plplot-5.10.0+dfsg/ 775 1750 1750 012406243603 126525ustar andrewandrewplplot-5.10.0+dfsg/lib/ 775 1750 1750 012406243566 134305ustar andrewandrewplplot-5.10.0+dfsg/lib/nistcd/ 775 1750 1750 012406243566 147145ustar andrewandrewplplot-5.10.0+dfsg/lib/nistcd/cdmulti.cgm 644 1750 1750 100211155124466 171110ustar andrewandrew4cd: CgmDraw Library"_gf'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'!f TIMES_ROMAN TIMES_BOLD TIMES_ITALICTIMES_BOLD_ITALIC HELVETICAHELVETICA_BOLDHELVETICA_ITALICHELVETICA_BOLD_ITALICCOURIER COURIER_BOLDCOURIER_ITALICCOURIER_BOLD_ITALICj picture 1 B TDTDTDQBQ@d Hello Worldj picture 2 B TDTDTDQBQ@d Goodbye World@plplot-5.10.0+dfsg/lib/nistcd/cd.h 644 1750 1750 2450311460615444 155520ustar andrewandrew#ifndef CD_H #define CD_H 1 // cd.h: declarations file for the cgmdraw module. // // Written by G. Edward Johnson // Date: April 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // Portions of this package are from the gd package written by // Thomas Boutell and are copyright 1994, 1995, Quest Protein // Database Center, Cold Spring Harbor Labs. They are marked in the // source code. // // // #include // stdio is needed for file I/O. #include #include "cddll.h" // This can not be changed to a value larger than 256, though smaller // values can be used. // #define cdMaxColors 256 // If you know you will be working with large pictures, increase the values // of the next two constants. // // The initial size of the element list. When it fills up, we will just // make it bigger. Starting with a larger number reduces the frequency of // the list growing, but increases the memory needed for small pictures // #define CDSTARTLISTSIZE 4096 // How much the element list grows by. When the list fills up, we allocate // a new larger list. This number is how much larger. using a larger number // decreases the frequency of the list growing, but if only a small amount // more is needed, it could waste memory // #define CDGROWLISTSIZE 2048 // Image type. See functions below; you will not need to change // the elements directly. Use the provided macros to // access sx, sy, the color table, and colorsTotal for // read-only purposes. #if defined ( __cplusplus ) || defined ( c_plusplus ) extern "C" { #endif typedef struct cdImageStruct { // Don't mess with these unsigned char * elemlist; short int state; int red[cdMaxColors]; int green[cdMaxColors]; int blue[cdMaxColors]; int open[cdMaxColors]; int colorsTotal; // You can have multiple pictures in the file, this keeps track // of which one you are on int picnum; // these take effect only when the first picture is created. // subsequent changes have no effect unsigned char *desc; unsigned char *fontlist; short int numfonts; FILE *outfile; // these take effect when a new picture is opened. Subsequent // changes are for the next picture int linespec; int edgespec; int markerspec; int sx; int sy; // these take effect immediately // Linetype, line width, line color have a broader scope in CGM int ltype; int lwidth; int lcolor; // interior style [of filled objects] (for me) can be empty, hollow, // solid, hatch [don't do pattern, geometric pattern, interpolated int shapestyle; // fill color, color used on inside of closed objects, significant // if interior style is hollow, solid, hatch, or geometric pattern int shapecolor; // hatch index, which hatch style to use, 1=horizontal, 2=vertical, // 3=pos.slope, 4=neg.slope, 5=hor/vert.crosshatch, // 6=pos/neg.crosshatch int shapehatch; // The edges of filled shapes can have line styles too. They // correspond to the ones for lines. These next few set them. int edgetype; int edgewidth; int edgecolor; int edgevis; // is the edge visible or invisible // now for the TEXT related attributes, Text Color, Text Height, // and Text font index int textfont; int textcolor; int textheight; int textpath; // Marker type, Marker size, marker color int mtype; int msize; int mcolor; // the next three are used for maintaining the element list long int bytestoend; // number of bytes to end of the element list long int listlen; // the total length of the element list unsigned char * curelemlist; // where we curently are in the list } cdImage; typedef cdImage * cdImagePtr; // Point type for use in polygon drawing. typedef struct cdPointStruct { int x, y, e; } cdPoint, *cdPointPtr; // Functions to manipulate images. CDDLLIMPEXP cdImagePtr cdImageCreate( int sx, int sy ); CDDLLIMPEXP int cdCgmNewPic( cdImagePtr im, int sticky ); CDDLLIMPEXP int cdImageCgm( cdImagePtr im, FILE * ); CDDLLIMPEXP int cdImageDestroy( cdImagePtr im ); // Use cdLine, not cdImageLine CDDLLIMPEXP int cdLine( cdImagePtr im, int x1, int y1, int x2, int y2 ); // Corners specified (not width and height). Upper left first, lower right // second. CDDLLIMPEXP int cdRectangle( cdImagePtr im, int x1, int y1, int x2, int y2 ); // center x, then center y, then radius of circle CDDLLIMPEXP int cdCircle( cdImagePtr im, int cx, int cy, int r ); // start, middle and end of arc CDDLLIMPEXP int cdArc3Pt( cdImagePtr im, int sx, int sy, int ix, int iy, int ex, int ey ); // cl is 0 for pie closure, 1 for cord closure CDDLLIMPEXP int cdArc3PtClose( cdImagePtr im, int sx, int sy, int ix, int iy, int ex, int ey, int cl ); CDDLLIMPEXP int cdEllipse( cdImagePtr im, int cx, int cy, int d1x, int d1y, int d2x, int d2y ); CDDLLIMPEXP int cdMarker( cdImagePtr im, int x, int y ); // polyshapes CDDLLIMPEXP int cdPolygon( cdImagePtr im, cdPointPtr p, int n ); CDDLLIMPEXP int cdPolygonSet( cdImagePtr im, cdPointPtr p, int n ); CDDLLIMPEXP int cdPolyLine( cdImagePtr im, cdPointPtr p, int n ); CDDLLIMPEXP int cdPolyMarker( cdImagePtr im, cdPointPtr p, int n ); // Functions for Compatibility with gd CDDLLIMPEXP int cdImageLine( cdImagePtr im, int x1, int y1, int x2, int y2, int color ); CDDLLIMPEXP int cdImageRectangle( cdImagePtr im, int x1, int y1, int x2, int y2, int color ); CDDLLIMPEXP int cdImageBoundsSafe( cdImagePtr im, int x, int y ); // These put characters in the picture. CGM can handle fonts // (x,y) is the lower left corner of where the text goes CDDLLIMPEXP int cdText( cdImagePtr im, int x, int y, const char * ); // Functions for allocating colors CDDLLIMPEXP int cdImageColorAllocate( cdImagePtr im, int r, int g, int b ); CDDLLIMPEXP int cdImageColorClosest( cdImagePtr im, int r, int g, int b ); CDDLLIMPEXP int cdImageColorExact( cdImagePtr im, int r, int g, int b ); CDDLLIMPEXP int cdImageColorDeallocate( cdImagePtr /* im */, int /* color */ ); // wogl: the parameter names are commented to avoid compiler warnings CDDLLIMPEXP int cdImageColor16( cdImagePtr im ); // gej: functions that set style attributes CDDLLIMPEXP int cdSetLineAttrib( cdImagePtr im, int lntype, int lnwidth, int lncolor ); CDDLLIMPEXP int cdSetShapeFillAttrib( cdImagePtr im, int instyle, int incolor, int inhatch ); CDDLLIMPEXP int cdSetShapeEdgeAttrib( cdImagePtr im, int edtype, int edwidth, int edcolor, int edvis ); CDDLLIMPEXP int cdSetTextAttrib( cdImagePtr im, int font, int color, int height ); CDDLLIMPEXP int cdSetMarkerAttrib( cdImagePtr im, int mtype, int msize, int mcolor ); // gej: or if you prefer, set the attributes individually CDDLLIMPEXP int cdSetLineType( cdImagePtr im, int lntype ); CDDLLIMPEXP int cdSetLineWidth( cdImagePtr im, int lnwidth ); CDDLLIMPEXP int cdSetLineColor( cdImagePtr im, int lncolor ); CDDLLIMPEXP int cdSetFillStyle( cdImagePtr im, int instyle ); CDDLLIMPEXP int cdSetFillColor( cdImagePtr im, int incolor ); CDDLLIMPEXP int cdSetFillHatch( cdImagePtr im, int inhatch ); CDDLLIMPEXP int cdSetEdgeType( cdImagePtr im, int edtype ); CDDLLIMPEXP int cdSetEdgeWidth( cdImagePtr im, int edwidth ); CDDLLIMPEXP int cdSetEdgeColor( cdImagePtr im, int edcolor ); CDDLLIMPEXP int cdSetEdgeVis( cdImagePtr im, int edvis ); CDDLLIMPEXP int cdSetTextFont( cdImagePtr im, int font ); CDDLLIMPEXP int cdSetTextColor( cdImagePtr im, int color ); CDDLLIMPEXP int cdSetTextHeight( cdImagePtr im, int height ); // geJ: these individual attributes can't be set with a group function CDDLLIMPEXP int cdSetTextPath( cdImagePtr im, int tpath ); CDDLLIMPEXP int cdSetTextOrient( cdImagePtr im, int xup, int yup, int xbase, int ybase ); CDDLLIMPEXP int cdSetMarkerType( cdImagePtr im, int mtype ); CDDLLIMPEXP int cdSetMarkerSize( cdImagePtr im, int msize ); CDDLLIMPEXP int cdSetMarkerColor( cdImagePtr im, int mcolor ); // EJ: Expert Functions, If you just need more control CDDLLIMPEXP int cdImageSetSize( cdImagePtr im, int x, int y ); CDDLLIMPEXP int cdImageSetLineSpec( cdImagePtr im, int specmode ); CDDLLIMPEXP int cdImageSetMarkerSpec( cdImagePtr im, int specmode ); CDDLLIMPEXP int cdImageSetEdgeSpec( cdImagePtr im, int specmode ); CDDLLIMPEXP int cdImageSetOutput( cdImagePtr im, FILE *output ); CDDLLIMPEXP int cdImageAddFont( cdImagePtr im, const char *fontname ); CDDLLIMPEXP int cdImageClearFonts( cdImagePtr im ); CDDLLIMPEXP cdImagePtr cdImageStartCgm(); CDDLLIMPEXP int cdCgmHeader( cdImagePtr ); CDDLLIMPEXP int cdCgmPic( cdImagePtr, int ); CDDLLIMPEXP int cdImageSetDefaults( cdImagePtr im ); CDDLLIMPEXP int cdImageEndPic( cdImagePtr im ); CDDLLIMPEXP int cdImageEndCgm( cdImagePtr im ); // Macros to access information about images. READ ONLY. Changing // these values will NOT have the desired result. #define cdImageSX( im ) ( ( im )->sx ) #define cdImageSY( im ) ( ( im )->sy ) #define cdImageColorsTotal( im ) ( ( im )->colorsTotal ) #define cdImageRed( im, c ) ( ( im )->red[( c )] ) #define cdImageGreen( im, c ) ( ( im )->green[( c )] ) #define cdImageBlue( im, c ) ( ( im )->blue[( c )] ) // Source: Independent JPEG Group // In ANSI C, and indeed any rational implementation, size_t is also the // type returned by sizeof(). However, it seems there are some irrational // implementations out there, in which sizeof() returns an int even though // size_t is defined as long or unsigned long. To ensure consistent results // we always use this SIZEOF() macro in place of using sizeof() directly. // #define SIZEOF( object ) ( (size_t) sizeof ( object ) ) // GeJ: these are helper functions I use in cd. That means DON'T call // them from your program. Yes, that means you. CDDLLIMPEXP int cdImageColorClear( cdImagePtr im ); #if defined ( __cplusplus ) || defined ( c_plusplus ) } #endif #endif plplot-5.10.0+dfsg/lib/nistcd/cdexp1.cgm 644 1750 1750 71611155124466 166270ustar andrewandrew4cd: CgmDraw Library"_gf'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'!f TIMES_ROMANj picture 1 B b TDTDTDRSbSSSQPbPPQAh ^^@(,dd@dE@dw@dd Hello Worldj picture 2 B TJPdRSbSSSQAh ^^@(,dd@hEw@dd Hello World@plplot-5.10.0+dfsg/lib/nistcd/cdtext.c 644 1750 1750 1113711460615444 164510ustar andrewandrew// // cdtext is an example program that uses the text attribute commands // cdSetTextPath and cdSetTextOrient // // // cdtext.c: test program for the cgmdraw module. // // Written by G. Edward Johnson // Date: May 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // #include #include #include #include #include "defines.h" #include "cd.h" int main() { // you must create a pointer to the image(s) that you will be using // not suprisingly, it is of type cdImagePtr cdImagePtr im; // this is a pointer to the output file you will be using FILE *outf; // these will be index's into the color palette containing // the corresponding colors int black, white, blue; // Create an image 800 pixels wide by 400 pixels high im = cdImageCreate( 800, 400 ); // allocate some colors (isn't this fun?) // the first color allocated is the background color white = cdImageColorAllocate( im, 255, 255, 255 ); black = cdImageColorAllocate( im, 0, 0, 0 ); blue = cdImageColorAllocate( im, 0, 0, 255 ); // set the text attributes // font, colorindex, and size respectivily // font is the style the text is written in. 1 is for Times, // 5 is for Helvetica. // we will have black text for this one // Size is a tough one, but larger numbers give larger text. // if ( !( cdSetTextAttrib( im, 5, black, 20 ) ) ) return 1; // Set some line attributes, lets make lines solid, width 1, and blue // if ( !( cdSetLineAttrib( im, 1, 1, blue ) ) ) return 1; // Draw a couple of grid lines if ( !( cdLine( im, 0, 200, 799, 200 ) ) ) return 1; if ( !( cdLine( im, 200, 0, 200, 399 ) ) ) return 1; if ( !( cdLine( im, 600, 0, 600, 399 ) ) ) return 1; // Show Text going left, up, down, and right, all starting // from the same point // Text going to the left if ( !( cdSetTextPath( im, 1 ) ) ) return 1; if ( !( cdText( im, 200, 200, "Text Left" ) ) ) return 1; // Text going UP if ( !( cdSetTextPath( im, 2 ) ) ) return 1; if ( !( cdText( im, 200, 200, "Text Up" ) ) ) return 1; // Text going DOWN if ( !( cdSetTextPath( im, 3 ) ) ) return 1; if ( !( cdText( im, 200, 200, "Text Down" ) ) ) return 1; // Text going to the RIGHT if ( !( cdSetTextPath( im, 0 ) ) ) return 1; if ( !( cdText( im, 200, 200, "Text Right" ) ) ) return 1; // Show text going at an angle of 0, 45, 90, 135, 180 Degrees // // Text at no angle if ( !( cdText( im, 600, 200, "CGM Draw" ) ) ) return 1; // Text, 45 Degree Angle if ( !( cdSetTextOrient( im, -1, 1, 1, 1 ) ) ) return 1; if ( !( cdText( im, 600, 200, "CGM Draw" ) ) ) return 1; // Text, 90 Degree Angle if ( !( cdSetTextOrient( im, -1, 0, 0, 1 ) ) ) return 1; if ( !( cdText( im, 600, 200, "CGM Draw" ) ) ) return 1; // Text, 135 Degree Angle if ( !( cdSetTextOrient( im, -1, -1, -1, 1 ) ) ) return 1; if ( !( cdText( im, 600, 200, "CGM Draw" ) ) ) return 1; // Text, 180 Degree Angle if ( !( cdSetTextOrient( im, 0, -1, -1, 0 ) ) ) return 1; if ( !( cdText( im, 600, 200, "CGM Draw" ) ) ) return 1; // Skewed Text, No Angle if ( !( cdSetTextOrient( im, 1, 1, 1, 0 ) ) ) { return 1; } if ( !( cdSetTextAttrib( im, -1, -1, 40 ) ) ) { return 1; } if ( !( cdText( im, 300, 300, "CGM Draw" ) ) ) { return 1; } // show some lines around it if ( !( cdLine( im, 300, 300, 500, 300 ) ) ) return 1; if ( !( cdLine( im, 300, 300, 340, 340 ) ) ) return 1; // reset the text to 0 angle if ( !( cdSetTextOrient( im, 0, 1, 1, 0 ) ) ) return 1; if ( !( cdSetTextAttrib( im, 5, -1, 20 ) ) ) return 1; if ( !( cdText( im, 5, 5, "G. Edward Johnson" ) ) ) return 1; // now write the file out, lets call it cdtext.cgm outf = fopen( "cdtext.cgm", "wb" ); if ( !outf ) return 1; cdImageCgm( im, outf ); fclose( outf ); outf = 0; // Remember to destroy the image when you are done cdImageDestroy( im ); im = 0; printf( "CGM Text Example!!!\n" ); return 0; } plplot-5.10.0+dfsg/lib/nistcd/CMakeLists.txt 644 1750 1750 1272511202115437 175450ustar andrewandrew# lib/nistcd/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # build nistcd library (a.k.a., "cd" library put into the public domain by # NIST) required by the PLplot cgm device. if(PLD_cgm) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) set( cd_LIB_SRCS cd.c ) set( cd_LIB_HDRS cd.h defines.h ) # Bypass "#include " in all code where it appears since # being too specific like this fails on some platforms (e.g., OS X), and # the proper form of the malloc.h include should be dragged in by # ""#include stdlib.h" in any case. # There may be some arcane platforms where we should not define this, # but for now, at least, try it for all platforms. set( cd_ADD_DEFINES "-DNOMALLOCH" ) if(BUILD_SHARED_LIBS) set_source_files_properties( ${cd_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL ${cd_ADD_DEFINES}" ) endif(BUILD_SHARED_LIBS) add_library( nistcd ${cd_LIB_SRCS} ) set_target_properties( nistcd PROPERTIES SOVERSION ${nistcd_SOVERSION} VERSION ${nistcd_VERSION} INSTALL_NAME_DIR "${LIB_DIR}" ) option(TEST_NISTCD "Test libnistcd" ON) if(TEST_NISTCD AND NOT CMAKE_CROSSCOMPILING) # build applications to test libnistcd. set( cd_EXE cdexpert cdmulti cdsimple cdtest cdtext color16 ) foreach(EXE ${cd_EXE}) add_executable( ${EXE} ${EXE}.c ) set_source_files_properties( ${EXE}.c PROPERTIES COMPILE_FLAGS "${cd_ADD_DEFINES}" ) target_link_libraries( ${EXE} nistcd ) get_target_property(${EXE}_LOC ${EXE} LOCATION) endforeach(EXE ${cd_EXE}) # Create tests for libnistcd. file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdexp1.cgm COMMAND ${cdexpert_LOC} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdexp1.cgm ${CMAKE_CURRENT_SOURCE_DIR}/cdexp1.cgm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir DEPENDS ${cdexpert_LOC} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdmulti.cgm COMMAND ${cdmulti_LOC} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdmulti.cgm ${CMAKE_CURRENT_SOURCE_DIR}/cdmulti.cgm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir DEPENDS ${cdmulti_LOC} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdsimple.cgm COMMAND ${cdsimple_LOC} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdsimple.cgm ${CMAKE_CURRENT_SOURCE_DIR}/cdsimple.cgm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir DEPENDS ${cdsimple_LOC} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdout.cgm COMMAND ${cdtest_LOC} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdout.cgm ${CMAKE_CURRENT_SOURCE_DIR}/cdout.cgm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir DEPENDS ${cdtest_LOC} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdtext.cgm COMMAND ${cdtext_LOC} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdtext.cgm ${CMAKE_CURRENT_SOURCE_DIR}/cdtext.cgm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir DEPENDS ${cdtext_LOC} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/color16.cgm COMMAND ${color16_LOC} COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/color16.cgm ${CMAKE_CURRENT_SOURCE_DIR}/color16.cgm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir DEPENDS ${color16_LOC} ) add_custom_target(test_nistcd ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdexp1.cgm ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdmulti.cgm ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdsimple.cgm ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdout.cgm ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/cdtext.cgm ${CMAKE_CURRENT_BINARY_DIR}/test_nistcd_dir/color16.cgm ) endif(TEST_NISTCD AND NOT CMAKE_CROSSCOMPILING) # install library and binaries install(TARGETS nistcd EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) # install library header files. install( FILES ${cd_LIB_HDRS} DESTINATION ${INCLUDE_DIR} ) endif(PLD_cgm) plplot-5.10.0+dfsg/lib/nistcd/cdtext.cgm 644 1750 1750 145411155124466 167560ustar andrewandrew4cd: CgmDraw Library"_gf'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'!f TIMES_ROMAN TIMES_BOLD TIMES_ITALICTIMES_BOLD_ITALIC HELVETICAHELVETICA_BOLDHELVETICA_ITALICHELVETICA_BOLD_ITALICCOURIER COURIER_BOLDCOURIER_ITALICCOURIER_BOLD_ITALICj picture 1 B  TDTDTDQBQPdP@(@(@(XXR"@ Text LeftR"@Text UpR"@ Text DownR"@ Text Right@XCGM DrawR@XCGM DrawR@XCGM DrawR@XCGM DrawR@XCGM DrawRQ(@,,CGM Draw@(,,,@(,,TTRQ@G. Edward Johnson@plplot-5.10.0+dfsg/lib/nistcd/cdout.cgm 644 1750 1750 174611155124466 166050ustar andrewandrew4cd: CgmDraw Library"_gf'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'!f TIMES_ROMAN TIMES_BOLD TIMES_ITALICTIMES_BOLD_ITALIC HELVETICAHELVETICA_BOLDHELVETICA_ITALICHELVETICA_BOLD_ITALICCOURIER COURIER_BOLDCOURIER_ITALICCOURIER_BOLD_ITALICj picture 1 B TDTDTDTDTDPP@(P@(22PBPd@(22RRSSSSAhddPBPdP@(dXXPB@(dqqPB@(dPB@(dPB@(dRSAA&XX&A&X,SB, ,@@, 9RkRRk R99SA$^?^?X^^PdP@(@0 9RkPPQ@dPPQ@h/TDfQQ2@2 CGM Draw Version 1.3R"@2 CGM DrawRR"@CGM DrawRQBQ@G. Edward Johnson@plplot-5.10.0+dfsg/lib/nistcd/cdexpert.c 644 1750 1750 1162011460615444 167710ustar andrewandrew// // cdexpert highlights the expert functions in CD. You probably // don't want to use these unless you have to. // // // cdexpert.c: test program for the cgmdraw module. // // Written by G. Edward Johnson // Date: January 1997 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // #include #include #include #include #include "defines.h" #include "cd.h" #define CD_CHECK_RETURN( x ) \ if ( !( x ) ) \ { \ cdImageDestroy( im ); \ fclose( outf ); \ return 1; \ } int main() { // you must create a pointer to the image(s) that you will be using // not suprisingly, it is of type cdImagePtr cdImagePtr im; cdPoint points[2]; // this is a pointer to the output file you will be using FILE *outf; // these will be index's into the color palette containing // the corresponding colors int black, white, blue; // Create an image im = cdImageStartCgm(); // now open the file lets call it cdexpert1.cgm outf = fopen( "cdexp1.cgm", "wb" ); if ( !outf ) { cdImageDestroy( im ); return 1; } // set its size to 500x500 CD_CHECK_RETURN( cdImageSetSize( im, 500, 500 ) ); // set Line, Marker, and Edge specification modes to absolute (0) // the default is scaled (1) CD_CHECK_RETURN( cdImageSetLineSpec( im, 0 ) ); CD_CHECK_RETURN( cdImageSetMarkerSpec( im, 0 ) ); CD_CHECK_RETURN( cdImageSetEdgeSpec( im, 0 ) ); // Clear the font list, then set it to just contain 1 font CD_CHECK_RETURN( cdImageClearFonts( im ) ); CD_CHECK_RETURN( cdImageAddFont( im, "TIMES_ROMAN" ) ); // start the picture CD_CHECK_RETURN( cdCgmHeader( im ) ); CD_CHECK_RETURN( cdCgmPic( im, 2 ) ); // allocate some colors (isn't this fun?) // the first color allocated is the background color white = cdImageColorAllocate( im, 255, 255, 255 ); black = cdImageColorAllocate( im, 0, 0, 0 ); blue = cdImageColorAllocate( im, 0, 0, 255 ); // fill attributes: Empty CD_CHECK_RETURN( cdSetShapeFillAttrib( im, 4, -1, -1 ) ); // Edge attributes: dots, width 3, blue, visible edges. CD_CHECK_RETURN( cdSetShapeEdgeAttrib( im, 2, 3, blue, 1 ) ); // Text attributes: Times, black, size 25 CD_CHECK_RETURN( cdSetTextAttrib( im, 1, black, 25 ) ); // Line attributes: Solid Black Line of Width 5 CD_CHECK_RETURN( cdSetLineAttrib( im, 1, 5, black ) ); // Marker attributes: style pluses, size 3, black CD_CHECK_RETURN( cdSetMarkerAttrib( im, 2, 3, black ) ); // Now that we have set some attributes, lets do some drawing // Draw a rectangle (10,450) is upper left, (350,350) is lower right CD_CHECK_RETURN( cdRectangle( im, 10, 450, 350, 350 ) ); // Draw a line (300,100) to (400,100) CD_CHECK_RETURN( cdLine( im, 300, 100, 400, 100 ) ); // Add Two markers CD_CHECK_RETURN( cdMarker( im, 325, 150 ) ); CD_CHECK_RETURN( cdMarker( im, 375, 150 ) ); // lets put some text in the picture too. // (100,100) is the point at the lower left corner of the text CD_CHECK_RETURN( cdText( im, 100, 100, "Hello World" ) ); // we could just finish off the CGM here with a // cdImageCgm(im, outf), but lets put another picture in. // close the picture CD_CHECK_RETURN( cdImageEndPic( im ) ); // set the specifications modes back to the default CD_CHECK_RETURN( cdImageSetLineSpec( im, 1 ) ); CD_CHECK_RETURN( cdImageSetMarkerSpec( im, 1 ) ); CD_CHECK_RETURN( cdImageSetEdgeSpec( im, 1 ) ); // start a new picture, keeping all the changes we made, including // the color table CD_CHECK_RETURN( cdCgmPic( im, 1 ) ); // draw the same image again, notice the Specification modes are // different // Draw a rectangle (10,450) is upper left, (350,350) is lower right CD_CHECK_RETURN( cdRectangle( im, 10, 450, 350, 350 ) ); // Draw a line (300,100) to (400,100) CD_CHECK_RETURN( cdLine( im, 300, 100, 400, 100 ) ); // Add Two markers // we are doing the markers a little bit differently this time points[0].x = 325; points[0].y = 150; points[1].x = 375; points[1].y = 150; CD_CHECK_RETURN( cdPolyMarker( im, points, 2 ) ); // lets put some text in the picture too. // (100,100) is the point at the lower left corner of the text CD_CHECK_RETURN( cdText( im, 100, 100, "Hello World" ) ); cdImageCgm( im, outf ); fclose( outf ); outf = 0; // Remember to destroy the image when you are done cdImageDestroy( im ); im = 0; printf( "I am a CGM expert!!!\n" ); return 0; } plplot-5.10.0+dfsg/lib/nistcd/cd.html 644 1750 1750 20365711155124466 163200ustar andrewandrew CD -- CGM Draw Documentation

CD Documentation

A graphics library for fast CGM creation

Follow this link for the latest version of the CD documentation.

Table of Contents

Credits and license terms

cd was written by G. Edward Johnson at the National Institute of Standards and Technology. You may use this code for any purpose, but please give us credit. If find cd useful, please let us know. cd software produced by NIST, an agency of the U.S. government, is by statute not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.

Some of this code is from the gd (GifDraw) library written by Thomas Boutell. Mr. Boutell did not help with this project, so do not send him questions about cd. Code from gd is clearly marked in the source. Additionally, this document is patterned after the gd documentation, some portions have been copied verbatim. gd is covered by the following license.

gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. Permission granted to copy and distribute this work provided that this notice remains intact. Credit for the library must be given to the Quest Protein Database Center, Cold Spring Harbor Labs, in all derived works. This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for Quest, not to interfere with your use of gd. If you have questions, ask. ("Derived works" includes all programs that utilize the library. Credit must be given in user-visible documentation.)

The Quest Protein Database Center is funded under Grant P41-RR02188 by the National Institutes of Health.

What's new?

Version 1.3

  • Polygon Sets. Now you can define multiple polygons and draw them all with one simple command. This required a small change to cdPoint but it is backward compatable (unless you've been taking some not-portable shortcuts.)
  • Markers. Markers allow you to set a point in the CGM file. Depending on what attributes you set, it may appear as a point, plus, astrisk, circle, or cross, in any color and size.
  • Expert Functions. I added a bunch of new "expert" functions that give you more control over creating your CGM's. These unfortunatly add a lot of complexity to your program, so I don't recomment you use them unless you have to.
  • New Font. Several people requested that I add a fixed width font. Courier, Courier Bold, Courier Italic, Courier Bold Italic now occupy positions 9-12 respectively in the font list. I also changed the names of fonts so they would match mil-std-2301 which should give a better chance of the fonts being displayed correctly. (Except, I kept Helvetica with italic, not oblique because FIGleaf got confused.)
  • New example program, cdexpert shows the use of the expert functions.
  • changed the way many functions operate. These changes shouldn't have any effect on existing programs.
  • Makefile for OpenVMS provided by David Mathog (mathog@seqaxp.bio.caltech.edu)

Version 1.2

  • New Text attributes:
    • cdSetTextPath sets the text direction as right, left, up, or down
    • cdSetTextOrient sets the angle of the text
  • Multiple pictures in a file. Now you can put more than one picture in a cgm file, see cdCgmNewPic for details.
  • Internal changes like using short int's in some places so it may take less space in memory when using 16 or 64 bit compilers.
  • New example programs.
    • cdtext to show the new text attributes.
    • cdmulti to show the multiple picture capability.

Version 1.1

Thanks to Wolfgang Glunz (Wolfgang.Glunz@mchp.siemens.de) who purified it, pointed out some bugs and did the Borland makefile.

  • Switched from using malloc to calloc most cases, solving an off by one error in a function I then eliminated.
  • Added a Makefile for Borland Turbo C++
  • Fixed a couple of spelling errors, cleared out some dead code, and some other trivial things.
  • Added a new example program cdsimple which walks you through some basics.
  • Added a new function cdPolyLine for when you want lines with more than two points

Version 1.0

Basically, everything is new, this is the first release.

What is cd?

cd is a graphics library. It allows your code to quickly draw images complete with lines, arcs, rectangles, polygons, text, and multiple colors. most geometric shapes can be filled or have a hatch pattern as well. The output is a CGM file. If you are unsure of what CGM is, or if CGM is appropriate for your project, see the NIST CGM Homepage.

Every effort has been made to ensure that the generated cgm files conform to the standard, however, if you do not use the library properly, you could generate invalid metafiles that no one is able to read, so be careful.

What else do I need to use cd?

To use cd, you will need an ANSI C compiler. Any full-ANSI-standard C compiler should be adequate, although those with PCs will need to replace the Makefile with one of their own. The cc compiler released with SunOS 4.1.3 is not an ANSI C compiler. Get gcc, which is freely available. See the Sun-related newsgroups for more information.

You will also want a CGM viewer, if you do not already have one for your system, since you will need a good way to check the results of your work.

How do I get cd?

You can fetch cd as a gzip'ed tar file, or you can FTP it directly from zing.ncsl.nist.gov in the subdirectory cgm.

How do I build cd?

Note: if you have a non-Unix system, you will need to acquire versions of "gunzip" and "tar" suitable for your system. Both have been ported to PC and Mac environments. Consult newsgroups relevant to your particular system.

gunzip cd1.3.tar.gz
tar -xf cd1.3.tar
This will create the directory "cd1.3" beneath the current directory.

change to this directory and examine the Makefile, which you may need to change slightly depending on your installation (or more than slightly for a Windows or Mac environment). On UNIX systems the command "make all" will create the cd library and three example programs, cdsimple, cdtest, and color16. If you are using Borland Turbo C++ version 3 (or later I hope) try to make it using makefile.bor

CGM files are always in Network Byte order, Big-Endian systems use this ordering. I wrote this on a Big-Endian machine, but it seems to work on Little-Endian's as well. Cd has been tested on Solaris 2, SunOs 4, Ultrix, Linux, IRIX, OpenVMS, and DOS (Borland). If you get it to run on other systems, drop me a note.

cd basics: using cd in your program

cd lets you create CGM images on the fly. To use cd in your program, include the file cd.h, and link with the libcd.a library produced by "make libcd.a", under Unix. You will need to adapt the makefile for your needs if you are using a non-Unix operating system, but this is very straightforward.

Look at the example programs included in this distribution for examples of using cd. The programs are cdsimple which is a heavily commented program that makes a small cgm. cdtest which makes a cgm with every different kind of shape you can use. It has lines, circles, arcs, ellipses, rectangles, polygons, and text as well as examples for setting the attributes for them. So look at it closely, it is your friend. The other example program, color16 allocates 16 colors using cdImageColor16 (these are the 16 standard Windows colors). Than it draws a rectangle with each of them. These programs are created automatically when you "make all".

Function and Type reference

Types

cdImage (Type)

The data structure in which cd stores images. cdImageCreate returns a pointer to this type, and other functions expect to receive a pointer to this type as the first argument.

cdImagePtr (Type)

A pointer to an image structure. cdImageCreate returns this type, and the other functions expect it as the first argument. you may read the members sx (size of x axis), sy (size of y axis), colorsTotal (total colors allocated), red (red component of colors; an array of 256 integers between 0 and 255), green (green commponent of colors), and blue (blue component of colors). Please do so using the macros provided. Do Not set the members directly from your code, use the functions provided.

cdPoint (Type)

Represents a collection of points in the coordinate space of the image; used by cdPolygon by cdPolygonSet by cdPolyLine and by cdPolyMarker.

cdPointPtr is defined in cd.h, basically, it is an array of integer triples p[m].x and p[m].y containing the x and y values respectively and p[m].e containing the closure and edge visiblity flags. p[m].e is only used for cdPolygonSet. pcnt is the number of points in this array (not the index of the last point, which is pcnt-1). pcnt must be at least 3 for polygons, 2 for polylines, or 1 for polymarkers.

Declare it with cdPoint points[pcnt] where pcnt is the upper limit of the number of points you wish to have. then fill it in with points[0].x = x0; points[0].y = y0; and the like.

p[m].e is used for cdPolygonSet. For other functions, p[m].e is ignored. Its value determines the visibility of the edge leaving that point. It is an integer with one of the following values:

  • 0 for and invisible edge
  • 1 for a visible edge
  • 2 for and invisible edge which is the last one in the polygon
  • 3 for a visible edge which is the last one in the polygon

cdPointPtr (Type)

A pointer to a cdPoint structure; passed as an argument to cdPolygon to cdPolygonSet to to cdPolyLine and to cdPolyMarker.

Image creation, destruction, and saving

cdImageCreate(int sx, int sy) (Function)

cdImageCreate is called to create images. Invoke cdImageCreate with the x and y dimensions of the desired image. cdImageCreate returns a cdImagePtr to the new image, or NULL if unable to allocate the image. The image must eventually be destroyed using cdImageDestroy

cdImageDestroy(cdImagePtr im) (Function)

cdImageDestroy is used to free the memory associated with and image. It is important to invoke cdImageDestroy before exiting your program or assigning a new image to a cdImagePtr variable.

cdCgmNewPic(cdImagePtr im, int sticky) (Function)

cdCgmNewPic allows for a single CGM file to contain multiple pictures. If sticky is 0 then all attributes will be reset to their default condition and the color table will be cleared. If sticky is 1 then all attributes and the color table will be carried over to the new picture. NOTE: as of now (version 1.2) the only allowable value for sticky is 0. If you set it to 1, the function will fail.

cdImageCgm(cdImagePtr im, FILE *out) (Function)

cdImageCgm outputs the specified image to the specified file in the CGM image format. The file must be open for writing. Under MSDOS, it is important to use "wb" as opposed to simply "w" as the mode when opening the file, and under UNIX there is no penalty for doing so. cdImageCgm does not close the file, your code must do that.

Drawing Functions

int cdLine(cdImagePtr im, int x1, int y1, int x2, int y2) (Function)
Graphic Primitive: Polyline; Elem Class 4; Elem ID 1
Returns 1 for success, 0 for failure. cdLine is used to draw a line between two endpoints (x1,y1) and (x2,y2) This line is drawn using the attributes set by cdSetLineAttrib The attributes that may be set are Line Type, Line Width, or Line Color. The endpoints must be within the bounds of the picture.
int cdPolyLine(cdImagePtr im, cdPointPtr p, int n) (Function)
Graphic Primitive: Polyline; Elem Class 4; Elem ID 1
Returns 1 for success, 0 for failure. cdPolyLine draws a line connecting all the points specified by cdPointPtr. n is the number of points in cdPointPtr, (not the index of the last point, which is n-1). This line is drawn using the attributes set by cdSetLineAttrib The attributes that may be set are Line Type, Line Width, or Line Color. Note that it uses line attributes not edge attributes for drawing the line. The endpoints must be within the bounds of the picture.

cdPointPtr is defined in cd.h, basically, it is two arrays of integers p[m].x and p[m].y containing the x and y values respectively. n is the number of points in this array (not the index of the last point, which is n-1). n must be at least 2 (otherwise you really don't have much of a line, it is closer to a point.)

int cdRectangle(cdImagePtr im, int x1, int y1, int x2, int y2) (Function)
Graphic Primitive: rectangle; Elem Class 4; Elem ID 11
Returns 1 for success, 0 for failure. cdRectangle draws a line which has (x1,y1) as the upper left corner and (x2,y2) as the lower right corner. This rectangle is drawn using the attributes set by cdSetShapeFillAttrib and by cdSetShapeEdgeAttrib. The fill attributes that may be set are Fill Style, Fill Color, or Fill Hatch. The edge attributes that may be set are Edge Type, Edge Width, Edge Color, or Edge Visibility. Note that it uses Edge attributes not line attributes for drawing the perimeter of the rectangle. The Rectangle must be within the bounds of the picture.
int cdCircle(cdImagePtr im, int cx, int cy, int r) (Function)
Graphic Primitive: circle; Elem Class 4; Elem ID 12
Returns 1 for success, 0 for failure. cdCircle draws a circle which has center (cx, cy) and radius r. This circle is drawn using the attributes set by cdSetShapeFillAttrib and by cdSetShapeEdgeAttrib. The fill attributes that may be set are Fill Style, Fill Color, or Fill Hatch. The edge attributes that may be set are Edge Type, Edge Width, Edge Color, or Edge Visibility. Note that it uses Edge attributes not line attributes for drawing the perimeter of the Circle. The Circle must be within the bounds of the picture.
int cdArc3Pt(cdImagePtr im, int sx, int sy, int ix, int iy, int ex, int ey) (Function)
Graphic Primitive: Cicular Arc 3 Point; Elem Class 4; Elem ID 13
Returns 1 for success, 0 for failure. cdArc3Pt draws an arc specified by the given points. (sx,sy) is the start of the arc, (ix,iy) is the middle of the arc, and (ex,ey) is the end of the arc. This arc is drawn using the attributes set by cdSetLineAttrib The attributes that may be set are Line Type, Line Width, or Line Color. Note that it uses Line attributesfor drawing the perimiter of the arc, not Edge attributes like cdArc3PtClose. The Arc must be within the bounds of the picture.
int cdArc3PtClose(cdImagePtr im, int sx, int sy, int ix, int iy, int ex, int ey, int cl) (Function)
Graphic Primitive: Cicular Arc 3 Point Close; Elem Class 4; Elem ID 14
Returns 1 for success, 0 for failure. cdArc3PtClose draws an arc specified by the given points. (sx,sy) is the start of the arc, (ix,iy) is the middle of the arc, and (ex,ey) is the end of the arc. The arc is closed base on cl. If cl is 0 then pie closure will be used, resulting in a pie shaped slice. if cl is 1 then cord closure will be used and a straight line will be drawn from one endpoint to the other. This arc is drawn using the attributes set by cdSetShapeFillAttrib and by cdSetShapeEdgeAttrib. The fill attributes that may be set are Fill Style, Fill Color, or Fill Hatch. The edge attributes that may be set are Edge Type, Edge Width, Edge Color, or Edge Visibility. Note that it uses Edge attributes for drawing the perimeter of the arc, not Line attributes like cdArc3Pt. The Arc must be within the bounds of the picture.
int cdEllipse(cdImagePtr im, int cx, int cy, int d1x, int d1y, int d2x, int d2y) (Function)
Graphic Primitive: Ellipse; Elem Class 4; Elem ID 17
Returns 1 for success, 0 for failure. cdEllipse draws an ellipse specified by the given points. (cx,cy) is the center, (d1x,d1y) is the endpoint of the first conjugate diameter, (d2x, d2y) is the endpoint of the second conjugate diameter. I can't really explain this one, if you come up with a good description, mail me. This ellipse is drawn using the attributes set by cdSetShapeFillAttrib and by cdSetShapeEdgeAttrib. The fill attributes that may be set are Fill Style, Fill Color, or Fill Hatch. The edge attributes that may be set are Edge Type, Edge Width, Edge Color, or Edge Visibility. Note that it uses Edge attributes not line attributes for drawing the perimeter of the Ellipse. The Ellipse must be within the bounds of the picture.
int cdPolygon(cdImagePtr im, cdPointPtr p, int n) (Function)
Graphic Primitive: Polygon; Elem Class 4; Elem ID 7
Returns 1 for success, 0 for failure. cdPolygon draws a closed polygon connecting the points specified by cdPointPtr. n is the number of points in cdPointPtr, (not the index of the last point, which is n-1). This polygon is drawn using the attributes set by cdSetShapeFillAttrib and by cdSetShapeEdgeAttrib. The fill attributes that may be set are Fill Style, Fill Color, or Fill Hatch. The edge attributes that may be set are Edge Type, Edge Width, Edge Color, or Edge Visibility. Note that it uses Edge attributes not line attributes for drawing the perimeter of the polygon. The polygon must be within the bounds of the picture.

cdPointPtr is defined in cd.h, basically, it is two arrays of integers p[m].x and p[m].y containing the x and y values respectively. n is the number of points in this array (not the index of the last point, which is n-1). n must be at least 3 (otherwise you really don't have much of a polygon, it is closer to a line.)

int cdPolygonSet(cdImagePtr im, cdPointPtr p, int n) (Function)
Graphic Primitive: Polygon; Elem Class 4; Elem ID 8
Returns 1 for success, 0 for failure. cdPolygon draws a set of closed polygons connecting the points specified by cdPointPtr. n is the number of points in cdPointPtr, (not the index of the last point, which is n-1). This polygon is drawn using the attributes set by cdSetShapeFillAttrib and by cdSetShapeEdgeAttrib. The fill attributes that may be set are Fill Style, Fill Color, or Fill Hatch. The edge attributes that may be set are Edge Type, Edge Width, Edge Color, or Edge Visibility. Note that it uses Edge attributes not line attributes for drawing the perimeter of the polygons. The polygons must be within the bounds of the picture.

You can draw several polygons with this command by the use of flags described in cdPoint.

A visible edge of a polygon will only be drawn if the current edge attribute is visible, however if the edge of the polygon is set to invisible and the current edge attribute is visible, it will not be drawn.

cdPointPtr is defined in cd.h, basically, it is three arrays of integers p[m].x and p[m].y containing the x and y values respectively and p[m].e containing the visibility of the edge leaving the point. See cdPoint for more details. n is the number of points in this array (not the index of the last point, which is n-1). n must be at least 3 (otherwise you really don't have much of a polygon, it is closer to a line.)

int cdMarker(cdImagePtr im, int x, int y) (Function)
Graphic Primitive: Polymarker; Elem Class 4; Elem ID 3
Returns 1 for success, 0 for failure. cdMarker draws a marker, at the point (x,Y) These markers are drawn using the attributes set by cdSetMarkerAttrib. The attributes that may be set are Marker Type, Marker Size, or Marker Color. Markers must be within the bounds of the picture.

Markers are point objects. They can be dots, pluses, astrisks, circles, or crosses. They generally take up less space than drawing them using other graphics elements.

int cdPolyMarker(cdImagePtr im, cdPointPtr p, int n) (Function)
Graphic Primitive: Polymarker; Elem Class 4; Elem ID 3
Returns 1 for success, 0 for failure. cdPolyMarker draws a set of markers, one for each point in cdPointPtr. n is the number of points in cdPointPtr, (not the index of the last point, which is n-1). These markers are drawn using the attributes set by cdSetMarkerAttrib. The attributes that may be set are Marker Type, Marker Size, or Marker Color. The markers must be within the bounds of the picture.

cdPointPtr is defined in cd.h, basically, it is three arrays of integers p[m].x and p[m].y containing the x and y values respectively and p[m].e containing the visibility of the edge leaving the point. See cdPoint for more details. n is the number of points in this array (not the index of the last point, which is n-1). n must be at least 1.

Font and text-handling functions

int cdSetTextAttrib(cdImagePtr im, int font, int color, int height) (Function)
Returns 1 for success, 0 for failure. cdSetTextAttrib sets the attributes for text elements. The Font functions are affected by this. These attributes stay in effect until they are changed, you don't have to call this function every time. If you call the function with a value of -1 for any of the attributes they will not be changed. If you call the function with the same value for an attribute as it already has, it will not be changed (so you don't have to worry about bloating your CGM with redundant attribute changes.) It calls three functions. cdSetTextFont to set the index into the font table, cdSetTextColor with color to set the forground color of the text, and cdSetTextHeight with height to set the height of the text. You may also call any of the three functions individually if you like.
int cdText(cdImagePtr im, int x, int y, const char *ts) (Function)
Graphic Primitive: Text; Elem Class 4; Elem ID 4
Returns 1 for success, 0 for failure. cdText puts a string of text ts starting at position (x,y) The Text is drawn using the attributes set with cdSetTextAttrib. The attributes that may be set are: cdSetTextFont, cdSetTextColor, or cdSetTextHeight. The point where the text starts must be within the bounds of the picture.
int cdSetTextPath(cdImagePtr im, int tpath) (Function)
Attribute: Text Path; Elem Class 5; Elem ID 17
Returns 1 for success, 0 for failure. sets the path of the text to tpath. tpath is an integer with one of the following values
  • 0 for right
  • 1 for left
  • 2 for up
  • 3 for down
These are all relative to the charater base vector and up vector. If you haven't changed them (with cdSetTextOrient then the direction of the text will be right to left for 0, left to right for 1, bottom to top for 2, and top to bottom for 3. Each individual letter will still be facing in the normal direction. If you want to rotate the text use cdSetTextOrient.

Things get more interesting if you use cdSetTextOrient with this function. A more exact definition of tpath is

  • 0 right -- the direction of the character base vector
  • 1 left -- 180 degrees from the direction of the character base vector
  • 2 up -- the direction of the character up vector
  • 3 down -- 180 degrees from the direction of the character up vector

int cdSetTextOrient(cdImagePtr im, int xup, int yup, int xbase, int ybase) (Function)
Attribute: Character Orientation; Elem Class 5; Elem ID 16
Returns 1 for success, 0 for failure. (xbase,ybase) is the run and the rise of the line that the text is written along. For regular text that is rotated, set xup = -ybase and yup = xbase. Setting it to something different will result in skewed text (which may be what you want.) Text written from bottom to top at a 90 degree angle would have the following parameters: xup=-1, yup=0, xbase=0, ybase=1. Text written from bottom to top at a 22.5 degree angle would have the following parameters: xup=-1, yup=2, xbase=2, ybase=1.

Skewed text can also be created with this function. (xup,yup) is the "Character Up Vector" which is the vertical line running from the bottom of the character to the top. The skew angle is computed independently of the (xbase,ybase) vector. If you change the Up vector, text will be skewed. (xup,yup) is the run and the rise of the up vector. Text written with a 45 degree skew would have the following parameters: xup=1, yup=1, xbase=1, ybase=0. Changing xup to 2, the skew angle becomes 22.5 degrees. You can, of course, have text that is both skewed and rotated by inserting the proper parameters.

This function adds the Orientation to the metafile every time. It does not interpert an attribute value of -1 as no change like many functions do.

int cdSetTextFont(cdImagePtr im, int font) (Function)
Attribute: Text Font Index; Elem Class 5; Elem ID 10
Returns 1 for success, 0 for failure. Sets the font index to font. It is an index into the font table, the possible values are:
  • 1 for Times
  • 2 for Times Bold
  • 3 for Times Italic
  • 4 for Times Bold Italic
  • 5 for Helvetica
  • 6 for Helvetica Bold
  • 7 for Helvetica Italic
  • 8 for Helvetica Bold Italic
  • 9 for Courier
  • 10 for Courier Bold
  • 11 for Courier Italic
  • 12 for Courier Bold Italic
font must be one of these values or the function will fail. See cdSetTextAttrib for more information on this and related functions.
int cdSetTextColor(cdImagePtr im, int color) (Function)
Attribute: Text Colour; Elem Class 5; Elem ID 14
Returns 1 for success, 0 for failure. Sets the foreground color of text to color. This should be an integer which is an index into the color table that you have previously allocated. See cdSetTextAttrib for more information on this and related functions.
int cdSetTextHeight(cdImagePtr im, int height) (Function)
Attribute: Character Height; Elem Class 5; Elem ID 15
Returns 1 for success, 0 for failure. height is an integer for the height of the text you are displaying. Bigger numbers make larger text. The size of the text is dependent on the size of the picture. See cdSetTextAttrib for more information on this and related functions.

Line, Edge, Fill, and Marker attributes

int cdSetLineAttrib(cdImagePtr im, int lntype, int lnwidth, int lncolor) (Function)
Returns 1 for success, 0 for failure. cdSetLineAttrib sets the attributes for lines and non-closed area elements. The drawing functions affected are These attributes stay in effect until they are changed, you don't have to call this function every time. If you call the function with a value of -1 for any of the attributes they will not be changed. If you call the function with the same value for an attribute as it already has, it will not be changed (so you don't have to worry about bloating your CGM with redundant attribute changes.) It calls three functions. cdSetLineType with lntype to set the line type (solid, dashed, etc), cdSetLineWidth with lnwidth to set how wide the line is, and cdSetLineColor to set the color of the line. You may also call any of the three functions individually if you like.
int cdSetShapeFillAttrib(cdImagePtr im, int instyle, int incolor, int inhatch) (Function)
Returns 1 for success, 0 for failure. cdSetShapeFillAttrib sets the attributes for the interior of closed area elements. The drawing functionsaffected are These attributes stay in effect until they are changed, you don't have to call this function every time. If you call the function with a value of -1 for any of the attributes they will not be changed. If you call the function with the same value for an attribute as it already has, it will not be changed (so you don't have to worry about bloating your CGM with repetitive attribute changes. It calls three functions. cdSetFillStyle with instyle to set the interior style (solid, hatch, empty), cdSetFillColor with incolor to set the interior color (used if instyle is solid or hatch), and cdSetFillHatch with inhatch to set the hatch style (hor lines, vert lines, crosshatch, etc) (used if instyle is hatch). You may also call any of the three functions individually if you like.
int cdSetShapeEdgeAttrib(cdImagePtr im, int edtype, int edwidth, int edcolor, int edvis) (Function)
Returns 1 for success, 0 for failure. cdSetShapeEdgeAttrib sets the attributes for the perimeter of Filled area elements. It might seem logical to use the line attributes instead, but that is not the case. The drawing functionsaffected are These attributes stay in effect until they are changed, you don't have to call this function every time. If you call the function with a value of -1 for any of the attributes they will not be changed. If you call the function with the same value for an attribute as it already has, it will not be changed (so you don't have to worry about bloating your CGM with redundant attribute changes.) cdSetShapeEdgeAttrib calls three functions. cdSetEdgeType with edtype to set the edge type (solid, dashed, etc), cdSetEdgeWidth with edwidth to set the width of the line around the perimeter, cdSetEdgeColor with edcolor to set the color of the line around the perimeter, and cdSetEdgeVis with edvis to determine if the line around the perimeter is visible. You may also call any of the four functions individually if you like.
int cdSetMarkerAttrib(cdImagePtr im, int mtype, int mwidth, int mcolor ) (Function)
Returns 1 for success, 0 for failure. cdSetMarkerAttrib sets the attributes for markers The drawing functionsaffected are These attributes stay in effect until they are changed, you don't have to call this function every time. If you call the function with a value of -1 for any of the attributes they will not be changed. If you call the function with the same value for an attribute as it already has, it will not be changed (so you don't have to worry about bloating your CGM with redundant attribute changes.) cdSetMarkerAttrib calls three functions. cdSetMarkerType with mtype to set the marker type (point, cross, etc), cdSetMarkerSize with msize to set the size of each marker, and cdSetMarkerColor with mcolor to set the color of the marker. You may also call any of the three functions individually if you like.
int cdSetLineType(cdImagePtr im, int lntype) (Function)
Attribute: Line Type; Elem Class 5; Elem ID 2
Returns 1 for success, 0 for failure. lntype is the line type which is an integer with possible values of:
  • 1 for a solid line
  • 2 for a dashed line
  • 3 for a dotted line
  • 4 for a dash-dot line
  • 5 for a dash-dot-dot line
lntype must be one of these values or the function will fail. See cdSetLineAttrib for more information on this and related functions.
int cdSetLineWidth(cdImagePtr im, int lnwidth) (Function)
Attribute: Line Width; Elem Class 5; Elem ID 3
Returns 1 for success, 0 for failure. lnwidth is an integer giving the width of lines. With an image of height Y with line width 1 the displayed width will be 1/Y%. As an example, if you image is x=5, y=10, and you set line width = 1, and draw a vertical line, the resulting line will cover 20% of horizontal area. (I think anyway). See cdSetLineAttrib for more information on this and related functions.
int cdSetLineColor(cdImagePtr im, int lncolor) (Function)
Attribute: Line Colour; Elem Class 5; Elem ID 4
Returns 1 for success, 0 for failure. Sets the line color to lncolor. This should be an integer which is an index into the color table that you have previously allocated. See cdSetLineAttrib for more information on this and related functions.
int cdSetFillStyle(cdImagePtr im, int instyle) (Function)
Attribute: Interior Style; Elem Class 5; Elem ID 22
Returns 1 for success, 0 for failure. Sets the style of the interior of filled area elements. instyle is the interior style which is an integer with possible values of:
  • 0 for hollow. No filling, but the boundary (bounding line) of the filled area is drawn using the fill colour currently selected. The boundary of a "hollow" filled area is considered to be the representation of the interior. The boundary is distinct from the edge, and is drawn only for "hollow" filled areas
  • 1 for solid. Fill the interior using the fill colour currently selected
  • 3 for hatch. Fill the interior using the fill colour and hatch index currently selected.
  • 4 for empty. No filling is done and no boundary is drawn, i.e., nothing is done to represent the interior. The only potentially visible component of an "empty" filled area is the edge, subject to EDGE VISIBILITY and other edge attributes.
instyle must be one of these values or the function will fail. So, basically, if you want an interior which is transparent and you can see what is underneath it, use "empty" otherwise fill it in with a hatch or solid color. See cdSetShapeFillAttrib for more information on this and related functions.
int cdSetFillColor(cdImagePtr im, int incolor) (Function)
Attribute: Fill Colour; Elem Class 5; Elem ID 23
Returns 1 for success, 0 for failure. Sets the fill color to incolor. This should be an integer which is an index into the color table that you have previously allocated. See cdSetShapeFillAttrib for more information on this and related functions.
int cdSetFillHatch(cdImagePtr im, int inhatch) (Function)
Attribute: Hatch Index; Elem Class 5; Elem ID 24
Returns 1 for success, 0 for failure. Sets the hatch pattern for the interior of filled-area elements to inhatch. The fill style must be set to hatch for this to have an effect. the value for inhatch is the hatch style, which is an integer with possible values of:
  • 1 for horizontal lines
  • 2 for vertcal lines
  • 3 for positive slope parallel lines
  • 4 for negative slope parallel lines
  • 5 for horizontal/vertical crosshatch
  • 6 for positive/negative slope crosshatch
lntype must be one of these values or the function will fail. See cdSetShapeFillAttrib for more information on this and related functions.
int cdSetEdgeType(cdImagePtr im, int edtype) (Function)
Attribute: Edge Type; Elem Class 5; Elem ID 27
Returns 1 for success, 0 for failure. edtype is the edge type which is an integer with possible values of:
  • 1 for a solid line
  • 2 for a dashed line
  • 3 for a dotted line
  • 4 for a dash-dot line
  • 5 for a dash-dot-dot line
edtype must be one of these values or the function will fail. See cdSetShapeEdgeAttrib for more information on this and related functions.
int cdSetEdgeWidth(cdImagePtr im, int edwidth) (Function)
Attribute: Edge Width; Elem Class 5; Elem ID 28
Returns 1 for success, 0 for failure. edwidth is an integer giving the width of the perimeter lines. With an image of height X with line width 1 the displayed width will be 1/X%. As an example, if you image is x=5, y=10, and you set line width = 1, and draw a vertical line, the resulting line will cover 20% of horizontal area. (I think anyway). See cdSetShapeEdgeAttrib for more information on this and related functions.
int cdSetEdgeColor(cdImagePtr im, int edcolor) (Function)
Attribute: Edge Color; Elem Class 5; Elem ID 29
Returns 1 for success, 0 for failure. Sets the color of the perimeter lines to edcolor. This should be an integer which is an index into the color table that you have previously allocated. See cdSetShapeEdgeAttrib for more information on this and related functions.
int cdSetEdgeVis(cdImagePtr im, int edvis) (Function)
Attribute: Edge Visibility; Elem Class 5; Elem ID 30
Returns 1 for success, 0 for failure. edvis is an integer that can have one of the following values.
  • 0 for invisible edges
  • 1 for visible edges
If you set the edge visibility to off (invisible edges) than you will not see the edges, regardless of what other edge attributes are set. The other attributes will still be set and turning the edge visibility to on will make edges using the current edge styles. See cdSetShapeEdgeAttrib for more information on this and related functions.
int cdSetMarkerType(cdImagePtr im, int mtype) (Function)
Attribute: Marker Type; Elem Class 5; Elem ID 6
Returns 1 for success, 0 for failure. mtype is the marker type which is an integer with possible values of:
  • 1 for a dot
  • 2 for a plus
  • 3 for a asterisk
  • 4 for a circle
  • 5 for a cross
mtype must be one of these values or the function will fail. See cdSetMarkerAttrib for more information on this and related functions.
int cdSetMarkerSize(cdImagePtr im, int msize) (Function)
Attribute: Marker Width; Elem Class 5; Elem ID 7
Returns 1 for success, 0 for failure. msize is an integer giving the size of markers. If you just want to note a point, the default size of 1 is probably sufficient. Larger sizes make larger markers. See cdSetMarkerAttrib for more information on this and related functions.
int cdSetMarkerColor(cdImagePtr im, int mcolor) (Function)
Attribute: Marker Colour; Elem Class 5; Elem ID 8
Returns 1 for success, 0 for failure. Sets the marker color to mcolor. This should be an integer which is an index into the color table that you have previously allocated. See cdSetMarkerAttrib for more information on this and related functions.

Color handling functions

int cdImageColorAllocate(cdImagePtr im, int r, int g, int b) (Function)
cdImageColorAllocate finds the first available color index in the image specified, sets its RGB values to those requested (255 is the maximum for each), and returns the index of the new color table entry. When creating a new image, the first time you invoke this function, you are setting the background color for that image.

In the event that all cdMaxColors colors (256) have been allocated already, cdImageColorAllocate will return -1 to indicate failure, otherwise it will return the index into the color table allocated. (Note that most functions return 0 on failure, but 0 is a valid color table entry.)

cdImageColorAllocate does not check for existing colors that match your request, you might want to use cdImageColorExact prior to calling this function to keep from defining multiple indexes with the same color. If color alocation fails, use cdImageColorClosest to find the nearest matching color.

int cdImageColorClosest(cdImagePtr im, int r, int g, int b) (Function)
cdImageColorClosest searches the colors which have been defined thus far in the image specified and returns the index of the color with RGB values closest to those of the request. (Closeness is determined by Euclidian distance, which is used to determine the distance in three-dimensional color space between colors.)

If no colors have yet been allocated in the image, gdImageColorClosest returns -1.

This function is most useful as a backup method for choosing a drawing color when an image already contains cdMaxColors (256) colors and no more can be allocated. See cdImageColorExact for a method of locating exact matches only.

int cdImageColorExact(cdImagePtr im, int r, int g, int b) (Function)
cdImageColorExact searches the colors which have been defined thus far in the image specified and returns the index of the first color with RGB values which exactly match those of the request. If no allocated color matches the request precisely, cdImageColorExact returns -1. See cdImageColorClosest for a way to find the color closest to the color requested.
int cdImageColorsTotal(cdImagePtr im) (Macro)
cdImageColorsTotal is a macro which returns the number of colors currently allocated in the image. Use this macro to obtain this information; do not access the structure directly.
int cdImageColorRed(cdImagePtr im, int c) (Macro)
cdImageColorRed is a macro which returns the red portion of the specified color in the image. Use this macro to obtain this information; do not access the structure directly.
int cdImageColorGreen(cdImagePtr im, int c) (Macro)
cdImageColorGreen is a macro which returns the green portion of the specified color in the image. Use this macro to obtain this information; do not access the structure directly.
int cdImageColorBlue(cdImagePtr im, int c) (Macro)
cdImageColorBlue is a macro which returns the green portion of the specified color in the image. Use this macro to obtain this information; do not access the structure directly.

Expert Functions

Most people will never have to use these functions. Don't use them unless you know what you are doing, and can't do it any other way. These functions are in a special group because using them adds considerable complexity to your program. All these functions deal with attributes which must be set before the picture is initialized, so you can't use cdImageCreate and use these functions as well. You must use these image creation functions if you set any of these "expert" attributes.

cdImagePtr cdImageStartCgm() (Expert Function)

Sets up the initial CGM state. Does not open a picture. this should be the first function you call.

int cdCgmHeader(cdImagePtr im) (Expert Function)

After you have changed any expert defaults you are going to, call this function. Only change the defaults that are marked as "expert" If you try to change things like line, marker, or shape attributes, you will end up with a bad CGM file.

int cdCgmPic(cdImagePtr im) (Expert Function)

This function actually starts a new picture in a CGM. Use this right after calling cdCgmHeader. If you have multiple pictures in the file, this can be used to start subsequent pictures, after the current one is closed.

int cdImageEndPic(cdImagePtr im) (Expert Function)

Closes a picture (but not the CGM) Useful if you are writing multiple picture CGM files and want to change the "expert" defaults between pictures. If all you want to do is start a new picture, it is easier to just call cdCgmNewPic with the sticky bit set to 1 (to keep your changes and the color table) or 2 (to keep your changes but not the color table.) if it is the last image of the CGM, you can then call cdImageEndCgm to finalize the CGM, but it is probably easier to call cdImageCgm instead of this function and cdImageEndCgm. Of course, if you set the output file at the begining, you have to close the CGM with these two functions.

int cdEndCgm(cdImagePtr im) (Expert Function)

Finalizes the CGM, writes any buffered data to the output stream that was set by cdImageSetOutput. See cdImageEndPic for more details.

int cdImageSetSize(cdImagePtr im, int x, int y) (Expert Function)

Sets the size of a CGM file. Can be called before the first picture is opened, or in a multi-picture CGM, it can be called between pictures.

int cdImageSetOutput(cdImagePtr im, FILE *output) (Expert Function)

Sets the output stream. The file must be opened prior to calling this function.

int cdImageClearFonts(cdImagePtr im) (Expert Function)

Clears the font list. You may only call this before the first picture is opened. If you are going to use all your own fonts instead of the pre-defined ones, you can clear out the old ones with this, then your fonts (added with cdAddFont will be numbered starting with 1. If you do not have any text in your file, you can call this to save about 150 bytes in the output file.

int cdImageAddFont(cdImagePtr im, char *fontname) (Expert Function)

Adds a new font. you may only call this before the first picture is opened. Returns the font index you need to use to access this font from within your picture.

int cdImageSetDefaults(cdImagePtr im) (Expert Function)

This is mostly useful for multi-picture CGM's. Between cdImageEndPic and cdImagePic you can call this function to reset the attributes to the standard defaults.

int cdImageSetLineSpec(cdImagePtr im, int specmode) (Expert Function)

Sets the Line Width Specification Mode. The options are:

  • 0 -- Absolute.
  • 1 -- Scaled. This is the default Specification Mode
This function can be called before the first picture is opened, or between pictures in a CGM.

int cdImageSetMarkerSpec(cdImagePtr im, int specmode) (Expert Function)

Sets the Marker Size Specification Mode. The options are:

  • 0 -- Absolute.
  • 1 -- Scaled. This is the default Specification Mode
This function can be called before the first picture is opened, or between pictures in a CGM.

int cdImageSetEdgeSpec(cdImagePtr im, int specmode) (Expert Function)

Sets the Edge Width Specification Mode. The options are:

  • 0 -- Absolute.
  • 1 -- Scaled. This is the default Specification Mode
This function can be called before the first picture is opened, or between pictures in a CGM.

Constants

cdMaxColors Constant
cdMaxColors is the maximum number of colors that can be allocated in a CGM picture. the CGM standard allows for many different ways of allocating colors, but I have chosen to limit this library to 8 bit indexed color. This means the maximum value of this is 256. If you really wanted to you could make it smaller though it would not have an effect on the resulting file size.
CDSTARTLISTSIZE Constant
When you create an image, a buffer is allocated to hold the drawing commands. This is the initial size of the buffer in bytes. When it is filled, the size gets increased by CDGROWLISTSIZE. If you know you are going to be working with very small CGM's then make this a small number. If you know your CGM's will be large increase this number. If CDSTARTLISTSIZE is smaller than the header information than it will have to grow before you do anything. I wouldn't make it smaller than 1024. Try to make it as large as the average picture you make.
CDGROWLISTSIZE Constant
When you create an image, a buffer is allocated to hold the drawing commands. When the buffer is filled, the size is increased by the amount given in CDGROWLISTSIZE (in bytes). If you know that most of the CGM's you create will be near the size of CDSTARTLISTSIZE than make this number small. If there is lots of variablility in the size of your CGM's, make this number large. If CDGROWLISTSIZE is larger than CDSTARTLISTSIZE, you should probably increase the value of CDSTARTLISTSIZE. If CDGROWLISTSIZE is smaller than the largest CGM element you create than it will be growing alot. I wouldn't make it smaller than about 1024.

Using cd instead of gd

CD was designed to be easy to use instead of gd (or with gd, if you want to be able to produce both). However, There are significate differences between the way CGM handles attributes versus the way gd does. In particular, gd requires you to put the line color in the function call to draw lines, CD does not, Color, like the other attributes only need to be set when they are changed. I recomend that you read over the documentation of both to see what the differences are, and make appropriate changes to your code. If you really want to make as few changes as possible to your code, I have provided two functions to help you. cdImageLine takes the same parameters as gdImageLine and will draw a solid line of the color specified. cdImageRectangle draws a hollow rectangle with solid edges of the color specified. I did this by drawing four lines, so it is not a true rectangle. Again, I recomend you use cdLine and cdRectangle instead of these, but they are there if you want them.

Please tell us you're using cd!

When you contact us and let us know you are using cd, you help us justify the time spent in maintaining and improving it. So please let us know. If the results are publicly visible on the web, a URL is a wonderful thing to receive, but if it's not a publicly visible project, a simple note is just as welcome.


G. Edward Johnson
lorax@nist.gov

plplot-5.10.0+dfsg/lib/nistcd/cdtest.c 644 1750 1750 3200011460615444 164340ustar andrewandrew #include #include #include #include #include "defines.h" #include "cd.h" // cdtest.c: test program for the cgmdraw module. // // Written by G. Edward Johnson // Date: April 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // int main() { cdImagePtr myimage; // Color indexes int white; int blue; int red; int green; int black; int lavender; // points for polygons and polylines cdPoint points[15]; // output file FILE *outf; // create an image, 1000 by 1000 pixels myimage = cdImageCreate( 1000, 1000 ); // Allocate the background color white = cdImageColorAllocate( myimage, 255, 255, 255 ); red = cdImageColorAllocate( myimage, 255, 0, 0 ); green = cdImageColorAllocate( myimage, 0, 255, 0 ); blue = cdImageColorAllocate( myimage, 0, 0, 255 ); black = cdImageColorAllocate( myimage, 0, 0, 0 ); if ( cdSetLineColor( myimage, blue ) ) { fprintf( stderr, "cdSetLineColor Successful\n" ); } else { fprintf( stderr, "cdSetLineColor Unsuccessful\n" ); } if ( cdSetLineColor( myimage, blue ) ) { fprintf( stderr, "cdSetLineColor Successful\n" ); } else { fprintf( stderr, "cdSetLineColor Unsuccessful\n" ); } if ( cdImageLine( myimage, 400, 8, 520, 8, green ) ) { fprintf( stderr, "cdImageLine Successful\n" ); } else { fprintf( stderr, "cdImageLine Unsuccessful\n" ); } if ( cdImageLine( myimage, 50, 50, 500, 500, red ) ) { fprintf( stderr, "cdImageLine Successful\n" ); } else { fprintf( stderr, "cdImageLine Unsuccessful\n" ); } if ( cdSetLineAttrib( myimage, 2, 3, red ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } if ( cdLine( myimage, 500, 50, 50, 500 ) ) { fprintf( stderr, "cdLine Successful\n" ); } else { fprintf( stderr, "cdLine Unsuccessful\n" ); } // Now, build a rectangle if ( cdSetShapeFillAttrib( myimage, 3, blue, 6 ) ) { fprintf( stderr, "cdSetShapeFillAttrib Successful\n" ); } else { fprintf( stderr, "cdSetShapeFillAttrib Unsuccessful\n" ); } if ( cdSetShapeEdgeAttrib( myimage, 1, 2, green, 1 ) ) { fprintf( stderr, "cdSetShapeEdgeAttrib Successful\n" ); } else { fprintf( stderr, "cdSetShapeEdgeAttrib Unsuccessful\n" ); } if ( cdRectangle( myimage, 100, 100, 250, 250 ) ) { fprintf( stderr, "cdRectangle Successful\n" ); } else { fprintf( stderr, "cdRectangle Unsuccessful\n" ); } // now check out each of the line styles in order if ( cdSetLineAttrib( myimage, 5, 4, green ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } if ( cdLine( myimage, 100, 600, 500, 600 ) ) { fprintf( stderr, "cdLine Successful\n" ); } else { fprintf( stderr, "cdLine Unsuccessful\n" ); } if ( cdSetLineAttrib( myimage, 4, -1, -1 ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } if ( cdLine( myimage, 100, 625, 500, 625 ) ) { fprintf( stderr, "cdLine Successful\n" ); } else { fprintf( stderr, "cdLine Unsuccessful\n" ); } if ( cdSetLineAttrib( myimage, 3, -1, -1 ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } if ( cdLine( myimage, 100, 650, 500, 650 ) ) { fprintf( stderr, "cdLine Successful\n" ); } else { fprintf( stderr, "cdLine Unsuccessful\n" ); } if ( cdSetLineAttrib( myimage, 2, -1, -1 ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } if ( cdLine( myimage, 100, 675, 500, 675 ) ) { fprintf( stderr, "cdLine Successful\n" ); } else { fprintf( stderr, "cdLine Unsuccessful\n" ); } if ( cdSetLineAttrib( myimage, 1, -1, -1 ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } if ( cdLine( myimage, 100, 700, 500, 700 ) ) { fprintf( stderr, "cdLine Successful\n" ); } else { fprintf( stderr, "cdLine Unsuccessful\n" ); } // now make a circle if ( cdSetShapeFillAttrib( myimage, 1, -1, 6 ) ) { fprintf( stderr, "cdSetShapeFillAttrib Successful\n" ); } else { fprintf( stderr, "cdSetShapeFillAttrib Unsuccessful\n" ); } if ( cdSetShapeEdgeAttrib( myimage, 1, 2, green, 0 ) ) { fprintf( stderr, "cdSetShapeEdgeAttrib Successful\n" ); } else { fprintf( stderr, "cdSetShapeEdgeAttrib Unsuccessful\n" ); } if ( cdCircle( myimage, 500, 500, 25 ) ) { fprintf( stderr, "cdCircle Successful\n" ); } else { fprintf( stderr, "cdCircle Unsuccessful\n" ); } // how about a Circular Arc now if ( cdArc3Pt( myimage, 550, 500, 600, 600, 650, 550 ) ) { fprintf( stderr, "cdArc3Pt Successful\n" ); } else { fprintf( stderr, "cdArc3Pt Unsuccessful\n" ); } // now draw a closed Circular Arc if ( cdArc3PtClose( myimage, 550, 200, 600, 300, 650, 250, 0 ) ) { fprintf( stderr, "cdArc3PtClose Successful\n" ); } else { fprintf( stderr, "cdArc3PtClose Unsuccessful\n" ); } // and now for an ellipse if ( cdSetShapeEdgeAttrib( myimage, 1, 2, green, 1 ) ) { fprintf( stderr, "cdSetShapeEdgeAttrib Successful\n" ); } else { fprintf( stderr, "cdSetShapeEdgeAttrib Unsuccessful\n" ); } if ( cdEllipse( myimage, 750, 200, 800, 250, 750, 300 ) ) { fprintf( stderr, "cdEllipse Successful\n" ); } else { fprintf( stderr, "cdEllipse Unsuccessful\n" ); } // Now, the harder ones. First lets try the polygon stuff // a polygon with 7 or less points points[0].x = 700; points[0].y = 700; points[1].x = 725; points[1].y = 750; points[2].x = 775; points[2].y = 650; if ( cdPolygon( myimage, points, 3 ) ) { fprintf( stderr, "cdPolygon Successful\n" ); } else { fprintf( stderr, "cdPolygon Unsuccessful\n" ); } // Here's a tough one, a polygon with more than seven points points[0].x = 800; points[0].y = 700; points[1].x = 825; points[1].y = 725; points[2].x = 850; points[2].y = 700; points[3].x = 875; points[3].y = 750; points[4].x = 900; points[4].y = 775; points[5].x = 925; points[5].y = 750; points[6].x = 950; points[6].y = 850; points[7].x = 925; points[7].y = 850; points[8].x = 875; points[8].y = 800; points[9].x = 850; points[9].y = 825; points[10].x = 825; points[10].y = 900; if ( cdPolygon( myimage, points, 11 ) ) { fprintf( stderr, "cdPolygon Successful\n" ); } else { fprintf( stderr, "cdPolygon Unsuccessful\n" ); } // Now for a polygon set, two polygons (both triangles) the first one // with an invisible edge closing it. points[0].x = 500; // start of first polygon points[0].y = 350; points[0].e = 1; // edge out is visible points[1].x = 575; points[1].y = 350; points[1].e = 1; points[2].x = 575; points[2].y = 430; points[2].e = 3; // close polygon with visible edge points[3].x = 600; // start of second polygon points[3].y = 350; points[3].e = 0; // edge out is invisible points[4].x = 700; points[4].y = 350; points[4].e = 1; points[5].x = 650; points[5].y = 475; points[5].e = 2; // close polygone with an invisible edge // make the edges wider so it is easier to see if they are there if ( cdSetEdgeWidth( myimage, 3 ) ) { fprintf( stderr, "cdSetEdgeWidth Successful\n" ); } else { fprintf( stderr, "cdSetEdgeWidth Unsuccessful\n" ); } if ( cdPolygonSet( myimage, points, 6 ) ) // draw the polygonset { fprintf( stderr, "cdPolygonSet Successful\n" ); } else { fprintf( stderr, "cdPolygonSet Unsuccessful\n" ); } // now for poly lines, just like polygons (except they're lines) if ( cdSetLineAttrib( myimage, 1, 1, red ) ) { fprintf( stderr, "cdSetLineAttrib Successful\n" ); } else { fprintf( stderr, "cdSetLineAttrib Unsuccessful\n" ); } points[0].x = 400; points[0].y = 16; points[1].x = 520; points[1].y = 16; if ( cdPolyLine( myimage, points, 2 ) ) { fprintf( stderr, "cdPolyLine Successful\n" ); } else { fprintf( stderr, "cdPolyLine Unsuccessful\n" ); } points[0].x = 800; points[0].y = 650; points[1].x = 825; points[1].y = 675; points[2].x = 850; points[2].y = 650; points[3].x = 875; points[3].y = 700; if ( cdPolyLine( myimage, points, 4 ) ) { fprintf( stderr, "cdPolyLine Successful\n" ); } else { fprintf( stderr, "cdPolyLine Unsuccessful\n" ); } // Markers // set the attributes if ( cdSetMarkerAttrib( myimage, 1, 1, green ) ) { fprintf( stderr, "cdSetMarkerAttrib Successful\n" ); } else { fprintf( stderr, "cdSetMarkerAttrib Unsuccessful\n" ); } // now plot the marker if ( cdMarker( myimage, 900, 500 ) ) { fprintf( stderr, "cdMarker Successful\n" ); } else { fprintf( stderr, "cdMarker Unsuccessful\n" ); } if ( cdSetMarkerAttrib( myimage, 5, 3, black ) ) { // set the marker type to cross fprintf( stderr, "cdSetMarkerAttrib Successful\n" ); } else { fprintf( stderr, "cdSetMarkerAttrib Unsuccessful\n" ); } // a Poly Marker, two markers in different places points[0].x = 715; points[0].y = 785; points[1].x = 735; points[1].y = 815; if ( cdPolyMarker( myimage, points, 2 ) ) { fprintf( stderr, "cdPolyMarker Successful\n" ); } else { fprintf( stderr, "cdMarker Unsuccessful\n" ); } // Hey, things are going so well, lets do some text lavender = cdImageColorAllocate( myimage, 204, 102, 255 ); if ( cdSetTextAttrib( myimage, 1, lavender, 50 ) ) { fprintf( stderr, "cdSetTextAttrib Successful\n" ); } else { fprintf( stderr, "cdSetTextAttrib Unsuccessful\n" ); } if ( cdText( myimage, 50, 800, "CGM Draw Version 1.3" ) ) { fprintf( stderr, "cdText Successful\n" ); } else { fprintf( stderr, "cdText Unsuccessful\n" ); } // More text. This time test TextPath and TextOrient if ( cdSetTextPath( myimage, 3 ) ) { fprintf( stderr, "cdSetTextPath Successful\n" ); } else { fprintf( stderr, "cdSetTextPath Unsuccessful\n" ); } if ( cdText( myimage, 50, 800, "CGM Draw" ) ) { fprintf( stderr, "cdText Successful\n" ); } else { fprintf( stderr, "cdText Unsuccessful\n" ); } if ( cdSetTextOrient( myimage, 1, 0, 0, -1 ) ) { fprintf( stderr, "cdSetTextOrient Successful\n" ); } else { fprintf( stderr, "cdSetTextOrient Unsuccessful\n" ); } if ( cdSetTextPath( myimage, 0 ) ) { fprintf( stderr, "cdSetTextPath Successful\n" ); } else { fprintf( stderr, "cdSetTextPath Unsuccessful\n" ); } if ( cdText( myimage, 950, 400, "CGM Draw" ) ) { fprintf( stderr, "cdText Successful\n" ); } else { fprintf( stderr, "cdText Unsuccessful\n" ); } if ( cdSetTextOrient( myimage, 0, 1, 1, 0 ) ) { fprintf( stderr, "cdSetTextOrient Successful\n" ); } else { fprintf( stderr, "cdSetTextOrient Unsuccessful\n" ); } if ( cdSetTextAttrib( myimage, 5, -1, 25 ) ) { fprintf( stderr, "cdSetTextAttrib Successful\n" ); } else { fprintf( stderr, "cdSetTextAttrib Unsuccessful\n" ); } if ( cdText( myimage, 5, 5, "G. Edward Johnson" ) ) { fprintf( stderr, "cdText Successful\n" ); } else { fprintf( stderr, "cdText Unsuccessful\n" ); } outf = fopen( "cdout.cgm", "wb" ); if ( !outf ) return 1; cdImageCgm( myimage, outf ); fclose( outf ); outf = 0; cdImageDestroy( myimage ); return 0; } plplot-5.10.0+dfsg/lib/nistcd/cdmulti.c 644 1750 1750 565611460615444 166100ustar andrewandrew// // cdmulti is a program to make a cgm file with multiple pictures in it. // // // cdmulti.c: test program for the cgmdraw module. // // Written by G. Edward Johnson // Date: June 26, 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // #include #include #include #include #include "defines.h" #include "cd.h" int main() { // you must create a pointer to the image(s) that you will be using // not suprisingly, it is of type cdImagePtr cdImagePtr im; // this is a pointer to the output file you will be using FILE *outf; // these will be index's into the color palette containing // the corresponding colors int black, white, blue; // Create an image 200 pixels wide by 250 pixels high im = cdImageCreate( 200, 250 ); // allocate some colors (isn't this fun?) // the first color allocated is the background color white = cdImageColorAllocate( im, 255, 255, 255 ); black = cdImageColorAllocate( im, 0, 0, 0 ); blue = cdImageColorAllocate( im, 0, 0, 255 ); // set the text attributes // font, colorindex, and size respectivily // font is the style the text is written in. 1 is for Times, // 5 is for Helvetica. // we will have black text for this one // Size is a tough one, but larger numbers give larger text. // 25 is a not too large size if ( !( cdSetTextAttrib( im, 5, black, 25 ) ) ) return 1; // Now that we have set some attributes, lets do some drawing // lets put some text in the picture. // (20,100) is the point at the lower left corner of the text if ( !( cdText( im, 20, 100, "Hello World" ) ) ) return 1; // Here's something special, put a second picture in the file // we put in a second picture, and reset all defaults. This means // we have to re-allocate the colors as well if ( !( cdCgmNewPic( im, 0 ) ) ) return 1; // allocate some colors (Again!) // the first color allocated is the background color white = cdImageColorAllocate( im, 255, 255, 255 ); black = cdImageColorAllocate( im, 0, 0, 0 ); blue = cdImageColorAllocate( im, 0, 0, 255 ); // set text attributes if ( !( cdSetTextAttrib( im, 5, black, 25 ) ) ) return 1; if ( !( cdText( im, 20, 100, "Goodbye World" ) ) ) return 1; // now write the file out. outf = fopen( "cdmulti.cgm", "wb" ); if ( !outf ) return 1; cdImageCgm( im, outf ); fclose( outf ); outf = 0; // Remember to destroy the image when you are done cdImageDestroy( im ); im = 0; printf( "I just created a multi picture CGM!!!\n" ); return 0; } plplot-5.10.0+dfsg/lib/nistcd/README_plplot_nistcd 644 1750 1750 104511155124466 206050ustar andrewandrewMost of these files were obtained (as of 2001-12-09) from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz This software was written originally by G. Edward Johnson at NIST, but it is no longer maintained by him. It is public-domain software except for the small part licensed under the libgd license (see his documentation). The PLplot developer's contribution is CMakeLists.txt, cddll.h, and some small visibility modifications to cd.h. We call the resulting library, libnistcd to distinguish it from all the other "libcd" libraries out there. plplot-5.10.0+dfsg/lib/nistcd/cd.c 644 1750 1750 27552111571511407 155720ustar andrewandrew // cd.c main file for cgmdraw module. // // Written by G. Edward Johnson // Date: April 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // Portions of this package are from the gd package written by // Thomas Boutell and are copyright 1994, 1995, Quest Protein // Database Center, Cold Spring Harbor Labs. They are marked in the // source code. // #ifndef NOMALLOCH #include #endif #include #include #include #include #include "defines.h" #include "cd.h" static int cdImageAddColor( cdImagePtr im, int si, int ei ); cdImagePtr cdImageCreate( int sx, int sy ) // Creates a new image of size (sx,sy). Most people should always // start by calling this function { cdImagePtr im; im = cdImageStartCgm(); if ( !im ) return 0; // memory allocation failed if ( !cdImageSetSize( im, sx, sy ) ) { free( im ); return 0; } if ( !cdCgmHeader( im ) ) { free( im ); return 0; } if ( cdCgmPic( im, 0 ) ) { return im; } else { free( im ); return 0; } } static int cdAppNull( unsigned char *es, int x ) { // put x nulls in the string. // return value is number of octets added (1) int y; for ( y = 0; y < x; y++ ) { *es = '\0'; es++; } return x; } static int cdAppByte( unsigned char *es, short int addme ) { // Append an octet to the end of es // Return value is number of octets added // for internal cd functions only, do not call // *es = (unsigned char) addme & 0377; return 1; } static int cdAppShort( unsigned char *es, short int addme ) { // Append a short to the end of es // return value is number of octets added // For internal cd functions only, do not call! // short int temp; temp = addme >> 8; *es = (unsigned char) temp & 0377; es++; *es = (unsigned char) addme & 0377; return 2; } // static int cdAppWord(unsigned char *es, int addme){ // Append an word to es // Return value is number of octets added // For internal cd functions only, do not call! // // // int temp; // temp = addme >> 24; //es = (unsigned char) temp & 0377; // es++; // temp = addme >> 16; //es = (unsigned char) temp & 0377; // es++; // temp = addme >> 8; //es = (unsigned char) temp & 0377; // es++; //es = (unsigned char) addme & 0377; // es++; // return 4; // } // static int cdcomhead( unsigned char *es, int elemclass, int id, int len ) { // sets the command header in the first two bytes of string es // element class is in bits 15-12 // element id is in bits 11-5 // parameter list length is in bits 4-0 // int temp; if ( !es ) return 0; // the string must be allocated first // set the element class *es = (unsigned char) elemclass << 4; // set the element id temp = 0177 & id; temp = temp >> 3; *es = *es | temp; es++; id = id << 5; *es = (unsigned char) id; *es = *es | (unsigned char) ( 037 & len ); return 1; } static int cdcomheadlong( unsigned char *es, int elemclass, int id, int len ) { // sets the command header for the long form. // first 16 bits: // element class is in bits 15-12 // element id is in bits 11-5 // parameter list length is in bits 4-0 = 31 // second 16 bits: // bit 15 = 0 (for last partition) // bit 14-0 param list len // // I'm lazy, call cdcomhead to set the first two bytes if ( !cdcomhead( es, elemclass, id, 31 ) ) return 0; es += 2; // now set the second two bytes cdAppShort( es, (short int) len ); *es = *es & 0177; // make bit 15 = 0 es += 2; return 1; } static int cdAddElem( cdImagePtr im, unsigned char *es, int octet_count ) // adds a string, which is a CGM element to the elemlist. // This function is called by other functions in this library and // should NOT be called by users of the library // For internal cd functions only, do not call! // { unsigned char *newlist; // in case memory allocation fails int x; // counter while ( ( octet_count + 1 ) >= im->bytestoend ) { // not enough space, must grow elemlist im->listlen = im->listlen + CDGROWLISTSIZE; newlist = (unsigned char *) realloc( im->elemlist, SIZEOF( unsigned char ) * im->listlen ); if ( newlist ) { // successfully allocated memory im->elemlist = newlist; im->bytestoend = im->bytestoend + CDGROWLISTSIZE; im->curelemlist = im->elemlist + ( im->listlen - im->bytestoend ); } else { // memory allocation failed, save yurself im->listlen = im->listlen - CDGROWLISTSIZE; return 0; } } // ok, if we get to here, there is enough space, so add it. for ( x = 0; x < octet_count; x++ ) { *im->curelemlist = (unsigned char) *es; im->curelemlist++; es++; } im->bytestoend = im->bytestoend - octet_count; return 1; } int cdCgmHeader( cdImagePtr im ) { // add the cgm header to the imagepointer's element list // do it all in a string than call cdAddElem on it // For internal cd functions only, do not call! // unsigned char *headerp; unsigned char *head; const unsigned char *buf, *buf2; int octet_count = 0; int blen; // length of buf int curly; int fontlistlen; // each font in the font list is stored as a string, // with a single octet in front of the string // giving its length, fontlistlen is the sum of // the lengths of all the font strings + the // length octets. if ( im->state != 0 ) return 0; headerp = (unsigned char *) calloc( 1024, SIZEOF( unsigned char ) ); if ( !headerp ) return 0; // memory allocation failed head = headerp; //** Attribute: BegMF; Elem Class 0; Elem ID 1 buf = (const unsigned char *) "cd: CgmDraw Library"; blen = strlen( (const char *) buf ); cdcomhead( head, 0, 1, blen + 1 ); head += 2; head += cdAppByte( head, (short int) blen ); buf2 = buf; while ( *buf2 ) { *head++ = *buf2++; } octet_count += ( blen + 3 ); curly = 4 - ( octet_count % 4 ); if ( curly % 4 ) { octet_count += curly; head += cdAppNull( head, curly ); } //** Attribute: MFVersion; Elem Class 1; Elem ID 1 cdcomhead( head, 1, 1, 2 ); head += 2; head += cdAppShort( head, (short int) 1 ); octet_count += 4; //** Attribute: MFDesc; Elem Class 1; Elem ID 2 blen = strlen( (char *) im->desc ); cdcomheadlong( head, 1, 2, blen + 1 ); head += 4; head += cdAppByte( head, (short int) blen ); buf2 = im->desc; while ( *buf2 ) { *head++ = *buf2++; } octet_count += ( blen + 5 ); curly = 4 - ( octet_count % 4 ); if ( curly % 4 ) { octet_count += curly; head += cdAppNull( head, curly ); } //** Attribute: ColrPrec; Elem Class 1; Elem ID 7 cdcomhead( head, 1, 7, 2 ); head += 2; head += cdAppShort( head, (short int) 8 ); octet_count += 4; //** Attribute: ColrIndexPrec; Elem Class 1; Elem ID 8 cdcomhead( head, 1, 8, 2 ); head += 2; head += cdAppShort( head, (short int) 8 ); octet_count += 4; //** Attribute: MaxColrIndex; Elem Class 1; Elem ID 9 cdcomhead( head, 1, 9, 1 ); head += 2; head += cdAppByte( head, (short int) 255 ); octet_count += 4; head++; //** Attribute: MFElemList; Elem Class 1; Elem ID 11 // shorthand here. 1 means 1 element specified, (-1,1) // means drawing-plus-control set cdcomhead( head, 1, 11, 6 ); head += 2; head += cdAppShort( head, (short int) 1 ); head += cdAppShort( head, (short int) -1 ); head += cdAppShort( head, (short int) 1 ); octet_count += 8; //** Attribute: FontList; Elem Class 1; Elem ID 13 // im->fontlist contains a comma separated list of font names // since we don't need the commas, and every font except one has // a comma, and we do need a length octet, that means that // taking the string length will give us one less than the // correct length. buf = im->fontlist; if ( buf ) // don't do this if there aren't any fonts { fontlistlen = strlen( (const char *) buf ) + 1; cdcomheadlong( head, 1, 13, fontlistlen ); head += 4; while ( *buf ) { blen = 0; buf2 = buf; while ( ( *buf ) && ( *buf != ',' ) ) { buf++; blen++; } head += cdAppByte( head, (short int) blen ); while ( buf2 < buf ) { *head++ = *buf2++; } if ( *buf ) { buf++; } } octet_count += ( 4 + fontlistlen ); curly = 4 - ( octet_count % 4 ); if ( curly % 4 ) { octet_count += curly; head += cdAppNull( head, curly ); } } // end of check to see if any fonts if ( cdAddElem( im, headerp, octet_count ) ) { free( headerp ); headerp = 0; return 1; } else { free( headerp ); return 0; } } int cdCgmPic( cdImagePtr im, int sticky ) { // Start the picture. if the sticky bit is set, set and use the defaults // of the previous picture. Otherwise, reset all defaults. // Gej: sticky = 0 reset defaults, 1 dont reset anything, 2 only // reset the color table // unsigned char *headerp; unsigned char *head; unsigned char *buf, *buf2; char *tb; int octet_count = 0; int blen; // length of buf int x1, x2, x3, x4; // needed for setting defaults if ( ( im->state != 0 ) && ( im->state != 2 ) ) return 0; if ( ( sticky > 2 ) || ( sticky < 0 ) ) return 0; // invalid sticky bit // increment the picture number im->picnum++; tb = (char *) calloc( 4 * 4, SIZEOF( char ) ); if ( !tb ) return 0; // memory allocation failed headerp = (unsigned char *) calloc( 1024, SIZEOF( unsigned char ) ); if ( !headerp ) { // memory allocation failed free( tb ); return 0; } head = headerp; //** Attribute: BegPic; Elem Class 0; Elem ID 3 sprintf( tb, "picture %d", im->picnum ); buf = (unsigned char *) tb; // buf = (unsigned char *) "picture 1"; blen = strlen( (char *) buf ); cdcomhead( head, 0, 3, blen + 1 ); head += 2; head += cdAppByte( head, (short int) blen ); buf2 = buf; while ( *buf2 ) { *head++ = *buf2++; } free( tb ); octet_count += ( blen + 3 ); if ( !( blen % 2 ) ) { octet_count++; head += cdAppNull( head, 1 ); } if ( octet_count % 4 ) { octet_count += 2; head += cdAppNull( head, 2 ); } //** Attribute: ColrMode; Elem Class 2; Elem ID 2 cdcomhead( head, 2, 2, 2 ); head += 2; head += cdAppShort( head, (short int) 0 ); octet_count += 4; // Picture Descriptor: Line Width Specification Mode; // Elem Class 2; Elem ID 3 if ( sticky && ( im->linespec != CDLINESPEC ) ) { cdcomhead( head, 2, 3, 2 ); head += 2; head += cdAppShort( head, (short int) im->linespec ); octet_count += 4; } // Picture Descriptor: Marker Size Specification Mode; // Elem Class 2; Elem ID 4 if ( sticky && ( im->markerspec != CDMARKERSPEC ) ) { cdcomhead( head, 2, 4, 2 ); head += 2; head += cdAppShort( head, (short int) im->markerspec ); octet_count += 4; } // Picture Descriptor: Edge Width Specification Mode; // Elem Class 2; Elem ID 5 if ( sticky && ( im->edgespec != CDEDGESPEC ) ) { cdcomhead( head, 2, 5, 2 ); head += 2; head += cdAppShort( head, (short int) im->edgespec ); octet_count += 4; } //** Attribute: VDCExt; Elem Class 2; Elem ID 6 cdcomhead( head, 2, 6, 8 ); head += 2; head += cdAppShort( head, (short int) 0 ); head += cdAppShort( head, (short int) 0 ); head += cdAppShort( head, (short int) im->sx ); head += cdAppShort( head, (short int) im->sy ); octet_count += 10; //** Attribute: Begin Picture Body; Elem Class 0; Elem ID 4 cdcomhead( head, 0, 4, 0 ); head += 2; octet_count += 2; if ( cdAddElem( im, headerp, octet_count ) ) { free( headerp ); } else { free( headerp ); return 0; } if ( sticky ) { // keep defaults the way they are if ( sticky == 1 ) { // keep the color table if ( cdImageAddColor( im, 0, im->colorsTotal - 1 ) == -1 ) { // no colortable return 1; } } else { // Nuke the color table if there is one cdImageColorClear( im ); } im->state = 1; x1 = im->ltype; x2 = im->lwidth; x3 = im->lcolor; im->ltype = CDLTYPE; im->lwidth = CDLWIDTH; im->lcolor = CDLCOLOR; if ( !cdSetLineAttrib( im, x1, x2, x3 ) ) return 0; x1 = im->shapestyle; x2 = im->shapecolor; x3 = im->shapehatch; im->shapestyle = CDSHAPESTYLE; im->shapecolor = CDSHAPECOLOR; im->shapehatch = CDSHAPEHATCH; if ( !cdSetShapeFillAttrib( im, x1, x2, x3 ) ) return 0; x1 = im->edgetype; x2 = im->edgewidth; x3 = im->edgecolor; x4 = im->edgevis; im->edgetype = CDEDGETYPE; im->edgewidth = CDEDGEWIDTH; im->edgecolor = CDEDGECOLOR; im->edgevis = CDEDGEVIS; if ( !cdSetShapeEdgeAttrib( im, x1, x2, x3, x4 ) ) return 0; x1 = im->textfont; x2 = im->textcolor; x3 = im->textheight; im->textfont = CDTEXTFONT; im->textcolor = CDTEXTCOLOR; im->textheight = CDTEXTHEIGHT; if ( !cdSetTextAttrib( im, x1, x2, x3 ) ) return 0; x1 = im->textpath; im->textpath = CDTEXTPATH; if ( !cdSetTextPath( im, x1 ) ) return 0; x1 = im->mtype; x2 = im->msize; x3 = im->mcolor; im->ltype = CDMTYPE; im->lwidth = CDMSIZE; im->lcolor = CDMCOLOR; if ( !cdSetMarkerAttrib( im, x1, x2, x3 ) ) return 0; } else { // reset all the defaults cdImageSetDefaults( im ); // Nuke the color table if there is one cdImageColorClear( im ); im->state = 1; // now we are officially in the picture } return 1; } int cdCgmNewPic( cdImagePtr im, int sticky ) // The CGM standard allows multiple images in a single file. This function // will close the current picture, then open a new one. // if sticky is 0 then all attributes will be reset to the defaults // if sticky is 1 then all attributes will be inherited from the prevous // picture. // if sticky is 2 all attributes except the color table will be inherited // from the previous picture // { // close the current picture if ( !cdImageEndPic( im ) ) return 0; // now start the new picture return ( cdCgmPic( im, sticky ) ); } int cdImageCgm( cdImagePtr im, FILE *out ) // Gej: Write the image to file *out, which must be open already // does not close the file { // // if (out) { // im->outfile = out; // } // cdImageSetOutput( im, out ); return cdImageEndCgm( im ); } int cdSetLineType( cdImagePtr im, int lntype ) { // Attribute: Line Type; Elem Class 5; Elem ID 2 // Set the line type. Possible values are: // 1=solid, 2=dash, 3=dot, 4=dash-dot, 5=dash-dot-dot // Even though new ones can be defined, I am limiting lntype to these values // If you really need more, you can make the proper changes. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( lntype == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( lntype == im->ltype ) return 1; // Make sure that lntype is between 1 and 5 if ( ( lntype < 1 ) || ( lntype > 5 ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 2, 2 ) ) { free( esp ); return 0; } es += 2; // set Param_List_Len to 2 (signed int at index precision) // add in the value of lntype es += cdAppShort( es, (short int) lntype ); octet_count = 4; // we just know this // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->ltype = (short int) lntype; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetLineWidth( cdImagePtr im, int lnwidth ) { // Attribute: Line Width; Elem Class 5; Elem ID 3 // sets the line width. with an image of height X with line width 1 // the displayed width will be 1/X%. as an example, if you image is // x=5, y=10, and you set line width = 1, and draw a vertical line, the // resulting line will cover 20% of horizontal area. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( lnwidth == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( lnwidth == im->lwidth ) return 1; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; //gej: line width is 32 bit floating point number, 16 bits before the // decimal, 16 bits after if Line Spec is default (1, scaled) // if Line Spec is 0 (0, absolute) then it is 16 bit SI if ( im->linespec ) { if ( !cdcomhead( es, 5, 3, 4 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; es += cdAppShort( es, (short int) lnwidth ); octet_count += 2; // the next two (after decimal point) will always be zero es += cdAppNull( es, 2 ); octet_count += 2; } else { if ( !cdcomhead( es, 5, 3, 2 ) ) { free( esp ); return 0; } octet_count = 2; es += 2; es += cdAppShort( es, (short int) lnwidth ); octet_count += 2; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->lwidth = lnwidth; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetLineColor( cdImagePtr im, int lncolor ) { // Attribute: Line Colour; Elem Class 5; Elem ID 4 // Sets the line color. lncolor should be an index into the color // table that you have previously allocated. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( lncolor == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( lncolor == im->lcolor ) return 1; // Make sure the color they want to use has been allocated. // also, that color must be non-negative if ( ( lncolor >= im->colorsTotal ) || ( lncolor < 0 ) ) return 0; // you must allocate a color before you use it // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 4, 1 ) ) { free( esp ); return 0; } es += 2; *es = 0377 & lncolor; // mask off last 8 bits and put in es es++; es += cdAppNull( es, 1 ); octet_count = 4; // we just know this; 2 octets of header, // 1 octet of data, 1 octet of null data // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->lcolor = (short int) lncolor; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetFillStyle( cdImagePtr im, int instyle ) { // set the style of the interior of filled area elements. // Attribute: Interior Style; Elem Class 5; Elem ID 22 // These attributes stay in effect until changed, so you don't have to output // them every time. // Interior Style: (integers 0-6, corresponding to: hollow, solid, // [not pattern], hatch, empty, [not geometric pattern], // interpolated.) // attribute is 16 bit signed int // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( instyle == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( instyle == im->shapestyle ) return 1; // Make sure that lnhatch is between 0 and 6, but not // 2, 5, or 6 if ( ( instyle < 0 ) || ( instyle > 4 ) || ( instyle == 2 ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // set the header to Class 5, ID 22, Length 2 if ( !cdcomhead( es, 5, 22, 2 ) ) { free( esp ); return 0; } es += 2; // add in the value of inhatch es += cdAppShort( es, (short int) instyle ); octet_count = 4; // we just know this // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->shapestyle = (short int) instyle; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetFillColor( cdImagePtr im, int incolor ) { // set the color of the interior of filled area elements // Attribute: Fill Colour; Elem Class 5; Elem ID 23 // These attributes stay in effect until changed, so you don't have to output // them every time. // Fill Colour: (index into the color table) // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( incolor == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( incolor == im->shapecolor ) return 1; // Make sure the color they want to use has been allocated. // also, that color must be non-negative if ( ( incolor >= im->colorsTotal ) || ( incolor < 0 ) ) return 0; // you must allocate a color before you use it // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 23, 1 ) ) { free( esp ); return 0; } es += 2; *es = 0377 & incolor; // mask off last 8 bits and put in es es++; es += cdAppNull( es, 1 ); octet_count = 4; // we just know this; 2 octets of header, // 1 octet of data, 1 octet of null data // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->shapecolor = (short int) incolor; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetFillHatch( cdImagePtr im, int inhatch ) { // Set the hatch pattern for the interior of filled-area elements // the fill style must be set to hatch for this to have an effect. // Attribute: Hatch Index; Elem Class 5; Elem ID 24 // These attributes stay in effect until changed, so you don't have to output // them every time. // Hatch Index: (integers 1-6, corresponding to: horizontal lines, // vertical lines, pos. slope parallel lines, // neg. slope parallel lines, horizontal/vertical // crosshatch, positive/negative slope crosshatch) // unsigned char *es, *esp; int octet_count, temp; // First check and see if the user doesn't want any changes, // if so, just return success if ( inhatch == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( inhatch == im->shapehatch ) return 1; // Make sure that lnhatch is between 1 and 6 if ( ( inhatch < 1 ) || ( inhatch > 6 ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // set the command header to class 5, id 24, length 2 if ( !cdcomhead( es, 5, 24, 2 ) ) { free( esp ); return 0; } es += 2; // add in the value of inhatch temp = inhatch >> 8; *es = *es | ( temp & 0377 ); es++; *es = *es | ( inhatch & 0377 ); es++; octet_count = 4; // we just know this // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->shapehatch = (short int) inhatch; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetEdgeType( cdImagePtr im, int edtype ) { // set the type of the edge of filled-area elements. // Attribute: Edge Type; Elem Class 5; Elem ID 27 // These attributes stay in effect until changed, so you don't have to output // them every time. // Edge Type (integers 1-5, corresponding to: solid, dash, dot, // dash-dot, dash-dot-dot. These are the same as those used // for line type.) // In Part 3 of the standard (Binary Encoding) on page 47 it says that // edge type is integer. This is incorrect. Edge type is Index, just // like line type. // Even though new ones can be defined, I am limiting lntype to these values // If you really need more, you can make the proper changes. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( edtype == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( edtype == im->edgetype ) return 1; // Make sure that lntype is between 1 and 5 if ( ( edtype < 1 ) || ( edtype > 5 ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 27, 2 ) ) { free( esp ); return 0; } es += 2; // add in the value of edtype es += cdAppShort( es, (short int) edtype ); octet_count = 4; // we just know this // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->edgetype = (short int) edtype; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetEdgeWidth( cdImagePtr im, int edwidth ) { // Set the width of the edge of filled-area elements. // Attribute: Edge Width; Elem Class 5; Elem ID 28 // These attributes stay in effect until changed, so you don't have to output // them every time. // Edge Width (should be the same as line width) // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( edwidth == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( edwidth == im->edgewidth ) return 1; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; //gej: edge width is 32 bit floating point number, 16 bits before the // decimal, 16 bits after for default edge spec (1, scaled) if // edge spec is absolute (0) then just 16 bit SI if ( im->edgespec ) { if ( !cdcomhead( es, 5, 28, 4 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; es += cdAppShort( es, edwidth ); octet_count += 2; // the next two (after decimal point) will always be zero es += cdAppNull( es, 2 ); octet_count += 2; } else { if ( !cdcomhead( es, 5, 28, 2 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; es += cdAppShort( es, edwidth ); octet_count += 2; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->edgewidth = edwidth; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetEdgeColor( cdImagePtr im, int edcolor ) { // Set the color of the edge of filled-area elements. // Attribute: Edge Color; Elem Class 5; Elem ID 29 // These attributes stay in effect until changed, so you don't have to output // them every time. // Edge Colour (index into the color table) // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( edcolor == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( edcolor == im->edgecolor ) return 1; // Make sure the color they want to use has been allocated. // also, that color must be non-negative if ( ( edcolor >= im->colorsTotal ) || ( edcolor < 0 ) ) return 0; // you must allocate a color before you use it // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 29, 1 ) ) { free( esp ); return 0; } es += 2; *es = 0377 & edcolor; // mask off last 8 bits and put in es es++; es += cdAppNull( es, 1 ); octet_count = 4; // we just know this; 2 octets of header, // 1 octet of data, 1 octet of null data // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->edgecolor = (short int) edcolor; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetEdgeVis( cdImagePtr im, int edvis ) { // Set the visibility of the edge of filled-area elements. // Attribute: Edge Visibility; Elem Class 5; Elem ID 30 // These attributes stay in effect until changed, so you don't have to output // them every time. // Edge Visibility (integer 0 or 1, corresponding to: Off, On) // Attribute is 16 bit signed int. // unsigned char *es, *esp; int octet_count, temp; // First check and see if the user doesn't want any changes, // if so, just return success if ( edvis == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( edvis == im->edgevis ) return 1; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 30, 2 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; temp = edvis >> 8; *es = *es | ( temp & 0377 ); es++; *es = *es | ( edvis & 0377 ); es++; octet_count += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->edgevis = (short int) edvis; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetTextFont( cdImagePtr im, int font ) { // Attribute: Text Font Index; Elem Class 5; Elem ID 10 // font is an index into the font table. it can have one of the following // values: // 1 Times Roman // 2 Times Bold // 3 Times Italic // 4 Times Bold Italic // 5 Helvetica // 6 Helvetica Bold // 7 Helvetica Italic // 8 Helvetica Bold Italic // 9 Courier // 10 Courier Bold // 11 Courier Italic // 12 Courier Bold Italic // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( font == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( font == im->textfont ) return 1; // Make sure that font is between 1 and the number of fonts if ( ( font < 1 ) || ( font > im->numfonts ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 10, 2 ) ) { free( esp ); return 0; } es += 2; es += cdAppShort( es, (short int) font ); octet_count = 4; // we just know this // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->textfont = (short int) font; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetTextColor( cdImagePtr im, int color ) { // Attribute: Text Colour ; Elem Class 5; Elem ID 14 // set the forground color of text // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( color == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( color == im->textcolor ) return 1; // Make sure the color they want to use has been allocated. // also, that color must be non-negative if ( ( color >= im->colorsTotal ) || ( color < 0 ) ) return 0; // you must allocate a color before you use it // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 14, 1 ) ) { free( esp ); return 0; } es += 2; *es = 0377 & color; // mask off last 8 bits and put in es es++; octet_count = 4; // we just know this; 2 octets of header, // 1 octet of data, 1 octet of null data // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->textcolor = (short int) color; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetTextHeight( cdImagePtr im, int height ) { // Attribute: Character Height; Elem Class 5; Elem ID 15 // the height is in the same units as line width // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( height == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( height == im->textheight ) return 1; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 15, 2 ) ) { free( esp ); return 0; } octet_count = 2; es += 2; es += cdAppShort( es, height ); octet_count += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->textheight = height; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetTextPath( cdImagePtr im, int tpath ) { // Attribute: Text Path; Elem Class 5; Elem ID 17 // Is one of: // 0 right -- Means the direction of the character base vector // 1 left -- means 180 degrees from the character base vector // 2 up -- means the direction of the character up vector // 3 down -- means 180 degrees from the character up vector // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( tpath == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( tpath == im->textpath ) return 1; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; octet_count = 0; if ( !cdcomhead( es, 5, 17, 2 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; es += cdAppShort( es, (short int) tpath ); octet_count += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->textpath = (short int) tpath; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetTextOrient( cdImagePtr im, int xup, int yup, int xbase, int ybase ) { // Attribute: Character Orientation; Elem Class 5; Elem ID 16 // (xbase,ybase) is the run and the rise of the line that the text is // written along. For regular text at an angle, set xup = -ybase // and yup = xbase. Setting it to something different will result in // skewed text (which may be what you want.) Text written from bottom to // top at a 90 degree angle would have the following parameters // xup=-1, yup=0, xbase=0, ybase=1 // // This function adds the Orientation to the metafile every time. // It does not follow the normal -1 for no change, although if you // put in the same numbers it won't re-add it to the meta file. // unsigned char *es, *esp; int octet_count; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; octet_count = 0; if ( !cdcomhead( es, 5, 16, 8 ) ) { free( esp ); return 0; } es += 2; octet_count += 2; // In the metafile it is a 16 bit signed integer // add xup es += cdAppShort( es, (short int) xup ); octet_count += 2; // add the rest es += cdAppShort( es, (short int) yup ); octet_count += 2; es += cdAppShort( es, (short int) xbase ); octet_count += 2; es += cdAppShort( es, (short int) ybase ); octet_count += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetMarkerType( cdImagePtr im, int mtype ) { // Attribute: Marker Type; Elem Class 5; Elem ID 6 // Set the Marker type. Possible values are: // 1=dot, 2=plus, 3=asterisk, 4=circle, 5=cross // Even though new ones can be defined, I am limiting lntype to these values // If you really need more, you can make the proper changes. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( mtype == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( mtype == im->mtype ) return 1; // Make sure that mtype is between 1 and 5 if ( ( mtype < 1 ) || ( mtype > 5 ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 6, 2 ) ) { free( esp ); return 0; } es += 2; // set Param_List_Len to 2 (signed int at index precision) // add in the value of mtype es += cdAppShort( es, (short int) mtype ); octet_count = 4; // we just know this // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->mtype = (short int) mtype; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetMarkerSize( cdImagePtr im, int msize ) { // Attribute: Marker Size; Elem Class 5; Elem ID 7 // sets the marker size. with an image of height X with marker size 1 // the displayed size will be 1/X%. as an example, if you image is // x=5, y=10, and you set marker size = 1, and draw a marker, the // resulting marker will cover 20% of horizontal area. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( msize == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( msize == im->msize ) return 1; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; //gej: marker size is 32 bit floating point number, 16 bits before the // decimal, 16 bits after if marker spec is default (1, scaled) // for absolute mode (0, absolute) it is 16 bit SI if ( im->markerspec ) { if ( !cdcomhead( es, 5, 7, 4 ) ) { free( esp ); return 0; } octet_count = 2; es += 2; es += cdAppShort( es, (short int) msize ); octet_count += 2; // the next two (after decimal point) will always be zero es += cdAppNull( es, 2 ); octet_count += 2; } else { if ( !cdcomhead( es, 5, 7, 4 ) ) { free( esp ); return 0; } octet_count = 2; es += 2; es += cdAppShort( es, (short int) msize ); octet_count += 2; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->msize = msize; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetMarkerColor( cdImagePtr im, int mcolor ) { // Attribute: Marker Colour; Elem Class 5; Elem ID 8 // Sets the marker color. mcolor should be an index into the color // table that you have previously allocated. // unsigned char *es, *esp; int octet_count; // First check and see if the user doesn't want any changes, // if so, just return success if ( mcolor == -1 ) return 1; // Check and see if the value it is being set to is the current // value, if so, don't make any changes, just return 1 if ( mcolor == im->mcolor ) return 1; // Make sure the color they want to use has been allocated. // also, that color must be non-negative if ( ( mcolor >= im->colorsTotal ) || ( mcolor < 0 ) ) return 0; // you must allocate a color before you use it // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 8, 1 ) ) { free( esp ); return 0; } es += 2; *es = 0377 & mcolor; // mask off last 8 bits and put in es es++; es += cdAppNull( es, 1 ); octet_count = 4; // we just know this; 2 octets of header, // 1 octet of data, 1 octet of null data // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->mcolor = (short int) mcolor; free( esp ); return 1; } else { free( esp ); return 0; } } int cdSetLineAttrib( cdImagePtr im, int lntype, int lnwidth, int lncolor ) { // Spits out the attributes of lines. These attributes stay in effect // until changed, so you don't have to output them every time. // if ( !cdSetLineType( im, lntype ) ) return 0; if ( !cdSetLineWidth( im, lnwidth ) ) return 0; if ( !cdSetLineColor( im, lncolor ) ) return 0; return 1; } int cdSetShapeFillAttrib( cdImagePtr im, int instyle, int incolor, int inhatch ) { // Spits out the attributes for the interior of filled-area elements. // These attributes stay in effect until changed, so you don't have to output // them every time. // Set the following attributes: // Interior Style: (integers 0-6, corresponding to: hollow, solid, // [not pattern], hatch, empty, [not geometric pattern], // interpolated.) // Fill Colour: (index into the color table) // Hatch Index: (integers 1-6, corresponding to: horizontal lines, // vertical lines, pos. slope parallel lines, // neg. slope parallel lines, horizontal/vertical // crosshatch, positive/negative slope crosshatch) // if ( !cdSetFillStyle( im, instyle ) ) return 0; if ( !cdSetFillColor( im, incolor ) ) return 0; if ( !cdSetFillHatch( im, inhatch ) ) return 0; return 1; } int cdSetShapeEdgeAttrib( cdImagePtr im, int edtype, int edwidth, int edcolor, int edvis ) { // Spits out the attributes for the edges of filled-area elements. It may // seem logical that these would be the same as the corresponding line // attributes, but this is not the case. // These attributes stay in effect until changed, so you don't have to output // them every time. // Set the following attributes: // Edge Type (integers 1-5, corresponding to: solid, dash, dot, // dash-dot, dash-dot-dot. These are the same as those used // for line type.) // Edge Width (should be the same as line width) // Edge Colour (index into the color table) // Edge Visibility (integer 0 or 1, corresponding to: Off, On) // if ( !cdSetEdgeType( im, edtype ) ) return 0; if ( !cdSetEdgeWidth( im, edwidth ) ) return 0; if ( !cdSetEdgeColor( im, edcolor ) ) return 0; if ( !cdSetEdgeVis( im, edvis ) ) return 0; return 1; } int cdSetTextAttrib( cdImagePtr im, int font, int color, int height ) { // Set the attributes of text. the font is an integer pointer into the // font list where: // 1 Times // 2 Times Bold // 3 Times Italic // 4 Times Bold Italic // 5 Helvetica // 6 Helvetica Bold // 7 Helvetica Italic // 8 Helvetica Bold Italic // 9 Courier // 10 Courier Bold // 11 Courier Italic // 12 Courier Bold Italic // color is an index into the colortable which is the color of the text // size is the approximate size you want the text written in. // if ( !cdSetTextFont( im, font ) ) return 0; if ( !cdSetTextColor( im, color ) ) return 0; if ( !cdSetTextHeight( im, height ) ) return 0; return 1; } int cdSetMarkerAttrib( cdImagePtr im, int mtype, int msize, int mcolor ) { // Spits out the attributes of Markers. These attributes stay in effect // until changed, so you don't have to output them every time. // if ( !cdSetMarkerType( im, mtype ) ) return 0; if ( !cdSetMarkerSize( im, msize ) ) return 0; if ( !cdSetMarkerColor( im, mcolor ) ) return 0; return 1; } int cdImageDestroy( cdImagePtr im ) // gej: should work, unless I make changes to cdImage Struct { if ( im->elemlist ) { free( im->elemlist ); } if ( im->desc ) { free( im->desc ); } if ( im->fontlist ) { free( im->fontlist ); } free( im ); return 1; } int cdImageColorClosest( cdImagePtr im, int r, int g, int b ) // From gd library, see README file for copyright information // gej: should work unchanged // gej: 5/96, changed the colors to use short int { short int i; long rd, gd, bd; int ct = ( -1 ); long mindist = 0; for ( i = 0; ( i < ( im->colorsTotal ) ); i++ ) { long dist; if ( im->open[i] ) { continue; } rd = ( im->red[i] - r ); gd = ( im->green[i] - g ); bd = ( im->blue[i] - b ); dist = rd * rd + gd * gd + bd * bd; if ( ( i == 0 ) || ( dist < mindist ) ) { mindist = dist; ct = i; } } return ct; } int cdImageColorClear( cdImagePtr im ) { // mark all entries in the color table as open short int i; for ( i = 0; ( i < ( cdMaxColors ) ); i++ ) { im->open[i] = 1; } return 1; } int cdImageColorExact( cdImagePtr im, int r, int g, int b ) // From gd library, see README file for copyright information // gej: should work unchanged // gej: 5/96, changed colors to work with short ints { short int i; for ( i = 0; ( i < ( im->colorsTotal ) ); i++ ) { if ( im->open[i] ) { continue; } if ( ( im->red[i] == r ) && ( im->green[i] == g ) && ( im->blue[i] == b ) ) { return i; } } return -1; } static int cdImageAddColorIndex( cdImagePtr im, int r, int g, int b ) // adds the specified color to the colortable in the cdImagePtr. // does not add it to the cgm file, cdImageAddColor does. // do not use either of these two functions, use cdImageColorAllocate. // { short int i; short int ct = ( -1 ); for ( i = 0; ( i < ( im->colorsTotal ) ); i++ ) { if ( im->open[i] ) { ct = i; break; } } if ( ct == ( -1 ) ) { ct = im->colorsTotal; if ( ct == cdMaxColors ) { return -1; } im->colorsTotal++; } im->red[ct] = (short int) r; im->green[ct] = (short int) g; im->blue[ct] = (short int) b; im->open[ct] = (short int) 0; return ct; } static int cdImageAddColor( cdImagePtr im, int si, int ei ) // adds colors to the cgm file, gets values from the color table. // adds all colors from si to ei inclusive. // Use cdImageColorAllocate, not this one. // { unsigned char *cts, *ctsp; // GEJ: color table attribute int octet_count; // GEJ: octet count int numco, curly; octet_count = 0; // // Attribute: Colour Table; Elem Class 5; Elem ID 34 // two parameters P1: Starting colour table index (1 octet, UI) // P2: list of direct colour values 3-tuples (3 one-octet values) // // G E J: find out how many values are being added if ( ei < 0 ) return -1; // no colors being added numco = ei - si + 1; if ( ( numco > 0 ) && ( numco < 10 ) ) { // we can use the short form of the command // allocate sufficent space. Should be 32 bits * 10 to be safe cts = (unsigned char *) calloc( 4 * 10, SIZEOF( unsigned char ) ); if ( !cts ) return -1; // memory allocation failed ctsp = cts; if ( !cdcomhead( ctsp, 5, 34, ( numco * 3 ) + 1 ) ) { free( cts ); return -1; } ctsp += 2; octet_count += 2; } else if ( ( numco > 9 ) && ( numco < 256 ) ) { // we must use the long form of the command // allocate sufficent space. Should be 32 bits*256 to be safe cts = (unsigned char *) calloc( 256 * 4, SIZEOF( unsigned char ) ); if ( !cts ) return -1; // memory allocation failed ctsp = cts; if ( !cdcomheadlong( ctsp, 5, 34, ( numco * 3 ) + 1 ) ) { free( cts ); return -1; } ctsp += 4; octet_count += 4; } else { return -1; } //ctsp += cdAppByte(ctsp, (short int) si); cdAppByte( ctsp, (short int) si ); ctsp++; octet_count++; for ( numco = si; numco <= ei; numco++ ) { ctsp += cdAppByte( ctsp, im->red[numco] ); ctsp += cdAppByte( ctsp, im->green[numco] ); ctsp += cdAppByte( ctsp, im->blue[numco] ); octet_count += 3; } curly = 4 - ( octet_count % 4 ); if ( curly % 4 ) { octet_count += curly; ctsp += cdAppNull( ctsp, curly ); } // add it to the buffer if ( cdAddElem( im, cts, octet_count ) ) { free( cts ); return 1; } else { free( cts ); return -1; } } int cdImageColorAllocate( cdImagePtr im, int r, int g, int b ) // From gd library, see README file for copyright information // gej: modified to allocate the color in the CGM buffer as well // as the color table // gej: 5/96, modified to use short ints for colors { short int ct; ct = cdImageAddColorIndex( im, r, g, b ); if ( ct == -1 ) return -1; // GEJ: w we have successfully alocated it in the color table // so let's put it in the CGM as well. // if ( cdImageAddColor( im, ct, ct ) == -1 ) { return -1; } else { return ct; } } int cdImageColor16( cdImagePtr im ) { // allocate the 16 basic colors in the windows pallete // // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // cdImageColorAllocate(im, 0, 0, 0); // int si, ei, li; si = cdImageAddColorIndex( im, 255, 255, 255 ); if ( si == -1 ) return 0; li = -1; ei = si; ei = cdImageAddColorIndex( im, 0, 0, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 128, 0, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 0, 128, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 128, 128, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 0, 0, 128 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 128, 0, 128 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 0, 128, 128 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 128, 128, 128 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 192, 192, 192 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 255, 0, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 0, 255, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 255, 255, 0 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 0, 0, 255 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 255, 0, 255 ); if ( ei != -1 ) { li = ei; } ei = cdImageAddColorIndex( im, 0, 255, 255 ); if ( ei != -1 ) { li = ei; } if ( ei == -1 ) { ei = li; } if ( cdImageAddColor( im, si, ei ) == -1 ) { return -1; } else { return ei; } } int cdImageColorDeallocate( cdImagePtr im, int color ) // wogl: the parameter names are commented to avoid compiler warnings // From gd library, see README file for copyright information // gej: should work unchanged { // Mark it open. //im->open[color] = 1; // gej: really can't work, we are not allowing redefinition // of color table entries return 0; } int cdLine( cdImagePtr im, int x1, int y1, int x2, int y2 ) // Graphic Primitive: Polyline; Elem Class 4; Elem ID 1 // Actually generate the line, if you are writing a program to use this // library, use this function, not cdImageLine or cdImageDashedLine, // those are just in for compatiblilty with gd // // This function will draw a line using the current line type, width, and color // { unsigned char *es, *esp; int octet_count; short int sweet; short int sour; // check to make sure the line is withing the scope of the picture // ie. the values you give for drawing the line are within // the values you created the picture with if ( !( cdImageBoundsSafe( im, x1, y1 ) ) || !( cdImageBoundsSafe( im, x2, y2 ) ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 4, 1, 8 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; // now we are ready for the parameter data sweet = (short int) x1; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) y1; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) x2; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) y2; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; octet_count++; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdMarker( cdImagePtr im, int x, int y ) // Graphic Primitive: PolyMarker; Elem Class 4; Elem ID 3 // puts a marker in the file, it will have characteristics set by // cdSetMarkerAttrib // { unsigned char *es, *esp; int octet_count; // check to make sure the line is withing the scope of the picture // ie. the values you give for drawing the line are within // the values you created the picture with if ( !cdImageBoundsSafe( im, x, y ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 4, 3, 4 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; octet_count += cdAppShort( es, (short int) x ); es += 2; octet_count += cdAppShort( es, (short int) y ); es += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdRectangle( cdImagePtr im, int x1, int y1, int x2, int y2 ) { // Graphic Primitive: rectangle; Elem Class 4; Elem ID 11 // Actually generate the rectangle, if you are writing a program to use this // library, use this function, not cdImageRectangle, // those are just in for compatiblilty with gd // // This function will draw a Rectangle using the current // edge type, width, color, and visibility, and the current // fill style, color, and hatch // unsigned char *es, *esp; int octet_count; short int sweet; short int sour; // check to make sure the line is withing the scope of the picture // ie. the values you give for drawing the line are within // the values you created the picture with if ( !( cdImageBoundsSafe( im, x1, y1 ) ) || !( cdImageBoundsSafe( im, x2, y2 ) ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are four 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 11, 8 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; // now we are ready for the parameter data sweet = (short int) x1; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) y1; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) x2; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) y2; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; octet_count++; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdCircle( cdImagePtr im, int cx, int cy, int r ) { // Graphic Primitive: circle; Elem Class 4; Elem ID 12 // cx,cy is the center of the circle, r is the radius // // This function will draw a Circle using the current // edge type, width, color, and visibility, and the current // fill style, color, and hatch // unsigned char *es, *esp; int octet_count; short int sweet; short int sour; // check to make sure the circle is withing the scope of the picture // ie. the values you give for drawing the circle are within // the values you created the picture with if ( !( cdImageBoundsSafe( im, cx, cy ) ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are three 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 12, 6 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; // now we are ready for the parameter data sweet = (short int) cx; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) cy; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) r; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; octet_count++; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdArc3Pt( cdImagePtr im, int sx, int sy, int ix, int iy, int ex, int ey ) { // Graphic Primitive: Cicular Arc 3 Point; Elem Class 4; Elem ID 13 // // This function will draw a Circular Arc using the current // Line type, width, and color, // unsigned char *es, *esp; int octet_count; short int sweet; short int sour; // check to make sure the line is withing the scope of the picture // ie. the values you give for drawing the line are within // the values you created the picture with if ( !( cdImageBoundsSafe( im, sx, sy ) ) || !( cdImageBoundsSafe( im, ix, iy ) ) || !( cdImageBoundsSafe( im, ex, ey ) ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are six 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 13, 12 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; // now we are ready for the parameter data sweet = (short int) sx; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) sy; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) ix; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) iy; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) ex; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; es++; octet_count++; sweet = (short int) ey; sour = sweet >> 8; *es = *es | ( sour & 0377 ); es++; octet_count++; *es = (unsigned char) sweet; octet_count++; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdArc3PtClose( cdImagePtr im, int sx, int sy, int ix, int iy, int ex, int ey, int cl ) { // Graphic Primitive: Cicular Arc 3 Point Close; Elem Class 4; Elem ID 14 // // This function will draw a Circle using the current // edge type, width, color, and visibility, and the current // fill style, color, and hatch // // cd is the closure type. It can be either 0 for pie closure or // 1 for chord closure. // unsigned char *es, *esp; int octet_count; // check to make sure the line is withing the scope of the picture // ie. the values you give for drawing the line are within // the values you created the picture with if ( !( cdImageBoundsSafe( im, sx, sy ) ) || !( cdImageBoundsSafe( im, ix, iy ) ) || !( cdImageBoundsSafe( im, ex, ey ) ) ) return 0; // make sure that they close the arc either with pie (0) or chord (1) if ( ( cl != 0 ) && ( cl != 1 ) ) return 0; // allocate sufficent space. should be 32 bits * 6 to be safe es = (unsigned char *) calloc( 4 * 6, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are seven 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 14, 14 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; // now we are ready for the parameter data octet_count += cdAppShort( es, (short int) sx ); es += 2; octet_count += cdAppShort( es, (short int) sy ); es += 2; octet_count += cdAppShort( es, (short int) ix ); es += 2; octet_count += cdAppShort( es, (short int) iy ); es += 2; octet_count += cdAppShort( es, (short int) ex ); es += 2; octet_count += cdAppShort( es, (short int) ey ); es += 2; octet_count += cdAppShort( es, (short int) cl ); es += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdEllipse( cdImagePtr im, int cx, int cy, int d1x, int d1y, int d2x, int d2y ) { // Graphic Primitive: Ellipse; Elem Class 4; Elem ID 17 // // This function will draw an Ellipse using the current // edge type, width, color, and visibility, and the current // fill style, color, and hatch // unsigned char *es, *esp; int octet_count; // check to make sure the line is withing the scope of the picture // ie. the values you give for drawing the line are within // the values you created the picture with if ( !( cdImageBoundsSafe( im, cx, cy ) ) || !( cdImageBoundsSafe( im, d1x, d1y ) ) || !( cdImageBoundsSafe( im, d2x, d2y ) ) ) return 0; // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are six 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 17, 12 ) ) { free( esp ); return 0; } es += 2; octet_count = 2; // now we are ready for the parameter data octet_count += cdAppShort( es, (short int) cx ); es += 2; octet_count += cdAppShort( es, (short int) cy ); es += 2; octet_count += cdAppShort( es, (short int) d1x ); es += 2; octet_count += cdAppShort( es, (short int) d1y ); es += 2; octet_count += cdAppShort( es, (short int) d2x ); es += 2; octet_count += cdAppShort( es, (short int) d2y ); es += 2; // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdPolygon( cdImagePtr im, cdPointPtr p, int n ) { // Graphic Primitive: Polygon; Elem Class 4; Elem ID 7 // // cdPointPtr is defined in cd.h, basically, it is two arrays of integers // p[m].x and p[m].y containing the x and y values respectively. n // is the number of points in this array (not the index of the last point, // which is n-1). n must be at least 3 (otherwise // you really don't have much of a polygon, it is closer to a line.) // // This function will draw a Polygon using the current // edge type, width, color, and visibility, and the current // fill style, color, and hatch // unsigned char *es, *esp; int octet_count; int x; // counter if ( n < 3 ) return 0; // it is either a point or a line if ( n < 8 ) { // It fits in the short form of the command, lets us // add it right now, shall we? // allocate sufficent space. Should be 32 bits*10 to be safe es = (unsigned char *) calloc( 4 * 10, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are n*2 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 7, ( n * 4 ) ) ) { free( esp ); return 0; } es += 2; octet_count = 2; } else if ( n < 8191 ) { // there are more than 7 points in it, that sucks // gej, so basically, for this one, I set the header // to cdcomhead(es, 4, 7, 31) then write a function for the long // form that takes the first 15 bits of n and tags a 0 in front // of it and puts it in es, than I do the for loop all over again // that doesn't seem too hard. But I will leave that for another // day. // // keep in mind that if CDGROWLISTSIZE is smaller than n*4 // (at most 32769) then things could fail in a most unsavory fashion. // // allocate sufficent space. 32 bits*(n+1) to be safe es = (unsigned char *) calloc( 4 * ( n + 1 ), SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomheadlong( es, 4, 7, ( n * 4 ) ) ) { free( esp ); return 0; } es += 4; octet_count = 4; } else { // there are more than 8191 points in it, I am not going to implement // that, if you want it that bad, do it yourself. return 0; } for ( x = 0; x < n; x++ ) { // now we are ready for the parameter data es += cdAppShort( es, (short int) p->x ); es += cdAppShort( es, (short int) p->y ); octet_count += 4; p++; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdPolygonSet( cdImagePtr im, cdPointPtr p, int n ) { // Graphic Primitive: Polygon; Elem Class 4; Elem ID 8 // // cdPointPtr is defined in cd.h, basically, it is three arrays of integers // p[m].x and p[m].y containing the x and y values respectively and p[m].e // the characteristics of the line leaving point n (0=invisible,1=visible, // 2=close,invisible, 3=close,visible). n is the number of points in this // array (not the index of the last point, which is n-1). // n must be at least 3 (otherwise you really don't have much of a polygon, // it is closer to a line.) // // This function will draw a set of Polygons using the current // edge type, width, color, and the current // fill style, color, and hatch // unsigned char *es, *esp; int octet_count; int x; // counter if ( n < 3 ) return 0; // it is either a point or a line if ( n < 6 ) { // It fits in the short form of the command, lets us // add it right now, shall we? // allocate sufficent space. Should be 48 bits*10 to be safe es = (unsigned char *) calloc( 6 * 10, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are n*2 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 8, ( n * 6 ) ) ) { free( esp ); return 0; } es += 2; octet_count = 2; } else if ( n < 5462 ) { // there are more than 5 points in it, that sucks // gej, so basically, for this one, I set the header // to cdcomhead(es, 4, 7, 31) then write a function for the long // form that takes the first 15 bits of n and tags a 0 in front // of it and puts it in es, than I do the for loop all over again // that doesn't seem too hard. But I will leave that for another // day. // // keep in mind that if CDGROWLISTSIZE is smaller than n*6 // (at most 32769) then things could fail in a most unsavory fashion. // // allocate sufficent space. 48 bits*(n+1) to be safe es = (unsigned char *) calloc( 6 * ( n + 1 ), SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomheadlong( es, 4, 8, ( n * 6 ) ) ) { free( esp ); return 0; } es += 4; octet_count = 4; } else { // there are more than 5462 points in it, I am not going to implement // that, if you want it that bad, do it yourself. return 0; } for ( x = 0; x < n; x++ ) { // now we are ready for the parameter data es += cdAppShort( es, (short int) p->x ); es += cdAppShort( es, (short int) p->y ); es += cdAppShort( es, (short int) p->e ); octet_count += 6; p++; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdPolyLine( cdImagePtr im, cdPointPtr p, int n ) { // Graphic Primitive: Polyline; Elem Class 4; Elem ID 1 // // cdPointPtr is defined in cd.h, basically, it is two arrays of integers // p[m].x and p[m].y containing the x and y values respectively. n // is the number of points in this array (not the index of the last point, // which is n-1). if n is 2, it is a regular line, like cdline // // This function will draw a Polyline using the current // line type, width, color, and visibility, // unsigned char *es, *esp; int octet_count; int x; // counter if ( n < 2 ) return 0; // it is a point if ( n < 8 ) { // It fits in the short form of the command, lets us // add it right now, shall we? // allocate sufficent space. Should be 32 bits*10 to be safe es = (unsigned char *) calloc( 4 * 10, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are n*2 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 1, ( n * 4 ) ) ) { free( esp ); return 0; } es += 2; octet_count = 2; } else if ( n < 8191 ) { // there are more than 7 points in it, that sucks // gej, so basically, for this one, I set the header // using the long version cdcomheadlong(es, 4, 1, n*4) // // keep in mind that if CDGROWLISTSIZE is smaller than n*4 // (at most 32769) then the list may have to grow several times // // allocate sufficent space. 32 bits*(n+1) to be safe es = (unsigned char *) calloc( 4 * ( n + 1 ), SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomheadlong( es, 4, 1, ( n * 4 ) ) ) { free( esp ); return 0; } es += 4; octet_count = 4; } else { // there are more than 8191 points in it, I am not going to implement // that, if you want it that bad, do it yourself. return 0; } for ( x = 0; x < n; x++ ) { // now we are ready for the parameter data es += cdAppShort( es, (short int) p->x ); es += cdAppShort( es, (short int) p->y ); octet_count += 4; p++; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdPolyMarker( cdImagePtr im, cdPointPtr p, int n ) { // Graphic Primitive: PolyMarker; Elem Class 4; Elem ID 3 // // cdPointPtr is defined in cd.h, basically, it is two arrays of integers // p[m].x and p[m].y containing the x and y values respectively. n // is the number of points in this array (not the index of the last point, // which is n-1). if n is 2, it is a regular line, like cdline // // This function will insert n markers using the current // Marker type, width, color, and visibility, // unsigned char *es, *esp; int octet_count; int x; // counter if ( n < 1 ) return 0; // it is nothing if ( n < 8 ) { // It fits in the short form of the command, lets us // add it right now, shall we? // allocate sufficent space. Should be 32 bits*10 to be safe es = (unsigned char *) calloc( 4 * 10, SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; // their are n*2 16 bit signed integers as attributes if ( !cdcomhead( es, 4, 3, ( n * 4 ) ) ) { free( esp ); return 0; } es += 2; octet_count = 2; } else if ( n < 8191 ) { // there are more than 7 points in it, that sucks // gej, so basically, for this one, I set the header // using the long version cdcomheadlong(es, 4, 1, n*4) // // keep in mind that if CDGROWLISTSIZE is smaller than n*4 // (at most 32769) then the list may have to grow several times // // allocate sufficent space. 32 bits*(n+1) to be safe es = (unsigned char *) calloc( 4 * ( n + 1 ), SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomheadlong( es, 4, 3, ( n * 4 ) ) ) { free( esp ); return 0; } es += 4; octet_count = 4; } else { // there are more than 8191 points in it, I am not going to implement // that, if you want it that bad, do it yourself. return 0; } for ( x = 0; x < n; x++ ) { // now we are ready for the parameter data es += cdAppShort( es, (short int) p->x ); es += cdAppShort( es, (short int) p->y ); octet_count += 4; p++; } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdText( cdImagePtr im, int x, int y, const char *ts ) { // Graphic Primitive: Text; Elem Class 4; Elem ID 4 // add text to the picture. Start it at the point (x,y) // this should be the lower left corner of where the text is // the parameters are point, enumerated(set to 1), string // // String encoding in CGM is a little strange. After you have the other // parameter info, the first octet for the string is either 0..254 which // is the number of octets of string data, or 255 which signifies a long // string. if it is 255 then the next 16 bits indicate the length of the // string. the first bit (bit15) is 0 if this is the last part of the // string and 1 if another part follows it. the next 15 bits are in the // range 0..32767 and are the number of octets of string info following. // so the length stored in the command header is the whole enchelada. // int tslen, curly; unsigned char *es, *esp; int octet_count; // check to make sure the Text is within the scope of the picture // actually, I am only checking the start of it // if ( !( cdImageBoundsSafe( im, x, y ) ) ) return 0; // allocate sufficent space. should be tslen+ 32 bits * 4 to be safe tslen = strlen( ts ); // if there are more than 32700 characters fail // gej: this could go as high as 32767 I think, but lets // cut it off at 32700 if ( ( tslen > 32700 ) || ( tslen < 0 ) ) return 0; es = (unsigned char *) calloc( ( ( 4 * 4 ) + tslen ), SIZEOF( unsigned char ) ); if ( !es ) return 0; // memory allocation failed esp = es; if ( !cdcomheadlong( es, 4, 4, 9 + tslen ) ) { free( esp ); return 0; } es += 4; octet_count = 4; // add the x position, the y position, then 1, which signifies // that this is all the text, there is none appended after it es += cdAppShort( es, (short int) x ); es += cdAppShort( es, (short int) y ); es += cdAppShort( es, (short int) 1 ); octet_count += 6; // now take care of the string information, for strings 254 bytes // or less, I could use a short one, but why bother, use the long // form for everything es += cdAppByte( es, (short int) 255 ); es += cdAppShort( es, (short int) tslen ); octet_count += 3; // gej: I should set bit 15 to 0 because it is the final part of a // string but I am not going to since I already checked that it was // a 16 number that was non-negative while ( *ts ) { *es++ = (unsigned char) *ts++; } octet_count += tslen; // now if the octet_count is not divisible by 4 add null padding curly = 4 - ( octet_count % 4 ); if ( curly % 4 ) { octet_count += curly; es += cdAppNull( es, curly ); } // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); return 1; } else { free( esp ); return 0; } } int cdImageLine( cdImagePtr im, int x1, int y1, int x2, int y2, int color ) // gej: this should be so much easier to do as a cgm // This is in for compatibility with gd, if you don't need that, use // cdLine instead { int ltstate; // save the linetype state ltstate = im->ltype; // set the attributes of the line if ( !cdSetLineAttrib( im, 1, -1, color ) ) return 0; if ( !cdLine( im, x1, y1, x2, y2 ) ) return 0; // draw the line // restore the state If it fails, don't return an error, because // the line was still drawn cdSetLineType( im, ltstate ); return 1; } int cdImageDashedLine( cdImagePtr im, int x1, int y1, int x2, int y2, int color ) // gej: this should be so much easier to do as a cgm // in order to really get a dashed line you must call cdSetLineType first // This is in for compatibility with gd, if you don't need that, use // cdLine instead { // set the attributes of the line if ( !cdSetLineAttrib( im, -1, -1, color ) ) return 0; // generate the line if ( !cdLine( im, x1, y1, x2, y2 ) ) return 0; // everthing is A-OK return 1; } int cdImageBoundsSafe( cdImagePtr im, int x, int y ) // From gd library, see README file for copyright information // gej: this should work unchanged { return ( !( ( ( y < 0 ) || ( y >= im->sy ) ) || ( ( x < 0 ) || ( x >= im->sx ) ) ) ); } int cdImageRectangle( cdImagePtr im, int x1, int y1, int x2, int y2, int color ) // Graphic Primitive: rectangle; Elem Class 4; Elem ID 11 // // gej: but I think I will use the cgm rectangle { if ( !cdImageLine( im, x1, y1, x2, y1, color ) ) return 0; if ( !cdImageLine( im, x1, y2, x2, y2, color ) ) return 0; if ( !cdImageLine( im, x1, y1, x1, y2, color ) ) return 0; if ( !cdImageLine( im, x2, y1, x2, y2, color ) ) return 0; return 1; } // Expert functions. If you need more control, you can use these // functions, but you probably won't need to. int cdImageSetSize( cdImagePtr im, int x, int y ) // sets the width and height of subsequent pictures. { im->sx = x; im->sy = y; return 1; } int cdImageSetLineSpec( cdImagePtr im, int specmode ) // Picture Descriptor: Line Width Specification Mode; Elem Class 2; Elem ID 3 // sets the Line Width Specification mode of subsequent pictures. // 1 is scaled (default), 2 is absolute { if ( ( specmode < 0 ) || ( specmode > 2 ) ) return 0; im->linespec = specmode; return 1; } int cdImageSetMarkerSpec( cdImagePtr im, int specmode ) // Picture Descriptor: Marker Size Specification Mode; Elem Class 2; Elem ID 4 // sets the Marker Width Specification mode of subsequent pictures. // 1 is scaled (default), 2 is absolute { if ( ( specmode < 0 ) || ( specmode > 2 ) ) return 0; im->linespec = specmode; return 1; } int cdImageSetEdgeSpec( cdImagePtr im, int specmode ) // Picture Descriptor: Edge Width Specification Mode; Elem Class 2; Elem ID 5 // sets the Edge Width Specification mode of subsequent pictures. // 1 is scaled (default), 2 is absolute { if ( ( specmode < 0 ) || ( specmode > 2 ) ) return 0; im->edgespec = specmode; return 1; } int cdImageSetOutput( cdImagePtr im, FILE *output ) // sets the output file to *output. which must already be open. // does not close the file // Useful if you want to write the file as you go along, or if you // want to write it to a stream // { if ( output ) { im->outfile = output; return 1; } else { return 0; } } int cdImageAddFont( cdImagePtr im, const char *fontname ) // adds a font to the list of fonts. This only has an effect // if you are using the expert functions for starting pictures, and // have not yet opened the first picture. Returns 0 for failure, // and the font index on success { unsigned char *oldfonts; int listsize; oldfonts = im->fontlist; if ( oldfonts ) { listsize = strlen( (char *) oldfonts ) + 1 + strlen( fontname ) + 1; } else { listsize = strlen( fontname ) + 1; } im->fontlist = (unsigned char *) calloc( listsize, SIZEOF( unsigned char ) ); if ( !im->fontlist ) return 0; // memory allocation failed if ( oldfonts ) { sprintf( (char *) im->fontlist, "%s%s%s", (char *) oldfonts, ",", fontname ); } else { sprintf( (char *) im->fontlist, "%s", fontname ); } im->numfonts++; if ( oldfonts ) free( oldfonts ); oldfonts = NULL; return im->numfonts; } int cdImageClearFonts( cdImagePtr im ) // clears out ALL fonts from the font list, including the ones the // package has be default. Useful if you want totally different fonts. // { free( im->fontlist ); im->fontlist = NULL; im->numfonts = 0; return 1; } int cdImageSetDefaults( cdImagePtr im ) // resets the defaults to what is in defines.h { // you must be either before any picture has been created, // or after a picture has closed to call this if ( ( im->state != 0 ) && ( im->state != 2 ) ) return 0; // set line_width, line_height, line_color to the defaults im->ltype = CDLTYPE; im->lwidth = CDLWIDTH; im->lcolor = CDLCOLOR; // interior_style, fill_color, hatch_index im->shapestyle = CDSHAPESTYLE; im->shapecolor = CDSHAPECOLOR; im->shapehatch = CDSHAPEHATCH; // edge_type, edge_width, edge_color, edge_visibility im->edgetype = CDEDGETYPE; im->edgecolor = CDEDGECOLOR; im->edgewidth = CDEDGEWIDTH; im->edgevis = CDEDGEVIS; // text_color, text_height, text_font im->textcolor = CDTEXTCOLOR; im->textheight = CDTEXTHEIGHT; im->textfont = CDTEXTFONT; im->textpath = CDTEXTPATH; // set marker_width, marker_size, marker_color to the defaults im->ltype = CDMTYPE; im->lwidth = CDMSIZE; im->lcolor = CDMCOLOR; // this is set by the expert functions. the defaults should be ok im->linespec = CDLINESPEC; im->edgespec = CDEDGESPEC; im->markerspec = CDMARKERSPEC; return 1; } cdImagePtr cdImageStartCgm() // initializes the CGM and sets up the defaults. If you are using // the "expert" functions, you should call this first. _ge { const char *tmps; int tmpsl; cdImagePtr im; im = (cdImage *) calloc( SIZEOF( cdImage ), 1 ); if ( !im ) return 0; // memory allocation failed // elemlist is set to some number, when it is full, make it bigger im->elemlist = (unsigned char *) calloc( CDSTARTLISTSIZE, SIZEOF( unsigned char ) ); if ( !im->elemlist ) { free( im ); return 0; } // memory allocation failed im->colorsTotal = 0; // you can have multiple pictures in a file, keep track of // which one you are on im->picnum = 0; im->outfile = NULL; // the next three are used for maintaining the element list // don't change these ever im->bytestoend = CDSTARTLISTSIZE; im->listlen = CDSTARTLISTSIZE; im->curelemlist = im->elemlist; // don't make this longer than 250 characters tmps = "'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'"; tmpsl = strlen( tmps ); if ( tmpsl > 250 ) tmpsl = 250; im->desc = (unsigned char *) calloc( tmpsl + 1, SIZEOF( unsigned char ) ); strncpy( (char *) im->desc, tmps, tmpsl ); // The font list can be quite long, but individual font names can // can only be 250 chars tmps = "TIMES_ROMAN,TIMES_BOLD,TIMES_ITALIC,TIMES_BOLD_ITALIC,HELVETICA,HELVETICA_BOLD,HELVETICA_ITALIC,HELVETICA_BOLD_ITALIC,COURIER,COURIER_BOLD,COURIER_ITALIC,COURIER_BOLD_ITALIC"; im->numfonts = 12; tmpsl = strlen( tmps ); im->fontlist = (unsigned char *) calloc( tmpsl + 1, SIZEOF( unsigned char ) ); strcpy( (char *) im->fontlist, tmps ); im->outfile = NULL; if ( !cdImageSetDefaults( im ) ) { cdImageDestroy( im ); } // set the state im->state = 0; // 0 no pictures started, 1 in a picture, // 2 after a picture return im; } int cdImageEndPic( cdImagePtr im ) // close the current picture { unsigned char *es, *esp; int octet_count = 0; // make sure we are really in a picture before ending it if ( im->state != 1 ) { return 0; } esp = (unsigned char *) calloc( 1024, SIZEOF( unsigned char ) ); if ( !esp ) return 0; // memory allocation failed es = esp; // Attribute: End Picture; Elem Class 0; Elem ID 5; Length 0 if ( !cdcomhead( es, 0, 5, 0 ) ) { free( esp ); return 0; } octet_count += 2; if ( cdAddElem( im, esp, octet_count ) ) { free( esp ); im->state = 2; return 1; } else { free( esp ); return 0; } } int cdImageEndCgm( cdImagePtr im ) // close the current CGM file. If an output stream is // defined, write the CGM to it { int x; // counter int used; // number of bytes used in the list unsigned char *efile, *efilep; // end of file information cdImageEndPic( im ); if ( im->state == 2 ) // We have closed the pic, but not the CGM { efile = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !efile ) return 0; // memory allocation failed efilep = efile; // Attribute: End Metafile; Elem Class 0; Elem ID 2 cdcomhead( efilep, 0, 2, 0 ); if ( cdAddElem( im, efile, 2 ) ) { free( efile ); efile = 0; efilep = 0; } else { free( efile ); return 0; } } if ( im->outfile ) { // now output the CGM, one byte at a time used = im->listlen - im->bytestoend; for ( x = 0; x < used; x++ ) { putc( (unsigned char) im->elemlist[x], im->outfile ); } } // else do nothing return 1; } plplot-5.10.0+dfsg/lib/nistcd/color16.c 644 1750 1750 1450211460615444 164420ustar andrewandrew// // Color16 is a test program that is part of the CGM Draw Library. // It Will write out a CGM file that allocates a 16 color pallete // using the function cdImageColor16. These correspond to the 16 // standard Windows colors. // // // color16.c: test program for the cgmdraw module. // // Written by G. Edward Johnson // Date: April 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // #ifndef NOMALLOCH #include #endif #include #include #include #include #include "defines.h" #include "cd.h" int main() { cdImagePtr im; FILE *outf; // Create an image 500 pixels high by 400 pixels wide im = cdImageCreate( 400, 500 ); // allocate the 16 windows colors if ( -1 == cdImageColor16( im ) ) return 1; // Set the fill attributes // fill=solid, colorindex=0, hatch=no change if ( !( cdSetShapeFillAttrib( im, 1, 0, 1 ) ) ) return 1; // set the text attributes // font=helvetica, colorindex=1, size=25 if ( !( cdSetTextAttrib( im, 5, 1, 25 ) ) ) return 1; // The first color index is white, so lets draw a box around it // edge=solid, width=1, color=1 (black), visible=yes cdSetShapeEdgeAttrib( im, 1, 1, 1, 1 ); // Draw a rectangle (10,450) is upper left, (35,425) is lower right if ( !( cdRectangle( im, 10, 450, 35, 425 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 425, "Color Index: 0" ) ) ) return 1; // Make the edges invisible if ( !( cdSetEdgeVis( im, 0 ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 1 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 400, 35, 375 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 375, "Color Index: 1" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 2 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 350, 35, 325 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 325, "Color Index: 2" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 3 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 300, 35, 275 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 275, "Color Index: 3" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 4 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 250, 35, 225 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 225, "Color Index: 4" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 5 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 200, 35, 175 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 175, "Color Index: 5" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 6 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 150, 35, 125 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 125, "Color Index: 6" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 7 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 10, 100, 35, 75 ) ) ) return 1; // Label it if ( !( cdText( im, 40, 75, "Color Index: 7" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 8 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 450, 235, 425 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 425, "Color Index: 8" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 9 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 400, 235, 375 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 375, "Color Index: 9" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 10 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 350, 235, 325 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 325, "Color Index: 10" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 11 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 300, 235, 275 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 275, "Color Index: 11" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 12 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 250, 235, 225 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 225, "Color Index: 12" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 13 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 200, 235, 175 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 175, "Color Index: 13" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 14 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 150, 235, 125 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 125, "Color Index: 14" ) ) ) return 1; // Set the fill color if ( !( cdSetFillColor( im, 15 ) ) ) return 1; // Draw a rectangle if ( !( cdRectangle( im, 210, 100, 235, 75 ) ) ) return 1; // Label it if ( !( cdText( im, 240, 75, "Color Index: 15" ) ) ) return 1; // now put a little thing at the bottom of the picture if ( !cdText( im, 5, 10, "Colors allocated by cdImageColor16" ) ) return 1; // now write the file out, lets call it color16.cgm outf = fopen( "color16.cgm", "wb" ); if ( !outf ) return 1; cdImageCgm( im, outf ); fclose( outf ); outf = 0; // Remember to destroy the image when you are done cdImageDestroy( im ); im = 0; printf( "CGM with 16 color colortable generated as color16.cgm\n" ); return 0; } plplot-5.10.0+dfsg/lib/nistcd/cdsimple.c 644 1750 1750 652711460615444 167450ustar andrewandrew// // cdsimple is a very simple program that uses the cd library. // it will walk you through the basics. // // // cdsimple.c: test program for the cgmdraw module. // // Written by G. Edward Johnson // Date: April 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // #ifndef NOMALLOCH #include #endif #include #include #include #include #include "defines.h" #include "cd.h" int main() { // you must create a pointer to the image(s) that you will be using // not suprisingly, it is of type cdImagePtr cdImagePtr im; // this is a pointer to the output file you will be using FILE *outf; // these will be index's into the color palette containing // the corresponding colors int black, white, blue; // Create an image 400 pixels wide by 500 pixels high im = cdImageCreate( 400, 500 ); // allocate some colors (isn't this fun?) // the first color allocated is the background color white = cdImageColorAllocate( im, 255, 255, 255 ); black = cdImageColorAllocate( im, 0, 0, 0 ); blue = cdImageColorAllocate( im, 0, 0, 255 ); // Set the fill attributes // fill, colorindex, and hatch respectivily // see the cd documentation for a complete description // fill is the color that will be on the inside of filled objects // such as rectangles and polygons. // It can be 1 for solid color, 2 for hatch pattern, 4 for empty // let's use blue for the fill color // we are going to set it to solid, so the hatch pattern doesn't // matter. we will signify no change by putting in -1 if ( !( cdSetShapeFillAttrib( im, 1, blue, -1 ) ) ) return 1; // notice that we also checked to make sure the command actually // worked. // we don't want the edges of our shapes to be a different color // so make them invisible. 0 means invisible, 1 means visible. if ( !( cdSetEdgeVis( im, 0 ) ) ) return 1; // set the text attributes // font, colorindex, and size respectivily // font is the style the text is written in. 1 is for Times, // 5 is for Helvetica. // we will have black text for this one // Size is a tough one, but larger numbers give larger text. // 25 is a not too large size if ( !( cdSetTextAttrib( im, 5, black, 25 ) ) ) return 1; // Now that we have set some attributes, lets do some drawing // Draw a rectangle (10,450) is upper left, (350,350) is lower right if ( !( cdRectangle( im, 10, 450, 350, 350 ) ) ) return 1; // lets put some text in the picture too. // (100,100) is the point at the lower left corner of the text if ( !( cdText( im, 100, 100, "Hello World" ) ) ) return 1; // now write the file out, lets call it cdsimple.cgm outf = fopen( "cdsimple.cgm", "wb" ); if ( !outf ) return 1; cdImageCgm( im, outf ); fclose( outf ); outf = 0; // Remember to destroy the image when you are done cdImageDestroy( im ); im = 0; printf( "I just created a simple CGM!!!\n" ); return 0; } plplot-5.10.0+dfsg/lib/nistcd/cddll.h 644 1750 1750 300011460615444 162130ustar andrewandrew#ifndef __CD_DLL_H #define __CD_DLL_H #ifdef USINGDLL #if defined ( WIN32 ) // Visual C/C++, Borland, MinGW and Watcom #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ ) #define CDDLLEXPORT __declspec( dllexport ) #define CDDLLIMPORT __declspec( dllimport ) #else #define CDDLLEXPORT #define CDDLLIMPORT #endif #elif defined ( __CYGWIN__ ) #define CDDLLEXPORT __declspec( dllexport ) #define CDDLLIMPORT __declspec( dllimport ) #elif defined ( __GNUC__ ) && __GNUC__ > 3 // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x // The following forces exported symbols specifically designated with // CDDLLEXPORT to be visible. #define CDDLLEXPORT __attribute__ ( ( visibility( "default" ) ) ) #define CDDLLIMPORT #endif #endif // For an unknown compiler or static built we clear the macros #ifndef CDDLLEXPORT #define CDDLLEXPORT #define CDDLLIMPORT #endif // The IMPEXP macros will always be set to DLLIMPORT (even for // the static library, but DLLIMPORT is empty in this case). If // cmake sets the corresponding macro xxxx_EXPORTS if the // corresponding library is built DLLIMPEXP is set to DLLEXPORT #if defined ( nistcd_EXPORTS ) #define CDDLLIMPEXP CDDLLEXPORT #define CDDLLIMPEXP_DATA( type ) CDDLLEXPORT type #else #define CDDLLIMPEXP CDDLLIMPORT #define CDDLLIMPEXP_DATA( type ) CDDLLIMPORT type #endif #endif // __CD_DLL_H plplot-5.10.0+dfsg/lib/nistcd/cd1.3.lsm 644 1750 1750 64311155124466 162770ustar andrewandrewBegin3 Title: CGMDraw Version: 1.3 Entered-date: 17JAN97 Description: C Library for creating CGM vector graphics files. Keywords: Computer Graphics Metafile vector CGM library Author: lorax@nist.gov (G. Edward Johnson) Maintained-by: lorax@nist.gov (G. Edward Johnson) Primary-site: zing.ncsl.nist.gov /cgm/cd1.3.tar.gz 44kb Platforms: Sun, Linux, Ultrix, IRIX, AIX, DOS Copying-policy: Freely Redistributable End plplot-5.10.0+dfsg/lib/nistcd/color16.cgm 644 1750 1750 221411155124466 167430ustar andrewandrew4cd: CgmDraw Library"_gf'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'!f TIMES_ROMAN TIMES_BOLD TIMES_ITALICTIMES_BOLD_ITALIC HELVETICAHELVETICA_BOLDHELVETICA_ITALICHELVETICA_BOLD_ITALICCOURIER COURIER_BOLDCOURIER_ITALICCOURIER_BOLD_ITALICj picture 1 B T_1RRQBQSAh #@(Color Index: 0SRAh #w@(wColor Index: 1RAh ^#E@(EColor Index: 2RAh ,#@(Color Index: 3RAh #@(Color Index: 4RAh #@(Color Index: 5RAh #}@(}Color Index: 6RAh d#K@(KColor Index: 7RAh@Color Index: 8R Ahw@wColor Index: 9R Ah^E@EColor Index: 10R Ah,@Color Index: 11R Ah@Color Index: 12R Ah@Color Index: 13RAh}@}Color Index: 14RAhdK@KColor Index: 15@+ "Colors allocated by cdImageColor16@plplot-5.10.0+dfsg/lib/nistcd/cdsimple.cgm 644 1750 1750 67211155124466 172440ustar andrewandrew4cd: CgmDraw Library"_gf'ProfileId: Model-Profile''ProfileEd:1''ColourClass:colour''Source:NIST CGMDraw 1.3''Date: 1996-12-16'!f TIMES_ROMAN TIMES_BOLD TIMES_ITALICTIMES_BOLD_ITALIC HELVETICAHELVETICA_BOLDHELVETICA_ITALICHELVETICA_BOLD_ITALICCOURIER COURIER_BOLDCOURIER_ITALICCOURIER_BOLD_ITALICj picture 1 B TDTDTDRRQBQAh ^^@dd Hello World@plplot-5.10.0+dfsg/lib/nistcd/readme 644 1750 1750 473711155124466 161620ustar andrewandrew Welcome, and thanks for downloading CGM Draw, a package for creating CGM files from a "C" program. If you are reading this then you probably have already unpacked the distribution. You can make it by typing "make all" this will make libcd.a the cd library, as well as several example programs (cdsimple, cdtest, color16, cdexpert, cdmulti, cdtext.) Please read over the documentation in cd.html before using the package. Every effort has been made to ensure that the generated cgm files conform to the standard, however, if you do not use the library properly, you could generate invalid metafiles that no one is able to read, so be careful. Documentation for cd is included with the package, and is available from http://speckle.ncsl.nist.gov/~lorax/cgm/cd.html General information about CGM is available many places on the web, including http://speckle.ncsl.nist.gov/~lsr/cgm.htm This distribution may be retrieved via ftp from zing.ncsl.nist.gov in the directory "cgm" it will have the name cd followed by the version number. I have tested CGM Draw on SunOs4, Solaris2, Ultrix, Linux, and IRIX. I have heard from other people it works under OpenVMS and Dos. It should compile and run on just about any Unix system, and probably other systems as well. I have switched jobs (within NIST) so there will be no further enhancements of this package. If any bugs come up, I will try to fix them. Copyright: CGM Draw software produced by NIST, an agency of the U.S. government, is by statute not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance. Please note however, that some of the code in this package is from gd, which is copyright. gd's copyright is as follows: gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. Permission granted to copy and distribute this work provided that this notice remains intact. Credit for the library must be given to the Quest Protein Database Center, Cold Spring Harbor Labs, in all derived works. This does not affect your ownership of the derived work itself, and the intent is to assure proper credit for Quest, not to interfere with your use of gd. If you have questions, ask. ("Derived works" includes all programs that utilize the library. Credit must be given in user-visible documentation.) If you have any questions or comments, please send me e-mail, lorax@nist.gov Thanks for trying it out. Edward Johnson plplot-5.10.0+dfsg/lib/nistcd/defines.h 644 1750 1750 313111460615444 165530ustar andrewandrew // defines.h: declarations file for the cgmdraw module. // // Written by G. Edward Johnson // Date: April 1996 // Copyright: cd software produced by NIST, an agency of the // U.S. government, is by statute not subject to copyright // in the United States. Recipients of this software assume all // responsibilities associated with its operation, modification // and maintenance. // // #ifndef CDDEF_H #define CDDEF_H 1 #define b0 01 #define b1 02 #define b2 04 #define b3 010 #define b4 020 #define b5 040 #define b6 0100 #define b7 0200 #define b8 0400 #define b9 01000 #define b10 02000 #define b11 04000 #define b12 010000 #define b13 020000 #define b14 040000 #define b15 0100000 // Defines the default values for different attributes. In general, // these track the CGM specificaition, so changing them is not a good idea. // however, it is generally ok to set them to -1 (undefined) if you want. // #define CDLTYPE 1 #define CDLWIDTH 0 #define CDLCOLOR 1 #define CDSHAPESTYLE 0 #define CDSHAPECOLOR 1 #define CDSHAPEHATCH 1 #define CDEDGETYPE 1 #define CDEDGECOLOR 1 #define CDEDGEWIDTH 1 #define CDEDGEVIS 0 #define CDTEXTFONT 1 #define CDTEXTCOLOR 1 #define CDTEXTHEIGHT -1 #define CDTEXTPATH 0 #define CDMTYPE 1 #define CDMSIZE 0 #define CDMCOLOR 1 #define CDLINESPEC 1 #define CDEDGESPEC 1 #define CDMARKERSPEC 1 #endif plplot-5.10.0+dfsg/lib/nistcd/cd.announce 644 1750 1750 477611155124466 171230ustar andrewandrew Announcing the release of CGM Draw 1.3. CGM Draw is a freely available library for generating CGM files from a C program. It has been tested on Solaris, Ultrix, Linux, IRIX, AIX, OpenVMS, and DOS. CGM (Computer Graphics Metafile) is a vector graphics format that can be read by many popular packages. With CGM Draw your code can quickly draw images complete with lines, arcs, rectangles, polygons, and text. CGM Draw is ideal for creating CGM files on the fly when you have a rapidly changing data set (such as in response to database queries.) Documentation for cd is included with the package, and is available from http://speckle.ncsl.nist.gov/~lorax/cgm/cd.html General information about CGM is available many places on the web, including http://speckle.ncsl.nist.gov/~lsr/cgm.htm This distribution may be retrieved via ftp from zing.ncsl.nist.gov in the directory "cgm" It will have the name cd followed by the version number. The current version is 1.3 and is at: ftp://zing.ncsl.nist.gov/cgm/cd1.3.tar.gz Whats new in this version: -Polygon Sets, you can define multiple polygons and draw them all with one simple command. -Markers, set points in CGM's -Expert functions, to give you more control of the final CGM if you need it. What is CGM: CGM is a widely used method for representing 2D vector pictures. Many industry users have decided to use CGM as the means of representing, storing, and interchanging pictures in all their documentation (e.g., Air Transport Association will use CGM to represent illustrations, US Petroleum industry has also adopted it). CGM is already and established, open standard. In 1987 ISO approved the first version as an international standard, and the current version (which extends the original) was approved in 1992 (ISO 8632.) Many programs are already capable of creating CGM files. Major illustration packages already can save their files in the CGM format (CorelDraw is one example) and many word processing programs (WordPerfect and Word) can include CGM files in their documents. What types of pictures is CGM suited for: CGM is ideally suited for pictures with geometric shapes, line drawings, and text. Here are some particular applications that CGM would do well with: Charts and Graphs--For instance charts of recent stock market data, or graphs of web server usage. Technical illustrations--Diagrams for products or engineering drawings. CGM pictures can be zoomed in on to show small details. General illustrations--Such as those you see in books or comic strips. plplot-5.10.0+dfsg/lib/CMakeLists.txt 644 1750 1750 13711155124466 162240ustar andrewandrewadd_subdirectory(csa) add_subdirectory(nn) add_subdirectory(qsastime) add_subdirectory(nistcd) plplot-5.10.0+dfsg/lib/nn/ 775 1750 1750 012406243566 140435ustar andrewandrewplplot-5.10.0+dfsg/lib/nn/delaunay.h 644 1750 1750 355511462375545 161100ustar andrewandrew//-------------------------------------------------------------------------- // // File: delaunay.h // // Created: 04/08/2000 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Header for delaunay triangulation wrapper // // Description: None // // Revisions: None // //-------------------------------------------------------------------------- #if !defined ( _DELAUNAY_H ) #define _DELAUNAY_H #include "nn.h" typedef struct { int vids[3]; } triangle; typedef struct { int tids[3]; } triangle_neighbours; typedef struct { double x; double y; double r; } circle; #if !defined ( _ISTACK_H ) struct istack; typedef struct istack istack; #endif struct delaunay { int npoints; point * points; double xmin; double xmax; double ymin; double ymax; int ntriangles; triangle * triangles; circle * circles; triangle_neighbours* neighbours; // for delaunay_xytoi() int * n_point_triangles; // n_point_triangles[i] is number of // triangles i-th point belongs to int ** point_triangles; // point_triangles[i][j] is index of j-th // triangle i-th point belongs to int nedges; int * edges; // n-th edge is formed by points[edges[n*2]] // and points[edges[n*2+1]] // // Work data for delaunay_circles_find(). Placed here for efficiency // reasons. Should be moved to the procedure if parallelizable code // needed. // int * flags; int first_id; // last search result, used in start up of a // new search istack* t_in; istack* t_out; }; #endif plplot-5.10.0+dfsg/lib/nn/version.h 644 1750 1750 66111645757710 157470ustar andrewandrew//-------------------------------------------------------------------------- // // File: version.h // // Created: 18/10/2001 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Contains version string // //-------------------------------------------------------------------------- #if !defined ( _VERSION_H ) #define _VERSION_H const char* nn_version = "1.38"; #endif plplot-5.10.0+dfsg/lib/nn/istack.h 644 1750 1750 134711645757710 155620ustar andrewandrew//-------------------------------------------------------------------------- // // File: istack.h // // Created: 06/06/2001 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Header for handling stack of integers. // // Description: None // // Revisions: None // //-------------------------------------------------------------------------- #if !defined ( _ISTACK_H ) #define _ISTACK_H typedef struct { int n; int nallocated; int * v; } istack; int istack_contains( istack* s, int v ); istack* istack_create( void ); void istack_destroy( istack* s ); void istack_push( istack* s, int v ); int istack_pop( istack* s ); void istack_reset( istack* s ); #endif plplot-5.10.0+dfsg/lib/nn/CMakeLists.txt 644 1750 1750 430711723136110 166500ustar andrewandrew# lib/nn/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if(PL_HAVE_QHULL) set(csironn_LIB_SRCS delaunay.c hash.c istack.c lpi.c nnai.c nnpi.c nncommon.c ) if(BUILD_SHARED_LIBS) set_source_files_properties( ${csironn_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS) add_library(csironn ${csironn_LIB_SRCS}) if(NON_TRANSITIVE) # empty list ==> non-transitive linking for everything that links to # libcsironn in the shared libraries case. target_link_libraries(csironn LINK_INTERFACE_LIBRARIES) endif(NON_TRANSITIVE) set_target_properties( csironn PROPERTIES SOVERSION ${csironn_SOVERSION} VERSION ${csironn_VERSION} COMPILE_FLAGS "-I${QHULL_INCLUDE_DIRS}" INSTALL_NAME_DIR "${LIB_DIR}" ) set( csironn_LINK_LIBRARIES ${csironn_LINK_LIBRARIES} ${QHULL_LIBRARIES} ) if(MATH_LIB) set( csironn_LINK_LIBRARIES ${csironn_LINK_LIBRARIES} ${MATH_LIB} ) endif(MATH_LIB) target_link_libraries(csironn ${csironn_LINK_LIBRARIES}) install(TARGETS csironn EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) set(nn_DOCFILES README README.1st ) install(FILES README DESTINATION ${DOC_DIR} RENAME README.nn) install(FILES README.1st DESTINATION ${DOC_DIR} RENAME README.1st.nn) endif(PL_HAVE_QHULL) plplot-5.10.0+dfsg/lib/nn/hash.h 644 1750 1750 540011462375545 152200ustar andrewandrew//-------------------------------------------------------------------------- // // File: hash.h // // Purpose: Hash table header // // Author: Jerry Coffin // // Description: Public domain code by Jerry Coffin, with improvements by // HenkJan Wolthuis. // Date last modified: 05-Jul-1997 // // Revisions: 18-09-2002 -- modified by Pavel Sakov // //-------------------------------------------------------------------------- #ifndef _HASH_H #define _HASH_H struct hashtable; typedef struct hashtable hashtable; //* Copies a key. The key must be able to be deallocated by free(). // typedef void* ( *ht_keycp )( void* ); //* Returns 1 if two keys are equal, 0 otherwise. // typedef int ( *ht_keyeq )( void*, void* ); //* Converts key to an unsigned integer (not necessarily unique). // typedef unsigned int ( *ht_key2hash )( void* ); //* Creates a hash table of specified size. // // @param size Size of hash table for output points // @param cp Key copy function // @param eq Key equality check function // @param hash Hash value calculation function // hashtable* ht_create( int size, ht_keycp cp, ht_keyeq eq, ht_key2hash hash ); //* Create a hash table of specified size and key type. // hashtable* ht_create_d1( int size ); // double[1] hashtable* ht_create_d2( int size ); // double[2] hashtable* ht_create_str( int size ); // char* //* Destroys a hash table. // (Take care of deallocating data by ht_process() prior to destroying the // table if necessary.) // // @param table Hash table to be destroyed // void ht_destroy( hashtable* table ); //* Inserts a new entry into the hash table. // // @param table The hash table // @param key Ponter to entry's key // @param data Pointer to associated data // @return Pointer to the old data associated with the key, NULL if the key // wasn't in the table previously // void* ht_insert( hashtable* table, void* key, void* data ); //* Returns a pointer to the data associated with a key. If the key has // not been inserted in the table, returns NULL. // // @param table The hash table // @param key The key // @return The associated data or NULL // void* ht_find( hashtable* table, void* key ); //* Deletes an entry from the table. Returns a pointer to the data that // was associated with the key so that the calling code can dispose it // properly. // // @param table The hash table // @param key The key // @return The associated data or NULL // void* ht_delete( hashtable* table, void* key ); //* For each entry, calls a specified function with corresponding data as a // parameter. // // @param table The hash table // @param func The action function // void ht_process( hashtable* table, void ( *func )( void* ) ); #endif // _HASH_H plplot-5.10.0+dfsg/lib/nn/hash.c 644 1750 1750 4613011647527346 152430ustar andrewandrew//-------------------------------------------------------------------------- // // File: hash.c // // Purpose: Hash table implementation // // Author: Jerry Coffin // // Description: Public domain code by Jerry Coffin, with improvements by // HenkJan Wolthuis. // Date last modified: 05-Jul-1997 // // Revisions: 18-09-2002 -- modified by Pavel Sakov // //-------------------------------------------------------------------------- #include #include #include #include "hash.h" #define INT_PER_DOUBLE 2 //* A hash table consists of an array of these buckets. // typedef struct ht_bucket { void * key; void * data; int id; // unique id -- just in case struct ht_bucket* next; } ht_bucket; //* Hash table structure. // Note that more nodes than `size' can be inserted in the table, // but performance degrades as this happens. // struct hashtable { int size; // table size int n; // current number of entries int naccum; // number of inserted entries int nhash; // number of used table elements ht_keycp cp; ht_keyeq eq; ht_key2hash hash; ht_bucket ** table; }; int d1eq( void* key1, void* key2 ); // Creates a hashtable of specified size. // hashtable* ht_create( int size, ht_keycp cp, ht_keyeq eq, ht_key2hash hash ) { hashtable* table = malloc( sizeof ( hashtable ) ); ht_bucket** bucket; int i; assert( sizeof ( double ) == INT_PER_DOUBLE * sizeof ( int ) ); // // (used in d1hash() and d2hash()) // if ( table == NULL ) return NULL; if ( size <= 0 ) { free( table ); return NULL; } table->size = size; table->table = malloc( sizeof ( ht_bucket* ) * (size_t) size ); bucket = table->table; if ( bucket == NULL ) { free( table ); return NULL; } for ( i = 0; i < size; ++i ) bucket[i] = NULL; table->n = 0; table->naccum = 0; table->nhash = 0; table->eq = eq; table->cp = cp; table->hash = hash; return table; } // Destroys a hash table. // (Take care of deallocating data by ht_process() prior to destroying the // table if necessary.) // // @param table Hash table to be destroyed // void ht_destroy( hashtable* table ) { int i; if ( table == NULL ) return; for ( i = 0; i < table->size; ++i ) { ht_bucket* bucket; for ( bucket = ( table->table )[i]; bucket != NULL; ) { ht_bucket* prev = bucket; free( bucket->key ); bucket = bucket->next; free( prev ); } } free( table->table ); free( table ); } // Inserts a new entry into the hash table. // // @param table The hash table // @param key Ponter to entry's key // @param data Pointer to associated data // @return Pointer to the old data associated with the key, NULL if the key // wasn't in the table previously // void* ht_insert( hashtable* table, void* key, void* data ) { unsigned int val = table->hash( key ) % (unsigned int) table->size; ht_bucket * bucket; // // NULL means this bucket hasn't been used yet. We'll simply allocate // space for our new bucket and put our data there, with the table // pointing at it. // if ( ( table->table )[val] == NULL ) { bucket = malloc( sizeof ( ht_bucket ) ); if ( bucket == NULL ) return NULL; bucket->key = table->cp( key ); bucket->next = NULL; bucket->data = data; bucket->id = table->naccum; ( table->table )[val] = bucket; table->n++; table->naccum++; table->nhash++; return bucket->data; } // // This spot in the table is already in use. See if the current string // has already been inserted, and if so, return corresponding data. // for ( bucket = ( table->table )[val]; bucket != NULL; bucket = bucket->next ) if ( table->eq( key, bucket->key ) == 1 ) { void* old_data = bucket->data; bucket->data = data; bucket->id = table->naccum; table->naccum++; return old_data; } // // This key must not be in the table yet. We'll add it to the head of // the list at this spot in the hash table. Speed would be slightly // improved if the list was kept sorted instead. In this case, this // code would be moved into the loop above, and the insertion would take // place as soon as it was determined that the present key in the list // was larger than this one. // bucket = (ht_bucket *) malloc( sizeof ( ht_bucket ) ); if ( bucket == NULL ) return 0; bucket->key = table->cp( key ); bucket->data = data; bucket->next = ( table->table )[val]; bucket->id = table->naccum; ( table->table )[val] = bucket; table->n++; table->naccum++; return data; } // Returns a pointer to the data associated with a key. If the key has // not been inserted in the table, returns NULL. // // @param table The hash table // @param key The key // @return The associated data or NULL // void* ht_find( hashtable* table, void* key ) { unsigned int val = table->hash( key ) % (unsigned int) table->size; ht_bucket * bucket; if ( ( table->table )[val] == NULL ) return NULL; for ( bucket = ( table->table )[val]; bucket != NULL; bucket = bucket->next ) if ( table->eq( key, bucket->key ) == 1 ) return bucket->data; return NULL; } // Deletes an entry from the table. Returns a pointer to the data that // was associated with the key so that the calling code can dispose it // properly. // // @param table The hash table // @param key The key // @return The associated data or NULL // void* ht_delete( hashtable* table, void* key ) { unsigned int val = table->hash( key ) % (unsigned int) table->size; ht_bucket * prev; ht_bucket * bucket; void * data; if ( ( table->table )[val] == NULL ) return NULL; // // Traverse the list, keeping track of the previous node in the list. // When we find the node to delete, we set the previous node's next // pointer to point to the node after ourself instead. We then delete // the key from the present node, and return a pointer to the data it // contains. // for ( prev = NULL, bucket = ( table->table )[val]; bucket != NULL; prev = bucket, bucket = bucket->next ) { if ( table->eq( key, bucket->key ) == 1 ) { data = bucket->data; if ( prev != NULL ) prev->next = bucket->next; else { // // If 'prev' still equals NULL, it means that we need to // delete the first node in the list. This simply consists // of putting our own 'next' pointer in the array holding // the head of the list. We then dispose of the current // node as above. // ( table->table )[val] = bucket->next; table->nhash--; } free( bucket->key ); free( bucket ); table->n--; return data; } } // // If we get here, it means we didn't find the item in the table. Signal // this by returning NULL. // return NULL; } // For each entry, calls a specified function with corresponding data as a // parameter. // // @param table The hash table // @param func The action function // void ht_process( hashtable* table, void ( *func )( void* ) ) { int i; for ( i = 0; i < table->size; ++i ) if ( ( table->table )[i] != NULL ) { ht_bucket* bucket; for ( bucket = ( table->table )[i]; bucket != NULL; bucket = bucket->next ) func( bucket->data ); } } // // functions for for string keys // static unsigned int strhash( void* key ) { char * str = (char *) key; unsigned int hashvalue = 0; while ( *str != 0 ) { hashvalue ^= *(unsigned int *) str; hashvalue <<= 1; str++; } return hashvalue; } static void* strcp( void* key ) { return (void *) strdup( (const char *) key ); } static int streq( void* key1, void* key2 ) { return !strcmp( key1, key2 ); } // functions for for double keys static unsigned int d1hash( void* key ) { unsigned int* v = (unsigned int *) key; #if INT_PER_DOUBLE == 2 return v[0] + v[1]; #else #error not implemented #endif } static void* d1cp( void* key ) { double* newkey = malloc( sizeof ( double ) ); *newkey = *(double *) key; return newkey; } int d1eq( void* key1, void* key2 ) { return *(double *) key1 == *(double *) key2; } // // functions for for double[2] keys // #include "math.h" static unsigned int d2hash( void* key ) { unsigned int* v = (unsigned int *) key; #if INT_PER_DOUBLE == 2 // // PS: here multiplications suppose to make (a,b) and (b,a) generate // different hash values // return v[0] + v[1] + v[2] * 3 + v[3] * 7; #else #error not implemented #endif } static void* d2cp( void* key ) { double* newkey = malloc( sizeof ( double ) * 2 ); newkey[0] = ( (double *) key )[0]; newkey[1] = ( (double *) key )[1]; return newkey; } static int d2eq( void* key1, void* key2 ) { return ( ( (double *) key1 )[0] == ( (double *) key2 )[0] ) && ( ( (double *) key1 )[1] == ( (double *) key2 )[1] ); } hashtable* ht_create_d1( int size ) { return ht_create( size, d1cp, d1eq, d1hash ); } hashtable* ht_create_d2( int size ) { return ht_create( size, d2cp, d2eq, d2hash ); } hashtable* ht_create_str( int size ) { return ht_create( size, strcp, streq, strhash ); } #ifdef HT_TEST #include #include #define BUFSIZE 1024 static void print_double( void* data ) { printf( " \"%d\"", (int) *(double *) data ); } static void print_string( void* data ) { printf( " \"%s\"", (char *) data ); } int main() { double points[] = { 922803.7855, 7372394.688, 0, 922849.2037, 7372307.027, 1, 922894.657, 7372219.306, 2, 922940.1475, 7372131.528, 3, 922985.6777, 7372043.692, 4, 923031.2501, 7371955.802, 5, 923076.8669, 7371867.857, 6, 923122.5307, 7371779.861, 7, 923168.2439, 7371691.816, 8, 923214.0091, 7371603.722, 9, 923259.8288, 7371515.583, 10, 922891.3958, 7372440.117, 11, 922936.873, 7372352.489, 12, 922982.3839, 7372264.804, 13, 923027.9308, 7372177.064, 14, 923073.5159, 7372089.268, 15, 923119.1415, 7372001.42, 16, 923164.8099, 7371913.521, 17, 923210.5233, 7371825.572, 18, 923256.2841, 7371737.575, 19, 923302.0946, 7371649.534, 20, 923347.9572, 7371561.45, 21, 922978.9747, 7372485.605, 22, 923024.5085, 7372398.009, 23, 923070.0748, 7372310.358, 24, 923115.6759, 7372222.654, 25, 923161.3136, 7372134.897, 26, 923206.9903, 7372047.09, 27, 923252.7079, 7371959.233, 28, 923298.4686, 7371871.33, 29, 923344.2745, 7371783.381, 30, 923390.1279, 7371695.389, 31, 923436.0309, 7371607.357, 32, 923066.5232, 7372531.148, 33, 923112.1115, 7372443.583, 34, 923157.7311, 7372355.966, 35, 923203.3842, 7372268.296, 36, 923249.0725, 7372180.577, 37, 923294.7981, 7372092.808, 38, 923340.5628, 7372004.993, 39, 923386.3686, 7371917.132, 40, 923432.2176, 7371829.229, 41, 923478.1116, 7371741.284, 42, 923524.0527, 7371653.302, 43, 923154.0423, 7372576.746, 44, 923199.6831, 7372489.211, 45, 923245.3541, 7372401.625, 46, 923291.0572, 7372313.989, 47, 923336.7941, 7372226.305, 48, 923382.5667, 7372138.574, 49, 923428.3766, 7372050.798, 50, 923474.2256, 7371962.978, 51, 923520.1155, 7371875.118, 52, 923566.0481, 7371787.218, 53, 923612.0252, 7371699.282, 54, 923241.533, 7372622.396, 55, 923287.2244, 7372534.889, 56, 923332.9449, 7372447.334, 57, 923378.6963, 7372359.731, 58, 923424.4801, 7372272.081, 59, 923470.2979, 7372184.385, 60, 923516.1513, 7372096.646, 61, 923562.0418, 7372008.866, 62, 923607.9709, 7371921.046, 63, 923653.9402, 7371833.188, 64, 923699.9514, 7371745.296, 65, 923328.9962, 7372668.095, 66, 923374.7365, 7372580.617, 67, 923420.5049, 7372493.091, 68, 923466.303, 7372405.519, 69, 923512.1321, 7372317.901, 70, 923557.9936, 7372230.24, 71, 923603.8889, 7372142.536, 72, 923649.8192, 7372054.793, 73, 923695.786, 7371967.011, 74, 923741.7905, 7371879.193, 75, 923787.8341, 7371791.342, 76, 923416.4327, 7372713.844, 77, 923462.2204, 7372626.393, 78, 923508.0353, 7372538.895, 79, 923553.8787, 7372451.353, 80, 923599.7517, 7372363.766, 81, 923645.6555, 7372276.137, 82, 923691.5914, 7372188.467, 83, 923737.5603, 7372100.757, 84, 923783.5634, 7372013.011, 85, 923829.6017, 7371925.231, 86, 923875.6763, 7371837.419, 87, 923503.8433, 7372759.64, 88, 923549.6771, 7372672.214, 89, 923595.5372, 7372584.744, 90, 923641.4246, 7372497.23, 91, 923687.3404, 7372409.673, 92, 923733.2855, 7372322.074, 93, 923779.2608, 7372234.436, 94, 923825.2672, 7372146.759, 95, 923871.3056, 7372059.047, 96, 923917.3766, 7371971.301, 97, 923963.4812, 7371883.524, 98, 923591.2288, 7372805.481, 99, 923637.1076, 7372718.081, 100, 923683.0118, 7372630.638, 101, 923728.9423, 7372543.151, 102, 923774.8998, 7372455.622, 103, 923820.8852, 7372368.052, 104, 923866.8991, 7372280.443, 105, 923912.9422, 7372192.797, 106, 923959.015, 7372105.116, 107, 924005.118, 7372017.402, 108, 924051.2518, 7371929.657, 109, 923678.5898, 7372851.367, 110, 923724.5126, 7372763.992, 111, 923770.46, 7372676.574, 112, 923816.4328, 7372589.113, 113, 923862.4314, 7372501.611, 114, 923908.4564, 7372414.069, 115, 923954.5083, 7372326.488, 116, 924000.5875, 7372238.87, 117, 924046.6941, 7372151.218, 118, 924092.8286, 7372063.533, 119, 924138.9911, 7371975.818, 120 }; int size = sizeof ( points ) / sizeof ( double ) / 3; hashtable* ht; int i; // // double[2] key // printf( "\n1. Testing a table with key of double[2] type\n\n" ); printf( " creating a table..." ); ht = ht_create_d2( size ); printf( "done\n" ); printf( " inserting %d values from a file...", size ); for ( i = 0; i < size; ++i ) ht_insert( ht, &points[i * 3], &points[i * 3 + 2] ); printf( "done\n" ); printf( " stats:\n" ); printf( " %d entries, %d table elements, %d filled elements\n", ht->n, ht->size, ht->nhash ); printf( " %f entries per hash value in use\n", (double) ht->n / ht->nhash ); printf( " finding and printing each 10th data:\n" ); for ( i = 0; i < size; i += 10 ) { double* point = &points[i * 3]; double* data = ht_find( ht, point ); if ( data != NULL ) printf( " i = %d; data = \"%d\"\n", i, (int) *data ); else printf( " i = %d; data = \n", i ); } printf( " removing every 3rd element..." ); for ( i = 0; i < size; i += 3 ) { double* point = &points[i * 3]; ht_delete( ht, point ); } printf( "done\n" ); printf( " stats:\n" ); printf( " %d entries, %d table elements, %d filled elements\n", ht->n, ht->size, ht->nhash ); printf( " %f entries per hash value in use\n", (double) ht->n / ht->nhash ); printf( " finding and printing each 10th data:\n" ); for ( i = 0; i < size; i += 10 ) { double* point = &points[i * 3]; double* data = ht_find( ht, point ); if ( data != NULL ) printf( " i = %d; data = \"%d\"\n", i, (int) *data ); else printf( " i = %d; data = \n", i ); } printf( " printing all data by calling ht_process():\n " ); ht_process( ht, print_double ); printf( "\n destroying the hash table..." ); ht_destroy( ht ); printf( "done\n" ); // // char* key // printf( "\n2. Testing a table with key of char* type\n\n" ); printf( " creating a table..." ); ht = ht_create_str( size ); printf( "done\n" ); printf( " inserting %d elements with deep copy of each data string...", size ); for ( i = 0; i < size; ++i ) { char key[BUFSIZE]; char str[BUFSIZE]; char * data; sprintf( key, "%d-th key", i ); sprintf( str, "%d-th data", i ); data = strdup( str ); ht_insert( ht, key, data ); } printf( "done\n" ); printf( " stats:\n" ); printf( " %d entries, %d table elements, %d filled elements\n", ht->n, ht->size, ht->nhash ); printf( " %f entries per hash value in use\n", (double) ht->n / ht->nhash ); printf( " finding and printing each 10th data:\n" ); for ( i = 0; i < size; i += 10 ) { char key[BUFSIZE]; char * data; sprintf( key, "%d-th key", i ); data = ht_find( ht, key ); if ( data != NULL ) printf( " i = %d; data = \"%s\"\n", i, data ); else printf( " i = %d; data = \n", i ); } printf( " removing every 3rd element..." ); for ( i = 0; i < size; i += 3 ) { char key[BUFSIZE]; sprintf( key, "%d-th key", i ); free( ht_delete( ht, key ) ); } printf( "done\n" ); printf( " stats:\n" ); printf( " %d entries, %d table elements, %d filled elements\n", ht->n, ht->size, ht->nhash ); printf( " %f entries per hash value in use\n", (double) ht->n / ht->nhash ); printf( " finding and printing each 10th data:\n" ); for ( i = 0; i < size; i += 10 ) { char key[BUFSIZE]; char * data; sprintf( key, "%d-th key", i ); data = ht_find( ht, key ); if ( data != NULL ) printf( " i = %d; data = \"%s\"\n", i, data ); else printf( " i = %d; data = \n", i ); } printf( " printing all data by calling ht_process():\n " ); ht_process( ht, print_string ); printf( "\n freeing the remaining data by calling ht_process()..." ); ht_process( ht, free ); printf( "done\n" ); printf( " destroying the hash table..." ); ht_destroy( ht ); printf( "done\n" ); return 0; } #endif // HT_TEST plplot-5.10.0+dfsg/lib/nn/nnai.c 644 1750 1750 2662111647527346 152500ustar andrewandrew//-------------------------------------------------------------------------- // // File: nnai.c // // Created: 15/11/2002 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Code for: // -- Natural Neighbours Array Interpolator // // Description: `nnai' is a tructure for conducting // consequitive Natural Neighbours interpolations on a given // spatial data set in a given array of points. It allows to // modify Z coordinate of data in between interpolations. // `nnai' is the fastest of the three Natural // Neighbours interpolators in `nn' library. // // Revisions: None // //-------------------------------------------------------------------------- #include #include #include #include #include "nn.h" #include "delaunay.h" #include "nan.h" typedef struct { int nvertices; int * vertices; // vertex indices [nvertices] double* weights; // vertex weights [nvertices] } nn_weights; struct nnai { delaunay * d; double wmin; double n; // number of output points double * x; // [n] double * y; // [n] nn_weights* weights; }; void nn_quit( const char* format, ... ); void nnpi_calculate_weights( nnpi* nn ); int nnpi_get_nvertices( nnpi* nn ); int* nnpi_get_vertices( nnpi* nn ); double* nnpi_get_weights( nnpi* nn ); void nnpi_normalize_weights( nnpi* nn ); void nnpi_reset( nnpi* nn ); void nnpi_set_point( nnpi* nn, point* p ); // Builds Natural Neighbours array interpolator. This includes calculation of // weights used in nnai_interpolate(). // // @param d Delaunay triangulation // @return Natural Neighbours interpolation // nnai* nnai_build( delaunay* d, int n, double* x, double* y ) { nnai * nn = malloc( sizeof ( nnai ) ); nnpi * nnp = nnpi_create( d ); int * vertices; double* weights; int i; if ( n <= 0 ) nn_quit( "nnai_create(): n = %d\n", n ); nn->d = d; nn->n = n; nn->x = malloc( (size_t) n * sizeof ( double ) ); memcpy( nn->x, x, (size_t) n * sizeof ( double ) ); nn->y = malloc( (size_t) n * sizeof ( double ) ); memcpy( nn->y, y, (size_t) n * sizeof ( double ) ); nn->weights = malloc( (size_t) n * sizeof ( nn_weights ) ); for ( i = 0; i < n; ++i ) { nn_weights* w = &nn->weights[i]; point p; p.x = x[i]; p.y = y[i]; nnpi_reset( nnp ); nnpi_set_point( nnp, &p ); nnpi_calculate_weights( nnp ); nnpi_normalize_weights( nnp ); vertices = nnpi_get_vertices( nnp ); weights = nnpi_get_weights( nnp ); w->nvertices = nnpi_get_nvertices( nnp ); w->vertices = malloc( (size_t) ( w->nvertices ) * sizeof ( int ) ); memcpy( w->vertices, vertices, (size_t) ( w->nvertices ) * sizeof ( int ) ); w->weights = malloc( (size_t) ( w->nvertices ) * sizeof ( double ) ); memcpy( w->weights, weights, (size_t) ( w->nvertices ) * sizeof ( double ) ); } nnpi_destroy( nnp ); return nn; } // Destroys Natural Neighbours array interpolator. // // @param nn Structure to be destroyed // void nnai_destroy( nnai* nn ) { int i; for ( i = 0; i < nn->n; ++i ) { nn_weights* w = &nn->weights[i]; free( w->vertices ); free( w->weights ); } free( nn->x ); free( nn->y ); free( nn->weights ); free( nn ); } // Conducts NN interpolation in a fixed array of output points using // data specified for a fixed array of input points. Uses pre-calculated // weights. // // @param nn NN array interpolator // @param zin input data [nn->d->npoints] // @param zout output data [nn->n]. Must be pre-allocated! // void nnai_interpolate( nnai* nn, double* zin, double* zout ) { int i; for ( i = 0; i < nn->n; ++i ) { nn_weights* w = &nn->weights[i]; double z = 0.0; int j; for ( j = 0; j < w->nvertices; ++j ) { double weight = w->weights[j]; if ( weight < nn->wmin ) { z = NaN; break; } z += weight * zin[w->vertices[j]]; } zout[i] = z; } } //* Sets minimal allowed weight for Natural Neighbours interpolation. // @param nn Natural Neighbours array interpolator // @param wmin Minimal allowed weight // void nnai_setwmin( nnai* nn, double wmin ) { nn->wmin = wmin; } // The rest of this file contains a number of test programs. // #if defined ( NNAI_TEST ) #include #define NPOINTSIN 10000 #define NMIN 10 #define NX 101 #define NXMIN 1 #define SQ( x ) ( ( x ) * ( x ) ) static double franke( double x, double y ) { x *= 9.0; y *= 9.0; return 0.75 * exp( ( -SQ( x - 2.0 ) - SQ( y - 2.0 ) ) / 4.0 ) + 0.75 * exp( -SQ( x - 2.0 ) / 49.0 - ( y - 2.0 ) / 10.0 ) + 0.5 * exp( ( -SQ( x - 7.0 ) - SQ( y - 3.0 ) ) / 4.0 ) - 0.2 * exp( -SQ( x - 4.0 ) - SQ( y - 7.0 ) ); } static void usage() { printf( "Usage: nn_test [-v|-V] [-n ]\n" "Options:\n" " -a -- use non-Sibsonian interpolation rule\n" " -n :\n" " -- number of input points (default = 10000)\n" " -- number of output points per side (default = 64)\n" " -v -- verbose\n" " -V -- very verbose\n" ); } int main( int argc, char* argv[] ) { int nin = NPOINTSIN; int nx = NX; int nout = 0; point * pin = NULL; delaunay * d = NULL; point * pout = NULL; nnai * nn = NULL; double * zin = NULL; double * xout = NULL; double * yout = NULL; double * zout = NULL; int cpi = -1; // control point index struct timeval tv0, tv1, tv2; struct timezone tz; int i; i = 1; while ( i < argc ) { switch ( argv[i][1] ) { case 'a': i++; nn_rule = NON_SIBSONIAN; break; case 'n': i++; if ( i >= argc ) nn_quit( "no number of data points found after -i\n" ); nin = atoi( argv[i] ); i++; if ( i >= argc ) nn_quit( "no number of ouput points per side found after -i\n" ); nx = atoi( argv[i] ); i++; break; case 'v': i++; nn_verbose = 1; break; case 'V': i++; nn_verbose = 2; break; default: usage(); break; } } if ( nin < NMIN ) nin = NMIN; if ( nx < NXMIN ) nx = NXMIN; printf( "\nTest of Natural Neighbours array interpolator:\n\n" ); printf( " %d data points\n", nin ); printf( " %d output points\n", nx * nx ); // // generate data // printf( " generating data:\n" ); fflush( stdout ); pin = malloc( nin * sizeof ( point ) ); zin = malloc( nin * sizeof ( double ) ); for ( i = 0; i < nin; ++i ) { point* p = &pin[i]; p->x = (double) random() / RAND_MAX; p->y = (double) random() / RAND_MAX; p->z = franke( p->x, p->y ); zin[i] = p->z; if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } // // triangulate // printf( " triangulating:\n" ); fflush( stdout ); d = delaunay_build( nin, pin, 0, NULL, 0, NULL ); // // generate output points // points_generate2( -0.1, 1.1, -0.1, 1.1, nx, nx, &nout, &pout ); xout = malloc( nout * sizeof ( double ) ); yout = malloc( nout * sizeof ( double ) ); zout = malloc( nout * sizeof ( double ) ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; xout[i] = p->x; yout[i] = p->y; zout[i] = NaN; } cpi = ( nx / 2 ) * ( nx + 1 ); gettimeofday( &tv0, &tz ); // // create interpolator // printf( " creating interpolator:\n" ); fflush( stdout ); nn = nnai_build( d, nout, xout, yout ); fflush( stdout ); gettimeofday( &tv1, &tz ); { long dt = 1000000 * ( tv1.tv_sec - tv0.tv_sec ) + tv1.tv_usec - tv0.tv_usec; printf( " interpolator creation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } // // interpolate // printf( " interpolating:\n" ); fflush( stdout ); nnai_interpolate( nn, zin, zout ); if ( nn_verbose ) for ( i = 0; i < nout; ++i ) printf( " (%f, %f, %f)\n", xout[i], yout[i], zout[i] ); fflush( stdout ); gettimeofday( &tv2, &tz ); { long dt = 1000000.0 * ( tv2.tv_sec - tv1.tv_sec ) + tv2.tv_usec - tv1.tv_usec; printf( " interpolation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", xout[cpi], yout[cpi], zout[cpi], franke( xout[cpi], yout[cpi] ) ); printf( " interpolating one more time:\n" ); fflush( stdout ); nnai_interpolate( nn, zin, zout ); if ( nn_verbose ) for ( i = 0; i < nout; ++i ) printf( " (%f, %f, %f)\n", xout[i], yout[i], zout[i] ); fflush( stdout ); gettimeofday( &tv0, &tz ); { long dt = 1000000.0 * ( tv0.tv_sec - tv2.tv_sec ) + tv0.tv_usec - tv2.tv_usec; printf( " interpolation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", xout[cpi], yout[cpi], zout[cpi], franke( xout[cpi], yout[cpi] ) ); printf( " entering new data:\n" ); fflush( stdout ); for ( i = 0; i < nin; ++i ) { point* p = &pin[i]; p->z = p->x * p->x - p->y * p->y; zin[i] = p->z; if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } printf( " interpolating:\n" ); fflush( stdout ); nnai_interpolate( nn, zin, zout ); if ( nn_verbose ) for ( i = 0; i < nout; ++i ) printf( " (%f, %f, %f)\n", xout[i], yout[i], zout[i] ); if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", xout[cpi], yout[cpi], zout[cpi], xout[cpi] * xout[cpi] - yout[cpi] * yout[cpi] ); printf( " restoring data:\n" ); fflush( stdout ); for ( i = 0; i < nin; ++i ) { point* p = &pin[i]; p->z = franke( p->x, p->y ); zin[i] = p->z; if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } printf( " interpolating:\n" ); fflush( stdout ); nnai_interpolate( nn, zin, zout ); if ( nn_verbose ) for ( i = 0; i < nout; ++i ) printf( " (%f, %f, %f)\n", xout[i], yout[i], zout[i] ); if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", xout[cpi], yout[cpi], zout[cpi], franke( xout[cpi], yout[cpi] ) ); printf( "\n" ); nnai_destroy( nn ); free( zin ); free( xout ); free( yout ); free( zout ); free( pout ); delaunay_destroy( d ); free( pin ); return 0; } #endif plplot-5.10.0+dfsg/lib/nn/istack.c 644 1750 1750 262311647527346 155550ustar andrewandrew//-------------------------------------------------------------------------- // // File: istack.c // // Created: 06/06/2001 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Handling stack of integers // // Description: None // // Revisions: None // //-------------------------------------------------------------------------- #define STACK_NSTART 50 #define STACK_NINC 50 #include #include #include "istack.h" static void istack_init( istack* s ) { s->n = 0; s->nallocated = STACK_NSTART; s->v = malloc( STACK_NSTART * sizeof ( int ) ); } istack* istack_create() { istack* s = malloc( sizeof ( istack ) ); istack_init( s ); return s; } void istack_reset( istack* s ) { s->n = 0; } int istack_contains( istack* s, int v ) { int i; for ( i = 0; i < s->n; ++i ) if ( s->v[i] == v ) return 1; return 0; } void istack_push( istack* s, int v ) { if ( s->n == s->nallocated ) { s->v = realloc( s->v, (size_t) ( s->nallocated + STACK_NINC ) * sizeof ( int ) ); s->nallocated += STACK_NINC; } s->v[s->n] = v; s->n++; } int istack_pop( istack* s ) { s->n--; return s->v[s->n]; } void istack_destroy( istack* s ) { if ( s != NULL ) { free( s->v ); free( s ); } } plplot-5.10.0+dfsg/lib/nn/nncommon.c 644 1750 1750 3321611647527346 161450ustar andrewandrew//-------------------------------------------------------------------------- // // File: nncommon.c // // Created: 04/08/2000 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Common stuff for NN interpolation library // // Description: None // // Revisions: 15/11/2002 PS: Changed name from "utils.c" // 28/02/2003 PS: Modified points_read() to do the job without // rewinding the file. This allows to read from stdin when // necessary. // 09/04/2003 PS: Modified points_read() to read from a // file specified by name, not by handle. // Modified: Andrew Ross 20/10/2008 // Change <= comparison in circle_contains() to use EPSILON // to catch case where the point lies on the circle and there // is floating point rounding error in the radii. // //-------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include "nan.h" #include "delaunay.h" #define BUFSIZE 1024 #define EPSILON 1.0e-8 int nn_verbose = 0; int nn_test_vertice = -1; NN_RULE nn_rule = SIBSON; #include "version.h" void nn_quit( const char* format, ... ); int circle_build( circle* c, point* p1, point* p2, point* p3 ); int circle_contains( circle* c, point* p ); void nn_quit( const char* format, ... ) { va_list args; fflush( stdout ); // just in case, to have the exit message // last fprintf( stderr, "error: nn: " ); va_start( args, format ); vfprintf( stderr, format, args ); va_end( args ); exit( 1 ); } int circle_build( circle* c, point* p1, point* p2, point* p3 ) { double x1sq = p1->x * p1->x; double x2sq = p2->x * p2->x; double x3sq = p3->x * p3->x; double y1sq = p1->y * p1->y; double y2sq = p2->y * p2->y; double y3sq = p3->y * p3->y; double t1 = x3sq - x2sq + y3sq - y2sq; double t2 = x1sq - x3sq + y1sq - y3sq; double t3 = x2sq - x1sq + y2sq - y1sq; double D = ( p1->x * ( p2->y - p3->y ) + p2->x * ( p3->y - p1->y ) + p3->x * ( p1->y - p2->y ) ) * 2.0; if ( D == 0.0 ) return 0; c->x = ( p1->y * t1 + p2->y * t2 + p3->y * t3 ) / D; c->y = -( p1->x * t1 + p2->x * t2 + p3->x * t3 ) / D; c->r = hypot( c->x - p1->x, c->y - p1->y ); return 1; } // This procedure has taken it final shape after a number of tries. The problem // was to have the calculated and stored radii being the same if (x,y) is // exactly on the circle border (i.e. not to use FCPU extended precision in // the radius calculation). This may have little effect in practice but was // important in some tests when both input and output data were placed // in rectangular grid nodes. // int circle_contains( circle* c, point* p ) { return hypot( c->x - p->x, c->y - p->y ) <= c->r * ( 1.0 + EPSILON ); } // Smoothes the input point array by averaging the input x,y and z values // for each cell within virtual rectangular nx by ny grid. The corners of the // grid are created from min and max values of the input array. It also frees // the original array and returns results and new dimension via original // data and size pointers. // // @param pn Pointer to number of points (input/output) // @param ppoints Pointer to array of points (input/output) [*pn] // @param nx Number of x nodes in decimation // @param ny Number of y nodes in decimation // void points_thin( int* pn, point** ppoints, int nx, int ny ) { int n = *pn; point * points = *ppoints; double xmin = DBL_MAX; double xmax = -DBL_MAX; double ymin = DBL_MAX; double ymax = -DBL_MAX; int nxy = nx * ny; double * sumx = calloc( (size_t) nxy, sizeof ( double ) ); double * sumy = calloc( (size_t) nxy, sizeof ( double ) ); double * sumz = calloc( (size_t) nxy, sizeof ( double ) ); int * count = calloc( (size_t) nxy, sizeof ( int ) ); double stepx = 0.0; double stepy = 0.0; int nnew = 0; point * pointsnew = NULL; int i, j, ii; if ( nn_verbose ) fprintf( stderr, "thinned: %d points -> ", *pn ); if ( nx < 1 || ny < 1 ) { free( points ); *ppoints = NULL; *pn = 0; if ( nn_verbose ) fprintf( stderr, "0 points" ); free( sumx ); free( sumy ); free( sumz ); free( count ); return; } for ( ii = 0; ii < n; ++ii ) { point* p = &points[ii]; if ( p->x < xmin ) xmin = p->x; if ( p->x > xmax ) xmax = p->x; if ( p->y < ymin ) ymin = p->y; if ( p->y > ymax ) ymax = p->y; } stepx = ( nx > 1 ) ? ( xmax - xmin ) / nx : 0.0; stepy = ( ny > 1 ) ? ( ymax - ymin ) / ny : 0.0; for ( ii = 0; ii < n; ++ii ) { point* p = &points[ii]; int index; // // Following is the portion of the code which really depends on the // floating point particulars. Do not be surprised if different // compilers/options give different results here. // i = ( nx == 1 ) ? 0 : (int) ( ( p->x - xmin ) / stepx ); j = ( ny == 1 ) ? 0 : (int) ( ( p->y - ymin ) / stepy ); if ( i == nx ) i--; if ( j == ny ) j--; index = i + j * nx; sumx[index] += p->x; sumy[index] += p->y; sumz[index] += p->z; count[index]++; } for ( j = 0; j < ny; ++j ) { for ( i = 0; i < nx; ++i ) { int index = i + j * nx; if ( count[index] > 0 ) nnew++; } } pointsnew = malloc( (size_t) nnew * sizeof ( point ) ); ii = 0; for ( j = 0; j < ny; ++j ) { for ( i = 0; i < nx; ++i ) { int index = i + j * nx; int nn = count[index]; if ( nn > 0 ) { point* p = &pointsnew[ii]; p->x = sumx[index] / nn; p->y = sumy[index] / nn; p->z = sumz[index] / nn; ii++; } } } if ( nn_verbose ) fprintf( stderr, "%d points\n", nnew ); free( sumx ); free( sumy ); free( sumz ); free( count ); free( points ); *ppoints = pointsnew; *pn = nnew; } // Generates rectangular grid nx by ny using min and max x and y values from // the input point array. Allocates space for the output point array, be sure // to free it when necessary! // // @param n Number of points // @param points Array of points [n] // @param nx Number of x nodes // @param ny Number of y nodes // @param zoom Zoom coefficient // @param nout Pointer to number of output points // @param pout Pointer to array of output points [*nout] // void points_generate1( int nin, point pin[], int nx, int ny, double zoom, int* nout, point** pout ) { double xmin = DBL_MAX; double xmax = -DBL_MAX; double ymin = DBL_MAX; double ymax = -DBL_MAX; double stepx, stepy; double x0, xx, yy; int i, j, ii; if ( nx < 1 || ny < 1 ) { *pout = NULL; *nout = 0; return; } for ( ii = 0; ii < nin; ++ii ) { point* p = &pin[ii]; if ( p->x < xmin ) xmin = p->x; if ( p->x > xmax ) xmax = p->x; if ( p->y < ymin ) ymin = p->y; if ( p->y > ymax ) ymax = p->y; } if ( isnan( zoom ) || zoom <= 0.0 ) zoom = 1.0; if ( zoom != 1.0 ) { double xdiff2 = ( xmax - xmin ) / 2.0; double ydiff2 = ( ymax - ymin ) / 2.0; double xav = ( xmax + xmin ) / 2.0; double yav = ( ymax + ymin ) / 2.0; xmin = xav - xdiff2 * zoom; xmax = xav + xdiff2 * zoom; ymin = yav - ydiff2 * zoom; ymax = yav + ydiff2 * zoom; } *nout = nx * ny; *pout = malloc( (size_t) ( *nout ) * sizeof ( point ) ); stepx = ( nx > 1 ) ? ( xmax - xmin ) / ( nx - 1 ) : 0.0; stepy = ( ny > 1 ) ? ( ymax - ymin ) / ( ny - 1 ) : 0.0; x0 = ( nx > 1 ) ? xmin : ( xmin + xmax ) / 2.0; yy = ( ny > 1 ) ? ymin : ( ymin + ymax ) / 2.0; ii = 0; for ( j = 0; j < ny; ++j ) { xx = x0; for ( i = 0; i < nx; ++i ) { point* p = &( *pout )[ii]; p->x = xx; p->y = yy; xx += stepx; ii++; } yy += stepy; } } // Generates rectangular grid nx by ny using specified min and max x and y // values. Allocates space for the output point array, be sure to free it // when necessary! // // @param xmin Min x value // @param xmax Max x value // @param ymin Min y value // @param ymax Max y value // @param nx Number of x nodes // @param ny Number of y nodes // @param nout Pointer to number of output points // @param pout Pointer to array of output points [*nout] // void points_generate2( double xmin, double xmax, double ymin, double ymax, int nx, int ny, int* nout, point** pout ) { double stepx, stepy; double x0, xx, yy; int i, j, ii; if ( nx < 1 || ny < 1 ) { *pout = NULL; *nout = 0; return; } *nout = nx * ny; *pout = malloc( (size_t) ( *nout ) * sizeof ( point ) ); stepx = ( nx > 1 ) ? ( xmax - xmin ) / ( nx - 1 ) : 0.0; stepy = ( ny > 1 ) ? ( ymax - ymin ) / ( ny - 1 ) : 0.0; x0 = ( nx > 1 ) ? xmin : ( xmin + xmax ) / 2.0; yy = ( ny > 1 ) ? ymin : ( ymin + ymax ) / 2.0; ii = 0; for ( j = 0; j < ny; ++j ) { xx = x0; for ( i = 0; i < nx; ++i ) { point* p = &( *pout )[ii]; p->x = xx; p->y = yy; xx += stepx; ii++; } yy += stepy; } } static int str2double( char* token, double* value ) { char* end = NULL; if ( token == NULL ) { *value = NaN; return 0; } *value = strtod( token, &end ); if ( end == token ) { *value = NaN; return 0; } return 1; } #define NALLOCATED_START 1024 // Reads array of points from a columnar file. // // @param fname File name (can be "stdin" for standard input) // @param dim Number of dimensions (must be 2 or 3) // @param n Pointer to number of points (output) // @param points Pointer to array of points [*n] (output) (to be freed) // void points_read( char* fname, int dim, int* n, point** points ) { FILE * f = NULL; int nallocated = NALLOCATED_START; char buf[BUFSIZE]; char seps[] = " ,;\t"; char * token; if ( dim < 2 || dim > 3 ) { *n = 0; *points = NULL; return; } if ( fname == NULL ) f = stdin; else { if ( strcmp( fname, "stdin" ) == 0 || strcmp( fname, "-" ) == 0 ) f = stdin; else { f = fopen( fname, "r" ); if ( f == NULL ) nn_quit( "%s: %s\n", fname, strerror( errno ) ); } } *points = malloc( (size_t) nallocated * sizeof ( point ) ); *n = 0; while ( fgets( buf, BUFSIZE, f ) != NULL ) { point* p; if ( *n == nallocated ) { nallocated *= 2; *points = realloc( *points, (size_t) nallocated * sizeof ( point ) ); } p = &( *points )[*n]; if ( buf[0] == '#' ) continue; if ( ( token = strtok( buf, seps ) ) == NULL ) continue; if ( !str2double( token, &p->x ) ) continue; if ( ( token = strtok( NULL, seps ) ) == NULL ) continue; if ( !str2double( token, &p->y ) ) continue; if ( dim == 2 ) p->z = NaN; else { if ( ( token = strtok( NULL, seps ) ) == NULL ) continue; if ( !str2double( token, &p->z ) ) continue; } ( *n )++; } if ( *n == 0 ) { free( *points ); *points = NULL; } else *points = realloc( *points, (size_t) ( *n ) * sizeof ( point ) ); if ( f != stdin ) if ( fclose( f ) != 0 ) nn_quit( "%s: %s\n", fname, strerror( errno ) ); } //* Scales Y coordinate so that the resulting set fits into square: //** xmax - xmin = ymax - ymin //* //* @param n Number of points //* @param points The points to scale //* @return Y axis compression coefficient // double points_scaletosquare( int n, point* points ) { double xmin, ymin, xmax, ymax; double k; int i; if ( n <= 0 ) return NaN; xmin = xmax = points[0].x; ymin = ymax = points[0].y; for ( i = 1; i < n; ++i ) { point* p = &points[i]; if ( p->x < xmin ) xmin = p->x; else if ( p->x > xmax ) xmax = p->x; if ( p->y < ymin ) ymin = p->y; else if ( p->y > ymax ) ymax = p->y; } if ( xmin == xmax || ymin == ymax ) return NaN; else k = ( ymax - ymin ) / ( xmax - xmin ); for ( i = 0; i < n; ++i ) points[i].y /= k; return k; } //* Compresses Y domain by a given multiple. // // @param n Number of points // @param points The points to scale // @param Y axis compression coefficient as returned by points_scaletosquare() // void points_scale( int n, point* points, double k ) { int i; for ( i = 0; i < n; ++i ) points[i].y /= k; } plplot-5.10.0+dfsg/lib/nn/nn.h 644 1750 1750 2431611645757710 147400ustar andrewandrew//-------------------------------------------------------------------------- // // File: nn.h // // Created: 04/08/2000 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Header file for nn library // // Description: None // // Revisions: None // //-------------------------------------------------------------------------- #if !defined ( _NN_H ) #define _NN_H #include "nndll.h" typedef enum { SIBSON, NON_SIBSONIAN } NN_RULE; #if !defined ( _POINT_STRUCT ) #define _POINT_STRUCT typedef struct { double x; double y; double z; } point; #endif //* Smoothes the input point array by averaging the input x,y and z values //** for each cell within virtual rectangular nx by ny grid. The corners of the //** grid are created from min and max values of the input array. It also frees //** the original array and returns results and new dimension via original //** data and size pointers. //* //* @param pn Pointer to number of points (input/output) //* @param ppoints Pointer to array of points (input/output) [*pn] //* @param nx Number of x nodes in decimation //* @param ny Number of y nodes in decimation // void points_thin( int* n, point** points, int nx, int ny ); //* Generates rectangular grid nx by ny using min and max x and y values from //** the input point array. Allocates space for the output point array, be sure //** to free it when necessary! //* //* @param n Number of points //* @param points Array of points [n] //* @param nx Number of x nodes //* @param ny Number of y nodes //* @param nout Pointer to number of output points //* @param pout Ppointer to array of output points [*nout] // void points_generate1( int n, point points[], int nx, int ny, double zoom, int* nout, point** pout ); //* Generates rectangular grid nx by ny using specified min and max x and y //** values. Allocates space for the output point array, be sure to free it //** when necessary! //* //* @param xmin Min x value //* @param xmax Max x value //* @param ymin Min y value //* @param ymax Max y value //* @param nx Number of x nodes //* @param ny Number of y nodes //* @param zoom Zoom coefficient //* @param nout Pointer to number of output points //* @param pout Pointer to array of output points [*nout] // void points_generate2( double xmin, double xmax, double ymin, double ymax, int nx, int ny, int* nout, point** pout ); //* Reads array of points from a columnar file. // // @param fname File name (can be "stdin" dor stndard input) // @param dim Number of dimensions (must be 2 or 3) // @param n Pointer to number of points (output) // @param points Pointer to array of points [*n] (output) // void points_read( char* fname, int dim, int* n, point** points ); //* Scales Y coordinate so that the resulting set fits into square: //** xmax - xmin = ymax - ymin //* //* @param n Number of points //* @param points The points to scale //* @return Y axis compression coefficient // double points_scaletosquare( int n, point* points ); //* Compresses Y domain by a given multiple. // // @param n Number of points // @param points The points to scale // @param Y axis compression coefficient as returned by points_scaletosquare() // void points_scale( int n, point* points, double k ); //* Structure to perform the Delaunay triangulation of a given array of points. // // Contains a deep copy of the input array of points. // Contains triangles, circles and edges resulted from the triangulation. // Contains neighbour triangles for each triangle. // Contains point to triangle map. // struct delaunay; typedef struct delaunay delaunay; //* Builds Delaunay triangulation of the given array of points. // // @param np Number of points // @param points Array of points [np] (input) // @param ns Number of forced segments // @param segments Array of (forced) segment endpoint indices [2*ns] // @param nh Number of holes // @param holes Array of hole (x,y) coordinates [2*nh] // @return Delaunay triangulation with triangulation results // delaunay* delaunay_build( int np, point points[], int ns, int segments[], int nh, double holes[] ); //* Destroys Delaunay triangulation. // // @param d Structure to be destroyed // void delaunay_destroy( delaunay* d ); //* `lpi' -- "linear point interpolator" is a structure for // conducting linear interpolation on a given data on a "point-to-point" basis. // It interpolates linearly within each triangle resulted from the Delaunay // triangluation of input data. `lpi' is much faster than all // Natural Neighbours interpolators below. // struct lpi; typedef struct lpi lpi; //* Builds linear interpolator. // // @param d Delaunay triangulation // @return Linear interpolator // lpi* lpi_build( delaunay* d ); //* Destroys linear interpolator. // // @param l Structure to be destroyed // void lpi_destroy( lpi* l ); //* Finds linearly interpolated value in a point. // // @param l Linear point interpolator // @param p Point to be interpolated (p->x, p->y -- input; p->z -- output) // void lpi_interpolate_point( lpi* l, point* p ); // Linearly interpolates data from one array of points for another array of // points. // // @param nin Number of input points // @param pin Array of input points [pin] // @param nout Number of ouput points // @param pout Array of output points [nout] // NNDLLIMPEXP void lpi_interpolate_points( int nin, point pin[], int nout, point pout[] ); //* `nnpi' -- "Natural Neighbours point interpolator" is a // structure for conducting Natural Neighbours interpolation on a given data on // a "point-to-point" basis. Because it involves weight calculation for each // next output point, it is not particularly suitable for consequitive // interpolations on the same set of observation points -- use // `nnhpi' or `nnai' in these cases. // struct nnpi; typedef struct nnpi nnpi; //* Creates Natural Neighbours point interpolator. // // @param d Delaunay triangulation // @return Natural Neighbours interpolation // nnpi* nnpi_create( delaunay* d ); //* Destroys Natural Neighbours point interpolation. // // @param nn Structure to be destroyed // void nnpi_destroy( nnpi* nn ); //* Finds Natural Neighbours-interpolated value in a point. // // @param nn NN point interpolator // @param p Point to be interpolated (p->x, p->y -- input; p->z -- output) // void nnpi_interpolate_point( nnpi* nn, point* p ); //* Natural Neighbours-interpolates data in one array of points for another //** array of points. //* //* @param nin Number of input points //* @param pin Array of input points [pin] //* @param wmin Minimal allowed weight //* @param nout Number of output points //* @param pout Array of output points [nout] // NNDLLIMPEXP void nnpi_interpolate_points( int nin, point pin[], double wmin, int nout, point pout[] ); //* Sets minimal allowed weight for Natural Neighbours interpolation. // @param nn Natural Neighbours point interpolator // @param wmin Minimal allowed weight // void nnpi_setwmin( nnpi* nn, double wmin ); //* `nnhpi' is a structure for conducting consequitive // Natural Neighbours interpolations on a given spatial data set in a random // sequence of points from a set of finite size, taking advantage of repeated // interpolations in the same point. It allows to modify Z // coordinate of data between interpolations. // struct nnhpi; typedef struct nnhpi nnhpi; //* Creates Natural Neighbours hashing point interpolator. // // @param d Delaunay triangulation // @param size Hash table size (should be of order of number of output points) // @return Natural Neighbours interpolation // nnhpi* nnhpi_create( delaunay* d, int size ); //* Destroys Natural Neighbours hashing point interpolation. // // @param nn Structure to be destroyed // void nnhpi_destroy( nnhpi* nn ); //* Finds Natural Neighbours-interpolated value in a point. // // @param nnhpi NN hashing point interpolator // @param p Point to be interpolated (p->x, p->y -- input; p->z -- output) // void nnhpi_interpolate( nnhpi* nn, point* p ); //* Modifies interpolated data. // Finds point* pd in the underlying Delaunay triangulation such that // pd->x = p->x and pd->y = p->y, and copies p->z to pd->z. Exits with error // if the point is not found. // // @param nn Natural Neighbours hashing point interpolator // @param p New data // void nnhpi_modify_data( nnhpi* nn, point* p ); //* Sets minimal allowed weight for Natural Neighbours interpolation. // @param nn Natural Neighbours point hashing interpolator // @param wmin Minimal allowed weight // void nnhpi_setwmin( nnhpi* nn, double wmin ); // `nnai' is a tructure for conducting consequitive Natural // Neighbours interpolations on a given spatial data set in a given array of // points. It allows to modify Z coordinate of data between interpolations. // `nnai' is the fastest of the three Natural Neighbours // interpolators here. // struct nnai; typedef struct nnai nnai; //* Builds Natural Neighbours array interpolator. This includes calculation of // weights used in nnai_interpolate(). // // @param d Delaunay triangulation // @return Natural Neighbours interpolation // nnai* nnai_build( delaunay* d, int n, double* x, double* y ); //* Destroys Natural Neighbours array interpolator. // // @param nn Structure to be destroyed // void nnai_destroy( nnai* nn ); //* Conducts NN interpolation in a fixed array of output points using // data specified for a fixed array of input points. Uses pre-calculated // weights. // // @param nn NN array interpolator // @param zin input data [nn->d->npoints] // @param zout output data [nn->n]. Must be pre-allocated! // void nnai_interpolate( nnai* nn, double* zin, double* zout ); //* Sets minimal allowed weight for Natural Neighbours interpolation. // @param nn Natural Neighbours array interpolator // @param wmin Minimal allowed weight // void nnai_setwmin( nnai* nn, double wmin ); // Sets the verbosity level within nn package. // 0 (default) - silent // 1 - verbose // 2 - very verbose // extern int nn_verbose; // Switches between weight calculation methods. // SIBSON -- classic Sibson method // NON_SIBSONIAN -- simpler and (I think) more robust method // extern NNDLLIMPEXP_DATA( NN_RULE ) nn_rule; // Contains version string for the nn package. // extern const char* nn_version; // Limits verbose information to a particular vertex (used mainly for // debugging purposes). // extern int nn_test_vertice; #endif // _NN_H plplot-5.10.0+dfsg/lib/nn/README 644 1750 1750 2473 7630263304 147620ustar andrewandrewnn Natural Neighbours interpolation library Version 1.20 C library functions and two utilities for Natural Neighbours interpolation. Copyright 2000-2002 CSIRO Marine Research GPO 1538 Hobart TAS 7001 Australia Please send comments and bugs to Pavel.Sakov@csiro.au There is no warranty whatsoever. Use at your own risk. These code may be freely redistributed under the condition that the copyright notices are not removed. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF CSIRO, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. This code has is being developed and used under i386/Linux. I do not think there will be major problems for porting it elsewhere. Please let me know if you managed to do it. To compile, run: configure make (make install) For a couple of quick tests, run: make tests ./nnphi_test ./nnai_test ./ht_test Apart from the `nn' library, this code contains `nnbathy' -- a simple interpolation utility/example based on `nn'. Look in ./example to try or test it. Acknowledgments: This library uses `Triangle' by Jonathan Richard Shewchuk for Delaunay triangulation -- thanks, Richard, well done! Good luck! Pavel Sakov plplot-5.10.0+dfsg/lib/nn/delaunay.c 644 1750 1750 5562411652525523 161210ustar andrewandrew//-------------------------------------------------------------------------- // // File: delaunay.c // // Created: 04/08/2000 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Delaunay triangulation - a wrapper to triangulate() // // Description: None // // Revisions: 10/06/2003 PS: delaunay_build(); delaunay_destroy(); // struct delaunay: from now on, only shallow copy of the // input data is contained in struct delaunay. This saves // memory and is consistent with libcsa. // // Modified: Joao Cardoso, 4/2/2003 // Adapted for use with Qhull instead of "triangle". // Andrew Ross 20/10/2008 // Fix bug in delaunay_circles_find() when checking // whether a circle has been found. // //-------------------------------------------------------------------------- #define USE_QHULL #include #include #include #include #include #include #include #ifdef USE_QHULL #include #else #include "triangle.h" #endif #include "istack.h" #include "nan.h" #include "delaunay.h" int circle_build( circle* c, point* p0, point* p1, point* p2 ); int circle_contains( circle* c, point* p ); int delaunay_xytoi( delaunay* d, point* p, int id ); void delaunay_circles_find( delaunay* d, point* p, int* n, int** out ); #ifdef USE_QHULL static int cw( delaunay *d, triangle *t ); #endif #ifndef USE_QHULL static void tio_init( struct triangulateio* tio ) { tio->pointlist = NULL; tio->pointattributelist = NULL; tio->pointmarkerlist = NULL; tio->numberofpoints = 0; tio->numberofpointattributes = 0; tio->trianglelist = NULL; tio->triangleattributelist = NULL; tio->trianglearealist = NULL; tio->neighborlist = NULL; tio->numberoftriangles = 0; tio->numberofcorners = 0; tio->numberoftriangleattributes = 0; tio->segmentlist = 0; tio->segmentmarkerlist = NULL; tio->numberofsegments = 0; tio->holelist = NULL; tio->numberofholes = 0; tio->regionlist = NULL; tio->numberofregions = 0; tio->edgelist = NULL; tio->edgemarkerlist = NULL; tio->normlist = NULL; tio->numberofedges = 0; } static void tio_destroy( struct triangulateio* tio ) { if ( tio->pointlist != NULL ) free( tio->pointlist ); if ( tio->pointattributelist != NULL ) free( tio->pointattributelist ); if ( tio->pointmarkerlist != NULL ) free( tio->pointmarkerlist ); if ( tio->trianglelist != NULL ) free( tio->trianglelist ); if ( tio->triangleattributelist != NULL ) free( tio->triangleattributelist ); if ( tio->trianglearealist != NULL ) free( tio->trianglearealist ); if ( tio->neighborlist != NULL ) free( tio->neighborlist ); if ( tio->segmentlist != NULL ) free( tio->segmentlist ); if ( tio->segmentmarkerlist != NULL ) free( tio->segmentmarkerlist ); if ( tio->holelist != NULL ) free( tio->holelist ); if ( tio->regionlist != NULL ) free( tio->regionlist ); if ( tio->edgelist != NULL ) free( tio->edgelist ); if ( tio->edgemarkerlist != NULL ) free( tio->edgemarkerlist ); if ( tio->normlist != NULL ) free( tio->normlist ); } static delaunay* delaunay_create() { delaunay* d = malloc( sizeof ( delaunay ) ); d->npoints = 0; d->points = NULL; d->xmin = DBL_MAX; d->xmax = -DBL_MAX; d->ymin = DBL_MAX; d->ymax = -DBL_MAX; d->ntriangles = 0; d->triangles = NULL; d->circles = NULL; d->neighbours = NULL; d->n_point_triangles = NULL; d->point_triangles = NULL; d->nedges = 0; d->edges = NULL; d->flags = NULL; d->first_id = -1; d->t_in = NULL; d->t_out = NULL; return d; } static void tio2delaunay( struct triangulateio* tio_out, delaunay* d ) { int i, j; // // I assume that all input points appear in tio_out in the same order as // they were written to tio_in. I have seen no exceptions so far, even // if duplicate points were presented. Just in case, let us make a couple // of checks. // assert( tio_out->numberofpoints == d->npoints ); assert( tio_out->pointlist[2 * d->npoints - 2] == d->points[d->npoints - 1].x && tio_out->pointlist[2 * d->npoints - 1] == d->points[d->npoints - 1].y ); for ( i = 0, j = 0; i < d->npoints; ++i ) { point* p = &d->points[i]; if ( p->x < d->xmin ) d->xmin = p->x; if ( p->x > d->xmax ) d->xmax = p->x; if ( p->y < d->ymin ) d->ymin = p->y; if ( p->y > d->ymax ) d->ymax = p->y; } if ( nn_verbose ) { fprintf( stderr, "input:\n" ); for ( i = 0, j = 0; i < d->npoints; ++i ) { point* p = &d->points[i]; fprintf( stderr, " %d: %15.7g %15.7g %15.7g\n", i, p->x, p->y, p->z ); } } d->ntriangles = tio_out->numberoftriangles; if ( d->ntriangles > 0 ) { d->triangles = malloc( d->ntriangles * sizeof ( triangle ) ); d->neighbours = malloc( d->ntriangles * sizeof ( triangle_neighbours ) ); d->circles = malloc( d->ntriangles * sizeof ( circle ) ); d->n_point_triangles = calloc( d->npoints, sizeof ( int ) ); d->point_triangles = malloc( d->npoints * sizeof ( int* ) ); d->flags = calloc( d->ntriangles, sizeof ( int ) ); } if ( nn_verbose ) fprintf( stderr, "triangles:\n" ); for ( i = 0; i < d->ntriangles; ++i ) { int offset = i * 3; triangle * t = &d->triangles[i]; triangle_neighbours* n = &d->neighbours[i]; circle * c = &d->circles[i]; t->vids[0] = tio_out->trianglelist[offset]; t->vids[1] = tio_out->trianglelist[offset + 1]; t->vids[2] = tio_out->trianglelist[offset + 2]; n->tids[0] = tio_out->neighborlist[offset]; n->tids[1] = tio_out->neighborlist[offset + 1]; n->tids[2] = tio_out->neighborlist[offset + 2]; circle_build( c, &d->points[t->vids[0]], &d->points[t->vids[1]], &d->points[t->vids[2]] ); if ( nn_verbose ) fprintf( stderr, " %d: (%d,%d,%d)\n", i, t->vids[0], t->vids[1], t->vids[2] ); } for ( i = 0; i < d->ntriangles; ++i ) { triangle* t = &d->triangles[i]; for ( j = 0; j < 3; ++j ) d->n_point_triangles[t->vids[j]]++; } if ( d->ntriangles > 0 ) { for ( i = 0; i < d->npoints; ++i ) { if ( d->n_point_triangles[i] > 0 ) d->point_triangles[i] = malloc( d->n_point_triangles[i] * sizeof ( int ) ); else d->point_triangles[i] = NULL; d->n_point_triangles[i] = 0; } } for ( i = 0; i < d->ntriangles; ++i ) { triangle* t = &d->triangles[i]; for ( j = 0; j < 3; ++j ) { int vid = t->vids[j]; d->point_triangles[vid][d->n_point_triangles[vid]] = i; d->n_point_triangles[vid]++; } } if ( tio_out->edgelist != NULL ) { d->nedges = tio_out->numberofedges; d->edges = malloc( d->nedges * 2 * sizeof ( int ) ); memcpy( d->edges, tio_out->edgelist, d->nedges * 2 * sizeof ( int ) ); } } #endif // Builds Delaunay triangulation of the given array of points. // // @param np Number of points // @param points Array of points [np] (input) // @param ns Number of forced segments // @param segments Array of (forced) segment endpoint indices [2*ns] // @param nh Number of holes // @param holes Array of hole (x,y) coordinates [2*nh] // @return Delaunay triangulation structure with triangulation results // delaunay* delaunay_build( int np, point points[], int ns, int segments[], int nh, double holes[] ) #ifndef USE_QHULL { delaunay * d = delaunay_create(); struct triangulateio tio_in; struct triangulateio tio_out; char cmd[64] = "eznC"; int i, j; assert( sizeof ( REAL ) == sizeof ( double ) ); tio_init( &tio_in ); if ( np == 0 ) { free( d ); return NULL; } tio_in.pointlist = malloc( np * 2 * sizeof ( double ) ); tio_in.numberofpoints = np; for ( i = 0, j = 0; i < np; ++i ) { tio_in.pointlist[j++] = points[i].x; tio_in.pointlist[j++] = points[i].y; } if ( ns > 0 ) { tio_in.segmentlist = malloc( ns * 2 * sizeof ( int ) ); tio_in.numberofsegments = ns; memcpy( tio_in.segmentlist, segments, ns * 2 * sizeof ( int ) ); } if ( nh > 0 ) { tio_in.holelist = malloc( nh * 2 * sizeof ( double ) ); tio_in.numberofholes = nh; memcpy( tio_in.holelist, holes, nh * 2 * sizeof ( double ) ); } tio_init( &tio_out ); if ( !nn_verbose ) strcat( cmd, "Q" ); else if ( nn_verbose > 1 ) strcat( cmd, "VV" ); if ( ns != 0 ) strcat( cmd, "p" ); if ( nn_verbose ) fflush( stderr ); // // climax // triangulate( cmd, &tio_in, &tio_out, NULL ); if ( nn_verbose ) fflush( stderr ); d->npoints = np; d->points = points; tio2delaunay( &tio_out, d ); tio_destroy( &tio_in ); tio_destroy( &tio_out ); return d; } #else // USE_QHULL { delaunay* d = malloc( sizeof ( delaunay ) ); coordT *qpoints; // array of coordinates for each point boolT ismalloc = False; // True if qhull should free points char flags[64] = "qhull d Qbb Qt"; // option flags for qhull facetT *facet, *neighbor, **neighborp; // variables to walk through facets vertexT *vertex, **vertexp; // variables to walk through vertex int curlong, totlong; // memory remaining after qh_memfreeshort FILE *outfile = stdout; FILE *errfile = stderr; // error messages from qhull code int i, j; int exitcode; int dim, ntriangles; int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars; (void) segments; // Cast to void to suppress compiler warnings about unused parameters (void) holes; dim = 2; assert( sizeof ( realT ) == sizeof ( double ) ); // Qhull was compiled with doubles? if ( np == 0 || ns > 0 || nh > 0 ) { fprintf( stderr, "segments=%d holes=%d\n, aborting Qhull implementation, use 'triangle' instead.\n", ns, nh ); free( d ); return NULL; } qpoints = (coordT *) malloc( (size_t) ( np * ( dim + 1 ) ) * sizeof ( coordT ) ); for ( i = 0; i < np; i++ ) { qpoints[i * dim] = points[i].x; qpoints[i * dim + 1] = points[i].y; } if ( !nn_verbose ) outfile = NULL; if ( nn_verbose ) strcat( flags, " s" ); if ( nn_verbose > 1 ) strcat( flags, " Ts" ); if ( nn_verbose ) fflush( stderr ); // // climax // exitcode = qh_new_qhull( dim, np, qpoints, ismalloc, flags, outfile, errfile ); if ( !exitcode ) { if ( nn_verbose ) fflush( stderr ); d->xmin = DBL_MAX; d->xmax = -DBL_MAX; d->ymin = DBL_MAX; d->ymax = -DBL_MAX; d->npoints = np; d->points = malloc( (size_t) np * sizeof ( point ) ); for ( i = 0; i < np; ++i ) { point* p = &d->points[i]; p->x = points[i].x; p->y = points[i].y; p->z = points[i].z; if ( p->x < d->xmin ) d->xmin = p->x; if ( p->x > d->xmax ) d->xmax = p->x; if ( p->y < d->ymin ) d->ymin = p->y; if ( p->y > d->ymax ) d->ymax = p->y; } if ( nn_verbose ) { fprintf( stderr, "input:\n" ); for ( i = 0; i < np; ++i ) { point* p = &d->points[i]; fprintf( stderr, " %d: %15.7g %15.7g %15.7g\n", i, p->x, p->y, p->z ); } } qh_findgood_all( qh facet_list ); qh_countfacets( qh facet_list, NULL, !qh_ALL, &numfacets, &numsimplicial, &totneighbors, &numridges, &numcoplanars, &numtricoplanars ); ntriangles = 0; FORALLfacets { if ( !facet->upperdelaunay && facet->simplicial ) ntriangles++; } d->ntriangles = ntriangles; d->triangles = malloc( (size_t) d->ntriangles * sizeof ( triangle ) ); d->neighbours = malloc( (size_t) d->ntriangles * sizeof ( triangle_neighbours ) ); d->circles = malloc( (size_t) d->ntriangles * sizeof ( circle ) ); if ( nn_verbose ) fprintf( stderr, "triangles:\tneighbors:\n" ); i = 0; FORALLfacets { if ( !facet->upperdelaunay && facet->simplicial ) { triangle * t = &d->triangles[i]; triangle_neighbours* n = &d->neighbours[i]; circle * c = &d->circles[i]; j = 0; FOREACHvertex_( facet->vertices ) t->vids[j++] = qh_pointid( vertex->point ); j = 0; FOREACHneighbor_( facet ) n->tids[j++] = ( neighbor->visitid > 0 ) ? (int) neighbor->visitid - 1 : -1; // Put triangle vertices in counterclockwise order, as // 'triangle' do. // The same needs to be done with the neighbors. // // The following works, i.e., it seems that Qhull maintains a // relationship between the vertices and the neighbors // triangles, but that is not said anywhere, so if this stop // working in a future Qhull release, you know what you have // to do, reorder the neighbors. // if ( cw( d, t ) ) { int tmp = t->vids[1]; t->vids[1] = t->vids[2]; t->vids[2] = tmp; tmp = n->tids[1]; n->tids[1] = n->tids[2]; n->tids[2] = tmp; } circle_build( c, &d->points[t->vids[0]], &d->points[t->vids[1]], &d->points[t->vids[2]] ); if ( nn_verbose ) fprintf( stderr, " %d: (%d,%d,%d)\t(%d,%d,%d)\n", i, t->vids[0], t->vids[1], t->vids[2], n->tids[0], n->tids[1], n->tids[2] ); i++; } } d->flags = calloc( (size_t) ( d->ntriangles ), sizeof ( int ) ); d->n_point_triangles = calloc( (size_t) ( d->npoints ), sizeof ( int ) ); for ( i = 0; i < d->ntriangles; ++i ) { triangle* t = &d->triangles[i]; for ( j = 0; j < 3; ++j ) d->n_point_triangles[t->vids[j]]++; } d->point_triangles = malloc( (size_t) ( d->npoints ) * sizeof ( int* ) ); for ( i = 0; i < d->npoints; ++i ) { if ( d->n_point_triangles[i] > 0 ) d->point_triangles[i] = malloc( (size_t) ( d->n_point_triangles[i] ) * sizeof ( int ) ); else d->point_triangles[i] = NULL; d->n_point_triangles[i] = 0; } for ( i = 0; i < d->ntriangles; ++i ) { triangle* t = &d->triangles[i]; for ( j = 0; j < 3; ++j ) { int vid = t->vids[j]; d->point_triangles[vid][d->n_point_triangles[vid]] = i; d->n_point_triangles[vid]++; } } d->nedges = 0; d->edges = NULL; d->t_in = NULL; d->t_out = NULL; d->first_id = -1; } else { free( d ); d = NULL; } free( qpoints ); qh_freeqhull( !qh_ALL ); // free long memory qh_memfreeshort( &curlong, &totlong ); // free short memory and memory allocator if ( curlong || totlong ) fprintf( errfile, "qhull: did not free %d bytes of long memory (%d pieces)\n", totlong, curlong ); return d; } // returns 1 if a,b,c are clockwise ordered static int cw( delaunay *d, triangle *t ) { point* pa = &d->points[t->vids[0]]; point* pb = &d->points[t->vids[1]]; point* pc = &d->points[t->vids[2]]; return ( ( pb->x - pa->x ) * ( pc->y - pa->y ) < ( pc->x - pa->x ) * ( pb->y - pa->y ) ); } #endif // Releases memory engaged in the Delaunay triangulation structure. // // @param d Structure to be destroyed // void delaunay_destroy( delaunay* d ) { if ( d == NULL ) return; if ( d->point_triangles != NULL ) { int i; for ( i = 0; i < d->npoints; ++i ) if ( d->point_triangles[i] != NULL ) free( d->point_triangles[i] ); free( d->point_triangles ); } if ( d->nedges > 0 ) free( d->edges ); #ifdef USE_QHULL // This is a shallow copy if we're not using qhull so we don't // need to free it if ( d->points != NULL ) free( d->points ); #endif if ( d->n_point_triangles != NULL ) free( d->n_point_triangles ); if ( d->flags != NULL ) free( d->flags ); if ( d->circles != NULL ) free( d->circles ); if ( d->neighbours != NULL ) free( d->neighbours ); if ( d->triangles != NULL ) free( d->triangles ); if ( d->t_in != NULL ) istack_destroy( d->t_in ); if ( d->t_out != NULL ) istack_destroy( d->t_out ); free( d ); } // Returns whether the point p is on the right side of the vector (p0, p1). // static int on_right_side( point* p, point* p0, point* p1 ) { return ( p1->x - p->x ) * ( p0->y - p->y ) > ( p0->x - p->x ) * ( p1->y - p->y ); } // Finds triangle specified point belongs to (if any). // // @param d Delaunay triangulation // @param p Point to be mapped // @param seed Triangle index to start with // @return Triangle id if successful, -1 otherwhile // int delaunay_xytoi( delaunay* d, point* p, int id ) { triangle* t; int i; if ( p->x < d->xmin || p->x > d->xmax || p->y < d->ymin || p->y > d->ymax ) return -1; if ( id < 0 || id > d->ntriangles ) id = 0; t = &d->triangles[id]; do { for ( i = 0; i < 3; ++i ) { int i1 = ( i + 1 ) % 3; if ( on_right_side( p, &d->points[t->vids[i]], &d->points[t->vids[i1]] ) ) { id = d->neighbours[id].tids[( i + 2 ) % 3]; if ( id < 0 ) return id; t = &d->triangles[id]; break; } } } while ( i < 3 ); return id; } // Finds all tricircles specified point belongs to. // // @param d Delaunay triangulation // @param p Point to be mapped // @param n Pointer to the number of tricircles within `d' containing `p' // (output) // @param out Pointer to an array of indices of the corresponding triangles // [n] (output) // // There is a standard search procedure involving search through triangle // neighbours (not through vertex neighbours). It must be a bit faster due to // the smaller number of triangle neighbours (3 per triangle) but can fail // for a point outside convex hall. // // We may wish to modify this procedure in future: first check if the point // is inside the convex hall, and depending on that use one of the two // search algorithms. It not 100% clear though whether this will lead to a // substantial speed gains because of the check on convex hall involved. // void delaunay_circles_find( delaunay* d, point* p, int* n, int** out ) { int i; if ( d->t_in == NULL ) { d->t_in = istack_create(); d->t_out = istack_create(); } // // It is important to have a reasonable seed here. If the last search // was successful -- start with the last found tricircle, otherwhile (i) // try to find a triangle containing (x,y); if fails then (ii) check // tricircles from the last search; if fails then (iii) make linear // search through all tricircles // if ( d->first_id < 0 || !circle_contains( &d->circles[d->first_id], p ) ) { // // if any triangle contains (x,y) -- start with this triangle // d->first_id = delaunay_xytoi( d, p, d->first_id ); // // if no triangle contains (x,y), there still is a chance that it is // inside some of circumcircles // if ( d->first_id < 0 ) { int nn = d->t_out->n; int tid = -1; // // first check results of the last search // for ( i = 0; i < nn; ++i ) { tid = d->t_out->v[i]; if ( circle_contains( &d->circles[tid], p ) ) break; } // // if unsuccessful, search through all circles // if ( tid < 0 || i == nn ) { double nt = d->ntriangles; for ( tid = 0; tid < nt; ++tid ) { if ( circle_contains( &d->circles[tid], p ) ) break; } if ( tid == nt ) { istack_reset( d->t_out ); *n = 0; *out = NULL; return; // failed } } d->first_id = tid; } } istack_reset( d->t_in ); istack_reset( d->t_out ); istack_push( d->t_in, d->first_id ); d->flags[d->first_id] = 1; // // main cycle // while ( d->t_in->n > 0 ) { int tid = istack_pop( d->t_in ); triangle* t = &d->triangles[tid]; if ( circle_contains( &d->circles[tid], p ) ) { istack_push( d->t_out, tid ); for ( i = 0; i < 3; ++i ) { int vid = t->vids[i]; int nt = d->n_point_triangles[vid]; int j; for ( j = 0; j < nt; ++j ) { int ntid = d->point_triangles[vid][j]; if ( d->flags[ntid] == 0 ) { istack_push( d->t_in, ntid ); d->flags[ntid] = 1; } } } } } *n = d->t_out->n; *out = d->t_out->v; } plplot-5.10.0+dfsg/lib/nn/nnpi.c 644 1750 1750 6046311647527346 152710ustar andrewandrew//-------------------------------------------------------------------------- // // File: nnpi.c // // Created: 15/11/2002 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Code for: // -- Natural Neighbours Point Interpolator // -- Natural Neighbours Point Hashing Interpolator // // Description: `nnpi' -- "Natural Neighbours Point // Interpolator" -- is a structure for conducting Natural // Neighbours interpolation on a given data on a // "point-to-point" basis. Because it involves weight // calculation for each next output point, it is not // particularly suitable for consequitive interpolations on // the same set of observation points -- use // `nnhpi' or `nnai' // in these cases. // // `nnhpi' is a structure for // conducting consequitive Natural Neighbours interpolations // on a given spatial data set in a random sequence of points // from a set of finite size, taking advantage of repeated // interpolations in the same point. It allows to modify Z // coordinate of data in between interpolations. // // // Revisions: 01/04/2003 PS: modified nnpi_triangle_process(): for // Sibson interpolation, if circle_build fails(), now a // local copy of a point is moved slightly rather than the // data point itself. The later approach have found leading // to inconsistencies of the new point position with the // earlier built triangulation. // //-------------------------------------------------------------------------- #include #include #include #include #include #include #include #include "nn.h" #include "delaunay.h" #include "nan.h" #include "hash.h" struct nnpi { delaunay* d; point * p; double wmin; // // work variables // int nvertices; int nallocated; int * vertices; // vertex indices double* weights; int n; // number of points processed }; int circle_build( circle* c, point* p0, point* p1, point* p2 ); int circle_contains( circle* c, point* p ); void delaunay_circles_find( delaunay* d, point* p, int* n, int** out ); int delaunay_xytoi( delaunay* d, point* p, int seed ); void nn_quit( const char* format, ... ); void nnpi_reset( nnpi* nn ); void nnpi_calculate_weights( nnpi* nn ); void nnpi_normalize_weights( nnpi* nn ); void nnpi_set_point( nnpi* nn, point* p ); int nnpi_get_nvertices( nnpi* nn ); int* nnpi_get_vertices( nnpi* nn ); double* nnpi_get_weights( nnpi* nn ); #define NSTART 10 #define NINC 10 #define EPS_SHIFT 1.0e-9 #define N_SEARCH_TURNON 20 #define BIGNUMBER 1.0e+100 #define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) #define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) // Creates Natural Neighbours point interpolator. // // @param d Delaunay triangulation // @return Natural Neighbours interpolation // nnpi* nnpi_create( delaunay* d ) { nnpi* nn = malloc( sizeof ( nnpi ) ); nn->d = d; nn->wmin = -DBL_MAX; nn->vertices = calloc( NSTART, sizeof ( int ) ); nn->weights = calloc( NSTART, sizeof ( double ) ); nn->nvertices = 0; nn->nallocated = NSTART; nn->p = NULL; nn->n = 0; return nn; } // Destroys Natural Neighbours point interpolator. // // @param nn Structure to be destroyed // void nnpi_destroy( nnpi* nn ) { free( nn->weights ); free( nn->vertices ); free( nn ); } void nnpi_reset( nnpi* nn ) { nn->nvertices = 0; nn->p = NULL; memset( nn->d->flags, 0, (size_t) ( nn->d->ntriangles ) * sizeof ( int ) ); } static void nnpi_add_weight( nnpi* nn, int vertex, double w ) { int i; // // find whether the vertex is already in the list // for ( i = 0; i < nn->nvertices; ++i ) if ( nn->vertices[i] == vertex ) break; if ( i == nn->nvertices ) // not in the list { // // get more memory if necessary // if ( nn->nvertices == nn->nallocated ) { nn->vertices = realloc( nn->vertices, (size_t) ( nn->nallocated + NINC ) * sizeof ( int ) ); nn->weights = realloc( nn->weights, (size_t) ( nn->nallocated + NINC ) * sizeof ( double ) ); nn->nallocated += NINC; } // // add the vertex to the list // nn->vertices[i] = vertex; nn->weights[i] = w; nn->nvertices++; } else // in the list { if ( nn_rule == SIBSON ) nn->weights[i] += w; else if ( w > nn->weights[i] ) nn->weights[i] = w; } } static double triangle_scale_get( delaunay* d, triangle* t ) { double x0 = d->points[t->vids[0]].x; double x1 = d->points[t->vids[1]].x; double x2 = d->points[t->vids[2]].x; double y0 = d->points[t->vids[0]].y; double y1 = d->points[t->vids[1]].y; double y2 = d->points[t->vids[2]].y; double xmin = min( min( x0, x1 ), x2 ); double xmax = max( max( x0, x1 ), x2 ); double ymin = min( min( y0, y1 ), y2 ); double ymax = max( max( y0, y1 ), y2 ); return xmax - xmin + ymax - ymin; } // This is a central procedure for the Natural Neighbours interpolation. It // uses the Watson's algorithm for the required areas calculation and implies // that the vertices of the delaunay triangulation are listed in uniform // (clockwise or counterclockwise) order. // static void nnpi_triangle_process( nnpi* nn, point* p, int i ) { delaunay* d = nn->d; triangle* t = &d->triangles[i]; circle * c = &d->circles[i]; circle cs[3]; int j; assert( circle_contains( c, p ) ); if ( nn_rule == SIBSON ) { point pp; pp.x = p->x; pp.y = p->y; // // Sibson interpolation by using Watson's algorithm // do { for ( j = 0; j < 3; ++j ) { int j1 = ( j + 1 ) % 3; int j2 = ( j + 2 ) % 3; int v1 = t->vids[j1]; int v2 = t->vids[j2]; if ( !circle_build( &cs[j], &d->points[v1], &d->points[v2], &pp ) ) { double scale = triangle_scale_get( d, t ); if ( d->points[v1].y == d->points[v2].y ) pp.y += EPS_SHIFT * scale; else pp.x += EPS_SHIFT * scale; break; } } } while ( j != 3 ); for ( j = 0; j < 3; ++j ) { int j1 = ( j + 1 ) % 3; int j2 = ( j + 2 ) % 3; double det = ( ( cs[j1].x - c->x ) * ( cs[j2].y - c->y ) - ( cs[j2].x - c->x ) * ( cs[j1].y - c->y ) ); nnpi_add_weight( nn, t->vids[j], det ); } } else if ( nn_rule == NON_SIBSONIAN ) { double d1 = c->r - hypot( p->x - c->x, p->y - c->y ); for ( i = 0; i < 3; ++i ) { int vid = t->vids[i]; point * pp = &d->points[vid]; double d2 = hypot( p->x - pp->x, p->y - pp->y ); if ( d2 == 0.0 ) nnpi_add_weight( nn, vid, BIGNUMBER ); else nnpi_add_weight( nn, vid, d1 / d2 ); } } else nn_quit( "unknown rule\n" ); } void nnpi_calculate_weights( nnpi* nn ) { point* p = nn->p; int n = nn->d->ntriangles; int i; if ( n > N_SEARCH_TURNON ) { int* tids; delaunay_circles_find( nn->d, p, &n, &tids ); for ( i = 0; i < n; ++i ) nnpi_triangle_process( nn, p, tids[i] ); } else for ( i = 0; i < n; ++i ) if ( circle_contains( &nn->d->circles[i], p ) ) nnpi_triangle_process( nn, p, i ); } void nnpi_normalize_weights( nnpi* nn ) { int n = nn->nvertices; double sum = 0.0; int i; for ( i = 0; i < n; ++i ) sum += nn->weights[i]; for ( i = 0; i < n; ++i ) nn->weights[i] /= sum; } // Finds Natural Neighbours-interpolated value for a point. // // @param nn NN interpolation // @param p Point to be interpolated (p->x, p->y -- input; p->z -- output) // void nnpi_interpolate_point( nnpi* nn, point* p ) { delaunay* d = nn->d; int i; nnpi_reset( nn ); nn->p = p; nnpi_calculate_weights( nn ); nnpi_normalize_weights( nn ); if ( nn_verbose ) { if ( nn_test_vertice == -1 ) { if ( nn->n == 0 ) fprintf( stderr, "weights:\n" ); fprintf( stderr, " %d: {", nn->n ); for ( i = 0; i < nn->nvertices; ++i ) { fprintf( stderr, "(%d,%.5g)", nn->vertices[i], nn->weights[i] ); if ( i < nn->nvertices - 1 ) fprintf( stderr, ", " ); } fprintf( stderr, "}\n" ); } else { double w = 0.0; if ( nn->n == 0 ) fprintf( stderr, "weights for vertex %d:\n", nn_test_vertice ); for ( i = 0; i < nn->nvertices; ++i ) { if ( nn->vertices[i] == nn_test_vertice ) { w = nn->weights[i]; break; } } fprintf( stderr, "%15.7g %15.7g %15.7g\n", p->x, p->y, w ); } } nn->n++; if ( nn->nvertices == 0 ) { p->z = NaN; return; } p->z = 0.0; for ( i = 0; i < nn->nvertices; ++i ) { double weight = nn->weights[i]; if ( weight < nn->wmin ) { p->z = NaN; return; } p->z += d->points[nn->vertices[i]].z * weight; } } // Performs Natural Neighbours interpolation for an array of points. // // @param nin Number of input points // @param pin Array of input points [pin] // @param wmin Minimal allowed weight // @param nout Number of output points // @param pout Array of output points [nout] // void nnpi_interpolate_points( int nin, point pin[], double wmin, int nout, point pout[] ) { delaunay* d = delaunay_build( nin, pin, 0, NULL, 0, NULL ); nnpi * nn = nnpi_create( d ); int seed = 0; int i; nn->wmin = wmin; if ( nn_verbose ) { fprintf( stderr, "xytoi:\n" ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; fprintf( stderr, "(%.7g,%.7g) -> %d\n", p->x, p->y, delaunay_xytoi( d, p, seed ) ); } } for ( i = 0; i < nout; ++i ) nnpi_interpolate_point( nn, &pout[i] ); if ( nn_verbose ) { fprintf( stderr, "output:\n" ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; fprintf( stderr, " %d:%15.7g %15.7g %15.7g\n", i, p->x, p->y, p->z ); } } nnpi_destroy( nn ); delaunay_destroy( d ); } // Sets minimal allowed weight for Natural Neighbours interpolation. // @param nn Natural Neighbours point interpolator // @param wmin Minimal allowed weight // void nnpi_setwmin( nnpi* nn, double wmin ) { nn->wmin = wmin; } // Sets point to interpolate in. // @param nn Natural Neighbours point interpolator // @param p Point to interpolate in // void nnpi_set_point( nnpi* nn, point* p ) { nn->p = p; } // Gets number of data points involved in current interpolation. // @return Number of data points involved in current interpolation // int nnpi_get_nvertices( nnpi* nn ) { return nn->nvertices; } // Gets indices of data points involved in current interpolation. // @return indices of data points involved in current interpolation // int* nnpi_get_vertices( nnpi* nn ) { return nn->vertices; } // Gets weights of data points involved in current interpolation. // @return weights of data points involved in current interpolation // double* nnpi_get_weights( nnpi* nn ) { return nn->weights; } // // nnhpi // struct nnhpi { nnpi * nnpi; hashtable* ht_data; hashtable* ht_weights; int n; // number of points processed }; typedef struct { int nvertices; int * vertices; // vertex indices [nvertices] double* weights; // vertex weights [nvertices] } nn_weights; // Creates Natural Neighbours hashing point interpolator. // // @param d Delaunay triangulation // @param size Hash table size (should be of order of number of output points) // @return Natural Neighbours interpolation // nnhpi* nnhpi_create( delaunay* d, int size ) { nnhpi* nn = malloc( sizeof ( nnhpi ) ); int i; nn->nnpi = nnpi_create( d ); nn->ht_data = ht_create_d2( d->npoints ); nn->ht_weights = ht_create_d2( size ); nn->n = 0; for ( i = 0; i < d->npoints; ++i ) ht_insert( nn->ht_data, &d->points[i], &d->points[i] ); return nn; } static void free_nn_weights( void* data ) { nn_weights* weights = (nn_weights *) data; free( weights->vertices ); free( weights->weights ); free( weights ); } // Destroys Natural Neighbours hashing point interpolation. // // @param nn Structure to be destroyed // void nnhpi_destroy( nnhpi* nn ) { ht_destroy( nn->ht_data ); ht_process( nn->ht_weights, free_nn_weights ); ht_destroy( nn->ht_weights ); nnpi_destroy( nn->nnpi ); } // Finds Natural Neighbours-interpolated value in a point. // // @param nnhp NN point hashing interpolator // @param p Point to be interpolated (p->x, p->y -- input; p->z -- output) // void nnhpi_interpolate( nnhpi* nnhp, point* p ) { nnpi * nnp = nnhp->nnpi; delaunay * d = nnp->d; hashtable * ht_weights = nnhp->ht_weights; nn_weights* weights; int i; if ( ht_find( ht_weights, p ) != NULL ) { weights = ht_find( ht_weights, p ); if ( nn_verbose ) fprintf( stderr, " \n" ); } else { nnpi_reset( nnp ); nnp->p = p; nnpi_calculate_weights( nnp ); nnpi_normalize_weights( nnp ); weights = malloc( sizeof ( nn_weights ) ); weights->vertices = malloc( sizeof ( int ) * (size_t) ( nnp->nvertices ) ); weights->weights = malloc( sizeof ( double ) * (size_t) ( nnp->nvertices ) ); weights->nvertices = nnp->nvertices; for ( i = 0; i < nnp->nvertices; ++i ) { weights->vertices[i] = nnp->vertices[i]; weights->weights[i] = nnp->weights[i]; } ht_insert( ht_weights, p, weights ); if ( nn_verbose ) { if ( nn_test_vertice == -1 ) { if ( nnp->n == 0 ) fprintf( stderr, "weights:\n" ); fprintf( stderr, " %d: {", nnp->n ); for ( i = 0; i < nnp->nvertices; ++i ) { fprintf( stderr, "(%d,%.5g)", nnp->vertices[i], nnp->weights[i] ); if ( i < nnp->nvertices - 1 ) fprintf( stderr, ", " ); } fprintf( stderr, "}\n" ); } else { double w = 0.0; if ( nnp->n == 0 ) fprintf( stderr, "weights for vertex %d:\n", nn_test_vertice ); for ( i = 0; i < nnp->nvertices; ++i ) { if ( nnp->vertices[i] == nn_test_vertice ) { w = nnp->weights[i]; break; } } fprintf( stderr, "%15.7g %15.7g %15.7g\n", p->x, p->y, w ); } } nnp->n++; } nnhp->n++; if ( weights->nvertices == 0 ) { p->z = NaN; return; } p->z = 0.0; for ( i = 0; i < weights->nvertices; ++i ) { if ( weights->weights[i] < nnp->wmin ) { p->z = NaN; return; } p->z += d->points[weights->vertices[i]].z * weights->weights[i]; } } // Modifies interpolated data. // Finds point* pd in the underlying Delaunay triangulation such that // pd->x = p->x and pd->y = p->y, and copies p->z to pd->z. Exits with error // if the point is not found. // // @param nnhp Natural Neighbours hashing point interpolator // @param p New data // void nnhpi_modify_data( nnhpi* nnhp, point* p ) { point* orig = ht_find( nnhp->ht_data, p ); assert( orig != NULL ); orig->z = p->z; } // Sets minimal allowed weight for Natural Neighbours interpolation. // @param nn Natural Neighbours point hashing interpolator // @param wmin Minimal allowed weight // void nnhpi_setwmin( nnhpi* nn, double wmin ) { nn->nnpi->wmin = wmin; } #if defined ( NNPHI_TEST ) #include #define NPOINTSIN 10000 #define NMIN 10 #define NX 101 #define NXMIN 1 #define SQ( x ) ( ( x ) * ( x ) ) static double franke( double x, double y ) { x *= 9.0; y *= 9.0; return 0.75 * exp( ( -SQ( x - 2.0 ) - SQ( y - 2.0 ) ) / 4.0 ) + 0.75 * exp( -SQ( x - 2.0 ) / 49.0 - ( y - 2.0 ) / 10.0 ) + 0.5 * exp( ( -SQ( x - 7.0 ) - SQ( y - 3.0 ) ) / 4.0 ) - 0.2 * exp( -SQ( x - 4.0 ) - SQ( y - 7.0 ) ); } static void usage() { printf( "Usage: nnhpi_test [-a] [-n ] [-v|-V]\n" ); printf( "Options:\n" ); printf( " -a -- use non-Sibsonian interpolation rule\n" ); printf( " -n :\n" ); printf( " -- number of input points (default = 10000)\n" ); printf( " -- number of output points per side (default = 64)\n" ); printf( " -v -- verbose\n" ); printf( " -V -- very verbose\n" ); exit( 0 ); } int main( int argc, char* argv[] ) { int nin = NPOINTSIN; int nx = NX; int nout = 0; point * pin = NULL; delaunay * d = NULL; point * pout = NULL; nnhpi * nn = NULL; int cpi = -1; // control point index struct timeval tv0, tv1; struct timezone tz; int i; i = 1; while ( i < argc ) { switch ( argv[i][1] ) { case 'a': i++; nn_rule = NON_SIBSONIAN; break; case 'n': i++; if ( i >= argc ) nn_quit( "no number of data points found after -n\n" ); nin = atoi( argv[i] ); i++; if ( i >= argc ) nn_quit( "no number of ouput points per side found after -i\n" ); nx = atoi( argv[i] ); i++; break; case 'v': i++; nn_verbose = 1; break; case 'V': i++; nn_verbose = 2; break; default: usage(); break; } } if ( nin < NMIN ) nin = NMIN; if ( nx < NXMIN ) nx = NXMIN; printf( "\nTest of Natural Neighbours hashing point interpolator:\n\n" ); printf( " %d data points\n", nin ); printf( " %d output points\n", nx * nx ); // // generate data // printf( " generating data:\n" ); fflush( stdout ); pin = malloc( nin * sizeof ( point ) ); for ( i = 0; i < nin; ++i ) { point* p = &pin[i]; p->x = (double) random() / RAND_MAX; p->y = (double) random() / RAND_MAX; p->z = franke( p->x, p->y ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } // // triangulate // printf( " triangulating:\n" ); fflush( stdout ); d = delaunay_build( nin, pin, 0, NULL, 0, NULL ); // // generate output points // points_generate2( -0.1, 1.1, -0.1, 1.1, nx, nx, &nout, &pout ); cpi = ( nx / 2 ) * ( nx + 1 ); gettimeofday( &tv0, &tz ); // // create interpolator // printf( " creating interpolator:\n" ); fflush( stdout ); nn = nnhpi_create( d, nout ); fflush( stdout ); gettimeofday( &tv1, &tz ); { long dt = 1000000 * ( tv1.tv_sec - tv0.tv_sec ) + tv1.tv_usec - tv0.tv_usec; printf( " interpolator creation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } // // interpolate // printf( " interpolating:\n" ); fflush( stdout ); gettimeofday( &tv1, &tz ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; nnhpi_interpolate( nn, p ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } fflush( stdout ); gettimeofday( &tv0, &tz ); { long dt = 1000000.0 * ( tv0.tv_sec - tv1.tv_sec ) + tv0.tv_usec - tv1.tv_usec; printf( " interpolation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", pout[cpi].x, pout[cpi].y, pout[cpi].z, franke( pout[cpi].x, pout[cpi].y ) ); printf( " interpolating one more time:\n" ); fflush( stdout ); gettimeofday( &tv0, &tz ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; nnhpi_interpolate( nn, p ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } fflush( stdout ); gettimeofday( &tv1, &tz ); { long dt = 1000000.0 * ( tv1.tv_sec - tv0.tv_sec ) + tv1.tv_usec - tv0.tv_usec; printf( " interpolation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", pout[cpi].x, pout[cpi].y, pout[cpi].z, franke( pout[cpi].x, pout[cpi].y ) ); printf( " entering new data:\n" ); fflush( stdout ); for ( i = 0; i < nin; ++i ) { point* p = &pin[i]; p->z = p->x * p->x - p->y * p->y; nnhpi_modify_data( nn, p ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } printf( " interpolating:\n" ); fflush( stdout ); gettimeofday( &tv1, &tz ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; nnhpi_interpolate( nn, p ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } fflush( stdout ); gettimeofday( &tv0, &tz ); { long dt = 1000000.0 * ( tv0.tv_sec - tv1.tv_sec ) + tv0.tv_usec - tv1.tv_usec; printf( " interpolation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", pout[cpi].x, pout[cpi].y, pout[cpi].z, pout[cpi].x * pout[cpi].x - pout[cpi].y * pout[cpi].y ); printf( " restoring data:\n" ); fflush( stdout ); for ( i = 0; i < nin; ++i ) { point* p = &pin[i]; p->z = franke( p->x, p->y ); nnhpi_modify_data( nn, p ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } printf( " interpolating:\n" ); fflush( stdout ); gettimeofday( &tv0, &tz ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; nnhpi_interpolate( nn, p ); if ( nn_verbose ) printf( " (%f, %f, %f)\n", p->x, p->y, p->z ); } fflush( stdout ); gettimeofday( &tv1, &tz ); { long dt = 1000000.0 * ( tv1.tv_sec - tv0.tv_sec ) + tv1.tv_usec - tv0.tv_usec; printf( " interpolation time = %ld us (%.2f us / point)\n", dt, (double) dt / nout ); } if ( !nn_verbose ) printf( " control point: (%f, %f, %f) (expected z = %f)\n", pout[cpi].x, pout[cpi].y, pout[cpi].z, franke( pout[cpi].x, pout[cpi].y ) ); printf( " hashtable stats:\n" ); fflush( stdout ); { hashtable* ht = nn->ht_data; printf( " input points: %d entries, %d table elements, %d filled elements\n", ht->n, ht->size, ht->nhash ); ht = nn->ht_weights; printf( " weights: %d entries, %d table elements, %d filled elements\n", ht->n, ht->size, ht->nhash ); } printf( "\n" ); nnhpi_destroy( nn ); free( pout ); delaunay_destroy( d ); free( pin ); return 0; } #endif plplot-5.10.0+dfsg/lib/nn/nndll.h 644 1750 1750 300111460615444 153700ustar andrewandrew#ifndef __NN_DLL_H #define __NN_DLL_H #ifdef USINGDLL #if defined ( WIN32 ) // Visual C/C++, Borland, MinGW and Watcom #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ ) #define NNDLLEXPORT __declspec( dllexport ) #define NNDLLIMPORT __declspec( dllimport ) #else #define NNDLLEXPORT #define NNDLLIMPORT #endif #elif defined ( __CYGWIN__ ) #define NNDLLEXPORT __declspec( dllexport ) #define NNDLLIMPORT __declspec( dllimport ) #elif defined ( __GNUC__ ) && __GNUC__ > 3 // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x // The following forces exported symbols specifically designated with // NNDLLEXPORT to be visible. #define NNDLLEXPORT __attribute__ ( ( visibility( "default" ) ) ) #define NNDLLIMPORT #endif #endif // For an unknown compiler or static built we clear the macros #ifndef NNDLLEXPORT #define NNDLLEXPORT #define NNDLLIMPORT #endif // The IMPEXP macros will always be set to DLLIMPORT (even for // the static library, but DLLIMPORT is empty in this case). If // cmake sets the corresponding macro xxxx_EXPORTS if the // corresponding library is built DLLIMPEXP is set to DLLEXPORT #if defined ( csironn_EXPORTS ) #define NNDLLIMPEXP NNDLLEXPORT #define NNDLLIMPEXP_DATA( type ) NNDLLEXPORT type #else #define NNDLLIMPEXP NNDLLIMPORT #define NNDLLIMPEXP_DATA( type ) NNDLLIMPORT type #endif #endif // __NN_DLL_H plplot-5.10.0+dfsg/lib/nn/nan.h 644 1750 1750 321211571511407 150360ustar andrewandrew//-------------------------------------------------------------------------- // // File: nan.h // // Created: 18/10/2001 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: NaN definition // // Description: Should cover machines with 64 bit doubles or other machines // with GCC // // Revisions: None // //-------------------------------------------------------------------------- #if !defined ( _NAN_H ) #define _NAN_H #if ( defined ( __GNUC__ ) && !defined ( __ICC ) ) || defined ( __BORLANDC__ ) static const double NaN = 0.0 / 0.0; #ifdef __BORLANDC__ #define isnan _isnan #define copysign _copysign #endif #elif defined ( WIN32 ) #if !defined ( _MSC_VER ) static unsigned _int64 lNaN = ( (unsigned _int64) 1 << 63 ) - 1; #define NaN ( *(double *) &lNaN ) #else // MSVC/C++ 6.0 reports a version 1200, // MSVC/C++ 2003 reports a version 1300 // #include #include #undef NaN #if _MSC_VER < 1300 #define NaN _Nan._D #else #define NaN _Nan._Double #endif #define isnan _isnan #define copysign _copysign #endif #else static const long long lNaN = ( (unsigned long long) 1 << 63 ) - 1; #define NaN ( *(double *) &lNaN ) #endif #endif //#if !defined(_NAN_H) // #define _NAN_H // // #if defined(__GNUC__) // static const double NaN = 0.0 / 0.0; // #elif defined(BIG_ENDIAN) || defined(_BIG_ENDIAN) // static const long long lNaN = 0x7fffffffffffffff; // // #define NaN (*(double*)&lNaN) // #else // static const long long lNaN = 0xfff8000000000000; // // #define NaN (*(double*)&lNaN) // #endif // // #endif plplot-5.10.0+dfsg/lib/nn/lpi.c 644 1750 1750 1046711647527346 151100ustar andrewandrew//-------------------------------------------------------------------------- // // File: linear.c // // Created: 04/08/2000 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: 2D linear interpolation // // Description: `lpi' -- "Linear Point Interpolator" -- is // a structure for conducting linear interpolation on a given // data on a "point-to-point" basis. It interpolates linearly // within each triangle resulted from the Delaunay // triangluation of input data. `lpi' is much // faster than all Natural Neighbours interpolators in `nn' // library. // // Revisions: None // //-------------------------------------------------------------------------- #include #include #include "nan.h" #include "delaunay.h" typedef struct { double w[3]; } lweights; struct lpi { delaunay* d; lweights* weights; }; int delaunay_xytoi( delaunay* d, point* p, int seed ); // Builds linear interpolator. // // @param d Delaunay triangulation // @return Linear interpolator // lpi* lpi_build( delaunay* d ) { int i; lpi * l = malloc( sizeof ( lpi ) ); l->d = d; l->weights = malloc( (size_t) d->ntriangles * sizeof ( lweights ) ); for ( i = 0; i < d->ntriangles; ++i ) { triangle* t = &d->triangles[i]; lweights* lw = &l->weights[i]; double x0 = d->points[t->vids[0]].x; double y0 = d->points[t->vids[0]].y; double z0 = d->points[t->vids[0]].z; double x1 = d->points[t->vids[1]].x; double y1 = d->points[t->vids[1]].y; double z1 = d->points[t->vids[1]].z; double x2 = d->points[t->vids[2]].x; double y2 = d->points[t->vids[2]].y; double z2 = d->points[t->vids[2]].z; double x02 = x0 - x2; double y02 = y0 - y2; double z02 = z0 - z2; double x12 = x1 - x2; double y12 = y1 - y2; double z12 = z1 - z2; if ( y12 != 0.0 ) { double y0212 = y02 / y12; lw->w[0] = ( z02 - z12 * y0212 ) / ( x02 - x12 * y0212 ); lw->w[1] = ( z12 - lw->w[0] * x12 ) / y12; lw->w[2] = ( z2 - lw->w[0] * x2 - lw->w[1] * y2 ); } else { double x0212 = x02 / x12; lw->w[1] = ( z02 - z12 * x0212 ) / ( y02 - y12 * x0212 ); lw->w[0] = ( z12 - lw->w[1] * y12 ) / x12; lw->w[2] = ( z2 - lw->w[0] * x2 - lw->w[1] * y2 ); } } return l; } // Destroys linear interpolator. // // @param l Structure to be destroyed // void lpi_destroy( lpi* l ) { free( l->weights ); free( l ); } // Finds linearly interpolated value in a point. // // @param l Linear interpolation // @param p Point to be interpolated (p->x, p->y -- input; p->z -- output) // void lpi_interpolate_point( lpi* l, point* p ) { delaunay* d = l->d; int tid = delaunay_xytoi( d, p, d->first_id ); if ( tid >= 0 ) { lweights* lw = &l->weights[tid]; d->first_id = tid; p->z = p->x * lw->w[0] + p->y * lw->w[1] + lw->w[2]; } else p->z = NaN; } // Linearly interpolates data from one array of points for another array of // points. // // @param nin Number of input points // @param pin Array of input points [pin] // @param nout Number of ouput points // @param pout Array of output points [nout] // void lpi_interpolate_points( int nin, point pin[], int nout, point pout[] ) { delaunay* d = delaunay_build( nin, pin, 0, NULL, 0, NULL ); lpi * l = lpi_build( d ); int seed = 0; int i; if ( nn_verbose ) { fprintf( stderr, "xytoi:\n" ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i]; fprintf( stderr, "(%.7g,%.7g) -> %d\n", p->x, p->y, delaunay_xytoi( d, p, seed ) ); } } for ( i = 0; i < nout; ++i ) lpi_interpolate_point( l, &pout[i] ); if ( nn_verbose ) { fprintf( stderr, "output:\n" ); for ( i = 0; i < nout; ++i ) { point* p = &pout[i];; fprintf( stderr, " %d:%15.7g %15.7g %15.7g\n", i, p->x, p->y, p->z ); } } lpi_destroy( l ); delaunay_destroy( d ); } plplot-5.10.0+dfsg/lib/nn/README.1st 644 1750 1750 200 7631173065 154370ustar andrewandrewThe files in this directory come from a stripped version of Pavel Sakov's nn library. See the file README for further details. plplot-5.10.0+dfsg/lib/qsastime/ 775 1750 1750 012406243566 152565ustar andrewandrewplplot-5.10.0+dfsg/lib/qsastime/qsastime_test.c 644 1750 1750 1242212276771565 204200ustar andrewandrew// // This software originally contributed under the LGPL in January 2009 to // PLplot by the // Cluster Science Centre // QSAS team, // Imperial College, London // Copyright (C) 2009 Imperial College, London // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "qsastime_extra.h" #include "qsastimeP.h" #include #include #include // Test program to run MJDtime int main() { char buf[360]; char copy[360]; int y = 2004; int m = 0; int d = 23; int hour = 13; int min = 39; double sec = 2.345678901; const char *ISOstring; double epoch; int doy, ifleapyear, y1; double zeroTest; size_t used; time_t localt; struct tm *ptm; MJDtime MJD1; MJDtime MJD2; printf( "Start date/time components: %d-%d-%d %d:%d:%13.11g\n", y, m + 1, d, hour, min, sec ); setFromUT( y, m, d, hour, min, sec, &MJD2, 0 ); breakDownMJD( &y, &m, &d, &hour, &min, &sec, &MJD2, 0 ); printf( "date/time components: %d-%d-%d %d:%d:%13.11g\n\n", y, m + 1, d, hour, min, sec ); printf( "MJD = %d, seconds = %17.15g\n", MJD2.base_day, MJD2.time_sec ); printf( " MJD = %18.10f \n", getMJD( &MJD2 ) ); printf( " JD = %18.10f \n\n", getJD( &MJD2 ) ); ISOstring = getISOString( &MJD2, 0, 0 ); printf( "ISO string = '%s'\n\n", ISOstring ); strfMJD( &( buf[0] ), 360, "%Y-%m-%d %H:%M:%S%.", &MJD2, 0, 0 ); printf( "strfMJD:ISO equiv: '%s'\n", buf ); strfMJD( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%S%4Z", &MJD2, 0, 0 ); printf( "strfMJD:ISO equiv: '%s'\n", buf ); getYAD( &y1, &ifleapyear, &doy, &MJD2, 0 ); setFromDOY( y, doy, hour, min, sec, &MJD1, 0 ); zeroTest = getDiffSecs( &MJD1, &MJD2 ); printf( "difference MJD (month/day) - MJD(doy) '%g'\n\n", zeroTest ); hour += 24; d -= 1; setFromUT( y, m, d, hour, min, sec, &MJD2, 0 ); zeroTest = getDiffDays( &MJD1, &MJD2 ); printf( "difference MJD (d-1, h+24) - MJD(d, h) '%g'\n\n", zeroTest ); epoch = getCDFepoch( &MJD2 ); printf( "CDF epoch sec %18.3f\n", epoch ); setFromCDFepoch( epoch, &MJD2 ); printf( "from CDF ISO string (CDF epoch is accurate to msec only) = '%s'\n", getISOString( &MJD2, 1, 0 ) ); printf( "Day of week is/was %s\n\n", getDayOfWeek( &MJD2 ) ); ISOstring = getISOString( &MJD1, 0, 0 ); printf( "ISO string = '%s'\n\n", ISOstring ); setFromISOstring( ISOstring, &MJD1, 0 ); printf( "for %s, MJD = %d, seconds = %17.11g\n", ISOstring, MJD1.base_day, MJD1.time_sec ); ISOstring = getISOString( &MJD1, 1, 0 ); printf( "ISO string = '%s'\n\n", ISOstring ); setFromISOstring( ISOstring, &MJD1, 0 ); printf( "for %s, MJD = %d, seconds = %17.11g\n\n", ISOstring, MJD1.base_day, MJD1.time_sec ); // try julian/gregorian changeover y = 1752; m = 8; d = 14; hour = 0; setFromUT( y, m, d, hour, min, sec, &MJD1, 0 ); strcpy( &( copy[0] ), getISOString( &MJD1, 0, 0 ) ); // copy because getISOString() returns a pointer to a static string printf( "Gregorian = '%s'\n", &( copy[0] ) ); //setFromUT(y, m, d, hour, min, sec, &MJD1, 1); // set from Julian date printf( "%s Julian = '%s' Gregorian, (give us back our 11 days)\n", getISOString( &MJD1, 1, 1 ), &( copy[0] ) ); // Compare formatting from strftime() used = strfMJD( &( buf[0] ), 360, " strfMJD():\n --------\n '%+' \n %c\n %D %F \n %j \n %r \n %s \n %v\n\n", &MJD2, 0, 0 ); printf( "chars %d for \n%s\n", (int) used, buf ); // seconds since 01 Jan 1970 Gregorian for strftime use localt = (int) MJD2.time_sec + ( MJD2.base_day - 40587 ) * 86400; ptm = gmtime( &localt ); #ifndef _MSC_VER // note %s not implemented in cygwin 1.5 gcc 3.x nothing printed strftime( &( buf[0] ), 360, " strftime(): (invalid before 1970 on some systems and subject to time zones on all systems)\n ------\n '%a %b %e %H:%M:%S UTC %Y' \n %c\n %D %F \n %j \n %r \n %s \n %e-%b-%Y", ptm ); #else // the following format options are not defined in MSVC (2008) // and are replaced as follows // %e -> %d will print as 01 etc // %D -> %m/%d/%y // %F -> %Y-%m-%d // %r -> %I:%M:%S %p // %s -> %%s - turned into literal as not implemented // // also %c and %p are locale dependent // strftime( &( buf[0] ), 360, " strftime(): (invalid before 1970)\n ------\n '%a %b %d %H:%M:%S UTC %Y' \n %c\n %m/%d/%y %Y-%m-%d \n %j \n %I:%M:%S %p \n %%s not implemented \n %d-%b-%Y", ptm ); #endif printf( "%s\n", buf ); } plplot-5.10.0+dfsg/lib/qsastime/deltaT-gen.c 644 1750 1750 1615111646000332 174730ustar andrewandrew// $Id: deltaT-gen.c 11971 2011-10-14 09:28:58Z andrewross $ // // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // Program for generating spline representation (xspline, yspline, // and y2spline arrays) header from deltaT.dat. // // The program assumes that argv[1] will be the input file, and // argv[2] the output file. This works cross-platform without // worrying about shell redirects of stdin and stdout that are // not accessible on Windows, apparently. #include #include #include #include #include "dspline.h" //-------------------------------------------------------------------------- // Function-like macro definitions //-------------------------------------------------------------------------- #define MemError1( a ) do { fprintf( stderr, "MEMORY ERROR %d\n" a "\n", __LINE__ ); exit( __LINE__ ); } while ( 0 ) const char header[] = "" \ "/*\n" \ " This file is part of PLplot.\n" \ " \n" \ " PLplot is free software; you can redistribute it and/or modify\n" \ " it under the terms of the GNU Library General Public License as published\n" \ " by the Free Software Foundation; either version 2 of the License, or\n" \ " (at your option) any later version.\n" \ " \n" \ " PLplot is distributed in the hope that it will be useful,\n" \ " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \ " GNU Library General Public License for more details.\n" \ " \n" \ " You should have received a copy of the GNU Library General Public License\n" \ " along with PLplot; if not, write to the Free Software\n" \ " Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n" \ " \n" \ " \n" \ " This header file contains spline data (xspline, yspline, and y2spline)\n" \ " for converting between UT1 and ephemeris time.\n" \ " It is an automatically generated file, so please do\n" \ " not edit it directly. Make any changes to deltaT.dat then use\n" \ " deltaT-gen to recreate this header file.\n" \ " \n" \ "*/"; int main( int argc, char *argv[] ) { FILE *fr, *fw; char readbuffer[256]; double *xspline = NULL; double *yspline = NULL; double *y2spline = NULL; int i = 0; int number_of_lines = 0; if ( ( argc < 2 ) || ( fr = fopen( argv[1], "r" ) ) == NULL ) { fprintf( stderr, "Cannot open first file as readable\n" ); exit( 1 ); } if ( ( argc < 3 ) || ( fw = fopen( argv[2], "w" ) ) == NULL ) { fprintf( stderr, "Cannot open second file as writable\n" ); exit( 1 ); } // // Work out how many lines we have all up // while ( ( fgets( readbuffer, 255, fr ) != NULL ) ) { ++number_of_lines; } // // Allocate memory to the arrays which will hold the data // if ( ( xspline = (double *) calloc( (size_t) number_of_lines, (size_t) sizeof ( double ) ) ) == NULL ) MemError1( "Allocating memory to the xspline table" ); if ( ( yspline = (double *) calloc( (size_t) number_of_lines, (size_t) sizeof ( double ) ) ) == NULL ) MemError1( "Allocating memory to the yspline table" ); if ( ( y2spline = (double *) calloc( (size_t) number_of_lines, (size_t) sizeof ( double ) ) ) == NULL ) MemError1( "Allocating memory to the y2spline table" ); rewind( fr ); // Go back to the start of the file // // Read in line by line, and copy the numbers into our arrays // while ( ( fgets( readbuffer, 255, fr ) != NULL ) ) { sscanf( readbuffer, "%lf %lf", (double *) &xspline[i], (double *) &yspline[i] ); i++; } fclose( fr ); // Calculate spline representation using second derivative condition // on end points that is consistent with overall average parabolic shape // of delta T curve (Morrison and Stephenson, 2004) with second // derivative = 6.4e-3 secs/year/year. dspline( xspline, yspline, number_of_lines, 2, 6.4e-3, 2, 6.4e-3, y2spline ); // // Write the data out to file ready to be included in our source // fprintf( fw, "%s\n", header ); fprintf( fw, "const int number_of_entries_in_spline_tables=%d;\n\n", number_of_lines ); fprintf( fw, "const double xspline[%d] = {\n", number_of_lines ); for ( i = 0; i < number_of_lines; i++ ) { fprintf( fw, "%10.0f,\n", xspline[i] ); } fprintf( fw, "};\n" ); fprintf( fw, "const double yspline[%d] = {\n", number_of_lines ); for ( i = 0; i < number_of_lines; i++ ) { fprintf( fw, "%10.0f,\n", yspline[i] ); } fprintf( fw, "};\n" ); fprintf( fw, "const double y2spline[%d] = {\n", number_of_lines ); for ( i = 0; i < number_of_lines; i++ ) { fprintf( fw, "%25.15e,\n", y2spline[i] ); } fprintf( fw, "};\n" ); fclose( fw ); free( xspline ); free( yspline ); free( y2spline ); return ( 0 ); } plplot-5.10.0+dfsg/lib/qsastime/qsastimedll.h 644 1750 1750 311411460615444 200230ustar andrewandrew#ifndef __QSASTIME_DLL_H #define __QSASTIME_DLL_H #ifdef USINGDLL #if defined ( WIN32 ) // Visual C/C++, Borland, MinGW and Watcom #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ ) #define QSASTIMEDLLEXPORT __declspec( dllexport ) #define QSASTIMEDLLIMPORT __declspec( dllimport ) #else #define QSASTIMEDLLEXPORT #define QSASTIMEDLLIMPORT #endif #elif defined ( __CYGWIN__ ) #define QSASTIMEDLLEXPORT __declspec( dllexport ) #define QSASTIMEDLLIMPORT __declspec( dllimport ) #elif defined ( __GNUC__ ) && __GNUC__ > 3 // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x // The following forces exported symbols specifically designated with // QSASTIMEDLLEXPORT to be visible. #define QSASTIMEDLLEXPORT __attribute__ ( ( visibility( "default" ) ) ) #define QSASTIMEDLLIMPORT #endif #endif // For an unknown compiler or static built we clear the macros #ifndef QSASTIMEDLLEXPORT # define QSASTIMEDLLEXPORT # define QSASTIMEDLLIMPORT #endif // The IMPEXP macros will always be set to DLLIMPORT (even for // the static library, but DLLIMPORT is empty in this case). If // cmake sets the corresponding macro xxxx_EXPORTS if the // corresponding library is built DLLIMPEXP is set to DLLEXPORT #if defined ( qsastime_EXPORTS ) #define QSASTIMEDLLIMPEXP QSASTIMEDLLEXPORT #define QSASTIMEDLLIMPEXP_DATA( type ) QSASTIMEDLLEXPORT type #else #define QSASTIMEDLLIMPEXP QSASTIMEDLLIMPORT #define QSASTIMEDLLIMPEXP_DATA( type ) QSASTIMEDLLIMPORT type #endif #endif // __QSASTIME_DLL_H plplot-5.10.0+dfsg/lib/qsastime/tai-utc.dat 644 1750 1750 600611142420277 173660ustar andrewandrew 1961 JAN 1 =JD 2437300.5 TAI-UTC= 1.4228180 S + (MJD - 37300.) X 0.001296 S 1961 AUG 1 =JD 2437512.5 TAI-UTC= 1.3728180 S + (MJD - 37300.) X 0.001296 S 1962 JAN 1 =JD 2437665.5 TAI-UTC= 1.8458580 S + (MJD - 37665.) X 0.0011232S 1963 NOV 1 =JD 2438334.5 TAI-UTC= 1.9458580 S + (MJD - 37665.) X 0.0011232S 1964 JAN 1 =JD 2438395.5 TAI-UTC= 3.2401300 S + (MJD - 38761.) X 0.001296 S 1964 APR 1 =JD 2438486.5 TAI-UTC= 3.3401300 S + (MJD - 38761.) X 0.001296 S 1964 SEP 1 =JD 2438639.5 TAI-UTC= 3.4401300 S + (MJD - 38761.) X 0.001296 S 1965 JAN 1 =JD 2438761.5 TAI-UTC= 3.5401300 S + (MJD - 38761.) X 0.001296 S 1965 MAR 1 =JD 2438820.5 TAI-UTC= 3.6401300 S + (MJD - 38761.) X 0.001296 S 1965 JUL 1 =JD 2438942.5 TAI-UTC= 3.7401300 S + (MJD - 38761.) X 0.001296 S 1965 SEP 1 =JD 2439004.5 TAI-UTC= 3.8401300 S + (MJD - 38761.) X 0.001296 S 1966 JAN 1 =JD 2439126.5 TAI-UTC= 4.3131700 S + (MJD - 39126.) X 0.002592 S 1968 FEB 1 =JD 2439887.5 TAI-UTC= 4.2131700 S + (MJD - 39126.) X 0.002592 S 1972 JAN 1 =JD 2441317.5 TAI-UTC= 10.0 S + (MJD - 41317.) X 0.0 S 1972 JUL 1 =JD 2441499.5 TAI-UTC= 11.0 S + (MJD - 41317.) X 0.0 S 1973 JAN 1 =JD 2441683.5 TAI-UTC= 12.0 S + (MJD - 41317.) X 0.0 S 1974 JAN 1 =JD 2442048.5 TAI-UTC= 13.0 S + (MJD - 41317.) X 0.0 S 1975 JAN 1 =JD 2442413.5 TAI-UTC= 14.0 S + (MJD - 41317.) X 0.0 S 1976 JAN 1 =JD 2442778.5 TAI-UTC= 15.0 S + (MJD - 41317.) X 0.0 S 1977 JAN 1 =JD 2443144.5 TAI-UTC= 16.0 S + (MJD - 41317.) X 0.0 S 1978 JAN 1 =JD 2443509.5 TAI-UTC= 17.0 S + (MJD - 41317.) X 0.0 S 1979 JAN 1 =JD 2443874.5 TAI-UTC= 18.0 S + (MJD - 41317.) X 0.0 S 1980 JAN 1 =JD 2444239.5 TAI-UTC= 19.0 S + (MJD - 41317.) X 0.0 S 1981 JUL 1 =JD 2444786.5 TAI-UTC= 20.0 S + (MJD - 41317.) X 0.0 S 1982 JUL 1 =JD 2445151.5 TAI-UTC= 21.0 S + (MJD - 41317.) X 0.0 S 1983 JUL 1 =JD 2445516.5 TAI-UTC= 22.0 S + (MJD - 41317.) X 0.0 S 1985 JUL 1 =JD 2446247.5 TAI-UTC= 23.0 S + (MJD - 41317.) X 0.0 S 1988 JAN 1 =JD 2447161.5 TAI-UTC= 24.0 S + (MJD - 41317.) X 0.0 S 1990 JAN 1 =JD 2447892.5 TAI-UTC= 25.0 S + (MJD - 41317.) X 0.0 S 1991 JAN 1 =JD 2448257.5 TAI-UTC= 26.0 S + (MJD - 41317.) X 0.0 S 1992 JUL 1 =JD 2448804.5 TAI-UTC= 27.0 S + (MJD - 41317.) X 0.0 S 1993 JUL 1 =JD 2449169.5 TAI-UTC= 28.0 S + (MJD - 41317.) X 0.0 S 1994 JUL 1 =JD 2449534.5 TAI-UTC= 29.0 S + (MJD - 41317.) X 0.0 S 1996 JAN 1 =JD 2450083.5 TAI-UTC= 30.0 S + (MJD - 41317.) X 0.0 S 1997 JUL 1 =JD 2450630.5 TAI-UTC= 31.0 S + (MJD - 41317.) X 0.0 S 1999 JAN 1 =JD 2451179.5 TAI-UTC= 32.0 S + (MJD - 41317.) X 0.0 S 2006 JAN 1 =JD 2453736.5 TAI-UTC= 33.0 S + (MJD - 41317.) X 0.0 S 2009 JAN 1 =JD 2454832.5 TAI-UTC= 34.0 S + (MJD - 41317.) X 0.0 S plplot-5.10.0+dfsg/lib/qsastime/README.tai-utc 644 1750 1750 742011200622625 175500ustar andrewandrewWe use the file tai-utc.dat (which is obtained by wget http://maia.usno.navy.mil/ser7/tai-utc.dat ) to define the relationship between UTC and TAI. (That file gets updated once per year or so, and it is the PLplot release manager's responsibility to check that the local tai-utc.dat is up to date with the file at maia.usno.navy.mil.) Here are the first and last lines in this file (as of 2009-03). 1961 JAN 1 =JD 2437300.5 TAI-UTC= 1.4228180 S + (MJD - 37300.) X 0.001296 S 2009 JAN 1 =JD 2454832.5 TAI-UTC= 34.0 S + (MJD - 41317.) X 0.0 S Clearly, the JD where the discontinuity in UTC occurs is in UTC. (If it were in TAI instead, the JD epoch would not correspond to midnight exactly.) I further assume that for early epochs where there was a non-zero slope, the MJD argument is also UTC. Thus, we have the following general relationship that holds between the discontinuities in UTC. MJD(TAI) - MJD(UTC) = (offset1 + (MJD(UTC) - offset2)*slope)/86400 (1) The tai-utc-gen application reads in these (UTC) epoch, offset1, offset2, and slope data from tai-utc.dat, calculates the discontinuous change in UTC at the unique TAI epoch of the UTC discontinuity using equation 2 below, and stores the results in the header file tai-utc.h as the TAI_UTC_lookup_table with data for MJD(TAI) (int base_day, double time_sec_tai), MJD(UTC) (int base_day, double time_sec_utc = 0.), the discontinuous change, offset1, offset2, and slope stored for each epoch. The qsastime library uses equation 1 to calculate MJD(TAI) as a function of MJD(UTC), and MJD(TAI) - MJD(UTC) = ((offset1 + (MJD(TAI) - offset2)*slope)/86400)/ (1. + slope/86400) (2) to calculate MJD(UTC) from MJD(TAI). (Equation 2 can be derived from equation 1 by adding (MJD(TAI) - MJD(UTC))*slope/86400 to each side and dividing out the common factor.) The data for these two equations is taken from tai-utc.h, and the efficient routine bhunt_search is used to find for a given MJD(TAI) or MJD(UTC) which set of data to use for the transformation from TAI to UTC or vice versa. For historical epochs prior to the starting date of tai-utc.dat (1961-01-01 = JD 2437300.5 UTC) we assume the same TAI-UTC offset of 1.422818 seconds as for the starting date of that file. This assumption of no variation in the earth rotation rate prior to 1961 is obviously not correct so that the TAI, TT, etc. derived from our code will not be reliable prior to that date. That is, if you use GMT (a historical backwards extension of UTC corresponding to civil time for the prime meridian) for broken down time prior to 1961, the TT result you will get will not produce a good approximation to the historical ephemeris time that is the correct backwards extension of TT, see http://en.wikipedia.org/wiki/Ephemeris_time. For epochs after the ending date of tai-utc.dat (currently 2009-01-01 = JD 2454832.5 UTC) we assume the same TAI-UTC offset (currently 34 seconds) as for the ending date of that file, i.e., we assume no leap seconds after the ending date of the file. Insertion of leap seconds cannot be predicted years in advance (because future predictions of the earth rotation rate are not reliable on such time scales) so the transformation between civil time (UTC) and TAI, TT, etc. cannot be known years in advance. However, the approximation of assuming no leap seconds after the end of the file should be correct on time scales less than roughly a year so when a decision is made in advance to insert an official leap second, there should be plenty of time for that decision to propagate to http://maia.usno.navy.mil/ser7/tai-utc.dat and ultimately the tai-utc.dat file included in our code releases. Thus, so long as we make releases on a timely basis, our calculation of TT for current epochs should always be reliable. plplot-5.10.0+dfsg/lib/qsastime/ttbipm.dat 644 1750 1750 10246611212777744 174020ustar andrewandrewTT(BIPM08) is a realization of Terrestrial Time as defined by Recommendation IV of Resolution A4 of the International Astronomical Union, adopted at its XXIst General Assembly (1991), and updated by Resolution B1.9 at its XXIVth General Assembly (2000). The scale unit of TT(BIPM08) thus agrees with the SI second on the rotating geoid and its origin is defined by the following relation to TAI : TT(BIPM08) = TAI + 32.184 s on 1977 January 1st, 0 h TAI. TT(BIPM08) has been established according to the principles described in (Guinot B., Atomic time scales for pulsar studies and other demanding applications, Astron. Astrophys., 192, 1988, pp. 370-373), updated in 2003 (Petit G., A new realization of Terrestrial Time, Proc. 35th PTTI, 2003, pp. 307-317) using data from all available primary frequency standards until December 2008. Following Recommendation S2 (1996) of the CCDS, a frequency correction for the black-body radiation shift is applied to all primary frequency standard results. The computation of TT(BIPM08) started on MJD 48989 (2 January 1993). Before that date, TT(BIPM08) is by construction identical to all past realizations since TT(BIPM99). The difference TT(BIPM08)-TT(BIPM07) is within 1 ns until December 2007 and the largest discrepancy between TT(BIPM08) and TT(BIPM07) is 1.5 ns in December 2006. Starting MJD 52729, TT(BIPM08) is provided with 0.1 ns resolution, consistent with the resolution of TAI. 1st column : MJD at 0 h UTC 2nd " : TT(BIPM08) - EAL - 32.184 s, unit is one microsecond 3rd " : TT(BIPM08) - TAI - 32.184 s, unit is one microsecond 42589. 46.258 46.258 42599. 45.439 45.439 42609. 44.617 44.617 42619. 43.793 43.793 42629. 42.965 42.965 42639. 42.133 42.133 42649. 41.298 41.298 42659. 40.459 40.459 42669. 39.615 39.615 42679. 38.766 38.766 42689. 37.913 37.913 42699. 37.054 37.054 42709. 36.189 36.189 42719. 35.311 35.311 42729. 34.429 34.429 42739. 33.542 33.542 42749. 32.652 32.652 42759. 31.760 31.760 42769. 30.866 30.866 42779. 29.971 29.971 42789. 29.076 29.076 42799. 28.183 28.183 42809. 27.294 27.294 42819. 26.408 26.408 42829. 25.528 25.528 42839. 24.659 24.659 42849. 23.797 23.797 42859. 22.942 22.942 42869. 22.095 22.095 42879. 21.258 21.258 42889. 20.429 20.429 42899. 19.618 19.618 42909. 18.820 18.820 42919. 18.029 18.029 42929. 17.245 17.245 42939. 16.467 16.467 42949. 15.693 15.693 42959. 14.923 14.923 42969. 14.156 14.156 42979. 13.390 13.390 42989. 12.623 12.623 42999. 11.854 11.854 43009. 11.082 11.082 43019. 10.305 10.305 43029 9.515 9.515 43039 8.718 8.718 43049 7.915 7.915 43059 7.107 7.107 43069 6.292 6.292 43079 5.472 5.472 43089 4.636 4.636 43099 3.796 3.796 43109 2.952 2.952 43119 2.107 2.107 43129 1.263 1.263 43139 0.420 0.420 43149. -0.420 0.012 43159. -1.255 0.041 43169. -2.084 0.076 43179. -2.905 0.119 43189. -3.716 0.172 43199. -4.517 0.235 43209. -5.296 0.320 43219. -6.062 0.418 43229. -6.817 0.527 43239. -7.560 0.648 43249. -8.292 0.780 43259. -9.013 0.923 43269. -9.718 1.065 43279. -10.414 1.216 43289. -11.101 1.375 43299. -11.781 1.542 43309. -12.455 1.715 43319. -13.124 1.892 43329. -13.790 2.056 43339. -14.453 2.222 43349. -15.115 2.390 43359. -15.777 2.557 43369. -16.439 2.724 43379. -17.104 2.889 43389. -17.776 3.029 43399. -18.452 3.166 43409. -19.131 3.298 43419. -19.815 3.427 43429. -20.503 3.551 43439. -21.195 3.671 43449. -21.896 3.765 43459. -22.601 3.855 43469. -23.311 3.940 43479. -24.025 4.020 43489. -24.745 4.096 43499. -25.468 4.167 43509. -26.200 4.231 43519. -26.934 4.291 43529. -27.672 4.348 43539. -28.412 4.403 43549. -29.153 4.457 43559. -29.895 4.510 43569. -30.638 4.561 43579. -31.380 4.614 43589. -32.120 4.669 43599. -32.857 4.727 43609. -33.589 4.790 43619. -34.316 4.858 43629. -35.031 4.937 43639. -35.739 5.025 43649. -36.439 5.120 43659. -37.132 5.221 43669. -37.818 5.330 43679. -38.497 5.446 43689. -39.167 5.571 43699. -39.825 5.708 43709. -40.476 5.852 43719. -41.123 6.000 43729. -41.765 6.152 43739. -42.404 6.308 43749. -43.041 6.466 43759. -43.676 6.626 43769. -44.310 6.787 43779. -44.946 6.946 43789. -45.584 7.103 43799. -46.226 7.256 43809. -46.873 7.404 43819. -47.533 7.521 43829. -48.199 7.633 43839. -48.871 7.738 43849. -49.550 7.837 43859. -50.235 7.929 43869. -50.927 8.016 43879. -51.629 8.091 43889. -52.337 8.160 43899. -53.051 8.224 43909. -53.768 8.285 43919. -54.489 8.341 43929. -55.212 8.396 43939. -55.939 8.446 43949. -56.666 8.496 43959. -57.394 8.547 43969. -58.120 8.598 43979. -58.844 8.651 43989. -59.565 8.708 43999. -60.279 8.772 44009. -60.988 8.841 44019. -61.692 8.914 44029. -62.390 8.994 44039. -63.081 9.080 44049. -63.766 9.172 44059. -64.438 9.262 44069. -65.102 9.357 44079. -65.760 9.459 44089. -66.413 9.567 44099. -67.062 9.679 44109. -67.705 9.795 44119. -68.342 9.902 44129. -68.975 10.011 44139. -69.608 10.122 44149. -70.242 10.231 44159. -70.877 10.339 44169. -71.515 10.444 44179. -72.159 10.526 44189. -72.809 10.602 44199. -73.465 10.671 44209. -74.129 10.733 44219. -74.801 10.787 44229. -75.483 10.831 44239. -76.185 10.854 44249. -76.898 10.867 44259. -77.620 10.871 44269. -78.351 10.865 44279. -79.091 10.851 44289. -79.840 10.828 44299. -80.601 10.793 44309. -81.371 10.749 44319. -82.145 10.700 44329. -82.922 10.649 44339. -83.701 10.596 44349. -84.479 10.544 44359. -85.253 10.496 44369. -86.019 10.455 44379. -86.781 10.419 44389. -87.538 10.388 44399. -88.288 10.364 44409. -89.031 10.346 44419. -89.766 10.337 44429. -90.483 10.346 44439. -91.192 10.363 44449. -91.893 10.388 44459. -92.587 10.419 44469. -93.274 10.457 44479. -93.956 10.501 44489. -94.627 10.556 44499. -95.295 10.614 44509. -95.960 10.675 44519. -96.625 10.736 44529. -97.290 10.796 44539. -97.958 10.854 44549. -98.635 10.903 44559. -99.316 10.947 44569. -100.003 10.986 44579. -100.696 11.019 44589. -101.396 11.045 44599. -102.104 11.063 44609. -102.829 11.064 44619. -103.561 11.057 44629. -104.300 11.044 44639. -105.045 11.025 44649. -105.795 11.001 44659. -106.548 10.973 44669. -107.309 10.938 44679. -108.071 10.901 44689. -108.834 10.865 44699. -109.595 10.830 44709. -110.353 10.797 44719. -111.106 10.770 44729. -111.847 10.754 44739. -112.582 10.745 44749. -113.309 10.744 44759. -114.029 10.750 44769. -114.741 10.764 44779. -115.444 10.787 44789. -116.128 10.828 44799. -116.804 10.878 44809. -117.473 10.935 44819. -118.136 10.997 44829. -118.795 11.064 44839. -119.450 11.135 44849. -120.102 11.209 44859. -120.753 11.284 44869. -121.404 11.358 44879. -122.057 11.431 44889. -122.713 11.501 44899. -123.373 11.566 44909. -124.046 11.620 44919. -124.726 11.665 44929. -125.413 11.704 44939. -126.106 11.736 44949. -126.805 11.763 44959. -127.510 11.784 44969. -128.226 11.794 44979. -128.950 11.795 44989. -129.679 11.792 44999. -130.411 11.786 45009. -131.145 11.778 45019. -131.879 11.769 45029. -132.612 11.762 45039. -133.343 11.757 45049. -134.071 11.755 45059. -134.795 11.757 45069. -135.514 11.764 45079. -136.226 11.777 45089. -136.929 11.800 45099. -137.617 11.820 45109. -138.298 11.848 45119. -138.971 11.884 45129. -139.637 11.926 45139. -140.297 11.974 45149. -140.951 12.029 45159. -141.596 12.075 45169. -142.236 12.127 45179. -142.872 12.181 45189. -143.507 12.238 45199. -144.140 12.296 45209. -144.773 12.354 45219. -145.409 12.392 45229. -146.046 12.429 45239. -146.685 12.464 45249. -147.328 12.495 45259. -147.974 12.522 45269. -148.626 12.544 45279. -149.290 12.555 45289. -149.959 12.560 45299. -150.633 12.559 45309. -151.312 12.554 45319. -151.995 12.545 45329. -152.683 12.531 45339. -153.377 12.511 45349. -154.075 12.487 45359. -154.775 12.461 45369. -155.476 12.434 45379. -156.178 12.406 45389. -156.880 12.377 45399. -157.581 12.351 45409. -158.279 12.326 45419. -158.976 12.303 45429. -159.670 12.283 45439. -160.361 12.267 45449. -161.047 12.254 45459. -161.725 12.250 45469. -162.398 12.251 45479. -163.067 12.256 45489. -163.730 12.267 45499. -164.389 12.281 45509. -165.044 12.301 45519. -165.689 12.329 45529. -166.331 12.362 45539. -166.969 12.398 45549. -167.605 12.436 45559. -168.238 12.476 45569. -168.871 12.517 45579. -169.505 12.557 45589. -170.138 12.598 45599. -170.772 12.637 45609. -171.408 12.676 45619. -172.045 12.712 45629. -172.685 12.747 45639. -173.330 12.775 45649. -173.980 12.800 45659. -174.632 12.821 45669. -175.288 12.839 45679. -175.947 12.855 45689. -176.609 12.867 45699. -177.274 12.875 45709. -177.946 12.877 45719. -178.619 12.878 45729. -179.295 12.876 45739. -179.972 12.873 45749. -180.650 12.868 45759. -181.329 12.864 45769. -182.007 12.877 45779. -182.685 12.890 45789. -183.362 12.904 45799. -184.038 12.919 45809. -184.712 12.936 45819. -185.385 12.955 45829. -186.053 12.978 45839. -186.718 13.004 45849. -187.382 13.032 45859. -188.043 13.062 45869. -188.702 13.094 45879. -189.359 13.128 45889. -190.012 13.166 45899. -190.664 13.205 45909. -191.315 13.246 45919. -191.964 13.288 45929. -192.612 13.331 45939. -193.260 13.374 45949. -193.907 13.418 45959. -194.555 13.462 45969. -195.203 13.505 45979. -195.851 13.548 45989. -196.501 13.590 45999. -197.151 13.630 46009. -197.806 13.667 46019. -198.462 13.702 46029. -199.120 13.735 46039. -199.779 13.767 46049. -200.441 13.797 46059. -201.104 13.825 46069. -201.771 13.849 46079. -202.439 13.872 46089. -203.109 13.894 46099. -203.779 13.914 46109. -204.451 13.934 46119. -205.123 13.953 46129. -205.795 13.972 46139. -206.467 13.991 46149. -207.139 14.010 46159. -207.811 14.030 46169. -208.482 14.050 46179. -209.153 14.070 46189. -209.821 14.093 46199. -210.489 14.117 46209. -211.155 14.141 46219. -211.821 14.167 46229. -212.486 14.193 46239. -213.151 14.220 46249. -213.813 14.249 46259. -214.475 14.278 46269. -215.136 14.308 46279. -215.798 14.337 46289. -216.460 14.367 46299. -217.122 14.395 46309. -217.786 14.423 46319. -218.451 14.449 46329. -219.117 14.474 46339. -219.784 14.498 46349. -220.453 14.520 46359. -221.124 14.540 46369. -221.798 14.558 46379. -222.476 14.571 46389. -223.155 14.583 46399. -223.836 14.593 46409. -224.520 14.601 46419. -225.205 14.607 46429. -225.892 14.611 46439. -226.581 14.613 46449. -227.272 14.613 46459. -227.964 14.612 46469. -228.657 14.611 46479. -229.350 14.609 46489. -230.043 14.607 46499. -230.736 14.605 46509. -231.429 14.604 46519. -232.120 14.603 46529. -232.811 14.604 46539. -233.500 14.606 46549. -234.188 14.610 46559. -234.872 14.617 46569. -235.554 14.626 46579. -236.234 14.637 46589. -236.912 14.651 46599. -237.587 14.666 46609. -238.261 14.684 46619. -238.930 14.705 46629. -239.598 14.729 46639. -240.264 14.755 46649. -240.928 14.781 46659. -241.592 14.809 46669. -242.254 14.837 46679. -242.916 14.867 46689. -243.578 14.896 46699. -244.240 14.925 46709. -244.903 14.954 46719. -245.566 14.982 46729. -246.231 15.008 46739. -246.900 15.031 46749. -247.570 15.052 46759. -248.242 15.071 46769. -248.915 15.089 46779. -249.591 15.104 46789. -250.268 15.119 46799. -250.949 15.129 46809. -251.631 15.138 46819. -252.314 15.145 46829. -252.999 15.153 46839. -253.683 15.159 46849. -254.368 15.166 46859. -255.052 15.173 46869. -255.736 15.180 46879. -256.419 15.188 46889. -257.100 15.198 46899. -257.781 15.209 46909. -258.459 15.221 46919. -259.133 15.239 46929. -259.806 15.259 46939. -260.476 15.281 46949. -261.145 15.305 46959. -261.812 15.331 46969. -262.477 15.358 46979. -263.139 15.388 46989. -263.799 15.419 46999. -264.459 15.452 47009. -265.118 15.486 47019. -265.776 15.520 47029. -266.433 15.555 47039. -267.091 15.589 47049. -267.749 15.623 47059. -268.407 15.657 47069. -269.066 15.691 47079. -269.725 15.724 47089. -270.385 15.756 47099. -271.047 15.787 47109. -271.710 15.816 47119. -272.375 15.843 47129. -273.041 15.870 47139. -273.707 15.896 47149. -274.374 15.921 47159. -275.042 15.945 47169. -275.712 15.967 47179. -276.381 15.989 47189. -277.052 16.010 47199. -277.722 16.030 47209. -278.393 16.051 47219. -279.063 16.072 47229. -279.733 16.093 47239. -280.403 16.114 47249. -281.072 16.137 47259. -281.740 16.160 47269. -282.407 16.183 47279. -283.074 16.209 47289. -283.737 16.236 47299. -284.400 16.264 47309. -285.061 16.294 47319. -285.721 16.326 47329. -286.379 16.359 47339. -287.036 16.394 47349. -287.689 16.431 47359. -288.341 16.470 47369. -288.992 16.510 47379. -289.642 16.552 47389. -290.291 16.594 47399. -290.940 16.636 47409. -291.588 16.680 47419. -292.235 16.723 47429. -292.883 16.767 47439. -293.531 16.810 47449. -294.180 16.853 47459. -294.829 16.894 47469. -295.481 16.934 47479. -296.134 16.972 47489. -296.788 17.009 47499. -297.443 17.045 47509. -298.100 17.080 47519. -298.757 17.114 47529. -299.418 17.144 47539. -300.080 17.174 47549. -300.742 17.203 47559. -301.404 17.231 47569. -302.067 17.260 47579. -302.729 17.289 47589. -303.390 17.319 47599. -304.050 17.350 47609. -304.709 17.382 47619. -305.367 17.416 47629. -306.023 17.451 47639. -306.677 17.488 47649. -307.328 17.529 47659. -307.976 17.572 47669. -308.622 17.617 47679. -309.267 17.663 47689. -309.909 17.712 47699. -310.551 17.762 47709. -311.189 17.810 47719. -311.826 17.860 47729. -312.463 17.910 47739. -313.098 17.962 47749. -313.733 18.014 47759. -314.368 18.065 47769. -315.004 18.117 47779. -315.641 18.166 47789. -316.279 18.215 47799. -316.918 18.263 47809. -317.557 18.311 47819. -318.197 18.358 47829. -318.837 18.405 47839. -319.480 18.449 47849. -320.123 18.493 47859. -320.767 18.536 47869. -321.411 18.579 47879. -322.055 18.622 47889. -322.699 18.664 47899. -323.342 18.703 47909. -323.986 18.743 47919. -324.629 18.782 47929. -325.271 18.822 47939. -325.913 18.863 47949. -326.555 18.904 47959. -327.194 18.943 47969. -327.833 18.982 47979. -328.472 19.021 47989. -329.110 19.062 47999. -329.748 19.102 48009. -330.385 19.143 48019. -331.022 19.179 48029. -331.660 19.216 48039. -332.297 19.253 48049. -332.933 19.290 48059. -333.570 19.327 48069. -334.207 19.364 48079. -334.845 19.396 48089. -335.482 19.428 48099. -336.120 19.461 48109. -336.757 19.493 48119. -337.394 19.525 48129. -338.031 19.558 48139. -338.668 19.586 48149. -339.304 19.615 48159. -339.940 19.645 48169. -340.576 19.674 48179. -341.211 19.705 48189. -341.845 19.736 48199. -342.478 19.768 48209. -343.111 19.801 48219. -343.742 19.834 48229. -344.373 19.869 48239. -345.003 19.904 48249. -345.632 19.940 48259. -346.260 19.978 48269. -346.887 20.016 48279. -347.513 20.056 48289. -348.138 20.096 48299. -348.762 20.137 48309. -349.385 20.179 48319. -350.008 20.215 48329. -350.630 20.252 48339. -351.251 20.289 48349. -351.872 20.327 48359. -352.492 20.366 48369. -353.112 20.405 48379. -353.730 20.439 48389. -354.348 20.473 48399. -354.966 20.508 48409. -355.583 20.544 48419. -356.199 20.579 48429. -356.815 20.615 48439. -357.431 20.652 48449. -358.047 20.689 48459. -358.662 20.726 48469. -359.278 20.762 48479. -359.893 20.799 48489. -360.509 20.836 48499. -361.125 20.873 48509. -361.741 20.904 48519. -362.357 20.936 48529. -362.974 20.967 48539. -363.592 20.997 48549. -364.210 21.027 48559. -364.829 21.056 48569. -365.449 21.080 48579. -366.070 21.102 48589. -366.692 21.124 48599. -367.314 21.146 48609. -367.937 21.166 48619. -368.561 21.186 48629. -369.186 21.205 48639. -369.811 21.224 48649. -370.436 21.242 48659. -371.062 21.260 48669. -371.687 21.279 48679. -372.312 21.298 48689. -372.935 21.318 48699. -373.558 21.339 48709. -374.180 21.360 48719. -374.801 21.383 48729. -375.421 21.407 48739. -376.040 21.432 48749. -376.656 21.455 48759. -377.271 21.479 48769. -377.886 21.504 48779. -378.499 21.530 48789. -379.112 21.556 48799. -379.723 21.584 48809. -380.334 21.608 48819. -380.944 21.633 48829. -381.554 21.658 48839. -382.164 21.684 48849. -382.774 21.709 48859. -383.384 21.733 48869. -383.996 21.757 48879. -384.608 21.780 48889. -385.221 21.802 48899. -385.834 21.823 48909. -386.449 21.844 48919. -387.064 21.864 48929. -387.680 21.883 48939. -388.298 21.900 48949. -388.916 21.917 48959. -389.535 21.933 48969. -390.154 21.949 48979. -390.774 21.964 48989. -391.395 21.978 48999. -392.015 21.993 49009. -392.635 22.008 49019. -393.255 22.023 49029. -393.876 22.037 49039. -394.496 22.052 49049. -395.117 22.066 49059. -395.738 22.081 49069. -396.359 22.095 49079. -396.980 22.109 49089. -397.601 22.124 49099. -398.222 22.139 49109. -398.843 22.155 49119. -399.464 22.173 49129. -400.086 22.191 49139. -400.707 22.209 49149. -401.329 22.227 49159. -401.950 22.245 49169. -402.572 22.262 49179. -403.194 22.280 49189. -403.816 22.297 49199. -404.437 22.315 49209. -405.059 22.332 49219. -405.682 22.349 49229. -406.304 22.367 49239. -406.926 22.384 49249. -407.548 22.401 49259. -408.171 22.417 49269. -408.794 22.434 49279. -409.416 22.451 49289. -410.039 22.467 49299. -410.662 22.484 49309. -411.285 22.500 49319. -411.908 22.517 49329. -412.531 22.533 49339. -413.154 22.549 49349. -413.777 22.565 49359. -414.400 22.582 49369. -415.024 22.598 49379. -415.647 22.614 49389. -416.270 22.630 49399. -416.893 22.647 49409. -417.516 22.663 49419. -418.138 22.680 49429. -418.761 22.697 49439. -419.384 22.713 49449. -420.006 22.730 49459. -420.628 22.748 49469. -421.250 22.765 49479. -421.872 22.782 49489. -422.494 22.800 49499. -423.115 22.818 49509. -423.737 22.836 49519. -424.358 22.854 49529. -424.979 22.872 49539. -425.600 22.891 49549. -426.221 22.909 49559. -426.841 22.928 49569. -427.462 22.946 49579. -428.083 22.965 49589. -428.703 22.984 49599. -429.324 23.003 49609. -429.944 23.022 49619. -430.564 23.041 49629. -431.185 23.060 49639. -431.805 23.079 49649. -432.425 23.098 49659. -433.045 23.118 49669. -433.665 23.137 49679. -434.285 23.156 49689. -434.905 23.176 49699. -435.525 23.196 49709. -436.144 23.215 49719. -436.763 23.235 49729. -437.383 23.256 49739. -438.002 23.276 49749. -438.621 23.296 49759. -439.239 23.317 49769. -439.858 23.338 49779. -440.476 23.358 49789. -441.095 23.378 49799. -441.713 23.399 49809. -442.330 23.419 49819. -442.948 23.440 49829. -443.566 23.461 49839. -444.183 23.481 49849. -444.801 23.501 49859. -445.418 23.522 49869. -446.035 23.542 49879. -446.652 23.562 49889. -447.270 23.583 49899. -447.887 23.603 49909. -448.504 23.622 49919. -449.121 23.642 49929. -449.738 23.662 49939. -450.355 23.681 49949. -450.972 23.701 49959. -451.589 23.721 49969. -452.206 23.740 49979. -452.823 23.758 49989. -453.441 23.777 49999. -454.058 23.796 50009. -454.675 23.815 50019. -455.292 23.834 50029. -455.909 23.852 50039. -456.526 23.870 50049. -457.143 23.888 50059. -457.759 23.906 50069. -458.376 23.925 50079. -458.992 23.943 50089. -459.608 23.961 50099. -460.224 23.980 50109. -460.840 23.998 50119. -461.455 24.017 50129. -462.071 24.036 50139. -462.685 24.055 50149. -463.300 24.074 50159. -463.914 24.093 50169. -464.528 24.112 50179. -465.142 24.132 50189. -465.756 24.152 50199. -466.369 24.172 50209. -466.982 24.191 50219. -467.594 24.211 50229. -468.206 24.232 50239. -468.818 24.252 50249. -469.430 24.273 50259. -470.041 24.294 50269. -470.652 24.315 50279. -471.263 24.336 50289. -471.873 24.357 50299. -472.483 24.379 50309. -473.093 24.400 50319. -473.703 24.422 50329. -474.312 24.444 50339. -474.921 24.465 50349. -475.530 24.486 50359. -476.139 24.508 50369. -476.748 24.529 50379. -477.356 24.551 50389. -477.965 24.573 50399. -478.573 24.594 50409. -479.181 24.615 50419. -479.788 24.636 50429. -480.396 24.657 50439. -481.003 24.679 50449. -481.611 24.700 50459. -482.218 24.720 50469. -482.825 24.741 50479. -483.432 24.762 50489. -484.039 24.782 50499. -484.646 24.803 50509. -485.252 24.824 50519. -485.859 24.843 50529. -486.466 24.863 50539. -487.072 24.883 50549. -487.679 24.903 50559. -488.285 24.923 50569. -488.892 24.942 50579. -489.498 24.960 50589. -490.105 24.978 50599. -490.712 24.996 50609. -491.318 25.014 50619. -491.925 25.031 50629. -492.532 25.049 50639. -493.140 25.065 50649. -493.747 25.080 50659. -494.354 25.096 50669. -494.962 25.111 50679. -495.570 25.126 50689. -496.178 25.141 50699. -496.787 25.153 50709. -497.396 25.166 50719. -498.005 25.178 50729. -498.614 25.190 50739. -499.223 25.202 50749. -499.833 25.213 50759. -500.443 25.223 50769. -501.054 25.232 50779. -501.664 25.241 50789. -502.275 25.249 50799. -502.886 25.258 50809. -503.497 25.266 50819. -504.109 25.273 50829. -504.721 25.280 50839. -505.333 25.286 50849. -505.945 25.292 50859. -506.558 25.297 50869. -507.171 25.302 50879. -507.784 25.306 50889. -508.397 25.310 50899. -509.010 25.314 50909. -509.624 25.316 50919. -510.237 25.318 50929. -510.851 25.320 50939. -511.465 25.322 50949. -512.080 25.324 50959. -512.694 25.326 50969. -513.309 25.327 50979. -513.924 25.328 50989. -514.538 25.329 50999. -515.153 25.331 51009. -515.769 25.331 51019. -516.384 25.332 51029. -516.999 25.333 51039. -517.614 25.334 51049. -518.230 25.334 51059. -518.845 25.335 51069. -519.460 25.336 51079. -520.076 25.336 51089. -520.691 25.337 51099. -521.307 25.338 51109. -521.922 25.339 51119. -522.537 25.339 51129. -523.152 25.340 51139. -523.767 25.341 51149. -524.382 25.342 51159. -524.997 25.343 51169. -525.612 25.345 51179. -526.227 25.346 51189. -526.841 25.347 51199. -527.456 25.349 51209. -528.070 25.350 51219. -528.685 25.352 51229. -529.299 25.354 51239. -529.913 25.356 51249. -530.527 25.359 51259. -531.141 25.362 51269. -531.754 25.366 51279. -532.368 25.369 51289. -532.982 25.372 51299. -533.595 25.376 51309. -534.208 25.379 51319. -534.822 25.383 51329. -535.435 25.387 51339. -536.048 25.390 51349. -536.661 25.394 51359. -537.274 25.398 51369. -537.886 25.403 51379. -538.499 25.407 51389. -539.112 25.411 51399. -539.724 25.415 51409. -540.337 25.420 51419. -540.949 25.424 51429. -541.562 25.429 51439. -542.174 25.433 51449. -542.787 25.437 51459. -543.399 25.442 51469. -544.011 25.446 51479. -544.624 25.451 51489. -545.236 25.455 51499. -545.849 25.460 51509. -546.461 25.464 51519. -547.073 25.469 51529. -547.686 25.473 51539. -548.298 25.478 51549. -548.910 25.482 51559. -549.522 25.486 51569. -550.134 25.490 51579. -550.746 25.494 51589. -551.358 25.498 51599. -551.970 25.502 51609. -552.581 25.507 51619. -553.193 25.512 51629. -553.804 25.516 51639. -554.415 25.522 51649. -555.026 25.527 51659. -555.636 25.532 51669. -556.247 25.538 51679. -556.857 25.543 51689. -557.467 25.549 51699. -558.077 25.555 51709. -558.687 25.560 51719. -559.297 25.566 51729. -559.906 25.571 51739. -560.516 25.577 51749. -561.125 25.583 51759. -561.734 25.589 51769. -562.343 25.595 51779. -562.952 25.602 51789. -563.561 25.608 51799. -564.169 25.614 51809. -564.778 25.621 51819. -565.387 25.627 51829. -565.995 25.633 51839. -566.604 25.639 51849. -567.212 25.644 51859. -567.821 25.650 51869. -568.429 25.656 51879. -569.037 25.662 51889. -569.646 25.667 51899. -570.254 25.672 51909. -570.862 25.678 51919. -571.470 25.683 51929. -572.078 25.688 51939. -572.686 25.694 51949. -573.294 25.699 51959. -573.901 25.704 51969. -574.509 25.709 51979. -575.116 25.714 51989. -575.723 25.720 51999. -576.330 25.726 52009. -576.936 25.732 52019. -577.543 25.738 52029. -578.149 25.744 52039. -578.755 25.750 52049. -579.360 25.756 52059. -579.966 25.762 52069. -580.571 25.769 52079. -581.176 25.776 52089. -581.780 25.783 52099. -582.385 25.790 52109. -582.989 25.798 52119. -583.593 25.806 52129. -584.196 25.813 52139. -584.799 25.821 52149. -585.403 25.828 52159. -586.006 25.836 52169. -586.608 25.844 52179. -587.211 25.853 52189. -587.813 25.860 52199. -588.415 25.868 52209. -589.017 25.876 52219. -589.619 25.885 52229. -590.220 25.893 52239. -590.821 25.902 52249. -591.422 25.910 52259. -592.023 25.918 52269. -592.624 25.927 52279. -593.224 25.935 52289. -593.825 25.944 52299. -594.425 25.953 52309. -595.025 25.962 52319. -595.625 25.970 52329. -596.224 25.979 52339. -596.824 25.988 52349. -597.423 25.997 52359. -598.022 26.006 52369. -598.621 26.015 52379. -599.220 26.023 52389. -599.819 26.032 52399. -600.417 26.041 52409. -601.016 26.049 52419. -601.614 26.058 52429. -602.213 26.067 52439. -602.811 26.076 52449. -603.409 26.084 52459. -604.007 26.093 52469. -604.605 26.101 52479. -605.202 26.110 52489. -605.800 26.119 52499. -606.397 26.127 52509. -606.995 26.135 52519. -607.592 26.143 52529. -608.189 26.152 52539. -608.786 26.161 52549. -609.383 26.169 52559. -609.980 26.177 52569. -610.576 26.185 52579. -611.173 26.194 52589. -611.769 26.202 52599. -612.365 26.211 52609. -612.961 26.219 52619. -613.557 26.227 52629. -614.153 26.236 52639. -614.748 26.244 52649. -615.344 26.252 52659. -615.939 26.261 52669. -616.535 26.269 52679. -617.130 26.277 52689. -617.725 26.285 52699. -618.321 26.293 52709. -618.916 26.300 52719. -619.511 26.308 52729. -620.1064 26.3161 52739. -620.7016 26.3231 52749. -621.2968 26.3302 52759. -621.8918 26.3373 52769. -622.4868 26.3445 52779. -623.0818 26.3518 52789. -623.6766 26.3592 52799. -624.2713 26.3658 52809. -624.8658 26.3726 52819. -625.4602 26.3796 52829. -626.0544 26.3867 52839. -626.6484 26.3941 52849. -627.2421 26.4017 52859. -627.8357 26.4095 52869. -628.4290 26.4175 52879. -629.0221 26.4257 52889. -629.6151 26.4341 52899. -630.2078 26.4428 52909. -630.8003 26.4515 52919. -631.3927 26.4596 52929. -631.9850 26.4678 52939. -632.5772 26.4761 52949. -633.1693 26.4845 52959. -633.7614 26.4929 52969. -634.3534 26.5013 52979. -634.9455 26.5089 52989. -635.5376 26.5164 52999. -636.1298 26.5238 53009. -636.7221 26.5312 53019. -637.3144 26.5384 53029. -637.9070 26.5455 53039. -638.4996 26.5521 53049. -639.0923 26.5580 53059. -639.6852 26.5639 53069. -640.2782 26.5697 53079. -640.8713 26.5753 53089. -641.4645 26.5809 53099. -642.0578 26.5859 53109. -642.6511 26.5905 53119. -643.2444 26.5951 53129. -643.8378 26.5996 53139. -644.4312 26.6041 53149. -645.0245 26.6087 53159. -645.6179 26.6128 53169. -646.2112 26.6165 53179. -646.8045 26.6202 53189. -647.3977 26.6237 53199. -647.9910 26.6269 53209. -648.5842 26.6302 53219. -649.1774 26.6333 53229. -649.7706 26.6362 53239. -650.3637 26.6391 53249. -650.9568 26.6421 53259. -651.5499 26.6451 53269. -652.1429 26.6482 53279. -652.7359 26.6513 53289. -653.3288 26.6545 53299. -653.9216 26.6578 53309. -654.5143 26.6611 53319. -655.1069 26.6646 53329. -655.6993 26.6682 53339. -656.2917 26.6719 53349. -656.8838 26.6758 53359. -657.4759 26.6799 53369. -658.0677 26.6841 53379. -658.6594 26.6882 53389. -659.2508 26.6925 53399. -659.8421 26.6969 53409. -660.4332 26.7016 53419. -661.0241 26.7064 53429. -661.6148 26.7114 53439. -662.2053 26.7163 53449. -662.7956 26.7214 53459. -663.3857 26.7266 53469. -663.9757 26.7318 53479. -664.5656 26.7370 53489. -665.1552 26.7425 53499. -665.7448 26.7479 53509. -666.3343 26.7534 53519. -666.9236 26.7590 53529. -667.5129 26.7645 53539. -668.1021 26.7701 53549. -668.6912 26.7757 53559. -669.2803 26.7809 53569. -669.8693 26.7861 53579. -670.4583 26.7914 53589. -671.0473 26.7964 53599. -671.6363 26.8015 53609. -672.2253 26.8066 53619. -672.8143 26.8112 53629. -673.4033 26.8158 53639. -673.9923 26.8203 53649. -674.5813 26.8247 53659. -675.1704 26.8291 53669. -675.7594 26.8334 53679. -676.3484 26.8375 53689. -676.9375 26.8414 53699. -677.5265 26.8452 53709. -678.1156 26.8488 53719. -678.7046 26.8521 53729. -679.2936 26.8554 53739. -679.8826 26.8586 53749. -680.4715 26.8615 53759. -681.0604 26.8644 53769. -681.6492 26.8672 53779. -682.2379 26.8698 53789. -682.8266 26.8725 53799. -683.4151 26.8750 53809. -684.0036 26.8774 53819. -684.5919 26.8799 53829. -685.1801 26.8822 53839. -685.7681 26.8844 53849. -686.3560 26.8868 53859. -686.9438 26.8891 53869. -687.5314 26.8912 53879. -688.1189 26.8935 53889. -688.7063 26.8957 53899. -689.2936 26.8980 53909. -689.8807 26.9003 53919. -690.4678 26.9028 53929. -691.0548 26.9053 53939. -691.6417 26.9078 53949. -692.2286 26.9103 53959. -692.8155 26.9127 53969. -693.4024 26.9151 53979. -693.9893 26.9174 53989. -694.5761 26.9198 53999. -695.1631 26.9221 54009. -695.7500 26.9243 54019. -696.3370 26.9263 54029. -696.9240 26.9283 54039. -697.5110 26.9302 54049. -698.0981 26.9322 54059. -698.6852 26.9340 54069. -699.2723 26.9359 54079. -699.8594 26.9374 54089. -700.4465 26.9389 54099. -701.0335 26.9404 54109. -701.6205 26.9415 54119. -702.2074 26.9426 54129. -702.7942 26.9438 54139. -703.3809 26.9448 54149. -703.9675 26.9459 54159. -704.5539 26.9472 54169. -705.1403 26.9485 54179. -705.7264 26.9501 54189. -706.3124 26.9517 54199. -706.8983 26.9536 54209. -707.4840 26.9556 54219. -708.0695 26.9577 54229. -708.6549 26.9600 54239. -709.2402 26.9625 54249. -709.8253 26.9651 54259. -710.4102 26.9675 54269. -710.9951 26.9701 54279. -711.5797 26.9729 54289. -712.1643 26.9755 54299. -712.7487 26.9783 54309. -713.3330 26.9812 54319. -713.9171 26.9840 54329. -714.5011 26.9869 54339. -715.0850 26.9899 54349. -715.6688 26.9928 54359. -716.2525 26.9957 54369. -716.8360 26.9988 54379. -717.4195 27.0018 54389. -718.0029 27.0048 54399. -718.5861 27.0079 54409. -719.1693 27.0110 54419. -719.7524 27.0141 54429. -720.3354 27.0172 54439. -720.9183 27.0202 54449. -721.5011 27.0231 54459. -722.0838 27.0261 54469. -722.6664 27.0291 54479. -723.2489 27.0320 54489. -723.8313 27.0351 54499. -724.4136 27.0381 54509. -724.9957 27.0411 54519. -725.5778 27.0441 54529. -726.1597 27.0472 54539. -726.7415 27.0502 54549. -727.3231 27.0534 54559. -727.9046 27.0566 54569. -728.4860 27.0598 54579. -729.0673 27.0631 54589. -729.6484 27.0664 54599. -730.2295 27.0697 54609. -730.8104 27.0731 54619. -731.3912 27.0764 54629. -731.9719 27.0796 54639. -732.5525 27.0829 54649. -733.1330 27.0861 54659. -733.7134 27.0892 54669. -734.2936 27.0924 54679. -734.8738 27.0955 54689. -735.4539 27.0986 54699. -736.0338 27.1019 54709. -736.6137 27.1052 54719. -737.1934 27.1085 54729. -737.7730 27.1118 54739. -738.3524 27.1154 54749. -738.9317 27.1186 54759. -739.5108 27.1220 54769. -740.0897 27.1256 54779. -740.6685 27.1291 54789. -741.2470 27.1328 54799. -741.8254 27.1367 54809. -742.4035 27.1405 54819. -742.9814 27.1446 54829. -743.5591 27.1489 plplot-5.10.0+dfsg/lib/qsastime/bhunt_search_test.c 644 1750 1750 1036311543675237 212340ustar andrewandrew// // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include #include #include "qsastimeP.h" int gedouble( double *number1, double *number2 ); int count_gedouble; int gedouble( double *number1, double *number2 ) { count_gedouble++; return ( *number1 >= *number2 ); } int main() { int i, j, iswitch, ifrandom, ifhunt, ntable, offset, multiplier, ntest, index; double *table, test; // size of ordered table of data and offset and multiplier to determine // number and value of test values used to search the ordered table. scanf( "%i %i %i", &ntable, &offset, &multiplier ); ntest = abs( multiplier ) * ( ntable - 1 ) + 1; printf( "ntable, offset, multiplier, ntest = %i, %i, %i, %i\n", ntable, offset, multiplier, ntest ); table = (double *) malloc( ntable * sizeof ( double ) ); if ( table == NULL ) { printf( "Could not malloc desired memory\n" ); return 1; } // Generate ordered table to be searched. for ( i = 0; i < ntable; i++ ) { table[i] = (double) i; } for ( iswitch = 0; iswitch < 4; iswitch++ ) { ifrandom = ( iswitch & 0x1 ) == 0x1; ifhunt = ( iswitch & 0x2 ) == 0x2; // Generate series of test values (not necessarily ordered) to be used // as keys for searching the table array). index = -40; count_gedouble = 0; for ( i = 0; i < ntest; i++ ) { if ( ifrandom ) { j = (int) ( (double) ntest * (double) rand() / ( ( (double) RAND_MAX ) + 1. ) ); } else { j = i; } test = offset + (double) j / (double) multiplier; if ( !ifhunt ) index = -40; bhunt_search( &test, table, ntable, sizeof ( double ), &index, ( int ( * )( const void *, const void * ) )gedouble ); if ( index < -1 || index > ntable - 1 ) { printf( "ERROR: test = %20.16f lead to an invalid index of %i\n", test, index ); return 1; } if ( !( ( index == -1 && test < table[index + 1] ) || ( index > -1 && index < ntable - 1 && table[index] <= test && test < table[index + 1] ) || ( index == ntable - 1 && table[index] <= test ) ) ) { if ( index == -1 ) { printf( "ERROR for index == -1, test = %20.16f, table[index+1] = %20.16f\n", test, table[index + 1] ); return 1; } else if ( index > -1 && index < ntable - 1 ) { printf( "ERROR for index > -1 && index < ntable-1, table[index] = %20.16f, test = %20.16f, table[index+1] = %20.16f\n", table[index], test, table[index + 1] ); return 1; } else if ( index == ntable - 1 ) { printf( "ERROR for index == ntable - 1, table[index] = %20.16f, test = %20.16f\n", table[index], test ); return 1; } else { printf( "Internal logic ERROR\n" ); return 1; } } } printf( "Average number of gedouble calls per bhunt_search call = %f for ifhunt, ifrandom = %i,%i\n", (double) count_gedouble / (double) ntest, ifhunt, ifrandom ); } printf( "Successful completion of bhunt_search test\n" ); free( (void *) table ); return 0; } plplot-5.10.0+dfsg/lib/qsastime/deltaT_test.c 644 1750 1750 115411646000332 177400ustar andrewandrew#include "deltaT.h" #include "qsastime.h" #include "dsplint.h" #include int main() { int iyear; // double year, delta, ddelta, d2delta; double year, delta; for ( iyear = -1000; iyear <= 2000; ++iyear ) { year = (double) iyear; // dsplint(xspline, yspline, y2spline, number_of_entries_in_spline_tables, year, &delta, &ddelta, &d2delta); dsplint( xspline, yspline, y2spline, number_of_entries_in_spline_tables, year, &delta ); // printf("%9.0f.%9.0f.%15.6E%15.6E\n", year, delta, ddelta, d2delta); printf( "%9.0f.%9.0f.\n", year, delta ); } return 0; } plplot-5.10.0+dfsg/lib/qsastime/qsastime_testlib.c 644 1750 1750 5232711543675237 211120ustar andrewandrew// // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "qsastime.h" #include "qsastimeP.h" #include #include #include #include #include #define TEST01 0x1 #define TEST02 0x2 #define TEST03 0x4 #define TEST04 0x8 #define TEST05 0x10 #define TEST06 0x20 #define TEST07 0x40 #define TEST08 0x80 #define TEST09 0x100 #define TEST10 0x200 #define TEST11 0x400 #define TEST12 0x800 #define TEST13 0x1000 #define TEST14 0x2000 #define TEST15 0x4000 #define TEST16 0x8000 // MJD for Jan 01, 1970 00:00:00 Gregorian, the Unix epoch. #define MJD_1970 40587 // Recommended (by Linux timegm man page) POSIX equivalent of Linux timegm C library function time_t my_timegm( struct tm *tm ) { time_t ret; char *tz; tz = getenv( "TZ" ); setenv( "TZ", "", 1 ); tzset(); ret = mktime( tm ); if ( tz ) setenv( "TZ", tz, 1 ); else unsetenv( "TZ" ); tzset(); return ret; } int testlib_broken_down_time( int year, int month, int day, int hour, int min, double sec, int forceJulian, int inner_test_choice, int verbose ) { char buf[360]; int year1, month1, day1, hour1, min1; double sec1; struct tm tm; struct tm *ptm = &tm; struct tm tm1; struct tm *ptm1 = &tm1; time_t secs_past_epoch, secs_past_epoch1, delta_secs; MJDtime MJD1, *pMJD1 = &MJD1; double jd; int ifleapyear, ifleapday, iffeb29, ifsamedate, ifsametime; ptm->tm_year = year - 1900; ptm->tm_mon = month; ptm->tm_mday = day; ptm->tm_hour = hour; ptm->tm_min = min; ptm->tm_sec = (int) sec; if ( verbose ) { if ( forceJulian ) { printf( "Start of Julian proleptic inner test\n" ); printf( "input and output (strfMJD) date/time\n" ); } else { printf( "Start of Gregorian proleptic inner test\n" ); printf( "input and output (strftime), and output (strfMJD) date/time\n" ); } printf( "%.4d-%02d-%02dT%02d:%02d:%018.15fZ\n", year, month + 1, day, hour, min, sec ); } setFromUT( year, month, day, hour, min, sec, pMJD1, forceJulian ); // Inner TEST01: compare setFromUT with my_timegm. if ( !forceJulian && ( inner_test_choice & TEST01 ) ) { secs_past_epoch1 = (time_t) ( 86400. * ( (double) pMJD1->base_day - (double) MJD_1970 ) + (int) pMJD1->time_sec ); secs_past_epoch = my_timegm( ptm ); delta_secs = abs( secs_past_epoch1 - secs_past_epoch ); if ( delta_secs != 0 ) { printf( "setFromUT secs_past_epoch = %lld seconds\n", (long long) secs_past_epoch1 ); printf( "my_timegm secs_past_epoch = %lld seconds\n", (long long) secs_past_epoch ); printf( "delta secs_past_epoch = %lld seconds\n", (long long) ( secs_past_epoch1 - secs_past_epoch ) ); printf( "test failed with inconsistency between setFromUT and my_timegm\n" ); return 1; } } // Inner TEST02: check minimal fields of strfMJD (Julian) or // strftime and strfMJD (Gregorian) if ( inner_test_choice & TEST02 ) { if ( !forceJulian ) { strftime( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%SZ\n", ptm ); if ( verbose ) printf( "%s", buf ); } strfMJD( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%S%.Z\n", pMJD1, forceJulian, 0 ); if ( verbose ) printf( "%s", buf ); } if ( verbose ) { jd = 2400000.5 + pMJD1->base_day + pMJD1->time_sec / 86400.; printf( "setFromUT JD = %25.16f days\n", jd ); } if ( forceJulian ) ifleapyear = ( year % 4 == 0 ); else ifleapyear = ( ( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ); iffeb29 = month == 1 && day == 29; ifleapday = ( ifleapyear && iffeb29 ); // Inner TEST03: compare setFromUT with its inverse, breakDownMJD if ( inner_test_choice & TEST03 ) { breakDownMJD( &year1, &month1, &day1, &hour1, &min1, &sec1, pMJD1, forceJulian ); ifsamedate = ( year1 - year == 0 && ( ( ( !iffeb29 || ifleapday ) && ( month1 - month == 0 && day1 - day == 0 ) ) || ( ( iffeb29 && !ifleapday ) && ( month1 == 2 && day1 == 1 ) ) ) ); ifsametime = ( hour1 - hour == 0 && min1 - min == 0 && fabs( sec1 - sec ) < 1.e-10 ); if ( !( ifsamedate && ifsametime ) ) { printf( "output date calculated with breakDownMJD = %d-%02d-%02dT%02d:%02d:%018.15fZ\n", year1, month1 + 1, day1, hour1, min1, sec1 ); printf( "test failed with inconsistency between setFromUT and breakDownMJD\n" ); return 1; } } // Inner TEST04: compare setFromUT with its inverse, the C library gmtime. if ( !forceJulian && ( inner_test_choice & TEST04 ) ) { ptm1 = gmtime( &secs_past_epoch ); ifsamedate = ( ptm1->tm_year == ptm->tm_year && ( ( ( !iffeb29 || ifleapday ) && ( ptm1->tm_mon == ptm->tm_mon && ptm1->tm_mday == ptm->tm_mday ) ) || ( ( iffeb29 && !ifleapday ) && ( ptm1->tm_mon == 2 && ptm1->tm_mday == 1 ) ) ) ); ifsametime = ( ptm1->tm_hour == ptm->tm_hour && ptm1->tm_min == ptm->tm_min && ptm1->tm_sec == ptm->tm_sec ); if ( !( ifsamedate && ifsametime ) ) { printf( "test failed with inconsistency between my_timegm and its C library inverse gmtime" ); return 1; } } return 0; } int testlib_MJD( const MJDtime *MJD, int forceJulian, int inner_test_choice, int verbose ) { int year, month, day, hour, min; double sec; char buf[360]; int year1, month1, day1, hour1, min1; double sec1; struct tm tm; struct tm *ptm = &tm; struct tm tm1; struct tm *ptm1 = &tm1; time_t secs_past_epoch, secs_past_epoch1; MJDtime MJD1_value, *MJD1 = &MJD1_value; MJDtime MJD2_value, *MJD2 = &MJD2_value; double jd; int ifleapyear, ifleapday, iffeb29, ifsamedate, ifsametime; *MJD1 = *MJD; normalize_MJD( MJD1 ); secs_past_epoch = (time_t) ( 86400. * ( (double) MJD1->base_day - (double) MJD_1970 ) + MJD1->time_sec ); breakDownMJD( &year, &month, &day, &hour, &min, &sec, MJD1, forceJulian ); ptm->tm_year = year - 1900; ptm->tm_mon = month; ptm->tm_mday = day; ptm->tm_hour = hour; ptm->tm_min = min; ptm->tm_sec = (int) sec; if ( verbose ) { if ( forceJulian ) { printf( "Start of Julian proleptic inner test\n" ); printf( "input and output (strfMJD) date/time\n" ); } else { printf( "Start of Gregorian proleptic inner test\n" ); printf( "input and output (strftime), and output (strfMJD) date/time\n" ); } printf( "%.4d-%02d-%02dT%02d:%02d:%018.15fZ\n", year, month + 1, day, hour, min, sec ); } // Inner TEST01: compare breakDownMJD with gmtime. if ( !forceJulian && ( inner_test_choice & TEST01 ) ) { ptm1 = gmtime( &secs_past_epoch ); if ( !( ( ptm1->tm_year + 1900 ) == year && ptm1->tm_mon == month && ptm1->tm_mday == day && ptm1->tm_hour == hour && ptm1->tm_min == min && ptm1->tm_sec == (int) sec ) ) { printf( "date calculated with breakDownMJD = %d-%02d-%02dT%02d:%02d:%018.15fZ\n", year, month + 1, day, hour, min, sec ); printf( "date calculated with gmtime = %d-%02d-%02dT%02d:%02d:%02dZ\n", ptm1->tm_year + 1900, ptm1->tm_mon + 1, ptm1->tm_mday, ptm1->tm_hour, ptm1->tm_min, ptm1->tm_sec ); printf( "test failed with inconsistency between breakDownMJD and gmtime\n" ); return 1; } } // Inner TEST02: check minimal fields of strfMJD (Julian) or // strftime and strfMJD (Gregorian) if ( inner_test_choice & TEST02 ) { if ( !forceJulian ) { strftime( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%SZ\n", ptm ); if ( verbose ) printf( "%s", buf ); } strfMJD( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%S%.Z\n", MJD1, forceJulian, 0 ); if ( verbose ) printf( "%s", buf ); } if ( verbose ) { jd = 2400000.5 + MJD1->base_day + MJD1->time_sec / 86400.; printf( "JD = %25.16f days\n", jd ); } if ( forceJulian ) ifleapyear = ( year % 4 == 0 ); else ifleapyear = ( ( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ); iffeb29 = month == 1 && day == 29; ifleapday = ( ifleapyear && iffeb29 ); // Inner TEST03: compare breakDownMJD with its inverse, setFromUT if ( inner_test_choice & TEST03 ) { setFromUT( year, month, day, hour, min, sec, MJD2, forceJulian ); if ( !( MJD2->time_sec == MJD1->time_sec && MJD2->base_day == MJD1->base_day ) ) { printf( "(normalized) input MJD components are = %d, %f\n", MJD1->base_day, MJD1->time_sec ); printf( "(output MJD2 components generated by setFromUT are = %d, %f\n", MJD2->base_day, MJD2->time_sec ); printf( "test failed with inconsistency between breakDownMJD and setFromUT\n" ); return 1; } } // Inner TEST04: compare breakDownMJD with its inverse, my_timegm if ( !forceJulian && ( inner_test_choice & TEST04 ) ) { secs_past_epoch1 = my_timegm( ptm ); if ( !( secs_past_epoch == secs_past_epoch1 ) ) { printf( "secs_past_epoch calculated from input = %lld\n", (long long) secs_past_epoch ); printf( "secs_past_epoch calculated from my_timegm = %lld\n", (long long) secs_past_epoch1 ); printf( "delta secs_past_epoch = %lld seconds\n", (long long) ( secs_past_epoch1 - secs_past_epoch ) ); printf( "test failed with inconsistency between breakDownMJD and its C library based inverse, my_timegm\n" ); return 1; } } return 0; } // Test program to do extensive comparisons between setFromUT, breakDownMJD, // and strfMJD and the closest corresponding _Linux_ C library routines, // timegm, gmtime, and strftime. int main() { char buf[360]; char buf1[360]; int year, month, day, hour, min; double sec; int year1, month1, day1, hour1, min1; double sec1; struct tm tm; struct tm *ptm = &tm; struct tm tm1; struct tm *ptm1 = &tm1; int seconds; MJDtime MJD1_value, *MJD1 = &MJD1_value; double jd; int test_choice, date_choice, ret; // choose test(s) to be run using bit-pattern in test_choice that is // input from stdin. scanf( "%i", &test_choice ); printf( "sizeof(time_t) = %d\n", (int) sizeof ( time_t ) ); if ( sizeof ( time_t ) < 8 ) { printf( "tests abandoned because time_t is too small on this platform to represent the extremely large date range used for many of these tests. Note, the limitation is in the C library routines (gmtime and mktime) used for these test comparisons and not libqsastime itself.\n" ); return 1; } printf( "sizeof(int) = %d\n", (int) sizeof ( int ) ); if ( sizeof ( int ) != 4 ) { printf( "tests abandoned because int must be 32-bits to test this library properly for how well it will potentially perform on 32-bit platforms\n" ); return 2; } // strftime affected by locale so force 0 timezone for this complete test. setenv( "TZ", "", 1 ); tzset(); if ( test_choice & TEST01 ) { printf( "Test 01 of calendar dates in the vicinity of the JD epoch \n" ); for ( date_choice = 0; date_choice < 5; date_choice++ ) { if ( date_choice == 0 ) { month = 0; day = 1; } else if ( date_choice == 1 ) { month = 1; day = 28; } else if ( date_choice == 2 ) { month = 1; day = 29; } else if ( date_choice == 3 ) { month = 2; day = 1; } else if ( date_choice == 4 ) { month = 11; day = 31; } hour = 12; min = 0; sec = 0.; for ( year = -4717; year <= -4707; year++ ) { printf( "\n" ); ret = testlib_broken_down_time( year, month, day, hour, min, sec, 1, 0xffff, 1 ); if ( ret ) return ret; ret = testlib_broken_down_time( year, month, day, hour, min, sec, 0, 0xffff, 1 ); if ( ret ) return ret; } } } if ( test_choice & TEST02 ) { printf( "Test 02 of calendar dates in the vicinity of the year epoch. \n" ); for ( date_choice = 0; date_choice < 5; date_choice++ ) { if ( date_choice == 0 ) { month = 0; day = 1; } else if ( date_choice == 1 ) { month = 1; day = 28; } else if ( date_choice == 2 ) { month = 1; day = 29; } else if ( date_choice == 3 ) { month = 2; day = 1; } else if ( date_choice == 4 ) { month = 11; day = 31; } hour = 0; min = 0; sec = 0.; for ( year = -5; year <= 5; year++ ) { printf( "\n" ); ret = testlib_broken_down_time( year, month, day, hour, min, sec, 1, 0xffff, 1 ); if ( ret ) return ret; ret = testlib_broken_down_time( year, month, day, hour, min, sec, 0, 0xffff, 1 ); if ( ret ) return ret; } } } if ( test_choice & TEST03 ) { printf( "Test 03 of calendar dates in the vicinity of the MJD epoch. \n" ); for ( date_choice = 0; date_choice < 6; date_choice++ ) { if ( date_choice == 0 ) { month = 0; day = 1; } else if ( date_choice == 1 ) { month = 1; day = 28; } else if ( date_choice == 2 ) { month = 1; day = 29; } else if ( date_choice == 3 ) { month = 2; day = 1; } else if ( date_choice == 4 ) { month = 10; day = 17; } else if ( date_choice == 5 ) { month = 11; day = 31; } hour = 0; min = 0; sec = 0.; for ( year = 1853; year <= 1863; year++ ) { printf( "\n" ); ret = testlib_broken_down_time( year, month, day, hour, min, sec, 1, 0xffff, 1 ); if ( ret ) return ret; ret = testlib_broken_down_time( year, month, day, hour, min, sec, 0, 0xffff, 1 ); if ( ret ) return ret; } } } if ( test_choice & TEST04 ) { printf( "Test 04 of small second range near Year 0 (Julian)\n" ); ret = setFromUT( 0, 0, 1, 0, 0, 0., MJD1, 1 ); if ( ret ) { printf( "Test 04 cannot even start for Year 0 (Julian)" ); return ret; } for ( seconds = -5; seconds < 5; seconds++ ) { printf( "\n" ); ret = testlib_MJD( MJD1, 1, 0xffff, 1 ); if ( ret ) return ret; MJD1->time_sec++; } printf( "Test 04 of small second range near Year 0 (Gregorian)\n" ); ret = setFromUT( 0, 0, 1, 0, 0, 0., MJD1, 0 ); if ( ret ) { printf( "Test 04 cannot even start for Year 0 (Gregorian)" ); return ret; } for ( seconds = -5; seconds < 5; seconds++ ) { printf( "\n" ); ret = testlib_MJD( MJD1, 0, 0xffff, 1 ); if ( ret ) return ret; MJD1->time_sec++; } printf( "Test 04 of small second range near 2009-01-01 (Gregorian) when a leap second was inserted\n" ); ret = setFromUT( 2009, 0, 1, 0, 0, 0.1234567890123456 - 5., MJD1, 0 ); if ( ret ) { printf( "Test 04 cannot even start for Year 0 (Gregorian)" ); return ret; } for ( seconds = -5; seconds < 5; seconds++ ) { printf( "\n" ); ret = testlib_MJD( MJD1, 0, 0xffff, 1 ); if ( ret ) return ret; MJD1->time_sec++; } } if ( test_choice & TEST05 ) { printf( "Test 05 of normalization of breakDownMJD result and strfMJD results near the hour.\n" ); MJD1->base_day = 51910; MJD1->time_sec = 3600.; int iepsilon; for ( iepsilon = -1; iepsilon < 2; iepsilon++ ) { MJD1->time_sec = 3600. + 1.e-8 * (double) iepsilon; breakDownMJD( &year, &month, &day, &hour, &min, &sec, MJD1, 0 ); printf( "MJD = {%d,%20.15f}\n", MJD1->base_day, MJD1->time_sec ); printf( "breakDownMJD result is year, month, day, hour, min, sec = %d, %d, %d, %d, %d, %20.15f\n", year, month, day, hour, min, sec ); strfMJD( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%S%9Z\n", MJD1, 0, 0 ); printf( "strfMJD %%S%%9 result is %s", buf ); strfMJD( &( buf[0] ), 360, "%Y-%m-%dT%H:%M:%S%.Z\n", MJD1, 0, 0 ); printf( "strfMJD %%S%%. result is %s", buf ); strfMJD( &( buf[0] ), 360, "%H:%M:%S, %H:%M:%S%0, %H:%M:%S%1, %H:%M:%S%2, %H:%M:%S%3, %H:%M:%S%4\n %H:%M:%S %0,%H:%M:%S %1,%H:%M:%S %2,%H:%M:%S %3,%H:%M:%S %4\n", MJD1, 0, 0 ); printf( "strfMJD more heavily rounded results (the latter ones with a blank before the\ndecimal point to prove separated formatting works) for H:M:S are the following:\n%s", buf ); } } if ( test_choice & TEST06 ) { printf( "Test 06 (non-verbose) of calendar dates for every year from -5000000 to 5000000\n" ); for ( date_choice = 0; date_choice < 5; date_choice++ ) { if ( date_choice == 0 ) { month = 0; day = 1; } else if ( date_choice == 1 ) { month = 1; day = 28; } else if ( date_choice == 2 ) { month = 1; day = 29; } else if ( date_choice == 3 ) { month = 2; day = 1; } else if ( date_choice == 4 ) { month = 11; day = 31; } hour = 0; min = 0; sec = 0.123456; // test reduced range of years that just barely misses overflowing // the MJD integer. e.g., 6000000 overflows it. for ( year = -5000000; year <= 5000000; year += 1 ) { ret = testlib_broken_down_time( year, month, day, hour, min, sec, 1, 0xffff, 0 ); if ( ret ) return ret; ret = testlib_broken_down_time( year, month, day, hour, min, sec, 0, 0xffff, 0 ); if ( ret ) return ret; } } } if ( test_choice & TEST07 ) { printf( "Test 07 (non-verbose) of all seconds from late 2007 to early 2009\n" ); ret = setFromUT( 2007, 11, 30, 0, 0, 0., MJD1, 0 ); if ( ret ) { printf( "Test 06 cannot even start" ); return ret; } // 430 days or ~ 37 million seconds should cover the complete next year for both Julian and Gregorian . for ( seconds = 0; seconds < 430 * 86400; seconds++ ) { MJD1->time_sec = (double) seconds; ret = testlib_MJD( MJD1, 1, 0xffff, 0 ); if ( ret ) return ret; ret = testlib_MJD( MJD1, 0, 0xffff, 0 ); if ( ret ) return ret; } } return 0; } plplot-5.10.0+dfsg/lib/qsastime/deltaT.out_standard 644 1750 1750 17305511212524224 212200ustar andrewandrew -1000. 25400. -999. 25384. -998. 25367. -997. 25351. -996. 25334. -995. 25318. -994. 25301. -993. 25285. -992. 25268. -991. 25252. -990. 25235. -989. 25219. -988. 25202. -987. 25186. -986. 25169. -985. 25153. -984. 25137. -983. 25120. -982. 25104. -981. 25087. -980. 25071. -979. 25054. -978. 25038. -977. 25021. -976. 25005. -975. 24988. -974. 24972. -973. 24955. -972. 24939. -971. 24922. -970. 24906. -969. 24889. -968. 24873. -967. 24856. -966. 24840. -965. 24823. -964. 24807. -963. 24790. -962. 24773. -961. 24757. -960. 24740. -959. 24723. -958. 24707. -957. 24690. -956. 24673. -955. 24657. -954. 24640. -953. 24623. -952. 24607. -951. 24590. -950. 24573. -949. 24556. -948. 24539. -947. 24523. -946. 24506. -945. 24489. -944. 24472. -943. 24455. -942. 24438. -941. 24421. -940. 24404. -939. 24387. -938. 24370. -937. 24353. -936. 24336. -935. 24319. -934. 24302. -933. 24284. -932. 24267. -931. 24250. -930. 24233. -929. 24216. -928. 24198. -927. 24181. -926. 24164. -925. 24146. -924. 24129. -923. 24111. -922. 24094. -921. 24076. -920. 24059. -919. 24041. -918. 24023. -917. 24006. -916. 23988. -915. 23970. -914. 23953. -913. 23935. -912. 23917. -911. 23899. -910. 23881. -909. 23863. -908. 23845. -907. 23827. -906. 23809. -905. 23791. -904. 23773. -903. 23755. -902. 23737. -901. 23718. -900. 23700. -899. 23682. -898. 23663. -897. 23645. -896. 23626. -895. 23608. -894. 23589. -893. 23571. -892. 23552. -891. 23534. -890. 23515. -889. 23496. -888. 23478. -887. 23459. -886. 23440. -885. 23421. -884. 23403. -883. 23384. -882. 23365. -881. 23346. -880. 23328. -879. 23309. -878. 23290. -877. 23271. -876. 23252. -875. 23234. -874. 23215. -873. 23196. -872. 23177. -871. 23159. -870. 23140. -869. 23121. -868. 23103. -867. 23084. -866. 23065. -865. 23047. -864. 23028. -863. 23010. -862. 22991. -861. 22973. -860. 22955. -859. 22936. -858. 22918. -857. 22900. -856. 22881. -855. 22863. -854. 22845. -853. 22827. -852. 22809. -851. 22791. -850. 22773. -849. 22755. -848. 22737. -847. 22720. -846. 22702. -845. 22685. -844. 22667. -843. 22650. -842. 22632. -841. 22615. -840. 22598. -839. 22581. -838. 22564. -837. 22547. -836. 22530. -835. 22513. -834. 22496. -833. 22480. -832. 22463. -831. 22447. -830. 22431. -829. 22415. -828. 22398. -827. 22383. -826. 22367. -825. 22351. -824. 22335. -823. 22320. -822. 22304. -821. 22289. -820. 22274. -819. 22259. -818. 22244. -817. 22229. -816. 22215. -815. 22200. -814. 22186. -813. 22172. -812. 22157. -811. 22144. -810. 22130. -809. 22116. -808. 22103. -807. 22089. -806. 22076. -805. 22063. -804. 22050. -803. 22037. -802. 22025. -801. 22012. -800. 22000. -799. 21988. -798. 21976. -797. 21964. -796. 21953. -795. 21941. -794. 21930. -793. 21919. -792. 21908. -791. 21897. -790. 21886. -789. 21875. -788. 21865. -787. 21854. -786. 21844. -785. 21834. -784. 21824. -783. 21814. -782. 21804. -781. 21794. -780. 21785. -779. 21775. -778. 21766. -777. 21756. -776. 21747. -775. 21738. -774. 21729. -773. 21720. -772. 21711. -771. 21702. -770. 21693. -769. 21684. -768. 21675. -767. 21667. -766. 21658. -765. 21649. -764. 21641. -763. 21632. -762. 21624. -761. 21615. -760. 21607. -759. 21598. -758. 21590. -757. 21581. -756. 21573. -755. 21564. -754. 21556. -753. 21548. -752. 21539. -751. 21531. -750. 21522. -749. 21514. -748. 21505. -747. 21497. -746. 21488. -745. 21480. -744. 21471. -743. 21462. -742. 21454. -741. 21445. -740. 21436. -739. 21427. -738. 21418. -737. 21409. -736. 21400. -735. 21391. -734. 21382. -733. 21373. -732. 21363. -731. 21354. -730. 21345. -729. 21335. -728. 21325. -727. 21315. -726. 21306. -725. 21296. -724. 21285. -723. 21275. -722. 21265. -721. 21254. -720. 21244. -719. 21233. -718. 21222. -717. 21211. -716. 21200. -715. 21189. -714. 21177. -713. 21166. -712. 21154. -711. 21142. -710. 21130. -709. 21118. -708. 21106. -707. 21093. -706. 21080. -705. 21067. -704. 21054. -703. 21041. -702. 21028. -701. 21014. -700. 21000. -699. 20986. -698. 20972. -697. 20957. -696. 20943. -695. 20928. -694. 20913. -693. 20897. -692. 20882. -691. 20866. -690. 20851. -689. 20835. -688. 20819. -687. 20802. -686. 20786. -685. 20769. -684. 20753. -683. 20736. -682. 20719. -681. 20701. -680. 20684. -679. 20666. -678. 20649. -677. 20631. -676. 20613. -675. 20595. -674. 20577. -673. 20558. -672. 20540. -671. 20521. -670. 20502. -669. 20483. -668. 20464. -667. 20445. -666. 20426. -665. 20407. -664. 20387. -663. 20368. -662. 20348. -661. 20328. -660. 20309. -659. 20289. -658. 20269. -657. 20248. -656. 20228. -655. 20208. -654. 20187. -653. 20167. -652. 20146. -651. 20126. -650. 20105. -649. 20084. -648. 20064. -647. 20043. -646. 20022. -645. 20001. -644. 19980. -643. 19959. -642. 19938. -641. 19916. -640. 19895. -639. 19874. -638. 19852. -637. 19831. -636. 19810. -635. 19788. -634. 19767. -633. 19745. -632. 19724. -631. 19702. -630. 19681. -629. 19659. -628. 19638. -627. 19616. -626. 19595. -625. 19573. -624. 19551. -623. 19530. -622. 19508. -621. 19487. -620. 19465. -619. 19444. -618. 19422. -617. 19401. -616. 19379. -615. 19358. -614. 19336. -613. 19315. -612. 19293. -611. 19272. -610. 19251. -609. 19229. -608. 19208. -607. 19187. -606. 19166. -605. 19145. -604. 19124. -603. 19103. -602. 19082. -601. 19061. -600. 19040. -599. 19019. -598. 18999. -597. 18978. -596. 18957. -595. 18937. -594. 18916. -593. 18896. -592. 18876. -591. 18856. -590. 18835. -589. 18815. -588. 18795. -587. 18775. -586. 18755. -585. 18735. -584. 18716. -583. 18696. -582. 18676. -581. 18656. -580. 18637. -579. 18617. -578. 18598. -577. 18578. -576. 18559. -575. 18539. -574. 18520. -573. 18501. -572. 18482. -571. 18463. -570. 18443. -569. 18424. -568. 18405. -567. 18386. -566. 18368. -565. 18349. -564. 18330. -563. 18311. -562. 18292. -561. 18274. -560. 18255. -559. 18236. -558. 18218. -557. 18199. -556. 18181. -555. 18162. -554. 18144. -553. 18126. -552. 18107. -551. 18089. -550. 18071. -549. 18052. -548. 18034. -547. 18016. -546. 17998. -545. 17980. -544. 17962. -543. 17944. -542. 17926. -541. 17908. -540. 17890. -539. 17872. -538. 17854. -537. 17836. -536. 17818. -535. 17801. -534. 17783. -533. 17765. -532. 17747. -531. 17730. -530. 17712. -529. 17694. -528. 17677. -527. 17659. -526. 17641. -525. 17624. -524. 17606. -523. 17589. -522. 17571. -521. 17554. -520. 17536. -519. 17519. -518. 17502. -517. 17484. -516. 17467. -515. 17449. -514. 17432. -513. 17415. -512. 17397. -511. 17380. -510. 17363. -509. 17345. -508. 17328. -507. 17311. -506. 17293. -505. 17276. -504. 17259. -503. 17242. -502. 17224. -501. 17207. -500. 17190. -499. 17173. -498. 17156. -497. 17138. -496. 17121. -495. 17104. -494. 17087. -493. 17070. -492. 17052. -491. 17035. -490. 17018. -489. 17001. -488. 16984. -487. 16967. -486. 16949. -485. 16932. -484. 16915. -483. 16898. -482. 16881. -481. 16864. -480. 16847. -479. 16830. -478. 16813. -477. 16796. -476. 16779. -475. 16762. -474. 16745. -473. 16728. -472. 16711. -471. 16694. -470. 16677. -469. 16660. -468. 16643. -467. 16626. -466. 16609. -465. 16592. -464. 16575. -463. 16558. -462. 16541. -461. 16524. -460. 16508. -459. 16491. -458. 16474. -457. 16457. -456. 16440. -455. 16424. -454. 16407. -453. 16390. -452. 16373. -451. 16357. -450. 16340. -449. 16323. -448. 16307. -447. 16290. -446. 16273. -445. 16257. -444. 16240. -443. 16223. -442. 16207. -441. 16190. -440. 16174. -439. 16157. -438. 16141. -437. 16124. -436. 16108. -435. 16091. -434. 16075. -433. 16059. -432. 16042. -431. 16026. -430. 16010. -429. 15993. -428. 15977. -427. 15961. -426. 15944. -425. 15928. -424. 15912. -423. 15896. -422. 15880. -421. 15864. -420. 15847. -419. 15831. -418. 15815. -417. 15799. -416. 15783. -415. 15767. -414. 15751. -413. 15735. -412. 15719. -411. 15703. -410. 15687. -409. 15672. -408. 15656. -407. 15640. -406. 15624. -405. 15608. -404. 15593. -403. 15577. -402. 15561. -401. 15546. -400. 15530. -399. 15514. -398. 15499. -397. 15483. -396. 15468. -395. 15452. -394. 15437. -393. 15421. -392. 15406. -391. 15391. -390. 15375. -389. 15360. -388. 15344. -387. 15329. -386. 15314. -385. 15299. -384. 15283. -383. 15268. -382. 15253. -381. 15238. -380. 15223. -379. 15208. -378. 15193. -377. 15178. -376. 15163. -375. 15148. -374. 15133. -373. 15118. -372. 15103. -371. 15088. -370. 15073. -369. 15058. -368. 15043. -367. 15028. -366. 15014. -365. 14999. -364. 14984. -363. 14969. -362. 14955. -361. 14940. -360. 14925. -359. 14911. -358. 14896. -357. 14882. -356. 14867. -355. 14852. -354. 14838. -353. 14823. -352. 14809. -351. 14794. -350. 14780. -349. 14765. -348. 14751. -347. 14737. -346. 14722. -345. 14708. -344. 14694. -343. 14679. -342. 14665. -341. 14651. -340. 14636. -339. 14622. -338. 14608. -337. 14594. -336. 14580. -335. 14565. -334. 14551. -333. 14537. -332. 14523. -331. 14509. -330. 14495. -329. 14481. -328. 14467. -327. 14453. -326. 14439. -325. 14425. -324. 14411. -323. 14397. -322. 14383. -321. 14369. -320. 14355. -319. 14341. -318. 14327. -317. 14313. -316. 14300. -315. 14286. -314. 14272. -313. 14258. -312. 14244. -311. 14231. -310. 14217. -309. 14203. -308. 14189. -307. 14176. -306. 14162. -305. 14148. -304. 14135. -303. 14121. -302. 14107. -301. 14094. -300. 14080. -299. 14066. -298. 14053. -297. 14039. -296. 14026. -295. 14012. -294. 13999. -293. 13985. -292. 13972. -291. 13958. -290. 13945. -289. 13931. -288. 13918. -287. 13904. -286. 13891. -285. 13877. -284. 13864. -283. 13851. -282. 13837. -281. 13824. -280. 13811. -279. 13797. -278. 13784. -277. 13771. -276. 13757. -275. 13744. -274. 13731. -273. 13717. -272. 13704. -271. 13691. -270. 13678. -269. 13665. -268. 13651. -267. 13638. -266. 13625. -265. 13612. -264. 13599. -263. 13586. -262. 13573. -261. 13560. -260. 13547. -259. 13534. -258. 13520. -257. 13507. -256. 13494. -255. 13481. -254. 13468. -253. 13456. -252. 13443. -251. 13430. -250. 13417. -249. 13404. -248. 13391. -247. 13378. -246. 13365. -245. 13352. -244. 13340. -243. 13327. -242. 13314. -241. 13301. -240. 13288. -239. 13276. -238. 13263. -237. 13250. -236. 13237. -235. 13225. -234. 13212. -233. 13199. -232. 13187. -231. 13174. -230. 13161. -229. 13149. -228. 13136. -227. 13124. -226. 13111. -225. 13099. -224. 13086. -223. 13074. -222. 13061. -221. 13049. -220. 13036. -219. 13024. -218. 13011. -217. 12999. -216. 12986. -215. 12974. -214. 12962. -213. 12949. -212. 12937. -211. 12925. -210. 12912. -209. 12900. -208. 12888. -207. 12875. -206. 12863. -205. 12851. -204. 12839. -203. 12827. -202. 12814. -201. 12802. -200. 12790. -199. 12778. -198. 12766. -197. 12754. -196. 12742. -195. 12729. -194. 12717. -193. 12705. -192. 12693. -191. 12681. -190. 12669. -189. 12657. -188. 12645. -187. 12633. -186. 12621. -185. 12610. -184. 12598. -183. 12586. -182. 12574. -181. 12562. -180. 12550. -179. 12538. -178. 12526. -177. 12515. -176. 12503. -175. 12491. -174. 12479. -173. 12468. -172. 12456. -171. 12444. -170. 12432. -169. 12421. -168. 12409. -167. 12397. -166. 12386. -165. 12374. -164. 12362. -163. 12351. -162. 12339. -161. 12327. -160. 12316. -159. 12304. -158. 12293. -157. 12281. -156. 12270. -155. 12258. -154. 12247. -153. 12235. -152. 12224. -151. 12212. -150. 12201. -149. 12189. -148. 12178. -147. 12166. -146. 12155. -145. 12144. -144. 12132. -143. 12121. -142. 12109. -141. 12098. -140. 12087. -139. 12075. -138. 12064. -137. 12053. -136. 12041. -135. 12030. -134. 12019. -133. 12007. -132. 11996. -131. 11985. -130. 11974. -129. 11962. -128. 11951. -127. 11940. -126. 11929. -125. 11917. -124. 11906. -123. 11895. -122. 11884. -121. 11873. -120. 11862. -119. 11850. -118. 11839. -117. 11828. -116. 11817. -115. 11806. -114. 11795. -113. 11784. -112. 11773. -111. 11761. -110. 11750. -109. 11739. -108. 11728. -107. 11717. -106. 11706. -105. 11695. -104. 11684. -103. 11673. -102. 11662. -101. 11651. -100. 11640. -99. 11629. -98. 11618. -97. 11607. -96. 11596. -95. 11585. -94. 11574. -93. 11563. -92. 11552. -91. 11541. -90. 11530. -89. 11519. -88. 11508. -87. 11498. -86. 11487. -85. 11476. -84. 11465. -83. 11454. -82. 11443. -81. 11432. -80. 11421. -79. 11411. -78. 11400. -77. 11389. -76. 11378. -75. 11367. -74. 11356. -73. 11346. -72. 11335. -71. 11324. -70. 11313. -69. 11302. -68. 11292. -67. 11281. -66. 11270. -65. 11259. -64. 11249. -63. 11238. -62. 11227. -61. 11217. -60. 11206. -59. 11195. -58. 11184. -57. 11174. -56. 11163. -55. 11152. -54. 11142. -53. 11131. -52. 11121. -51. 11110. -50. 11099. -49. 11089. -48. 11078. -47. 11067. -46. 11057. -45. 11046. -44. 11036. -43. 11025. -42. 11015. -41. 11004. -40. 10994. -39. 10983. -38. 10973. -37. 10962. -36. 10952. -35. 10941. -34. 10931. -33. 10920. -32. 10910. -31. 10899. -30. 10889. -29. 10878. -28. 10868. -27. 10858. -26. 10847. -25. 10837. -24. 10826. -23. 10816. -22. 10806. -21. 10795. -20. 10785. -19. 10775. -18. 10764. -17. 10754. -16. 10744. -15. 10733. -14. 10723. -13. 10713. -12. 10702. -11. 10692. -10. 10682. -9. 10672. -8. 10661. -7. 10651. -6. 10641. -5. 10631. -4. 10621. -3. 10610. -2. 10600. -1. 10590. 0. 10580. 1. 10570. 2. 10560. 3. 10550. 4. 10540. 5. 10529. 6. 10519. 7. 10509. 8. 10499. 9. 10489. 10. 10479. 11. 10469. 12. 10459. 13. 10449. 14. 10439. 15. 10429. 16. 10419. 17. 10409. 18. 10399. 19. 10389. 20. 10379. 21. 10369. 22. 10359. 23. 10349. 24. 10339. 25. 10329. 26. 10319. 27. 10309. 28. 10300. 29. 10290. 30. 10280. 31. 10270. 32. 10260. 33. 10250. 34. 10240. 35. 10230. 36. 10221. 37. 10211. 38. 10201. 39. 10191. 40. 10181. 41. 10172. 42. 10162. 43. 10152. 44. 10142. 45. 10132. 46. 10123. 47. 10113. 48. 10103. 49. 10093. 50. 10083. 51. 10074. 52. 10064. 53. 10054. 54. 10044. 55. 10035. 56. 10025. 57. 10015. 58. 10006. 59. 9996. 60. 9986. 61. 9976. 62. 9967. 63. 9957. 64. 9947. 65. 9938. 66. 9928. 67. 9918. 68. 9909. 69. 9899. 70. 9889. 71. 9880. 72. 9870. 73. 9860. 74. 9851. 75. 9841. 76. 9831. 77. 9822. 78. 9812. 79. 9802. 80. 9793. 81. 9783. 82. 9773. 83. 9764. 84. 9754. 85. 9744. 86. 9735. 87. 9725. 88. 9715. 89. 9706. 90. 9696. 91. 9687. 92. 9677. 93. 9667. 94. 9658. 95. 9648. 96. 9638. 97. 9629. 98. 9619. 99. 9610. 100. 9600. 101. 9590. 102. 9581. 103. 9571. 104. 9562. 105. 9552. 106. 9542. 107. 9533. 108. 9523. 109. 9513. 110. 9504. 111. 9494. 112. 9485. 113. 9475. 114. 9465. 115. 9456. 116. 9446. 117. 9436. 118. 9427. 119. 9417. 120. 9408. 121. 9398. 122. 9388. 123. 9379. 124. 9369. 125. 9360. 126. 9350. 127. 9340. 128. 9331. 129. 9321. 130. 9312. 131. 9302. 132. 9292. 133. 9283. 134. 9273. 135. 9263. 136. 9254. 137. 9244. 138. 9235. 139. 9225. 140. 9215. 141. 9206. 142. 9196. 143. 9187. 144. 9177. 145. 9167. 146. 9158. 147. 9148. 148. 9139. 149. 9129. 150. 9119. 151. 9110. 152. 9100. 153. 9091. 154. 9081. 155. 9071. 156. 9062. 157. 9052. 158. 9043. 159. 9033. 160. 9023. 161. 9014. 162. 9004. 163. 8995. 164. 8985. 165. 8975. 166. 8966. 167. 8956. 168. 8947. 169. 8937. 170. 8927. 171. 8918. 172. 8908. 173. 8899. 174. 8889. 175. 8880. 176. 8870. 177. 8860. 178. 8851. 179. 8841. 180. 8832. 181. 8822. 182. 8812. 183. 8803. 184. 8793. 185. 8784. 186. 8774. 187. 8765. 188. 8755. 189. 8745. 190. 8736. 191. 8726. 192. 8717. 193. 8707. 194. 8697. 195. 8688. 196. 8678. 197. 8669. 198. 8659. 199. 8650. 200. 8640. 201. 8630. 202. 8621. 203. 8611. 204. 8602. 205. 8592. 206. 8583. 207. 8573. 208. 8563. 209. 8554. 210. 8544. 211. 8535. 212. 8525. 213. 8516. 214. 8506. 215. 8496. 216. 8487. 217. 8477. 218. 8468. 219. 8458. 220. 8449. 221. 8439. 222. 8429. 223. 8420. 224. 8410. 225. 8401. 226. 8391. 227. 8382. 228. 8372. 229. 8362. 230. 8353. 231. 8343. 232. 8334. 233. 8324. 234. 8315. 235. 8305. 236. 8295. 237. 8286. 238. 8276. 239. 8267. 240. 8257. 241. 8248. 242. 8238. 243. 8228. 244. 8219. 245. 8209. 246. 8200. 247. 8190. 248. 8181. 249. 8171. 250. 8161. 251. 8152. 252. 8142. 253. 8133. 254. 8123. 255. 8113. 256. 8104. 257. 8094. 258. 8085. 259. 8075. 260. 8065. 261. 8056. 262. 8046. 263. 8037. 264. 8027. 265. 8017. 266. 8008. 267. 7998. 268. 7989. 269. 7979. 270. 7969. 271. 7960. 272. 7950. 273. 7941. 274. 7931. 275. 7921. 276. 7912. 277. 7902. 278. 7892. 279. 7883. 280. 7873. 281. 7864. 282. 7854. 283. 7844. 284. 7835. 285. 7825. 286. 7815. 287. 7806. 288. 7796. 289. 7786. 290. 7777. 291. 7767. 292. 7757. 293. 7748. 294. 7738. 295. 7728. 296. 7719. 297. 7709. 298. 7699. 299. 7690. 300. 7680. 301. 7670. 302. 7661. 303. 7651. 304. 7641. 305. 7632. 306. 7622. 307. 7612. 308. 7602. 309. 7593. 310. 7583. 311. 7573. 312. 7564. 313. 7554. 314. 7544. 315. 7534. 316. 7525. 317. 7515. 318. 7505. 319. 7496. 320. 7486. 321. 7476. 322. 7466. 323. 7457. 324. 7447. 325. 7437. 326. 7427. 327. 7418. 328. 7408. 329. 7398. 330. 7388. 331. 7379. 332. 7369. 333. 7359. 334. 7349. 335. 7339. 336. 7330. 337. 7320. 338. 7310. 339. 7300. 340. 7291. 341. 7281. 342. 7271. 343. 7261. 344. 7251. 345. 7242. 346. 7232. 347. 7222. 348. 7212. 349. 7202. 350. 7193. 351. 7183. 352. 7173. 353. 7163. 354. 7153. 355. 7144. 356. 7134. 357. 7124. 358. 7114. 359. 7104. 360. 7094. 361. 7085. 362. 7075. 363. 7065. 364. 7055. 365. 7045. 366. 7036. 367. 7026. 368. 7016. 369. 7006. 370. 6996. 371. 6986. 372. 6976. 373. 6967. 374. 6957. 375. 6947. 376. 6937. 377. 6927. 378. 6917. 379. 6907. 380. 6898. 381. 6888. 382. 6878. 383. 6868. 384. 6858. 385. 6848. 386. 6838. 387. 6829. 388. 6819. 389. 6809. 390. 6799. 391. 6789. 392. 6779. 393. 6769. 394. 6759. 395. 6749. 396. 6740. 397. 6730. 398. 6720. 399. 6710. 400. 6700. 401. 6690. 402. 6680. 403. 6670. 404. 6660. 405. 6651. 406. 6641. 407. 6631. 408. 6621. 409. 6611. 410. 6601. 411. 6591. 412. 6581. 413. 6571. 414. 6561. 415. 6551. 416. 6542. 417. 6532. 418. 6522. 419. 6512. 420. 6502. 421. 6492. 422. 6482. 423. 6472. 424. 6462. 425. 6452. 426. 6442. 427. 6432. 428. 6423. 429. 6413. 430. 6403. 431. 6393. 432. 6383. 433. 6373. 434. 6363. 435. 6353. 436. 6343. 437. 6333. 438. 6323. 439. 6313. 440. 6303. 441. 6294. 442. 6284. 443. 6274. 444. 6264. 445. 6254. 446. 6244. 447. 6234. 448. 6224. 449. 6214. 450. 6204. 451. 6194. 452. 6184. 453. 6175. 454. 6165. 455. 6155. 456. 6145. 457. 6135. 458. 6125. 459. 6115. 460. 6105. 461. 6095. 462. 6085. 463. 6075. 464. 6066. 465. 6056. 466. 6046. 467. 6036. 468. 6026. 469. 6016. 470. 6006. 471. 5996. 472. 5986. 473. 5976. 474. 5967. 475. 5957. 476. 5947. 477. 5937. 478. 5927. 479. 5917. 480. 5907. 481. 5897. 482. 5887. 483. 5878. 484. 5868. 485. 5858. 486. 5848. 487. 5838. 488. 5828. 489. 5818. 490. 5808. 491. 5799. 492. 5789. 493. 5779. 494. 5769. 495. 5759. 496. 5749. 497. 5740. 498. 5730. 499. 5720. 500. 5710. 501. 5700. 502. 5690. 503. 5680. 504. 5671. 505. 5661. 506. 5651. 507. 5641. 508. 5631. 509. 5622. 510. 5612. 511. 5602. 512. 5592. 513. 5582. 514. 5573. 515. 5563. 516. 5553. 517. 5543. 518. 5533. 519. 5524. 520. 5514. 521. 5504. 522. 5494. 523. 5484. 524. 5475. 525. 5465. 526. 5455. 527. 5445. 528. 5436. 529. 5426. 530. 5416. 531. 5406. 532. 5397. 533. 5387. 534. 5377. 535. 5367. 536. 5358. 537. 5348. 538. 5338. 539. 5328. 540. 5319. 541. 5309. 542. 5299. 543. 5289. 544. 5280. 545. 5270. 546. 5260. 547. 5251. 548. 5241. 549. 5231. 550. 5221. 551. 5212. 552. 5202. 553. 5192. 554. 5183. 555. 5173. 556. 5163. 557. 5154. 558. 5144. 559. 5134. 560. 5125. 561. 5115. 562. 5105. 563. 5096. 564. 5086. 565. 5076. 566. 5067. 567. 5057. 568. 5047. 569. 5038. 570. 5028. 571. 5018. 572. 5009. 573. 4999. 574. 4989. 575. 4980. 576. 4970. 577. 4961. 578. 4951. 579. 4941. 580. 4932. 581. 4922. 582. 4912. 583. 4903. 584. 4893. 585. 4884. 586. 4874. 587. 4864. 588. 4855. 589. 4845. 590. 4836. 591. 4826. 592. 4817. 593. 4807. 594. 4797. 595. 4788. 596. 4778. 597. 4769. 598. 4759. 599. 4750. 600. 4740. 601. 4730. 602. 4721. 603. 4711. 604. 4702. 605. 4692. 606. 4683. 607. 4673. 608. 4664. 609. 4654. 610. 4645. 611. 4635. 612. 4626. 613. 4616. 614. 4607. 615. 4597. 616. 4588. 617. 4578. 618. 4569. 619. 4559. 620. 4550. 621. 4540. 622. 4531. 623. 4521. 624. 4512. 625. 4502. 626. 4493. 627. 4483. 628. 4474. 629. 4464. 630. 4455. 631. 4446. 632. 4436. 633. 4427. 634. 4417. 635. 4408. 636. 4398. 637. 4389. 638. 4380. 639. 4370. 640. 4361. 641. 4351. 642. 4342. 643. 4333. 644. 4323. 645. 4314. 646. 4305. 647. 4295. 648. 4286. 649. 4277. 650. 4267. 651. 4258. 652. 4249. 653. 4239. 654. 4230. 655. 4221. 656. 4211. 657. 4202. 658. 4193. 659. 4184. 660. 4174. 661. 4165. 662. 4156. 663. 4147. 664. 4137. 665. 4128. 666. 4119. 667. 4110. 668. 4100. 669. 4091. 670. 4082. 671. 4073. 672. 4064. 673. 4055. 674. 4045. 675. 4036. 676. 4027. 677. 4018. 678. 4009. 679. 4000. 680. 3991. 681. 3981. 682. 3972. 683. 3963. 684. 3954. 685. 3945. 686. 3936. 687. 3927. 688. 3918. 689. 3909. 690. 3900. 691. 3891. 692. 3882. 693. 3873. 694. 3864. 695. 3855. 696. 3846. 697. 3837. 698. 3828. 699. 3819. 700. 3810. 701. 3801. 702. 3792. 703. 3783. 704. 3774. 705. 3765. 706. 3757. 707. 3748. 708. 3739. 709. 3730. 710. 3721. 711. 3712. 712. 3703. 713. 3695. 714. 3686. 715. 3677. 716. 3668. 717. 3659. 718. 3651. 719. 3642. 720. 3633. 721. 3624. 722. 3616. 723. 3607. 724. 3598. 725. 3589. 726. 3581. 727. 3572. 728. 3563. 729. 3555. 730. 3546. 731. 3537. 732. 3529. 733. 3520. 734. 3511. 735. 3503. 736. 3494. 737. 3485. 738. 3477. 739. 3468. 740. 3460. 741. 3451. 742. 3443. 743. 3434. 744. 3425. 745. 3417. 746. 3408. 747. 3400. 748. 3391. 749. 3383. 750. 3374. 751. 3366. 752. 3357. 753. 3349. 754. 3340. 755. 3332. 756. 3324. 757. 3315. 758. 3307. 759. 3298. 760. 3290. 761. 3281. 762. 3273. 763. 3265. 764. 3256. 765. 3248. 766. 3240. 767. 3231. 768. 3223. 769. 3214. 770. 3206. 771. 3198. 772. 3190. 773. 3181. 774. 3173. 775. 3165. 776. 3156. 777. 3148. 778. 3140. 779. 3132. 780. 3123. 781. 3115. 782. 3107. 783. 3099. 784. 3090. 785. 3082. 786. 3074. 787. 3066. 788. 3058. 789. 3049. 790. 3041. 791. 3033. 792. 3025. 793. 3017. 794. 3009. 795. 3001. 796. 2992. 797. 2984. 798. 2976. 799. 2968. 800. 2960. 801. 2952. 802. 2944. 803. 2936. 804. 2928. 805. 2920. 806. 2912. 807. 2904. 808. 2896. 809. 2888. 810. 2880. 811. 2872. 812. 2864. 813. 2856. 814. 2848. 815. 2840. 816. 2832. 817. 2824. 818. 2816. 819. 2808. 820. 2800. 821. 2792. 822. 2784. 823. 2776. 824. 2768. 825. 2760. 826. 2753. 827. 2745. 828. 2737. 829. 2729. 830. 2721. 831. 2713. 832. 2706. 833. 2698. 834. 2690. 835. 2682. 836. 2674. 837. 2667. 838. 2659. 839. 2651. 840. 2643. 841. 2636. 842. 2628. 843. 2620. 844. 2613. 845. 2605. 846. 2597. 847. 2590. 848. 2582. 849. 2574. 850. 2567. 851. 2559. 852. 2551. 853. 2544. 854. 2536. 855. 2529. 856. 2521. 857. 2514. 858. 2506. 859. 2498. 860. 2491. 861. 2483. 862. 2476. 863. 2468. 864. 2461. 865. 2454. 866. 2446. 867. 2439. 868. 2431. 869. 2424. 870. 2416. 871. 2409. 872. 2402. 873. 2394. 874. 2387. 875. 2380. 876. 2372. 877. 2365. 878. 2358. 879. 2350. 880. 2343. 881. 2336. 882. 2328. 883. 2321. 884. 2314. 885. 2307. 886. 2300. 887. 2292. 888. 2285. 889. 2278. 890. 2271. 891. 2264. 892. 2257. 893. 2249. 894. 2242. 895. 2235. 896. 2228. 897. 2221. 898. 2214. 899. 2207. 900. 2200. 901. 2193. 902. 2186. 903. 2179. 904. 2172. 905. 2165. 906. 2158. 907. 2151. 908. 2144. 909. 2137. 910. 2131. 911. 2124. 912. 2117. 913. 2110. 914. 2103. 915. 2096. 916. 2089. 917. 2083. 918. 2076. 919. 2069. 920. 2062. 921. 2056. 922. 2049. 923. 2042. 924. 2036. 925. 2029. 926. 2022. 927. 2016. 928. 2009. 929. 2002. 930. 1996. 931. 1989. 932. 1983. 933. 1976. 934. 1969. 935. 1963. 936. 1956. 937. 1950. 938. 1943. 939. 1937. 940. 1930. 941. 1924. 942. 1918. 943. 1911. 944. 1905. 945. 1898. 946. 1892. 947. 1886. 948. 1879. 949. 1873. 950. 1867. 951. 1860. 952. 1854. 953. 1848. 954. 1842. 955. 1835. 956. 1829. 957. 1823. 958. 1817. 959. 1810. 960. 1804. 961. 1798. 962. 1792. 963. 1786. 964. 1780. 965. 1774. 966. 1768. 967. 1762. 968. 1755. 969. 1749. 970. 1743. 971. 1737. 972. 1731. 973. 1725. 974. 1719. 975. 1714. 976. 1708. 977. 1702. 978. 1696. 979. 1690. 980. 1684. 981. 1678. 982. 1672. 983. 1667. 984. 1661. 985. 1655. 986. 1649. 987. 1643. 988. 1638. 989. 1632. 990. 1626. 991. 1621. 992. 1615. 993. 1609. 994. 1604. 995. 1598. 996. 1592. 997. 1587. 998. 1581. 999. 1576. 1000. 1570. 1001. 1564. 1002. 1559. 1003. 1553. 1004. 1548. 1005. 1542. 1006. 1537. 1007. 1532. 1008. 1526. 1009. 1521. 1010. 1515. 1011. 1510. 1012. 1505. 1013. 1499. 1014. 1494. 1015. 1489. 1016. 1483. 1017. 1478. 1018. 1473. 1019. 1467. 1020. 1462. 1021. 1457. 1022. 1452. 1023. 1447. 1024. 1441. 1025. 1436. 1026. 1431. 1027. 1426. 1028. 1421. 1029. 1416. 1030. 1411. 1031. 1406. 1032. 1400. 1033. 1395. 1034. 1390. 1035. 1385. 1036. 1380. 1037. 1375. 1038. 1370. 1039. 1365. 1040. 1361. 1041. 1356. 1042. 1351. 1043. 1346. 1044. 1341. 1045. 1336. 1046. 1331. 1047. 1326. 1048. 1321. 1049. 1317. 1050. 1312. 1051. 1307. 1052. 1302. 1053. 1298. 1054. 1293. 1055. 1288. 1056. 1283. 1057. 1279. 1058. 1274. 1059. 1269. 1060. 1265. 1061. 1260. 1062. 1255. 1063. 1251. 1064. 1246. 1065. 1242. 1066. 1237. 1067. 1233. 1068. 1228. 1069. 1223. 1070. 1219. 1071. 1214. 1072. 1210. 1073. 1206. 1074. 1201. 1075. 1197. 1076. 1192. 1077. 1188. 1078. 1183. 1079. 1179. 1080. 1175. 1081. 1170. 1082. 1166. 1083. 1162. 1084. 1157. 1085. 1153. 1086. 1149. 1087. 1144. 1088. 1140. 1089. 1136. 1090. 1132. 1091. 1127. 1092. 1123. 1093. 1119. 1094. 1115. 1095. 1111. 1096. 1106. 1097. 1102. 1098. 1098. 1099. 1094. 1100. 1090. 1101. 1086. 1102. 1082. 1103. 1078. 1104. 1074. 1105. 1070. 1106. 1066. 1107. 1062. 1108. 1058. 1109. 1054. 1110. 1050. 1111. 1046. 1112. 1042. 1113. 1038. 1114. 1034. 1115. 1030. 1116. 1026. 1117. 1022. 1118. 1018. 1119. 1014. 1120. 1011. 1121. 1007. 1122. 1003. 1123. 999. 1124. 995. 1125. 992. 1126. 988. 1127. 984. 1128. 980. 1129. 977. 1130. 973. 1131. 969. 1132. 965. 1133. 962. 1134. 958. 1135. 954. 1136. 951. 1137. 947. 1138. 943. 1139. 940. 1140. 936. 1141. 933. 1142. 929. 1143. 926. 1144. 922. 1145. 918. 1146. 915. 1147. 911. 1148. 908. 1149. 904. 1150. 901. 1151. 897. 1152. 894. 1153. 890. 1154. 887. 1155. 884. 1156. 880. 1157. 877. 1158. 873. 1159. 870. 1160. 867. 1161. 863. 1162. 860. 1163. 856. 1164. 853. 1165. 850. 1166. 847. 1167. 843. 1168. 840. 1169. 837. 1170. 833. 1171. 830. 1172. 827. 1173. 824. 1174. 820. 1175. 817. 1176. 814. 1177. 811. 1178. 808. 1179. 804. 1180. 801. 1181. 798. 1182. 795. 1183. 792. 1184. 789. 1185. 786. 1186. 782. 1187. 779. 1188. 776. 1189. 773. 1190. 770. 1191. 767. 1192. 764. 1193. 761. 1194. 758. 1195. 755. 1196. 752. 1197. 749. 1198. 746. 1199. 743. 1200. 740. 1201. 737. 1202. 734. 1203. 731. 1204. 728. 1205. 725. 1206. 722. 1207. 719. 1208. 717. 1209. 714. 1210. 711. 1211. 708. 1212. 705. 1213. 702. 1214. 699. 1215. 697. 1216. 694. 1217. 691. 1218. 688. 1219. 685. 1220. 683. 1221. 680. 1222. 677. 1223. 674. 1224. 672. 1225. 669. 1226. 666. 1227. 663. 1228. 661. 1229. 658. 1230. 655. 1231. 653. 1232. 650. 1233. 647. 1234. 645. 1235. 642. 1236. 639. 1237. 637. 1238. 634. 1239. 632. 1240. 629. 1241. 626. 1242. 624. 1243. 621. 1244. 619. 1245. 616. 1246. 614. 1247. 611. 1248. 609. 1249. 606. 1250. 604. 1251. 601. 1252. 599. 1253. 596. 1254. 594. 1255. 591. 1256. 589. 1257. 586. 1258. 584. 1259. 581. 1260. 579. 1261. 577. 1262. 574. 1263. 572. 1264. 569. 1265. 567. 1266. 565. 1267. 562. 1268. 560. 1269. 558. 1270. 555. 1271. 553. 1272. 551. 1273. 548. 1274. 546. 1275. 544. 1276. 542. 1277. 539. 1278. 537. 1279. 535. 1280. 533. 1281. 530. 1282. 528. 1283. 526. 1284. 524. 1285. 522. 1286. 520. 1287. 517. 1288. 515. 1289. 513. 1290. 511. 1291. 509. 1292. 507. 1293. 505. 1294. 502. 1295. 500. 1296. 498. 1297. 496. 1298. 494. 1299. 492. 1300. 490. 1301. 488. 1302. 486. 1303. 484. 1304. 482. 1305. 480. 1306. 478. 1307. 476. 1308. 474. 1309. 472. 1310. 470. 1311. 468. 1312. 466. 1313. 464. 1314. 462. 1315. 460. 1316. 458. 1317. 456. 1318. 455. 1319. 453. 1320. 451. 1321. 449. 1322. 447. 1323. 445. 1324. 443. 1325. 442. 1326. 440. 1327. 438. 1328. 436. 1329. 434. 1330. 432. 1331. 431. 1332. 429. 1333. 427. 1334. 425. 1335. 423. 1336. 422. 1337. 420. 1338. 418. 1339. 416. 1340. 415. 1341. 413. 1342. 411. 1343. 410. 1344. 408. 1345. 406. 1346. 404. 1347. 403. 1348. 401. 1349. 399. 1350. 398. 1351. 396. 1352. 394. 1353. 393. 1354. 391. 1355. 389. 1356. 388. 1357. 386. 1358. 384. 1359. 383. 1360. 381. 1361. 380. 1362. 378. 1363. 376. 1364. 375. 1365. 373. 1366. 372. 1367. 370. 1368. 368. 1369. 367. 1370. 365. 1371. 364. 1372. 362. 1373. 361. 1374. 359. 1375. 357. 1376. 356. 1377. 354. 1378. 353. 1379. 351. 1380. 350. 1381. 348. 1382. 347. 1383. 345. 1384. 344. 1385. 342. 1386. 341. 1387. 339. 1388. 338. 1389. 336. 1390. 335. 1391. 333. 1392. 332. 1393. 330. 1394. 329. 1395. 327. 1396. 326. 1397. 324. 1398. 323. 1399. 321. 1400. 320. 1401. 319. 1402. 317. 1403. 316. 1404. 314. 1405. 313. 1406. 311. 1407. 310. 1408. 308. 1409. 307. 1410. 306. 1411. 304. 1412. 303. 1413. 301. 1414. 300. 1415. 299. 1416. 297. 1417. 296. 1418. 294. 1419. 293. 1420. 292. 1421. 290. 1422. 289. 1423. 287. 1424. 286. 1425. 285. 1426. 283. 1427. 282. 1428. 281. 1429. 279. 1430. 278. 1431. 277. 1432. 275. 1433. 274. 1434. 273. 1435. 271. 1436. 270. 1437. 269. 1438. 267. 1439. 266. 1440. 265. 1441. 263. 1442. 262. 1443. 261. 1444. 260. 1445. 258. 1446. 257. 1447. 256. 1448. 255. 1449. 253. 1450. 252. 1451. 251. 1452. 250. 1453. 249. 1454. 247. 1455. 246. 1456. 245. 1457. 244. 1458. 243. 1459. 241. 1460. 240. 1461. 239. 1462. 238. 1463. 237. 1464. 236. 1465. 235. 1466. 233. 1467. 232. 1468. 231. 1469. 230. 1470. 229. 1471. 228. 1472. 227. 1473. 226. 1474. 225. 1475. 224. 1476. 223. 1477. 222. 1478. 221. 1479. 219. 1480. 218. 1481. 217. 1482. 216. 1483. 215. 1484. 214. 1485. 214. 1486. 213. 1487. 212. 1488. 211. 1489. 210. 1490. 209. 1491. 208. 1492. 207. 1493. 206. 1494. 205. 1495. 204. 1496. 203. 1497. 203. 1498. 202. 1499. 201. 1500. 200. 1501. 199. 1502. 198. 1503. 198. 1504. 197. 1505. 196. 1506. 195. 1507. 194. 1508. 194. 1509. 193. 1510. 192. 1511. 191. 1512. 191. 1513. 190. 1514. 189. 1515. 188. 1516. 188. 1517. 187. 1518. 186. 1519. 186. 1520. 185. 1521. 184. 1522. 184. 1523. 183. 1524. 182. 1525. 182. 1526. 181. 1527. 180. 1528. 179. 1529. 179. 1530. 178. 1531. 178. 1532. 177. 1533. 176. 1534. 176. 1535. 175. 1536. 174. 1537. 174. 1538. 173. 1539. 172. 1540. 172. 1541. 171. 1542. 170. 1543. 170. 1544. 169. 1545. 168. 1546. 168. 1547. 167. 1548. 166. 1549. 166. 1550. 165. 1551. 164. 1552. 163. 1553. 163. 1554. 162. 1555. 161. 1556. 161. 1557. 160. 1558. 159. 1559. 158. 1560. 158. 1561. 157. 1562. 156. 1563. 155. 1564. 155. 1565. 154. 1566. 153. 1567. 152. 1568. 152. 1569. 151. 1570. 150. 1571. 149. 1572. 148. 1573. 147. 1574. 147. 1575. 146. 1576. 145. 1577. 144. 1578. 143. 1579. 142. 1580. 141. 1581. 140. 1582. 139. 1583. 138. 1584. 137. 1585. 136. 1586. 135. 1587. 134. 1588. 133. 1589. 132. 1590. 131. 1591. 130. 1592. 129. 1593. 128. 1594. 127. 1595. 126. 1596. 125. 1597. 124. 1598. 122. 1599. 121. 1600. 120. 1601. 119. 1602. 118. 1603. 116. 1604. 115. 1605. 114. 1606. 112. 1607. 111. 1608. 110. 1609. 108. 1610. 107. 1611. 106. 1612. 104. 1613. 103. 1614. 102. 1615. 100. 1616. 99. 1617. 97. 1618. 96. 1619. 94. 1620. 93. 1621. 92. 1622. 90. 1623. 89. 1624. 87. 1625. 86. 1626. 84. 1627. 83. 1628. 81. 1629. 80. 1630. 78. 1631. 77. 1632. 75. 1633. 74. 1634. 72. 1635. 71. 1636. 69. 1637. 68. 1638. 67. 1639. 65. 1640. 64. 1641. 62. 1642. 61. 1643. 59. 1644. 58. 1645. 57. 1646. 55. 1647. 54. 1648. 52. 1649. 51. 1650. 50. 1651. 48. 1652. 47. 1653. 46. 1654. 44. 1655. 43. 1656. 42. 1657. 40. 1658. 39. 1659. 38. 1660. 37. 1661. 36. 1662. 34. 1663. 33. 1664. 32. 1665. 31. 1666. 30. 1667. 29. 1668. 28. 1669. 27. 1670. 26. 1671. 25. 1672. 24. 1673. 23. 1674. 22. 1675. 21. 1676. 20. 1677. 19. 1678. 19. 1679. 18. 1680. 17. 1681. 16. 1682. 16. 1683. 15. 1684. 14. 1685. 14. 1686. 13. 1687. 13. 1688. 12. 1689. 12. 1690. 11. 1691. 11. 1692. 10. 1693. 10. 1694. 10. 1695. 10. 1696. 9. 1697. 9. 1698. 9. 1699. 9. 1700. 9. 1701. 9. 1702. 9. 1703. 9. 1704. 9. 1705. 9. 1706. 9. 1707. 10. 1708. 10. 1709. 10. 1710. 10. 1711. 10. 1712. 10. 1713. 10. 1714. 11. 1715. 11. 1716. 11. 1717. 11. 1718. 11. 1719. 11. 1720. 11. 1721. 11. 1722. 11. 1723. 11. 1724. 11. 1725. 11. 1726. 11. 1727. 11. 1728. 11. 1729. 11. 1730. 11. 1731. 11. 1732. 11. 1733. 11. 1734. 11. 1735. 11. 1736. 12. 1737. 12. 1738. 12. 1739. 12. 1740. 12. 1741. 12. 1742. 12. 1743. 12. 1744. 12. 1745. 12. 1746. 13. 1747. 13. 1748. 13. 1749. 13. 1750. 13. 1751. 13. 1752. 13. 1753. 14. 1754. 14. 1755. 14. 1756. 14. 1757. 14. 1758. 15. 1759. 15. 1760. 15. 1761. 15. 1762. 15. 1763. 15. 1764. 16. 1765. 16. 1766. 16. 1767. 16. 1768. 16. 1769. 16. 1770. 16. 1771. 16. 1772. 16. 1773. 16. 1774. 16. 1775. 16. 1776. 17. 1777. 17. 1778. 17. 1779. 17. 1780. 17. 1781. 17. 1782. 17. 1783. 17. 1784. 17. 1785. 17. 1786. 17. 1787. 17. 1788. 17. 1789. 17. 1790. 17. 1791. 17. 1792. 17. 1793. 16. 1794. 16. 1795. 16. 1796. 15. 1797. 15. 1798. 15. 1799. 14. 1800. 14. 1801. 14. 1802. 14. 1803. 13. 1804. 13. 1805. 13. 1806. 13. 1807. 13. 1808. 13. 1809. 13. 1810. 13. 1811. 13. 1812. 13. 1813. 13. 1814. 13. 1815. 13. 1816. 13. 1817. 13. 1818. 12. 1819. 12. 1820. 12. 1821. 12. 1822. 11. 1823. 11. 1824. 11. 1825. 10. 1826. 10. 1827. 9. 1828. 9. 1829. 8. 1830. 8. 1831. 8. 1832. 7. 1833. 7. 1834. 7. 1835. 7. 1836. 6. 1837. 6. 1838. 6. 1839. 6. 1840. 6. 1841. 6. 1842. 6. 1843. 6. 1844. 6. 1845. 6. 1846. 6. 1847. 6. 1848. 7. 1849. 7. 1850. 7. 1851. 7. 1852. 7. 1853. 8. 1854. 8. 1855. 8. 1856. 8. 1857. 8. 1858. 8. 1859. 8. 1860. 8. 1861. 8. 1862. 7. 1863. 7. 1864. 6. 1865. 6. 1866. 5. 1867. 4. 1868. 4. 1869. 3. 1870. 2. 1871. 1. 1872. 0. 1873. -0. 1874. -1. 1875. -2. 1876. -3. 1877. -3. 1878. -4. 1879. -5. 1880. -5. 1881. -5. 1882. -6. 1883. -6. 1884. -6. 1885. -6. 1886. -6. 1887. -6. 1888. -6. 1889. -6. 1890. -6. 1891. -6. 1892. -6. 1893. -6. 1894. -6. 1895. -5. 1896. -5. 1897. -5. 1898. -4. 1899. -4. 1900. -3. 1901. -2. 1902. -1. 1903. 0. 1904. 1. 1905. 3. 1906. 4. 1907. 6. 1908. 7. 1909. 9. 1910. 10. 1911. 11. 1912. 13. 1913. 14. 1914. 15. 1915. 16. 1916. 17. 1917. 18. 1918. 19. 1919. 20. 1920. 21. 1921. 22. 1922. 22. 1923. 23. 1924. 23. 1925. 23. 1926. 24. 1927. 24. 1928. 24. 1929. 24. 1930. 24. 1931. 24. 1932. 24. 1933. 24. 1934. 24. 1935. 24. 1936. 24. 1937. 24. 1938. 24. 1939. 24. 1940. 24. 1941. 24. 1942. 25. 1943. 25. 1944. 26. 1945. 26. 1946. 27. 1947. 27. 1948. 28. 1949. 28. 1950. 29. 1951. 29. 1952. 30. 1953. 30. 1954. 31. 1955. 31. 1956. 31. 1957. 32. 1958. 32. 1959. 33. 1960. 33. 1961. 33. 1962. 34. 1963. 35. 1964. 35. 1965. 36. 1966. 36. 1967. 37. 1968. 38. 1969. 39. 1970. 40. 1971. 41. 1972. 42. 1973. 43. 1974. 45. 1975. 46. 1976. 47. 1977. 48. 1978. 49. 1979. 50. 1980. 51. 1981. 52. 1982. 53. 1983. 53. 1984. 54. 1985. 54. 1986. 55. 1987. 55. 1988. 56. 1989. 56. 1990. 57. 1991. 58. 1992. 58. 1993. 59. 1994. 60. 1995. 61. 1996. 61. 1997. 62. 1998. 63. 1999. 64. 2000. 65. plplot-5.10.0+dfsg/lib/qsastime/deltaT.dat 644 1750 1750 103111212233146 172210ustar andrewandrew-1000 25400 -900 23700 -800 22000 -700 21000 -600 19040 -500 17190 -400 15530 -300 14080 -200 12790 -100 11640 000 10580 100 9600 200 8640 300 7680 400 6700 500 5710 600 4740 700 3810 800 2960 900 2200 1000 1570 1100 1090 1200 740 1300 490 1400 320 1500 200 1600 120 1700 9 1710 10 1720 11 1730 11 1740 12 1750 13 1760 15 1770 16 1780 17 1790 17 1800 14 1810 13 1820 12 1830 8 1840 6 1850 7 1860 8 1870 2 1880 -5 1890 -6 1900 -3 1910 10 1920 21 1930 24 1940 24 1950 29 1960 33 1970 40 1980 51 1990 57 2000 65 plplot-5.10.0+dfsg/lib/qsastime/CMakeLists.txt 644 1750 1750 1442512167100522 201060ustar andrewandrew# lib/qsastime/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Required to configure qsastimeP.h here and also for deciding whether # to build test applications later. option( TEST_QSASTIME "Build any of the provided libqsastime test applications." OFF ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/qsastimeP.h.in ${CMAKE_CURRENT_BINARY_DIR}/qsastimeP.h ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) # Routine for generating a header containing data to be used by the # TAI-UTC transformation code. if(NOT CMAKE_CROSSCOMPILING) add_executable(tai-utc-gen ${CMAKE_CURRENT_SOURCE_DIR}/tai-utc-gen.c) if(MATH_LIB) target_link_libraries(tai-utc-gen ${MATH_LIB}) endif(MATH_LIB) add_executable(deltaT-gen ${CMAKE_CURRENT_SOURCE_DIR}/deltaT-gen.c ${CMAKE_CURRENT_SOURCE_DIR}/dspline.c) export(TARGETS tai-utc-gen FILE ${CMAKE_CURRENT_BINARY_DIR}/tai-utc-gen.cmake ) export(TARGETS deltaT-gen FILE ${CMAKE_CURRENT_BINARY_DIR}/deltaT-gen.cmake ) else(NOT CMAKE_CROSSCOMPILING) # Generated by initial non-cross build above. include(${CMAKE_NATIVE_BINARY_DIR}/lib/qsastime/tai-utc-gen.cmake) include(${CMAKE_NATIVE_BINARY_DIR}/lib/qsastime/deltaT-gen.cmake) endif(NOT CMAKE_CROSSCOMPILING) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tai-utc.h COMMAND tai-utc-gen ${CMAKE_CURRENT_SOURCE_DIR}/tai-utc.dat ${CMAKE_CURRENT_BINARY_DIR}/tai-utc.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tai-utc.dat tai-utc-gen ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deltaT.h COMMAND deltaT-gen ${CMAKE_CURRENT_SOURCE_DIR}/deltaT.dat ${CMAKE_CURRENT_BINARY_DIR}/deltaT.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/deltaT.dat deltaT-gen ) # These target-level dependencies needed below. add_custom_target( tai-utc.h_built DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tai-utc.h ) add_custom_target( deltaT.h_built DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/deltaT.h ) set(qsastime_LIB_SRCS qsastime.c dsplint.c ) if(BUILD_SHARED_LIBS) SET_SOURCE_FILES_PROPERTIES( ${qsastime_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS) add_library(qsastime ${qsastime_LIB_SRCS}) add_dependencies(qsastime tai-utc.h_built deltaT.h_built) if(NON_TRANSITIVE) # empty list ==> non-transitive linking for everything that links to # libqsatime in the shared libraries case. target_link_libraries(qsastime LINK_INTERFACE_LIBRARIES) endif(NON_TRANSITIVE) if(MATH_LIB) target_link_libraries(qsastime ${MATH_LIB}) endif(MATH_LIB) set_target_properties( qsastime PROPERTIES SOVERSION ${qsastime_SOVERSION} VERSION ${qsastime_VERSION} INSTALL_NAME_DIR "${LIB_DIR}" ) set(qsastime_INSTALLED_HEADERS qsastime.h qsastimedll.h ) install(FILES ${qsastime_INSTALLED_HEADERS} DESTINATION ${INCLUDE_DIR}) install(TARGETS qsastime EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) # Build test routines if so desired. if(TEST_QSASTIME) option( BUILD_QSASTIME_TESTLIB "Build qsastime_testlib application which is used to test the qsastime library against the C library time routines" OFF ) # Don't bother with building qsastime_testlib on Windows because its # C library is incapable of providing useful time routines to act # as comparisons with qsastime library results. if(WIN32_OR_CYGWIN) set(BUILD_QSASTIME_TESTLIB OFF CACHE BOOL "Build qsastime_testlib application which is used to test the qsastime library against the C library time routines" FORCE) endif(WIN32_OR_CYGWIN) # qsastime_extra.[ch] provides helper functions for qsastime_test that should # not be part of the library. # Add in qsastime.c rather than use the library because don't want # to make the private library API visible. add_executable(qsastime_test qsastime_test.c qsastime_extra.c qsastime.c) add_dependencies(qsastime_test tai-utc.h_built) if(MATH_LIB) target_link_libraries(qsastime_test ${MATH_LIB}) endif(MATH_LIB) # Routine for testing bhunt_search function in qsastime.c. add_executable(bhunt_search_test bhunt_search_test.c qsastime.c) add_dependencies(bhunt_search_test tai-utc.h_built) if(MATH_LIB) target_link_libraries(bhunt_search_test ${MATH_LIB}) endif(MATH_LIB) # Routine for generating interpolated values for delta T (difference between # ephemeris time and GMT) on standard grid. # Add in dsplint.c rather than use the library because don't want # to make the private library API visible. add_executable(deltaT_test deltaT_test.c dsplint.c) add_dependencies(deltaT_test deltaT.h_built) # Routine for testing just the library functions against their library # inverses (to test self-consistency when such inverses exist) and also # equivalent C library routines. # N.B. the routine immediately errors out at run time if sizeof(time_t) < 8 or # sizeof(int) !=4. The time_t constraint is because we want access to a large # C library date range to do the tests. The int constraint is so we # emulate library results on 32-bit systems. # The test executable normally only passes these two criteria for # 64-bit platforms. # Add in qsastime.c rather than use the library because don't want # to make the private library API visible. if(BUILD_QSASTIME_TESTLIB) add_executable(qsastime_testlib qsastime_testlib.c qsastime.c) add_dependencies(qsastime_testlib tai-utc.h_built) if(MATH_LIB) target_link_libraries(qsastime_testlib ${MATH_LIB}) endif(MATH_LIB) endif(BUILD_QSASTIME_TESTLIB) endif(TEST_QSASTIME) plplot-5.10.0+dfsg/lib/qsastime/dspline.c 644 1750 1750 1351511646000332 171460ustar andrewandrew// // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // Provenance: This code was originally developed under the GPL as part of // the FreeEOS project (revision 121). This code has been converted from // Fortran to C with the aid of f2c and relicensed for PLplot under the LGPL // with the permission of the FreeEOS copyright holder (Alan W. Irwin). // #include "dspline.h" int dspline( double *x, double *y, int n, int if1, double cond1, int ifn, double condn, double *y2 ) { int i__1, i__, k; double p, u[2000], qn, un, sig; // input parameters: // x(n) are the spline knot points // y(n) are the function values at the knot points // if1 = 1 specifies cond1 is the first derivative at the // first knot point. // if1 = 2 specifies cond1 is the second derivative at the // first knot point. // ifn = 1 specifies condn is the first derivative at the // nth knot point. // ifn = 2 specifies condn is the second derivative at the // nth knot point. // output values: // y2(n) is the second derivative of the spline evaluated at // the knot points. // Parameter adjustments --y2; --y; --x; // Function Body if ( n > 2000 ) { return 1; } // y2(i) = u(i) + d(i)*y2(i+1), where // d(i) is temporarily stored in y2(i) (see below). if ( if1 == 2 ) { // cond1 is second derivative at first point. // these two values assure that for above equation with d(i) temporarily // stored in y2(i) y2[1] = 0.; u[0] = cond1; } else if ( if1 == 1 ) { // cond1 is first derivative at first point. // special case (Press et al 3.3.5 with A = 1, and B=0) // of equations below where // a_j = 0 // b_j = -(x_j+1 - x_j)/3 // c_j = -(x_j+1 - x_j)/6 // r_j = cond1 - (y_j+1 - y_j)/(x_j+1 - x_j) // u(i) = r(i)/b(i) // d(i) = -c(i)/b(i) // N.B. d(i) is temporarily stored in y2. y2[1] = -.5; u[0] = 3. / ( x[2] - x[1] ) * ( ( y[2] - y[1] ) / ( x[2] - x[1] ) - cond1 ); } else { return 2; } // if original tri-diagonal system is characterized as // a_j y2_j-1 + b_j y2_j + c_j y2_j+1 = r_j // Then from Press et al. 3.3.7, we have the unscaled result: // a_j = (x_j - x_j-1)/6 // b_j = (x_j+1 - x_j-1)/3 // c_j = (x_j+1 - x_j)/6 // r_j = (y_j+1 - y_j)/(x_j+1 - x_j) - (y_j - y_j-1)/(x_j - x_j-1) // In practice, all these values are divided through by b_j/2 to scale // them, and from now on we will use these scaled values. // forward elimination step: assume y2(i-1) = u(i-1) + d(i-1)*y2(i). // When this is substituted into above tridiagonal equation ==> // y2(i) = u(i) + d(i)*y2(i+1), where // u(i) = [r(i) - a(i) u(i-1)]/[b(i) + a(i) d(i-1)] // d(i) = -c(i)/[b(i) + a(i) d(i-1)] // N.B. d(i) is temporarily stored in y2. i__1 = n - 1; for ( i__ = 2; i__ <= i__1; ++i__ ) { // sig is scaled a(i) sig = ( x[i__] - x[i__ - 1] ) / ( x[i__ + 1] - x[i__ - 1] ); // p is denominator = scaled a(i) d(i-1) + scaled b(i), where scaled // b(i) is 2. p = sig * y2[i__ - 1] + 2.; // propagate d(i) equation above. Note sig-1 = -c(i) y2[i__] = ( sig - 1. ) / p; // propagate scaled u(i) equation above u[i__ - 1] = ( ( ( y[i__ + 1] - y[i__] ) / ( x[i__ + 1] - x[i__] ) - ( y[i__] - y[i__ - 1] ) / ( x[i__] - x[i__ - 1] ) ) * 6. / ( x[i__ + 1] - x[i__ - 1] ) - sig * u[i__ - 2] ) / p; } if ( ifn == 2 ) { // condn is second derivative at nth point. // These two values assure that in the equation below. qn = 0.; un = condn; } else if ( ifn == 1 ) { // specify condn is first derivative at nth point. // special case (Press et al 3.3.5 with A = 0, and B=1) // implies a_n y2(n-1) + b_n y2(n) = r_n, where // a_n = (x_n - x_n-1)/6 // b_n = (x_n - x_n-1)/3 // r_n = cond1 - (y_n - y_n-1)/(x_n - x_n-1) // use same propagation equation as above, only with c_n = 0 // ==> d_n = 0 ==> y2(n) = u(n) => // y(n) = [r(n) - a(n) u(n-1)]/[b(n) + a(n) d(n-1)] // qn is scaled a_n qn = .5; // un is scaled r_n (N.B. un is not u(n))! Sorry for the mixed notation. un = 3. / ( x[n] - x[n - 1] ) * ( condn - ( y[n] - y[n - 1] ) / ( x[n] - x[n - 1] ) ); } else { return 3; } // N.B. d(i) is temporarily stored in y2, and everything is // scaled by b_n. // qn is scaled a_n, 1.d0 is scaled b_n, and un is scaled r_n. y2[n] = ( un - qn * u[n - 2] ) / ( qn * y2[n - 1] + 1. ); // back substitution. for ( k = n - 1; k >= 1; --k ) { y2[k] = y2[k] * y2[k + 1] + u[k - 1]; } return 0; } plplot-5.10.0+dfsg/lib/qsastime/qsastime_extra.c 644 1750 1750 2145012276771565 205650ustar andrewandrew// // This software originally contributed under the LGPL in January 2009 to // PLplot by the // Cluster Science Centre // QSAS team, // Imperial College, London // Copyright (C) 2009 Imperial College, London // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // MJD measures from the start of 17 Nov 1858 // These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 Gregoriam // Note C libraries use Gregorian only from 14 Sept 1752 // More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php // These routines have been compared with the results of the US Naval Observatory online converter. // Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5 // // In all routines, specifying a day, hour, minute or second field greater than would be valid is // handled with modulo arithmetic and safe. // Thus 2006-12-32 00:62:00.0 will safely, and correctly, be treated as 2007-01-01 01:02:00.0 // // #include "qsastime_extra.h" static double MJDtoJD = 2400000.5; static double SecInDay = 86400; // we ignore leap seconds int setFromISOstring( const char* ISOstring, MJDtime *MJD, int forceJulian ) { double seconds; int y, m, d, h, min; int startAt = 0; int len = strlen( ISOstring ); // ISO is "1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z" // parse off year y = strtol( &( ISOstring[startAt] ), NULL, 10 ); if ( ISOstring[startAt] == '-' || ISOstring[startAt] == '+' ) startAt++; startAt += 5; if ( startAt > len ) return 1; m = strtol( &( ISOstring[startAt] ), NULL, 10 ); startAt += 3; if ( startAt > len ) return 1; d = strtol( &( ISOstring[startAt] ), NULL, 10 ); startAt += 3; if ( startAt > len ) return 1; h = strtol( &( ISOstring[startAt] ), NULL, 10 ); startAt += 3; if ( startAt > len ) return 1; min = strtol( &( ISOstring[startAt] ), NULL, 10 ); startAt += 3; if ( startAt > len ) return 1; seconds = strtod( &( ISOstring[startAt] ), NULL ); setFromUT( y, m - 1, d, h, min, seconds, MJD, forceJulian ); return 0; } void setFromDOY( int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian ) { // Set from Day Of Year format // convert Gregorian date plus time to MJD // MJD measures from the start of 17 Nov 1858 // the int flag forceJulian forces use of Julian calendar whatever the year // default is to use Gregorian after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 Gregorian // Note C libraries use Gregorian only from 14 Sept 1752 onwards int leaps, lastyear, extraDays; // N.B. There were known problems (both for the Julian and Gregorian // cases) with the following leap year logic that were completely fixed // in qsastime.c, but I (AWI) am not going to bother with these fixups // here since this code only used for a specific test routine for limited // date range and not for anything general. if ( forceJulian && year <= 0 ) { // count leap years on Julian Calendar // MJD for Jan 1 0000 (correctly Jan 01, BCE 1) is - 678943, count from there // negative CE (AD) years convert to BCE (BC) as BCE = 1 - CE, e.g. 2 BCE = -1 CE leaps = ( year - 4 ) / 4; // (note leaps is negative here and year 0 (1 BCE) was a leap year MJD->base_day = year * 365 + leaps + doy - 678943; } else if ( forceJulian ) { // count leap years on Julian Calendar // MJD for Jan 1 0000 (correctly Jan 01, BCE 1) is - 678943, count from there leaps = ( year - 1 ) / 4; MJD->base_day = year * 365 + leaps + doy - 678943; } else { // count leap years Gregorian Calendar - modern dates // Algorithm below for 17 Nov 1858 (0 MJD) gives // leaps = 450 and hence base_day of 678941, so subtract it to give MJD day lastyear = year - 1; leaps = lastyear / 4 - lastyear / 100 + lastyear / 400; MJD->base_day = year * 365 + leaps + doy - 678941; } MJD->time_sec = sec + ( (double) min + (double) hour * 60. ) * 60.; if ( MJD->time_sec >= SecInDay ) { extraDays = (int) ( MJD->time_sec / SecInDay ); MJD->base_day += extraDays; MJD->time_sec -= extraDays * SecInDay; } return; } void setFromBCE( int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian ) { // utility to allow user to input dates BCE (BC) int year = 1 - yearBCE; setFromUT( year, month, day, hour, min, sec, MJD, forceJulian ); } void setFromMJD( double ModifiedJulianDate, MJDtime *MJD ) { // convert MJD double into MJD structure MJD->base_day = (int) ModifiedJulianDate; MJD->time_sec = ( ModifiedJulianDate - MJD->base_day ) * SecInDay; } void setFromJD( double JulianDate, MJDtime *MJD ) { // break JD double into MJD based structure // Note Julian Day starts Noon, so convert to MJD first MJD->base_day = (int) ( JulianDate - MJDtoJD ); MJD->time_sec = ( JulianDate - MJDtoJD - (double) MJD->base_day ) * SecInDay; } void setFromCDFepoch( double cdfepoch, MJDtime *MJD ) { // convert cdf epoch double into MJD structure // Note that cdfepoch is msec from 0 AD on the Gregorian calendar double seconds = cdfepoch * 0.001; MJD->base_day = (int) ( seconds / 86400.0 ); MJD->time_sec = seconds - MJD->base_day * SecInDay; MJD->base_day -= 678941; } double getCDFepoch( MJDtime *MJD ) { // convert MJD structure into cdf epoch double // Note that cdfepoch is msec from 0 AD on the Gregorian Calendar int days = MJD->base_day + 678941; double seconds = days * SecInDay + MJD->time_sec; return seconds * 1000.; } double getMJD( MJDtime *MJD ) { // Return MJD as a double return (double) MJD->base_day + MJD->time_sec / SecInDay; } double getJD( MJDtime *MJD ) { // Return JD as a double double JD = getMJD( MJD ) + MJDtoJD; return JD; } double getDiffDays( MJDtime *MJD1, MJDtime *MJD2 ) { // Return difference MJD1 - MJD2 in days as a double double diff = (double) ( MJD1->base_day - MJD2->base_day ) + ( MJD1->time_sec - MJD2->time_sec ) / SecInDay; return diff; } double getDiffSecs( MJDtime *MJD1, MJDtime *MJD2 ) { // Return difference MJD1 - MJD2 in seconds as a double double diff = (double) ( MJD1->base_day - MJD2->base_day ) * SecInDay + ( MJD1->time_sec - MJD2->time_sec ); return diff; } const char * getISOString( MJDtime* MJD, int delim, int forceJulian ) { // ISO time string for UTC // uses default behaviour for Julian/Gregorian switch over //** // Warning getISOString is not thread safe // as it writes to a static variable DateTime //* static char DateTime[50]; int y, m, d, hour, min; int sec1, ysign; double sec; int slen; char * ptr; breakDownMJD( &y, &m, &d, &hour, &min, &sec, MJD, forceJulian ); if ( y < 0 ) { ysign = 1; y = -y; } else ysign = 0; sec1 = (int) sec / 10; sec -= (double) sec1 * 10; if ( delim == 1 ) { if ( ysign == 0 ) sprintf( DateTime, "%04d-%02d-%02dT%02d:%02d:%01d%-11.10f", y, m + 1, d, hour, min, sec1, sec ); else sprintf( DateTime, "-%04d-%02d-%02dT%02d:%02d:%01d%-11.10f", y, m + 1, d, hour, min, sec1, sec ); // remove trailing white space while ( ( ptr = strrchr( &( DateTime[0] ), ' ' ) ) != NULL ) ptr[0] = '\0'; strcat( &( DateTime[0] ), "Z" ); } else { if ( ysign == 0 ) sprintf( DateTime, "%04d-%02d-%02d %02d:%02d:%01d%-11.10f", y, m + 1, d, hour, min, sec1, sec ); else sprintf( DateTime, "-%04d-%02d-%02d %02d:%02d:%01d%-11.10f", y, m + 1, d, hour, min, sec1, sec ); // remove trailing white space slen = strlen( DateTime ) - 1; while ( DateTime[slen] == ' ' ) { DateTime[slen] = '\0'; slen--; } } return &( DateTime[0] ); } plplot-5.10.0+dfsg/lib/qsastime/dsplint.c 644 1750 1750 720611646000332 171450ustar andrewandrew// // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // Provenance: This code was originally developed under the GPL as part of // the FreeEOS project (revision 121). This code has been converted from // Fortran to C with the aid of f2c and relicensed for PLplot under the LGPL // with the permission of the FreeEOS copyright holder (Alan W. Irwin). // #include "dsplint.h" # define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) # define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) //int dsplint(double *xa, double *ya, double *y2a, // int n, double x, double *y, double *dy, double *d2y) int dsplint( double *xa, double *ya, double *y2a, int n, double x, double *y ) { // Initialized data static int nsave = 0, khi, klo; int i__1, i__2, k; double a, b, h__; // evaluate spline = y and its derivatives dy and d2y at x given // xa, ya, y2a from dspline. // Parameter adjustments --y2a; --ya; --xa; // Function Body if ( n != nsave ) { // if call with different n value, then redo range nsave = n; klo = 1; khi = n; if ( xa[klo] > x ) { return 1; } if ( xa[khi] < x ) { return 2; } } else { // optimize range assuming continuous (ascending or // descending x calls. if ( xa[klo] > x ) { // x is descending so try next range. khi = MAX( 2, klo ); klo = khi - 1; // if x smaller than next range try lower limit. if ( xa[klo] > x ) { klo = 1; } if ( xa[klo] > x ) { return 1; } } else if ( xa[khi] <= x ) { // x is ascending so try next range. // Computing MIN i__1 = khi, i__2 = n - 1; klo = MIN( i__1, i__2 ); khi = klo + 1; // if x larger than next range try upper limit. if ( xa[khi] <= x ) { khi = n; } if ( xa[khi] < x ) { return 2; } } } while ( khi - klo > 1 ) { k = ( khi + klo ) / 2; if ( xa[k] > x ) { khi = k; } else { klo = k; } } h__ = xa[khi] - xa[klo]; if ( h__ <= 0. ) { return 3; } a = ( xa[khi] - x ) / h__; b = ( x - xa[klo] ) / h__; *y = a * ya[klo] + b * ya[khi] + ( a * ( a * a - 1. ) * y2a[klo] + b * ( b * b - 1. ) * y2a[khi] ) * ( h__ * h__ ) / 6.; // *dy = (-ya[klo] + ya[khi] + (-(a * 3. * a - 1.) * y2a[klo] + (b * 3. * b // - 1.) * y2a[khi]) * (h__ * h__) / 6.) / h__; //d2y = a * y2a[klo] + b * y2a[khi]; return 0; } plplot-5.10.0+dfsg/lib/qsastime/qsastime.xml 644 1750 1750 4721312276771565 177450ustar andrewandrew
MJDtime Routines QSAS Support Team Cluster Science Centre, Imperial College csc-support-dl@imperial.ac.uk Provided under library gnu public licence (LGPL)         These routines convert between various date and time formats. The date and time is stored internally as a structure , MJDtime, containing an integer, as the integer part of the MJD date, and a double representing the seconds offset from the start of this day. Routines exist to also set and get MJD, JD, formatted date/time strings and NASA CDF epoch date/times from this structure. Modified Julian Date (MJD) measures days (and fractional days) since the start of 17 Nov 1858 CE in Universal Time (UTC). Julian Date (JD) measures days (and fractional days) since noon on 1 January, 4713 BCE in Universal Time (UTC). Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5 Common Era (CE) and Before Common Era (BCE) are also often called AD and BC respectively. These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian). In some routines the forceJulian flag can be set to 1 to override this and explicitly use the Julian calendar in conversions. The default value for forceJulian is 0 (do not force use of Julian Calendar). Note C libraries use Gregorian only from 14 Sept 1752 and will yield different results between years 1582 and 1752.  More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php These routines have been compared with the results of the US Naval Observatory online converter.          In all routines, specifying a day, hour, minute or second field greater than would be valid is  handled with modulo arithmetic and is safe. Thus 2006-12-32 00:62:00.0 will be safely, and correctly, treated as 2007-01-01 01:02:00.0         MJD starts at 0h, so truncating MJD always gives the same day whatever the time of day (unlike JD). The seconds offset may take any value, so that any date/time may be expressed in terms of an offset from the same MJD day. The seconds field thus may exceed a single day, and may also be negative. typedef struct MJDtimeStruct {         int base_day; /* integer part of MJD  */         double time_sec; /* seconds from start of base_day */         }MJDtime; Routines void setFromUT  (int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int  forceJulian); void setFromDOY (int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian); void setFromBCE  (int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD); void setFromMJD  (double ModifiedJulianDate, MJDtime *MJD); void setFromJD  (double JulianDate, MJDtime *MJD); int setFromISOstring(const char* ISOstring, MJDtime *MJD); void setFromCDFepoch  (double cdfepoch, MJDtime *MJD); void breakDownMJD  (int *year, int *month, int *day, int *hour, int *min, double *sec,  const MJDtime *MJD, int forceJulian); double getMJD  (MJDtime *MJD); double getJD  (MJDtime *MJD); double getDiffDays  (MJDtime *MJD1, MJDtime *MJD2); double getDiffSecs  (MJDtime *MJD1, MJDtime *MJD2); double getCDFepoch  (MJDtime *MJD); const char * getISOString  (MJDtime *MJD, int delim); const char * getDayOfWeek  (const MJDtime *MJD); const char * getLongDayOfWeek  (const MJDtime *MJD); const char * getMonth  (int m); const char * getLongMonth  (int m); int getDOY  (const MJDtime *MJD, int Julian); size_t strfMJD  (char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian); Detailed Descriptions #include <MJDtime.h> void setFromUT  (int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int  forceJulian); DESCRIPTION The setFromUT() function constructs an MJDtime structure from the broken down year, month, day, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following  4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian).  Note C libraries use Gregorian only from 14 Sept 1752 onwards. void setFromDOY (int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian); DESCRIPTION The setFromDOY() function constructs an MJDtime structure from the broken down year,  day of year, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following  4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian).  Note C libraries use the Gregorian calendar only from 14 Sept 1752 onwards. void setFromBCE  (int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD); DESCRIPTION The setFromBCE() function constructs an MJDtime structure from the broken down year (BCE),  month, day, hour, minute and seconds. Note BCE years start from 0 CE, so year CE = 1 – year BCE. Julian Calendar is always used in setFromBCE(). void setFromMJD  (double ModifiedJulianDate, MJDtime *MJD); DESCRIPTION The setFromMJD() function constructs an MJDtime structure from Modified Julian Date as a double. MJD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. void setFromJD  (double JulianDate, MJDtime *MJD); DESCRIPTION The setFromJD() function constructs an MJDtime structure from Julian Date as a double. JD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. MJD = JD – 2400000.5 since JD starts at noon. int setFromISOstring(const char* ISOstring, MJDtime *MJD); DESCRIPTION The setFromISOstring() function constructs an MJDtime structure from an ISO standard format Date and time string in UTC. Gregorian Calendar is assumed from 15 Oct 1582. The ISO format is of the form "1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z". Both the ‘T’ separator and the trailing ‘Z’ are optional, and any number of decimal places after the seconds field are allowed. void setFromCDFepoch  (double cdfepoch, MJDtime *MJD); DESCRIPTION The setFromCDFepoch() function constructs an MJDtime structure from the NASA CDF Epoch as a double. CDF Epoch measures milliseconds from 0 CE (1 BCE) on the Gregorian Calendar. It is intended for use with space missions in the Common Era and will give misleading dates on the Julian Calendar. Much faster routines exist for handling conversion of CDF epochs to time strings in the modern restricted interval of applicability, but the algorithm here is consistent with the rest of the routines at all dates. void breakDownMJD  (int *year, int *month, int *day, int *hour, int *min, double *sec,  const MJDtime *MJD, int forceJulian); DESCRIPTION The brteakDownMJD() function converts an MJDtime structure into the broken down year, month, day, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following  4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian).  Note C libraries use Gregorian only from 14 Sept 1752 onwards. double getMJD  (MJDtime *MJD); DESCRIPTION The getMJD() function converts an MJDtime structure into a Modified Julian Date as a double. MJD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. double getJD  (MJDtime *MJD); DESCRIPTION The getJD() function converts an MJDtime structure into a Julian Date as a double. JD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. double getCDFepoch  (MJDtime *MJD); DESCRIPTION The getCDFepoch() function converts an MJDtime structure into the NASA CDF Epoch as a double. CDF Epoch measures milliseconds from 0 CE (1 BCE) on the Gregorian Calendar. It is intended for use with space missions in the Common Era and will give misleading dates on the Julian Calendar. Much faster routines exist for handling conversion of CDF epochs to time strings in the modern restricted interval of applicability, but the algorithm here is consistent with the rest of the routines at all dates. const char * getISOString  (MJDtime *MJD, int delim); DESCRIPTION The getISOString() function converts an MJDtime structure into an ISO date/time string measured in UTC. Uses the default change over date for Julian to Gregorian calendars, 15 Oct 1582. If delim is 1 then the ‘T’ and ‘Z’ delimiters are used, otherwise the date and time part are space separated. The resulting string is of the form "1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z".   It returns a pointer to a static string and is therefore not thread safe. The returned string must be copied if it is to be retained beyond a repeat call, for example : printf("%s Julian =  %s Gregorian \n" , getISOString(&MJD1,1), getISOString(&MJD1,0)); will use the same string twice rather than distinct strings. This is only a convenience utility for quick testing and simple use, and is equivalent to the (thread safe) strfMJD() call which is preferred for robust coding. The equivalent call would be …    char buf[360];    strfMJD(&(buf[0]), 360, "%Y-%m-%dT%H:%M:%S%.Z",  &MJD2, 0); (note the decimal point before the final Z gives all available accuracy for the seconds fraction). Also, for a specific accuracy, e.g. microseconds, use strfMJD() as in… strfMJD(&(buf[0]), 360, "%Y-%m-%d %H:%M:%S%6",  &MJD2, 0); double getDiffDays  (MJDtime *MJD1, MJDtime *MJD2); DESCRIPTION The getDiffDays() function returns the difference between two MJDtime structures measured in days as a double. The MJDtime structures do not need to have the same base day. double getDiffSecs  (MJDtime *MJD1, MJDtime *MJD2); DESCRIPTION The getDiffSecs() function returns the difference between two MJDtime structures measured in seconds as a double. The MJDtime structures do not need to have the same base day. const char * getDayOfWeek  (const MJDtime *MJD); DESCRIPTION The getDayOfWeek() function returns a char * pointer to a static null terminated string holding the short (3 character) text name for the day, in English, e.g. Mon, Tue, etc. const char * getLongDayOfWeek  (const MJDtime *MJD); DESCRIPTION The getLongDayOfWeek() function returns a char * pointer to a static null terminated string holding the full text name for the day, in English, e.g. Monday, Tuesday, etc. const char * getMonth  (int m); DESCRIPTION The getMonth() function returns a char * pointer to a static null terminated string holding the short (3 character) text name for the month, in English, e.g. Jan, Feb, etc. const char * getLongMonth  (int m); DESCRIPTION The getLongMonth() function returns a char * pointer to a static null terminated string holding the full text name for the month, in English, e.g. January, February, etc. int getDOY  (const MJDtime *MJD, int forceJulian); DESCRIPTION The getDOY() function returns the day of year as an int for the current day in the MJDtime structure MJD. If seconds are negative or hold more than one day the day is adjusted accordingly, thus it is not simply the doy for the integer part of the MJDtime structure. If the forceJulian flag is set to 1 the Julian calendar is used, otherwise the Gregorian calendar is used from the day following  4 Oct, 1582 (Julian) i.e. from 15 Oct, 1582 (Gregorian).  Note C libraries use Gregorian only from 14 Sept, 1752 onwards. size_t  strfMJD  (char * buf, size_t len,  const char * format, const MJDtime MJD); DESCRIPTION The strfMJD () function formats the information from MJD into the buffer buf according to the string pointed to by format using the formatting conventions of strftime(); The format string consists of zero or more conversion specifications and ordinary characters.  All ordinary characters are copied directly into the buffer.  A conversion specification consists of a percent sign `%' and one other character. No more than len characters will be placed into the array, including the terminating NULL. strfMJD () returns the number of characters written into the array, not counting the terminating NULL. The output is truncated when len - 1 characters is reached. This routine differs from strftime() in that all date/times are in UTC and no locale or national variations in names are used. All names are returned in English. The conversion specifications are copied to the buffer after expansion as follows:- %A   is replaced by a representation of the full weekday name. %a    is replaced by a representation of the abbreviated weekday name. %B    is replaced by a representation of the full month name. %b    is replaced by a representation of the abbreviated month name. %C   is replaced by (year / 100) as decimal number; single digits are preceded by a zero. %c    is replaced by a representation of time and date. %D   is equivalent to ``%m/%d/%y''. %d    is replaced by the day of the month as a decimal number (01-31). %e    is replaced by the day of month as a decimal number (1-31); single digits are preceded by a blank. %F    is equivalent to ``%Y-%m-%d''. %G   is replaced by a year as a decimal number with century.  This year is the one that contains the greater part of the week (Monday as the first day of the week). %g    is replaced by the same year as in ``%G'', but as a decimal number without century (00-99). %H    is replaced by the hour (24-hour clock) as a decimal number (00-23). %h    the same as %b. %I    is replaced by the hour (12-hour clock) as a decimal number (01-12). %j    is replaced by the day of the year as a decimal number (001-366). %k    is replaced by the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank. %l    is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank. %M   is replaced by the minute as a decimal number (00-59). %m    is replaced by the month as a decimal number (01-12). %n    is replaced by a newline. %p    is replaced by ‘AM’ or ‘PM’ as appropriate. %R    is equivalent to ‘%H:%M’. %r    is equivalent to ‘%I:%M:%S %p’. %S    is replaced by the second as a decimal number (00-60). %s    is replaced by the number of seconds since 1 Jan 1970, UTC. %T    is equivalent to ‘%H:%M:%S’. %t    is replaced by a tab. %U   is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number (00-53). %u    is replaced by the weekday (Monday as the first day of the week) as a decimal number (1-7). %V   is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (01-53).  If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next week is week 1. %v    is equivalent to ‘%e-%b-%Y’. %W  is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (00-53). %w   is replaced by the weekday (Sunday as the first day of the week) as a decimal number (0-6). %X   is replaced by a representation of the time. %x   is replaced by a representation of the date. %Y   is replaced by the year with century as a decimal number. %y    is replaced by the year without century as a decimal number (00-99). %Z    is replaced by the time zone name. %z    is replaced by the time zone offset from UTC; a leading plus sign stands for east of UTC, a minus sign for west of UTC, hours and minutes follow with two digits each and no delimiter between them (always gives ‘+0000’). %+    is replaced by a representation of the date and time of the form Fri Jan 23 15:06:10 UTC 2009 %%    is replaced by ‘%’. The following extra two option flags are also provided although they are not available in the strftime() routines. %(0-9)      is replaced by the fractional part of the seconds field to the specified accuracy. Thus %S%3 would give seconds to millisecond accuracy (00.000). %.     (decimal point) is replaced by the fractional part of the seconds field to available accuracy. Thus %S%. would give seconds with fractional part up to 9 decimal places if available. Spaces are removed from the end of the string but zeros are left. This may behave slightly differently on different platforms. All other flags are silently ignored and not printed.
plplot-5.10.0+dfsg/lib/qsastime/qsastime.h 644 1750 1750 511112276771565 173430ustar andrewandrew#ifndef _QSASTIME_H_ #define _QSASTIME_H_ // // This software originally contributed under the LGPL in January 2009 to // PLplot by the // Cluster Science Centre // QSAS team, // Imperial College, London // Copyright (C) 2009 Imperial College, London // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // MJD measures from the start of 17 Nov 1858 // These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 Gregorian // Note C libraries use Gregorian only from 14 Sept 1752 // More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php // These routines have been compared with the results of the US Naval Observatory online converter. // Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5 // // In all routines, specifying a day, hour, minute or second field greater than would be valid is // handled with modulo arithmetic and safe. // Thus 2006-12-32 00:62:00.0 will safely, and correctly, be treated as 2007-01-01 01:02:00.0 // // #include #include #include // include header file for dll definitions #include "qsastimedll.h" struct QSASConfigStruct; typedef struct QSASConfigStruct QSASConfig; // externally accessible functions QSASTIMEDLLIMPEXP void configqsas( double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec, QSASConfig **qsasconfig ); QSASTIMEDLLIMPEXP void closeqsas( QSASConfig **qsasconfig ); QSASTIMEDLLIMPEXP int ctimeqsas( int year, int month, int day, int hour, int min, double sec, double * ctime, QSASConfig *qsasconfig ); QSASTIMEDLLIMPEXP void btimeqsas( int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime, QSASConfig *qsasconfig ); QSASTIMEDLLIMPEXP size_t strfqsas( char * buf, size_t len, const char *format, double ctime, QSASConfig *qsasconfig ); #endif plplot-5.10.0+dfsg/lib/qsastime/README.qsastime_API 644 1750 1750 1650611147636012 205530ustar andrewandrewThe desired API for libqsastime should consist of just five functions that are actually publicly visible. ========================= void configqsas(double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec, QSASCONFIG **qsasconfig); Within this routine if ifbtime_offset is false, then the broken-down time arguments are ignored. If ifbtime_offset is true, then the input offset1 and offset2 values are ignored, and instead, the broken-down time values are used to calculate offset1 and offset2 with the help of an internal call to setFromUT. If *qsasconfig is NULL, this routine allocates memory for a QSASCONFIG struct and points *qsaconfig to that memory location. It initializes the four variables encapsulated in that struct with scale, offset1, offset2, and ccontrol. Further details of the meaning of these four variables is contained in qsastime.h. The special pointer to a pointer QSASCONFIG argument is required so that the external pointer can be changed if/when the memory is allocated. Although this API gives the user a large degree of flexibility in choosing the transformation between broken-down time and continuous time, a number of combinations of offset1, offset2, scale, and ccontrol are documented below for some common time system transformations to guide the user. (Some of these are currently just placeholders.) Broken- Contin- offset1 offset2 scale correction Notes down uous time time Civil MJD (TT) 0. 0. 1. 1 1, 2, 3 Civil JD (TT) 2400000. 0.5 1. 1 2, 3 TT MJD (TT) 0. 0. 1. 0 4 TT MJD (TAI) 0. -0.0003725 1. 0 5 TT TT 0. 0. 86400. 0 6 Specific notes for the table. 1. These offset1, offset2, scale, and correction values are the library default if the user does not call time_config at all. 2. We define civil time as the civil time on the prime meridian. (The user is responsible for converting their local time to civil time using their locale data for time zone and daylight savings time adjustment). Currently, our civil time corresponds to UTC as defined in note 3. 3. We use the file at http://maia.usno.navy.mil/ser7/tai-utc.dat to define the relationship between UTC and TAI (and thus TT) for correction = 1. For epochs prior to the starting date of that file (1961-01-01 = JD 2437300.5 UTC) we assume the same TAI-UTC offset of 1.422818 seconds as for the starting date of that file. This assumption of no variation in the earth rotation rate prior to 1961 is obviously not correct so that the TT derived from our code will not be reliable prior to that date. That is, if you use GMT (a historical backwards extension of UTC corresponding to civil time for the prime meridian) for broken down time prior to 1961, the TT result you will get will not produce a good approximation to the historical ephemeris time that is the correct backwards extension of TT, see http://en.wikipedia.org/wiki/Ephemeris_time. For epochs after the ending date of that file (currently 2009-01-01 = JD 2454832.5 UTC) we assume the same TAI-UTC offset (currently 34 seconds) as for the ending date of that file, i.e., we assume no leap seconds after the ending date of the file. Insertion of leap seconds cannot be predicted years in advance (because future predictions of the earth rotation rate are not reliable on such time scales) so the transformation between civil time (UTC) and TT cannot be known years in advance. However, the approximation of assuming no leap seconds after the end of the file should be correct on time scales less than roughly a year so when a decision is made in advance to insert an official leap second, there should be plenty of time for that decision to propagate to http://maia.usno.navy.mil/ser7/tai-utc.dat and ultimately our code releases. Thus, so long as we make releases on a timely basis, our calculation of TT for current epochs should always be reliable. 2. I haven't checked the code yet, but I assume this relationship holds for all transformations between broken-down time and continuous time in MJD when the broken-down time and continuous time are defined on the same continuous time scale (TT in this case). All other relationships are derived from the known offsets with respect to TT and differences between MJD epochs and native (TT, TAI, etc.) epochs. 3. Offset derived from definition TT = TAI + 32.184 s = TAI + 0.0003725 d 4. Continuous times (e.g., TT) without further designation are in seconds since the native (e.g., TT) epoch. NEEDS WORK to figure out offset. 5. the POSIX time standard of seconds since the Unix epoch is actually discontinuous (see remarks in http://en.wikipedia.org/wiki/Unix_Time). So our "Unix (TAI)" continuous time scale (NOT YET IN THE TABLE) corresponds to the continuous "International Atomic Time-based variant" discussed in the above article. NEEDS FURTHER INVESTIGATION. dTT/dTCG = 1-LG, where LG = 6.969290134D-10, IAU Resolution B1.9 Re-definition of Terrestrial Time TT, http://syrte.obspm.fr/IAU_resolutions/Resol-UAI.htm Time ephemeris reference is Irwin and Fukushima, 1999, http://adsabs.harvard.edu/full/1999A&A...348..642I). ========================= void closeqsas (QSASCONFIG **qsasconfig): This routine closes the library by freeing memory allocated for qsasconfig if *qsaconfig is non-NULL and sets *qsasconfig to NULL. The special pointer to a pointer QSASCONFIG argument is required in order to change the external pointer. ========================= void ctimeqsas (int year, int month, int day, int hour, int min, double sec, double *ctime, const QSASCONFIG *qsasconfig); Determine continuous time (ctime). Wraps the existing internal (not visible by default) setFromUT to use the four variables in qsasconfig discussed above in the transformation from broken-down-time to ctime. Note, because of the transformation implied by the four variables mentioned above, the ctime result can be stored in just a double assuming the user has picked a reasonable epoch that is not so distant from his plotted range of times that it causes a noticable loss of numerical precision. ========================= void btimeqsas (int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime, const QSASCONFIG *qsasconfig); Determine broken-down time (btime). This is the inverse of ctimeqsas. It wraps the existing internal (not visible by default) breakDownMJD to use the four variables in qsasconfig discussed above in the transformation from ctime to btime. Note, because of the transformation implied by the four variables, the input ctime can be just a double assuming the user has picked a reasonable epoch that is not so distant from his plotted range of times that it causes a noticable loss of numerical precision. ========================= size_t strfqsas (char * buf, size_t len, const char * format, const double ctime, const QSASCONFIG *qsasconfig); This wraps the existing internal (not visible by default) strfMJD to use the four variables in qsasconfig discussed above in the transformation from ctime to btime. Note, because of the transformation implied by the four variables, the input ctime can be just a double assuming the user has picked a reasonable epoch that is not so distant from his plotted range of times that it causes a noticable loss of numerical precision. ========================= plplot-5.10.0+dfsg/lib/qsastime/README.deltaT.dat 644 1750 1750 75511212540525 201530ustar andrewandrewThe data in DeltaT.dat were taken from what appears to be the definitive work which is Table 1 of Title: Historical values of the Earth's clock error ΔT and the calculation of eclipses Authors: Morrison, L. V.; Stephenson, F. R. Publication: Journal for the History of Astronomy (ISSN 0021-8286), Vol. 35, Part 3, No. 120, p. 327 - 336 (2004) Publication Date: 08/2004 The above bibliographic data and link to the paper was taken from http://adsabs.harvard.edu/abs/2004JHA....35..327M plplot-5.10.0+dfsg/lib/qsastime/dsplint.h 644 1750 1750 166111646000332 171510ustar andrewandrew#ifndef _DSPLINT_H_ #define _DSPLINT_H_ // // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA int dsplint( double *xa, double *ya, double *y2a, int n, double x, double *y ); #endif // _DSPLINT_H_ plplot-5.10.0+dfsg/lib/qsastime/qsastime.txt 644 1750 1750 3775312276771565 177740ustar andrewandrewMJDtime Routines QSAS Support Team Cluster Science Centre, Imperial College csc-support-dl@imperial.ac.uk Provided under library gnu public licence (LGPL). These routines convert between various date and time formats. The date and time is stored internally as a structure , MJDtime, containing an integer, as the integer part of the MJD date, and a double representing the seconds offset from the start of this day. Routines exist to also set and get MJD, JD, formatted date/time strings and NASA CDF epoch date/times from this structure. Modified Julian Date (MJD) measures days (and fractional days) since the start of 17 Nov 1858 CE in Universal Time (UTC). Julian Date (JD) measures days (and fractional days) since noon on 1 January, 4713 BCE in Universal Time (UTC). Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5 Common Era (CE) and Before Common Era (BCE) are also often called AD and BC respectively. These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian). In some routines the forceJulian flag can be set to 1 to override this and explicitly use the Julian calendar in conversions. The default value for forceJulian is 0 (do not force use of Julian Calendar). Note C libraries use Gregorian only from 14 Sept 1752 and will yield different results between years 1582 and 1752. More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php These routines have been compared with the results of the US Naval Observatory online converter. In all routines, specifying a day, hour, minute or second field greater than would be valid is handled with modulo arithmetic and is safe. Thus 2006-12-32 00:62:00.0 will be safely, and correctly, treated as 2007-01-01 01:02:00.0 MJD starts at 0h, so truncating MJD always gives the same day whatever the time of day (unlike JD). The seconds offset may take any value, so that any date/time may be expressed in terms of an offset from the same MJD day. The seconds field thus may exceed a single day, and may also be negative. typedef struct MJDtimeStruct { int base_day; /* integer part of MJD */ double time_sec; /* seconds from start of base_day */ }MJDtime; Routines void setFromUT (int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian); void setFromDOY (int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian); void setFromBCE (int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD); void setFromMJD (double ModifiedJulianDate, MJDtime *MJD); void setFromJD (double JulianDate, MJDtime *MJD); int setFromISOstring(const char* ISOstring, MJDtime *MJD); void setFromCDFepoch (double cdfepoch, MJDtime *MJD); void breakDownMJD (int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian); double getMJD (MJDtime *MJD); double getJD (MJDtime *MJD); double getDiffDays (MJDtime *MJD1, MJDtime *MJD2); double getDiffSecs (MJDtime *MJD1, MJDtime *MJD2); double getCDFepoch (MJDtime *MJD); const char * getISOString (MJDtime *MJD, int delim); const char * getDayOfWeek (const MJDtime *MJD); const char * getLongDayOfWeek (const MJDtime *MJD); const char * getMonth (int m); const char * getLongMonth (int m); int getDOY (const MJDtime *MJD, int Julian); size_t strfMJD (char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian); Detailed Descriptions #include void setFromUT (int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian); DESCRIPTION The setFromUT() function constructs an MJDtime structure from the broken down year, month, day, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian). Note C libraries use Gregorian only from 14 Sept 1752 onwards. void setFromDOY (int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian); DESCRIPTION The setFromDOY() function constructs an MJDtime structure from the broken down year, day of year, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian). Note C libraries use the Gregorian calendar only from 14 Sept 1752 onwards. void setFromBCE (int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD); DESCRIPTION The setFromBCE() function constructs an MJDtime structure from the broken down year (BCE), month, day, hour, minute and seconds. Note BCE years start from 0 CE, so year CE = 1 – year BCE. Julian Calendar is always used in setFromBCE(). void setFromMJD (double ModifiedJulianDate, MJDtime *MJD); DESCRIPTION The setFromMJD() function constructs an MJDtime structure from Modified Julian Date as a double. MJD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. void setFromJD (double JulianDate, MJDtime *MJD); DESCRIPTION The setFromJD() function constructs an MJDtime structure from Julian Date as a double. JD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. MJD = JD – 2400000.5 since JD starts at noon. int setFromISOstring(const char* ISOstring, MJDtime *MJD); DESCRIPTION The setFromISOstring() function constructs an MJDtime structure from an ISO standard format Date and time string in UTC. Gregorian Calendar is assumed from 15 Oct 1582. The ISO format is of the form "1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z". Both the ‘T’ separator and the trailing ‘Z’ are optional, and any number of decimal places after the seconds field are allowed. void setFromCDFepoch (double cdfepoch, MJDtime *MJD); DESCRIPTION The setFromCDFepoch() function constructs an MJDtime structure from the NASA CDF Epoch as a double. CDF Epoch measures milliseconds from 0 CE (1 BCE) on the Gregorian Calendar. It is intended for use with space missions in the Common Era and will give misleading dates on the Julian Calendar. Much faster routines exist for handling conversion of CDF epochs to time strings in the modern restricted interval of applicability, but the algorithm here is consistent with the rest of the routines at all dates. void breakDownMJD (int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian); DESCRIPTION The brteakDownMJD() function converts an MJDtime structure into the broken down year, month, day, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian). Note C libraries use Gregorian only from 14 Sept 1752 onwards. double getMJD (MJDtime *MJD); DESCRIPTION The getMJD() function converts an MJDtime structure into a Modified Julian Date as a double. MJD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. double getJD (MJDtime *MJD); DESCRIPTION The getJD() function converts an MJDtime structure into a Julian Date as a double. JD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. double getCDFepoch (MJDtime *MJD); DESCRIPTION The getCDFepoch() function converts an MJDtime structure into the NASA CDF Epoch as a double. CDF Epoch measures milliseconds from 0 CE (1 BCE) on the Gregorian Calendar. It is intended for use with space missions in the Common Era and will give misleading dates on the Julian Calendar. Much faster routines exist for handling conversion of CDF epochs to time strings in the modern restricted interval of applicability, but the algorithm here is consistent with the rest of the routines at all dates. const char * getISOString (MJDtime *MJD, int delim); DESCRIPTION The getISOString() function converts an MJDtime structure into an ISO date/time string measured in UTC. Uses the default change over date for Julian to Gregorian calendars, 15 Oct 1582. If delim is 1 then the ‘T’ and ‘Z’ delimiters are used, otherwise the date and time part are space separated. The resulting string is of the form "1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z". It returns a pointer to a static string and is therefore not thread safe. The returned string must be copied if it is to be retained beyond a repeat call, for example : printf("%s Julian = %s Gregorian \n" , getISOString(&MJD1,1), getISOString(&MJD1,0)); will use the same string twice rather than distinct strings. This is only a convenience utility for quick testing and simple use, and is equivalent to the (thread safe) strfMJD() call which is preferred for robust coding. The equivalent call would be … char buf[360]; strfMJD(&(buf[0]), 360, "%Y-%m-%dT%H:%M:%S%.Z", &MJD2, 0); (note the decimal point before the final Z gives all available accuracy for the seconds fraction). Also, for a specific accuracy, e.g. microseconds, use strfMJD() as in… strfMJD(&(buf[0]), 360, "%Y-%m-%d %H:%M:%S%6", &MJD2, 0); double getDiffDays (MJDtime *MJD1, MJDtime *MJD2); DESCRIPTION The getDiffDays() function returns the difference between two MJDtime structures measured in days as a double. The MJDtime structures do not need to have the same base day. double getDiffSecs (MJDtime *MJD1, MJDtime *MJD2); DESCRIPTION The getDiffSecs() function returns the difference between two MJDtime structures measured in seconds as a double. The MJDtime structures do not need to have the same base day. const char * getDayOfWeek (const MJDtime *MJD); DESCRIPTION The getDayOfWeek() function returns a char * pointer to a static null terminated string holding the short (3 character) text name for the day, in English, e.g. Mon, Tue, etc. const char * getLongDayOfWeek (const MJDtime *MJD); DESCRIPTION The getLongDayOfWeek() function returns a char * pointer to a static null terminated string holding the full text name for the day, in English, e.g. Monday, Tuesday, etc. const char * getMonth (int m); DESCRIPTION The getMonth() function returns a char * pointer to a static null terminated string holding the short (3 character) text name for the month, in English, e.g. Jan, Feb, etc. const char * getLongMonth (int m); DESCRIPTION The getLongMonth() function returns a char * pointer to a static null terminated string holding the full text name for the month, in English, e.g. January, February, etc. int getDOY (const MJDtime *MJD, int forceJulian); DESCRIPTION The getDOY() function returns the day of year as an int for the current day in the MJDtime structure MJD. If seconds are negative or hold more than one day the day is adjusted accordingly, thus it is not simply the doy for the integer part of the MJDtime structure. If the forceJulian flag is set to 1 the Julian calendar is used, otherwise the Gregorian calendar is used from the day following 4 Oct, 1582 (Julian) i.e. from 15 Oct, 1582 (Gregorian). Note C libraries use Gregorian only from 14 Sept, 1752 onwards. size_t strfMJD (char * buf, size_t len, const char * format, const MJDtime MJD); DESCRIPTION The strfMJD () function formats the information from MJD into the buffer buf according to the string pointed to by format using the formatting conventions of strftime(); The format string consists of zero or more conversion specifications and ordinary characters. All ordinary characters are copied directly into the buffer. A conversion specification consists of a percent sign `%' and one other character. No more than len characters will be placed into the array, including the terminating NULL. strfMJD () returns the number of characters written into the array, not counting the terminating NULL. The output is truncated when len - 1 characters is reached. This routine differs from strftime() in that all date/times are in UTC and no locale or national variations in names are used. All names are returned in English. The conversion specifications are copied to the buffer after expansion as follows:- %A is replaced by a representation of the full weekday name. %a is replaced by a representation of the abbreviated weekday name. %B is replaced by a representation of the full month name. %b is replaced by a representation of the abbreviated month name. %C is replaced by (year / 100) as decimal number; single digits are preceded by a zero. %c is replaced by a representation of time and date. %D is equivalent to ``%m/%d/%y''. %d is replaced by the day of the month as a decimal number (01-31). %e is replaced by the day of month as a decimal number (1-31); single digits are preceded by a blank. %F is equivalent to ``%Y-%m-%d''. %G is replaced by a year as a decimal number with century. This year is the one that contains the greater part of the week (Monday as the first day of the week). %g is replaced by the same year as in ``%G'', but as a decimal number without century (00-99). %H is replaced by the hour (24-hour clock) as a decimal number (00-23). %h the same as %b. %I is replaced by the hour (12-hour clock) as a decimal number (01-12). %j is replaced by the day of the year as a decimal number (001-366). %k is replaced by the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank. %l is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank. %M is replaced by the minute as a decimal number (00-59). %m is replaced by the month as a decimal number (01-12). %n is replaced by a newline. %p is replaced by ‘AM’ or ‘PM’ as appropriate. %R is equivalent to ‘%H:%M’. %r is equivalent to ‘%I:%M:%S %p’. %S is replaced by the second as a decimal number (00-60). %s is replaced by the number of seconds since 1 Jan 1970, UTC. %T is equivalent to ‘%H:%M:%S’. %t is replaced by a tab. %U is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number (00-53). %u is replaced by the weekday (Monday as the first day of the week) as a decimal number (1-7). %V is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (01-53). If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next week is week 1. %v is equivalent to ‘%e-%b-%Y’. %W is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (00-53). %w is replaced by the weekday (Sunday as the first day of the week) as a decimal number (0-6). %X is replaced by a representation of the time. %x is replaced by a representation of the date. %Y is replaced by the year with century as a decimal number. %y is replaced by the year without century as a decimal number (00-99). %Z is replaced by the time zone name. %z is replaced by the time zone offset from UTC; a leading plus sign stands for east of UTC, a minus sign for west of UTC, hours and minutes follow with two digits each and no delimiter between them (always gives ‘+0000’). %+ is replaced by a representation of the date and time of the form Fri Jan 23 15:06:10 UTC 2009 %% is replaced by ‘%’. The following extra two option flags are also provided although they are not available in the strftime() routines. %(0-9) is replaced by the fractional part of the seconds field to the specified accuracy. Thus %S%3 would give seconds to millisecond accuracy (00.000). %. (decimal point) is replaced by the fractional part of the seconds field to available accuracy. Thus %S%. would give seconds with fractional part up to 9 decimal places if available. Spaces are removed from the end of the string but zeros are left. This may behave slightly differently on different platforms. All other flags are silently ignored and not printed. plplot-5.10.0+dfsg/lib/qsastime/qsastime_testlib.out_standard 644 1750 1750 23505611153061356 233650ustar andrewandrewsizeof(time_t) = 8 sizeof(int) = 4 Test 01 of calendar dates in the vicinity of the JD epoch Start of Julian proleptic inner test input and output (strfMJD) date/time -4717-01-01T12:00:00.000000000000000Z -4717-01-01T12:00:00.0Z setFromUT JD = -1826.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4717-01-01T12:00:00.000000000000000Z -4717-01-01T12:00:00Z -4717-01-01T12:00:00.0Z setFromUT JD = -1788.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4716-01-01T12:00:00.000000000000000Z -4716-01-01T12:00:00.0Z setFromUT JD = -1461.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4716-01-01T12:00:00.000000000000000Z -4716-01-01T12:00:00Z -4716-01-01T12:00:00.0Z setFromUT JD = -1423.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4715-01-01T12:00:00.000000000000000Z -4715-01-01T12:00:00.0Z setFromUT JD = -1095.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4715-01-01T12:00:00.000000000000000Z -4715-01-01T12:00:00Z -4715-01-01T12:00:00.0Z setFromUT JD = -1057.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4714-01-01T12:00:00.000000000000000Z -4714-01-01T12:00:00.0Z setFromUT JD = -730.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4714-01-01T12:00:00.000000000000000Z -4714-01-01T12:00:00Z -4714-01-01T12:00:00.0Z setFromUT JD = -692.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4713-01-01T12:00:00.000000000000000Z -4713-01-01T12:00:00.0Z setFromUT JD = -365.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4713-01-01T12:00:00.000000000000000Z -4713-01-01T12:00:00Z -4713-01-01T12:00:00.0Z setFromUT JD = -327.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4712-01-01T12:00:00.000000000000000Z -4712-01-01T12:00:00.0Z setFromUT JD = 0.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4712-01-01T12:00:00.000000000000000Z -4712-01-01T12:00:00Z -4712-01-01T12:00:00.0Z setFromUT JD = 38.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4711-01-01T12:00:00.000000000000000Z -4711-01-01T12:00:00.0Z setFromUT JD = 366.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4711-01-01T12:00:00.000000000000000Z -4711-01-01T12:00:00Z -4711-01-01T12:00:00.0Z setFromUT JD = 404.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4710-01-01T12:00:00.000000000000000Z -4710-01-01T12:00:00.0Z setFromUT JD = 731.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4710-01-01T12:00:00.000000000000000Z -4710-01-01T12:00:00Z -4710-01-01T12:00:00.0Z setFromUT JD = 769.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4709-01-01T12:00:00.000000000000000Z -4709-01-01T12:00:00.0Z setFromUT JD = 1096.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4709-01-01T12:00:00.000000000000000Z -4709-01-01T12:00:00Z -4709-01-01T12:00:00.0Z setFromUT JD = 1134.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4708-01-01T12:00:00.000000000000000Z -4708-01-01T12:00:00.0Z setFromUT JD = 1461.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4708-01-01T12:00:00.000000000000000Z -4708-01-01T12:00:00Z -4708-01-01T12:00:00.0Z setFromUT JD = 1499.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4707-01-01T12:00:00.000000000000000Z -4707-01-01T12:00:00.0Z setFromUT JD = 1827.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4707-01-01T12:00:00.000000000000000Z -4707-01-01T12:00:00Z -4707-01-01T12:00:00.0Z setFromUT JD = 1865.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4717-02-28T12:00:00.000000000000000Z -4717-02-28T12:00:00.0Z setFromUT JD = -1768.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4717-02-28T12:00:00.000000000000000Z -4717-02-28T12:00:00Z -4717-02-28T12:00:00.0Z setFromUT JD = -1730.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4716-02-28T12:00:00.000000000000000Z -4716-02-28T12:00:00.0Z setFromUT JD = -1403.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4716-02-28T12:00:00.000000000000000Z -4716-02-28T12:00:00Z -4716-02-28T12:00:00.0Z setFromUT JD = -1365.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4715-02-28T12:00:00.000000000000000Z -4715-02-28T12:00:00.0Z setFromUT JD = -1037.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4715-02-28T12:00:00.000000000000000Z -4715-02-28T12:00:00Z -4715-02-28T12:00:00.0Z setFromUT JD = -999.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4714-02-28T12:00:00.000000000000000Z -4714-02-28T12:00:00.0Z setFromUT JD = -672.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4714-02-28T12:00:00.000000000000000Z -4714-02-28T12:00:00Z -4714-02-28T12:00:00.0Z setFromUT JD = -634.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4713-02-28T12:00:00.000000000000000Z -4713-02-28T12:00:00.0Z setFromUT JD = -307.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4713-02-28T12:00:00.000000000000000Z -4713-02-28T12:00:00Z -4713-02-28T12:00:00.0Z setFromUT JD = -269.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4712-02-28T12:00:00.000000000000000Z -4712-02-28T12:00:00.0Z setFromUT JD = 58.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4712-02-28T12:00:00.000000000000000Z -4712-02-28T12:00:00Z -4712-02-28T12:00:00.0Z setFromUT JD = 96.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4711-02-28T12:00:00.000000000000000Z -4711-02-28T12:00:00.0Z setFromUT JD = 424.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4711-02-28T12:00:00.000000000000000Z -4711-02-28T12:00:00Z -4711-02-28T12:00:00.0Z setFromUT JD = 462.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4710-02-28T12:00:00.000000000000000Z -4710-02-28T12:00:00.0Z setFromUT JD = 789.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4710-02-28T12:00:00.000000000000000Z -4710-02-28T12:00:00Z -4710-02-28T12:00:00.0Z setFromUT JD = 827.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4709-02-28T12:00:00.000000000000000Z -4709-02-28T12:00:00.0Z setFromUT JD = 1154.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4709-02-28T12:00:00.000000000000000Z -4709-02-28T12:00:00Z -4709-02-28T12:00:00.0Z setFromUT JD = 1192.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4708-02-28T12:00:00.000000000000000Z -4708-02-28T12:00:00.0Z setFromUT JD = 1519.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4708-02-28T12:00:00.000000000000000Z -4708-02-28T12:00:00Z -4708-02-28T12:00:00.0Z setFromUT JD = 1557.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4707-02-28T12:00:00.000000000000000Z -4707-02-28T12:00:00.0Z setFromUT JD = 1885.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4707-02-28T12:00:00.000000000000000Z -4707-02-28T12:00:00Z -4707-02-28T12:00:00.0Z setFromUT JD = 1923.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4717-02-29T12:00:00.000000000000000Z -4717-03-01T12:00:00.0Z setFromUT JD = -1767.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4717-02-29T12:00:00.000000000000000Z -4717-03-01T12:00:00Z -4717-03-01T12:00:00.0Z setFromUT JD = -1729.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4716-02-29T12:00:00.000000000000000Z -4716-02-29T12:00:00.0Z setFromUT JD = -1402.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4716-02-29T12:00:00.000000000000000Z -4716-02-29T12:00:00Z -4716-02-29T12:00:00.0Z setFromUT JD = -1364.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4715-02-29T12:00:00.000000000000000Z -4715-03-01T12:00:00.0Z setFromUT JD = -1036.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4715-02-29T12:00:00.000000000000000Z -4715-03-01T12:00:00Z -4715-03-01T12:00:00.0Z setFromUT JD = -998.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4714-02-29T12:00:00.000000000000000Z -4714-03-01T12:00:00.0Z setFromUT JD = -671.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4714-02-29T12:00:00.000000000000000Z -4714-03-01T12:00:00Z -4714-03-01T12:00:00.0Z setFromUT JD = -633.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4713-02-29T12:00:00.000000000000000Z -4713-03-01T12:00:00.0Z setFromUT JD = -306.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4713-02-29T12:00:00.000000000000000Z -4713-03-01T12:00:00Z -4713-03-01T12:00:00.0Z setFromUT JD = -268.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4712-02-29T12:00:00.000000000000000Z -4712-02-29T12:00:00.0Z setFromUT JD = 59.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4712-02-29T12:00:00.000000000000000Z -4712-02-29T12:00:00Z -4712-02-29T12:00:00.0Z setFromUT JD = 97.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4711-02-29T12:00:00.000000000000000Z -4711-03-01T12:00:00.0Z setFromUT JD = 425.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4711-02-29T12:00:00.000000000000000Z -4711-03-01T12:00:00Z -4711-03-01T12:00:00.0Z setFromUT JD = 463.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4710-02-29T12:00:00.000000000000000Z -4710-03-01T12:00:00.0Z setFromUT JD = 790.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4710-02-29T12:00:00.000000000000000Z -4710-03-01T12:00:00Z -4710-03-01T12:00:00.0Z setFromUT JD = 828.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4709-02-29T12:00:00.000000000000000Z -4709-03-01T12:00:00.0Z setFromUT JD = 1155.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4709-02-29T12:00:00.000000000000000Z -4709-03-01T12:00:00Z -4709-03-01T12:00:00.0Z setFromUT JD = 1193.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4708-02-29T12:00:00.000000000000000Z -4708-02-29T12:00:00.0Z setFromUT JD = 1520.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4708-02-29T12:00:00.000000000000000Z -4708-02-29T12:00:00Z -4708-02-29T12:00:00.0Z setFromUT JD = 1558.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4707-02-29T12:00:00.000000000000000Z -4707-03-01T12:00:00.0Z setFromUT JD = 1886.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4707-02-29T12:00:00.000000000000000Z -4707-03-01T12:00:00Z -4707-03-01T12:00:00.0Z setFromUT JD = 1924.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4717-03-01T12:00:00.000000000000000Z -4717-03-01T12:00:00.0Z setFromUT JD = -1767.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4717-03-01T12:00:00.000000000000000Z -4717-03-01T12:00:00Z -4717-03-01T12:00:00.0Z setFromUT JD = -1729.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4716-03-01T12:00:00.000000000000000Z -4716-03-01T12:00:00.0Z setFromUT JD = -1401.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4716-03-01T12:00:00.000000000000000Z -4716-03-01T12:00:00Z -4716-03-01T12:00:00.0Z setFromUT JD = -1363.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4715-03-01T12:00:00.000000000000000Z -4715-03-01T12:00:00.0Z setFromUT JD = -1036.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4715-03-01T12:00:00.000000000000000Z -4715-03-01T12:00:00Z -4715-03-01T12:00:00.0Z setFromUT JD = -998.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4714-03-01T12:00:00.000000000000000Z -4714-03-01T12:00:00.0Z setFromUT JD = -671.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4714-03-01T12:00:00.000000000000000Z -4714-03-01T12:00:00Z -4714-03-01T12:00:00.0Z setFromUT JD = -633.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4713-03-01T12:00:00.000000000000000Z -4713-03-01T12:00:00.0Z setFromUT JD = -306.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4713-03-01T12:00:00.000000000000000Z -4713-03-01T12:00:00Z -4713-03-01T12:00:00.0Z setFromUT JD = -268.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4712-03-01T12:00:00.000000000000000Z -4712-03-01T12:00:00.0Z setFromUT JD = 60.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4712-03-01T12:00:00.000000000000000Z -4712-03-01T12:00:00Z -4712-03-01T12:00:00.0Z setFromUT JD = 98.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4711-03-01T12:00:00.000000000000000Z -4711-03-01T12:00:00.0Z setFromUT JD = 425.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4711-03-01T12:00:00.000000000000000Z -4711-03-01T12:00:00Z -4711-03-01T12:00:00.0Z setFromUT JD = 463.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4710-03-01T12:00:00.000000000000000Z -4710-03-01T12:00:00.0Z setFromUT JD = 790.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4710-03-01T12:00:00.000000000000000Z -4710-03-01T12:00:00Z -4710-03-01T12:00:00.0Z setFromUT JD = 828.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4709-03-01T12:00:00.000000000000000Z -4709-03-01T12:00:00.0Z setFromUT JD = 1155.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4709-03-01T12:00:00.000000000000000Z -4709-03-01T12:00:00Z -4709-03-01T12:00:00.0Z setFromUT JD = 1193.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4708-03-01T12:00:00.000000000000000Z -4708-03-01T12:00:00.0Z setFromUT JD = 1521.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4708-03-01T12:00:00.000000000000000Z -4708-03-01T12:00:00Z -4708-03-01T12:00:00.0Z setFromUT JD = 1559.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4707-03-01T12:00:00.000000000000000Z -4707-03-01T12:00:00.0Z setFromUT JD = 1886.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4707-03-01T12:00:00.000000000000000Z -4707-03-01T12:00:00Z -4707-03-01T12:00:00.0Z setFromUT JD = 1924.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4717-12-31T12:00:00.000000000000000Z -4717-12-31T12:00:00.0Z setFromUT JD = -1462.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4717-12-31T12:00:00.000000000000000Z -4717-12-31T12:00:00Z -4717-12-31T12:00:00.0Z setFromUT JD = -1424.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4716-12-31T12:00:00.000000000000000Z -4716-12-31T12:00:00.0Z setFromUT JD = -1096.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4716-12-31T12:00:00.000000000000000Z -4716-12-31T12:00:00Z -4716-12-31T12:00:00.0Z setFromUT JD = -1058.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4715-12-31T12:00:00.000000000000000Z -4715-12-31T12:00:00.0Z setFromUT JD = -731.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4715-12-31T12:00:00.000000000000000Z -4715-12-31T12:00:00Z -4715-12-31T12:00:00.0Z setFromUT JD = -693.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4714-12-31T12:00:00.000000000000000Z -4714-12-31T12:00:00.0Z setFromUT JD = -366.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4714-12-31T12:00:00.000000000000000Z -4714-12-31T12:00:00Z -4714-12-31T12:00:00.0Z setFromUT JD = -328.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4713-12-31T12:00:00.000000000000000Z -4713-12-31T12:00:00.0Z setFromUT JD = -1.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4713-12-31T12:00:00.000000000000000Z -4713-12-31T12:00:00Z -4713-12-31T12:00:00.0Z setFromUT JD = 37.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4712-12-31T12:00:00.000000000000000Z -4712-12-31T12:00:00.0Z setFromUT JD = 365.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4712-12-31T12:00:00.000000000000000Z -4712-12-31T12:00:00Z -4712-12-31T12:00:00.0Z setFromUT JD = 403.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4711-12-31T12:00:00.000000000000000Z -4711-12-31T12:00:00.0Z setFromUT JD = 730.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4711-12-31T12:00:00.000000000000000Z -4711-12-31T12:00:00Z -4711-12-31T12:00:00.0Z setFromUT JD = 768.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4710-12-31T12:00:00.000000000000000Z -4710-12-31T12:00:00.0Z setFromUT JD = 1095.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4710-12-31T12:00:00.000000000000000Z -4710-12-31T12:00:00Z -4710-12-31T12:00:00.0Z setFromUT JD = 1133.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4709-12-31T12:00:00.000000000000000Z -4709-12-31T12:00:00.0Z setFromUT JD = 1460.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4709-12-31T12:00:00.000000000000000Z -4709-12-31T12:00:00Z -4709-12-31T12:00:00.0Z setFromUT JD = 1498.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4708-12-31T12:00:00.000000000000000Z -4708-12-31T12:00:00.0Z setFromUT JD = 1826.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4708-12-31T12:00:00.000000000000000Z -4708-12-31T12:00:00Z -4708-12-31T12:00:00.0Z setFromUT JD = 1864.0000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -4707-12-31T12:00:00.000000000000000Z -4707-12-31T12:00:00.0Z setFromUT JD = 2191.0000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -4707-12-31T12:00:00.000000000000000Z -4707-12-31T12:00:00Z -4707-12-31T12:00:00.0Z setFromUT JD = 2229.0000000000000000 days Test 02 of calendar dates in the vicinity of the year epoch. Start of Julian proleptic inner test input and output (strfMJD) date/time -0005-01-01T00:00:00.000000000000000Z -0005-01-01T00:00:00.0Z setFromUT JD = 1719231.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0005-01-01T00:00:00.000000000000000Z -5-01-01T00:00:00Z -0005-01-01T00:00:00.0Z setFromUT JD = 1719233.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0004-01-01T00:00:00.000000000000000Z -0004-01-01T00:00:00.0Z setFromUT JD = 1719596.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0004-01-01T00:00:00.000000000000000Z -4-01-01T00:00:00Z -0004-01-01T00:00:00.0Z setFromUT JD = 1719598.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0003-01-01T00:00:00.000000000000000Z -0003-01-01T00:00:00.0Z setFromUT JD = 1719962.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0003-01-01T00:00:00.000000000000000Z -3-01-01T00:00:00Z -0003-01-01T00:00:00.0Z setFromUT JD = 1719964.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0002-01-01T00:00:00.000000000000000Z -0002-01-01T00:00:00.0Z setFromUT JD = 1720327.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0002-01-01T00:00:00.000000000000000Z -2-01-01T00:00:00Z -0002-01-01T00:00:00.0Z setFromUT JD = 1720329.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0001-01-01T00:00:00.000000000000000Z -0001-01-01T00:00:00.0Z setFromUT JD = 1720692.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0001-01-01T00:00:00.000000000000000Z -1-01-01T00:00:00Z -0001-01-01T00:00:00.0Z setFromUT JD = 1720694.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:00.000000000000000Z 0000-01-01T00:00:00.0Z setFromUT JD = 1721057.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:00.000000000000000Z 0-01-01T00:00:00Z 0000-01-01T00:00:00.0Z setFromUT JD = 1721059.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0001-01-01T00:00:00.000000000000000Z 0001-01-01T00:00:00.0Z setFromUT JD = 1721423.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0001-01-01T00:00:00.000000000000000Z 1-01-01T00:00:00Z 0001-01-01T00:00:00.0Z setFromUT JD = 1721425.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0002-01-01T00:00:00.000000000000000Z 0002-01-01T00:00:00.0Z setFromUT JD = 1721788.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0002-01-01T00:00:00.000000000000000Z 2-01-01T00:00:00Z 0002-01-01T00:00:00.0Z setFromUT JD = 1721790.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0003-01-01T00:00:00.000000000000000Z 0003-01-01T00:00:00.0Z setFromUT JD = 1722153.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0003-01-01T00:00:00.000000000000000Z 3-01-01T00:00:00Z 0003-01-01T00:00:00.0Z setFromUT JD = 1722155.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0004-01-01T00:00:00.000000000000000Z 0004-01-01T00:00:00.0Z setFromUT JD = 1722518.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0004-01-01T00:00:00.000000000000000Z 4-01-01T00:00:00Z 0004-01-01T00:00:00.0Z setFromUT JD = 1722520.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0005-01-01T00:00:00.000000000000000Z 0005-01-01T00:00:00.0Z setFromUT JD = 1722884.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0005-01-01T00:00:00.000000000000000Z 5-01-01T00:00:00Z 0005-01-01T00:00:00.0Z setFromUT JD = 1722886.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0005-02-28T00:00:00.000000000000000Z -0005-02-28T00:00:00.0Z setFromUT JD = 1719289.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0005-02-28T00:00:00.000000000000000Z -5-02-28T00:00:00Z -0005-02-28T00:00:00.0Z setFromUT JD = 1719291.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0004-02-28T00:00:00.000000000000000Z -0004-02-28T00:00:00.0Z setFromUT JD = 1719654.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0004-02-28T00:00:00.000000000000000Z -4-02-28T00:00:00Z -0004-02-28T00:00:00.0Z setFromUT JD = 1719656.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0003-02-28T00:00:00.000000000000000Z -0003-02-28T00:00:00.0Z setFromUT JD = 1720020.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0003-02-28T00:00:00.000000000000000Z -3-02-28T00:00:00Z -0003-02-28T00:00:00.0Z setFromUT JD = 1720022.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0002-02-28T00:00:00.000000000000000Z -0002-02-28T00:00:00.0Z setFromUT JD = 1720385.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0002-02-28T00:00:00.000000000000000Z -2-02-28T00:00:00Z -0002-02-28T00:00:00.0Z setFromUT JD = 1720387.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0001-02-28T00:00:00.000000000000000Z -0001-02-28T00:00:00.0Z setFromUT JD = 1720750.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0001-02-28T00:00:00.000000000000000Z -1-02-28T00:00:00Z -0001-02-28T00:00:00.0Z setFromUT JD = 1720752.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-02-28T00:00:00.000000000000000Z 0000-02-28T00:00:00.0Z setFromUT JD = 1721115.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-02-28T00:00:00.000000000000000Z 0-02-28T00:00:00Z 0000-02-28T00:00:00.0Z setFromUT JD = 1721117.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0001-02-28T00:00:00.000000000000000Z 0001-02-28T00:00:00.0Z setFromUT JD = 1721481.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0001-02-28T00:00:00.000000000000000Z 1-02-28T00:00:00Z 0001-02-28T00:00:00.0Z setFromUT JD = 1721483.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0002-02-28T00:00:00.000000000000000Z 0002-02-28T00:00:00.0Z setFromUT JD = 1721846.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0002-02-28T00:00:00.000000000000000Z 2-02-28T00:00:00Z 0002-02-28T00:00:00.0Z setFromUT JD = 1721848.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0003-02-28T00:00:00.000000000000000Z 0003-02-28T00:00:00.0Z setFromUT JD = 1722211.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0003-02-28T00:00:00.000000000000000Z 3-02-28T00:00:00Z 0003-02-28T00:00:00.0Z setFromUT JD = 1722213.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0004-02-28T00:00:00.000000000000000Z 0004-02-28T00:00:00.0Z setFromUT JD = 1722576.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0004-02-28T00:00:00.000000000000000Z 4-02-28T00:00:00Z 0004-02-28T00:00:00.0Z setFromUT JD = 1722578.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0005-02-28T00:00:00.000000000000000Z 0005-02-28T00:00:00.0Z setFromUT JD = 1722942.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0005-02-28T00:00:00.000000000000000Z 5-02-28T00:00:00Z 0005-02-28T00:00:00.0Z setFromUT JD = 1722944.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0005-02-29T00:00:00.000000000000000Z -0005-03-01T00:00:00.0Z setFromUT JD = 1719290.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0005-02-29T00:00:00.000000000000000Z -5-03-01T00:00:00Z -0005-03-01T00:00:00.0Z setFromUT JD = 1719292.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0004-02-29T00:00:00.000000000000000Z -0004-02-29T00:00:00.0Z setFromUT JD = 1719655.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0004-02-29T00:00:00.000000000000000Z -4-02-29T00:00:00Z -0004-02-29T00:00:00.0Z setFromUT JD = 1719657.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0003-02-29T00:00:00.000000000000000Z -0003-03-01T00:00:00.0Z setFromUT JD = 1720021.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0003-02-29T00:00:00.000000000000000Z -3-03-01T00:00:00Z -0003-03-01T00:00:00.0Z setFromUT JD = 1720023.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0002-02-29T00:00:00.000000000000000Z -0002-03-01T00:00:00.0Z setFromUT JD = 1720386.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0002-02-29T00:00:00.000000000000000Z -2-03-01T00:00:00Z -0002-03-01T00:00:00.0Z setFromUT JD = 1720388.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0001-02-29T00:00:00.000000000000000Z -0001-03-01T00:00:00.0Z setFromUT JD = 1720751.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0001-02-29T00:00:00.000000000000000Z -1-03-01T00:00:00Z -0001-03-01T00:00:00.0Z setFromUT JD = 1720753.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-02-29T00:00:00.000000000000000Z 0000-02-29T00:00:00.0Z setFromUT JD = 1721116.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-02-29T00:00:00.000000000000000Z 0-02-29T00:00:00Z 0000-02-29T00:00:00.0Z setFromUT JD = 1721118.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0001-02-29T00:00:00.000000000000000Z 0001-03-01T00:00:00.0Z setFromUT JD = 1721482.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0001-02-29T00:00:00.000000000000000Z 1-03-01T00:00:00Z 0001-03-01T00:00:00.0Z setFromUT JD = 1721484.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0002-02-29T00:00:00.000000000000000Z 0002-03-01T00:00:00.0Z setFromUT JD = 1721847.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0002-02-29T00:00:00.000000000000000Z 2-03-01T00:00:00Z 0002-03-01T00:00:00.0Z setFromUT JD = 1721849.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0003-02-29T00:00:00.000000000000000Z 0003-03-01T00:00:00.0Z setFromUT JD = 1722212.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0003-02-29T00:00:00.000000000000000Z 3-03-01T00:00:00Z 0003-03-01T00:00:00.0Z setFromUT JD = 1722214.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0004-02-29T00:00:00.000000000000000Z 0004-02-29T00:00:00.0Z setFromUT JD = 1722577.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0004-02-29T00:00:00.000000000000000Z 4-02-29T00:00:00Z 0004-02-29T00:00:00.0Z setFromUT JD = 1722579.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0005-02-29T00:00:00.000000000000000Z 0005-03-01T00:00:00.0Z setFromUT JD = 1722943.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0005-02-29T00:00:00.000000000000000Z 5-03-01T00:00:00Z 0005-03-01T00:00:00.0Z setFromUT JD = 1722945.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0005-03-01T00:00:00.000000000000000Z -0005-03-01T00:00:00.0Z setFromUT JD = 1719290.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0005-03-01T00:00:00.000000000000000Z -5-03-01T00:00:00Z -0005-03-01T00:00:00.0Z setFromUT JD = 1719292.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0004-03-01T00:00:00.000000000000000Z -0004-03-01T00:00:00.0Z setFromUT JD = 1719656.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0004-03-01T00:00:00.000000000000000Z -4-03-01T00:00:00Z -0004-03-01T00:00:00.0Z setFromUT JD = 1719658.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0003-03-01T00:00:00.000000000000000Z -0003-03-01T00:00:00.0Z setFromUT JD = 1720021.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0003-03-01T00:00:00.000000000000000Z -3-03-01T00:00:00Z -0003-03-01T00:00:00.0Z setFromUT JD = 1720023.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0002-03-01T00:00:00.000000000000000Z -0002-03-01T00:00:00.0Z setFromUT JD = 1720386.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0002-03-01T00:00:00.000000000000000Z -2-03-01T00:00:00Z -0002-03-01T00:00:00.0Z setFromUT JD = 1720388.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0001-03-01T00:00:00.000000000000000Z -0001-03-01T00:00:00.0Z setFromUT JD = 1720751.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0001-03-01T00:00:00.000000000000000Z -1-03-01T00:00:00Z -0001-03-01T00:00:00.0Z setFromUT JD = 1720753.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-03-01T00:00:00.000000000000000Z 0000-03-01T00:00:00.0Z setFromUT JD = 1721117.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-03-01T00:00:00.000000000000000Z 0-03-01T00:00:00Z 0000-03-01T00:00:00.0Z setFromUT JD = 1721119.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0001-03-01T00:00:00.000000000000000Z 0001-03-01T00:00:00.0Z setFromUT JD = 1721482.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0001-03-01T00:00:00.000000000000000Z 1-03-01T00:00:00Z 0001-03-01T00:00:00.0Z setFromUT JD = 1721484.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0002-03-01T00:00:00.000000000000000Z 0002-03-01T00:00:00.0Z setFromUT JD = 1721847.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0002-03-01T00:00:00.000000000000000Z 2-03-01T00:00:00Z 0002-03-01T00:00:00.0Z setFromUT JD = 1721849.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0003-03-01T00:00:00.000000000000000Z 0003-03-01T00:00:00.0Z setFromUT JD = 1722212.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0003-03-01T00:00:00.000000000000000Z 3-03-01T00:00:00Z 0003-03-01T00:00:00.0Z setFromUT JD = 1722214.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0004-03-01T00:00:00.000000000000000Z 0004-03-01T00:00:00.0Z setFromUT JD = 1722578.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0004-03-01T00:00:00.000000000000000Z 4-03-01T00:00:00Z 0004-03-01T00:00:00.0Z setFromUT JD = 1722580.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0005-03-01T00:00:00.000000000000000Z 0005-03-01T00:00:00.0Z setFromUT JD = 1722943.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0005-03-01T00:00:00.000000000000000Z 5-03-01T00:00:00Z 0005-03-01T00:00:00.0Z setFromUT JD = 1722945.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0005-12-31T00:00:00.000000000000000Z -0005-12-31T00:00:00.0Z setFromUT JD = 1719595.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0005-12-31T00:00:00.000000000000000Z -5-12-31T00:00:00Z -0005-12-31T00:00:00.0Z setFromUT JD = 1719597.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0004-12-31T00:00:00.000000000000000Z -0004-12-31T00:00:00.0Z setFromUT JD = 1719961.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0004-12-31T00:00:00.000000000000000Z -4-12-31T00:00:00Z -0004-12-31T00:00:00.0Z setFromUT JD = 1719963.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0003-12-31T00:00:00.000000000000000Z -0003-12-31T00:00:00.0Z setFromUT JD = 1720326.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0003-12-31T00:00:00.000000000000000Z -3-12-31T00:00:00Z -0003-12-31T00:00:00.0Z setFromUT JD = 1720328.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0002-12-31T00:00:00.000000000000000Z -0002-12-31T00:00:00.0Z setFromUT JD = 1720691.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0002-12-31T00:00:00.000000000000000Z -2-12-31T00:00:00Z -0002-12-31T00:00:00.0Z setFromUT JD = 1720693.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time -0001-12-31T00:00:00.000000000000000Z -0001-12-31T00:00:00.0Z setFromUT JD = 1721056.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time -0001-12-31T00:00:00.000000000000000Z -1-12-31T00:00:00Z -0001-12-31T00:00:00.0Z setFromUT JD = 1721058.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-12-31T00:00:00.000000000000000Z 0000-12-31T00:00:00.0Z setFromUT JD = 1721422.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-12-31T00:00:00.000000000000000Z 0-12-31T00:00:00Z 0000-12-31T00:00:00.0Z setFromUT JD = 1721424.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0001-12-31T00:00:00.000000000000000Z 0001-12-31T00:00:00.0Z setFromUT JD = 1721787.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0001-12-31T00:00:00.000000000000000Z 1-12-31T00:00:00Z 0001-12-31T00:00:00.0Z setFromUT JD = 1721789.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0002-12-31T00:00:00.000000000000000Z 0002-12-31T00:00:00.0Z setFromUT JD = 1722152.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0002-12-31T00:00:00.000000000000000Z 2-12-31T00:00:00Z 0002-12-31T00:00:00.0Z setFromUT JD = 1722154.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0003-12-31T00:00:00.000000000000000Z 0003-12-31T00:00:00.0Z setFromUT JD = 1722517.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0003-12-31T00:00:00.000000000000000Z 3-12-31T00:00:00Z 0003-12-31T00:00:00.0Z setFromUT JD = 1722519.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0004-12-31T00:00:00.000000000000000Z 0004-12-31T00:00:00.0Z setFromUT JD = 1722883.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0004-12-31T00:00:00.000000000000000Z 4-12-31T00:00:00Z 0004-12-31T00:00:00.0Z setFromUT JD = 1722885.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0005-12-31T00:00:00.000000000000000Z 0005-12-31T00:00:00.0Z setFromUT JD = 1723248.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0005-12-31T00:00:00.000000000000000Z 5-12-31T00:00:00Z 0005-12-31T00:00:00.0Z setFromUT JD = 1723250.5000000000000000 days Test 03 of calendar dates in the vicinity of the MJD epoch. Start of Julian proleptic inner test input and output (strfMJD) date/time 1853-01-01T00:00:00.000000000000000Z 1853-01-01T00:00:00.0Z setFromUT JD = 2397866.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1853-01-01T00:00:00.000000000000000Z 1853-01-01T00:00:00Z 1853-01-01T00:00:00.0Z setFromUT JD = 2397854.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1854-01-01T00:00:00.000000000000000Z 1854-01-01T00:00:00.0Z setFromUT JD = 2398231.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1854-01-01T00:00:00.000000000000000Z 1854-01-01T00:00:00Z 1854-01-01T00:00:00.0Z setFromUT JD = 2398219.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1855-01-01T00:00:00.000000000000000Z 1855-01-01T00:00:00.0Z setFromUT JD = 2398596.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1855-01-01T00:00:00.000000000000000Z 1855-01-01T00:00:00Z 1855-01-01T00:00:00.0Z setFromUT JD = 2398584.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1856-01-01T00:00:00.000000000000000Z 1856-01-01T00:00:00.0Z setFromUT JD = 2398961.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1856-01-01T00:00:00.000000000000000Z 1856-01-01T00:00:00Z 1856-01-01T00:00:00.0Z setFromUT JD = 2398949.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1857-01-01T00:00:00.000000000000000Z 1857-01-01T00:00:00.0Z setFromUT JD = 2399327.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1857-01-01T00:00:00.000000000000000Z 1857-01-01T00:00:00Z 1857-01-01T00:00:00.0Z setFromUT JD = 2399315.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1858-01-01T00:00:00.000000000000000Z 1858-01-01T00:00:00.0Z setFromUT JD = 2399692.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1858-01-01T00:00:00.000000000000000Z 1858-01-01T00:00:00Z 1858-01-01T00:00:00.0Z setFromUT JD = 2399680.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1859-01-01T00:00:00.000000000000000Z 1859-01-01T00:00:00.0Z setFromUT JD = 2400057.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1859-01-01T00:00:00.000000000000000Z 1859-01-01T00:00:00Z 1859-01-01T00:00:00.0Z setFromUT JD = 2400045.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1860-01-01T00:00:00.000000000000000Z 1860-01-01T00:00:00.0Z setFromUT JD = 2400422.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1860-01-01T00:00:00.000000000000000Z 1860-01-01T00:00:00Z 1860-01-01T00:00:00.0Z setFromUT JD = 2400410.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1861-01-01T00:00:00.000000000000000Z 1861-01-01T00:00:00.0Z setFromUT JD = 2400788.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1861-01-01T00:00:00.000000000000000Z 1861-01-01T00:00:00Z 1861-01-01T00:00:00.0Z setFromUT JD = 2400776.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1862-01-01T00:00:00.000000000000000Z 1862-01-01T00:00:00.0Z setFromUT JD = 2401153.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1862-01-01T00:00:00.000000000000000Z 1862-01-01T00:00:00Z 1862-01-01T00:00:00.0Z setFromUT JD = 2401141.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1863-01-01T00:00:00.000000000000000Z 1863-01-01T00:00:00.0Z setFromUT JD = 2401518.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1863-01-01T00:00:00.000000000000000Z 1863-01-01T00:00:00Z 1863-01-01T00:00:00.0Z setFromUT JD = 2401506.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1853-02-28T00:00:00.000000000000000Z 1853-02-28T00:00:00.0Z setFromUT JD = 2397924.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1853-02-28T00:00:00.000000000000000Z 1853-02-28T00:00:00Z 1853-02-28T00:00:00.0Z setFromUT JD = 2397912.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1854-02-28T00:00:00.000000000000000Z 1854-02-28T00:00:00.0Z setFromUT JD = 2398289.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1854-02-28T00:00:00.000000000000000Z 1854-02-28T00:00:00Z 1854-02-28T00:00:00.0Z setFromUT JD = 2398277.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1855-02-28T00:00:00.000000000000000Z 1855-02-28T00:00:00.0Z setFromUT JD = 2398654.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1855-02-28T00:00:00.000000000000000Z 1855-02-28T00:00:00Z 1855-02-28T00:00:00.0Z setFromUT JD = 2398642.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1856-02-28T00:00:00.000000000000000Z 1856-02-28T00:00:00.0Z setFromUT JD = 2399019.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1856-02-28T00:00:00.000000000000000Z 1856-02-28T00:00:00Z 1856-02-28T00:00:00.0Z setFromUT JD = 2399007.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1857-02-28T00:00:00.000000000000000Z 1857-02-28T00:00:00.0Z setFromUT JD = 2399385.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1857-02-28T00:00:00.000000000000000Z 1857-02-28T00:00:00Z 1857-02-28T00:00:00.0Z setFromUT JD = 2399373.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1858-02-28T00:00:00.000000000000000Z 1858-02-28T00:00:00.0Z setFromUT JD = 2399750.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1858-02-28T00:00:00.000000000000000Z 1858-02-28T00:00:00Z 1858-02-28T00:00:00.0Z setFromUT JD = 2399738.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1859-02-28T00:00:00.000000000000000Z 1859-02-28T00:00:00.0Z setFromUT JD = 2400115.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1859-02-28T00:00:00.000000000000000Z 1859-02-28T00:00:00Z 1859-02-28T00:00:00.0Z setFromUT JD = 2400103.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1860-02-28T00:00:00.000000000000000Z 1860-02-28T00:00:00.0Z setFromUT JD = 2400480.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1860-02-28T00:00:00.000000000000000Z 1860-02-28T00:00:00Z 1860-02-28T00:00:00.0Z setFromUT JD = 2400468.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1861-02-28T00:00:00.000000000000000Z 1861-02-28T00:00:00.0Z setFromUT JD = 2400846.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1861-02-28T00:00:00.000000000000000Z 1861-02-28T00:00:00Z 1861-02-28T00:00:00.0Z setFromUT JD = 2400834.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1862-02-28T00:00:00.000000000000000Z 1862-02-28T00:00:00.0Z setFromUT JD = 2401211.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1862-02-28T00:00:00.000000000000000Z 1862-02-28T00:00:00Z 1862-02-28T00:00:00.0Z setFromUT JD = 2401199.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1863-02-28T00:00:00.000000000000000Z 1863-02-28T00:00:00.0Z setFromUT JD = 2401576.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1863-02-28T00:00:00.000000000000000Z 1863-02-28T00:00:00Z 1863-02-28T00:00:00.0Z setFromUT JD = 2401564.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1853-02-29T00:00:00.000000000000000Z 1853-03-01T00:00:00.0Z setFromUT JD = 2397925.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1853-02-29T00:00:00.000000000000000Z 1853-03-01T00:00:00Z 1853-03-01T00:00:00.0Z setFromUT JD = 2397913.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1854-02-29T00:00:00.000000000000000Z 1854-03-01T00:00:00.0Z setFromUT JD = 2398290.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1854-02-29T00:00:00.000000000000000Z 1854-03-01T00:00:00Z 1854-03-01T00:00:00.0Z setFromUT JD = 2398278.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1855-02-29T00:00:00.000000000000000Z 1855-03-01T00:00:00.0Z setFromUT JD = 2398655.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1855-02-29T00:00:00.000000000000000Z 1855-03-01T00:00:00Z 1855-03-01T00:00:00.0Z setFromUT JD = 2398643.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1856-02-29T00:00:00.000000000000000Z 1856-02-29T00:00:00.0Z setFromUT JD = 2399020.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1856-02-29T00:00:00.000000000000000Z 1856-02-29T00:00:00Z 1856-02-29T00:00:00.0Z setFromUT JD = 2399008.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1857-02-29T00:00:00.000000000000000Z 1857-03-01T00:00:00.0Z setFromUT JD = 2399386.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1857-02-29T00:00:00.000000000000000Z 1857-03-01T00:00:00Z 1857-03-01T00:00:00.0Z setFromUT JD = 2399374.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1858-02-29T00:00:00.000000000000000Z 1858-03-01T00:00:00.0Z setFromUT JD = 2399751.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1858-02-29T00:00:00.000000000000000Z 1858-03-01T00:00:00Z 1858-03-01T00:00:00.0Z setFromUT JD = 2399739.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1859-02-29T00:00:00.000000000000000Z 1859-03-01T00:00:00.0Z setFromUT JD = 2400116.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1859-02-29T00:00:00.000000000000000Z 1859-03-01T00:00:00Z 1859-03-01T00:00:00.0Z setFromUT JD = 2400104.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1860-02-29T00:00:00.000000000000000Z 1860-02-29T00:00:00.0Z setFromUT JD = 2400481.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1860-02-29T00:00:00.000000000000000Z 1860-02-29T00:00:00Z 1860-02-29T00:00:00.0Z setFromUT JD = 2400469.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1861-02-29T00:00:00.000000000000000Z 1861-03-01T00:00:00.0Z setFromUT JD = 2400847.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1861-02-29T00:00:00.000000000000000Z 1861-03-01T00:00:00Z 1861-03-01T00:00:00.0Z setFromUT JD = 2400835.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1862-02-29T00:00:00.000000000000000Z 1862-03-01T00:00:00.0Z setFromUT JD = 2401212.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1862-02-29T00:00:00.000000000000000Z 1862-03-01T00:00:00Z 1862-03-01T00:00:00.0Z setFromUT JD = 2401200.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1863-02-29T00:00:00.000000000000000Z 1863-03-01T00:00:00.0Z setFromUT JD = 2401577.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1863-02-29T00:00:00.000000000000000Z 1863-03-01T00:00:00Z 1863-03-01T00:00:00.0Z setFromUT JD = 2401565.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1853-03-01T00:00:00.000000000000000Z 1853-03-01T00:00:00.0Z setFromUT JD = 2397925.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1853-03-01T00:00:00.000000000000000Z 1853-03-01T00:00:00Z 1853-03-01T00:00:00.0Z setFromUT JD = 2397913.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1854-03-01T00:00:00.000000000000000Z 1854-03-01T00:00:00.0Z setFromUT JD = 2398290.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1854-03-01T00:00:00.000000000000000Z 1854-03-01T00:00:00Z 1854-03-01T00:00:00.0Z setFromUT JD = 2398278.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1855-03-01T00:00:00.000000000000000Z 1855-03-01T00:00:00.0Z setFromUT JD = 2398655.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1855-03-01T00:00:00.000000000000000Z 1855-03-01T00:00:00Z 1855-03-01T00:00:00.0Z setFromUT JD = 2398643.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1856-03-01T00:00:00.000000000000000Z 1856-03-01T00:00:00.0Z setFromUT JD = 2399021.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1856-03-01T00:00:00.000000000000000Z 1856-03-01T00:00:00Z 1856-03-01T00:00:00.0Z setFromUT JD = 2399009.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1857-03-01T00:00:00.000000000000000Z 1857-03-01T00:00:00.0Z setFromUT JD = 2399386.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1857-03-01T00:00:00.000000000000000Z 1857-03-01T00:00:00Z 1857-03-01T00:00:00.0Z setFromUT JD = 2399374.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1858-03-01T00:00:00.000000000000000Z 1858-03-01T00:00:00.0Z setFromUT JD = 2399751.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1858-03-01T00:00:00.000000000000000Z 1858-03-01T00:00:00Z 1858-03-01T00:00:00.0Z setFromUT JD = 2399739.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1859-03-01T00:00:00.000000000000000Z 1859-03-01T00:00:00.0Z setFromUT JD = 2400116.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1859-03-01T00:00:00.000000000000000Z 1859-03-01T00:00:00Z 1859-03-01T00:00:00.0Z setFromUT JD = 2400104.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1860-03-01T00:00:00.000000000000000Z 1860-03-01T00:00:00.0Z setFromUT JD = 2400482.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1860-03-01T00:00:00.000000000000000Z 1860-03-01T00:00:00Z 1860-03-01T00:00:00.0Z setFromUT JD = 2400470.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1861-03-01T00:00:00.000000000000000Z 1861-03-01T00:00:00.0Z setFromUT JD = 2400847.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1861-03-01T00:00:00.000000000000000Z 1861-03-01T00:00:00Z 1861-03-01T00:00:00.0Z setFromUT JD = 2400835.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1862-03-01T00:00:00.000000000000000Z 1862-03-01T00:00:00.0Z setFromUT JD = 2401212.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1862-03-01T00:00:00.000000000000000Z 1862-03-01T00:00:00Z 1862-03-01T00:00:00.0Z setFromUT JD = 2401200.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1863-03-01T00:00:00.000000000000000Z 1863-03-01T00:00:00.0Z setFromUT JD = 2401577.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1863-03-01T00:00:00.000000000000000Z 1863-03-01T00:00:00Z 1863-03-01T00:00:00.0Z setFromUT JD = 2401565.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1853-11-17T00:00:00.000000000000000Z 1853-11-17T00:00:00.0Z setFromUT JD = 2398186.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1853-11-17T00:00:00.000000000000000Z 1853-11-17T00:00:00Z 1853-11-17T00:00:00.0Z setFromUT JD = 2398174.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1854-11-17T00:00:00.000000000000000Z 1854-11-17T00:00:00.0Z setFromUT JD = 2398551.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1854-11-17T00:00:00.000000000000000Z 1854-11-17T00:00:00Z 1854-11-17T00:00:00.0Z setFromUT JD = 2398539.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1855-11-17T00:00:00.000000000000000Z 1855-11-17T00:00:00.0Z setFromUT JD = 2398916.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1855-11-17T00:00:00.000000000000000Z 1855-11-17T00:00:00Z 1855-11-17T00:00:00.0Z setFromUT JD = 2398904.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1856-11-17T00:00:00.000000000000000Z 1856-11-17T00:00:00.0Z setFromUT JD = 2399282.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1856-11-17T00:00:00.000000000000000Z 1856-11-17T00:00:00Z 1856-11-17T00:00:00.0Z setFromUT JD = 2399270.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1857-11-17T00:00:00.000000000000000Z 1857-11-17T00:00:00.0Z setFromUT JD = 2399647.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1857-11-17T00:00:00.000000000000000Z 1857-11-17T00:00:00Z 1857-11-17T00:00:00.0Z setFromUT JD = 2399635.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1858-11-17T00:00:00.000000000000000Z 1858-11-17T00:00:00.0Z setFromUT JD = 2400012.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1858-11-17T00:00:00.000000000000000Z 1858-11-17T00:00:00Z 1858-11-17T00:00:00.0Z setFromUT JD = 2400000.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1859-11-17T00:00:00.000000000000000Z 1859-11-17T00:00:00.0Z setFromUT JD = 2400377.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1859-11-17T00:00:00.000000000000000Z 1859-11-17T00:00:00Z 1859-11-17T00:00:00.0Z setFromUT JD = 2400365.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1860-11-17T00:00:00.000000000000000Z 1860-11-17T00:00:00.0Z setFromUT JD = 2400743.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1860-11-17T00:00:00.000000000000000Z 1860-11-17T00:00:00Z 1860-11-17T00:00:00.0Z setFromUT JD = 2400731.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1861-11-17T00:00:00.000000000000000Z 1861-11-17T00:00:00.0Z setFromUT JD = 2401108.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1861-11-17T00:00:00.000000000000000Z 1861-11-17T00:00:00Z 1861-11-17T00:00:00.0Z setFromUT JD = 2401096.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1862-11-17T00:00:00.000000000000000Z 1862-11-17T00:00:00.0Z setFromUT JD = 2401473.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1862-11-17T00:00:00.000000000000000Z 1862-11-17T00:00:00Z 1862-11-17T00:00:00.0Z setFromUT JD = 2401461.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1863-11-17T00:00:00.000000000000000Z 1863-11-17T00:00:00.0Z setFromUT JD = 2401838.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1863-11-17T00:00:00.000000000000000Z 1863-11-17T00:00:00Z 1863-11-17T00:00:00.0Z setFromUT JD = 2401826.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1853-12-31T00:00:00.000000000000000Z 1853-12-31T00:00:00.0Z setFromUT JD = 2398230.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1853-12-31T00:00:00.000000000000000Z 1853-12-31T00:00:00Z 1853-12-31T00:00:00.0Z setFromUT JD = 2398218.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1854-12-31T00:00:00.000000000000000Z 1854-12-31T00:00:00.0Z setFromUT JD = 2398595.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1854-12-31T00:00:00.000000000000000Z 1854-12-31T00:00:00Z 1854-12-31T00:00:00.0Z setFromUT JD = 2398583.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1855-12-31T00:00:00.000000000000000Z 1855-12-31T00:00:00.0Z setFromUT JD = 2398960.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1855-12-31T00:00:00.000000000000000Z 1855-12-31T00:00:00Z 1855-12-31T00:00:00.0Z setFromUT JD = 2398948.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1856-12-31T00:00:00.000000000000000Z 1856-12-31T00:00:00.0Z setFromUT JD = 2399326.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1856-12-31T00:00:00.000000000000000Z 1856-12-31T00:00:00Z 1856-12-31T00:00:00.0Z setFromUT JD = 2399314.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1857-12-31T00:00:00.000000000000000Z 1857-12-31T00:00:00.0Z setFromUT JD = 2399691.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1857-12-31T00:00:00.000000000000000Z 1857-12-31T00:00:00Z 1857-12-31T00:00:00.0Z setFromUT JD = 2399679.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1858-12-31T00:00:00.000000000000000Z 1858-12-31T00:00:00.0Z setFromUT JD = 2400056.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1858-12-31T00:00:00.000000000000000Z 1858-12-31T00:00:00Z 1858-12-31T00:00:00.0Z setFromUT JD = 2400044.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1859-12-31T00:00:00.000000000000000Z 1859-12-31T00:00:00.0Z setFromUT JD = 2400421.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1859-12-31T00:00:00.000000000000000Z 1859-12-31T00:00:00Z 1859-12-31T00:00:00.0Z setFromUT JD = 2400409.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1860-12-31T00:00:00.000000000000000Z 1860-12-31T00:00:00.0Z setFromUT JD = 2400787.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1860-12-31T00:00:00.000000000000000Z 1860-12-31T00:00:00Z 1860-12-31T00:00:00.0Z setFromUT JD = 2400775.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1861-12-31T00:00:00.000000000000000Z 1861-12-31T00:00:00.0Z setFromUT JD = 2401152.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1861-12-31T00:00:00.000000000000000Z 1861-12-31T00:00:00Z 1861-12-31T00:00:00.0Z setFromUT JD = 2401140.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1862-12-31T00:00:00.000000000000000Z 1862-12-31T00:00:00.0Z setFromUT JD = 2401517.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1862-12-31T00:00:00.000000000000000Z 1862-12-31T00:00:00Z 1862-12-31T00:00:00.0Z setFromUT JD = 2401505.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 1863-12-31T00:00:00.000000000000000Z 1863-12-31T00:00:00.0Z setFromUT JD = 2401882.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 1863-12-31T00:00:00.000000000000000Z 1863-12-31T00:00:00Z 1863-12-31T00:00:00.0Z setFromUT JD = 2401870.5000000000000000 days Test 04 of small second range near Year 0 (Julian) Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:00.000000000000000Z 0000-01-01T00:00:00.0Z JD = 1721057.5000000000000000 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:01.000000000000000Z 0000-01-01T00:00:01.0Z JD = 1721057.5000115740112960 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:02.000000000000000Z 0000-01-01T00:00:02.0Z JD = 1721057.5000231482554227 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:03.000000000000000Z 0000-01-01T00:00:03.0Z JD = 1721057.5000347222667187 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:04.000000000000000Z 0000-01-01T00:00:04.0Z JD = 1721057.5000462962780148 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:05.000000000000000Z 0000-01-01T00:00:05.0Z JD = 1721057.5000578702893108 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:06.000000000000000Z 0000-01-01T00:00:06.0Z JD = 1721057.5000694445334375 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:07.000000000000000Z 0000-01-01T00:00:07.0Z JD = 1721057.5000810185447335 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:08.000000000000000Z 0000-01-01T00:00:08.0Z JD = 1721057.5000925925560296 days Start of Julian proleptic inner test input and output (strfMJD) date/time 0000-01-01T00:00:09.000000000000000Z 0000-01-01T00:00:09.0Z JD = 1721057.5001041665673256 days Test 04 of small second range near Year 0 (Gregorian) Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:00.000000000000000Z 0-01-01T00:00:00Z 0000-01-01T00:00:00.0Z JD = 1721059.5000000000000000 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:01.000000000000000Z 0-01-01T00:00:01Z 0000-01-01T00:00:01.0Z JD = 1721059.5000115740112960 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:02.000000000000000Z 0-01-01T00:00:02Z 0000-01-01T00:00:02.0Z JD = 1721059.5000231482554227 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:03.000000000000000Z 0-01-01T00:00:03Z 0000-01-01T00:00:03.0Z JD = 1721059.5000347222667187 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:04.000000000000000Z 0-01-01T00:00:04Z 0000-01-01T00:00:04.0Z JD = 1721059.5000462962780148 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:05.000000000000000Z 0-01-01T00:00:05Z 0000-01-01T00:00:05.0Z JD = 1721059.5000578702893108 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:06.000000000000000Z 0-01-01T00:00:06Z 0000-01-01T00:00:06.0Z JD = 1721059.5000694445334375 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:07.000000000000000Z 0-01-01T00:00:07Z 0000-01-01T00:00:07.0Z JD = 1721059.5000810185447335 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:08.000000000000000Z 0-01-01T00:00:08Z 0000-01-01T00:00:08.0Z JD = 1721059.5000925925560296 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 0000-01-01T00:00:09.000000000000000Z 0-01-01T00:00:09Z 0000-01-01T00:00:09.0Z JD = 1721059.5001041665673256 days Test 04 of small second range near 2009-01-01 (Gregorian) when a leap second was inserted Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2008-12-31T23:59:55.123456789006013Z 2008-12-31T23:59:55Z 2008-12-31T23:59:55.123456789Z JD = 2454832.4999435585923493 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2008-12-31T23:59:56.123456789006013Z 2008-12-31T23:59:56Z 2008-12-31T23:59:56.123456789Z JD = 2454832.4999551326036453 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2008-12-31T23:59:57.123456789006013Z 2008-12-31T23:59:57Z 2008-12-31T23:59:57.123456789Z JD = 2454832.4999667066149414 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2008-12-31T23:59:58.123456789006013Z 2008-12-31T23:59:58Z 2008-12-31T23:59:58.123456789Z JD = 2454832.4999782806262374 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2008-12-31T23:59:59.123456789006013Z 2008-12-31T23:59:59Z 2008-12-31T23:59:59.123456789Z JD = 2454832.4999898546375334 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2009-01-01T00:00:00.123456789012345Z 2009-01-01T00:00:00Z 2009-01-01T00:00:00.123456789Z JD = 2454832.5000014291144907 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2009-01-01T00:00:01.123456789012345Z 2009-01-01T00:00:01Z 2009-01-01T00:00:01.123456789Z JD = 2454832.5000130031257868 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2009-01-01T00:00:02.123456789012345Z 2009-01-01T00:00:02Z 2009-01-01T00:00:02.123456789Z JD = 2454832.5000245771370828 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2009-01-01T00:00:03.123456789012345Z 2009-01-01T00:00:03Z 2009-01-01T00:00:03.123456789Z JD = 2454832.5000361511483788 days Start of Gregorian proleptic inner test input and output (strftime), and output (strfMJD) date/time 2009-01-01T00:00:04.123456789012345Z 2009-01-01T00:00:04Z 2009-01-01T00:00:04.123456789Z JD = 2454832.5000477251596749 days Test 05 of normalization of breakDownMJD result and strfMJD results near the hour. MJD = {51910,3599.999999990000106} breakDownMJD result is year, month, day, hour, min, sec = 2001, 0, 1, 0, 59, 59.999999990000106 strfMJD %S%9 result is 2001-01-01T00:59:59.999999990Z strfMJD %S%. result is 2001-01-01T00:59:59.99999999Z strfMJD more heavily rounded results (the latter ones with a blank before the decimal point to prove separated formatting works) for H:M:S are the following: 01:00:00, 01:00:00, 01:00:00.0, 01:00:00.00, 01:00:00.000, 01:00:00.0000 01:00:00 ,01:00:00 .0,01:00:00 .00,01:00:00 .000,01:00:00 .0000 MJD = {51910,3600.000000000000000} breakDownMJD result is year, month, day, hour, min, sec = 2001, 0, 1, 1, 0, 0.000000000000000 strfMJD %S%9 result is 2001-01-01T01:00:00.000000000Z strfMJD %S%. result is 2001-01-01T01:00:00.0Z strfMJD more heavily rounded results (the latter ones with a blank before the decimal point to prove separated formatting works) for H:M:S are the following: 01:00:00, 01:00:00, 01:00:00.0, 01:00:00.00, 01:00:00.000, 01:00:00.0000 01:00:00 ,01:00:00 .0,01:00:00 .00,01:00:00 .000,01:00:00 .0000 MJD = {51910,3600.000000009999894} breakDownMJD result is year, month, day, hour, min, sec = 2001, 0, 1, 1, 0, 0.000000009999894 strfMJD %S%9 result is 2001-01-01T01:00:00.000000010Z strfMJD %S%. result is 2001-01-01T01:00:00.00000001Z strfMJD more heavily rounded results (the latter ones with a blank before the decimal point to prove separated formatting works) for H:M:S are the following: 01:00:00, 01:00:00, 01:00:00.0, 01:00:00.00, 01:00:00.000, 01:00:00.0000 01:00:00 ,01:00:00 .0,01:00:00 .00,01:00:00 .000,01:00:00 .0000 Test 06 (non-verbose) of calendar dates for every year from -5000000 to 5000000 Test 07 (non-verbose) of all seconds from late 2007 to early 2009 plplot-5.10.0+dfsg/lib/qsastime/dspline.h 644 1750 1750 172211646000332 171300ustar andrewandrew#ifndef _DSPLINE_H_ #define _DSPLINE_H_ // // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA int dspline( double *x, double *y, int n, int if1, double cond1, int ifn, double condn, double *y2 ); #endif // _DSPLINE_H_ plplot-5.10.0+dfsg/lib/qsastime/qsastime.c 644 1750 1750 14154012276771565 174050ustar andrewandrew// // This software originally contributed under the LGPL in January 2009 to // PLplot by the // Cluster Science Centre // QSAS team, // Imperial College, London // Copyright (C) 2009 Imperial College, London // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // MJD measures from the start of 17 Nov 1858 // These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 Gregorian // Note C libraries use Gregorian only from 14 Sept 1752 // More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php // These routines have been compared with the results of the US Naval Observatory online converter. // Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5 // // In all routines, specifying a day, hour, minute or second field greater than would be valid is // handled with modulo arithmetic and safe. // Thus 2006-12-32 00:62:00.0 will safely, and correctly, be treated as 2007-01-01 01:02:00.0 // // #include #include #include "qsastimeP.h" #include "tai-utc.h" // MJD for 0000-01-01 (correctly Jan 01, BCE 1) // Julian proleptic calendar value. #define MJD_0000J -678943 // Gregorian proleptic calendar value. (At MJD_0000J the Gregorian proleptic // calendar reads two days behind the Julian proleptic calendar, i.e. - 2 days, // see http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar, // so MJD_0000G = MJD_0000J+2) #define MJD_0000G -678941 // MJD for 0001-01-01 which is 366 days later than previous definitions because // the year 0 is a leap year in both calendars. #define MJD_0001J -678577 #define MJD_0001G -678575 // MJD for Jan 01, 1970 00:00:00 Gregorian, the Unix epoch. #define MJD_1970 40587 static const double SecInDay = 86400; // we ignore leap seconds static const int MonthStartDOY[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; static const int MonthStartDOY_L[] = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }; // Static function declarations. static int geMJDtime_TAI( const MJDtime *number1, const TAI_UTC *number2 ); static int geMJDtime_UTC( const MJDtime *number1, const TAI_UTC *number2 ); static double leap_second_TAI( const MJDtime *MJD_TAI, int *inleap, int *index ); // End of static function declarations. int setFromUT( int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian ) { // convert broken-down time to MJD // MJD measures from the start of 17 Nov 1858 // If forceJulian is true (non-zero), the Julian proleptic calendar is // used whatever the year. Otherwise, the Gregorian proleptic calendar // is used whatever the year. // Note C libraries use Gregorian only (at least on Linux). In contrast, // the Linux (and Unix?) cal application uses Julian for earlier dates // and Gregorian from 14 Sept 1752 onwards. int leaps, year4, year100, year400; double dbase_day, non_leaps = 365.; //int dbase_day, non_leaps = 365; double time_sec, dextraDays; int extraDays; if ( month < 0 || month > 11 ) { fprintf( stderr, "setfromUT: invalid month value\n" ); exit( EXIT_FAILURE ); } // As year increases, year4/4 increments by 1 at // year = -7, -3, 1, 5, 9, etc. // As year increases, year100/100 increments by 1 at // year = -299, -199, -99, 1, 101, 201, 301, etc. // As year increases, year400/400 increments by 1 at // year = -1199, -799, -399, 1, 401, 801, 1201, etc. if ( year <= 0 ) { year4 = year - 4; year100 = year - 100; year400 = year - 400; } else { year4 = year - 1; year100 = year - 1; year400 = year - 1; } if ( forceJulian ) { // count leap years on proleptic Julian Calendar starting from MJD_0000J leaps = year4 / 4; if ( year % 4 == 0 ) dbase_day = year * non_leaps + leaps + MonthStartDOY_L[month] + day + MJD_0000J; else dbase_day = year * non_leaps + leaps + MonthStartDOY[month] + day + MJD_0000J; } else { // count leap years for proleptic Gregorian Calendar. // Algorithm below for 1858-11-17 (0 MJD) gives // leaps = 450 and hence dbase_day of 678941, so subtract that value // or add MJD_0000G (which is two days different from MJD_0000J, see // above). leaps = year4 / 4 - year100 / 100 + year400 / 400; // left to right associativity means the double value of // non_leaps propagate to make all calculations be // done in double precision without the potential of // integer overflow. The result should be a double which // stores the expected exact integer results of the // calculation with exact representation unless the // result is much larger than the integer overflow limit. if ( ( year % 4 == 0 && year % 100 != 0 ) || ( year % 4 == 0 && year % 400 == 0 ) ) dbase_day = year * non_leaps + leaps + MonthStartDOY_L[month] + day + MJD_0000G; else dbase_day = year * non_leaps + leaps + MonthStartDOY[month] + day + MJD_0000G; } time_sec = sec + ( (double) min + (double) hour * 60. ) * 60.; if ( time_sec >= SecInDay ) { dextraDays = ( time_sec / SecInDay ); // precaution against overflowing extraDays. if ( fabs( dextraDays ) > 2.e9 ) { return 3; } extraDays = (int) ( dextraDays ); dbase_day += extraDays; time_sec -= extraDays * SecInDay; } // precaution against overflowing MJD->base_day. if ( fabs( dbase_day ) > 2.e9 ) { return 4; } else { // The exact integer result should be represented exactly in the // double, dbase_day, and its absolute value should be less than // the integer overflow limit. So the cast to int should be // exact. MJD->base_day = (int) dbase_day; MJD->time_sec = time_sec; return 0; } } void getYAD( int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian ) { // Get year and day of year from normalized MJD int j, ifcorrect, year4, year100, year400; j = MJD->base_day; if ( forceJulian ) { // Shift j epoch to 0000-01-01 for the Julian proleptic calendar. j -= MJD_0000J; // 365.25 is the exact period of the Julian year so year will be correct // if the day offset is set exactly right so that years -4, 0, 4 are // leap years, i.e. years -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 start with // j = -1826 -1461, -1095, -730, -365, 0, 366, 731, 1096, 1461, 1827 if ( j >= 366 ) { *year = (int) ( (double) ( j ) / 365.25 ); year4 = *year - 1; } else { *year = (int) ( (double) ( j - 365 ) / 365.25 ); year4 = *year - 4; } *doy = j - *year * 365 - year4 / 4; *ifleapyear = *year % 4 == 0; } else { // Shift j epoch to 0000-01-01 for the Gregorian proleptic calendar. j -= MJD_0000G; // 365.245 is the exact period of the Gregorian year so year will be correct // on average, but because the leap year rule is irregular within // the 400-year Gregorian cycle, the first and last days of the // year may need further adjustment. if ( j >= 366 ) { *year = (int) ( (double) ( j ) / 365.2425 ); year4 = *year - 1; year100 = *year - 1; year400 = *year - 1; } else { *year = (int) ( (double) ( j - 365 ) / 365.2425 ); year4 = *year - 4; year100 = *year - 100; year400 = *year - 400; } *doy = j - *year * 365 - year4 / 4 + year100 / 100 - year400 / 400; *ifleapyear = ( *year % 4 == 0 && *year % 100 != 0 ) || ( *year % 4 == 0 && *year % 400 == 0 ); // Rare corrections to above average Gregorian relations. if ( *doy < 1 ) { ( *year )--; ifcorrect = 1; } else if ( *doy > 365 && ( !*ifleapyear || *doy > 366 ) ) { ( *year )++; ifcorrect = 1; } else { ifcorrect = 0; } if ( ifcorrect ) { if ( j >= 366 ) { year4 = *year - 1; year100 = *year - 1; year400 = *year - 1; } else { year4 = *year - 4; year100 = *year - 100; year400 = *year - 400; } *doy = j - *year * 365 - year4 / 4 + year100 / 100 - year400 / 400; *ifleapyear = ( *year % 4 == 0 && *year % 100 != 0 ) || ( *year % 4 == 0 && *year % 400 == 0 ); } } } void normalize_MJD( MJDtime *MJD ) { int extra_days; // Calculate MJDout as normalized version // (i.e., 0. <= MJDout->time_sec < 86400.) of MJDin. if ( MJD->time_sec >= 0 ) { extra_days = (int) ( MJD->time_sec / SecInDay ); } else { // allow for negative seconds push into previous day even if less than 1 day extra_days = (int) ( MJD->time_sec / SecInDay ) - 1; } MJD->base_day += extra_days; MJD->time_sec -= extra_days * SecInDay; } void breakDownMJD( int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian ) { // Convert MJD struct into date/time elements // Note year 0 CE (AD) [1 BCE (BC)] is a leap year int doy, ifleapyear; MJDtime nMJD_value, *nMJD = &nMJD_value; *nMJD = *MJD; normalize_MJD( nMJD ); // Time part *sec = nMJD->time_sec; *hour = (int) ( *sec / 3600. ); *sec -= (double) *hour * 3600.; *min = (int) ( *sec / 60. ); *sec -= (double) *min * 60.; getYAD( year, &ifleapyear, &doy, nMJD, forceJulian ); // calculate month part with doy set to be the day within // the year in the range from 1 to 366 *month = -1; if ( ifleapyear ) { while ( doy > MonthStartDOY_L[*month + 1] ) { ( *month )++; if ( *month == 11 ) break; } *day = doy - MonthStartDOY_L[*month]; } else { while ( doy > MonthStartDOY[*month + 1] ) { ( *month )++; if ( *month == 11 ) break; } *day = doy - MonthStartDOY[*month]; } } const char * getDayOfWeek( const MJDtime *MJD ) { static const char *dow = { "Wed\0Thu\0Fri\0Sat\0Sun\0Mon\0Tue" }; int d = MJD->base_day % 7; if ( d < 0 ) d += 7; return &( dow[d * 4] ); } const char * getLongDayOfWeek( const MJDtime *MJD ) { static const char *dow = { "Wednesday\0Thursday\0\0Friday\0\0\0\0Saturday\0\0Sunday\0\0\0\0Monday\0\0\0\0Tuesday" }; int d = MJD->base_day % 7; if ( d < 0 ) d += 7; return &( dow[d * 10] ); } const char * getMonth( int m ) { static const char *months = { "Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec" }; return &( months[( m ) * 4] ); } const char * getLongMonth( int m ) { static const char *months = { "January\0\0\0February\0\0March\0\0\0\0\0April\0\0\0\0\0May\0\0\0\0\0\0\0June\0\0\0\0\0\0July\0\0\0\0\0\0August\0\0\0\0September\0October\0\0\0November\0\0December" }; return &( months[( m ) * 10] ); } size_t strfMJD( char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int inleap ) { // Format a text string according to the format string. // Uses the same syntax as strftime() but does not use current locale. // The null terminator is included in len for safety. // if inleap is true (non-zero) then renormalize so that (int) sec // is 60 to mark results as a flag that a leap increment (recently // always a second, but historically it was sometimes smaller than // that) was in the process of being inserted for this particular // epoch just prior to a positive discontinuity in TAI-UTC. int year, month, day, hour, min, ysign, second, d, y; int y1, ifleapyear; int i, secsSince1970; int nplaces, fmtlen, slen; int resolution; double shiftPlaces; char * ptr; double sec, sec_fraction; int w, doy, days_in_wk1; const char *dayText; const char *monthText; char DateTime[80]; size_t posn = 0; size_t last = len - 1; MJDtime nMJD_value, *nMJD = &nMJD_value; char dynamic_format[10]; // Find required resolution resolution = 0; fmtlen = (int) strlen( format ); i = 0; while ( i < fmtlen ) { char next = format[i]; if ( next == '%' ) { // find seconds format if used i++; next = format[i]; if ( isdigit( next ) != 0 ) { nplaces = (int) strtol( &( format[i] ), NULL, 10 ); if ( nplaces > resolution ) resolution = nplaces; } else if ( next == '.' ) { resolution = 9; // maximum resolution allowed } } i++; } // ensure rounding is done before breakdown shiftPlaces = pow( 10, (double) resolution ); *nMJD = *MJD; nMJD->time_sec += 0.5 / shiftPlaces; buf[last] = '\0'; buf[0] = '\0'; // force overwrite of old buffer since strnctat() used hereafter if ( inleap ) nMJD->time_sec -= 1.; breakDownMJD( &year, &month, &day, &hour, &min, &sec, nMJD, forceJulian ); if ( inleap ) sec += 1.; if ( year < 0 ) { ysign = 1; year = -year; } else ysign = 0; //truncate seconds to resolution to stop formatting rounding up sec = floor( sec * shiftPlaces ) / shiftPlaces; second = (int) sec; // Read format string, character at a time i = 0; while ( i < fmtlen ) { char next = format[i]; if ( next == '%' ) { // format character or escape i++; next = format[i]; if ( next == '%' ) { // escaped %, pass it on buf[posn] = next; posn++; if ( posn >= last ) return posn; } else if ( next == 'a' ) { // short day name dayText = getDayOfWeek( nMJD ); strncat( &( buf[posn] ), dayText, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'A' ) { // long day name dayText = getLongDayOfWeek( nMJD ); strncat( &( buf[posn] ), dayText, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'b' || next == 'h' ) { // short month name monthText = getMonth( month ); strncat( &( buf[posn] ), monthText, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'B' ) { // long month name monthText = getLongMonth( month ); strncat( &( buf[posn] ), monthText, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'c' ) { // Date and Time with day of week dayText = getDayOfWeek( nMJD ); monthText = getMonth( month ); if ( ysign == 0 ) sprintf( DateTime, "%s %s %02d %02d:%02d:%02d %04d", dayText, monthText, day, hour, min, second, year ); else sprintf( DateTime, "%s %s %02d %02d:%02d:%02d -%04d", dayText, monthText, day, hour, min, second, year ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'C' ) { // year / 100 so, e.g. 1989 is 20th century but comes out as 19 int century = year / 100; if ( ysign == 0 ) sprintf( DateTime, "%02d", century ); else sprintf( DateTime, "-%02d", century + 1 ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'd' ) { // day of month (01 - 31) sprintf( DateTime, "%02d", day ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'D' ) { // month/day/year y = year % 100; if ( ysign == 0 ) sprintf( DateTime, "%02d/%02d/%02d", month + 1, day, y ); else sprintf( DateTime, "%02d/%02d/-%02d", month + 1, day, y ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'e' ) { // day of month ( 1 - 31) if ( day < 10 ) sprintf( DateTime, " %01d", day ); else sprintf( DateTime, "%02d", day ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'F' ) { // year-month-day if ( ysign == 0 ) sprintf( DateTime, "%04d-%02d-%02d", year, month + 1, day ); else sprintf( DateTime, "-%04d-%02d-%02d", year, month + 1, day ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'H' ) { // hour, 24 hour clock (00 - 23) sprintf( DateTime, "%02d", hour ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'I' ) { // hour, 12 hour clock (01 - 12) if ( hour == 0 ) sprintf( DateTime, "%02d", hour + 12 ); else if ( hour > 12 ) sprintf( DateTime, "%02d", hour - 12 ); else sprintf( DateTime, "%02d", hour ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'j' ) { // day of year getYAD( &y1, &ifleapyear, &doy, nMJD, forceJulian ); sprintf( DateTime, "%03d", doy ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'k' ) { // hour, 24 hour clock ( 0 - 23) if ( hour < 10 ) sprintf( DateTime, " %01d", hour ); else sprintf( DateTime, "%02d", hour ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'l' ) { // hour, 12 hour clock ( 1 - 12) if ( hour == 0 ) sprintf( DateTime, "%02d", hour + 12 ); else if ( hour < 10 ) sprintf( DateTime, " %01d", hour ); else if ( hour <= 12 ) sprintf( DateTime, "%02d", hour ); else if ( hour < 22 ) sprintf( DateTime, " %01d", hour - 12 ); else sprintf( DateTime, "%02d", hour - 12 ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'm' ) { // month (01 - 12) sprintf( DateTime, "%02d", month + 1 ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'M' ) { // minute (00 - 59) sprintf( DateTime, "%02d", min ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'n' ) { // newline buf[posn] = '\n'; posn++; if ( posn >= last ) return posn; } else if ( next == 'p' ) { // am/pm on12 hour clock if ( hour < 0 ) sprintf( DateTime, "AM" ); else sprintf( DateTime, "PM" ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'r' ) { // hour:min:sec AM, 12 hour clock (01 - 12):(00 - 59):(00 - 59) (AM - PM) if ( hour == 0 ) sprintf( DateTime, "%02d:%02d:%02d AM", hour + 12, min, second ); else if ( hour > 12 ) sprintf( DateTime, "%02d:%02d:%02d PM", hour - 12, min, second ); else if ( hour == 12 ) sprintf( DateTime, "%02d:%02d:%02d PM", hour, min, second ); else sprintf( DateTime, "%02d:%02d:%02d AM", hour, min, second ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'R' ) { // hour:min, 24 hour clock (00 - 23):(00 - 59) sprintf( DateTime, "%02d:%02d", hour, min ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'S' ) { // second (00 - 59 with optional decimal point and numbers after the decimal point.) if ( i + 2 < fmtlen && format[i + 1] == '%' && ( format[i + 2] == '.' || isdigit( format[i + 2] ) != 0 ) ) { // nplaces is number of decimal places ( 0 < nplaces <= 9 ) if ( format[i + 2] == '.' ) // maximum number of places nplaces = 9; else nplaces = (int) strtol( &( format[i + 2] ), NULL, 10 ); i += 2; } else { nplaces = 0; } if ( nplaces == 0 ) { sprintf( DateTime, "%02d", (int) ( sec + 0.5 ) ); } else { sprintf( dynamic_format, "%%0%d.%df", nplaces + 3, nplaces ); sprintf( DateTime, dynamic_format, sec ); if ( format[i] == '.' ) { slen = (int) strlen( DateTime ) - 1; while ( DateTime[slen] == '0' && DateTime[slen - 1] != '.' ) { DateTime[slen] = '\0'; // remove trailing zeros slen--; } } } strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 's' ) { // seconds since 01 Jan 1970 Gregorian secsSince1970 = (int) ( nMJD->time_sec + ( nMJD->base_day - MJD_1970 ) * SecInDay ); sprintf( DateTime, "%d", secsSince1970 ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 't' ) { // tab buf[posn] = '\t'; posn++; if ( posn >= last ) return posn; } else if ( next == 'T' ) { // hour:min:sec, 24 hour clock (00 - 23):(00 - 59):(00 - 59) sprintf( DateTime, "%02d:%02d:%02d", hour, min, second ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'U' ) { // week of year as a number, (00 - 53) start of week is Sunday getYAD( &y1, &ifleapyear, &doy, nMJD, forceJulian ); days_in_wk1 = ( nMJD->base_day - doy - 4 ) % 7; w = ( doy + 6 - days_in_wk1 ) / 7; sprintf( DateTime, "%02d", w ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'u' ) { // weekday as a number, 0 = Monday d = 1 + ( nMJD->base_day - 5 ) % 7; sprintf( DateTime, "%01d", d ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'v' ) { // day-MonthName-year day of month ( 1 - 31) - month (Jan ... Dec) - year (yyyy) monthText = getMonth( month ); if ( ysign == 0 ) { if ( day < 10 ) sprintf( DateTime, " %01d-%s-%04d", day, monthText, year ); else sprintf( DateTime, "%02d-%s-%04d", day, monthText, year ); } else { if ( day < 10 ) sprintf( DateTime, " %01d-%s-(-)%04d", day, monthText, year ); else sprintf( DateTime, "%02d-%s-(-)%04d", day, monthText, year ); } strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'V' ) { // week of year as a number, (01 - 53) start of week is Monday and first week has at least 3 days in year getYAD( &y1, &ifleapyear, &doy, nMJD, forceJulian ); days_in_wk1 = ( nMJD->base_day - doy - 3 ) % 7; if ( days_in_wk1 <= 3 ) w = ( doy + 6 - days_in_wk1 ) / 7; // ensure first week has at least 3 days in this year else w = 1 + ( doy + 6 - days_in_wk1 ) / 7; if ( w == 0 ) w = 53; sprintf( DateTime, "%02d", w ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'w' ) { // weekday as a number, 0 = Sunday d = ( nMJD->base_day - 4 ) % 7; sprintf( DateTime, "%01d", d ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'W' ) { // week of year as a number, (00 - 53) start of week is Monday getYAD( &y1, &ifleapyear, &doy, nMJD, forceJulian ); days_in_wk1 = ( nMJD->base_day - doy - 3 ) % 7; w = ( doy + 6 - days_in_wk1 ) / 7; sprintf( DateTime, "%02d", w ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'x' ) { // date string dayText = getDayOfWeek( nMJD ); monthText = getMonth( month ); if ( ysign == 0 ) sprintf( DateTime, "%s %s %02d, %04d", dayText, monthText, day, year ); else sprintf( DateTime, "%s %s %02d, -%04d", dayText, monthText, day, year ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'X' ) { // time string sprintf( DateTime, "%02d:%02d:%02d", hour, min, second ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'y' ) { // 2 digit year y = year % 100; if ( ysign == 0 ) sprintf( DateTime, "%02d", y ); else sprintf( DateTime, "-%02d", y ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'Y' ) { // 4 digit year if ( ysign == 0 ) sprintf( DateTime, "%04d", year ); else sprintf( DateTime, "-%04d", year ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'Z' ) { // time zone and calendar, always UTC if ( forceJulian ) strncat( &( buf[posn] ), "UTC Julian", last - posn ); else strncat( &( buf[posn] ), "UTC Gregorian", last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == 'z' ) { // time zone, always UTC strncat( &( buf[posn] ), "+0000", last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == '+' ) { // date and time dayText = getDayOfWeek( nMJD ); monthText = getMonth( month ); if ( ysign == 0 ) sprintf( DateTime, "%s %s %02d %02d:%02d:%02d UTC %04d", dayText, monthText, day, hour, min, second, year ); else sprintf( DateTime, "%s %s %02d %02d:%02d:%02d UTC -%04d", dayText, monthText, day, hour, min, second, year ); strncat( &( buf[posn] ), DateTime, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } else if ( next == '.' || isdigit( next ) != 0 ) { // nplaces is number of decimal places ( 0 < nplaces <= 9 ) if ( next == '.' ) // maximum number of places nplaces = 9; else nplaces = (int) strtol( &( format[i] ), NULL, 10 ); // fractional part of seconds to maximum available accuracy sec_fraction = sec - (int) sec; sprintf( dynamic_format, "%%-%d.%df", nplaces + 2, nplaces ); //sprintf(DateTime, "%-11.9f", sec_fraction); sprintf( DateTime, dynamic_format, sec_fraction ); while ( ( ptr = strrchr( &( DateTime[0] ), ' ' ) ) != NULL ) ptr[0] = '\0'; // remove trailing white space if ( next == '.' ) { slen = (int) strlen( DateTime ) - 1; while ( DateTime[slen] == '0' && DateTime[slen - 1] != '.' ) { DateTime[slen] = '\0'; // remove trailing zeros slen--; } } ptr = strchr( DateTime, '.' ); // remove everything in front of the decimal point, and // ignore case (%0) where no decimal point exists at all. if ( ptr != NULL ) strncat( &( buf[posn] ), ptr, last - posn ); posn = strlen( buf ); if ( posn >= last ) return posn; } } else { // regular multi-byte character, pass it on buf[posn] = next; posn++; if ( posn >= last ) return posn; } buf[posn] = '\0'; i++; } return posn; } int geMJDtime_TAI( const MJDtime *number1, const TAI_UTC *number2 ) { // Returns true if number1 >= number2. // N.B. both number1 and number2 must be normalized. if ( number1->base_day > number2->base_day ) { return 1; } else if ( number1->base_day < number2->base_day ) { return 0; } else { return ( number1->time_sec >= number2->time_sec_tai ); } } int geMJDtime_UTC( const MJDtime *number1, const TAI_UTC *number2 ) { // Returns true if number1 >= number2. // N.B. both number1 and number2 must be normalized. if ( number1->base_day > number2->base_day ) { return 1; } else if ( number1->base_day < number2->base_day ) { return 0; } else { return ( number1->time_sec >= number2->time_sec_utc ); } } double leap_second_TAI( const MJDtime *MJD_TAI, int *inleap, int *index ) { // Logic assumes input MJD_TAI is in TAI // *inleap lets the calling routine know whether MJD_TAI corresponds // to an epoch when a positive leap increment is being inserted. MJDtime MJD_value, *MJD = &MJD_value; double leap; int debug = 0; // N.B. geMJDtime_TAI only works for normalized values. *MJD = *MJD_TAI; normalize_MJD( MJD ); // Search for index such that TAI_UTC_lookup_table[*index] <= MJD(TAI) < TAI_UTC_lookup_table[*index+1] bhunt_search( MJD, TAI_UTC_lookup_table, number_of_entries_in_tai_utc_table, sizeof ( TAI_UTC ), index, ( int ( * )( const void *, const void * ) )geMJDtime_TAI ); if ( debug == 2 ) fprintf( stderr, "*index = %d\n", *index ); if ( *index == -1 ) { // MJD is less than first table entry. // Debug: check that condition is met if ( debug && geMJDtime_TAI( MJD, &TAI_UTC_lookup_table[*index + 1] ) ) { fprintf( stderr, "libqsastime (leap_second_TAI) logic ERROR: bad condition for *index = %d\n", *index ); exit( EXIT_FAILURE ); } // There is (by assertion) no discontinuity at the start of the table. // Therefore, *inleap cannot be true. *inleap = 0; // Use initial offset for MJD values before first table entry. // Calculate this offset strictly from offset1. The slope term // doesn't enter because offset2 is the same as the UTC of the // first epoch of the table. return -TAI_UTC_lookup_table[*index + 1].offset1; } else if ( *index == number_of_entries_in_tai_utc_table - 1 ) { // MJD is greater than or equal to last table entry. // Debug: check that condition is met if ( debug && !geMJDtime_TAI( MJD, &TAI_UTC_lookup_table[*index] ) ) { fprintf( stderr, "libqsastime (leap_second_TAI) logic ERROR: bad condition for *index = %d\n", *index ); exit( EXIT_FAILURE ); } // If beyond end of table, cannot be in middle of leap second insertion. *inleap = 0; // Use final offset for MJD values after last table entry. // The slope term doesn't enter because modern values of the slope // are zero. return -TAI_UTC_lookup_table[*index].offset1; } else if ( *index >= 0 && *index < number_of_entries_in_tai_utc_table ) { // table[*index] <= MJD < table[*index+1]. // Debug: check that condition is met if ( debug && !( geMJDtime_TAI( MJD, &TAI_UTC_lookup_table[*index] ) && !geMJDtime_TAI( MJD, &TAI_UTC_lookup_table[*index + 1] ) ) ) { fprintf( stderr, "MJD = {%d, %f}\n", MJD->base_day, MJD->time_sec ); fprintf( stderr, "libqsastime (leap_second_TAI) logic ERROR: bad condition for *index = %d\n", *index ); exit( EXIT_FAILURE ); } leap = -( TAI_UTC_lookup_table[*index].offset1 + ( ( MJD->base_day - TAI_UTC_lookup_table[*index].offset2 ) + MJD->time_sec / SecInDay ) * TAI_UTC_lookup_table[*index].slope ) / ( 1. + TAI_UTC_lookup_table[*index].slope / SecInDay ); // Convert MJD(TAI) to normalized MJD(UTC). MJD->time_sec += leap; normalize_MJD( MJD ); // If MJD(UT) is in the next interval of the corresponding // TAI_UTC_lookup_table, then we are right in the middle of a // leap interval (recently a second but for earlier epochs it could be // less) insertion. Note this logic even works when leap intervals // are taken away from UTC (i.e., leap is positive) since in that // case the UTC *index always corresponds to the TAI *index. *inleap = geMJDtime_UTC( MJD, &TAI_UTC_lookup_table[*index + 1] ); return leap; } else { fprintf( stderr, "libqsastime (leap_second_TAI) logic ERROR: bad *index = %d\n", *index ); exit( EXIT_FAILURE ); } } void configqsas( double scale, double offset1, double offset2, int ccontrol, int ifbtime_offset, int year, int month, int day, int hour, int min, double sec, QSASConfig **qsasconfig ) { // Configure the transformation between continuous time and broken-down time // that is used for ctimeqsas, btimeqsas, and strfqsas. int forceJulian, ret; MJDtime MJD_value, *MJD = &MJD_value; // Allocate memory for *qsasconfig if that hasn't been done by a // previous call. if ( *qsasconfig == NULL ) { *qsasconfig = (QSASConfig *) malloc( (size_t) sizeof ( QSASConfig ) ); if ( *qsasconfig == NULL ) { fprintf( stderr, "configqsas: out of memory\n" ); exit( EXIT_FAILURE ); } } // Set bhunt_search index to a definite value less than -1 to insure no // initial hunt phase from some random index value is done. ( *qsasconfig )->index = -40; if ( scale != 0. ) { if ( ifbtime_offset ) { if ( ccontrol & 0x1 ) forceJulian = 1; else forceJulian = 0; ret = setFromUT( year, month, day, hour, min, sec, MJD, forceJulian ); if ( ret ) { fprintf( stderr, "configqsas: some problem with broken-down arguments\n" ); exit( EXIT_FAILURE ); } offset1 = (double) MJD->base_day; offset2 = MJD->time_sec / (double) SecInDay; } ( *qsasconfig )->scale = scale; ( *qsasconfig )->offset1 = offset1; ( *qsasconfig )->offset2 = offset2; ( *qsasconfig )->ccontrol = ccontrol; } else { // if scale is 0., then use default values. Currently, that // default is continuous time (stored as a double) is seconds since // 1970-01-01 while broken-down time is Gregorian with no other // additional corrections. ( *qsasconfig )->scale = 1. / (double) SecInDay; ( *qsasconfig )->offset1 = (double) MJD_1970; ( *qsasconfig )->offset2 = 0.; ( *qsasconfig )->ccontrol = 0x0; } } void closeqsas( QSASConfig **qsasconfig ) { // Close library if it has been opened. if ( *qsasconfig != NULL ) { free( (void *) *qsasconfig ); *qsasconfig = NULL; } } int ctimeqsas( int year, int month, int day, int hour, int min, double sec, double * ctime, QSASConfig *qsasconfig ) { MJDtime MJD_value, *MJD = &MJD_value; int forceJulian, ret; if ( qsasconfig == NULL ) { fprintf( stderr, "libqsastime (ctimeqsas) ERROR: configqsas must be called first.\n" ); exit( EXIT_FAILURE ); } if ( qsasconfig->ccontrol & 0x1 ) forceJulian = 1; else forceJulian = 0; ret = setFromUT( year, month, day, hour, min, sec, MJD, forceJulian ); if ( ret ) return ret; *ctime = ( ( (double) ( MJD->base_day ) - qsasconfig->offset1 ) - qsasconfig->offset2 + MJD->time_sec / (double) SecInDay ) / qsasconfig->scale; return 0; } void btimeqsas( int *year, int *month, int *day, int *hour, int *min, double *sec, double ctime, QSASConfig *qsasconfig ) { MJDtime MJD_value, *MJD = &MJD_value; int forceJulian; double integral_offset1, integral_offset2, integral_scaled_ctime; int inleap; if ( qsasconfig == NULL ) { fprintf( stderr, "libqsastime (btimeqsas) ERROR: configqsas must be called first.\n" ); exit( EXIT_FAILURE ); } MJD->time_sec = SecInDay * ( modf( qsasconfig->offset1, &integral_offset1 ) + modf( qsasconfig->offset2, &integral_offset2 ) + modf( ctime * qsasconfig->scale, &integral_scaled_ctime ) ); MJD->base_day = (int) ( integral_offset1 + integral_offset2 + integral_scaled_ctime ); if ( qsasconfig->ccontrol & 0x1 ) forceJulian = 1; else forceJulian = 0; if ( qsasconfig->ccontrol & 0x2 ) MJD->time_sec += leap_second_TAI( MJD, &inleap, &( qsasconfig->index ) ); else inleap = 0; // If in the middle of a positive leap increment insertion, normalize the // broken-down result so that *sec exceeds 60 to mark the insertion // (similar to the way February 29 marks a leap day). if ( inleap ) MJD->time_sec -= 1.; breakDownMJD( year, month, day, hour, min, sec, MJD, forceJulian ); if ( inleap ) *sec += 1.; } size_t strfqsas( char * buf, size_t len, const char *format, double ctime, QSASConfig *qsasconfig ) { MJDtime MJD_value, *MJD = &MJD_value; int forceJulian; double integral_offset1, integral_offset2, integral_scaled_ctime; int inleap; if ( qsasconfig == NULL ) { fprintf( stderr, "libqsastime (strfqsas) ERROR: configqsas must be called first.\n" ); exit( EXIT_FAILURE ); } MJD->time_sec = SecInDay * ( modf( qsasconfig->offset1, &integral_offset1 ) + modf( qsasconfig->offset2, &integral_offset2 ) + modf( ctime * qsasconfig->scale, &integral_scaled_ctime ) ); MJD->base_day = (int) ( integral_offset1 + integral_offset2 + integral_scaled_ctime ); if ( qsasconfig->ccontrol & 0x1 ) forceJulian = 1; else forceJulian = 0; if ( qsasconfig->ccontrol & 0x2 ) MJD->time_sec += leap_second_TAI( MJD, &inleap, &( qsasconfig->index ) ); else inleap = 0; return strfMJD( buf, len, format, MJD, forceJulian, inleap ); } // bhunt_search. Search an ordered table with a binary hunt phase and a // binary search phase. // // On entry *low is used to help the hunt phase speed up the binary // search when consecutive calls to bhunt_search are made with // similar key values. On exit, *low is adjusted such that // base[*low] <= key < base[(*low+1)] with the special cases of //low set to -1 to indicate the key < base[0] and *low set to n-1 // to indicate base[n-1] <= key. The function *ge must return true (1) // if its first argument (the search key) is greater than or equal to // its second argument (a table entry). Otherwise it returns false // (0). Items in the array base must be in ascending order. void bhunt_search( const void *key, const void *base, int n, size_t size, int *low, int ( *ge )( const void *keyval, const void *datum ) ) { const void *indexbase; int mid, high, hunt_inc = 1; // If previous search found below range, then assure one hunt cycle // just in case new key is also below range. if ( *low == -1 ) *low = 0; // Protect against invalid or undefined *low values where hunt // is waste of time. if ( *low < 0 || *low >= n ) { *low = -1; high = n; } else { // binary hunt phase where we are assured 0 <= *low < n indexbase = (const void *) ( ( (const char *) base ) + ( size * (size_t) ( *low ) ) ); if ( ( *ge )( key, indexbase ) ) { high = ( *low ) + hunt_inc; indexbase = (const void *) ( ( (const char *) base ) + ( size * (size_t) high ) ); // indexbase is valid if high < n. while ( ( high < n ) && ( ( *ge )( key, indexbase ) ) ) { *low = high; hunt_inc += hunt_inc; high = high + hunt_inc; indexbase = (const void *) ( ( (const char *) base ) + ( size * (size_t) high ) ); } if ( high >= n ) high = n; // At this point, low is valid and base[low] <= key // and either key < base[high] for valid high or high = n. } else { high = *low; *low = high - hunt_inc; indexbase = (const void *) ( ( (const char *) base ) + ( size * (size_t) ( *low ) ) ); // indexbase is valid if(*low) >= 0 while ( ( ( *low ) >= 0 ) && !( ( *ge )( key, indexbase ) ) ) { high = *low; hunt_inc += hunt_inc; *low = ( *low ) - hunt_inc; indexbase = (const void *) ( ( (const char *) base ) + ( size * (size_t) ( *low ) ) ); } if ( ( *low ) < 0 ) *low = -1; // At this point high is valid and key < base[high] // and either base[low] <= key for valid low or low = -1. } } // binary search phase where we are assured base[low] <= key < base[high] // when both low and high are valid with obvious special cases signalled // by low = -1 or high = n. while ( high - *low > 1 ) { mid = *low + ( high - *low ) / 2; indexbase = (const void *) ( ( (const char *) base ) + ( size * (size_t) mid ) ); if ( ( *ge )( key, indexbase ) ) *low = mid; else high = mid; } } plplot-5.10.0+dfsg/lib/qsastime/qsastime_test.out_standard 644 1750 1750 260211175640373 226310ustar andrewandrewStart date/time components: 2004-1-23 13:39: 2.345678901 date/time components: 2004-1-23 13:39: 2.345678901 MJD = 53027, seconds = 49142.345678901 MJD = 53027.5687771491 JD = 2453028.0687771491 ISO string = '2004-01-23 13:39:02.3456789010' strfMJD:ISO equiv: '2004-01-23 13:39:02.345678901' strfMJD:ISO equiv: '2004-01-23T13:39:02.3457Z' difference MJD (month/day) - MJD(doy) '0' difference MJD (d-1, h+24) - MJD(d, h) '-8.42125e-17' CDF epoch sec 63242084342345.680 from CDF ISO string (CDF epoch is accurate to msec only) = '2004-01-23T13:39:02.3456802368Z' Day of week is/was Fri ISO string = '2004-01-23 13:39:02.3456789010' for 2004-01-23 13:39:02.3456789010, MJD = 53027, seconds = 49142.345679 ISO string = '2004-01-23T13:39:02.3456789010Z' for 2004-01-23T13:39:02.3456789010Z, MJD = 53027, seconds = 49142.345679 Gregorian = '1752-09-14 00:39:02.3456789010' 1752-09-03T00:39:02.3456789010Z Julian = '1752-09-14 00:39:02.3456789010' Gregorian, (give us back our 11 days) chars 154 for strfMJD(): -------- 'Fri Jan 23 13:39:02 UTC 2004' Fri Jan 23 13:39:02 2004 01/23/04 2004-01-23 023 01:39:02 PM 1074865142 23-Jan-2004 strftime(): (invalid before 1970 on some systems and subject to time zones on all systems) ------ 'Fri Jan 23 13:39:02 UTC 2004' Fri Jan 23 13:39:02 2004 01/23/04 2004-01-23 023 01:39:02 PM 1074893942 23-Jan-2004 plplot-5.10.0+dfsg/lib/qsastime/qsastimeP.h.in 644 1750 1750 667112276771565 201040ustar andrewandrew#ifndef _QSASTIMEP_H_ #define _QSASTIMEP_H_ // Declaration of private structures within libqsastime which the user does // not need to acccess. // Also definition of functions within libqsastime that are needed // for testing of libqsastime, but which are not normally needed for anything // else #include "qsastime.h" typedef struct MJDtimeStruct { // // MJD starts at 0h, so truncating MJD always gives the same day whatever the time (unlike JD). // The MJD base day is arbitrary, i.e. seconds can be greater than one day or even negative. // int base_day; // integer part of MJD used as default double time_sec; // seconds from start of base_day }MJDtime; struct QSASConfigStruct { // Values used to define the transformation between broken down time // and continuous time for the public API of libqsastime, // continuous_time_qsas, broken_down_time_qsas, and strfqsas. // scale multiplies the continuous time variable to convert the units to // days. double scale; // offset1 and offset2 (in days) specifies the amount to add to the // scaled continuous time to derive the MJD time value that is used // internally by libqsastime. Normally epoch1 is an integral // value (which can be exactly stored in a double for a very wide // range of integers) and offset2 is normally a non-integral value // whose absolute value is less than 1. This arrangement allows the // continuous time variable in the API to be stored as a single double // without compromising numerical precision if epoch1 and epoch2 // are chosen wisely. double offset1, offset2; // The various bits of ccontrol are used as independent switches to // control optional additional corrections which define the // transformation between continuous time and broken-down time. // // If bit 0 (the lowest order bit of ccontrol) is 1 the Julian // proleptic calendar is used for broken-down time. Otherwise the // Gregorian proleptic calendar is used for broken-down time. // // If bit 1 is 1, an additional correction for the difference // between atomic-clock based times and UTC is applied to the broken-down // times. // // We reserve other bits of ccontrol for future use. int ccontrol; // index keeps track of latest bhunt_search index. int index; }; // Set if the qsastime library is being tested. #cmakedefine TEST_QSASTIME #ifdef TEST_QSASTIME #define QSASTIME_static #else #define QSASTIME_static static #endif QSASTIME_static void bhunt_search( const void *key, const void *base, int n, size_t size, int *low, int ( *ge )( const void *keyval, const void *datum ) ); QSASTIME_static int setFromUT( int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian ); QSASTIME_static void breakDownMJD( int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian ); QSASTIME_static size_t strfMJD( char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int if60secformat ); QSASTIME_static void normalize_MJD( MJDtime *MJD ); QSASTIME_static const char * getDayOfWeek( const MJDtime *MJD ); QSASTIME_static const char * getLongDayOfWeek( const MJDtime *MJD ); QSASTIME_static const char * getMonth( int m ); QSASTIME_static const char * getLongMonth( int m ); QSASTIME_static void getYAD( int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian ); #endif plplot-5.10.0+dfsg/lib/qsastime/qsastime.html 644 1750 1750 47142512276771565 201370ustar andrewandrew SYNOPSIS

MJDtime Routines

 

QSAS Support Team

Cluster Science Centre, Imperial College

csc-support-dl@imperial.ac.uk

Provided under the library gnu public licence (LGPL).

 

           

These routines convert between various date and time formats. The date and time is stored internally as a structure , MJDtime, containing an integer, as the integer part of the MJD date, and a double representing the seconds offset from the start of this day. Routines exist to also set and get MJD, JD, formatted date/time strings and NASA CDF epoch date/times from this structure.

 

Modified Julian Date (MJD) measures days (and fractional days) since the start of 17 Nov 1858 CE in Universal Time (UTC). Julian Date (JD) measures days (and fractional days) since noon on 1 January, 4713 BCE in Universal Time (UTC).

 

Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5

 

Common Era (CE) and Before Common Era (BCE) are also often called AD and BC respectively.

 

These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian). In some routines the forceJulian flag can be set to 1 to override this and explicitly use the Julian calendar in conversions. The default value for forceJulian is 0 (do not force use of Julian Calendar). Note C libraries use Gregorian only from 14 Sept 1752 and will yield different results between years 1582 and 1752.

 

 More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php

These routines have been compared with the results of the US Naval Observatory online converter.

             

 In all routines, specifying a day, hour, minute or second field greater than would be valid is

 handled with modulo arithmetic and is safe.

Thus 2006-12-32 00:62:00.0 will be safely, and correctly, treated as 2007-01-01 01:02:00.0

             

MJD starts at 0h, so truncating MJD always gives the same day whatever the time of day (unlike JD). The seconds offset may take any value, so that any date/time may be expressed in terms of an offset from the same MJD day. The seconds field thus may exceed a single day, and may also be negative.

 

typedef struct MJDtimeStruct

{

            int base_day; /* integer part of MJD  */

            double time_sec; /* seconds from start of base_day */

           

}MJDtime;

 

 

 

 

Routines

 

void setFromUT  (int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int  forceJulian);

 

void setFromDOY (int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian);

 

void setFromBCE  (int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD);

 

void setFromMJD  (double ModifiedJulianDate, MJDtime *MJD);

 

void setFromJD  (double JulianDate, MJDtime *MJD);

 

int setFromISOstring(const char* ISOstring, MJDtime *MJD);

 

void setFromCDFepoch  (double cdfepoch, MJDtime *MJD);

 

void breakDownMJD  (int *year, int *month, int *day, int *hour, int *min, double *sec,  const MJDtime *MJD, int forceJulian);

 

double getMJD  (MJDtime *MJD);

 

double getJD  (MJDtime *MJD);

 

double getDiffDays  (MJDtime *MJD1, MJDtime *MJD2);

 

double getDiffSecs  (MJDtime *MJD1, MJDtime *MJD2);

 

double getCDFepoch  (MJDtime *MJD);

 

const char * getISOString  (MJDtime *MJD, int delim);

 

const char * getDayOfWeek  (const MJDtime *MJD);

 

const char * getLongDayOfWeek  (const MJDtime *MJD);

 

const char * getMonth  (int m);

 

const char * getLongMonth  (int m);

 

int getDOY  (const MJDtime *MJD, int Julian);

 

size_t strfMJD  (char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian);

 

 

 

 

 

 

 

 

 

 

 

Detailed Descriptions

 

#include <MJDtime.h>

 

void setFromUT  (int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int  forceJulian);

 

DESCRIPTION

The setFromUT() function constructs an MJDtime structure from the broken down year, month, day, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following  4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian).  Note C libraries use Gregorian only from 14 Sept 1752 onwards.

 

 

void setFromDOY (int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian);

 

DESCRIPTION

The setFromDOY() function constructs an MJDtime structure from the broken down year,  day of year, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following  4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian).  Note C libraries use the Gregorian calendar only from 14 Sept 1752 onwards.

 

 

void setFromBCE  (int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD);

 

DESCRIPTION

The setFromBCE() function constructs an MJDtime structure from the broken down year (BCE),  month, day, hour, minute and seconds. Note BCE years start from 0 CE, so year CE = 1 year BCE. Julian Calendar is always used in setFromBCE().

 

void setFromMJD  (double ModifiedJulianDate, MJDtime *MJD);

 

DESCRIPTION

The setFromMJD() function constructs an MJDtime structure from Modified Julian Date as a double. MJD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC.

 

void setFromJD  (double JulianDate, MJDtime *MJD);

 

DESCRIPTION

The setFromJD() function constructs an MJDtime structure from Julian Date as a double. JD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC. MJD = JD 2400000.5 since JD starts at noon.

 

int setFromISOstring(const char* ISOstring, MJDtime *MJD);

 

 

DESCRIPTION

The setFromISOstring() function constructs an MJDtime structure from an ISO standard format Date and time string in UTC. Gregorian Calendar is assumed from 15 Oct 1582.

The ISO format is of the form "1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z". Both the T separator and the trailing Z are optional, and any number of decimal places after the seconds field are allowed.

 

void setFromCDFepoch  (double cdfepoch, MJDtime *MJD);

 

DESCRIPTION

The setFromCDFepoch() function constructs an MJDtime structure from the NASA CDF Epoch as a double. CDF Epoch measures milliseconds from 0 CE (1 BCE) on the Gregorian Calendar. It is intended for use with space missions in the Common Era and will give misleading dates on the Julian Calendar. Much faster routines exist for handling conversion of CDF epochs to time strings in the modern restricted interval of applicability, but the algorithm here is consistent with the rest of the routines at all dates.

 

void breakDownMJD  (int *year, int *month, int *day, int *hour, int *min, double *sec,  const MJDtime *MJD, int forceJulian);

 

DESCRIPTION

The brteakDownMJD() function converts an MJDtime structure into the broken down year, month, day, hour, minute and seconds. If the forceJulian flag is 1 the Julian Calendar is used whatever the date, otherwise the Gregorian calendar is used from the day following  4 Oct 1582 (Julian) i.e. from 15 Oct 1582 (Gregorian).  Note C libraries use Gregorian only from 14 Sept 1752 onwards.

 

double getMJD  (MJDtime *MJD);

 

DESCRIPTION

The getMJD() function converts an MJDtime structure into a Modified Julian Date as a double. MJD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC.

 

double getJD  (MJDtime *MJD);

 

DESCRIPTION

The getJD() function converts an MJDtime structure into a Julian Date as a double. JD is calendar independent and forms a continuous sequence of days and fractions of days. Time is measured in UTC.

 

double getCDFepoch  (MJDtime *MJD);

 

DESCRIPTION

The getCDFepoch() function converts an MJDtime structure into the NASA CDF Epoch as a double. CDF Epoch measures milliseconds from 0 CE (1 BCE) on the Gregorian Calendar. It is intended for use with space missions in the Common Era and will give misleading dates on the Julian Calendar. Much faster routines exist for handling conversion of CDF epochs to time strings in the modern restricted interval of applicability, but the algorithm here is consistent with the rest of the routines at all dates.

 

const char * getISOString  (MJDtime *MJD, int delim);

 

DESCRIPTION

The getISOString() function converts an MJDtime structure into an ISO date/time string measured in UTC. Uses the default change over date for Julian to Gregorian calendars, 15 Oct 1582. If delim is 1 then the T and Z delimiters are used, otherwise the date and time part are space separated. The resulting string is of the form

"1995-01-23 02:33:17.235" or "1995-01-23T02:33:17.235Z".  

It returns a pointer to a static string and is therefore not thread safe. The returned string must be copied if it is to be retained beyond a repeat call, for example :

printf("%s Julian =  %s Gregorian \n" , getISOString(&MJD1,1), getISOString(&MJD1,0));

will use the same string twice rather than distinct strings.

 

This is only a convenience utility for quick testing and simple use, and is equivalent to the (thread safe) strfMJD() call which is preferred for robust coding. The equivalent call would be

   char buf[360];

   strfMJD(&(buf[0]), 360, "%Y-%m-%dT%H:%M:%S%.Z",  &MJD2, 0);

(note the decimal point before the final Z gives all available accuracy for the seconds fraction).

Also, for a specific accuracy, e.g. microseconds, use strfMJD() as in

strfMJD(&(buf[0]), 360, "%Y-%m-%d %H:%M:%S%6",  &MJD2, 0);

 

double getDiffDays  (MJDtime *MJD1, MJDtime *MJD2);

 

DESCRIPTION

The getDiffDays() function returns the difference between two MJDtime structures measured in days as a double. The MJDtime structures do not need to have the same base day.

 

double getDiffSecs  (MJDtime *MJD1, MJDtime *MJD2);

 

DESCRIPTION

The getDiffSecs() function returns the difference between two MJDtime structures measured in seconds as a double. The MJDtime structures do not need to have the same base day.

 

const char * getDayOfWeek  (const MJDtime *MJD);

 

DESCRIPTION

The getDayOfWeek() function returns a char * pointer to a static null terminated string holding the short (3 character) text name for the day, in English, e.g. Mon, Tue, etc.

 

const char * getLongDayOfWeek  (const MJDtime *MJD);

 

DESCRIPTION

The getLongDayOfWeek() function returns a char * pointer to a static null terminated string holding the full text name for the day, in English, e.g. Monday, Tuesday, etc.

 

const char * getMonth  (int m);

 

DESCRIPTION

The getMonth() function returns a char * pointer to a static null terminated string holding the short (3 character) text name for the month, in English, e.g. Jan, Feb, etc.

 

const char * getLongMonth  (int m);

 

DESCRIPTION

The getLongMonth() function returns a char * pointer to a static null terminated string holding the full text name for the month, in English, e.g. January, February, etc.

 

int getDOY  (const MJDtime *MJD, int forceJulian);

 

DESCRIPTION

The getDOY() function returns the day of year as an int for the current day in the MJDtime structure MJD. If seconds are negative or hold more than one day the day is adjusted accordingly, thus it is not simply the doy for the integer part of the MJDtime structure. If the forceJulian flag is set to 1 the Julian calendar is used, otherwise the Gregorian calendar is used from the day following  4 Oct, 1582 (Julian) i.e. from 15 Oct, 1582 (Gregorian).  Note C libraries use Gregorian only from 14 Sept, 1752 onwards.

 

size_t  strfMJD  (char * buf, size_t len,  const char * format, const MJDtime MJD);

 

DESCRIPTION

The strfMJD () function formats the information from MJD into the

buffer buf according to the string pointed to by format using the formatting conventions of strftime();

 

The format string consists of zero or more conversion specifications and

ordinary characters.  All ordinary characters are copied directly into

the buffer.  A conversion specification consists of a percent sign

`%' and one other character.

 

No more than len characters will be placed into the array, including the terminating NULL. strfMJD () returns the number of characters written into the array, not counting the terminating NULL. The output is truncated when len - 1 characters is reached.

 

This routine differs from strftime() in that all date/times are in UTC and no locale or national variations in names are used. All names are returned in English.

 

The conversion specifications are copied to the buffer after expansion as

follows:-

 

%A   is replaced by a representation of the full weekday name.

 

%a    is replaced by a representation of the abbreviated weekday name.

 

%B    is replaced by a representation of the full month name.

 

%b    is replaced by a representation of the abbreviated month name.

 

%C   is replaced by (year / 100) as decimal number; single digits are preceded by a zero.

 

%c    is replaced by a representation of time and date.

 

%D   is equivalent to ``%m/%d/%y''.

 

%d    is replaced by the day of the month as a decimal number (01-31).

 

%e    is replaced by the day of month as a decimal number (1-31); single digits are preceded by a blank.

 

%F    is equivalent to ``%Y-%m-%d''.

 

%G   is replaced by a year as a decimal number with century.  This year is the one that contains the greater part of the week (Monday as the first day of the week).

 

%g    is replaced by the same year as in ``%G'', but as a decimal number without century (00-99).

 

%H    is replaced by the hour (24-hour clock) as a decimal number (00-23).

 

%h    the same as %b.

 

%I    is replaced by the hour (12-hour clock) as a decimal number (01-12).

 

%j    is replaced by the day of the year as a decimal number (001-366).

 

%k    is replaced by the hour (24-hour clock) as a decimal number (0-23); single digits are preceded by a blank.

 

%l    is replaced by the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank.

 

%M   is replaced by the minute as a decimal number (00-59).

 

%m    is replaced by the month as a decimal number (01-12).

 

%n    is replaced by a newline.

 

%p    is replaced by AM or PM as appropriate.

 

%R    is equivalent to %H:%M.

 

%r    is equivalent to %I:%M:%S %p.

 

%S    is replaced by the second as a decimal number (00-60).

 

%s    is replaced by the number of seconds since 1 Jan 1970, UTC.

 

%T    is equivalent to %H:%M:%S.

 

%t    is replaced by a tab.

 

%U   is replaced by the week number of the year (Sunday as the first day of the week) as a decimal number (00-53).

 

%u    is replaced by the weekday (Monday as the first day of the week) as a decimal number (1-7).

 

%V   is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (01-53).  If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next week is week 1.

 

%v    is equivalent to %e-%b-%Y.

 

%W  is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (00-53).

 

%w   is replaced by the weekday (Sunday as the first day of the week) as a decimal number (0-6).

 

%X   is replaced by a representation of the time.

 

%x   is replaced by a representation of the date.

 

%Y   is replaced by the year with century as a decimal number.

 

%y    is replaced by the year without century as a decimal number (00-99).

 

%Z    is replaced by the time zone name.

 

%z    is replaced by the time zone offset from UTC; a leading plus sign stands for east of UTC, a minus sign for west of UTC, hours and minutes follow with two digits each and no delimiter between them (always gives +0000).

 

%+    is replaced by a representation of the date and time of the form

Fri Jan 23 15:06:10 UTC 2009

 

%%    is replaced by %.

 

The following extra two option flags are also provided although they are not available in the strftime() routines.

 

%(0-9)      is replaced by the fractional part of the seconds field to the specified accuracy. Thus %S%3 would give seconds to millisecond accuracy (00.000).

 

%.     (decimal point) is replaced by the fractional part of the seconds field to available accuracy. Thus %S%. would give seconds with fractional part up to 9 decimal places if available. Spaces are removed from the end of the string but zeros are left. This may behave slightly differently on different platforms.

 

All other flags are silently ignored and not printed.

plplot-5.10.0+dfsg/lib/qsastime/tai-utc-gen.c 644 1750 1750 2160411646000332 176230ustar andrewandrew// $Id: tai-utc-gen.c 11971 2011-10-14 09:28:58Z andrewross $ // // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // Program for generating data structure used for containing tai-utc // conversion information (linear transforms and leap seconds). // // The program assumes that argv[1] will be the input file, and // argv[2] the output file. This works cross-platform without // worrying about shell redirects of stdin and stdout that are // not accessible on Windows, apparently. #include #include #include #include //-------------------------------------------------------------------------- // Function-like macro definitions //-------------------------------------------------------------------------- #define MemError1( a ) do { fprintf( stderr, "MEMORY ERROR %d\n" a "\n", __LINE__ ); exit( __LINE__ ); } while ( 0 ) const char header[] = "" \ "/*\n" \ " This file is part of PLplot.\n" \ " \n" \ " PLplot is free software; you can redistribute it and/or modify\n" \ " it under the terms of the GNU Library General Public License as published\n" \ " by the Free Software Foundation; either version 2 of the License, or\n" \ " (at your option) any later version.\n" \ " \n" \ " PLplot is distributed in the hope that it will be useful,\n" \ " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \ " GNU Library General Public License for more details.\n" \ " \n" \ " You should have received a copy of the GNU Library General Public License\n" \ " along with PLplot; if not, write to the Free Software\n" \ " Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n" \ " \n" \ " \n" \ " This header file contains the table containing the linear transforms \n" \ " for converting between TAI and UTC.\n" \ " It is an automatically generated file, so please do\n" \ " not edit it directly. Make any changes to tai-utc.dat then use\n" \ " tai-utc-gen to recreate this header file.\n" \ " \n" \ " tai-utc.dat contains four essential fields to represent the following\n" \ " formula for the linear transformation between TAI and UTC: \n" \ " TAI-UTC (seconds) = offset1 + (MJD-offset2)*slope\n" \ " There are four essential fields per line in tai-utc.dat to represent\n" \ " this formula. They are the Julian date (UTC) where the linear\n" \ " transformation implied by the line is first applied;\n" \ " offset1 (seconds); offset2 (days), and slope (secs/day).\n" \ " \n" \ "*/"; int main( int argc, char *argv[] ) { FILE *fr, *fw; char readbuffer[256]; int *MJDstart = NULL; double *offset1 = NULL; int *offset2 = NULL; double *slope = NULL; double sec, *leap_sec = NULL; int jd; int i = 0; int number_of_lines = 0; if ( ( argc < 2 ) || ( fr = fopen( argv[1], "r" ) ) == NULL ) { fprintf( stderr, "Cannot open first file as readable\n" ); exit( 1 ); } if ( ( argc < 3 ) || ( fw = fopen( argv[2], "w" ) ) == NULL ) { fprintf( stderr, "Cannot open second file as writable\n" ); exit( 1 ); } // // Work out how many lines we have all up // while ( ( fgets( readbuffer, 255, fr ) != NULL ) ) { ++number_of_lines; } // // Allocate memory to the arrays which will hold the data // if ( ( MJDstart = (int *) calloc( (size_t) number_of_lines, (size_t) sizeof ( int ) ) ) == NULL ) MemError1( "Allocating memory to the MJDstart table" ); if ( ( offset1 = (double *) calloc( (size_t) number_of_lines, (size_t) sizeof ( double ) ) ) == NULL ) MemError1( "Allocating memory to the offset1 table" ); if ( ( offset2 = (int *) calloc( (size_t) number_of_lines, (size_t) sizeof ( int ) ) ) == NULL ) MemError1( "Allocating memory to the offset2 table" ); if ( ( slope = (double *) calloc( (size_t) number_of_lines, (size_t) sizeof ( double ) ) ) == NULL ) MemError1( "Allocating memory to the slope table" ); if ( ( leap_sec = (double *) calloc( (size_t) number_of_lines, (size_t) sizeof ( double ) ) ) == NULL ) MemError1( "Allocating memory to the leap_sec table" ); rewind( fr ); // Go back to the start of the file // // Read in line by line, and copy the numbers into our arrays // while ( ( fgets( readbuffer, 255, fr ) != NULL ) ) { sscanf( readbuffer, "%*s %*s %*s %*s %d.5 %*s %lf %*s %*s %*s %*s %d.) X %lf S", (int *) &jd, (double *) &offset1[i], (int *) &offset2[i], (double *) &slope[i] ); // Should be exact since all jd's in the file are integer+0.5 MJDstart[i] = jd - 2400000; i++; } fclose( fr ); // // Write the data out to file ready to be included in our source // fprintf( fw, "%s\n", header ); fprintf( fw, "typedef struct {\n\tint base_day;\n\tdouble time_sec_tai;\n\tdouble time_sec_utc;\n\tdouble size_prev_leap_sec;\n\tdouble offset1;\n\tint offset2;\n\tdouble slope;\n} TAI_UTC;\n\n" ); fprintf( fw, "const int number_of_entries_in_tai_utc_table=%d;\n\n", number_of_lines ); fprintf( fw, "const TAI_UTC TAI_UTC_lookup_table[%d] = {\n", number_of_lines ); for ( i = 0; i < number_of_lines; i++ ) { sec = offset1[i] + (double) ( MJDstart[i] - offset2[i] ) * slope[i]; if ( i == 0 ) leap_sec[i] = 0.; else // sec is TAI-UTC in seconds calculated from UTC transformation // (equation 1 in README.tai-utc). This calculation must be correct // for start of epoch range. However, near end of epoch range where // ambiguities in UTC occur, must use equivalent TAI transformation // (equation 2 from same source) to calculate the UTC discontinuity // unambiguously. leap_sec[i] = sec - ( offset1[i - 1] + (double) ( MJDstart[i] + sec / 86400. - offset2[i - 1] ) * slope[i - 1] ) / ( 1. + slope[i - 1] / 86400. ); if ( fabs( leap_sec[i] ) < 1.e-14 ) leap_sec[i] = 0.; fprintf( fw, "{%d, %15.8f, 0., %20.14f, %15.8f, %d, %15.8f},\n", MJDstart[i], sec, leap_sec[i], offset1[i], offset2[i], slope[i] ); } fprintf( fw, "};\n" ); fclose( fw ); free( MJDstart ); free( offset1 ); free( offset2 ); free( slope ); free( leap_sec ); return ( 0 ); } plplot-5.10.0+dfsg/lib/qsastime/qsastime_extra.h 644 1750 1750 546212276771565 205570ustar andrewandrew#ifndef _QSASTIME_EXTRA_H_ #define _QSASTIME_EXTRA_H_ // // This software originally contributed under the LGPL in January 2009 to // PLplot by the // Cluster Science Centre // QSAS team, // Imperial College, London // Copyright (C) 2009 Imperial College, London // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // MJD measures from the start of 17 Nov 1858 // These utilities use the Gregorian calendar after 4 Oct 1582 (Julian) i.e. from 15 Oct 1582 Gregorian // Note C libraries use Gregorian only from 14 Sept 1752 // More detailed discussion can be found at http://aa.usno.navy.mil/data/docs/JulianDate.php // These routines have been compared with the results of the US Naval Observatory online converter. // Modified Julian Date (MJD) = Julian Date (JD) - 2400000.5 // // In all routines, specifying a day, hour, minute or second field greater than would be valid is // handled with modulo arithmetic and safe. // Thus 2006-12-32 00:62:00.0 will safely, and correctly, be treated as 2007-01-01 01:02:00.0 // // #include #include #include // include header file for dll definitions #include "qsastimeP.h" QSASTIMEDLLIMPEXP void setFromDOY( int year, int doy, int hour, int min, double sec, MJDtime *MJD, int forceJulian ); QSASTIMEDLLIMPEXP void setFromBCE( int yearBCE, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian ); QSASTIMEDLLIMPEXP void setFromMJD( double ModifiedJulianDate, MJDtime *MJD ); QSASTIMEDLLIMPEXP void setFromCDFepoch( double cdfepoch, MJDtime *MJD ); QSASTIMEDLLIMPEXP void setFromJD( double JulianDate, MJDtime *MJD ); QSASTIMEDLLIMPEXP int setFromISOstring( const char* ISOstring, MJDtime *MJD, int forceJulian ); QSASTIMEDLLIMPEXP double getMJD( MJDtime *MJD ); QSASTIMEDLLIMPEXP double getJD( MJDtime *MJD ); QSASTIMEDLLIMPEXP double getDiffDays( MJDtime *MJD1, MJDtime *MJD2 ); QSASTIMEDLLIMPEXP double getDiffSecs( MJDtime *MJD1, MJDtime *MJD2 ); QSASTIMEDLLIMPEXP double getCDFepoch( MJDtime *MJD ); QSASTIMEDLLIMPEXP const char * getISOString( MJDtime *MJD, int delim, int forceJulian ); //** Warning getISOString is not thread safe ** #endif plplot-5.10.0+dfsg/lib/qsastime/README.qsastime_tests 644 1750 1750 2117111200212260 212570ustar andrewandrewWe have implemented a number of applications to test the qsastime library. In general, if you want to build any of these test applications you specify the cmake option -DTEST_QSASTIME=ON (but an additional option has to be set for the qsastime_testlib case discussed below in III). (I) lib/qsastime/qsastime_test is automatically built in the build tree if -DTEST_QSASTIME=ON. This test routine does some minimal tests of the qsastime library using the C library. Because the date range is so small, I believe this test builds and runs on every platform without running into C library limitations. Note some of the results of this test depend on C library routines whose results depend on the local time zone. Run this test as follows from the top of the build tree lib/qsastime/qsastime_test >qsastime_test.out Then compare these output results with those at lib/qsastime/qsastime_test.out_standard in the source tree. Your results will differ in some respects if you have a different time zone than the PST (7 hours west of Greenwich) time zone where the lib/qsastime/qsastime_test.out_standard result was produced. (II) lib/qsastime/bhunt_search_test is automatically built in the build tree if -DTEST_QSASTIME=ON. Depending on input, this test routine is capable of severe testing of the bhunt_search routine in the qsastime library. The point of bhunt_search is to avoid scanning through the whole leap second table every time you are dealing with a broken-down or continuous time. So this algorithm follows the general idea in Numerical Recipes of first having a hunt phase where the increment (or decrement) in index is doubled until the value is bracketed, and then bisection is used to find the index such that x[index] <= value < x[index+1], (1) This has been implemented as a completely generalized routine so "<=" and "<" stand for a generalized comparison of anything that can be stuffed into a struct, with the comparisons provided by a callback routine. bhunt_search_test tests bhunt_search as follows: ntable, offset, and multiplier values are provided via stdin. bhunt_search_test then creates a table of ntable double values (of 0. through (double) ntable-1) and searches that table at a set of ntest = (ntable-1)*multiplier +1 (2) points which are offset from the table range by offset. (Thus, large positive or negative offset values allow you to test repeated searches for data beyond the ends of the table.) An offset of zero and a multiplier of 1 mean you search the table for the exact table values rather than something in between the table values. For each of the ntest values, bhunt_search returns an index which the test routine then tests to make sure it satisfies condition 1 above. Here are some typical results for a table with 64 values (somewhat larger than the current TAI-UTC offset table which has 38 values.) software@raven> echo '64 0 1000'| lib/qsastime/bhunt_search_test ntable, offset, multiplier, ntest = 64, 0, 1000, 63001 Average number of gedouble calls per bhunt_search call = 6.015889 for ifhunt, ifrandom = 0,0 Average number of gedouble calls per bhunt_search call = 6.016444 for ifhunt, ifrandom = 0,1 Average number of gedouble calls per bhunt_search call = 2.002016 for ifhunt, ifrandom = 1,0 Average number of gedouble calls per bhunt_search call = 8.502754 for ifhunt, ifrandom = 1,1 Successful completion of bhunt_search test software@raven> echo '64 -64 1000'| lib/qsastime/bhunt_search_test ntable, offset, multiplier, ntest = 64, -64, 1000, 63001 Average number of gedouble calls per bhunt_search call = 6.000000 for ifhunt, ifrandom = 0,0 Average number of gedouble calls per bhunt_search call = 6.000000 for ifhunt, ifrandom = 0,1 Average number of gedouble calls per bhunt_search call = 1.000079 for ifhunt, ifrandom = 1,0 Average number of gedouble calls per bhunt_search call = 1.000079 for ifhunt, ifrandom = 1,1 Successful completion of bhunt_search test software@raven> echo '64 64 1000'| lib/qsastime/bhunt_search_test ntable, offset, multiplier, ntest = 64, 64, 1000, 63001 Average number of gedouble calls per bhunt_search call = 7.000000 for ifhunt, ifrandom = 0,0 Average number of gedouble calls per bhunt_search call = 7.000000 for ifhunt, ifrandom = 0,1 Average number of gedouble calls per bhunt_search call = 1.000095 for ifhunt, ifrandom = 1,0 Average number of gedouble calls per bhunt_search call = 1.000095 for ifhunt, ifrandom = 1,1 Successful completion of bhunt_search test Here are results for a table with one million values. software@raven> echo '1000000 0 10'| lib/qsastime/bhunt_search_test ntable, offset, multiplier, ntest = 1000000, 0, 10, 9999991 Average number of gedouble calls per bhunt_search call = 19.951426 for ifhunt, ifrandom = 0,0 Average number of gedouble calls per bhunt_search call = 19.951496 for ifhunt, ifrandom = 0,1 Average number of gedouble calls per bhunt_search call = 2.200001 for ifhunt, ifrandom = 1,0 Average number of gedouble calls per bhunt_search call = 35.978823 for ifhunt, ifrandom = 1,1 Successful completion of bhunt_search test As expected for a table with 2^6 = 64 entries, bhunt_search requires only an average of 6 calls to gedouble (my simple callback test code inside bhunt_search_test.c which compares two floating point numbers) to search per bhunt_search call if you turn off the hunt phase part of the routine. That number drops down close to 2 if the hunt phase is turned on and the successive numbers tend to be correlated (as happens quite often with time variables, for example). The number drops close to unity if you are beyond the end of the table (which also happens often for time variables). The hunt phase actually slows down the search for completely uncorrelated (i.e., random) variables, but that is a rare case for time variables so within the qsastime library, the the hunt phase is always turned on when using bhunt_search to determine the offset between TAI and UTC. For fun, I also showed a test above for a large table of one million values (near 2^20). As expected bhunt_search scales well for this case requiring an average of only 20 calls to gedouble if the hunt phase is turned off and only 2 calls to geodouble if the hunt phase is turned on for correlated data. (III) lib/qsastime/qsastime_testlib is automatically built in the build tree if _both_ -DTEST_QSASTIME=ON and -DBUILD_QSASTIME_TESTLIB=ON. This test routine tests the qsastime library over essentially the complete range of possible dates that can be represented internally without integer overflow by the qsastime library continuous time variable which stores the integer part of the MJD as a signed int. This works out to a range of +/-5.9 million years from the (Gregorian and Julian) calendar epoch. The actual tests in lib/qsastime/qsastime_testlib range over +/- 5 million years from the calendar epoch. Internally our build system forces BUILD_QSASTIME_TESTLIB to OFF for the Windows (WIN32) case because we have found in practice that the Windows C library time function limitations are so severe (e.g., dates prior to 1970 give incorrect results) that this test of a large date range is worthless on Windows. Also, once we acknowledged that Windows was never going to give good results for this test because of limitations in the Windows C library, it greatly simplified the programming of qsastime_testlib to ignore the Windows case completely. N.B. This is just an issue with the qsastime_testlib routine. The qsastime library itself works fine on Windows because it specifically avoids using any C library time routines. For 32-bit Linux platforms qsastime_testlib is also worthless because of limitations in the 32-bit C Linux library (e.g., the date range is limited to just 1902 through 2038). However, qsastime_testlib gives excellent results for the 64-bit Linux C library. To avoid wasting time on a 32-bit test, we have installed a check in qsastime_testlib which refuses to run the test if (sizeof(time_t) < 8). N.B. The sizeof(time_t) issue is only relevant for the qsastime_testlib routine. The qsastime library itself works fine on 32-bit platforms because it specifically avoids using any C library time routines. On 64-bit Linux (and possibly Mac OS X) platforms run this test as follows: echo 0xffff |lib/qsastime/qsastime_testlib > qsastime_testlib.out Then compare these output results with those at lib/qsastime/qsastime_testlib.out_standard in the source tree. They should be identical in all cases because the C library time routines that qsastime_testlib calls are made independent of time zone issues by forcing a zero time zone. (The qsastime library itself is, of course, independent of time zone issues.) N.B. this comprehensive test of the qsastime library takes 12 minutes to run on a 2.4GHz PC. plplot-5.10.0+dfsg/lib/qsastime/README.ttbipm.dat 644 1750 1750 152711212777744 202720ustar andrewandrewTAI is one realization of TT that must be determined instantly from a world-wide network of atomic clocks. As expected, after-the-fact analysis of the world-wide atomic clock data allows determination of better realizations of TT, and the ttbipm.dat file contains one such corrected realization. This file is obtained by, e.g., wget ftp://ftp2.bipm.fr/pub/tai/scale/ttbipm.08 mv ttbipm.08 ttbipm.dat The files ttbipm.nn tend to be published early in the year nn+1, (i.e., the year 2009 for the ttbipm.08 file) so yearly downloads are required to keep ttbipm.dat up to date. For each ttbipm.nn file, there exists some header lines (30 of them for ttbipm.08) that must be skipped before actual data appear in the file. Thus, the NSKIP_LINES variable that appears in CMakeLists.dat must be confirmed/reviewed each year after the download of ttbipm.nn. plplot-5.10.0+dfsg/lib/csa/ 775 1750 1750 012406243566 141765ustar andrewandrewplplot-5.10.0+dfsg/lib/csa/csa.h 644 1750 1750 253611645771433 152040ustar andrewandrew//-------------------------------------------------------------------------- // // File: csa.h // // Created: 16/10/2002 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: A header for csa library (2D data approximation with // bivariate C1 cubic spline) // // Revisions: None // //-------------------------------------------------------------------------- #if !defined ( _CSA_H ) #define _CSA_H // include header file for dll definitions #include "csadll.h" #if _MSC_VER > 1309 #define hypot _hypot #endif #if !defined ( _POINT_STRUCT ) #define _POINT_STRUCT typedef struct { double x; double y; double z; } point; #endif extern int csa_verbose; extern const char* csa_version; struct csa; typedef struct csa csa; CSADLLIMPEXP csa* csa_create( void ); CSADLLIMPEXP void csa_destroy( csa* a ); CSADLLIMPEXP void csa_addpoints( csa* a, int n, point points[] ); CSADLLIMPEXP void csa_calculatespline( csa* a ); CSADLLIMPEXP void csa_approximate_point( csa* a, point* p ); CSADLLIMPEXP void csa_approximate_points( csa* a, int n, point* points ); CSADLLIMPEXP void csa_setnpmin( csa* a, int npmin ); CSADLLIMPEXP void csa_setnpmax( csa* a, int npmax ); CSADLLIMPEXP void csa_setk( csa* a, int k ); CSADLLIMPEXP void csa_setnpps( csa* a, double npps ); #endif plplot-5.10.0+dfsg/lib/csa/version.h 644 1750 1750 67111645757710 161030ustar andrewandrew//-------------------------------------------------------------------------- // // File: version.h // // Created: 16/10/2002 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: Version string for csa library // //-------------------------------------------------------------------------- #if !defined ( _VERSION_H ) #define _VERSION_H const char* csa_version = "0.23"; #endif plplot-5.10.0+dfsg/lib/csa/CMakeLists.txt 644 1750 1750 357711663514373 170310ustar andrewandrew# lib/csa/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if(WITH_CSA) set(csirocsa_LIB_SRCS csa.c ) if(BUILD_SHARED_LIBS) set_source_files_properties(${csirocsa_LIB_SRCS} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS) add_library(csirocsa ${csirocsa_LIB_SRCS}) if(NON_TRANSITIVE) # empty list ==> non-transitive linking for everything that links to # libcsirocsa in the shared libraries case. target_link_libraries(csirocsa LINK_INTERFACE_LIBRARIES) endif(NON_TRANSITIVE) set_target_properties(csirocsa PROPERTIES SOVERSION ${csirocsa_SOVERSION} VERSION ${csirocsa_VERSION} INSTALL_NAME_DIR "${LIB_DIR}" ) if(MATH_LIB) target_link_libraries(csirocsa ${MATH_LIB}) endif(MATH_LIB) install(TARGETS csirocsa EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) set(csa_DOCFILES README README.1st ) install(FILES README DESTINATION ${DOC_DIR} RENAME README.csa) install(FILES README.1st DESTINATION ${DOC_DIR} RENAME README.1st.csa) endif(WITH_CSA) plplot-5.10.0+dfsg/lib/csa/csadll.h 644 1750 1750 303511460615444 156650ustar andrewandrew#ifndef __CSA_DLL_H #define __CSA_DLL_H #ifdef USINGDLL #if defined ( WIN32 ) // Visual C/C++, Borland, MinGW and Watcom #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ ) #define CSADLLEXPORT __declspec( dllexport ) #define CSADLLIMPORT __declspec( dllimport ) #else #define CSADLLEXPORT #define CSADLLIMPORT #endif #elif defined ( __CYGWIN__ ) #define CSADLLEXPORT __declspec( dllexport ) #define CSADLLIMPORT __declspec( dllimport ) #elif defined ( __GNUC__ ) && __GNUC__ > 3 // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x // The following forces exported symbols specifically designated with // CSADLLEXPORT to be visible. #define CSADLLEXPORT __attribute__ ( ( visibility( "default" ) ) ) #define CSADLLIMPORT #endif #endif // For an unknown compiler or static built we clear the macros #ifndef CSADLLEXPORT # define CSADLLEXPORT # define CSADLLIMPORT #endif // The IMPEXP macros will always be set to DLLIMPORT (even for // the static library, but DLLIMPORT is empty in this case). If // cmake sets the corresponding macro xxxx_EXPORTS if the // corresponding library is built DLLIMPEXP is set to DLLEXPORT #if defined ( csirocsa_EXPORTS ) #define CSADLLIMPEXP CSADLLEXPORT #define CSADLLIMPEXP_DATA( type ) CSADLLEXPORT type #else #define CSADLLIMPEXP CSADLLIMPORT #define CSADLLIMPEXP_DATA( type ) CSADLLIMPORT type #endif #endif // __CSA_DLL_H plplot-5.10.0+dfsg/lib/csa/csa.c 644 1750 1750 17025111720156574 152340ustar andrewandrew//-------------------------------------------------------------------------- // // File: csa.c // // Created: 16/10/2002 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: 2D data approximation with bivariate C1 cubic spline. // A set of library functions + standalone utility. // // Description: See J. Haber, F. Zeilfelder, O.Davydov and H.-P. Seidel, // Smooth approximation and rendering of large scattered data // sets, in ``Proceedings of IEEE Visualization 2001'' // (Th.Ertl, K.Joy and A.Varshney, Eds.), pp.341-347, 571, // IEEE Computer Society, 2001. // http://www.uni-giessen.de/www-Numerische-Mathematik/ // davydov/VIS2001.ps.gz // http://www.math.uni-mannheim.de/~lsmath4/paper/ // VIS2001.pdf.gz // // Revisions: 09/04/2003 PS: Modified points_read() to read from a // file specified by name, not by handle. // //-------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include "version.h" #include "nan.h" #include "csa.h" int csa_verbose = 0; #define NPASTART 5 // Number of Points Allocated at Start #define SVD_NMAX 30 // Maximal number of iterations in svd() // default algorithm parameters #define NPMIN_DEF 3 #define NPMAX_DEF 40 #define K_DEF 140 #define NPPC_DEF 5 struct square; typedef struct square square; typedef struct { square * parent; int index; // index within parent square; 0 <= index <= // 3 point vertices[3]; point middle; // barycenter double h; // parent square edge length double r; // data visibility radius // // points used -- in primary triangles only // int nallocated; int npoints; point** points; int primary; // flag -- whether calculate spline // coefficients directly (by least squares // method) (primary = 1) or indirectly (from // C1 smoothness conditions) (primary = 0) int hascoeffs; // flag -- whether there are no NaNs among // the spline coefficients int order; // spline order -- for primary triangles only // } triangle; struct square { csa * parent; int i, j; // indices int nallocated; int npoints; point ** points; int primary; // flag -- whether this square contains a // primary triangle triangle* triangles[4]; double coeffs[25]; }; struct csa { double xmin; double xmax; double ymin; double ymax; int nallocated; int npoints; point ** points; // // squarization // int ni; int nj; double h; square *** squares; // square* [j][i] int npt; // Number of Primary Triangles triangle** pt; // Primary Triangles -- triangle* [npt] // // algorithm parameters // int npmin; // minimal number of points locally involved // in * spline calculation (normally = 3) int npmax; // maximal number of points locally involved // in * spline calculation (required > 10, * // recommended 20 < npmax < 60) double k; // relative tolerance multiple in fitting // spline coefficients: the higher this // value, the higher degree of the locally // fitted spline (recommended 80 < k < 200) int nppc; // average number of points per square }; void csa_setnppc( csa* a, double nppc ); static void csa_quit( const char* format, ... ) { va_list args; fflush( stdout ); // just in case -- to have the exit message // last fprintf( stderr, "error: csa: " ); va_start( args, format ); vfprintf( stderr, format, args ); va_end( args ); exit( 1 ); } // Allocates n1xn2 matrix of something. Note that it will be accessed as // [n2][n1]. // @param n1 Number of columns // @param n2 Number of rows // @return Matrix // static void* alloc2d( int n1, int n2, size_t unitsize ) { size_t size; char * p; char ** pp; int i; assert( n1 > 0 ); assert( n2 > 0 ); assert( (double) n1 * (double) n2 <= (double) UINT_MAX ); size = (size_t) ( n1 * n2 ); if ( ( p = calloc( size, unitsize ) ) == NULL ) csa_quit( "alloc2d(): %s\n", strerror( errno ) ); assert( (double) n2 * (double) sizeof ( void* ) <= (double) UINT_MAX ); size = (size_t) n2 * sizeof ( void* ); if ( ( pp = malloc( size ) ) == NULL ) csa_quit( "alloc2d(): %s\n", strerror( errno ) ); for ( i = 0; i < n2; i++ ) pp[i] = &p[(size_t) ( i * n1 ) * unitsize]; return pp; } // Destroys n1xn2 matrix. // @param pp Matrix // static void free2d( void* pp ) { void* p; assert( pp != NULL ); p = ( (void **) pp )[0]; free( pp ); assert( p != NULL ); free( p ); } static triangle* triangle_create( square* s, point vertices[], int index ) { triangle* t = malloc( sizeof ( triangle ) ); t->parent = s; memcpy( t->vertices, vertices, sizeof ( point ) * 3 ); t->middle.x = ( vertices[0].x + vertices[1].x + vertices[2].x ) / 3.0; t->middle.y = ( vertices[0].y + vertices[1].y + vertices[2].y ) / 3.0; t->h = s->parent->h; t->index = index; t->r = 0.0; t->points = 0; t->nallocated = 0; t->npoints = 0; t->hascoeffs = 0; t->primary = 0; t->order = -1; return t; } static void triangle_addpoint( triangle* t, point* p ) { if ( t->nallocated == t->npoints ) { if ( t->nallocated == 0 ) { t->points = malloc( NPASTART * sizeof ( point* ) ); t->nallocated = NPASTART; } else { t->points = realloc( t->points, (size_t) ( t->nallocated * 2 ) * sizeof ( point* ) ); t->nallocated *= 2; } } t->points[t->npoints] = p; t->npoints++; } static void triangle_destroy( triangle* t ) { if ( t->points != NULL ) free( t->points ); free( t ); } // Calculates barycentric coordinates of a point. // Takes into account that possible triangles are rectangular, with the right // angle at t->vertices[0], the vertices[1] vertex being in // (-3*PI/4) + (PI/2) * t->index direction from vertices[0], and // vertices[2] being at (-5*PI/4) + (PI/2) * t->index. // static void triangle_calculatebc( triangle* t, point* p, double bc[] ) { double dx = p->x - t->vertices[0].x; double dy = p->y - t->vertices[0].y; if ( t->index == 0 ) { bc[1] = ( dy - dx ) / t->h; bc[2] = -( dx + dy ) / t->h; } else if ( t->index == 1 ) { bc[1] = ( dx + dy ) / t->h; bc[2] = ( dy - dx ) / t->h; } else if ( t->index == 2 ) { bc[1] = ( dx - dy ) / t->h; bc[2] = ( dx + dy ) / t->h; } else { bc[1] = -( dx + dy ) / t->h; bc[2] = ( dx - dy ) / t->h; } bc[0] = 1.0 - bc[1] - bc[2]; } static square* square_create( csa* parent, double xmin, double ymin, int i, int j ) { int ii; square * s = malloc( sizeof ( square ) ); double h = parent->h; s->parent = parent; s->i = i; s->j = j; s->points = NULL; s->nallocated = 0; s->npoints = 0; s->primary = 0; // // create 4 triangles formed by diagonals // for ( ii = 0; ii < 4; ++ii ) { point vertices[3]; vertices[0].x = xmin + h / 2.0; vertices[0].y = ymin + h / 2.0; vertices[1].x = xmin + h * ( ( ( ii + 1 ) % 4 ) / 2 ); // 0 1 1 0 vertices[1].y = ymin + h * ( ( ( ii + 2 ) % 4 ) / 2 ); // 1 1 0 0 vertices[2].x = xmin + h * ( ii / 2 ); // 0 0 1 1 vertices[2].y = ymin + h * ( ( ( ii + 1 ) % 4 ) / 2 ); // 0 1 1 0 s->triangles[ii] = triangle_create( s, vertices, ii ); } for ( ii = 0; ii < 25; ++ii ) s->coeffs[ii] = NaN; return s; } static void square_destroy( square* s ) { int i; for ( i = 0; i < 4; ++i ) triangle_destroy( s->triangles[i] ); if ( s->points != NULL ) free( s->points ); free( s ); } static void square_addpoint( square* s, point* p ) { if ( s->nallocated == s->npoints ) { if ( s->nallocated == 0 ) { s->points = malloc( NPASTART * sizeof ( point* ) ); s->nallocated = NPASTART; } else { s->points = realloc( s->points, (size_t) ( s->nallocated * 2 ) * sizeof ( point* ) ); s->nallocated *= 2; } } s->points[s->npoints] = p; s->npoints++; } csa* csa_create() { csa* a = malloc( sizeof ( csa ) ); a->xmin = DBL_MAX; a->xmax = -DBL_MAX; a->ymin = DBL_MAX; a->ymax = -DBL_MAX; a->points = malloc( NPASTART * sizeof ( point* ) ); a->nallocated = NPASTART; a->npoints = 0; a->ni = 0; a->nj = 0; a->h = NaN; a->squares = NULL; a->npt = 0; a->pt = NULL; a->npmin = NPMIN_DEF; a->npmax = NPMAX_DEF; a->k = K_DEF; a->nppc = NPPC_DEF; return a; } void csa_destroy( csa* a ) { int i, j; if ( a->squares != NULL ) { for ( j = 0; j < a->nj; ++j ) for ( i = 0; i < a->ni; ++i ) square_destroy( a->squares[j][i] ); free2d( a->squares ); } if ( a->pt != NULL ) free( a->pt ); if ( a->points != NULL ) free( a->points ); free( a ); } void csa_addpoints( csa* a, int n, point points[] ) { int na = a->nallocated; int i; assert( a->squares == NULL ); // // (can be called prior to squarization only) // while ( na < a->npoints + n ) na *= 2; if ( na != a->nallocated ) { a->points = realloc( a->points, (size_t) na * sizeof ( point* ) ); a->nallocated = na; } for ( i = 0; i < n; ++i ) { point* p = &points[i]; a->points[a->npoints] = p; a->npoints++; if ( p->x < a->xmin ) a->xmin = p->x; if ( p->x > a->xmax ) a->xmax = p->x; if ( p->y < a->ymin ) a->ymin = p->y; if ( p->y > a->ymax ) a->ymax = p->y; } } // Marks the squares containing "primary" triangles by setting "primary" flag // to 1. // static void csa_setprimaryflag( csa* a ) { square*** squares = a->squares; int nj1 = a->nj - 1; int ni1 = a->ni - 1; int i, j; for ( j = 1; j < nj1; ++j ) { for ( i = 1; i < ni1; ++i ) { if ( squares[j][i]->npoints > 0 ) { if ( ( i + j ) % 2 == 0 ) { squares[j][i]->primary = 1; squares[j - 1][i - 1]->primary = 1; squares[j + 1][i - 1]->primary = 1; squares[j - 1][i + 1]->primary = 1; squares[j + 1][i + 1]->primary = 1; } else { squares[j - 1][i]->primary = 1; squares[j + 1][i]->primary = 1; squares[j][i - 1]->primary = 1; squares[j][i + 1]->primary = 1; } } } } } // Splits the data domain in a number of squares. // static void csa_squarize( csa* a ) { int nps[7] = { 0, 0, 0, 0, 0, 0 }; // stats on number of points per // square double dx = a->xmax - a->xmin; double dy = a->ymax - a->ymin; int npoints = a->npoints; double h; int i, j, ii, nadj; if ( csa_verbose ) { fprintf( stderr, "squarizing csa:\n" ); fflush( stderr ); } assert( a->squares == NULL ); // // (can be done only once) // h = sqrt( dx * dy * a->nppc / npoints ); // square edge size if ( dx < h ) h = dy * a->nppc / npoints; if ( dy < h ) h = dx * a->nppc / npoints; a->h = h; a->ni = (int) ( ceil( dx / h ) + 2 ); a->nj = (int) ( ceil( dy / h ) + 2 ); if ( csa_verbose ) { fprintf( stderr, " %d x %d squares\n", a->ni, a->nj ); fflush( stderr ); } // // create squares // a->squares = alloc2d( a->ni, a->nj, sizeof ( void* ) ); for ( j = 0; j < a->nj; ++j ) for ( i = 0; i < a->ni; ++i ) a->squares[j][i] = square_create( a, a->xmin + h * ( i - 1 ), a->ymin + h * ( j - 1 ), i, j ); // // map points to squares // for ( ii = 0; ii < npoints; ++ii ) { point* p = a->points[ii]; i = (int) ( floor( ( p->x - a->xmin ) / h ) + 1 ); j = (int) ( floor( ( p->y - a->ymin ) / h ) + 1 ); square_addpoint( a->squares[j][i], p ); } // // mark relevant squares with no points // csa_setprimaryflag( a ); // // Create a list of "primary" triangles, for which spline coefficients // will be calculated directy (by least squares method), without using // C1 smoothness conditions. // a->pt = malloc( (size_t) ( ( a->ni / 2 + 1 ) * a->nj ) * sizeof ( triangle* ) ); for ( j = 0, ii = 0, nadj = 0; j < a->nj; ++j ) { for ( i = 0; i < a->ni; ++i ) { square* s = a->squares[j][i]; if ( s->npoints > 0 ) { int nn = s->npoints / 5; if ( nn > 6 ) nn = 6; nps[nn]++; ii++; } if ( s->primary && s->npoints == 0 ) nadj++; if ( s->primary ) { a->pt[a->npt] = s->triangles[0]; s->triangles[0]->primary = 1; a->npt++; } } } if ( csa_verbose ) { fprintf( stderr, " %d non-empty squares\n", ii ); fprintf( stderr, " %d primary squares\n", a->npt ); fprintf( stderr, " %d primary squares with no data\n", nadj ); fprintf( stderr, " %.2f points per square \n", (double) a->npoints / ii ); } if ( csa_verbose == 2 ) { for ( i = 0; i < 6; ++i ) fprintf( stderr, " %d-%d points -- %d squares\n", i * 5, i * 5 + 4, nps[i] ); fprintf( stderr, " %d or more points -- %d squares\n", i * 5, nps[i] ); } if ( csa_verbose == 2 ) { fprintf( stderr, " j\\i" ); for ( i = 0; i < a->ni; ++i ) fprintf( stderr, "%3d ", i ); fprintf( stderr, "\n" ); for ( j = a->nj - 1; j >= 0; --j ) { fprintf( stderr, "%3d ", j ); for ( i = 0; i < a->ni; ++i ) { square* s = a->squares[j][i]; if ( s->npoints > 0 ) fprintf( stderr, "%3d ", s->npoints ); else fprintf( stderr, " . " ); } fprintf( stderr, "\n" ); } } if ( csa_verbose ) fflush( stderr ); } // Returns all squares intersecting with a square with center in t->middle // and edges of length 2*t->r parallel to X and Y axes. // static void getsquares( csa* a, triangle* t, int* n, square*** squares ) { int imin = (int) floor( ( t->middle.x - t->r - a->xmin ) / t->h ); int imax = (int) ceil( ( t->middle.x + t->r - a->xmin ) / t->h ); int jmin = (int) floor( ( t->middle.y - t->r - a->ymin ) / t->h ); int jmax = (int) ceil( ( t->middle.y + t->r - a->ymin ) / t->h ); int i, j; if ( imin < 0 ) imin = 0; if ( imax >= a->ni ) imax = a->ni - 1; if ( jmin < 0 ) jmin = 0; if ( jmax >= a->nj ) jmax = a->nj - 1; *n = 0; ( *squares ) = malloc( (size_t) ( ( imax - imin + 1 ) * ( jmax - jmin + 1 ) ) * sizeof ( square* ) ); for ( j = jmin; j <= jmax; ++j ) { for ( i = imin; i <= imax; ++i ) { square* s = a->squares[j][i]; if ( s->npoints > 0 ) { ( *squares )[*n] = a->squares[j][i]; ( *n )++; } } } } static double distance( point* p1, point* p2 ) { return hypot( p1->x - p2->x, p1->y - p2->y ); } // Thins data by creating an auxiliary regular grid and for leaving only // the most central point within each grid cell. // (I follow the paper here. It is possible that taking average -- in terms of // both value and position -- of all points within a cell would be a bit more // robust. However, because of keeping only shallow copies of input points, // this would require quite a bit of structural changes. So, leaving it as is // for now.) // static void thindata( triangle* t, int npmax ) { csa * a = t->parent->parent; int imax = (int) ceil( sqrt( (double) ( npmax * 3 / 2 ) ) ); square *** squares = alloc2d( imax, imax, sizeof ( void* ) ); double h = t->r * 2.0 / imax; double h2 = h / 2.0; double xmin = t->middle.x - t->r; double ymin = t->middle.y - t->r; int i, j, ii; for ( j = 0; j < imax; ++j ) for ( i = 0; i < imax; ++i ) squares[j][i] = square_create( a, xmin + h * i, ymin + h * j, i, j ); for ( ii = 0; ii < t->npoints; ++ii ) { square* s; point * p = t->points[ii]; i = (int) floor( ( p->x - xmin ) / h ); j = (int) floor( ( p->y - ymin ) / h ); s = squares[j][i]; if ( s->npoints == 0 ) square_addpoint( s, p ); else // npoints == 1 { point pmiddle; pmiddle.x = xmin + h * i + h2; pmiddle.y = ymin + h * j + h2; if ( distance( s->points[0], &pmiddle ) > distance( p, &pmiddle ) ) s->points[0] = p; } } t->npoints = 0; for ( j = 0; j < imax; ++j ) { for ( i = 0; i < imax; ++i ) { square* s = squares[j][i]; if ( squares[j][i]->npoints != 0 ) triangle_addpoint( t, s->points[0] ); square_destroy( s ); } } free2d( squares ); imax++; } // Finds data points to be used in calculating spline coefficients for each // primary triangle. // static void csa_attachpoints( csa* a ) { int npmin = a->npmin; int npmax = a->npmax; int nincreased = 0; int nthinned = 0; int i; assert( a->npt > 0 ); if ( csa_verbose ) { fprintf( stderr, "pre-processing data points:\n " ); fflush( stderr ); } for ( i = 0; i < a->npt; ++i ) { triangle* t = a->pt[i]; int increased = 0; if ( csa_verbose ) { fprintf( stderr, "." ); fflush( stderr ); } t->r = t->h * 1.25; while ( 1 ) { int nsquares = 0; square** squares = NULL; int ii; getsquares( a, t, &nsquares, &squares ); for ( ii = 0; ii < nsquares; ++ii ) { square* s = squares[ii]; int iii; for ( iii = 0; iii < s->npoints; ++iii ) { point* p = s->points[iii]; if ( distance( p, &t->middle ) <= t->r ) triangle_addpoint( t, p ); } } free( squares ); if ( t->npoints < npmin ) { if ( !increased ) { increased = 1; nincreased++; } t->r *= 1.25; t->npoints = 0; } else if ( t->npoints > npmax ) { nthinned++; thindata( t, npmax ); if ( t->npoints > npmin ) break; else { // // Sometimes you have too much data, you thin it and -- // oops -- you have too little. This is not a frequent // event, so let us not bother to put a new subdivision. // t->r *= 1.25; t->npoints = 0; } } else break; } } if ( csa_verbose ) { fprintf( stderr, "\n %d sets enhanced, %d sets thinned\n", nincreased, nthinned ); fflush( stderr ); } } static int n2q( int n ) { assert( n >= 3 ); if ( n >= 10 ) return 3; else if ( n >= 6 ) return 2; else // n == 3 return 1; } //* Singular value decomposition. // Borrowed from EISPACK (1972-1973). // Presents input matrix A as A = U.W.V'. // // @param a Input matrix A = U.W[0..m-1][0..n-1]; output matrix U // @param n Number of columns // @param m Number of rows // @param w Ouput vector that presents diagonal matrix W // @param V output matrix V // static void svd( double** a, int n, int m, double* w, double** v ) { double * rv1; int i, j, k, l = -1; double tst1, c, f, g, h, s, scale; assert( m > 0 && n > 0 ); rv1 = malloc( (size_t) n * sizeof ( double ) ); // // householder reduction to bidiagonal form // g = 0.0; scale = 0.0; tst1 = 0.0; for ( i = 0; i < n; i++ ) { l = i + 1; rv1[i] = scale * g; g = 0.0; s = 0.0; scale = 0.0; if ( i < m ) { for ( k = i; k < m; k++ ) scale += fabs( a[k][i] ); if ( scale != 0.0 ) { for ( k = i; k < m; k++ ) { a[k][i] /= scale; s += a[k][i] * a[k][i]; } f = a[i][i]; g = -copysign( sqrt( s ), f ); h = f * g - s; a[i][i] = f - g; if ( i < n - 1 ) { for ( j = l; j < n; j++ ) { s = 0.0; for ( k = i; k < m; k++ ) s += a[k][i] * a[k][j]; f = s / h; for ( k = i; k < m; k++ ) a[k][j] += f * a[k][i]; } } for ( k = i; k < m; k++ ) a[k][i] *= scale; } } w[i] = scale * g; g = 0.0; s = 0.0; scale = 0.0; if ( i < m && i < n - 1 ) { for ( k = l; k < n; k++ ) scale += fabs( a[i][k] ); if ( scale != 0.0 ) { for ( k = l; k < n; k++ ) { a[i][k] /= scale; s += a[i][k] * a[i][k]; } f = a[i][l]; g = -copysign( sqrt( s ), f ); h = f * g - s; a[i][l] = f - g; for ( k = l; k < n; k++ ) rv1[k] = a[i][k] / h; for ( j = l; j < m; j++ ) { s = 0.0; for ( k = l; k < n; k++ ) s += a[j][k] * a[i][k]; for ( k = l; k < n; k++ ) a[j][k] += s * rv1[k]; } for ( k = l; k < n; k++ ) a[i][k] *= scale; } } { double tmp = fabs( w[i] ) + fabs( rv1[i] ); tst1 = ( tst1 > tmp ) ? tst1 : tmp; } } // // accumulation of right-hand transformations // for ( i = n - 1; i >= 0; i-- ) { if ( i < n - 1 ) { if ( g != 0.0 ) { for ( j = l; j < n; j++ ) // // double division avoids possible underflow // v[j][i] = ( a[i][j] / a[i][l] ) / g; for ( j = l; j < n; j++ ) { s = 0.0; for ( k = l; k < n; k++ ) s += a[i][k] * v[k][j]; for ( k = l; k < n; k++ ) v[k][j] += s * v[k][i]; } } for ( j = l; j < n; j++ ) { v[i][j] = 0.0; v[j][i] = 0.0; } } v[i][i] = 1.0; g = rv1[i]; l = i; } // // accumulation of left-hand transformations // for ( i = ( m < n ) ? m - 1 : n - 1; i >= 0; i-- ) { l = i + 1; g = w[i]; if ( i != n - 1 ) for ( j = l; j < n; j++ ) a[i][j] = 0.0; if ( g != 0.0 ) { for ( j = l; j < n; j++ ) { s = 0.0; for ( k = l; k < m; k++ ) s += a[k][i] * a[k][j]; // // double division avoids possible underflow // f = ( s / a[i][i] ) / g; for ( k = i; k < m; k++ ) a[k][j] += f * a[k][i]; } for ( j = i; j < m; j++ ) a[j][i] /= g; } else for ( j = i; j < m; j++ ) a[j][i] = 0.0; a[i][i] += 1.0; } // // diagonalization of the bidiagonal form // for ( k = n - 1; k >= 0; k-- ) { int k1 = k - 1; int its = 0; while ( 1 ) { int docancellation = 1; double x, y, z; int l1 = -1; its++; if ( its > SVD_NMAX ) csa_quit( "svd(): no convergence in %d iterations", SVD_NMAX ); for ( l = k; l >= 0; l-- ) // test for splitting { double tst2 = fabs( rv1[l] ) + tst1; if ( tst2 == tst1 ) { docancellation = 0; break; } l1 = l - 1; // // rv1(1) is always zero, so there is no exit through the // bottom of the loop // tst2 = fabs( w[l - 1] ) + tst1; if ( tst2 == tst1 ) break; } // // cancellation of rv1[l] if l > 1 // if ( docancellation ) { c = 0.0; s = 1.0; for ( i = l; i <= k; i++ ) { f = s * rv1[i]; rv1[i] = c * rv1[i]; if ( ( fabs( f ) + tst1 ) == tst1 ) break; g = w[i]; h = hypot( f, g ); w[i] = h; h = 1.0 / h; c = g * h; s = -f * h; for ( j = 0; j < m; j++ ) { y = a[j][l1]; z = a[j][i]; a[j][l1] = y * c + z * s; a[j][i] = z * c - y * s; } } } // // test for convergence // z = w[k]; if ( l != k ) { int i1; // // shift from bottom 2 by 2 minor // x = w[l]; y = w[k1]; g = rv1[k1]; h = rv1[k]; f = 0.5 * ( ( ( g + z ) / h ) * ( ( g - z ) / y ) + y / h - h / y ); g = hypot( f, 1.0 ); f = x - ( z / x ) * z + ( h / x ) * ( y / ( f + copysign( g, f ) ) - h ); // // next qr transformation // c = 1.0; s = 1.0; for ( i1 = l; i1 < k; i1++ ) { i = i1 + 1; g = rv1[i]; y = w[i]; h = s * g; g = c * g; z = hypot( f, h ); rv1[i1] = z; c = f / z; s = h / z; f = x * c + g * s; g = g * c - x * s; h = y * s; y *= c; for ( j = 0; j < n; j++ ) { x = v[j][i1]; z = v[j][i]; v[j][i1] = x * c + z * s; v[j][i] = z * c - x * s; } z = hypot( f, h ); w[i1] = z; // // rotation can be arbitrary if z = 0 // if ( z != 0.0 ) { c = f / z; s = h / z; } f = c * g + s * y; x = c * y - s * g; for ( j = 0; j < m; j++ ) { y = a[j][i1]; z = a[j][i]; a[j][i1] = y * c + z * s; a[j][i] = z * c - y * s; } } rv1[l] = 0.0; rv1[k] = f; w[k] = x; } else { // // w[k] is made non-negative // if ( z < 0.0 ) { w[k] = -z; for ( j = 0; j < n; j++ ) v[j][k] = -v[j][k]; } break; } } } free( rv1 ); } // Least squares fitting via singular value decomposition. // static void lsq( double** A, int ni, int nj, double* z, double* w, double* sol ) { double** V = alloc2d( ni, ni, sizeof ( double ) ); double** B = alloc2d( nj, ni, sizeof ( double ) ); int i, j, ii; svd( A, ni, nj, w, V ); for ( j = 0; j < ni; ++j ) for ( i = 0; i < ni; ++i ) V[j][i] /= w[i]; for ( i = 0; i < ni; ++i ) { double* v = V[i]; for ( j = 0; j < nj; ++j ) { double* a = A[j]; double* b = &B[i][j]; for ( ii = 0; ii < ni; ++ii ) *b += v[ii] * a[ii]; } } for ( i = 0; i < ni; ++i ) sol[i] = 0.0; for ( i = 0; i < ni; ++i ) for ( j = 0; j < nj; ++j ) sol[i] += B[i][j] * z[j]; free2d( B ); free2d( V ); } // // square->coeffs[]: // // --------------------- // | 3 10 17 24 | // | 6 13 20 | // | 2 9 16 23 | // | 5 12 19 | // | 1 8 15 22 | // | 4 11 18 | // | 0 7 14 21 | // --------------------- // // Calculates spline coefficients in each primary triangle by least squares // fitting to data attached by csa_attachpoints(). // static void csa_findprimarycoeffs( csa* a ) { int n[4] = { 0, 0, 0, 0 }; int i; if ( csa_verbose ) fprintf( stderr, "calculating spline coefficients for primary triangles:\n " ); for ( i = 0; i < a->npt; ++i ) { triangle* t = a->pt[i]; int npoints = t->npoints; point ** points = t->points; double * z = malloc( (size_t) npoints * sizeof ( double ) ); int q = n2q( t->npoints ); int ok = 1; double b[10]; double b1[6]; int ii; if ( csa_verbose ) { fprintf( stderr, "." ); fflush( stderr ); } for ( ii = 0; ii < npoints; ++ii ) z[ii] = points[ii]->z; do { double bc[3]; double wmin, wmax; if ( !ok ) q--; assert( q >= 0 ); if ( q == 3 ) { double ** A = alloc2d( 10, npoints, sizeof ( double ) ); double w[10]; for ( ii = 0; ii < npoints; ++ii ) { double * aii = A[ii]; double tmp; triangle_calculatebc( t, points[ii], bc ); // // 0 1 2 3 4 5 6 7 8 9 // 300 210 201 120 111 102 030 021 012 003 // tmp = bc[0] * bc[0]; aii[0] = tmp * bc[0]; tmp *= 3.0; aii[1] = tmp * bc[1]; aii[2] = tmp * bc[2]; tmp = bc[1] * bc[1]; aii[6] = tmp * bc[1]; tmp *= 3.0; aii[3] = tmp * bc[0]; aii[7] = tmp * bc[2]; tmp = bc[2] * bc[2]; aii[9] = tmp * bc[2]; tmp *= 3.0; aii[5] = tmp * bc[0]; aii[8] = tmp * bc[1]; aii[4] = bc[0] * bc[1] * bc[2] * 6.0; } lsq( A, 10, npoints, z, w, b ); wmin = w[0]; wmax = w[0]; for ( ii = 1; ii < 10; ++ii ) { if ( w[ii] < wmin ) wmin = w[ii]; else if ( w[ii] > wmax ) wmax = w[ii]; } if ( wmin < wmax / a->k ) ok = 0; free2d( A ); } else if ( q == 2 ) { double ** A = alloc2d( 6, npoints, sizeof ( double ) ); double w[6]; for ( ii = 0; ii < npoints; ++ii ) { double* aii = A[ii]; triangle_calculatebc( t, points[ii], bc ); // // 0 1 2 3 4 5 // 200 110 101 020 011 002 // aii[0] = bc[0] * bc[0]; aii[1] = bc[0] * bc[1] * 2.0; aii[2] = bc[0] * bc[2] * 2.0; aii[3] = bc[1] * bc[1]; aii[4] = bc[1] * bc[2] * 2.0; aii[5] = bc[2] * bc[2]; } lsq( A, 6, npoints, z, w, b1 ); wmin = w[0]; wmax = w[0]; for ( ii = 1; ii < 6; ++ii ) { if ( w[ii] < wmin ) wmin = w[ii]; else if ( w[ii] > wmax ) wmax = w[ii]; } if ( wmin < wmax / a->k ) ok = 0; else // degree raising { ok = 1; b[0] = b1[0]; b[1] = ( b1[0] + 2.0 * b1[1] ) / 3.0; b[2] = ( b1[0] + 2.0 * b1[2] ) / 3.0; b[3] = ( b1[3] + 2.0 * b1[1] ) / 3.0; b[4] = ( b1[1] + b1[2] + b1[4] ) / 3.0; b[5] = ( b1[5] + 2.0 * b1[2] ) / 3.0; b[6] = b1[3]; b[7] = ( b1[3] + 2.0 * b1[4] ) / 3.0; b[8] = ( b1[5] + 2.0 * b1[4] ) / 3.0; b[9] = b1[5]; } free2d( A ); } else if ( q == 1 ) { double ** A = alloc2d( 3, npoints, sizeof ( double ) ); double w[3]; for ( ii = 0; ii < npoints; ++ii ) { double* aii = A[ii]; triangle_calculatebc( t, points[ii], bc ); aii[0] = bc[0]; aii[1] = bc[1]; aii[2] = bc[2]; } lsq( A, 3, npoints, z, w, b1 ); wmin = w[0]; wmax = w[0]; for ( ii = 1; ii < 3; ++ii ) { if ( w[ii] < wmin ) wmin = w[ii]; else if ( w[ii] > wmax ) wmax = w[ii]; } if ( wmin < wmax / a->k ) ok = 0; else // degree raising { ok = 1; b[0] = b1[0]; b[1] = ( 2.0 * b1[0] + b1[1] ) / 3.0; b[2] = ( 2.0 * b1[0] + b1[2] ) / 3.0; b[3] = ( 2.0 * b1[1] + b1[0] ) / 3.0; b[4] = ( b1[0] + b1[1] + b1[2] ) / 3.0; b[5] = ( 2.0 * b1[2] + b1[0] ) / 3.0; b[6] = b1[1]; b[7] = ( 2.0 * b1[1] + b1[2] ) / 3.0; b[8] = ( 2.0 * b1[2] + b1[1] ) / 3.0; b[9] = b1[2]; } free2d( A ); } else if ( q == 0 ) { double ** A = alloc2d( 1, npoints, sizeof ( double ) ); double w[1]; for ( ii = 0; ii < npoints; ++ii ) A[ii][0] = 1.0; lsq( A, 1, npoints, z, w, b1 ); ok = 1; b[0] = b1[0]; b[1] = b1[0]; b[2] = b1[0]; b[3] = b1[0]; b[4] = b1[0]; b[5] = b1[0]; b[6] = b1[0]; b[7] = b1[0]; b[8] = b1[0]; b[9] = b1[0]; free2d( A ); } } while ( !ok ); n[q]++; t->order = q; { square* s = t->parent; double* coeffs = s->coeffs; coeffs[12] = b[0]; coeffs[9] = b[1]; coeffs[6] = b[3]; coeffs[3] = b[6]; coeffs[2] = b[7]; coeffs[1] = b[8]; coeffs[0] = b[9]; coeffs[4] = b[5]; coeffs[8] = b[2]; coeffs[5] = b[4]; } free( z ); } if ( csa_verbose ) { fprintf( stderr, "\n 3rd order -- %d sets\n", n[3] ); fprintf( stderr, " 2nd order -- %d sets\n", n[2] ); fprintf( stderr, " 1st order -- %d sets\n", n[1] ); fprintf( stderr, " 0th order -- %d sets\n", n[0] ); fflush( stderr ); } if ( csa_verbose == 2 ) { int j; fprintf( stderr, " j\\i" ); for ( i = 0; i < a->ni; ++i ) fprintf( stderr, "%2d ", i ); fprintf( stderr, "\n" ); for ( j = a->nj - 1; j >= 0; --j ) { fprintf( stderr, "%2d ", j ); for ( i = 0; i < a->ni; ++i ) { square* s = a->squares[j][i]; if ( s->triangles[0]->primary ) fprintf( stderr, "%2d ", s->triangles[0]->order ); else fprintf( stderr, " . " ); } fprintf( stderr, "\n" ); } } } // Finds spline coefficients in (adjacent to primary triangles) secondary // triangles from C1 smoothness conditions. // static void csa_findsecondarycoeffs( csa* a ) { square*** squares = a->squares; int ni = a->ni; int nj = a->nj; int ii; if ( csa_verbose ) { fprintf( stderr, "propagating spline coefficients to the remaining triangles:\n" ); fflush( stderr ); } // // red // for ( ii = 0; ii < a->npt; ++ii ) { triangle* t = a->pt[ii]; square * s = t->parent; int i = s->i; int j = s->j; double * c = s->coeffs; double * cl = ( i > 0 ) ? squares[j][i - 1]->coeffs : NULL; double * cb = ( j > 0 ) ? squares[j - 1][i]->coeffs : NULL; double * cbl = ( i > 0 && j > 0 ) ? squares[j - 1][i - 1]->coeffs : NULL; double * ca = ( j < nj - 1 ) ? squares[j + 1][i]->coeffs : NULL; double * cal = ( j < nj - 1 && i > 0 ) ? squares[j + 1][i - 1]->coeffs : NULL; c[7] = 2.0 * c[4] - c[1]; c[11] = 2.0 * c[8] - c[5]; c[15] = 2.0 * c[12] - c[9]; c[10] = 2.0 * c[6] - c[2]; c[13] = 2.0 * c[9] - c[5]; c[16] = 2.0 * c[12] - c[8]; c[19] = 2.0 * c[15] - c[11]; if ( cl != NULL ) { cl[21] = c[0]; cl[22] = c[1]; cl[23] = c[2]; cl[24] = c[3]; cl[18] = c[0] + c[1] - c[4]; cl[19] = c[1] + c[2] - c[5]; cl[20] = c[2] + c[3] - c[6]; cl[17] = 2.0 * cl[20] - cl[23]; cl[14] = 2.0 * cl[18] - cl[22]; } if ( cb != NULL ) { cb[3] = c[0]; cb[10] = c[7]; cb[6] = c[0] + c[7] - c[4]; cb[2] = 2.0 * cb[6] - cb[10]; } if ( cbl != NULL ) { cbl[23] = cb[2]; cbl[24] = cb[3]; cbl[20] = cb[2] + cb[3] - cb[6]; cbl[17] = cl[14]; } if ( ca != NULL ) { ca[0] = c[3]; ca[7] = c[10]; ca[4] = c[3] + c[10] - c[6]; ca[1] = 2.0 * ca[4] - ca[7]; } if ( cal != NULL ) { cal[21] = c[3]; cal[22] = ca[1]; cal[18] = ca[0] + ca[1] - ca[4]; cal[14] = cl[17]; } } // // blue // for ( ii = 0; ii < a->npt; ++ii ) { triangle* t = a->pt[ii]; square * s = t->parent; int i = s->i; int j = s->j; double * c = s->coeffs; double * cr = ( i < ni - 1 ) ? squares[j][i + 1]->coeffs : NULL; double * car = ( i < ni - 1 && j < nj - 1 ) ? squares[j + 1][i + 1]->coeffs : NULL; double * cbr = ( i < ni - 1 && j > 0 ) ? squares[j - 1][i + 1]->coeffs : NULL; if ( car != NULL ) cr[13] = car[7] + car[14] - car[11]; if ( cbr != NULL ) cr[11] = cbr[10] + cbr[17] - cbr[13]; if ( cr != NULL ) cr[5] = c[22] + c[23] - c[19]; } // // green & yellow // for ( ii = 0; ii < a->npt; ++ii ) { triangle* t = a->pt[ii]; square * s = t->parent; int i = s->i; int j = s->j; double * cr = ( i < ni - 1 ) ? squares[j][i + 1]->coeffs : NULL; if ( cr != NULL ) { cr[9] = ( cr[5] + cr[13] ) / 2.0; cr[8] = ( cr[5] + cr[11] ) / 2.0; cr[15] = ( cr[11] + cr[19] ) / 2.0; cr[16] = ( cr[13] + cr[19] ) / 2.0; cr[12] = ( cr[8] + cr[16] ) / 2.0; } } if ( csa_verbose ) { fprintf( stderr, "checking that all coefficients have been set:\n" ); fflush( stderr ); } for ( ii = 0; ii < ni * nj; ++ii ) { square* s = squares[0][ii]; double* c = s->coeffs; int i; if ( s->npoints == 0 ) continue; for ( i = 0; i < 25; ++i ) if ( isnan( c[i] ) ) fprintf( stderr, " squares[%d][%d]->coeffs[%d] = NaN\n", s->j, s->i, i ); } } static int i300[] = { 12, 12, 12, 12 }; static int i030[] = { 3, 24, 21, 0 }; static int i003[] = { 0, 3, 24, 21 }; static int i210[] = { 9, 16, 15, 8 }; static int i021[] = { 2, 17, 22, 7 }; static int i102[] = { 4, 6, 20, 18 }; static int i120[] = { 6, 20, 18, 4 }; static int i012[] = { 1, 10, 23, 14 }; static int i201[] = { 8, 9, 16, 15 }; static int i111[] = { 5, 13, 19, 11 }; static int * iall[] = { i300, i030, i003, i210, i021, i102, i120, i012, i201, i111 }; static void csa_sethascoeffsflag( csa* a ) { int i, j; for ( j = 0; j < a->nj; ++j ) { for ( i = 0; i < a->ni; ++i ) { square* s = a->squares[j][i]; double* coeffs = s->coeffs; int ii; for ( ii = 0; ii < 4; ++ii ) { triangle* t = s->triangles[ii]; int cc; for ( cc = 0; cc < 10; ++cc ) if ( isnan( coeffs[iall[cc][ii]] ) ) break; if ( cc == 10 ) t->hascoeffs = 1; } } } } void csa_calculatespline( csa* a ) { csa_squarize( a ); csa_attachpoints( a ); csa_findprimarycoeffs( a ); csa_findsecondarycoeffs( a ); csa_sethascoeffsflag( a ); } void csa_approximate_point( csa* a, point* p ) { double h = a->h; double ii = ( p->x - a->xmin ) / h + 1.0; double jj = ( p->y - a->ymin ) / h + 1.0; int i, j; square * s; double fi, fj; int ti; triangle* t; double bc[3]; if ( ii < 0.0 || jj < 0.0 || ii > (double) a->ni - 1.0 || jj > (double) a->nj - 1.0 ) { p->z = NaN; return; } i = (int) floor( ii ); j = (int) floor( jj ); s = a->squares[j][i]; fi = ii - i; fj = jj - j; if ( fj < fi ) { if ( fi + fj < 1.0 ) ti = 3; else ti = 2; } else { if ( fi + fj < 1.0 ) ti = 0; else ti = 1; } t = s->triangles[ti]; if ( !t->hascoeffs ) { p->z = NaN; return; } triangle_calculatebc( t, p, bc ); { double * c = s->coeffs; double bc1 = bc[0]; double bc2 = bc[1]; double bc3 = bc[2]; double tmp1 = bc1 * bc1; double tmp2 = bc2 * bc2; double tmp3 = bc3 * bc3; switch ( ti ) { case 0: p->z = c[12] * bc1 * tmp1 + c[3] * bc2 * tmp2 + c[0] * bc3 * tmp3 + 3.0 * ( c[9] * tmp1 * bc2 + c[2] * tmp2 * bc3 + c[4] * tmp3 * bc1 + c[6] * bc1 * tmp2 + c[1] * bc2 * tmp3 + c[8] * tmp1 * bc3 ) + 6.0 * c[5] * bc1 * bc2 * bc3; break; case 1: p->z = c[12] * bc1 * tmp1 + c[24] * bc2 * tmp2 + c[3] * bc3 * tmp3 + 3.0 * ( c[16] * tmp1 * bc2 + c[17] * tmp2 * bc3 + c[6] * tmp3 * bc1 + c[20] * bc1 * tmp2 + c[10] * bc2 * tmp3 + c[9] * tmp1 * bc3 ) + 6.0 * c[13] * bc1 * bc2 * bc3; break; case 2: p->z = c[12] * bc1 * tmp1 + c[21] * bc2 * tmp2 + c[24] * bc3 * tmp3 + 3.0 * ( c[15] * tmp1 * bc2 + c[22] * tmp2 * bc3 + c[20] * tmp3 * bc1 + c[18] * bc1 * tmp2 + c[23] * bc2 * tmp3 + c[16] * tmp1 * bc3 ) + 6.0 * c[19] * bc1 * bc2 * bc3; break; default: // 3 p->z = c[12] * bc1 * tmp1 + c[0] * bc2 * tmp2 + c[21] * bc3 * tmp3 + 3.0 * ( c[8] * tmp1 * bc2 + c[7] * tmp2 * bc3 + c[18] * tmp3 * bc1 + c[4] * bc1 * tmp2 + c[14] * bc2 * tmp3 + c[15] * tmp1 * bc3 ) + 6.0 * c[11] * bc1 * bc2 * bc3; } } } void csa_approximate_points( csa* a, int n, point* points ) { int ii; for ( ii = 0; ii < n; ++ii ) csa_approximate_point( a, &points[ii] ); } void csa_setnpmin( csa* a, int npmin ) { a->npmin = npmin; } void csa_setnpmax( csa* a, int npmax ) { a->npmax = npmax; } void csa_setk( csa* a, int k ) { a->k = k; } void csa_setnppc( csa* a, double nppc ) { a->nppc = (int) nppc; } #if defined ( STANDALONE ) #include "minell.h" #define NIMAX 2048 #define BUFSIZE 10240 #define STRBUFSIZE 64 static void points_generate( double xmin, double xmax, double ymin, double ymax, int nx, int ny, int* nout, point** pout ) { double stepx, stepy; double x0, xx, yy; int i, j, ii; if ( nx < 1 || ny < 1 ) { *pout = NULL; *nout = 0; return; } *nout = nx * ny; *pout = malloc( *nout * sizeof ( point ) ); stepx = ( nx > 1 ) ? ( xmax - xmin ) / ( nx - 1 ) : 0.0; stepy = ( ny > 1 ) ? ( ymax - ymin ) / ( ny - 1 ) : 0.0; x0 = ( nx > 1 ) ? xmin : ( xmin + xmax ) / 2.0; yy = ( ny > 1 ) ? ymin : ( ymin + ymax ) / 2.0; ii = 0; for ( j = 0; j < ny; ++j ) { xx = x0; for ( i = 0; i < nx; ++i ) { point* p = &( *pout )[ii]; p->x = xx; p->y = yy; xx += stepx; ii++; } yy += stepy; } } static int str2double( char* token, double* value ) { char* end = NULL; if ( token == NULL ) { *value = NaN; return 0; } *value = strtod( token, &end ); if ( end == token ) { *value = NaN; return 0; } return 1; } #define NALLOCATED_START 1024 // Reads array of points from a columnar file. // // @param fname File name (can be "stdin" or "-" for standard input) // @param dim Number of dimensions (must be 2 or 3) // @param n Pointer to number of points (output) // @param points Pointer to array of points [*n] (output) (to be freed) // void points_read( char* fname, int dim, int* n, point** points ) { FILE * f = NULL; int nallocated = NALLOCATED_START; char buf[BUFSIZE]; char seps[] = " ,;\t"; char * token; if ( dim < 2 || dim > 3 ) { *n = 0; *points = NULL; return; } if ( fname == NULL ) f = stdin; else { if ( strcmp( fname, "stdin" ) == 0 || strcmp( fname, "-" ) == 0 ) f = stdin; else { f = fopen( fname, "r" ); if ( f == NULL ) csa_quit( "%s: %s\n", fname, strerror( errno ) ); } } *points = malloc( nallocated * sizeof ( point ) ); *n = 0; while ( fgets( buf, BUFSIZE, f ) != NULL ) { point* p; if ( *n == nallocated ) { nallocated *= 2; *points = realloc( *points, nallocated * sizeof ( point ) ); } p = &( *points )[*n]; if ( buf[0] == '#' ) continue; if ( ( token = strtok( buf, seps ) ) == NULL ) continue; if ( !str2double( token, &p->x ) ) continue; if ( ( token = strtok( NULL, seps ) ) == NULL ) continue; if ( !str2double( token, &p->y ) ) continue; if ( dim == 2 ) p->z = NaN; else { if ( ( token = strtok( NULL, seps ) ) == NULL ) continue; if ( !str2double( token, &p->z ) ) continue; } ( *n )++; } if ( *n == 0 ) { free( *points ); *points = NULL; } else *points = realloc( *points, *n * sizeof ( point ) ); if ( f != stdin ) if ( fclose( f ) != 0 ) csa_quit( "%s: %s\n", fname, strerror( errno ) ); } static void points_write( int n, point* points ) { int i; if ( csa_verbose ) printf( "Output:\n" ); for ( i = 0; i < n; ++i ) { point* p = &points[i]; printf( "%.15g %.15g %.15g\n", p->x, p->y, p->z ); } } static double points_scaletosquare( int n, point* points ) { double xmin, ymin, xmax, ymax; double k; int i; if ( n <= 0 ) return NaN; xmin = xmax = points[0].x; ymin = ymax = points[0].y; for ( i = 1; i < n; ++i ) { point* p = &points[i]; if ( p->x < xmin ) xmin = p->x; else if ( p->x > xmax ) xmax = p->x; if ( p->y < ymin ) ymin = p->y; else if ( p->y > ymax ) ymax = p->y; } if ( xmin == xmax || ymin == ymax ) return NaN; else k = ( ymax - ymin ) / ( xmax - xmin ); for ( i = 0; i < n; ++i ) points[i].y /= k; return k; } static void points_scale( int n, point* points, double k ) { int i; for ( i = 0; i < n; ++i ) points[i].y /= k; } static void usage() { printf( "Usage: csabathy -i {-o |-n x [-c|-s] [-z ]}\n" ); printf( " [-v|-V] [-P nppc=] [-P k=]\n" ); printf( "Options:\n" ); printf( " -c -- scale internally so that the minimal ellipse turns into a\n" ); printf( " circle (this produces results invariant to affine\n" ); printf( " transformations)\n" ); printf( " -i -- three-column file with points to approximate from (use\n" ); printf( " \"-i stdin\" or \"-i -\" for standard input)\n" ); printf( " -n x -- generate x output rectangular grid\n" ); printf( " -o -- two-column file with points to approximate in (use\n" ); printf( " \"-o stdin\" or \"-o -\" for standard input)\n" ); printf( " -s -- scale internally so that Xmax - Xmin = Ymax - Ymin\n" ); printf( " -v -- verbose / version\n" ); printf( " -z -- zoom in (if < 1) or out ( > 1)\n" ); printf( " -P nppc= -- set the average number of points per cell (default = 5\n" ); printf( " increase if the point distribution is strongly non-uniform\n" ); printf( " to get larger cells)\n" ); printf( " -P k= -- set the spline sensitivity (default = 140, reduce to get\n" ); printf( " smoother results)\n" ); printf( " -V -- very verbose / version\n" ); printf( "Description:\n" ); printf( " `csabathy' approximates irregular scalar 2D data in specified points using\n" ); printf( " C1-continuous bivariate cubic spline. The calculated values are written to\n" ); printf( " standard output.\n" ); exit( 0 ); } static void version() { printf( "csa version %s\n", csa_version ); exit( 0 ); } static void parse_commandline( int argc, char* argv[], char** fdata, char** fpoints, int* invariant, int* square, int* generate_points, int* nx, int* ny, int* nppc, int* k, double* zoom ) { int i; if ( argc < 2 ) usage(); i = 1; while ( i < argc ) { if ( argv[i][0] != '-' ) usage(); switch ( argv[i][1] ) { case 'c': i++; *invariant = 1; *square = 0; break; case 'i': i++; if ( i >= argc ) csa_quit( "no file name found after -i\n" ); *fdata = argv[i]; i++; break; case 'n': i++; *fpoints = NULL; *generate_points = 1; if ( i >= argc ) csa_quit( "no grid dimensions found after -n\n" ); if ( sscanf( argv[i], "%dx%d", nx, ny ) != 2 ) csa_quit( "could not read grid dimensions after \"-n\"\n" ); if ( *nx <= 0 || *nx > NIMAX || *ny <= 0 || *ny > NIMAX ) csa_quit( "invalid size for output grid\n" ); i++; break; case 'o': i++; if ( i >= argc ) csa_quit( "no file name found after -o\n" ); *fpoints = argv[i]; i++; break; case 's': i++; *square = 1; *invariant = 0; break; case 'v': i++; csa_verbose = 1; break; case 'z': i++; if ( i >= argc ) csa_quit( "no zoom value found after -z\n" ); *zoom = atof( argv[i] ); i++; break; case 'P': { char delim[] = "="; char prmstr[STRBUFSIZE] = ""; char * token; i++; if ( i >= argc ) csa_quit( "no input found after -P\n" ); if ( strlen( argv[i] ) >= STRBUFSIZE ) csa_quit( "could not interpret \"%s\" after -P option\n", argv[i] ); strcpy( prmstr, argv[i] ); token = strtok( prmstr, delim ); if ( token == NULL ) csa_quit( "could not interpret \"%s\" after -P option\n", argv[i] ); if ( strcmp( token, "nppc" ) == 0 ) { long int n; token = strtok( NULL, delim ); if ( token == NULL ) csa_quit( "could not interpret \"%s\" after -P option\n", argv[i] ); n = strtol( token, NULL, 10 ); if ( n == LONG_MIN || n == LONG_MAX ) csa_quit( "could not interpret \"%s\" after -P option\n", argv[i] ); else if ( n <= 0 ) csa_quit( "non-sensible value for \"nppc\" parameter\n" ); *nppc = (int) n; } else if ( strcmp( token, "k" ) == 0 ) { long int n; token = strtok( NULL, delim ); if ( token == NULL ) csa_quit( "could not interpret \"%s\" after -P option\n", argv[i] ); n = strtol( token, NULL, 10 ); if ( n == LONG_MIN || n == LONG_MAX ) csa_quit( "could not interpret \"%s\" after -P option\n", argv[i] ); else if ( n <= 0 ) csa_quit( "non-sensible value for \"k\" parameter\n" ); *k = (int) n; } else usage(); i++; break; } case 'V': i++; csa_verbose = 2; break; default: usage(); break; } } if ( csa_verbose && argc == 2 ) version(); } int main( int argc, char* argv[] ) { char * fdata = NULL; char * fpoints = NULL; int nin = 0; point * pin = NULL; int invariant = 0; minell * me = NULL; int square = 0; int nout = 0; int generate_points = 0; point * pout = NULL; int nx = -1; int ny = -1; csa * a = NULL; int nppc = -1; int k = -1; double ks = NaN; double zoom = NaN; parse_commandline( argc, argv, &fdata, &fpoints, &invariant, &square, &generate_points, &nx, &ny, &nppc, &k, &zoom ); if ( fdata == NULL ) csa_quit( "no input data\n" ); if ( !generate_points && fpoints == NULL ) csa_quit( "no output grid specified\n" ); points_read( fdata, 3, &nin, &pin ); if ( nin < 3 ) return 0; if ( invariant ) { me = minell_build( nin, pin ); minell_scalepoints( me, nin, pin ); } else if ( square ) ks = points_scaletosquare( nin, pin ); a = csa_create(); csa_addpoints( a, nin, pin ); if ( nppc > 0 ) csa_setnppc( a, nppc ); if ( k > 0 ) csa_setk( a, k ); csa_calculatespline( a ); if ( generate_points ) { if ( isnan( zoom ) ) points_generate( a->xmin - a->h, a->xmax + a->h, a->ymin - a->h, a->ymax + a->h, nx, ny, &nout, &pout ); else { double xdiff2 = ( a->xmax - a->xmin ) / 2.0; double ydiff2 = ( a->ymax - a->ymin ) / 2.0; double xav = ( a->xmax + a->xmin ) / 2.0; double yav = ( a->ymax + a->ymin ) / 2.0; points_generate( xav - xdiff2 * zoom, xav + xdiff2 * zoom, yav - ydiff2 * zoom, yav + ydiff2 * zoom, nx, ny, &nout, &pout ); } } else { points_read( fpoints, 2, &nout, &pout ); if ( invariant ) minell_scalepoints( me, nout, pout ); else if ( square ) points_scale( nout, pout, ks ); } csa_approximate_points( a, nout, pout ); if ( invariant ) minell_rescalepoints( me, nout, pout ); else if ( square ) points_scale( nout, pout, 1.0 / ks ); points_write( nout, pout ); csa_destroy( a ); free( pin ); free( pout ); return 0; } #endif // STANDALONE plplot-5.10.0+dfsg/lib/csa/README 644 1750 1750 2616 7630262764 151250ustar andrewandrewcsa Bivariate Cubic Spline approximation library + standalone utility Version 0.05 Copyright 2002 CSIRO Marine Research GPO 1538 Hobart TAS 7001 Australia Please send comments and bugs to Pavel.Sakov@csiro.au There is no warranty whatsoever. Use at your own risk. These code may be freely redistributed under the condition that the copyright notices are not removed. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF CSIRO, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. To compile, run: configure make (make install) Apart from the `csa' library, this code contains `csabathy' -- an approximation utility based on `csa'. For a quick test, see examples/*/README. Acknowledgments: *The algorithm used is described in paper by J. Haber, F. Zeilfelder, O.Davydov and H.-P. Seidel, Smooth approximation and rendering of large scattered data sets, in ``Proceedings of IEEE Visualization 2001'' (Th.Ertl, K.Joy and A.Varshney, Eds.), pp.341-347, 571, IEEE Computer Society, 2001. http://www.uni-giessen.de/www-Numerische-Mathematik/davydov/VIS2001.ps.gz http://www.math.uni-mannheim.de/~lsmath4/paper/VIS2001.pdf.gz *The singular value decomposition code was borrowed from "Numerical Recipes in C". Good luck! Pavel Sakov plplot-5.10.0+dfsg/lib/csa/nan.h 644 1750 1750 242411571511407 151750ustar andrewandrew//-------------------------------------------------------------------------- // // File: nan.h // // Created: 18/10/2001 // // Author: Pavel Sakov // CSIRO Marine Research // // Purpose: NaN definition // // Description: Should cover machines with 64 bit doubles or other machines // with GCC // // Revisions: None // //-------------------------------------------------------------------------- #if !defined ( _NAN_H ) #define _NAN_H #if ( defined ( __GNUC__ ) && !defined ( __ICC ) ) || defined ( __BORLANDC__ ) static const double NaN = 0.0 / 0.0; #ifdef __BORLANDC__ #define isnan _isnan #define copysign _copysign #endif #elif defined ( WIN32 ) #if !defined ( _MSC_VER ) static unsigned _int64 lNaN = ( (unsigned _int64) 1 << 63 ) - 1; #define NaN ( *(double *) &lNaN ) #else // MSVC/C++ 6.0 reports a version 1200, // MSVC/C++ 2003 reports a version 1300 // #include #include #undef NaN #if _MSC_VER < 1300 #define NaN _Nan._D #else #define NaN _Nan._Double #endif #define isnan _isnan #define copysign _copysign #endif #else static const long long lNaN = ( (unsigned long long) 1 << 63 ) - 1; #define NaN ( *(double *) &lNaN ) #endif #endif plplot-5.10.0+dfsg/lib/csa/README.1st 644 1750 1750 201 7631173065 155730ustar andrewandrewThe files in this directory come from a stripped version of Pavel Sakov's csa library. See the file README for further details. plplot-5.10.0+dfsg/.gitignore 644 1750 1750 3311564571723 146670ustar andrewandrew*~ *.flc *.pyc tmp/ build/ plplot-5.10.0+dfsg/ToDo 644 1750 1750 20545 5765142652 135420ustar andrewandrew Areas currently under development --------------------------------- - Need developers! It is becoming too difficult to support PLplot on all the many platforms it runs on. If you want it to run correctly on your platform it needs your support. Current system supporters include: Maurice LeBrun HP-UX, Super-UX mjl@dino.ph.utexas.edu Geoff Furnish Linux furnish@dino.ph.utexas.edu Paul Casteels DOS/BGI (bcc) casteels@uia.ac.be John C. Peterson OS/2 jcp@trg.saic.com Paul Kirschner DOS/DJGPP pek@logos.res.utc.com Hiromi Kimura VMS port hiromi@tac.tsukuba.ac.jp This is not to say that other platforms are unsupported, as often we do work on other platforms, and will fix whatever problems we encounter. But there is no guarantee PLplot will work without problems on such systems either. The systems we really need help to support (in order of most urgent need) include: Irix Ultrix SunOS 5.x (any other *ix not mentioned) Macintosh Amiga Unicos AIX SunOS 4.x - Continue updating the manual. - improve color dialogs for TK driver: . inform client side that colors have been changed (right now only plserver side knows about it) . put in a better file selector for palette files . rewrite palette tools in itcl . add a way to pick direction in hue to use when interpolating between colors - Add an initialization file capability. This would be very nice from a customization standpoint, and inevitably I will want to add it before long. But it has some problems. For example, when does it get read? If when you call plinit(), it may overwrite previous variables set by the API or command-line. This is a thorny problem. A secondary issue is deciding what libraries it should depend on. Using libX11 makes it easier for color support, and Tcl for parsing, but with a bit extra effort, I could support non-Unix systems too. The real problem is that plplot has no command to "open the library". I am VERY tempted to require a call to plopen() as the FIRST plplot library call, just so that it could be absolutely sure it was the first. Then, it could read the startup file. You could do this with the Tk plframe widget because it must be created before you can send commands to it, and the command to read the init file could be buried in there. But it would probably be a bad idea to have one output driver read an init file and another one ignore it, since most people (myself included) rely on output from one driver to the next to be basically the same, contingent on driver capabilities that is. So this capability really needs to go into the core. - 3-D plots should be clipped at the 3-D box boundary. Right now the 3-d data is immediately transformed to 2-d lines on the projection plane. No intermediate clipping is performed, meaning that only the 2-d projected part is clipped. - fix 2d function plotter API's: Most general function in each category should accept transformer function and transformer data, to work with arbitrary data layouts, but there should also be FE's for the "usual data types". Work to be done: - add contour plotter FE's - add condition code array handler to plshade (upgrade plAlloc.. to handle char variables?) - fix API for surface plotter - vector field plotter? - better document the 2d function plotter API in plfcont, etc. - File familying is iffy and needs a full check out. - Write plcfill() or whatever to cheaply fill 2d functions based on cell value only. Should be much faster than plshade for many grid points (e.g. 128 x 128). The other option is raster, see below. - The color map selection in the versaterm driver still doesn't work quite right. When running x16c, the following happens: o color 9 isn't set correctly. This doesn't make sense -- how can the driver be messing up just for this one? Besides, it works fine on my Amiga's tek4107 driver. Sounds like a bug in versaterm. Need to check this code out on other Tek4107 emulators, like mskermit. o There is sometimes some garbage at the beginning of the fill. - implement some sort of raster-oriented output. GIF might be good since it runs on lots of machines (originated with PC's but now supported under Unix and Amiga). Any PD code for writing it from Unix? - support command line arg reading from Fortran under whatever important OS's support it. One trouble here is that it may require an additional oddball library to be linked in, and I'm not thrilled about that. - fix additional problems with custom color map support under X: . Add command line switch to enable it, maybe switches to for all the preprocessor constants in xwin.c controlling cmap allocation. . When a custom colormap is used, it becomes the new top level TK colormap, since the palette modification tools need to be using the same colormap in order for the colors to come out the same. But there is a minimum of color changing when the colormaps are swapped (i.e. focus goes into or out of the plplot/TK application) because the xwin driver copies as many colors out of the default as is reasonable. Cases where this still isn't quite good enough include the text widgets (such as help windows), for which the color is not preallocated, and sometimes the TK menu bar, for which I think the color is preallocated but exactly matches one already in use by the window manager and thus does not get copied. Some strategies in fixing this include: (a) providing a list of colors for the xwin driver to copy and allocate and (b) do not install the xwin colormap in the main window and instead share the colormap with windows that want it through a plframe extension. Right now because of continued uncertainties the custom colormap option in xwin.c is disabled. - metafile produced on the Amiga isn't quite right! Compiler bug? - How can I modify the surface plotter to do color overlays? - Write Fortran counterparts to x14c and x15c? - check out shared library support under SAS/C on the Amiga -- supposed to be easy (6.0 and later) - Split off Tcl-DP stuff from Tk stuff better, get it working with DP-lite. - put pen width option in TK driver - const'ify plplot API where appropriate. - fix bugs in Amiga print driver. - mouse dragging in TK driver text window should cause a scroll. - get plplot up under gcc on the Amiga? - fix problems with hidden line removal on "spiky" 3D plots on high resolution (300 dpi or greater) devices. There are little gaps that sometimes appear after a line reappears from behind a surface. In Mathematica, hidden line removal is done by the device driver (which receives PostScript) instead of beforehand. (There is a section in the Mathematica manual where they mention hidden-line removal as an inherently device dependent problem.) Things planned for sometime in the future. ---------------------------------------------- - CGM driver. Shouldn't be too hard, just haven't gotten around to it yet. Any volunteers? Should I assume the presence of a CGM library? Or should I carry my own routines to do low-level operations to the CGM file? (Here I could borrow from a freely distributable package that deals with CGM files). - graphical entities to be "objectized", so they are easier to manipulate from plrender. Likely candidates: plot, string, character, tick, axis, line, etc. But high performance must not be sacrificed. - Better use of driver intelligence, esp. for text -- the postscript driver should be capable of using postscript fonts instead of the Hershey fonts. - Cloned streams, for plotting to multiple devices simultaneously. - Fully document the plplot-driver interface. - Japanese plplot/TK extensions? - Japanese font extensions? BUGS ---- The following are known bugs or failings of PLplot, that are unlikely to be fixed any time soon if at all. - ps output files do not work with up(1). - The contour plotter has a bug that causes it to occasionally fail for some data sets. One known example is if there is no x-dependence. If you experience problems with other data try to work up a demo and send it to me and then maybe I can track down the problem. There has been some talk about replacing the contourer with a better algorithm. Volunteers needed. plplot-5.10.0+dfsg/plplot_test/ 775 1750 1750 012406243566 152335ustar andrewandrewplplot-5.10.0+dfsg/plplot_test/test_ocaml.sh.in 755 1750 1750 407111722014037 203760ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for ocaml examples. # # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $ocamldir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # Do the standard non-interactive examples. lang="ocaml" for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33; do if [ "$verbose_test" ] ; then echo "x${index}ocaml" fi if [ "$index" = "14" ] ; then echo "${OUTPUT_DIR}"/x${index}a${lang}%n.$dsuffix | \ "$ocamldir"/x${index}${lang} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? else "$ocamldir"/x${index}ocaml -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/plplot-test.sh.in 755 1750 1750 3116112243237170 205570ustar andrewandrew#!@SH_EXECUTABLE@ # -*- mode: shell-script -*- # $Id: plplot-test.sh.in 12725 2013-11-20 22:58:00Z airwin $ # # Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # test suite for executing all configured demos (either in plplot/tmp # or else in the install area) capable of file output. Our ultimate aim # is to compare the generated files with results generated on a system # that is known to give good results. However, single-precision # contamination (even when double is configured) and the consequent large # roundoff error is currently hampering our cross-platform comparisons. # So for now, this is only a test suite in the sense that it checks the # files corresponding to our demo plots can all be generated. It is # up to the user to display those files with the appropriate software # (e.g., gv for postscript files and kview or a browser for png, gif, # or jpeg files on Linux systems) to make sure they display properly. version=@PLPLOT_VERSION@ EXAMPLES_DIR=${EXAMPLES_DIR:-.} SRC_EXAMPLES_DIR=${SRC_EXAMPLES_DIR:-.} OUTPUT_DIR=${OUTPUT_DIR:-.} device=${DEVICE:-psc} export EXAMPLES_DIR SRC_EXAMPLES_DIR OUTPUT_DIR device DEBUG_CMD usage() { echo ' Usage: plplot-test.sh [OPTIONS] Options: [--device=DEVICE] (DEVICE = any cmake-enabled device. psc is the default) [--front-end=FE] (FE = one of c, cxx, f95 java, octave, python, tcl, pdl, ada, ocaml, lua or d) If this option is not specified, then all front-ends will be tested. More than one front-end may be given, like this --front-end="c cxx" [--examples-dir=/path/to/examples/dir] Specify path to the examples directory. Defaults to "." [--src-examples-dir=/path/to/src/examples/dir] Specify path to the src examples directory. Defaults to "." [--output-dir=/path/to/output/dir] Specify location where the resulting files are stored. Defaults to "." [--interactive] Run subset of C examples for interactive devices only. [--interactive_octave] Run interactive octave examples for interactive devices only. [--verbose] Echo each PLplot example that is executed. [--debug="debug command"] Run examples with given debug command. [--debug] Run examples with default debug command (valgrind). [--version] [--help] Environment variables: DEVICE, FRONT_END, EXAMPLES_DIR, SRC_EXAMPLES_DIR, and OUTPUT_DIR can be used to specify the devices, front-ends, the examples directory, the source examples directory (used for the special case of build-tree checks when that tree is separated from the source tree), and output directory. These environment variables are overridden by the options --device, --front-end, --examples-dir, --src-examples-dir, and --output-dir. ' exit $1 } # Figure out what script options were specified by the user. while test $# -gt 0; do if [ "@HAVE_BASH@" = "ON" ] ; then case "$1" in -*=*) optarg=${1#*=} ;; *) optarg= ;; esac else case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac fi case $1 in --device=*) device=$optarg ;; --interactive) interactive=on ;; --interactive_octave) interactive_octave=on ;; --verbose) export verbose_test=on ;; --version) echo $version exit 0 ;; --front-end=*) FRONT_END=$optarg for i in $FRONT_END ; do [ $i = "c" \ -o $i = "cxx" \ -o $i = "f95" \ -o $i = "java" \ -o $i = "octave" \ -o $i = "python" \ -o $i = "tcl" \ -o $i = "pdl" \ -o $i = "ada" \ -o $i = "ocaml" \ -o $i = "lua" \ -o $i = "d" \ ] \ || usage 0 1>&2 done ;; --examples-dir=*) EXAMPLES_DIR=$optarg ;; --src-examples-dir=*) SRC_EXAMPLES_DIR=$optarg ;; --output-dir=*) OUTPUT_DIR=$optarg ;; --debug=*) DEBUG_CMD=$optarg ;; --debug) DEBUG_CMD="valgrind --leak-check=full --show-reachable=yes --log-file=valgrind.x%q{index}%q{lang}.%q{dsuffix}.log" ;; --help) usage 0 1>&2 ;; *) usage 1 1>&2 ;; esac shift done # This script is only designed to work when EXAMPLES_DIR is a directory # with a subdirectory called "c". Check whether this conditions is true. if [ ! -d "$EXAMPLES_DIR"/c ] ; then echo ' This script is only designed to work when the EXAMPLES_DIR environment variable (overridden by option --examples-dir) is a directory with a subdirectory called "c". This condition has been violated. ' exit 1 fi # Find where the front-end scripts are by looking at the directory name of the # current script. if [ "@WIN32@" = "1" ] ; then scripts_dir=${0%/*} else scripts_dir=`echo "$0" | sed 's:/[^/][^/]*$::'` fi if [ "$interactive" = "on" -o "$interactive_octave" = "on" ] ; then # List of interactive devices for PLplot that _might_ be enabled. PLD_aqt=@PLD_aqt@ PLD_qtwidget=@PLD_qtwidget@ PLD_gcw=@PLD_gcw@ PLD_gnome=@PLD_gnome@ PLD_ntk=@PLD_ntk@ PLD_tk=@PLD_tk@ PLD_wingcc=@PLD_wingcc@ PLD_wincairo=@PLD_wincairo@ PLD_wxwidgets=@PLD_wxwidgets@ PLD_xcairo=@PLD_xcairo@ PLD_xwin=@PLD_xwin@ eval pld_device='$'PLD_$device if [ -z "$pld_device" ] ; then echo ' Never heard of an interactive device called '"$device"'. Either this is not a legitimate interactive device for PLplot or else plplot-test.sh.cmake needs some maintenance to include this interactive device in the list of possible PLplot interactive devices. ' exit 1 fi if [ ! "$pld_device" = "ON" ] ; then echo ' PLD_'"$device"' is defined as '"$pld_device"'. It must be ON (i.e., enabled by your cmake configuration and built properly) before you can use this script with DEVICE='"$device"'. ' exit 1 fi status=0 if [ "$interactive" = "on" ] ; then export cdir="$EXAMPLES_DIR"/c echo "Testing subset of C examples for device $device" script="$scripts_dir"/test_c_interactive.sh else # This case must be "$interactive_octave" = "on" export options= export octave=@OCTAVE@ export octavedir=\ "$EXAMPLES_DIR"/../bindings/octave:\ "$SRC_EXAMPLES_DIR"/../bindings/octave/PLplot:\ "$SRC_EXAMPLES_DIR"/../bindings/octave/PLplot/support:\ "$SRC_EXAMPLES_DIR"/../bindings/octave/misc:\ "$SRC_EXAMPLES_DIR"/octave:\ "@PLPLOT_OCTAVE_DIR@":\ "@PLPLOT_OCTAVE_DIR@"/support:\ "@OCTAVE_M_DIR@"/PLplot:\ "@OCTAVE_OCT_DIR@": echo "Testing interactive octave examples for device $device" script="$scripts_dir"/test_octave_interactive.sh fi @SH_EXECUTABLE@ "$script" || status=1 exit $status fi # These variables set by default assuming you are going to run this # script from the installed demos directory $prefix/lib/plplot$version/examples. cdir="$EXAMPLES_DIR"/c cxxdir="$EXAMPLES_DIR"/c++ f95dir="$EXAMPLES_DIR"/f95 pythondir="$@CONFIGURED_EXAMPLES_DIR@"/python tcldir="$@CONFIGURED_EXAMPLES_DIR@"/tcl perldir="$SRC_EXAMPLES_DIR"/perl javadir="$EXAMPLES_DIR"/java adadir="$EXAMPLES_DIR"/ada ocamldir="$EXAMPLES_DIR"/ocaml luadir="$@CONFIGURED_EXAMPLES_DIR@"/lua ddir="$EXAMPLES_DIR"/d octave=@OCTAVE@ octavedir=\ "$EXAMPLES_DIR"/../bindings/octave:\ "$SRC_EXAMPLES_DIR"/../bindings/octave/PLplot:\ "$SRC_EXAMPLES_DIR"/../bindings/octave/PLplot/support:\ "$SRC_EXAMPLES_DIR"/../bindings/octave/misc:\ "$SRC_EXAMPLES_DIR"/octave:\ "@PLPLOT_OCTAVE_DIR@":\ "@PLPLOT_OCTAVE_DIR@"/support:\ "@OCTAVE_M_DIR@"/PLplot:\ "@OCTAVE_OCT_DIR@": export cdir cxxdir f95dir pythondir javadir octave octavedir tcldir perldir adadir ocamldir luadir ddir fe="" # List of non-interactive (i.e., file) devices for PLplot that # _might_ be enabled. For completeness you may want to specify all devices # here, but be sure to comment out the interactive ones since they are # handled by the above --interactive logic. #interactive PLD_aqt=@PLD_aqt@ PLD_cgm=@PLD_cgm@ PLD_conex=@PLD_conex@ PLD_dg300=@PLD_dg300@ PLD_epsqt=@PLD_epsqt@ PLD_pdfqt=@PLD_pdfqt@ #interactive PLD_qtwidget=@PLD_qtwidget@ PLD_bmpqt=@PLD_bmpqt@ PLD_jpgqt=@PLD_jpgqt@ PLD_pngqt=@PLD_pngqt@ PLD_ppmqt=@PLD_ppmqt@ PLD_tiffqt=@PLD_tiffqt@ PLD_svgqt=@PLD_svgqt@ #interactive PLD_gcw=@PLD_gcw@ PLD_gif=@PLD_gif@ #interactive PLD_gnome=@PLD_gnome@ PLD_hp7470=@PLD_hp7470@ PLD_hp7580=@PLD_hp7580@ PLD_imp=@PLD_imp@ PLD_jpeg=@PLD_jpeg@ PLD_lj_hpgl=@PLD_lj_hpgl@ PLD_ljii=@PLD_ljii@ PLD_ljiip=@PLD_ljiip@ #not a file device PLD_mem=@PLD_mem@ #not a file device PLD_memcairo=@PLD_memcairo@ PLD_mskermit=@PLD_mskermit@ #interactive PLD_ntk=@PLD_ntk@ PLD_null=@PLD_null@ PLD_pbm=@PLD_pbm@ PLD_pdf=@PLD_pdf@ PLD_pdfcairo=@PLD_pdfcairo@ PLD_plmeta=@PLD_plmeta@ PLD_png=@PLD_png@ PLD_pngcairo=@PLD_pngcairo@ PLD_ps=@PLD_ps@ # special case PLD_psc=@PLD_ps@ PLD_pscairo=@PLD_pscairo@ PLD_epscairo=@PLD_epscairo@ PLD_pstex=@PLD_pstex@ PLD_psttf=@PLD_psttf@ # special case PLD_psttfc=@PLD_psttf@ PLD_svg=@PLD_svg@ PLD_svgcairo=@PLD_svgcairo@ PLD_tek4010=@PLD_tek4010@ PLD_tek4010f=@PLD_tek4010f@ PLD_tek4107=@PLD_tek4107@ PLD_tek4107f=@PLD_tek4107f@ #interactive PLD_tk=@PLD_tk@ #interactive PLD_tkwin=@PLD_tkwin@ PLD_versaterm=@PLD_versaterm@ PLD_vlt=@PLD_vlt@ #interactive PLD_wincairo=@PLD_wincairo@ #interactive PLD_wingcc=@PLD_wingcc@ PLD_wxpng=@PLD_wxpng@ #interactive PLD_wxwidgets=@PLD_wxwidgets@ #interactive PLD_xcairo=@PLD_xcairo@ PLD_xfig=@PLD_xfig@ PLD_xterm=@PLD_xterm@ #interactive PLD_xwin=@PLD_xwin@ eval pld_device='$'PLD_$device if [ -z "$pld_device" ] ; then echo ' Never heard of a file device called '"$device"'. Either this is not a legitimate file (i.e. non-interactive) device for PLplot or else plplot-test.sh.cmake needs some maintenance to include this file device in the list of possible PLplot file devices. ' exit 1 fi if [ ! "$pld_device" = "ON" ] ; then echo ' PLD_'"$device"' is defined as '"$pld_device"'. It must be ON (i.e., enabled by your cmake configuration and built properly) before you can use this script with DEVICE='"$device"'. ' exit 1 fi # Some devices require special options others do not. case "$device" in png|pngcairo|epscairo|jpeg|xfig|svg|svgcairo|bmpqt|jpgqt|pngqt|ppmqt|tiffqt|svgqt|epsqt|pdfqt) options="-fam -fflen 2" ;; gif) # gif standard is limited to 256 colours so cannot have aliasing turned # on (which uses additional colours) for examples which already have # a substantial number of colours (such as example 2 with its 116 colours). options="-fam -fflen 2 -drvopt smooth=0" ;; *) options= ;; esac dsuffix=$device export dsuffix options # Find out what front-ends have been configured if [ -z "$FRONT_END" ] ; then FRONT_END=c test "@ENABLE_cxx@" = "ON" && FRONT_END="$FRONT_END cxx" test "@ENABLE_f95@" = "ON" && FRONT_END="$FRONT_END f95" test "@ENABLE_java@" = "ON" && FRONT_END="$FRONT_END java" test "@ENABLE_octave@" = "ON" && FRONT_END="$FRONT_END octave" test "@ENABLE_python@" = "ON" && FRONT_END="$FRONT_END python" test "@ENABLE_tcl@" = "ON" && FRONT_END="$FRONT_END tcl" test "@ENABLE_pdl@" = "ON" && FRONT_END="$FRONT_END pdl" test "@ENABLE_ada@" = "ON" && FRONT_END="$FRONT_END ada" test "@ENABLE_ocaml@" = "ON" && FRONT_END="$FRONT_END ocaml" test "@ENABLE_lua@" = "ON" && FRONT_END="$FRONT_END lua" test "@ENABLE_d@" = "ON" && FRONT_END="$FRONT_END d" fi # Call the front-end scripts status=0 if [ "@WIN32@" = "1" ] ; then critical_examples="14 17 29" exesuffix=".exe" else critical_examples="14 17 29" exesuffix= fi export critical_examples exesuffix for i in $FRONT_END ; do echo "Testing front-end $i" script="$scripts_dir"/test_$i.sh @SH_EXECUTABLE@ "$script" || status=1 done exit $status plplot-5.10.0+dfsg/plplot_test/test_java.sh.in 755 1750 1750 525511722014037 202310ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for java examples. # # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $javadir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # N.B. $PLPLOT_CLASSPATH must be defined properly so it includes a # reference to plplot.jar. If not we assume in installation location. # The path must point to the java command for this to work. # To build the java examples before running this script do the following: # pushd $javadir; make; popd # Do the standard non-interactive examples. # # Set up option to point to java bindings jar file and wrapper if needed. lang="j" if [ -n "$PLPLOT_JAVA_WRAP_DIR" ]; then JAVA_TEST_OPTS="-Dplplot.libdir=$PLPLOT_JAVA_WRAP_DIR" fi if [ -z "$PLPLOT_CLASSPATH" ] ; then PLPLOT_CLASSPATH="@JAVADATA_HARDDIR@"/plplot.jar fi if [ "@WIN32@" != "1" ]; then PLPLOT_CLASSPATH="${javadir}":"${PLPLOT_CLASSPATH}" fi for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33 ; do if [ "$verbose_test" ] ; then echo "x${index}" fi if [ "$index" = "14" ] ; then echo "${OUTPUT_DIR}"/x${index}a${lang}%n.$dsuffix | \ java -classpath "${PLPLOT_CLASSPATH}" ${JAVA_TEST_OPTS} plplot.examples.x${index} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? else java -classpath "${PLPLOT_CLASSPATH}" ${JAVA_TEST_OPTS} plplot.examples.x${index} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_cxx.sh.in 755 1750 1750 522611722014037 201100ustar andrewandrew#!@SH_EXECUTABLE@ # # Test suite for c++ examples. # # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $cxxdir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # To build the c++ examples before running this script do the following: # pushd $cxxdir; make; popd lang="cxx" export index lang # Do the standard non-interactive examples. for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 15 16 18 19 20 \ 21 22 23 24 25 26 27 28 30 31 33 ${critical_examples}; do if [ "$verbose_test" ] ; then echo "x${index}" fi if [ "$index" = "14" ] ; then echo "${OUTPUT_DIR}"/x${index}a${lang}%n.$dsuffix | \ $DEBUG_CMD "$cxxdir"/x${index}${exesuffix} -dev $device -o "${OUTPUT_DIR}"/x${index}cxx%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? else $DEBUG_CMD "$cxxdir"/x${index}${exesuffix} -dev $device -o "${OUTPUT_DIR}"/x${index}cxx%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done # x01cc is a C++ alternative that has no corresponding examples for the # other front ends. if [ "$verbose_test" ] ; then echo "x01cc" fi index=01c $DEBUG_CMD "$cxxdir"/x01cc${exesuffix} -dev $device -o "${OUTPUT_DIR}"/x01cc%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi plplot-5.10.0+dfsg/plplot_test/CMakeLists.txt 644 1750 1750 4573512254656572 201150ustar andrewandrew# plplot_test/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006-2013 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Only set up test environment, configure test files, and install them if # a shell is available. if(SH_EXECUTABLE) set(SCRIPTS) set(TEST_ENVIRONMENT "EXAMPLES_DIR=${CMAKE_BINARY_DIR}/examples SRC_EXAMPLES_DIR=${CMAKE_SOURCE_DIR}/examples" ) set(TEST_DEVICE psc CACHE STRING "device used for ctest") # There is no PLD_psc or PLD_psttfc and the PLD_ps and PLD_psttf # variables must be used instead. All other PLD_* names correspond # to exact device names. So adjust for this complicated naming # scheme in a general way in case some other TEST_DEVICE is chosen # in the future. if(TEST_DEVICE STREQUAL "psc") set(PLD_TEST_DEVICE ${PLD_ps}) elseif(TEST_DEVICE STREQUAL "psttfc") set(PLD_TEST_DEVICE ${PLD_psttf}) else(TEST_DEVICE STREQUAL "psc") set(PLD_TEST_DEVICE ${PLD_${TEST_DEVICE}}) endif(TEST_DEVICE STREQUAL "psc") set(TEST_SCRIPT "./plplot-test.sh --verbose") set(TEST_SCRIPT_DEVICE "${TEST_SCRIPT} --device=${TEST_DEVICE}") set(JAVA_TEST_ENVIRONMENT "${TEST_ENVIRONMENT} PLPLOT_JAVA_WRAP_DIR=${CMAKE_BINARY_DIR}/bindings/java/ PLPLOT_CLASSPATH=${CMAKE_BINARY_DIR}/examples/java/plplot.jar") #Build-tree configuration set(CONFIGURED_EXAMPLES_DIR EXAMPLES_DIR) configure_file( plplot-test.sh.in ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh @ONLY ) #Install-tree configuration set(CONFIGURED_EXAMPLES_DIR SRC_EXAMPLES_DIR) configure_file( plplot-test.sh.in ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh_install @ONLY ) # Set up optional tests in the configured plplot-test-interactive.sh file. set(pkgIndex_LOCATION ${DATA_DIR}) set(SHELL_TEST_PLTCL_STANDARD_EXAMPLES 1) set(SHELL_TEST_PLSERVER_STANDARD_EXAMPLES 1) # FIXME. Currently plserver_runAllDemos needs work so drop it for now. set(SHELL_TEST_PLSERVER_RUNALLDEMOS 0) # All Tcl/Tk tests that use the "package require" approach only # work with shared libraries. if(BUILD_SHARED_LIBS) set(SHELL_TEST_TCLSH_STANDARD_EXAMPLES 1) # FIXME. Currently wish_standard_examples segfaults on exit. So # drop it for now. set(SHELL_TEST_WISH_STANDARD_EXAMPLES 0) # FIXME. Currently the wish_runAllDemos needs work and also has # an intermittent bug (x?? not recognized as a command). set(SHELL_TEST_WISH_RUNALLDEMOS 0) else(BUILD_SHARED_LIBS) set(SHELL_TEST_TCLSH_STANDARD_EXAMPLES 0) set(SHELL_TEST_WISH_STANDARD_EXAMPLES 0) set(SHELL_TEST_WISH_RUNALLDEMOS 0) endif(BUILD_SHARED_LIBS) configure_file( plplot-test-interactive.sh.in ${CMAKE_CURRENT_BINARY_DIR}/plplot-test-interactive.sh @ONLY ) configure_file( test_c.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_c.sh @ONLY ) list(APPEND SCRIPTS test_c.sh) configure_file( test_c_interactive.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_c_interactive.sh @ONLY ) list(APPEND SCRIPTS test_c_interactive.sh) set(test_output_files_LIST) set(examples_compare_DEPENDS) if(PLD_TEST_DEVICE) add_test(examples_c ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=c" ) list(APPEND examples_compare_DEPENDS examples_c) list_example_files(. ${TEST_DEVICE} c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) if(ENABLE_cxx) configure_file( test_cxx.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_cxx.sh @ONLY ) list(APPEND SCRIPTS test_cxx.sh) if(PLD_TEST_DEVICE) add_test(examples_cxx ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=cxx" ) list(APPEND examples_compare_DEPENDS examples_cxx) list_example_files(. ${TEST_DEVICE} cxx output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_cxx) if(ENABLE_f95) configure_file( test_f95.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_f95.sh @ONLY ) list(APPEND SCRIPTS test_f95.sh) if(PLD_TEST_DEVICE) add_test(examples_f95 ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=f95" ) list(APPEND examples_compare_DEPENDS examples_f95) list_example_files(. ${TEST_DEVICE} f95 output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_f95) if(ENABLE_java) configure_file( test_java.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_java.sh @ONLY ) list(APPEND SCRIPTS test_java.sh) if(PLD_TEST_DEVICE) add_test(examples_java ${SH_EXECUTABLE} -c "${JAVA_TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=java" ) list(APPEND examples_compare_DEPENDS examples_java) list_example_files(. ${TEST_DEVICE} j output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_java) if(ENABLE_octave) configure_file( test_octave_interactive.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_octave_interactive.sh @ONLY ) list(APPEND SCRIPTS test_octave_interactive.sh) configure_file( test_octave.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_octave.sh @ONLY ) list(APPEND SCRIPTS test_octave.sh) if(PLD_TEST_DEVICE) add_test(examples_octave ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=octave" ) list(APPEND examples_compare_DEPENDS examples_octave) list_example_files(. ${TEST_DEVICE} o output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_octave) if(ENABLE_python) configure_file( test_python.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_python.sh @ONLY ) list(APPEND SCRIPTS test_python.sh) if(PLD_TEST_DEVICE) add_test(examples_python ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=python" ) list(APPEND examples_compare_DEPENDS examples_python) list_example_files(. ${TEST_DEVICE} p output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_python) if(ENABLE_tcl) get_target_property(pltcl_LOC pltcl LOCATION) string(REGEX REPLACE "/pltcl.*$" "" PLTCL_DIR ${pltcl_LOC}) # Experience with MSYS bash shows that variables used to set a # PATH component must transform the drive-letter form to the # leading-slash Unix form of the PATH component. The case of the # drive letter doesn't matter. For example converting # z:/whatever/path ==> /z/whatever/path or /Z/whatever/path works # fine for MSYS bash. string(REGEX REPLACE "^(.):/" "/\\1/" PLTCL_DIR ${PLTCL_DIR}) configure_file(test_tcl.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_tcl.sh @ONLY ) if(PLD_TEST_DEVICE) add_test(examples_tcl ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=tcl" ) list(APPEND examples_compare_DEPENDS examples_tcl) list_example_files(. ${TEST_DEVICE} t output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) set(PLTCL_DIR ${BIN_DIR}) # Transform drive-letter form to leading-slash form, see comment above. string(REGEX REPLACE "^(.):" "/\\1/" PLTCL_DIR ${PLTCL_DIR}) configure_file(test_tcl.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_tcl.sh_install @ONLY ) endif(ENABLE_tcl) if(ENABLE_pdl) configure_file( test_pdl.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_pdl.sh @ONLY ) list(APPEND SCRIPTS test_pdl.sh) if(PLD_TEST_DEVICE) add_test(examples_pdl ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=pdl" ) list(APPEND examples_compare_DEPENDS examples_pdl) list_example_files(. ${TEST_DEVICE} pdl output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_pdl) if(ENABLE_ada) configure_file( test_ada.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_ada.sh @ONLY ) list(APPEND SCRIPTS test_ada.sh) if(PLD_TEST_DEVICE) add_test(examples_ada ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=ada" ) list(APPEND examples_compare_DEPENDS examples_ada) list_example_files(. ${TEST_DEVICE} a output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_ada) if(ENABLE_ocaml) configure_file( test_ocaml.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_ocaml.sh @ONLY ) list(APPEND SCRIPTS test_ocaml.sh) if(PLD_TEST_DEVICE) add_test(examples_ocaml ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=ocaml" ) list(APPEND examples_compare_DEPENDS examples_ocaml) list_example_files(. ${TEST_DEVICE} ocaml output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_ocaml) if(ENABLE_lua) configure_file( test_lua.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_lua.sh @ONLY ) list(APPEND SCRIPTS test_lua.sh) if(PLD_TEST_DEVICE) add_test(examples_lua ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=lua" ) list(APPEND examples_compare_DEPENDS examples_lua) list_example_files(. ${TEST_DEVICE} lua output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_lua) if(ENABLE_d) configure_file( test_d.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_d.sh @ONLY ) list(APPEND SCRIPTS test_d.sh) if(PLD_TEST_DEVICE) add_test(examples_d ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT_DEVICE} --front-end=d" ) list(APPEND examples_compare_DEPENDS examples_d) list_example_files(. ${TEST_DEVICE} d output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_TEST_DEVICE) endif(ENABLE_d) # Run C examples with different drivers if(PLD_ps) if (NOT TEST_DEVICE STREQUAL "psc") add_test(examples_psc ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=psc" ) list_example_files(. psc c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(NOT TEST_DEVICE STREQUAL "psc") endif(PLD_ps) if(PLD_psttf) add_test(examples_psttfc ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=psttfc" ) list_example_files(. psttfc c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_psttf) if(PLD_pstex) add_test(examples_pstex ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pstex" ) list_example_files(. pstex c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_pstex) if(PLD_png) add_test(examples_png ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=png" ) list_example_files(. png c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_png) if(PLD_svg) add_test(examples_svg ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=svg" ) list_example_files(. svg c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_svg) if(PLD_plmeta) add_test(examples_plmeta ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=plmeta" ) list_example_files(. plmeta c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_plmeta) if(PLD_pscairo) add_test(examples_pscairo ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pscairo" ) list_example_files(. pscairo c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_pscairo) if(PLD_pngcairo) add_test(examples_pngcairo ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pngcairo" ) list_example_files(. pngcairo c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_pngcairo) if(PLD_xfig) add_test(examples_xfig ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=xfig" ) list_example_files(. xfig c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_xfig) if(PLD_gif) add_test(examples_gif ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=gif" ) list_example_files(. gif c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_gif) if(PLD_cgm) add_test(examples_cgm ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=cgm" ) list_example_files(. cgm c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_cgm) if(PLD_bmpqt) add_test(examples_bmpqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=bmpqt" ) list_example_files(. bmpqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_bmpqt) if(PLD_jpgqt) add_test(examples_jpgqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=jpgqt" ) list_example_files(. jpgqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_jpgqt) if(PLD_pngqt) add_test(examples_pngqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pngqt" ) list_example_files(. pngqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_pngqt) if(PLD_ppmqt) add_test(examples_ppmqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=ppmqt" ) list_example_files(. ppmqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_ppmqt) if(PLD_tiffqt) add_test(examples_tiffqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=tiffqt" ) list_example_files(. tiffqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_tiffqt) if(PLD_svgqt) add_test(examples_svgqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=svgqt" ) list_example_files(. svgqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_svgqt) if(PLD_epsqt) add_test(examples_epsqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=epsqt" ) list_example_files(. epsqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_epsqt) if(PLD_pdfqt) add_test(examples_pdfqt ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pdfqt" ) list_example_files(. pdfqt c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_pdfqt) if(PLD_pdf) add_test(examples_pdf ${SH_EXECUTABLE} -c "${TEST_ENVIRONMENT} ${TEST_SCRIPT} --front-end=c --device=pdf" ) list_example_files(. pdf c output_list) list(APPEND test_output_files_LIST ${output_list}) endif(PLD_pdf) if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) configure_file( test_diff.sh.in ${CMAKE_CURRENT_BINARY_DIR}/test_diff.sh @ONLY ) list(APPEND SCRIPTS test_diff.sh) add_test(examples_compare ${SH_EXECUTABLE} -c "./test_diff.sh" ) # There is a bug in 2.8.x with x < 5 where tests are run out of # the order in which they are declared by default. Also, 2.8.x # can run repeat tests out of order due to some optimizations that # have been implemented. Thus, always force examples_compare to # be run after the other tests it depends on. #message(STATUS "DEBUG: examples_compare_DEPENDS = ${examples_compare_DEPENDS}") set_tests_properties(examples_compare PROPERTIES DEPENDS "${examples_compare_DEPENDS}" ) endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) if(BUILD_TEST) # Make a copy of lena.pgm to the test subdirectory of the build # tree so that example 20 will run from there. add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/examples/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm DEPENDS ${CMAKE_SOURCE_DIR}/examples/lena.pgm ) add_custom_target(lena_file ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm) if(ENABLE_octave) # Also need a copy of lena.img for the octave bindings add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lena.img COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/examples/octave/lena.img ${CMAKE_CURRENT_BINARY_DIR}/lena.img DEPENDS ${CMAKE_SOURCE_DIR}/examples/octave/lena.img ) add_custom_target(lena_octave_file ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lena.img) endif(ENABLE_octave) # Custom target to remove everything created by ctest # N.B. the test_output_files_LIST is extremely long and # overflows the maximum line length of the shell if you # replace "." above with ${CMAKE_CURRENT_BINARY_DIR} add_custom_target(clean_ctest_plot_files COMMAND ${CMAKE_COMMAND} -E remove ${test_output_files_LIST} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) endif(BUILD_TEST) set(PERM_SCRIPTS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) foreach(SCRIPT ${SCRIPTS}) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT} DESTINATION ${DATA_DIR}/examples PERMISSIONS ${PERM_SCRIPTS} ) endforeach(SCRIPT ${SCRIPTS}) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot-test.sh_install DESTINATION ${DATA_DIR}/examples PERMISSIONS ${PERM_SCRIPTS} RENAME plplot-test.sh ) if(ENABLE_tcl) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/test_tcl.sh_install DESTINATION ${DATA_DIR}/examples PERMISSIONS ${PERM_SCRIPTS} RENAME test_tcl.sh ) endif(ENABLE_tcl) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot-test-interactive.sh DESTINATION ${DATA_DIR}/examples PERMISSIONS ${PERM_SCRIPTS} ) endif(SH_EXECUTABLE) plplot-5.10.0+dfsg/plplot_test/test_c.sh.in 755 1750 1750 435411652165607 175450ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for c examples. # # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $cdir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # To build the c examples before running this script do the following: # pushd $cdir; make; popd # Do the standard non-interactive examples. lang="c" export index lang for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 15 16 18 19 20 \ 21 22 23 24 25 26 27 28 30 31 33 ${critical_examples}; do if [ "$verbose_test" ] ; then echo "x${index}${lang}" fi if [ "$index" = "14" ] ; then echo "${OUTPUT_DIR}"/x${index}a${lang}%n.$dsuffix | \ $DEBUG_CMD "$cdir"/x${index}${lang} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? else $DEBUG_CMD "$cdir"/x${index}${lang} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_octave.sh.in 755 1750 1750 735412241255155 206000ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for octave examples. # # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $octave, $octavedir, $device, # $dsuffix and $options defined. # Assumes that $option starts and are '-' separated. # The following is only need for the build tree! It should has no effect # when this script is launched from the install tree. lang="o" export lang # Normalize to leading-slash form of drive-letter just in case that is # essential for Windows platforms. TOPDIR="$(pwd |sed 's?^/\(.\)/?\1:/?')"/.. echo "$TOPDIR" export LD_LIBRARY_PATH="$TOPDIR"/src:"$TOPDIR"/lib/csa:"$TOPDIR"/lib/nn # Launch an Octave script that exercises all the demos $octave -f -q -p "$octavedir" < test.error # Check verbose_test variable if (strcmp(getenv("verbose_test"),"on") == 1) verbose_test = 1; else verbose_test = 0; endif plplot_stub; t = char(strsplit("$options", "-")); if (t); t(1,:)=""; endif; for i=1:rows(t) tt = deblank (t(i,:)); len = length(tt); ix = index(tt," "); if (ix == 0); ix = len; len = 0; endif plsetopt(tt(1:ix), tt(ix+1:len)); endfor # Subset of p examples selected that seem to work ok with noninteractive # devices. # Remove 7, 16 until plshade1 fix is done. for i=[1:6 8 9 13 15 21] ; if (verbose_test) printf("p%d\n",i); endif figure(i,"$device",sprintf("${OUTPUT_DIR}/p%d%%n.$dsuffix",i)); feval(sprintf("p%d",i)) closefig endfor #plot equivalent of x??c examples. These only required octave-2.0.x #Example 19 is not yet implemented # Example 32 not implemented because there has been no call for propagation # and it exercises no new API. failed = [] ; for i=[0:18 19 20:31 33] ; ofile = sprintf("${OUTPUT_DIR}/x%.2d${lang}_${dsuffix}.txt",i); strm = fopen(ofile,"w"); cmd = sprintf("x%.2dc",i); if (verbose_test) printf("%s\n",cmd); endif t = char(strsplit("$options", "-")); if (t) ; t(1,:)=""; endif for j=1:rows(t) tt = deblank (t(j,:)); len = length(tt); ix = index(tt," "); if (ix == 0); ix = len; len = 0; endif plSetOpt(deblank(tt(1:ix)), tt(ix:len)); endfor device="$device"; plSetOpt("dev", device); #o trailer on filename e.g., x01o.ps) to distinguish from other #common examples. file = sprintf("${OUTPUT_DIR}/x%.2d${lang}%%n.$dsuffix",i); plSetOpt("o", file); if i == 14 file2 = sprintf("${OUTPUT_DIR}/x%.2da${lang}.${dsuffix}",i); endif eval(cmd, "failed = [failed, i] ;"); fclose(strm); clear file2; endfor if ! isempty (failed) printf ("Failed tests: "); for i = 1 : length (failed) if i != 1 printf (", "); endif printf ("x%.2dc.m", failed (i)); endfor printf ("\n"); exit (1); endif EOF status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi plplot-5.10.0+dfsg/plplot_test/test_lua.sh.in 755 1750 1750 462011722014037 200640ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for lua examples. # # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $luadir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # Do the standard non-interactive examples. lang="lua" # Lua examples must be run from the directory where they exist. cd "${OUTPUT_DIR}" # On Windows systems the sed stanza converts from leading slash form # to drive-letter form. This distinction matters for all prompted # filenames (e.g., example 14) but does not matter for -o options. results="$(pwd |sed 's?^/\(.\)/?\1:/?')" export results cd "$luadir" for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33; do if [ "$verbose_test" ] ; then echo "x${index}" fi if [ "$index" = "14" ] ; then echo "${results}"/x${index}a${lang}%n.$dsuffix | \ @LUA_EXECUTABLE@ x${index}.${lang} -dev $device -o "${results}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${results}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? else @LUA_EXECUTABLE@ x${index}.${lang} -dev $device -o "${results}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${results}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_pdl.sh.in 755 1750 1750 440412276771565 201070ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for perl examples. # # Copyright (C) 2004-2011 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $perldir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # To build the c examples before running this script do the following: # pushd $cdir; make; popd # Do the standard non-interactive examples. # Ensure correct version of the libraries are picked up in both the build # tree and install tree. lang="pdl" if [ "$LD_LIBRARY_PATH" = "" ] ; then export LD_LIBRARY_PATH=../src:"@LIB_DIR@" else export LD_LIBRARY_PATH=../src:"@LIB_DIR@":$LD_LIBRARY_PATH fi INDEX_LIST="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33" for index in $INDEX_LIST ; do if [ "$verbose_test" ] ; then echo "x${index}.pl" fi if [ "$index" = "14" ] ; then echo "${OUTPUT_DIR}"/x${index}a${lang}%n.$dsuffix | \ "$perldir"/x${index}.pl -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? else "$perldir"/x${index}.pl -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/plplot-test-interactive.sh.in 755 1750 1750 3324712264404031 230740ustar andrewandrew#!@SH_EXECUTABLE@ # -*- mode: shell-script -*- # $Id: plplot-test-interactive.sh.in 12934 2014-01-12 03:12:25Z airwin $ # # Copyright (C) 2009-2014 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Test suite of PLplot interactive stuff that cannot be tested with # file output device drivers. EXAMPLES_DIR=${EXAMPLES_DIR:-.} SRC_EXAMPLES_DIR=${SRC_EXAMPLES_DIR:-.} usage() { echo ' Usage: plplot-test-interactive.sh [OPTIONS] Options: [--device=DEVICES_LIST] where DEVICES_LIST is one of more devices specified as a blank-delimited string (e.g., --device=xwin or --device="qtwidget extqt"). Note each specified device must be taken from the following list of eligible interactive devices: xwin, tk, xcairo, gcw, wxwidgets, qtwidget, extcairo or extqt. [--help] Environment variables: DEVICES_LIST can be used to specify the device(s). This environment variable is overridden by the option --device. N.B. All members of DEVICES_LIST (whether specified by the DEVICES_LIST environment variable or by the --device option _must_ be configured. If neither the environment variable or --device option is specified, then every _configured_ device from the above list is used. ' exit $1 } # Figure out what script options were specified by the user. while test $# -gt 0; do if [ "@HAVE_BASH@" = "ON" ] ; then case "$1" in -*=*) optarg=${1#*=} ;; *) optarg= ;; esac else case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac fi case $1 in --device=*) DEVICES_LIST=$optarg ;; --help) usage 0 1>&2 ;; *) usage 1 1>&2 ;; esac shift done # This script is only designed to work when EXAMPLES_DIR is a directory # with a subdirectory called "c". Check whether this conditions is true. if [ ! -d "$EXAMPLES_DIR"/c ] ; then echo ' This script is only designed to work when the EXAMPLES_DIR environment variable (overridden by option --examples-dir) is a directory with a subdirectory called "c". This condition has been violated. ' exit 1 fi # Set up interactive and/or external devices that are used for tests. # Cannot use loop for this because of configuration. PLD_xwin=@PLD_xwin@ PLD_tk=@PLD_tk@ PLD_ntk=@PLD_ntk@ PLD_xcairo=@PLD_xcairo@ PLD_gcw=@PLD_gcw@ PLD_wxwidgets=@PLD_wxwidgets@ PLD_qtwidget=@PLD_qtwidget@ PLD_extcairo=@PLD_extcairo@ PLD_extqt=@PLD_extqt@ # These blank-delimited strings must be consistent with previous configured # list of devices. POSSIBLE_INTERACTIVE_DEVICES_LIST="xwin tk ntk xcairo gcw wxwidgets qtwidget" POSSIBLE_DEVICES_LIST="$POSSIBLE_INTERACTIVE_DEVICES_LIST extcairo extqt" # Default DEVICES_LIST is all eligible devices if environment variable # not specified and --devices option not specified. if [ -z "$DEVICES_LIST" ] ; then DEVICES_LIST= for device in $POSSIBLE_DEVICES_LIST ; do eval pld_device='$'PLD_$device test "$pld_device" = "ON" && DEVICES_LIST="$DEVICES_LIST $device" done fi # Check that everything in DEVICES_LIST is a configured device. for device in $DEVICES_LIST ; do eval pld_device='$'PLD_$device if [ ! "$pld_device" = "ON" ] ; then echo "$device is either not configured or not used for interactive tests." usage 1 1>&2 fi done # Turn off all devices not mentioned in DEVICES_LIST. for device in $POSSIBLE_DEVICES_LIST ; do eval "PLD_$device=OFF" done for device in $DEVICES_LIST ; do eval "PLD_$device=ON" done INTERACTIVE_DEVICES_LIST= for device in $POSSIBLE_INTERACTIVE_DEVICES_LIST ; do eval pld_device='$'PLD_$device test "$pld_device" = "ON" && \ INTERACTIVE_DEVICES_LIST="$INTERACTIVE_DEVICES_LIST $device" done OVERALL_STATUS_CODE=0 for device in $INTERACTIVE_DEVICES_LIST ; do ./plplot-test.sh --verbose --interactive --device=$device OVERALL_STATUS_CODE=$? done INDEX_LIST= COUNT=0 if [ "@PLD_xcairo@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c" COMMAND[$COUNT]="./extXdrawable_demo" COUNT=$(( $COUNT + 1 )) fi if [ "@PLD_extcairo@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c" COMMAND[$COUNT]="./ext-cairo-test" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_wxwidgets@" = "ON" -a "@ENABLE_cxx@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c++" COMMAND[$COUNT]="./wxPLplotDemo" COUNT=$(( $COUNT + 1 )) fi if [ "@PLD_extqt@" = "ON" -a "@ENABLE_cxx@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c++" COMMAND[$COUNT]="./qt_example" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_gnome2@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c" COMMAND[$COUNT]="./plplotcanvas_demo" COUNT=$(( $COUNT + 1 )) INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/c" COMMAND[$COUNT]="./plplotcanvas_animation" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_pygcw@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${SRC_EXAMPLES_DIR}/python" COMMAND[$COUNT]="./plplotcanvas_demo.py" COUNT=$(( $COUNT + 1 )) INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${SRC_EXAMPLES_DIR}/python" COMMAND[$COUNT]="./plplotcanvas_animation.py" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_tkX@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk" COMMAND[$COUNT]="./xtk01 -f tk01" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_itkX@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk" COMMAND[$COUNT]="./xtk02 -f tk02" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_tkX@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk" COMMAND[$COUNT]="plserver -f tk03" COUNT=$(( $COUNT + 1 )) fi if [ "@ENABLE_itkX@" = "ON" ] ; then INDEX_LIST="$INDEX_LIST $COUNT" DIRECTORY[$COUNT]="${EXAMPLES_DIR}/tk" COMMAND[$COUNT]="./xtk04 -f tk04" COUNT=$(( $COUNT + 1 )) fi # execute all interactive commands set up by previous stanzas. for index in $INDEX_LIST ; do pushd ${DIRECTORY[$index]} echo "${COMMAND[$index]}" ${COMMAND[$index]} 2> test.error # Look for any status codes (segfaults, plexit) from the examples themselves status_code=$? if [ "$status_code" -ne 0 ] ; then echo "ERROR indicated by status code = $status_code for ${COMMAND[$index]}" OVERALL_STATUS_CODE=$status_code fi cat test.error # Look for any PLPLOT ERROR messages from plwarn that do not result in an exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then echo "ERROR indicated by 'PLPLOT ERROR' in stderr for ${COMMAND[$index]}" OVERALL_STATUS_CODE=1 fi popd done if [ "@ENABLE_tkX@" = "ON" ] ; then cd "${SRC_EXAMPLES_DIR}"/tcl plserver < test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? else "$adadir"/x${index}${lang} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_f95.sh.in 755 1750 1750 535312243237170 177160ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for f95 examples. # # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $f95dir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # To build the f95 examples before running this script do the following: # pushd $f95dir; make; popd lang="f95" export index lang # It is assumed here that fortran has command-line parsing capability. # Do non-standard example 16a because it illustrates plshade functionality # with cmap1 (and also because the result looks nice.) if [ "$verbose_test" ] ; then echo "x16af" fi index="16a" $DEBUG_CMD "$f95dir"/x${index}f -dev $device -o "${OUTPUT_DIR}"/x${index}f95%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi # Do the standard non-interactive examples. for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33; do if [ "$verbose_test" ] ; then echo "x${index}f" fi if [ "${index}" = "14" ] ; then echo "${OUTPUT_DIR}"/x${index}a${lang}%n.$dsuffix | \ $DEBUG_CMD "$f95dir"/x${index}f -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? else $DEBUG_CMD "$f95dir"/x${index}f -dev $device -o "${OUTPUT_DIR}"/x${index}f95%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_single_python.sh 755 1750 1750 236611543675237 216050ustar andrewandrew#!/bin/sh # Run *one* python plplot example non-interactively. # # Copyright (C) 2004 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # usage: # ./test_single_python.sh 01 # n.b. must use two digits to specify any number between 01 and 19, to get # any of the first, through 19th examples. python < test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? else $DEBUG_CMD "$ddir"/x${index}${lang} -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix \ $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt # Look for any status codes (segfaults, plexit) from the examples themselves. status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_tcl.sh.in 755 1750 1750 631612172035565 201020ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for Tcl examples. # # Copyright (C) 2004-2010 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $tcldir, $device, $dsuffix, # $options, and possibly $verbose_test defined. # Put pltcl on the PATH. PATH=@PLTCL_DIR@:$PATH lang="t" cd "${OUTPUT_DIR}" # On Windows systems the sed stanza converts from leading slash form # to drive-letter form. This distinction matters for all prompted # filenames (e.g., example 14) but does not matter for -o options. results="$(pwd |sed 's?^/\(.\)/?\1:/?')" export results cd "$tcldir" if [ "$verbose_test" ] ; then echo "@PLTCL_DIR@/pltcl demo of plot" fi pltcl -dev $device -o "$results"/plot%n.$dsuffix $options < test.error plinit source plot.tcl plot stats.log {1 4} plot stats.log plot r.dat plot plot.dat exit EOF status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi if [ "$verbose_test" ] ; then echo "@PLTCL_DIR@/pltcl demo of plgrid" fi pltcl -dev $device -o "$results"/plgrid%n.$dsuffix $options < test.error plinit source plgrid.tcl plgrid exit EOF status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi for index in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33; do if [ "$verbose_test" ] ; then echo "x${index}" fi if [ "$index" = "14" ] ; then echo "${results}"/x${index}a${lang}%n.$dsuffix | \ @SH_EXECUTABLE@ x${index} -dev $device \ -o "$results"/x${index}${lang}%n.$dsuffix \ $options "" 2> test.error >| "${results}"/x${index}${lang}_${dsuffix}.txt status_code=$? else @SH_EXECUTABLE@ x${index} -dev $device \ -o "$results"/x${index}${lang}%n.$dsuffix \ $options "" 2> test.error >| "${results}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_c_interactive.sh.in 755 1750 1750 364212251723745 221400ustar andrewandrew#!@SH_EXECUTABLE@ # Test subset of c examples for interactive devices. # # Copyright (C) 2004-2009 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $cdir, $device, and possibly # $verbose_test defined. # Use a subset of C examples that tests interactive devices. lang="c" export index lang if [ "$device" = "xcairo" -o "$device" = "qtwidget" ] ; then # Temporarily drop example 17 for xcairo and qtwidget because those drivers are # so horribly slow for such interactive plots. INDEX="01 04 08 14 16 24 30" else INDEX="01 04 08 14 16 17 24 30" fi for index in $INDEX; do if [ "$verbose_test" ] ; then echo "x${index}${lang}" fi $DEBUG_CMD "$cdir"/x${index}${lang} -dev $device -np \ 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${device}.txt # Look for any status codes (segfaults, plexit) from the examples # themselves. status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/plplot_test/test_diff.sh.in 755 1750 1750 741212243237170 202210ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite to compare C examples with other language bindings # # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # ret=0 # Comparison C results have no xsuffix. xsuffix_c= # Compare C results with c++, f95, java, octave, python, tcl, perl, # ada, ocaml, lua and d results for lang in c++ f95 java octave python tcl perl ada adathick ocaml lua d; do # Check which suffix is used for this binding case $lang in c++) xsuffix= suffix=cxx ;; f95) xsuffix= suffix=f95 ;; java) xsuffix= suffix=j ;; octave) xsuffix= suffix=o ;; python) xsuffix= suffix=p ;; tcl) xsuffix= suffix=t ;; perl) xsuffix= suffix=pdl ;; ada) xsuffix= suffix=a ;; adathick) xsuffix=thick suffix=a ;; ocaml) xsuffix= suffix=ocaml ;; lua) xsuffix= suffix=lua ;; d) xsuffix= suffix=d ;; esac missing="" different="" diffstdout="" missingstdout="" # List of standard examples INDEX_LIST="00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 14a 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33" # Check if any examples exist for this language. EXAMPLES_EXIST="no" for index in ${INDEX_LIST} ; do if [ -f x${xsuffix}${index}${suffix}.psc ] ; then EXAMPLES_EXIST="yes" break fi done if [ "$EXAMPLES_EXIST" = "yes" ] ; then for index in ${INDEX_LIST} ; do if [ ! -f x${xsuffix_c}${index}c.psc ] ; then echo "C example ${index} is missing" else if [ ! -f x${xsuffix}${index}${suffix}.psc ] ; then missing="${missing} ${index}" else if [ "@HAVE_CMP_I@" = "ON" ] ; then # Skip first 190 bytes of comparison to ignore date stamp. @CMP_EXECUTABLE@ -s -i 190 x${xsuffix_c}${index}c.psc x${xsuffix}${index}${suffix}.psc if [ $? != 0 ] ; then different="${different} ${index}" fi else # Drop first 8 lines from comparison to ignore date stamp. @TAIL_EXECUTABLE@ -n +9 x${xsuffix_c}${index}c.psc > test1.psc @TAIL_EXECUTABLE@ -n +9 x${xsuffix}${index}${suffix}.psc > test2.psc @DIFF_EXECUTABLE@ -q test1.psc test2.psc 2>&1 > /dev/null if [ $? != 0 ] ; then different="${different} ${index}" fi fi if [ "$index" != "14a" ] ; then if [ -f x${xsuffix}${index}${suffix}_psc.txt ] ; then @DIFF_EXECUTABLE@ -q x${xsuffix_c}${index}c_psc.txt x${xsuffix}${index}${suffix}_psc.txt 2>&1 > /dev/null if [ $? != 0 ] ; then diffstdout="${diffstdout} ${index}" fi else missingstdout="${missingstdout} ${index}" fi fi fi fi done echo "${lang}" echo " Missing examples : ${missing}" echo " Differing postscript output : ${different}" echo " Missing stdout : ${missingstdout}" echo " Differing stdout : ${diffstdout}" if [ "${different}" != "" -o "${diffstdout}" != "" ] ; then ret=1 fi fi done if [ "${ret}" != "0" ] ; then echo "WARNING: Some PostScript or stdout results were different" fi plplot-5.10.0+dfsg/plplot_test/test_octave_interactive.sh.in 755 1750 1750 607412276771565 232130ustar andrewandrew#!@SH_EXECUTABLE@ # Test suite for interactive ("p??") octave examples. # # Copyright (C) 2004-2010 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This is called from plplot-test.sh with $octave, $octavedir, $options, # and $device defined. # The following is only need for the build tree! It should has no effect # when this script is launched from the install tree. lang="o" export lang TOPDIR=`pwd`/.. echo "$TOPDIR" export LD_LIBRARY_PATH="$TOPDIR"/src:"$TOPDIR"/lib/csa:"$TOPDIR"/lib/nn # Launch an Octave script that exercises all the "p" demos. $octave -f -q -p "$octavedir" < test.error # Check verbose_test variable if (strcmp(getenv("verbose_test"),"on") == 1) verbose_test = 1; else verbose_test = 0; endif plplot_stub; t = char(strsplit("$options", "-")); if (t); t(1,:)=""; endif; for i=1:rows(t) tt = deblank (t(i,:)); len = length(tt); ix = index(tt," "); if (ix == 0); ix = len; len = 0; endif plsetopt(tt(1:ix), tt(ix+1:len)); endfor # -dev wxwidgets will work on one at a time, but segfaults # for multiple examples. # -dev xcairo very slow on all of these (the well-known interactive # slowness issue with that device). # 17 - the selection rectangle is not drawn because xcairo does not support xor mode. # The following comments are for -dev qtwidget. # 14 - looks pretty to start but then segfaults on some systems (octave 3.0?); # - with octave 3.2 the animation does not work correctly (as with xwin / tk ) # 17 - the selection rectangle is not drawn because qtwidget does not support xor mode. # -dev wxwidgets had similar issues except possibly for examples 18 # and 19 which seemed fine, but there is no way to tell for sure with # second wxwidgets example (no matter what) always segfaulting. # -dev xwin and -dev tk worked for all examples and Octave-3.0. For # Octave-3.2 the animation for p14 does not work correctly with these devices. # Remove 7, 16, 20 until plshade1 fix is done. # Remove 17 until an additional fix is done. # Remove combined example 21. plsetopt("dev","$device"); for i=[1:20]; if (verbose_test) printf("p%d\n",i); endif #figure(i,"$device",sprintf("${OUTPUT_DIR}/p%d%%n.$dsuffix",i)); figure(i,"$device"); plsetopt("dev","$device"); feval(sprintf("p%d",i)) closefig endfor EOF status_code=$? cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi plplot-5.10.0+dfsg/plplot_test/test_single_tcl.sh 755 1750 1750 217011543675237 210370ustar andrewandrew#!/bin/sh # # Copyright (C) 2004 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # usage: # ./test_single_tcl.sh 01 # n.b. must use two digits to specify any number between 01 and 18, to get # any of the first, through 18th examples. number=$1 shortnumber=$number if test ${number:0:1} == "0"; then shortnumber=${number:1:1}; fi ./pltcl -dev psc -o x$number\t.ps < test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? else @PYTHON_EXECUTABLE@ "$pythondir"/x$index -dev $device -o "${OUTPUT_DIR}"/x${index}${lang}%n.$dsuffix $options 2> test.error >| "${OUTPUT_DIR}"/x${index}${lang}_${dsuffix}.txt status_code=$? fi cat test.error if [ "$status_code" -ne 0 ] ; then exit $status_code fi # Look for any PLPLOT ERROR messages from plwarn that do not result in an # exit code. is_error=`grep -l 'PLPLOT ERROR' test.error` if [ -n "$is_error" ] ; then exit 1 fi done plplot-5.10.0+dfsg/INSTALL 644 1750 1750 1425412260600524 140040ustar andrewandrewPLplot Configuration, Build, and Installation ============================================= The definitive set of instructions is given at http://www.miscdebris.net/plplot_wiki/index.php?title=Building_PLplot. The material below is cut and pasted from there as of 2009-01-10. All PLplot builds are done with our CMake-based build system which gives good results on Unix, Linux, and Mac OS X and Cygwin, MinGW, MinGW/MSYS, and bare windows. Building PLplot with our CMake-based build system ================================================= Our CMake-based build system has been made available as part of our development releases of PLplot starting with version 5.7.0 and is now with the exception of the DJGPP platform our sole build system. It is important to consult the CMake documentation to get the most out of our build system. That documentation is quite thorough but tends to be a bit scattered so we have collected what we think are the best general CMake documentation links for your convenience at http://www.miscdebris.net/plplot_wiki/index.php?title=General_CMake_documentation_links. After consulting that documentation, install the appropriate package of CMake for your system platform. Note, you must use at least version 2.6.0 of CMake for your PLplot configuration, but our build system works with the latest version (2.6.2) of CMake as well. Generic Unix instructions for our build system ============================================== (Optional) set environment variables to help cmake find system components that are installed in non-standard locations ------------------------------------------------------------------------- Here is one particular example (which must be executed before the cmake invocation discussed below). export CMAKE_INCLUDE_PATH=/home/software/autotools/install/include:/home/software/cgmlib/cd1.3 export CMAKE_LIBRARY_PATH=/home/software/autotools/install/lib:/home/software/cgmlib/cd1.3 export PKG_CONFIG_PATH=/home/software/libLASi/install/lib/pkgconfig For this particular example, CMAKE_INCLUDE_PATH helps cmake to find the headers for libltdl and libcd in non-standard install locations; CMAKE_LIBRARY_PATH helps cmake to find the libltdl and libcd libraries in non-standard install locations; and PKG_CONFIG_PATH helps cmake to use the pkg-config command internally to find a libLASi pkg-config module file that is installed in a non-standard location. In general, CMAKE_INCLUDE_PATH helps cmake find headers and other files that are installed in non-standard locations; CMAKE_LIBRARY_PATH helps cmake find libraries that are installed in non-standard locations; and PKG_CONFIG_PATH helps pkg-config (either externally or internally from cmake) find pkg-config modules installed in non-standard locations. Finally, although not used in the specific example above, the colon-separated environment variable PATH helps cmake find executables that are installed in non-standard locations. (Optional) set environment variables to specify the compilers and compiler flags -------------------------------------------------------------------------- Here is one particular example (which must be executed before the cmake invocation discussed below). export CC="gcc -O2" export CXX="g++ -O2" export FC="gfortran -O2" If you don't set the environment variables above, then by default no compiler options (i.e., no optimization and no debugging symbols) are used for gcc-related compilers for our build system which makes for fast builds, but slow execution. CMake invocation ---------------- Here is one typical example. mkdir build_dir cd build_dir cmake -DCMAKE_INSTALL_PREFIX=/my/prefix ../plplot_cmake >& cmake.out (Note: - "build_dir" is the directory where you want to build the libraries. - "/my/prefix" is the directory where you want to install the PLplot libraries for actual use. If you leave the option -DCMAKE_INSTALL_PREFIX= out, a default installation directory will be selected. This actual default directory depends on the operating system you are using. - "plplot_cmake" is the directory where all the source files are contained, most notably the file "CMakeLists.txt", as that is the file that CMake will start its build preparation from. All of these directories can be given any name you like, of course.) (CMake is capable of generating builds within the source tree, but we have emphasized a build with a separate build tree here because of its fundamental advantage that the source tree remains clean with no generated files in it.) Check the cmake.out file for any configuration issues, especially WARNING messages which signal that a component of PLplot has been removed because required system components for that component have not been found. There are a large number of CMake options for PLplot (see http://www.miscdebris.net/plplot_wiki/index.php?title=CMake_options_for_PLplot) which can be set for cmake to personalize your build. Use the ccmake front end to cmake to obtain documentation of all these options. In the above case we have specified a particular install prefix "/my/prefix". Note in the above example an initially empty build directory (arbitrarily) named build_dir is used to insure a clean start, and ../plplot_cmake is the (arbitrary) name of the top-level directory of a freshly checked out source tree from our svn repository. If instead you use a freshly unpacked PLplot source distribution tarball "../plplot_cmake" will need to be replaced by "../plplot-5.9.2" (for our latest release at time of writing). To start a fresh build, simply execute "cd build_dir; rm -rf *" before invoking cmake. Of course, "rm -rf *" is an extremely dangerous command (since it removes everything in the current directory and all subdirectories), but you should be okay so long as you cd to the correct directory before executing the "rm" command. Build and install ----------------- make >& make.out make install >& make_install.out Check make.out and make_install.out for any errors. Follow up by testing PLplot (see http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot and README.testing). Platform-specific remarks about building PLplot =============================================== See http://www.miscdebris.net/plplot_wiki/index.php?title=Specifics_for_various_platforms. plplot-5.10.0+dfsg/git/ 775 1750 1750 012406243570 134405ustar andrewandrewplplot-5.10.0+dfsg/git/case-1/ 775 1750 1750 012406243570 145115ustar andrewandrewplplot-5.10.0+dfsg/git/case-1/pl-make-svn-gateway 755 1750 1750 21011221054422 202450ustar andrewandrew#!/bin/sh git svn --authors-file=svn-authors \ clone https://plplot.svn.sourceforge.net/svnroot/plplot \ -s --prefix=svn/ plplot-5.10.0+dfsg/git/case-1/README 644 1750 1750 1343511221317413 154650ustar andrewandrew---------------------------------------------------------------------------- WARNING: This use-case is *NOT* ready for general use yet. More work-flow testing and documentation is required before this use-case is really ready for the general PLplot developer public. If you're interested, and have the emotional fortitude for some turbulence, feel free to contact me (Geoff) privately and let me know your experiences with this use-case. I'll remove this warning message when I'm a little more satisfied that it's "safe" and behaves in a comprehensible manner, and have documentation here to explain it in a reasonably self-contained manner to non-git folk. At that point, I'll advertise its availability on pldev. ---------------------------------------------------------------------------- One very basic thing one might like to do during svn-to-git transition planning, is to have a git repository which "tracks" the official PLplot svn master repository. This is accomplished using the git svn gateway system. In case 1, we examine a specific, stylized way to do this. 1) Make sure you have the necessary commands on your system. [Somebody fill in comments on the svn client itself] Obtain git. On Fedora 11: yum install git-all [Need guidance for other systems, especially non-Linux systems] Note that in older versions of git (1.5.x and prior), there were many commands with names of the form git-xyz installed. In git 1.6 this practice is dropped. Instead, there is just the git wrapper command, and all git subcommands are activated by passing the sub command as the second token on the command line. With specific reference to the git-svn gateway, in git 1.5.x and prior this was called "git-svn", but in git 1.6.x+, it is invoked as "git svn". Note that in older versions of git, the git program was able to find the scripts (or executables) for its subcommands. So "git svn" worked in both old and new git (if you had the git svn gateway installed). But in git 1.6 and beyond, you have to say "git svn", as "git-svn" is no longer recognized. 2) Obtain the files in this directory (plplot/git/case-1) and place them in your directory structure at the point where you want to create a git PLplot repo which is a gateway to the svn PLplot master repo. For example: % ls -l ~/plplot/t3 total 16 -rwxr-xr-x. 1 furnish xxxxx 136 2009-03-27 07:25 pl-make-svn-gateway -rw-r--r--. 1 furnish xxxxx 1133 2009-03-28 19:51 svn-authors 3) Run the pl-make-svn-gateway script: % ./pl-make-svn-gateway This takes quite a while. Exact times depend on your internet connection bandwidth. But for a good DSL-grade connection in North America, figure on a few hours for this to run. If it errors out for any reason, just run it again and it will pick up where it left off. This happens sometimes, apparently due to network spasms. ALERT: Please be assured that the time to perform the initial setup of this svn gateway git repo is not indicative of the timescales for your normal day-to-day operations with git. Generally speaking, git is /very/ fast compared to other source control systems, for essentially all common operations. The explanation for the long run time of the git-svn import step is that svn does not store all the version relationships that git is looking for in a useable manner, so the git svn clone step has to do a bunch of analysis to discern things that can't be querried directly using the protocol spoken between svn clients and servers. Research topic: It might be interesting to see if there's a way to speed up this step by rsync-ing over the PLplot master repo, and then doing the git svn clone on a local disk, without further use of the network. But note that we would want the resulting git repo to know that it's upstream URL is the master svn repo, not the rsync'd local copy. Seems like it should be feasible, but there's probably a bit of work needed to figure out exactly how to do this correctly. 4) Examine what you got: cd plplot git branch -a [Add more comments about the output from the above, what it means, and why we did it that way.] 5) Make yourself a git working (aka "topic") branch which tracks the svn trunk. git checkout -b w_trunk svn/trunk 6) Edit/commit in the usual git way. 7) Pull in changes from upstream: % git svn fetch % git svn rebase 8) "Push" up the local changes to the svn master repo. % git svn dcommit Then watch for the commit notice to propagate to plplot-cvs. ---------------------------- Working with a repo that has been setup by git svn [Fill this in.] ---------------------------- Issues 1) git svn --authors-file gone stale We know that if you are running the svn import ("git svn clone ..."), with the --authors-file= option, and git svn encounters a commit by someone not listed in the authors-file, then git svn import (clone) balks. Aside: If that happens to you, what you need to do is update the authors-file with the new biographical entry or entries, and then rerun the git svn clone step. It will continue where it left off. There is no need to rm the under-construction repo and start over from the beginning. Question: What if your authors-file is up to date at the time you run the repo import, but then new team members make new commits to the svn master? What happens when you next do a git svn fetch? Answer: Not yet completely clear. Some careful tests are in order. But one thing is clear, git svn fetch is not looking in the authors file, and does not stop the way git svn clone does when there's a mising entry in the authors file. So it would seem then that the git svn fetch is clearly producing a repo that is in some ways different than if you did a fresh clone. To me, this seems quite contrary to the "git way", and is yet another reason to be irked with the whole git svn approach to mirroring an svn repo. plplot-5.10.0+dfsg/git/case-1/svn-authors 644 1750 1750 226511221314425 170000ustar andrewandrew(no author) = Who Knows furnish = Geoffrey Furnish mjl = Maurice LeBrun wdn = Dave Nystrom gray = Mark Gray shouman = Rady Shouman airwin = Alan W. Irwin vincentdarley = Vince Darley mlebrun = Maurice LeBrun rlaboiss = Rafael Laboissiere aroach = Andrew Roach jcard = Joao Cardoso uid25278 = uid25278 dschleef = David Schleef andrewross = Andrew Ross arjenmarkus = Arjen Markus tomduck = Thomas J. Duck hbabcock = Hazen Babcock smekal = Werner Smekal huntd = Doug Hunt jbauck = Jerry Bauck hezekiahcarty = Hezekiah M. Carty plplot-5.10.0+dfsg/git/README 644 1750 1750 54411221054362 143520ustar andrewandrewThis directory contains scripts, documentation, and assorted miscellany intended to aide in the process of transitioning PLplot to git. Subdir Description ------------ -------------------------------------------------------- case-1 Use git-svn to establish a git gateway to the PLplot svn repository. plplot-5.10.0+dfsg/CMakeLists.txt 644 1750 1750 2455112260100733 155110ustar andrewandrew# Top-level CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006-2012 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Recommended way to do user overrides of C-related variables, is given at # http://public.kitware.com/pipermail/cmake/2006-July/010334.html. # See also, CMakeCInformation.cmake. There are also C++, and Fortran-specific # overrides that can be done. However, I prefer putting overrides in just # one file so I use the overall variable CMAKE_USER_MAKE_RULES_OVERRIDE # instead. set( CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_SOURCE_DIR}/cmake/UserOverride.cmake ) cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) # cmake-2.8.12.1 (2.8.12 screwed up the implementation) introduced a # corrected implementation of keyword signatures for # target_link_libraries which are preferred now over the traditional # plain signatures. There are a lot of implications concerning these # preferred keyword signatures which I don't understand at the moment, # but it is clear some modifications to our build system will be # required to start using keyword signatures appropriately. But it is # also clear we can do nothing about this until we can guarantee that # all our users are running 2.8.12.1 or higher. Therefore, until we # bump the actual minimum version to 2.8.12.1 in the above # cmake_minimum_required call and deal with all the errors in our # CMake code that will generate, quiet the warnings about this issue # by explicitly setting policies CMP0022 and CMP0023 (if they exist # for whatever CMake version the user is running) to OLD. if(POLICY CMP0022) message(STATUS "Explicitly setting policy CMP0022 to OLD") cmake_policy(SET CMP0022 OLD) endif(POLICY CMP0022) if(POLICY CMP0023) message(STATUS "Explicitly setting policy CMP0023 to OLD") cmake_policy(SET CMP0023 OLD) endif(POLICY CMP0023) # It is a fatal error if no working C compiler is available to build # the PLplot core C library and core C examples. All other compilers # required by our bindings are optional in that if no working compiler # of the kind needed is available, the associated bindings and # examples are disabled. project(plplot C) message(STATUS "CMake version = ${CMAKE_VERSION}") message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") # Set unambiguous names for these variables as a reminder. set(WIN32_AND_NOT_CYGWIN ${WIN32}) if(WIN32 OR CYGWIN) set(WIN32_OR_CYGWIN ON) else(WIN32 OR CYGWIN) set(WIN32_OR_CYGWIN OFF) endif(WIN32 OR CYGWIN) #foreach(policy RANGE 0 9) # cmake_policy(GET CMP000${policy} policy_result) # message(STATUS "Policy CMP000${policy} is ${policy_result}") #endforeach(policy RANGE 0 9) set(PACKAGE plplot) # Locations where PLplot cmake build system first looks for cmake modules. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake-2.8 ) # We need the path to the MinGW/Borland compiler in order to find # the import libraries for system libraries. if(MINGW) get_filename_component(MINGWBINPATH ${CMAKE_C_COMPILER} PATH) set(MINGWLIBPATH ${MINGWBINPATH}/../lib CACHE FILEPATH DOCSTRING "Path to MinGW import libraries") endif(MINGW) if(BORLAND) get_filename_component(BORLANDBINPATH ${CMAKE_C_COMPILER} PATH) set(BORLANDLIBPATH ${BORLANDBINPATH}/../Lib/PSDK CACHE FILEPATH DOCSTRING "Path to Borland import libraries") endif(BORLAND) # Version data that need modification for each release. include(plplot_version) # parameters to control overall cmake behaviour. # Configure PLplot component variables.... include(plplot) # Use configured variables to process configurable top-level files. # This CMake-configured template file is processed further by sed for # abi-compliance-checker. configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/abi-compliance-checker.xml.template.in ${CMAKE_CURRENT_BINARY_DIR}/abi-compliance-checker.xml.template @ONLY ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plplot_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/plplot_config.h ) # Allow access to the generated plplot_config.h for this build. add_definitions("-DHAVE_CONFIG_H") # Install top-level files # Enable testing framework for examples if(BUILD_TEST) include(CTest) endif(BUILD_TEST) # Disable warnings about deprecated functions (Visual C++ 2005) if(MSVC_VERSION GREATER 1399) add_definitions("/D_CRT_SECURE_NO_DEPRECATE") endif(MSVC_VERSION GREATER 1399) # Borland Compiler must compile in ANSII mode if(BORLAND) add_definitions(-A) endif(BORLAND) set(top_level_DOCFILES ABOUT AUTHORS COPYING.LIB ChangeLog.release Copyright FAQ NEWS PROBLEMS README README.release README.testing ) install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR}) if(BUILD_SHARED_LIBS AND WIN32_OR_CYGWIN) # For platforms (currently WIN32 or Cygwin, although the Cygwin version # of CMake may support this in future since -rpath apparently does work # on that platform) where CMake does not use -rpath, use a workaround # where all dll's are collected in the dll subdirectory of the build tree. set(USE_DLL_SUBDIRECTORY ON) else(BUILD_SHARED_LIBS AND WIN32_OR_CYGWIN) set(USE_DLL_SUBDIRECTORY OFF) endif(BUILD_SHARED_LIBS AND WIN32_OR_CYGWIN) # in windows all created dlls are gathered in the dll directory # if you add this directory to your PATH all shared libraries are available if(USE_DLL_SUBDIRECTORY) set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll) endif(USE_DLL_SUBDIRECTORY) # Process other directories including using configured variables to # process configurable files in those directories. # N.B. Order is important here at the cmake stage because targets must # be processed by cmake in a specific order e.g., due to get_target_property # invocations. Note, this order has nothing to do with the order which make # processes these subdirectories at build time. That build-time order # is determined by the dependencies between targets and also by file # dependencies that are established by the cmake configuration files. add_subdirectory(fonts) add_subdirectory(lib) add_subdirectory(include) add_subdirectory(src) add_subdirectory(data) add_subdirectory(bindings) add_subdirectory(drivers) add_subdirectory(utils) add_subdirectory(examples) add_subdirectory(plplot_test) add_subdirectory(scripts) add_subdirectory(doc) add_subdirectory(www) add_subdirectory(pkgcfg) summary() if(PREBUILD_DIST) # Pre-build everything required for a distribution tarball and copy it to # the source tree (if build tree is different from source tree). # List of targets that must be (pre-)built. set(DIST_TARGETS) if(ENABLE_octave) list(APPEND DIST_TARGETS make_documentation) endif(ENABLE_octave) if(BUILD_PRINT) list(APPEND DIST_TARGETS print) endif(BUILD_PRINT) if(BUILD_INFO) list(APPEND DIST_TARGETS info) endif(BUILD_INFO) if(BUILD_MAN) list(APPEND DIST_TARGETS man) endif(BUILD_MAN) if(BUILD_HTML) list(APPEND DIST_TARGETS html) endif(BUILD_HTML) if(BUILD_DOX_DOC) list(APPEND DIST_TARGETS build_doxygen) endif(BUILD_DOX_DOC) if(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") add_custom_target(prebuild_dist) else(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") # copy prebuilds back to source tree. # N.B. copy_directory quietly creates an empty directory with no # error condition if the source directory does not exist. add_custom_target( prebuild_dist COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bindings/octave/plplot_octave_txt ${CMAKE_SOURCE_DIR}/bindings/octave/plplot_octave_txt COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/doc/doxygen COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/doc/doxygen ${CMAKE_SOURCE_DIR}/doc/doxygen COMMAND cp `cat static_built_files ${INFO_MANIFEST} ${MAN_MANIFEST} ${HTML_MANIFEST}` ${CMAKE_SOURCE_DIR}/doc/docbook/src WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc/docbook/src ) endif(CMAKE_BINARY_DIR STREQUAL "${CMAKE_SOURCE_DIR}") add_dependencies(prebuild_dist ${DIST_TARGETS}) endif(PREBUILD_DIST) # # Packing stuff # set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Scientific Plotting Library PLplot") set(CPACK_PACKAGE_VENDOR "PLplot development team") set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README) set(CPACK_SET_DESTDIR ON) if(WIN32_AND_NOT_CYGWIN) set(CPACK_GENERATOR ZIP) else(WIN32_AND_NOT_CYGWIN) set(CPACK_GENERATOR TGZ) endif(WIN32_AND_NOT_CYGWIN) set( CPACK_SOURCE_PACKAGE_FILE_NAME "plplot-${PLPLOT_VERSION}" CACHE INTERNAL "tarball basename" ) set(CPACK_SOURCE_GENERATOR TGZ) # The following components are regex's to match anywhere (unless anchored) # in absolute path + filename to find files or directories to be excluded # from source tarball. set(CPACK_SOURCE_IGNORE_FILES "\\\\#*\\\\#$" "~$" "\\\\.cvsignore$" "^${PROJECT_SOURCE_DIR}.*/\\\\.svn/" "^${PROJECT_SOURCE_DIR}/old/" "^${PROJECT_SOURCE_DIR}/sys/mac" "^${PROJECT_SOURCE_DIR}/sys/os2" "^${PROJECT_SOURCE_DIR}/sys/unix" "^${PROJECT_SOURCE_DIR}/sys/dos/msc" "^${PROJECT_SOURCE_DIR}/sys/dos/bcc" "^${PROJECT_SOURCE_DIR}/sys/dos/emx" "^${PROJECT_SOURCE_DIR}/sys/win-tk" "^${PROJECT_SOURCE_DIR}/sys/win32" "^${PROJECT_SOURCE_DIR}/debian" ) #message("CPACK_SOURCE_IGNORE_FILES = ${CPACK_SOURCE_IGNORE_FILES}") include(CPack) # Path to native build for executables required in the build process. # This is only required for cross compiling if(CMAKE_CROSSCOMPILING) set(CMAKE_NATIVE_BINARY_DIR NATIVEDIR-NOTFOUND CACHE FILEPATH "Point to the native build directory") endif(CMAKE_CROSSCOMPILING) plplot-5.10.0+dfsg/plplot_config.h.in 644 1750 1750 2442612264656416 164110ustar andrewandrew// Configured (by CMake) macros for PLplot that are required for the // core build but _not_ required for the build of the installed // examples (and presumably any user applications). Therefore, the // configured plplot_config.h should not be installed. In contrast, // include/plConfig.h.in (note, the configured plConfig.h result // #includes plplot_config.h for the core build because HAVE_CONFIG_H // is #defined in that case) contains configured macros that are // required for the core build, installed examples build, and build of // user applications. Therefore, in contrast to plplot_config.h, // plConfig.h should be installed. // // Maintenance issue: in makes no sense to configure duplicate macros // for both plplot_config.h and plConfig.h. Therefore, when adding a macro // decide which file to put it in depending on whether the result is // needed for the installed examples build or not. Furthermore, move // configured macros from one file to the other as needed depending on // that criterion, but do not copy them. // // Location of executables #define BIN_DIR "@BIN_DIR@" // Location of Build tree #define BUILD_DIR "@BUILD_DIR@" // Location of package data files #define DATA_DIR "@DATA_DIR@" // Location of dynamically loaded drivers #define DRV_DIR "@DRV_DIR@" // Name of the default cmap0 palette to use #define PL_DEFAULT_CMAP0_FILE "@DEFAULT_CMAP0_FILE@" // Name of the default cmap1 palette to use #define PL_DEFAULT_CMAP1_FILE "@DEFAULT_CMAP1_FILE@" // Define if support for deprecated plplot functions should be compiled #cmakedefine PL_DEPRECATED // Define if there is support for dynamically loaded drivers #cmakedefine ENABLE_DYNDRIVERS // Define to 1 if you have the header file. #cmakedefine HAVE_CMATH 1 // Define to 1 if you have the header file, and it defines `DIR'. // #cmakedefine HAVE_DIRENT_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_DLFCN_H 1 // Define if [freetype] is available #cmakedefine PL_HAVE_FREETYPE // Define if [shapelib] is available #cmakedefine HAVE_SHAPELIB // Define if [agg] is available #cmakedefine HAVE_AGG // Define to 1 if you have the header file. #cmakedefine HAVE_GLIB_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_GLIB_OBJECT_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_GTK_GTK_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_INTTYPES_H 1 // Define if [incr], [Tcl] is available #cmakedefine HAVE_ITCL // Define to 1 if you have the header file. #cmakedefine HAVE_ITCLDECLS_H 1 // Define if Tk is enabled and X11 has been found. #cmakedefine ENABLE_tkX // Define if [incr], [Tk] is available #cmakedefine HAVE_ITK // Define to 1 if you have the header file. #cmakedefine HAVE_JNI_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_LIBART_LGPL_LIBART_H 1 // Define to 1 if you have the header file. // #cmakedefine HAVE_LIBGNOMECANVAS_LIBGNOMECANVAS_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_LIBGNOMEPRINT_GNOME_PRINT_H 1 // Define if libunicode is available #cmakedefine HAVE_LIBUNICODE // Define to 1 if you have the header file. #cmakedefine HAVE_MATH_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_MEMORY_H 1 // Define to 1 if the function mkstemp is available. #cmakedefine PL_HAVE_MKSTEMP 1 // Define to 1 if the function mkdtemp is available. #cmakedefine PL_HAVE_MKDTEMP 1 // Define to 1 if the function mkfifo is available. #cmakedefine PL_HAVE_MKFIFO 1 // Define to 1 if you have the header file, and it defines `DIR'. #cmakedefine HAVE_NDIR_H 1 // Define if libpango is available #cmakedefine HAVE_PANGO // Define if popen is available #cmakedefine HAVE_POPEN // Define if _NSGetArgc is available #cmakedefine HAVE_NSGETARGC // Define if pthreads is available #cmakedefine PL_HAVE_PTHREAD // Define if Qhull is available #cmakedefine PL_HAVE_QHULL // Define to 1 if you have the header file. #cmakedefine HAVE_STDLIB_H 1 // Define to 1 if you have the header file, and it defines `DIR'. // #cmakedefine HAVE_SYS_DIR_H 1 // Define to 1 if you have the header file, and it defines `DIR'. // #cmakedefine HAVE_SYS_NDIR_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_SYS_STAT_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_SYS_TYPES_H 1 // Define to 1 if you have that is POSIX.1 compatible. #cmakedefine HAVE_SYS_WAIT_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_TERMIOS_H 1 // Define to 1 if you have the header file. #cmakedefine HAVE_CRT_EXTERNS_H 1 // Define to 1 if the function unlink is available #cmakedefine PL_HAVE_UNLINK 1 // Define to 1 if you have the `vfork' function. #cmakedefine HAVE_VFORK 1 // Define to 1 if you have the header file. #cmakedefine HAVE_VFORK_H 1 // Include sys/type.h if needed #cmakedefine NEED_SYS_TYPE_H // Name of package #define PACKAGE "@PACKAGE@" // Define if the win32 ltdl implementation should be used #cmakedefine LTDL_WIN32 // Portable definition for PTHREAD_MUTEX_RECURSIVE #define PLPLOT_MUTEX_RECURSIVE @PLPLOT_MUTEX_RECURSIVE@ // Directory containing fonts that are accessible from freetype #define PL_FREETYPE_FONT_DIR "@PL_FREETYPE_FONT_DIR@" // MONO font accessible from freetype #define PL_FREETYPE_MONO "@PL_FREETYPE_MONO@" // MONO_BOLD font accessible from freetype #define PL_FREETYPE_MONO_BOLD "@PL_FREETYPE_MONO_BOLD@" // MONO_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_MONO_BOLD_ITALIC "@PL_FREETYPE_MONO_BOLD_ITALIC@" // MONO_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_MONO_BOLD_OBLIQUE "@PL_FREETYPE_MONO_BOLD_OBLIQUE@" // MONO_ITALIC font accessible from freetype #define PL_FREETYPE_MONO_ITALIC "@PL_FREETYPE_MONO_ITALIC@" // MONO_OBLIQUE font accessible from freetype #define PL_FREETYPE_MONO_OBLIQUE "@PL_FREETYPE_MONO_OBLIQUE@" // SANS font accessible from freetype #define PL_FREETYPE_SANS "@PL_FREETYPE_SANS@" // SANS_BOLD font accessible from freetype #define PL_FREETYPE_SANS_BOLD "@PL_FREETYPE_SANS_BOLD@" // SANS_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SANS_BOLD_ITALIC "@PL_FREETYPE_SANS_BOLD_ITALIC@" // SANS_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SANS_BOLD_OBLIQUE "@PL_FREETYPE_SANS_BOLD_OBLIQUE@" // SANS_ITALIC font accessible from freetype #define PL_FREETYPE_SANS_ITALIC "@PL_FREETYPE_SANS_ITALIC@" // SANS_OBLIQUE font accessible from freetype #define PL_FREETYPE_SANS_OBLIQUE "@PL_FREETYPE_SANS_OBLIQUE@" // SCRIPT font accessible from freetype #define PL_FREETYPE_SCRIPT "@PL_FREETYPE_SCRIPT@" // SCRIPT_BOLD font accessible from freetype #define PL_FREETYPE_SCRIPT_BOLD "@PL_FREETYPE_SCRIPT_BOLD@" // SCRIPT_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SCRIPT_BOLD_ITALIC "@PL_FREETYPE_SCRIPT_BOLD_ITALIC@" // SCRIPT_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SCRIPT_BOLD_OBLIQUE "@PL_FREETYPE_SCRIPT_BOLD_OBLIQUE@" // SCRIPT_ITALIC font accessible from freetype #define PL_FREETYPE_SCRIPT_ITALIC "@PL_FREETYPE_SCRIPT_ITALIC@" // SCRIPT_OBLIQUE font accessible from freetype #define PL_FREETYPE_SCRIPT_OBLIQUE "@PL_FREETYPE_SCRIPT_OBLIQUE@" // SERIF font accessible from freetype #define PL_FREETYPE_SERIF "@PL_FREETYPE_SERIF@" // SERIF_BOLD font accessible from freetype #define PL_FREETYPE_SERIF_BOLD "@PL_FREETYPE_SERIF_BOLD@" // SERIF_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SERIF_BOLD_ITALIC "@PL_FREETYPE_SERIF_BOLD_ITALIC@" // SERIF_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SERIF_BOLD_OBLIQUE "@PL_FREETYPE_SERIF_BOLD_OBLIQUE@" // SERIF_ITALIC font accessible from freetype #define PL_FREETYPE_SERIF_ITALIC "@PL_FREETYPE_SERIF_ITALIC@" // SERIF_OBLIQUE font accessible from freetype #define PL_FREETYPE_SERIF_OBLIQUE "@PL_FREETYPE_SERIF_OBLIQUE@" // Symbol font accessible from freetype #define PL_FREETYPE_SYMBOL "@PL_FREETYPE_SYMBOL@" // SYMBOL_BOLD font accessible from freetype #define PL_FREETYPE_SYMBOL_BOLD "@PL_FREETYPE_SYMBOL_BOLD@" // SYMBOL_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SYMBOL_BOLD_ITALIC "@PL_FREETYPE_SYMBOL_BOLD_ITALIC@" // SYMBOL_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SYMBOL_BOLD_OBLIQUE "@PL_FREETYPE_SYMBOL_BOLD_OBLIQUE@" // SYMBOL_ITALIC font accessible from freetype #define PL_FREETYPE_SYMBOL_ITALIC "@PL_FREETYPE_SYMBOL_ITALIC@" // SYMBOL_OBLIQUE font accessible from freetype #define PL_FREETYPE_SYMBOL_OBLIQUE "@PL_FREETYPE_SYMBOL_OBLIQUE@" // Define as the return type of signal handlers (`int' or `void'). #define RETSIGTYPE @RETSIGTYPE@ // Location of Source tree #define SOURCE_DIR "@SOURCE_DIR@" // Define to 1 if you have the ANSI C header files. #cmakedefine STDC_HEADERS 1 // Overall PLplot version number #define PLPLOT_VERSION "@PLPLOT_VERSION@" // Location of Tcl stuff #define TCL_DIR "@TCL_DIR@" // Consistent package versions for Itcl and friends found by PLplot // If PLplot could not find consistent values these are set to 0.0.0 #define PLPLOT_ITCL_VERSION "@PLPLOT_ITCL_VERSION@" #define PLPLOT_ITK_VERSION "@PLPLOT_ITK_VERSION@" #define PLPLOT_IWIDGETS_VERSION "@PLPLOT_IWIDGETS_VERSION@" // Define if csa is desired #cmakedefine WITH_CSA // Define if want to use general fill_intersection_polygon approach // rather than the traditional code to fill the intersection of a polygon with // the clipping limits. #cmakedefine USE_FILL_INTERSECTION_POLYGON // Define to `char *' if does not define. #cmakedefine caddr_t // Define to `int' if does not define. #cmakedefine pid_t // Define as `fork' if `vfork' does not work. #cmakedefine vfork plplot-5.10.0+dfsg/abi-compliance-checker.xml.template.in 644 1750 1750 134412240276136 221430ustar andrewandrew${PLPLOT_VERSION} ${PREFIX}/include/plplot ${PREFIX}/lib @TCL_INCLUDE_PATH@ @TK_INCLUDE_PATH@ @QT_INCLUDES@ plplotP.h qt.h gcw.h plplotcanvas.h wxPLplotstream.h wxPLplotwindow.h plplot-5.10.0+dfsg/OLD-README.release 644 1750 1750 240535012255663635 157510ustar andrewandrewPLplot Release 5.9.11 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file or on our bug tracker, then please send bug reports to PLplot developers via the mailing lists at (preferred for initial discussion of issues) and, if no quick resolution is possible, on our bug tracker at . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. INDEX 1. OFFICIAL NOTICES FOR USERS SINCE 5.9.10 (the previous development release) 2. Tests made for release 5.9.11 3. Changes relative to PLplot 5.9.10 (the previous development release) 3.1 NUMERIC_INCLUDE_PATH ==> NUMPY_INCLUDE_PATH 3.2 Major overhaul of the build system and bindings for Tcl and friends 3.3 Substantial overhaul of the build system for the Qt-components of PLplot 3.4 The epa_build project has been implemented 4. OFFICIAL NOTICES FOR USERS SINCE 5.8.0 (the previous stable release) 5. Changes relative to PLplot 5.8.0 (the previous stable release) 5.1 All autotools-related files have now been removed 5.2 Build system bug fixes 5.3 Build system improvements 5.4 Implement build-system infrastructure for installed Ada bindings and examples 5.5 Code cleanup 5.6 Date / time labels for axes 5.7 Alpha value support 5.8 New PLplot functions 5.9 External libLASi library improvements affecting our psttf device 5.10 Improvements to the cairo driver family 5.11 wxWidgets driver improvements 5.12 pdf driver improvements 5.13 svg driver improvements 5.14 Ada language support 5.15 OCaml language support 5.16 Perl/PDL language support 5.17 Update to various language bindings 5.18 Update to various examples 5.19 Extension of our test framework 5.20 Rename test subdirectory to plplot_test 5.21 Website support files updated 5.22 Internal changes to function visibility 5.23 Dynamic driver support in Windows 5.24 Documentation updates 5.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 5.26 get-drv-info now changed to test-drv-info 5.27 Text clipping now enabled by default for the cairo devices 5.28 A powerful qt device driver has been implemented 5.29 The PLplot API is now accessible from Qt GUI applications 5.30 NaN / Inf support for some PLplot functions 5.31 Various bug fixes 5.32 Cairo driver improvements 5.33 PyQt changes 5.34 Color Palettes 5.35 Re-implementation of a "soft landing" when a bad/missing compiler is detected 5.36 Make PLplot aware of LC_NUMERIC locale 5.37 Linear gradients have been implemented 5.38 Cairo Windows driver implemented 5.39 Custom axis labelling implemented 5.40 Universal coordinate transform implemented 5.41 Support for arbitrary storage of 2D user data 5.42 Font improvements 5.42 Alpha value support for plotting in memory. 5.43 Add a Qt device for in memory plotting. 5.44 Add discrete legend capability. 5.45 Add full bindings and examples for the D language. 5.46 The plstring and plstring3 functions have been added 5.47 The pllegend API has been finalized 5.48 Octave bindings now implemented with swig 5.49 Documentation redone for our swig-generated Python and Octave bindings 5.50 Support large polygons 5.51 Complete set of PLplot parameters now available for Fortran 5.52 The plarc function has been added 5.53 The format for map data used by plmap has changed 5.54 Python support for Numeric has been dropped 5.55 Backwards-incompatible API change to non-integer line widths 5.56 Improvements to the build system for the Cygwin case 5.57 The plcolorbar API has been finalized 5.58 Documentation of the new legend and color bar capabilities of PLplot 5.59 The D bindings and examples have been converted from the old version of D (D1) to the new version of D (D2) 5.60 The DocBook documentation for PLplot is now generated using modern XML/XSL backend tools for DocBook 5.61 Implement experimental build_projects sub-project 5.62 Implement extremely simple "00" example 5.63 Convert to using the Allura form of SourceForge software 5.64 Use NON_TRANSITIVE linking by default for the shared libraries case for all non-windows systems 5.65 Update f95 examples to take larger advantage of Fortran 95 capabilities 5.66 Substantial additions to the doxygen documentation 5.67 NUMERIC_INCLUDE_PATH ==> NUMPY_INCLUDE_PATH 5.68 Major overhaul of the build system and bindings for Tcl and friends 5.69 Substantial overhaul of the build system for the Qt-components of PLplot 5.70 The epa_build project has been implemented 1. OFFICIAL NOTICES FOR USERS SINCE 5.9.10 (the previous development release) (5.9.11) Backwards-incompatible API change. The numerical symbolic constants that are #defined as macros in plplot.h have been repropagated to the Python, Java, Lua, Octave, Fortran 95, and Tcl language bindings using scripts. Previously, this propagation was done by hand in a piece-meal manner so use of the scripts has created a number of changes in the PLplot symbolic constants for these languages. These changes are the addition of 25 symbolic constants that were previously only available for C, no deletions of symbolic constants, no changes to numerical values, but the following backwards-incompatible name changes: PLESC_PLFLTBUFFERING ==> PLESC_DOUBLEBUFFERING PLESPLFLTBUFFERING_DISABLE ==> PLESC_DOUBLEBUFFERING_ENABLE PLESPLFLTBUFFERING_ENABLE ==> PLESC_DOUBLEBUFFERING_ENABLE PLESPLFLTBUFFERING_QUERY ==> PLESC_DOUBLEBUFFERING_QUERY So those users who were using the symbolic constants on the left for the above languages will have to change their source code or scripts to use the constants on the right. No changes in source code or scripts should be required of other users. (5.9.11) Backwards-incompatible API change. The PLplot build system and bindings for Tcl and friends have had a major overhaul, see below. Part of this change was to split the former libplplottcltk into two components. The new libplplottcltk is now a pure Tcl/Tk extension that can be linked to the stub versions of the Tcl/Tk libraries and dynamically loaded from a tclsh or wish environment using the appropriate "package require" command. The new libplplottcltk_Main library contains code (e.g., pltclMain and pltkMain) required by C plotting applications (e.g., pltcl, plrender, and xtk0[124].c) that link to libplplottcltk. (5.9.11) Backwards-incompatible change. Our Fortran 77 bindings and examples have been completely removed because Fortran 95 is just a much better language which we have been supporting for a long time, and our judgement call based on user feedback we have received is nobody is interested in plotting using strict Fortran 77 language constructs any more. However, if there is still some Fortran 77 source code out there that uses PLplot, typically the only change you should have to do to port it to our Fortran 95 bindings is to place the command "use plplot" as the first line of the source code of the main routine. (5.9.11) Deprecation. The functionality of the AGG backend and FreeType option in the wxwidgets device driver is provided (and in some cases exceeded) by other backends and options that we have implemented for this device driver. The AGG backend and Freetype option are therefore deprecated with the intention to remove them in a future release. 2. Tests made for release 5.9.11 Note that "comprehensive tests" below refers to running scripts/comprehensive_test.sh in default mode (i.e., not dropping any tests). For each of our three major configurations (shared libraries/dynamic devices, shared libraries/nondynamic devices, and static libraries/nondynamic devices) this test script runs ctest in the build tree and runs the test_noninteractive and test_interactive targets in the build tree, the installed examples tree configured with a CMake-based build system for the examples, and an installed examples tree configured with our traditional (Make + pkg-config) build system for the examples. Note that all tests mentioned below were successful ones unless noted differently. * Alan W. Irwin ran comprehensive tests for a complete system build environment on 64-bit Debian Wheezy Linux for AMD-64 hardware. * Alan W. Irwin ran comprehensive testsfor a limited (qt, cairo, wxwidgets, and octave PLplot components were dropped) epa_build environment on 64-bit Debian Wheezy Linux for AMD-64 hardware. * Alan W. Irwin ran comprehensive tests for an almost complete epa_build environment (only the wxwidgets and octave components of PLplot were dropped) on 64-bit Debian Wheezy Linux for AMD-64 hardware. * Alan W. Irwin ran fairly comprehensive tests (i.e, for the shared library/dynamic devices case run ctest and also the test_noninteractive and test_interactive targets in the build tree) for a quite limited (qt, cairo, wxwidgets, octave, Tcl/Tk, and Java PLplot components were dropped) epa_build environment for 32-bit MinGW/MSYS/Wine for AMD-64 hardware. The Wine version was a release candidate for Wine-1.6 that was built on Debian Wheezy Linux, the compiler was gcc-4.7.2, the CMake generator was "MSYS Makefiles", and the build command was "make" (i.e., the MSYS version, not the MinGW version). An attempt was made to extend this successful test result to the installed examples built with the CMake-based build system, but for that case the Ada examples all failed at run time with a return code of 3 so no further attempt was made to widen the scope of these MinGW/MSYS/Wine tests. * Andrew Ross ran fairly comprehensive tests (i.e., for the shared library/dynamic devices case use the test_noninteractive and test_interactive targets in the build tree) for a complete system build environment on 64-bit Debian unstable Linux for AMD-64 hardware. * Andrew Ross ran comprehensive tests for a complete system build environment on 64-bit Ubuntu Saucy (13.10) Linux for AMD-64 hardware. The only issue was a segmentation fault on the c++ qt_example for the nondynamic devices case only. This is reproducible on this system, but not on other Linux platforms so may be specific to the Ubuntu version of the Qt libraries. This is unlikely to affect most users since the default is to use dynamically loaded devices. * Andrew Ross ran limited tests with a limited number of nondynamic devices (mem, null, psc, svg, xfig, xwin) and limited language bindings (C / C++ / F95) for a CentOS 5.10 system with AMD64 hardware. The build passed "make test_diff psc". The java version was too old and java support had to be disabled. Ada support had to be disabled due to a bug (now fixed). Cairo support also had to be disabled due to too old a version of the library being installed. * Andrew Ross ran limited tests for an epa_build environment on CentOS 5.10. The buildtools and plplot_lite targets were built (with nondynamic devices), again after disabling java, ada and cairo support. This build added support for tcl / tk bindings and the pdf and tk based devices. The build passed make test_noninteractive in the install tree, but failed make test_interactive due to missing rpath information for the itcl and itk libraries. This bug can be worked around by setting LD_LIBRARY_PATH to point to the libraries, in which case the interactive test works fine. * Arjen Markus ran a fairly comprehensive test (i.e., for the shared library/dynamic devices case use the test_noninteractive target) for a incomplete system build environment (the Ada, D, itcl/itk, Lua, ocaml, octave, Java, and wxwidgets components of PLplot were dropped) on 64-bit Cygwin with gcc-4.8.2. That platform was installed on top of 64-bit Windows 7, service pack 1 for AMD-64 hardware. Java and wxwidgets were dropped because of build errors for those on Cygwin that have not been resolved yet. The remaining components were dropped due to lack of time to investigate them so far. There was close to complete success with the qt and cairo (aside from wincairo) device drivers which is an excellent Windows result since those device drivers add a lot of important capability to PLplot. * Arjen Markus ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the shared libraries/dynamic devices case for a limited build environment (the qt, cairo, wxwidgets, pdf and the components mentioned above of PLplot were dropped except for Java which was included in this test) on 32-bit MinGW. That platform was installed on top of 64-bit Windows 7, service pack 1 for AMD-64 hardware. The compiler was gcc-4.7.0, the CMake generator was "MinGW Makefiles", and the build command was mingw32-make. * Arjen Markus ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the shared libraries/dynamic devices case for a limited build environment (the same limitations as for his MinGW tests above) for MSVC/C++ 2010 and Intel Fortran 2011 compilers on 64-bit Windows 7, service pack 1 for AMD-64 hardware. In general, the CMake generator "NMake Makefiles" and the corresponding build command "nmake" worked well for this platform. The attempted use of Visual Studio generators combined with the Visual Studio 2010 IDE available on that platform was more problematic. * Phil Rosenberg ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the static libraries/nondynamic devices case for a limited build environment (virtually all PLplot components dropped other than C, C++ and wxwidgets 2.8) for the Visual Studio 2008 IDE (with associated MSVC compiler) on 32-bit Windows 7 for AMD-64 hardware. The "Visual Studio 9 2008" generator yielded good results. * Phil Rosenberg ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the static libraries/nondynamic devices case for a limited build environment (virtually all PLplot components dropped other than C, CXX, and wxwidgets 3.0) for the Visual Studio 2012 IDE (with associated MSVC compiler) on Windows 8 for AMD-64 hardware. Both x86 and x64 builds were tested. The combination of "NMake Makefiles" generator and MSVC compiler yielded good build results if CMake patches (available at http://www.cmake.org/Bug/view.php?id=14587 and http://www.cmake.org/Bug/view.php?id=14642) to allow use of wxwidgets-3.0 were applied. With those patches some run-time problems with the use of Plplot's wxWidgetsApp with wxWidgets 3.0 were observed in the examples, however plots embedded in wxWidgets apps seem to work fine. The "Visual Studio 11" and "Visual Studio 11 Win64" generators had some additional issues which could be worked around but which nevertheless indicated there are some CMake bugs for those generators that need to be addressed. * Jerry Bauck ran build tests of PLplot for the C core library, the Ada, C++, Java, Lua, and Python bindings, and a fairly complete list of device drivers (including qt and cairo) for PLplot on Mac OS X Mountain Lion for AMD64 hardware. Extremely narrow run-time tests of the Ada examples were a success, but all the standard testing scripts failed because for unknown reasons the lena.pgm file that is used in conjunction with our standard example 20 was not properly copied by our build and test system from the source tree to the correct locations in the build tree. * Felipe Gonzalez ran build tests of PLplot for the C core library and the C++, Fortran 95, and OCaml-4.01.0 bindings on Mac OS X Mountain Lion. The report from Felipe stated the compiler suite used was probably from MacPorts, and did not state anything about the hardware type. 3. Changes relative to PLplot 5.9.10 (the previous development release) 3.1 NUMERIC_INCLUDE_PATH ==> NUMPY_INCLUDE_PATH We have long since dropped support for the Numeric Python module and are now exclusively using the numpy Python modules instead. Therefore, we have changed the CMake variable name used in our build system that holds the location of the numpy headers from the confusing misnomer, NUMERIC_INCLUDE_PATH, to NUMPY_INCLUDE_PATH. This change only impacts PLplot users who in the past have used the cmake option -DNUMERIC_INCLUDE_PATH to set the CMake variable NUMERIC_INCLUDE_PATH to the location of the numpy header directory. Note we discourage that method since without that user intervention, the build system uses python and numpy to find the location which should normally be foolproof and not subject to the inconsistencies or errors possible with setting the variable. But if some users still insist on setting the variable, that variable's name should now be NUMPY_INCLUDE_PATH. 3.2 Major overhaul of the build system and bindings for Tcl and friends After years of neglect we have worked very hard in the release cycle leading up to the release of 5.9.11 on our build system and code interfacing Tcl and friends (Tk, Itcl, Itk, and Iwidgets) with PLplot. The build system now does a much better job of finding a consistent set of components for Tcl and friends. For example, switching from the system version of those components to a special build of those components is typically a matter of simply putting tclsh from the special build first on the PATH. And after the components of Tcl and friends are found, the build system does extensive checking to make sure they are compatible with each other. The plplottcktk library has now been split (see remarks in the above OFFICIAL NOTICES for more details). Many bugs have been fixed, and all tests documented in examples/tcl/README.tcldemos and examples/tk/README.tkdemos have now been implemented as tests via the build system to help avoid any regressions in the build system and bindings for Tcl and friends in the future. As a consequence of these activities the ntk device has been enabled under Windows. The xwin and tkwin devices work under Cygwin. 3.3 Substantial overhaul of the build system for the Qt-components of PLplot As a result of these improvements compiling and linking of our Qt-related components just got a lot more rational, and the long-standing memory management issues reported by valgrind for examples/c++/qt_example for the non-dynamic devices case have been resolved. 3.4 The epa_build project has been implemented The goal of this project is to make builds of recent versions of PLplot dependencies (and PLplot itself) much more convenient on all platforms. Once this goal is realized, it should make the full power of PLplot (which depends on the existence and quality of its dependencies) readily available on all platforms. The epa_build project uses the power of CMake (especially the ExternalProject_Add command which is why we chose to use the prefix "epa_" in the name of epa_build) to organize downloading, updating, configuring, building, testing, and installing of any kind (not just those with CMake-based build systems) of software project with full dependency support between all the various builds. For those users who are not satisified with the PLplot dependencies on their systems, learn how to use the epa_build project by consulting cmake/epa_build/README. The epa_build project is in pretty good shape on Linux; epa_build configurations work properly for build tools such as Tcl/Tk8.6, Itcl, Itk, and Iwidgets and for regular packages such as pango (needed for the cairo device driver), qt4_lite (needed for the qt device driver), the wxwidgets software package (needed for the wxwidgets device driver), and many smaller, but useful PLplot dependencies such as shapelib, libqhull, and libharu. The total build time is roughly an hour for an ordinary PC which is not much of a price to pay to get access to up-to-date versions of virtually all dependencies of PLplot. In fact, the only known dependency of PLplot not currently covered by epa_build is octave. In principle, it should be straightforward to add an epa_build configurations for octave and its many dependencies, but that possibility has not been explored yet. In principle, epa_build should work out of the box on Mac OS X platforms, but we haven't tested on that platform yet. Our testing for MinGW/MSYS and Cygwin shows the epa_build project is still in fairly rough shape on Windows. It is known that the "plplot" case (PLplot with all its dependencies) fails in various ways on all Windows platforms. Those issues are being actively worked on. Note, however, that the "plplot_lite" case (PLplot with all the minor dependencies but without Tcl etc., build tools and without the pango, qt4_lite, and wxwidgets dependencies) has been shown to work on MinGW/MSYS and should probably also work on Cygwin although we haven't tested that specific case yet. 4. OFFICIAL NOTICES FOR USERS SINCE 5.8.0 (the previous stable release) (5.9.11) Backwards-incompatible API change. The numerical symbolic constants that are #defined as macros in plplot.h have been repropagated to the Python, Java, Lua, Octave, Fortran 95, and Tcl language bindings using scripts. Previously, this propagation was done by hand in a piece-meal manner so use of the scripts has created a number of changes in the PLplot symbolic constants for these languages. These changes are the addition of 25 symbolic constants that were previously only available for C, no deletions of symbolic constants, no changes to numerical values, but the following backwards-incompatible name changes: PLESC_PLFLTBUFFERING ==> PLESC_DOUBLEBUFFERING PLESPLFLTBUFFERING_DISABLE ==> PLESC_DOUBLEBUFFERING_ENABLE PLESPLFLTBUFFERING_ENABLE ==> PLESC_DOUBLEBUFFERING_ENABLE PLESPLFLTBUFFERING_QUERY ==> PLESC_DOUBLEBUFFERING_QUERY So those users who were using the symbolic constants on the left for the above languages will have to change their source code or scripts to use the constants on the right. No changes in source code or scripts should be required of other users. (5.9.11) Backwards-incompatible API change. The PLplot build system and bindings for Tcl and friends have had a major overhaul, see below. Part of this change was to split the former libplplottcltk into two components. The new libplplottcltk is now a pure Tcl/Tk extension that can be linked to the stub versions of the Tcl/Tk libraries and dynamically loaded from a tclsh or wish environment using the appropriate "package require" command. The new libplplottcltk_Main library contains code (e.g., pltclMain and pltkMain) required by C plotting applications (e.g., pltcl, plrender, and xtk0[124].c) that link to libplplottcltk. (5.9.11) Backwards-incompatible change. Our Fortran 77 bindings and examples have been completely removed because Fortran 95 is just a much better language which we have been supporting for a long time, and our judgement call based on user feedback we have received is nobody is interested in plotting using strict Fortran 77 language constructs any more. However, if there is still some Fortran 77 source code out there that uses PLplot, typically the only change you should have to do to port it to our Fortran 95 bindings is to place the command "use plplot" as the first line of the source code of the main routine. (5.9.11) Deprecation. The functionality of the AGG backend and FreeType option in the wxwidgets device driver is provided (and in some cases exceeded) by other backends and options that we have implemented for this device driver. The AGG backend and Freetype option are therefore deprecated with the intention to remove them in a future release. (5.9.10) The minimum version of CMake has been bumped to 5.8.9. This change allows our build system to take advantage of CMake features introduced in later versions of CMake. Even more importantly it also updates user's builds to the CMake policy conventions (important backwards-incompatible changes in CMake behaviour introduced in later versions of CMake) to the default CMake policy used for 5.8.9. (5.9.10) The long deprecated support for the python Numeric package has been dropped. This is no longer supported and is superseded by numpy. Support for numpy has been the default in PLplot for a number of years so most users should notice no difference. (5.9.10) The current format for maps used by plmap has been deprecated in favour of using shapefiles (a standard format widely used for GIS and with suitable free data sources available). This requires the shapelib library to be installed. If this library is not installed then by default no map support will be available. Support for the old binary format is still available by setting the cmake variable PL_DEPRECATED, however this support will be removed in a future release of PLplot. (5.9.10) Those who use the Python version of plgriddata will have to change their use of this function for this release as follows (see examples/xw21.py) # old version (which overwrites preexisting zg in place): zg = reshape(zeros(xp*yp),(xp,yp)) plgriddata(x, y, z, xg, yg, zg, alg, opt[alg-1]) # new version (which uses a properly returned newly created NumPy array # as per the normal Python expectations): zg = plgriddata(x, y, z, xg, yg, alg, opt[alg-1]) (5.9.10) Significant efforts have been made to ensure the PLplot code is standards compliant and free from warnings. Compliance has been tested using the gcc compiler suite -std, -pedantic and -W flags. The language standards adopted are C: ISO C99 with POSIX.1-2001 base specification (required for a number of C library calls) C++: ISO C++ 1998 standard plus amendments F95: Fortran 95 standard Specifically, the following gcc / g++ / gfortran flags were used CFLAGS='-O3 -std=c99 -pedantic -D_POSIX_C_SOURCE=200112L -Wall \ -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \ -Wconversion -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings' CXXFLAGS='-O3 -fvisibility=hidden -std=c++98 -pedantic -Wall -Wextra ' FFLAGS='-std=f95 -O3 -fall-intrinsics -fvisibility=hidden -pedantic \ -Wall -Wextra ' Note that the code is not yet quite standards compliant or warning free, but this is our aim. We know that a number of common compilers do not support these standards "out of the box", so we will continue to develop and support workarounds to ensure that PLplot remains easily built on a variety of platforms and compilers. Standards compliance should make it easier to port to new systems in the future. Using aggressive warnings flags will help to detect and eliminate errors or problems in the libraries. The gfortran -fall-intrinsics flag is required for a couple of non-standard intrinsics which are used in the code. In the future adopting the fortran 2003 or 2008 standard should allow this to be removed. Note: currently this code cleanup does not apply to code generated by swig (octave, python, java, lua bindings) which gives a large number of code warnings. (5.9.10) For some years now we have had both FORTRAN 77 and Fortran 95 bindings, but to the best of our knowledge, there are no longer any maintained FORTRAN 77 compilers left that do not also support Fortran 95. (g77 for instance has not been maintained for several years now. Its successor gfortran supports Fortran 95 and later standards as well all g77's legacy features). An important consequence is that we can not test the implementation for compliance to the FORTRAN 77 standard. Furthermore, we would prefer to concentrate all our Fortran development effort on our f95 bindings and strongly encourage all our Fortran users to use those bindings if they haven't switched from the f77 version already. Therefore, as of this release we are deprecating the f77 bindings and examples and plan no further support for them. We signal this deprecation by disabling f77 by default (although our users can still get access to these unsupported bindings and examples for now by specifying the -DENABLE_f77=ON cmake option). We plan to completely remove the f77 bindings and examples two releases after this one. (5.9.10) We have found that some distributions of the Windows MinGW/gfortran compiler (i.e., MinGW/gfortran 4.6.1 and 4.6.2 from http://www.equation.com) may cause a link error due to duplicate symbols like __gfortran_setarg_. These errors can be suppressed by adding the flag -Wl,--allow-multiple-define. It is very likely that this is a bug in these distributions. As building the libraries and the examples succeeds without any problem if you use most other distributions of Windows MinGW/gfortran, we have decided not to include this flag in our build system. Distributions that are known to work: - MinGW/gfortran-4.5 from http://www.equation.com, - MinGW/gfortran-4.5.2-1 that is installed using the latest mingw-get-inst-20110802 automatic installer available at http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst - MinGW/gfortran-4.6.2 from tdm-gcc.tdragon.net (Therefore it is not the 4.5.x versus 4.6.x version of MinGW/gfortran as such that causes this problem.) (5.9.9) This is a quick release to deal with two broken build issues that were recently discovered for our Windows platform. Windows users should avoid 5.9.8 because of these problems for that release, and instead use 5.9.9 which has been heavily tested on a number of platforms including Windows, see "Tests made for release 5.9.9" below. (5.9.8) For unicode-aware devices we now follow what is done for the Hershey font case for epsilon, theta, and phi. This means the #ge, #gh, and #gf escapes now give users the Greek lunate epsilon, the ordinary Greek lower case theta, and the Greek symbol phi for Unicode fonts just like has occurred since the dawn of PLplot history for the Hershey font case. Previously these legacy escapes were assigned to ordinary Greek lower-case epsilon, the Greek symbol theta (= script theta), and the ordinary Greek lower case phi for unicode fonts inconsistently with what occurred for Hershey fonts. This change gets rid of this inconsistency, that is the #g escapes should give the best unicode approximation to the Hershey glyph result that is possible for unicode-aware devices. In general we encourage users of unicode-aware devices who might dislike the Greek glyph Hershey-lookalike choices they get with the legacy #g escapes to use instead either PLplot unicode escapes (e.g., "#[0x03b5]" for ordinary Greek lower-case epsilon, see page 3 of example 23) or better yet, UTF-8 strings (e.g., "ε") to specify exactly what unicode glyph they want. (5.9.8) The full set of PLplot constants have been made available to our Fortran 95 users as part of the plplot module. This means those users will have to remove any parameter statements where they have previously defined the PLplot constants (whose names typically start with "PL_" for themselves. For a complete list of the affected constants, see the #defines in swig-support/plplotcapi.i which are used internally to help generate the plplot module. See also Index item 5.51 below. (5.9.8) There has been widespread const modifier changes in the API for libplplotd and libplplotcxxd. Those backwards-incompatible API changes are indicated in the usual way by a soversion bump in those two libraries which will force all apps and libraries that depend on those two libraries to be rebuilt. Specifically, we have changed the following arguments in the C library (libplplotd) case type * name1 ==> const type * name1 type * name2 ==> const type ** name2 and the following arguments in the C++ library (libplplotcxxd) case type * name1 ==> const type * name1 type * name1 ==> const type * const * name2 where name1 is the name of a singly dimensioned array whose values are not changed internally by the PLplot libraries and name2 is the name of a doubly dimensioned array whose values are not changed internally by the PLplot libraries. The general documentation and safety justification for such const modifier changes to our API is given in http://www.cprogramming.com/tutorial/const_correctness.html. Essentially, the above const modifier changes constitute our guarantee that the associated arrays are not changed internally by the PLplot libraries. Although it is necessary to rebuild all apps and libraries that depend on libplplotd and/or libplplotcxxd, that rebuild should be possible with unchanged source code without build errors in all cases. For C apps and libraries (depending on libplplotd) there will be additional build warnings due to a limitation in the C standard discussed at http://c-faq.com/ansi/constmismatch.html unless all doubly dimensioned arrays (but not singly dimensioned) are explicitly cast to (const type **). However, such source code changes will not be necessary to avoid warning messages for the C++ (libplplotcxxd) change because of the double use of const in the above "const type * const * name2" change. (5.9.8) The plarc API has changed in release 5.9.8. The plarc API now has a rotation parameter which will eventually allow for rotated arcs. PLplot does not currently support rotated arcs, but the plarc function signature has been modified to avoid changing the API when this functionality is added. (5.9.6) We have retired the pbm driver containing the pbm (actually portable pixmap) file device. This device is quite primitive and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It also has a serious run-time issue with example 2 (double free detected by glibc) which probably indicates some fundamental issue with the 100 colors in cmap0 for that example. For those who really need portable pixmap results, we suggest using the ImageMagick convert programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap results from our best png device results. (5.9.6) We have retired the linuxvga driver containing the linuxvga interactive device. This device is quite primitive, difficult to test, and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It is Linux only, can only be run as root, and svgalib (the library used by linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. All of these characteristics make it difficult to even test this device much less use it for anything serious. Finally, it has had a well-known issue for years (incorrect colors) which has never been fixed indicating nobody is interested in maintaining this device. (5.9.6) We have retired our platform support of djgpp that used to reside in sys/dos/djgpp. The developer (Andrew Roach) who used to maintain those support files for djgpp feels that the djgpp platform is no longer actively developed, and he no longer uses djgpp himself. (5.9.6) We have changed plpoin results for ascii codes 92, 94, and 95 from centred dot, degree symbol, and centred dot glyphs to the correct backslash, caret, and underscore glyphs that are associated with those ascii indices. This change is consistent with the documentation of plpoin and solves a long-standing issue with backslash, caret, and underscore ascii characters in character strings used for example by pl[mp]tex. Those who need access to a centred dot with plpoin should use index 1. The degree symbol is no longer accessible with plpoin, but it is available in ordinary text input to PLplot as Hershey escape "#(718)", where 718 is the Hershey index of the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". (5.9.6) We have retired the gcw device driver and the related gnome2 and pygcw bindings since these are unmaintained and there are good replacements. These components of PLplot were deprecated as of release 5.9.3. A good replacement for the gcw device is either the xcairo or qtwidget device. A good replacement for the gnome2 bindings is the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo). A good replacement for pygcw is our new pyqt4 bindings for PLplot. (5.9.6) We have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. (5.9.5) We have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). (5.9.5) The only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing re-implementation for details. (5.9.5) We have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. (5.9.4) We have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. (5.9.3) Our build system requires CMake version 5.6.0 or higher. (5.9.3) We have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. (5.9.3) We have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. (5.9.3) We have re-enabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. (5.9.2) We have set HAVE_PTHREAD (now called PL_HAVE_PTHREAD as of release 5.9.8) to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. (5.9.1) We have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. (5.9.1) We no longer support Octave-5.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. (5.9.1) We have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. 5. Changes relative to PLplot 5.8.0 (the previous stable release) N.B. This release includes many code cleanups and fixes relative to 5.8.0 that are not mentioned in the list below. 5.1 All autotools-related files have now been removed CMake is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 5.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 5.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 5.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 5.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.5. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 5.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 5.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 5.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 5.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 5.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 5.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 5.8.4 and later. This backend produces antialiased output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already available in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 5.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 5.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 5.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 5.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 5.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an official PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 5.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 5.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 5.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigorous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 5.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 5.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 5.22 Internal changes to function visibility The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 5.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared PLplot library is built. 5.24 Documentation updates The DocBook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for PLplot users. 5.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 5.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 5.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 5.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 5.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 5.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 5.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make Fortran command line argument parsing work with shared libraries on Windows 5.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 5.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 5.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 5.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 5.36 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our color palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 5.37 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current color map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 5. 5.38 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 5.39 Custom axis labelling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labelling geographic coordinates in degrees North, South, East and West. 5.40 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 5.41 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbitrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t structure of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 5.42 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). 5.42 Alpha value support for plotting in memory. The function plsmema() was added to the PLplot API. This allows the user to supply a RGBA formatted array that PLplot can use to do in memory plotting with alpha value support. At present only the memcairo device is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. 5.43 Add a Qt device for in memory plotting. A new device called memqt has been added for in memory plotting using Qt. This device is the Qt equivalent of the memcairo device. 5.44 Add discrete legend capability. A new routine called pllegend has been added to our core C API. (N.B. This is an experimental API that may be subject to further change as we gain more experience with it.) This routine creates a discrete plot legend with a plotted box, line, and/or line of symbols for each annotated legend entry. The arguments of pllegend provide control over the location and size of the legend within the current subpage as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage 5.45 Add full bindings and examples for the D language. As of release 5.9.5 we added full bindings and examples for the D language. The results for the D examples are generally consistent with the corresponding C examples which helps to verify the D bindings. Since the release of 5.9.5 it has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). 5.46 The plstring and plstring3 functions have been added The plstring function largely supersedes plpoin and plsym because many(!) more glyphs are accessible with plstring. The glyph is specified with a PLplot user string. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph. Standard examples 4 and 26 use plstring. The plstring3 function largely supersedes plpoin3 for the same (access to many more glyphs) reasons. Standard example 18 uses plstring3. 5.47 The pllegend API has been finalized The function pllegend allows users to create a discrete plot legend with a plotted colored box, line, and/or line of symbols for each annotated legend entry. The pllegend function was first made available for 5.9.7. Due to feedback from early adopters of pllegend, we have now added substantially to the pllegend capabilities. and we now believe pllegend is ready for prime time. The pllegend capabilities are documented in our DocBook documentation and demonstrated in standard examples 4, 26, and 33. N.B. The current set of changes required a backwards-incompatible change to the pllegend API. This requires users who tried this new functionality for 5.9.7 to reprogramme their pllegend calls. Since the pllegend API was labelled experimental for 5.9.7, we will not be bumping the soversions of the affected PLplot libraries. 5.48 Octave bindings now implemented with swig Octave is a powerful platform that demands a first-class PLplot solution, but we were finding it difficult to realize that goal because we were running up against limitations of the previous matwrap-generated Octave bindings. Accordingly, a swig-generated version of the Octave bindings has now been implemented that builds on the prior matwrapped bindings effort but also extends it with, e.g., bindings for plstring, plstring3, pllegend, and plcolorbar. These new octave bindings (which now completely replace the prior matwrapped bindings) make it possible to run examples 4, 18, 26, and 33 (all of which have now have been updated to use those functions) and get consistent results with the corresponding C examples. Like the matwrapped bindings before it, the new swig-generated octave bindings currently do not have a number of the PLplot functions wrapped (e.g., "plmap") that are needed by standard example 19. However, because of the power of swig we now have some confidence we can solve this issue in the future. 5.49 Documentation redone for our swig-generated Python and Octave bindings Through the docstring %feature, swig can generate documentation strings for certain of the languages it supports (currently Python, Octave, and Ruby). We have now removed all such hand-crafted swig documentation data from bindings/swig-support/plplotcapi.i and replaced it with generated documentation in the file bindings/swig-support/swig_documentation.i. That file is generated from doc/docbook/src/api.xml using the perl script doc/docbook/bin/api2swigdoc.pl. The build system Unix target "check_swig_documentation" now runs that script and compares results with bindings/swig-support/swig_documentation.i in the source tree to make sure that latter file is consistent with any changes that might have occurred in doc/docbook/src/api.xml. The resulting Octave and Python user-documentation (obtained by 'help ' in Octave and 'print ("%s" % .__doc__)' in Python is much more detailed than what was available before using the hand-crafted documentation. If we ever decided to generate PLplot bindings for Ruby with swig, this high-quality user-documentation would be available for that language as well. 5.50 Support large polygons Previous releases had an implicit limitation with respect to the number of vertices in a polygon. This was due to the use of statically defined arrays (to avoid allocating and freeing memory for each polygon to be drawn). José Luis García Pallero found this limitation and provided patches to eliminate this limitation. The strategy is that for small polygons, the original statically defined arrays are used and for large polygons new arrays are allocated and freed. This strategy has been applied to all relevant source files. 5.51 Complete set of PLplot parameters now available for Fortran The #defines in bindings/swig-support/plplotcapi.i (which are consistent with those in include/plplot.h) define the complete set of important PLplot constants (whose names typically start with "PL_"). We have implemented automatic methods of transforming that complete set of #defines into Fortran parameters that can be used from either Fortran 77 or Fortran 95. For Fortran 77, the user must insert an include 'plplot_parameters.h' statement in every function/subroutine/main programme where he expects to use PLplot constants (whose names typically start with "PL_". (See examples/f77/*.fm4 for examples of this method). When compiling he must also insert the appropriate -I option to find this file (in bindings/f77/ in the source tree and currently in $prefix/lib/fortran/include/plplot$version in the install tree although that install location may be subject to change). Note, the above method does not interfere with existing apps which have necessarily been forced to define the needed PLplot constants for themselves. But for future f77 use, the above statement is more convenient and much less subject to error than a whole bunch of parameter statements for the required constants. For Fortran 95, the complete set of parameters are made available as part of the plplot module. So access to this complete set of parameters is automatic wherever the "use plplot" statement is used. This is extremely convenient for new Fortran 95 apps that use PLplot, but, in general, changes will have to be made for existing apps. (See announcement XX above for the details). 5.52 The plarc function has been added The plarc function allows drawing filled and outlined arcs in PLplot. Standard example 3 uses plarc. 5.53 The format for map data used by plmap has changed The format for map data used by plmap is now the shapefile format. This is a widely used standard format and there are many sources of data in this format. This replaces the custom binary format that PLplot used to use. The support for reading shapefiles is provided by the shapelib library, which is a new dependency for PLplot. If users do not have this installed then, by default, they will not get any map capabilities with PLplot. Support for the old format can still be enabled by setting the PL_DEPRECATED cmake variable, but this support will be removed in a subsequent PLplot release. 5.54 Python support for Numeric has been dropped Support for the python Numeric package has been dropped. This has been deprecated since 5.9.6. Numeric is no longer supported and is superseded by numpy. Support for numpy has been the default in plplot for a number of years so most users should notice no difference. 5.55 Backwards-incompatible API change to non-integer line widths All functions which take line width arguments (plwidth, plshade*, pllegend) now use PLFLT values for the line width. This allows device drivers which are based on modern graphics libraries such as Qt4 and pango/cairo to make full use (e.g., extremely fine line widths) of the floating-point line width capabilities of those libraries. The replacement of plwid by plwidth, and the change in argument lists for plshade* and pllegend constitute a backwards incompatible API change from previous releases and the soname of libraries has been bumped accordingly (which forces users to recompile PLplot). 5.56 Improvements to the build system for the Cygwin case The Cygwin platform provides a full-featured Unix environment on Windows. CMake has recently been changed (at the request of Cygwin developers) to emphasize the Unix aspects of the Cygwin platform and deemphasize the Windows aspects of that platform. It was argued this change would tend to make CMake builds of software much more reliable on Cygwin, and after some small but important changes to our CMake-based build system to adjust for these recent CMake changes for Cygwin, we have indeed confirmed that prediction for the PLplot case. There are still some Cygwin platform issues left which are being discussed on our Wiki at http://www.miscdebris.net/plplot_wiki/index.php?title=Setup_cygwin, but some fundamental breakthroughs have also been made for the Cygwin case that should interest all our Windows users. For example, for the first time ever we have been able to build our cairo and qt device drivers on the Cygwin platform giving our Windows users convenient access to the many high-quality PLplot devices that are available with these two different device drivers. 5.57 The plcolorbar API has been finalized The function plcolorbar allows users to create a color bar (an annotated subplot representing a continuous range of colors within the main plot and typically identifying certain colors with certain numerical values using an axis). The plcolorbar capabilities are documented in our DocBook (and doxygen) documentation and demonstrated in standard examples 16 and 33. N.B. The previous two releases (5.9.8 and 5.9.9) contained unadvertised experimental versions of plcolorbar. Any PLplot user who found and tried those capabilities will have to reprogramme their plcolorbar calls to be compatible with the argument list of the latest version. 5.58 Documentation of the new legend and color bar capabilities of PLplot The pllegend and plcolorbar API has been documented in both doxygen and DocBook forms. In addition, the "advanced use" chapter of the DocBook form of documentation now contains a section giving an overview of pllegend and plcolorbar. N.B. Although we feel the pllegend and plcolorbar API has now been finalized with regard to the PLplot core developers own interests and needs, we also realize that as more and more PLplot users take advantage of these new PLplot capabilities there will likely be calls to add additional features to pllegend or plcolorbar based on additional experience with these powerful capabilities. In general, we would welcome such feature requests. 5.59 The D bindings and examples have been converted from the old version of D (D1) to the new version of D (D2) This change should make PLplot much more relevant for D users going forward. See http://en.wikipedia.org/wiki/D_(programming_language)#History for a discussion of the differences between these two variants of D. 5.60 The DocBook documentation for PLplot is now generated using modern XML/XSL backend tools for DocBook These modern backend tools (such as xmlto) replace the deprecated/unmaintained SGML/DSSL tools we have used before. For developers this means generation of our DocBook generation is much easier. much faster, and much less error-prone. End users will notice some improvements in the results (e.g., the table of Greek letters) as well as some minor style changes. 5.61 Implement experimental build_projects sub-project The idea here (see cmake/build_projects) is to automate the build of all PLplot dependencies and the build and test of PLplot itself for platforms (such as Linux enterprise distributions and all forms of Windows platforms other than Cygwin) that do not come with modern versions of PLplot soft dependencies such as Pango/Cairo and Qt. This project is beginning to work properly for the Linux case, but still needs lots of work for the Windows case. 5.62 Implement extremely simple "00" example The point of this standard example is to give the users an extremely simple tutorial example to help them to get started with 2D plotting with PLplot. 5.63 Convert to using the Allura form of SourceForge software We use sourceforge.net as our software hosting facility. Early in 2013 Sourceforge updated essentially all their support software as part of the so-called Allura project. This made it necessary to make some minor internal PLplot changes such as script changes and different URL's in the website referring to SourceForge facilities. The most important change from the user perspective is the URL for the Allura form of the svn repository that we use now: http://svn.code.sf.net/p/plplot/code/trunk/ 5.64 Use NON_TRANSITIVE linking by default for the shared libraries case for all non-windows systems The point of this change is to reduce overlinking and therefore the problems caused by overlinking that are mentioned at http://en.altlinux.org/UnderOverLinkProblems. Non-transitive linking means link only to libraries that directly resolve undefined symbols, i.e., do not link to a library just because it is a dependency of a dependency. 5.65 Update f95 examples to take larger advantage of Fortran 95 capabilities Previously our f95 examples tended to use legacy Fortran capabilities, but that situation has substantially changed for this release. 5.66 Substantial additions to the doxygen documentation One of the on-going documentation projects is to create doxygen documentation of every single argument of the public API for PLplot. A substantial increase in such documentation has been implemented in this release cycle. 5.67 NUMERIC_INCLUDE_PATH ==> NUMPY_INCLUDE_PATH We have long since dropped support for the Numeric Python module and are now exclusively using the numpy Python modules instead. Therefore, we have changed the CMake variable name used in our build system that holds the location of the numpy headers from the confusing misnomer, NUMERIC_INCLUDE_PATH, to NUMPY_INCLUDE_PATH. This change only impacts PLplot users who in the past have used the cmake option -DNUMERIC_INCLUDE_PATH to set the CMake variable NUMERIC_INCLUDE_PATH to the location of the numpy header directory. Note we discourage that method since without that user intervention, the build system uses python and numpy to find the location which should normally be foolproof and not subject to the inconsistencies or errors possible with setting the variable. But if some users still insist on setting the variable, that variable's name should now be NUMPY_INCLUDE_PATH. 5.68 Major overhaul of the build system and bindings for Tcl and friends After years of neglect we have worked very hard in the release cycle leading up to the release of 5.9.11 on our build system and code interfacing Tcl and friends (Tk, Itcl, Itk, and Iwidgets) with PLplot. The build system now does a much better job of finding a consistent set of components for Tcl and friends. For example, switching from the system version of those components to a special build of those components is typically a matter of simply putting tclsh from the special build first on the PATH. And after the components of Tcl and friends are found, the build system does extensive checking to make sure they are compatible with each other. The plplottcktk library has now been split (see remarks in the above OFFICIAL NOTICES for more details). Many bugs have been fixed, and all tests documented in examples/tcl/README.tcldemos and examples/tk/README.tkdemos have now been implemented as tests via the build system to help avoid any regressions in the build system and bindings for Tcl and friends in the future. 5.69 Substantial overhaul of the build system for the Qt-components of PLplot As a result of these improvements compiling and linking of our Qt-related components just got a lot more rational, and the long-standing memory management issues reported by valgrind for examples/c++/qt_example for the non-dynamic drivers case have been resolved. 5.70 The epa_build project has been implemented The goal of this project is to make builds of recent versions of PLplot dependencies (and PLplot itself) much more convenient on all platforms. Once this goal is realized, it should make the full power of PLplot (which depends on the existence and quality of its dependencies) readily available on all platforms. The epa_build project uses the power of CMake (especially the ExternalProject_Add command which is why we chose to use the prefix "epa_" in the name of epa_build) to organize downloading, updating, configuring, building, testing, and installing of any kind (not just those with CMake-based build systems) of software project with full dependency support between all the various builds. For those users who are not satisified with the PLplot dependencies on their systems, learn how to use the epa_build project by consulting cmake/epa_build/README. The epa_build project is in pretty good shape on Linux; epa_build configurations work properly for build tools such as Tcl/Tk8.6, Itcl, Itk, and Iwidgets and for regular packages such as pango (needed for the cairo device driver), qt4_lite (needed for the qt device driver), the wxwidgets software package (needed for the wxwidgets device driver), and many smaller, but useful PLplot dependencies such as shapelib, libqhull, and libharu. The total build time is roughly an hour for an ordinary PC which is not much of a price to pay to get access to up-to-date versions of virtually all dependencies of PLplot. In fact, the only known dependency of PLplot not currently covered by epa_build is octave. In principle, it should be straightforward to add an epa_build configurations for octave and its many dependencies, but that possibility has not been explored yet. In principle, epa_build should work out of the box on Mac OS X platforms, but we haven't tested on that platform yet. Our testing for MinGW/MSYS and Cygwin shows the epa_build project is still in fairly rough shape on Windows. It is known that the "plplot" case (PLplot with all its dependencies) fails in various ways on all Windows platforms. Those issues are being actively worked on. Note, however, that the "plplot_lite" case (PLplot with all the minor dependencies but without Tcl etc., build tools and without the pango, qt4_lite, and wxwidgets dependencies) has been shown to work on MinGW/MSYS and should probably also work on Cygwin although we haven't tested that specific case yet. PLplot Release 5.9.10 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file or on our bug tracker, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bug tracker at http://sourceforge.net/tracker/?group_id=2915&atid=102915. Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. INDEX OFFICIAL NOTICES FOR USERS CHANGES -1. Important changes we should have mentioned in previous release announcements. -1.1 Add full bindings and examples for the D language. 0. Tests made for release 5.9.10 1. Changes relative to PLplot 5.9.9 (the previous development release) 1.1 The format for map data used by plmap has changed 1.2 Python support for Numeric has been dropped 1.3 Backwards-incompatible API change to non-integer line widths 1.4 Improvements to the build system for the Cygwin case 1.5 The plcolorbar API has been finalized 1.6 Documentation of the new legend and color bar capabilities of PLplot 1.7 The D bindings and examples have been converted from the old version of D (D1) to the new version of D (D2) 1.8 The DocBook documentation for PLplot is now generated using modern XML/XSL backend tools for DocBook 1.9 Implement experimental build_projects sub-project 1.10 Implement extremely simple "00" example 1.11 Convert to using the Allura form of SourceForge software 1.12 Use NON_TRANSITIVE linking by default for the shared libraries case for all non-windows systems 1.13 Update f95 examples to take larger advantage of Fortran 95 capabilities 1.14 Substantial additions to the doxygen documentation 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device 2.10 Improvements to the cairo driver family 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 2.33 PyQt changes 2.34 Color Palettes 2.35 Re-implementation of a "soft landing" when a bad/missing compiler is detected 2.36 Make PLplot aware of LC_NUMERIC locale 2.37 Linear gradients have been implemented 2.38 Cairo Windows driver implemented 2.39 Custom axis labelling implemented 2.40 Universal coordinate transform implemented 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements 2.42 Alpha value support for plotting in memory. 2.43 Add a Qt device for in memory plotting. 2.44 Add discrete legend capability. 2.45 Add full bindings and examples for the D language. 2.46 The plstring and plstring3 functions have been added 2.47 The pllegend API has been finalized 2.48 Octave bindings now implemented with swig 2.49 Documentation redone for our swig-generated Python and Octave bindings 2.50 Support large polygons 2.51 Complete set of PLplot parameters now available for Fortran 2.52 The plarc function has been added 2.53 The format for map data used by plmap has changed 2.54 Python support for Numeric has been dropped 2.55 Backwards-incompatible API change to non-integer line widths 2.56 Improvements to the build system for the Cygwin case 2.57 The plcolorbar API has been finalized 2.58 Documentation of the new legend and color bar capabilities of PLplot 2.59 The D bindings and examples have been converted from the old version of D (D1) to the new version of D (D2) 2.60 The DocBook documentation for PLplot is now generated using modern XML/XSL backend tools for DocBook 2.61 Implement experimental build_projects sub-project 2.62 Implement extremely simple "00" example 2.63 Convert to using the Allura form of SourceForge software 2.64 Use NON_TRANSITIVE linking by default for the shared libraries case for all non-windows systems 2.65 Update f95 examples to take larger advantage of Fortran 95 capabilities 2.66 Substantial additions to the doxygen documentation OFFICIAL NOTICES FOR USERS (5.9.10) The minimum version of CMake has been bumped to 2.8.9. This change allows our build system to take advantage of CMake features introduced in later versions of CMake. Even more importantly it also updates user's builds to the CMake policy conventions (important backwards-incompatible changes in CMake behaviour introduced in later versions of CMake) to the default CMake policy used for 2.8.9. (5.9.10) The long deprecated support for the python Numeric package has been dropped. This is no longer supported and is superseded by numpy. Support for numpy has been the default in PLplot for a number of years so most users should notice no difference. (5.9.10) The current format for maps used by plmap has been deprecated in favour of using shapefiles (a standard format widely used for GIS and with suitable free data sources available). This requires the shapelib library to be installed. If this library is not installed then by default no map support will be available. Support for the old binary format is still available by setting the cmake variable PL_DEPRECATED, however this support will be removed in a future release of PLplot. (5.9.10) Those who use the Python version of plgriddata will have to change their use of this function for this release as follows (see examples/xw21.py) # old version (which overwrites preexisting zg in place): zg = reshape(zeros(xp*yp),(xp,yp)) plgriddata(x, y, z, xg, yg, zg, alg, opt[alg-1]) # new version (which uses a properly returned newly created NumPy array # as per the normal Python expectations): zg = plgriddata(x, y, z, xg, yg, alg, opt[alg-1]) (5.9.10) Significant efforts have been made to ensure the PLplot code is standards compliant and free from warnings. Compliance has been tested using the gcc compiler suite -std, -pedantic and -W flags. The language standards adopted are C: ISO C99 with POSIX.1-2001 base specification (required for a number of C library calls) C++: ISO C++ 1998 standard plus amendments F95: Fortran 95 standard Specifically, the following gcc / g++ / gfortran flags were used CFLAGS='-O3 -std=c99 -pedantic -D_POSIX_C_SOURCE=200112L -Wall \ -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \ -Wconversion -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings' CXXFLAGS='-O3 -fvisibility=hidden -std=c++98 -pedantic -Wall -Wextra ' FFLAGS='-std=f95 -O3 -fall-intrinsics -fvisibility=hidden -pedantic \ -Wall -Wextra ' Note that the code is not yet quite standards compliant or warning free, but this is our aim. We know that a number of common compilers do not support these standards "out of the box", so we will continue to develop and support workarounds to ensure that PLplot remains easily built on a variety of platforms and compilers. Standards compliance should make it easier to port to new systems in the future. Using aggressive warnings flags will help to detect and eliminate errors or problems in the libraries. The gfortran -fall-intrinsics flag is required for a couple of non-standard intrinsics which are used in the code. In the future adopting the fortran 2003 or 2008 standard should allow this to be removed. Note: currently this code cleanup does not apply to code generated by swig (octave, python, java, lua bindings) which gives a large number of code warnings. (5.9.10) For some years now we have had both FORTRAN 77 and Fortran 95 bindings, but to the best of our knowledge, there are no longer any maintained FORTRAN 77 compilers left that do not also support Fortran 95. (g77 for instance has not been maintained for several years now. Its successor gfortran supports Fortran 95 and later standards as well all g77's legacy features). An important consequence is that we can not test the implementation for compliance to the FORTRAN 77 standard. Furthermore, we would prefer to concentrate all our Fortran development effort on our f95 bindings and strongly encourage all our Fortran users to use those bindings if they haven't switched from the f77 version already. Therefore, as of this release we are deprecating the f77 bindings and examples and plan no further support for them. We signal this deprecation by disabling f77 by default (although our users can still get access to these unsupported bindings and examples for now by specifying the -DENABLE_f77=ON cmake option). We plan to completely remove the f77 bindings and examples two releases after this one. (5.9.10) We have found that some distributions of the Windows MinGW/gfortran compiler (i.e., MinGW/gfortran 4.6.1 and 4.6.2 from http://www.equation.com) may cause a link error due to duplicate symbols like __gfortran_setarg_. These errors can be suppressed by adding the flag -Wl,--allow-multiple-define. It is very likely that this is a bug in these distributions. As building the libraries and the examples succeeds without any problem if you use most other distributions of Windows MinGW/gfortran, we have decided not to include this flag in our build system. Distributions that are known to work: - MinGW/gfortran-4.5 from http://www.equation.com, - MinGW/gfortran-4.5.2-1 that is installed using the latest mingw-get-inst-20110802 automatic installer available at http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst - MinGW/gfortran-4.6.2 from tdm-gcc.tdragon.net (Therefore it is not the 4.5.x versus 4.6.x version of MinGW/gfortran as such that causes this problem.) (5.9.9) This is a quick release to deal with two broken build issues that were recently discovered for our Windows platform. Windows users should avoid 5.9.8 because of these problems for that release, and instead use 5.9.9 which has been heavily tested on a number of platforms including Windows, see "Tests made for release 5.9.9" below. (5.9.8) For unicode-aware devices we now follow what is done for the Hershey font case for epsilon, theta, and phi. This means the #ge, #gh, and #gf escapes now give users the Greek lunate epsilon, the ordinary Greek lower case theta, and the Greek symbol phi for Unicode fonts just like has occurred since the dawn of PLplot history for the Hershey font case. Previously these legacy escapes were assigned to ordinary Greek lower-case epsilon, the Greek symbol theta (= script theta), and the ordinary Greek lower case phi for unicode fonts inconsistently with what occurred for Hershey fonts. This change gets rid of this inconsistency, that is the #g escapes should give the best unicode approximation to the Hershey glyph result that is possible for unicode-aware devices. In general we encourage users of unicode-aware devices who might dislike the Greek glyph Hershey-lookalike choices they get with the legacy #g escapes to use instead either PLplot unicode escapes (e.g., "#[0x03b5]" for ordinary Greek lower-case epsilon, see page 3 of example 23) or better yet, UTF-8 strings (e.g., "ε") to specify exactly what unicode glyph they want. (5.9.8) The full set of PLplot constants have been made available to our Fortran 95 users as part of the plplot module. This means those users will have to remove any parameter statements where they have previously defined the PLplot constants (whose names typically start with "PL_" for themselves. For a complete list of the affected constants, see the #defines in swig-support/plplotcapi.i which are used internally to help generate the plplot module. See also Index item 2.51 below. (5.9.8) There has been widespread const modifier changes in the API for libplplotd and libplplotcxxd. Those backwards-incompatible API changes are indicated in the usual way by a soversion bump in those two libraries which will force all apps and libraries that depend on those two libraries to be rebuilt. Specifically, we have changed the following arguments in the C library (libplplotd) case type * name1 ==> const type * name1 type * name2 ==> const type ** name2 and the following arguments in the C++ library (libplplotcxxd) case type * name1 ==> const type * name1 type * name1 ==> const type * const * name2 where name1 is the name of a singly dimensioned array whose values are not changed internally by the PLplot libraries and name2 is the name of a doubly dimensioned array whose values are not changed internally by the PLplot libraries. The general documentation and safety justification for such const modifier changes to our API is given in http://www.cprogramming.com/tutorial/const_correctness.html. Essentially, the above const modifier changes constitute our guarantee that the associated arrays are not changed internally by the PLplot libraries. Although it is necessary to rebuild all apps and libraries that depend on libplplotd and/or libplplotcxxd, that rebuild should be possible with unchanged source code without build errors in all cases. For C apps and libraries (depending on libplplotd) there will be additional build warnings due to a limitation in the C standard discussed at http://c-faq.com/ansi/constmismatch.html unless all doubly dimensioned arrays (but not singly dimensioned) are explicitly cast to (const type **). However, such source code changes will not be necessary to avoid warning messages for the C++ (libplplotcxxd) change because of the double use of const in the above "const type * const * name2" change. (5.9.8) The plarc API has changed in release 5.9.8. The plarc API now has a rotation parameter which will eventually allow for rotated arcs. PLplot does not currently support rotated arcs, but the plarc function signature has been modified to avoid changing the API when this functionality is added. (5.9.6) We have retired the pbm driver containing the pbm (actually portable pixmap) file device. This device is quite primitive and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It also has a serious run-time issue with example 2 (double free detected by glibc) which probably indicates some fundamental issue with the 100 colors in cmap0 for that example. For those who really need portable pixmap results, we suggest using the ImageMagick convert programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap results from our best png device results. (5.9.6) We have retired the linuxvga driver containing the linuxvga interactive device. This device is quite primitive, difficult to test, and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It is Linux only, can only be run as root, and svgalib (the library used by linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. All of these characteristics make it difficult to even test this device much less use it for anything serious. Finally, it has had a well-known issue for years (incorrect colors) which has never been fixed indicating nobody is interested in maintaining this device. (5.9.6) We have retired our platform support of djgpp that used to reside in sys/dos/djgpp. The developer (Andrew Roach) who used to maintain those support files for djgpp feels that the djgpp platform is no longer actively developed, and he no longer uses djgpp himself. (5.9.6) We have changed plpoin results for ascii codes 92, 94, and 95 from centred dot, degree symbol, and centred dot glyphs to the correct backslash, caret, and underscore glyphs that are associated with those ascii indices. This change is consistent with the documentation of plpoin and solves a long-standing issue with backslash, caret, and underscore ascii characters in character strings used for example by pl[mp]tex. Those who need access to a centred dot with plpoin should use index 1. The degree symbol is no longer accessible with plpoin, but it is available in ordinary text input to PLplot as Hershey escape "#(718)", where 718 is the Hershey index of the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". (5.9.6) We have retired the gcw device driver and the related gnome2 and pygcw bindings since these are unmaintained and there are good replacements. These components of PLplot were deprecated as of release 5.9.3. A good replacement for the gcw device is either the xcairo or qtwidget device. A good replacement for the gnome2 bindings is the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo). A good replacement for pygcw is our new pyqt4 bindings for PLplot. (5.9.6) We have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. (5.9.5) We have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). (5.9.5) The only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing re-implementation for details. (5.9.5) We have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. (5.9.4) We have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. (5.9.3) Our build system requires CMake version 2.6.0 or higher. (5.9.3) We have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. (5.9.3) We have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. (5.9.3) We have re-enabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. (5.9.2) We have set HAVE_PTHREAD (now called PL_HAVE_PTHREAD as of release 5.9.8) to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. (5.9.1) We have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. (5.9.1) We no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. (5.9.1) We have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. CHANGES 0. Tests made for release 5.9.10 Comprehensive testing that showed no non-zero return codes or other obvious run-time issues such as segfaults was done for the Debian Wheezy platform. These tests were done with the scripts/comprehensive_test.sh which does 21 major tests. Those tests consist of seven tests (ctest, and "make test_noninteractive" and make "test_interactive" results for the build tree, and "make test_noninteractive" and make "test_interactive" results for both the traditional and CMake-based build systems for the installed examples tree) for each of our three major configurations (shared libraries/dynamic devices, shared libraries/non-dynamic devices, static libraries/non-dynamic devices). More limited testing that showed no non-zero return codes or other obvious run-time issues such as segfaults was done on a large number of different platforms including the following: Fedora with "Unix Makefiles" generator Ubuntu with "Unix Makefiles" generator Debian unstable with "Unix Makefiles" generator Debian wheezy with "Ninja" generator Wine version of Windows with "MSYS Makefiles" generator Wine version of Windows with "MinGW Makefiles" generator Wine version of Windows with "NMake Makefiles JOM" generator Microsoft version of Windows with Cygwin and with "Unix Makefiles" generator Microsoft version of Windows with "MinGW Makefiles" generator Microsoft version of Windows with "MSYS Makefiles" generator Microsoft version of Windows with "NMake Makefiles" generator 1. Changes relative to PLplot 5.9.9 (the previous development release) N.B. This release includes many code cleanups and fixes relative to 5.9.9 that are not mentioned in the list below. 1.1 The format for map data used by plmap has changed The format for map data used by plmap is now the shapefile format. This is a widely used standard format and there are many sources of data in this format. This replaces the custom binary format that PLplot used to use. The support for reading shapefiles is provided by the shapelib library, which is a new dependency for PLplot. If users do not have this installed then, by default, they will not get any map capabilities with PLplot. Support for the old format can still be enabled by setting the PL_DEPRECATED cmake variable, but this support will be removed in a subsequent PLplot release. 1.2 Python support for Numeric has been dropped Support for the python Numeric package has been dropped. This has been deprecated since 5.9.6. Numeric is no longer supported and is superseded by numpy. Support for numpy has been the default in plplot for a number of years so most users should notice no difference. 1.3 Backwards-incompatible API change to non-integer line widths All functions which take line width arguments (plwidth, plshade*, pllegend) now use PLFLT values for the line width. This allows device drivers which are based on modern graphics libraries such as Qt4 and pango/cairo to make full use (e.g., extremely fine line widths) of the floating-point line width capabilities of those libraries. The replacement of plwid by plwidth, and the change in argument lists for plshade* and pllegend constitute a backwards incompatible API change from previous releases and the soname of libraries has been bumped accordingly (which forces users to recompile PLplot). 1.4 Improvements to the build system for the Cygwin case The Cygwin platform provides a full-featured Unix environment on Windows. CMake has recently been changed (at the request of Cygwin developers) to emphasize the Unix aspects of the Cygwin platform and deemphasize the Windows aspects of that platform. It was argued this change would tend to make CMake builds of software much more reliable on Cygwin, and after some small but important changes to our CMake-based build system to adjust for these recent CMake changes for Cygwin, we have indeed confirmed that prediction for the PLplot case. There are still some Cygwin platform issues left which are being discussed on our Wiki at http://www.miscdebris.net/plplot_wiki/index.php?title=Setup_cygwin, but some fundamental breakthroughs have also been made for the Cygwin case that should interest all our Windows users. For example, for the first time ever we have been able to build our cairo and qt device drivers on the Cygwin platform giving our Windows users convenient access to the many high-quality PLplot devices that are available with these two different device drivers. 1.5 The plcolorbar API has been finalized The function plcolorbar allows users to create a color bar (an annotated subplot representing a continuous range of colors within the main plot and typically identifying certain colors with certain numerical values using an axis). The plcolorbar capabilities are documented in our DocBook (and doxygen) documentation and demonstrated in standard examples 16 and 33. N.B. The previous two releases (5.9.8 and 5.9.9) contained unadvertised experimental versions of plcolorbar. Any PLplot user who found and tried those capabilities will have to reprogramme their plcolorbar calls to be compatible with the argument list of the latest version. 1.6 Documentation of the new legend and color bar capabilities of PLplot The pllegend and plcolorbar API has been documented in both doxygen and DocBook forms. In addition, the "advanced use" chapter of the DocBook form of documentation now contains a section giving an overview of pllegend and plcolorbar. N.B. Although we feel the pllegend and plcolorbar API has now been finalized with regard to the PLplot core developers own interests and needs, we also realize that as more and more PLplot users take advantage of these new PLplot capabilities there will likely be calls to add additional features to pllegend or plcolorbar based on additional experience with these powerful capabilities. In general, we would welcome such feature requests. 1.7 The D bindings and examples have been converted from the old version of D (D1) to the new version of D (D2) This change should make PLplot much more relevant for D users going forward. See http://en.wikipedia.org/wiki/D_(programming_language)#History for a discussion of the differences between these two variants of D. 1.8 The DocBook documentation for PLplot is now generated using modern XML/XSL backend tools for DocBook These modern backend tools (such as xmlto) replace the deprecated/unmaintained SGML/DSSL tools we have used before. For developers this means generation of our DocBook generation is much easier. much faster, and much less error-prone. End users will notice some improvements in the results (e.g., the table of Greek letters) as well as some minor style changes. 1.9 Implement experimental build_projects sub-project The idea here (see cmake/build_projects) is to automate the build of all PLplot dependencies and the build and test of PLplot itself for platforms (such as Linux enterprise distributions and all forms of Windows platforms other than Cygwin) that do not come with modern versions of PLplot soft dependencies such as Pango/Cairo and Qt. This project is beginning to work properly for the Linux case, but still needs lots of work for the Windows case. 1.10 Implement extremely simple "00" example The point of this standard example is to give the users an extremely simple tutorial example to help them to get started with 2D plotting with PLplot. 1.11 Convert to using the Allura form of SourceForge software We use sourceforge.net as our software hosting facility. Early in 2013 Sourceforge updated essentially all their support software as part of the so-called Allura project. This made it necessary to make some minor internal PLplot changes such as script changes and different URL's in the website referring to SourceForge facilities. The most important change from the user perspective is the URL for the Allura form of the svn repository that we use now: http://svn.code.sf.net/p/plplot/code/trunk/ 1.12 Use NON_TRANSITIVE linking by default for the shared libraries case for all non-windows systems The point of this change is to reduce overlinking and therefore the problems caused by overlinking that are mentioned at http://en.altlinux.org/UnderOverLinkProblems. Non-transitive linking means link only to libraries that directly resolve undefined symbols, i.e., do not link to a library just because it is a dependency of a dependency. 1.13 Update f95 examples to take larger advantage of Fortran 95 capabilities Previously our f95 examples tended to use legacy Fortran capabilities, but that situation has substantially changed for this release. 1.14 Substantial additions to the doxygen documentation One of the on-going documentation projects is to create doxygen documentation of every single argument of the public API for PLplot. A substantial increase in such documentation has been implemented in this release cycle. 2. Changes relative to PLplot 5.8.0 (the previous stable release) N.B. This release includes many code cleanups and fixes relative to 5.8.0 that are not mentioned in the list below. 2.1 All autotools-related files have now been removed CMake is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialiased output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already available in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an official PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigorous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared PLplot library is built. 2.24 Documentation updates The DocBook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for PLplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make Fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 2.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 2.36 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our color palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 2.37 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current color map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. 2.38 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 2.39 Custom axis labelling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labelling geographic coordinates in degrees North, South, East and West. 2.40 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 2.41 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbitrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t structure of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 2.42 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). 2.42 Alpha value support for plotting in memory. The function plsmema() was added to the PLplot API. This allows the user to supply a RGBA formatted array that PLplot can use to do in memory plotting with alpha value support. At present only the memcairo device is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. 2.43 Add a Qt device for in memory plotting. A new device called memqt has been added for in memory plotting using Qt. This device is the Qt equivalent of the memcairo device. 2.44 Add discrete legend capability. A new routine called pllegend has been added to our core C API. (N.B. This is an experimental API that may be subject to further change as we gain more experience with it.) This routine creates a discrete plot legend with a plotted box, line, and/or line of symbols for each annotated legend entry. The arguments of pllegend provide control over the location and size of the legend within the current subpage as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage 2.45 Add full bindings and examples for the D language. As of release 5.9.5 we added full bindings and examples for the D language. The results for the D examples are generally consistent with the corresponding C examples which helps to verify the D bindings. Since the release of 5.9.5 it has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). 2.46 The plstring and plstring3 functions have been added The plstring function largely supersedes plpoin and plsym because many(!) more glyphs are accessible with plstring. The glyph is specified with a PLplot user string. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph. Standard examples 4 and 26 use plstring. The plstring3 function largely supersedes plpoin3 for the same (access to many more glyphs) reasons. Standard example 18 uses plstring3. 2.47 The pllegend API has been finalized The function pllegend allows users to create a discrete plot legend with a plotted colored box, line, and/or line of symbols for each annotated legend entry. The pllegend function was first made available for 5.9.7. Due to feedback from early adopters of pllegend, we have now added substantially to the pllegend capabilities. and we now believe pllegend is ready for prime time. The pllegend capabilities are documented in our DocBook documentation and demonstrated in standard examples 4, 26, and 33. N.B. The current set of changes required a backwards-incompatible change to the pllegend API. This requires users who tried this new functionality for 5.9.7 to reprogramme their pllegend calls. Since the pllegend API was labelled experimental for 5.9.7, we will not be bumping the soversions of the affected PLplot libraries. 2.48 Octave bindings now implemented with swig Octave is a powerful platform that demands a first-class PLplot solution, but we were finding it difficult to realize that goal because we were running up against limitations of the previous matwrap-generated Octave bindings. Accordingly, a swig-generated version of the Octave bindings has now been implemented that builds on the prior matwrapped bindings effort but also extends it with, e.g., bindings for plstring, plstring3, pllegend, and plcolorbar. These new octave bindings (which now completely replace the prior matwrapped bindings) make it possible to run examples 4, 18, 26, and 33 (all of which have now have been updated to use those functions) and get consistent results with the corresponding C examples. Like the matwrapped bindings before it, the new swig-generated octave bindings currently do not have a number of the PLplot functions wrapped (e.g., "plmap") that are needed by standard example 19. However, because of the power of swig we now have some confidence we can solve this issue in the future. 2.49 Documentation redone for our swig-generated Python and Octave bindings Through the docstring %feature, swig can generate documentation strings for certain of the languages it supports (currently Python, Octave, and Ruby). We have now removed all such hand-crafted swig documentation data from bindings/swig-support/plplotcapi.i and replaced it with generated documentation in the file bindings/swig-support/swig_documentation.i. That file is generated from doc/docbook/src/api.xml using the perl script doc/docbook/bin/api2swigdoc.pl. The build system Unix target "check_swig_documentation" now runs that script and compares results with bindings/swig-support/swig_documentation.i in the source tree to make sure that latter file is consistent with any changes that might have occurred in doc/docbook/src/api.xml. The resulting Octave and Python user-documentation (obtained by 'help ' in Octave and 'print ("%s" % .__doc__)' in Python is much more detailed than what was available before using the hand-crafted documentation. If we ever decided to generate PLplot bindings for Ruby with swig, this high-quality user-documentation would be available for that language as well. 2.50 Support large polygons Previous releases had an implicit limitation with respect to the number of vertices in a polygon. This was due to the use of statically defined arrays (to avoid allocating and freeing memory for each polygon to be drawn). José Luis García Pallero found this limitation and provided patches to eliminate this limitation. The strategy is that for small polygons, the original statically defined arrays are used and for large polygons new arrays are allocated and freed. This strategy has been applied to all relevant source files. 2.51 Complete set of PLplot parameters now available for Fortran The #defines in bindings/swig-support/plplotcapi.i (which are consistent with those in include/plplot.h) define the complete set of important PLplot constants (whose names typically start with "PL_"). We have implemented automatic methods of transforming that complete set of #defines into Fortran parameters that can be used from either Fortran 77 or Fortran 95. For Fortran 77, the user must insert an include 'plplot_parameters.h' statement in every function/subroutine/main programme where he expects to use PLplot constants (whose names typically start with "PL_". (See examples/f77/*.fm4 for examples of this method). When compiling he must also insert the appropriate -I option to find this file (in bindings/f77/ in the source tree and currently in $prefix/lib/fortran/include/plplot$version in the install tree although that install location may be subject to change). Note, the above method does not interfere with existing apps which have necessarily been forced to define the needed PLplot constants for themselves. But for future f77 use, the above statement is more convenient and much less subject to error than a whole bunch of parameter statements for the required constants. For Fortran 95, the complete set of parameters are made available as part of the plplot module. So access to this complete set of parameters is automatic wherever the "use plplot" statement is used. This is extremely convenient for new Fortran 95 apps that use PLplot, but, in general, changes will have to be made for existing apps. (See announcement XX above for the details). 2.52 The plarc function has been added The plarc function allows drawing filled and outlined arcs in PLplot. Standard example 3 uses plarc. 2.53 The format for map data used by plmap has changed The format for map data used by plmap is now the shapefile format. This is a widely used standard format and there are many sources of data in this format. This replaces the custom binary format that PLplot used to use. The support for reading shapefiles is provided by the shapelib library, which is a new dependency for PLplot. If users do not have this installed then, by default, they will not get any map capabilities with PLplot. Support for the old format can still be enabled by setting the PL_DEPRECATED cmake variable, but this support will be removed in a subsequent PLplot release. 2.54 Python support for Numeric has been dropped Support for the python Numeric package has been dropped. This has been deprecated since 5.9.6. Numeric is no longer supported and is superseded by numpy. Support for numpy has been the default in plplot for a number of years so most users should notice no difference. 2.55 Backwards-incompatible API change to non-integer line widths All functions which take line width arguments (plwidth, plshade*, pllegend) now use PLFLT values for the line width. This allows device drivers which are based on modern graphics libraries such as Qt4 and pango/cairo to make full use (e.g., extremely fine line widths) of the floating-point line width capabilities of those libraries. The replacement of plwid by plwidth, and the change in argument lists for plshade* and pllegend constitute a backwards incompatible API change from previous releases and the soname of libraries has been bumped accordingly (which forces users to recompile PLplot). 2.56 Improvements to the build system for the Cygwin case The Cygwin platform provides a full-featured Unix environment on Windows. CMake has recently been changed (at the request of Cygwin developers) to emphasize the Unix aspects of the Cygwin platform and deemphasize the Windows aspects of that platform. It was argued this change would tend to make CMake builds of software much more reliable on Cygwin, and after some small but important changes to our CMake-based build system to adjust for these recent CMake changes for Cygwin, we have indeed confirmed that prediction for the PLplot case. There are still some Cygwin platform issues left which are being discussed on our Wiki at http://www.miscdebris.net/plplot_wiki/index.php?title=Setup_cygwin, but some fundamental breakthroughs have also been made for the Cygwin case that should interest all our Windows users. For example, for the first time ever we have been able to build our cairo and qt device drivers on the Cygwin platform giving our Windows users convenient access to the many high-quality PLplot devices that are available with these two different device drivers. 2.57 The plcolorbar API has been finalized The function plcolorbar allows users to create a color bar (an annotated subplot representing a continuous range of colors within the main plot and typically identifying certain colors with certain numerical values using an axis). The plcolorbar capabilities are documented in our DocBook (and doxygen) documentation and demonstrated in standard examples 16 and 33. N.B. The previous two releases (5.9.8 and 5.9.9) contained unadvertised experimental versions of plcolorbar. Any PLplot user who found and tried those capabilities will have to reprogramme their plcolorbar calls to be compatible with the argument list of the latest version. 2.58 Documentation of the new legend and color bar capabilities of PLplot The pllegend and plcolorbar API has been documented in both doxygen and DocBook forms. In addition, the "advanced use" chapter of the DocBook form of documentation now contains a section giving an overview of pllegend and plcolorbar. N.B. Although we feel the pllegend and plcolorbar API has now been finalized with regard to the PLplot core developers own interests and needs, we also realize that as more and more PLplot users take advantage of these new PLplot capabilities there will likely be calls to add additional features to pllegend or plcolorbar based on additional experience with these powerful capabilities. In general, we would welcome such feature requests. 2.59 The D bindings and examples have been converted from the old version of D (D1) to the new version of D (D2) This change should make PLplot much more relevant for D users going forward. See http://en.wikipedia.org/wiki/D_(programming_language)#History for a discussion of the differences between these two variants of D. 2.60 The DocBook documentation for PLplot is now generated using modern XML/XSL backend tools for DocBook These modern backend tools (such as xmlto) replace the deprecated/unmaintained SGML/DSSL tools we have used before. For developers this means generation of our DocBook generation is much easier. much faster, and much less error-prone. End users will notice some improvements in the results (e.g., the table of Greek letters) as well as some minor style changes. 2.61 Implement experimental build_projects sub-project The idea here (see cmake/build_projects) is to automate the build of all PLplot dependencies and the build and test of PLplot itself for platforms (such as Linux enterprise distributions and all forms of Windows platforms other than Cygwin) that do not come with modern versions of PLplot soft dependencies such as Pango/Cairo and Qt. This project is beginning to work properly for the Linux case, but still needs lots of work for the Windows case. 2.62 Implement extremely simple "00" example The point of this standard example is to give the users an extremely simple tutorial example to help them to get started with 2D plotting with PLplot. 2.63 Convert to using the Allura form of SourceForge software We use sourceforge.net as our software hosting facility. Early in 2013 Sourceforge updated essentially all their support software as part of the so-called Allura project. This made it necessary to make some minor internal PLplot changes such as script changes and different URL's in the website referring to SourceForge facilities. The most important change from the user perspective is the URL for the Allura form of the svn repository that we use now: http://svn.code.sf.net/p/plplot/code/trunk/ 2.64 Use NON_TRANSITIVE linking by default for the shared libraries case for all non-windows systems The point of this change is to reduce overlinking and therefore the problems caused by overlinking that are mentioned at http://en.altlinux.org/UnderOverLinkProblems. Non-transitive linking means link only to libraries that directly resolve undefined symbols, i.e., do not link to a library just because it is a dependency of a dependency. 2.65 Update f95 examples to take larger advantage of Fortran 95 capabilities Previously our f95 examples tended to use legacy Fortran capabilities, but that situation has substantially changed for this release. 2.66 Substantial additions to the doxygen documentation One of the on-going documentation projects is to create doxygen documentation of every single argument of the public API for PLplot. A substantial increase in such documentation has been implemented in this release cycle. PLplot Release 5.9.9 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file or on our bugtracker, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bugtracker at http://sourceforge.net/tracker/?group_id=2915&atid=102915. Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. INDEX OFFICIAL NOTICES FOR USERS CHANGES -1. Important changes we should have mentioned in previous release announcements. -1.1 Add full bindings and examples for the D language. 0. Tests made for release 5.9.9 1. Changes relative to PLplot 5.9.8 (the previous development release) 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device 2.10 Improvements to the cairo driver family 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 2.33 PyQt changes 2.34 Color Palettes 2.35 Re-implementation of a "soft landing" when a bad/missing compiler is detected 2.36 Make PLplot aware of LC_NUMERIC locale 2.37 Linear gradients have been implemented 2.38 Cairo Windows driver implemented 2.39 Custom axis labeling implemented 2.40 Universal coordinate transform implemented 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements 2.42 Alpha value support for plotting in memory. 2.43 Add a Qt device for in memory plotting. 2.44 Add discrete legend capability. 2.45 Add full bindings and examples for the D language. 2.46 The plstring and plstring3 functions have been added 2.47 The pllegend API has been finalized 2.48 Octave bindings now implemented with swig 2.49 Documentation redone for our swig-generated Python and Octave bindings 2.50 Support large polygons 2.51 Complete set of PLplot parameters now available for Fortran 2.52 The plarc function has been added OFFICIAL NOTICES FOR USERS (5.9.9) This is a quick release to deal with two broken build issues that were recently discovered for our Windows platform. Windows users should avoid 5.9.8 because of these problems for that release, and instead use 5.9.9 which has been heavily tested on a number of platforms including Windows, see "Tests made for release 5.9.9" below. (5.9.8) For unicode-aware devices we now follow what is done for the Hershey font case for epsilon, theta, and phi. This means the #ge, #gh, and #gf escapes now give users the Greek lunate epsilon, the ordinary Greek lower case theta, and the Greek symbol phi for Unicode fonts just like has occurred since the dawn of PLplot history for the Hershey font case. Previously these legacy escapes were assigned to ordinary Greek lower-case epsilon, the Greek symbol theta (= script theta), and the ordinary Greek lower case phi for unicode fonts inconsistently with what occurred for Hershey fonts. This change gets rid of this inconsistency, that is the #g escapes should give the best unicode approximation to the Hershey glyph result that is possible for unicode-aware devices. In general we encourage users of unicode-aware devices who might dislike the Greek glyph Hershey-lookalike choices they get with the legacy #g escapes to use instead either PLplot unicode escapes (e.g., "#[0x03b5]" for ordinary Greek lower-case epsilon, see page 3 of example 23) or better yet, UTF-8 strings (e.g., "ε") to specify exactly what unicode glyph they want. (5.9.8) The full set of PLplot constants have been made available to our Fortran 95 users as part of the plplot module. This means those users will have to remove any parameter statements where they have previously defined the PLplot constants (whose names typically start with "PL_" for themselves. For a complete list of the affected constants, see the #defines in swig-support/plplotcapi.i which are used internally to help generate the plplot module. See also Index item 2.51 below. (5.9.8) There has been widespread const modifier changes in the API for libplplotd and libplplotcxxd. Those backwards-incompatible API changes are indicated in the usual way by a soversion bump in those two libraries which will force all apps and libraries that depend on those two libraries to be rebuilt. Specifically, we have changed the following arguments in the C library (libplplotd) case type * name1 ==> const type * name1 type * name2 ==> const type ** name2 and the following arguments in the C++ library (libplplotcxxd) case type * name1 ==> const type * name1 type * name1 ==> const type * const * name2 where name1 is the name of a singly dimensioned array whose values are not changed internally by the PLplot libraries and name2 is the name of a doubly dimensioned array whose values are not changed internally by the PLplot libraries. The general documentation and safety justification for such const modifier changes to our API is given in http://www.cprogramming.com/tutorial/const_correctness.html. Essentially, the above const modifier changes constitute our guarantee that the associated arrays are not changed internally by the PLplot libraries. Although it is necessary to rebuild all apps and libraries that depend on libplplotd and/or libplplotcxxd, that rebuild should be possible with unchanged source code without build errors in all cases. For C apps and libraries (depending on libplplotd) there will be additional build warnings due to a limitation in the C standard discussed at http://c-faq.com/ansi/constmismatch.html unless all doubly dimensioned arrays (but not singly dimensioned) are explicitly cast to (const type **). However, such source code changes will not be necessary to avoid warning messages for the C++ (libplplotcxxd) change because of the double use of const in the above "const type * const * name2" change. (5.9.8) The plarc API has changed in release 5.9.8. The plarc API now has a rotation parameter which will eventually allow for rotated arcs. PLplot does not currently support rotated arcs, but the plarc function signature has been modified to avoid changing the API when this functionality is added. (5.9.6) We have retired the pbm driver containing the pbm (actually portable pixmap) file device. This device is quite primitive and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It also has a serious run-time issue with example 2 (double free detected by glibc) which probably indicates some fundamental issue with the 100 colours in cmap0 for that example. For those who really need portable pixmap results, we suggest using the ImageMagick convert programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap results from our best png device results. (5.9.6) We have retired the linuxvga driver containing the linuxvga interactive device. This device is quite primitive, difficult to test, and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It is Linux only, can only be run as root, and svgalib (the library used by linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. All of these characteristics make it difficult to even test this device much less use it for anything serious. Finally, it has had a well-known issue for years (incorrect colours) which has never been fixed indicating nobody is interested in maintaining this device. (5.9.6) We have retired our platform support of djgpp that used to reside in sys/dos/djgpp. The developer (Andrew Roach) who used to maintain those support files for djgpp feels that the djgpp platform is no longer actively developed, and he no longer uses djgpp himself. (5.9.6) We have changed plpoin results for ascii codes 92, 94, and 95 from centred dot, degree symbol, and centred dot glyphs to the correct backslash, caret, and underscore glyphs that are associated with those ascii indices. This change is consistent with the documentation of plpoin and solves a long-standing issue with backslash, caret, and underscore ascii characters in character strings used for example by pl[mp]tex. Those who need access to a centred dot with plpoin should use index 1. The degree symbol is no longer accessible with plpoin, but it is available in ordinary text input to PLplot as Hershey escape "#(718)", where 718 is the Hershey index of the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". (5.9.6) We have retired the gcw device driver and the related gnome2 and pygcw bindings since these are unmaintained and there are good replacements. These components of PLplot were deprecated as of release 5.9.3. A good replacement for the gcw device is either the xcairo or qtwidget device. A good replacement for the gnome2 bindings is the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo). A good replacement for pygcw is our new pyqt4 bindings for PLplot. (5.9.6) We have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. (5.9.5) We have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). (5.9.5) The only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing re-implementation for details. (5.9.5) We have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. (5.9.4) We have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. (5.9.3) Our build system requires CMake version 2.6.0 or higher. (5.9.3) We have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. (5.9.3) We have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. (5.9.3) We have re-enabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. (5.9.2) We have set HAVE_PTHREAD (now called PL_HAVE_PTHREAD as of release 5.9.8) to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. (5.9.1) We have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. (5.9.1) We no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. (5.9.1) We have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. CHANGES -1. Important changes we should have mentioned in previous release announcements. -1.1 Add full bindings and examples for the D language. As of release 5.9.5 we added full bindings and examples for the D language. The results for the D examples are generally consistent with the corresponding C examples which helps to verify the D bindings. Since the release of 5.9.5 it has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). 0. Tests made for release 5.9.9 * (Alan W. Irwin) The scripts/comprehensive_test.sh script was run for a fully loaded (all Linux bindings other than PDL, all Linux device drivers including our qt and cairo device drivers) Debian Squeeze Linux platform with no obvious build-time or run-time issues being found. This script runs 7 major tests for each of our three principal build configurations (shared library/dynamic device drivers, shared libraries/nondynamic device drivers, static libraries/nondynamic device drivers). Those 7 tests are ctest and the test_noninteractive and test_interactive targets in the build tree, the test_noninteractive and test_interactive targets configured with CMake in the installed examples tree, and the traditional (MakeFile + pkg-config) test_noninteractive and test_interactive targets in the installed examples tree. These tests were done with OCaml disabled because of a segfault and a series of bad valgrind test results that occurred for OCaml 3.11.2. We have tentatively ascribed this issue to issues with the OCaml stack on that platform since this bad OCaml result contrasts with good OCaml results on other reported platforms. In addition to the scripts/comprehensive_test.sh result, comprehensive valgrind results were clean for all C examples for both -dev psc and -dev epsqt for the build-tree/shared library/dynamic device drivers case. The first result verifies there are no core memory management issues for our C library and C examples for one of our simpler devices that has no external dependencies. The second result shows in addition that there are no memory management issues for our epsqt device and the part of the Qt4 version 4.6.3 stack that it uses on this platform. * (Andrew Ross) For one Ubuntu platform the test_noninteractive and test_interactive targets for the shared libraries and dynamic drivers case gave good results. This was for a fully loaded platform including our qt and cairo device drivers. * (Hezekiah M. Carty) scripts/comprehensive_test.sh failed on a Ubuntu Linux platform because of segfaults in the qt devices. We have tentatively ascribed this issue to issues with the Qt4 stack of libraries on that platform since this bad qt result contrasts with the good qt result on the previous two Linux platforms. When qt devices were ignored, clean valgrind results were obtained for OCaml-3.12.1 and OCaml-3.11.2 (in contrast to the results seen for OCaml-3.11.2 above). Testing with the comprehensive_test.sh script and qt devices disabled completed with good results. * (Arjen Markus) MinGW/MSYS installed on a lightly loaded (at least compared to Linux tests) Windows XP system gives good results for the test_noninteractive target in the build tree for the shared library/dynamic device drivers case. * (Arjen Markus) The combination of Microsoft Visual C/C++ version 9.0 and Intel Fortran compilers installed on a lightly loaded Windows XP system gives good results for the "all" target for the shared library/dynamic device drivers case. That target just builds the software. In addition, some run-time testing was done by hand with no sign of any run-time trouble. * (Jerry Bauck) Mac OS X 10.6.8 (Snow Leopard) platform with Ada bindings and good coverage of devices (e.g., qt and cairo) but lightly loaded with regard to non-Ada bindings give fairly good results for ctest and the test_noninteractive target for the shared library/dynamic device drivers case. All tests passed including qt and cairo device driver tests, but when looking at detailed results some missing circular symbol issues were discovered for the pscairo results. We don't understand this issue because the cairo devices give both superb and reliable results on our Linux platforms. The cairo device driver depends on a subset (e.g., pango and cairo) of the GTK+ stack of libraries. These results were obtained for GTK+ version 2.18.5. * (Werner Smekal) Mac OS X 10.7.1, XCode 4.1 platform that is lightly loaded (e.g., GTK+ but no Qt4) gave mixed results for ctest and the test_noninteractive target for the shared library/dynamic device drivers case. The build worked without issues, and also everything but cairo devices at run time. However, all cairo device results had major run-time errors (e.g., segfaults). In this case the GTK+ library was newer than we have tested before (version 2.24 from the Homebrew packaging effort as compared to 2.21 that gives such good results on Linux) so there may be a mismatch between our cairo device driver and this newer version of GTK+ that needs to be sorted out. 1. Changes relative to PLplot 5.9.8 (the previous development release) No notable new features. This is a bug fix release. See the above announcements. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already available in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an official PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared PLplot library is built. 2.24 Documentation updates The DocBook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for PLplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make Fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 2.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 2.36 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our colour palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 2.37 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current colour map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. 2.38 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 2.39 Custom axis labeling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labeling geographic coordinates in degrees North, South, East and West. 2.40 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 2.41 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbitrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t structure of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 2.42 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). 2.42 Alpha value support for plotting in memory. The function plsmema() was added to the PLplot API. This allows the user to supply a RGBA formatted array that PLplot can use to do in memory plotting with alpha value support. At present only the memcairo device is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. 2.43 Add a Qt device for in memory plotting. A new device called memqt has been added for in memory plotting using Qt. This device is the Qt equivalent of the memcairo device. 2.44 Add discrete legend capability. A new routine called pllegend has been added to our core C API. (N.B. This is an experimental API that may be subject to further change as we gain more experience with it.) This routine creates a discrete plot legend with a plotted box, line, and/or line of symbols for each annotated legend entry. The arguments of pllegend provide control over the location and size of the legend within the current subpage as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage 2.45 Add full bindings and examples for the D language. As of release 5.9.5 we added full bindings and examples for the D language. The results for the D examples are generally consistent with the corresponding C examples which helps to verify the D bindings. Since the release of 5.9.5 it has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). 2.46 The plstring and plstring3 functions have been added The plstring function largely supersedes plpoin and plsym because many(!) more glyphs are accessible with plstring. The glyph is specified with a PLplot user string. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph. Standard examples 4 and 26 use plstring. The plstring3 function largely supersedes plpoin3 for the same (access to many more glyphs) reasons. Standard example 18 uses plstring3. 2.47 The pllegend API has been finalized The function pllegend allows users to create a discrete plot legend with a plotted colored box, line, and/or line of symbols for each annotated legend entry. The pllegend function was first made available for 5.9.7. Due to feedback from early adopters of pllegend, we have now added substantially to the pllegend capabilities. and we now believe pllegend is ready for prime time. The pllegend capabilities are documented in our DocBook documentation and demonstrated in standard examples 4, 26, and 33. N.B. The current set of changes required a backwards-incompatible change to the pllegend API. This requires users who tried this new functionality for 5.9.7 to reprogramme their pllegend calls. Since the pllegend API was labelled experimental for 5.9.7, we will not be bumping the soversions of the affected PLplot libraries. 2.48 Octave bindings now implemented with swig Octave is a powerful platform that demands a first-class PLplot solution, but we were finding it difficult to realize that goal because we were running up against limitations of the previous matwrap-generated Octave bindings. Accordingly, a swig-generated version of the Octave bindings has now been implemented that builds on the prior matwrapped bindings effort but also extends it with, e.g., bindings for plstring, plstring3, pllegend, and plcolorbar. These new octave bindings (which now completely replace the prior matwrapped bindings) make it possible to run examples 4, 18, 26, and 33 (all of which have now have been updated to use those functions) and get consistent results with the corresponding C examples. Like the matwrapped bindings before it, the new swig-generated octave bindings currently do not have a number of the PLplot functions wrapped (e.g., "plmap") that are needed by standard example 19. However, because of the power of swig we now have some confidence we can solve this issue in the future. 2.49 Documentation redone for our swig-generated Python and Octave bindings Through the docstring %feature, swig can generate documentation strings for certain of the languages it supports (currently Python, Octave, and Ruby). We have now removed all such hand-crafted swig documentation data from bindings/swig-support/plplotcapi.i and replaced it with generated documentation in the file bindings/swig-support/swig_documentation.i. That file is generated from doc/docbook/src/api.xml using the perl script doc/docbook/bin/api2swigdoc.pl. The build system Unix target "check_swig_documentation" now runs that script and compares results with bindings/swig-support/swig_documentation.i in the source tree to make sure that latter file is consistent with any changes that might have occurred in doc/docbook/src/api.xml. The resulting Octave and Python user-documentation (obtained by 'help ' in Octave and 'print ("%s" % .__doc__)' in Python is much more detailed than what was available before using the hand-crafted documentation. If we ever decided to generate PLplot bindings for Ruby with swig, this high-quality user-documentation would be available for that language as well. 2.50 Support large polygons Previous releases had an implicit limitation with respect to the number of vertices in a polygon. This was due to the use of statically defined arrays (to avoid allocating and freeing memory for each polygon to be drawn). Jos Luis Garca Pallero found this limitation and provided patches to eliminate this limitation. The strategy is that for small polygons, the original statically defined arrays are used and for large polygons new arrays are allocated and freed. This strategy has been applied to all relevant source files. 2.51 Complete set of PLplot parameters now available for Fortran The #defines in bindings/swig-support/plplotcapi.i (which are consistent with those in include/plplot.h) define the complete set of important PLplot constants (whose names typically start with "PL_"). We have implemented automatic methods of transforming that complete set of #defines into Fortran parameters that can be used from either Fortran 77 or Fortran 95. For Fortran 77, the user must insert an include 'plplot_parameters.h' statement in every function/subroutine/main programme where he expects to use PLplot constants (whose names typically start with "PL_". (See examples/f77/*.fm4 for examples of this method). When compiling he must also insert the appropriate -I option to find this file (in bindings/f77/ in the source tree and currently in $prefix/lib/fortran/include/plplot$version in the install tree although that install location may be subject to change). Note, the above method does not interfere with existing apps which have necessarily been forced to define the needed PLplot constants for themselves. But for future f77 use, the above statement is more convenient and much less subject to error than a whole bunch of parameter statements for the required constants. For Fortran 95, the complete set of parameters are made available as part of the plplot module. So access to this complete set of parameters is automatic wherever the "use plplot" statement is used. This is extremely convenient for new Fortran 95 apps that use PLplot, but, in general, changes will have to be made for existing apps. (See announcement XX above for the details). 2.52 The plarc function has been added The plarc function allows drawing filled and outlined arcs in PLplot. Standard example 3 uses plarc. PLplot Release 5.9.8 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file or on our bugtracker, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bugtracker at http://sourceforge.net/tracker/?group_id=2915&atid=102915. Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Official Notices for Users. (5.9.8) For unicode-aware devices we now follow what is done for the Hershey font case for epsilon, theta, and phi. This means the #ge, #gh, and #gf escapes now give users the Greek lunate epsilon, the ordinary Greek lower case theta, and the Greek symbol phi for Unicode fonts just like has occurred since the dawn of PLplot history for the Hershey font case. Previously these legacy escapes were assigned to ordinary Greek lower-case epsilon, the Greek symbol theta (= script theta), and the ordinary Greek lower case phi for unicode fonts inconsistently with what occurred for Hershey fonts. This change gets rid of this inconsistency, that is the #g escapes should give the best unicode approximation to the Hershey glyph result that is possible for unicode-aware devices. In general we encourage users of unicode-aware devices who might dislike the Greek glyph Hershey-lookalike choices they get with the legacy #g escapes to use instead either PLplot unicode escapes (e.g., "#[0x03b5]" for ordinary Greek lower-case epsilon, see page 3 of example 23) or better yet, UTF-8 strings (e.g., "ε") to specify exactly what unicode glyph they want. (5.9.8) The full set of PLplot constants have been made available to our Fortran 95 users as part of the plplot module. This means those users will have to remove any parameter statements where they have previously defined the PLplot constants (whose names typically start with "PL_" for themselves. For a complete list of the affected constants, see the #defines in swig-support/plplotcapi.i which are used internally to help generate the plplot module. See also Index item 2.51 below. (5.9.8) There has been widespread const modifier changes in the API for libplplotd and libplplotcxxd. Those backwards-incompatible API changes are indicated in the usual way by a soversion bump in those two libraries which will force all apps and libraries that depend on those two libraries to be rebuilt. Specifically, we have changed the following arguments in the C library (libplplotd) case type * name1 ==> const type * name1 type * name2 ==> const type ** name2 and the following arguments in the C++ library (libplplotcxxd) case type * name1 ==> const type * name1 type * name1 ==> const type * const * name2 where name1 is the name of a singly dimensioned array whose values are not changed internally by the PLplot libraries and name2 is the name of a doubly dimensioned array whose values are not changed internally by the PLplot libraries. The general documentation and safety justification for such const modifier changes to our API is given in http://www.cprogramming.com/tutorial/const_correctness.html. Essentially, the above const modifier changes constitute our guarantee that the associated arrays are not changed internally by the PLplot libraries. Although it is necessary to rebuild all apps and libraries that depend on libplplotd and/or libplplotcxxd, that rebuild should be possible with unchanged source code without build errors in all cases. For C apps and libraries (depending on libplplotd) there will be additional build warnings due to a limitation in the C standard discussed at http://c-faq.com/ansi/constmismatch.html unless all doubly dimensioned arrays (but not singly dimensioned) are explicitly cast to (const type **). However, such source code changes will not be necessary to avoid warning messages for the C++ (libplplotcxxd) change because of the double use of const in the above "const type * const * name2" change. (5.9.8) The plarc API has changed in release 5.9.8. The plarc API now has a rotation parameter which will eventually allow for rotated arcs. PLplot does not currently support rotated arcs, but the plarc function signature has been modified to avoid changing the API when this functionality is added. (5.9.6) We have retired the pbm driver containing the pbm (actually portable pixmap) file device. This device is quite primitive and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It also has a serious run-time issue with example 2 (double free detected by glibc) which probably indicates some fundamental issue with the 100 colours in cmap0 for that example. For those who really need portable pixmap results, we suggest using the ImageMagick convert programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap results from our best png device results. (5.9.6) We have retired the linuxvga driver containing the linuxvga interactive device. This device is quite primitive, difficult to test, and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It is Linux only, can only be run as root, and svgalib (the library used by linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. All of these characteristics make it difficult to even test this device much less use it for anything serious. Finally, it has had a well-known issue for years (incorrect colours) which has never been fixed indicating nobody is interested in maintaining this device. (5.9.6) We have retired our platform support of djgpp that used to reside in sys/dos/djgpp. The developer (Andrew Roach) who used to maintain those support files for djgpp feels that the djgpp platform is no longer actively developed, and he no longer uses djgpp himself. (5.9.6) We have changed plpoin results for ascii codes 92, 94, and 95 from centred dot, degree symbol, and centred dot glyphs to the correct backslash, caret, and underscore glyphs that are associated with those ascii indices. This change is consistent with the documentation of plpoin and solves a long-standing issue with backslash, caret, and underscore ascii characters in character strings used for example by pl[mp]tex. Those who need access to a centred dot with plpoin should use index 1. The degree symbol is no longer accessible with plpoin, but it is available in ordinary text input to PLplot as Hershey escape "#(718)", where 718 is the Hershey index of the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". (5.9.6) We have retired the gcw device driver and the related gnome2 and pygcw bindings since these are unmaintained and there are good replacements. These components of PLplot were deprecated as of release 5.9.3. A good replacement for the gcw device is either the xcairo or qtwidget device. A good replacement for the gnome2 bindings is the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo). A good replacement for pygcw is our new pyqt4 bindings for PLplot. (5.9.6) We have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. (5.9.5) We have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). (5.9.5) The only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing re-implementation for details. (5.9.5) We have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. (5.9.4) We have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. (5.9.3) Our build system requires CMake version 2.6.0 or higher. (5.9.3) We have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. (5.9.3) We have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. (5.9.3) We have re-enabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. (5.9.2) We have set HAVE_PTHREAD (now called PL_HAVE_PTHREAD as of release 5.9.8) to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. (5.9.1) We have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. (5.9.1) We no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. (5.9.1) We have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. INDEX -1. Important changes we should have mentioned in previous release announcements. -1.1 Add full bindings and examples for the D language. 0. Tests made for release 5.9.8 1. Changes relative to PLplot 5.9.7 (the previous development release) 1.1 The plstring and plstring3 functions have been added 1.2 The pllegend API has been finalized 1.3 Octave bindings now implemented with swig 1.4 Documentation redone for our swig-generated Python and Octave bindings 1.5 Support large polygons 1.6 Complete set of PLplot parameters now available for Fortran 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device 2.10 Improvements to the cairo driver family 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 2.33 PyQt changes 2.34 Color Palettes 2.35 Re-implementation of a "soft landing" when a bad/missing compiler is detected 2.36 Make PLplot aware of LC_NUMERIC locale 2.37 Linear gradients have been implemented 2.38 Cairo Windows driver implemented 2.39 Custom axis labeling implemented 2.40 Universal coordinate transform implemented 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements 2.42 Alpha value support for plotting in memory. 2.43 Add a Qt device for in memory plotting. 2.44 Add discrete legend capability. 2.45 Add full bindings and examples for the D language. 2.46 The plstring and plstring3 functions have been added 2.47 The pllegend API has been finalized 2.48 Octave bindings now implemented with swig 2.49 Documentation redone for our swig-generated Python and Octave bindings 2.50 Support large polygons 2.51 Complete set of PLplot parameters now available for Fortran 2.52 The plarc function has been added -1. Important changes we should have mentioned in previous release announcements. -1.1 Add full bindings and examples for the D language. As of release 5.9.5 we added full bindings and examples for the D language. The results for the D examples are generally consistent with the corresponding C examples which helps to verify the D bindings. Since the release of 5.9.5 it has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). 0. Tests made for release 5.9.8 See http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports for a summary table of all testing done for PLplot-5.9.8. 1. Changes relative to PLplot 5.9.7 (the previous development release) 1.1 The plstring and plstring3 functions have been added The plstring function largely supersedes plpoin and plsym because many(!) more glyphs are accessible with plstring. The glyph is specified with a PLplot user string. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph. Standard examples 4 and 26 use plstring. The plstring3 function largely supersedes plpoin3 for the same (access to many more glyphs) reasons. Standard example 18 uses plstring3. 1.2 The pllegend API has been finalized The function pllegend allows users to create a discrete plot legend with a plotted colored box, line, and/or line of symbols for each annotated legend entry. The pllegend function was first made available for 5.9.7. Due to feedback from early adopters of pllegend, we have now added substantially to the pllegend capabilities. and we now believe pllegend is ready for prime time. The pllegend capabilities are documented in our docbook documentation and demonstrated in standard examples 4, 26, and 33. N.B. The current set of changes required a backwards-incompatible change to the pllegend API. This requires users who tried this new functionality for 5.9.7 to reprogramme their pllegend calls. Since the pllegend API was labelled experimental for 5.9.7, we will not be bumping the soversions of the affected PLplot libraries. 1.3 Octave bindings now implemented with swig Octave is a powerful platform that demands a first-class PLplot solution, but we were finding it difficult to realize that goal because we were running up against limitations of the previous matwrap-generated Octave bindings. Accordingly, a swig-generated version of the Octave bindings has now been implemented that builds on the prior matwrapped bindings effort but also extends it with, e.g., bindings for plstring, plstring3, pllegend, and plcolorbar. These new octave bindings (which now completely replace the prior matwrapped bindings) make it possible to run examples 4, 18, 26, and 33 (all of which have now have been updated to use those functions) and get consistent results with the corresponding C examples. Like the matwrapped bindings before it, the new swig-generated octave bindings currently do not have a number of the PLplot functions wrapped (e.g., "plmap") that are needed by standard example 19. However, because of the power of swig we now have some confidence we can solve this issue in the future. 1.4 Documentation redone for our swig-generated Python and Octave bindings Through the docstring %feature, swig can generate documentation strings for certain of the languages it supports (currently Python, Octave, and Ruby). We have now removed all such hand-crafted swig documentation data from bindings/swig-support/plplotcapi.i and replaced it with generated documentation in the file bindings/swig-support/swig_documentation.i. That file is generated from doc/docbook/src/api.xml using the perl script doc/docbook/bin/api2swigdoc.pl. The build system Unix target "check_swig_documentation" now runs that script and compares results with bindings/swig-support/swig_documentation.i in the source tree to make sure that latter file is consistent with any changes that might have occurred in doc/docbook/src/api.xml. The resulting Octave and Python user-documentation (obtained by 'help ' in Octave and 'print ("%s" % .__doc__)' in Python is much more detailed than what was available before using the hand-crafted documentation. If we ever decided to generate PLplot bindings for Ruby with swig, this high-quality user-documentation would be available for that language as well. 1.5 Support large polygons Previous releases had an implicit limitation with respect to the number of vertices in a polygon. This was due to the use of statically defined arrays (to avoid allocating and freeing memory for each polygon to be drawn). Jos Luis Garca Pallero found this limitation and provided patches to eliminate this limitation. The strategy is that for small polygons, the original statically defined arrays are used and for large polygons new arrays are allocated and freed. This strategy has been applied to all relevant source files. 1.6 Complete set of PLplot parameters now available for Fortran The #defines in bindings/swig-support/plplotcapi.i (which are consistent with those in include/plplot.h) define the complete set of important PLplot constants (whose names typically start with "PL_"). We have implemented automatic methods of transforming that complete set of #defines into Fortran parameters that can be used from either Fortran 77 or Fortran 95. For Fortran 77, the user must insert an include 'plplot_parameters.h' statement in every function/subroutine/main programme where he expects to use PLplot constants (whose names typically start with "PL_". (See examples/f77/*.fm4 for examples of this method). When compiling he must also insert the appropriate -I option to find this file (in bindings/f77/ in the source tree and currently in $prefix/lib/fortran/include/plplot$version in the install tree although that install location may be subject to change). Note, the above method does not interfere with existing apps which have necessarily been forced to define the needed PLplot constants for themselves. But for future f77 use, the above statement is more convenient and much less subject to error than a whole bunch of parameter statements for the required constants. For Fortran 95, the complete set of parameters are made available as part of the plplot module. So access to this complete set of parameters is automatic wherever the "use plplot" statement is used. This is extremely convenient for new Fortran 95 apps that use PLplot, but, in general, changes will have to be made for existing apps. (See announcement XX above for the details). 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already available in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an official PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared PLplot library is built. 2.24 Documentation updates The DocBook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for PLplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 2.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 2.36 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our colour palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 2.37 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current colour map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. 2.38 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 2.39 Custom axis labeling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labeling geographic coordinates in degrees North, South, East and West. 2.40 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 2.41 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbtrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t stucture of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 2.42 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). 2.42 Alpha value support for plotting in memory. The function plsmema() was added to the PLplot API. This allows the user to supply a RGBA formatted array that PLplot can use to do in memory plotting with alpha value support. At present only the memcairo device is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. 2.43 Add a Qt device for in memory plotting. A new device called memqt has been added for in memory plotting using Qt. This device is the Qt equivalent of the memcairo device. 2.44 Add discrete legend capability. A new routine called pllegend has been added to our core C API. (N.B. This is an experimental API that may be subject to further change as we gain more experience with it.) This routine creates a discrete plot legend with a plotted box, line, and/or line of symbols for each annotated legend entry. The arguments of pllegend provide control over the location and size of the legend within the current subpage as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage 2.45 Add full bindings and examples for the D language. As of release 5.9.5 we added full bindings and examples for the D language. The results for the D examples are generally consistent with the corresponding C examples which helps to verify the D bindings. Since the release of 5.9.5 it has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). 2.46 The plstring and plstring3 functions have been added The plstring function largely supersedes plpoin and plsym because many(!) more glyphs are accessible with plstring. The glyph is specified with a PLplot user string. As with plmtex and plptex, the user string can contain FCI escapes to determine the font, UTF-8 code to determine the glyph or else PLplot escapes for Hershey or unicode text to determine the glyph. Standard examples 4 and 26 use plstring. The plstring3 function largely supersedes plpoin3 for the same (access to many more glyphs) reasons. Standard example 18 uses plstring3. 2.47 The pllegend API has been finalized The function pllegend allows users to create a discrete plot legend with a plotted colored box, line, and/or line of symbols for each annotated legend entry. The pllegend function was first made available for 5.9.7. Due to feedback from early adopters of pllegend, we have now added substantially to the pllegend capabilities. and we now believe pllegend is ready for prime time. The pllegend capabilities are documented in our docbook documentation and demonstrated in standard examples 4, 26, and 33. N.B. The current set of changes required a backwards-incompatible change to the pllegend API. This requires users who tried this new functionality for 5.9.7 to reprogramme their pllegend calls. Since the pllegend API was labelled experimental for 5.9.7, we will not be bumping the soversions of the affected PLplot libraries. 2.48 Octave bindings now implemented with swig Octave is a powerful platform that demands a first-class PLplot solution, but we were finding it difficult to realize that goal because we were running up against limitations of the previous matwrap-generated Octave bindings. Accordingly, a swig-generated version of the Octave bindings has now been implemented that builds on the prior matwrapped bindings effort but also extends it with, e.g., bindings for plstring, plstring3, pllegend, and plcolorbar. These new octave bindings (which now completely replace the prior matwrapped bindings) make it possible to run examples 4, 18, 26, and 33 (all of which have now have been updated to use those functions) and get consistent results with the corresponding C examples. Like the matwrapped bindings before it, the new swig-generated octave bindings currently do not have a number of the PLplot functions wrapped (e.g., "plmap") that are needed by standard example 19. However, because of the power of swig we now have some confidence we can solve this issue in the future. 2.49 Documentation redone for our swig-generated Python and Octave bindings Through the docstring %feature, swig can generate documentation strings for certain of the languages it supports (currently Python, Octave, and Ruby). We have now removed all such hand-crafted swig documentation data from bindings/swig-support/plplotcapi.i and replaced it with generated documentation in the file bindings/swig-support/swig_documentation.i. That file is generated from doc/docbook/src/api.xml using the perl script doc/docbook/bin/api2swigdoc.pl. The build system Unix target "check_swig_documentation" now runs that script and compares results with bindings/swig-support/swig_documentation.i in the source tree to make sure that latter file is consistent with any changes that might have occurred in doc/docbook/src/api.xml. The resulting Octave and Python user-documentation (obtained by 'help ' in Octave and 'print ("%s" % .__doc__)' in Python is much more detailed than what was available before using the hand-crafted documentation. If we ever decided to generate PLplot bindings for Ruby with swig, this high-quality user-documentation would be available for that language as well. 2.50 Support large polygons Previous releases had an implicit limitation with respect to the number of vertices in a polygon. This was due to the use of statically defined arrays (to avoid allocating and freeing memory for each polygon to be drawn). Jos Luis Garca Pallero found this limitation and provided patches to eliminate this limitation. The strategy is that for small polygons, the original statically defined arrays are used and for large polygons new arrays are allocated and freed. This strategy has been applied to all relevant source files. 2.51 Complete set of PLplot parameters now available for Fortran The #defines in bindings/swig-support/plplotcapi.i (which are consistent with those in include/plplot.h) define the complete set of important PLplot constants (whose names typically start with "PL_"). We have implemented automatic methods of transforming that complete set of #defines into Fortran parameters that can be used from either Fortran 77 or Fortran 95. For Fortran 77, the user must insert an include 'plplot_parameters.h' statement in every function/subroutine/main programme where he expects to use PLplot constants (whose names typically start with "PL_". (See examples/f77/*.fm4 for examples of this method). When compiling he must also insert the appropriate -I option to find this file (in bindings/f77/ in the source tree and currently in $prefix/lib/fortran/include/plplot$version in the install tree although that install location may be subject to change). Note, the above method does not interfere with existing apps which have necessarily been forced to define the needed PLplot constants for themselves. But for future f77 use, the above statement is more convenient and much less subject to error than a whole bunch of parameter statements for the required constants. For Fortran 95, the complete set of parameters are made available as part of the plplot module. So access to this complete set of parameters is automatic wherever the "use plplot" statement is used. This is extremely convenient for new Fortran 95 apps that use PLplot, but, in general, changes will have to be made for existing apps. (See announcement XX above for the details). 2.52 The plarc function has been added The plarc function allows drawing filled and outlined arcs in PLplot. Standard example 3 uses plarc. PLplot Release 5.9.7 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file or on our bugtracker, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bugtracker at http://sourceforge.net/tracker/?group_id=2915&atid=102915. Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Official Notices for Users. I. As of release 5.9.1 we have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. II. As of release 5.9.1 we no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. III. As of release 5.9.1 we have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. IV. As of release 5.9.2 we have set HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. V. As of release 5.9.3 our build system requires CMake version 2.6.0 or higher. VI. As of release 5.9.3 we have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. N.B. This announcement has been superseded by the subsequent retirement of gcw, gnome2, and pygcw, see announcement XVII. VII. As of release 5.9.3 we have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. VIII. As of release 5.9.3 we have re-enabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. IX. As of release 5.9.4 we have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. X. As of release 5.9.5 we have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). XI. As of release 5.9.5 the only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing re-implementation for details. XII. As of release 5.9.5 we have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. XIII. As of release 5.9.6 we have retired the pbm driver containing the pbm (actually portable pixmap) file device. This device is quite primitive and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It also has a serious run-time issue with example 2 (double free detected by glibc) which probably indicates some fundamental issue with the 100 colours in cmap0 for that example. For those who really need portable pixmap results, we suggest using the ImageMagick convert programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap results from our best png device results. XIV. As of release 5.9.6 we have retired the linuxvga driver containing the linuxvga interactive device. This device is quite primitive, difficult to test, and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It is Linux only, can only be run as root, and svgalib (the library used by linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. All of these characteristics make it difficult to even test this device much less use it for anything serious. Finally, it has had a well-known issue for years (incorrect colours) which has never been fixed indicating nobody is interested in maintaining this device. XV. As of release 5.9.6 we have retired our platform support of djgpp that used to reside in sys/dos/djgpp. The developer (Andrew Roach) who used to maintain those support files for djgpp feels that the djgpp platform is no longer actively developed, and he no longer uses djgpp himself. XVI. As of release 5.9.6 plpoin results for ascii codes 92, 94, and 95 are changed from centred dot, degree symbol, and centred dot glyphs to the correct backslash, caret, and underscore glyphs that are associated with those ascii indices. This change is consistent with the documentation of plpoin and solves a long-standing issue with backslash, caret, and underscore ascii characters in character strings used for example by pl[mp]tex. Those who need access to a centred dot with plpoin should use index 1. The degree symbol is no longer accessible with plpoin, but it is available in ordinary text input to PLplot as Hershey escape "#(718)", where 718 is the Hershey index of the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". XVII. As of release 5.9.6 we have retired the gcw device driver and the related gnome2 and pygcw bindings since these are unmaintained and there are good replacements. These components of PLplot were deprecated as of release 5.9.3. A good replacement for the gcw device is either the xcairo or qtwidget device. A good replacement for the gnome2 bindings is the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo). A good replacement for pygcw is our new pyqt4 bindings for PLplot. XVIII. As of release 5.9.6 we have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. XVIV. It has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). INDEX 0. Tests made for release 5.9.7 1. Changes relative to PLplot 5.9.6 (the previous development release) 1.1 Alpha value support for plotting in memory. 1.2 Add a Qt device for in memory plotting. 1.3 Add discrete legend capability. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device 2.10 Improvements to the cairo driver family 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 2.33 PyQt changes 2.34 Color Palettes 2.35 Re-implementation of a "soft landing" when a bad/missing compiler is detected 2.36 Make PLplot aware of LC_NUMERIC locale 2.37 Linear gradients have been implemented 2.38 Cairo Windows driver implemented 2.39 Custom axis labeling implemented 2.40 Universal coordinate transform implemented 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements 2.42 Alpha value support for plotting in memory. 2.43 Add a Qt device for in memory plotting. 2.44 Add discrete legend capability. 0. Tests made for release 5.9.7 See http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports for a summary table of all testing done for PLplot-5.9.7. 1. Changes relative to PLplot 5.9.6 (the previous development release) 1.1 Alpha value support for plotting in memory. The function plsmema() was added to the PLplot API. This allows the user to supply a RGBA formatted array that PLplot can use to do in memory plotting with alpha value support. At present only the memcairo device is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. 1.2 Add a Qt device for in memory plotting. A new device called memqt has been added for in memory plotting using Qt. This device is the Qt equivalent of the memcairo device. 1.3 Add discrete legend capability. A new routine called pllegend has been added to our core C API. (N.B. This is an experimental API that may be subject to further change as we gain more experience with it.) This routine creates a discrete plot legend with a plotted box, line, and/or line of symbols for each annotated legend entry. The arguments of pllegend provide control over the location and size of the legend within the current subpage as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already available in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an official PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared PLplot library is built. 2.24 Documentation updates The DocBook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for PLplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 2.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 2.36 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our colour palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 2.37 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current colour map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. 2.38 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 2.39 Custom axis labeling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labeling geographic coordinates in degrees North, South, East and West. 2.40 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 2.41 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbtrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t stucture of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 2.42 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). 2.42 Alpha value support for plotting in memory. The function plsmema() was added to the PLplot API. This allows the user to supply a RGBA formatted array that PLplot can use to do in memory plotting with alpha value support. At present only the memcairo device is capable of using RGBA formatted memory. The mem device, at least for the time being, only supports RGB formatted memory and will exit if the user attempts to give it RGBA formatted memory to plot in. 2.43 Add a Qt device for in memory plotting. A new device called memqt has been added for in memory plotting using Qt. This device is the Qt equivalent of the memcairo device. 2.44 Add discrete legend capability. A new routine called pllegend has been added to our core C API. (N.B. This is an experimental API that may be subject to further change as we gain more experience with it.) This routine creates a discrete plot legend with a plotted box, line, and/or line of symbols for each annotated legend entry. The arguments of pllegend provide control over the location and size of the legend within the current subpage as well as the location and characteristics of the elements (most of which are optional) within that legend. The resulting legend is clipped at the boundaries of the current subpage PLplot Release 5.9.6 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file or on our bugtracker, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 (preferred) or on our bugtracker at http://sourceforge.net/tracker/?group_id=2915&atid=102915. Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Official Notices for Users. I. As of release 5.9.1 we have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. II. As of release 5.9.1 we no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. III. As of release 5.9.1 we have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. IV. As of release 5.9.2 we have set HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. V. As of release 5.9.3 our build system requires CMake version 2.6.0 or higher. VI. As of release 5.9.3 we have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. N.B. This announcement has been superseded by the subsequent retirement of gcw, gnome2, and pygcw, see announcement XVII. VII. As of release 5.9.3 we have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. VIII. As of release 5.9.3 we have re-enabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. IX. As of release 5.9.4 we have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. X. As of release 5.9.5 we have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). XI. As of release 5.9.5 the only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing re-implementation for details. XII. As of release 5.9.5 we have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. XIII. As of release 5.9.6 we have retired the pbm driver containing the pbm (actually portable pixmap) file device. This device is quite primitive and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It also has a serious run-time issue with example 2 (double free detected by glibc) which probably indicates some fundamental issue with the 100 colours in cmap0 for that example. For those who really need portable pixmap results, we suggest using the ImageMagick convert programme, e.g., "convert examples/x24c01.pngqt test.ppm" or "convert examples/x24c01.pngcairo test.ppm" to produce good-looking portable pixmap results from our best png device results. XIV. As of release 5.9.6 we have retired the linuxvga driver containing the linuxvga interactive device. This device is quite primitive, difficult to test, and poorly maintained. It ignores unicode fonts (i.e., uses the Hershey font fallback), falls back to ugly software fills, doesn't support alpha transparency, etc. It is Linux only, can only be run as root, and svgalib (the library used by linuxsvga) is not supported by some mainstream (e.g., Intel) chipsets. All of these characteristics make it difficult to even test this device much less use it for anything serious. Finally, it has had a well-known issue for years (incorrect colours) which has never been fixed indicating nobody is interested in maintaining this device. XV. As of release 5.9.6 we have retired our platform support of djgpp that used to reside in sys/dos/djgpp. The developer (Andrew Roach) who used to maintain those support files for djgpp feels that the djgpp platform is no longer actively developed, and he no longer uses djgpp himself. XVI. As of release 5.9.6 plpoin results for ascii codes 92, 94, and 95 are changed from centred dot, degree symbol, and centred dot glyphs to the correct backslash, caret, and underscore glyphs that are associated with those ascii indices. This change is consistent with the documentation of plpoin and solves a long-standing issue with backslash, caret, and underscore ascii characters in character strings used for example by pl[mp]tex. Those who need access to a centred dot with plpoin should use index 1. The degree symbol is no longer accessible with plpoin, but it is available in ordinary text input to PLplot as Hershey escape "#(718)", where 718 is the Hershey index of the degree symbol, unicode escape "#[0x00B0]" where 0x00B0 is the unicode index for the degree symbol or direct UTF8 unicode string "°". XVII. As of release 5.9.6 we have retired the gcw device driver and the related gnome2 and pygcw bindings since these are unmaintained and there are good replacements. These components of PLplot were deprecated as of release 5.9.3. A good replacement for the gcw device is either the xcairo or qtwidget device. A good replacement for the gnome2 bindings is the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo). A good replacement for pygcw is our new pyqt4 bindings for PLplot. XVIII. As of release 5.9.6 we have deprecated support for the python Numeric array extensions. Numeric is no longer maintained and users of Numeric are advised to migrate to numpy. Numpy has been the standard for PLplot for some time. If numpy is not present PLplot will now disable python by default. If you still require Numeric support in the short term then set USE_NUMERIC to ON in cmake. The PLplot support for Numeric will be dropped in a future release. XVIV. It has come to our attention that the version of gdc supplied with several recent versions of Ubuntu has a very serious bug on 64-bit systems (see https://bugs.launchpad.net/ubuntu/+source/gdc-4.2/+bug/235955) which causes several of the plplot D examples to crash. If this affects you, you are recommended to disable the d bindings or switch to an alternative d compiler (the Digital Mars compiler is reported to be good). INDEX 0. Tests made for release 5.9.6 1. Changes relative to PLplot 5.9.5 (the previous development release) 1.1 Make PLplot aware of LC_NUMERIC locale 1.2 Linear gradients have been implemented 1.3 Cairo Windows driver implemented 1.4 Custom axis labeling implemented 1.5 Universal coordinate transform implemented 1.6 Support for arbitrary storage of 2D user data 1.7 Font improvements 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device 2.10 Improvements to the cairo driver family 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 2.33 PyQt changes 2.34 Color Palettes 2.35 Re-implementation of a "soft landing" when a bad/missing compiler is detected 2.36 Make PLplot aware of LC_NUMERIC locale 2.37 Linear gradients have been implemented 2.38 Cairo Windows driver implemented 2.39 Custom axis labeling implemented 2.40 Universal coordinate transform implemented 2.41 Support for arbitrary storage of 2D user data 2.42 Font improvements 0. Tests made for release 5.9.6 See http://www.miscdebris.net/plplot_wiki/index.php?title=Testing_PLplot#Testing_Reports for a summary table of all testing done for PLplot-5.9.6. 1. Changes relative to PLplot 5.9.5 (the previous development release) 1.1 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our colour palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 1.2 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current colour map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. 1.3 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 1.4 Custom axis labeling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labeling geographic coordinates in degrees North, South, East and West. 1.5 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 1.6 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbtrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t stucture of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 1.7 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already available in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an official PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in PLplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in PLplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core PLplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared PLplot library is built. 2.24 Documentation updates The DocBook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for PLplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 2.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplot's color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplot's color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on Linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 2.36 Make PLplot aware of LC_NUMERIC locale For POSIX-compliant systems, locale is set globally so any external applications or libraries that use the PLplot library or any external libraries used by the PLplot library or PLplot device drivers could potentially change the LC_NUMERIC locale used by PLplot to anything those external applications and libraries choose. The principal consequence of such choice is the decimal separator could be a comma (for some locales) rather than the period assumed for the "C" locale. For previous versions of PLplot a comma decimal separator would have lead to a large number of errors, but this issue is now addressed with a side benefit that our plots now have the capability of displaying the comma (e.g., in axis labels) for the decimal separator for those locales which require that. If you are not satisfied with the results for the default PLplot locale set by external applications and libraries, then you can now choose the LC_NUMERIC locale for PLplot by (a) specifying the new -locale command-line option for PLplot (if you do not specify that option, a default locale is chosen depending on applications and libraries external to PLplot (see comments above), and (b) setting an environment variable (LC_ALL, LC_NUMERIC, or LANG on Linux, for example) to some locale that has been installed on your system. On Linux, to find what locales are installed, use the "locale -a" option. The "C" locale is always installed, but usually there is also a principal locale that works on a platform such as en_US.UTF8, nl_NL.UTF8, etc. Furthermore, it is straightforward to build and install any additional locale you desire. (For example, on Debian Linux you do that by running "dpkg-reconfigure locales".) Normally, users will not use the -locale option since the period decimal separator that you get for the normal LC_NUMERIC default "C" locale used by external applications and libraries is fine for their needs. However, if the resulting decimal separator is not what the user wants, then they would do something like the following to (a) use a period decimal separator for command-line input and plots: LC_ALL=C examples/c/x09c -locale -dev psc -o test.psc -ori 0.5 or (b) use a comma decimal separator for command-line input and plots: LC_ALL=nl_NL.UTF8 examples/c/x09c -locale -dev psc -o test.psc -ori 0,5 N.B. in either case if the wrong separator is used for input (e.g., -ori 0,5 in the first case or -ori 0.5 in the second) the floating-point conversion (using atof) is silently terminated at the wrong separator for the locale, i.e., the fractional part of the number is silently dropped. This is obviously not ideal, but on the other hand there are relatively few floating-point command-line options for PLplot, and we also expect those who use the -locale option to specifically ask for a given separator for plots (e.g., axis labels) will then use it for command-line input of floating-point values as well. Certain critical areas of the PLplot library (e.g., our colour palette file reading routines and much of the code in our device drivers) absolutely require a period for the decimal separator. We now protect those critical areas by saving the normal PLplot LC_NUMERIC locale (established with the above -locale option or by default by whatever is set by external applications or libraries), setting the LC_NUMERIC "C" locale, executing the critical code, then restoring back to the normal PLplot LC_NUMERIC locale. Previous versions of PLplot did not have this protection of the critical areas so were vulnerable to default LC_NUMERIC settings of external applications that resulted in a comma decimal separator that did not work correctly for the critical areas. 2.37 Linear gradients have been implemented The new plgradient routine draws a linear gradient (based on the current colour map 1) at a specified angle with the x axis for a specified polygon. Standard examples 25 and 30 now demonstrate use of plgradient. Some devices use a software fallback to render the gradient. This fallback is implemented with plshades which uses a series of rectangles to approximate the gradient. Tiny alignment issues for those rectangles relative to the pixel grid may look problematic for transparency gradients. To avoid that issue, we try to use native gradient capability whenever that is possible for any of our devices. Currently, this has been implemented for our svg, qt, and cairo devices. The result is nice-looking smooth transparency gradients for those devices, for, e.g., example 30, page 2. 2.38 Cairo Windows driver implemented A cairo Windows driver has been implemented. This provides an interactive cairo driver for Windows similar to xcairo on Linux. Work to improve its functionality is ongoing. 2.39 Custom axis labeling implemented Axis text labels can now be customized using the new plslabelfunc function. This allows a user to specify what text should be draw at a given position along a plot axis. Example 19 has been updated to illustrate this function's use through labeling geographic coordinates in degrees North, South, East and West. 2.40 Universal coordinate transform implemented A custom coordinate transformation function can be set using plstransform. This transformation function affects all subsequent plot function calls which work with plot window coordinates. Testing and refinement of this support is ongoing. 2.41 Support for arbitrary storage of 2D user data This improvement courtesy of David MacMahon adds support for arbitrary storage of 2D user data. This is very similar to the technique employed by some existing functions (e.g. plfcont and plfshade) that use "evaluator" functions to access 2D user data that is stored in an arbtrary format. The new approach extends the concept of a user-supplied (or predefined) "evaluator" function to a group of user-supplied (or predefined) "operator" functions. The operator functions provide for various operations on the arbitrarily stored 2D data including: get, set, +=, -=, *=, /=, isnan, minmax, and f2eval. To facilitate the passing of an entire family of operator functions (via function pointers), a plf2ops_t structure is defined to contain a pointer to each type of operator function. Predefined operator functions are defined for several common 2D data storage techniques. Variables (of type plf2ops_t) containing function pointers for these operator functions are also defined. New variants of functions that accept 2D data are created. The new variants accept the 2D data as two parameters: a pointer to a plf2ops_t structure containing (pointers to) suitable operator functions and a PLPointer to the actual 2D data store. Existing functions that accept 2D data are modified to simply pass their parameters to the corresponding new variant of the function, along with a pointer to the suitable predefined plf2ops_t stucture of operator function pointers. The list of functions for which new variants are created is: c_plimage, c_plimagefr, c_plmesh, c_plmeshc, c_plot3d, c_plot3dc, c_plot3dcl, c_plshade1, c_plshades, c_plsurf3d, and c_plsurf3dl, and c_plgriddata. The new variants are named the same as their corresponding existing function except that the "c_" prefix is changed to "plf" (e.g. the new variant of c_plmesh is called plfmesh). Adds plfvect declaration to plplot.h and changes the names (and only the names) of some plfvect arguments to make them slightly clearer. In order to maintain backwards API compatibility, this function and the other existing functions that use "evaluator" functions are NOT changed to use the new operator functions. Makes plplot.h and libplplot consistent vis-a-vis pltr0f and pltr2d. Moves the definitions of pltr2f (already declared in plplot.h) from the sccont.c files of the FORTRAN 77 and Fortran 95 bindings into plcont.c. Removes pltr0f declaration from plplot.h. Changes x08c.c to demonstrate use of new support for arbitrary storage of 2D data arrays. Shows how to do surface plots with the following four types of 2D data arrays: 1) PLFLT z[nx][ny]; 2) PLfGrid2 z; 3) PLFLT z[nx*ny]; /* row major order */ 4) PLFLT z[nx*ny]; /* column major order */ 2.42 Font improvements We have added the underscore to the Hershey glyphs (thanks to David MacMahon) and slightly rearranged the ascii index to the Hershey indices so that plpoin now generates the complete set of printable ascii characters in the correct order for the Hershey fonts (and therefore the Type1 and TrueType fonts as well). We have improved how we access TrueType and Type1 fonts via the Hershey font index (used by plpoin, plsym, and the Hershey escape sequences in pl*tex commands). We have added considerably to the Hershey index to Unicode index translation table both for the compact and extended Hershey indexing scheme, and we have adopted the standard Unicode to Type1 index translation tables from http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/. We have also dropped the momentary switch to symbol font that was implemented in the PLplot core library. That switch was designed to partially compensate for the lack of symbol glyphs in the standard Type1 fonts. That was a bad design because it affected TrueType font devices as well as the desired Type1 font devices. To replace this bad idea we now change from Type1 standard fonts to the Type1 Symbol font (and vice versa) whenever there is a glyph lookup failure in the Type1 font device drivers (ps and pdf). PLplot Release 5.9.5 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Official Notices for Users. I. As of release 5.9.1 we have removed our previously deprecated autotools-based build system. Instead, use the CMake-based build system following the directions in the INSTALL file. II. As of release 5.9.1 we no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. III. As of release 5.9.1 we have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. IV. As of release 5.9.2 we have set HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. V. As of release 5.9.3 our build system requires CMake version 2.6.0 or higher. VI. As of release 5.9.3 we have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. VII. As of release 5.9.3 we have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. VIII. As of release 5.9.3 we have reenabled the tk, itk, and itcl components of PLplot by default that were disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. IX. As of release 5.9.4 we have deprecated the pbm device driver (containing the pbm device) because glibc detects a catastrophic double free. X. As of release 5.9.5 we have removed pyqt3 access to PLplot and replaced it by pyqt4 access to PLplot (see details below). XI. As of release 5.9.5 the only method of specifying a non-default compiler (and associated compiler options) that we support is the environment variable approach, e.g., export CC='gcc -g -fvisibility=hidden' export CXX='g++ -g -fvisibility=hidden' export FC='gfortran -g -fvisibility=hidden' All other CMake methods of specifying a non-default compiler and associated compiler options will not be supported until CMake bug 9220 is fixed, see discussion below of the soft-landing reimplementation for details. XII. As of release 5.9.5 we have retired the hpgl driver (containing the hp7470, hp7580, and lj_hpgl devices), the impress driver (containing the imp device), the ljii driver (containing the ljii and ljiip devices), and the tek driver (containing the conex, mskermit, tek4107, tek4107f, tek4010, tek4010f, versaterm, vlt, and xterm devices). Retirement means we have removed the build options which would allow these devices to build and install. Recent tests have shown a number of run-time issues (hpgl, impress, and ljii) or build-time issues (tek) with these devices, and as far as we know there is no more user interest in them. Therefore, we have decided to retire these devices rather than fix them. INDEX 1. Changes relative to PLplot 5.9.4 (the previous development release) 1.1 PyQt changes 1.2 Color Palettes 1.3 Reimplementation of a "soft landing" when a bad/missing compiler is detected 1.1 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 1.2 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplots color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplots color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on linux). 1.3 Reimplementation of a "soft landing" when a bad/missing compiler is detected. The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device 2.10 Improvements to the cairo driver family. 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 2.33 PyQt changes 2.34 Color Palettes 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake (with the exception of a special build script for the DJGPP platform) is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family. Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already availale in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an offical PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in plplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in plplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared plplot library is built. 2.24 Documentation updates The docbook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for plplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2.33 PyQt changes Years ago we got a donation of a hand-crafted pyqt3 interface to PLplot (some of the functions in plplot_widgetmodule.c in bindings/python) and a proof-of-concept example (prova.py and qplplot.py in examples/python), but this code did not gain any developer interest and was therefore not understood or maintained. Recently one of our core developers has implemented a sip-generated pyqt4 interface to PLplot (controlled by plplot_pyqt4.sip in bindings/qt_gui/pyqt4) that builds without problems as a python extension module, and a good-looking pyqt4 example (pyqt4_example.py in examples/python) that works well. Since this pyqt4 approach is maintained by a PLplot developer it appears to have a good future, and we have therefore decided to concentrate on pyqt4 and remove the pyqt3 PLplot interface and example completely. 2.34 Color Palettes Support has been added to PLplot for user defined color palette files. These files can be loaded at the command line using the -cmap0 or -cmap1 commands, or via the API using the plspal0 and plspal1 commands. The commands cmap0 / plspal0 are used to load cmap0 type files which specify the colors in PLplots color table 0. The commands cmap1 / plspal1 are used to load cmap1 type files which specify PLplots color table 1. Examples of both types of files can be found in either the plplot-source/data directory or the PLplot installed directory (typically /usr/local/share/plplotx.y.z/ on linux). 2.35 Reimplementation of a "soft landing" when a bad/missing compiler is detected. The PLplot core library is written in C so our CMake-based build system will error out if it doesn't detect a working C compiler. However all other compiled languages (Ada, C++, D, Fortran, Java, and OCaml) we support are optional. If a working compiler is not available, we give a "soft landing" (give a warning message, disable the optional component, and keep going). The old implementation of the soft landing was not applied consistently (C++ was unnecessarily mandatory before) and also caused problems for ccmake (a CLI front-end to the cmake application) and cmake-gui (a CMake GUI front-end to the cmake application) which incorrectly dropped languages as a result even when there was a working compiler. We now have completely reimplemented the soft landing logic. The result works well for cmake, ccmake, and cmake-gui. The one limitation of this new method that we are aware of is it only recognizes either the default compiler chosen by the generator or else a compiler specified by the environment variable approach (see Official Notice XII above). Once CMake bug 9220 has been fixed (so that the OPTIONAL signature of the enable_language command actually works without erroring out), then our soft-landing approach (which is a workaround for bug 9220) will be replaced by the OPTIONAL signature of enable_language, and all CMake methods of specifying compilers and compiler options will automatically be recognized as a result. PLplot Release 5.9.4 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Notices for Users. I. This is the official notice that our deprecated autotools-based build system has been removed as of release 5.9.1. Instead, use the CMake-based build system following the directions in the INSTALL file. II. This is official notice that we (as of 5.9.1) no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. III. This is official notice that the PLplot team have decided (as of release 5.9.1) for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. IV. This is official notice that (as of release 5.9.2) we have set HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. V. This is official notice that (as of release 5.9.3) our build system requires CMake version 2.6.0 or higher. VI. This is official notice that (as of release 5.9.3) we have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. VII. This is official notice that (as of release 5.9.3) we have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. VIII. This is official notice that the tk, itk, and itcl components of PLplot have been reenabled again by default (as of release 5.9.3) after being disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. INDEX 1. Changes relative to PLplot 5.9.3 (the previous development release) 1.1 Various bug fixes 1.2 Cairo driver improvements 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device. 2.10 Improvements to the cairo driver family. 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 2.31 Various bug fixes 2.32 Cairo driver improvements 1. Changes relative to PLplot 5.9.3 (the previous development release) 1.1 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make fortran command line argument parsing work with shared libraries on Windows 1.2 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake (with the exception of a special build script for the DJGPP platform) is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device. Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family. Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already availale in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an offical PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in plplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in plplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared plplot library is built. 2.24 Documentation updates The docbook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for plplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a new qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse (or hitting to be consistent with other PLplot interactive devices) to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overall sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 (the version we used for most of our tests) has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. One of our developers found that pdfqt was orders of magnitude slower than the other qt devices for Qt-4.4.3 on Ubuntu 8.10 installed on a 64 bit box. That problem was completely cured by moving to the downloadable Qt-4.5 version. However, we have also had good Qt-4.4.3 pdfqt reports on other platforms. One of our developers also found that all first pages of examples were black for just the qtwidget device for Qt-4.5.1 on Mac OS X. From the other improvements we see in Qt-4.5.1 relative to Qt-4.4.3 we assume this black first page for qtwidget problem also exists for Qt-4.4.3, but we haven't tested that combination. In sum, Qt-4.4.3 is worth trying if it is already installed on your machine, but if you run into any difficulty with it please switch to Qt-4.5.x (once Qt-4.5.x is installed all you have to do is to put the 4.5.x version of qmake in your path, and cmake does the rest). If the problem persists for Qt-4.5, then it is worth reporting a qt bug. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2.31 Various bug fixes Various bugs in the 5.9.3 release have been fixed including: - Include missing file needed for the aqt driver on Mac OS X - Missing library version number for nistcd - Fixes for the qt examples with dynamic drivers disabled - Fixes to several tcl examples so they work with plserver - Fix pkg-config files to work correctly with Debug / Release build types set - Make fortran command line argument parsing work with shared libraries on Windows 2.32 Cairo driver improvements Improvements to the cairo driver to give better results for bitmap formats when used with anti-aliasing file viewers. PLplot Release 5.9.3 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Notices for Users. I. This is the official notice that our deprecated autotools-based build system has been removed as of release 5.9.1. Instead, use the CMake-based build system following the directions in the INSTALL file. II. This is official notice that we (as of 5.9.1) no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. III. This is official notice that the PLplot team have decided (as of release 5.9.1) for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. IV. This is official notice that (as of release 5.9.2) we have set HAVE_PTHREAD to ON by default for all platforms other than Darwin. Darwin will follow later once it appears the Apple version of X supports it. V. This is official notice that (as of release 5.9.3) our build system requires CMake version 2.6.0 or higher. VI. This is official notice that (as of release 5.9.3) we have deprecated the gcw device driver and the related gnome2 and pygcw bindings since these are essentially unmaintained. For example, the gcw device and associated bindings still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues we advise using the xcairo device and the externally supplied XDrawable or Cairo context associated with the xcairo device and the extcairo device (see examples/c/README.cairo) instead. If you still absolutely must use -dev gcw or the related gnome2 or pygcw bindings despite the known problems, then they can still be accessed by setting PLD_gcw, ENABLE_gnome2, and/or ENABLE_pygcw to ON. VII. This is official notice that (as of release 5.9.3) we have deprecated the gd device driver which implements the png, jpeg, and gif devices. This device driver is essentially unmaintained. For example, it still depends on the plfreetype approach for accessing unicode fonts which has known issues (inconsistent text offsets, inconvenient font setting capabilities, and incorrect rendering of CTL languages). To avoid these issues for PNG format, we advise using the pngcairo or pngqt devices. To avoid these issues for the JPEG format, we advise using the jpgqt device. PNG is normally considered a better raster format than GIF, but if you absolutely require GIF format, we advise using the pngcairo or pngqt devices and then downgrading the results to the GIF format using the ImageMagick "convert" application. For those platforms where libgd (the dependency of the gd device driver) is accessible while the required dependencies of the cairo and/or qt devices are not accessible, you can still use these deprecated devices by setting PLD_png, PLD_jpeg, or PLD_gif to ON. VIII. This is official notice that the tk, itk, and itcl components of PLplot have been reenabled again by default (as of release 5.9.3) after being disabled by default as of release 5.9.1 due to segfaults. The cause of the segfaults was a bug (now fixed) in how pthread support was implemented for the Tk-related components of PLplot. INDEX 1. Changes relative to PLplot 5.9.2 (the previous development release) 1.1 libnistcd (a.k.a. libcd) now built internally for -dev cgm 1.2 get-drv-info now changed to test-drv-info 1.3 Text clipping now enabled by default for the cairo devices 1.4 A powerful qt device driver has been implemented 1.5 The PLplot API is now accessible from Qt GUI applications 1.6 NaN / Inf support for some PLplot functions 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device. 2.10 Improvements to the cairo driver family. 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm 2.26 get-drv-info now changed to test-drv-info 2.27 Text clipping now enabled by default for the cairo devices 2.28 A powerful qt device driver has been implemented 2.29 The PLplot API is now accessible from Qt GUI applications 2.30 NaN / Inf support for some PLplot functions 1. Changes relative to PLplot 5.9.2 (the previous development release) 1.1 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 1.2 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 1.3 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 1.4 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overal sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. Qt-4.5 is the version we have used for most of our testing, but limited testing for Qt-4.4 indicates that version should be fine for qt devices other than svgqt. 1.5 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 1.6 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake (with the exception of a special build script for the DJGPP platform) is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, qt, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device. Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family. Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already availale in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an offical PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in plplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in plplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared plplot library is built. 2.24 Documentation updates The docbook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for plplot users. 2.25 libnistcd (a.k.a. libcd) now built internally for -dev cgm CGM format is a long-established (since 1987) open standard for vector graphics that is supported by w3c (see http://www.w3.org/Graphics/WebCGM/). PLplot has long had a cgm device driver which depended on the (mostly) public domain libcd library that was distributed in the mid 90's by National Institute of Standards and Technology (NIST) and which is still available from http://www.pa.msu.edu/ftp/pub/unix/cd1.3.tar.gz. As a convenience to our -dev cgm users, we have brought that source code in house under lib/nistcd and now build libnistcd routinely as part of our ordinary builds. The only changes we have made to the cd1.3 source code is visibility changes in cd.h and swapping the sense of the return codes for the test executables so that 0 is returned on success and 1 on failure. If you want to test libnistcd on your platform, please run make test_nistcd in the top-level build tree. (That tests runs all the test executables that are built as part of cd1.3 and compares the results that are generated with the *.cgm files that are supplied as part of cd1.3.) Two applications that convert and/or display CGM results on Linux are ralcgm (which is called by the ImageMagick convert and display applications) and uniconvertor. Some additional work on -dev cgm is required to implement antialiasing and non-Hershey fonts, but both those should be possible using libnistcd according to the text that is shown by lib/nistcd/cdtext.cgm and lib/nistcd/cdexp1.cgm. 2.26 get-drv-info now changed to test-drv-info To make cross-building much easier for PLplot we now configure the *.rc files that are used to describe our various dynamic devices rather than generating the required *.rc files with get-drv-info. We have changed the name of get-drv-info to test-drv-info. That name is more appropriate because that executable has always tested dynamic loading of the driver plug-ins as well as generating the *.rc files from the information gleaned from that dynamic loading. Now, we simply run test-drv-info as an option (defaults to ON unless cross-building is enabled) and compare the resulting *.rc file with the one configured by cmake to be sure the dynamic device has been built correctly. 2.27 Text clipping now enabled by default for the cairo devices When correct text clipping was first implemented for cairo devices, it was discovered that the libcairo library of that era (2007-08) did that clipping quite inefficiently so text clipping was disabled by default. Recent tests of text clipping for the cairo devices using libcairo 1.6.4 (released in 2008-04) shows text clipping is quite efficient now. Therefore, it is now enabled by default. If you notice a significant slowdown for some libcairo version prior to 1.6.4 you can use the option -drvopt text_clipping=0 for your cairo device plots (and accept the improperly clipped text results that might occur with that option). Better yet, use libcairo 1.6.4 or later. 2.28 A powerful qt device driver has been implemented Thanks to the efforts of Alban Rochel of the QSAS team, we now have a qt device driver which delivers the following 9 (!) devices: qtwidget, bmpqt, jpgqt, pngqt, ppmqt, tiffqt, epsqt, pdfqt, and svgqt. qtwidget is an elementary interactive device where, for now, the possible interactions consist of resizing the window and right clicking with the mouse to control paging. The qtwidget overall size is expressed in pixels. bmpqt, jpgqt, pngqt, ppmqt, and tiffqt are file devices whose overal sizes are specified in pixels and whose output is BMP (Windows bitmap), JPEG, PNG, PPM (portable pixmap), and TIFF (tagged image file format) formatted files. epsqt, pdfqt, svgqt are file devices whose overall sizes are specified in points (1/72 of an inch) and whose output is EPS (encapsulated PostScript), PDF, and SVG formatted files. The qt device driver is based on the powerful facilities of Qt4 so all qt devices implement variable opacity (alpha channel) effects (see example 30). The qt devices also use system unicode fonts, and deal with CTL (complex text layout) languages automatically without any intervention required by the user. (To show this, try qt device results from examples 23 [mathematical symbols] and 24 [CTL languages].) Our exhaustive Linux testing of the qt devices (which consisted of detailed comparisons for all our standard examples between qt device results and the corresponding cairo device results) indicates this device driver is mature, but testing on other platforms is requested to confirm that maturity. Qt-4.5 has some essential SVG functionality so we recommend that version (downloadable from http://www.qtsoftware.com/downloads for Linux, Mac OS X, and Windows) for svgqt. Qt-4.5 is the version we have used for most of our testing, but limited testing for Qt-4.4 indicates that version should be fine for qt devices other than svgqt. 2.29 The PLplot API is now accessible from Qt GUI applications This important new feature has been implemented by Alban Rochel of the QSAS team as a spin-off of the qt device driver project using the extqt device (which constitutes the tenth qt device). See examples/c++/README.qt_example for a brief description of a simple Qt example which accesses the PLplot API and which is built in the installed examples tree using the pkg-config approach. Our build system has been enhanced to configure the necessary plplotd-qt.pc file. 2.30 NaN / Inf support for some PLplot functions Some PLplot now correctly handle Nan or Inf values in the data to be plotted. Line plotting (plline etc) and image plotting (plimage, plimagefr) will now ignore NaN / Inf values. Currently some of the contour plotting / 3-d routines do not handle NaN / Inf values. This functionality will depend on whether the language binding used supports NaN / Inf values. PLplot Release 5.9.2 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Notices for Users. I. This is the official notice that our deprecated autotools-based build system has been removed as of release 5.9.1. Instead, use the CMake-based build system following the directions in the INSTALL file. II. This is official notice that the tk, itk, and itcl components of PLplot have been disabled by default as of 5.9.1. We reluctantly took this step for these venerable PLplot components because we found segfaults with most of our Tk-related interactive tests for this release which we have been, as yet, unable to address. For now, if you want to try these components of PLplot to help us debug the problem, you must specifically use the cmake options -DENABLE_tk=ON -DENABLE_itk=ON -DENABLE_itcl=ON to build and install these components. III. This is official notice that we (as of 5.9.1) no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. IV. This is official notice that the PLplot team have decided (as of release 5.9.1) for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. INDEX 1. Changes relative to PLplot 5.9.1 (the previous development release) 1.1 Extension of our test framework 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device. 2.10 Improvements to the cairo driver family. 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Extension of our test framework 2.20 Rename test subdirectory to plplot_test 2.21 Website support files updated 2.22 Internal changes to function visibility 2.23 Dynamic driver support in Windows 2.24 Documentation updates 1. Changes relative to PLplot 5.9.1 (the previous development release) 1.1 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake (with the exception of a special build script for the DJGPP platform) is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device. Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family. Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already availale in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an offical PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (examples 1-31 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in plplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Extension of our test framework The standard test suite for PLplot now carries out a comparison of the stdout output (especially important for example 31 which tests most of our set and get functions) and PostScript output for different languages as a check. Thanks to the addition of example 31, the inclusion of examples 14 and 17 in the test suite and other recent extensions of the other examples we now have rigourous testing in place for almost the entirety of our common API. This extensive testing framework has already helped us track down a number of bugs, and it should make it much easier for us to maintain high quality for our ongoing PLplot releases. 2.20 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.21 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.22 Internal changes to function visibility The internal definitions of functions in plplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.23 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared plplot library is built. 2.24 Documentation updates The docbook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for plplot users. PLplot Release 5.9.1 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. Notices for Users. I. This is the official notice that our deprecated autotools-based build system has now been removed. Instead, use the CMake-based build system following the directions in the INSTALL file. II. This is official notice that the tk, itk, and itcl components of PLplot have been disabled by default for this release. We reluctantly take this step for these venerable PLplot components because we found segfaults with most of our Tk-related interactive tests for this release. We hope these issues are addressed before our next release so that the tk, itk, and itcl components of PLplot can be enabled by default again. For now, if you want to try these components of PLplot to help us debug the problem, you must specifically use the cmake options -DENABLE_tk=ON -DENABLE_itk=ON -DENABLE_itcl=ON to build and install these components. III. This is official notice that the python version of gnome2 has been temporarily disabled by default until we can figure out a RuntimeError: maximum recursion depth exceeded error that has been introduced for it (e.g., when running plplotcanvas_animation.py in the installed examples/python directory). If you wish to experiment with this component of PLplot use the -DENABLE_pygcw=ON option. examples/c/plplotcanvas_animation (when built in the install tree for the default ENABLE_gnome2=ON case) works fine. So do all the standard examples in the installed examples/python tree. So this issue appears to be confined just to the python version of gnome2. IV. This is official notice that we no longer support Octave-2.1.73 which has a variety of run-time issues in our tests of the Octave examples on different platforms. In contrast our tests show we get good run-time results with all our Octave examples for Octave-3.0.1. Also, that is the recommended stable version of Octave at http://www.gnu.org/software/octave/download.html so that is the only version of Octave we support at this time. V. This is official notice that the PLplot team have decided for consistency sake to change the PLplot stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma and the results returned by plgvpw to reflect the exact window limit values input by users using plwind. Previously to this change, the stream variables and the values returned by plgvpw reflected the internal slightly expanded range of window limits used by PLplot so that the user's specified limits would be on the graph. Two users noted this slight difference, and we agree with them it should not be there. Note that internally, PLplot still uses the expanded ranges so most users results will be identical. However, you may notice some small changes to your plot results if you use these stream variables directly (only possible in C/C++) or use plgvpw. INDEX 1. Changes relative to PLplot 5.9.0 (the previous development release) 1.1 New PLplot functions 1.2 Improvements to the cairo driver family. 1.3 wxWidgets driver improvements 1.4 pdf driver improvements 1.5 svg driver improvements 1.6 Ada language support 1.7 OCaml language support 1.8 Perl/PDL language support 1.9 Update to various language bindings 1.10 Update to various examples 1.11 Rename test subdirectory to plplot_test 1.12 Website support files updated 1.13 Internal changes to function visibility 1.14 Dynamic driver support in Windows 1.15 Documentation updates 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed 2.2 Build system bug fixes 2.3 Build system improvements 2.4 Implement build-system infrastructure for installed Ada bindings and examples 2.5 Code cleanup 2.6 Date / time labels for axes 2.7 Alpha value support 2.8 New PLplot functions 2.9 External libLASi library improvements affecting our psttf device. 2.10 Improvements to the cairo driver family. 2.11 wxWidgets driver improvements 2.12 pdf driver improvements 2.13 svg driver improvements 2.14 Ada language support 2.15 OCaml language support 2.16 Perl/PDL language support 2.17 Update to various language bindings 2.18 Update to various examples 2.19 Rename test subdirectory to plplot_test 2.20 Website support files updated 2.21 Internal changes to function visibility 2.22 Dynamic driver support in Windows 2.23 Documentation updates 1. Changes relative to PLplot 5.9.0 (the previous development release) 1.1 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator (based on the original Mersenne Twister 1997 code) within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 1.2 Improvements to the cairo driver family. Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 1.3 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already availale in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 1.4 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 1.5 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 1.6 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 1.7 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 1.8 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an offical PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 1.9 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 1.10 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (example 1-30 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. The standard test suite for PLplot using ctest now carries out a comparison of the postscript output for different languages as a check. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in plplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 1.11 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 1.12 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 1.13 Internal changes to function visibility The internal definitions of functions in plplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 1.14 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared plplot library is built. 1.15 Documentation updates The docbook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for plplot users. 2. Changes relative to PLplot 5.8.0 (the previous stable release) 2.1 All autotools-related files have now been removed CMake (with the exception of a special build script for the DJGPP platform) is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 2.2 Build system bug fixes Various fixes include the following: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 2.3 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 2.4 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 2.5 Code cleanup The PLplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using PLplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 2.6 Date / time labels for axes PLplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. N.B. Our reliance on C library POSIX time routines to (1) convert from broken-down time to time-epoch, (2) to convert from time-epoch to broken-down time, and (3) to format results with strftime have proved problematic for non-C languages which have time routines of variable quality. Also, it is not clear that even the POSIX time routines are available on Windows. So we have plans afoot to implement high-quality versions of (1), (2), and (3) with additional functions to get/set the epoch in the PLplot core library itself. These routines should work on all C platforms and should also be uniformly accessible for all our language bindings. WARNING..... Therefore, assuming these plans are implemented, the present part of our date/time PLplot API that uses POSIX time routines will be changed. 2.7 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 2.8 New PLplot functions An enhanced version of plimage, plimagefr has been added. This allows images to be plotted using coordinate transformation, and also for the dynamic range of the plotted values to be altered. Example 20 has been modified to demonstrate this new functionality. To ensure consistent results in example 21 between different platforms and language bindings PLplot now includes a small random number generator within the library. plrandd will return a PLFLT random number in the range 0.0-1.0. plseed will allow the random number generator to be seeded. 2.9 External libLASi library improvements affecting our psttf device. Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. 2.10 Improvements to the cairo driver family. Jonathan Woithe improved the xcairo driver so that it can optionally be used with an external user supplied X Drawable. This enables a nice separation of graphing (PLplot) and window management (Gtk, etc..). Doug Hunt fixed the bugs that broke the memcairo driver and it is now fully functional. Additionally, a new extcairo driver was added that will plot into a user supplied cairo context. 2.11 wxWidgets driver improvements Complete reorganization of the driver code. A new backend was added, based on the wxGraphicsContext class, which is available for wxWidgets 2.8.4 and later. This backend produces antialized output similar to the AGG backend but has no dependency on the AGG library. The basic wxDC backend and the wxGraphicsContext backend process the text output on their own, which results in much nicer plots than with the standard Hershey fonts and is much faster than using the freetype library. New options were introduced in the wxWidgets driver: - backend: Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext - hrshsym: Use Hershey symbol set (hrshsym=0|1) - text: Use own text routines (text=0|1) - freetype: Use FreeType library (freetype=0|1) The option "text" changed its meaning, since it enabled the FreeType library support, while now the option enables the driver's own text routines. Some other features were added: * the wxWidgets driver now correctly clears the background (or parts of it) * transparency support was added * the "locate mode" (already availale in the xwin and tk driver) was implemented, where graphics input events are processed and translated to world coordinates 2.12 pdf driver improvements The pdf driver (which is based on the haru library http://www.libharu.org) processes the text output now on its own. So far only the Adobe Type1 fonts are supported. TrueType font support will follow. Full unicode support will follow after the haru library will support unicode strings. The driver is now able to produce A4, letter, A5 and A3 pages. The Hershey font may be used only for symbols. Output can now be compressed, resulting in much smaller file sizes. Added new options: - text: Use own text routines (text=0|1) - compress: Compress pdf output (compress=0|1) - hrshsym: Use Hershey symbol set (hrshsym=0|1) - pagesize: Set page size (pagesize=A4|letter|A3|A5) 2.13 svg driver improvements This device driver has had the following improvements: schema for generated file now validates properly at http://validator.w3.org/ for the automatically detected document type of SVG 1.1; -geometry option now works; alpha channel transparency has been implemented; file familying for multipage examples has been implemented; coordinate scaling has been implemented so that full internal PLplot resolution is used; extraneous whitespace and line endings that were being injected into text in error have now been removed; and differential correction to string justification is now applied. The result of these improvements is that our SVG device now gives the best-looking results of all our devices. However, currently you must be careful of which SVG viewer or editor you try because a number of them have some bugs that need to be resolved. For example, there is a librsvg bug in text placement (http://bugzilla.gnome.org/show_bug.cgi?id=525023) that affects all svg use within GNOME as well as the ImageMagick "display" application. However, at least the latest konqueror and firefox as well as inkscape and scribus-ng (but not scribus!) give outstanding looking results for files generated by our svg device driver. 2.14 Ada language support We now have a complete Ada bindings implemented for PLplot. We also have a complete set of our standard examples implemented in Ada which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the Ada bindings. We now enable Ada by default for our users and request widespread testing of this new feature. 2.15 OCaml language support Thanks primarily to Hezekiah M. Carty's efforts we now have a complete OCaml bindings implemented for PLplot. We also have a complete set of our standard examples implemented in OCaml which give results that are identical with corresponding results for the C standard examples. This is an excellent test of a large subset of the OCaml bindings. We now enable OCaml by default for our users and request widespread testing of this new feature. 2.16 Perl/PDL language support Thanks to Doug Hunt's efforts the external Perl/PDL module, PDL::Graphics::PLplot version 0.46 available at http://search.cpan.org/dist/PDL-Graphics-PLplot has been brought up to date to give access to recently added PLplot API. The instructions for how to install this module on top of an offical PDL release are given in examples/perl/README.perldemos. Doug has also finished implementing a complete set of standard examples in Perl/PDL which are part of PLplot and which produce identical results to their C counterparts if the above updated module has been installed. Our build system tests the version of PDL::Graphics::PLplot that is available, and if it is not 0.46 or later, the list of Perl/PDL examples that are run as part of our standard tests is substantially reduced to avoid examples that use the new functionality. In sum, if you use PDL::Graphics::PLplot version 0.46 or later the full complement of PLplot commands is available to you from Perl/PDL, but otherwise not. 2.17 Updates to various language bindings A concerted effort has been made to bring all the language bindings up to date with recently added functions. Ada, C++, f77, f95, Java, OCaml, Octave, Perl/PDL, Python, and Tcl now all support the common PLplot API (with the exception of the mapping functions which are not yet implemented for all bindings due to technical issues.) This is a significant step forward for those using languages other than C. 2.18 Updates to various examples To help test the updates to the language bindings the examples have been thoroughly checked. Ada, C, C++, f77, f95, and OCaml now contain a full set of non-interactive tests (example 1-30 excluding 14 and 17). Java, Octave, Python and Tcl are missing example 19 because of the issue with the mapping functions. The examples have also been checked to ensure consistent results between different language bindings. Currently there are still some minor differences in the results for the tcl examples, probably due to rounding errors. The standard test suite for PLplot using ctest now carries out a comparison of the postscript output for different languages as a check. Some of the Tcl examples (example 21) require Tcl version 8.5 for proper support for NaNs. Also new is an option for the plplot_test.sh script to run the examples using a debugging command. This is enabled using the --debug option. The default it to use the valgrind memory checker. This has highlighted at least one memory leaks in plplot which have been fixed. It is not part of the standard ctest tests because it can be _very_ slow for a complete set of language bindings and device drivers. 2.19 Rename test subdirectory to plplot_test This change was necessary to quit clashing with the "make test" target which now works for the first time ever (by executing ctest). 2.20 Website support files updated Our new website content is generated with PHP and uses CSS (cascaded style sheets) to implement a consistent style. This new approach demanded lots of changes in the website support files that are used to generate and upload our website and which are automatically included with the release. 2.21 Internal changes to function visibility The internal definitions of functions in plplot have been significantly tidied up to allow the use of the -fvisibility=hidden option with newer versions of gcc. This prevents internal functions from being exported to the user where possible. This extends the existing support for this on windows. 2.22 Dynamic driver support in Windows An interface based on the ltdl library function calls was established which allows to open and close dynamic link libraries (DLL) during run-time and call functions from these libraries. As a consequence drivers can now be compiled into single DLLs separate from the core plplot DLL also in Windows. The cmake option ENABLE_DYNDRIVERS is now ON by default for Windows if a shared plplot library is built. 2.23 Documentation updates The docbook documentation has been updated to include many of the C-specific functions (for example plAlloc2dGrid) which are not part of the common API, but are used in the examples and may be helpful for plplot users. PLplot Release 5.9.0 ~~~~~~~~~~~~~~~~~~~~ This is a development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. N.B. This is the official notice that our deprecated autotools-based build system has now been removed. Instead, use the CMake-based build system following the directions in the INSTALL file. INDEX 1. Changes relative to PLplot 5.8.0 (the previous stable release) 1.1 All autotools-related files have now been removed 1.2 Date / time labels for axes 1.3 Code cleanup 1.4 Bug fixes 1.5 Alpha value support 1.6 Build system improvements 1.7 Implement build-system infrastructure for installed Ada bindings and examples 1.8 WxWidgets driver improvements 1.9 External libLASi library improvements affecting our psttf device. 1.1 All autotools-related files have now been removed CMake (with the exception of a special build script for the DJGPP platform) is now the only supported build system. It has been tested on Linux / Unix, Mac OS-X and Windows platforms. 1.2 Date / time labels for axes Plplot now allows date / time labels to be used on axes. A new option ('d') is available for the xopt and yopt arguments to plbox which indicates that the axis should be interpreted as a date / time. Similarly there is a new range of options for plenv to select date / time labels. The time format is seconds since the epoch (usually 1 Jan 1970). This format is commonly used on most systems. The C gmtime routine can be used to calculate this for a given date and time. The format for the labels is controlled using a new pltimefmt function, which takes a format string. All formatting is done using the C strftime function. See documentation for available options on your platform. Example 29 demonstrates the new capabilities. 1.3 Code cleanup The plplot source code has been cleaned up to make consistent use of (const char *) and (char *) throughout. Some API functions have changed to use const char * instead of char * to make it clear that the strings are not modified by the function. The C and C++ examples have been updated consistent with this. These changes fix a large number of warnings with gcc-4.2. Note: this should not require programs using plplot to be recompiled as it is not a binary API change. There has also been some cleanup of include files in the C++ examples so the code will compile with the forthcoming gcc-4.3. 1.4 Bug fixes Various fixes including: Ctest will now work correctly when the build tree path includes symlinks. Dependencies for swig generated files fixed so they are not rebuilt every time make is called. Various dependency fixes to ensure that parallel builds (using make -j) work under unix. 1.5 Alpha value support PLplot core has been modified to support a transparency or alpha value channel for each color in color map 0 and 1. In addition a number of new functions were added the PLplot API so that the user can both set and query alpha values for color in the two color maps. These functions have the same name as their non-alpha value equivalents, but with a an "a" added to the end. Example 30 demonstrates some different ways to use these functions and the effects of alpha values, at least for those drivers that support alpha values. This change should have no effect on the device drivers that do not currently support alpha values. Currently only the cairo, gd, wxwidgets and aquaterm drivers support alpha values. There are some limitations with the gd driver due to transparency support in the underlying libgd library. 1.6 Build system improvements We now transform link flag results delivered to the CMake environment by pkg-config into the preferred CMake form of library information. The practical effect of this improvement is that external libraries in non-standard locations now have their rpath options set correctly for our build system both for the build tree and the install tree so you don't have to fiddle with LD_LIBRARY_PATH, etc. 1.7 Implement build-system infrastructure for installed Ada bindings and examples Install source files, library information files, and the plplotada library associated with the Ada bindings. Configure and install the pkg-config file for the plplotada library. Install the Ada examples and a configured Makefile to build them in the install tree. 1.8 WxWidgets driver improvements A number of small bug fixes. New functionality includes menu options to save the current plot in different formats. 1.9 External libLASi library improvements affecting our psttf device. Our psttf device depends on the libLASi library. libLASi-1.1.0 has just been released at http://sourceforge.net/svn/?group_id=187113 . We recommend using this latest version of libLASi for building PLplot and the psttf device since this version of libLASi is more robust against glyph information returned by pango/cairo/fontconfig that on rare occasions is not suitable for use by libLASi. PLplot Release 5.8.0 ~~~~~~~~~~~~~~~~~~~~ This is a stable release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. N.B. This is the official notice that our deprecated autotools-based build system is scheduled for removal starting with the 5.9.0 release. The reason for this decision is the PLplot developers and users are happy with our CMake-based build system (see below), and nobody has been willing to spend time maintaining our old autotools-based build system. Note for Windows users: The same holds for the old Windows build system in sys/win32/msdev. This build system is much less flexible than the CMake-based system. It also lacks a larger number of important features - freetype text, language bindings and so on. With the 5.9.0 release the source distribution will no longer contain this directory. Hence you should switch to the new build system described below. Note for gfortran users of our f95 bindings: gfortran version 4.2.1 or later is a requirement, see fortran 95 bindings remarks below. Note for OS-X users: The Octave bindings no longer work for Octave 2.1.73. Work is ongoing to try and solve this problem. INDEX 1. Changes relative to PLplot 5.7.4 1.1 Drivers 1.1.1 cairo devices 1.1.2 plmeta/plrender 1.2 Fortran 95 bindings 1.3 plmtex3/plptex3 1.4 Octave 2.9 2. Changes relative to PLplot 5.6.1 2.1 CVS to Subversion conversion 2.2 CMake build system 2.3 Plot Buffering 2.4 Updated INSTALL/README 2.5 malloc/calloc clean up 2.6 Documentation 2.7 Additions to the PLplot API 2.8 Language bindings 2.8.1 ADA language binding 2.8.2 wxwidgets applications bindings 2.8.3 Python bindings 2.8.4 Fortran 95 bindings 2.8.5 Octave 2.9 2.9 Updated examples 2.10 Drivers 2.10.1 psttf 2.10.2 svg 2.10.3 wxwidgets 2.10.4 pdf 2.10.5 gd, wingcc (freetype) 2.10.6 cairo 2.10.7 pstex 2.10.8 plmeta (and plrender application to render plmeta results). 1. Changes relative to PLplot 5.7.4 (the previous development release) 1.1 Drivers 1.1.1 cairo devices The xwinttf driver has been renamed xcairo. In addition most of the other devices that are theoretically possible with Cairo have been implemented. These are a PostScript device (pscairo), a PNG device (pngcairo), a PDF device (pdfcairo), an SVG device (svgcairo), and a memory device (memcairo). The cairo device driver is still considered experimental as a whole. Known issues include improper text rendering with svgcairo and memcairo not working at all so those two devices are disabled by default. The pngcairo, pscairo, and xcairo devices appear to work without problems and also give outstanding-looking antialiased and hinted results so are enabled by default. The pdfcairo device appears to work reasonably well so is enabled by default although it is not as mature as the other Cairo devices that are enabled. 1.1.2 plmeta/plrender The combination of the plmeta device and the plrender application that renders plmeta results is unmaintained and has some known issues with strings, aspect ratio changes, and fonts. Therefore, the plmeta device is now not enabled by default, and must be specifically enabled by the user using the -DPLD_plmeta=ON cmake option. Furthermore, plrender is not built or installed and the plrender man page is not installed unless the plmeta device is specifically enabled. 1.2 Fortran 95 bindings Equivalance statements in our F95 bindings were causing problems for one fortran 95 compiler so we have dropped those equivalence statements and use the transfer intrinsic instead. However, for gfortran that intrinsic was only implemented for version 4.2.1 so that is the minimum version requirement for gfortran now if you attempt to build the f95 bindings. Note, earlier versions of gfortran build the f77 bindings with no problems. 1.3 plmtex3/plptex3 These two functions, which were added in release 5.7.3, had a number of bugs. These have hopefully been cleaned up. Example 28 demonstrates how to use these functions. The functions and the example have now been implemented for most language bindings. 1.4 Octave 2.9 Octave 2.9 has a number of significant differences from version 2.1. The octave language bindings have been updated to work with this new version since the latest 2.9.x release is now the "recommended" choice by the octave developers. Note that all the low-level plplot functions work as expected. The higher level functions which replace the default octave / gnuplot plotting commands mostly work as for version 2.1. They do not (yet) replicate the new and more Matlab-like functionality in the latest 2.9.x releases of Octave. Note: As a result of the compatibilty code for octave 2.1 and lower the octave bindings will generate spurious warnings about obsolete built-in variables when using octave 2.9. These can be silenced using the command warning("off","Octave:built-in-variable-assignment"); before using the plplot bindings. This is not enabled by default as it would also turn off genuine warnings in your own code which you might want to fix. 2. Changes relative to PLplot 5.6.1 (the previous stable release) 2.1 CVS to Subversion conversion PLplot now uses the Subversion (svn) version control system. Records of all the changes and release tags have been preserved from the CVS repository. 2.2 CMake build system PLplot now uses the CMake build system (www.cmake.org) and the older autotools build system has been deprecated and is scheduled for removal as of the 5.9.0 release. The switch to CMake was made due its superior support for Windows platforms and its relative simplicity compared to autotools on Unix. To use CMake to configure and build PLplot follow the directions at http://www.miscdebris.net/plplot_wiki/. 2.3 Plot Buffering PLplot core has been modified to buffer plot commands in memory rather than via a unix pipe or temporary file. Testing has shown that there is 20-30% improvement in plotting performance (i.e. speed). This is likely to be system dependent and some may see a much larger benefit. This also resolves a problem with some windows platforms where the temporary files were not getting deleted. 2.4 Updated INSTALL/README The INSTALL and README files have been updated. They now include detailed instructions for building plplot using the new CMake build system on Linux and Windows. 2.5 malloc/calloc clean up Checks have been added to many (all?) of the calls to calloc and malloc in the PLplot core. The purpose of the check is to verify that the memory requested was actually allocated prior to attempting to use it. 2.6 Documentation The API section has been expanded to include information about how to call the functions from Fortran95, Java, Perl/PDL and Python. Since array dimension information is typically redundant in these languages it is dropped in many of the relevant function. Additionally, some of the Perl/PDL function calls have a different argument order than their C equivalent. This section has also been expanded to include a list of which examples each function is used in (if any). The Fortran95 documentation has been updated. 2.7 Additions to the PLplot API The functions plptex3 and plmtex3 have been added to the PLplot API. These allow the user to draw text in "3D" on the 3D plots. plptex3 is the 3D equivalent of plptex and plmtex3 is the 3D equivalent of plmtex. Their use is demonstrated by example 28. 2.8 Language bindings 2.8.1 ADA Jerry Bauck has donated bindings to the ADA programming language. These bindings have been included into the CMake build system, and should be generated automatically if you have an ADA compiler and you specify the cmake option -DENABLE_ada=ON. The ADA bindings are now considered complete and the current focus is on implementing all of the examples in ADA to help test the bindings. Until that work is completed these bindings should be considered experimental. 2.8.2 wxwidgets applications bindings The wxWidgets bindings provide an interface to the PLplot API and a simple widget to be used in a wxWidgets application. The class 'wxPLplotstream' inherited from the PLplot class 'plstream' allows access to the complete PLplot API. 'wxPLplotWindow' is a simple wxWidget which takes care of some preparatory work for convenient use of the PLplot Library within a wxWidgets application. 2.8.3 Python bindings The Python bindings have been updated to use numpy rather than the now deprecated Numeric python numeric library. 2.8.4 Fortran 95 bindings Equivalance statements in our F95 bindings were causing problems for one fortran 95 compiler so we have dropped those equivalence statements and use the transfer intrinsic instead. However, for gfortran that intrinsic was only implemented for version 4.1.2 so that is the minimum version requirement for gfortran now if you attempt to build the f95 bindings. Note, earlier versions of gfortran build the f77 bindings with no problems. 2.8.5 Octave 2.9 Octave 2.9 has a number of significant differences from version 2.1. The octave language bindings have been updated to work with this new version since the latest 2.9.x release is now the "recommended" choice by the octave developers. Note that all the low-level plplot functions work as expected. The higher level functions which replace the default octave / gnuplot plotting commands mostly work as for version 2.1. They do not (yet) replicate the new and more Matlab-like functionality in the latest 2.9.x releases of Octave. Note: As a result of the compatibilty code for octave 2.1 and lower the octave bindings will generate spurious warnings about obsolete built-in variables when using octave 2.9. These can be silenced using the command warning("off","Octave:built-in-variable-assignment"); before using the plplot bindings. This is not enabled by default as it would also turn off genuine warnings in your own code which you might want to fix. 2.9 Updated examples The examples have been checked over to make sure that they all work and to make them more consistent across different programming languages. 2.10 Drivers 2.10.1 psttf This device driver now requires LASi version 1.0.6 or 1.0.5pl. See http://www.unifont.org/lasi/ for instructions (depending on installed version of FreeType library) on which to choose. 2.10.2 svg This is a new device driver that creates Scalable Vector Graphics files (http://www.w3.org/Graphics/SVG/). SVG is a XML language describing graphics that is supported directly or via plug-ins in most modern web browsers. The driver is off by default as its text handling has not been perfected. 2.10.3 wxwidgets This driver has been updated a great deal. The most important improvements have been to the antialiasing part of the driver. It is now about 4 times faster than it was, and is nearly comparable in speed to the driver with the antialiasing turned off. In addition the antialiasing code can now handle filled polygons and window resizing. 2.10.4 pdf A basic version of a pdf driver was added to the latest PLplot release. This driver is based on the libharu library (http://libharu.sourceforge.net/). At present only the Hershey fonts are used and there is no support for pdf or TrueType fonts. Compression of the pdf output is not enabled and the paper size can't be chosen. All these issues will be addressed in later releases. 2.10.5 gd, wingcc (freetype) Improved anti-aliasing routines have been added to PLplot's freetype font rendering engine. The gd and wingcc drivers have been modified in turn to take advantage of these new routines, leading to improved text rendering. 2.10.6 cairo This is a family of drivers that use the Cairo graphics library to render text and graphics. The graphics and the text are both anti-aliased which yields some outstanding-looking results. This driver is unicode enabled, and Truetype fonts are used by default. Most of the devices that are theoretically possible with Cairo have been implemented. These are an X device (xcairo), a PostScript device (pscairo), a PNG device (pngcairo, a PDF device (pdfcairo), an SVG device (svgcairo), and a memory device (memcairo). The cairo device driver is still considered experimental as a whole. Known issues include improper text rendering with svgcairo and memcairo not working at all so those two devices are disabled by default. The pngcairo, pscairo, and xcairo devices appear to work without problems and also give outstanding-looking antialiased and hinted results so are enabled by default. The pdfcairo device appears to work reasonable well so is enabled by default although it is not as mature as the other three cairo devices that are enabled. 2.10.7 pstex driver This Latex driver has now been resurrected from years of neglect and aside from bounding box issues seems to be working well. Should be useful for Latex enthusiasts. 2.10.8 plmeta driver The combination of the plmeta device and the plrender application that renders plmeta results is unmaintained and has some known issues with strings, aspect ratio changes, and fonts. Therefore, the plmeta device is now not enabled by default, and must be specifically enabled by the user using the -DPLD_plmeta=ON cmake option. Furthermore, plrender is not built or installed and the plrender man page is not installed unless the plmeta device is specifically enabled. PLplot Release 5.8.0-RC1 ~~~~~~~~~~~~~~~~~~~~~~~~ This is a stable release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.9.x series will be available every few months. The next stable release will be 5.10.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. N.B. This is the official notice that our deprecated autotools-based build system is scheduled for removal starting with the 5.9.0 release. The reason for this decision is the PLplot developers and users are happy with our CMake-based build system (see below), and nobody has been willing to spend time maintaining our old autotools-based build system. Note for Windows users: The same holds for the old Windows build system in sys/win32/msdev. This build system is much less flexible than the CMake-based system. It also lacks a larger number of important features - freetype text, language bindings and so on. With the 5.9.0 release the source distribution will no longer contain this directory. Hence you should switch to the new build system described below. Note for gfortran users of our f95 bindings: gfortran version 4.1.2 or later is a requirement, see fortran 95 bindings remarks below. INDEX 1. Changes relative to PLplot 5.7.4 1.1 Drivers 1.1.1 cairo devices 1.1.2 plmeta/plrender 1.2 Fortran 95 bindings 1.3 plmtex3/plptex3 1.4 Octave 2.9 2. Changes relative to PLplot 5.6.1 2.1 CVS to Subversion conversion 2.2 CMake build system 2.3 Plot Buffering 2.4 Updated INSTALL/README 2.5 malloc/calloc clean up 2.6 Documentation 2.7 Additions to the PLplot API 2.8 Language bindings 2.8.1 ADA language binding 2.8.2 wxwidgets applications bindings 2.8.3 Python bindings 2.8.4 Fortran 95 bindings 2.8.5 Octave 2.9 2.9 Updated examples 2.10 Drivers 2.10.1 psttf 2.10.2 svg 2.10.3 wxwidgets 2.10.4 pdf 2.10.5 gd, wingcc (freetype) 2.10.6 cairo 2.10.7 pstex 2.10.8 plmeta (and plrender application to render plmeta results). 1. Changes relative to PLplot 5.7.4 (the previous development release) 1.1 Drivers 1.1.1 cairo devices The xwinttf driver has been renamed xcairo. In addition most of the other devices that are theoretically possible with Cairo have been implemented. These are a PostScript device (pscairo), a PNG device (pngcairo), a PDF device (pdfcairo), an SVG device (svgcairo), and a memory device (memcairo). The cairo device driver is still considered experimental as a whole. Known issues include improper text rendering with svgcairo and memcairo not working at all so those two devices are disabled by default. The pngcairo, pscairo, and xcairo devices appear to work without problems and also give outstanding-looking antialiased and hinted results so are enabled by default. The pdfcairo device appears to work reasonably well so is enabled by default although it is not as mature as the other Cairo devices that are enabled. 1.1.2 plmeta/plrender The combination of the plmeta device and the plrender application that renders plmeta results is unmaintained and has some known issues with strings, aspect ratio changes, and fonts. Therefore, the plmeta device is now not enabled by default, and must be specifically enabled by the user using the -DPLD_plmeta=ON cmake option. Furthermore, plrender is not built or installed and the plrender man page is not installed unless the plmeta device is specifically enabled. 1.2 Fortran 95 bindings Equivalance statements in our F95 bindings were causing problems for one fortran 95 compiler so we have dropped those equivalence statements and use the transfer intrinsic instead. However, for gfortran that intrinsic was only implemented for version 4.1.2 so that is the minimum version requirement for gfortran now if you attempt to build the f95 bindings. Note, earlier versions of gfortran build the f77 bindings with no problems. 1.3 plmtex3/plptex3 These two functions, which were added in release 5.7.3, had a number of bugs. These have hopefully been cleaned up. Example 28 demonstrates how to use these functions. The functions and the example have now been implemented for most language bindings. 1.4 Octave 2.9 Octave 2.9 has a number of significant differences from version 2.1. The octave language bindings have been updated to work with this new version since the latest 2.9.x release is now the "recommended" choice by the octave developers. Note that all the low-level plplot functions work as expected. The higher level functions which replace the default octave / gnuplot plotting commands mostly work as for version 2.1. They do not (yet) replicate the new and more Matlab-like functionality in the latest 2.9.x releases of Octave. Note: As a result of the compatibilty code for octave 2.1 and lower the octave bindings will generate spurious warnings about obsolete built-in variables when using octave 2.9. These can be silenced using the command warning("off","Octave:built-in-variable-assignment"); before using the plplot bindings. This is not enabled by default as it would also turn off genuine warnings in your own code which you might want to fix. 2. Changes relative to PLplot 5.6.1 (the previous stable release) 2.1 CVS to Subversion conversion PLplot now uses the Subversion (svn) version control system. Records of all the changes and release tags have been preserved from the CVS repository. 2.2 CMake build system PLplot now uses the CMake build system (www.cmake.org) and the older autotools build system has been deprecated and is scheduled for removal as of the 5.9.0 release. The switch to CMake was made due its superior support for Windows platforms and its relative simplicity compared to autotools on Unix. To use CMake to configure and build PLplot follow the directions at http://www.miscdebris.net/plplot_wiki/. 2.3 Plot Buffering PLplot core has been modified to buffer plot commands in memory rather than via a unix pipe or temporary file. Testing has shown that there is 20-30% improvement in plotting performance (i.e. speed). This is likely to be system dependent and some may see a much larger benefit. This also resolves a problem with some windows platforms where the temporary files were not getting deleted. 2.4 Updated INSTALL/README The INSTALL and README files have been updated. They now include detailed instructions for building plplot using the new CMake build system on Linux and Windows. 2.5 malloc/calloc clean up Checks have been added to many (all?) of the calls to calloc and malloc in the PLplot core. The purpose of the check is to verify that the memory requested was actually allocated prior to attempting to use it. 2.6 Documentation The API section has been expanded to include information about how to call the functions from Fortran95, Java, Perl/PDL and Python. Since array dimension information is typically redundant in these languages it is dropped in many of the relevant function. Additionally, some of the Perl/PDL function calls have a different argument order than their C equivalent. This section has also been expanded to include a list of which examples each function is used in (if any). The Fortran95 documentation has been updated. 2.7 Additions to the PLplot API The functions plptex3 and plmtex3 have been added to the PLplot API. These allow the user to draw text in "3D" on the 3D plots. plptex3 is the 3D equivalent of plptex and plmtex3 is the 3D equivalent of plmtex. Their use is demonstrated by example 28. 2.8 Language bindings 2.8.1 ADA Jerry Bauck has donated bindings to the ADA programming language. These bindings have been included into the CMake build system, and should be generated automatically if you have an ADA compiler and you specify the cmake option -DENABLE_ada=ON. The ADA bindings are now considered complete and the current focus is on implementing all of the examples in ADA to help test the bindings. Until that work is completed these bindings should be considered experimental. 2.8.2 wxwidgets applications bindings The wxWidgets bindings provide an interface to the PLplot API and a simple widget to be used in a wxWidgets application. The class 'wxPLplotstream' inherited from the PLplot class 'plstream' allows access to the complete PLplot API. 'wxPLplotWindow' is a simple wxWidget which takes care of some preparatory work for convenient use of the PLplot Library within a wxWidgets application. 2.8.3 Python bindings The Python bindings have been updated to use numpy rather than the now deprecated Numeric python numeric library. 2.8.4 Fortran 95 bindings Equivalance statements in our F95 bindings were causing problems for one fortran 95 compiler so we have dropped those equivalence statements and use the transfer intrinsic instead. However, for gfortran that intrinsic was only implemented for version 4.1.2 so that is the minimum version requirement for gfortran now if you attempt to build the f95 bindings. Note, earlier versions of gfortran build the f77 bindings with no problems. 2.8.5 Octave 2.9 Octave 2.9 has a number of significant differences from version 2.1. The octave language bindings have been updated to work with this new version since the latest 2.9.x release is now the "recommended" choice by the octave developers. Note that all the low-level plplot functions work as expected. The higher level functions which replace the default octave / gnuplot plotting commands mostly work as for version 2.1. They do not (yet) replicate the new and more Matlab-like functionality in the latest 2.9.x releases of Octave. Note: As a result of the compatibilty code for octave 2.1 and lower the octave bindings will generate spurious warnings about obsolete built-in variables when using octave 2.9. These can be silenced using the command warning("off","Octave:built-in-variable-assignment"); before using the plplot bindings. This is not enabled by default as it would also turn off genuine warnings in your own code which you might want to fix. 2.9 Updated examples The examples have been checked over to make sure that they all work and to make them more consistent across different programming languages. 2.10 Drivers 2.10.1 psttf This device driver now requires LASi version 1.0.6 or 1.0.5pl. See http://www.unifont.org/lasi/ for instructions (depending on installed version of FreeType library) on which to choose. 2.10.2 svg This is a new device driver that creates Scalable Vector Graphics files (http://www.w3.org/Graphics/SVG/). SVG is a XML language describing graphics that is supported directly or via plug-ins in most modern web browsers. The driver is off by default as its text handling has not been perfected. 2.10.3 wxwidgets This driver has been updated a great deal. The most important improvements have been to the antialiasing part of the driver. It is now about 4 times faster than it was, and is nearly comparable in speed to the driver with the antialiasing turned off. In addition the antialiasing code can now handle filled polygons and window resizing. 2.10.4 pdf A basic version of a pdf driver was added to the latest PLplot release. This driver is based on the libharu library (http://libharu.sourceforge.net/). At present only the Hershey fonts are used and there is no support for pdf or TrueType fonts. Compression of the pdf output is not enabled and the paper size can't be chosen. All these issues will be addressed in later releases. 2.10.5 gd, wingcc (freetype) Improved anti-aliasing routines have been added to PLplot's freetype font rendering engine. The gd and wingcc drivers have been modified in turn to take advantage of these new routines, leading to improved text rendering. 2.10.6 cairo This is a family of drivers that use the Cairo graphics library to render text and graphics. The graphics and the text are both anti-aliased which yields some outstanding-looking results. This driver is unicode enabled, and Truetype fonts are used by default. Most of the devices that are theoretically possible with Cairo have been implemented. These are an X device (xcairo), a PostScript device (pscairo), a PNG device (pngcairo, a PDF device (pdfcairo), an SVG device (svgcairo), and a memory device (memcairo). The cairo device driver is still considered experimental as a whole. Known issues include improper text rendering with svgcairo and memcairo not working at all so those two devices are disabled by default. The pngcairo, pscairo, and xcairo devices appear to work without problems and also give outstanding-looking antialiased and hinted results so are enabled by default. The pdfcairo device appears to work reasonable well so is enabled by default although it is not as mature as the other three cairo devices that are enabled. 2.10.7 pstex driver This Latex driver has now been resurrected from years of neglect and aside from bounding box issues seems to be working well. Should be useful for Latex enthusiasts. 2.10.8 plmeta driver The combination of the plmeta device and the plrender application that renders plmeta results is unmaintained and has some known issues with strings, aspect ratio changes, and fonts. Therefore, the plmeta device is now not enabled by default, and must be specifically enabled by the user using the -DPLD_plmeta=ON cmake option. Furthermore, plrender is not built or installed and the plrender man page is not installed unless the plmeta device is specifically enabled. PLplot Release 5.7.4 ~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.7.x series will be available every few months. The next stable release will be 5.8.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Changes relative to PLplot 5.7.3 1.1 CVS to Subversion conversion 1.2 Drivers 1.2.1 xwinttf -> xcairo 1.3 Ada bindings 1.4 Python bindings 1.5 Fortran95 Documentation 2. Changes relative to PLplot 5.6.1 2.1 CVS to Subversion conversion 2.2 CMake build system 2.3 Plot Buffering 2.4 Updated INSTALL/README 2.5 malloc/calloc clean up 2.6 Documentation 2.7 Additions to the PLplot API 2.8 Language bindings 2.8.1 Experimental ADA language binding 2.8.2 wxwidgets applications bindings 2.9 Updated examples 2.10 Drivers 2.10.1 psttf 2.10.2 svg 2.10.3 wxwidgets 2.10.4 pdf 2.10.5 gd, wingcc (freetype) 2.10.6 cairo 2.10.7 pstex 2.11 Python bindings 2.12 Fortran95 Documentation 1. Changes relative to PLplot 5.7.3 (the previous development release) 1.1 CVS to Subversion conversion PLplot now uses the Subversion (svn) version control system. Records of all the changes and release tags have been preserved from the CVS repository. 1.2 Drivers 1.2.1 xwinttf -> xcairo The xwinttf driver has been renamed xcairo. In addition most of the the other output devices that Cairo supports are now supported. These include a postscript driver (pscairo), a PDF driver (pdfcairo), a SVG driver (svgcairo), a PNG driver (pngcairo) and a memory driver (memcairo). This driver is still considered experimental. Known issues include improper text rendering with the SVG driver and the memory driver does not work at all. 1.3 Ada bindings The ADA bindings are now considered complete and the current focus is on implementing all of the examples in ADA. 1.4 Python bindings The Python bindings have been updated to use numpy rather than the now deprecated Numeric python numeric library. If you need to revert to the old Numeric support, then you should specify the cmake option -DHAVE_NUMPY=OFF. 1.5 Fortran95 documentation The Fortran95 documentation has been updated. 2. Changes relative to PLplot 5.6.1 (the previous stable release) 2.1 CVS to Subversion conversion PLplot now uses the Subversion (svn) version control system. Records of all the changes and release tags have been preserved from the CVS repository. 2.2 CMake build system PLplot now uses the CMake build system (www.cmake.org) and the older autotools build system has been deprecated. The switch to CMake was made due its superior support for Windows platforms and its relative simplicity compared to autotools. CMake 2.4.5 is the minimum required version of cmake. Finding swig has been improved such that it should now be found as long as it is in your path. 2.3 Plot Buffering PLplot core has been modified to buffer plot commands in memory rather than via a unix pipe or temporary file. Testing has shown that there is 20-30% improvement in plotting performance (i.e. speed). This is likely to be system dependent and some may see a much larger benefit. This also resolves a problem with some windows platforms where the temporary files were not getting deleted. 2.4 Updated INSTALL/README The INSTALL and README files have been updated. They now include detailed instructions for building plplot using the new CMake build system on linux and windows. 2.5 malloc/calloc clean up Checks have been added to many (all?) of the calls to calloc and malloc in the PLplot core. The purpose of the check is to verify that the memory requested was actually allocated prior to attempting to use it. 2.6 Documentation The API section has been expanded to include information about how to call the functions from Fortran95, Java, Perl/PDL and Python. Since array dimension information is typically redundant in these languages it is dropped in many of the relevant function. Additionally, some of the Perl/PDL function calls have a different argument order than their C equivalent. This section has also been expanded to include a list of which examples each function is used in (if any). 2.7 Additions to the PLplot API The functions plptex3 and plmtex3 have been added to the PLplot API. These allow the user to draw text in "3D" on the 3D plots. plptex3 is the 3D equivalent of plptex and plmtex3 is the 3D equivalent of plmtex. 2.8 Language bindings 2.8.1 ADA Jerry Bauck has donated bindings to the ADA programming language. These are considered experimental in nature and the API is subject to change. These bindings have been included into the CMake build system, and should be generated automatically if you have an ADA compiler and you specify the cmake option -DENABLE_ada=ON. Four standard examples have been completed and work on a complete set of examples is ongoing. 2.8.2 wxwidgets applications bindings The wxWidgets bindings provide an interface to the PLplot API and a simple widget to be used in a wxWidgets application. The class 'wxPLplotstream' inherited from the PLplot class 'plstream' allows access to the complete PLplot API. 'wxPLplotWindow' is a simple wxWidget which takes care of some preparational work for convenient use of the PLplot Library within a wxWidgets application. 2.9 Updated examples The examples have been checked over to make sure that they all work and to make them more consistent across different programming languages. 2.10 Drivers 2.10.1 psttf This device driver now requires LASi version 1.0.6 or 1.0.5pl. See http://www.unifont.org/lasi/ for instructions (depending on installed version of FreeType library) on which to choose. 2.10.2 svg This is a new device driver that creates Scalable Vector Graphics files (http://www.w3.org/Graphics/SVG/). SVG is a XML language describing graphics that is supported directly or via plug-ins in most modern web browsers. The driver is off by default as its text handling has not been perfected. 2.10.3 wxwidgets This driver has been updated a great deal. The most important improvements have been to the antializing part of the driver. It is now about 4 times faster than it was, and is nearly comparable in speed to the driver with the antializing turned off. In addition the antializing code can now handle filled polygons and window resizing. 2.10.4 pdf A basic version of a pdf driver was added to the latest PLplot release. This driver is based on the libharu library (http://libharu.sourceforge.net/). At present only the hershey fonts are used and there is no support for pdf or ttf fonts. Compression of the pdf output is not enabled and the paper size can't be chosen. All these issues will be addressed in later releases. 2.10.5 gd, wingcc (freetype) Improved anti-aliasing routines have been added to plplot's freetype font rendering engine. The gd and wingcc drivers have been modified in turn to take advantage of these new routines, leading to improved text rendering. 2.10.6 cairo This is a family of drivers that use the Cairo graphics library to render text and graphics. The graphics and the text are both anti-aliased. It is unicode enabled and Truetype fonts are used by default. Most of the the output devices that Cairo supports are supported. These include a X windows driver (xcairo), a postscript driver (pscairo), a PDF driver (pdfcairo), a SVG driver (svgcairo), a PNG driver (pngcairo) and a memory driver (memcairo). This driver is still considered experimental. Known issues include improper text rendering with the SVG driver and the memory driver does not work at all. 2.10.7 pstex driver This Latex driver has now been resurrected from years of neglect and aside from bounding box issues seems to be working well. Should be useful for Latex enthusiasts. 1.4 Python bindings The Python bindings have been updated to use numpy rather than the now deprecated Numeric python numeric library. 1.5 Fortran95 documentation The Fortran95 documentation has been updated. PLplot Release 5.7.3 ~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.7.x series will be available every few months. The next stable release will be 5.8.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Changes relative to PLplot 5.7.2 1.1 CMake build system 1.2 malloc/calloc clean up 1.3 Documentation 1.4 Additions to the PLplot API 1.5 Language bindings 1.5.1 Experimental ADA language binding 1.5.2 wxwidgets applications bindings 1.6 Drivers 1.6.1 xwinttf 1.6.2 pstex 2. Changes relative to PLplot 5.6.1 2.1 CMake build system 2.2 Plot Buffering 2.3 Updated INSTALL/README 2.4 malloc/calloc clean up 2.5 Documentation 2.6 Additions to the PLplot API 2.7 Language bindings 2.7.1 Experimental ADA language binding 2.7.2 wxwidgets applications bindings 2.8 Updated examples 2.9 Drivers 2.9.1 psttf 2.9.2 svg 2.9.3 wxwidgets 2.9.4 pdf 2.9.5 gd, wingcc (freetype) 2.9.6 xwinttf 2.9.7 pstex 1. Changes relative to PLplot 5.7.2 (the previous development release) 1.1 CMake build system Finding swig has been improved such that it should now be found as long as it is in your path. 1.2 malloc/calloc clean up Checks have been added to many (all?) of the calls to calloc and malloc in the PLplot core. The purpose of the check is to verify that the memory requested was actually allocated prior to attempting to use it. 1.3 Documentation The API section has been expanded to include information about how to call the functions from Fortran95, Java, Perl/PDL and Python. Since array dimension information is typically redundant in these languages it is dropped in many of the relevant function. Additionally, some of the Perl/PDL function calls have a different argument order than their C equivalent. This section has also been expanded to include a list of which examples each function is used in (if any). 1.4 Additions to the PLplot API The functions plptex3 and plmtex3 have been added to the PLplot API. These allow the user to draw text in "3D" on the 3D plots. plptex3 is the 3D equivalent of plptex and plmtex3 is the 3D equivalent of plmtex. 1.5 Language bindings 1.5.1 ADA Jerry Bauck has donated bindings to the ADA programming language. These are considered experimental in nature and the API is subject to change. These bindings have been included into the CMake build system, and should be generated automatically if you have an ADA compiler and you specify the cmake option -DENABLE_ada=ON. Four standard examples have been completed and work on a complete set of examples is ongoing. 1.5.2 wxwidgets applications bindings The wxWidgets bindings provide an interface to the PLplot API and a simple widget to be used in a wxWidgets application. The class 'wxPLplotstream' inherited from the PLplot class 'plstream' allows access to the complete PLplot API. 'wxPLplotWindow' is a simple wxWidget which takes care of some preparational work for convenient use of the PLplot Library within a wxWidgets application. 1.6 Drivers 1.6.1 xwinttf driver This is a new driver for X Windows that uses Cairo for rendering graphics and Pango for rendering text. The graphics and the text are both anti-aliased. It is unicode enabled and Truetype fonts are used by default. 1.6.2 pstex driver This Latex driver has now been resurrected from years of neglect and aside from bounding box issues seems to be working well. Should be useful for Latex enthusiasts. 2. Changes relative to PLplot 5.6.1 (the previous stable release) 2.1 CMake build system PLplot now uses the CMake build system (www.cmake.org) and the older autotools build system has been deprecated. The switch to CMake was made due its superior support for Windows platforms and its relative simplicity compared to autotools. CMake 2.4.5 is the minimum required version of cmake. Finding swig has been improved such that it should now be found as long as it is in your path. 2.2 Plot Buffering PLplot core has been modified to buffer plot commands in memory rather than via a unix pipe or temporary file. Testing has shown that there is 20-30% improvement in plotting performance (i.e. speed). This is likely to be system dependent and some may see a much larger benefit. This also resolves a problem with some windows platforms where the temporary files were not getting deleted. 2.3 Updated INSTALL/README The INSTALL and README files have been updated. They now include detailed instructions for building plplot using the new CMake build system on linux and windows. 2.4 malloc/calloc clean up Checks have been added to many (all?) of the calls to calloc and malloc in the PLplot core. The purpose of the check is to verify that the memory requested was actually allocated prior to attempting to use it. 2.5 Documentation The API section has been expanded to include information about how to call the functions from Fortran95, Java, Perl/PDL and Python. Since array dimension information is typically redundant in these languages it is dropped in many of the relevant function. Additionally, some of the Perl/PDL function calls have a different argument order than their C equivalent. This section has also been expanded to include a list of which examples each function is used in (if any). 2.6 Additions to the PLplot API The functions plptex3 and plmtex3 have been added to the PLplot API. These allow the user to draw text in "3D" on the 3D plots. plptex3 is the 3D equivalent of plptex and plmtex3 is the 3D equivalent of plmtex. 2.7 Language bindings 2.7.1 ADA Jerry Bauck has donated bindings to the ADA programming language. These are considered experimental in nature and the API is subject to change. These bindings have been included into the CMake build system, and should be generated automatically if you have an ADA compiler and you specify the cmake option -DENABLE_ada=ON. Four standard examples have been completed and work on a complete set of examples is ongoing. 2.7.2 wxwidgets applications bindings The wxWidgets bindings provide an interface to the PLplot API and a simple widget to be used in a wxWidgets application. The class 'wxPLplotstream' inherited from the PLplot class 'plstream' allows access to the complete PLplot API. 'wxPLplotWindow' is a simple wxWidget which takes care of some preparational work for convenient use of the PLplot Library within a wxWidgets application. 2.8 Updated examples The examples have been checked over to make sure that they all work and to make them more consistent across different programming languages. 2.9 Drivers 2.9.1 psttf This device driver now requires LASi version 1.0.6 or 1.0.5pl. See http://www.unifont.org/lasi/ for instructions (depending on installed version of FreeType library) on which to choose. 2.9.2 svg This is a new device driver that creates Scalable Vector Graphics files (http://www.w3.org/Graphics/SVG/). SVG is a XML language describing graphics that is supported directly or via plug-ins in most modern web browsers. The driver is off by default as its text handling has not been perfected. 2.9.3 wxwidgets This driver has been updated a great deal. The most important improvements have been to the antializing part of the driver. It is now about 4 times faster than it was, and is nearly comparable in speed to the driver with the antializing turned off. In addition the antializing code can now handle filled polygons and window resizing. 2.9.4 pdf A basic version of a pdf driver was added to the latest PLplot release. This driver is based on the libharu library (http://libharu.sourceforge.net/). At present only the hershey fonts are used and there is no support for pdf or ttf fonts. Compression of the pdf output is not enabled and the paper size can't be chosen. All these issues will be addressed in later releases. 2.9.5 gd, wingcc (freetype) Improved anti-aliasing routines have been added to plplot's freetype font rendering engine. The gd and wingcc drivers have been modified in turn to take advantage of these new routines, leading to improved text rendering. 2.9.6 xwinttf driver This is a new driver for X Windows that uses Cairo for rendering graphics and Pango for rendering text. The graphics and the text are both anti-aliased. It is unicode enabled and Truetype fonts are used by default. 2.9.7 pstex driver This Latex driver has now been resurrected from years of neglect and aside from bounding box issues seems to be working well. Should be useful for Latex enthusiasts. PLplot Release 5.7.2 ~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.7.x series will be available every few months. The next full release will be 5.8.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Changes relative to PLplot 5.7.1 1.1 CMake build system 1.2 Updated INSTALL/README 1.3 Updated examples 1.4 Drivers 1.4.1 pdf 1.4.2 gd, wingcc (freetype) 2. Changes relative to PLplot 5.6.1 2.1 CMake build system 2.2 Plot Buffering 2.3 Drivers 2.3.1 psttf 2.3.2 svg 2.3.3 wxwidgets 1. Changes relative to PLplot 5.7.1 (the previous development release) 1.1 CMake build system CMake 2.4.5 is the now minimum required version of cmake. A lot of work has been done to improve this build system, particularly for Windows platforms. 1.2 Updated INSTALL/README The INSTALL and README files have been updated. They now include detailed instructions for building plplot using the new CMake build system on linux and windows. 1.3 Updated examples The examples have been checked over to make sure that they all work and to make them more consistent across different programming languages. 1.4 Drivers 1.4.1 pdf A basic version of a pdf driver was added to the latest PLplot release. This driver is based on the libharu library (http://libharu.sourceforge.net/). At present only the hershey fonts are used and there is no support for pdf or ttf fonts. Compression of the pdf output is not enabled and the paper size can't be chosen. All these issues will be addressed in later releases. 1.4.2 gd, wingcc (freetype) Improved anti-aliasing routines have been added to plplot's freetype font rendering engine. The gd and wingcc drivers have been modified in turn to take advantage of these new routines, leading to improved text rendering. 2. Changes relative to PLplot 5.6.1 (the previous stable release) 2.1 CMake build system PLplot now uses the CMake build system (www.cmake.org) and the older autotools build system has been deprecated. The switch to CMake was made due its superior support for Windows platforms and its relative simplicity compared to autotools. 2.2 Plot Buffering PLplot core has been modified to buffer plot commands in memory rather than via a unix pipe or temporary file. Testing has shown that there is 20-30% improvement in plotting performance (i.e. speed). This is likely to be system dependent and some may see a much larger benefit. This also resolves a problem with some windows platforms where the temporary files were not getting deleted. 2.3 Drivers 2.3.1 psttf This device driver now requires LASi version 1.0.6 or 1.0.5pl. See http://www.unifont.org/lasi/ for instructions (depending on installed version of FreeType library) on which to choose. 2.3.2 svg This is a new device driver that creates Scalable Vector Graphics files (http://www.w3.org/Graphics/SVG/). SVG is a XML language describing graphics that is supported directly or via plug-ins in most modern web browsers. The driver is off by default as its text handling has not been perfected. 2.3.3 wxwidgets This driver has been updated a great deal. The most important improvements have been to the antializing part of the driver. It is now about 4 times faster than it was, and is nearly comparable in speed to the driver with the antializing turned off. In addition the antializing code can now handle filled polygons and window resizing. PLplot Release 5.7.1 ~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.7.x series will be available every few months. The next full release will be 5.8.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Changes relative to PLplot 5.6.1 1.1 CMake build system 1.2 Plot Buffering 1.3 Drivers 1.3.1 psttf 1.3.2 svg 1.3.3 wxwidgets 1. Changes relative to PLplot 5.6.1 (the previous stable release) 1.1 CMake build system PLplot now uses the CMake build system (www.cmake.org) and the older autotools build system has been deprecated. The switch to CMake was made due its superior support for Windows platforms and its relative simplicity compared to autotools. 1.2 Plot Buffering PLplot core has been modified to buffer plot commands in memory rather than via a unix pipe or temporary file. Testing has shown that there is 20-30% improvement in plotting performance (i.e. speed). This is likely to be system dependent and some may see a much larger benefit. This also resolves a problem with some windows platforms where the temporary files were not getting deleted. 1.3 Drivers 1.3.1 psttf This device driver now requires LASi version 1.0.6 or 1.0.5pl. See http://www.unifont.org/lasi/ for instructions (depending on installed version of FreeType library) on which to choose. 1.3.2 svg This is a new device driver that creates Scalable Vector Graphics files (http://www.w3.org/Graphics/SVG/). SVG is a XML language describing graphics that is supported directly or via plug-ins in most modern web browsers. The driver is off by default as its text handling has not been perfected. 1.3.3 wxwidgets This driver has been updated a great deal. The most important improvements have been to the antializing part of the driver. It is now about 4 times faster than it was, and is nearly comparable in speed to the driver with the antializing turned off. In addition the antializing code can now handle filled polygons and window resizing. PLplot Bug Fix Release 5.6.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This release corrects a number of outstanding issues with plplot that were discovered subsequent to the 5.6.0 release. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.7.x series will be available every few months. The next full release will be 5.8.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Changes relative to PLplot 5.6.0 1.1 API 1.1.1 f95 1.2 Drivers 1.2.1 psttf 1.2.2 pstex 1. Changes relative to PLplot 5.6.0 (the previous stable release) 1.1 Fortran 95 A lot of work was done to correct a number of outstanding issues with Fortran 95 interface. All of plplot API is now available to f95 users and a complete set of examples was created to demonstrate how to use plplot with a f95. In its current form it is known to work with gfortran compiler. Due to limitations in the current version of libtool it not possible to use both a f77 and a f95 compiler to build plplot. If you desire both interfaces the recommended approach is to compile the f77 interface with your f95 compiler, which can be done by setting the FC and F77 environment variables at the configuration stage. - The API is defined via a module, so that the compiler can now check the argument types. - It is now possible to pass arrays as assumed-shape arrays. This means: less arguments and less chances for interface errors. - The module also defines specific parameters to describe PLplot options. This way, you can use symbolic names instead of numbers. - The floating-point type PLFLT is now available as a KIND parameter, making it possible to use the same code for single and double precision applications - simply declare all real variables using the KIND facility and link with the corresponding version of the PLplot library. More information is found in bindings/f95/readme_f95.txt 1.2 Drivers 1.2.1 psttf This is a postscript driver that supports TrueType fonts. This allows access to a far greater range of fonts and characters than is possible using Type 1 postscript fonts. The driver requires the LASi (v1.0.5), pango and pangoft2 libraries to work. The pango and pangoft2 libraries are widely distributed with most Linux distributions and give the psttf driver full complex text layout (CTL) capability (see http://plplot.sourceforge.net/examples/demo24.php for an example of this capability). The LASi library is not part of most distributions at this time. The source code can be downloaded from http://www.unifont.org/lasi/. The library is small and easy to build and install. Make sure you use LASi-1.0.5. The psttf device driver uses new capabilities in this version of LASi and no longer works with LASi-1.0.4. This driver is now enabled by default. 1.2.2 pstex Permanently disable the autotools build of pstex. Other PostScript devices (either ps or psttf) appear to give better solutions so there doesn't seem to be much purpose in maintaining this currently broken device. PLplot Development Release 5.6.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a stable release of PLplot. It represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases in the 5.7.x series will be available every few months. The next full release will be 5.8.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Build Instructions 2. Changes relative to PLplot 5.5.3 2.1 API 2.1.1 PLBOOL 2.2 Drivers 2.2.1 psttf 2.2.2 wingcc 2.2.3 wxwidgets 3. Changes relative to PLplot 5.3.1 3.1 API 3.1.1 Deprecated functions 3.1.2 Unicode 3.1.3 Extended cmap0 support 3.1.4 The PlplotCanvas Widget for Gnome/GTK Applications 3.2 Drivers 3.2.1 PostScript 3.2.2 psttf 3.2.3 GD (png, jpeg, gif) 3.2.4 GCW (Gnome 2) 3.2.5 AquaTerm (Mac OS X) 3.2.6 Tk 3.2.7 wxwidgets 4. Notes on Autotools 4.1 Autotools versions 4.2 cf/bootstrap.sh output 1. Build Instructions For detailed instructions on how to build and install PLplot from this tarball, please read the INSTALL file. The basic procedure is to execute the following commands: ./configure make make install There are a variety of configuration options, and these are explained in the INSTALL document, and below as required. In particular, if you want to install the PLplot Programmer's Reference Manual, please use: ./configure --with-prebuiltdoc Note that it is often helpful to use the --with-pkg-config option if your system has the pkg-config program (typically *nix systems). 2. Changes relative to PLplot 5.5.3 (the previous development release) 2.1 API 2.1.1 PLBOOL The java interface was reworked to use the PLBOOL type. 2.1.2 Fortran 95 The language bindings have been extended to Fortran 95. While it is possible to use the F77 bindings in a program that uses the Fortran 95 features (as Fortran 95 is almost 100% compatible with FORTRAN 77), there are a few aspects specific to this newer standard that made it worthwhile to support Fortran 95 explicitly: - The API is defined via a module, so that the compiler can now check the argument types. - It is now possible to pass arrays as assumed-shape arrays. This means: less arguments and less chances for interface errors. - The module also defines specific parameters to describe PLplot options. This way, you can use symbolic names instead of numbers. - The floating-point type PLFLT is now available as a KIND parameter, making it possible to use the same code for single and double precision applications - simply declare all real variables using the KIND facility and link with the corresponding version of the PLplot library. More information is found in bindings/f95/readme_f95.txt 2.2 Drivers 2.2.1 psttf Initial version of a postscript driver that supports TrueType fonts. This allows access to a far greater range of fonts and characters than is possible using purely postscript fonts. The driver requires the LASi, pango and pangoft2 libraries to work. The pango and pangoft2 libraries are widely distributed with most Linux distributions at least. The LASi library is not part of most distributions at this time. The source code can be downloaded from http://eyegene.ophthy.med.umich.edu/lasi/. The library is small and easy to build and install. This driver is disabled by default. To try it you will need to add the --enable-psttf --enable-psttfc options when running configure. 2.2.2 wingcc Performance improvements have been implemented. 2.2.3 wxwidgets Major upgrade that eliminated a number of bugs and added support for unicode fonts. 2.2.4 win32 Support for UNICODE and anti-aliasing fonts added 3. Changes Relative to PLplot 5.3.1 (the previous stable release) 3.1 API 3.1.1 Deprecated functions plParseOpts, plHLS_RGB, and plRGB_HLS are now deprecated and will eventually be removed from the API. Use plparseopts, plhlsrgb, and plrgbhls instead for all language interfaces. 3.1.2 Unicode PLplot now supports unicode text. The escape sequence for unicode characters is #[nnn] where nnn can be decimal or hexadecimal. Escape sequences are also defined to change fonts mid-string. There are known bugs for our unicode font implementation that are listed in a special section of the PROBLEMS file, but the current implementation is good enough so we turn on unicode support by default for the psc, ps, png, gif, jpeg, and gcw devices. Although all examples look better with unicode fonts, the new PLplot unicode capabilities are especially demonstrated in examples x23 and x24. (The latter example requires special fonts to be installed and at run time environment variables have to be set to access them; see the self-documentation of the example 24 source code). 3.1.3 Extended cmap0 support. There have been many updates to cmap0 handling in the effort to wipe away all vestiges of the old 16 color limit. The theoretical limit should now be 2^15 colors, since the metafile and tk drivers use a short for communication of the cmap0 index. Should be *plenty* for the given application, i.e. fixing colors for lines, points, labels, and such. Since both the metafile & tk data stream formats have changed due to the change from U_CHAR -> short for cmap0 index representation, the format versions have been upgraded. If you see something like this: $ x02c -dev tk Error: incapable of reading output of version 2005a. plr_init: Please obtain a newer copy of plserver. Command code: 1, byte count: 14 plr_process1: Unrecognized command code 0 ... then you know it's using the wrong version of plserver (in which case either you didn't install or your path is wrong). The second example program (multiple bindings available) contains a demo of the expanded cmap0 capability. 3.1.4 The PlplotCanvas Widget for Gnome/GTK Applications PlplotCanvas is a widget for use in Gnome/GTK applications, and is contained in the libplplotgnome2d library. A specialzed API is provided, and bindings are included for the C and Python programming languages. Special example programs that demonstrate the use of PlplotCanvas in Gnome/GTK applications are given for each language binding. 3.2 Drivers Some of the drivers have undergone important revisions in order to provide unicode support. Several now present TrueType or PostScript fonts by default, which produces higher-quality output than in the past: see the examples from the GD (png) driver on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html . 3.2.1 PostScript The PostScript driver produces "publication quality" output files. It is unicode-enabled, and Type 1 PostScript fonts are used by default. Although the Type 1 symbol fonts have a significant number of mathemetical symbols available, some key special symbols (squares, triangles) are missing. Thus, by default, Hershey fonts are used to produce the symbols generated by calls to "plpoin" and "plsym", while PostScript fonts are used for calls to PLplot routines that plot text strings (e.g., "plmtex"). If you prefer a pure Hershey font environment, specify -drvopt text=0, and if you prefer a pure Postscript font environment, specify -drvopt hrshsym=0. 3.2.2 psttf An initial version of a new PostScript driver that has all the functionality of the current postscript driver and also handles TrueType fonts. 3.2.2 GD (png, jpeg, gif) The GD driver is used to produce png, jpeg, and gif files. It is unicode-enabled, and uses TrueType fonts by default. The examples on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html were produced using this driver. 3.2.3 GCW (Gnome 2) GCW is a new driver for Gnome 2 that displays plots in a tabbed window. The driver is unicode-enabled, and uses TrueType fonts. The GCW user interface supports zooming, and saves to a variety of output file formats (ps, psc, png, jpg, gif). All of the relevant command-line options for PLplot are supported. A specialized API, which allows interaction with the driver, is provided in libplplotgnome2d. Bindings are provided for the C and Python programming languages. 3.2.4 AquaTerm (Mac OS X) AquaTerm is a new driver for Mac OS X that provides PLplot output in the AquaTerm graphics terminal program. Aquaterm is a native Cocoa graphics terminal program for Mac OS X that provides a familiar look and feel to Mac users. More details about AquaTerm and how to install it can be found at http://aquaterm.sourceforge.net/. The driver is unicode-enabled and uses default OS X fonts. 3.2.5 Tk The plframe widget (and by extension, the Tk driver) now saves a plot using the correct aspect ratio, as represented by the actual window size. For complicit output drivers only, e.g. png. 3.2.6 wxwidgets This is a device driver that runs on the wxWidgets cross-platform GUI (see http://www.wxwidgets.org/) that has been donated by Werner Smekal. The driver is unicode-enabled. It currently provides a limited GUI but additional capabilities are being developed. 4. Note on the Autotools that were used for this release 4.1 Autotools versions autoconf (GNU Autoconf) 2.59 Written by David J. MacKenzie and Akim Demaille. automake (GNU automake) 1.9.6 Written by Tom Tromey . ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) 4.2 cf/bootstrap.sh output Running aclocal (GNU automake) 1.9.6... done Running autoheader (GNU Autoconf) 2.59... done Running libtoolize (GNU libtool) 1.5.22... done Running automake (GNU automake) 1.9.6... done Running autoconf (GNU Autoconf) 2.59... done Regenerating libltdl/aclocal+configure... done PLplot Development Release 5.5.4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot, and represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases represent a "work in progress", and we expect to provide installments in the 5.5.x series every few weeks. The next full release will be 5.6.0. If you encounter a problem that is not already documented in the PROBLEMS file, then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Build Instructions 2. Changes relative to PLplot 5.5.3 2.1 API 2.1.1 PlplotCanvas 2.1.2 FCI 2.2 Drivers 2.2.1 GCW (Gnome 2) 2.2.2 wxwidgets 3. Changes relative to PLplot 5.3.1 3.1 API 3.1.1 Deprecated functions 3.1.2 Unicode 3.1.3 Extended cmap0 support 3.1.4 The PlplotCanvas Widget for Gnome/GTK Applications 3.2 Drivers 3.2.1 PostScript 3.2.2 GD (png, jpeg, gif) 3.2.3 GCW (Gnome 2) 3.2.4 AquaTerm (Mac OS X) 3.2.5 Tk 3.2.6 wxwidgets 1. Build Instructions For detailed instructions on how to build and install PLplot from this tarball, please read the INSTALL file. The basic procedure is to execute the following commands: ./configure make make install There are a variety of configuration options, and these are explained in the INSTALL document, and below as required. In particular, if you want to install the PLplot Programmer's Reference Manual, please use: ./configure --with-prebuiltdoc Note that it is often helpful to use the --with-pkg-config option if your system has the pkg-config program (typically *nix systems). 2. Changes relative to PLplot 5.5.3 (the previous development release) 2.1 API 2.1.1 PlplotCanvas PlplotCanvas method wrappers for PLplot functions have dropped the prefix "pl" from the function name. For example, the method plplot_canvas_plline is now plplot_canvas_line. 2.1.2 FCI Backwards incompatible API change (with respect to 5.5.3, but not with respect to 5.3.1 since this involves a new feature within the 5.5.x development releases). PL_FCI_MARK changed from 0x10000000 to 0x80000000. This should only affect users who have been inserting absolute FCI (font characterization integer) changes within their strings to change the font in mid-string. 2.2 Drivers 2.2.1 GCW (Gnome 2) Performance improvements have been implemented. 2.2.2 wxwidgets Initial version of a device to run on the wxWidgets cross-platform GUI (see http://www.wxwidgets.org/) has been donated by Werner Smekal. Most examples work out of the box, but some (e.g., a segfault for example 8) currently have problems. More development of this immature device driver is planned. 3. Changes Relative to PLplot 5.3.1 (the previous stable release) 3.1 API 3.1.1 Deprecated functions plParseOpts, plHLS_RGB, and plRGB_HLS are now deprecated and will eventually be removed from the API. Use plparseopts, plhlsrgb, and plrgbhls instead for all language interfaces. 3.1.2 Unicode PLplot now supports unicode text. The escape sequence for unicode characters is #[nnn] where nnn can be decimal or hexadecimal. Escape sequences are also defined to change fonts mid-string. There are known bugs for our unicode font implementation that are listed in a special section of the PROBLEMS file, but the current implementation is good enough so we turn on unicode support by default for the psc, ps, png, gif, jpeg, and gcw devices. Although all examples look better with unicode fonts, the new PLplot unicode capabilities are especially demonstrated in examples x23 and x24. (The latter example requires special fonts to be installed and at run time environment variables have to be set to access them; see the self-documentation of the example 24 source code). 3.1.3 Extended cmap0 support. There have been many updates to cmap0 handling in the effort to wipe away all vestiges of the old 16 color limit. The theoretical limit should now be 2^15 colors, since the metafile and tk drivers use a short for communication of the cmap0 index. Should be *plenty* for the given application, i.e. fixing colors for lines, points, labels, and such. Since both the metafile & tk data stream formats have changed due to the change from U_CHAR -> short for cmap0 index representation, the format versions have been upgraded. If you see something like this: $ x02c -dev tk Error: incapable of reading output of version 2005a. plr_init: Please obtain a newer copy of plserver. Command code: 1, byte count: 14 plr_process1: Unrecognized command code 0 ... then you know it's using the wrong version of plserver (in which case either you didn't install or your path is wrong). The second example program (multiple bindings available) contains a demo of the expanded cmap0 capability. 3.1.4 The PlplotCanvas Widget for Gnome/GTK Applications PlplotCanvas is a widget for use in Gnome/GTK applications, and is contained in the libplplotgnome2d library. A specialzed API is provided, and bindings are included for the C and Python programming languages. Special example programs that demonstrate the use of PlplotCanvas in Gnome/GTK applications are given for each language binding. 3.2 Drivers Some of the drivers have undergone important revisions in order to provide unicode support. Several now present TrueType or PostScript fonts by default, which produces higher-quality output than in the past: see the examples from the GD (png) driver on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html . 3.2.1 PostScript The PostScript driver produces "publication quality" output files. It is unicode-enabled, and Type 1 PostScript fonts are used by default. Although the Type 1 symbol fonts have a significant number of mathemetical symbols available, some key special symbols (squares, triangles) are missing. Thus, by default, Hershey fonts are used to produce the symbols generated by calls to "plpoin" and "plsym", while PostScript fonts are used for calls to PLplot routines that plot text strings (e.g., "plmtex"). If you prefer a pure Hershey font environment, specify -drvopt text=0, and if you prefer a pure Postscript font environment, specify -drvopt hrshsym=0. 3.2.2 GD (png, jpeg, gif) The GD driver is used to produce png, jpeg, and gif files. It is unicode-enabled, and uses TrueType fonts by default. The examples on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html were produced using this driver. 3.2.3 GCW (Gnome 2) GCW is a new driver for Gnome 2 that displays plots in a tabbed window. The driver is unicode-enabled, and uses TrueType fonts. The GCW user interface supports zooming, and saves to a variety of output file formats (ps, psc, png, jpg, gif). All of the relevant command-line options for PLplot are supported. A specialized API, which allows interaction with the driver, is provided in libplplotgnome2d. Bindings are provided for the C and Python programming languages. 3.2.4 AquaTerm (Mac OS X) AquaTerm is a new driver for Mac OS X that provides PLplot output in the AquaTerm graphics terminal program. Aquaterm is a native Cocoa graphics terminal program for Mac OS X that provides a familiar look and feel to Mac users. More details about AquaTerm and how to install it can be found at http://aquaterm.sourceforge.net/. The driver is unicode-enabled and uses default OS X fonts. To install the AquaTerm driver, use the options "--disable-dyndrivers" and "--disable-f77" during the configure step of the install process. 3.2.5 Tk The plframe widget (and by extension, the Tk driver) now saves a plot using the correct aspect ratio, as represented by the actual window size. For complicit output drivers only, e.g. png. 3.2.6 wxwidgets Initial version of a device to run on the wxWidgets cross-platform GUI (see http://www.wxwidgets.org/) has been donated by Werner Smekal. Most examples work out of the box, but some (e.g., a segfault for example 8) currently have problems. More development of this immature device driver is planned. PLplot Development Release 5.5.2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot, and represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases represent a "work in progress", and we expect to provide installments in the 5.5.x series every few weeks. The next full release will be 5.6.0. If you encounter a problem that is not already documented in the PROBLEMS file then please send bug reports to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed, and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Build Instructions 2. Changes Relative to PLplot 5.5.1 2.1 API 2.2 Drivers 3. Changes Relative to PLplot 5.3.1 3.1 API 3.1.1 Unicode 3.1.2 Extended cmap0 support 3.2 Drivers 3.2.1 PostScript 3.2.2 GD (png, jpeg, gif) 3.2.3 GCW "Gnome Canvas Widget" 3.2.4 AquaTerm (Mac OS X) 3.2.5 Tk 1. Build Instructions For detailed instructions on how to build and install PLplot from this tarball, please read the INSTALL file. The basic procedure is to execute the following commands: ./configure make make install There are a variety of configuration options, and these are explained in the INSTALL document, and below as required. In particular, if you want to install the PLplot Programmer's Reference Manual (which is required for documentation on any new feature since PLplot 5.3.1), you must use: ./configure --with-prebuiltdoc Note that it is often helpful to use the --with-pkg-config option if your system has the pkg-config program (typically *nix systems). 2. Changes Relative to our last development release, PLplot 5.5.1 Progress toward our next major release with documentation improvements and a substantial number of minor tweaks and bug fixes. 2.1 API No change. 2.2 Drivers No change. 3. Changes Relative to our last stable release, PLplot 5.3.1 3.1 API 3.1.1 Unicode PLplot now allows unicode text, and this is detailed in the PLplot Programmers Reference Manual in the section on "Setting Character Attributes". The escape sequence for unicode characters is #[nnn] where nnn can be decimal or hexadecimal. Escape sequences are also defined to change fonts mid-string. There are known bugs for our unicode font implementation that are listed in a special section of the PROBLEMS file, but the current implementation is good enough so we turn on unicode support by default for the psc, ps, png, gif, jpeg, and gcw devices. Although all examples look better with unicode fonts, the new PLplot unicode capabilities are especially demonstrated in examples x23 and x24. (The latter example requires special fonts to be installed and at run time environment variables have to be set to access them, see the self-documentation of the example 24 source code). 3.1.2 Extended cmap0 support. There have been many updates to cmap0 handling in the effort to wipe away all vestiges of the old 16 color limit. The theoretical limit should now be 2^15 colors, since the metafile and tk drivers use a short for communication of the cmap0 index. Should be *plenty* for the given application, i.e. fixing colors for lines, points, labels, and such. Since both the metafile & tk data stream formats have changed due to the change from U_CHAR -> short for cmap0 index representation, the format versions have been upgraded. If you see something like this: $ x02c -dev tk Error: incapable of reading output of version 2005a. plr_init: Please obtain a newer copy of plserver. Command code: 1, byte count: 14 plr_process1: Unrecognized command code 0 ... then you know it's using the wrong version of plserver (in which case either you didn't install or your path is wrong). The second example program (multiple bindings available) contains a demo of the expanded cmap0 capability. 3.2 Drivers Some of the drivers have undergone important revisions in order to provide unicode support. Several now present TrueType or PostScript fonts by default, which produces higher-quality output than in the past: see the examples from the GD (png) driver on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html . 3.2.1 PostScript The PostScript driver is unicode-enabled, and Type 1 PostScript fonts are used by default. Although the Type 1 symbol fonts do have a significant number of mathemetical symbols available some key special symbols (squares, triangles) are missing so that by default Hershey fonts are used to produce the symbols generated by calls to "plpoin" and "plsym" while PostScript fonts are used for calls to PLplot routines that plot text strings (e.g., "plmtex"). If you prefer a pure Hershey font environment, specify -drvopt text=0, and if you prefer a pure Postscript font environment, specify -drvopt hrshsym=0. Tranforms to the text (i.e., rotations, shears) have been dramatically improved, and the PostScript driver now produces "publication quality" output with the default PostScript fonts for text and Hershey fonts for special symbols. 3.2.2 GD (png, jpeg, gif) The GD driver is unicode-enabled, and uses TrueType fonts by default. The examples on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html were produced using this driver. 3.2.3 GCW "Gnome Canvas Widget" The GCW "Gnome Canvas Widget" is a new driver that provides PLplot output in a tabbed Gnome window. It can alternatively be used to drive a special widget called the PlplotCanvas that can be embedded in Gnome applications. The driver, associated widget, and specialized API are fully documented in the PLplot Programmer's Reference Manual in the sections titled "The GCW Driver" and "Embedding Plots in Gnome/GTK Applications", respectively. The GCW driver is unicode-enabled, and uses TrueType fonts by default. Special examples that demonstrate the use of the PlplotCanvas are provided for both the C and Python programming languages. To install the GCW driver, use the "--enable-gcw" option during the configure step of the install process. For more information on GTK, see http://www.gtk.org/ . 3.2.4 AquaTerm (Mac OS X) AquaTerm is a new driver that provides PLplot output in the AquaTerm graphics terminal program. Aquaterm is a native Cocoa graphics terminal program for Mac OS X that provides a familiar look and feel to Mac users. More details about AquaTerm and how to install it can be found at http://aquaterm.sourceforge.net/. The driver is unicode-enabled, however it currently only supports the default OS X fonts which are not TrueType. To install the AquaTerm driver, use the options "--disable-dyndrivers" and "--disable-f77" during the configure step of the install process. 3.2.5 Tk The plframe widget (and by extension, the Tk driver) now saves a plot using the correct aspect ratio, as represented by the actual window size. For complicit output drivers only, e.g. png. PLplot Development Release 5.5.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot, and represents the ongoing efforts of the community to improve the PLplot plotting package. Development releases represent a "work in progress", and we expect to provide installments in the 5.5.x series every few weeks. The next full release will be 5.6.0. Feedback on this development release can be communicated to PLplot developers via the mailing lists at http://sourceforge.net/mail/?group_id=2915 . Please see the license under which this software is distributed, and the disclaimer of all warrantees, given in the COPYING.LIB file. INDEX 1. Build Instructions 1.1 Tcl 2. Changes 2.1 API 2.2 Drivers 1. Build Instructions For detailed instructions on how to build and install PLplot from this tarball, please read the INSTALL file. The basic procedure is to execute the following commands: ./configure make make install There are a variety of configuration options, and these are explained in the INSTALL document, and below as required. In particular, if you want to install the PLplot Programmer's Reference Manual (which is required for documentation on any new feature since PLplot 5.3.1), you must use: ./configure --with-prebuiltdoc Note that it is often helpful to use the --with-pkg-config option if your system has the pkg-config program (typically *nix). 1.1 Tcl Due to unresolved problems in the build process, tcl has been temporarily disabled for this release. If you must have tcl, here are the instrutions. DO NOT ATTEMPT THIS UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING. 1) Move all plplot files in /usr/lib and /usr/local/lib into a temporary directory. 2) Use the --enable-tcl and --enable-itcl options during configure. 2. Changes 2.1 API 2.2 Drivers PLplot Development Release 5.5.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a routine development release of PLplot, and represents the ongoing efforts of the community to improve the PLplot plotting package. The next full release will be 5.6.0. INDEX 1. Build Instructions 2. Changes 2.1 API 2.1.1 Unicode 2.2 Drivers 2.2.1 Postscript 2.2.2 GD (png, jpeg, gif) 2.2.3 GCW "Gnome Canvas Widget" 1. Build Instructions For detailed instructions on how to build and install PLplot from this tarball, please read the INSTALL file. The basic procedure is to execute the following commands: ./configure make make install There are a variety of configuration options, and these are explained in the INSTALL document, and below as required. In particular, if you want to build and install the PLplot Programmer's Reference Manual (which is required for documentation on any new feature since PLplot 5.3.1), you must use: ./configure --enable-builddoc Detailed instructions on building the documentation, including the packages that you will need for a successful build, are provided in this tarball under doc/docbook/README.developers. 2. Changes 2.1 API 2.1.1 Unicode PLplot now allows unicode text, and this is detailed in the PLplot Programmers Reference Manual in the section on "Setting Character Attributes". The escape sequence for unicode characters is #[nnn] where nnn can be decimal or hexdecimal. Escape sequences are also defined to change fonts mid-string. The new unicode capabilities are demonstrated in example x23. 2.2 Drivers Some of the drivers have undergone important revisions in order to provide unicode support. Several now present truetype or postscript fonts by default, which produces higher-quality output than in the past: see the examples from the GD (png) driver on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html. 2.2.1 PostScript The PostScript driver is unicode-enabled, and Type 1 PostScript fonts are used by default. Because many symbols are missing from the Type 1 PostScript fonts, Hershey fonts are used for calls to "plpoin". Tranforms to the text (i.e., rotations, shears) have been dramatically improved, and the PostScript driver now produces "publication quality" output. 2.2.2 GD (png, jpeg, gif) The GD driver is unicode-enabled, and uses truetype fonts by default. The examples on the PLplot Web site at http://plplot.sourceforge.net/examples/index.html were produced using this driver. 2.2.3 GCW "Gnome Canvas Widget" The GCW "Gnome Canvas Widget" is a new driver that provides PLplot output in a tabbed Gnome window. It can alternatively be used to drive a special widget called the PlplotCanvas that can be embedded in Gnome applications. The driver, associated widget, and specialized API are fully documented in the PLplot Programmer's Reference Manual in the sections titled "The GCW Driver" and "Embedding Plots in Gnome/GTK Applications", respectively. The GCW driver is unicode-enabled, and uses truetype fonts by default. Special examples that demonstrate the use of the PlplotCanvas are provided for both the C and Python programming languages. To install the GCW driver, use the "--enable-gcw" option during the configure step of the install process. plplot-5.10.0+dfsg/PROBLEMS 644 1750 1750 1700711377762173 141410ustar andrewandrewThis file is designed to keep track of various problem fixes and new features being worked on for the current PLplot CVS MAIN HEAD version and who is taking responsibility for following up on each item. The items are divided into Essential and "Would be nice" (i.e., release critical versus not) with each of those categories further classified into minor or major effort required. N.B. at the end we have an additional section on problems/issues associated with the new unicode-aware fonts. Essential, major effort required. ******************************** Essential, minor effort required. ******************************** * PLplot documentation of python, java, etc., interfaces. Alan "Would be nice", major effort required. *************************************** * Fix bad-looking surface contours for plsurf. The problem goes away if the plP_fill call is commented out in the normal series of alternating calls to plP_fill and plline3 that are used to generate the surface and the surface contours. So I conclude there is some inconsistency between the edge of the triangles as defined for the surface contours plotted by plline3 and the edge of the triangles being filled. Low resolution devices have worse problems than high resolution devices. Surface contours look bad for png, better (but still not acceptable for publication) for psc, better still for xwin, and I could not find any problems at all for tk. * Move from DSSL based docbook stylesheets to XSL. Rafael, as soon as the XSL results look as good (pdf currently a problem) as the DSSL results. * Maurice's idea of plsopt and plsdopt so that our API doesn't keep proliferating. Example, instead of plenv0 do: plsopt("plenv_advance", "0"); plenv(...) * -the tk drivers ignore plconfig.tcl if it is in the user directory ~/tcl and a tclIndex file is generated. "auto_path" is correctly initialized to ~/tcl, pwd/tcl, etc, but plconfig is not executed. Reported by Joao. Status? * Maurice plans to finish his changes to implement handling strings as strings in the metafile format. * Geoffrey plans to at least evaluate remaining fidelity problems caused by our 16-bit integer approach. * Put in index limits for the plot3d API's so they can handle non-rectangular x,y regions. This has already been done for plsurf and needs to be extended to plot3d. * Put in variation of "defined" callback function with user-defined data for plshade and plshades. Rafael? * Put in "defined" callback function with user-defined data for plcont, plot3d, and plsurf. This will supersede the non-rectangular x,y regions change already done for plsurf and planned for plot3d, but this programming is harder than those previous or planned changes so it will probably take longer. Rafael? "Would be nice", minor effort required. *************************************** * 2003-09-20: The generated info files should have their root name changed from plplotdoc (plplotdoc.info, etc.) to plplot$version like the rest of the generated files (plplot-5.2.1.cvs.20030915.dvi, etc.) Note this change would require that packagers' scripts that execute install-info would need a change to use the versioned name, but this should be straightforward to do both for RedHat and Debian packages. * 2003-09-20: References are not there in info bibliography section (chapter 14). According to Rafael this problem is caused by docbook2x not currently supporting the and tags so we will have to wait for that to get sorted out. * plplot_general list 2003-08-26: Arjen Markus "I have found that with the X Window driver the values returned by plgspa() are/can be too small by a factor of approximately 1.4." This should be followed up by an attempt to confirm the bug, and if it is there, fix it. * Error messages for when the extended search fails in tclAPI.c. This is required when running in tcl-only mode with no plframe or stack trace. * As part of extended search try the install location. We know exactly where that is relative to our font data, and we know exactly where the font data are installed so we know the absolute path to our tcl install location. Then, the only way such an extended search would fail is if the packagers messed with our tcl install location. * Use some well-recognized pdf verification tool (similar in spirit to the w3c verification tests for web sites) to be sure our results conform to the published pdf standards. Currently there is no idea whether such a pdf verification tool exists, but acroread is buggy on Linux so that is not good enough as a verification tool. Collection of problems/issues with new unicode-aware fonts as of 2005-03-21. All these are in the would-be-nice category with some/all taking major effort to resolve. **************************************************************************** I. Font problems associated with plfreetype.c which is called by gd.c which implements the png, gif, or jpeg devices. (These issues were discovered using -dev png). * The default -drvopt smooth=1 option does not work (lots of cmap0 index errors) if there is any user change to cmap0. This problem is triggered if you attempt to run example 2 with -dev png. Andrew Roach thinks he knows a small redesign that will fix it. * There are still problems with vertical alignment of symbols for plfreetype.c. See results from examples/c/x06c -dev png -o test.png where on line 100 the characters move up or down depending on whether they have an ascender, descender or neither. There are similar problems for example 7. N.B. This is only a problem for plpoin (example 6) and plsym (example 7), but not a problem for plmtex. So there is probably some issue with the way plhrsh (called by plpoin and plsym) sets up the call to the code in plfreetype.c that is not present for plmtex. * The above problem may be related to the xform setting in plhrsh (plsym.c) which is a kludge. if you define TEST_FOR_MISSING_GLYPHS, it quits working (all the symbols are twisted by 90 deg). * -drvopt 24bit problems. If this option is turned on (and only in this case), Example 9 and 22 second and subsequent pages have rectangular viewports with no box or tick marks. Furthermore, with Example 19 the second and 3rd pages turn black. If you use -bg FFFFFF, you can see the problem is a cmap0 one, somehow 24bit turns the default red colour into black which doesn't show against the normal black background, but which does show against a white background as with -bg FFFFFF. * text clipping does not work (see example 9). There is a clipping method in libgd, but the preferred solution (since it will apply to every device driver that uses plfreetype.c) is to use the libfreetype clipping method which Andrew Ross found in the freetype documentation. * We need to build in fontconfig support into plfreetype.c for truetype fonts. This well-known library by Keith Packard is available for both Linux and windows and should allow truetype font selection by name rather than by filename, and font substitution on both Linux and windows if the requested named font is not available. II. Font problems associated with ps.c and either -dev psc or -dev ps. * The overall size of the text is systematically smaller than for Hershey or TrueType fonts. III. Other font problems/issues. * We should enable additional device drivers for unicode. In particular, our two most heavily used interactive device drivers, xwin and tk, should give some outstanding looking results once they are unicode-enabled. I nominate Maurice to make this happen.... :-) plplot-5.10.0+dfsg/NEWS 644 1750 1750 153112243272525 134330ustar andrewandrewThis file contains no PLplot news. Instead it points to the places where you can find such news. For short news items about PLplot stretching back to 2001 look at http://sourceforge.net/p/plplot/news/?source=navbar For current release notes see README.release For older release notes stretching back to 5.5.0 see OLD-README.release. For still older release announcements, see http://plplot.sourceforge.net/announce/announce-plplot-5.3.1.xhtml http://plplot.sourceforge.net/announce/announce-plplot-5.3.0.xhtml http://plplot.sourceforge.net/announce/announce-plplot-5.2.1.html http://plplot.sourceforge.net/announce/announce-plplot-5.1.0.html For release notes for 4.99j (some also covered in slightly different format in OLDER-NEWS) through PLplot-5.1.0, see OLD-NEWS. For key e-mails from 1993 to the release announcement for 5.0.2 see OLDER-NEWS. plplot-5.10.0+dfsg/examples/ 775 1750 1750 012406243570 144735ustar andrewandrewplplot-5.10.0+dfsg/examples/d/ 775 1750 1750 012406243570 147165ustar andrewandrewplplot-5.10.0+dfsg/examples/d/x04d.d 644 1750 1750 1110412163113463 157320ustar andrewandrew// $Id: x04d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Log plot demo. // import plplot; import std.math; import std.string; //-------------------------------------------------------------------------- // main // // Illustration of logarithmic axes, and redefinition of window. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); plfont( 2 ); // Make log plots using two different styles. plot1( 0 ); plot1( 1 ); plend(); return 0; } //-------------------------------------------------------------------------- // plot1 // // Log-linear plot. //-------------------------------------------------------------------------- void plot1( int type ) { PLFLT[101] freql, ampl, phase; PLFLT f0, freq; PLINT nlegend; string[] text, symbols; PLINT[] opt_array; PLINT[] text_colors; PLINT[] box_colors; PLINT[] box_patterns; PLFLT[] box_scales; PLFLT[] box_line_widths; PLINT[] line_colors; PLINT[] line_styles; PLFLT[] line_widths; PLINT[] symbol_numbers, symbol_colors; PLFLT[] symbol_scales; PLFLT legend_width, legend_height; pladv( 0 ); // Set up data for log plot f0 = 1.0; for ( size_t i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, freql[i] ); ampl[i] = 20.0 * log10( 1.0 / sqrt( 1.0 + pow( ( freq / f0 ), 2.0 ) ) ); phase[i] = -( 180.0 / PI ) * atan( freq / f0 ); } plvpor( 0.15, 0.85, 0.1, 0.9 ); plwind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. plcol0( 1 ); switch ( type ) { case 0: plbox( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: plbox( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; default: break; } // Plot ampl vs freq plcol0( 2 ); plline( freql, ampl ); plcol0( 2 ); plptex( 1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade" ); // Put labels on plcol0( 1 ); plmtex( "b", 3.2, 0.5, 0.5, "Frequency" ); plmtex( "t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter" ); plcol0( 2 ); plmtex( "l", 5.0, 0.5, 0.5, "Amplitude (dB)" ); // For the gridless case, put phase vs freq on same plot if ( type == 0 ) { plcol0( 1 ); plwind( -2.0, 3.0, -100.0, 0.0 ); plbox( "", 0.0, 0, "cmstv", 30.0, 3 ); plcol0( 3 ); plline( freql, phase ); plstring( freql, phase, "*" ); plcol0( 3 ); plmtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); nlegend = 2; } else { nlegend = 1; } // Initialize arrays needed for pllegend. opt_array.length = nlegend; text_colors.length = nlegend; text.length = nlegend; line_colors.length = nlegend; line_styles.length = nlegend; line_widths.length = nlegend; box_colors.length = nlegend; box_patterns.length = nlegend; box_scales.length = nlegend; box_line_widths.length = nlegend; symbol_numbers.length = nlegend; symbol_colors.length = nlegend; symbol_scales.length = nlegend; symbols.length = nlegend; // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; text[0] = "Amplitude"; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.; // Note from the above opt_array the first symbol (and box) indices // do not have to be specified if ( nlegend == 2 ) { opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; text[1] = "Phase shift"; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // Note from the above opt_array the second box array indices // do not have to be specified } plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); } plplot-5.10.0+dfsg/examples/d/x08d.d 644 1750 1750 1447412163113463 157530ustar andrewandrew// $Id: x08d.d 12393 2013-06-27 19:49:07Z andrewross $ // // // 3-d plot demo. // // Copyright (C) 2008 Werner Smekal // Copyright (C) 2004 Alan W. Irwin // Copyright (C) 2004 Rafael Laboissiere // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // import plplot; import std.string; import std.math; import std.c.stdlib; int sombrero = 0; //-------------------------------------------------------------------------- // cmap1_init1 // // Initializes color map 1 in HLS space. // Basic grayscale variation from half-dark (which makes more interesting // looking plot compared to dark) to light. // An interesting variation on this: // s[1] = 1.0 //-------------------------------------------------------------------------- void cmap1_init( bool gray ) { PLFLT[2] i, h, l, s; i[] = [ 0.0, 1.0 ]; // boundaries if ( gray ) { h[] = [ 0.0, 0.0 ]; // hue -- low: red (arbitrary if s=0), high: red (arbitrary if s=0) l[] = [ 0.5, 1.0]; // lightness -- low: half-dark, high: light s[] = [ 0.0, 0.0 ]; // minimum saturation } else { h[] = [ 240.0, 0.0 ]; // blue -> green -> yellow -> red l[] = [ 0.6, 0.6 ]; s[] = [ 0.8, 0.8 ]; } plscmap1n( 256 ); c_plscmap1l( 0, 2, cast(PLFLT*) i, cast(PLFLT*) h, cast(PLFLT*) l, cast(PLFLT*) s, null ); } //-------------------------------------------------------------------------- // main // // Does a series of 3-d plots for a given data set, with different // viewing options in each plot. //-------------------------------------------------------------------------- int main( char[][] args ) { const nlevel = 10; const XPTS = 35; // Data points in x const YPTS = 46; // Data points in y PLFLT xx, yy, r; bool rosen = true; PLFLT[] alt = [ 60.0, 20.0 ]; PLFLT[] az = [ 30.0, 60.0 ]; string title[] = [ "#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60" ]; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); if ( sombrero ) rosen = false; // Initialize plplot plinit(); // Allocate data structures PLFLT[XPTS] x; PLFLT[YPTS] y; PLFLT[][] z = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) z[i] = new PLFLT[YPTS]; for ( int i = 0; i < XPTS; i++ ) { x[i] = ( cast(PLFLT) ( i - ( XPTS / 2 ) ) / cast(PLFLT) ( XPTS / 2 ) ); if ( rosen ) x[i] *= 1.5; } for ( int i = 0; i < YPTS; i++ ) { y[i] = cast(PLFLT) ( i - ( YPTS / 2 ) ) / cast(PLFLT) ( YPTS / 2 ); if ( rosen ) y[i] += 0.5; } for ( size_t i = 0; i < XPTS; i++ ) { xx = x[i]; for ( size_t j = 0; j < YPTS; j++ ) { yy = y[j]; if ( rosen ) { z[i][j] = pow( 1. - xx, 2. ) + 100. * pow( yy - pow( xx, 2. ), 2. ); // The log argument may be zero for just the right grid. if ( z[i][j] > 0. ) z[i][j] = log( z[i][j] ); else z[i][j] = -5.; // -MAXFLOAT would mess-up up the scale } else { r = sqrt( xx * xx + yy * yy ); z[i][j] = exp( -r * r ) * cos( 2.0 * PI * r ); } } } PLFLT zmin, zmax; f2mnmx( z, zmin, zmax ); PLFLT step = ( zmax - zmin ) / ( nlevel + 1 ); PLFLT[nlevel] clevel; for ( size_t i = 0; i < nlevel; i++ ) clevel[i] = zmin + step + step * i; pllightsource( 1., 1., 1. ); for ( size_t k = 0; k < 2; k++ ) { for ( size_t ifshade = 0; ifshade < 4; ifshade++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -0.9, 1.1 ); plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, title[k] ); plcol0( 1 ); if ( rosen ) plw3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k] ); else plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); plcol0( 2 ); switch ( ifshade ) { case 0: // diffuse light surface plot cmap1_init( 1 ); plsurf3d( x, y, z, 0 ); break; case 1: // magnitude colored plot cmap1_init( 0 ); plsurf3d( x, y, z, MAG_COLOR ); break; case 2: // magnitude colored plot with faceted squares cmap1_init( 0 ); plsurf3d( x, y, z, MAG_COLOR | FACETED ); break; default: // magnitude colored plot with contours cmap1_init( 0 ); plsurf3d( x, y, z, MAG_COLOR | SURF_CONT | BASE_CONT, clevel ); break; } } } plend(); return 0; } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- void f2mnmx( PLFLT[][] f, out PLFLT fmn, out PLFLT fmx ) { fmx = f[0][0]; fmn = fmx; for ( int i = 0; i < f.length; i++ ) { for ( int j = 0; j < f[i].length; j++ ) { fmx = fmax( fmx, f[i][j] ); fmn = fmin( fmn, f[i][j] ); } } } plplot-5.10.0+dfsg/examples/d/x14d.d 644 1750 1750 2405511544777744 157700ustar andrewandrew// $Id: x14d.d 11684 2011-03-31 04:15:32Z airwin $ // // Demo of multiple stream/window capability (requires Tk or Tcl-DP). // // Maurice LeBrun // IFS, University of Texas at Austin // // Copyright (C) 2009 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.math; import std.stdio; import plplot; //-------------------------------------------------------------------------- // main // // Plots several simple functions from other example programs. // // This version sends the output of the first 4 plots (one page) to two // independent streams. //-------------------------------------------------------------------------- int main( char[][] args ) { // Select either TK or DP driver and use a small window // Using DP results in a crash at the end due to some odd cleanup problems // The geometry strings MUST be in writable memory string geometry_master = "500x410+100+200"; string geometry_slave = "500x410+650+200"; // plplot initialization // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // If valid geometry specified on command line, use it for both streams. PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; plgpage( &xp0, &yp0, &xleng0, &yleng0, &xoff0, &yoff0 ); bool valid_geometry = ( xleng0 > 0 && yleng0 > 0 ); // Set up first stream if ( valid_geometry ) plspage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); else plsetopt( "geometry", geometry_master ); plssub( 2, 2 ); plinit(); string driver; plgdev( driver ); PLINT fam, num, bmax; plgfam( &fam, &num, &bmax ); writefln( "Demo of multiple output streams via the %s driver.", driver ); writefln( "Running with the second stream as slave to the first.\n" ); // Start next stream plsstrm( 1 ); if ( valid_geometry ) plspage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); else plsetopt( "geometry", geometry_slave ); // Turn off pause to make this a slave (must follow master) plspause( 0 ); plsdev( driver ); plsfam( fam, num, bmax ); // Currently number of digits in format number can only be // set via the command line option plsetopt( "fflen", "2" ); plinit(); // Set up the data & plot // Original case plsstrm( 0 ); plot myPlot = new plot; myPlot.plot1( 6, 1, 0, 0 ); // Set up the data & plot myPlot.plot1( 1, 1e6, 0, 0 ); // Set up the data & plot int digmax = 2; plsyax( digmax, 0 ); myPlot.plot1( 1, 1e-6, 0, 0 ); // Set up the data & plot digmax = 5; plsyax( digmax, 0 ); myPlot.plot1( 1, 0.0014, 0, 0.0185 ); // To slave // The pleop() ensures the eop indicator gets lit. plsstrm( 1 ); myPlot.plot4(); pleop(); // Back to master plsstrm( 0 ); myPlot.plot2(); myPlot.plot3(); // To slave plsstrm( 1 ); myPlot.plot5(); pleop(); // Back to master to wait for user to advance plsstrm( 0 ); pleop(); // Call plend to finish off. plend(); return 0; } // special variables for plot5() and mypltr const int XPTS = 35; const int YPTS = 46; const double XSPA = 2.0 / ( XPTS - 1 ); const double YSPA = 2.0 / ( YPTS - 1 ); // Transformation function extern ( C ) { PLFLT[] tr = [ XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 ]; void mypltr( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } } class plot { private PLFLT[] x, y, x0, y0; private PLFLT[6] xs, ys; private PLINT[1] space1 = [ 1500 ], mark1 = [ 1500 ]; public void plot1( PLFLT xscale, PLFLT yscale, PLFLT xoff, PLFLT yoff ) { x.length = 60; y.length = 60; for ( int i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale*pow( x[i], 2. ); } PLFLT xmin = x[0]; PLFLT xmax = x[59]; PLFLT ymin = y[0]; PLFLT ymax = y[59]; for ( int i = 0; i < xs.length; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 6 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points plcol0( 9 ); plpoin( xs, ys, 9 ); // Draw the line through the data plcol0( 4 ); plline( x, y ); plflush(); } public void plot2() { // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). plcol0( 1 ); plenv( -2.0, 10.0, -0.4, 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays x.length = 100; y.length = 100; for ( int i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line plcol0( 3 ); plline( x, y ); plflush(); } public void plot3() { // For the final graph we wish to override the default tick intervals, and // so do not use PLENV pladv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. plvsta(); plwind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl // expects a pointer!! plstyl( mark1, space1 ); plcol0( 2 ); plbox( "g", 30.0, 0, "g", 0.2, 0 ); plstyl( null, null ); plcol0( 3 ); pllab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); x.length = 101; y.length = 101; for ( int i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * PI / 180.0 ); } plcol0( 4 ); plline( x, y ); plflush(); } public void plot4() { string text; x0.length = 361; y0.length = 361; PLFLT dtr = PI / 180.0; for ( int i = 0; i < 361; i++ ) { x0[i] = cos( dtr * i ); y0[i] = sin( dtr * i ); } // Set up viewport and window, but do not draw box plenv( -1.3, 1.3, -1.3, 1.3, 1, -2 ); x.length = 361; y.length = 361; for ( int i = 1; i <= 10; i++ ) { for ( int j = 0; j < 361; j++ ) { x[j] = 0.1 * i * x0[j]; y[j] = 0.1 * i * y0[j]; } // Draw circles for polar grid plline( x, y ); } plcol0( 2 ); for ( int i = 0; i <= 11; i++ ) { PLFLT theta = 30.0 * i; PLFLT dx = cos( dtr * theta ); PLFLT dy = sin( dtr * theta ); // Draw radial spokes for polar grid pljoin( 0.0, 0.0, dx, dy ); text = format( "%d", lrint( theta ) ); // Write labels for angle // Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) plptex( dx, dy, dx, dy, -0.15, text ); else plptex( dx, dy, -dx, -dy, 1.15, text ); } // Draw the graph for ( int i = 0; i < 361; i++ ) { PLFLT r = sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } plcol0( 3 ); plline( x, y ); plcol0( 4 ); plmtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); plflush(); } // =============================================================== // Demonstration of contour plotting public void plot5() { PLFLT[] clevel = [ -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. ]; // Set up function arrays PLFLT[][] z, w; z.length = XPTS; w.length = XPTS; for ( int i = 0; i < XPTS; i++ ) { PLFLT xx = cast(double) ( i - ( XPTS / 2 ) ) / ( XPTS / 2 ); z[i].length = YPTS; w[i].length = YPTS; for ( int j = 0; j < YPTS; j++ ) { PLFLT yy = cast(double) ( j - ( YPTS / 2 ) ) / ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( z, 1, XPTS, 1, YPTS, clevel, &mypltr ); plstyl( mark1, space1 ); plcol0( 3 ); plcont( w, 1, XPTS, 1, YPTS, clevel, &mypltr ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); plflush(); } } plplot-5.10.0+dfsg/examples/d/x03d.d 644 1750 1750 436211544777744 157450ustar andrewandrew// $Id: x03d.d 11684 2011-03-31 04:15:32Z airwin $ // // Polar plot demo. // import std.math; import std.string; import plplot; //-------------------------------------------------------------------------- // main // // Generates polar plot, with 1-1 scaling. //-------------------------------------------------------------------------- int main( char[][] args ) { PLFLT dtr = PI / 180.0; PLFLT[] x0, y0; x0.length = y0.length = 361; for ( size_t i = 0; i < x0.length; i++ ) { x0[i] = cos( dtr * i ); y0[i] = sin( dtr * i ); } // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Set orientation to portrait - note not all device drivers // support this, in particular most interactive drivers do not plsori( 1 ); // Initialize plplot plinit(); // Set up viewport and window, but do not draw box plenv( -1.3, 1.3, -1.3, 1.3, 1, -2 ); // Draw circles for polar grid for ( size_t i = 1; i < 11; i++ ) plarc( 0.0, 0.0, 0.1 * i, 0.1 * i, 0.0, 360.0, 0.0, 0 ); plcol0( 2 ); for ( size_t i = 0; i <= 11; i++ ) { PLFLT theta = 30.0 * i; PLFLT dx = cos( dtr * theta ); PLFLT dy = sin( dtr * theta ); // Draw radial spokes for polar grid pljoin( 0.0, 0.0, dx, dy ); // Write labels for angle string text = format( "%d", lrint( theta ) ); PLFLT offset; if ( theta < 9.99 ) offset = 0.45; else if ( theta < 99.9 ) offset = 0.30; else offset = 0.15; // Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) plptex( dx, dy, dx, dy, -offset, text ); else plptex( dx, dy, -dx, -dy, 1. + offset, text ); } // Draw the graph PLFLT r; PLFLT[] x, y; x.length = y.length = 361; for ( size_t i = 0; i < x.length; i++ ) { r = sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } plcol0( 3 ); plline( x, y ); plcol0( 4 ); plmtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); // Close the plot at end plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x00d.d 644 1750 1750 326211722016102 157040ustar andrewandrew// $Id: x00d.d 12179 2012-02-24 23:24:50Z andrewross $ // // Simple demo of a 2D line plot. // // Copyright (C) 2011 Alan W. Irwin // Copyright (C) 2012 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import plplot; int main( char[][] args ) { const int nsize = 101; PLFLT[nsize] x; PLFLT[nsize] y; PLFLT xmin = 0., xmax = 1., ymin = 0., ymax = 100.; int i; // Prepare data to be plotted. for ( i = 0; i < nsize; i++ ) { x[i] = cast(PLFLT) ( i ) / cast(PLFLT) ( nsize - 1 ); y[i] = ymax * x[i] * x[i]; } // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // Create a labelled box to hold the plot. plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ); // Plot the data that was prepared above. plline( x, y ); // Close PLplot library plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x05d.d 644 1750 1750 157711544777744 157540ustar andrewandrew// $Id: x05d.d 11684 2011-03-31 04:15:32Z airwin $ // // Histogram demo. // import std.math; import plplot; //-------------------------------------------------------------------------- // main // // Draws a histogram from sample data. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // Fill up data points const int npts = 2047; PLFLT delta = 2.0 * PI / npts; PLFLT[npts] data; for ( size_t i = 0; i < npts; i++ ) data[i] = sin( i * delta ); plcol0( 1 ); plhist( data, -1.1, 1.1, 44, PL_HIST_DEFAULT ); plcol0( 2 ); pllab( "#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator" ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x19d.d 644 1750 1750 1072012221050115 157300ustar andrewandrew// $Id: x19d.d 12532 2013-09-26 15:18:37Z andrewross $ // // Illustrates backdrop plotting of world, US maps. // Contributed by Wesley Ebisuzaki. // import std.math; import std.string; import std.c.string; import plplot; extern ( C ) { void map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { double radius; radius = 90.0 - y; *xt = radius * cos( x * PI / 180.0 ); *yt = radius * sin( x * PI / 180.0 ); } //-------------------------------------------------------------------------- // mapform19 // // Defines specific coordinate transformation for example 19. // Not to be confused with mapform in src/plmap.c. // x[], y[] are the coordinates to be plotted. //-------------------------------------------------------------------------- void mapform19( PLINT n, PLFLT* x, PLFLT* y ) { double xp, yp, radius; for ( int i = 0; i < n; i++ ) { radius = 90.0 - y[i]; xp = radius * cos( x[i] * PI / 180.0 ); yp = radius * sin( x[i] * PI / 180.0 ); x[i] = xp; y[i] = yp; } } // A custom axis labeling function for longitudes and latitudes. void geolocation_labeler( PLINT axis, PLFLT value, char* label, PLINT length, PLPointer data ) { string direction_label; PLFLT label_val; char * mlabel; if ( axis == PL_Y_AXIS ) { label_val = value; if ( label_val > 0.0 ) direction_label = " N"; else if ( label_val < 0.0 ) direction_label = " S"; else direction_label = "Eq"; } else if ( axis == PL_X_AXIS ) { label_val = normalize_longitude( value ); if ( label_val > 0.0 ) direction_label = " E"; else if ( label_val < 0.0 ) direction_label = " W"; else direction_label = ""; } if ( axis == PL_Y_AXIS && value == 0.0 ) // A special case for the equator strcpy( label, toStringz( direction_label ) ); else strcpy( label, toStringz( format( "%.0f%s", fabs( label_val ), direction_label ) ) ); } } // "Normalize" longitude values so that they always fall between -180.0 and // 180.0 PLFLT normalize_longitude( PLFLT lon ) { if ( lon >= -180.0 && lon <= 180.0 ) return ( lon ); else { PLFLT times = floor( ( fabs( lon ) + 180.0 ) / 360.0 ); if ( lon < 0.0 ) return ( lon + 360.0 * times ); else return ( lon - 360.0 * times ); } } //-------------------------------------------------------------------------- // main // // Shows two views of the world map. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Longitude (x) and latitude (y) PLFLT miny = -70; PLFLT maxy = 80; plinit(); // Cartesian plots // Most of world PLFLT minx = -170; PLFLT maxx = minx + 360; // Setup a custom latitude and longitude-based scaling function. plslabelfunc( &geolocation_labeler, null ); plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( null, "usaglobe", minx, maxx, miny, maxy ); // The Americas minx = 190; maxx = 340; plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( null, "usaglobe", minx, maxx, miny, maxy ); // Clear the labeling function plslabelfunc( null, null ); // Polar, Northern hemisphere minx = 0; maxx = 360; plenv( -75., 75., -75., 75., 1, -1 ); plmap( &mapform19, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( &mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0; maxx = 360; plstransform( &map_transform, null ); pllsty( 1 ); plenv( -75., 75., -75., 75., 1, -1 ); // No need to set the map transform here as the global transform will be // used. plmap( null, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( null, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Show Baltimore, MD on the map plcol0( 2 ); plssym( 0.0, 2.0 ); PLFLT x[1] = -76.6125; PLFLT y[1] = 39.2902778; plpoin( x, y, 18 ); plssym( 0.0, 1.0 ); plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); // For C, this is how the global transform is cleared plstransform( null, null ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x24d.d 644 1750 1750 605012163113463 157200ustar andrewandrew// $Id: x24d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Unicode Pace Flag // // Copyright (C) 2009 Werner Smekal // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // For Debian, the required font packages are the following: // ttf-arphic-bkai00mp // ttf-freefont // ttf-devanagari-fonts // ttf-unfonts // ttf-bengali-fonts // // For the latest Ubuntu systems lohit_hi.ttf has been moved to the // ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you // will have to use this package instead and update the font path. // import std.string; import plplot; static PLINT[] red = [ 240, 204, 204, 204, 0, 39, 125 ]; static PLINT[] green = [ 240, 0, 125, 204, 204, 80, 0 ]; static PLINT[] blue = [ 240, 0, 0, 0, 0, 204, 125 ]; static PLFLT[] px = [ 0.0, 0.0, 1.0, 1.0 ]; static PLFLT[] py = [ 0.0, 0.25, 0.25, 0.0 ]; static PLFLT[] sx = [ 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 ]; static PLFLT[] sy = [ 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 ]; // Taken from http://www.columbia.edu/~fdc/pace/ static string[] peace = [ // Mandarin "#<0x00>和平", // Hindi "#<0x20>शांति", // English "#<0x10>Peace", // Hebrew "#<0x10>שלום", // Russian "#<0x10>Мир", // German "#<0x10>Friede", // Korean "#<0x30>평화", // French "#<0x10>Paix", // Spanish "#<0x10>Paz", // Arabic "#<0x10>ﺳﻼم", // Turkish "#<0x10>Barış", // Kurdish "#<0x10>Hasîtî", ]; int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); plinit(); pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plcol0( 0 ); plbox( "", 1.0, 0, "", 1.0, 0 ); plscmap0n( 7 ); plscmap0( red, green, blue ); plschr( 0, 4.0 ); plfont( 1 ); for ( int i = 0; i < 4; i++ ) { plcol0( i + 1 ); plfill( px, py ); for ( int j = 0; j < py.length; j++ ) py[j] += 1.0 / 4.0; } plcol0( 0 ); for ( int i = 0; i < 12; i++ ) plptex( sx[i], sy[i], 1.0, 0.0, 0.5, peace[i] ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/CMakeLists.txt 644 1750 1750 511611722014037 175310ustar andrewandrew# examples/d/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2008 Werner Smekal # Copyright (C) 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(d_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) if(CORE_BUILD) set(d_SRCS) foreach(STRING_INDEX ${d_STRING_INDICES}) set(d_SRCS ${d_SRCS} x${STRING_INDEX}d.d) endforeach(STRING_INDEX ${d_STRING_INDICES}) install(FILES ${d_SRCS} DESTINATION ${DATA_DIR}/examples/d ) set(DC ${CMAKE_D_COMPILER}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/d RENAME Makefile ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/d ) endif(CORE_BUILD) if(BUILD_TEST) if(CORE_BUILD) include_directories( ${CMAKE_SOURCE_DIR}/bindings/d ) else(CORE_BUILD) include_directories(${INCLUDE_DIR}) endif(CORE_BUILD) set_property(GLOBAL PROPERTY TARGETS_examples_d) foreach(STRING_INDEX ${d_STRING_INDICES}) add_executable(x${STRING_INDEX}d x${STRING_INDEX}d.d) target_link_libraries(x${STRING_INDEX}d plplotdmd${LIB_TAG} plplot${LIB_TAG} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_d x${STRING_INDEX}d) endforeach(STRING_INDEX ${d_STRING_INDICES}) endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/d/x27d.d 644 1750 1750 1413711637651102 157520ustar andrewandrew// $Id: x27d.d 11935 2011-09-25 16:09:38Z airwin $ // // Drawing "spirograph" curves - epitrochoids, cycolids, roulettes // // Copyright (C) 2009 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.math; import plplot; //-------------------------------------------------------------------------- // main // // Generates two kinds of plots: // - construction of a cycloid (animated) // - series of epitrochoids and hypotrochoids //-------------------------------------------------------------------------- int main( char[][] args ) { // R, r, p, N // R and r should be integers to give correct termination of the // angle loop using gcd. // N.B. N is just a place holder since it is no longer used // (because we now have proper termination of the angle loop). static PLFLT[4][9] params = [ [ 21.0, 7.0, 7.0, 3.0 ], // Deltoid [ 21.0, 7.0, 10.0, 3.0 ], [ 21.0, -7.0, 10.0, 3.0 ], [ 20.0, 3.0, 7.0, 20.0 ], [ 20.0, 3.0, 10.0, 20.0 ], [ 20.0, -3.0, 10.0, 20.0 ], [ 20.0, 13.0, 7.0, 20.0 ], [ 20.0, 13.0, 20.0, 20.0 ], [ 20.0, -13.0, 20.0, 20.0 ] ]; // plplot initialization // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // Illustrate the construction of a cycloid cycloid(); // Loop over the various curves // First an overview, then all curves one by one // plssub( 3, 3 ); // Three by three window int fill = 0; for ( int i = 0; i < 9; i++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params[i], fill ); } pladv( 0 ); plssub( 1, 1 ); // One window per curve for ( int i = 0; i < 9; i++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params[i], fill ); } // fill the curves fill = 1; pladv( 0 ); plssub( 1, 1 ); // One window per curve for ( int i = 0; i < 9; i++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params[i], fill ); } // Finally, an example to test out plarc capabilities arcs(); plend(); return 0; } //-------------------------------------------------------------------------- // Calculate greatest common divisor following pseudo-code for the // Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm PLINT gcd( PLINT a, PLINT b ) { PLINT t; a = abs( a ); b = abs( b ); while ( b != 0 ) { t = b; b = a % b; a = t; } return a; } //-------------------------------------------------------------------------- void cycloid() { // TODO } //-------------------------------------------------------------------------- void spiro( PLFLT[] params, int fill ) { const int npnt = 2000; PLFLT[] xcoord, ycoord; int windings, steps; PLFLT dphi, phi, phiw; PLFLT xmin, xmax, xrange_adjust; PLFLT ymin, ymax, yrange_adjust; // Fill the coordinates // Proper termination of the angle loop very near the beginning // point, see // http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = cast(PLINT) abs( params[1] ) / gcd( cast(PLINT) params[0], cast(PLINT) params[1] ); steps = npnt / windings; dphi = 2.0 * PI / cast(PLFLT) steps; xcoord.length = windings * steps + 1; ycoord.length = windings * steps + 1; for ( int i = 0; i <= windings * steps; i++ ) { phi = i * dphi; phiw = ( params[0] - params[1] ) / params[1] * phi; xcoord[i] = ( params[0] - params[1] ) * cos( phi ) + params[2] * cos( phiw ); ycoord[i] = ( params[0] - params[1] ) * sin( phi ) - params[2] * sin( phiw ); if ( i == 0 ) { xmin = xcoord[i]; xmax = xcoord[i]; ymin = ycoord[i]; ymax = ycoord[i]; } if ( xmin > xcoord[i] ) xmin = xcoord[i]; if ( xmax < xcoord[i] ) xmax = xcoord[i]; if ( ymin > ycoord[i] ) ymin = ycoord[i]; if ( ymax < ycoord[i] ) ymax = ycoord[i]; } xrange_adjust = 0.15 * ( xmax - xmin ); xmin = xmin - xrange_adjust; xmax = xmax + xrange_adjust; yrange_adjust = 0.15 * ( ymax - ymin ); ymin = ymin - yrange_adjust; ymax = ymax + yrange_adjust; plwind( xmin, xmax, ymin, ymax ); plcol0( 1 ); if ( fill ) { plfill( xcoord, ycoord ); } else { plline( xcoord, ycoord ); } } void arcs() { const int NSEG = 8; int i; PLFLT theta, dtheta; PLFLT a, b; theta = 0.0; dtheta = 360.0 / NSEG; plenv( -10.0, 10.0, -10.0, 10.0, 1, 0 ); // Plot segments of circle in different colors for ( i = 0; i < NSEG; i++ ) { plcol0( i % 2 + 1 ); plarc( 0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, 0 ); theta = theta + dtheta; } // Draw several filled ellipses inside the circle at different // angles. a = 3.0; b = a * tan( ( dtheta / 180.0 * PI ) / 2.0 ); theta = dtheta / 2.0; for ( i = 0; i < NSEG; i++ ) { plcol0( 2 - i % 2 ); plarc( a * cos( theta / 180.0 * PI ), a * sin( theta / 180.0 * PI ), a, b, 0.0, 360.0, theta, 1 ); theta = theta + dtheta; } } plplot-5.10.0+dfsg/examples/d/x20d.d 644 1750 1750 2044712222762774 157550ustar andrewandrew// $Id: x20d.d 12568 2013-10-02 09:23:08Z andrewross $ // // plimage demo // // import std.math; import std.stdio; import std.file; import plplot; int dbg = 0; int nosombrero = 0; int nointeractive = 0; string f_name; struct stretch_data { PLFLT xmin, xmax, ymin, ymax; PLFLT stretch; }; extern ( C ) { // Transformation function void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ) { stretch_data* s = cast(stretch_data *) pltr_data; PLFLT x0 = ( s.xmin + s.xmax ) * 0.5; PLFLT y0 = ( s.ymin + s.ymax ) * 0.5; PLFLT dy = ( s.ymax - s.ymin ) * 0.5; *tx = x0 + ( x0 - x ) * ( 1.0 - s.stretch * cos( ( y - y0 ) / dy * PI * 0.5 ) ); *ty = y; } } int main( char[][] args ) { const int XDIM = 260; const int YDIM = 220; // // Bugs in plimage(): // -at high magnifications, the left and right edge are ragged, try // ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 // // Bugs in x20c.c: // -if the window is resized after a selection is made on "lena", when // making a new selection the old one will re-appear. // // Parse and process command line arguments // plMergeOpts(options, "x20c options", NULL); plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); PLFLT[][] z = new PLFLT[][XDIM]; for ( int i = 0; i < XDIM; i++ ) z[i] = new PLFLT[YDIM]; // view image border pixels if ( dbg ) { plenv( 1.0, XDIM, 1.0, YDIM, 1, 1 ); // no plot box // Zero z array before use for ( int j = 0; j < YDIM; j++ ) for ( int i = 0; i < XDIM; i++ ) z[i][j] = 0.0; // build a one pixel square border, for diagnostics for ( int i = 0; i < XDIM; i++ ) z[i][YDIM - 1] = 1.0; // right for ( int i = 0; i < XDIM; i++ ) z[i][0] = 1.0; // left for ( int i = 0; i < YDIM; i++ ) z[0][i] = 1.0; // top for ( int i = 0; i < YDIM; i++ ) z[XDIM - 1][i] = 1.0; // botton pllab( "...around a blue square.", " ", "A red border should appear..." ); plimage( z, 1.0, XDIM, 1.0, YDIM, 0., 0., 1.0, XDIM, 1.0, YDIM ); } PLFLT[] x = new PLFLT[XDIM]; PLFLT[] y = new PLFLT[YDIM]; // sombrero-like demo if ( !nosombrero ) { PLFLT[][] r = new PLFLT[][XDIM]; for ( int i = 0; i < XDIM; i++ ) r[i] = new PLFLT[YDIM]; plcol0( 2 ); // draw a yellow plot box, useful for diagnostics! :( plenv( 0.0, 2.0 * PI, 0, 3.0 * PI, 1, -1 ); for ( int i = 0; i < XDIM; i++ ) x[i] = i * 2.0 * PI / ( XDIM - 1 ); for ( int i = 0; i < YDIM; i++ ) y[i] = i * 3.0 * PI / ( YDIM - 1 ); for ( int i = 0; i < XDIM; i++ ) for ( int j = 0; j < YDIM; j++ ) { r[i][j] = sqrt( x[i] * x[i] + y[j] * y[j] ) + 1e-3; z[i][j] = sin( r[i][j] ) / ( r[i][j] ); } pllab( "No, an amplitude clipped \"sombrero\"", "", "Saturn?" ); plptex( 2.0, 2.0, 3.0, 4.0, 0.0, "Transparent image" ); plimage( z, 0.0, 2.0 * PI, 0.0, 3.0 * PI, 0.05, 1.0, 0.0, 2.0 * PI, 0.0, 3.0 * PI ); // save the plot if ( f_name.length != 0 ) save_plot( f_name ); } // read Lena image // Note we try two different locations to cover the case where this // examples is being run from the test_c.sh script int width, height, num_col; PLFLT[][] img_f; if ( read_img( "lena.pgm", img_f, width, height, num_col ) ) { if ( read_img( "../lena.pgm", img_f, width, height, num_col ) ) { stderr.writeln( "No such file" ); plend(); return 1; } } // set gray colormap gray_cmap( num_col ); // display Lena plenv( 1.0, cast(PLFLT) width, 1.0, cast(PLFLT) height, 1, -1 ); if ( !nointeractive ) pllab( "Set and drag Button 1 to (re)set selection, Button 2 to finish.", " ", "Lena..." ); else pllab( "", " ", "Lena..." ); plimage( img_f, 1.0, width, 1.0, height, 0.0, 0.0, 1.0, width, 1.0, height ); // selection/expansion demo if ( !nointeractive ) { PLFLT xi = 200.0; PLFLT xe = 330.0; PLFLT yi = 280.0; PLFLT ye = 220.0; if ( get_clip( xi, xe, yi, ye ) ) // get selection rectangle { plend(); return 0; } plspause( 0 ); pladv( 0 ); // display selection only plimage( img_f, 1.0, width, 1.0, height, 0.0, 0.0, xi, xe, ye, yi ); plspause( 1 ); // zoom in selection plenv( xi, xe, ye, yi, 1, -1 ); plimage( img_f, 1.0, width, 1.0, height, 0.0, 0.0, xi, xe, ye, yi ); } // Base the dynamic range on the image contents. PLFLT img_min, img_max; plMinMax2dGrid( img_f, img_max, img_min ); // Draw a saturated version of the original image. Only use the middle 50% // of the image's full dynamic range. plcol0( 2 ); plenv( 0, width, 0, height, 1, -1 ); pllab( "", "", "Reduced dynamic range image example" ); plimagefr( img_f, 0.0, width, 0.0, height, 0.0, 0.0, img_min + img_max * 0.25, img_max - img_max * 0.25 ); // Draw a distorted version of the original image, showing its full dynamic range. plenv( 0, width, 0, height, 1, -1 ); pllab( "", "", "Distorted image example" ); stretch_data stretch = { 0, width, 0, height, 0.5 }; // In C / C++ the following would work, with plimagefr directly calling // mypltr. For compatibilty with other language bindings the same effect // can be achieved by generating the transformed grid first and then // using pltr2. plimagefr( img_f, 0.0, width, 0.0, height, 0.0, 0.0, img_min, img_max, &mypltr, cast(PLPointer) &stretch ); plend(); return 0; } // read image from file in binary ppm format int read_img( string fname, out PLFLT[][] img_f, out int width, out int height, out int num_col ) { ubyte[] img; if ( !std.file.exists( fname ) ) return 1; File input; try { input.open( fname ); string ver; ver = input.readln(); if ( ver != "P5\n" ) // I only understand this! return 1; char dummy; string result; input.readf( "%c", &dummy ); while ( dummy == '#' ) { result = input.readln(); if ( result.length == 0 ) result = input.readln(); // workaround: for some reason the first call returns empty string input.readf( "%c", &dummy ); } input.seek( -1, SEEK_CUR ); if ( input.readf( "%d %d %d\n", &width, &height, &num_col ) != 3 ) // width, height num colors return 1; img = new ubyte[width * height]; img_f = new PLFLT[][width]; for ( int i = 0; i < width; i++ ) img_f[i] = new PLFLT[height]; if ( input.rawRead( img ).length != ( width * height ) ) return 1; } catch ( Exception except ) { stderr.writeln( "Caught exception reading " ~ fname ); return 1; } finally { input.close(); } for ( int i = 0; i < width; i++ ) for ( int j = 0; j < height; j++ ) img_f[i][j] = img[( height - 1 - j ) * width + i]; // flip image up-down return 0; } // save plot void save_plot( string fname ) { PLINT cur_strm, new_strm; plgstrm( &cur_strm ); // get current stream plmkstrm( &new_strm ); // create a new one plsdev( "psc" ); // new device type. Use a known existing driver plsfnam( fname ); // file name plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream plreplot(); // do the save plend1(); // close new device plsstrm( cur_strm ); // and return to previous one } // get selection square interactively int get_clip( ref PLFLT xi, ref PLFLT xe, ref PLFLT yi, ref PLFLT ye ) { return 0; } // set gray colormap void gray_cmap( PLINT num_col ) { PLFLT[] r = [ 0.0, 1.0 ]; PLFLT[] g = [ 0.0, 1.0 ]; PLFLT[] b = [ 0.0, 1.0 ]; PLFLT[] pos = [ 0.0, 1.0 ]; plscmap1n( num_col ); plscmap1l( 1, pos, r, g, b ); } plplot-5.10.0+dfsg/examples/d/x09d.d 644 1750 1750 2514211544777744 157720ustar andrewandrew// $Id: x09d.d 11684 2011-03-31 04:15:32Z airwin $ // // Contour plot demo. // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.math; import plplot; const int XPTS = 35; // Data points in x const int YPTS = 46; // Data points in y // Transformation function extern ( C ) { PLFLT[] tr = [ 2. / ( XPTS - 1 ), 0.0, -1.0, 0.0, 2. / ( YPTS - 1 ), -1.0 ]; void mypltr( PLFLT x, PLFLT y, PLFLT* tx, PLFLT* ty, void* pltr_data ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } } //polar contour plot example. void polar() { const int PERIMETERPTS = 100; const int RPTS = 40; const int THETAPTS = 40; plenv( -1., 1., -1., 1., 0, -2 ); plcol0( 1 ); //Perimeter PLFLT[] px, py; px.length = PERIMETERPTS; py.length = PERIMETERPTS; PLFLT t; for ( int i = 0; i < PERIMETERPTS; i++ ) { t = 2. * PI / ( PERIMETERPTS - 1 ) * i; px[i] = cos( t ); py[i] = sin( t ); } plline( px, py ); //create data to be contoured. PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][RPTS]; for ( int i = 0; i < RPTS; i++ ) cgrid2.xg[i] = new PLFLT[THETAPTS]; cgrid2.yg = new PLFLT[][RPTS]; for ( int i = 0; i < RPTS; i++ ) cgrid2.yg[i] = new PLFLT[THETAPTS]; PLFLT[][] z = new PLFLT[][RPTS]; for ( int i = 0; i < RPTS; i++ ) z[i] = new PLFLT[THETAPTS]; PLFLT r, theta; for ( int i = 0; i < RPTS; i++ ) { r = i / cast(double) ( RPTS - 1 ); for ( int j = 0; j < THETAPTS; j++ ) { theta = 2. * PI / ( THETAPTS - 1 ) * j; cgrid2.xg[i][j] = r * cos( theta ); cgrid2.yg[i][j] = r * sin( theta ); z[i][j] = r; } } PLFLT[] lev; lev.length = 10; for ( int i = 0; i < 10; i++ ) lev[i] = 0.05 + 0.10 * i; plcol0( 2 ); plcont( z, 1, RPTS, 1, THETAPTS, lev, cgrid2 ); plcol0( 1 ); pllab( "", "", "Polar Contour Plot" ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- void f2mnmx( PLFLT[][] f, out PLFLT fmn, out PLFLT fmx ) { fmx = f[0][0]; fmn = fmx; for ( int i = 0; i < f.length; i++ ) { for ( int j = 0; j < f[i].length; j++ ) { fmx = fmax( fmx, f[i][j] ); fmn = fmin( fmn, f[i][j] ); } } } //shielded potential contour plot example. void potential() { const int PERIMETERPTS = 100; const int RPTS = 40; const int THETAPTS = 64; const int NLEVEL = 20; //create data to be contoured. PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][RPTS]; for ( int i = 0; i < RPTS; i++ ) cgrid2.xg[i] = new PLFLT[THETAPTS]; cgrid2.yg = new PLFLT[][RPTS]; for ( int i = 0; i < RPTS; i++ ) cgrid2.yg[i] = new PLFLT[THETAPTS]; PLFLT[][] z = new PLFLT[][RPTS]; for ( int i = 0; i < RPTS; i++ ) z[i] = new PLFLT[THETAPTS]; PLFLT r, theta; for ( int i = 0; i < RPTS; i++ ) { r = 0.5 + i; for ( int j = 0; j < THETAPTS; j++ ) { theta = 2. * PI / ( THETAPTS - 1 ) * ( 0.5 + j ); cgrid2.xg[i][j] = r * cos( theta ); cgrid2.yg[i][j] = r * sin( theta ); } } PLFLT rmax = r; PLFLT xmin, xmax, ymin, ymax; f2mnmx( cgrid2.xg, xmin, xmax ); f2mnmx( cgrid2.yg, ymin, ymax ); PLFLT x0 = ( xmin + xmax ) / 2.; PLFLT y0 = ( ymin + ymax ) / 2.; // Expanded limits PLFLT peps = 0.05; PLFLT xpmin = xmin - fabs( xmin ) * peps; PLFLT xpmax = xmax + fabs( xmax ) * peps; PLFLT ypmin = ymin - fabs( ymin ) * peps; PLFLT ypmax = ymax + fabs( ymax ) * peps; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. // PLFLT eps = 2.; PLFLT q1 = 1.; PLFLT d1 = rmax / 4.; PLFLT q1i = -q1 * rmax / d1; PLFLT d1i = pow( rmax, 2. ) / d1; PLFLT q2 = -1.; PLFLT d2 = rmax / 4.; PLFLT q2i = -q2 * rmax / d2; PLFLT d2i = pow( rmax, 2. ) / d2; PLFLT div1, div1i, div2, div2i; for ( int i = 0; i < RPTS; i++ ) { for ( int j = 0; j < THETAPTS; j++ ) { div1 = sqrt( pow( cgrid2.xg[i][j] - d1, 2. ) + pow( cgrid2.yg[i][j] - d1, 2. ) + pow( eps, 2. ) ); div1i = sqrt( pow( cgrid2.xg[i][j] - d1i, 2. ) + pow( cgrid2.yg[i][j] - d1i, 2. ) + pow( eps, 2. ) ); div2 = sqrt( pow( cgrid2.xg[i][j] - d2, 2. ) + pow( cgrid2.yg[i][j] + d2, 2. ) + pow( eps, 2. ) ); div2i = sqrt( pow( cgrid2.xg[i][j] - d2i, 2. ) + pow( cgrid2.yg[i][j] + d2i, 2. ) + pow( eps, 2. ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; } } PLFLT zmin, zmax; f2mnmx( z, zmin, zmax ); // Positive and negative contour levels. PLFLT dz = ( zmax - zmin ) / NLEVEL; PLFLT[] clevelneg, clevelpos; PLFLT clevel; clevelneg.length = NLEVEL; clevelpos.length = NLEVEL; int nlevelneg = 0; int nlevelpos = 0; for ( int i = 0; i < NLEVEL; i++ ) { clevel = zmin + ( i + 0.5 ) * dz; if ( clevel <= 0. ) clevelneg[nlevelneg++] = clevel; else clevelpos[nlevelpos++] = clevel; } // Colours! PLINT ncollin = 11; PLINT ncolbox = 1; PLINT ncollab = 2; // Finally start plotting this page! pladv( 0 ); plcol0( ncolbox ); plvpas( 0.1, 0.9, 0.1, 0.9, 1.0 ); plwind( xpmin, xpmax, ypmin, ypmax ); plbox( "", 0., 0, "", 0., 0 ); plcol0( ncollin ); if ( nlevelneg > 0 ) { // Negative contours pllsty( 2 ); plcont( z, 1, RPTS, 1, THETAPTS, clevelneg, cgrid2 ); } if ( nlevelpos > 0 ) { // Positive contours pllsty( 1 ); plcont( z, 1, RPTS, 1, THETAPTS, clevelpos, cgrid2 ); } // Draw outer boundary PLFLT[] px, py; px.length = PERIMETERPTS; py.length = PERIMETERPTS; PLFLT t; for ( int i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * PI / ( PERIMETERPTS - 1 ) ) * i; px[i] = x0 + rmax*cos( t ); py[i] = y0 + rmax*sin( t ); } plcol0( ncolbox ); plline( px, py ); plcol0( ncollab ); pllab( "", "", "Shielded potential of charges in a conducting sphere" ); } //-------------------------------------------------------------------------- // main // // Does several contour plots using different coordinate mappings. //-------------------------------------------------------------------------- int main( char[][] args ) { PLINT[] mark = [ 1500 ], space = [ 1500 ]; PLFLT[] clevel = [ -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. ]; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // Set up function arrays PLFLT[][] z = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) z[i] = new PLFLT[YPTS]; PLFLT[][] w = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) w[i] = new PLFLT[YPTS]; PLFLT xx, yy; for ( int i = 0; i < XPTS; i++ ) { xx = cast(double) ( i - ( XPTS / 2 ) ) / ( XPTS / 2 ); for ( int j = 0; j < YPTS; j++ ) { yy = cast(double) ( j - ( YPTS / 2 ) ) / ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } // Set up grids PLcGrid cgrid1; cgrid1.xg = new PLFLT[XPTS]; cgrid1.yg = new PLFLT[YPTS]; PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) cgrid2.xg[i] = new PLFLT[YPTS]; cgrid2.yg = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) cgrid2.yg[i] = new PLFLT[YPTS]; PLFLT argx, argy, distort; for ( int i = 0; i < XPTS; i++ ) { for ( int j = 0; j < YPTS; j++ ) { mypltr( cast(PLFLT) i, cast(PLFLT) j, &xx, &yy, null ); argx = xx * PI / 2; argy = yy * PI / 2; distort = 0.4; cgrid1.xg[i] = xx + distort * cos( argx ); cgrid1.yg[j] = yy - distort * cos( argy ); cgrid2.xg[i][j] = xx + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = yy - distort * cos( argx ) * cos( argy ); } } // Plot using identity transform pl_setcontlabelformat( 4, 3 ); pl_setcontlabelparam( 0.006, 0.3, 0.1, 1 ); plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( z, 1, XPTS, 1, YPTS, clevel, &mypltr ); plstyl( mark, space ); plcol0( 3 ); plcont( w, 1, XPTS, 1, YPTS, clevel, &mypltr ); plstyl( null, null ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pl_setcontlabelparam( 0.006, 0.3, 0.1, 0 ); // Plot using 1d coordinate transform plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( z, 1, XPTS, 1, YPTS, clevel, cgrid1 ); plstyl( mark, space ); plcol0( 3 ); plcont( w, 1, XPTS, 1, YPTS, clevel, cgrid1 ); plstyl( null, null ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // Plot using 2d coordinate transform plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( z, 1, XPTS, 1, YPTS, clevel, cgrid2 ); plstyl( mark, space ); plcol0( 3 ); plcont( w, 1, XPTS, 1, YPTS, clevel, cgrid2 ); plstyl( null, null ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pl_setcontlabelparam( 0.006, 0.3, 0.1, 0 ); polar(); pl_setcontlabelparam( 0.006, 0.3, 0.1, 0 ); potential(); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x07d.d 644 1750 1750 402212163113463 157160ustar andrewandrew// $Id: x07d.d 12393 2013-06-27 19:49:07Z andrewross $ // // // Font demo. // import plplot; import std.string; int[20] base = [ 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900]; //-------------------------------------------------------------------------- // main // // Displays the entire "plsym" symbol (font) set. //-------------------------------------------------------------------------- int main( char[][] args ) { string text; PLFLT[1] x, y; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); plfontld( 0 ); for ( size_t l = 0; l < 20; l++ ) { if ( l == 2 ) plfontld( 1 ); pladv( 0 ); // Set up viewport and window plcol0( 2 ); plvpor( 0.15, 0.95, 0.1, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); // Draw the grid using plbox plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame plcol0( 15 ); for ( size_t i = 0; i <= 9; i++ ) { text = format( "%d", i ); plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } size_t k = 0; for ( size_t i = 0; i <= 9; i++ ) { // Write the digits to the left of the frame text = format( "%d", base[l] + 10 * i ); plmtex( "lv", 1.0, ( 0.95 - 0.1 * i ), 1.0, text ); for ( size_t j = 0; j <= 9; j++ ) { x[0] = 0.1 * j + 0.05; y[0] = 0.95 - 0.1 * i; // Display the symbols plsym( x, y, cast(PLINT) ( base[l] + k ) ); k = k + 1; } } if ( l < 2 ) plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); else plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x12d.d 644 1750 1750 332211544777744 157400ustar andrewandrew// $Id: x12d.d 11684 2011-03-31 04:15:32Z airwin $ // // Bar chart demo. // import std.string; import plplot; //-------------------------------------------------------------------------- // main // // Does a simple bar chart, using color fill. If color fill is // unavailable, pattern fill is used instead (automatic). //-------------------------------------------------------------------------- int main( char[][] args ) { string text; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); plvsta(); plwind( 1980.0, 1990.0, 0.0, 35.0 ); plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 ); plcol0( 2 ); pllab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" ); PLFLT[] pos = [ 0.0, 0.25, 0.5, 0.75, 1.0 ]; PLFLT[] red = [ 0.0, 0.25, 0.5, 1.0, 1.0 ]; PLFLT[] green = [ 1.0, 0.5, 0.5, 0.5, 1.0 ]; PLFLT[] blue = [ 1.0, 1.0, 0.5, 0.25, 0.0 ]; plscmap1l( 1, pos, red, green, blue ); PLFLT[] y0 = [ 5.0, 15.0, 12.0, 24.0, 28.0, 30.0, 20.0, 8.0, 12.0, 3.0 ]; for ( size_t i = 0; i < 10; i++ ) { plcol1( i / 9.0 ); plpsty( 0 ); plfbox( ( 1980. + i ), y0[i] ); text = format( "%.0f", y0[i] ); plptex( ( 1980. + i + .5 ), ( y0[i] + 1. ), 1.0, 0.0, .5, text ); text = format( "%d", 1980 + i ); plmtex( "b", 1.0, ( ( i + 1 ) * .1 - .05 ), 0.5, text ); } // Don't forget to call plend() to finish off! plend(); return 0; } void plfbox( PLFLT x0, PLFLT y0 ) { PLFLT[4] x = [x0, x0, x0 + 1.0, x0 + 1.0];; PLFLT[4] y = [0.0, y0, y0, 0.0]; plfill( x, y ); plcol0( 1 ); pllsty( 1 ); plline( x, y ); } plplot-5.10.0+dfsg/examples/d/x06d.d 644 1750 1750 431612163113463 157230ustar andrewandrew// $Id: x06d.d 12393 2013-06-27 19:49:07Z andrewross $ // // // Font demo. // import std.string; import plplot; //-------------------------------------------------------------------------- // main // // Displays the entire "plpoin" symbol (font) set. //-------------------------------------------------------------------------- int main( char[][] args ) { int maxfont; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); for ( int kind_font = 0; kind_font < 2; kind_font++ ) { plfontld( kind_font ); if ( kind_font == 0 ) maxfont = 1; else maxfont = 4; for ( int font = 0; font < maxfont; font++ ) { plfont( font + 1 ); pladv( 0 ); // Set up viewport and window plcol0( 2 ); plvpor( 0.1, 1.0, 0.1, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.3 ); // Draw the grid using plbox plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame plcol0( 15 ); PLFLT[1] x, y; for ( size_t i = 0; i <= 9; i++ ) plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, format( "%d", i ) ); size_t k = 0; for ( size_t i = 0; i <= 12; i++ ) { // Write the digits to the left of the frame plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, format( "%d", 10 * i ) ); for ( size_t j = 0; j <= 9; j++ ) { x[0] = 0.1 * j + 0.05; y[0] = 1.25 - 0.1 * i; // Display the symbols (plpoin expects that x and y // are arrays so pass pointers) if ( k < 128 ) plpoin( x, y, cast(PLINT) k ); k = k + 1; } } if ( kind_font == 0 ) plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); else plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); } } plend(); return 0; } plplot-5.10.0+dfsg/examples/d/Makefile.examples.in 644 1750 1750 360712254152010 206510ustar andrewandrew# examples/d/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2008 Werner Smekal # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA DC = @DC@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ RPATHCMD = @RPATHCMD@ EXECUTABLES_list = \ x00d$(EXEEXT) \ x01d$(EXEEXT) \ x02d$(EXEEXT) \ x03d$(EXEEXT) \ x04d$(EXEEXT) \ x05d$(EXEEXT) \ x06d$(EXEEXT) \ x07d$(EXEEXT) \ x08d$(EXEEXT) \ x09d$(EXEEXT) \ x10d$(EXEEXT) \ x11d$(EXEEXT) \ x12d$(EXEEXT) \ x13d$(EXEEXT) \ x14d$(EXEEXT) \ x15d$(EXEEXT) \ x16d$(EXEEXT) \ x17d$(EXEEXT) \ x18d$(EXEEXT) \ x19d$(EXEEXT) \ x20d$(EXEEXT) \ x21d$(EXEEXT) \ x22d$(EXEEXT) \ x23d$(EXEEXT) \ x24d$(EXEEXT) \ x25d$(EXEEXT) \ x26d$(EXEEXT) \ x27d$(EXEEXT) \ x28d$(EXEEXT) \ x29d$(EXEEXT) \ x30d$(EXEEXT) \ x31d$(EXEEXT) \ x33d$(EXEEXT) all: $(EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) *.o .d.o: $(DC) $< -c -o $@ `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags plplot$(LIB_TAG)-d` .o$(EXEEXT): $(DC) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --libs plplot$(LIB_TAG)-d` .SUFFIXES: .d .o $(EXEEXT) plplot-5.10.0+dfsg/examples/d/x16d.d 644 1750 1750 3276212217451661 157570ustar andrewandrew// $Id: x16d.d 12512 2013-09-22 02:19:29Z airwin $ // // plshade demo, using color fill. // // Maurice LeBrun // IFS, University of Texas at Austin // 20 Mar 1994 // import std.string; import std.math; import plplot; // Fundamental settings. See notes[] for more info. int ns = 20; // Default number of shade levels int nx = 35; // Default number of data points in x int ny = 46; // Default number of data points in y int exclude = 0; // By default do not plot a page illustrating // exclusion. API is probably going to change // anyway, and cannot be reproduced by any // front end other than the C one. // For now, don't show the colorbars while we are working out the API. int colorbar = 1; extern ( C ) { // Transformation function PLFLT[] tr; void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void* pltr_data ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } } // Options data structure definition. //~ static PLOptionTable options[] = { //~ { //~ "exclude", /* Turns on page showing exclusion */ //~ NULL, //~ NULL, //~ &exclude, //~ PL_OPT_BOOL, //~ "-exclude", //~ "Plot the \"exclusion\" page." }, //~ { //~ "ns", /* Number of shade levels */ //~ NULL, //~ NULL, //~ &ns, //~ PL_OPT_INT, //~ "-ns levels", //~ "Sets number of shade levels" }, //~ { //~ "nx", /* Number of data points in x */ //~ NULL, //~ NULL, //~ &nx, //~ PL_OPT_INT, //~ "-nx xpts", //~ "Sets number of data points in x" }, //~ { //~ "ny", /* Number of data points in y */ //~ NULL, //~ NULL, //~ &ny, //~ PL_OPT_INT, //~ "-ny ypts", //~ "Sets number of data points in y" }, //~ { //~ NULL, /* option */ //~ NULL, /* handler */ //~ NULL, /* client data */ //~ NULL, /* address of variable to set */ //~ 0, /* mode flag */ //~ NULL, /* short syntax */ //~ NULL } /* long syntax */ //~ }; //~ static const char *notes[] = { //~ "To get smoother color variation, increase ns, nx, and ny. To get faster", //~ "response (especially on a serial link), decrease them. A decent but quick", //~ "test results from ns around 5 and nx, ny around 25.", //~ NULL}; extern ( C ) { PLINT zdefined( PLFLT x, PLFLT y ) { PLFLT z = sqrt( x * x + y * y ); return z < 0.4 || z > 0.6; } } //-------------------------------------------------------------------------- // main // // Does several shade plots using different coordinate mappings. //-------------------------------------------------------------------------- int main( char[][] args ) { const int PERIMETERPTS = 100; // Parse and process command line arguments //plMergeOpts(options, "x16c options", notes); plparseopts( args, PL_PARSE_FULL ); // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); // Initialize plplot plinit(); // Set up transformation function tr = [ 2. / ( nx - 1 ), 0.0, -1.0, 0.0, 2. / ( ny - 1 ), -1.0 ]; // Allocate data structures PLFLT[][] z = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) z[i] = new PLFLT[ny]; PLFLT[][] w = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) w[i] = new PLFLT[ny]; // Set up data array PLFLT x, y; for ( int i = 0; i < nx; i++ ) { x = cast(double) ( i - ( nx / 2 ) ) / ( nx / 2 ); for ( int j = 0; j < ny; j++ ) { y = cast(double) ( j - ( ny / 2 ) ) / ( ny / 2 ) - 1.0; z[i][j] = -sin( 7 * x ) * cos( 7 * y ) + x * x - y * y; w[i][j] = -cos( 7 * x ) * sin( 7 * y ) + 2 * x * y; } } PLFLT zmin, zmax; f2mnmx( z, zmin, zmax ); PLFLT[] clevel = new PLFLT[ns]; for ( int i = 0; i < ns; i++ ) clevel[i] = zmin + ( zmax - zmin ) * ( i + 0.5 ) / ns; PLFLT[] shedge = new PLFLT[ns + 1]; for ( int i = 0; i < ns + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * i / ns; // Set up coordinate grids PLcGrid cgrid1; cgrid1.xg = new PLFLT[nx]; cgrid1.yg = new PLFLT[ny]; PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.xg[i] = new PLFLT[ny]; cgrid2.yg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.yg[i] = new PLFLT[ny]; PLFLT argx, argy, distort; for ( int i = 0; i < nx; i++ ) { for ( int j = 0; j < ny; j++ ) { mypltr( i, j, &x, &y, null ); argx = x * PI / 2; argy = y * PI / 2; distort = 0.4; cgrid1.xg[i] = x + distort * cos( argx ); cgrid1.yg[j] = y - distort * cos( argy ); cgrid2.xg[i][j] = x + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = y - distort * cos( argx ) * cos( argy ); } } // Plot using identity transform PLFLT fill_width = 2., cont_width = 0.; PLFLT colorbar_width, colorbar_height; PLINT cont_color = 0; const int NUM_AXES = 1; string[] axis_opts = [ "bcvtm", ]; PLFLT[] values[NUM_AXES]; for ( size_t i = 0; i < NUM_AXES; i++ ) { values[i] = new PLFLT[ns]; } PLFLT[] axis_ticks = [ 0.0, ]; PLINT[] axis_subticks = [ 0, ]; const int NUM_LABELS = 1; PLINT label_opts[] = [ PL_COLORBAR_LABEL_BOTTOM, ]; string[] labels = [ "Magnitude", ]; pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( z, null, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, 1 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon density" ); // Plot using 1d coordinate transform // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_blue_yellow.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( z, null, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, 1, cgrid1 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon density" ); // Plot using 2d coordinate transform // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_blue_red.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( z, null, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, 0, cgrid2 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); plcont( w, 1, nx, 1, ny, clevel, cgrid2 ); pllab( "distance", "altitude", "Bogon density, with streamlines" ); // Plot using 2d coordinate transform // Load colour palettes plspal0( "" ); plspal1( "", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( z, null, -1., 1., -1., 1., shedge, fill_width, 2, 3, 0, cgrid2 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3., label_opts, labels, axis_opts, axis_ticks, axis_subticks, values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon density" ); // Note this exclusion API will probably change. // Plot using 2d coordinate transform and exclusion if ( exclude ) { // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( z, &zdefined, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, 0, cgrid2 ); plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pllab( "distance", "altitude", "Bogon density with exclusion" ); } // Example with polar coordinates. // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( .1, .9, .1, .9 ); plwind( -1., 1., -1., 1. ); plpsty( 0 ); // Build new coordinate matrices. PLFLT r, t; for ( int i = 0; i < nx; i++ ) { r = cast(PLFLT) i / ( nx - 1 ); for ( int j = 0; j < ny; j++ ) { t = 2. * PI / ( ny - 1. ) * j; cgrid2.xg[i][j] = r * cos( t ); cgrid2.yg[i][j] = r * sin( t ); z[i][j] = exp( -r * r ) * cos( 5. * PI * r ) * cos( 5. * t ); } } // Need a new shedge to go along with the new data set. f2mnmx( z, zmin, zmax ); for ( int i = 0; i < ns + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * i / ns; // Now we can shade the interior region. plshades( z, null, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, 0, cgrid2 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } // Now we can draw the perimeter. (If do before, shade stuff may overlap.) PLFLT[PERIMETERPTS] px, py; for ( int i = 0; i < PERIMETERPTS; i++ ) { t = 2. * PI / ( PERIMETERPTS - 1 ) * i; px[i] = cos( t ); py[i] = sin( t ); } plcol0( 1 ); plline( px, py ); // And label the plot. plcol0( 2 ); pllab( "", "", "Tokamak Bogon Instability" ); plend(); return 0; } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- void f2mnmx( PLFLT[][] f, out PLFLT fmn, out PLFLT fmx ) { fmx = f[0][0]; fmn = fmx; for ( int i = 0; i < f.length; i++ ) { for ( int j = 0; j < f[i].length; j++ ) { fmx = fmax( fmx, f[i][j] ); fmn = fmin( fmn, f[i][j] ); } } } plplot-5.10.0+dfsg/examples/d/x21d.d 644 1750 1750 2020412163113463 157320ustar andrewandrew// $Id: x21d.d 12393 2013-06-27 19:49:07Z andrewross $ // Grid data demo // // Copyright (C) 2009 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.math; import plplot; // Options data structure definition. PLINT pts = 500; PLINT xp = 25; PLINT yp = 20; PLINT nl = 16; int knn_order = 20; PLFLT threshold = 1.001; PLFLT wmin = -1e3; int randn = 0; int rosen = 0; PLFLT xm, xM, ym, yM; int main( char[][] args ) { string[] title = [ "Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted" ]; xm = ym = -0.2; xM = yM = 0.6; // plMergeOpts(options, "x21c options", NULL); plparseopts( args, PL_PARSE_FULL ); PLFLT[] opt = [ 0.0, 0.0, wmin, knn_order, threshold, 0.0 ]; // Initialize plplot plinit(); cmap1_init(); // Initialise random number generator plseed( 5489 ); PLFLT[] x, y, z; x.length = y.length = z.length = pts; create_data( x, y, z ); // the sampled data PLFLT zmin = z[0]; PLFLT zmax = z[0]; for ( int i = 1; i < pts; i++ ) { if ( z[i] > zmax ) zmax = z[i]; if ( z[i] < zmin ) zmin = z[i]; } PLFLT[] xg, yg; xg.length = xp; yg.length = yp; create_grid( xg, yg ); // grid the data at PLFLT[][] zg = new PLFLT[][xp]; for ( int i = 0; i < xp; i++ ) zg[i] = new PLFLT[yp]; PLFLT[] clev = new PLFLT[nl]; PLFLT[] xx = new PLFLT[1]; PLFLT[] yy = new PLFLT[1]; plcol0( 1 ); plenv( xm, xM, ym, yM, 2, 0 ); plcol0( 15 ); pllab( "X", "Y", "The original data sampling" ); for ( int i = 0; i < pts; i++ ) { plcol1( ( z[i] - zmin ) / ( zmax - zmin ) ); xx[0] = x[i]; yy[0] = y[i]; plstring( xx, yy, "#(727)" ); } pladv( 0 ); plssub( 3, 2 ); for ( int k = 0; k < 2; k++ ) { pladv( 0 ); for ( int alg = 1; alg < 7; alg++ ) { plgriddata( x, y, z, xg, yg, zg, alg, opt[alg - 1] ); // - CSA can generate NaNs (only interpolates?!). // - DTLI and NNI can generate NaNs for points outside the convex hull // of the data points. // - NNLI can generate NaNs if a sufficiently thick triangle is not found // // PLplot should be NaN/Inf aware, but changing it now is quite a job... // so, instead of not plotting the NaN regions, a weighted average over // the neighbors is done. // if ( alg == GRID_CSA || alg == GRID_DTLI || alg == GRID_NNLI || alg == GRID_NNI ) { PLFLT dist, d; for ( int i = 0; i < xp; i++ ) { for ( int j = 0; j < yp; j++ ) { if ( isnan( zg[i][j] ) ) // average (IDW) over the 8 neighbors { zg[i][j] = 0.0; dist = 0.0; for ( int ii = i - 1; ii <= i + 1 && ii < xp; ii++ ) { for ( int jj = j - 1; jj <= j + 1 && jj < yp; jj++ ) { if ( ii >= 0 && jj >= 0 && !isnan( zg[ii][jj] ) ) { d = ( abs( ii - i ) + abs( jj - j ) ) == 1 ? 1.0 : 1.4142; zg[i][j] += zg[ii][jj] / ( d * d ); dist += d; } } } if ( dist != 0.0 ) zg[i][j] /= dist; else zg[i][j] = zmin; } } } } PLFLT lzM, lzm; plMinMax2dGrid( zg, lzM, lzm ); lzm = fmin( lzm, zmin ); lzM = fmax( lzM, zmax ); // Increase limits slightly to prevent spurious contours // due to rounding errors lzm = lzm - 0.01; lzM = lzM + 0.01; plcol0( 1 ); pladv( alg ); if ( k == 0 ) { for ( int i = 0; i < nl; i++ ) clev[i] = lzm + ( lzM - lzm ) / ( nl - 1 ) * i; plenv0( xm, xM, ym, yM, 2, 0 ); plcol0( 15 ); pllab( "X", "Y", title[alg - 1] ); plshades( zg, null, xm, xM, ym, yM, clev, 1, 0, 1, 1 ); plcol0( 2 ); } else { for ( int i = 0; i < nl; i++ ) clev[i] = lzm + ( lzM - lzm ) / ( nl - 1 ) * i; plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.1, 0.75, -0.65, 1.20 ); // // For the comparison to be fair, all plots should have the // same z values, but to get the max/min of the data generated // by all algorithms would imply two passes. Keep it simple. // // plw3d(1., 1., 1., xm, xM, ym, yM, zmin, zmax, 30, -60); // plw3d( 1., 1., 1., xm, xM, ym, yM, lzm, lzM, 30, -40 ); plbox3( "bntu", "X", 0., 0, "bntu", "Y", 0., 0, "bcdfntu", "Z", 0.5, 0 ); plcol0( 15 ); pllab( "", "", title[alg - 1] ); plot3dc( xg, yg, zg, DRAW_LINEXY | MAG_COLOR | BASE_CONT, clev ); } } } plend(); return 0; } void create_grid( PLFLT[] x, PLFLT[] y ) { int px = cast(int) x.length; int py = cast(int) y.length; for ( int i = 0; i < px; i++ ) x[i] = xm + ( xM - xm ) * i / ( px - 1.0 ); for ( int i = 0; i < py; i++ ) y[i] = ym + ( yM - ym ) * i / ( py - 1.0 ); } void create_data( PLFLT[] x, PLFLT[] y, PLFLT[] z ) { int pts = cast(int) x.length; assert( pts == y.length, "create_data(): Arrays must be of same length" ); assert( pts == z.length, "create_data(): Arrays must be of same length" ); PLFLT xt, yt, r; for ( int i = 0; i < pts; i++ ) { xt = ( xM - xm ) * plrandd(); yt = ( yM - ym ) * plrandd(); if ( !randn ) { x[i] = xt + xm; y[i] = yt + ym; } else // std=1, meaning that many points are outside the plot range { x[i] = sqrt( -2.0 * log( xt ) ) * cos( 2. * PI * yt ) + xm; y[i] = sqrt( -2.0 * log( xt ) ) * sin( 2. * PI * yt ) + ym; } if ( !rosen ) { r = sqrt( x[i] * x[i] + y[i] * y[i] ); z[i] = exp( -r * r ) * cos( 2.0 * PI * r ); } else z[i] = log( pow( 1. - x[i], 2.9 ) + 100.0 * pow( y[i] - pow( x[i], 2.0 ), 2.0 ) ); } } void cmap1_init() { PLFLT[] i = [ 0.0, 1.0 ]; // boundaries PLFLT[] h = [ 240.0, 0.0 ]; // blue -> green -> yellow -> red PLFLT[] l = [ 0.6, 0.6 ]; PLFLT[] s = [ 0.8, 0.8 ]; plscmap1n( 256 ); plscmap1l( 0, i, h, l, s ); } plplot-5.10.0+dfsg/examples/d/x18d.d 644 1750 1750 717611544777744 157610ustar andrewandrew// $Id: x18d.d 11684 2011-03-31 04:15:32Z airwin $ // // 3-d line and point plot demo. Adapted from x08c.c. // import std.math; import std.string; import plplot; int opt[] = [ 1, 0, 1, 0 ]; PLFLT alt[] = [ 20.0, 35.0, 50.0, 65.0 ]; PLFLT az[] = [ 30.0, 40.0, 50.0, 60.0 ]; //-------------------------------------------------------------------------- // main // // Does a series of 3-d plots for a given data set, with different // viewing options in each plot. //-------------------------------------------------------------------------- int main( char[][] args ) { const int npts = 1000; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); for ( int k = 0; k < 4; k++ ) test_poly( k ); PLFLT[] x = new PLFLT[npts]; PLFLT[] y = new PLFLT[npts]; PLFLT[] z = new PLFLT[npts]; // From the mind of a sick and twisted physicist... PLFLT r; for ( int i = 0; i < npts; i++ ) { z[i] = -1. + 2. * i / npts; // Pick one ... // r = 1. - cast(PLFLT)i/npts; r = z[i]; x[i] = r * cos( 2. * PI * 6. * i / npts ); y[i] = r * sin( 2. * PI * 6. * i / npts ); } for ( int k = 0; k < 4; k++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -0.9, 1.1 ); plcol0( 1 ); plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); plcol0( 2 ); if ( opt[k] ) { plline3( x, y, z ); } else { // U+22C5 DOT OPERATOR. plstring3( x, y, z, "⋅" ); } plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, format( "#frPLplot Example 18 - Alt=%.0f, Az=%.0f", alt[k], az[k] ) ); } plend(); return 0; } void test_poly( int k ) { PLINT draw[][] = [ [ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ] ]; PLFLT[] x = new PLFLT[5]; PLFLT[] y = new PLFLT[5]; PLFLT[] z = new PLFLT[5]; pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -0.9, 1.1 ); plcol0( 1 ); plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); plcol0( 2 ); PLFLT theta( int a ) { return 2 * PI * a / 20; } PLFLT phi( int a ) { return PI * a / 20.1; } for ( int i = 0; i < 20; i++ ) { for ( int j = 0; j < 20; j++ ) { x[0] = sin( phi( j ) ) * cos( theta( i ) ); y[0] = sin( phi( j ) ) * sin( theta( i ) ); z[0] = cos( phi( j ) ); x[1] = sin( phi( j + 1 ) ) * cos( theta( i ) ); y[1] = sin( phi( j + 1 ) ) * sin( theta( i ) ); z[1] = cos( phi( j + 1 ) ); x[2] = sin( phi( j + 1 ) ) * cos( theta( i + 1 ) ); y[2] = sin( phi( j + 1 ) ) * sin( theta( i + 1 ) ); z[2] = cos( phi( j + 1 ) ); x[3] = sin( phi( j ) ) * cos( theta( i + 1 ) ); y[3] = sin( phi( j ) ) * sin( theta( i + 1 ) ); z[3] = cos( phi( j ) ); x[4] = sin( phi( j ) ) * cos( theta( i ) ); y[4] = sin( phi( j ) ) * sin( theta( i ) ); z[4] = cos( phi( j ) ); plpoly3( x, y, z, draw[k], 1 ); } } plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, "unit radius sphere" ); } plplot-5.10.0+dfsg/examples/d/x26d.d 644 1750 1750 1763012163113463 157500ustar andrewandrew// -*- coding: utf-8; -*- // // $Id: x26d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Multi-lingual version of the first page of example 4. // // Copyright (C) 2009 Werner Smekal // // Thanks to the following for providing translated strings for this example: // Valery Pipin (Russian) // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // // This example designed just for devices (e.g., psttfc and the // cairo-related devices) that use the pango and fontconfig libraries. The // best choice of glyph is selected by fontconfig and automatically rendered // by pango in way that is sensitive to complex text layout (CTL) language // issues for each unicode character in this example. Of course, you must // have the appropriate TrueType fonts installed to have access to all the // required glyphs. // // Translation instructions: The strings to be translated are given by // x_label, y_label, alty_label, title_label, and line_label below. The // encoding used must be UTF-8. // // The following strings to be translated involve some scientific/mathematical // jargon which is now discussed further to help translators. // // (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . // (2) degrees is an angular measure, see // http://en.wikipedia.org/wiki/Degree_(angle) . // (3) low-pass filter is one that transmits (passes) low frequencies. // (4) pole is in the mathematical sense, see // http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" // means a particular mathematical transformation of the filter function has // a single pole, see // http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . // Furthermore, a single-pole filter must have an inverse square decline // (or -20 db/decade). Since the filter plotted here does have that // characteristic, it must by definition be a single-pole filter, see also // http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm // (5) decade represents a factor of 10, see // http://en.wikipedia.org/wiki/Decade_(log_scale) . // import std.string; import std.math; import plplot; string[] x_label = [ "Frequency", "Частота", null ]; string[] y_label = [ "Amplitude (dB)", "Амплитуда (dB)", null ]; string[] alty_label = [ "Phase shift (degrees)", "Фазовый сдвиг (градусы)", null ]; // Short rearranged versions of y_label and alty_label. string[][] legend_text = [ [ "Amplitude", "Phase shift" ], [ "Амплитуда", "Фазовый сдвиг" ], null ]; string[] title_label = [ "Single Pole Low-Pass Filter", "Однополюсный Низко-Частотный Фильтр", null ]; string[] line_label = [ "-20 dB/decade", "-20 dB/десяток", null ]; //-------------------------------------------------------------------------- // main // // Illustration of logarithmic axes, and redefinition of window. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); plfont( 2 ); // Make log plots using two different styles. int i = 0; while ( x_label[i] ) { plot1( 0, x_label[i], y_label[i], alty_label[i], title_label[i], line_label[i], legend_text[i] ); i++; } plend(); return 0; } //-------------------------------------------------------------------------- // plot1 // // Log-linear plot. //-------------------------------------------------------------------------- void plot1( int type, string x_label, string y_label, string alty_label, string title_label, string line_label, string[] legend_text ) { // Set up data for log plot PLFLT[101] freql, ampl, phase; PLFLT f0 = 1.0, freq; PLINT nlegend = 2; string[] symbols; PLINT[] opt_array; PLINT[] text_colors; PLINT[] box_colors; PLINT[] box_patterns; PLFLT[] box_scales; PLFLT[] box_line_widths; PLINT[] line_colors; PLINT[] line_styles; PLFLT[] line_widths; PLINT[] symbol_numbers, symbol_colors; PLFLT[] symbol_scales; PLFLT legend_width, legend_height; for ( int i = 0; i < 101; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, freql[i] ); ampl[i] = 20.0 * log10( 1.0 / sqrt( 1.0 + pow( ( freq / f0 ), 2. ) ) ); phase[i] = -( 180.0 / PI ) * atan( freq / f0 ); } pladv( 0 ); plvpor( 0.15, 0.85, 0.1, 0.9 ); plwind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. plcol0( 1 ); switch ( type ) { case 0: plbox( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: plbox( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; default: break; } // Plot ampl vs freq plcol0( 2 ); plline( freql, ampl ); plcol0( 2 ); plptex( 1.6, -30.0, 1.0, -20.0, 0.5, line_label ); // Put labels on plcol0( 1 ); plmtex( "b", 3.2, 0.5, 0.5, x_label ); plmtex( "t", 2.0, 0.5, 0.5, title_label ); plcol0( 2 ); plmtex( "l", 5.0, 0.5, 0.5, y_label ); // For the gridless case, put phase vs freq on same plot if ( type == 0 ) { plcol0( 1 ); plwind( -2.0, 3.0, -100.0, 0.0 ); plbox( "", 0.0, 0, "cmstv", 30.0, 3 ); plcol0( 3 ); plline( freql, phase ); plstring( freql, phase, "*" ); plcol0( 3 ); plmtex( "r", 5.0, 0.5, 0.5, alty_label ); } // Initialize arrays needed for pllegend. opt_array.length = nlegend; text_colors.length = nlegend; line_colors.length = nlegend; line_styles.length = nlegend; line_widths.length = nlegend; box_colors.length = nlegend; box_patterns.length = nlegend; box_scales.length = nlegend; box_line_widths.length = nlegend; symbol_numbers.length = nlegend; symbol_colors.length = nlegend; symbol_scales.length = nlegend; symbols.length = nlegend; // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.; // Note from the above opt_array the first symbol (and box) indices // do not have to be specified // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // Note from the above opt_array the second box array indices // do not have to be specified plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, legend_text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); } plplot-5.10.0+dfsg/examples/d/x10d.d 644 1750 1750 151511544777744 157400ustar andrewandrew// $Id: x10d.d 11684 2011-03-31 04:15:32Z airwin $ // // // Window positioning demo. // import plplot; import std.string; //-------------------------------------------------------------------------- // main // // Demonstrates absolute positioning of graphs on a page. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plsvpa( 50.0, 150.0, 50.0, 100.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x13d.d 644 1750 1750 467012163113463 157240ustar andrewandrew// $Id: x13d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Pie chart demo. // import std.string; import std.stdio; import std.math; import plplot; string[] text = [ "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" ]; //-------------------------------------------------------------------------- // main // // Does a simple pie chart. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); // Ensure window has aspect ratio of one so circle is // plotted as a circle. plvasp( 1.0 ); plwind( 0.0, 10.0, 0.0, 10.0 ); plcol0( 2 ); // n.b. all theta quantities scaled by 2*M_PI/500 to be integers to avoid // floating point logic problems. int theta0 = 0; int dthet = 1; int theta1, theta; PLFLT just, dx, dy; PLFLT[] per = [ 10.0, 32.0, 12.0, 30.0, 16.0 ]; PLFLT[] x, y; for ( size_t i = 0; i < 5; i++ ) { size_t j = 0; // n.b. the theta quantities multiplied by 2*M_PI/500 afterward so // in fact per is interpreted as a percentage. theta1 = cast(int) ( theta0 + 5.0 * per[i] ); if ( i == 4 ) theta1 = 500; // set size of data arrays x.length = y.length = ( theta1 - theta0 ) / dthet + 2; x[j] = 5.0; y[j++] = 5.0; for ( theta = theta0; theta <= theta1; theta += dthet ) { x[j] = 5.0 + 3.0 * cos( ( 2.0 * PI / 500. ) * theta ); y[j++] = 5.0 + 3.0 * sin( ( 2.0 * PI / 500. ) * theta ); } plcol0( cast(PLINT) ( i + 1 ) ); plpsty( ( i + 3 ) % 8 + 1 ); plfill( x, y ); plcol0( 1 ); plline( x, y ); just = ( 2.0 * PI / 500.0 ) * ( theta0 + theta1 ) / 2.0; dx = 0.25 * cos( just ); dy = 0.25 * sin( just ); if ( ( theta0 + theta1 ) < 250 || ( theta0 + theta1 ) > 750 ) just = 0.0; else just = 1.0; plptex( x[j / 2] + dx, y[j / 2] + dy, 1.0, 0.0, just, text[i] ); theta0 = theta - dthet; } plfont( 2 ); plschr( 0., 1.3 ); plptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" ); // Don't forget to call PLEND to finish off! plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x02d.d 644 1750 1750 745112163113463 157220ustar andrewandrew// $Id: x02d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Multiple window and color map 0 demo. // import std.string; import std.conv; import plplot; //-------------------------------------------------------------------------- // main // // Demonstrates multiple windows and color map 0 palette, both default and // user-modified. //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // Run demos plot myPlot = new plot; myPlot.demo1(); myPlot.demo2(); plend(); return 0; } class plot { //-------------------------------------------------------------------------- // demo1 // Demonstrates multiple windows and default color map 0 palette. //-------------------------------------------------------------------------- public void demo1() { plbop(); // Divide screen into 16 regions plssub( 4, 4 ); draw_windows( 16, 0 ); pleop(); } //-------------------------------------------------------------------------- // demo2 // Demonstrates multiple windows, user-modified color map 0 palette, and // HLS -> RGB translation. //-------------------------------------------------------------------------- public void demo2() { // Set up cmap0 // Use 100 custom colors in addition to base 16 PLINT[116] r, g, b; // Min & max lightness values PLFLT lmin = 0.15, lmax = 0.85; plbop(); // Divide screen into 100 regions plssub( 10, 10 ); for ( int i = 0; i < 100; i++ ) { // Bounds on HLS, from plhlsrgb() commentary -- // hue [0., 360.] degrees // lightness [0., 1.] magnitude // saturation [0., 1.] magnitude // // Vary hue uniformly from left to right PLFLT h = ( 360. / 10. ) * ( i % 10 ); // Vary lightness uniformly from top to bottom, between min & max PLFLT l = lmin + ( lmax - lmin ) * ( i / 10 ) / 9.0; // Use max saturation PLFLT s = 1.0; PLFLT r1, g1, b1; plhlsrgb( h, l, s, &r1, &g1, &b1 ); // Use 255.001 to avoid close truncation decisions in this example. r[i + 16] = cast(PLINT) ( r1 * 255.001 ); g[i + 16] = cast(PLINT) ( g1 * 255.001 ); b[i + 16] = cast(PLINT) ( b1 * 255.001 ); } // Load default cmap0 colors into our custom set for ( int i = 0; i < 16; i++ ) plgcol0( i, &r[i], &g[i], &b[i] ); // Now set cmap0 all at once (faster, since fewer driver calls) plscmap0( r, g, b ); draw_windows( 100, 16 ); pleop(); } //-------------------------------------------------------------------------- // draw_windows // // Draws a set of numbered boxes with colors according to cmap0 entry. //-------------------------------------------------------------------------- private void draw_windows( int nw, int cmap0_offset ) { plschr( 0.0, 3.5 ); plfont( 4 ); for ( int i = 0; i < nw; i++ ) { plcol0( i + cmap0_offset ); pladv( 0 ); PLFLT vmin = 0.1; PLFLT vmax = 0.9; for ( int j = 0; j < 3; j++ ) { plwidth( j + 1 ); plvpor( vmin, vmax, vmin, vmax ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); vmin = vmin + 0.1; vmax = vmax - 0.1; } plwidth( 1 ); plptex( 0.5, 0.5, 1.0, 0.0, 0.5, to!string( i ) ); } } } plplot-5.10.0+dfsg/examples/d/x22d.d 644 1750 1750 3126312251353077 157470ustar andrewandrew// $Id: x22d.d 12832 2013-12-09 14:39:59Z andrewross $ // // Simple vector plot example // Copyright (C) 2009 Werner Smekal // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.math; import std.string; import plplot; // // Global transform function for a constriction using data passed in // This is the same transformation used in constriction. // extern ( C ) { void transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { PLFLT *xmax = cast(PLFLT *) data; *xt = x; *yt = y / 4.0 * ( 3 - cos( PI * x / *xmax ) ); } } //-------------------------------------------------------------------------- // main // // Generates several simple vector plots. //-------------------------------------------------------------------------- class plot { // // Vector plot of the circulation about the origin // void circulation() { const int nx = 20; const int ny = 20; PLFLT dx = 1.0; PLFLT dy = 1.0; PLFLT xmin = -nx / 2 * dx; PLFLT xmax = nx / 2 * dx; PLFLT ymin = -ny / 2 * dy; PLFLT ymax = ny / 2 * dy; PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.xg[i] = new PLFLT[ny]; cgrid2.yg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.yg[i] = new PLFLT[ny]; PLFLT[][] u = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) u[i] = new PLFLT[ny]; PLFLT[][] v = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) v[i] = new PLFLT[ny]; // Create data - circulation around the origin. PLFLT x, y; for ( int i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( int j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; u[i][j] = y; v[i][j] = -x; } } // Plot vectors with default arrows plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "(x)", "(y)", "#frPLplot Example 22 - circulation" ); plcol0( 2 ); plvect( u, v, 0.0, cgrid2 ); plcol0( 1 ); } // // Vector plot of flow through a constricted pipe // void constriction( int astyle ) { const int nx = 20; const int ny = 20; string title; PLFLT dx = 1.0; PLFLT dy = 1.0; PLFLT xmin = -nx / 2 * dx; PLFLT xmax = nx / 2 * dx; PLFLT ymin = -ny / 2 * dy; PLFLT ymax = ny / 2 * dy; PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.xg[i] = new PLFLT[ny]; cgrid2.yg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.yg[i] = new PLFLT[ny]; PLFLT[][] u = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) u[i] = new PLFLT[ny]; PLFLT[][] v = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) v[i] = new PLFLT[ny]; PLFLT Q = 2.0; PLFLT x, y, b, dbdx; for ( int i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( int j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; b = ymax / 4.0 * ( 3 - cos( PI * x / xmax ) ); if ( fabs( y ) < b ) { dbdx = ymax / 4.0 * sin( PI * x / xmax ) * PI / xmax * y / b; u[i][j] = Q * ymax / b; v[i][j] = dbdx * u[i][j]; } else { u[i][j] = 0.0; v[i][j] = 0.0; } } } plenv( xmin, xmax, ymin, ymax, 0, 0 ); title = format( "#frPLplot Example 22 - constriction (arrow style %d)", astyle ); pllab( "(x)", "(y)", title ); plcol0( 2 ); plvect( u, v, -1.0, cgrid2 ); plcol0( 1 ); } // // Vector plot of flow through a constricted pipe // with a coordinate transform // void constriction2() { const int nx = 20; const int ny = 20; const int nc = 11; const int nseg = 20; PLFLT [] clev = new PLFLT[nc]; PLFLT dx = 1.0; PLFLT dy = 1.0; PLFLT xmin = -nx / 2 * dx; PLFLT xmax = nx / 2 * dx; PLFLT ymin = -ny / 2 * dy; PLFLT ymax = ny / 2 * dy; plstransform( &transform, cast(PLPointer) &xmax ); PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.xg[i] = new PLFLT[ny]; cgrid2.yg = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) cgrid2.yg[i] = new PLFLT[ny]; PLFLT[][] u = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) u[i] = new PLFLT[ny]; PLFLT[][] v = new PLFLT[][nx]; for ( int i = 0; i < nx; i++ ) v[i] = new PLFLT[ny]; PLFLT Q = 2.0; PLFLT x, y, b, dbdx; for ( int i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( int j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; b = ymax / 4.0 * ( 3 - cos( PI * x / xmax ) ); u[i][j] = Q * ymax / b; v[i][j] = 0.0; } } for ( int i = 0; i < nc; i++ ) { clev[i] = Q + i * Q / ( nc - 1 ); } plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform" ); plcol0( 2 ); plshades( u, null, xmin + dx / 2, xmax - dx / 2, ymin + dy / 2, ymax - dy / 2, clev, 0.0, 1, 1.0, 0 ); plvect( u, v, -1.0, cgrid2 ); // Plot edges using plpath (which accounts for coordinate transformation) rather than plline plpath( nseg, xmin, ymax, xmax, ymax ); plpath( nseg, xmin, ymin, xmax, ymin ); plcol0( 1 ); plstransform( null, null ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- void f2mnmx( PLFLT[][] f, out PLFLT fmn, out PLFLT fmx ) { fmx = f[0][0]; fmn = fmx; for ( int i = 0; i < f.length; i++ ) { for ( int j = 0; j < f[i].length; j++ ) { fmx = fmax( fmx, f[i][j] ); fmn = fmin( fmn, f[i][j] ); } } } // // Vector plot of the gradient of a shielded potential (see example 9) // void potential() { const int nper = 100; const int nlevel = 10; const int nr = 20; const int ntheta = 20; PLcGrid2 cgrid2; cgrid2.xg = new PLFLT[][nr]; for ( int i = 0; i < nr; i++ ) cgrid2.xg[i] = new PLFLT[ntheta]; cgrid2.yg = new PLFLT[][nr]; for ( int i = 0; i < nr; i++ ) cgrid2.yg[i] = new PLFLT[ntheta]; PLFLT[][] u = new PLFLT[][nr]; for ( int i = 0; i < nr; i++ ) u[i] = new PLFLT[ntheta]; PLFLT[][] v = new PLFLT[][nr]; for ( int i = 0; i < nr; i++ ) v[i] = new PLFLT[ntheta]; PLFLT[][] z = new PLFLT[][nr]; for ( int i = 0; i < nr; i++ ) z[i] = new PLFLT[ntheta]; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. // PLFLT rmax = nr; PLFLT eps = 2.0; PLFLT q1 = 1.0; PLFLT d1 = rmax / 4.0; PLFLT q1i = -q1 * rmax / d1; PLFLT d1i = pow( rmax, 2.0 ) / d1; PLFLT q2 = -1.0; PLFLT d2 = rmax / 4.0; PLFLT q2i = -q2 * rmax / d2; PLFLT d2i = pow( rmax, 2.0 ) / d2; PLFLT r, theta, x, y; PLFLT div1, div1i, div2, div2i; for ( int i = 0; i < nr; i++ ) { r = 0.5 + i; for ( int j = 0; j < ntheta; j++ ) { theta = 2.0 * PI / ( ntheta - 1 ) * ( 0.5 + j ); x = r * cos( theta ); y = r * sin( theta ); cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; div1 = sqrt( pow( x - d1, 2.0 ) + pow( y - d1, 2.0 ) + pow( eps, 2.0 ) ); div1i = sqrt( pow( x - d1i, 2.0 ) + pow( y - d1i, 2.0 ) + pow( eps, 2.0 ) ); div2 = sqrt( pow( x - d2, 2.0 ) + pow( y + d2, 2.0 ) + pow( eps, 2.0 ) ); div2i = sqrt( pow( x - d2i, 2.0 ) + pow( y + d2i, 2.0 ) + pow( eps, 2.0 ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; u[i][j] = -q1 * ( x - d1 ) / pow( div1, 3.0 ) - q1i * ( x - d1i ) / pow( div1i, 3.0 ) - q2 * ( x - d2 ) / pow( div2, 3.0 ) - q2i * ( x - d2i ) / pow( div2i, 3.0 ); v[i][j] = -q1 * ( y - d1 ) / pow( div1, 3.0 ) - q1i * ( y - d1i ) / pow( div1i, 3.0 ) - q2 * ( y + d2 ) / pow( div2, 3.0 ) - q2i * ( y + d2i ) / pow( div2i, 3.0 ); } } PLFLT xmin, xmax, ymin, ymax, zmin, zmax; f2mnmx( cgrid2.xg, xmin, xmax ); f2mnmx( cgrid2.yg, ymin, ymax ); f2mnmx( z, zmin, zmax ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot" ); // Plot contours of the potential PLFLT dz = ( zmax - zmin ) / nlevel; PLFLT[] clevel = new PLFLT[nlevel]; for ( int i = 0; i < nlevel; i++ ) clevel[i] = zmin + ( i + 0.5 ) * dz; plcol0( 3 ); pllsty( 2 ); plcont( z, 1, nr, 1, ntheta, clevel, cgrid2 ); pllsty( 1 ); plcol0( 1 ); // Plot the vectors of the gradient of the potential plcol0( 2 ); plvect( u, v, 25.0, cgrid2 ); plcol0( 1 ); // Plot the perimeter of the cylinder PLFLT[] px = new PLFLT[nper]; PLFLT[] py = new PLFLT[nper]; for ( int i = 0; i < nper; i++ ) { theta = ( 2.0 * PI / ( nper - 1 ) ) * i; px[i] = rmax * cos( theta ); py[i] = rmax * sin( theta ); } plline( px, py ); } } int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); plot myPlot = new plot; myPlot.circulation(); PLINT fill = 0; // Pairs of points making the line segments used to plot the user defined arrow PLFLT[] arrow_x = [ -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 ]; PLFLT[] arrow_y = [ 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 ]; // Set arrow style using arrow_x and arrow_y then // plot using these arrows. plsvect( arrow_x, arrow_y, fill ); myPlot.constriction( 1 ); // Pairs of points making the line segments used to plot the user defined arrow PLFLT[] arrow2_x = [ -0.5, 0.3, 0.3, 0.5, 0.3, 0.3 ]; PLFLT[] arrow2_y = [ 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 ]; // Set arrow style using arrow2_x and arrow2_y then // plot using these filled arrows. fill = 1; plsvect( arrow2_x, arrow2_y, fill ); myPlot.constriction( 2 ); myPlot.constriction2(); plsvect( null, null, 0 ); myPlot.potential(); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x17d.d 644 1750 1750 703711544777744 157540ustar andrewandrew// $Id: x17d.d 11684 2011-03-31 04:15:32Z airwin $ // // Plots a simple stripchart with four pens. // import std.string; import std.math; import std.stdio; import std.c.stdlib; import plplot; //-------------------------------------------------------------------------- // main program //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // If db is used the plot is much more smooth. However, because of the // async X behaviour, one does not have a real-time scripcharter. // plsetopt("db", ""); // plsetopt("np", ""); // User sets up plot completely except for window and data // Eventually settings in place when strip chart is created will be // remembered so that multiple strip charts can be used simultaneously. // // Specify some reasonable defaults for ymin and ymax // The plot will grow automatically if needed (but not shrink) PLFLT ymin = -0.1; PLFLT ymax = 0.1; // Specify initial tmin and tmax -- this determines length of window. // Also specify maximum jump in t // This can accomodate adaptive timesteps PLFLT tmin = 0.; PLFLT tmax = 10.; PLFLT tjump = 0.3; // percentage of plot to jump // Axes options same as plbox. // Only automatic tick generation and label placement allowed // Eventually I'll make this fancier PLINT colbox = 1; PLINT collab = 3; PLINT[4] styline = [ 2, 3, 4, 5 ]; // pens color and line style PLINT[4] colline = [ 2, 3, 4, 5 ]; // pens legend string[4] legline = [ "sum", "sin", "sin*noi", "sin+noi" ]; PLFLT xlab = 0.; // legend position PLFLT ylab = 0.25; PLINT autoy = 1; // autoscale y PLINT acc = 1; // don't scrip, accumulate // Initialize plplot plinit(); pladv( 0 ); plvsta(); // Register our error variables with PLplot // From here on, we're handling all errors here PLINT pl_errcode; char[160] errmsg; plsError( &pl_errcode, errmsg.ptr ); PLINT id1; plstripc( &id1, "bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo" ); if ( pl_errcode ) { writefln( "%s", errmsg ); // TODO: to stderr return 1; } // Let plplot handle errors from here on plsError( null, null ); autoy = 0; // autoscale y acc = 1; // accumulate // This is to represent a loop over time // Let's try a random walk process PLFLT y1 = 0.0, y2 = 0.0, y3 = 0.0, y4 = 0.0; PLFLT dt = 0.1; const int nsteps = 1000; PLFLT t, noise; for ( size_t n = 0; n < nsteps; n++ ) { // todo: usleep? // todo: poll? t = n * dt; noise = plrandd() - 0.5; y1 += noise; y2 = sin( t * PI / 18. ); y3 = y2 * noise; y4 = y2 + noise / 3.; // There is no need for all pens to have the same number of // points or beeing equally time spaced. if ( n % 2 ) plstripa( id1, 0, t, y1 ); if ( n % 3 ) plstripa( id1, 1, t, y2 ); if ( n % 4 ) plstripa( id1, 2, t, y3 ); if ( n % 5 ) plstripa( id1, 3, t, y4 ); /* pleop(); */ /* use double buffer (-db on command line) */ } // Destroy strip chart and it's memory plstripd( id1 ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x33d.d 644 1750 1750 7246712230620121 157440ustar andrewandrew// -*- coding: utf-8; -*- // // $Id: x33d.d 12609 2013-10-20 00:14:09Z airwin $ // // Demonstrate most pllegend capability including unicode symbols. // // Copyright (C) 2010 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example designed just for devices (e.g., the cairo-related and // qt-related devices) where the best choice of glyph is automatically // selected by the related libraries (pango/cairo or Qt4) for each // unicode character depending on what system fonts are installed. Of // course, you must have the appropriate TrueType fonts installed to // have access to all the required glyphs. import plplot; import std.math; import std.string; static PLINT position_options[16] = [ PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_INSIDE ]; // Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). static string special_symbols[5] = [ "✰", "✴", "✱", "✽", "✦" ]; // plcolorbar options // Colorbar type options const int COLORBAR_KINDS = 4; static PLINT colorbar_option_kinds[COLORBAR_KINDS] = [ PL_COLORBAR_SHADE, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT ]; static string colorbar_option_kind_labels[COLORBAR_KINDS] = [ "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars" ]; // Which side of the page are we positioned relative to? const int COLORBAR_POSITIONS = 4; static PLINT colorbar_position_options[COLORBAR_POSITIONS] = [ PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM ]; static string colorbar_position_option_labels[COLORBAR_POSITIONS] = [ "Left", "Right", "Top", "Bottom" ]; // Colorbar label positioning options const int COLORBAR_LABELS = 4; static PLINT colorbar_label_options[COLORBAR_LABELS] = [ PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM ]; static string colorbar_label_option_labels[COLORBAR_LABELS] = [ "Label left", "Label right", "Label top", "Label bottom" ]; // Colorbar cap options const int COLORBAR_CAPS = 4; static PLINT colorbar_cap_options[COLORBAR_CAPS] = [ PL_COLORBAR_CAP_NONE, PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH ]; static string colorbar_cap_option_labels[COLORBAR_CAPS] = [ "No caps", "Low cap", "High cap", "Low and high caps" ]; static int colorbar = 1; // By default do not plot plcolorbar pages // for now while we are working out the API. void plcolorbar_example_page( int kind_i, int label_i, int cap_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT [] values ) { // Parameters for the colorbars on this page PLINT position_i, position, opt; PLFLT x, y, x_length, y_length; PLFLT ticks[1] = [ 0.0 ]; PLINT sub_ticks[1] = [ 0 ]; PLFLT low_cap_color, high_cap_color; PLINT vertical, ifn; PLINT n_axes = 1; string[] axis_opts; PLINT n_labels = 1; PLINT label_opts[1] = [ 0 ]; string[] label; string title; PLFLT colorbar_width, colorbar_height; PLINT n_values_array[1]; PLFLT[][] values_array; axis_opts.length = 1; label.length = 1; values_array = new PLFLT[][1]; n_values_array[0] = n_values; values_array[0] = values; low_cap_color = 0.0; high_cap_color = 1.0; // Start a new page pladv( 0 ); // Draw one colorbar relative to each side of the page for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) { position = colorbar_position_options[position_i]; opt = colorbar_option_kinds[kind_i] | colorbar_label_options[label_i] | colorbar_cap_options[cap_i]; vertical = position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT; ifn = position & PL_POSITION_LEFT || position & PL_POSITION_BOTTOM; // Set the offset position on the page if ( vertical ) { x = 0.0; y = 0.0; x_length = 0.05; y_length = 0.5; } else { x = 0.0; y = 0.0; x_length = 0.5; y_length = 0.05; } // Set appropriate labelling options. if ( ifn ) { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivn"; //axis_opts[0] = "uwtin"; } else { axis_opts[0] = "uwxvn"; //axis_opts[0] = "uwxn"; } } else { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivm"; //axis_opts[0] = "uwtim"; } else { axis_opts[0] = "uwxvm"; //axis_opts[0] = "uwxm"; } } label[0] = format( "%s, %s", colorbar_position_option_labels[position_i], colorbar_label_option_labels[label_i] ); // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); plvpor( 0.20, 0.80, 0.20, 0.80 ); plwind( 0.0, 1.0, 0.0, 1.0 ); // Set interesting background colour. plscol0a( 15, 0, 0, 0, 0.20 ); plcolorbar( &colorbar_width, &colorbar_height, opt | PL_COLORBAR_BOUNDING_BOX | PL_COLORBAR_BACKGROUND, position, x, y, x_length, y_length, 15, 1, 1, low_cap_color, high_cap_color, cont_color, cont_width, label_opts, label, axis_opts, ticks, sub_ticks, values_array ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } // Draw a page title title = format( "%s - %s", colorbar_option_kind_labels[kind_i], colorbar_cap_option_labels[cap_i] ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } void plcolorbar_example( string palette, int kind_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT [] values ) { int label_i, cap_i; // Load the color palette plspal1( palette, 1 ); for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) { for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) { plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ); } } } //-------------------------------------------------------------------------- // main // // Demonstrate most pllegend capability including unicode symbols. //-------------------------------------------------------------------------- const int MAX_NLEGEND = 7; int main( char[][] args ) { int i, k; PLINT opt; PLINT nlegend, nturn; PLINT opt_array[MAX_NLEGEND]; PLINT text_colors[MAX_NLEGEND]; PLINT box_colors[MAX_NLEGEND]; PLINT box_patterns[MAX_NLEGEND]; PLFLT box_scales[MAX_NLEGEND]; PLFLT box_line_widths[MAX_NLEGEND]; PLINT line_colors[MAX_NLEGEND]; PLINT line_styles[MAX_NLEGEND]; PLFLT line_widths[MAX_NLEGEND]; PLINT symbol_numbers[MAX_NLEGEND]; PLINT symbol_colors[MAX_NLEGEND]; PLFLT symbol_scales[MAX_NLEGEND]; string text[MAX_NLEGEND]; string symbols[MAX_NLEGEND]; PLFLT legend_width, legend_height, x, y, xstart, ystart; PLFLT max_height, text_scale; PLINT position, opt_base, nrow, ncolumn; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // First page illustrating the 16 standard positions. pladv( 0 ); plvpor( 0.25, 0.75, 0.25, 0.75 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 8.0, 0.5, 0.5, "The 16 standard legend positions with" ); plmtex( "t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y" ); nlegend = 1; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[0] = 1; line_widths[0] = 1.; symbol_scales[0] = 1.; symbol_numbers[0] = 4; symbols[0] = "*"; // Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); for ( k = 0; k < 16; k++ ) { position = position_options[k]; opt = opt_base; text[0] = format( "%2.2d", k ); text_colors[0] = 1 + ( k % 8 ); line_colors[0] = 1 + ( k % 8 ); symbol_colors[0] = 1 + ( k % 8 ); pllegend( &legend_width, &legend_height, opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); } // Second page illustrating effect of nrow, ncolumn for the same legend // data.; pladv( 0 ); plvpor( 0.25, 0.75, 0.25, 0.75 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR," ); plmtex( "t", 6.0, 0.5, 0.5, "and position for the same legend data" ); nlegend = 7; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; text[k] = format( "%2.2d", k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); position = PL_POSITION_TOP | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 3; ncolumn = 3; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 2.0, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); // Third page demonstrating legend alignment pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 2.0, 0.5, 0.5, "Demonstrate legend alignment" ); x = 0.1; y = 0.1; nturn = 4; nlegend = 0; position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt = opt_base; for ( i = 0; i < 9; i++ ) { // Set up legend arrays with the correct size, type. if ( i <= nturn ) nlegend += 1; else nlegend -= 1; nlegend = cast(int) fmax( 1, nlegend ); // nly specify legend data that are required according to the // value of opt_array for that entry. for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; text[k] = format( "%2.2d", k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); nrow = cast(int) fmin( 3, nlegend ); ncolumn = 0; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, opt_array[0..nlegend], 1.0, 1.0, 1.5, 1., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); if ( i == nturn ) { position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE; opt = opt_base; x = 1. - x; y += legend_height; } else { x += legend_width; y += legend_height; } } // Fourth page illustrating various kinds of legends max_height = 0.; xstart = 0.0; ystart = 0.1; x = xstart; y = ystart; text_scale = 0.90; pladv( 0 ); plvpor( 0.0, 1., 0.0, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); //plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends" ); nlegend = 5; // Only specify legend data that are required according to the // value of opt_array for that entry. position = PL_POSITION_LEFT | PL_POSITION_TOP; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT; // Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array[0] = PL_LEGEND_NONE; text[0] = format( "%s", "None" ); text_colors[0] = 1; opt_array[1] = PL_LEGEND_COLOR_BOX; text[1] = format( "%s", "Box" ); text_colors[1] = 2; box_colors[1] = 2; box_patterns[1] = 0; box_scales[1] = 0.8; box_line_widths[1] = 1.; opt_array[2] = PL_LEGEND_LINE; text[2] = format( "%s", "Line" ); text_colors[2] = 3; line_colors[2] = 3; line_styles[2] = 1; line_widths[2] = 1.; opt_array[3] = PL_LEGEND_SYMBOL; text[3] = format( "%s", "Symbol" ); text_colors[3] = 4; symbol_colors[3] = 4; symbol_scales[3] = text_scale; symbol_numbers[3] = 4; symbols[3] = special_symbols[2]; opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE; text[4] = format( "%s", "L & S" ); text_colors[4] = 5; line_colors[4] = 5; line_styles[4] = 1; line_widths[4] = 1.; symbol_colors[4] = 5; symbol_scales[4] = text_scale; symbol_numbers[4] = 4; symbols[4] = special_symbols[2]; opt = opt_base; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], box_colors[0..nlegend], box_patterns[0..nlegend], box_scales[0..nlegend], box_line_widths[0..nlegend], line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); max_height = fmax( max_height, legend_height ); // Set up symbol legend entries with various symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; text[i] = format( "%s%s", "Symbol ", special_symbols[i] ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = 4; symbols[i] = special_symbols[i]; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, null, null, null, symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); max_height = fmax( max_height, legend_height ); // Set up symbol legend entries with various numbers of symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; text[i] = format( "%s %d", "Symbol Number", i + 2 ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = i + 2; symbols[i] = special_symbols[2]; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, null, null, null, symbol_colors[0..nlegend], symbol_scales[0..nlegend], symbol_numbers[0..nlegend], symbols[0..nlegend] ); max_height = fmax( max_height, legend_height ); // Set up box legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; text[i] = format( "%s %d", "Box Color", i + 1 ); text_colors[i] = i + 1; box_colors[i] = i + 1; box_patterns[i] = 0; box_scales[i] = 0.8; box_line_widths[i] = 1.; } opt = opt_base; // Use new origin x = xstart; y += max_height; max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], box_colors[0..nlegend], box_patterns[0..nlegend], box_scales[0..nlegend], box_line_widths[0..nlegend], null, null, null, null, null, null, null ); max_height = fmax( max_height, legend_height ); // Set up box legend entries with various patterns. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; text[i] = format( "%s %d", "Box Pattern", i ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = i; box_scales[i] = 0.8; box_line_widths[i] = 1.; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], box_colors[0..nlegend], box_patterns[0..nlegend], box_scales[0..nlegend], box_line_widths[0..nlegend], null, null, null, null, null, null, null ); max_height = fmax( max_height, legend_height ); // Set up box legend entries with various box pattern line widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; text[i] = format( "%s %d", "Box Line Width", i + 1 ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = 3; box_scales[i] = 0.8; box_line_widths[i] = cast(PLFLT) ( i + 1 ); } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], box_colors[0..nlegend], box_patterns[0..nlegend], box_scales[0..nlegend], box_line_widths[0..nlegend], null, null, null, null, null, null, null ); max_height = fmax( max_height, legend_height ); // Set up line legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; text[i] = format( "%s %d", "Line Color", i + 1 ); text_colors[i] = i + 1; line_colors[i] = i + 1; line_styles[i] = 1; line_widths[i] = 1.; } opt = opt_base; // Use new origin x = xstart; y += max_height; max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], null, null, null, null ); max_height = fmax( max_height, legend_height ); // Set up line legend entries with various styles. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; text[i] = format( "%s %d", "Line Style", i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = i + 1; line_widths[i] = 1.; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], null, null, null, null ); max_height = fmax( max_height, legend_height ); // Set up line legend entries with various widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; text[i] = format( "%s %d", "Line Width", i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = 1; line_widths[i] = cast(PLFLT) ( i + 1 ); } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array[0..nlegend], 1.0, text_scale, 2.0, 0., text_colors[0..nlegend], text[0..nlegend], null, null, null, null, line_colors[0..nlegend], line_styles[0..nlegend], line_widths[0..nlegend], null, null, null, null ); max_height = fmax( max_height, legend_height ); if ( colorbar ) { // Color bar examples PLFLT values_small[2] = [ -1.0e-200, 1.0e-200 ]; PLFLT values_uneven[9] = [ -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 ]; PLFLT values_even[9] = [ -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 ]; // Use unsaturated green background colour to contrast with black caps. plscolbg( 70, 185, 70 ); // Cut out the greatest and smallest bits of the color spectrum to // leave colors for the end caps. plscmap1_range( 0.01, 0.99 ); // We can only test image and gradient colorbars with two element arrays for ( i = 2; i < COLORBAR_KINDS; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); } // Test shade colorbars with larger arrays for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); } for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); } } plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x31d.d 644 1750 1750 2060411544777744 157630ustar andrewandrew// $Id: x31d.d 11684 2011-03-31 04:15:32Z airwin $ // // Copyright (C) 2009 Werner Smekal // // set/get tester // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.stdio; import std.math; import std.cstream; import plplot; int main( char[][] args ) { // Parse and process command line arguments int status = 0; plparseopts( args, PL_PARSE_FULL ); // Test setting / getting familying parameters before plinit // Save values set by plparseopts to be restored later. PLINT fam0, num0, bmax0; plgfam( &fam0, &num0, &bmax0 ); PLINT fam1 = 0; PLINT num1 = 10; PLINT bmax1 = 1000; plsfam( fam1, num1, bmax1 ); // Retrieve the same values? PLINT fam2, num2, bmax2; plgfam( &fam2, &num2, &bmax2 ); writefln( "family parameters: fam, num, bmax = %d %d %d", fam2, num2, bmax2 ); if ( fam2 != fam1 || num2 != num1 || bmax2 != bmax1 ) { derr.writefln( "plgfam test failed" ); status = 1; } // Restore values set initially by plparseopts. plsfam( fam0, num0, bmax0 ); // Test setting / getting page parameters before plinit // Save values set by plparseopts to be restored later. PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; plgpage( &xp0, &yp0, &xleng0, &yleng0, &xoff0, &yoff0 ); PLFLT xp1 = 200.0; PLFLT yp1 = 200.0; PLINT xleng1 = 400; PLINT yleng1 = 200; PLINT xoff1 = 10; PLINT yoff1 = 20; plspage( xp1, yp1, xleng1, yleng1, xoff1, yoff1 ); // Retrieve the same values? PLFLT xp2, yp2; PLINT xleng2, yleng2, xoff2, yoff2; plgpage( &xp2, &yp2, &xleng2, &yleng2, &xoff2, &yoff2 ); writefln( "page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d", xp2, yp2, xleng2, yleng2, xoff2, yoff2 ); if ( xp2 != xp1 || yp2 != yp1 || xleng2 != xleng1 || yleng2 != yleng1 || xoff2 != xoff1 || yoff2 != yoff1 ) { derr.writefln( "plgpage test failed" ); status = 1; } // Restore values set initially by plparseopts. plspage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); // Test setting / getting compression parameter across plinit. PLINT compression1 = 95; plscompression( compression1 ); // Initialize plplot plinit(); // Test if device initialization screwed around with the preset // compression parameter. PLINT compression2; plgcompression( &compression2 ); writefln( "Output various PLplot parameters" ); writefln( "compression parameter = %d", compression2 ); if ( compression2 != compression1 ) { derr.writefln( "plgcompression test failed" ); status = 1; } // Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure // they work without any obvious error messages. PLINT[] r1 = [ 0, 255 ]; PLINT[] g1 = [ 255, 0 ]; PLINT[] b1 = [ 0, 0 ]; PLFLT[] a1 = [ 1.0, 1.0 ]; plscolor( 1 ); plscol0( 1, 255, 0, 0 ); plscmap1( r1, g1, b1 ); plscmap1a( r1, g1, b1, a1 ); PLINT level2; plglevel( &level2 ); writefln( "level parameter = %d", level2 ); if ( level2 != 1 ) { derr.writefln( "plglevel test failed." ); status = 1; } pladv( 0 ); plvpor( 0.01, 0.99, 0.02, 0.49 ); PLFLT xmin, xmax, ymin, ymax; plgvpd( &xmin, &xmax, &ymin, &ymax ); writefln( "plvpor: xmin, xmax, ymin, ymax = %f %f %f %f", xmin, xmax, ymin, ymax ); if ( xmin != 0.01 || xmax != 0.99 || ymin != 0.02 || ymax != 0.49 ) { derr.writefln( "plgvpd test failed" ); status = 1; } PLFLT xmid = 0.5 * ( xmin + xmax ); PLFLT ymid = 0.5 * ( ymin + ymax ); plwind( 0.2, 0.3, 0.4, 0.5 ); plgvpw( &xmin, &xmax, &ymin, &ymax ); writefln( "plwind: xmin, xmax, ymin, ymax = %f %f %f %f", xmin, xmax, ymin, ymax ); if ( xmin != 0.2 || xmax != 0.3 || ymin != 0.4 || ymax != 0.5 ) { derr.writefln( "plgvpw test failed" ); status = 1; } // Get world coordinates for middle of viewport PLFLT wx, wy; PLINT win; plcalc_world( xmid, ymid, &wx, &wy, &win ); writefln( "world parameters: wx, wy, win = %f %f %d", wx, wy, win ); if ( fabs( wx - 0.5 * ( xmin + xmax ) ) > 1.0E-5 || fabs( wy - 0.5 * ( ymin + ymax ) ) > 1.0E-5 ) { derr.writefln( "plcalc_world test failed" ); status = 1; } // Retrieve and print the name of the output file (if any). // This goes to stderr not stdout since it will vary between tests and // we want stdout to be identical for compare test. string fnam; plgfnam( fnam ); if ( fnam.length == 0 ) writefln( "No output file name is set" ); else writefln( "Output file name read" ); derr.writefln( "Output file name is %s", fnam ); // Set and get the number of digits used to display axis labels // Note digits is currently ignored in pls[xyz]ax and // therefore it does not make sense to test the returned // value plsxax( 3, 0 ); PLINT digmax, digits; plgxax( &digmax, &digits ); writefln( "x axis parameters: digmax, digits = %d %d", digmax, digits ); if ( digmax != 3 ) { derr.writefln( "plgxax test failed" ); status = 1; } plsyax( 4, 0 ); plgyax( &digmax, &digits ); writefln( "y axis parameters: digmax, digits = %d %d", digmax, digits ); if ( digmax != 4 ) { derr.writefln( "plgyax test failed" ); status = 1; } plszax( 5, 0 ); plgzax( &digmax, &digits ); writefln( "z axis parameters: digmax, digits = %d %d", digmax, digits ); if ( digmax != 5 ) { derr.writefln( "plgzax test failed" ); status = 1; } plsdidev( 0.05, PL_NOTSET, 0.1, 0.2 ); PLFLT mar, aspect, jx, jy; plgdidev( &mar, &aspect, &jx, &jy ); writefln( "device-space window parameters: mar, aspect, jx, jy = %f %f %f %f", mar, aspect, jx, jy ); if ( mar != 0.05 || jx != 0.1 || jy != 0.2 ) { derr.writefln( "plgdidev test failed" ); status = 1; } plsdiori( 1.0 ); PLFLT ori; plgdiori( &ori ); writefln( "ori parameter = %f", ori ); if ( ori != 1.0 ) { derr.writefln( "plgdiori test failed" ); status = 1; } plsdiplt( 0.1, 0.2, 0.9, 0.8 ); plgdiplt( &xmin, &ymin, &xmax, &ymax ); writefln( "plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f", xmin, ymin, xmax, ymax ); if ( xmin != 0.1 || xmax != 0.9 || ymin != 0.2 || ymax != 0.8 ) { derr.writefln( "plgdiplt test failed" ); status = 1; } plsdiplz( 0.1, 0.1, 0.9, 0.9 ); PLFLT zxmin, zymin, zxmax, zymax; plgdiplt( &zxmin, &zymin, &zxmax, &zymax ); writefln( "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f", zxmin, zymin, zxmax, zymax ); if ( fabs( zxmin - ( xmin + ( xmax - xmin ) * 0.1 ) ) > 1.0E-5 || fabs( zxmax - ( xmin + ( xmax - xmin ) * 0.9 ) ) > 1.0E-5 || fabs( zymin - ( ymin + ( ymax - ymin ) * 0.1 ) ) > 1.0E-5 || fabs( zymax - ( ymin + ( ymax - ymin ) * 0.9 ) ) > 1.0E-5 ) { derr.writefln( "plsdiplz test failed" ); status = 1; } plscolbg( 10, 20, 30 ); PLINT r, g, b; plgcolbg( &r, &g, &b ); writefln( "background colour parameters: r, g, b = %d %d %d", r, g, b ); if ( r != 10 || g != 20 || b != 30 ) { derr.writefln( "plgcolbg test failed" ); status = 1; } plscolbga( 20, 30, 40, 0.5 ); PLFLT a; plgcolbga( &r, &g, &b, &a ); writefln( "background/transparency colour parameters: r, g, b, a = %d %d %d %f", r, g, b, a ); if ( r != 20 || g != 30 || b != 40 || a != 0.5 ) { derr.writefln( "plgcolbga test failed" ); status = 1; } plend(); return status; } plplot-5.10.0+dfsg/examples/d/x01d.d 644 1750 1750 2061312102122103 157140ustar andrewandrew// $Id: x01d.d 12288 2013-01-30 04:40:35Z airwin $ // // Simple line plot and multiple windows demo. // // Copyright (C) 2009 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.math; import std.stdio; import std.string; import plplot; static int locate_mode; static int test_xor; static int fontset = 1; static string f_name; // Options data structure definition. //~ static PLOptionTable[] options[] = { //~ { //~ "locate", /* Turns on test of API locate function */ //~ NULL, //~ NULL, //~ &locate_mode, //~ PL_OPT_BOOL, //~ "-locate", //~ "Turns on test of API locate function" }, //~ { //~ "xor", /* Turns on test of xor function */ //~ NULL, //~ NULL, //~ &test_xor, //~ PL_OPT_BOOL, //~ "-xor", //~ "Turns on test of XOR" }, //~ { //~ "font", /* For switching between font set 1 & 2 */ //~ NULL, //~ NULL, //~ &fontset, //~ PL_OPT_INT, //~ "-font number", //~ "Selects stroke font set (0 or 1, def:1)" }, //~ { //~ "save", /* For saving in postscript */ //~ NULL, //~ NULL, //~ &f_name, //~ PL_OPT_STRING, //~ "-save filename", //~ "Save plot in color postscript `file'" }, //~ { //~ NULL, /* option */ //~ NULL, /* handler */ //~ NULL, /* client data */ //~ NULL, /* address of variable to set */ //~ 0, /* mode flag */ //~ NULL, /* short syntax */ //~ NULL } /* long syntax */ //~ }; //~ const char *notes[] = {"Make sure you get it right!", NULL}; // Function prototypes //-------------------------------------------------------------------------- // main // // Generates several simple line plots. Demonstrates: // - subwindow capability // - setting up the window, drawing plot, and labelling // - changing the color // - automatic axis rescaling to exponential notation // - placing the axes in the middle of the box // - gridded coordinate axes //-------------------------------------------------------------------------- int main( char[][] args ) { // plplot initialization // Divide page into 2x2 plots unless user overrides plssub( 2, 2 ); // Parse and process command line arguments //plMergeOpts(options, "x01c options", notes); plparseopts( args, PL_PARSE_FULL ); // Get version number, just for kicks string ver; plgver( ver ); writefln( "PLplot library version: %s", ver ); // TODO: to stdout // Initialize plplot plinit(); // Select font set as per input flag if ( fontset ) plfontld( 1 ); else plfontld( 0 ); plot myPlot = new plot; // Set up the data & plot myPlot.plot1( 6, 1, 0, 0, 0 ); // Set up the data & plot PLINT digmax = 5; plsyax( digmax, 0 ); myPlot.plot1( 1, 0.0014, 0, 0.0185, 1 ); myPlot.plot2(); myPlot.plot3(); // // Show how to save a plot: // Open a new device, make it current, copy parameters, // and replay the plot buffer // if ( f_name ) // command line option '-save filename' { PLINT cur_strm, new_strm; writefln( "The current plot was saved in color Postscript under the name `%s'.", f_name ); plgstrm( &cur_strm ); // get current stream plmkstrm( &new_strm ); // create a new one plsfnam( f_name ); // file name plsdev( "psc" ); // device type plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream plreplot(); // do the save by replaying the plot buffer plend1(); // finish the device plsstrm( cur_strm ); // return to previous stream } // Let's get some user input if ( locate_mode ) { PLGraphicsIn gin; //for(;;) { // if(!plGetCursor(&gin)) // break; // if(gin.keysym==PLK_Escape) // break; // pltext(); // if(gin.keysym<0xFF && isprint(gin.keysym)) // writefln("subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c'", // gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); // else // writefln("subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x", // gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); // plgra(); // } } // Don't forget to call plend() to finish off! plend(); return 0; } class plot { private PLFLT[] x, y, x0, y0; private PLFLT[6] xs, ys; private PLINT[1] space1 = [ 1500 ], mark1 = [ 1500 ]; public void plot1( PLFLT xscale, PLFLT yscale, PLFLT xoff, PLFLT yoff, int do_test ) { x.length = 60; y.length = 60; for ( int i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale*pow( x[i], 2. ); } PLFLT xmin = x[0]; PLFLT xmax = x[59]; PLFLT ymin = y[0]; PLFLT ymax = y[59]; for ( int i = 0; i < xs.length; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 2 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points plcol0( 4 ); plpoin( xs, ys, 9 ); // Draw the line through the data plcol0( 3 ); plline( x, y ); // xor mode enable erasing a line/point/text by replotting it again // it does not work in double buffering mode, however if ( do_test && test_xor ) { writefln( "The -xor command line option can only be exercised if your " "system\nhas usleep(), which does not seem to happen." ); } } public void plot2() { // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). plcol0( 1 ); plenv( -2.0, 10.0, -0.4, 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays x.length = 100; y.length = 100; for ( int i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line plcol0( 3 ); plwidth( 2 ); plline( x, y ); plflush(); plwidth( 1 ); } public void plot3() { // For the final graph we wish to override the default tick intervals, and // so do not use PLENV pladv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. plvsta(); plwind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl // expects a pointer!! plstyl( mark1, space1 ); plcol0( 2 ); plbox( "g", 30.0, 0, "g", 0.2, 0 ); plstyl( null, null ); plcol0( 3 ); pllab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); x.length = 101; y.length = 101; for ( int i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * PI / 180.0 ); } plcol0( 4 ); plline( x, y ); } }plplot-5.10.0+dfsg/examples/d/x23d.d 644 1750 1750 2460612163113463 157460ustar andrewandrew// $Id: x23d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Displays Greek letters and mathematically interesting Unicode ranges // Copyright (C) 2005,2008 Alan Irwin // Copyright (C) 2005,2008 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.stdio; import plplot; // // main // // Displays Greek letters and mathematically interesting Unicode ranges // static string[] Greek = [ "#gA", "#gB", "#gG", "#gD", "#gE", "#gZ", "#gY", "#gH", "#gI", "#gK", "#gL", "#gM", "#gN", "#gC", "#gO", "#gP", "#gR", "#gS", "#gT", "#gU", "#gF", "#gX", "#gQ", "#gW", "#ga", "#gb", "#gg", "#gd", "#ge", "#gz", "#gy", "#gh", "#gi", "#gk", "#gl", "#gm", "#gn", "#gc", "#go", "#gp", "#gr", "#gs", "#gt", "#gu", "#gf", "#gx", "#gq", "#gw" ]; static int[] Type1 = [ 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0028, 0x0029, 0x002b, 0x002c, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x005b, 0x005d, 0x005f, 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac, 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7, 0x0192, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022, 0x2026, 0x2032, 0x2033, 0x203e, 0x2044, 0x2111, 0x2118, 0x211c, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, 0x2215, 0x2217, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329, 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665, 0x2666 ]; static string[] title = [ "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)" ]; static int[] lo = [ 0x0, 0x0, 0x40, 0x80, 0x2153, 0x2190, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0 ]; static int[] hi = [ 0x30, 0x40, 0x80, 0xA6, 0x2184, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, 0x2300 ]; static int[] nxcells = [ 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ]; static int[] nycells = [ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ]; // non-zero values Must be consistent with nxcells and nycells. static int[] offset = [ 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0, ]; // 30 possible FCI values. const int FCI_COMBINATIONS = 30; static PLUNICODE[] fci = [ 0x80000000, 0x80000001, 0x80000002, 0x80000003, 0x80000004, 0x80000010, 0x80000011, 0x80000012, 0x80000013, 0x80000014, 0x80000020, 0x80000021, 0x80000022, 0x80000023, 0x80000024, 0x80000100, 0x80000101, 0x80000102, 0x80000103, 0x80000104, 0x80000110, 0x80000111, 0x80000112, 0x80000113, 0x80000114, 0x80000120, 0x80000121, 0x80000122, 0x80000123, 0x80000124 ]; static const string[] family = [ "sans-serif", "serif", "monospace", "script", "symbol" ]; static const string[] style = [ "upright", "italic", "oblique" ]; static const string[] weight = [ "medium", "bold" ]; int main( char[][] args ) { string cmdString; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); plinit(); for ( int page = 0; page < 11; page++ ) { pladv( 0 ); // Set up viewport and window plvpor( 0.02, 0.98, 0.02, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); PLFLT xmin, xmax, ymin, ymax; plgspa( &xmin, &xmax, &ymin, &ymax ); plschr( 0., 0.8 ); PLFLT ycharacter_scale = ( 1.0 - 0.0 ) / ( ymax - ymin ); // Factor should be 0.5, but heuristically it turns out to be larger. PLFLT chardef, charht; plgchr( &chardef, &charht ); PLFLT yoffset = 1.0 * charht * ycharacter_scale; // Draw the grid using plbox plcol0( 2 ); PLFLT deltax = 1.0 / nxcells[page]; PLFLT deltay = 1.0 / nycells[page]; plbox( "bcg", deltax, 0, "bcg", deltay, 0 ); plcol0( 15 ); int length = hi[page] - lo[page]; int slice = 0; PLFLT x, y; for ( int j = nycells[page] - 1; j >= -1; j-- ) { y = ( 0.5 + j ) * deltay; for ( int i = 0; i < nxcells[page]; i++ ) { x = ( 0.5 + i ) * deltax; if ( slice < length ) { if ( page == 0 ) cmdString = format( "#%s", Greek[slice] ); else if ( ( page >= 1 ) && ( page <= 3 ) ) cmdString = format( "##[0x%.4x]", Type1[offset[page] + slice] ); else if ( page >= 4 ) cmdString = format( "##[0x%.4x]", lo[page] + slice ); plptex( x, y + yoffset, 1., 0., 0.5, cmdString[1..cmdString.length] ); plptex( x, y - yoffset, 1., 0., 0.5, cmdString ); } slice++; } } // Page title plschr( 0., 1.0 ); plmtex( "t", 1.5, 0.5, 0.5, title[page] ); } // Demonstrate methods of getting the current fonts PLUNICODE fci_old; plgfci( &fci_old ); PLINT ifamily, istyle, iweight; plgfont( &ifamily, &istyle, &iweight ); writefln( "For example 23 prior to page 12 the FCI is 0x%x", fci_old ); writefln( "For example 23 prior to page 12 the font family, style and weight are %s %s %s", family[ifamily], style[istyle], weight[iweight] ); for ( int page = 11; page < 16; page++ ) { PLFLT dy = 0.030; string text; pladv( 0 ); plvpor( 0.02, 0.98, 0.02, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plsfci( 0 ); if ( page == 11 ) plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with plsfci" ); else if ( page == 12 ) plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with plsfont" ); else if ( page == 13 ) plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct" ); else if ( page == 14 ) plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs" ); else if ( page == 15 ) plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with ## constructs" ); plschr( 0., 0.75 ); for ( int i = 0; i < FCI_COMBINATIONS; i++ ) { int family_index = i % 5; int style_index = ( i / 5 ) % 3; int weight_index = ( ( i / 5 ) / 3 ) % 2; if ( page == 11 ) { plsfci( fci[i] ); text = format( "Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index] ); } else if ( page == 12 ) { plsfont( family_index, style_index, weight_index ); text = format( "Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index] ); } else if ( page == 13 ) { text = format( "Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], fci[i] ); } else if ( page == 14 ) { text = format( "Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family_index, style_index, weight_index ); } else if ( page == 15 ) { text = format( "Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family[family_index], style[style_index], weight[weight_index] ); } plptex( 0., 1. - ( i + 0.5 ) * dy, 1., 0., 0., text ); } plschr( 0., 1.0 ); } // Restore defaults plcol0( 1 ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x15d.d 644 1750 1750 2012012163113463 157320ustar andrewandrew// $Id: x15d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Shade plot demo. // // Maurice LeBrun // IFS, University of Texas at Austin // 31 Aug 1993 // import std.math; import std.stdio; import std.string; import plplot; //-------------------------------------------------------------------------- // main // // Does a variety of shade plots. //-------------------------------------------------------------------------- int main( char[][] args ) { const int XPTS = 35; // Data points in x const int YPTS = 46; // Data points in y // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Set up color map 0 // plscmap0n(3); // create plot object plot myPlot = new plot; // Set up color map 1 myPlot.cmap1_init2(); // Initialize plplot plinit(); // Set up data array PLFLT xx, yy; PLFLT[][] z = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) z[i] = new PLFLT[YPTS]; for ( int i = 0; i < XPTS; i++ ) { xx = cast(double) ( i - ( XPTS / 2 ) ) / ( XPTS / 2 ); for ( int j = 0; j < YPTS; j++ ) { yy = cast(double) ( j - ( YPTS / 2 ) ) / ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy + ( xx - yy ) / ( xx * xx + yy * yy + 0.1 ); } } // Plot using identity transform myPlot.plot1( z ); myPlot.plot2( z ); myPlot.plot3(); plend(); return 0; } class plot { //-------------------------------------------------------------------------- // cmap1_init1 // // Initializes color map 1 in HLS space. //-------------------------------------------------------------------------- public void cmap1_init1() { PLFLT[] i = [ 0.0, 0.45, 0.55, 1.0 ]; // left boundary, just before center, // just after center, right boundary PLFLT[] h = [ 260.0, 260.0, 20.0, 20.0 ]; // hue -- low: blue-violet, only change as we go over vertex // hue -- high: red, keep fixed PLFLT[] l = [ 0.5, 0.0, 0.0, 0.5 ]; // lightness -- low, lightness -- center // lightness -- center, lightness -- high PLFLT[] s = [ 1.0, 1.0, 1.0, 1.0 ]; // maximum saturation plscmap1l( 0, i, h, l, s ); } //-------------------------------------------------------------------------- // cmap1_init2 // // Initializes color map 1 in HLS space. //-------------------------------------------------------------------------- public void cmap1_init2() { PLFLT[] i = [ 0.0, 0.45, 0.55, 1.0 ]; // left boundary, just before center, // just after center, right boundary PLFLT[] h = [ 260.0, 260.0, 20.0, 20.0 ]; // hue -- low: blue-violet, only change as we go over vertex // hue -- high: red, keep fixed PLFLT[] l = [ 0.6, 0.0, 0.0, 0.6 ]; // lightness -- low, lightness -- center // lightness -- center, lightness -- high PLFLT[] s = [ 1.0, 0.5, 0.5, 1.0 ]; // saturation -- low, saturation -- center // saturation -- center, saturation -- high plscmap1l( 0, i, h, l, s ); } //-------------------------------------------------------------------------- // plot1 // // Illustrates a single shaded region. //-------------------------------------------------------------------------- public void plot1( PLFLT[][] z ) { pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); PLFLT zmin, zmax; f2mnmx( z, zmin, zmax ); PLFLT shade_min = zmin + ( zmax - zmin ) * 0.4; PLFLT shade_max = zmin + ( zmax - zmin ) * 0.6; PLFLT sh_color = 7; PLFLT sh_width = 2.; PLINT sh_cmap = 0; PLINT min_color = 9; PLINT max_color = 2; PLFLT min_width = 2.; PLFLT max_width = 2.; plpsty( 8 ); plshade( z, null, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1 ); plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon flux" ); } //-------------------------------------------------------------------------- // plot2 // // Illustrates multiple adjacent shaded regions, using different fill // patterns for each region. //-------------------------------------------------------------------------- public void plot2( PLFLT[][] z ) { static PLINT nlin[10] = [ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]; static PLINT inc[10][2] = [ [450, 0], [-450, 0], [0, 0], [900, 0], [300, 0], [450, -450], [0, 900], [0, 450], [450, -450], [0, 900] ]; static PLINT del[10][2] = [ [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [4000, 4000], [4000, 2000] ]; PLINT sh_cmap = 0, sh_width = 2; PLINT min_color = 0, min_width = 0, max_color = 0, max_width = 0; pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); PLFLT zmin, zmax; f2mnmx( z, zmin, zmax ); // Plot using identity transform for ( int i = 0; i < 10; i++ ) { PLFLT shade_min = zmin + ( zmax - zmin ) * i / 10.0; PLFLT shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / 10.0; PLFLT sh_color = i + 6; plpat( inc[i][0..nlin[i]], del[i][0..nlin[i]] ); plshade( z, null, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon flux" ); } //-------------------------------------------------------------------------- // plot3 // // Illustrates shaded regions in 3d, using a different fill pattern for // each region. //-------------------------------------------------------------------------- public void plot3() { static PLFLT xx[2][5] = [ [-1.0, 1.0, 1.0, -1.0, -1.0], [-1.0, 1.0, 1.0, -1.0, -1.0] ]; static PLFLT yy[2][5] = [ [1.0, 1.0, 0.0, 0.0, 1.0], [-1.0, -1.0, 0.0, 0.0, -1.0] ]; static PLFLT zz[2][5] = [ [0.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0] ]; pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plw3d( 1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40 ); // Plot using identity transform plcol0( 1 ); plbox3( "bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0 ); plcol0( 2 ); pllab( "", "", "3-d polygon filling" ); plcol0( 3 ); plpsty( 1 ); plline3( xx[0], yy[0], zz[0] ); plfill3( xx[0][0..4], yy[0][0..4], zz[0][0..4] ); plpsty( 2 ); plline3( xx[1], yy[1], zz[1] ); plfill3( xx[1][0..4], yy[1][0..4], zz[1][0..4] ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- public void f2mnmx( PLFLT[][] f, out PLFLT fmn, out PLFLT fmx ) { fmx = f[0][0]; fmn = fmx; for ( int i = 0; i < f.length; i++ ) { for ( int j = 0; j < f[i].length; j++ ) { fmx = fmax( fmx, f[i][j] ); fmn = fmin( fmn, f[i][j] ); } } } } plplot-5.10.0+dfsg/examples/d/x25d.d 644 1750 1750 667212163113463 157330ustar andrewandrew// $Id: x25d.d 12393 2013-06-27 19:49:07Z andrewross $ // // Filling and clipping polygons. // import plplot; import std.string; //-------------------------------------------------------------------------- // main // // Test program for filling polygons and proper clipping //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plssub( 3, 3 ); plinit(); static PLFLT[2][9] xextreme = [ [-120.0, 120.0], [-120.0, 120.0], [-120.0, 120.0], [ -80.0, 80.0], [-220.0, -120.0], [ -20.0, 20.0], [ -20.0, 20.0], [ -80.0, 80.0], [ 20.0, 120.0] ]; static PLFLT[2][9] yextreme = [ [-120.0, 120.0], [ 20.0, 120.0], [ -20.0, 120.0], [ -20.0, 120.0], [-120.0, 120.0], [-120.0, 120.0], [ -20.0, 20.0], [ -80.0, 80.0], [-120.0, 120.0] ]; PLFLT[] x0, y0; for ( int k = 0; k < 2; k++ ) { for ( int j = 0; j < 4; j++ ) { switch ( j ) { case 0: x0.length = 4; y0.length = 4; // Polygon 1: a diamond x0[] = [ 0.0, -100.0, 0.0, 100.0 ]; y0[] = [-100.0, 0.0, 100.0, 0.0 ]; break; case 1: // Polygon 1: a diamond - reverse direction x0[] = [ 100.0, 0.0, -100.0, 0.0 ]; y0[] = [ 0.0, 100.0, 0.0, -100.0 ]; break; case 2: // Polygon 2: a square with punctures x0.length = 10; y0.length = 10; x0[] = [ -100.0, -100.0, 80.0, -100.0, -100.0, -80.0, 0.0, 80.0, 100.0, 100.0 ]; y0[] = [ -100.0, -80.0, 0.0, 80.0, 100.0, 100.0, 80.0, 100.0, 100.0, -100.0 ]; break; case 3: // Polygon 2: a square with punctures - reversed direction x0[] = [ 100.0, 100.0, 80.0, 0.0, -80.0, -100.0, -100.0, 80.0, -100.0, -100.0 ]; y0[] = [ -100.0, 100.0, 100.0, 80.0, 100.0, 100.0, 80.0, 0.0, -80.0, -100.0 ]; break; default: break; } for ( int i = 0; i < 9; i++ ) { pladv( 0 ); plvsta(); plwind( xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1] ); plcol0( 2 ); plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 ); plcol0( 1 ); plpsty( 0 ); if ( k == 0 ) plfill( x0, y0 ); else plgradient( x0, y0, 45. ); plcol0( 2 ); pllsty( 1 ); plline( x0, y0 ); } } } // Don't forget to call plend() to finish off! plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x29d.d 644 1750 1750 3040311544777744 157700ustar andrewandrew// $Id: x29d.d 11684 2011-03-31 04:15:32Z airwin $ // // Sample plots using date / time formatting for axes // // Copyright (C) 2009 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.math; import plplot; //-------------------------------------------------------------------------- // main // // Draws several plots which demonstrate the use of date / time formats for // the axis labels. // Time formatting is done using the strfqsas routine from the qsastime // library. This is similar to strftime, but works for a broad // date range even on 32-bit systems. See the // documentation of strfqsas for full details of the available formats. // // 1) Plotting temperature over a day (using hours / minutes) // 2) Plotting // // Note: We currently use the default call for plconfigtime (done in // plinit) which means continuous times are interpreted as seconds since // 1970-01-01, but that may change in future, more extended versions of // this example. // //-------------------------------------------------------------------------- int main( char[][] args ) { // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); // Change the escape character to a '@' instead of the default '#' plsesc( '@' ); plot myPlot = new plot; myPlot.page1(); myPlot.page2(); myPlot.page3(); myPlot.page4(); // Don't forget to call plend() to finish off! plend(); return 0; } class plot { private PLFLT[] x, y; private PLFLT[] xerr1, xerr2, yerr1, yerr2; private void resizeArrays( int size ) { x.length = y.length = size; xerr1.length = xerr2.length = size; yerr1.length = yerr2.length = size; } // Plot a model diurnal cycle of temperature void page1() { // resize arrays const int npts = 73; resizeArrays( npts ); // Data points every 10 minutes for 1 day PLFLT xmin = 0; PLFLT xmax = 60.0 * 60.0 * 24.0; // Number of seconds in a day PLFLT ymin = 10.0; PLFLT ymax = 20.0; for ( int i = 0; i < npts; i++ ) { x[i] = xmax * ( i / cast(PLFLT) npts ); y[i] = 15.0 - 5.0 * cos( 2 * PI * ( i / cast(PLFLT) npts ) ); // Set x error bars to +/- 5 minute xerr1[i] = x[i] - 60 * 5; xerr2[i] = x[i] + 60 * 5; // Set y error bars to +/- 0.1 deg C yerr1[i] = y[i] - 0.1; yerr2[i] = y[i] + 0.1; } pladv( 0 ); // Rescale major ticks marks by 0.5 plsmaj( 0.0, 0.5 ); // Rescale minor ticks and error bar marks by 0.5 plsmin( 0.0, 0.5 ); plvsta(); plwind( xmin, xmax, ymin, ymax ); // Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. plcol0( 1 ); // Set time format to be hours:minutes pltimefmt( "%H:%M" ); plbox( "bcnstd", 3.0 * 60 * 60, 3, "bcnstv", 1, 5 ); plcol0( 3 ); pllab( "Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature" ); plcol0( 4 ); plline( x, y ); plcol0( 2 ); plerrx( xerr1, xerr2, y ); plcol0( 3 ); plerry( x, yerr1, yerr2 ); // Rescale major / minor tick marks back to default plsmin( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); } // Plot the number of hours of daylight as a function of day for a year void page2() { // resize arrays const int npts = 365; resizeArrays( npts ); // Latitude for London PLFLT lat = 51.5; PLFLT xmin = 0; PLFLT xmax = npts * 60.0 * 60.0 * 24.0; PLFLT ymin = 0; PLFLT ymax = 24; // Formula for hours of daylight from // "A Model Comparison for Daylength as a Function of Latitude and // Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. PLFLT p, d; for ( int j = 0; j < npts; j++ ) { x[j] = j * 60.0 * 60.0 * 24.0; p = asin( 0.39795 * cos( 0.2163108 + 2 * atan( 0.9671396 * tan( 0.00860 * ( j - 186 ) ) ) ) ); d = 24.0 - ( 24.0 / PI ) * acos( ( sin( 0.8333 * PI / 180.0 ) + sin( lat * PI / 180.0 ) * sin( p ) ) / ( cos( lat * PI / 180.0 ) * cos( p ) ) ); y[j] = d; } plcol0( 1 ); // Set time format to be abbreviated month name followed by day of month pltimefmt( "%b %d" ); plprec( 1, 1 ); plenv( xmin, xmax, ymin, ymax, 0, 40 ); plcol0( 3 ); pllab( "Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N" ); plcol0( 4 ); plline( x, y ); plprec( 0, 0 ); } void page3() { // resize arrays const int npts = 62; resizeArrays( npts ); // Calculate continuous time corresponding to 2005-12-01 UTC. PLFLT tstart; plctime( 2005, 11, 01, 0, 0, 0., &tstart ); PLFLT xmin = tstart; PLFLT xmax = xmin + npts * 60.0 * 60.0 * 24.0; PLFLT ymin = 0.0; PLFLT ymax = 5.0; for ( int i = 0; i < npts; i++ ) { x[i] = xmin + i * 60.0 * 60.0 * 24.0; y[i] = 1.0 + sin( 2 * PI * i / 7.0 ) + exp( fmin( i, npts - i ) / 31.0 ); } pladv( 0 ); plvsta(); plwind( xmin, xmax, ymin, ymax ); plcol0( 1 ); // Set time format to be ISO 8601 standard YYYY-MM-DD. pltimefmt( "%F" ); // Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox( "bcnstd", 14 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1, 4 ); plcol0( 3 ); pllab( "Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006" ); plcol0( 4 ); // Rescale symbol size (used by plpoin) by 0.5 plssym( 0.0, 0.5 ); plpoin( x, y, 2 ); plline( x, y ); } void page4() { // TAI-UTC (seconds) as a function of time. // Use Besselian epochs as the continuous time interval just to prove // this does not introduce any issues. // Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch // B = 1900. + (JD -2415020.31352)/365.242198781 // ==> (as calculated with aid of "bc -l" command) // B = (MJD + 678940.364163900)/365.242198781 // ==> // MJD = B*365.24219878 - 678940.364163900 PLFLT scale = 365.242198781; PLFLT offset1 = -678940.; PLFLT offset2 = -0.3641639; plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); PLFLT xmin, xmax, ymin, ymax, xlabel_step; int npts, if_TAI_time_format; string time_format, title_suffix, xtitle; for ( int kind = 0; kind < 7; kind++ ) { if ( kind == 0 ) { plctime( 1950, 0, 2, 0, 0, 0.0, &xmin ); plctime( 2020, 0, 2, 0, 0, 0.0, &xmax ); npts = 70 * 12 + 1; ymin = 0.0; ymax = 36.0; time_format = "%Y%"; if_TAI_time_format = 1; title_suffix = "from 1950 to 2020"; xtitle = "Year"; xlabel_step = 10.0; } else if ( kind == 1 || kind == 2 ) { plctime( 1961, 7, 1, 0, 0, 1.64757 - 0.20, &xmin ); plctime( 1961, 7, 1, 0, 0, 1.64757 + 0.20, &xmax ); npts = 1001; ymin = 1.625; ymax = 1.725; time_format = "%S%2%"; title_suffix = "near 1961-08-01 (TAI)"; xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 1 ) { if_TAI_time_format = 1; xtitle = "Seconds (TAI)"; } else { if_TAI_time_format = 0; xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } else if ( kind == 3 || kind == 4 ) { plctime( 1963, 10, 1, 0, 0, 2.6972788 - 0.20, &xmin ); plctime( 1963, 10, 1, 0, 0, 2.6972788 + 0.20, &xmax ); npts = 1001; ymin = 2.55; ymax = 2.75; time_format = "%S%2%"; title_suffix = "near 1963-11-01 (TAI)"; xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 3 ) { if_TAI_time_format = 1; xtitle = "Seconds (TAI)"; } else { if_TAI_time_format = 0; xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } else if ( kind == 5 || kind == 6 ) { plctime( 2009, 0, 1, 0, 0, 34.0 - 5.0, &xmin ); plctime( 2009, 0, 1, 0, 0, 34.0 + 5.0, &xmax ); npts = 1001; ymin = 32.5; ymax = 34.5; time_format = "%S%2%"; title_suffix = "near 2009-01-01 (TAI)"; xlabel_step = 1. / ( scale * 86400. ); if ( kind == 5 ) { if_TAI_time_format = 1; xtitle = "Seconds (TAI)"; } else { if_TAI_time_format = 0; xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } PLINT tai_year, tai_month, tai_day, tai_hour, tai_min; PLFLT tai_sec, tai; PLINT utc_year, utc_month, utc_day, utc_hour, utc_min; PLFLT utc_sec, utc; PLFLT[] x, y; x.length = y.length = npts; for ( int i = 0; i < npts; i++ ) { x[i] = xmin + i * ( xmax - xmin ) / ( npts - 1 ); plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); tai = x[i]; plbtime( &tai_year, &tai_month, &tai_day, &tai_hour, &tai_min, &tai_sec, tai ); plconfigtime( scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0. ); plbtime( &utc_year, &utc_month, &utc_day, &utc_hour, &utc_min, &utc_sec, tai ); plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); plctime( utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, &utc ); y[i] = ( tai - utc ) * scale * 86400.; } pladv( 0 ); plvsta(); plwind( xmin, xmax, ymin, ymax ); plcol0( 1 ); if ( if_TAI_time_format ) plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); else plconfigtime( scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0. ); pltimefmt( time_format ); plbox( "bcnstd", xlabel_step, 0, "bcnstv", 0., 0 ); plcol0( 3 ); string title = "@frPLplot Example 29 - TAI-UTC "; title ~= title_suffix; pllab( xtitle, "TAI-UTC (sec)", title ); plcol0( 4 ); plline( x, y ); } } } plplot-5.10.0+dfsg/examples/d/x28d.d 644 1750 1750 3204011544777744 157660ustar andrewandrew// $Id: x28d.d 11684 2011-03-31 04:15:32Z airwin $ // // plmtex3, plptex3 demo. // // Copyright (C) 2009 Werner Smekal // Copyright (C) 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // import std.string; import std.math; import plplot; //-------------------------------------------------------------------------- // main // // Demonstrates plotting text in 3D. //-------------------------------------------------------------------------- int main( char[][] args ) { // Choose these values to correspond to tick marks. const int XPTS = 2; const int YPTS = 2; const int NREVOLUTION = 16; const int NROTATION = 8; const int NSHEAR = 8; PLFLT xmin = 0.0, xmax = 1.0, xmid = 0.5 * ( xmax + xmin ), xrange = xmax - xmin, ymin = 0.0, ymax = 1.0, ymid = 0.5 * ( ymax + ymin ), yrange = ymax - ymin, zmin = 0.0, zmax = 1.0, zmid = 0.5 * ( zmax + zmin ), zrange = zmax - zmin, ysmin = ymin + 0.1 * yrange, ysmax = ymax - 0.1 * yrange, ysrange = ysmax - ysmin, dysrot = ysrange / cast(PLFLT) ( NROTATION - 1 ), dysshear = ysrange / cast(PLFLT) ( NSHEAR - 1 ), zsmin = zmin + 0.1 * zrange, zsmax = zmax - 0.1 * zrange, zsrange = zsmax - zsmin, dzsrot = zsrange / cast(PLFLT) ( NROTATION - 1 ), dzsshear = zsrange / cast(PLFLT) ( NSHEAR - 1 ), ys, zs; // p1string must be exactly one character + the null termination // character. string pstring = "The future of our civilization depends on software freedom."; // Allocate and define the minimal x, y, and z to insure 3D box PLFLT[XPTS] x; PLFLT[YPTS] y; PLFLT[][] z = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) z[i] = new PLFLT[YPTS]; for ( int i = 0; i < XPTS; i++ ) x[i] = xmin + i * xrange / ( XPTS - 1 ); for ( int j = 0; j < YPTS; j++ ) y[j] = ymin + j * yrange / ( YPTS - 1 ); for ( int i = 0; i < XPTS; i++ ) for ( int j = 0; j < YPTS; j++ ) z[i][j] = 0.0; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); plinit(); // Page 1: Demonstrate inclination and shear capability pattern. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xrange, 0, "b", "", yrange, 0, "bcd", "", zrange, 0 ); PLFLT x_inclination, y_inclination, z_inclination; PLFLT x_shear, y_shear, z_shear; PLFLT omega, sin_omega, cos_omega; // z = zmin. plschr( 0., 1.0 ); for ( int i = 0; i < NREVOLUTION; i++ ) { omega = ( 2. * PI * i ) / NREVOLUTION; sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.5 * yrange * sin_omega; z_inclination = 0.0; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.5 * yrange * cos_omega; z_shear = 0.; plptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // x = xmax. plschr( 0., 1.0 ); for ( int i = 0; i < NREVOLUTION; i++ ) { omega = ( 2. * PI * i ) / NREVOLUTION; sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.; y_inclination = -0.5 * yrange * cos_omega; z_inclination = 0.5 * zrange * sin_omega; x_shear = 0.; y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; plptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // y = ymax. plschr( 0., 1.0 ); for ( int i = 0; i < NREVOLUTION; i++ ) { omega = ( 2. * PI * i ) / NREVOLUTION; sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.; z_inclination = 0.5 * zrange * sin_omega; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.; z_shear = 0.5 * zrange * cos_omega; plptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, z, DRAW_LINEXY ); // Page 2: Demonstrate rotation of string around its axis. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xrange, 0, "b", "", yrange, 0, "bcd", "", zrange, 0 ); // y = ymax. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( int i = 0; i < NROTATION; i++ ) { omega = ( 2. * PI * i ) / NROTATION; sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * cast(PLFLT) i; plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u" ); } // x = xmax. plschr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; y_shear = 0.; for ( int i = 0; i < NROTATION; i++ ) { omega = ( 2. * PI * i ) / NROTATION; sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * cast(PLFLT) i; plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u" ); } // z = zmin. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( int i = 0; i < NROTATION; i++ ) { omega = ( 2. * PI * i ) / NROTATION; sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; z_shear = 0.5 * zrange * sin_omega; ys = ysmax - dysrot * cast(PLFLT) i; plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, z, DRAW_LINEXY ); // Page 3: Demonstrate shear of string along its axis. // Work around xcairo and pngcairo (but not pscairo) problems for // shear vector too close to axis of string. (N.B. no workaround // would be domega = 0.) PLFLT domega = 0.05; pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xrange, 0, "b", "", yrange, 0, "bcd", "", zrange, 0 ); // y = ymax. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; y_shear = 0.; for ( int i = 0; i < NSHEAR; i++ ) { omega = domega + ( 2. * PI * i ) / NSHEAR; sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * cast(PLFLT) i; plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u" ); } // x = xmax. plschr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; x_shear = 0.; for ( int i = 0; i < NSHEAR; i++ ) { omega = domega + ( 2. * PI * i ) / NSHEAR; sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = -0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * cast(PLFLT) i; plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u" ); } // z = zmin. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; z_shear = 0.; for ( int i = 0; i < NSHEAR; i++ ) { omega = domega + ( 2. * PI * i ) / NSHEAR; sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; x_shear = 0.5 * xrange * sin_omega; ys = ysmax - dysshear * cast(PLFLT) i; plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, z, DRAW_LINEXY ); // Page 4: Demonstrate drawing a string on a 3D path. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30. ); plcol0( 2 ); plbox3( "b", "", xrange, 0, "b", "", yrange, 0, "bcd", "", zrange, 0 ); plschr( 0., 1.2 ); // domega controls the spacing between the various characters of the // string and also the maximum value of omega for the given number // of characters in *pstring. domega = 2. * PI / pstring.length; omega = 0.; // 3D function is a helix of the given radius and pitch PLFLT radius = 0.5; PLFLT pitch = 1. / ( 2. * PI ); PLFLT xpos, ypos, zpos; for ( int i = 0; i < pstring.length; i++ ) { sin_omega = sin( omega ); cos_omega = cos( omega ); xpos = xmid + radius * sin_omega; ypos = ymid - radius * cos_omega; zpos = zmin + pitch * omega; // In general, the inclination is proportional to the derivative of // the position wrt theta. x_inclination = radius * cos_omega;; y_inclination = radius * sin_omega; z_inclination = pitch; // The shear vector should be perpendicular to the 3D line with Z // component maximized, but for low pitch a good approximation is // a constant vector that is parallel to the Z axis. x_shear = 0.; y_shear = 0.; z_shear = 1.; plptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, pstring[i..i + 1] ); omega += domega; } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, z, DRAW_LINEXY ); // Page 5: Demonstrate plmtex3 axis labelling capability pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xrange, 0, "b", "", yrange, 0, "bcd", "", zrange, 0 ); plschr( 0., 1.0 ); plmtex3( "xp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "xp", 4.5, 0.5, 0.5, "primary X-axis label" ); plmtex3( "xs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "xs", -1.0, 0.5, 0.5, "secondary X-axis label" ); plmtex3( "yp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "yp", 4.5, 0.5, 0.5, "primary Y-axis label" ); plmtex3( "ys", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "ys", -1.0, 0.5, 0.5, "secondary Y-axis label" ); plmtex3( "zp", 4.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "zp", 3.0, 0.5, 0.5, "primary Z-axis label" ); plmtex3( "zs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "zs", -1.0, 0.5, 0.5, "secondary Z-axis label" ); // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, z, DRAW_LINEXY ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x30d.d 644 1750 1750 1047211544777744 157640ustar andrewandrew// $Id: x30d.d 11684 2011-03-31 04:15:32Z airwin $ // // Alpha color values demonstration. // // Copyright (C) 2009 Werner Smekal // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example will only really be interesting when used with devices that // support or alpha (or transparency) values, such as the cairo device family. // import plplot; import std.string; int main( char[][] args ) { PLINT[] red = [ 0, 255, 0, 0 ]; PLINT[] green = [ 0, 0, 255, 0 ]; PLINT[] blue = [ 0, 0, 0, 255 ]; PLFLT[] alpha = [ 1.0, 1.0, 1.0, 1.0 ]; PLFLT[] px = [ 0.1, 0.5, 0.5, 0.1 ]; PLFLT[] py = [ 0.1, 0.1, 0.5, 0.5 ]; PLFLT[] pos = [ 0.0, 1.0 ]; PLFLT[] rcoord = [ 1.0, 1.0 ]; PLFLT[] gcoord = [ 0.0, 0.0 ]; PLFLT[] bcoord = [ 0.0, 0.0 ]; PLFLT[] acoord = [ 0.0, 1.0 ]; PLBOOL[] rev = [ 0 ]; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); plinit(); plscmap0n( 4 ); plscmap0a( red, green, blue, alpha ); // // Page 1: // // This is a series of red, green and blue rectangles overlaid // on each other with gradually increasing transparency. // // Set up the window pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plcol0( 0 ); plbox( "", 1.0, 0, "", 1.0, 0 ); // Draw the boxes PLINT icol, r, g, b; PLFLT a; for ( int i = 0; i < 9; i++ ) { icol = i % 3 + 1; // Get a color, change its transparency and // set it as the current color. plgcol0a( icol, &r, &g, &b, &a ); plscol0a( icol, r, g, b, 1.0 - i / 9.0 ); plcol0( icol ); // Draw the rectangle plfill( px, py ); // Shift the rectangles coordinates for ( int j = 0; j < 4; j++ ) { px[j] += 0.5 / 9.0; py[j] += 0.5 / 9.0; } } // // Page 2: // // This is a bunch of boxes colored red, green or blue with a single // large (red) box of linearly varying transparency overlaid. The // overlaid box is completely transparent at the bottom and completely // opaque at the top. // // Set up the window pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); // Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for ( int i = 0; i < 5; i++ ) { // Set box X position px[0] = 0.05 + 0.2 * i; px[1] = px[0] + 0.1; px[2] = px[1]; px[3] = px[0]; // We don't want the boxes to be transparent, so since we changed // the colors transparencies in the first example we have to change // the transparencies back to completely opaque. icol = i % 3 + 1; plgcol0a( icol, &r, &g, &b, &a ); plscol0a( icol, r, g, b, 1.0 ); plcol0( icol ); for ( int j = 0; j < 5; j++ ) { // Set box y position and draw the box. py[0] = 0.05 + 0.2 * j; py[1] = py[0]; py[2] = py[0] + 0.1; py[3] = py[2]; plfill( px, py ); } } // Create the color map with 128 colors and use plscmap1la to initialize // the color values with a linearly varying red transparency (or alpha) plscmap1n( 128 ); plscmap1la( 1, pos, rcoord, gcoord, bcoord, acoord, rev ); // Use that cmap1 to create a transparent red gradient for the whole // window. px[0] = 0.; px[1] = 1.; px[2] = 1.; px[3] = 0.; py[0] = 0.; py[1] = 0.; py[2] = 1.; py[3] = 1.; plgradient( px, py, 90. ); plend(); return 0; } plplot-5.10.0+dfsg/examples/d/x11d.d 644 1750 1750 1212212163113463 157310ustar andrewandrew// $Id: x11d.d 12393 2013-06-27 19:49:07Z andrewross $ // // // Mesh plot demo. // // Copyright (C) 2008 Werner Smekal // Copyright (C) 2004 Rafael Laboissiere // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free So ftware // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // import plplot; import std.string; import std.math; void cmap1_init() { PLFLT[2] i, h, l, s; i[] = [ 0.0, 1.0 ]; // boundaries h[] = [ 240.0, 0.0 ]; // blue -> green -> yellow -> red l[] = [ 0.6, 0.6 ]; s[] = [ 0.8, 0.8 ]; plscmap1n( 256 ); c_plscmap1l( 0, 2, cast(PLFLT*) i, cast(PLFLT*) h, cast(PLFLT*) l, cast(PLFLT*) s, null ); } //-------------------------------------------------------------------------- // main // // Does a series of mesh plots for a given data set, with different // viewing options in each plot. //-------------------------------------------------------------------------- int main( char[][] args ) { const nlevel = 10; const XPTS = 35; // Data points in x const YPTS = 46; // Data points in y int[] opt = [ DRAW_LINEXY, DRAW_LINEXY ]; PLFLT[] alt = [ 33.0, 17.0 ]; PLFLT[] az = [ 24.0, 115.0 ]; string title[] = [ "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" ]; PLFLT xx, yy; // Parse and process command line arguments plparseopts( args, PL_PARSE_FULL ); // Initialize plplot plinit(); PLFLT[XPTS] x; PLFLT[YPTS] y; PLFLT[][] z = new PLFLT[][XPTS]; for ( int i = 0; i < XPTS; i++ ) z[i] = new PLFLT[YPTS]; for ( int i = 0; i < XPTS; i++ ) x[i] = 3. * cast(PLFLT) ( i - ( XPTS / 2 ) ) / cast(PLFLT) ( XPTS / 2 ); for ( int i = 0; i < YPTS; i++ ) y[i] = 3. * cast(PLFLT) ( i - ( YPTS / 2 ) ) / cast(PLFLT) ( YPTS / 2 ); for ( size_t i = 0; i < XPTS; i++ ) { xx = x[i]; for ( size_t j = 0; j < YPTS; j++ ) { yy = y[j]; z[i][j] = 3. * ( 1. - xx ) * ( 1. - xx ) * exp( -( xx * xx ) - ( yy + 1. ) * ( yy + 1. ) ) - 10. * ( xx / 5. - pow( xx, 3. ) - pow( yy, 5. ) ) * exp( -xx * xx - yy * yy ) - 1. / 3. * exp( -( xx + 1 ) * ( xx + 1 ) - ( yy * yy ) ); if ( 0 ) // Jungfraujoch/Interlaken { if ( z[i][j] < -1. ) z[i][j] = -1.; } } } PLFLT zmin, zmax; f2mnmx( z, zmin, zmax ); PLFLT step = ( zmax - zmin ) / ( nlevel + 1 ); PLFLT[nlevel] clevel; for ( size_t i = 0; i < nlevel; i++ ) clevel[i] = zmin + step + step * i; cmap1_init(); for ( size_t k = 0; k < 2; k++ ) { for ( size_t i = 0; i < 4; i++ ) { pladv( 0 ); plcol0( 1 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.5 ); plw3d( 1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4 ); plcol0( 2 ); switch ( i ) { case 0: // wireframe plot plmesh( x, y, z, opt[k] ); break; case 1: // magnitude colored wireframe plot plmesh( x, y, z, opt[k] | MAG_COLOR ); break; case 2: // magnitude colored wireframe plot with sides plot3d( x, y, z, opt[k] | MAG_COLOR, 1 ); break; case 3: // magnitude colored wireframe plot with base contour plmeshc( x, y, z, opt[k] | MAG_COLOR | BASE_CONT, clevel ); break; default: break; } plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, title[k] ); } } plend(); return 0; } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- void f2mnmx( PLFLT[][] f, out PLFLT fmn, out PLFLT fmx ) { fmx = f[0][0]; fmn = fmx; for ( int i = 0; i < f.length; i++ ) { for ( int j = 0; j < f[i].length; j++ ) { fmx = fmax( fmx, f[i][j] ); fmn = fmin( fmn, f[i][j] ); } } } plplot-5.10.0+dfsg/examples/lua/ 775 1750 1750 012406243570 152545ustar andrewandrewplplot-5.10.0+dfsg/examples/lua/x05.lua 644 1750 1750 300511543675237 164610ustar andrewandrew--[[ $Id: x05.lua 11680 2011-03-27 17:57:51Z airwin $ Histogram demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -------------------------------------------------------------------------- -- main -- -- Draws a histogram from sample data. -------------------------------------------------------------------------- NPTS=2047 data = {} -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL); -- Initialize plplot pl.init() -- Fill up data points delta = 2.0*math.pi/NPTS for i=1, NPTS do data[i] = math.sin((i-1)*delta) end pl.col0(1) pl.hist(data, -1.1, 1.1, 44, 0) pl.col0(2) pl.lab("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator") pl.plend() plplot-5.10.0+dfsg/examples/lua/x04.lua 644 1750 1750 1133612140621721 164650ustar andrewandrew--[[ $Id: x04.lua 12331 2013-05-03 02:41:21Z airwin $ Log plot demo. Simple line plot and multiple windows demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ---------------------------------------------------------------------------- -- plot1 -- -- Log-linear plot. ---------------------------------------------------------------------------- -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end function plot1(type) freql = {} ampl = {} phase = {} pl.adv(0) -- Set up data for log plot f0 = 1 for i=1, 101 do freql[i] = -2 + (i-1) / 20 freq = 10^freql[i] ampl[i] = 20 * math.log10(1 / math.sqrt(1 + (freq / f0)^2)) phase[i] = -(180 / math.pi) * math.atan(freq / f0) end pl.vpor(0.15, 0.85, 0.1, 0.9) pl.wind(-2, 3, -80, 0) -- Try different axis and labelling styles. pl.col0(1) if type == 0 then pl.box("bclnst", 0, 0, "bnstv", 0, 0) elseif type == 1 then pl.box("bcfghlnst", 0, 0, "bcghnstv", 0, 0) else print("error: type must be either 0 or 1") end -- Plot ampl vs freq pl.col0(2) pl.line(freql, ampl) pl.col0(2) pl.ptex(1.6, -30, 1, -20, 0.5, "-20 dB/decade") -- Put labels on pl.col0(1) pl.mtex("b", 3.2, 0.5, 0.5, "Frequency") pl.mtex("t", 2, 0.5, 0.5, "Single Pole Low-Pass Filter") pl.col0(2) pl.mtex("l", 5, 0.5, 0.5, "Amplitude (dB)") -- For the gridless case, put phase vs freq on same plot if type == 0 then pl.col0(1) pl.wind(-2, 3, -100, 0) pl.box("", 0, 0, "cmstv", 30, 3) pl.col0(3) pl.line(freql, phase) pl.string(freql, phase, "*") pl.col0(3) pl.mtex("r", 5, 0.5, 0.5, "Phase shift (degrees)") nlegend = 2 else nlegend = 1 end -- Draw a legend. opt_array = {} text_colors = {} text = {} box_colors = {} box_patterns = {} box_scales = {} box_line_widths = {} line_colors = {} line_styles = {} line_widths = {} symbol_colors = {} symbol_scales = {} symbol_numbers = {} symbols = {} -- Data for the first legend entry. opt_array[1] = pl.PL_LEGEND_LINE text_colors[1] = 2 text[1] = "Amplitude" -- box data unused so initialize to arbitrary values. box_colors[1] = 0 box_patterns[1] = 0 box_scales[1] = 0 box_line_widths[1] = 0. line_colors[1] = 2 line_styles[1] = 1 line_widths[1] = 1. -- unused arbitrary data symbol_colors[1] = 0 symbol_scales[1] = 0 symbol_numbers[1] = 0 symbols[1] = "" -- Data for the second legend entry. if nlegend > 1 then opt_array[2] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) text_colors[2] = 3 text[2] = "Phase shift" -- box data unused so initialize to arbitrary values. box_colors[2] = 0 box_patterns[2] = 0 box_scales[2] = 0 box_line_widths[2] = 0. line_colors[2] = 3 line_styles[2] = 1 line_widths[2] = 1. symbol_colors[2] = 3 symbol_scales[2] = 1. symbol_numbers[2] = 4 symbols[2] = "*" end pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( lor(pl.PL_LEGEND_BACKGROUND, pl.PL_LEGEND_BOUNDING_BOX), 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) end ---------------------------------------------------------------------------- -- main -- -- Illustration of logarithmic axes, and redefinition of window. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() pl.font(2) -- Make log plots using two different styles. plot1(0) plot1(1) pl.plend() plplot-5.10.0+dfsg/examples/lua/x06.lua 644 1750 1750 451211543675237 164660ustar andrewandrew--[[ $Id: x06.lua 11680 2011-03-27 17:57:51Z airwin $ Font demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ---------------------------------------------------------------------------- -- main -- -- Displays the entire "plpoin" symbol (font) set. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() for kind_font = 0,1 do pl.fontld( kind_font ) if kind_font == 0 then maxfont = 1 else maxfont = 4 end for font = 1,maxfont do pl.font( font ) pl.adv(0) -- Set up viewport and window pl.col0(2) pl.vpor(0.1, 1, 0.1, 0.9) pl.wind(0, 1, 0, 1.3) -- Draw the grid using plbox pl.box("bcg", 0.1, 0, "bcg", 0.1, 0) -- Write the digits below the frame pl.col0(15) for i=0, 9 do pl.mtex("b", 1.5, (0.1 * i + 0.05), 0.5, tostring(i)) end k = 0 x = {} y ={} for i = 0, 12 do -- Write the digits to the left of the frame pl.mtex("lv", 1, (1 - (2 * i + 1) / 26), 1, tostring(10*i)) for j = 0, 9 do x[1] = 0.1 * j + 0.05 y[1] = 1.25 - 0.1 * i -- Display the symbols if k < 128 then pl.poin(x, y, k) end k = k + 1 end end if kind_font == 0 then pl.mtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)") else pl.mtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)") end end end pl.plend() plplot-5.10.0+dfsg/examples/lua/x26.lua 644 1750 1750 1673012140621721 164740ustar andrewandrew--[[ -*- coding: utf-8 -*- $Id: x26.lua 12331 2013-05-03 02:41:21Z airwin $ Multi-lingual version of the first page of example 4. Copyright (C) 2009 Werner Smekal Thanks to the following for providing translated strings for this example: Valery Pipin (Russian) This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] --[[ This example designed just for devices (e.g., psttfc and the cairo-related devices) that use the pango and fontconfig libraries. The best choice of glyph is selected by fontconfig and automatically rendered by pango in way that is sensitive to complex text layout (CTL) language issues for each unicode character in this example. Of course, you must have the appropriate TrueType fonts installed to have access to all the required glyphs. Translation instructions: The strings to be translated are given by x_label, y_label, alty_label, title_label, and line_label below. The encoding used must be UTF-8. The following strings to be translated involve some scientific/mathematical jargon which is now discussed further to help translators. (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . (2) degrees is an angular measure, see http://en.wikipedia.org/wiki/Degree_(angle) . (3) low-pass filter is one that transmits (passes) low frequencies. (4) pole is in the mathematical sense, see http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" means a particular mathematical transformation of the filter function has a single pole, see http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . Furthermore, a single-pole filter must have an inverse square decline (or -20 db/decade). Since the filter plotted here does have that characteristic, it must by definition be a single-pole filter, see also http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm (5) decade represents a factor of 10, see http://en.wikipedia.org/wiki/Decade_(log_scale) . --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") x_label = { "Frequency", "Частота" } y_label = { "Amplitude (dB)", "Амплитуда (dB)" } alty_label = { "Phase shift (degrees)", "Фазовый сдвиг (градусы)" } -- Short rearranged versions of y_label and alty_label. legend_text = { {"Amplitude", "Phase shift"}, {"Амплитуда", "Фазовый сдвиг"} } title_label = { "Single Pole Low-Pass Filter", "Однополюсный Низко-Частотный Фильтр" } line_label = { "-20 dB/decade", "-20 dB/десяток" } -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end ---------------------------------------------------------------------------- -- plot1 -- -- Log-linear plot. ---------------------------------------------------------------------------- function plot1(type, x_label, y_label, alty_label, title_label, line_label, legend_text) freql = {} ampl = {} phase = {} pl.adv(0) -- Set up data for log plot f0 = 1 for i = 1, 101 do freql[i] = -2 + (i-1)/20 freq = 10^freql[i] ampl[i] = 20 * math.log10(1/math.sqrt(1+(freq/f0)^2)) phase[i] = -180/math.pi*math.atan(freq/f0) end pl.vpor(0.15, 0.85, 0.1, 0.9) pl.wind(-2, 3, -80, 0) -- Try different axis and labelling styles. pl.col0(1) if type==0 then pl.box("bclnst", 0, 0, "bnstv", 0, 0) elseif type==1 then pl.box("bcfghlnst", 0, 0, "bcghnstv", 0, 0) else pl.abort("type must be 0 or 1") pl.plend() os.exit() end -- Plot ampl vs freq pl.col0(2) pl.line(freql, ampl) pl.col0(2) pl.ptex(1.6, -30, 1, -20, 0.5, line_label) -- Put labels on pl.col0(1) pl.mtex("b", 3.2, 0.5, 0.5, x_label) pl.mtex("t", 2, 0.5, 0.5, title_label) pl.col0(2) pl.mtex("l", 5, 0.5, 0.5, y_label) -- For the gridless case, put phase vs freq on same plot if type==0 then pl.col0(1) pl.wind(-2, 3, -100, 0) pl.box("", 0, 0, "cmstv", 30, 3) pl.col0(3) pl.line(freql, phase) pl.string(freql, phase, "*") pl.col0(3) pl.mtex("r", 5, 0.5, 0.5, alty_label) nlegend = 2 else nlegend = 1 end -- Draw a legend. opt_array = {} text_colors = {} text = {} box_colors = {} box_patterns = {} box_scales = {} box_line_widths = {} line_colors = {} line_styles = {} line_widths = {} symbol_colors = {} symbol_scales = {} symbol_numbers = {} symbols = {} -- Data for the first legend entry. opt_array[1] = pl.PL_LEGEND_LINE text_colors[1] = 2 text[1] = legend_text[1] -- box data unused so initialize to arbitrary values. box_colors[1] = 0 box_patterns[1] = 0 box_scales[1] = 0 box_line_widths[1] = 0. line_colors[1] = 2 line_styles[1] = 1 line_widths[1] = 1. -- unused arbitrary data symbol_colors[1] = 0 symbol_scales[1] = 0 symbol_numbers[1] = 0 symbols[1] = "" -- Data for the second legend entry. if nlegend > 1 then opt_array[2] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) text_colors[2] = 3 text[2] = legend_text[2] -- box data unused so initialize to arbitrary values. box_colors[2] = 0 box_patterns[2] = 0 box_scales[2] = 0 box_line_widths[2] = 0. line_colors[2] = 3 line_styles[2] = 1 line_widths[2] = 1. symbol_colors[2] = 3 symbol_scales[2] = 1. symbol_numbers[2] = 4 symbols[2] = "*" end pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( lor(pl.PL_LEGEND_BACKGROUND, pl.PL_LEGEND_BOUNDING_BOX), 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) end ---------------------------------------------------------------------------- -- main -- -- Illustration of logarithmic axes, and redefinition of window. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() nlang = # x_label if nlang ~= (# y_label) or nlang ~= (# alty_label) or nlang ~= (# title_label) or nlang ~= (# line_label) or nlang ~= (# legend_text) then pl.abort("All data must be expressed in the same number of languages") pl.plend() os.exit() end pl.font(2) -- Make log plots using two different styles. for i = 1, nlang do plot1(0, x_label[i], y_label[i], alty_label[i], title_label[i], line_label[i], legend_text[i]) end pl.plend() plplot-5.10.0+dfsg/examples/lua/x16.lua 644 1750 1750 2440712154402127 164750ustar andrewandrew--[[ $Id: x16.lua 12374 2013-06-07 16:03:35Z andrewross $ plshade demo, using color fill. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- Fundamental settings. See notes[] for more info. ns = 20 -- Default number of shade levels nx = 35 -- Default number of data points in x ny = 46 -- Default number of data points in y exclude = 0 -- By default do not plot a page illustrating -- exclusion. API is probably going to change -- anyway, and cannot be reproduced by any -- front end other than the C one. -- polar plot data PERIMETERPTS = 100 -- Transformation function tr = {} function mypltr(x, y) tx = tr[1] * x + tr[2] * y + tr[3] ty = tr[4] * x + tr[5] * y + tr[6] return tx, ty end ---------------------------------------------------------------------------- -- f2mnmx -- -- Returns min & max of input 2d array. ---------------------------------------------------------------------------- function f2mnmx(f, nx, ny) fmax = f[1][1] fmin = fmax for i = 1, nx do for j = 1, ny do fmax = math.max(fmax, f[i][j]) fmin = math.min(fmin, f[i][j]) end end return fmin, fmax end function zdefined(x, y) z = math.sqrt(x^2 + y^2) return z<0.4 or z>0.6 end -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,16 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end ---------------------------------------------------------------------------- -- main -- -- Does several shade plots using different coordinate mappings. ---------------------------------------------------------------------------- px = {} py = {} fill_width = 2. cont_color = 0 cont_width = 0. axis_opts = { "bcvtm" } num_values = {} values = {} axis_ticks = { 0.0 } axis_subticks = { 0 } label_opts = { pl.PL_COLORBAR_LABEL_BOTTOM } labels = { "Magnitude" } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Load colour palettes pl.spal0("cmap0_black_on_white.pal"); pl.spal1("cmap1_gray.pal",1); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display pl.scmap0n(3) -- Initialize plplot pl.init() -- Set up transformation function tr = { 2/(nx-1), 0, -1, 0, 2/(ny-1), -1 } -- Allocate data structures clevel = {} shedge = {} z = {} w = {} -- Set up data array for i = 1, nx do x = (i-1 - math.floor(nx/2))/math.floor(nx/2) z[i] = {} w[i] = {} for j = 1, ny do y = (j-1 - math.floor(ny/2))/math.floor(ny/2)-1 z[i][j] = -math.sin(7*x) * math.cos(7*y) + x^2 - y^2 w[i][j] = -math.cos(7*x) * math.sin(7*y) + 2*x*y end end zmin, zmax = f2mnmx(z, nx, ny) for i = 1, ns do clevel[i] = zmin + (zmax-zmin)*(i-0.5)/ns end for i = 1, ns+1 do shedge[i] = zmin + (zmax-zmin)*(i-1)/ns end -- Set up coordinate grids cgrid1 = {} cgrid1["xg"] = {} cgrid1["yg"] = {} cgrid1["nx"] = nx cgrid1["ny"] = ny cgrid2 = {} cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = nx cgrid2["ny"] = ny for i = 1, nx do cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} for j = 1, ny do x, y = mypltr(i-1, j-1) argx = x*math.pi/2 argy = y*math.pi/2 distort = 0.4 cgrid1["xg"][i] = x + distort * math.cos(argx) cgrid1["yg"][j] = y - distort * math.cos(argy) cgrid2["xg"][i][j] = x + distort * math.cos(argx) * math.cos(argy) cgrid2["yg"][i][j] = y - distort * math.cos(argx) * math.cos(argy) end end -- Plot using identity transform pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) pl.psty(0) pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 1) -- Smaller text pl.schr( 0.0, 0.75 ) -- Small ticks on the vertical axis pl.smaj( 0.0, 0.5 ) pl.smin( 0.0, 0.5 ) num_values[1] = ns + 1 values[1] = shedge colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ) -- Reset text and tick sizes pl.schr( 0.0, 1.0 ) pl.smaj( 0.0, 1.0 ) pl.smin( 0.0, 1.0 ) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) --pl.cont(w, 1, nx, 1, ny, clevel, mypltr, {}) pl.lab("distance", "altitude", "Bogon density") -- Plot using 1d coordinate transform -- Load colour palettes pl.spal0("cmap0_black_on_white.pal"); pl.spal1("cmap1_blue_yellow.pal",1); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display pl.scmap0n(3); pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) pl.psty(0) pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 1, "pltr1", cgrid1) -- Smaller text pl.schr( 0.0, 0.75 ) -- Small ticks on the vertical axis pl.smaj( 0.0, 0.5 ) pl.smin( 0.0, 0.5 ) num_values[1] = ns + 1 values[1] = shedge colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ) -- Reset text and tick sizes pl.schr( 0.0, 1.0 ) pl.smaj( 0.0, 1.0 ) pl.smin( 0.0, 1.0 ) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) pl.lab("distance", "altitude", "Bogon density") -- Plot using 2d coordinate transform -- Load colour palettes pl.spal0("cmap0_black_on_white.pal"); pl.spal1("cmap1_blue_red.pal",1); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display pl.scmap0n(3); pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) pl.psty(0) pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 0, "pltr2", cgrid2) -- Smaller text pl.schr( 0.0, 0.75 ) -- Small ticks on the vertical axis pl.smaj( 0.0, 0.5 ) pl.smin( 0.0, 0.5 ) num_values[1] = ns + 1 values[1] = shedge colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ) -- Reset text and tick sizes pl.schr( 0.0, 1.0 ) pl.smaj( 0.0, 1.0 ) pl.smin( 0.0, 1.0 ) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) pl.cont(w, 1, nx, 1, ny, clevel, "pltr2", cgrid2) pl.lab("distance", "altitude", "Bogon density, with streamlines") -- Plot using 2d coordinate transform -- Load colour palettes pl.spal0(""); pl.spal1("",1); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display pl.scmap0n(3); pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) pl.psty(0) pl.shades(z, -1, 1, -1, 1, shedge, fill_width, 2, 3., 0, "pltr2", cgrid2) -- Smaller text pl.schr( 0.0, 0.75 ) -- Small ticks on the vertical axis pl.smaj( 0.0, 0.5 ) pl.smin( 0.0, 0.5 ) num_values[1] = ns + 1 values[1] = shedge colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3., label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ) -- Reset text and tick sizes pl.schr( 0.0, 1.0 ) pl.smaj( 0.0, 1.0 ) pl.smin( 0.0, 1.0 ) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) pl.lab("distance", "altitude", "Bogon density") -- Note this exclusion API will probably change. -- Plot using 2d coordinate transform and exclusion if exclude~=0 then -- Load colour palettes pl.spal0("cmap0_black_on_white.pal"); pl.spal1("cmap1_gray.pal",1); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display pl.scmap0n(3); pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) plpsty(0) pl.shades(z, zdefined, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 0, "pltr2", cgrid2) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.lab("distance", "altitude", "Bogon density with exclusion") end -- Example with polar coordinates. -- Load colour palettes pl.spal0("cmap0_black_on_white.pal"); pl.spal1("cmap1_gray.pal",1); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display pl.scmap0n(3); pl.adv(0) pl.vpor(.1, .9, .1, .9) pl.wind(-1, 1, -1, 1) pl.psty(0) -- Build new coordinate matrices. for i = 1, nx do r = (i-1)/(nx-1) for j = 1, ny do t = 2*math.pi/(ny-1)*(j-1) cgrid2["xg"][i][j] = r*math.cos(t) cgrid2["yg"][i][j] = r*math.sin(t) z[i][j] = math.exp(-r^2)*math.cos(5*math.pi*r)*math.cos(5*t) end end -- Need a new shedge to go along with the new data set. zmin, zmax = f2mnmx(z, nx, ny) for i = 1, ns+1 do shedge[i] = zmin + (zmax-zmin)*(i-1)/ns end -- Now we can shade the interior region. pl.shades(z, -1, 1, -1, 1, shedge, fill_width, cont_color, cont_width, 0, "pltr2", cgrid2) -- Smaller text pl.schr( 0.0, 0.75 ) -- Small ticks on the vertical axis pl.smaj( 0.0, 0.5 ) pl.smin( 0.0, 0.5 ) num_values[1] = ns + 1 values[1] = shedge colorbar_width, colorbar_height = pl.colorbar( lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ) -- Reset text and tick sizes pl.schr( 0.0, 1.0 ) pl.smaj( 0.0, 1.0 ) pl.smin( 0.0, 1.0 ) -- Now we can draw the perimeter. (If do before, shade stuff may overlap.) for i = 1, PERIMETERPTS do t = 2*math.pi/(PERIMETERPTS-1)*(i-1) px[i] = math.cos(t) py[i] = math.sin(t) end pl.col0(1) pl.line(px, py) -- And label the plot. pl.col0(2) pl.lab( "", "", "Tokamak Bogon Instability" ) pl.plend() plplot-5.10.0+dfsg/examples/lua/x28.lua 644 1750 1750 2435611543675237 165220ustar andrewandrew--[[ $Id: x28.lua 11680 2011-03-27 17:57:51Z airwin $ pl.mtex3, plptex3 demo. Copyright (C) 2009 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- Choose these values to correspond to tick marks. XPTS = 2 YPTS = 2 NREVOLUTION = 16 NROTATION = 8 NSHEAR = 8 ---------------------------------------------------------------------------- -- main -- -- Demonstrates plotting text in 3D. ---------------------------------------------------------------------------- xmin=0 xmax=1 xmid = 0.5*(xmax + xmin) xrange = xmax - xmin ymin=0 ymax=1 ymid = 0.5*(ymax + ymin) yrange = ymax - ymin zmin=0 zmax=1 zmid = 0.5*(zmax + zmin) zrange = zmax - zmin ysmin = ymin + 0.1 * yrange ysmax = ymax - 0.1 * yrange ysrange = ysmax - ysmin dysrot = ysrange / ( NROTATION - 1 ) dysshear = ysrange / ( NSHEAR - 1 ) zsmin = zmin + 0.1 * zrange zsmax = zmax - 0.1 * zrange zsrange = zsmax - zsmin dzsrot = zsrange / ( NROTATION - 1 ) dzsshear = zsrange / ( NSHEAR - 1 ) pstring = "The future of our civilization depends on software freedom." -- Allocate and define the minimal x, y, and z to insure 3D box x = {} y = {} z = {} for i = 1, XPTS do x[i] = xmin + (i-1) * (xmax-xmin)/(XPTS-1) end for j = 1, YPTS do y[j] = ymin + (j-1) * (ymax-ymin)/(YPTS-1) end for i = 1, XPTS do z[i] = {} for j = 1, YPTS do z[i][j] = 0 end end -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) pl.init() -- Page 1: Demonstrate inclination and shear capability pattern. pl.adv(0) pl.vpor(-0.15, 1.15, -0.05, 1.05) pl.wind(-1.2, 1.2, -0.8, 1.5) pl.w3d(1, 1, 1, xmin, xmax, ymin, ymax, zmin, zmax, 20, 45) pl.col0(2) pl.box3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) -- z = zmin. pl.schr(0, 1) for i = 1, NREVOLUTION do omega = 2*math.pi*(i-1)/NREVOLUTION sin_omega = math.sin(omega) cos_omega = math.cos(omega) x_inclination = 0.5*xrange*cos_omega y_inclination = 0.5*yrange*sin_omega z_inclination = 0 x_shear = -0.5*xrange*sin_omega y_shear = 0.5*yrange*cos_omega z_shear = 0 pl.ptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0, " revolution") end -- x = xmax. pl.schr(0, 1) for i = 1, NREVOLUTION do omega = 2.*math.pi*(i-1)/NREVOLUTION sin_omega = math.sin(omega) cos_omega = math.cos(omega) x_inclination = 0. y_inclination = -0.5*yrange*cos_omega z_inclination = 0.5*zrange*sin_omega x_shear = 0 y_shear = 0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega pl.ptex3(xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0, " revolution") end -- y = ymax. pl.schr(0, 1) for i = 1, NREVOLUTION do omega = 2.*math.pi*(i-1)/NREVOLUTION sin_omega = math.sin(omega) cos_omega = math.cos(omega) x_inclination = 0.5*xrange*cos_omega y_inclination = 0. z_inclination = 0.5*zrange*sin_omega x_shear = -0.5*xrange*sin_omega y_shear = 0. z_shear = 0.5*zrange*cos_omega pl.ptex3(xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0, " revolution") end -- Draw minimal 3D grid to finish defining the 3D box. pl.mesh(x, y, z, pl.DRAW_LINEXY) -- Page 2: Demonstrate rotation of string around its axis. pl.adv(0) pl.vpor(-0.15, 1.15, -0.05, 1.05) pl.wind(-1.2, 1.2, -0.8, 1.5) pl.w3d(1, 1, 1, xmin, xmax, ymin, ymax, zmin, zmax, 20, 45) pl.col0(2) pl.box3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) -- y = ymax. pl.schr(0, 1) x_inclination = 1 y_inclination = 0 z_inclination = 0 x_shear = 0 for i = 1, NROTATION do omega = 2.*math.pi*(i-1)/NROTATION sin_omega = math.sin(omega) cos_omega = math.cos(omega) y_shear = 0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsrot * (i-1) pl.ptex3(xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u") end -- x = xmax. pl.schr(0, 1) x_inclination = 0 y_inclination = -1 z_inclination = 0 y_shear = 0 for i = 1, NROTATION do omega = 2.*math.pi*(i-1)/NROTATION sin_omega = math.sin(omega) cos_omega = math.cos(omega) x_shear = 0.5*xrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsrot * (i-1) pl.ptex3(xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u") end -- z = zmin. pl.schr(0, 1) x_inclination = 1 y_inclination = 0 z_inclination = 0 x_shear = 0 for i = 1, NROTATION do omega = 2.*math.pi*(i-1)/NROTATION sin_omega = math.sin(omega) cos_omega = math.cos(omega) y_shear = 0.5*yrange*cos_omega z_shear = 0.5*zrange*sin_omega ys = ysmax - dysrot * (i-1) pl.ptex3(xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u") end -- Draw minimal 3D grid to finish defining the 3D box. pl.mesh(x, y, z, pl.DRAW_LINEXY) -- Page 3: Demonstrate shear of string along its axis. -- Work around xcairo and pngcairo (but not pscairo) problems for -- shear vector too close to axis of string. (N.B. no workaround -- would be domega = 0.) domega = 0.05 pl.adv(0) pl.vpor(-0.15, 1.15, -0.05, 1.05) pl.wind(-1.2, 1.2, -0.8, 1.5) pl.w3d(1, 1, 1, xmin, xmax, ymin, ymax, zmin, zmax, 20, 45) pl.col0(2) pl.box3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) -- y = ymax. pl.schr(0, 1) x_inclination = 1 y_inclination = 0 z_inclination = 0 y_shear = 0 for i = 1, NSHEAR do omega = domega + 2.*math.pi*(i-1)/NSHEAR sin_omega = math.sin(omega) cos_omega = math.cos(omega) x_shear = 0.5*xrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsshear * (i-1) pl.ptex3(xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u") end -- x = xmax. pl.schr(0, 1) x_inclination = 0 y_inclination = -1 z_inclination = 0 x_shear = 0 for i = 1, NSHEAR do omega = domega + 2.*math.pi*(i-1)/NSHEAR sin_omega = math.sin(omega) cos_omega = math.cos(omega) y_shear = -0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsshear * (i-1) pl.ptex3(xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u") end -- z = zmin. pl.schr(0, 1) x_inclination = 1 y_inclination = 0 z_inclination = 0 z_shear = 0 for i = 1, NSHEAR do omega = domega + 2.*math.pi*(i-1)/NSHEAR sin_omega = math.sin(omega) cos_omega = math.cos(omega) y_shear = 0.5*yrange*cos_omega x_shear = 0.5*xrange*sin_omega ys = ysmax - dysshear * (i-1) pl.ptex3(xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u") end -- Draw minimal 3D grid to finish defining the 3D box. pl.mesh(x, y, z, pl.DRAW_LINEXY) -- Page 4: Demonstrate drawing a string on a 3D path. pl.adv(0) pl.vpor(-0.15, 1.15, -0.05, 1.05) pl.wind(-1.2, 1.2, -0.8, 1.5) pl.w3d(1, 1, 1, xmin, xmax, ymin, ymax, zmin, zmax, 40, -30) pl.col0(2) pl.box3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) pl.schr(0, 1.2) -- domega controls the spacing between the various characters of the -- string and also the maximum value of omega for the given number -- of characters in *pstring. domega = 2.*math.pi/string.len(pstring) omega = 0 -- 3D function is a helix of the given radius and pitch radius = 0.5 pitch = 1/(2*math.pi) for i = 1, string.len(pstring) do sin_omega = math.sin(omega) cos_omega = math.cos(omega) xpos = xmid + radius*sin_omega ypos = ymid - radius*cos_omega zpos = zmin + pitch*omega -- In general, the inclination is proportional to the derivative of --the position wrt theta. x_inclination = radius*cos_omega y_inclination = radius*sin_omega z_inclination = pitch -- The shear vector should be perpendicular to the 3D line with Z -- component maximized, but for low pitch a good approximation is --a constant vector that is parallel to the Z axis. x_shear = 0 y_shear = 0 z_shear = 1 pl.ptex3(xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, string.sub(pstring, i, i)) omega = omega + domega end -- Draw minimal 3D grid to finish defining the 3D box. pl.mesh(x, y, z, pl.DRAW_LINEXY) -- Page 5: Demonstrate pl.mtex3 axis labelling capability pl.adv(0) pl.vpor(-0.15, 1.15, -0.05, 1.05) pl.wind(-1.2, 1.2, -0.8, 1.5) pl.w3d(1, 1, 1, xmin, xmax, ymin, ymax, zmin, zmax, 20, 45) pl.col0(2) pl.box3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) pl.schr(0, 1) pl.mtex3("xp", 3, 0.5, 0.5, "Arbitrarily displaced") pl.mtex3("xp", 4.5, 0.5, 0.5, "primary X-axis label") pl.mtex3("xs", -2.5, 0.5, 0.5, "Arbitrarily displaced") pl.mtex3("xs", -1, 0.5, 0.5, "secondary X-axis label") pl.mtex3("yp", 3, 0.5, 0.5, "Arbitrarily displaced") pl.mtex3("yp", 4.5, 0.5, 0.5, "primary Y-axis label") pl.mtex3("ys", -2.5, 0.5, 0.5, "Arbitrarily displaced") pl.mtex3("ys", -1, 0.5, 0.5, "secondary Y-axis label") pl.mtex3("zp", 4.5, 0.5, 0.5, "Arbitrarily displaced") pl.mtex3("zp", 3, 0.5, 0.5, "primary Z-axis label") pl.mtex3("zs", -2.5, 0.5, 0.5, "Arbitrarily displaced") pl.mtex3("zs", -1, 0.5, 0.5, "secondary Z-axis label") -- Draw minimal 3D grid to finish defining the 3D box. pl.mesh(x, y, z, pl.DRAW_LINEXY) pl.plend() plplot-5.10.0+dfsg/examples/lua/x29.lua 644 1750 1750 2072111543675237 165130ustar andrewandrew--[[ $Id: x29.lua 11680 2011-03-27 17:57:51Z airwin $ Sample plots using date / time formatting for axes Copyright (C) 2009 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- Plot a model diurnal cycle of temperature function plot1() x = {} y = {} xerr1 = {} xerr2 = {} yerr1 = {} yerr2 = {} -- Data points every 10 minutes for 1 day npts = 73 xmin = 0 xmax = 60*60*24 -- Number of seconds in a day ymin = 10 ymax = 20 for i = 1, npts do x[i] = xmax*((i-1)/npts) y[i] = 15 - 5*math.cos(2*math.pi*((i-1)/npts)) -- Set x error bars to +/- 5 minute xerr1[i] = x[i]-60*5 xerr2[i] = x[i]+60*5 -- Set y error bars to +/- 0.1 deg C yerr1[i] = y[i]-0.1 yerr2[i] = y[i]+0.1 end pl.adv(0) -- Rescale major ticks marks by 0.5 pl.smaj(0, 0.5) -- Rescale minor ticks and error bar marks by 0.5 pl.smin(0, 0.5) pl.vsta() pl.wind(xmin, xmax, ymin, ymax) -- Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. pl.col0(1) -- Set time format to be hours:minutes pl.timefmt("%H:%M") pl.box("bcnstd", 3*60*60, 3, "bcnstv", 1, 5) pl.col0(3) pl.lab("Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature") pl.col0(4) pl.line(x, y) pl.col0(2) pl.errx(xerr1, xerr2, y) pl.col0(3) pl.erry(x, yerr1, yerr2) -- Rescale major / minor tick marks back to default pl.smin(0, 1) pl.smaj(0, 1) end -- Plot the number of hours of daylight as a function of day for a year function plot2() x = {} y = {} -- Latitude for London lat = 51.5 npts = 365 xmin = 0 xmax = npts*60*60*24 ymin = 0 ymax = 24 -- Formula for hours of daylight from -- "A Model Comparison for Daylength as a Function of Latitude and -- Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for j = 1, npts do x[j] = (j-1)*60*60*24 p = math.asin(0.39795*math.cos(0.2163108 + 2*math.atan(0.9671396*math.tan(0.00860*(j-1-186))))) d = 24 - (24/math.pi)* math.acos( (math.sin(0.8333*math.pi/180) + math.sin(lat*math.pi/180)*math.sin(p)) / (math.cos(lat*math.pi/180)*math.cos(p)) ) y[j] = d end pl.col0(1) -- Set time format to be abbreviated month name followed by day of month pl.timefmt("%b %d") pl.prec(1, 1) pl.env(xmin, xmax, ymin, ymax, 0, 40) pl.col0(3) pl.lab("Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N") pl.col0(4) pl.line(x, y) pl.prec(0, 0) end function plot3() x = {} y = {} tstart = 1133395200 npts = 62 xmin = tstart xmax = xmin + npts*60*60*24 ymin = 0 ymax = 5 for i = 1, npts do x[i] = xmin + (i-1)*60*60*24 y[i] = 1 + math.sin(2*math.pi*(i-1)/7) + math.exp(math.min(i-1,npts-i+1)/31) end pl.adv(0) pl.vsta() pl.wind(xmin, xmax, ymin, ymax) pl.col0(1) -- Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is --equivalent to %f for C99 compliant implementations of strftime. pl.timefmt("%Y-%m-%d") -- Draw a box with ticks spaced every 14 days in X and 1 hour in Y. pl.box("bcnstd", 14*24*60*60,14, "bcnstv", 1, 4) pl.col0(3) pl.lab("Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006") pl.col0(4) -- Rescale symbol size (used by plpoin) by 0.5 pl.ssym(0, 0.5) pl.poin(x, y, 2) pl.line(x, y) end function plot4() -- TAI-UTC (seconds) as a function of time. -- Use Besselian epochs as the continuous time interval just to prove -- this does not introduce any issues. x = {} y = {} -- Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch -- B = 1900. + (JD -2415020.31352)/365.242198781 -- ==> (as calculated with aid of "bc -l" command) -- B = (MJD + 678940.364163900)/365.242198781 -- ==> -- MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781 offset1 = -678940 offset2 = -0.3641639 pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0.) for kind = 0, 6 do if kind == 0 then xmin = pl.ctime(1950, 0, 2, 0, 0, 0) xmax = pl.ctime(2020, 0, 2, 0, 0, 0) npts = 70*12 + 1 ymin = 0 ymax = 36 time_format = "%Y%" if_TAI_time_format = 1 title_suffix = "from 1950 to 2020" xtitle = "Year" xlabel_step = 10 end if kind==1 or kind==2 then xmin = pl.ctime(1961, 7, 1, 0, 0, 1.64757-0.20) xmax = pl.ctime(1961, 7, 1, 0, 0, 1.64757+0.20) npts = 1001 ymin = 1.625 ymax = 1.725 time_format = "%S%2%" title_suffix = "near 1961-08-01 (TAI)" xlabel_step = 0.05/(scale*86400) if kind==1 then if_TAI_time_format = 1 xtitle = "Seconds (TAI)" else if_TAI_time_format = 0 xtitle = "Seconds (TAI) labelled with corresponding UTC" end end if kind==3 or kind==4 then xmin = pl.ctime(1963, 10, 1, 0, 0, 2.6972788-0.20) xmax = pl.ctime(1963, 10, 1, 0, 0, 2.6972788+0.20) npts = 1001 ymin = 2.55 ymax = 2.75 time_format = "%S%2%" title_suffix = "near 1963-11-01 (TAI)" xlabel_step = 0.05/(scale*86400) if kind==3 then if_TAI_time_format = 1 xtitle = "Seconds (TAI)" else if_TAI_time_format = 0 xtitle = "Seconds (TAI) labelled with corresponding UTC" end end if kind==5 or kind==6 then xmin = pl.ctime(2009, 0, 1, 0, 0, 34-5) xmax = pl.ctime(2009, 0, 1, 0, 0, 34+5) npts = 1001 ymin = 32.5 ymax = 34.5 time_format = "%S%2%" title_suffix = "near 2009-01-01 (TAI)" xlabel_step = 1/(scale*86400) if kind==5 then if_TAI_time_format = 1 xtitle = "Seconds (TAI)" else if_TAI_time_format = 0 xtitle = "Seconds (TAI) labelled with corresponding UTC" end end for i = 1, npts do x[i] = xmin + (i-1)*(xmax-xmin)/(npts-1) pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0) tai = x[i] tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec = pl.btime(tai) pl.configtime(scale, offset1, offset2, 2, 0, 0, 0, 0, 0, 0, 0) utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec = pl.btime(tai) pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0.) utc = pl.ctime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec) y[i]=(tai-utc)*scale*86400. end pl.adv(0) pl.vsta() pl.wind(xmin, xmax, ymin, ymax) pl.col0(1) if if_TAI_time_format ~= 0 then pl.configtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, 0, 0) else pl.configtime(scale, offset1, offset2, 2, 0, 0, 0, 0, 0, 0, 0) end pl.timefmt(time_format) pl.box("bcnstd", xlabel_step, 0, "bcnstv", 0., 0) pl.col0(3) title = "@frPLplot Example 29 - TAI-UTC " .. title_suffix pl.lab(xtitle, "TAI-UTC (sec)", title) pl.col0(4) pl.line(x, y) end end ---------------------------------------------------------------------------- -- main -- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. -- Time formatting is done using the system strftime routine. See the -- documentation of this for full details of the available formats. -- -- 1) Plotting temperature over a day (using hours / minutes) -- 2) Plotting -- -- Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). -- ---------------------------------------------------------------------------- -- Parse command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() -- Change the escape character to a '@' instead of the default '#' pl.sesc('@') plot1() plot2() plot3() plot4() -- Don't forget to call plend() to finish off! pl.plend() plplot-5.10.0+dfsg/examples/lua/x18.lua 644 1750 1750 737511543675237 165030ustar andrewandrew--[[ $Id: x18.lua 11680 2011-03-27 17:57:51Z airwin $ 3-d line and point plot demo. Adapted from x08c.c. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") function test_poly(k) draw= { { 1, 1, 1, 1 }, { 1, 0, 1, 0 }, { 0, 1, 0, 1 }, { 1, 1, 0, 0 } } x = {} y = {} z = {} pl.adv(0) pl.vpor(0, 1, 0, 0.9) pl.wind(-1, 1, -0.9, 1.1) pl.col0(1) pl.w3d(1, 1, 1, -1, 1, -1, 1, -1, 1, alt[k], az[k]) pl.box3("bnstu", "x axis", 0, 0, "bnstu", "y axis", 0, 0, "bcdmnstuv", "z axis", 0, 0) pl.col0(2) -- x = r sin(phi) cos(theta) -- y = r sin(phi) sin(theta) -- z = r cos(phi) -- r = 1 :=) for i=0, 19 do for j=0, 19 do x[1] = math.sin( math.pi*j/20.1 ) * math.cos( 2*math.pi*i/20 ) y[1] = math.sin( math.pi*j/20.1 ) * math.sin( 2*math.pi*i/20 ) z[1] = math.cos( math.pi*j/20.1 ) x[2] = math.sin( math.pi*(j+1)/20.1 ) * math.cos( 2*math.pi*i/20 ) y[2] = math.sin( math.pi*(j+1)/20.1 ) * math.sin( 2*math.pi*i/20 ) z[2] = math.cos( math.pi*(j+1)/20.1 ) x[3] = math.sin( math.pi*(j+1)/20.1 ) * math.cos( 2*math.pi*(i+1)/20 ) y[3] = math.sin( math.pi*(j+1)/20.1 ) * math.sin( 2*math.pi*(i+1)/20 ) z[3] = math.cos( math.pi*(j+1)/20.1 ) x[4] = math.sin( math.pi*j/20.1 ) * math.cos( 2*math.pi*(i+1)/20 ) y[4] = math.sin( math.pi*j/20.1 ) * math.sin( 2*math.pi*(i+1)/20 ) z[4] = math.cos( math.pi*j/20.1 ) x[5] = math.sin( math.pi*j/20.1 ) * math.cos( 2*math.pi*i/20 ) y[5] = math.sin( math.pi*j/20.1 ) * math.sin( 2*math.pi*i/20 ) z[5] = math.cos( math.pi*j/20.1 ) pl.poly3( x, y, z, draw[k], 1 ) end end pl.col0(3) pl.mtex("t", 1, 0.5, 0.5, "unit radius sphere" ) end ---------------------------------------------------------------------------- -- main -- -- Does a series of 3-d plots for a given data set, with different -- viewing options in each plot. ---------------------------------------------------------------------------- NPTS = 1000 opt = { 1, 0, 1, 0 } alt = { 20, 35, 50, 65 } az = { 30, 40, 50, 60 } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() for k=1, 4 do test_poly(k) end x = {} y = {} z = {} -- From the mind of a sick and twisted physicist... for i=1, NPTS do z[i] = -1 + 2*(i-1)/NPTS -- Pick one ... -- r = 1 - (i-1) / NPTS r = z[i] x[i] = r * math.cos( 12*math.pi*(i-1)/NPTS ) y[i] = r * math.sin( 12*math.pi*(i-1)/NPTS ) end for k=1, 4 do pl.adv(0) pl.vpor(0, 1, 0, 0.9) pl.wind(-1, 1, -0.9, 1.1) pl.col0(1) pl.w3d(1, 1, 1, -1, 1, -1, 1, -1, 1, alt[k], az[k]) pl.box3("bnstu", "x axis", 0, 0, "bnstu", "y axis", 0, 0, "bcdmnstuv", "z axis", 0, 0) pl.col0(2) if opt[k]~=0 then pl.line3( x, y, z ) else -- U+22C5 DOT OPERATOR. pl.string3( x, y, z, "⋅" ) end pl.col0(3) pl.mtex("t", 1.0, 0.5, 0.5, "#frPLplot Example 18 - Alt=" .. alt[k] .. ", Az=" .. az[k]) end pl.plend() plplot-5.10.0+dfsg/examples/lua/x03.lua 644 1750 1750 477411543675237 164750ustar andrewandrew--[[ $Id: x03.lua 11680 2011-03-27 17:57:51Z airwin $ Polar plot demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ---------------------------------------------------------------------------- -- main -- -- Generates polar plot, with 1-1 scaling. ---------------------------------------------------------------------------- x0 = {} y0 = {} x = {} y = {} dtr = math.pi/180 for i = 1, 361 do x0[i] = math.cos(dtr * (i-1)) y0[i] = math.sin(dtr * (i-1)) end -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Set orientation to portrait - note not all device drivers -- support this, in particular most interactive drivers do not pl.sori(1) -- Initialize plplot pl.init() -- Set up viewport and window, but do not draw box pl.env(-1.3, 1.3, -1.3, 1.3, 1, -2) -- Draw circles for polar grid for i = 1, 10 do pl.arc(0, 0, 0.1*i, 0.1*i, 0, 360, 0, 0); end pl.col0(2) for i=1, 12 do theta = 30 * (i-1) dx = math.cos(dtr * theta) dy = math.sin(dtr * theta) -- Draw radial spokes for polar grid pl.join(0, 0, dx, dy) -- Write labels for angle if theta < 9.99 then offset = 0.45 else if theta < 99.9 then offset = 0.30 else offset = 0.15 end end -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if dx >= -0.00001 then pl.ptex(dx, dy, dx, dy, -offset, tostring(math.floor(theta))) else pl.ptex(dx, dy, -dx, -dy, 1.+offset, tostring(math.floor(theta))) end end -- Draw the graph for i=1, 361 do r = math.sin(dtr * (5*(i-1))) x[i] = x0[i] * r y[i] = y0[i] * r end pl.col0(3) pl.line(x, y) pl.col0(4) pl.mtex("t", 2, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh") -- Close the plot at end pl.plend() plplot-5.10.0+dfsg/examples/lua/x22.lua 644 1750 1750 1646512245410716 165030ustar andrewandrew--[[ $Id: x22.lua 12769 2013-11-27 15:37:50Z andrewross $ Simple vector plot example Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- Pairs of points making the line segments used to plot the user defined arrow arrow_x = { -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 } arrow_y = { 0, 0, 0.2, 0, -0.2, 0 } arrow2_x = { -0.5, 0.3, 0.3, 0.5, 0.3, 0.3 } arrow2_y = { 0, 0, 0.2, 0, -0.2, 0 } -- Vector plot of the circulation about the origin function circulation() nx = 20 ny = 20 dx = 1 dy = 1 xmin = -nx/2*dx xmax = nx/2*dx ymin = -ny/2*dy ymax = ny/2*dy cgrid2 = {} cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = nx cgrid2["ny"] = ny u = {} v = {} -- Create data - circulation around the origin. for i = 1, nx do x = (i-1-nx/2+0.5)*dx cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} u[i] = {} v[i] = {} for j=1, ny do y = (j-1-ny/2+0.5)*dy cgrid2["xg"][i][j] = x cgrid2["yg"][i][j] = y u[i][j] = y v[i][j] = -x end end -- Plot vectors with default arrows pl.env(xmin, xmax, ymin, ymax, 0, 0) pl.lab("(x)", "(y)", "#frPLplot Example 22 - circulation") pl.col0(2) pl.vect(u, v, 0, "pltr2", cgrid2 ) pl.col0(1) end -- Vector plot of flow through a constricted pipe function constriction( astyle ) nx = 20 ny = 20 dx = 1 dy = 1 xmin = -nx/2*dx xmax = nx/2*dx ymin = -ny/2*dy ymax = ny/2*dy cgrid2 = {} cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = nx cgrid2["ny"] = ny u = {} v = {} Q = 2 for i = 1, nx do x = (i-1-nx/2+0.5)*dx cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} u[i] = {} v[i] = {} for j = 1, ny do y = (j-1-ny/2+0.5)*dy cgrid2["xg"][i][j] = x cgrid2["yg"][i][j] = y b = ymax/4*(3-math.cos(math.pi*x/xmax)) if math.abs(y)=-0.00001 then pl.ptex(dx, dy, dx, dy, -0.15, tostring(theta)) else pl.ptex(dx, dy, -dx, -dy, 1.15, tostring(theta)) end end x = {} y = {} -- Draw the graph for i = 1, 361 do r = math.sin(dtr * (5*(i-1))) x[i] = x0[i] * r y[i] = y0[i] * r end pl.col0(3) pl.line(x, y) pl.col0(4) pl.mtex("t", 2, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh") pl.flush() end -- Demonstration of contour plotting XPTS = 35 YPTS = 46 XSPA = 2/(XPTS-1) YSPA = 2/(YPTS-1) tr = { XSPA, 0, -1, 0, YSPA, -1 } function mypltr(x, y) tx = tr[1]*x + tr[2]*y + tr[3] ty = tr[4]*x + tr[5]*y + tr[6] return tx, ty end clevel = { -1, -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1 } function plot5() mark = { 1500 } space = { 1500 } -- Set up function arrays z = {} w = {} for i = 1, XPTS do xx = (i-1-math.floor(XPTS/2))/math.floor(XPTS/2) z[i] = {} w[i] = {} for j = 1, YPTS do yy = (j-1-math.floor(YPTS/2))/math.floor(YPTS/2)-1 z[i][j] = xx * xx - yy * yy w[i][j] = 2 * xx * yy end end pl.env(-1, 1, -1, 1, 0, 0) pl.col0(2) pl.cont(z, 1, XPTS, 1, YPTS, clevel, "mypltr") pl.styl(mark, space) pl.col0(3) pl.cont(w, 1, XPTS, 1, YPTS, clevel, "mypltr") pl.col0(1) pl.lab("X Coordinate", "Y Coordinate", "Streamlines of flow") pl.flush() end ---------------------------------------------------------------------------- -- main -- -- Plots several simple functions from other example programs. -- -- This version sends the output of the first 4 plots (one page) to two -- independent streams. ---------------------------------------------------------------------------- -- Select either TK or DP driver and use a small window -- Using DP results in a crash at the end due to some odd cleanup problems -- The geometry strings MUST be in writable memory geometry_master = "500x410+100+200" geometry_slave = "500x410+650+200" -- plplot initialization -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- If valid geometry specified on command line, use it for both streams. xp0, yp0, xleng0, yleng0, xoff0, yoff0 = pl.gpage() valid_geometry = xleng0>0 and yleng0>0 -- Set up first stream if valid_geometry==true then pl.spage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) else pl.setopt("geometry", geometry_master) end pl.ssub(2, 2) pl.init() driver = pl.gdev() fam, num, bmax = pl.gfam() print("Demo of multiple output streams via the " .. driver .." driver.") print("Running with the second stream as slave to the first.\n") -- Start next stream pl.sstrm(1) if valid_geometry==true then pl.spage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) else pl.setopt("geometry", geometry_slave) end -- Turn off pause to make this a slave (must follow master) pl.spause(0) pl.sdev(driver) pl.sfam(fam,num,bmax) -- Currently number of digits in format number can only be --set via the command line option pl.setopt("fflen", "2") pl.init() -- Set up the data & plot -- Original case pl.sstrm(0) xscale = 6 yscale = 1 xoff = 0 yoff = 0 plot1() -- Set up the data & plot xscale = 1 yscale = 1e6 plot1() -- Set up the data & plot xscale = 1. yscale = 1.e-6 digmax = 2 pl.syax(digmax, 0) plot1() -- Set up the data & plot xscale = 1 yscale = 0.0014 yoff = 0.0185 digmax = 5 pl.syax(digmax, 0) plot1() -- To slave -- The pleop() ensures the eop indicator gets lit. pl.sstrm(1) plot4() pl.eop() -- Back to master pl.sstrm(0) plot2() plot3() -- To slave pl.sstrm(1) plot5() pl.eop() -- Back to master to wait for user to advance pl.sstrm(0) pl.eop() -- Call plend to finish off. pl.plend() plplot-5.10.0+dfsg/examples/lua/x25.lua 644 1750 1750 532211543675237 164670ustar andrewandrew--[[ $Id: x25.lua 11680 2011-03-27 17:57:51Z airwin $ Filling and clipping polygons. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -------------------------------------------------------------------------- -- main -- -- Test program for filling polygons and proper clipping -------------------------------------------------------------------------- xextreme = {} yextreme ={} x0 = {} y0 = {} -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.ssub(3, 3) pl.init() xextreme = { { -120, 120 }, { -120, 120 }, { -120, 120 }, { -80, 80 }, { -220, -120 }, { -20, 20 }, { -20, 20 }, { -80, 80 }, { 20, 120 } } yextreme = { { -120, 120 }, { 20, 120 }, { -20, 120 }, { -20, 120 }, { -120, 120 }, { -120, 120 }, { -20, 20 }, { -80, 80 }, { -120, 120 } } for k = 1, 2 do for j = 1, 4 do if j==1 then -- Polygon 1: a diamond x0 = { 0, -100, 0, 100 } y0 = { -100, 0, 100, 0} end if j==2 then -- Polygon 1: a diamond - reverse direction x0 = { 100, 0, -100, 0 } y0 = { 0, 100, 0, -100} end if j==3 then -- Polygon 2: a square with punctures x0 = { -100, -100, 80, -100, -100, -80, 0, 80, 100, 100 } y0 = { -100, -80, 0, 80, 100, 100, 80, 100, 100, -100} end if j==4 then -- Polygon 2: a square with punctures - reversed direction x0 = { 100, 100, 80, 0, -80, -100, -100, 80, -100, -100 } y0 = { -100, 100, 100, 80, 100, 100, 80, 0, -80, -100} end for i = 1, 9 do pl.adv(0) pl.vsta() pl.wind(xextreme[i][1], xextreme[i][2], yextreme[i][1], yextreme[i][2]) pl.col0(2) pl.box("bc", 1, 0, "bcnv", 10, 0) pl.col0(1) pl.psty(0) if k==1 then pl.fill(x0, y0) else pl.gradient(x0, y0, 45.) end pl.col0(2) pl.lsty(1) pl.line(x0, y0) end end end -- Don't forget to call plend() to finish off! pl.plend() plplot-5.10.0+dfsg/examples/lua/x01.lua 644 1750 1750 1204112102122103 164400ustar andrewandrew--[[ $Id: x01.lua 12288 2013-01-30 04:40:35Z airwin $ Simple line plot and multiple windows demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- Variables and data arrays used by plot generators x = {} y = {} xs = {} ys = {} fontset = 1 f_name = "" function plot1(do_test) for i = 1, 60 do x[i] = xoff + xscale * (i) / 60 y[i] = yoff + yscale * x[i]^2 end xmin = x[1] xmax = x[60] ymin = y[1] ymax = y[60] for i = 1, 6 do xs[i] = x[(i-1) * 10 + 4] ys[i] = y[(i-1) * 10 + 4] end -- Set up the viewport and window using PLENV. The range in X is -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are -- scaled separately (just = 0), and we just draw a labelled -- box (axis = 0). pl.col0(1) pl.env(xmin, xmax, ymin, ymax, 0, 0) pl.col0(2) pl.lab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2") -- Plot the data points pl.col0(4) pl.poin(xs, ys, 9) -- Draw the line through the data pl.col0(3) pl.line(x, y) end function plot2() -- Set up the viewport and window using PLENV. The range in X is -2.0 to -- 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately --(just = 0), and we draw a box with axes (axis = 1). pl.col0(1) pl.env(-2, 10, -0.4, 1.2, 0, 1) pl.col0(2) pl.lab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function") -- Fill up the arrays for i=1, 100 do x[i] = (i - 20) / 6 y[i] = 1 if x[i] ~= 0 then y[i] = math.sin(x[i])/x[i] end end -- Draw the line pl.col0(3) pl.width(2) pl.line(x, y) pl.width(1) end function plot3() space0 = { } mark0 = { } space1 = { 1500 } mark1 = { 1500 } -- For the final graph we wish to override the default tick intervals, and --so do not use plenv(). pl.adv(0) -- Use standard viewport, and define X range from 0 to 360 degrees, Y range --from -1.2 to 1.2. pl.vsta() pl.wind(0, 360, -1.2, 1.2) -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. pl.col0(1) pl.box("bcnst", 60, 2, "bcnstv", 0.2, 2) -- Superimpose a dashed line grid, with 1.5 mm marks and spaces. -- plstyl expects a pointer! pl.styl(mark1, space1) pl.col0(2) pl.box("g", 30, 0, "g", 0.2, 0) pl.styl(mark0, space0) pl.col0(3) pl.lab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function") for i=1, 101 do x[i] = 3.6*(i-1) y[i] = math.sin(x[i]*math.pi/180) end pl.col0(4) pl.line(x, y) end ---------------------------------------------------------------------------- -- main -- -- Generates several simple line plots. Demonstrates: -- - subwindow capability -- - setting up the window, drawing plot, and labelling -- - changing the color -- - automatic axis rescaling to exponential notation -- - placing the axes in the middle of the box -- - gridded coordinate axes ---------------------------------------------------------------------------- -- plplot initialization -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Get version number, just for kicks ver=pl.gver() print("PLplot library version: " .. ver) -- Initialize plplot -- Divide page into 2x2 plots -- Note: calling plstar replaces separate calls to plssub and plinit pl.star(2,2) -- Select font set as per input flag if fontset ~= 0 then pl.fontld(1) else pl.fontld(0) end -- Set up the data -- Original case xscale = 6 yscale = 1 xoff = 0 yoff = 0 -- Do a plot plot1(0) -- Set up the data xscale = 1 yscale = 0.0014 yoff = 0.0185 -- Do a plot digmax = 5 pl.syax(digmax, 0) plot1(1) plot2() plot3() -- Show how to save a plot: -- Open a new device, make it current, copy parameters, -- and replay the plot buffer if f_name~="" then -- command line option '-save filename' print("The current plot was saved in color Postscript under the name " .. f_name .. ".\n") cur_strm = pl.gstrm() -- get current stream new_strm = pl.mkstrm() -- create a new one pl.sfnam(f_name) -- file name pl.sdev("psc") -- device type pl.cpstrm(cur_strm, 0) -- copy old stream parameters to new stream pl.replot() -- do the save by replaying the plot buffer pl.plend1() -- finish the device pl.sstrm(cur_strm) -- return to previous stream end -- Don't forget to call plend() to finish off! pl.plend() plplot-5.10.0+dfsg/examples/lua/x00.lua 644 1750 1750 305411722016102 164330ustar andrewandrew--[[ $Id: x00.lua 12179 2012-02-24 23:24:50Z andrewross $ Simple demo of a 2D line plot. Copyright (C) 2011 Alan W. Irwin Copyright (C) 2012 Andrew Ross This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- Variables and data arrays used by NSIZE = 101 x = {} y = {} xmin = 0. xmax = 1. ymin = 0. ymax = 100. -- Prepare data to be plotted. for i = 1, NSIZE do x[i] = ( i - 1 ) / ( NSIZE - 1 ) y[i] = ymax * x[i]^2 end -- Parse and process command line arguments pl.parseopts( arg, pl.PL_PARSE_FULL ) -- Initialize plplot pl.init() -- Create a labelled box to hold the plot. pl.env( xmin, xmax, ymin, ymax, 0, 0 ) pl.lab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ) -- Plot the data that was prepared above. pl.line( x, y ) -- Close PLplot library pl.plend() plplot-5.10.0+dfsg/examples/lua/x08.lua 644 1750 1750 1135011717262764 165060ustar andrewandrew--[[ $Id: x08.lua 12167 2012-02-16 20:24:20Z airwin $ 3-d plot demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- bitwise or operator from http://lua-users.org/wiki/BaseSixtyFour -- (c) 2006-2008 by Alex Kloss -- licensed under the terms of the LGPL2 -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end ---------------------------------------------------------------------------- -- cmap1_init1 -- -- Initializes color map 1 in HLS space. -- Basic grayscale variation from half-dark (which makes more interesting -- looking plot compared to dark) to light. -- An interesting variation on this: -- s[1] = 1.0 ---------------------------------------------------------------------------- function cmap1_init(gray) i = { 0, 1 } -- left and right boundary if gray ~= 0 then h = { 0, 0 } -- hue -- low: red (arbitrary if s=0), high: red (arbitrary if s=0) l = { 0.5, 1 } -- lightness -- low: half-dark, high: light s = { 0, 0 } -- minimum saturation else h = { 240, 0 } -- blue -> green -> yellow -> red l = { 0.6, 0.6 } s = { 0.8, 0.8 } end pl.scmap1n(256) pl.scmap1l(0, i, h, l, s) end ---------------------------------------------------------------------------- -- main -- -- Does a series of 3-d plots for a given data set, with different -- viewing options in each plot. ---------------------------------------------------------------------------- XPTS = 35 -- Data points in x YPTS = 46 -- Data points in y LEVELS = 10 alt = { 60, 20 } az = { 30, 60 } title = { "#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60" } clevel = {} nlevel = LEVELS rosen = 1 sombrero = 0 -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) if sombrero ~= 0 then rosen=0 end -- Initialize plplot pl.init() -- Allocate data structures x = {} y = {} z = {} for i=1, XPTS do x[i] = (i-1-math.floor(XPTS/2)) / math.floor(XPTS/2) if rosen~=0 then x[i]=x[i]*1.5 end end for i=1, YPTS do y[i] = (i-1-math.floor(YPTS/2)) / math.floor(YPTS/2) if rosen~=0 then y[i]=y[i]+0.5 end end for i=1, XPTS do xx = x[i] z[i]= {} for j=1, YPTS do yy = y[j] if rosen~=0 then z[i][j] = (1-xx)^2 + 100*(yy-xx^2)^2 -- The log argument may be zero for just the right grid. if z[i][j] > 0 then z[i][j] = math.log(z[i][j]) else z[i][j] = -5 -- MAXFLOAT would mess-up up the scale end else r = math.sqrt(xx^2 + yy^2) z[i][j] = math.exp(-r^2) * math.cos(2*math.pi*r) end end end zmax, zmin = pl.MinMax2dGrid(z) step = (zmax-zmin)/(nlevel+1) for i=1, nlevel do clevel[i] = zmin + step + step*(i-1) end pl.lightsource(1, 1, 1) for k=1, 2 do for ifshade = 1, 4 do pl.adv(0) pl.vpor(0, 1, 0, 0.9) pl.wind(-1, 1, -0.9, 1.1) pl.col0(3) pl.mtex("t", 1, 0.5, 0.5, title[k]) pl.col0(1) if rosen~=0 then pl.w3d(1, 1, 1, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k]) else pl.w3d(1, 1, 1, -1, 1, -1, 1, zmin, zmax, alt[k], az[k]) end pl.box3("bnstu", "x axis", 0, 0, "bnstu", "y axis", 0, 0, "bcdmnstuv", "z axis", 0, 0) pl.col0(2) if ifshade==1 then -- diffuse light surface plot cmap1_init(1) pl.surf3d(x, y, z, 0, clevel) end if ifshade==2 then -- magnitude colored plot cmap1_init(0) pl.surf3d(x, y, z, pl.MAG_COLOR, {}) end if ifshade==3 then -- magnitude colored plot with faceted squares cmap1_init(0) pl.surf3d(x, y, z, lor(pl.MAG_COLOR, pl.FACETED), {}) end if ifshade==4 then -- magnitude colored plot with contours cmap1_init(0) pl.surf3d(x, y, z, lor(lor(pl.MAG_COLOR, pl.SURF_CONT), pl.BASE_CONT), clevel) end end end -- Clean up pl.plend() plplot-5.10.0+dfsg/examples/lua/x12.lua 644 1750 1750 404511543675237 164640ustar andrewandrew--[[ $Id: x12.lua 11680 2011-03-27 17:57:51Z airwin $ Bar chart demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") function pl.fbox(x0, y0) x = { x0, x0, x0+1,x0+1 } y = { 0, y0, y0, 0 } pl.fill(x, y); pl.col0(1); pl.lsty(1); pl.line(x, y); end -------------------------------------------------------------------------- -- main -- -- Does a simple bar chart, using color fill. If color fill is -- unavailable, pattern fill is used instead (automatic). -------------------------------------------------------------------------- y0 = {} pos = { 0, 0.25, 0.5, 0.75, 1 } red = { 0, 0.25, 0.5, 1, 1 } green = { 1, 0.5, 0.5, 0.5, 1 } blue = { 1, 1, 0.5, 0.25, 0 } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL); -- Initialize plplot pl.init() pl.adv(0) pl.vsta() pl.wind(1980, 1990, 0, 35) pl.box("bc", 1, 0, "bcnv", 10, 0) pl.col0(2) pl.lab("Year", "Widget Sales (millions)", "#frPLplot Example 12") y0 = { 5, 15, 12, 24, 28, 30, 20, 8, 12, 3} pl.scmap1l(1, pos, red, green, blue); for i=1, 10 do pl.col1((i-1)/9.0); pl.psty(0); pl.fbox((1980+i-1), y0[i]); pl.ptex((1980+i-0.5), (y0[i]+1), 1, 0, 0.5, tostring(y0[i])); pl.mtex("b", 1, (i*0.1-0.05), 0.5, tostring(1980+i-1)); end pl.plend(); plplot-5.10.0+dfsg/examples/lua/x20.lua 644 1750 1750 1502611146506754 165000ustar andrewandrew--[[ $Id: x20.lua 9535 2009-02-17 10:14:04Z smekal $ plimage demo --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") XDIM = 260 YDIM = 220 dbg = 0 nosombrero = 0 nointeractive = 0 f_name="" -- Transformation function function mypltr(x, y) local x0 = (stretch["xmin"] + stretch["xmax"])*0.5 local y0 = (stretch["ymin"] + stretch["ymax"])*0.5 local dy = (stretch["ymax"]-stretch["ymin"])*0.5 local tx = x0 + (x0-x)*(1 - stretch["stretch"]*math.cos((y-y0)/dy*math.pi*0.5)) local ty = y return tx, ty end -- read image from file in binary ppm format function read_img(fname) -- naive grayscale binary ppm reading. If you know how to, improve it local fp = io.open(fname, "rb") if fp==nil then return 1 end -- version local ver = fp:read("*line") if ver~="P5" then -- I only understand this! fp:close() return 1 end while fp:read(1)=="#" do local com = fp:read("*line") if com==nil then fp:close() return 1 end end fp:seek("cur", -1) local w, h, num_col = fp:read("*number", "*number", "*number") if w==nil or h==nil or num_col==nil then -- width, height, num colors fp:close() return 1 end -- read the rest of the line (only EOL) fp:read("*line") local img = fp:read(w*h) fp:close() if string.len(img)~=(w*h) then return 1 end local imf = {} for i = 1, w do imf[i] = {} for j = 1, h do imf[i][j] = string.byte(img, (h-j)*w+i) -- flip image up-down end end return 0, imf, w, h, num_col end -- save plot function save_plot(fname) local cur_strm = pl.gstrm() -- get current stream local new_strm = pl.mkstrm() -- create a new one pl.sdev("psc") -- new device type. Use a known existing driver pl.sfnam(fname) -- file name pl.cpstrm(cur_strm, 0) -- copy old stream parameters to new stream pl.replot() -- do the save pl.end1() -- close new device pl.sstrm(cur_strm) -- and return to previous one end -- get selection square interactively function get_clip(xi, xe, yi, ye) return 0, xi, xe, yi, ye end -- set gray colormap function gray_cmap(num_col) local r = { 0, 1 } local g = { 0, 1 } local b = { 0, 1 } local pos = { 0, 1 } pl.scmap1n(num_col) pl.scmap1l(1, pos, r, g, b) end x = {} y = {} z = {} r = {} img_f = {} cgrid2 = {} -- Bugs in plimage(): -- + at high magnifications, the left and right edge are ragged, try -- ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 -- Bugs in x20c.c: -- + if the window is resized after a selection is made on "lena", when --making a new selection the old one will re-appear. -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() z={} -- view image border pixels if dbg~=0 then pl.env(1, XDIM, 1, YDIM, 1, 1) -- no plot box -- build a one pixel square border, for diagnostics for i = 1, XDIM do z[i] = {} z[i][1] = 1 -- left z[i][YDIM] = 1 -- right end for i = 1, YDIM do z[1][i] = 1 -- top z[XDIM][i] = 1 -- botton end pl.lab("...around a blue square."," ","A red border should appear...") pl.image(z, 1, XDIM, 1, YDIM, 0, 0, 1, XDIM, 1, YDIM) end -- sombrero-like demo if nosombrero==0 then r = {} pl.col0(2) -- draw a yellow plot box, useful for diagnostics! :( pl.env(0, 2*math.pi, 0, 3*math.pi, 1, -1) for i = 1, XDIM do x[i] = (i-1)*2*math.pi/(XDIM-1) end for i = 1, YDIM do y[i] = (i-1)*3*math.pi/(YDIM-1) end for i = 1, XDIM do r[i] = {} z[i] = {} for j=1, YDIM do r[i][j] = math.sqrt(x[i]^2+y[j]^2)+1e-3 z[i][j] = math.sin(r[i][j])/r[i][j] end end pl.lab("No, an amplitude clipped \"sombrero\"", "", "Saturn?") pl.ptex(2, 2, 3, 4, 0, "Transparent image") pl.image(z, 0, 2*math.pi, 0, 3*math.pi, 0.05, 1, 0, 2*math.pi, 0, 3*math.pi) -- save the plot if f_name~="" then save_plot(f_name) end end -- read Lena image -- Note we try two different locations to cover the case where this -- examples is being run from the test_c.sh script status, img_f, width, height, num_col = read_img("lena.pgm") if status~=0 then status, img_f, width, height, num_col = read_img("../lena.pgm") if status~=0 then pl.abort("No such file") pl.plend() os.exit() end end -- set gray colormap gray_cmap(num_col) -- display Lena pl.env(1, width, 1, height, 1, -1) if nointeractive==0 then pl.lab("Set and drag Button 1 to (re)set selection, Button 2 to finish."," ","Lena...") else pl.lab(""," ","Lena...") end pl.image(img_f, 1, width, 1, height, 0, 0, 1, width, 1, height) -- selection/expansion demo if nointeractive==0 then xi = 200 xe = 330 yi = 280 ye = 220 status, xi, xe, yi, ye = get_clip(xi, xe, yi, ye) if status~=0 then -- get selection rectangle pl.plend() os.exit() end pl.spause(0) pl.adv(0) -- display selection only pl.image(img_f, 1, width, 1, height, 0, 0, xi, xe, ye, yi) pl.spause(1) -- zoom in selection pl.env(xi, xe, ye, yi, 1, -1) pl.image(img_f, 1, width, 1, height, 0, 0, xi, xe, ye, yi) end -- Base the dynamic range on the image contents. img_max, img_min = pl.MinMax2dGrid(img_f) -- Draw a saturated version of the original image. Only use the middle 50% -- of the image's full dynamic range. pl.col0(2) pl.env(0, width, 0, height, 1, -1) pl.lab("", "", "Reduced dynamic range image example") pl.imagefr(img_f, 0, width, 0, height, 0, 0, img_min + img_max*0.25, img_max - img_max*0.25) -- Draw a distorted version of the original image, showing its full dynamic range. pl.env(0, width, 0, height, 1, -1) pl.lab("", "", "Distorted image example") stretch = {} stretch["xmin"] = 0 stretch["xmax"] = width stretch["ymin"] = 0 stretch["ymax"] = height stretch["stretch"] = 0.5 -- In C / C++ the following would work, with plimagefr directly calling -- mypltr. For compatibilty with other language bindings the same effect -- can be achieved by generating the transformed grid first and then -- using pltr2. -- pl.imagefr(img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, mypltr, (PLPointer) &stretch) cgrid2 = {} cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = width+1 cgrid2["ny"] = height+1 for i = 1, width+1 do cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} for j = 1, height+1 do xx, yy = mypltr(i, j) cgrid2["xg"][i][j] = xx cgrid2["yg"][i][j] = yy end end --pl.imagefr(img_f, 0, width, 0, height, 0, 0, img_min, img_max, "pltr2", cgrid2) pl.imagefr(img_f, 0, width, 0, height, 0, 0, img_min, img_max, "mypltr") pl.plend() plplot-5.10.0+dfsg/examples/lua/x15.lua 644 1750 1750 1455012140621721 164700ustar andrewandrew--[[ $Id: x15.lua 12331 2013-05-03 02:41:21Z airwin $ Shade plot demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") XPTS = 35 -- Data points in x YPTS = 46 -- Data points in y z = {} -- Function prototypes ---------------------------------------------------------------------------- -- cmap1_init1 -- -- Initializes color map 1 in HLS space. ---------------------------------------------------------------------------- function cmap1_init1() i = { 0, 0,45, 0.55, 1 } -- left boundary, just before center, -- just after center, right boundary h = { 260, 260, 20, 20 } -- hue -- low: blue-violet, only change as we go over vertex -- hue -- high: red, keep fixed l = { 0.5, 0, 0, 0.5 } -- lightness -- low, lightness -- center -- lightness -- center, lightness -- high s = { 1, 1, 1, 1 } -- maximum saturation pl.scmap1l(0, i, h, l, s) end ---------------------------------------------------------------------------- -- cmap1_init2 -- -- Initializes color map 1 in HLS space. ---------------------------------------------------------------------------- function cmap1_init2() i = { 0, 0.45, 0.55, 1 } -- left boundary, just before center, -- just after center, right boundary h = { 260, 260, 20, 20 } -- hue -- low: blue-violet, only change as we go over vertex -- hue -- high: red, keep fixed l = { 0.6, 0, 0, 0.6 } -- lightness -- low, lightness -- center -- lightness -- center, lightness -- high s = { 1, 0.5, 0.5, 1 } -- saturation -- low, saturation -- center -- saturation -- center, saturation -- high pl.scmap1l(0, i, h, l, s) end ---------------------------------------------------------------------------- -- plot1 -- -- Illustrates a single shaded region. ---------------------------------------------------------------------------- function plot1() sh_cmap = 0 pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) -- Plot using identity transform shade_min = zmin + (zmax-zmin)*0.4 shade_max = zmin + (zmax-zmin)*0.6 sh_color = 7 sh_width = 2. min_color = 9 max_color = 2 min_width = 2. max_width = 2. pl.psty(8) pl.shade(z, -1, 1, -1, 1, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1) pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) pl.lab("distance", "altitude", "Bogon flux") end ---------------------------------------------------------------------------- -- plot2 -- -- Illustrates multiple adjacent shaded regions, using different fill -- patterns for each region. ---------------------------------------------------------------------------- function plot2() sh_cmap = 0 min_color = 0 min_width = 0. max_color = 0 max_width = 0. inc = { {450}, {-450}, {0}, {900}, {300}, {450,-450}, {0, 900}, {0, 450}, {450, -450}, {0, 900} } del = { {2000}, {2000}, {2000}, {2000}, {2000}, {2000, 2000}, {2000, 2000}, {2000, 2000}, {4000, 4000}, {4000, 2000} } sh_width = 2. pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1) -- Plot using identity transform for i = 1, 10 do shade_min = zmin + (zmax - zmin) * (i-1)/10 shade_max = zmin + (zmax - zmin) * i/10 sh_color = i+5 pl.pat(inc[i], del[i]) pl.shade(z, -1, 1, -1, 1, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1) end pl.col0(1) pl.box("bcnst", 0, 0, "bcnstv", 0, 0) pl.col0(2) pl.lab("distance", "altitude", "Bogon flux") end ---------------------------------------------------------------------------- -- plot3 -- -- Illustrates shaded regions in 3d, using a different fill pattern for -- each region. ---------------------------------------------------------------------------- function plot3() xx = { {-1, 1, 1, -1, -1}, {-1, 1, 1, -1, -1} } yy = { {1, 1, 0, 0, 1}, {-1, -1, 0, 0, -1} } zz = { {0, 0, 1, 1, 0}, {0, 0, 1, 1, 0} } pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(-1, 1, -1, 1.) pl.w3d(1, 1, 1, -1, 1, -1, 1, 0, 1.5, 30, -40) -- Plot using identity transform pl.col0(1) pl.box3("bntu", "X", 0, 0, "bntu", "Y", 0, 0, "bcdfntu", "Z", 0.5, 0) pl.col0(2) pl.lab("","","3-d polygon filling") pl.col0(3) pl.psty(1) pl.line3(xx[1], yy[1], zz[1]) pl.fill3(xx[1], yy[1], zz[1]) pl.psty(2) pl.line3(xx[2], yy[2], zz[2]) pl.fill3(xx[2], yy[2], zz[2]) end ---------------------------------------------------------------------------- -- f2mnmx -- -- Returns min & max of input 2d array. ---------------------------------------------------------------------------- function f2mnmx(f, nx, ny) fmax = f[1][1] fmin = fmax for i=1, nx do for j=1, ny do fmax = math.max(fmax, f[i][j]) fmin = math.min(fmin, f[i][j]) end end return fmin, fmax end ---------------------------------------------------------------------------- -- main -- -- Does a variety of shade plots. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Set up color map 1 cmap1_init2() -- Initialize plplot pl.init() -- Set up data array for i=1, XPTS do xx = ((i-1) - math.floor(XPTS/2))/math.floor(XPTS/2) z[i] = {} for j = 1, YPTS do yy = ((j-1) - math.floor(YPTS/2))/math.floor(YPTS/2) - 1 z[i][j] = xx^2 - yy^2 + (xx - yy)/(xx^2+yy^2 + 0.1) end end zmin, zmax = f2mnmx(z, XPTS, YPTS) plot1() plot2() plot3() pl.plend() plplot-5.10.0+dfsg/examples/lua/x17.lua 644 1750 1750 616011717262764 164710ustar andrewandrew--[[ $Id: x17.lua 12167 2012-02-16 20:24:20Z airwin $ Plots a simple stripchart with four pens. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -------------------------------------------------------------------------- -- main -------------------------------------------------------------------------- nsteps = 1000 colline = {} legline = {} -- plplot initialization -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- User sets up plot completely except for window and data -- Eventually settings in place when strip chart is created will be -- remembered so that multiple strip charts can be used simultaneously. -- Specify some reasonable defaults for ymin and ymax -- The plot will grow automatically if needed (but not shrink) ymin = -0.1 ymax = 0.1 -- Specify initial tmin and tmax -- this determines length of window. -- Also specify maximum jump in t -- This can accomodate adaptive timesteps tmin = 0 tmax = 10 tjump = 0.3 -- percentage of plot to jump -- Axes options same as plbox. -- Only automatic tick generation and label placement allowed -- Eventually I'll make this fancier colbox = 1 collab = 3 styline = { 2, 3, 4, 5 } -- line style colline = { 2, 3, 4, 5 } -- pens color legline= { "sum", "sin", "sin*noi", "sin+noi" } -- pens legend xlab = 0 -- legend position ylab = 0.25 autoy = 1 -- autoscale y acc = 1 -- don't scrip, accumulate -- Initialize plplot pl.init() pl.adv(0) pl.vsta() id1 = pl.stripc("bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo") autoy = 0 -- autoscale y acc = 1 -- accumulate -- This is to represent a loop over time -- Let's try a random walk process y1 = 0 y2 = 0 y3 = 0 y4 = 0 dt = 0.1 for n = 0, nsteps-1 do for i = 0, 200000 do end t = n * dt noise = pl.randd() - 0.5 y1 = y1 + noise y2 = math.sin(t*math.pi/18) y3 = y2 * noise y4 = y2 + noise/3 -- There is no need for all pens to have the same number of -- points or beeing equally time spaced. if (n % 2)~=0 then pl.stripa(id1, 0, t, y1) end if (n % 3)~=0 then pl.stripa(id1, 1, t, y2) end if (n % 4)~=0 then pl.stripa(id1, 2, t, y3) end if (n % 5)~=0 then pl.stripa(id1, 3, t, y4) end end -- Destroy strip chart and it's memory pl.stripd(id1) pl.plend() plplot-5.10.0+dfsg/examples/lua/x27.lua 644 1750 1750 1147111717262764 165130ustar andrewandrew--[[ $Id: x27.lua 12167 2012-02-16 20:24:20Z airwin $ Drawing "spirograph" curves - epitrochoids, cycolids, roulettes Copyright (C) 2009 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -------------------------------------------------------------------------- -- Calculate greatest common divisor following pseudo-code for the -- Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm function gcd (a, b) a = math.floor(math.abs(a)) b = math.floor(math.abs(b)) while b~=0 do t = b b = a % b a = t end return a end function cycloid() -- TODO end function spiro( params, fill ) NPNT = 2000 xcoord = {} ycoord = {} -- Fill the coordinates -- Proper termination of the angle loop very near the beginning -- point, see -- http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = math.floor(math.abs(params[2])/gcd(params[1], params[2])) steps = math.floor(NPNT/windings) dphi = 2*math.pi/steps for i = 1, windings*steps+1 do phi = (i-1) * dphi phiw = (params[1]-params[2])/params[2]*phi xcoord[i] = (params[1]-params[2])*math.cos(phi) + params[3]*math.cos(phiw) ycoord[i] = (params[1]-params[2])*math.sin(phi) - params[3]*math.sin(phiw) if i == 1 then xmin = xcoord[i] xmax = xcoord[i] ymin = ycoord[i] ymax = ycoord[i] end if xmin>xcoord[i] then xmin = xcoord[i] end if xmaxycoord[i] then ymin = ycoord[i] end if ymax 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end function cmap1_init() i = { 0, 1 } -- left boundary , right boundary h = { 240, 0 } -- blue -> green -> yellow -> red l = { 0.6, 0.6 } s = { 0.8, 0.8 } pl.scmap1n(256) pl.scmap1l(0, i, h, l, s) end ---------------------------------------------------------------------------- -- main -- -- Does a series of mesh plots for a given data set, with different -- viewing options in each plot. ---------------------------------------------------------------------------- nlevel = LEVELS clevel = {} -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() x = {} y = {} z = {} for i=1, XPTS do x[i] = 3 * (i-1-math.floor(XPTS/2)) / math.floor(XPTS/2) end for i=1, YPTS do y[i] = 3 * (i-1-math.floor(YPTS/2)) / math.floor(YPTS/2) end for i=1, XPTS do xx = x[i] z[i] = {} for j=1, YPTS do yy = y[j] z[i][j] = 3 * (1-xx)^2 * math.exp(-xx^2 - (yy+1.)^2) - 10 * (xx/5 - xx^3 - yy^5) * math.exp(-xx^2-yy^2) - 1/3 * math.exp(-(xx+1)^2 - yy^2) -- Jungfraujoch/Interlaken if false then if z[i][j] < -1 then z[i][j] = -1 end end end end zmax, zmin = pl.MinMax2dGrid(z) step = (zmax - zmin)/(nlevel+1) for i=1, nlevel do clevel[i] = zmin + step + step*(i-1) end cmap1_init() for k=1, 2 do for i=1, 4 do pl.adv(0) pl.col0(1) pl.vpor(0, 1, 0, 0.9) pl.wind(-1, 1, -1, 1.5) pl.w3d(1, 1, 1.2, -3, 3, -3, 3, zmin, zmax, alt[k], az[k]) pl.box3("bnstu", "x axis", 0, 0, "bnstu", "y axis", 0, 0, "bcdmnstuv", "z axis", 0, 4) pl.col0(2) -- wireframe plot if i==1 then pl.mesh(x, y, z, opt[k]) end -- magnitude colored wireframe plot if i==2 then pl.mesh(x, y, z, lor(opt[k], pl.MAG_COLOR)) end -- magnitude colored wireframe plot with sides if i==3 then pl.plot3d(x, y, z, lor(opt[k], pl.MAG_COLOR), 1) end -- magnitude colored wireframe plot with base contour if i==4 then pl.meshc(x, y, z, lor(lor(opt[k], pl.MAG_COLOR), pl.BASE_CONT), clevel) end pl.col0(3) pl.mtex("t", 1, 0.5, 0.5, title[k]) end end -- Clean up pl.plend() plplot-5.10.0+dfsg/examples/lua/plplot_examples.lua.in 644 1750 1750 101111152055523 216370ustar andrewandrew-- initialise Lua bindings for PLplot examples. if string.sub(_VERSION,1,7)=='Lua 5.0' then lib=loadlib('@lua_lib_location@/plplotluac.so','luaopen_plplotluac') or loadlib('@lua_lib_location@/plplotluac.dll','luaopen_plplotluac') or loadlib('@lua_lib_location@/plplotluac.dylib','luaopen_plplotluac') assert(lib)() else package.cpath = '@lua_lib_location@/?.so;' .. '@lua_lib_location@/?.dll;' .. '@lua_lib_location@/?.dylib;' ..package.cpath require('plplotluac') end plplot-5.10.0+dfsg/examples/lua/x07.lua 644 1750 1750 457311543675237 164760ustar andrewandrew--[[ $Id: x07.lua 11680 2011-03-27 17:57:51Z airwin $ Font demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") base = { 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900 } ---------------------------------------------------------------------------- -- main -- -- Displays the entire "plsym" symbol (font) set. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() pl.fontld(0) for l = 1, 20 do if l == 3 then pl.fontld(1) end pl.adv(0) -- Set up viewport and window pl.col0(2) pl.vpor(0.15, 0.95, 0.1, 0.9) pl.wind(0, 1, 0, 1) -- Draw the grid using plbox pl.box("bcg", 0.1, 0, "bcg", 0.1, 0) -- Write the digits below the frame pl.col0(15) for i = 0, 9 do pl.mtex("b", 1.5, (0.1 * i + 0.05), 0.5, tostring(i)) end k = 0 x = {} y = {} for i = 0, 9 do -- Write the digits to the left of the frame pl.mtex("lv", 1.0, (0.95 - 0.1 * i), 1.0, tostring(base[l] + 10 * i)) for j=0, 9 do x[1] = 0.1 * j + 0.05 y[1] = 0.95 - 0.1 * i -- Display the symbols pl.sym(x, y, base[l] + k) k = k + 1 end end if l <= 2 then pl.mtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)") else pl.mtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)") end end pl.plend() plplot-5.10.0+dfsg/examples/lua/x10.lua 644 1750 1750 301311543675237 164540ustar andrewandrew--[[ $Id: x10.lua 11680 2011-03-27 17:57:51Z airwin $ Window positioning demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ---------------------------------------------------------------------------- -- main -- -- Demonstrates absolute positioning of graphs on a page. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL); -- Initialize plplot pl.init() pl.adv(0) pl.vpor(0.0, 1.0, 0.0, 1.0) pl.wind(0.0, 1.0, 0.0, 1.0) pl.box("bc", 0.0, 0, "bc", 0.0, 0) pl.svpa(50.0, 150.0, 50.0, 100.0) pl.wind(0.0, 1.0, 0.0, 1.0) pl.box("bc", 0.0, 0, "bc", 0.0, 0) pl.ptex(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)") pl.plend() plplot-5.10.0+dfsg/examples/lua/x23.lua 644 1750 1750 2041211717262764 165020ustar andrewandrew--[[ $Id: x23.lua 12167 2012-02-16 20:24:20Z airwin $ Displays Greek letters and mathematically interesting Unicode ranges Copyright (C) 2009 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ---------------------------------------------------------------------------- -- main -- -- Displays Greek letters and mathematically interesting Unicode ranges ---------------------------------------------------------------------------- Greek = { "#gA","#gB","#gG","#gD","#gE","#gZ","#gY","#gH","#gI","#gK","#gL","#gM", "#gN","#gC","#gO","#gP","#gR","#gS","#gT","#gU","#gF","#gX","#gQ","#gW", "#ga","#gb","#gg","#gd","#ge","#gz","#gy","#gh","#gi","#gk","#gl","#gm", "#gn","#gc","#go","#gp","#gr","#gs","#gt","#gu","#gf","#gx","#gq","#gw" } Type1 = { 32, 33, 35, 37, 38, 40, 41, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 91, 93, 95, 123, 124, 125, 169, 172, 174, 176, 177, 215, 247, 402, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 977, 978, 981, 982, 8226, 8230, 8242, 8243, 8254, 8260, 8465, 8472, 8476, 8482, 8486, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656, 8657, 8658, 8659, 8660, 8704, 8706, 8707, 8709, 8710, 8711, 8712, 8713, 8715, 8719, 8721, 8722, 8725, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747, 8756, 8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839, 8853, 8855, 8869, 8901, 8992, 8993, 9001, 9002, 9674, 9824, 9827, 9829, 9830 } title = { "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)" } lo = { 0, 0, 64, 128, 8531, 8592, 8656, 8704, 8768, 8832, 8896 } hi = { 48, 64, 128, 166, 8580, 8656, 8704, 8768, 8832, 8896, 8960 } nxcells = { 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } nycells = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } -- non-zero values Must be consistent with nxcells and nycells. offset = { 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0 } -- 30 possible FCI values. FCI_COMBINATIONS = 30 fci = { 2147483648, 2147483649, 2147483650, 2147483651, 2147483652, 2147483664, 2147483665, 2147483666, 2147483667, 2147483668, 2147483680, 2147483681, 2147483682, 2147483683, 2147483684, 2147483904, 2147483905, 2147483906, 2147483907, 2147483908, 2147483920, 2147483921, 2147483922, 2147483923, 2147483924, 2147483936, 2147483937, 2147483938, 2147483939, 2147483940 } family = { "sans-serif", "serif", "monospace", "script", "symbol" } style = { "upright", "italic", "oblique" } weight = { "medium", "bold" } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() for page=1, 11 do pl.adv(0) -- Set up viewport and window pl.vpor(0.02, 0.98, 0.02, 0.90) pl.wind(0, 1, 0, 1) xmin, xmax, ymin, ymax = pl.gspa() pl.schr(0, 0.8) ycharacter_scale = (1-0)/(ymax-ymin) -- Factor should be 0.5, but heuristically it turns out to be larger. chardef, charht = pl.gchr() yoffset = charht*ycharacter_scale -- Draw the grid using plbox pl.col0(2) deltax = 1.0/nxcells[page] deltay = 1.0/nycells[page] pl.box("bcg", deltax, 0, "bcg", deltay, 0) pl.col0(15) length=hi[page]-lo[page] slice = 1 for j=nycells[page]-1, -1, -1 do y = (0.5+j)*deltay for i=1, nxcells[page] do x = (i-0.5)*deltax if slice<=length then if page==1 then cmdString = "#" .. Greek[slice] elseif (page>=2) and (page<=4) then cmdString = string.format("##[0x%.4x]", Type1[offset[page]+slice]) elseif page>4 then cmdString = string.format("##[0x%.4x]", lo[page]+slice-1) end pl.ptex(x, y+yoffset, 1, 0, 0.5, string.sub(cmdString,2)) pl.ptex(x, y-yoffset, 1, 0, 0.5, cmdString) end slice = slice + 1 end end pl.schr(0, 1) -- Page title pl.mtex("t", 1.5, 0.5, 0.5, title[page]) end -- Demonstrate methods of getting the current fonts fci_old = pl.gfci() ifamily, istyle, iweight = pl.gfont() print(string.format("For example 23 prior to page 12 the FCI is 0x%x", fci_old)) print(string.format("For example 23 prior to page 12 the font family, style and weight are %s %s %s", family[ifamily+1], style[istyle+1], weight[iweight+1])) for page=12, 16 do dy = 0.030 pl.adv(0) pl.vpor(0.02, 0.98, 0.02, 0.90) pl.wind(0, 1, 0, 1) pl.sfci(0) if page==12 then pl.mtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with plsfci") elseif page==13 then pl.mtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with plsfont") elseif page==14 then pl.mtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct") elseif page==15 then pl.mtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs") elseif page==16 then pl.mtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - Set Font with ## constructs") end pl.schr(0, 0.75) for i=1, FCI_COMBINATIONS do family_index = ((i-1) % 5) +1 style_index = (math.floor((i-1)/5) % 3)+1 weight_index = (math.floor((i-1)/5/3) % 2)+1 if page==12 then pl.sfci(fci[i]) str = string.format("Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index]) elseif page==13 then pl.sfont(family_index-1, style_index-1, weight_index-1) str = string.format("Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index]) elseif page==14 then str = string.format("Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], fci[i]) elseif page==15 then str = string.format("Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family_index-1, style_index-1, weight_index-1) elseif page==16 then str = string.format("Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family[family_index], style[style_index], weight[weight_index]) end pl.ptex(0, 1-(i-0.5)*dy, 1, 0, 0, str) end pl.schr(0, 1) end -- Restore defaults pl.col0(1) pl.plend() plplot-5.10.0+dfsg/examples/lua/x13.lua 644 1750 1750 465511717262764 164740ustar andrewandrew--[[ $Id: x13.lua 12167 2012-02-16 20:24:20Z airwin $ Pie chart demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") text = { "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" } -------------------------------------------------------------------------- -- main -- -- Does a simple pie chart. -------------------------------------------------------------------------- per = { 10, 32, 12, 30, 16 } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL); -- Initialize plplot pl.init() pl.adv(0) -- Ensure window has aspect ratio of one so circle is -- plotted as a circle. pl.vasp(1) pl.wind(0, 10, 0, 10) pl.col0(2) -- n.b. all theta quantities scaled by 2*M_PI/500 to be integers to avoid --floating point logic problems. theta0 = 0 dthet = 1 for i = 1, 5 do x = { 5 } y = { 5 } j = 2 -- n.b. the theta quantities multiplied by 2*math.pi/500 afterward so -- in fact per is interpreted as a percentage. theta1 = theta0 + 5 * per[i] if i == 5 then theta1 = 500 end for theta = theta0, theta1, dthet do x[j] = 5 + 3 * math.cos(2*math.pi/500*theta) y[j] = 5 + 3 * math.sin(2*math.pi/500*theta) j = j + 1 thetasave=theta end pl.col0(i) pl.psty(((i + 2) % 8) + 1) pl.fill(x, y) pl.col0(1) pl.line(x, y) just = 2*math.pi/500*(theta0 + theta1)/2 dx = 0.25 * math.cos(just) dy = 0.25 * math.sin(just) if (theta0 + theta1)<250 or (theta0 + theta1)>750 then just = 0 else just = 1 end pl.ptex((x[(j-1)/2+1] + dx), (y[(j-1)/2+1] + dy), 1, 0, just, text[i]); theta0 = thetasave end pl.font(2) pl.schr(0, 1.3) pl.ptex(5, 9, 1, 0, 0.5, "Percentage of Sales") pl.plend() plplot-5.10.0+dfsg/examples/lua/x09.lua 644 1750 1750 1776511543675237 165270ustar andrewandrew--[[ $Id: x09.lua 11680 2011-03-27 17:57:51Z airwin $ Contour plot demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") XPTS = 35 -- Data points in x YPTS = 46 -- Data points in y XSPA = 2/(XPTS-1) YSPA = 2/(YPTS-1) -- polar plot data PERIMETERPTS = 100 RPTS = 40 THETAPTS = 40 -- potential plot data PPERIMETERPTS = 100 PRPTS = 40 PTHETAPTS = 64 PNLEVEL = 20 clevel = { -1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 1} -- Transformation function tr = { XSPA, 0, -1, 0, YSPA, -1 } function mypltr(x, y) tx = tr[1] * x + tr[2] * y + tr[3] ty = tr[4] * x + tr[5] * y + tr[6] return tx, ty end --polar contour plot example. function polar() px = {} py = {} lev = {} pl.env(-1, 1, -1, 1, 0, -2) pl.col0(1) --Perimeter for i=1, PERIMETERPTS do t = (2*math.pi/(PERIMETERPTS-1))*(i-1) px[i] = math.cos(t) py[i] = math.sin(t) end pl.line(px, py) --create data to be contoured. cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = RPTS cgrid2["ny"] = THETAPTS z = {} for i = 1, RPTS do r = (i-1)/(RPTS-1) cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} z[i] = {} for j = 1, THETAPTS do theta = (2*math.pi/(THETAPTS-1))*(j-1) cgrid2["xg"][i][j] = r*math.cos(theta) cgrid2["yg"][i][j] = r*math.sin(theta) z[i][j] = r end end for i = 1, 10 do lev[i] = 0.05 + 0.10*(i-1) end pl.col0(2) pl.cont(z, 1, RPTS, 1, THETAPTS, lev, "pltr2", cgrid2) pl.col0(1) pl.lab("", "", "Polar Contour Plot") end ---------------------------------------------------------------------------- -- f2mnmx -- -- Returns min & max of input 2d array. ---------------------------------------------------------------------------- function f2mnmx(f, nx, ny) fmax = f[1][1] fmin = fmax for i=1, nx do for j=1, ny do fmax = math.max(fmax, f[i][j]) fmin = math.min(fmin, f[i][j]) end end return fmin, fmax end --shielded potential contour plot example. function potential() clevelneg = {} clevelpos = {} px = {} py = {} --create data to be contoured. cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = PRPTS cgrid2["ny"] = PTHETAPTS z = {} for i = 1, PRPTS do r = 0.5 + (i-1) cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} for j = 1, PTHETAPTS do theta = 2*math.pi/(PTHETAPTS-1)*(j-0.5) cgrid2["xg"][i][j] = r*math.cos(theta) cgrid2["yg"][i][j] = r*math.sin(theta) end end rmax = PRPTS-0.5 xmin, xmax = f2mnmx(cgrid2["xg"], PRPTS, PTHETAPTS) ymin, ymax = f2mnmx(cgrid2["yg"], PRPTS, PTHETAPTS) x0 = (xmin + xmax)/2 y0 = (ymin + ymax)/2 -- Expanded limits peps = 0.05 xpmin = xmin - math.abs(xmin)*peps xpmax = xmax + math.abs(xmax)*peps ypmin = ymin - math.abs(ymin)*peps ypmax = ymax + math.abs(ymax)*peps -- Potential inside a conducting cylinder (or sphere) by method of images. -- Charge 1 is placed at (d1, d1), with image charge at (d2, d2). -- Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). -- Also put in smoothing term at small distances. eps = 2 q1 = 1 d1 = rmax/4 q1i = - q1*rmax/d1 d1i = rmax^2/d1 q2 = -1 d2 = rmax/4 q2i = - q2*rmax/d2 d2i = rmax^2/d2 for i = 1, PRPTS do z[i] = {} for j = 1, PTHETAPTS do div1 = math.sqrt((cgrid2.xg[i][j]-d1)^2 + (cgrid2.yg[i][j]-d1)^2 + eps^2) div1i = math.sqrt((cgrid2.xg[i][j]-d1i)^2 + (cgrid2.yg[i][j]-d1i)^2 + eps^2) div2 = math.sqrt((cgrid2.xg[i][j]-d2)^2 + (cgrid2.yg[i][j]+d2)^2 + eps^2) div2i = math.sqrt((cgrid2.xg[i][j]-d2i)^2 + (cgrid2.yg[i][j]+d2i)^2 + eps^2) z[i][j] = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i end end zmin, zmax = f2mnmx(z, PRPTS, PTHETAPTS) -- Positive and negative contour levels. dz = (zmax-zmin)/PNLEVEL nlevelneg = 1 nlevelpos = 1 for i = 1, PNLEVEL do clevel = zmin + (i-0.5)*dz if clevel <= 0 then clevelneg[nlevelneg] = clevel nlevelneg = nlevelneg + 1 else clevelpos[nlevelpos] = clevel nlevelpos = nlevelpos + 1 end end -- Colours! ncollin = 11 ncolbox = 1 ncollab = 2 -- Finally start plotting this page! pl.adv(0) pl.col0(ncolbox) pl.vpas(0.1, 0.9, 0.1, 0.9, 1) pl.wind(xpmin, xpmax, ypmin, ypmax) pl.box("", 0, 0, "", 0, 0) pl.col0(ncollin) if nlevelneg>1 then -- Negative contours pl.lsty(2) pl.cont(z, 1, PRPTS, 1, PTHETAPTS, clevelneg, "pltr2", cgrid2) end if nlevelpos>1 then -- Positive contours pl.lsty(1) pl.cont(z, 1, PRPTS, 1, PTHETAPTS, clevelpos, "pltr2", cgrid2) end -- Draw outer boundary for i = 1, PPERIMETERPTS do t = (2*math.pi/(PPERIMETERPTS-1))*(i-1) px[i] = x0 + rmax*math.cos(t) py[i] = y0 + rmax*math.sin(t) end pl.col0(ncolbox) pl.line(px, py) pl.col0(ncollab) pl.lab("", "", "Shielded potential of charges in a conducting sphere") end ---------------------------------------------------------------------------- -- main -- -- Does several contour plots using different coordinate mappings. ---------------------------------------------------------------------------- mark = { 1500 } space = { 1500 } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() -- Set up function arrays z = {} w = {} for i = 1, XPTS do xx = (i-1 - math.floor(XPTS/2)) / math.floor(XPTS/2) z[i] = {} w[i] = {} for j = 1, YPTS do yy = (j-1 - math.floor(YPTS/2)) / math.floor(YPTS/2) - 1 z[i][j] = xx^2 - yy^2 w[i][j] = 2 * xx * yy end end -- Set up grids cgrid1 = {} cgrid1["xg"] = {} cgrid1["yg"] = {} cgrid1["nx"] = XPTS cgrid1["ny"] = YPTS cgrid2 = {} cgrid2["xg"] = {} cgrid2["yg"] = {} cgrid2["nx"] = XPTS cgrid2["ny"] = YPTS for i = 1, XPTS do cgrid2["xg"][i] = {} cgrid2["yg"][i] = {} for j = 1, YPTS do xx, yy = mypltr(i-1, j-1) argx = xx * math.pi/2 argy = yy * math.pi/2 distort = 0.4 cgrid1["xg"][i] = xx + distort * math.cos(argx) cgrid1["yg"][j] = yy - distort * math.cos(argy) cgrid2["xg"][i][j] = xx + distort * math.cos(argx) * math.cos(argy) cgrid2["yg"][i][j] = yy - distort * math.cos(argx) * math.cos(argy) end end -- Plot using identity transform pl.setcontlabelformat(4, 3) pl.setcontlabelparam(0.006, 0.3, 0.1, 1) pl.env(-1, 1, -1, 1, 0, 0) pl.col0(2) pl.cont(z, 1, XPTS, 1, YPTS, clevel, "mypltr") pl.styl(mark, space) pl.col0(3) pl.cont(w, 1, XPTS, 1, YPTS, clevel, "mypltr") pl.styl({}, {}) pl.col0(1) pl.lab("X Coordinate", "Y Coordinate", "Streamlines of flow") pl.setcontlabelparam(0.006, 0.3, 0.1, 0) -- Plot using 1d coordinate transform pl.env(-1, 1, -1, 1, 0, 0) pl.col0(2) pl.cont(z, 1, XPTS, 1, YPTS, clevel, "pltr1", cgrid1) pl.styl(mark, space) pl.col0(3) pl.cont(w, 1, XPTS, 1, YPTS, clevel, "pltr1", cgrid1) pl.styl({}, {}) pl.col0(1) pl.lab("X Coordinate", "Y Coordinate", "Streamlines of flow") -- Plot using 2d coordinate transform pl.env(-1, 1, -1, 1, 0, 0) pl.col0(2) pl.cont(z, 1, XPTS, 1, YPTS, clevel, "pltr2", cgrid2) pl.styl(mark, space) pl.col0(3) pl.cont(w, 1, XPTS, 1, YPTS, clevel, "pltr2", cgrid2) pl.styl({}, {}) pl.col0(1) pl.lab("X Coordinate", "Y Coordinate", "Streamlines of flow") pl.setcontlabelparam(0.006, 0.3, 0.1, 0) polar() pl.setcontlabelparam(0.006, 0.3, 0.1, 0) potential() -- Clean up pl.plend() plplot-5.10.0+dfsg/examples/lua/x02.lua 644 1750 1750 733112102122103 164270ustar andrewandrew--[[ $Id: x02.lua 12288 2013-01-30 04:40:35Z airwin $ Multiple window and color map 0 demo. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") ---------------------------------------------------------------------------- -- draw_windows -- -- Draws a set of numbered boxes with colors according to cmap0 entry. ---------------------------------------------------------------------------- function draw_windows(nw, cmap0_offset) pl.schr(0, 3.5) pl.font(4) for i = 0, nw-1 do pl.col0(i+cmap0_offset) pl.adv(0) vmin = 0.1 vmax = 0.9 for j = 0, 2 do pl.width(j + 1) pl.vpor(vmin, vmax, vmin, vmax) pl.wind(0, 1, 0, 1) pl.box("bc", 0, 0, "bc", 0, 0) vmin = vmin + 0.1 vmax = vmax - 0.1 end pl.width(1) pl.ptex(0.5, 0.5, 1, 0, 0.5, tostring(i)) end end ---------------------------------------------------------------------------- -- demo1 -- -- Demonstrates multipl.e windows and default color map 0 palette. ---------------------------------------------------------------------------- function demo1() pl.bop() -- Divide screen into 16 regions pl.ssub(4, 4) draw_windows(16, 0) pl.eop() end ---------------------------------------------------------------------------- -- demo2 -- -- Demonstrates multipl.e windows, user-modified color map 0 palette, and -- HLS -> RGB translation. ---------------------------------------------------------------------------- function demo2() -- Set up cmap0 -- Use 100 custom colors in addition to base 16 r = {} g = {} b = {} -- Min & max lightness values lmin = 0.15 lmax = 0.85 pl.bop() -- Divide screen into 100 regions pl.ssub(10, 10) for i = 0, 99 do -- Bounds on HLS, from pl.hlsrgb() commentary -- -- hue [0., 360.] degrees -- lightness [0., 1.] magnitude -- saturation [0., 1.] magnitude -- Vary hue uniformly from left to right h = (360/10) * (i % 10) -- Vary lightness uniformly from top to bottom, between min & max l = lmin + (lmax - lmin) * math.floor(i/10)/9 -- Use max saturation s = 1 r1, g1, b1 = pl.hlsrgb(h, l, s) -- Use 255.001 to avoid close truncation decisions in this example. r[i+1+16] = r1 * 255.001 g[i+1+16] = g1 * 255.001 b[i+1+16] = b1 * 255.001 end -- Load default cmap0 colors into our custom set for i = 0, 15 do r[i+1], g[i+1], b[i+1] = pl.gcol0(i) end -- Now set cmap0 all at once (faster, since fewer driver calls) pl.scmap0(r, g, b) draw_windows(100, 16) pl.eop() end ---------------------------------------------------------------------------- -- main -- -- Demonstrates multipl.e windows and color map 0 palette, both default and -- user-modified. ---------------------------------------------------------------------------- -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize pl.pl.ot pl.init() -- Run demos demo1() demo2() pl.plend() plplot-5.10.0+dfsg/examples/lua/x33.lua 644 1750 1750 5770212154402127 165000ustar andrewandrew--[[ $Id: x33.lua 11667 2011-03-21 03:35:08Z airwin $ Demonstrate most pllegend capability including unicode symbols. Copyright (C) 2010 Alan W. Irwin This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,32 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end -- logic AND for number values function land(x,y) result = 0 for p=1,32 do result = result + (((bit(x,p) and bit(y,p)) == true) and 2^(p-1) or 0) end return result end -- Intialize pllegend arrays taking advantage of Lua's default global scope. function initialize_pllegend_arrays(nlegend) opt_array = {} text_colors = {} text = {} box_colors = {} box_patterns = {} box_scales = {} box_line_widths = {} line_colors = {} line_styles = {} line_widths = {} symbol_colors = {} symbol_scales = {} symbol_numbers = {} symbols = {} for i=1,nlegend do opt_array[i] = 0 text_colors[i] = 0 text[i] = "" box_colors[i] = 0 box_patterns[i] = 0 box_scales[i] = 0.0 box_line_widths[i] = 0. line_colors[i] = 0 line_styles[i] = 0 line_widths[i] = 0. symbol_colors[i] = 0 symbol_scales[i] = 0.0 symbol_numbers[i] = 0 symbols[i] = "" end end function plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ) -- Parameters for the colorbars on this page ticks = { 0.0 } sub_ticks = { 0 } axis_opts = {} label_opts = { 0 } n_values_array = {} values_array = {} label = {} n_values_array[1] = n_values values_array[1] = values low_cap_color = 0.0 high_cap_color = 1.0 -- Start a new page pl.adv( 0 ) -- Draw one colorbar relative to each side of the page for position_i = 0,COLORBAR_POSITIONS-1 do position = colorbar_position_options[position_i+1] opt = lor(colorbar_option_kinds[kind_i+1], lor(colorbar_label_options[label_i+1], colorbar_cap_options[cap_i+1])) vertical = lor(land(position,pl.PL_POSITION_LEFT), land(position,pl.PL_POSITION_RIGHT)) ifn = lor(land(position, pl.PL_POSITION_LEFT), land(position, pl.PL_POSITION_BOTTOM)) -- Set the offset position on the page if vertical > 0 then x = 0.0 y = 0.0 x_length = 0.05 y_length = 0.5 else x = 0.0 y = 0.0 x_length = 0.5 y_length = 0.05 end -- Set appropriate labelling options. if ifn > 0 then if ( cont_color == 0 ) or ( cont_width == 0. ) then axis_opts[1] = "uwtivn" else axis_opts[1] = "uwxvn" end else if ( cont_color == 0 ) or ( cont_width == 0. ) then axis_opts[1] = "uwtivm" else axis_opts[1] = "uwxvm" end end label[1] = string.format( "%s, %s", colorbar_position_option_labels[position_i+1], colorbar_label_option_labels[label_i+1] ) -- Smaller text pl.schr( 0.0, 0.75 ) -- Small ticks on the vertical axis pl.smaj( 0.0, 0.5 ) pl.smin( 0.0, 0.5 ) pl.vpor( 0.20, 0.80, 0.20, 0.80 ) pl.wind( 0.0, 1.0, 0.0, 1.0 ) -- Set interesting background colour. pl.scol0a( 15, 0, 0, 0, 0.20 ); colorbar_width, colorbar_height = pl.colorbar( lor(opt, lor(pl.PL_COLORBAR_BOUNDING_BOX, pl.PL_COLORBAR_BACKGROUND)), position, x, y, x_length, y_length, 15, 1, 1, low_cap_color, high_cap_color, cont_color, cont_width, label_opts, label, axis_opts, ticks, sub_ticks, n_values_array, values_array ) -- Reset text and tick sizes pl.schr( 0.0, 1.0 ) pl.smaj( 0.0, 1.0 ) pl.smin( 0.0, 1.0 ) end -- Draw a page title title = string.format( "%s - %s", colorbar_option_kind_labels[kind_i+1], colorbar_cap_option_labels[cap_i+1] ) pl.vpor( 0.0, 1.0, 0.0, 1.0 ) pl.wind( 0.0, 1.0, 0.0, 1.0 ) pl.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ) end function plcolorbar_example( palette, kind_i, cont_color, cont_width, n_values, values ) -- Load the color palette pl.spal1( palette, 1 ) for label_i = 0, COLORBAR_LABELS-1 do for cap_i = 0, COLORBAR_CAPS-1 do plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ) end end end ---------------------------------------------------------------------------- -- main ---------------------------------------------------------------------------- position_options = { lor(pl.PL_POSITION_LEFT, lor(pl.PL_POSITION_TOP , pl.PL_POSITION_OUTSIDE)), lor(pl.PL_POSITION_TOP, pl.PL_POSITION_OUTSIDE), lor(pl.PL_POSITION_RIGHT, lor(pl.PL_POSITION_TOP, pl.PL_POSITION_OUTSIDE)), lor(pl.PL_POSITION_RIGHT, pl.PL_POSITION_OUTSIDE), lor(pl.PL_POSITION_RIGHT, lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_OUTSIDE)), lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_OUTSIDE), lor(pl.PL_POSITION_LEFT, lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_OUTSIDE)), lor(pl.PL_POSITION_LEFT, pl.PL_POSITION_OUTSIDE), lor(pl.PL_POSITION_LEFT, lor(pl.PL_POSITION_TOP, pl.PL_POSITION_INSIDE)), lor(pl.PL_POSITION_TOP, pl.PL_POSITION_INSIDE), lor(pl.PL_POSITION_RIGHT, lor(pl.PL_POSITION_TOP, pl.PL_POSITION_INSIDE)), lor(pl.PL_POSITION_RIGHT, pl.PL_POSITION_INSIDE), lor(pl.PL_POSITION_RIGHT, lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_INSIDE)), lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_INSIDE), lor(pl.PL_POSITION_LEFT, lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_INSIDE)), lor(pl.PL_POSITION_LEFT, pl.PL_POSITION_INSIDE) } -- Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). special_symbols = { "✰", "✴", "✱", "✽", "✦" } -- plcolorbar options COLORBAR_KINDS = 4 -- Colorbar type options colorbar_option_kinds = { pl.PL_COLORBAR_SHADE, lor(pl.PL_COLORBAR_SHADE, pl.PL_COLORBAR_SHADE_LABEL), pl.PL_COLORBAR_IMAGE, pl.PL_COLORBAR_GRADIENT } colorbar_option_kind_labels = { "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars" } -- Which side of the page are we positioned relative to? COLORBAR_POSITIONS = 4 colorbar_position_options = { pl.PL_POSITION_LEFT, pl.PL_POSITION_RIGHT, pl.PL_POSITION_TOP, pl.PL_POSITION_BOTTOM } colorbar_position_option_labels = { "Left", "Right", "Top", "Bottom" } -- Colorbar label positioning options COLORBAR_LABELS = 4 colorbar_label_options = { pl.PL_COLORBAR_LABEL_LEFT, pl.PL_COLORBAR_LABEL_RIGHT, pl.PL_COLORBAR_LABEL_TOP, pl.PL_COLORBAR_LABEL_BOTTOM } colorbar_label_option_labels = { "Label left", "Label right", "Label top", "Label bottom" } -- Colorbar cap options COLORBAR_CAPS = 4 colorbar_cap_options = { pl.PL_COLORBAR_CAP_NONE, pl.PL_COLORBAR_CAP_LOW, pl.PL_COLORBAR_CAP_HIGH, lor(pl.PL_COLORBAR_CAP_LOW, pl.PL_COLORBAR_CAP_HIGH) } colorbar_cap_option_labels = { "No caps", "Low cap", "High cap", "Low and high caps" } -- Parse and process command line arguments pl.parseopts(arg, pl.PL_PARSE_FULL) -- Initialize plplot pl.init() -- First page illustrating the 16 standard positions. pl.adv(0) pl.vpor(0.25, 0.75, 0.25, 0.75) pl.wind(0.0, 1.0, 0.0, 1.0) pl.box("bc", 0.0, 0, "bc", 0.0, 0) pl.sfont(pl.PL_FCI_SANS, -1, -1) pl.mtex("t", 8.0, 0.5, 0.5, "The 16 standard legend positions with") pl.mtex("t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y") nlegend = 1 -- Set up legend arrays with the correct size, type. initialize_pllegend_arrays(nlegend) -- Only specify legend data that are required according to the -- value of opt_array for that entry. opt_base = lor(pl.PL_LEGEND_BACKGROUND, pl.PL_LEGEND_BOUNDING_BOX) opt_array[1] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) line_styles[1] = 1 line_widths[1] = 1. symbol_scales[1] = 1.0 symbol_numbers[1] = 4 symbols[1] = "*" -- Use monotype fonts so that all legends are the same size. pl.sfont(pl.PL_FCI_MONO, -1, -1) pl.scol0a( 15, 32, 32, 32, 0.70 ) for k=0,15 do position = position_options[k+1] opt = opt_base text[1] = string.format("%2.2d", k) text_colors[1] = 1 + (k % 8) line_colors[1] = 1 + (k % 8) symbol_colors[1] = 1 + (k % 8) legend_width, legend_height = pl.legend( opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) end -- Second page illustrating effect of nrow, ncolumn for the same legend -- data pl.adv(0) pl.vpor(0.25, 0.75, 0.25, 0.75) pl.wind(0.0, 1.0, 0.0, 1.0) pl.box("bc", 0.0, 0, "bc", 0.0, 0) pl.sfont(pl.PL_FCI_SANS, -1, -1) pl.mtex("t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,") pl.mtex("t", 6.0, 0.5, 0.5, "and position for the same legend data") -- Set up legend arrays with the correct size, type. nlegend = 7 initialize_pllegend_arrays(nlegend) -- Only specify legend data that are required according to the -- value of opt_array for that entry. opt_base = lor(pl.PL_LEGEND_BACKGROUND, pl.PL_LEGEND_BOUNDING_BOX) for k = 0, nlegend-1 do opt_array[k+1] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) line_styles[k+1] = 1 line_widths[k+1] = 1. symbol_scales[k+1] = 1.0 symbol_numbers[k+1] = 2 symbols[k+1] = "*" text[k+1] = string.format("%2.2d", k) text_colors[k+1] = 1 + (k % 8) line_colors[k+1] = 1 + (k % 8) symbol_colors[k+1] = 1 + (k % 8) end -- Use monotype fonts so that all legends are the same size. pl.sfont(pl.PL_FCI_MONO, -1, -1) pl.scol0a( 15, 32, 32, 32, 0.70 ) position = lor(pl.PL_POSITION_TOP, pl.PL_POSITION_OUTSIDE) opt = opt_base x = 0. y = 0.1 nrow = 1 ncolumn = nlegend legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_OUTSIDE) opt = opt_base x = 0. y = 0.1 nrow = 1 ncolumn = nlegend legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = lor(pl.PL_POSITION_LEFT, pl.PL_POSITION_OUTSIDE) opt = opt_base x = 0.1 y = 0. nrow = nlegend ncolumn = 1 legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = lor(pl.PL_POSITION_RIGHT, pl.PL_POSITION_OUTSIDE) opt = opt_base x = 0.1 y = 0. nrow = nlegend ncolumn = 1 legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = lor(pl.PL_POSITION_LEFT, lor(pl.PL_POSITION_TOP, pl.PL_POSITION_INSIDE)) opt = opt_base x = 0. y = 0. nrow = 6 ncolumn = 2 legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = lor(pl.PL_POSITION_RIGHT, lor(pl.PL_POSITION_TOP, pl.PL_POSITION_INSIDE)) opt = lor(opt_base, pl.PL_LEGEND_ROW_MAJOR) x = 0. y = 0. nrow = 6 ncolumn = 2 legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = lor(pl.PL_POSITION_BOTTOM, pl.PL_POSITION_INSIDE) opt = lor(opt_base, pl.PL_LEGEND_ROW_MAJOR) x = 0. y = 0. nrow = 3 ncolumn = 3 legend_width, legend_height = pl.legend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) -- Third page demonstrating legend alignment pl.adv(0) pl.vpor(0.0, 1.0, 0.0, 0.9) pl.wind(0.0, 1.0, 0.0, 1.0) pl.sfont(pl.PL_FCI_SANS, -1, -1) pl.mtex("t", 2.0, 0.5, 0.5, "Demonstrate legend alignment") x = 0.1 y = 0.1 nturn = 4 nlegend = 0 position = lor(pl.PL_POSITION_TOP, lor(pl.PL_POSITION_LEFT, pl.PL_POSITION_SUBPAGE)) opt_base = lor(pl.PL_LEGEND_BACKGROUND, pl.PL_LEGEND_BOUNDING_BOX) opt = opt_base for i=0,8 do -- Set up legend arrays with the correct size, type. if i <= nturn then nlegend = nlegend + 1 else nlegend = nlegend - 1 end nlegend = math.max(1, nlegend) initialize_pllegend_arrays(nlegend) -- Only specify legend data that are required according to the -- value of opt_array for that entry. for k = 0, nlegend-1 do opt_array[k+1] = lor(pl.PL_LEGEND_LINE, pl.PL_LEGEND_SYMBOL) line_styles[k+1] = 1 line_widths[k+1] = 1. symbol_scales[k+1] = 1.0 symbol_numbers[k+1] = 2 symbols[k+1] = "*" text[k+1] = string.format("%2.2d", k) text_colors[k+1] = 1 + (k % 8) line_colors[k+1] = 1 + (k % 8) symbol_colors[k+1] = 1 + (k % 8) end -- Use monotype fonts so that all legends are the same size. pl.sfont(pl.PL_FCI_MONO, -1, -1) pl.scol0a( 15, 32, 32, 32, 0.70 ) nrow = math.min(3, nlegend) ncolumn = 0 legend_width, legend_height = pl.legend( opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5, 1.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) if i==nturn then position = lor(pl.PL_POSITION_TOP, lor(pl.PL_POSITION_RIGHT, pl.PL_POSITION_SUBPAGE)) opt = opt_base x = 1.0 - x y = y + legend_height else x = x + legend_width y = y + legend_height end end -- Fourth page illustrating various kinds of legends max_height = 0. xstart = 0.0 ystart = 0.1 x = xstart y = ystart text_scale = 0.90 pl.adv(0) pl.vpor(0.0, 1.0, 0.0, 0.90) pl.wind(0.0, 1.0, 0.0, 1.0) -- pl.box("bc", 0.0, 0, "bc", 0.0, 0) pl.sfont(pl.PL_FCI_SANS, -1, -1) pl.mtex("t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends") -- Set up legend arrays with the correct size, type. nlegend = 5 initialize_pllegend_arrays(nlegend) -- Only specify legend data that are required according to the -- value of opt_array for that entry. position = lor(pl.PL_POSITION_LEFT, pl.PL_POSITION_TOP) opt_base = lor(pl.PL_LEGEND_BACKGROUND, lor(pl.PL_LEGEND_BOUNDING_BOX, pl.PL_LEGEND_TEXT_LEFT)) -- Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array[1] = pl.PL_LEGEND_NONE text[1] = "None" text_colors[1] = 1 opt_array[2] = pl.PL_LEGEND_COLOR_BOX text[2] = "Box" text_colors[2] = 2 box_colors[2] = 2 box_patterns[2] = 0 box_scales[2] = 0.8 box_line_widths[2] = 1. opt_array[3] = pl.PL_LEGEND_LINE text[3] = "Line" text_colors[3] = 3 line_colors[3] = 3 line_styles[3] = 1 line_widths[3] = 1. opt_array[4] = pl.PL_LEGEND_SYMBOL text[4] = "Symbol" text_colors[4] = 4 symbol_colors[4] = 4 symbol_scales[4] = text_scale symbol_numbers[4] = 4 symbols[4] = special_symbols[3] opt_array[5] = lor(pl.PL_LEGEND_SYMBOL, pl.PL_LEGEND_LINE) text[5] = "L & S" text_colors[5] = 5 line_colors[5] = 5 line_styles[5] = 1 line_widths[5] = 1. symbol_colors[5] = 5 symbol_scales[5] = text_scale symbol_numbers[5] = 4 symbols[5] = special_symbols[3] opt = opt_base pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) -- Set up symbol legend entries with various symbols. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_SYMBOL text[i+1] = "Symbol " .. special_symbols[i+1] text_colors[i+1] = i+1 symbol_colors[i+1] = i+1 symbol_scales[i+1] = text_scale symbol_numbers[i+1] = 4 symbols[i+1] = special_symbols[i+1] end opt = opt_base x = x + legend_width pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up symbol legend entries with various numbers of symbols. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_SYMBOL text[i+1] = string.format("Symbol Number %d", i+2) text_colors[i+1] = i+1 symbol_colors[i+1] = i+1 symbol_scales[i+1] = text_scale symbol_numbers[i+1] = i+2 symbols[i+1] = special_symbols[3] end opt = opt_base x = x + legend_width pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up box legend entries with various colours. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_COLOR_BOX text[i+1] = string.format("%s %d", "Box Color", i+1) text_colors[i+1] = i+1 box_colors[i+1] = i+1 box_patterns[i+1] = 0 box_scales[i+1] = 0.8 box_line_widths[i+1] = 1. end opt = opt_base -- Use new origin x = xstart y = y + max_height max_height = 0 pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up box legend entries with various patterns. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_COLOR_BOX text[i+1] = string.format("%s %d", "Box Pattern", i) text_colors[i+1] = 2 box_colors[i+1] = 2 box_patterns[i+1] = i box_scales[i+1] = 0.8 box_line_widths[i+1] = 1. end opt = opt_base x = x + legend_width pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up box legend entries with various pattern line widths. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_COLOR_BOX text[i+1] = string.format("%s %d", "Box Line Width", i+1) text_colors[i+1] = 2 box_colors[i+1] = 2 box_patterns[i+1] = 3 box_scales[i+1] = 0.8 box_line_widths[i+1] = i+1 end opt = opt_base x = x + legend_width pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up line legend entries with various colours. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_LINE text[i+1] = string.format("%s %d", "Line Color", i+1) text_colors[i+1] = i+1 line_colors[i+1] = i+1 line_styles[i+1] = 1 line_widths[i+1] = 1. end opt = opt_base -- Use new origin x = xstart y = y + max_height max_height = 0 pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up line legend entries with various styles. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_LINE text[i+1] = string.format("%s %d", "Line Style", i+1) text_colors[i+1] = 2 line_colors[i+1] = 2 line_styles[i+1] = i+1 line_widths[i+1] = 1. end opt = opt_base x = x + legend_width pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Set up line legend entries with various widths. for i=0,nlegend-1 do opt_array[i+1] = pl.PL_LEGEND_LINE text[i+1] = string.format("%s %d", "Line Width", i+1) text_colors[i+1] = 2 line_colors[i+1] = 2 line_styles[i+1] = 1 line_widths[i+1] = i+1 end opt = opt_base x = x + legend_width pl.scol0a( 15, 32, 32, 32, 0.70 ) legend_width, legend_height = pl.legend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = math.max(max_height, legend_height) -- Color bar examples values_small = { -1.0e-200, 1.0e-200 } values_uneven = { -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 } values_even = { -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 } -- Use unsaturated green background colour to contrast with black caps. pl.scolbg( 70, 185, 70 ) -- Cut out the greatest and smallest bits of the color spectrum to -- leave colors for the end caps. pl.scmap1_range( 0.01, 0.99 ) -- We can only test image and gradient colorbars with two element arrays for i = 2, COLORBAR_KINDS-1 do plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ) end -- Test shade colorbars with larger arrays for i = 0,1 do plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ) end for i = 0,1 do plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ) end pl.plend() plplot-5.10.0+dfsg/examples/lua/x21.lua 644 1750 1750 1447512140621721 164730ustar andrewandrew--[[ $Id: x21.lua 12331 2013-05-03 02:41:21Z airwin $ Grid data demo Copyright (C) 200 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") -- bitwise or operator from http://lua-users.org/wiki/BaseSixtyFour -- (c) 2006-2008 by Alex Kloss -- licensed under the terms of the LGPL2 -- return single bit (for OR) function bit(x,b) return ((x % 2^b) - (x % 2^(b-1)) > 0) end -- logic OR for number values function lor(x,y) result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end -- Options data structure definition. pts = 500 xp = 25 yp = 20 nl = 16 knn_order = 20 threshold = 1.001 wmin = -1e3 randn = 0 rosen = 0 function cmap1_init() i = { 0, 1 } -- left and right boundary h = { 240, 0 } -- blue -> green -> yellow -> red l = { 0.6, 0.6 } s = { 0.8, 0.8 } pl.scmap1n(256) pl.scmap1l(0, i, h, l, s) end function create_grid(px, py) local x = {} local y = {} for i = 1, px do x[i] = xm + (xM-xm)*(i-1)/(px-1) end for i = 1, py do y[i] = ym + (yM-ym)*(i-1)/(py-1) end return x, y end function create_data(pts) local x = {} local y = {} local z = {} for i = 1, pts do xt = (xM-xm)*pl.randd() yt = (yM-ym)*pl.randd() if randn==0 then x[i] = xt + xm y[i] = yt + ym else -- std=1, meaning that many points are outside the plot range x[i] = math.sqrt(-2*math.log(xt)) * math.cos(2*math.pi*yt) + xm y[i] = math.sqrt(-2*math.log(xt)) * math.sin(2*math.pi*yt) + ym end if rosen==0 then r = math.sqrt(x[i]^2 + y[i]^2) z[i] = math.exp(-r^2) * math.cos(2*math.pi*r) else z[i] = math.log((1-x[i])^2 + 100*(y[i] - x[i]^2)^2) end end return x, y, z end title = { "Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted" } xm = -0.2 ym = -0.2 xM = 0.6 yM = 0.6 pl.parseopts(arg, pl.PL_PARSE_FULL) opt = { 0, 0, wmin, knn_order, threshold, 0 } -- Initialize plplot pl.init() cmap1_init() -- Initialise random number generator pl.seed(5489) x, y, z = create_data(pts) -- the sampled data zmin = z[1] zmax = z[1] for i=2, pts do if z[i]>zmax then zmax = z[i] end if z[i]=1 and jj>=1 and zg[ii][jj]==zg[ii][jj] then if (math.abs(ii-i) + math.abs(jj-j)) == 1 then d = 1 else d = 1.4142 end zg[i][j] = zg[i][j] + zg[ii][jj]/(d^2) dist = dist + d end end end end end if dist~=0 then zg[i][j] = zg[i][j]/dist else zg[i][j] = zmin end end end end end lzM, lzm = pl.MinMax2dGrid(zg) if lzm~=lzm then lzm=zmin else lzm = math.min(lzm, zmin) end if lzM~=lzM then lzM=zmax else lzM = math.max(lzM, zmax) end -- Increase limits slightly to prevent spurious contours -- due to rounding errors lzm = lzm-0.01 lzM = lzM+0.01 pl.col0(1) pl.adv(alg) if k==1 then for i = 1, nl do clev[i] = lzm + (lzM-lzm)/(nl-1)*(i-1) end pl.env0(xm, xM, ym, yM, 2, 0) pl.col0(15) pl.lab("X", "Y", title[alg]) pl.shades(zg, xm, xM, ym, yM, clev, 1., 0, 1., 1) pl.col0(2) else for i = 1, nl do clev[i] = lzm + (lzM-lzm)/(nl-1)*(i-1) end pl.vpor(0, 1, 0, 0.9) pl.wind(-1.1, 0.75, -0.65, 1.20) -- For the comparison to be fair, all plots should have the -- same z values, but to get the max/min of the data generated -- by all algorithms would imply two passes. Keep it simple. -- -- pl.w3d(1, 1, 1, xm, xM, ym, yM, zmin, zmax, 30, -60) pl.w3d(1, 1, 1, xm, xM, ym, yM, lzm, lzM, 30, -40) pl.box3("bntu", "X", 0, 0, "bntu", "Y", 0, 0, "bcdfntu", "Z", 0.5, 0) pl.col0(15) pl.lab("", "", title[alg]) pl.plot3dc(xg, yg, zg, lor(lor(pl.DRAW_LINEXY, pl.MAG_COLOR), pl.BASE_CONT), clev) end end end pl.plend() plplot-5.10.0+dfsg/examples/lua/x31.lua 644 1750 1750 1554311543675237 165120ustar andrewandrew--[[ $Id: x31.lua 11680 2011-03-27 17:57:51Z airwin $ Copyright (C) 2008 Werner Smekal set/get tester This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") r1 = { 0, 255 } g1 = { 255, 0 } b1 = { 0, 0 } a1 = { 1, 1 } -- Parse and process command line arguments status = 0 pl.parseopts(arg, pl.PL_PARSE_FULL) -- Test setting / getting familying parameters before plinit -- Save values set by plparseopts to be restored later. fam0, num0, bmax0 = pl.gfam() fam1 = 0 num1 = 10 bmax1 = 1000 pl.sfam(fam1, num1, bmax1) -- Retrieve the same values? fam2, num2, bmax2 = pl.gfam() print(string.format("family parameters: fam, num, bmax = %d %d %d", fam2, num2, bmax2)) if fam2~=fam1 or num2~=num1 or bmax2~=bmax1 then io.stderr:write("plgfam test failed\n") status = 1 end -- Restore values set initially by plparseopts. pl.sfam(fam0, num0, bmax0) -- Test setting / getting page parameters before plinit -- Save values set by plparseopts to be restored later. xp0, yp0, xleng0, yleng0, xoff0, yoff0 = pl.gpage() xp1 = 200. yp1 = 200. xleng1 = 400 yleng1 = 200 xoff1 = 10 yoff1 = 20 pl.spage(xp1, yp1, xleng1, yleng1, xoff1, yoff1) -- Retrieve the same values? xp2, yp2, xleng2, yleng2, xoff2, yoff2 = pl.gpage() print(string.format("page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d", xp2, yp2, xleng2, yleng2, xoff2, yoff2)) if xp2~=xp1 or yp2~=yp1 or xleng2~=xleng1 or yleng2~=yleng1 or xoff2~=xoff1 or yoff2~=yoff1 then io.stderr:write("plgpage test failed\n") status = 1 end -- Restore values set initially by plparseopts. pl.spage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) -- Test setting / getting compression parameter across plinit. compression1 = 95 pl.scompression(compression1) -- Initialize plplot pl.init() -- Test if device initialization screwed around with the preset -- compression parameter. compression2 = pl.gcompression() print("Output various PLplot parameters") print("compression parameter = " .. compression2) if compression2~=compression1 then io.stderr:write("plgcompression test failed\n") status = 1 end -- Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure --they work without any obvious error messages. pl.scolor(1) pl.scol0(1, 255, 0, 0) pl.scmap1(r1, g1, b1) pl.scmap1a(r1, g1, b1, a1) level2 = pl.glevel() print("level parameter = " .. level2) if level2~=1 then io.stderr:write("plglevel test failed.\n") status = 1 end pl.adv(0) pl.vpor(0.01, 0.99, 0.02, 0.49) xmin, xmax, ymin, ymax = pl.gvpd() print(string.format("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f", xmin, xmax, ymin, ymax)) if xmin~=0.01 or xmax~=0.99 or ymin~=0.02 or ymax~=0.49 then io.stderr:write("plgvpd test failed\n") status = 1 end xmid = 0.5*(xmin+xmax) ymid = 0.5*(ymin+ymax) pl.wind(0.2, 0.3, 0.4, 0.5) xmin, xmax, ymin, ymax = pl.gvpw() print(string.format("plwind: xmin, xmax, ymin, ymax = %f %f %f %f", xmin, xmax, ymin, ymax)) if xmin~=0.2 or xmax~=0.3 or ymin~=0.4 or ymax~=0.5 then io.stderr:write("plgvpw test failed\n") status = 1 end -- Get world coordinates for middle of viewport wx, wy, win = pl.calc_world(xmid,ymid) print(string.format("world parameters: wx, wy, win = %f %f %d", wx, wy, win)) if math.abs(wx-0.5*(xmin+xmax))>1.0e-5 or math.abs(wy-0.5*(ymin+ymax))>1.0e-5 then io.stderr:write("plcalc_world test failed\n") status = 1 end -- Retrieve and print the name of the output file (if any). -- This goes to stderr not stdout since it will vary between tests and -- we want stdout to be identical for compare test. fnam = pl.gfnam() if fnam=="" then print("No output file name is set") else print("Output file name read") end io.stderr:write(string.format("Output file name is %s\n",fnam)) -- Set and get the number of digits used to display axis labels -- Note digits is currently ignored in pls[xyz]ax and -- therefore it does not make sense to test the returned -- value pl.sxax(3,0) digmax, digits = pl.gxax() print(string.format("x axis parameters: digmax, digits = %d %d", digmax, digits)) if digmax~=3 then io.stderr:write("plgxax test failed\n") status = 1 end pl.syax(4,0) digmax, digits = pl.gyax() print(string.format("y axis parameters: digmax, digits = %d %d", digmax, digits)) if digmax~=4 then io.stderr:write("plgyax test failed\n") status = 1 end pl.szax(5,0) digmax,digits = pl.gzax() print(string.format("z axis parameters: digmax, digits = %d %d", digmax, digits)) if digmax~=5 then io.stderr:write("plgzax test failed\n") status = 1 end pl.sdidev(0.05, pl.PL_NOTSET, 0.1, 0.2) mar, aspect, jx, jy = pl.gdidev() print(string.format("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f" , mar, aspect, jx, jy)) if mar~=0.05 or jx~=0.1 or jy~=0.2 then io.stderr:write("plgdidev test failed\n") status = 1 end pl.sdiori(1.0) ori = pl.gdiori() print(string.format("ori parameter = %f", ori)) if ori~=1.0 then io.stderr:write("plgdiori test failed\n") status = 1 end pl.sdiplt(0.1, 0.2, 0.9, 0.8) xmin, ymin, xmax, ymax = pl.gdiplt() print(string.format("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f", xmin, ymin, xmax, ymax)) if xmin~=0.1 or xmax~=0.9 or ymin~=0.2 or ymax~=0.8 then io.stderr:write("plgdiplt test failed\n") status = 1 end pl.sdiplz(0.1, 0.1, 0.9, 0.9) zxmin, zymin, zxmax, zymax = pl.gdiplt() print(string.format("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f", zxmin, zymin, zxmax, zymax)) if math.abs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0e-5 or math.abs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0e-5 or math.abs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0e-5 or math.abs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0e-5 then io.stderr:write("plsdiplz test failed\n") status = 1 end pl.scolbg(10, 20, 30) r, g, b = pl.gcolbg() print(string.format("background colour parameters: r, g, b = %d %d %d", r, g, b)) if r~=10 or g~=20 or b~=30 then io.stderr:write("plgcolbg test failed\n") status = 1 end pl.scolbga(20, 30, 40, 0.5) r, g, b, a = pl.gcolbga() print(string.format("background/transparency colour parameters: r, g, b, a = %d %d %d %f", r, g, b, a)) if r~=20 or g~=30 or b~=40 or a~=0.5 then io.stderr:write("plgcolbga test failed\n") status = 1 end pl.plend() plplot-5.10.0+dfsg/examples/lua/x30.lua 644 1750 1750 646411717262764 164730ustar andrewandrew--[[ $Id: x30.lua 12167 2012-02-16 20:24:20Z airwin $ Alpha color values demonstration. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") red = { 0, 255, 0, 0 } green = { 0, 0, 255, 0 } blue = { 0, 0, 0, 255 } alpha = { 1, 1, 1, 1 } px = { 0.1, 0.5, 0.5, 0.1 } py = { 0.1, 0.1, 0.5, 0.5 } pos = { 0, 1 } rcoord = { 1, 1 } gcoord = { 0, 0 } bcoord = { 0, 0 } acoord = { 0, 1 } rev = { 0, 0 } pl.parseopts (arg, pl.PL_PARSE_FULL); pl.init() pl.scmap0n(4) pl.scmap0a(red, green, blue, alpha) -- Page 1: -- -- This is a series of red, green and blue rectangles overlaid -- on each other with gradually increasing transparency. -- Set up the window pl.adv(0) pl.vpor(0, 1, 0, 1) pl.wind(0, 1, 0, 1) pl.col0(0) pl.box("", 1, 0, "", 1, 0) -- Draw the boxes for i = 0, 8 do icol = (i % 3) + 1 -- Get a color, change its transparency and -- set it as the current color. r, g, b, a = pl.gcol0a(icol) pl.scol0a(icol, r, g, b, 1-i/9) pl.col0(icol) -- Draw the rectangle pl.fill(px, py) -- Shift the rectangles coordinates for j = 1, 4 do px[j] = px[j] + 0.5/9 py[j] = py[j] + 0.5/9 end end -- Page 2: -- This is a bunch of boxes colored red, green or blue with a single -- large (red) box of linearly varying transparency overlaid. The -- overlaid box is completely transparent at the bottom and completely -- opaque at the top. -- Set up the window pl.adv(0) pl.vpor(0.1, 0.9, 0.1, 0.9) pl.wind(0.0, 1.0, 0.0, 1.0) -- Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for i = 0, 4 do -- Set box X position px[1] = 0.05 + 0.2 * i px[2] = px[1] + 0.1 px[3] = px[2] px[4] = px[1] -- We don't want the boxes to be transparent, so since we changed -- the colors transparencies in the first example we have to change -- the transparencies back to completely opaque. icol = (i % 3) + 1 r, g, b, a = pl.gcol0a(icol) pl.scol0a(icol, r, g, b, 1) pl.col0(icol) for j = 0, 4 do -- Set box y position and draw the box. py[1] = 0.05 + 0.2 * j py[2] = py[1] py[3] = py[1] + 0.1 py[4] = py[3] pl.fill(px, py) end end -- Create the color map with 128 colors and use plscmap1la to initialize -- the color values with a linearly varying red transparency (or alpha) pl.scmap1n(128) pl.scmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev) -- Use that cmap1 to create a transparent red gradient for the whole -- window. px[1] = 0. px[2] = 1. px[3] = 1. px[4] = 0. py[1] = 0. py[2] = 0. py[3] = 1. py[4] = 1. pl.gradient(px, py, 90.) pl.plend() plplot-5.10.0+dfsg/examples/lua/x19.lua 644 1750 1750 1040312221050115 164560ustar andrewandrew--[[ $Id: x19.lua 12532 2013-09-26 15:18:37Z andrewross $ Illustrates backdrop plotting of world, US maps. Contributed by Wesley Ebisuzaki. Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") function map_transform(x,y) radius = 90 - y xt = radius * math.cos(x * math.pi / 180) yt = radius * math.sin(x * math.pi / 180) return xt, yt end -------------------------------------------------------------------------- -- mapform19 -- -- Defines specific coordinate transformation for example 19. -- Not to be confused with mapform in src/plmap.c. -- x[], y[] are the coordinates to be plotted. -------------------------------------------------------------------------- function mapform19(n, x, y) for i = 1, n do x[i], y[i] = map_transform(x[i], y[i]) end return x, y end -- "Normalize" longitude values so that they always fall between -- -180.0 and 180.0 function normalize_longitude(lon) if lon>=-180 and lon<=180 then return lon; else times = math.floor((math.abs(lon)+180)/360) if lon<0 then return lon+360*times else return lon-360*times end end end -- A custom axis labeling function for longitudes and latitudes. function geolocation_labeler(axis, value) if axis==pl.PL_Y_AXIS then label_val = value if label_val>0 then direction_label = " N" else if label_val<0 then direction_label = " S" else direction_label = "Eq" end end else if axis==pl.PL_X_AXIS then label_val = normalize_longitude(value); if label_val>0 then direction_label = " E" else if label_val<0 then direction_label = " W" else direction_label = "" end end end end if axis==pl.PL_Y_AXIS and value==0 then -- A special case for the equator label = direction_label else label = math.abs(label_val) .. direction_label end return label end -------------------------------------------------------------------------- -- main -- -- Shows two views of the world map. -------------------------------------------------------------------------- -- Parse and process command line arguments x = {} y = {} pl.parseopts(arg, pl.PL_PARSE_FULL) -- Longitude (x) and latitude (y) miny = -70 maxy = 80 pl.init() -- Cartesian plots -- Most of world minx = -170 maxx = minx+360 -- Setup a custom latitude and longitude-based scaling function. pl.slabelfunc("geolocation_labeler"); pl.col0(1) pl.env(minx, maxx, miny, maxy, 1, 70) pl.map(nil, "usaglobe", minx, maxx, miny, maxy) -- The Americas minx = 190 maxx = 340 pl.col0(1) pl.env(minx, maxx, miny, maxy, 1, 70) pl.map(nil, "usaglobe", minx, maxx, miny, maxy) -- Clear the labeling function pl.slabelfunc(nil); -- Polar, Northern hemisphere minx = 0 maxx = 360 pl.env(-75., 75., -75., 75., 1, -1) pl.map("mapform19", "globe", minx, maxx, miny, maxy) pl.lsty(2) pl.meridians("mapform19", 10, 10, 0, 360, -10, 80) -- Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0 maxx = 360 pl.stransform( "map_transform" ) pl.lsty( 1 ) pl.env( -75., 75., -75., 75., 1, -1 ) -- No need to set the map transform here as the global transform will be -- used. pl.map( nil, "globe", minx, maxx, miny, maxy ) pl.lsty( 2 ); pl.meridians( nil, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ) -- Show Baltimore, MD on the map pl.col0( 2 ) pl.ssym( 0.0, 2.0 ) x[1] = -76.6125 y[1] = 39.2902778 pl.poin( x, y, 18 ) pl.ssym( 0.0, 1.0 ) pl.ptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ) -- For C, this is how the global transform is cleared pl.stransform( ); pl.plend() plplot-5.10.0+dfsg/examples/lua/x24.lua 644 1750 1750 540511543675237 164700ustar andrewandrew--[[ $Id: x24.lua 11680 2011-03-27 17:57:51Z airwin $ Unicode Pace Flag Copyright (C) 2008 Werner Smekal This file is part of PLplot. PLplot is free software you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In Debian, run like this: ( TTFDIR=/usr/share/fonts/truetype \ PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \ PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \ PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \ PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \ PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \ ./x24c -dev png -drvopt smooth=0 -o x24c.png ) Packages needed: ttf-arphic-bkai00mp ttf-freefont ttf-devanagari-fonts ttf-unfonts ttf-bengali-fonts --]] -- initialise Lua bindings for PLplot examples. dofile("plplot_examples.lua") red = { 240, 204, 204, 204, 0, 39, 125 } green = { 240, 0, 125, 204, 204, 80, 0 } blue = { 240, 0, 0, 0, 0, 204, 125 } px = { 0, 0, 1, 1 } py = { 0, 0.25, 0.25, 0 } sx = { 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 } sy = { 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 } -- Taken from http://www.columbia.edu/~fdc/pace/ peace = { -- Mandarin "#<0x00>和平", -- Hindi "#<0x20>शांति", -- English "#<0x10>Peace", -- Hebrew "#<0x10>שלום", -- Russian "#<0x10>Мир", -- German "#<0x10>Friede", -- Korean "#<0x30>평화", -- French "#<0x10>Paix", -- Spanish "#<0x10>Paz", -- Arabic "#<0x10>ﺳﻼم", -- Turkish "#<0x10>Barış", -- Kurdish "#<0x10>Hasîtî", } pl.parseopts(arg, pl.PL_PARSE_FULL) pl.init() pl.adv(0) pl.vpor(0, 1, 0, 1) pl.wind(0, 1, 0, 1) pl.col0(0) pl.box("", 1, 0, "", 1, 0) pl.scmap0n(7) pl.scmap0(red, green, blue) pl.schr(0, 4) pl.font(1) for i = 1, 4 do pl.col0(i) pl.fill(px, py) for j = 1, 4 do py[j] = py[j] + 1/4 end end pl.col0(0) for i = 1, 12 do pl.ptex(sx[i], sy[i], 1, 0, 0.5, peace[i]) end pl.plend() plplot-5.10.0+dfsg/examples/c/ 775 1750 1750 012406243570 147155ustar andrewandrewplplot-5.10.0+dfsg/examples/c/x26c.c 644 1750 1750 1730512140307134 157370ustar andrewandrew// -*- coding: utf-8; -*- // // $Id: x26c.c 12319 2013-05-01 21:51:24Z airwin $ // // Multi-lingual version of the first page of example 4. // // Copyright (C) 2006 Alan Irwin // Copyright (C) 2006 Andrew Ross // // Thanks to the following for providing translated strings for this example: // Valery Pipin (Russian) // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // // This example designed just for devices (e.g., psttfc and the // cairo-related devices) that use the pango and fontconfig libraries. The // best choice of glyph is selected by fontconfig and automatically rendered // by pango in way that is sensitive to complex text layout (CTL) language // issues for each unicode character in this example. Of course, you must // have the appropriate TrueType fonts installed to have access to all the // required glyphs. // // Translation instructions: The strings to be translated are given by // x_label, y_label, alty_label, title_label, and line_label below. The // encoding used must be UTF-8. // // The following strings to be translated involve some scientific/mathematical // jargon which is now discussed further to help translators. // // (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . // (2) degrees is an angular measure, see // http://en.wikipedia.org/wiki/Degree_(angle) . // (3) low-pass filter is one that transmits (passes) low frequencies. // (4) pole is in the mathematical sense, see // http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" // means a particular mathematical transformation of the filter function has // a single pole, see // http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . // Furthermore, a single-pole filter must have an inverse square decline // (or -20 db/decade). Since the filter plotted here does have that // characteristic, it must by definition be a single-pole filter, see also // http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm // (5) decade represents a factor of 10, see // http://en.wikipedia.org/wiki/Decade_(log_scale) . // #include "plcdemos.h" static const char *x_labels[] = { "Frequency", "Частота", NULL }; static const char *y_labels[] = { "Amplitude (dB)", "Амплитуда (dB)", NULL }; static const char *alty_labels[] = { "Phase shift (degrees)", "Фазовый сдвиг (градусы)", NULL }; // Short rearranged versions of y_label and alty_label. static const char *legend_texts[][2] = { { "Amplitude", "Phase shift" }, { "Амплитуда", "Фазовый сдвиг" } }; static const char *title_labels[] = { "Single Pole Low-Pass Filter", "Однополюсный Низко-Частотный Фильтр", NULL }; static const char *line_labels[] = { "-20 dB/decade", "-20 dB/десяток", NULL }; void plot1( int type, const char *x_label, const char *y_label, const char *alty_label, const char * legend_text[], const char *title_label, const char *line_label ); //-------------------------------------------------------------------------- // main // // Illustration of logarithmic axes, and redefinition of window. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); plfont( 2 ); // Make log plots using two different styles. i = 0; while ( x_labels[i] != NULL ) { plot1( 0, x_labels[i], y_labels[i], alty_labels[i], legend_texts[i], title_labels[i], line_labels[i] ); i++; } plend(); exit( 0 ); } //-------------------------------------------------------------------------- // plot1 // // Log-linear plot. //-------------------------------------------------------------------------- void plot1( int type, const char *x_label, const char *y_label, const char *alty_label, const char * legend_text[], const char *title_label, const char *line_label ) { int i; static PLFLT freql[101], ampl[101], phase[101]; PLFLT f0, freq; PLINT nlegend = 2; PLINT opt_array[2]; PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; const char *symbols[2]; PLFLT legend_width, legend_height; pladv( 0 ); // Set up data for log plot f0 = 1.0; for ( i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, freql[i] ); ampl[i] = 20.0 * log10( 1.0 / sqrt( 1.0 + pow( ( freq / f0 ), 2. ) ) ); phase[i] = -( 180.0 / M_PI ) * atan( freq / f0 ); } plvpor( 0.15, 0.85, 0.1, 0.9 ); plwind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. plcol0( 1 ); switch ( type ) { case 0: plbox( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: plbox( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; } // Plot ampl vs freq plcol0( 2 ); plline( 101, freql, ampl ); plcol0( 2 ); plptex( 1.6, -30.0, 1.0, -20.0, 0.5, line_label ); // Put labels on plcol0( 1 ); plmtex( "b", 3.2, 0.5, 0.5, x_label ); plmtex( "t", 2.0, 0.5, 0.5, title_label ); plcol0( 2 ); plmtex( "l", 5.0, 0.5, 0.5, y_label ); // For the gridless case, put phase vs freq on same plot if ( type == 0 ) { plcol0( 1 ); plwind( -2.0, 3.0, -100.0, 0.0 ); plbox( "", 0.0, 0, "cmstv", 30.0, 3 ); plcol0( 3 ); plline( 101, freql, phase ); plstring( 101, freql, phase, "*" ); plcol0( 3 ); plmtex( "r", 5.0, 0.5, 0.5, alty_label ); } // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices // do not have to be specified // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // from the above opt_arrays we can completely ignore everything // to do with boxes. plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.10, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) legend_text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); } plplot-5.10.0+dfsg/examples/c/x09c.c 644 1750 1750 3252411666362057 157610ustar andrewandrew// $Id: x09c.c 12095 2011-12-03 08:56:15Z andrewross $ // // Contour plot demo. // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" #define XPTS 35 // Data points in x #define YPTS 46 // Data points in y #define XSPA 2. / ( XPTS - 1 ) #define YSPA 2. / ( YPTS - 1 ) // polar plot data #define PERIMETERPTS 100 #define RPTS 40 #define THETAPTS 40 // potential plot data #define PPERIMETERPTS 100 #define PRPTS 40 #define PTHETAPTS 64 #define PNLEVEL 20 static PLFLT clevel[11] = { -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. }; // Transformation function PLFLT tr[6] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; // pltr_data is unused so mark it with the PL_UNUSED macro static void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * PL_UNUSED( pltr_data ) ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } static void polar( void ) //polar contour plot example. { int i, j; PLcGrid2 cgrid2; PLFLT **z; PLFLT px[PERIMETERPTS], py[PERIMETERPTS]; PLFLT t, r, theta; PLFLT lev[10]; plenv( -1., 1., -1., 1., 0, -2 ); plcol0( 1 ); //Perimeter for ( i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * M_PI / ( PERIMETERPTS - 1 ) ) * (double) i; px[i] = cos( t ); py[i] = sin( t ); } plline( PERIMETERPTS, px, py ); //create data to be contoured. plAlloc2dGrid( &cgrid2.xg, RPTS, THETAPTS ); plAlloc2dGrid( &cgrid2.yg, RPTS, THETAPTS ); plAlloc2dGrid( &z, RPTS, THETAPTS ); cgrid2.nx = RPTS; cgrid2.ny = THETAPTS; for ( i = 0; i < RPTS; i++ ) { r = i / (double) ( RPTS - 1 ); for ( j = 0; j < THETAPTS; j++ ) { theta = ( 2. * M_PI / (double) ( THETAPTS - 1 ) ) * (double) j; cgrid2.xg[i][j] = r * cos( theta ); cgrid2.yg[i][j] = r * sin( theta ); z[i][j] = r; } } for ( i = 0; i < 10; i++ ) { lev[i] = 0.05 + 0.10 * (double) i; } plcol0( 2 ); plcont( (const PLFLT * const *) z, RPTS, THETAPTS, 1, RPTS, 1, THETAPTS, lev, 10, pltr2, (void *) &cgrid2 ); plcol0( 1 ); pllab( "", "", "Polar Contour Plot" ); plFree2dGrid( z, RPTS, THETAPTS ); plFree2dGrid( cgrid2.xg, RPTS, THETAPTS ); plFree2dGrid( cgrid2.yg, RPTS, THETAPTS ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- static void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fnmin, PLFLT *fnmax ) { int i, j; *fnmax = f[0][0]; *fnmin = *fnmax; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { *fnmax = MAX( *fnmax, f[i][j] ); *fnmin = MIN( *fnmin, f[i][j] ); } } } static void potential( void ) //shielded potential contour plot example. { int i, j; PLcGrid2 cgrid2; PLFLT rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax; PLFLT peps, xpmin, xpmax, ypmin, ypmax; PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; PLFLT div1, div1i, div2, div2i; PLFLT **z; PLINT nlevelneg, nlevelpos; PLFLT dz, clevel2, clevelneg[PNLEVEL], clevelpos[PNLEVEL]; PLINT ncollin, ncolbox, ncollab; PLFLT px[PPERIMETERPTS], py[PPERIMETERPTS]; PLFLT t, r, theta; //create data to be contoured. plAlloc2dGrid( &cgrid2.xg, PRPTS, PTHETAPTS ); plAlloc2dGrid( &cgrid2.yg, PRPTS, PTHETAPTS ); plAlloc2dGrid( &z, PRPTS, PTHETAPTS ); cgrid2.nx = PRPTS; cgrid2.ny = PTHETAPTS; for ( i = 0; i < PRPTS; i++ ) { r = 0.5 + (double) i; for ( j = 0; j < PTHETAPTS; j++ ) { theta = ( 2. * M_PI / (double) ( PTHETAPTS - 1 ) ) * ( 0.5 + (double) j ); cgrid2.xg[i][j] = r * cos( theta ); cgrid2.yg[i][j] = r * sin( theta ); } } rmax = r; f2mnmx( cgrid2.xg, PRPTS, PTHETAPTS, &xmin, &xmax ); f2mnmx( cgrid2.yg, PRPTS, PTHETAPTS, &ymin, &ymax ); x0 = ( xmin + xmax ) / 2.; y0 = ( ymin + ymax ) / 2.; // Expanded limits peps = 0.05; xpmin = xmin - fabs( xmin ) * peps; xpmax = xmax + fabs( xmax ) * peps; ypmin = ymin - fabs( ymin ) * peps; ypmax = ymax + fabs( ymax ) * peps; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. // eps = 2.; q1 = 1.; d1 = rmax / 4.; q1i = -q1 * rmax / d1; d1i = pow( rmax, 2. ) / d1; q2 = -1.; d2 = rmax / 4.; q2i = -q2 * rmax / d2; d2i = pow( rmax, 2. ) / d2; for ( i = 0; i < PRPTS; i++ ) { for ( j = 0; j < PTHETAPTS; j++ ) { div1 = sqrt( pow( cgrid2.xg[i][j] - d1, 2. ) + pow( cgrid2.yg[i][j] - d1, 2. ) + pow( eps, 2. ) ); div1i = sqrt( pow( cgrid2.xg[i][j] - d1i, 2. ) + pow( cgrid2.yg[i][j] - d1i, 2. ) + pow( eps, 2. ) ); div2 = sqrt( pow( cgrid2.xg[i][j] - d2, 2. ) + pow( cgrid2.yg[i][j] + d2, 2. ) + pow( eps, 2. ) ); div2i = sqrt( pow( cgrid2.xg[i][j] - d2i, 2. ) + pow( cgrid2.yg[i][j] + d2i, 2. ) + pow( eps, 2. ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; } } f2mnmx( z, PRPTS, PTHETAPTS, &zmin, &zmax ); // printf("%.15g %.15g %.15g %.15g %.15g %.15g %.15g %.15g \n", // q1, d1, q1i, d1i, q2, d2, q2i, d2i); // printf("%.15g %.15g %.15g %.15g %.15g %.15g \n", // xmin, xmax, ymin, ymax, zmin, zmax); // Positive and negative contour levels. dz = ( zmax - zmin ) / (double) PNLEVEL; nlevelneg = 0; nlevelpos = 0; for ( i = 0; i < PNLEVEL; i++ ) { clevel2 = zmin + ( (double) i + 0.5 ) * dz; if ( clevel2 <= 0. ) clevelneg[nlevelneg++] = clevel2; else clevelpos[nlevelpos++] = clevel2; } // Colours! ncollin = 11; ncolbox = 1; ncollab = 2; // Finally start plotting this page! pladv( 0 ); plcol0( ncolbox ); plvpas( 0.1, 0.9, 0.1, 0.9, 1.0 ); plwind( xpmin, xpmax, ypmin, ypmax ); plbox( "", 0., 0, "", 0., 0 ); plcol0( ncollin ); if ( nlevelneg > 0 ) { // Negative contours pllsty( 2 ); plcont( (const PLFLT * const *) z, PRPTS, PTHETAPTS, 1, PRPTS, 1, PTHETAPTS, clevelneg, nlevelneg, pltr2, (void *) &cgrid2 ); } if ( nlevelpos > 0 ) { // Positive contours pllsty( 1 ); plcont( (const PLFLT * const *) z, PRPTS, PTHETAPTS, 1, PRPTS, 1, PTHETAPTS, clevelpos, nlevelpos, pltr2, (void *) &cgrid2 ); } // Draw outer boundary for ( i = 0; i < PPERIMETERPTS; i++ ) { t = ( 2. * M_PI / ( PPERIMETERPTS - 1 ) ) * (double) i; px[i] = x0 + rmax*cos( t ); py[i] = y0 + rmax*sin( t ); } plcol0( ncolbox ); plline( PPERIMETERPTS, px, py ); plcol0( ncollab ); pllab( "", "", "Shielded potential of charges in a conducting sphere" ); plFree2dGrid( z, PRPTS, PTHETAPTS ); plFree2dGrid( cgrid2.xg, PRPTS, PTHETAPTS ); plFree2dGrid( cgrid2.yg, PRPTS, PTHETAPTS ); } //-------------------------------------------------------------------------- // main // // Does several contour plots using different coordinate mappings. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i, j; PLFLT xx, yy, argx, argy, distort; static PLINT mark = 1500, space = 1500; PLFLT **z, **w; PLFLT xg1[XPTS], yg1[YPTS]; PLcGrid cgrid1; PLcGrid2 cgrid2; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // Set up function arrays plAlloc2dGrid( &z, XPTS, YPTS ); plAlloc2dGrid( &w, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } // Set up grids cgrid1.xg = xg1; cgrid1.yg = yg1; cgrid1.nx = XPTS; cgrid1.ny = YPTS; plAlloc2dGrid( &cgrid2.xg, XPTS, YPTS ); plAlloc2dGrid( &cgrid2.yg, XPTS, YPTS ); cgrid2.nx = XPTS; cgrid2.ny = YPTS; for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { mypltr( (PLFLT) i, (PLFLT) j, &xx, &yy, NULL ); argx = xx * M_PI / 2; argy = yy * M_PI / 2; distort = 0.4; cgrid1.xg[i] = xx + distort * cos( argx ); cgrid1.yg[j] = yy - distort * cos( argy ); cgrid2.xg[i][j] = xx + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = yy - distort * cos( argx ) * cos( argy ); } } // Plot using identity transform // // plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); // plcol0(2); // plcont(z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL); // plstyl(1, &mark, &space); // plcol0(3); // plcont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL); // plstyl(0, &mark, &space); // plcol0(1); // pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pl_setcontlabelformat( 4, 3 ); pl_setcontlabelparam( 0.006, 0.3, 0.1, 1 ); plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( (const PLFLT * const *) z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); plstyl( 1, &mark, &space ); plcol0( 3 ); plcont( (const PLFLT * const *) w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); plstyl( 0, &mark, &space ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pl_setcontlabelparam( 0.006, 0.3, 0.1, 0 ); // Plot using 1d coordinate transform plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( (const PLFLT * const *) z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, pltr1, (void *) &cgrid1 ); plstyl( 1, &mark, &space ); plcol0( 3 ); plcont( (const PLFLT * const *) w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, pltr1, (void *) &cgrid1 ); plstyl( 0, &mark, &space ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // // pl_setcontlabelparam(0.006, 0.3, 0.1, 1); // plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); // plcol0(2); // plcont((const PLFLT **) z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr1, (void *) &cgrid1); // // plstyl(1, &mark, &space); // plcol0(3); // plcont((const PLFLT **) w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr1, (void *) &cgrid1); // plstyl(0, &mark, &space); // plcol0(1); // pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pl_setcontlabelparam(0.006, 0.3, 0.1, 0); // // Plot using 2d coordinate transform plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( (const PLFLT * const *) z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, pltr2, (void *) &cgrid2 ); plstyl( 1, &mark, &space ); plcol0( 3 ); plcont( (const PLFLT * const *) w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, pltr2, (void *) &cgrid2 ); plstyl( 0, &mark, &space ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // // pl_setcontlabelparam(0.006, 0.3, 0.1, 1); // plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); // plcol0(2); // plcont((const PLFLT **) z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr2, (void *) &cgrid2); // // plstyl(1, &mark, &space); // plcol0(3); // plcont((const PLFLT **) w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr2, (void *) &cgrid2); // plstyl(0, &mark, &space); // plcol0(1); // pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pl_setcontlabelparam( 0.006, 0.3, 0.1, 0 ); polar(); // // pl_setcontlabelparam(0.006, 0.3, 0.1, 1); // polar(); // pl_setcontlabelparam( 0.006, 0.3, 0.1, 0 ); potential(); // // pl_setcontlabelparam(0.006, 0.3, 0.1, 1); // potential(); // // Clean up plFree2dGrid( z, XPTS, YPTS ); plFree2dGrid( w, XPTS, YPTS ); plFree2dGrid( cgrid2.xg, XPTS, YPTS ); plFree2dGrid( cgrid2.yg, XPTS, YPTS ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x15c.c 644 1750 1750 2141612140307134 157330ustar andrewandrew// $Id: x15c.c 12319 2013-05-01 21:51:24Z airwin $ // // Shade plot demo. // // Maurice LeBrun // IFS, University of Texas at Austin // 31 Aug 1993 // #include "plcdemos.h" #define XPTS 35 // Data points in x #define YPTS 46 // Data points in y PLFLT z[XPTS][YPTS], zmin, zmax; // Function prototypes static void plot1( void ); static void plot2( void ); static void plot3( void ); static void f2mnmx( PLFLT *, PLINT, PLINT, PLFLT *, PLFLT * ); //static void cmap1_init1( void ); static void cmap1_init2( void ); //-------------------------------------------------------------------------- // main // // Does a variety of shade plots. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i, j; PLFLT xx, yy; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Set up color map 0 // // plscmap0n(3); // // Set up color map 1 cmap1_init2(); // Initialize plplot plinit(); // Set up data array for ( i = 0; i < XPTS; i++ ) { xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy + ( xx - yy ) / ( xx * xx + yy * yy + 0.1 ); } } f2mnmx( &z[0][0], XPTS, YPTS, &zmin, &zmax ); plot1(); plot2(); plot3(); plend(); exit( 0 ); } //-------------------------------------------------------------------------- // cmap1_init1 // // Initializes color map 1 in HLS space. //-------------------------------------------------------------------------- //static void //cmap1_init1( void ) //{ // PLFLT i[4], h[4], l[4], s[4]; // // i[0] = 0; // left boundary // i[1] = 0.45; // just before center // i[2] = 0.55; // just after center // i[3] = 1; // right boundary // // h[0] = 260; // hue -- low: blue-violet // h[1] = 260; // only change as we go over vertex // h[2] = 20; // hue -- high: red // h[3] = 20; // keep fixed // //#if 1 // l[0] = 0.5; // lightness -- low // l[1] = 0.0; // lightness -- center // l[2] = 0.0; // lightness -- center // l[3] = 0.5; // lightness -- high //#else // plscolbg( 255, 255, 255 ); // l[0] = 0.5; // lightness -- low // l[1] = 1.0; // lightness -- center // l[2] = 1.0; // lightness -- center // l[3] = 0.5; // lightness -- high //#endif // s[0] = 1; // maximum saturation // s[1] = 1; // maximum saturation // s[2] = 1; // maximum saturation // s[3] = 1; // maximum saturation // // c_plscmap1l( 0, 4, i, h, l, s, NULL ); //} //-------------------------------------------------------------------------- // cmap1_init2 // // Initializes color map 1 in HLS space. //-------------------------------------------------------------------------- static void cmap1_init2( void ) { PLFLT i[4], h[4], l[4], s[4]; i[0] = 0; // left boundary i[1] = 0.45; // just before center i[2] = 0.55; // just after center i[3] = 1; // right boundary h[0] = 260; // hue -- low: blue-violet h[1] = 260; // only change as we go over vertex h[2] = 20; // hue -- high: red h[3] = 20; // keep fixed #if 1 l[0] = 0.6; // lightness -- low l[1] = 0.0; // lightness -- center l[2] = 0.0; // lightness -- center l[3] = 0.6; // lightness -- high #else plscolbg( 255, 255, 255 ); l[0] = 0.5; // lightness -- low l[1] = 1.0; // lightness -- center l[2] = 1.0; // lightness -- center l[3] = 0.5; // lightness -- high #endif s[0] = 1; // saturation -- low s[1] = 0.5; // saturation -- center s[2] = 0.5; // saturation -- center s[3] = 1; // saturation -- high c_plscmap1l( 0, 4, i, h, l, s, NULL ); } //-------------------------------------------------------------------------- // plot1 // // Illustrates a single shaded region. //-------------------------------------------------------------------------- static void plot1( void ) { PLFLT shade_min, shade_max, sh_color; PLINT sh_cmap = 0; PLINT min_color = 0, max_color = 0; PLFLT sh_width, min_width = 0., max_width = 0.; pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); // Plot using identity transform shade_min = zmin + ( zmax - zmin ) * 0.4; shade_max = zmin + ( zmax - zmin ) * 0.6; sh_color = 7; sh_width = 2.; min_color = 9; max_color = 2; min_width = 2.; max_width = 2.; plpsty( 8 ); plshade1( &z[0][0], XPTS, YPTS, NULL, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plfill, 1, NULL, NULL ); plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon flux" ); } //-------------------------------------------------------------------------- // plot2 // // Illustrates multiple adjacent shaded regions, using different fill // patterns for each region. //-------------------------------------------------------------------------- static void plot2( void ) { PLFLT shade_min, shade_max, sh_color; PLINT sh_cmap = 0; PLINT min_color = 0, max_color = 0; PLFLT sh_width, min_width = 0., max_width = 0.; int i; static PLINT nlin[10] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; static PLINT inc[10][2] = { { 450, 0 }, { -450, 0 }, { 0, 0 }, { 900, 0 }, { 300, 0 }, { 450, -450 }, { 0, 900 }, { 0, 450 }, { 450, -450 }, { 0, 900 } }; static PLINT del[10][2] = { { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 4000, 4000 }, { 4000, 2000 } }; sh_width = 2.; pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); // Plot using identity transform for ( i = 0; i < 10; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / 10.0; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / 10.0; sh_color = i + 6; plpat( nlin[i], inc[i], del[i] ); plshade1( &z[0][0], XPTS, YPTS, NULL, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plfill, 1, NULL, NULL ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); pllab( "distance", "altitude", "Bogon flux" ); } //-------------------------------------------------------------------------- // plot3 // // Illustrates shaded regions in 3d, using a different fill pattern for // each region. //-------------------------------------------------------------------------- static void plot3( void ) { static PLFLT xx[2][5] = { { -1.0, 1.0, 1.0, -1.0, -1.0 }, { -1.0, 1.0, 1.0, -1.0, -1.0 } }; static PLFLT yy[2][5] = { { 1.0, 1.0, 0.0, 0.0, 1.0 }, { -1.0, -1.0, 0.0, 0.0, -1.0 } }; static PLFLT zz[2][5] = { { 0.0, 0.0, 1.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 1.0, 0.0 } }; pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plw3d( 1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40 ); // Plot using identity transform plcol0( 1 ); plbox3( "bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0 ); plcol0( 2 ); pllab( "", "", "3-d polygon filling" ); plcol0( 3 ); plpsty( 1 ); plline3( 5, xx[0], yy[0], zz[0] ); plfill3( 4, xx[0], yy[0], zz[0] ); plpsty( 2 ); plline3( 5, xx[1], yy[1], zz[1] ); plfill3( 4, xx[1], yy[1], zz[1] ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- #define F( a, b ) ( f[a * ny + b] ) static void f2mnmx( PLFLT *f, PLINT nx, PLINT ny, PLFLT *fnmin, PLFLT *fnmax ) { int i, j; *fnmax = F( 0, 0 ); *fnmin = *fnmax; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { *fnmax = MAX( *fnmax, F( i, j ) ); *fnmin = MIN( *fnmin, F( i, j ) ); } } } plplot-5.10.0+dfsg/examples/c/x22c.c 644 1750 1750 3012512251341601 157260ustar andrewandrew// $Id: x22c.c 12827 2013-12-09 13:20:01Z andrewross $ // // Simple vector plot example // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Rafael Laboissiere // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" void circulation( void ); void constriction( int astyle ); void transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ); void constriction2( void ); void potential( void ); void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fnmin, PLFLT *fnmax ); // Pairs of points making the line segments used to plot the user defined arroW static PLFLT arrow_x[6] = { -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 }; static PLFLT arrow_y[6] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 }; static PLFLT arrow2_x[6] = { -0.5, 0.3, 0.3, 0.5, 0.3, 0.3 }; static PLFLT arrow2_y[6] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 }; //-------------------------------------------------------------------------- // main // // Generates several simple vector plots. //-------------------------------------------------------------------------- // // Vector plot of the circulation about the origin // void circulation( void ) { int i, j; PLFLT dx, dy, x, y; PLcGrid2 cgrid2; PLFLT **u, **v; const int nx = 20; const int ny = 20; PLFLT xmin, xmax, ymin, ymax; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; plAlloc2dGrid( &cgrid2.xg, nx, ny ); plAlloc2dGrid( &cgrid2.yg, nx, ny ); plAlloc2dGrid( &u, nx, ny ); plAlloc2dGrid( &v, nx, ny ); cgrid2.nx = nx; cgrid2.ny = ny; // Create data - circulation around the origin. for ( i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; u[i][j] = y; v[i][j] = -x; } } // Plot vectors with default arrows plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "(x)", "(y)", "#frPLplot Example 22 - circulation" ); plcol0( 2 ); plvect( (const PLFLT * const *) u, (const PLFLT * const *) v, nx, ny, 0.0, pltr2, (void *) &cgrid2 ); plcol0( 1 ); plFree2dGrid( cgrid2.xg, nx, ny ); plFree2dGrid( cgrid2.yg, nx, ny ); plFree2dGrid( u, nx, ny ); plFree2dGrid( v, nx, ny ); } // // Vector plot of flow through a constricted pipe // void constriction( int astyle ) { int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; PLFLT Q, b, dbdx; PLcGrid2 cgrid2; PLFLT **u, **v; const int nx = 20; const int ny = 20; char title[80]; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; plAlloc2dGrid( &cgrid2.xg, nx, ny ); plAlloc2dGrid( &cgrid2.yg, nx, ny ); plAlloc2dGrid( &u, nx, ny ); plAlloc2dGrid( &v, nx, ny ); cgrid2.nx = nx; cgrid2.ny = ny; Q = 2.0; for ( i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; b = ymax / 4.0 * ( 3 - cos( M_PI * x / xmax ) ); if ( fabs( y ) < b ) { dbdx = ymax / 4.0 * sin( M_PI * x / xmax ) * M_PI / xmax * y / b; u[i][j] = Q * ymax / b; v[i][j] = dbdx * u[i][j]; } else { u[i][j] = 0.0; v[i][j] = 0.0; } } } plenv( xmin, xmax, ymin, ymax, 0, 0 ); sprintf( title, "#frPLplot Example 22 - constriction (arrow style %d)", astyle ); pllab( "(x)", "(y)", title ); plcol0( 2 ); plvect( (const PLFLT * const *) u, (const PLFLT * const *) v, nx, ny, -1.0, pltr2, (void *) &cgrid2 ); plcol0( 1 ); plFree2dGrid( cgrid2.xg, nx, ny ); plFree2dGrid( cgrid2.yg, nx, ny ); plFree2dGrid( u, nx, ny ); plFree2dGrid( v, nx, ny ); } // // Global transform function for a constriction using data passed in // This is the same transformation used in constriction. // void transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { PLFLT *trdata; PLFLT xmax; trdata = (PLFLT *) data; xmax = *trdata; *xt = x; *yt = y / 4.0 * ( 3 - cos( M_PI * x / xmax ) ); } // // Vector plot of flow through a constricted pipe // with a coordinate transform // void constriction2( void ) { int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; PLFLT Q, b; PLcGrid2 cgrid2; PLFLT **u, **v; const int nx = 20; const int ny = 20; #define NC 11 const int nc = NC; const int nseg = 20; PLFLT clev[NC]; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; plstransform( transform, ( PLPointer ) & xmax ); plAlloc2dGrid( &cgrid2.xg, nx, ny ); plAlloc2dGrid( &cgrid2.yg, nx, ny ); plAlloc2dGrid( &u, nx, ny ); plAlloc2dGrid( &v, nx, ny ); cgrid2.nx = nx; cgrid2.ny = ny; Q = 2.0; for ( i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; b = ymax / 4.0 * ( 3 - cos( M_PI * x / xmax ) ); u[i][j] = Q * ymax / b; v[i][j] = 0.0; } } for ( i = 0; i < nc; i++ ) { clev[i] = Q + i * Q / ( nc - 1 ); } plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform" ); plcol0( 2 ); plshades( (const PLFLT * const *) u, nx, ny, NULL, xmin + dx / 2, xmax - dx / 2, ymin + dy / 2, ymax - dy / 2, clev, nc, 0.0, 1, 1.0, plfill, 0, NULL, NULL ); plvect( (const PLFLT * const *) u, (const PLFLT * const *) v, nx, ny, -1.0, pltr2, (void *) &cgrid2 ); // Plot edges using plpath (which accounts for coordinate transformation) rather than plline plpath( nseg, xmin, ymax, xmax, ymax ); plpath( nseg, xmin, ymin, xmax, ymin ); plcol0( 1 ); plFree2dGrid( cgrid2.xg, nx, ny ); plFree2dGrid( cgrid2.yg, nx, ny ); plFree2dGrid( u, nx, ny ); plFree2dGrid( v, nx, ny ); plstransform( NULL, NULL ); } void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fnmin, PLFLT *fnmax ) { int i, j; *fnmax = f[0][0]; *fnmin = *fnmax; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { *fnmax = MAX( *fnmax, f[i][j] ); *fnmin = MIN( *fnmin, f[i][j] ); } } } // // Vector plot of the gradient of a shielded potential (see example 9) // void potential( void ) { #if !defined ( WIN32 ) const int nper = 100; const int nlevel = 10; const int nr = 20; const int ntheta = 20; #else #define nper 100 #define nlevel 10 #define nr 20 #define ntheta 20 #endif int i, j; PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; PLFLT div1, div1i, div2, div2i; PLFLT **u, **v, **z, r, theta, x, y, dz; PLFLT xmin, xmax, ymin, ymax, rmax, zmax, zmin; PLFLT px[nper], py[nper], clevel[nlevel]; PLcGrid2 cgrid2; // Create data to be plotted plAlloc2dGrid( &cgrid2.xg, nr, ntheta ); plAlloc2dGrid( &cgrid2.yg, nr, ntheta ); plAlloc2dGrid( &u, nr, ntheta ); plAlloc2dGrid( &v, nr, ntheta ); plAlloc2dGrid( &z, nr, ntheta ); cgrid2.nx = nr; cgrid2.ny = ntheta; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. // rmax = (double) nr; eps = 2.; q1 = 1.; d1 = rmax / 4.; q1i = -q1 * rmax / d1; d1i = pow( rmax, 2. ) / d1; q2 = -1.; d2 = rmax / 4.; q2i = -q2 * rmax / d2; d2i = pow( rmax, 2. ) / d2; for ( i = 0; i < nr; i++ ) { r = 0.5 + (double) i; for ( j = 0; j < ntheta; j++ ) { theta = 2. * M_PI / ( ntheta - 1 ) * ( 0.5 + (double) j ); x = r * cos( theta ); y = r * sin( theta ); cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; div1 = sqrt( pow( x - d1, 2. ) + pow( y - d1, 2. ) + pow( eps, 2. ) ); div1i = sqrt( pow( x - d1i, 2. ) + pow( y - d1i, 2. ) + pow( eps, 2. ) ); div2 = sqrt( pow( x - d2, 2. ) + pow( y + d2, 2. ) + pow( eps, 2. ) ); div2i = sqrt( pow( x - d2i, 2. ) + pow( y + d2i, 2. ) + pow( eps, 2. ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; u[i][j] = -q1 * ( x - d1 ) / pow( div1, 3. ) - q1i * ( x - d1i ) / pow( div1i, 3.0 ) - q2 * ( x - d2 ) / pow( div2, 3. ) - q2i * ( x - d2i ) / pow( div2i, 3. ); v[i][j] = -q1 * ( y - d1 ) / pow( div1, 3. ) - q1i * ( y - d1i ) / pow( div1i, 3.0 ) - q2 * ( y + d2 ) / pow( div2, 3. ) - q2i * ( y + d2i ) / pow( div2i, 3. ); } } f2mnmx( cgrid2.xg, nr, ntheta, &xmin, &xmax ); f2mnmx( cgrid2.yg, nr, ntheta, &ymin, &ymax ); f2mnmx( z, nr, ntheta, &zmin, &zmax ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot" ); // Plot contours of the potential dz = ( zmax - zmin ) / (double) nlevel; for ( i = 0; i < nlevel; i++ ) { clevel[i] = zmin + ( (double) i + 0.5 ) * dz; } plcol0( 3 ); pllsty( 2 ); plcont( (const PLFLT * const *) z, nr, ntheta, 1, nr, 1, ntheta, clevel, nlevel, pltr2, (void *) &cgrid2 ); pllsty( 1 ); plcol0( 1 ); // Plot the vectors of the gradient of the potential plcol0( 2 ); plvect( (const PLFLT * const *) u, (const PLFLT * const *) v, nr, ntheta, 25.0, pltr2, (void *) &cgrid2 ); plcol0( 1 ); // Plot the perimeter of the cylinder for ( i = 0; i < nper; i++ ) { theta = ( 2. * M_PI / ( nper - 1 ) ) * (double) i; px[i] = rmax * cos( theta ); py[i] = rmax * sin( theta ); } plline( nper, px, py ); plFree2dGrid( z, nr, ntheta ); plFree2dGrid( cgrid2.xg, nr, ntheta ); plFree2dGrid( cgrid2.yg, nr, ntheta ); plFree2dGrid( u, nr, ntheta ); plFree2dGrid( v, nr, ntheta ); } int main( int argc, const char *argv[] ) { PLINT narr, fill; // Parse and process command line arguments plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); circulation(); narr = 6; fill = 0; // Set arrow style using arrow_x and arrow_y then // plot using these arrows. plsvect( arrow_x, arrow_y, narr, fill ); constriction( 1 ); // Set arrow style using arrow2_x and arrow2_y then // plot using these filled arrows. fill = 1; plsvect( arrow2_x, arrow2_y, narr, fill ); constriction( 2 ); constriction2(); // Reset arrow style to the default by passing two // NULL arrays plsvect( NULL, NULL, 0, 0 ); potential(); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x28c.c 644 1750 1750 3344511666362057 157650ustar andrewandrew// $Id: x28c.c 12095 2011-12-03 08:56:15Z andrewross $ // // plmtex3, plptex3 demo. // // Copyright (C) 2007, 2008, 2009 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" // Choose these values to correspond to tick marks. #define XPTS 2 #define YPTS 2 #define NREVOLUTION 16 #define NROTATION 8 #define NSHEAR 8 //-------------------------------------------------------------------------- // main // // Demonstrates plotting text in 3D. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { PLFLT *x, *y, **z, xmin = 0., xmax = 1.0, xmid = 0.5 * ( xmax + xmin ), xrange = xmax - xmin, ymin = 0., ymax = 1.0, ymid = 0.5 * ( ymax + ymin ), yrange = ymax - ymin, zmin = 0., zmax = 1.0, zmid = 0.5 * ( zmax + zmin ), zrange = zmax - zmin, ysmin = ymin + 0.1 * yrange, ysmax = ymax - 0.1 * yrange, ysrange = ysmax - ysmin, dysrot = ysrange / (PLFLT) ( NROTATION - 1 ), dysshear = ysrange / (PLFLT) ( NSHEAR - 1 ), zsmin = zmin + 0.1 * zrange, zsmax = zmax - 0.1 * zrange, zsrange = zsmax - zsmin, dzsrot = zsrange / (PLFLT) ( NROTATION - 1 ), dzsshear = zsrange / (PLFLT) ( NSHEAR - 1 ), ys, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, omega, sin_omega, cos_omega, domega; int i, j; PLFLT radius, pitch, xpos, ypos, zpos; // p1string must be exactly one character + the null termination // character. char p1string[] = "O"; const char *pstring = "The future of our civilization depends on software freedom."; // Allocate and define the minimal x, y, and z to insure 3D box x = (PLFLT *) calloc( XPTS, sizeof ( PLFLT ) ); y = (PLFLT *) calloc( YPTS, sizeof ( PLFLT ) ); plAlloc2dGrid( &z, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { x[i] = xmin + (double) i * ( xmax - xmin ) / (double) ( XPTS - 1 ); } for ( j = 0; j < YPTS; j++ ) y[j] = ymin + (double) j * ( ymax - ymin ) / (double) ( YPTS - 1 ); for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { z[i][j] = 0.; } } // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); plinit(); // Page 1: Demonstrate inclination and shear capability pattern. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // z = zmin. plschr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.5 * yrange * sin_omega; z_inclination = 0.; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.5 * yrange * cos_omega; z_shear = 0.; plptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // x = xmax. plschr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.; y_inclination = -0.5 * yrange * cos_omega; z_inclination = 0.5 * zrange * sin_omega; x_shear = 0.; y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; plptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // y = ymax. plschr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.; z_inclination = 0.5 * zrange * sin_omega; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.; z_shear = 0.5 * zrange * cos_omega; plptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 2: Demonstrate rotation of string around its axis. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * (PLFLT) i; plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u" ); } // x = xmax. plschr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * (PLFLT) i; plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u" ); } // z = zmin. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; z_shear = 0.5 * zrange * sin_omega; ys = ysmax - dysrot * (PLFLT) i; plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 3: Demonstrate shear of string along its axis. // Work around xcairo and pngcairo (but not pscairo) problems for // shear vector too close to axis of string. (N.B. no workaround // would be domega = 0.) domega = 0.05; pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * (PLFLT) i; plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u" ); } // x = xmax. plschr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = -0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * (PLFLT) i; plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u" ); } // z = zmin. plschr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; z_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; x_shear = 0.5 * xrange * sin_omega; ys = ysmax - dysshear * (PLFLT) i; plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 4: Demonstrate drawing a string on a 3D path. pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); plschr( 0., 1.2 ); // domega controls the spacing between the various characters of the // string and also the maximum value of omega for the given number // of characters in *pstring. domega = 2. * M_PI / (double) strlen( pstring ); omega = 0.; // 3D function is a helix of the given radius and pitch radius = 0.5; pitch = 1. / ( 2. * M_PI ); while ( *pstring ) { sin_omega = sin( omega ); cos_omega = cos( omega ); xpos = xmid + radius * sin_omega; ypos = ymid - radius * cos_omega; zpos = zmin + pitch * omega; // In general, the inclination is proportional to the derivative of // the position wrt theta. x_inclination = radius * cos_omega;; y_inclination = radius * sin_omega; z_inclination = pitch; // The shear vector should be perpendicular to the 3D line with Z // component maximized, but for low pitch a good approximation is // a constant vector that is parallel to the Z axis. x_shear = 0.; y_shear = 0.; z_shear = 1.; *p1string = *pstring; plptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, p1string ); pstring++; omega += domega; } // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Page 5: Demonstrate plmtex3 axis labelling capability pladv( 0 ); plvpor( -0.15, 1.15, -0.05, 1.05 ); plwind( -1.2, 1.2, -0.8, 1.5 ); plw3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); plcol0( 2 ); plbox3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); plschr( 0., 1.0 ); plmtex3( "xp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "xp", 4.5, 0.5, 0.5, "primary X-axis label" ); plmtex3( "xs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "xs", -1.0, 0.5, 0.5, "secondary X-axis label" ); plmtex3( "yp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "yp", 4.5, 0.5, 0.5, "primary Y-axis label" ); plmtex3( "ys", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "ys", -1.0, 0.5, 0.5, "secondary Y-axis label" ); plmtex3( "zp", 4.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "zp", 3.0, 0.5, 0.5, "primary Z-axis label" ); plmtex3( "zs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); plmtex3( "zs", -1.0, 0.5, 0.5, "secondary Z-axis label" ); // Draw minimal 3D grid to finish defining the 3D box. plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, DRAW_LINEXY ); // Clean up. free( (void *) x ); free( (void *) y ); plFree2dGrid( z, XPTS, YPTS ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x33c.c 644 1750 1750 7270712232626300 157450ustar andrewandrew// -*- coding: utf-8; -*- // // $Id: x33c.c 12631 2013-10-26 02:45:20Z airwin $ // // Demonstrate most pllegend capability including unicode symbols. // // Copyright (C) 2010 Alan Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example designed just for devices (e.g., the cairo-related and // qt-related devices) where the best choice of glyph is automatically // selected by the related libraries (pango/cairo or Qt4) for each // unicode character depending on what system fonts are installed. Of // course, you must have the appropriate TrueType fonts installed to // have access to all the required glyphs. #include "plcdemos.h" void plcolorbar_example_page( int kind_i, int label_i, int cap_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ); void plcolorbar_example( const char *palette, int kind_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ); static PLINT position_options[16] = { PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_INSIDE }; // Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). static const char *special_symbols[5] = { "✰", "✴", "✱", "✽", "✦" }; // plcolorbar options // Colorbar type options #define COLORBAR_KINDS 4 static PLINT colorbar_option_kinds[COLORBAR_KINDS] = { PL_COLORBAR_SHADE, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT }; static const char *colorbar_option_kind_labels[COLORBAR_KINDS] = { "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars" }; // Which side of the page are we positioned relative to? #define COLORBAR_POSITIONS 4 static PLINT colorbar_position_options[COLORBAR_POSITIONS] = { PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM }; static const char *colorbar_position_option_labels[COLORBAR_POSITIONS] = { "Left", "Right", "Top", "Bottom" }; // Colorbar label positioning options #define COLORBAR_LABELS 4 static PLINT colorbar_label_options[COLORBAR_LABELS] = { PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM }; static const char *colorbar_label_option_labels[COLORBAR_LABELS] = { "Label left", "Label right", "Label top", "Label bottom" }; // Colorbar cap options #define COLORBAR_CAPS 4 static PLINT colorbar_cap_options[COLORBAR_CAPS] = { PL_COLORBAR_CAP_NONE, PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH }; static const char *colorbar_cap_option_labels[COLORBAR_CAPS] = { "No caps", "Low cap", "High cap", "Low and high caps" }; static int colorbar = 1; // By default do not plot plcolorbar pages // for now while we are working out the API. static PLOptionTable options[] = { { "colorbar", // Turns on pages showing colorbars NULL, NULL, &colorbar, PL_OPT_BOOL, "-colorbar", "Plot the \"color bar\" pages." }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; const char *notes[] = { "Make sure you get it right!", NULL }; void plcolorbar_example_page( int kind_i, int label_i, int cap_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ) { // Parameters for the colorbars on this page PLINT position_i, position, opt; PLFLT x, y, x_length, y_length; PLFLT ticks[1] = { 0.0 }; PLINT sub_ticks[1] = { 0 }; PLFLT low_cap_color, high_cap_color; PLINT vertical, ifn; PLINT n_axes = 1; const char *axis_opts[1]; PLINT n_labels = 1; PLINT label_opts[1] = { 0 }; char *label; char title[200]; PLFLT colorbar_width, colorbar_height; PLINT n_values_array[1]; PLFLT *values_array[1]; label = (char *) malloc( sizeof ( char ) * 200 ); n_values_array[0] = n_values; values_array[0] = values; low_cap_color = 0.0; high_cap_color = 1.0; // Start a new page pladv( 0 ); // Draw one colorbar relative to each side of the page for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) { position = colorbar_position_options[position_i]; opt = colorbar_option_kinds[kind_i] | colorbar_label_options[label_i] | colorbar_cap_options[cap_i]; vertical = position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT; ifn = position & PL_POSITION_LEFT || position & PL_POSITION_BOTTOM; // Set the offset position on the page if ( vertical ) { x = 0.0; y = 0.0; x_length = 0.05; y_length = 0.5; } else { x = 0.0; y = 0.0; x_length = 0.5; y_length = 0.05; } // Set appropriate labelling options. if ( ifn ) { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivn"; //axis_opts[0] = "uwtin"; } else { axis_opts[0] = "uwxvn"; //axis_opts[0] = "uwxn"; } } else { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivm"; //axis_opts[0] = "uwtim"; } else { axis_opts[0] = "uwxvm"; //axis_opts[0] = "uwxm"; } } sprintf( label, "%s, %s", colorbar_position_option_labels[position_i], colorbar_label_option_labels[label_i] ); // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); plvpor( 0.20, 0.80, 0.20, 0.80 ); plwind( 0.0, 1.0, 0.0, 1.0 ); // Set interesting background colour. plscol0a( 15, 0, 0, 0, 0.20 ); plcolorbar( &colorbar_width, &colorbar_height, opt | PL_COLORBAR_BOUNDING_BOX | PL_COLORBAR_BACKGROUND, position, x, y, x_length, y_length, 15, 1, 1, low_cap_color, high_cap_color, cont_color, cont_width, n_labels, label_opts, (const char * const *) &label, n_axes, axis_opts, ticks, sub_ticks, n_values_array, (const PLFLT * const *) values_array ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } // Draw a page title sprintf( title, "%s - %s", colorbar_option_kind_labels[kind_i], colorbar_cap_option_labels[cap_i] ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); free( label ); } void plcolorbar_example( const char *palette, int kind_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ) { int label_i, cap_i; // Load the color palette plspal1( palette, 1 ); for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) { for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) { plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ); } } } //-------------------------------------------------------------------------- // main // // Demonstrate most pllegend capability including unicode symbols. //-------------------------------------------------------------------------- #define MAX_NLEGEND 7 int main( int argc, const char *argv[] ) { int i, k; PLINT opt; PLINT nlegend, nturn; PLINT opt_array[MAX_NLEGEND]; PLINT text_colors[MAX_NLEGEND]; PLINT box_colors[MAX_NLEGEND]; PLINT box_patterns[MAX_NLEGEND]; PLFLT box_scales[MAX_NLEGEND]; PLFLT box_line_widths[MAX_NLEGEND]; PLINT line_colors[MAX_NLEGEND]; PLINT line_styles[MAX_NLEGEND]; PLFLT line_widths[MAX_NLEGEND]; PLINT symbol_numbers[MAX_NLEGEND], symbol_colors[MAX_NLEGEND]; PLFLT symbol_scales[MAX_NLEGEND]; char *text[MAX_NLEGEND]; const char *symbols[MAX_NLEGEND]; PLFLT legend_width, legend_height, x, y, xstart, ystart; PLFLT max_height, text_scale; PLINT position, opt_base, nrow, ncolumn; // Create space to contain legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) text[k] = (char *) malloc( 200 * sizeof ( char ) ); // Parse and process command line arguments plMergeOpts( options, "x33c options", notes ); (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // First page illustrating the 16 standard positions. pladv( 0 ); plvpor( 0.25, 0.75, 0.25, 0.75 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 8.0, 0.5, 0.5, "The 16 standard legend positions with" ); plmtex( "t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y" ); nlegend = 1; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[0] = 1; line_widths[0] = 1.; symbol_scales[0] = 1.; symbol_numbers[0] = 4; symbols[0] = "*"; // Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); for ( k = 0; k < 16; k++ ) { position = position_options[k]; opt = opt_base; sprintf( text[0], "%2.2d", k ); text_colors[0] = 1 + ( k % 8 ); line_colors[0] = 1 + ( k % 8 ); symbol_colors[0] = 1 + ( k % 8 ); pllegend( &legend_width, &legend_height, opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); } // Second page illustrating effect of nrow, ncolumn for the same legend // data.; pladv( 0 ); plvpor( 0.25, 0.75, 0.25, 0.75 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR," ); plmtex( "t", 6.0, 0.5, 0.5, "and position for the same legend data" ); nlegend = 7; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; sprintf( text[k], "%2.2d", k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); position = PL_POSITION_TOP | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 3; ncolumn = 3; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); // Third page demonstrating legend alignment pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 2.0, 0.5, 0.5, "Demonstrate legend alignment" ); x = 0.1; y = 0.1; nturn = 4; nlegend = 0; position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt = opt_base; for ( i = 0; i < 9; i++ ) { // Set up legend arrays with the correct size, type. if ( i <= nturn ) nlegend += 1; else nlegend -= 1; nlegend = MAX( 1, nlegend ); // nly specify legend data that are required according to the // value of opt_array for that entry. for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; sprintf( text[k], "%2.2d", k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); nrow = MIN( 3, nlegend ); ncolumn = 0; pllegend( &legend_width, &legend_height, opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 1.5, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); if ( i == nturn ) { position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE; opt = opt_base; x = 1. - x; y += legend_height; } else { x += legend_width; y += legend_height; } } // Fourth page illustrating various kinds of legends max_height = 0.; xstart = 0.0; ystart = 0.1; x = xstart; y = ystart; text_scale = 0.90; pladv( 0 ); plvpor( 0.0, 1., 0.0, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); //plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( "t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends" ); nlegend = 5; // Only specify legend data that are required according to the // value of opt_array for that entry. position = PL_POSITION_LEFT | PL_POSITION_TOP; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT; // Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array[0] = PL_LEGEND_NONE; sprintf( text[0], "%s", "None" ); text_colors[0] = 1; opt_array[1] = PL_LEGEND_COLOR_BOX; sprintf( text[1], "%s", "Box" ); text_colors[1] = 2; box_colors[1] = 2; box_patterns[1] = 0; box_scales[1] = 0.8; box_line_widths[1] = 1.; opt_array[2] = PL_LEGEND_LINE; sprintf( text[2], "%s", "Line" ); text_colors[2] = 3; line_colors[2] = 3; line_styles[2] = 1; line_widths[2] = 1.; opt_array[3] = PL_LEGEND_SYMBOL; sprintf( text[3], "%s", "Symbol" ); text_colors[3] = 4; symbol_colors[3] = 4; symbol_scales[3] = text_scale; symbol_numbers[3] = 4; symbols[3] = special_symbols[2]; opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE; sprintf( text[4], "%s", "L & S" ); text_colors[4] = 5; line_colors[4] = 5; line_styles[4] = 1; line_widths[4] = 1.; symbol_colors[4] = 5; symbol_scales[4] = text_scale; symbol_numbers[4] = 4; symbols[4] = special_symbols[2]; opt = opt_base; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); max_height = MAX( max_height, legend_height ); // Set up symbol legend entries with various symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; sprintf( text[i], "%s%s", "Symbol ", special_symbols[i] ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = 4; symbols[i] = special_symbols[i]; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, NULL, NULL, NULL, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); max_height = MAX( max_height, legend_height ); // Set up symbol legend entries with various numbers of symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; sprintf( text[i], "%s %d", "Symbol Number", i + 2 ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = i + 2; symbols[i] = special_symbols[2]; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, NULL, NULL, NULL, symbol_colors, symbol_scales, symbol_numbers, (const char * const *) symbols ); max_height = MAX( max_height, legend_height ); // Set up box legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; sprintf( text[i], "%s %d", "Box Color", i + 1 ); text_colors[i] = i + 1; box_colors[i] = i + 1; box_patterns[i] = 0; box_scales[i] = 0.8; box_line_widths[i] = 1.; } opt = opt_base; // Use new origin x = xstart; y += max_height; max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, box_colors, box_patterns, box_scales, box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up box legend entries with various patterns. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; sprintf( text[i], "%s %d", "Box Pattern", i ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = i; box_scales[i] = 0.8; box_line_widths[i] = 1.; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, box_colors, box_patterns, box_scales, box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up box legend entries with various box pattern line widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; sprintf( text[i], "%s %d", "Box Line Width", i + 1 ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = 3; box_scales[i] = 0.8; box_line_widths[i] = (PLFLT) ( i + 1 ); } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, box_colors, box_patterns, box_scales, box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up line legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; sprintf( text[i], "%s %d", "Line Color", i + 1 ); text_colors[i] = i + 1; line_colors[i] = i + 1; line_styles[i] = 1; line_widths[i] = 1.; } opt = opt_base; // Use new origin x = xstart; y += max_height; max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up line legend entries with various styles. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; sprintf( text[i], "%s %d", "Line Style", i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = i + 1; line_widths[i] = 1.; } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up line legend entries with various widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; sprintf( text[i], "%s %d", "Line Width", i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = 1; line_widths[i] = (PLFLT) ( i + 1 ); } opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) free( (void *) text[k] ); if ( colorbar ) { // Color bar examples PLFLT values_small[2] = { -1.0e-200, 1.0e-200 }; PLFLT values_uneven[9] = { -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 }; PLFLT values_even[9] = { -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 }; // Use unsaturated green background colour to contrast with black caps. plscolbg( 70, 185, 70 ); // Cut out the greatest and smallest bits of the color spectrum to // leave colors for the end caps. plscmap1_range( 0.01, 0.99 ); // We can only test image and gradient colorbars with two element arrays for ( i = 2; i < COLORBAR_KINDS; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); } // Test shade colorbars with larger arrays for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); } for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); } } plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x10c.c 644 1750 1750 152611462631041 157110ustar andrewandrew// $Id: x10c.c 11289 2010-10-29 20:44:17Z airwin $ // // Window positioning demo. // #include "plcdemos.h" //-------------------------------------------------------------------------- // main // // Demonstrates absolute positioning of graphs on a page. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plsvpa( 50.0, 150.0, 50.0, 100.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); plptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x02c.c 644 1750 1750 735212102122103 156770ustar andrewandrew// $Id: x02c.c 12288 2013-01-30 04:40:35Z airwin $ // // Multiple window and color map 0 demo. // #include "plcdemos.h" //-------------------------------------------------------------------------- // main // // Demonstrates multiple windows and color map 0 palette, both default and // user-modified. //-------------------------------------------------------------------------- void demo1( void ); void demo2( void ); void draw_windows( int nw, int cmap0_offset ); int main( int argc, const char *argv[] ) { // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // Run demos demo1(); demo2(); plend(); exit( 0 ); } //-------------------------------------------------------------------------- // demo1 // // Demonstrates multiple windows and default color map 0 palette. //-------------------------------------------------------------------------- void demo1( void ) { plbop(); // Divide screen into 16 regions plssub( 4, 4 ); draw_windows( 16, 0 ); pleop(); } //-------------------------------------------------------------------------- // demo2 // // Demonstrates multiple windows, user-modified color map 0 palette, and // HLS -> RGB translation. //-------------------------------------------------------------------------- void demo2( void ) { // Set up cmap0 // Use 100 custom colors in addition to base 16 PLINT r[116], g[116], b[116]; // Min & max lightness values PLFLT lmin = 0.15, lmax = 0.85; int i; plbop(); // Divide screen into 100 regions plssub( 10, 10 ); for ( i = 0; i <= 99; i++ ) { PLFLT h, l, s; PLFLT r1, g1, b1; // Bounds on HLS, from plhlsrgb() commentary -- // hue [0., 360.] degrees // lightness [0., 1.] magnitude // saturation [0., 1.] magnitude // // Vary hue uniformly from left to right h = ( 360. / 10. ) * ( i % 10 ); // Vary lightness uniformly from top to bottom, between min & max l = lmin + ( lmax - lmin ) * ( i / 10 ) / 9.; // Use max saturation s = 1.0; plhlsrgb( h, l, s, &r1, &g1, &b1 ); //printf("%3d %15.9f %15.9f %15.9f %15.9f %15.9f %15.9f\n", // i+16,h,l,s,r1,g1,b1); // Use 255.001 to avoid close truncation decisions in this example. r[i + 16] = (PLINT) ( r1 * 255.001 ); g[i + 16] = (PLINT) ( g1 * 255.001 ); b[i + 16] = (PLINT) ( b1 * 255.001 ); } // Load default cmap0 colors into our custom set for ( i = 0; i <= 15; i++ ) plgcol0( i, &r[i], &g[i], &b[i] ); // for (i = 0; i < 116; i++) // printf("%3d %3d %3d %3d \n", i, r[i], g[i], b[i]); // Now set cmap0 all at once (faster, since fewer driver calls) plscmap0( r, g, b, 116 ); draw_windows( 100, 16 ); pleop(); } //-------------------------------------------------------------------------- // draw_windows // // Draws a set of numbered boxes with colors according to cmap0 entry. //-------------------------------------------------------------------------- void draw_windows( int nw, int cmap0_offset ) { int i, j; PLFLT vmin, vmax; char text[3]; plschr( 0.0, 3.5 ); plfont( 4 ); for ( i = 0; i < nw; i++ ) { plcol0( i + cmap0_offset ); sprintf( text, "%d", i ); pladv( 0 ); vmin = 0.1; vmax = 0.9; for ( j = 0; j <= 2; j++ ) { plwidth( j + 1 ); plvpor( vmin, vmax, vmin, vmax ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( "bc", 0.0, 0, "bc", 0.0, 0 ); vmin = vmin + 0.1; vmax = vmax - 0.1; } plwidth( 1 ); plptex( 0.5, 0.5, 1.0, 0.0, 0.5, text ); } } plplot-5.10.0+dfsg/examples/c/x01c.c 644 1750 1750 2261212251353077 157370ustar andrewandrew// $Id: x01c.c 12832 2013-12-09 14:39:59Z andrewross $ // // Simple line plot and multiple windows demo. // // Copyright (C) 2004 Rafael Laboissiere // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" #include "plevent.h" #ifdef PL_HAVE_NANOSLEEP #include #endif #ifdef PL_HAVE_UNISTD_H # include #endif // Variables and data arrays used by plot generators static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; static PLGraphicsIn gin; static int locate_mode; static int test_xor; static int fontset = 1; static char *f_name = NULL; // Options data structure definition. static PLOptionTable options[] = { { "locate", // Turns on test of API locate function NULL, NULL, &locate_mode, PL_OPT_BOOL, "-locate", "Turns on test of API locate function" }, { "xor", // Turns on test of xor function NULL, NULL, &test_xor, PL_OPT_BOOL, "-xor", "Turns on test of XOR" }, { "font", // For switching between font set 1 & 2 NULL, NULL, &fontset, PL_OPT_INT, "-font number", "Selects stroke font set (0 or 1, def:1)" }, { "save", // For saving in postscript NULL, NULL, &f_name, PL_OPT_STRING, "-save filename", "Save plot in color postscript `file'" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; const char *notes[] = { "Make sure you get it right!", NULL }; // Function prototypes void plot1( int ); void plot2( void ); void plot3( void ); //-------------------------------------------------------------------------- // main // // Generates several simple line plots. Demonstrates: // - subwindow capability // - setting up the window, drawing plot, and labelling // - changing the color // - automatic axis rescaling to exponential notation // - placing the axes in the middle of the box // - gridded coordinate axes //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { PLINT digmax, cur_strm, new_strm; char ver[80]; // plplot initialization // Parse and process command line arguments plMergeOpts( options, "x01c options", notes ); plparseopts( &argc, argv, PL_PARSE_FULL ); // Get version number, just for kicks plgver( ver ); fprintf( stdout, "PLplot library version: %s\n", ver ); // Initialize plplot // Divide page into 2x2 plots // Note: calling plstar replaces separate calls to plssub and plinit plstar( 2, 2 ); // Select font set as per input flag if ( fontset ) plfontld( 1 ); else plfontld( 0 ); // Set up the data // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; // Do a plot plot1( 0 ); // Set up the data xscale = 1.; yscale = 0.0014; yoff = 0.0185; // Do a plot digmax = 5; plsyax( digmax, 0 ); plot1( 1 ); plot2(); plot3(); // // Show how to save a plot: // Open a new device, make it current, copy parameters, // and replay the plot buffer // if ( f_name ) // command line option '-save filename' { printf( "The current plot was saved in color Postscript under the name `%s'.\n", f_name ); plgstrm( &cur_strm ); // get current stream plmkstrm( &new_strm ); // create a new one plsfnam( f_name ); // file name plsdev( "psc" ); // device type plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream plreplot(); // do the save by replaying the plot buffer plend1(); // finish the device plsstrm( cur_strm ); // return to previous stream } // Let's get some user input if ( locate_mode ) { for (;; ) { if ( !plGetCursor( &gin ) ) break; if ( gin.keysym == PLK_Escape ) break; pltext(); if ( gin.keysym < 0xFF && isprint( gin.keysym ) ) printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c' s = '%s'\n", gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); else printf( "subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x s - '%s'\n", gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym, gin.string ); plgra(); } } // Don't forget to call plend() to finish off! plend(); exit( 0 ); } //-------------------------------------------------------------------------- void plot1( int do_test ) { int i; PLFLT xmin, xmax, ymin, ymax; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * pow( x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). // plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 2 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points plcol0( 4 ); plpoin( 6, xs, ys, 9 ); // Draw the line through the data plcol0( 3 ); plline( 60, x, y ); // xor mode enable erasing a line/point/text by replotting it again // it does not work in double buffering mode, however if ( do_test && test_xor ) { #ifdef PL_HAVE_NANOSLEEP PLINT st; struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 50000000; plxormod( 1, &st ); // enter xor mode if ( st ) { for ( i = 0; i < 60; i++ ) { plpoin( 1, x + i, y + i, 9 ); // draw a point nanosleep( &ts, NULL ); // wait a little plflush(); // force an update of the tk driver plpoin( 1, x + i, y + i, 9 ); // erase point } plxormod( 0, &st ); // leave xor mode } #else printf( "The -xor command line option can only be exercised if your " "system\nhas nanosleep(), which does not seem to happen.\n" ); #endif } } //-------------------------------------------------------------------------- void plot2( void ) { int i; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). // plcol0( 1 ); plenv( -2.0, 10.0, -0.4, 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line plcol0( 3 ); plwidth( 2 ); plline( 100, x, y ); plwidth( 1 ); } //-------------------------------------------------------------------------- void plot3( void ) { PLINT space0 = 0, mark0 = 0, space1 = 1500, mark1 = 1500; int i; // For the final graph we wish to override the default tick intervals, and // so do not use plenv(). // pladv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. // plvsta(); plwind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. // plstyl expects a pointer! // plstyl( 1, &mark1, &space1 ); plcol0( 2 ); plbox( "g", 30.0, 0, "g", 0.2, 0 ); plstyl( 0, &mark0, &space0 ); plcol0( 3 ); pllab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * M_PI / 180.0 ); } plcol0( 4 ); plline( 101, x, y ); } plplot-5.10.0+dfsg/examples/c/test_plend.c 644 1750 1750 122211462631041 172700ustar andrewandrew// $Id: test_plend.c 11289 2010-10-29 20:44:17Z airwin $ // // plend and plend1 testing demo. // #include "plcdemos.h" //-------------------------------------------------------------------------- // main // // Demonstrates absolute positioning of graphs on a page. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); plenv( 0., 1., 0., 1., 1, 0 ); plend(); plinit(); plenv( 0., 10., 0., 10., 1, 0 ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/plplotcanvas_demo.c 644 1750 1750 726111462631041 206520ustar andrewandrew// // demo.c - Demonstrates the simplest use of the plplot canvas widget with gtk. // // Copyright (C) 2004, 2005 Thomas J. Duck // All rights reserved. // // Thomas J. Duck // Department of Physics and Atmospheric Science, // Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 // // $Author: airwin $ // $Revision: 11289 $ // $Date: 2010-10-29 13:44:17 -0700 (Fri, 29 Oct 2010) $ // $Name$ // // // NOTICE // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301 USA // #include #include // The width and height of the plplot canvas widget #define WIDTH 1000 // 500 #define HEIGHT 600 // 300 // Delete event callback gint delete_event_local( GtkWidget *widget, GdkEvent *event, gpointer data ) { return FALSE; } // Destroy event calback void destroy_local( GtkWidget *widget, gpointer data ) { gtk_main_quit(); } int main( int argc, char *argv[] ) { PlplotCanvas* canvas; GtkWidget *window; // Parse the options plparseopts( &argc, (const char **) argv, PL_PARSE_FULL ); // The data to plot double x[11] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; double y[11] = { 0, 0.1, 0.4, 0.9, 1.6, 2.6, 3.6, 4.9, 6.4, 8.1, 10 }; // Initialize gtk and the glib type system gtk_init( &argc, &argv ); g_type_init(); // Create the canvas and set its size; during the creation process, // the gcw driver is loaded into plplot, and plinit() is invoked. // canvas = plplot_canvas_new( TRUE ); plplot_canvas_set_size( canvas, WIDTH, HEIGHT ); // Create a new window and stuff the canvas into it window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( canvas ) ); // Connect the signal handlers to the window decorations g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event_local ), NULL ); g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_local ), NULL ); // Display everything gtk_widget_show_all( window ); // Draw on the canvas with Plplot plplot_canvas_adv( canvas, 0 ); // Advance to first page plplot_canvas_col0( canvas, 15 ); // Set color to black plplot_canvas_wid( canvas, 2 ); // Set the pen width plplot_canvas_vsta( canvas ); // Set the viewport plplot_canvas_wind( canvas, 0., 10., 0., 10. ); // Set the window plplot_canvas_box( canvas, "bcnst", 0., 0, "bcnstv", 0., 0 ); // Set the box plplot_canvas_lab( canvas, "x-axis", "y-axis", "A Simple Plot" ); // Draw some labels // Draw the line plplot_canvas_col0( canvas, 1 ); // Set the pen color plplot_canvas_line( canvas, 11, x, y ); // Advancing the page finalizes this plot plplot_canvas_adv( canvas, 0 ); // Start the gtk main loop gtk_main(); return 0; } plplot-5.10.0+dfsg/examples/c/CMakeLists.txt 644 1750 1750 1674311652165607 175740ustar andrewandrew# examples/c/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006, 2007, 2008, 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(c_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" ) if(CORE_BUILD) set(c_SRCS plcdemos.h tutor.c test_plend.c ) foreach(STRING_INDEX ${c_STRING_INDICES}) set(c_SRCS ${c_SRCS} x${STRING_INDEX}c.c) endforeach(STRING_INDEX ${c_STRING_INDICES}) if(PLD_xcairo) set(extXdrawable_SRC extXdrawable_demo.c) endif(PLD_xcairo) if(PLD_extcairo) set(extcairo_SRC ext-cairo-test.c) endif(PLD_extcairo) if(PLD_xcairo OR PLD_extcairo) set(cairo_DOCS README.cairo) endif(PLD_xcairo OR PLD_extcairo) if(ENABLE_gnome2) set(plplotcanvas_SRCS plplotcanvas_demo.c plplotcanvas_animation.c ) set(plplotcanvas_DOCS README.plplotcanvas ) set(gcw_true "") set(gcw_false "#") else(ENABLE_gnome2) set(gcw_true "#") set(gcw_false "") endif(ENABLE_gnome2) install(FILES ${c_SRCS} ${plplotcanvas_SRCS} ${plplotcanvas_DOCS} ${extXdrawable_SRC} ${extcairo_SRC} ${cairo_DOCS} DESTINATION ${DATA_DIR}/examples/c ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/c ) set(CC ${CMAKE_C_COMPILER}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/c RENAME Makefile ) endif(CORE_BUILD) if(BUILD_TEST) if(CORE_BUILD) include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR}/lib/qsastime ) else(CORE_BUILD) include_directories(${INCLUDE_DIR}) endif(CORE_BUILD) set_property(GLOBAL PROPERTY TARGETS_examples_c) foreach(STRING_INDEX ${c_STRING_INDICES}) if(CORE_BUILD AND BUILD_SHARED_LIBS) set_source_files_properties(x${STRING_INDEX}c.c PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(CORE_BUILD AND BUILD_SHARED_LIBS) add_executable(x${STRING_INDEX}c x${STRING_INDEX}c.c) target_link_libraries(x${STRING_INDEX}c plplot${LIB_TAG} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_c x${STRING_INDEX}c) endforeach(STRING_INDEX ${c_STRING_INDICES}) # Build simple test routines which nothing else depends on. add_executable(test_plend test_plend.c) target_link_libraries(test_plend plplot${LIB_TAG} ${MATH_LIB}) if(PKG_CONFIG_EXECUTABLE) if(ENABLE_gnome2) # plplotcanvas_demo.c and plplotcanvas_animation.c both # contain "#include " which occurs in the # /usr/include/gtk-2.0 directory. They also contain # "#include ". These issues are both taken care of # by the libgnomeprintui-2.2 pkg-config module. message(STATUS "Determine compile and link flags for plotcanvas_demo") pkg_check_pkgconfig(libgnomeprintui-2.2 includedir libdir linkflags1 cflags1 version1 _GNOMEPRINTUI) if(linkflags1) # Requires blank-delimited list. string(REGEX REPLACE ";" " " GNOMEPRINTUI_COMPILE_FLAGS "${cflags1}") set(GNOMEPRINTUI_LINK_FLAGS "${linkflags1}") set_source_files_properties( plplotcanvas_demo.c PROPERTIES COMPILE_FLAGS "${GNOMEPRINTUI_COMPILE_FLAGS}" ) add_executable(plplotcanvas_demo plplotcanvas_demo.c) target_link_libraries(plplotcanvas_demo ${GNOMEPRINTUI_LINK_FLAGS} plplotgnome2${LIB_TAG}) # plplotcanvas_animation.c contains a reference to gthread_init and also # contains '#include '. Analysis shows both these issues are # taken care of by the gthread-2.0 pkg-config module. message(STATUS "Determine compile and link flags for plotcanvas_animation") pkg_check_pkgconfig(gthread-2.0 includedir libdir linkflags2 cflags2 version2 _GTHREAD_2.0) if(linkflags2) # Requires blank-delimited list. string(REGEX REPLACE ";" " " GTHREAD_2.0_COMPILE_FLAGS "${cflags2}") set(GTHREAD_2.0_LINK_FLAGS "${linkflags2}") set_source_files_properties( plplotcanvas_animation.c PROPERTIES COMPILE_FLAGS "${GNOMEPRINTUI_COMPILE_FLAGS} ${GTHREAD_2.0_COMPILE_FLAGS}" ) add_executable(plplotcanvas_animation plplotcanvas_animation.c) target_link_libraries(plplotcanvas_animation ${GNOMEPRINTUI_LINK_FLAGS} ${GTHREAD_2.0_LINK_FLAGS} plplotgnome2${LIB_TAG} ${MATH_LIB}) else(linkflags2) message(STATUS "WARNING: gthread-2.0 not found. plplotcanvas_animation not built") endif(linkflags2) else(linkflags1) message(STATUS "WARNING: libgnomeprintui-2.2 not found. plplotcanvas_demo and plplotcanvas_animation not built.") endif(linkflags1) endif(ENABLE_gnome2) if(PLD_xcairo) message(STATUS "Determine compile and link flags for extXdrawable_demo") pkg_check_pkgconfig(gtk+-x11-2.0 includedir libdir linkflags3 cflags3 version3 _GTK_X11) if(linkflags3) # Requires blank-delimited list. string(REGEX REPLACE ";" " " GTK_X11_COMPILE_FLAGS "${cflags3}") set(GTK_X11_LINK_FLAGS "${linkflags3}") set_source_files_properties( extXdrawable_demo.c PROPERTIES COMPILE_FLAGS "${GTK_X11_COMPILE_FLAGS}" ) add_executable(extXdrawable_demo extXdrawable_demo.c) target_link_libraries(extXdrawable_demo ${GTK_X11_LINK_FLAGS} plplot${LIB_TAG}) else(linkflags3) message(STATUS "WARNING: gtk+-x11-2.0 not found. extXdrawable_demo not built.") endif(linkflags3) endif(PLD_xcairo) if(PLD_extcairo) message(STATUS "Determine compile and link flags for ext-cairo-test") pkg_check_pkgconfig(cairo includedir libdir linkflags4 cflags4 version4 _CAIRO) if(linkflags4) # Requires blank-delimited list. string(REGEX REPLACE ";" " " CAIRO_COMPILE_FLAGS "${cflags4}") set(CAIRO_LINK_FLAGS "${linkflags4}") set_source_files_properties( ext-cairo-test.c PROPERTIES COMPILE_FLAGS "${CAIRO_COMPILE_FLAGS}" ) add_executable(ext-cairo-test ext-cairo-test.c) target_link_libraries(ext-cairo-test ${CAIRO_LINK_FLAGS} plplot${LIB_TAG}) else(linkflags4) message(STATUS "WARNING: cairo not found. ext-cairo-test not built.") endif(linkflags4) endif(PLD_extcairo) else(PKG_CONFIG_EXECUTABLE) message(STATUS "WARNING: pkg-config not found so plplotcanvas_demo, plplotcanvas_animation, extXdrawable_demo, and ext-cairo-test not built.") endif(PKG_CONFIG_EXECUTABLE) endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/c/x17c.c 644 1750 1750 1101212251353077 157360ustar andrewandrew// $Id: x17c.c 12832 2013-12-09 14:39:59Z andrewross $ // // Plots a simple stripchart with four pens. // #include "plcdemos.h" #include #ifdef PL_HAVE_NANOSLEEP # include #endif #ifdef PL_HAVE_UNISTD_H # include #else # ifdef PL_HAVE_POLL # include # endif #endif // Variables for holding error return info from PLplot static PLINT pl_errcode; static char errmsg[160]; //-------------------------------------------------------------------------- // main program //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { PLINT id1, n, autoy, acc, nsteps = 1000; PLFLT y1, y2, y3, y4, ymin, ymax, xlab, ylab; PLFLT t, tmin, tmax, tjump, dt, noise; PLINT colbox, collab, colline[4], styline[4]; const char *legline[4]; #ifdef PL_HAVE_NANOSLEEP struct timespec ts; #endif // plplot initialization // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // If db is used the plot is much more smooth. However, because of the // async X behaviour, one does not have a real-time scripcharter. // This is now disabled since it does not significantly improve the // performance on new machines and makes it difficult to use this // example non-interactively since it requires an extra pleop call after // each call to plstripa. // //plsetopt("db", ""); //plsetopt("np", ""); // User sets up plot completely except for window and data // Eventually settings in place when strip chart is created will be // remembered so that multiple strip charts can be used simultaneously. // // Specify some reasonable defaults for ymin and ymax // The plot will grow automatically if needed (but not shrink) ymin = -0.1; ymax = 0.1; // Specify initial tmin and tmax -- this determines length of window. // Also specify maximum jump in t // This can accomodate adaptive timesteps tmin = 0.; tmax = 10.; tjump = 0.3; // percentage of plot to jump // Axes options same as plbox. // Only automatic tick generation and label placement allowed // Eventually I'll make this fancier colbox = 1; collab = 3; styline[0] = colline[0] = 2; // pens color and line style styline[1] = colline[1] = 3; styline[2] = colline[2] = 4; styline[3] = colline[3] = 5; legline[0] = "sum"; // pens legend legline[1] = "sin"; legline[2] = "sin*noi"; legline[3] = "sin+noi"; xlab = 0.; ylab = 0.25; // legend position autoy = 1; // autoscale y acc = 1; // don't scrip, accumulate // Initialize plplot plinit(); pladv( 0 ); plvsta(); // Register our error variables with PLplot // From here on, we're handling all errors here plsError( &pl_errcode, errmsg ); plstripc( &id1, "bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo" ); if ( pl_errcode ) { fprintf( stderr, "%s\n", errmsg ); exit( 1 ); } // Let plplot handle errors from here on plsError( NULL, NULL ); autoy = 0; // autoscale y acc = 1; // accumulate // This is to represent a loop over time // Let's try a random walk process y1 = y2 = y3 = y4 = 0.0; dt = 0.1; #ifdef PL_HAVE_NANOSLEEP ts.tv_sec = 0; ts.tv_nsec = 10000000; #endif for ( n = 0; n < nsteps; n++ ) { #ifdef PL_HAVE_NANOSLEEP nanosleep( &ts, NULL ); // wait a little (10 ms) to simulate time elapsing #else # ifdef PL_HAVE_POLL poll( 0, 0, 10 ); # else { int i; for ( i = 0; i < 1000000; i++ ) ; } # endif #endif t = (double) n * dt; noise = plrandd() - 0.5; y1 = y1 + noise; y2 = sin( t * M_PI / 18. ); y3 = y2 * noise; y4 = y2 + noise / 3.; // There is no need for all pens to have the same number of // points or beeing equally time spaced. if ( n % 2 ) plstripa( id1, 0, t, y1 ); if ( n % 3 ) plstripa( id1, 1, t, y2 ); if ( n % 4 ) plstripa( id1, 2, t, y3 ); if ( n % 5 ) plstripa( id1, 3, t, y4 ); // needed if using double buffering (-db on command line) //pleop(); } // Destroy strip chart and it's memory plstripd( id1 ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x18c.c 644 1750 1750 1032611474540544 157510ustar andrewandrew// -*- coding: utf-8; -*- // $Id: x18c.c 11354 2010-11-28 20:53:56Z airwin $ // // 3-d line and point plot demo. Adapted from x08c.c. // #include "plcdemos.h" static int opt[] = { 1, 0, 1, 0 }; static PLFLT alt[] = { 20.0, 35.0, 50.0, 65.0 }; static PLFLT az[] = { 30.0, 40.0, 50.0, 60.0 }; void test_poly( int k ); //-------------------------------------------------------------------------- // main // // Does a series of 3-d plots for a given data set, with different // viewing options in each plot. //-------------------------------------------------------------------------- #define NPTS 1000 int main( int argc, const char *argv[] ) { int i, k; PLFLT *x, *y, *z; PLFLT r; char title[80]; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); for ( k = 0; k < 4; k++ ) test_poly( k ); x = (PLFLT *) malloc( NPTS * sizeof ( PLFLT ) ); y = (PLFLT *) malloc( NPTS * sizeof ( PLFLT ) ); z = (PLFLT *) malloc( NPTS * sizeof ( PLFLT ) ); // From the mind of a sick and twisted physicist... for ( i = 0; i < NPTS; i++ ) { z[i] = -1. + 2. * i / NPTS; // Pick one ... // r = 1. - ( (PLFLT) i / (PLFLT) NPTS ); r = z[i]; x[i] = r * cos( 2. * M_PI * 6. * i / NPTS ); y[i] = r * sin( 2. * M_PI * 6. * i / NPTS ); } for ( k = 0; k < 4; k++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -0.9, 1.1 ); plcol0( 1 ); plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); plcol0( 2 ); if ( opt[k] ) { plline3( NPTS, x, y, z ); } else { // U+22C5 DOT OPERATOR. plstring3( NPTS, x, y, z, "⋅" ); } plcol0( 3 ); sprintf( title, "#frPLplot Example 18 - Alt=%.0f, Az=%.0f", alt[k], az[k] ); plmtex( "t", 1.0, 0.5, 0.5, title ); } // Clean up free( (void *) x ); free( (void *) y ); free( (void *) z ); plend(); exit( 0 ); } void test_poly( int k ) { PLFLT *x, *y, *z; int i, j; PLFLT pi, two_pi; PLINT draw[][4] = { { 1, 1, 1, 1 }, { 1, 0, 1, 0 }, { 0, 1, 0, 1 }, { 1, 1, 0, 0 } }; pi = M_PI, two_pi = 2. * pi; x = (PLFLT *) malloc( 5 * sizeof ( PLFLT ) ); y = (PLFLT *) malloc( 5 * sizeof ( PLFLT ) ); z = (PLFLT *) malloc( 5 * sizeof ( PLFLT ) ); pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -0.9, 1.1 ); plcol0( 1 ); plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); plcol0( 2 ); #define THETA( a ) ( two_pi * ( a ) / 20. ) #define PHI( a ) ( pi * ( a ) / 20.1 ) // // x = r sin(phi) cos(theta) // y = r sin(phi) sin(theta) // z = r cos(phi) // r = 1 :=) // for ( i = 0; i < 20; i++ ) { for ( j = 0; j < 20; j++ ) { x[0] = sin( PHI( j ) ) * cos( THETA( i ) ); y[0] = sin( PHI( j ) ) * sin( THETA( i ) ); z[0] = cos( PHI( j ) ); x[1] = sin( PHI( j + 1 ) ) * cos( THETA( i ) ); y[1] = sin( PHI( j + 1 ) ) * sin( THETA( i ) ); z[1] = cos( PHI( j + 1 ) ); x[2] = sin( PHI( j + 1 ) ) * cos( THETA( i + 1 ) ); y[2] = sin( PHI( j + 1 ) ) * sin( THETA( i + 1 ) ); z[2] = cos( PHI( j + 1 ) ); x[3] = sin( PHI( j ) ) * cos( THETA( i + 1 ) ); y[3] = sin( PHI( j ) ) * sin( THETA( i + 1 ) ); z[3] = cos( PHI( j ) ); x[4] = sin( PHI( j ) ) * cos( THETA( i ) ); y[4] = sin( PHI( j ) ) * sin( THETA( i ) ); z[4] = cos( PHI( j ) ); plpoly3( 5, x, y, z, draw[k], 1 ); } } plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, "unit radius sphere" ); // Clean up free( (void *) x ); free( (void *) y ); free( (void *) z ); } plplot-5.10.0+dfsg/examples/c/x31c.c 644 1750 1750 2071511543675237 157540ustar andrewandrew// $Id: x31c.c 11680 2011-03-27 17:57:51Z airwin $ // // Copyright (C) 2008 Alan W. Irwin // Copyright (C) 2008 Andrew Ross // // set/get tester // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" int main( int argc, const char *argv[] ) { PLFLT xmin, xmax, ymin, ymax, zxmin, zxmax, zymin, zymax; PLFLT xmid, ymid, wx, wy; PLFLT mar, aspect, jx, jy, ori; PLINT win, level2, digmax, digits, compression1, compression2; PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; PLFLT xp1, yp1; PLINT xleng1, yleng1, xoff1, yoff1; PLFLT xp2, yp2; PLINT xleng2, yleng2, xoff2, yoff2; PLINT fam0, num0, bmax0; PLINT fam1, num1, bmax1; PLINT fam2, num2, bmax2; PLINT r, g, b; PLFLT a; PLINT r1[] = { 0, 255 }; PLINT g1[] = { 255, 0 }; PLINT b1[] = { 0, 0 }; PLFLT a1[] = { 1.0, 1.0 }; int status; char fnam[256]; // Parse and process command line arguments status = 0; (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Test setting / getting familying parameters before plinit // Save values set by plparseopts to be restored later. plgfam( &fam0, &num0, &bmax0 ); fam1 = 0; num1 = 10; bmax1 = 1000; plsfam( fam1, num1, bmax1 ); // Retrieve the same values? plgfam( &fam2, &num2, &bmax2 ); printf( "family parameters: fam, num, bmax = %d %d %d\n", fam2, num2, bmax2 ); if ( fam2 != fam1 || num2 != num1 || bmax2 != bmax1 ) { fputs( "plgfam test failed\n", stderr ); status = 1; } // Restore values set initially by plparseopts. plsfam( fam0, num0, bmax0 ); // Test setting / getting page parameters before plinit // Save values set by plparseopts to be restored later. plgpage( &xp0, &yp0, &xleng0, &yleng0, &xoff0, &yoff0 ); xp1 = 200.; yp1 = 200.; xleng1 = 400; yleng1 = 200; xoff1 = 10; yoff1 = 20; plspage( xp1, yp1, xleng1, yleng1, xoff1, yoff1 ); // Retrieve the same values? plgpage( &xp2, &yp2, &xleng2, &yleng2, &xoff2, &yoff2 ); printf( "page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d\n", xp2, yp2, xleng2, yleng2, xoff2, yoff2 ); if ( xp2 != xp1 || yp2 != yp1 || xleng2 != xleng1 || yleng2 != yleng1 || xoff2 != xoff1 || yoff2 != yoff1 ) { fputs( "plgpage test failed\n", stderr ); status = 1; } // Restore values set initially by plparseopts. plspage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); // Test setting / getting compression parameter across plinit. compression1 = 95; plscompression( compression1 ); // Initialize plplot plinit(); // Test if device initialization screwed around with the preset // compression parameter. plgcompression( &compression2 ); printf( "Output various PLplot parameters\n" ); printf( "compression parameter = %d\n", compression2 ); if ( compression2 != compression1 ) { fputs( "plgcompression test failed\n", stderr ); status = 1; } // Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure // they work without any obvious error messages. plscolor( 1 ); plscol0( 1, 255, 0, 0 ); plscmap1( r1, g1, b1, 2 ); plscmap1a( r1, g1, b1, a1, 2 ); plglevel( &level2 ); printf( "level parameter = %d\n", level2 ); if ( level2 != 1 ) { fputs( "plglevel test failed.\n", stderr ); status = 1; } pladv( 0 ); plvpor( 0.01, 0.99, 0.02, 0.49 ); plgvpd( &xmin, &xmax, &ymin, &ymax ); printf( "plvpor: xmin, xmax, ymin, ymax = %f %f %f %f\n", xmin, xmax, ymin, ymax ); if ( xmin != 0.01 || xmax != 0.99 || ymin != 0.02 || ymax != 0.49 ) { fputs( "plgvpd test failed\n", stderr ); status = 1; } xmid = 0.5 * ( xmin + xmax ); ymid = 0.5 * ( ymin + ymax ); plwind( 0.2, 0.3, 0.4, 0.5 ); plgvpw( &xmin, &xmax, &ymin, &ymax ); printf( "plwind: xmin, xmax, ymin, ymax = %f %f %f %f\n", xmin, xmax, ymin, ymax ); if ( xmin != 0.2 || xmax != 0.3 || ymin != 0.4 || ymax != 0.5 ) { fputs( "plgvpw test failed\n", stderr ); status = 1; } // Get world coordinates for middle of viewport plcalc_world( xmid, ymid, &wx, &wy, &win ); printf( "world parameters: wx, wy, win = %f %f %d\n", wx, wy, win ); if ( fabs( wx - 0.5 * ( xmin + xmax ) ) > 1.0E-5 || fabs( wy - 0.5 * ( ymin + ymax ) ) > 1.0E-5 ) { fputs( "plcalc_world test failed\n", stderr ); status = 1; } // Retrieve and print the name of the output file (if any). // This goes to stderr not stdout since it will vary between tests and // we want stdout to be identical for compare test. plgfnam( fnam ); if ( fnam[0] == '\0' ) { printf( "No output file name is set\n" ); } else { printf( "Output file name read\n" ); } fprintf( stderr, "Output file name is %s\n", fnam ); // Set and get the number of digits used to display axis labels // Note digits is currently ignored in pls[xyz]ax and // therefore it does not make sense to test the returned // value plsxax( 3, 0 ); plgxax( &digmax, &digits ); printf( "x axis parameters: digmax, digits = %d %d\n", digmax, digits ); if ( digmax != 3 ) { fputs( "plgxax test failed\n", stderr ); status = 1; } plsyax( 4, 0 ); plgyax( &digmax, &digits ); printf( "y axis parameters: digmax, digits = %d %d\n", digmax, digits ); if ( digmax != 4 ) { fputs( "plgyax test failed\n", stderr ); status = 1; } plszax( 5, 0 ); plgzax( &digmax, &digits ); printf( "z axis parameters: digmax, digits = %d %d\n", digmax, digits ); if ( digmax != 5 ) { fputs( "plgzax test failed\n", stderr ); status = 1; } plsdidev( 0.05, PL_NOTSET, 0.1, 0.2 ); plgdidev( &mar, &aspect, &jx, &jy ); printf( "device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n", mar, aspect, jx, jy ); if ( mar != 0.05 || jx != 0.1 || jy != 0.2 ) { fputs( "plgdidev test failed\n", stderr ); status = 1; } plsdiori( 1.0 ); plgdiori( &ori ); printf( "ori parameter = %f\n", ori ); if ( ori != 1.0 ) { fputs( "plgdiori test failed\n", stderr ); status = 1; } plsdiplt( 0.1, 0.2, 0.9, 0.8 ); plgdiplt( &xmin, &ymin, &xmax, &ymax ); printf( "plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", xmin, ymin, xmax, ymax ); if ( xmin != 0.1 || xmax != 0.9 || ymin != 0.2 || ymax != 0.8 ) { fputs( "plgdiplt test failed\n", stderr ); status = 1; } plsdiplz( 0.1, 0.1, 0.9, 0.9 ); plgdiplt( &zxmin, &zymin, &zxmax, &zymax ); printf( "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", zxmin, zymin, zxmax, zymax ); if ( fabs( zxmin - ( xmin + ( xmax - xmin ) * 0.1 ) ) > 1.0E-5 || fabs( zxmax - ( xmin + ( xmax - xmin ) * 0.9 ) ) > 1.0E-5 || fabs( zymin - ( ymin + ( ymax - ymin ) * 0.1 ) ) > 1.0E-5 || fabs( zymax - ( ymin + ( ymax - ymin ) * 0.9 ) ) > 1.0E-5 ) { fputs( "plsdiplz test failed\n", stderr ); status = 1; } plscolbg( 10, 20, 30 ); plgcolbg( &r, &g, &b ); printf( "background colour parameters: r, g, b = %d %d %d\n", r, g, b ); if ( r != 10 || g != 20 || b != 30 ) { fputs( "plgcolbg test failed\n", stderr ); status = 1; } plscolbga( 20, 30, 40, 0.5 ); plgcolbga( &r, &g, &b, &a ); printf( "background/transparency colour parameters: r, g, b, a = %d %d %d %f\n", r, g, b, a ); if ( r != 20 || g != 30 || b != 40 || a != 0.5 ) { fputs( "plgcolbga test failed\n", stderr ); status = 1; } plend(); exit( status ); } plplot-5.10.0+dfsg/examples/c/x21c.c 644 1750 1750 2733112140523621 157330ustar andrewandrew// $Id: x21c.c 12324 2013-05-02 17:51:13Z airwin $ // Grid data demo // // Copyright (C) 2004 Joao Cardoso // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" // Options data structure definition. static PLINT pts = 500; static PLINT xp = 25; static PLINT yp = 20; static PLINT nl = 16; static int knn_order = 20; static PLFLT threshold = 1.001; static PLFLT wmin = -1e3; static int randn = 0; static int rosen = 0; static PLOptionTable options[] = { { "npts", NULL, NULL, &pts, PL_OPT_INT, "-npts points", "Specify number of random points to generate [500]" }, { "randn", NULL, NULL, &randn, PL_OPT_BOOL, "-randn", "Normal instead of uniform sampling -- the effective \n\ \t\t\t number of points will be smaller than the specified." }, { "rosen", NULL, NULL, &rosen, PL_OPT_BOOL, "-rosen", "Generate points from the Rosenbrock function." }, { "nx", NULL, NULL, &xp, PL_OPT_INT, "-nx points", "Specify grid x dimension [25]" }, { "ny", NULL, NULL, &yp, PL_OPT_INT, "-ny points", "Specify grid y dimension [20]" }, { "nlevel", NULL, NULL, &nl, PL_OPT_INT, "-nlevel ", "Specify number of contour levels [15]" }, { "knn_order", NULL, NULL, &knn_order, PL_OPT_INT, "-knn_order order", "Specify the number of neighbors [20]" }, { "threshold", NULL, NULL, &threshold, PL_OPT_FLOAT, "-threshold float", "Specify what a thin triangle is [1. < [1.001] < 2.]" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; void create_data( PLFLT **xi, PLFLT **yi, PLFLT **zi, int npts ); void free_data( PLFLT *x, PLFLT *y, PLFLT *z ); void create_grid( PLFLT **xi, int px, PLFLT **yi, int py ); void free_grid( PLFLT *x, PLFLT *y ); static void cmap1_init( void ) { PLFLT i[2], h[2], l[2], s[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; plscmap1n( 256 ); c_plscmap1l( 0, 2, i, h, l, s, NULL ); } PLFLT xm, xM, ym, yM; int main( int argc, const char *argv[] ) { PLFLT *x, *y, *z, *clev; PLFLT *xg, *yg, **zg; PLFLT zmin, zmax, lzm, lzM; int i, j, k; PLINT alg; const char *title[] = { "Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted" }; PLFLT opt[] = { 0., 0., 0., 0., 0., 0. }; xm = ym = -0.2; xM = yM = 0.6; plMergeOpts( options, "x21c options", NULL ); plparseopts( &argc, argv, PL_PARSE_FULL ); opt[2] = wmin; opt[3] = (PLFLT) knn_order; opt[4] = threshold; // Initialize plplot plinit(); // Use a colour map with no black band in the middle. cmap1_init(); // Initialise random number generator plseed( 5489 ); create_data( &x, &y, &z, pts ); // the sampled data zmin = z[0]; zmax = z[0]; for ( i = 1; i < pts; i++ ) { if ( z[i] > zmax ) zmax = z[i]; if ( z[i] < zmin ) zmin = z[i]; } create_grid( &xg, xp, &yg, yp ); // grid the data at plAlloc2dGrid( &zg, xp, yp ); // the output grided data clev = (PLFLT *) malloc( (size_t) nl * sizeof ( PLFLT ) ); plcol0( 1 ); plenv( xm, xM, ym, yM, 2, 0 ); plcol0( 15 ); pllab( "X", "Y", "The original data sampling" ); for ( i = 0; i < pts; i++ ) { plcol1( ( z[i] - zmin ) / ( zmax - zmin ) ); // The following plstring call should be the the equivalent of // plpoin( 1, &x[i], &y[i], 5 ); Use plstring because it is // not deprecated like plpoin and has much more powerful // capabilities. N.B. symbol 141 works for Hershey devices // (e.g., -dev xwin) only if plfontld( 0 ) has been called // while symbol 727 works only if plfontld( 1 ) has been // called. The latter is the default which is why we use 727 // here to represent a centred X (multiplication) symbol. // This dependence on plfontld is one of the limitations of // the Hershey escapes for PLplot, but the upside is you get // reasonable results for both Hershey and Unicode devices. plstring( 1, &x[i], &y[i], "#(727)" ); } pladv( 0 ); plssub( 3, 2 ); for ( k = 0; k < 2; k++ ) { pladv( 0 ); for ( alg = 1; alg < 7; alg++ ) { plgriddata( x, y, z, pts, xg, xp, yg, yp, zg, alg, opt[alg - 1] ); // - CSA can generate NaNs (only interpolates?!). // - DTLI and NNI can generate NaNs for points outside the convex hull // of the data points. // - NNLI can generate NaNs if a sufficiently thick triangle is not found // // PLplot should be NaN/Inf aware, but changing it now is quite a job... // so, instead of not plotting the NaN regions, a weighted average over // the neighbors is done. // if ( alg == GRID_CSA || alg == GRID_DTLI || alg == GRID_NNLI || alg == GRID_NNI ) { int ii, jj; PLFLT dist, d; for ( i = 0; i < xp; i++ ) { for ( j = 0; j < yp; j++ ) { if ( isnan( zg[i][j] ) ) // average (IDW) over the 8 neighbors { zg[i][j] = 0.; dist = 0.; for ( ii = i - 1; ii <= i + 1 && ii < xp; ii++ ) { for ( jj = j - 1; jj <= j + 1 && jj < yp; jj++ ) { if ( ii >= 0 && jj >= 0 && !isnan( zg[ii][jj] ) ) { d = ( abs( ii - i ) + abs( jj - j ) ) == 1 ? 1. : 1.4142; zg[i][j] += zg[ii][jj] / ( d * d ); dist += d; } } } if ( dist != 0. ) zg[i][j] /= dist; else zg[i][j] = zmin; } } } } plMinMax2dGrid( (const PLFLT * const *) zg, xp, yp, &lzM, &lzm ); lzm = MIN( lzm, zmin ); lzM = MAX( lzM, zmax ); // Increase limits slightly to prevent spurious contours // due to rounding errors lzm = lzm - 0.01; lzM = lzM + 0.01; plcol0( 1 ); pladv( alg ); if ( k == 0 ) { for ( i = 0; i < nl; i++ ) clev[i] = lzm + ( lzM - lzm ) / ( nl - 1 ) * i; plenv0( xm, xM, ym, yM, 2, 0 ); plcol0( 15 ); pllab( "X", "Y", title[alg - 1] ); plshades( (const PLFLT * const *) zg, xp, yp, NULL, xm, xM, ym, yM, clev, nl, 1., 0, 1., plfill, 1, NULL, NULL ); plcol0( 2 ); } else { for ( i = 0; i < nl; i++ ) clev[i] = lzm + ( lzM - lzm ) / ( nl - 1 ) * i; plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.1, 0.75, -0.65, 1.20 ); // // For the comparison to be fair, all plots should have the // same z values, but to get the max/min of the data generated // by all algorithms would imply two passes. Keep it simple. // // plw3d(1., 1., 1., xm, xM, ym, yM, zmin, zmax, 30, -60); // plw3d( 1., 1., 1., xm, xM, ym, yM, lzm, lzM, 30, -40 ); plbox3( "bntu", "X", 0., 0, "bntu", "Y", 0., 0, "bcdfntu", "Z", 0.5, 0 ); plcol0( 15 ); pllab( "", "", title[alg - 1] ); plot3dc( xg, yg, (const PLFLT * const *) zg, xp, yp, DRAW_LINEXY | MAG_COLOR | BASE_CONT, clev, nl ); } } } plend(); free_data( x, y, z ); free_grid( xg, yg ); free( (void *) clev ); plFree2dGrid( zg, xp, yp ); exit( 0 ); } void create_grid( PLFLT **xi, int px, PLFLT **yi, int py ) { PLFLT *x, *y; int i; x = *xi = (PLFLT *) malloc( (size_t) px * sizeof ( PLFLT ) ); y = *yi = (PLFLT *) malloc( (size_t) py * sizeof ( PLFLT ) ); for ( i = 0; i < px; i++ ) *x++ = xm + ( xM - xm ) * i / ( px - 1. ); for ( i = 0; i < py; i++ ) *y++ = ym + ( yM - ym ) * i / ( py - 1. ); } void free_grid( PLFLT *xi, PLFLT *yi ) { free( (void *) xi ); free( (void *) yi ); } void create_data( PLFLT **xi, PLFLT **yi, PLFLT **zi, int npts ) { int i; PLFLT *x, *y, *z, r; PLFLT xt, yt; *xi = x = (PLFLT *) malloc( (size_t) npts * sizeof ( PLFLT ) ); *yi = y = (PLFLT *) malloc( (size_t) npts * sizeof ( PLFLT ) ); *zi = z = (PLFLT *) malloc( (size_t) npts * sizeof ( PLFLT ) ); for ( i = 0; i < npts; i++ ) { xt = ( xM - xm ) * plrandd(); yt = ( yM - ym ) * plrandd(); if ( !randn ) { *x = xt + xm; *y = yt + ym; } else // std=1, meaning that many points are outside the plot range { *x = sqrt( -2. * log( xt ) ) * cos( 2. * M_PI * yt ) + xm; *y = sqrt( -2. * log( xt ) ) * sin( 2. * M_PI * yt ) + ym; } if ( !rosen ) { r = sqrt( ( *x ) * ( *x ) + ( *y ) * ( *y ) ); *z = exp( -r * r ) * cos( 2.0 * M_PI * r ); } else { *z = log( pow( 1. - *x, 2. ) + 100. * pow( *y - pow( *x, 2. ), 2. ) ); } x++; y++; z++; } } void free_data( PLFLT *x, PLFLT *y, PLFLT *z ) { free( (void *) x ); free( (void *) y ); free( (void *) z ); } plplot-5.10.0+dfsg/examples/c/x24c.c 644 1750 1750 572711645760320 157330ustar andrewandrew// // Unicode Pace Flag // // Copyright (C) 2005 Rafael Laboissiere // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // For Debian, the required font packages are the following: // ttf-arphic-bkai00mp // ttf-freefont // ttf-devanagari-fonts // ttf-unfonts // ttf-bengali-fonts // // For the latest Ubuntu systems lohit_hi.ttf has been moved to the // ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you // will have to use this package instead and update the font path. // #include "plcdemos.h" static PLINT red[] = { 240, 204, 204, 204, 0, 39, 125 }; static PLINT green[] = { 240, 0, 125, 204, 204, 80, 0 }; static PLINT blue[] = { 240, 0, 0, 0, 0, 204, 125 }; static PLFLT px[] = { 0.0, 0.0, 1.0, 1.0 }; static PLFLT py[] = { 0.0, 0.25, 0.25, 0.0 }; static PLFLT sx[] = { 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 }; static PLFLT sy[] = { 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 }; // Taken from http://www.columbia.edu/~fdc/pace/ static const char* peace[] = { // Mandarin "#<0x00>和平", // Hindi "#<0x20>शांति", // English "#<0x10>Peace", // Hebrew "#<0x10>שלום", // Russian "#<0x10>Мир", // German "#<0x10>Friede", // Korean "#<0x30>평화", // French "#<0x10>Paix", // Spanish "#<0x10>Paz", // Arabic "#<0x10>ﺳﻼم", // Turkish "#<0x10>Barış", // Kurdish "#<0x10>Hasîtî", }; int main( int argc, const char *argv[] ) { int i, j; plparseopts( &argc, argv, PL_PARSE_FULL ); plinit(); pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plcol0( 0 ); plbox( "", 1.0, 0, "", 1.0, 0 ); plscmap0n( 7 ); plscmap0( red, green, blue, 7 ); plschr( 0, 4.0 ); plfont( 1 ); for ( i = 0; i < 4; i++ ) { plcol0( i + 1 ); plfill( 4, px, py ); for ( j = 0; j < 4; j++ ) py [j] += 1.0 / 4.0; } plcol0( 0 ); for ( i = 0; i < 12; i++ ) plptex( sx [i], sy [i], 1.0, 0.0, 0.5, peace [i] ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x12c.c 644 1750 1750 402011462631041 157030ustar andrewandrew// $Id: x12c.c 11289 2010-10-29 20:44:17Z airwin $ // // Bar chart demo. // #include "plcdemos.h" void plfbox( PLFLT x0, PLFLT y0 ); //-------------------------------------------------------------------------- // main // // Does a simple bar chart, using color fill. If color fill is // unavailable, pattern fill is used instead (automatic). //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i; char string[20]; PLFLT y0[10]; static PLFLT pos[] = { 0.0, 0.25, 0.5, 0.75, 1.0 }; static PLFLT red[] = { 0.0, 0.25, 0.5, 1.0, 1.0 }; static PLFLT green[] = { 1.0, 0.5, 0.5, 0.5, 1.0 }; static PLFLT blue[] = { 1.0, 1.0, 0.5, 0.25, 0.0 }; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); plvsta(); plwind( 1980.0, 1990.0, 0.0, 35.0 ); plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 ); plcol0( 2 ); pllab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" ); y0[0] = 5; y0[1] = 15; y0[2] = 12; y0[3] = 24; y0[4] = 28; y0[5] = 30; y0[6] = 20; y0[7] = 8; y0[8] = 12; y0[9] = 3; plscmap1l( 1, 5, pos, red, green, blue, NULL ); for ( i = 0; i < 10; i++ ) { //plcol0(i + 1); plcol1( i / 9.0 ); plpsty( 0 ); plfbox( ( 1980. + i ), y0[i] ); sprintf( string, "%.0f", y0[i] ); plptex( ( 1980. + i + .5 ), ( y0[i] + 1. ), 1.0, 0.0, .5, string ); sprintf( string, "%d", 1980 + i ); plmtex( "b", 1.0, ( ( i + 1 ) * .1 - .05 ), 0.5, string ); } // Don't forget to call plend() to finish off! plend(); exit( 0 ); } void plfbox( PLFLT x0, PLFLT y0 ) { PLFLT x[4], y[4]; x[0] = x0; y[0] = 0.; x[1] = x0; y[1] = y0; x[2] = x0 + 1.; y[2] = y0; x[3] = x0 + 1.; y[3] = 0.; plfill( 4, x, y ); plcol0( 1 ); pllsty( 1 ); plline( 4, x, y ); } plplot-5.10.0+dfsg/examples/c/plcdemos.h 644 1750 1750 335611462631041 167540ustar andrewandrew// $Id: plcdemos.h 11289 2010-10-29 20:44:17Z airwin $ // // Everything needed by the C demo programs. // Created to avoid junking up plplot.h with this stuff. // #ifndef __PLCDEMOS_H__ #define __PLCDEMOS_H__ #include #include #include #include "plConfig.h" #include "plplot.h" // define PI if not defined by math.h // Actually M_PI seems to be more widely used so we deprecate PI. #ifndef PI #define PI 3.1415926535897932384 #endif #ifndef M_PI #define M_PI 3.1415926535897932384 #endif // various utility macros #ifndef MAX #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef MIN #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef ROUND #define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) ) #endif // Declarations for save string functions #ifdef PL_HAVE_SNPRINTF // In case only _snprintf is declared (as for Visual C++ and // Borland compiler toolset) we redefine the function names #ifdef _PL_HAVE_SNPRINTF #define snprintf _snprintf #define snscanf _snscanf #endif // _PL_HAVE_SNPRINTF #else // !PL_HAVE_SNPRINTF // declare dummy functions which just call the unsafe // functions ignoring the size of the string int plsnprintf( char *buffer, int n, const char *format, ... ); int plsnscanf( const char *buffer, int n, const char *format, ... ); #define snprintf plsnprintf #define snscanf plsnscanf #endif // PL_HAVE_SNPRINTF // Add in missing isnan definition if required #if defined ( PL__HAVE_ISNAN ) # define isnan _isnan # if defined ( _MSC_VER ) # include # endif #endif #if !defined ( PL_HAVE_ISNAN ) # define isnan( x ) ( ( x ) != ( x ) ) #endif #endif // __PLCDEMOS_H__ plplot-5.10.0+dfsg/examples/c/Makefile.examples.in 644 1750 1750 632711701326310 206540ustar andrewandrew# examples/c/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2002, 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA CC = @CC@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ RPATHCMD = @RPATHCMD@ @gcw_true@PLPLOTCANVAS_EXECUTABLES_list = \ @gcw_true@ plplotcanvas_demo$(EXEEXT) \ @gcw_true@ plplotcanvas_animation$(EXEEXT) @extXdrawable_true@extXdrawable_EXECUTABLES_list = \ @extXdrawable_true@ extXdrawable_demo$(EXEEXT) @extcairo_true@extcairo_EXECUTABLES_list = \ @extcairo_true@ ext-cairo-test$(EXEEXT) EXECUTABLES_list = \ x00c$(EXEEXT) \ x01c$(EXEEXT) \ x02c$(EXEEXT) \ x03c$(EXEEXT) \ x04c$(EXEEXT) \ x05c$(EXEEXT) \ x06c$(EXEEXT) \ x07c$(EXEEXT) \ x08c$(EXEEXT) \ x09c$(EXEEXT) \ x10c$(EXEEXT) \ x11c$(EXEEXT) \ x12c$(EXEEXT) \ x13c$(EXEEXT) \ x14c$(EXEEXT) \ x15c$(EXEEXT) \ x16c$(EXEEXT) \ x17c$(EXEEXT) \ x18c$(EXEEXT) \ x19c$(EXEEXT) \ x20c$(EXEEXT) \ x21c$(EXEEXT) \ x22c$(EXEEXT) \ x23c$(EXEEXT) \ x24c$(EXEEXT) \ x25c$(EXEEXT) \ x26c$(EXEEXT) \ x27c$(EXEEXT) \ x28c$(EXEEXT) \ x29c$(EXEEXT) \ x30c$(EXEEXT) \ x31c$(EXEEXT) \ x32c$(EXEEXT) \ x33c$(EXEEXT) \ $(PLPLOTCANVAS_EXECUTABLES_list) \ $(extXdrawable_EXECUTABLES_list) \ $(extcairo_EXECUTABLES_list) all: $(EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) @gcw_true@plplotcanvas_demo$(EXEEXT): plplotcanvas_demo.c @gcw_true@ $(CC) $< -o $@ $(RPATHCMD) \ @gcw_true@ `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-gnome2` @gcw_true@plplotcanvas_animation$(EXEEXT): plplotcanvas_animation.c @gcw_true@ $(CC) $< -o $@ $(RPATHCMD) \ @gcw_true@ `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-gnome2` \ @gcw_true@ `pkg-config @PC_STATIC_OPTION@ --cflags --libs gthread-2.0` @extXdrawable_true@extXdrawable_demo$(EXEEXT): extXdrawable_demo.c @extXdrawable_true@ $(CC) $< -o $@ $(RPATHCMD) \ @extXdrawable_true@ `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG) gtk+-x11-2.0` @extcairo_true@ext-cairo-test$(EXEEXT): ext-cairo-test.c @extcairo_true@ $(CC) $< -o $@ $(RPATHCMD) \ @extcairo_true@ `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG) cairo` .c$(EXEEXT): $(CC) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)` .SUFFIXES: .c $(EXEEXT) plplot-5.10.0+dfsg/examples/c/x34c.c 644 1750 1750 607511645771433 157400ustar andrewandrew// $Id$ // // Drawing mode setting and getting example. // // Copyright (C) 2011 Hezekiah M. Carty // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" // Drawing modes to demonstrate #define NUM_MODES 3 PLINT drawing_modes[NUM_MODES] = { PL_DRAWMODE_DEFAULT, PL_DRAWMODE_REPLACE, PL_DRAWMODE_XOR }; const char *drawing_mode_names[NUM_MODES] = { "Default drawing mode", "Replace destination with source", "XOR drawing" }; void initialize_colors( void ); void draw_page( PLINT mode, const char *title ); //-------------------------------------------------------------------------- // main //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { PLINT mode; PLINT i; // PLplot initialization // Parse and process command line arguments plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot plinit(); // Check for drawing mode support mode = plgdrawmode(); if ( mode == PL_DRAWMODE_UNKNOWN ) { printf( "WARNING: This driver does not support drawing mode getting/setting" ); } else { // Setup colors initialize_colors(); // Draw one page per drawing mode for ( i = 0; i < NUM_MODES; i++ ) { draw_page( drawing_modes[i], drawing_mode_names[i] ); } } // Clean up plend(); exit( 0 ); } void initialize_colors( void ) { plscol0( 0, 255, 255, 255 ); plscol0( 1, 0, 0, 0 ); plscol0( 2, 255, 0, 0 ); plscol0a( 3, 0, 0, 255, 0.3 ); } void draw_page( PLINT mode, const char *title ) { PLFLT xs[3], ys[3]; PLFLT over_x, over_y, over_r; // A triangle for the background xs[0] = 0.0; xs[1] = 1.0; xs[2] = 0.0; ys[0] = 0.0; ys[1] = 1.0; ys[2] = 1.0; // A circle for the foreground over_x = 0.5; over_y = 0.5; over_r = 0.4; plcol0( 1 ); // Setup a plot window plenv( 0.0, 1.0, 0.0, 1.0, 1, 0 ); // Show which mode we're using pllab( "", "", title ); // Draw a background triangle using the default drawing mode plcol0( 2 ); plsdrawmode( PL_DRAWMODE_DEFAULT ); plfill( 3, xs, ys ); // Draw a circle in the given drawing mode plcol0( 3 ); plsdrawmode( mode ); plarc( over_x, over_y, over_r, over_r, 0.0, 360.0, 0.0, 1 ); } plplot-5.10.0+dfsg/examples/c/x16c.c 644 1750 1750 3773612147244645 157660ustar andrewandrew// $Id: x16c.c 12346 2013-05-22 22:41:41Z andrewross $ // // plshade demo, using color fill. // // Maurice LeBrun // IFS, University of Texas at Austin // 20 Mar 1994 // #include "plcdemos.h" // Fundamental settings. See notes[] for more info. static int ns = 20; // Default number of shade levels static int nx = 35; // Default number of data points in x static int ny = 46; // Default number of data points in y static int exclude = 0; // By default do not plot a page illustrating // exclusion. API is probably going to change // anyway, and cannot be reproduced by any // front end other than the C one. // For now, don't show the colorbars while we are working out the API. static int colorbar = 1; // polar plot data #define PERIMETERPTS 100 // Transformation function PLFLT tr[6]; static void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * PL_UNUSED( pltr_data ) ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } // Function prototypes static void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax ); PLINT zdefined( PLFLT x, PLFLT y ); // Options data structure definition. static PLOptionTable options[] = { { "colorbar", // Turns on the colorbar for each page NULL, NULL, &colorbar, PL_OPT_BOOL, "-colorbar", "Plot a \"color bar\" on each page." }, { "exclude", // Turns on page showing exclusion NULL, NULL, &exclude, PL_OPT_BOOL, "-exclude", "Plot the \"exclusion\" page." }, { "ns", // Number of shade levels NULL, NULL, &ns, PL_OPT_INT, "-ns levels", "Sets number of shade levels" }, { "nx", // Number of data points in x NULL, NULL, &nx, PL_OPT_INT, "-nx xpts", "Sets number of data points in x" }, { "ny", // Number of data points in y NULL, NULL, &ny, PL_OPT_INT, "-ny ypts", "Sets number of data points in y" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; static const char *notes[] = { "To get smoother color variation, increase ns, nx, and ny. To get faster", "response (especially on a serial link), decrease them. A decent but quick", "test results from ns around 5 and nx, ny around 25.", NULL }; PLINT zdefined( PLFLT x, PLFLT y ) { PLFLT z = sqrt( x * x + y * y ); return z < 0.4 || z > 0.6; } //-------------------------------------------------------------------------- // main // // Does several shade plots using different coordinate mappings. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i, j; PLFLT x, y, argx, argy, distort, r, t; PLFLT px[PERIMETERPTS], py[PERIMETERPTS]; PLFLT **z, **w, zmin, zmax; PLFLT *clevel, *shedge, *xg1, *yg1; PLcGrid cgrid1; PLcGrid2 cgrid2; PLFLT fill_width = 2., cont_width = 0.; PLFLT colorbar_width, colorbar_height; PLINT cont_color = 0; #define NUM_AXES 1 PLINT n_axis_opts = NUM_AXES; const char *axis_opts[] = { "bcvtm", }; PLINT num_values[NUM_AXES]; PLFLT *values[NUM_AXES]; PLFLT axis_ticks[NUM_AXES] = { 0.0, }; PLINT axis_subticks[NUM_AXES] = { 0, }; #define NUM_LABELS 1 PLINT n_labels = NUM_LABELS; PLINT label_opts[] = { PL_COLORBAR_LABEL_BOTTOM, }; const char *labels[] = { "Magnitude", }; // Parse and process command line arguments plMergeOpts( options, "x16c options", notes ); plparseopts( &argc, argv, PL_PARSE_FULL ); // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); // Initialize plplot plinit(); // Set up transformation function tr[0] = 2. / ( nx - 1 ); tr[1] = 0.0; tr[2] = -1.0; tr[3] = 0.0; tr[4] = 2. / ( ny - 1 ); tr[5] = -1.0; // Allocate data structures clevel = (PLFLT *) calloc( (size_t) ns, sizeof ( PLFLT ) ); shedge = (PLFLT *) calloc( (size_t) ( ns + 1 ), sizeof ( PLFLT ) ); xg1 = (PLFLT *) calloc( (size_t) nx, sizeof ( PLFLT ) ); yg1 = (PLFLT *) calloc( (size_t) ny, sizeof ( PLFLT ) ); plAlloc2dGrid( &z, nx, ny ); plAlloc2dGrid( &w, nx, ny ); // Set up data array for ( i = 0; i < nx; i++ ) { x = (double) ( i - ( nx / 2 ) ) / (double) ( nx / 2 ); for ( j = 0; j < ny; j++ ) { y = (double) ( j - ( ny / 2 ) ) / (double) ( ny / 2 ) - 1.0; z[i][j] = -sin( 7. * x ) * cos( 7. * y ) + x * x - y * y; w[i][j] = -cos( 7. * x ) * sin( 7. * y ) + 2 * x * y; } } f2mnmx( z, nx, ny, &zmin, &zmax ); for ( i = 0; i < ns; i++ ) clevel[i] = zmin + ( zmax - zmin ) * ( i + 0.5 ) / (PLFLT) ns; for ( i = 0; i < ns + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * (PLFLT) i / (PLFLT) ns; // Set up coordinate grids cgrid1.xg = xg1; cgrid1.yg = yg1; cgrid1.nx = nx; cgrid1.ny = ny; plAlloc2dGrid( &cgrid2.xg, nx, ny ); plAlloc2dGrid( &cgrid2.yg, nx, ny ); cgrid2.nx = nx; cgrid2.ny = ny; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { mypltr( (PLFLT) i, (PLFLT) j, &x, &y, NULL ); argx = x * M_PI / 2; argy = y * M_PI / 2; distort = 0.4; cgrid1.xg[i] = x + distort * cos( argx ); cgrid1.yg[j] = y - distort * cos( argy ); cgrid2.xg[i][j] = x + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = y - distort * cos( argx ) * cos( argy ); } } // Plot using identity transform pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( (const PLFLT * const *) z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plfill, 1, NULL, NULL ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); // // plcont((const PLFLT **) w, nx, ny, 1, nx, 1, ny, clevel, ns, mypltr, NULL); // pllab( "distance", "altitude", "Bogon density" ); // Plot using 1d coordinate transform // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_blue_yellow.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( (const PLFLT * const *) z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plfill, 1, pltr1, (void *) &cgrid1 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); // // plcont((const PLFLT **) w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr1, (void *) &cgrid1); // pllab( "distance", "altitude", "Bogon density" ); // Plot using 2d coordinate transform // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_blue_red.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( (const PLFLT * const *) z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plfill, 0, pltr2, (void *) &cgrid2 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); plcont( (const PLFLT * const *) w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr2, (void *) &cgrid2 ); pllab( "distance", "altitude", "Bogon density, with streamlines" ); // Plot using 2d coordinate transform // Load colour palettes plspal0( "" ); plspal1( "", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( (const PLFLT * const *) z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, 2, 3., plfill, 0, pltr2, (void *) &cgrid2 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3., n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); // plcont((const PLFLT **) w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr2, (void *) &cgrid2); pllab( "distance", "altitude", "Bogon density" ); // Note this exclusion API will probably change. // Plot using 2d coordinate transform and exclusion if ( exclude ) { // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); plpsty( 0 ); plshades( (const PLFLT * const *) z, nx, ny, zdefined, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plfill, 0, pltr2, (void *) &cgrid2 ); plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pllab( "distance", "altitude", "Bogon density with exclusion" ); } // Example with polar coordinates. // Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); // Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv( 0 ); plvpor( .1, .9, .1, .9 ); plwind( -1., 1., -1., 1. ); plpsty( 0 ); // Build new coordinate matrices. for ( i = 0; i < nx; i++ ) { r = ( (PLFLT) i ) / ( nx - 1 ); for ( j = 0; j < ny; j++ ) { t = ( 2. * M_PI / ( ny - 1. ) ) * j; cgrid2.xg[i][j] = r * cos( t ); cgrid2.yg[i][j] = r * sin( t ); z[i][j] = exp( -r * r ) * cos( 5. * M_PI * r ) * cos( 5. * t ); } } // Need a new shedge to go along with the new data set. f2mnmx( z, nx, ny, &zmin, &zmax ); for ( i = 0; i < ns + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * (PLFLT) i / (PLFLT) ns; // Now we can shade the interior region. plshades( (const PLFLT * const *) z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plfill, 0, pltr2, (void *) &cgrid2 ); if ( colorbar ) { // Smaller text plschr( 0.0, 0.75 ); // Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; plcolorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); } // Now we can draw the perimeter. (If do before, shade stuff may overlap.) for ( i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * M_PI / ( PERIMETERPTS - 1 ) ) * (double) i; px[i] = cos( t ); py[i] = sin( t ); } plcol0( 1 ); plline( PERIMETERPTS, px, py ); // And label the plot. plcol0( 2 ); pllab( "", "", "Tokamak Bogon Instability" ); // Clean up free( (void *) clevel ); free( (void *) shedge ); free( (void *) xg1 ); free( (void *) yg1 ); plFree2dGrid( z, nx, ny ); plFree2dGrid( w, nx, ny ); plFree2dGrid( cgrid2.xg, nx, ny ); plFree2dGrid( cgrid2.yg, nx, ny ); plend(); exit( 0 ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- static void f2mnmx( PLFLT **f, PLINT nnx, PLINT nny, PLFLT *fnmin, PLFLT *fnmax ) { int i, j; *fnmax = f[0][0]; *fnmin = *fnmax; for ( i = 0; i < nnx; i++ ) { for ( j = 0; j < nny; j++ ) { *fnmax = MAX( *fnmax, f[i][j] ); *fnmin = MIN( *fnmin, f[i][j] ); } } } plplot-5.10.0+dfsg/examples/c/extXdrawable_demo.c 644 1750 1750 1611312276771565 206360ustar andrewandrew// // A simple GTK application demonstrating the use of the X Drawable // functionality of plplot's xcairo driver. // // Copyright (C) 2008 Jonathan Woithe // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // Set to 0 to draw direct to an X Window, 1 to draw via a pixmap #define TO_PIXMAP 1 #include #include #include // Needed for GDK_WINDOW_XID #include // Main menu structure static GtkItemFactoryEntry menu_items[] = { { "/_File", NULL, NULL, 0, "", NULL }, { "/File/_Quit", "Q", gtk_main_quit, 0, NULL, NULL }, }; #define APP_INITIAL_WIDTH 320 #define APP_INITIAL_HEIGHT 200 typedef struct App { GtkWidget *rootwindow; GtkWidget *plotwindow; GdkPixmap *plotwindow_pixmap; } App; App app; void setup_plot_drawable( App *a ); static gint ev_plotwindow_conf( GtkWidget *widget, GdkEventConfigure *ev, gpointer *data ); void init_app( App *a ); //-------------------------------------------------------------------------- void setup_plot_drawable( App *a ) { struct { Display *display; Drawable drawable; } xinfo; PLFLT x[3] = { 1, 3, 4 }; PLFLT y[3] = { 3, 2, 5 }; plsdev( "xcairo" ); plsetopt( "drvopt", "external_drawable" ); plinit(); #if TO_PIXMAP == 1 // Here we set up to draw to a pixmap xinfo.display = GDK_PIXMAP_XDISPLAY( a->plotwindow_pixmap ); xinfo.drawable = GDK_PIXMAP_XID( a->plotwindow_pixmap ); #else // Alternatively, we can do direct to a visible X Window xinfo.display = GDK_WINDOW_XDISPLAY( a->plotwindow->window ); xinfo.drawable = GDK_WINDOW_XID( a->plotwindow->window ); #endif pl_cmd( PLESC_DEVINIT, &xinfo ); plenv( 0, 5, 0, 5, 0, 0 ); plline( 3, x, y ); plend(); } //-------------------------------------------------------------------------- static gint ev_plotwindow_conf( GtkWidget *widget, GdkEventConfigure * PL_UNUSED( ev ), gpointer * PL_UNUSED( data ) ) { #if TO_PIXMAP == 1 // Allocate pixmap if ( app.plotwindow_pixmap ) gdk_pixmap_unref( app.plotwindow_pixmap ); app.plotwindow_pixmap = gdk_pixmap_new( widget->window, widget->allocation.width, widget->allocation.height, -1 ); // Clear the pixmap to a sensible background colour gdk_draw_rectangle( app.plotwindow_pixmap, widget->style->black_gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height ); // If drawing to a pixmap we can do a plot from the conf handler since // the pixmap is now realised (the window widget isn't). // setup_plot_drawable( &app ); #else (void) widget; // Cast to void to silence compiler warning about unused parameter #endif return ( TRUE ); } static gint ev_plotwindow_expose( GtkWidget *widget, GdkEventExpose *ev, gpointer * PL_UNUSED( data ) ) { #if TO_PIXMAP == 1 // Dump the cached plot (created in the conf handler) to the window from // the pixmap. We don't need to recreate the plot on each expose. // gdk_draw_pixmap( widget->window, widget->style->fg_gc[GTK_WIDGET_STATE( widget )], app.plotwindow_pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height ); #else (void) widget; // Cast to void to silence compiler warning about unused parameter (void) ev; // If drawing direct to an X Window, ensure GTK's double buffering // is turned off for that window or else the plot will be overridden // when the buffer is dumped to the screen. // setup_plot_drawable( &app ); #endif return ( TRUE ); } //-------------------------------------------------------------------------- void init_app( App *a ) { GtkWidget *menubar; GtkItemFactory *item_factory; GtkAccelGroup *accel_group = gtk_accel_group_new(); signed int nitems = sizeof ( menu_items ) / sizeof ( menu_items[0] ); GtkWidget *vbox, *hbox; // Create the top-level root window a->rootwindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_signal_connect( GTK_OBJECT( a->rootwindow ), "delete_event", gtk_main_quit, NULL ); // A toplevel box to hold things vbox = gtk_vbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( a->rootwindow ), vbox ); // Construct the main menu structure item_factory = gtk_item_factory_new( GTK_TYPE_MENU_BAR, "
", accel_group ); gtk_item_factory_create_items( item_factory, (guint) nitems, menu_items, NULL ); gtk_window_add_accel_group( GTK_WINDOW( a->rootwindow ), accel_group ); menubar = gtk_item_factory_get_widget( item_factory, "
" ); gtk_box_pack_start( GTK_BOX( vbox ), menubar, FALSE, FALSE, 0 ); gtk_widget_show( menubar ); // Fiddle with boxes to effect an indent from the edges of the root window hbox = gtk_hbox_new( FALSE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 10 ); vbox = gtk_vbox_new( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( hbox ), vbox, TRUE, TRUE, 10 ); // Add an area to plot into a->plotwindow = gtk_drawing_area_new(); a->plotwindow_pixmap = NULL; #if TO_PIXMAP != 1 // Turn off double buffering if we are plotting direct to the plotwindow // in setup_plot_drawable(). // GTK_WIDGET_UNSET_FLAGS( a->plotwindow, GTK_DOUBLE_BUFFERED ); #endif // By experiment, 3x3 seems to be the smallest size plplot can cope with. // Here we utilise the side effect that gtk_widget_set_size_request() // effectively sets the minimum size of the widget. // gtk_widget_set_size_request( a->plotwindow, 3, 3 ); gtk_box_pack_start( GTK_BOX( vbox ), a->plotwindow, TRUE, TRUE, 0 ); // Set the initial size of the application gtk_window_set_default_size( GTK_WINDOW( a->rootwindow ), APP_INITIAL_WIDTH, APP_INITIAL_HEIGHT ); g_signal_connect( G_OBJECT( a->plotwindow ), "configure_event", G_CALLBACK( ev_plotwindow_conf ), NULL ); g_signal_connect( G_OBJECT( a->plotwindow ), "expose_event", G_CALLBACK( ev_plotwindow_expose ), NULL ); gtk_widget_show_all( a->rootwindow ); } //-------------------------------------------------------------------------- int main( int argc, char *argv[] ) { gtk_init( &argc, &argv ); init_app( &app ); gtk_main(); return 0; } //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c/x04c.c 644 1750 1750 1011212253724162 157310ustar andrewandrew// $Id: x04c.c 12873 2013-12-17 01:27:14Z airwin $ // // Log plot demo. // #include "plcdemos.h" void plot1( int type ); //-------------------------------------------------------------------------- // main // // Illustration of logarithmic axes, and redefinition of window. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); plfont( 2 ); // Make log plots using two different styles. plot1( 0 ); plot1( 1 ); plend(); exit( 0 ); } //-------------------------------------------------------------------------- // plot1 // // Log-linear plot. //-------------------------------------------------------------------------- void plot1( int type ) { int i; static PLFLT freql[101], ampl[101], phase[101]; PLFLT f0, freq; PLINT nlegend; const char *text[2], *symbols[2]; PLINT opt_array[2]; PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; PLFLT legend_width, legend_height; pladv( 0 ); // Set up data for log plot f0 = 1.0; for ( i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, freql[i] ); ampl[i] = 20.0 * log10( 1.0 / sqrt( 1.0 + pow( ( freq / f0 ), 2. ) ) ); phase[i] = -( 180.0 / M_PI ) * atan( freq / f0 ); } plvpor( 0.15, 0.85, 0.1, 0.9 ); plwind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. plcol0( 1 ); switch ( type ) { case 0: plbox( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: plbox( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; } // Plot ampl vs freq plcol0( 2 ); plline( 101, freql, ampl ); plcol0( 2 ); plptex( 1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade" ); // Put labels on plcol0( 1 ); plmtex( "b", 3.2, 0.5, 0.5, "Frequency" ); plmtex( "t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter" ); plcol0( 2 ); plmtex( "l", 5.0, 0.5, 0.5, "Amplitude (dB)" ); nlegend = 1; // For the gridless case, put phase vs freq on same plot if ( type == 0 ) { plcol0( 1 ); plwind( -2.0, 3.0, -100.0, 0.0 ); plbox( "", 0.0, 0, "cmstv", 30.0, 3 ); plcol0( 3 ); plline( 101, freql, phase ); plstring( 101, freql, phase, "*" ); plcol0( 3 ); plmtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); nlegend = 2; } // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; text[0] = "Amplitude"; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices // do not have to be specified, at least in C. For Fortran we need // to set the symbols to be something, since the string is always // copied as part of the bindings. symbols[0] = ""; // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; text[1] = "Phase shift"; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // from the above opt_arrays we can completely ignore everything // to do with boxes. plscol0a( 15, 32, 32, 32, 0.70 ); pllegend( &legend_width, &legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); } plplot-5.10.0+dfsg/examples/c/ext-cairo-test.c 644 1750 1750 117412276771565 200310ustar andrewandrew#include #include #include #include int main( int argc, const char *argv[] ) { cairo_surface_t *cairoSurface; cairo_t *cairoContext; cairoSurface = cairo_ps_surface_create( "ext-cairo-test.ps", 720, 540 ); cairoContext = cairo_create( cairoSurface ); plparseopts( &argc, argv, PL_PARSE_FULL ); plsdev( "extcairo" ); plinit(); pl_cmd( PLESC_DEVINIT, cairoContext ); plenv( 0.0, 1.0, 0.0, 1.0, 1, 0 ); pllab( "x", "y", "title" ); plend(); cairo_destroy( cairoContext ); cairo_surface_destroy( cairoSurface ); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/plplotcanvas_animation.c 644 1750 1750 2131711462631041 217230ustar andrewandrew// // animation.c - Demonstrates the use of the plplot canvas widget with gtk. // // Copyright (C) 2004, 2005 Thomas J. Duck // All rights reserved. // // Thomas J. Duck // Department of Physics and Atmospheric Science, // Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 // // $Author: airwin $ // $Revision: 11289 $ // $Date: 2010-10-29 13:44:17 -0700 (Fri, 29 Oct 2010) $ // $Name$ // // // NOTICE // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301 USA // // // DESCRIPTION // // This program demonstrates the use of the plplot canvas widget with gtk. // Two graphs are draw in a window. When the Execute button is pressed, // two different waves progress through the graph in real time. Plotting // to the two graphs is handled in two different threads. // // #include #include #include #include // The number of time steps #define STEPS 300 // The number of points and period for the first wave #define NPTS 100 #define PERIOD 30 // The width and height for each plot widget #define WIDTH 800 #define HEIGHT 300 // Run the plots in different threads GThread* thread0 = NULL; GThread* thread1 = NULL; typedef struct { PlplotCanvas* canvas; char * title; } ThreadData; ThreadData data0, data1; gint Nthreads = 0; // Count the number of threads // Create two different canvases PlplotCanvas *canvas0 = NULL; PlplotCanvas *canvas1 = NULL; // Create the x and y array static PLFLT x[NPTS], y[NPTS]; // Lock on the gtkstate so that we don't try to plot after gtk_main_quit #define GTKSTATE_CONTINUE ( TRUE ) #define GTKSTATE_QUIT (FALSE) G_LOCK_DEFINE_STATIC( gtkstate ); static volatile int gtkstate = GTKSTATE_CONTINUE; // setup_plot - preparation for plotting an animation to a canvas void setup_plot( PlplotCanvas *canvas, char* title ) { // Set up the viewport and window plplot_canvas_vsta( canvas ); plplot_canvas_wind( canvas, x[0], x[NPTS - 1], -2., 2. ); // Set the pen width plplot_canvas_wid( canvas, 2 ); // The axes should be persistent, so that they don't have to be // replotted every time (which would slow down the animation) // plplot_canvas_use_persistence( canvas, TRUE ); // Draw the axes plplot_canvas_col0( canvas, 15 ); plplot_canvas_box( canvas, "bcnst", 0., 0, "bcnstv", 0., 0 ); plplot_canvas_lab( canvas, "(x)", "(y)", title ); // Prepare for plotting plplot_canvas_col0( canvas, plplot_canvas_get_stream_number( canvas ) + 8 ); // The animated data should not be persistent plplot_canvas_use_persistence( canvas, FALSE ); } // plot - draws a plot on a canvas void plot( PlplotCanvas *canvas, gdouble offset, char* title ) { int i; guint Nstream; gdouble xmin, xmax, ymin, ymax; // Get the stream number Nstream = plplot_canvas_get_stream_number( canvas ); // Generate the sinusoid for ( i = 0; i < NPTS; i++ ) y[i] = sin( 2. * 3.14 * ( x[i] + offset * ( Nstream + 1 ) ) / PERIOD / (PLFLT) ( Nstream + 1 ) ); // Draw the line plplot_canvas_line( canvas, NPTS, x, y ); // Advance the page to finalize the plot plplot_canvas_adv( canvas, 0 ); } // Delete event callback gint delete_event_local( GtkWidget *widget, GdkEvent *event, gpointer data ) { return FALSE; } // Destroy event calback void destroy_local( GtkWidget *widget, gpointer data ) { G_LOCK( gtkstate ); gtkstate = GTKSTATE_QUIT; G_UNLOCK( gtkstate ); gtk_main_quit(); } GThreadFunc plot_thread( ThreadData* data ) { int i; Nthreads++; // Draw STEPS plots in succession for ( i = 0; i < STEPS; i++ ) { gdk_threads_enter(); // Lock the current gtk state G_LOCK( gtkstate ); // Check to make sure gtk hasn't quit if ( gtkstate == GTKSTATE_QUIT ) { G_UNLOCK( gtkstate ); gdk_threads_leave(); g_thread_exit( NULL ); } // Draw the plot plot( data->canvas, i, data->title ); // Release the lock G_UNLOCK( gtkstate ); gdk_threads_leave(); } Nthreads--; g_thread_exit( NULL ); } // Start threads callback from execute button void start_threads( GtkWidget *widget, gpointer data ) { GError **gerror; // Ignore call if threads are currently active if ( Nthreads ) return; // Create the two plotting threads data0.canvas = canvas0; data0.title = "A phase-progressing wave"; if ( ( thread0 = g_thread_create( (GThreadFunc) plot_thread, &data0, TRUE, gerror ) ) \ == NULL ) { fprintf( stderr, "Could not create thread" ); return; } data1.canvas = canvas1; data1.title = "Another phase-progressing wave"; if ( ( thread1 = g_thread_create( (GThreadFunc) plot_thread, &data1, TRUE, gerror ) ) \ == NULL ) { fprintf( stderr, "Could not create thread" ); return; } } int main( int argc, char *argv[] ) { int i; GtkWidget *window; GtkWidget *table; GtkFrame *canvas0frame; GtkFrame *canvas1frame; GtkButton * button; GtkBox * buttonbox; GtkBox * vbox; // Parse the options plparseopts( &argc, (const char **) argv, PL_PARSE_FULL ); // Initialize g_thread_init( NULL ); gdk_threads_init(); gtk_init( &argc, &argv ); g_type_init(); // Initialize the x array for ( i = 0; i < NPTS; i++ ) x[i] = (PLFLT) i; // Create the first canvas, set its size, draw some axes on it, and // place it in a frame // canvas0 = plplot_canvas_new( TRUE ); plplot_canvas_set_size( canvas0, WIDTH, HEIGHT ); plplot_canvas_adv( canvas0, 0 ); setup_plot( canvas0, "A phase-progressing wave" ); plplot_canvas_adv( canvas0, 0 ); // Advance the page to finalize the plot canvas0frame = GTK_FRAME( gtk_frame_new( NULL ) ); gtk_frame_set_shadow_type( canvas0frame, GTK_SHADOW_ETCHED_OUT ); gtk_container_add( GTK_CONTAINER( canvas0frame ), GTK_WIDGET( canvas0 ) ); // Create the second canvas, set its size, draw some axes on it, and // place it in a frame // canvas1 = plplot_canvas_new( TRUE ); plplot_canvas_set_size( canvas1, WIDTH, HEIGHT ); plplot_canvas_adv( canvas1, 0 ); setup_plot( canvas1, "Another phase-progressing wave" ); plplot_canvas_adv( canvas1, 0 ); // Advance the page to finalize the plot canvas1frame = GTK_FRAME( gtk_frame_new( NULL ) ); gtk_frame_set_shadow_type( canvas1frame, GTK_SHADOW_ETCHED_OUT ); gtk_container_add( GTK_CONTAINER( canvas1frame ), GTK_WIDGET( canvas1 ) ); // Create a button and put it in a box button = GTK_BUTTON( gtk_button_new_from_stock( GTK_STOCK_EXECUTE ) ); g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( start_threads ), NULL ); gtk_container_set_border_width( GTK_CONTAINER( button ), 10 ); buttonbox = GTK_BOX( gtk_hbox_new( FALSE, 0 ) ); gtk_box_pack_start( buttonbox, GTK_WIDGET( button ), TRUE, FALSE, 0 ); // Create and fill the vbox with the widgets vbox = GTK_BOX( gtk_vbox_new( FALSE, 0 ) ); gtk_box_pack_start( vbox, GTK_WIDGET( canvas0frame ), TRUE, FALSE, 0 ); gtk_box_pack_start( vbox, GTK_WIDGET( canvas1frame ), TRUE, FALSE, 10 ); gtk_box_pack_start( vbox, GTK_WIDGET( buttonbox ), TRUE, FALSE, 0 ); // Create a new window window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); // Set the border width of the window gtk_container_set_border_width( GTK_CONTAINER( window ), 10 ); // Connect the signal handlers to the window decorations g_signal_connect( G_OBJECT( window ), "delete_event", G_CALLBACK( delete_event_local ), NULL ); g_signal_connect( G_OBJECT( window ), "destroy", G_CALLBACK( destroy_local ), NULL ); // Put the vbox into the window gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) ); // Display everything gtk_widget_show_all( window ); // Start the gtk main loop gdk_threads_enter(); gtk_main(); gdk_threads_leave(); return 0; } plplot-5.10.0+dfsg/examples/c/x30c.c 644 1750 1750 1041711543675237 157510ustar andrewandrew// // Alpha color values demonstration. // // Copyright (C) 2008 Hazen Babcock // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example will only really be interesting when used with devices that // support or alpha (or transparency) values, such as the cairo device family. // #include "plcdemos.h" static PLINT red[] = { 0, 255, 0, 0 }; static PLINT green[] = { 0, 0, 255, 0 }; static PLINT blue[] = { 0, 0, 0, 255 }; static PLFLT alpha[] = { 1.0, 1.0, 1.0, 1.0 }; static PLFLT px[] = { 0.1, 0.5, 0.5, 0.1 }; static PLFLT py[] = { 0.1, 0.1, 0.5, 0.5 }; static PLFLT pos[] = { 0.0, 1.0 }; static PLFLT rcoord[] = { 1.0, 1.0 }; static PLFLT gcoord[] = { 0.0, 0.0 }; static PLFLT bcoord[] = { 0.0, 0.0 }; static PLFLT acoord[] = { 0.0, 1.0 }; static PLBOOL rev[] = { 0, 0 }; int main( int argc, const char *argv[] ) { int i, j; PLINT icol, r, g, b; PLFLT a; plparseopts( &argc, argv, PL_PARSE_FULL ); plinit(); plscmap0n( 4 ); plscmap0a( red, green, blue, alpha, 4 ); // // Page 1: // // This is a series of red, green and blue rectangles overlaid // on each other with gradually increasing transparency. // // Set up the window pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plcol0( 0 ); plbox( "", 1.0, 0, "", 1.0, 0 ); // Draw the boxes for ( i = 0; i < 9; i++ ) { icol = i % 3 + 1; // Get a color, change its transparency and // set it as the current color. plgcol0a( icol, &r, &g, &b, &a ); plscol0a( icol, r, g, b, 1.0 - (double) i / 9.0 ); plcol0( icol ); // Draw the rectangle plfill( 4, px, py ); // Shift the rectangles coordinates for ( j = 0; j < 4; j++ ) { px[j] += 0.5 / 9.0; py[j] += 0.5 / 9.0; } } // // Page 2: // // This is a bunch of boxes colored red, green or blue with a single // large (red) box of linearly varying transparency overlaid. The // overlaid box is completely transparent at the bottom and completely // opaque at the top. // // Set up the window pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); // Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for ( i = 0; i < 5; i++ ) { // Set box X position px[0] = 0.05 + 0.2 * i; px[1] = px[0] + 0.1; px[2] = px[1]; px[3] = px[0]; // We don't want the boxes to be transparent, so since we changed // the colors transparencies in the first example we have to change // the transparencies back to completely opaque. icol = i % 3 + 1; plgcol0a( icol, &r, &g, &b, &a ); plscol0a( icol, r, g, b, 1.0 ); plcol0( icol ); for ( j = 0; j < 5; j++ ) { // Set box y position and draw the box. py[0] = 0.05 + 0.2 * j; py[1] = py[0]; py[2] = py[0] + 0.1; py[3] = py[2]; plfill( 4, px, py ); } } // Create the color map with 128 colors and use plscmap1la to initialize // the color values with a linearly varying red transparency (or alpha) plscmap1n( 128 ); plscmap1la( 1, 2, pos, rcoord, gcoord, bcoord, acoord, rev ); // Use that cmap1 to create a transparent red gradient for the whole // window. px[0] = 0.; px[1] = 1.; px[2] = 1.; px[3] = 0.; py[0] = 0.; py[1] = 0.; py[2] = 1.; py[3] = 1.; plgradient( 4, px, py, 90. ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x03c.c 644 1750 1750 437411541504335 157220ustar andrewandrew// $Id: x03c.c 11663 2011-03-20 23:08:13Z hezekiahcarty $ // // Polar plot demo. // #include "plcdemos.h" //-------------------------------------------------------------------------- // main // // Generates polar plot, with 1-1 scaling. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i; PLFLT dtr, theta, dx, dy, r, offset; char text[4]; static PLFLT x0[361], y0[361]; static PLFLT x[361], y[361]; dtr = M_PI / 180.0; for ( i = 0; i <= 360; i++ ) { x0[i] = cos( dtr * i ); y0[i] = sin( dtr * i ); } // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Set orientation to portrait - note not all device drivers // support this, in particular most interactive drivers do not plsori( 1 ); // Initialize plplot plinit(); // Set up viewport and window, but do not draw box plenv( -1.3, 1.3, -1.3, 1.3, 1, -2 ); // Draw circles for polar grid for ( i = 1; i <= 10; i++ ) { plarc( 0.0, 0.0, 0.1 * i, 0.1 * i, 0.0, 360.0, 0.0, 0 ); } plcol0( 2 ); for ( i = 0; i <= 11; i++ ) { theta = 30.0 * i; dx = cos( dtr * theta ); dy = sin( dtr * theta ); // Draw radial spokes for polar grid pljoin( 0.0, 0.0, dx, dy ); sprintf( text, "%d", ROUND( theta ) ); // Write labels for angle if ( theta < 9.99 ) { offset = 0.45; } else if ( theta < 99.9 ) { offset = 0.30; } else { offset = 0.15; } // Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) plptex( dx, dy, dx, dy, -offset, text ); else plptex( dx, dy, -dx, -dy, 1. + offset, text ); } // Draw the graph for ( i = 0; i <= 360; i++ ) { r = sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } plcol0( 3 ); plline( 361, x, y ); plcol0( 4 ); plmtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); // Close the plot at end plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x29c.c 644 1750 1750 2637412012374050 157470ustar andrewandrew// $Id: x29c.c 12213 2012-08-14 07:03:04Z andrewross $ // // Sample plots using date / time formatting for axes // // Copyright (C) 2007 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" static PLFLT x[365], y[365]; static PLFLT xerr1[365], xerr2[365], yerr1[365], yerr2[365]; // Function prototypes void plot1( void ); void plot2( void ); void plot3( void ); void plot4( void ); //-------------------------------------------------------------------------- // main // // Draws several plots which demonstrate the use of date / time formats for // the axis labels. // Time formatting is done using the strfqsas routine from the qsastime // library. This is similar to strftime, but works for a broad // date range even on 32-bit systems. See the // documentation of strfqsas for full details of the available formats. // // 1) Plotting temperature over a day (using hours / minutes) // 2) Plotting // // Note: We currently use the default call for plconfigtime (done in // plinit) which means continuous times are interpreted as seconds since // 1970-01-01, but that may change in future, more extended versions of // this example. // //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { // Parse command line arguments plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // Change the escape character to a '@' instead of the default '#' plsesc( '@' ); plot1(); plot2(); plot3(); plot4(); // Don't forget to call plend() to finish off! plend(); exit( 0 ); } // Plot a model diurnal cycle of temperature void plot1( void ) { int i, npts; PLFLT xmin, xmax, ymin, ymax; // Data points every 10 minutes for 1 day npts = 73; xmin = 0; xmax = 60.0 * 60.0 * 24.0; // Number of seconds in a day ymin = 10.0; ymax = 20.0; for ( i = 0; i < npts; i++ ) { x[i] = xmax * ( (PLFLT) i / (PLFLT) npts ); y[i] = 15.0 - 5.0 * cos( 2 * M_PI * ( (PLFLT) i / (PLFLT) npts ) ); // Set x error bars to +/- 5 minute xerr1[i] = x[i] - 60 * 5; xerr2[i] = x[i] + 60 * 5; // Set y error bars to +/- 0.1 deg C yerr1[i] = y[i] - 0.1; yerr2[i] = y[i] + 0.1; } pladv( 0 ); // Rescale major ticks marks by 0.5 plsmaj( 0.0, 0.5 ); // Rescale minor ticks and error bar marks by 0.5 plsmin( 0.0, 0.5 ); plvsta(); plwind( xmin, xmax, ymin, ymax ); // Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. plcol0( 1 ); // Set time format to be hours:minutes pltimefmt( "%H:%M" ); plbox( "bcnstd", 3.0 * 60 * 60, 3, "bcnstv", 1, 5 ); plcol0( 3 ); pllab( "Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature" ); plcol0( 4 ); plline( npts, x, y ); plcol0( 2 ); plerrx( npts, xerr1, xerr2, y ); plcol0( 3 ); plerry( npts, x, yerr1, yerr2 ); // Rescale major / minor tick marks back to default plsmin( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); } // Plot the number of hours of daylight as a function of day for a year void plot2( void ) { int j, npts; PLFLT xmin, xmax, ymin, ymax; PLFLT lat, p, d; // Latitude for London lat = 51.5; npts = 365; xmin = 0; xmax = npts * 60.0 * 60.0 * 24.0; ymin = 0; ymax = 24; // Formula for hours of daylight from // "A Model Comparison for Daylength as a Function of Latitude and // Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for ( j = 0; j < npts; j++ ) { x[j] = j * 60.0 * 60.0 * 24.0; p = asin( 0.39795 * cos( 0.2163108 + 2 * atan( 0.9671396 * tan( 0.00860 * ( j - 186 ) ) ) ) ); d = 24.0 - ( 24.0 / M_PI ) * acos( ( sin( 0.8333 * M_PI / 180.0 ) + sin( lat * M_PI / 180.0 ) * sin( p ) ) / ( cos( lat * M_PI / 180.0 ) * cos( p ) ) ); y[j] = d; } plcol0( 1 ); // Set time format to be abbreviated month name followed by day of month pltimefmt( "%b %d" ); plprec( 1, 1 ); plenv( xmin, xmax, ymin, ymax, 0, 40 ); plcol0( 3 ); pllab( "Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N" ); plcol0( 4 ); plline( npts, x, y ); plprec( 0, 0 ); } void plot3( void ) { int i, npts; PLFLT xmin, xmax, ymin, ymax; PLFLT tstart; // Calculate continuous time corresponding to 2005-12-01 UTC. plctime( 2005, 11, 01, 0, 0, 0., &tstart ); npts = 62; xmin = tstart; xmax = xmin + npts * 60.0 * 60.0 * 24.0; ymin = 0.0; ymax = 5.0; for ( i = 0; i < npts; i++ ) { x[i] = xmin + i * 60.0 * 60.0 * 24.0; y[i] = 1.0 + sin( 2 * M_PI * ( (PLFLT) i ) / 7.0 ) + exp( ( (PLFLT) MIN( i, npts - i ) ) / 31.0 ); } pladv( 0 ); plvsta(); plwind( xmin, xmax, ymin, ymax ); plcol0( 1 ); // Set time format to be ISO 8601 standard YYYY-MM-DD. pltimefmt( "%F" ); // Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox( "bcnstd", 14 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1, 4 ); plcol0( 3 ); pllab( "Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006" ); plcol0( 4 ); // Rescale symbol size (used by plpoin) by 0.5 plssym( 0.0, 0.5 ); plpoin( npts, x, y, 2 ); plline( npts, x, y ); } void plot4( void ) { // TAI-UTC (seconds) as a function of time. // Use Besselian epochs as the continuous time interval just to prove // this does not introduce any issues. PLFLT scale, offset1, offset2; PLFLT xmin, xmax, ymin = 0.0, ymax = 0.0, xlabel_step = 0.0; int kind, npts = 0, if_TAI_time_format = 0, i; char time_format[10]; char title_suffix[100]; char xtitle[100]; char title[100]; PLFLT xx[1001], yy[1001]; PLINT tai_year, tai_month, tai_day, tai_hour, tai_min; PLFLT tai_sec, tai; PLINT utc_year, utc_month, utc_day, utc_hour, utc_min; PLFLT utc_sec, utc; // Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch // B = 1900. + (JD -2415020.31352)/365.242198781 // ==> (as calculated with aid of "bc -l" command) // B = (MJD + 678940.364163900)/365.242198781 // ==> // MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781; offset1 = -678940.; offset2 = -0.3641639; plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); for ( kind = 0; kind < 7; kind++ ) { if ( kind == 0 ) { plctime( 1950, 0, 2, 0, 0, 0., &xmin ); plctime( 2020, 0, 2, 0, 0, 0., &xmax ); npts = 70 * 12 + 1; ymin = 0.0; ymax = 36.0; strncpy( time_format, "%Y%", 10 ); if_TAI_time_format = 1; strncpy( title_suffix, "from 1950 to 2020", 100 ); strncpy( xtitle, "Year", 100 ); xlabel_step = 10.; } else if ( kind == 1 || kind == 2 ) { plctime( 1961, 7, 1, 0, 0, 1.64757 - .20, &xmin ); plctime( 1961, 7, 1, 0, 0, 1.64757 + .20, &xmax ); npts = 1001; ymin = 1.625; ymax = 1.725; strncpy( time_format, "%S%2%", 10 ); strncpy( title_suffix, "near 1961-08-01 (TAI)", 100 ); xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 1 ) { if_TAI_time_format = 1; strncpy( xtitle, "Seconds (TAI)", 100 ); } else { if_TAI_time_format = 0; strncpy( xtitle, "Seconds (TAI) labelled with corresponding UTC", 100 ); } } else if ( kind == 3 || kind == 4 ) { plctime( 1963, 10, 1, 0, 0, 2.6972788 - .20, &xmin ); plctime( 1963, 10, 1, 0, 0, 2.6972788 + .20, &xmax ); npts = 1001; ymin = 2.55; ymax = 2.75; strncpy( time_format, "%S%2%", 10 ); strncpy( title_suffix, "near 1963-11-01 (TAI)", 100 ); xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 3 ) { if_TAI_time_format = 1; strncpy( xtitle, "Seconds (TAI)", 100 ); } else { if_TAI_time_format = 0; strncpy( xtitle, "Seconds (TAI) labelled with corresponding UTC", 100 ); } } else if ( kind == 5 || kind == 6 ) { plctime( 2009, 0, 1, 0, 0, 34. - 5., &xmin ); plctime( 2009, 0, 1, 0, 0, 34. + 5., &xmax ); npts = 1001; ymin = 32.5; ymax = 34.5; strncpy( time_format, "%S%2%", 10 ); strncpy( title_suffix, "near 2009-01-01 (TAI)", 100 ); xlabel_step = 1. / ( scale * 86400. ); if ( kind == 5 ) { if_TAI_time_format = 1; strncpy( xtitle, "Seconds (TAI)", 100 ); } else { if_TAI_time_format = 0; strncpy( xtitle, "Seconds (TAI) labelled with corresponding UTC", 100 ); } } for ( i = 0; i < npts; i++ ) { xx[i] = xmin + i * ( xmax - xmin ) / ( (double) ( npts - 1 ) ); plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); tai = xx[i]; plbtime( &tai_year, &tai_month, &tai_day, &tai_hour, &tai_min, &tai_sec, tai ); plconfigtime( scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0. ); plbtime( &utc_year, &utc_month, &utc_day, &utc_hour, &utc_min, &utc_sec, tai ); plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); plctime( utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, &utc ); yy[i] = ( tai - utc ) * scale * 86400.; } pladv( 0 ); plvsta(); plwind( xmin, xmax, ymin, ymax ); plcol0( 1 ); if ( if_TAI_time_format ) plconfigtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); else plconfigtime( scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0. ); pltimefmt( time_format ); plbox( "bcnstd", xlabel_step, 0, "bcnstv", 0., 0 ); plcol0( 3 ); strncpy( title, "@frPLplot Example 29 - TAI-UTC ", 100 ); strncat( title, title_suffix, 100 - strlen( title ) - 1 ); pllab( xtitle, "TAI-UTC (sec)", title ); plcol0( 4 ); plline( npts, xx, yy ); } } plplot-5.10.0+dfsg/examples/c/x25c.c 644 1750 1750 764211462631041 157240ustar andrewandrew// $Id: x25c.c 11289 2010-10-29 20:44:17Z airwin $ // // Filling and clipping polygons. // #include "plcdemos.h" //-------------------------------------------------------------------------- // main // // Test program for filling polygons and proper clipping //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i, j, k; int npts = 0; PLFLT xextreme[10][2]; PLFLT yextreme[10][2]; PLFLT x0[10]; PLFLT y0[10]; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plssub( 3, 3 ); plinit(); xextreme[0][0] = -120.0; xextreme[0][1] = 120.0; yextreme[0][0] = -120.0; yextreme[0][1] = 120.0; xextreme[1][0] = -120.0; xextreme[1][1] = 120.0; yextreme[1][0] = 20.0; yextreme[1][1] = 120.0; xextreme[2][0] = -120.0; xextreme[2][1] = 120.0; yextreme[2][0] = -20.0; yextreme[2][1] = 120.0; xextreme[3][0] = -80.0; xextreme[3][1] = 80.0; yextreme[3][0] = -20.0; yextreme[3][1] = 120.0; xextreme[4][0] = -220.0; xextreme[4][1] = -120.0; yextreme[4][0] = -120.0; yextreme[4][1] = 120.0; xextreme[5][0] = -20.0; xextreme[5][1] = 20.0; yextreme[5][0] = -120.0; yextreme[5][1] = 120.0; xextreme[6][0] = -20.0; xextreme[6][1] = 20.0; yextreme[6][0] = -20.0; yextreme[6][1] = 20.0; xextreme[7][0] = -80.0; xextreme[7][1] = 80.0; yextreme[7][0] = -80.0; yextreme[7][1] = 80.0; xextreme[8][0] = 20.0; xextreme[8][1] = 120.0; yextreme[8][0] = -120.0; yextreme[8][1] = 120.0; for ( k = 0; k < 2; k++ ) { for ( j = 0; j < 4; j++ ) { if ( j == 0 ) { // Polygon 1: a diamond x0[0] = 0; y0[0] = -100; x0[1] = -100; y0[1] = 0; x0[2] = 0; y0[2] = 100; x0[3] = 100; y0[3] = 0; npts = 4; } if ( j == 1 ) { // Polygon 1: a diamond - reverse direction x0[3] = 0; y0[3] = -100; x0[2] = -100; y0[2] = 0; x0[1] = 0; y0[1] = 100; x0[0] = 100; y0[0] = 0; npts = 4; } if ( j == 2 ) { // Polygon 2: a square with punctures x0[0] = -100; y0[0] = -100; x0[1] = -100; y0[1] = -80; x0[2] = 80; y0[2] = 0; x0[3] = -100; y0[3] = 80; x0[4] = -100; y0[4] = 100; x0[5] = -80; y0[5] = 100; x0[6] = 0; y0[6] = 80; x0[7] = 80; y0[7] = 100; x0[8] = 100; y0[8] = 100; x0[9] = 100; y0[9] = -100; npts = 10; } if ( j == 3 ) { // Polygon 2: a square with punctures - reversed direction x0[9] = -100; y0[9] = -100; x0[8] = -100; y0[8] = -80; x0[7] = 80; y0[7] = 0; x0[6] = -100; y0[6] = 80; x0[5] = -100; y0[5] = 100; x0[4] = -80; y0[4] = 100; x0[3] = 0; y0[3] = 80; x0[2] = 80; y0[2] = 100; x0[1] = 100; y0[1] = 100; x0[0] = 100; y0[0] = -100; npts = 10; } for ( i = 0; i < 9; i++ ) { pladv( 0 ); plvsta(); plwind( xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1] ); plcol0( 2 ); plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 ); plcol0( 1 ); plpsty( 0 ); if ( k == 0 ) plfill( npts, x0, y0 ); else plgradient( npts, x0, y0, 45. ); plcol0( 2 ); pllsty( 1 ); plline( npts, x0, y0 ); } } } // Don't forget to call plend() to finish off! plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/README.cairo 644 1750 1750 176712276771565 170010ustar andrewandrewSome examples demonstrating how to use the PLplot xcairo and extcairo devices to draw into an externally supplied XDrawable or Cairo context. EXTERNAL X DRAWABLE EXAMPLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The external X drawable example is extXdrawable_demo.c. It is designed to demonstrate the use of the ability of plplot's xcairo driver to use an X drawable supplied by an application. The example itself uses GTK but the concept applies to any graphical framework, or even programs using libX11 directly. To build this demo, install PLplot with the "make install" command and then run 'make extXdrawable_demo' in the installed .../examples/c directory. EXTERNAL CAIRO CONTEXT EXAMPLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The C program ext-cairo-test.c demonstrates how to pass in an external Cairo Context that PLplot can use for plotting using the extcairo device. To build this demo, install PLplot with the "make install" command and then run 'make ext-cairo-test' in the installed .../examples/c directory. plplot-5.10.0+dfsg/examples/c/x23c.c 644 1750 1750 2671711645771433 157630ustar andrewandrew// // // Displays Greek letters and mathematically interesting Unicode ranges // Copyright (C) 2005,2008 Alan Irwin // Copyright (C) 2005,2008 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" // // main // // Displays Greek letters and mathematically interesting Unicode ranges // static const char* Greek[] = { "#gA", "#gB", "#gG", "#gD", "#gE", "#gZ", "#gY", "#gH", "#gI", "#gK", "#gL", "#gM", "#gN", "#gC", "#gO", "#gP", "#gR", "#gS", "#gT", "#gU", "#gF", "#gX", "#gQ", "#gW", "#ga", "#gb", "#gg", "#gd", "#ge", "#gz", "#gy", "#gh", "#gi", "#gk", "#gl", "#gm", "#gn", "#gc", "#go", "#gp", "#gr", "#gs", "#gt", "#gu", "#gf", "#gx", "#gq", "#gw", }; static int Type1[] = { 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0028, 0x0029, 0x002b, 0x002c, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x005b, 0x005d, 0x005f, 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac, 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7, 0x0192, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022, 0x2026, 0x2032, 0x2033, 0x203e, 0x2044, 0x2111, 0x2118, 0x211c, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, 0x2215, 0x2217, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329, 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665, 0x2666, }; static const char* title[] = { "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)", }; static int lo[] = { 0x0, 0x0, 0x40, 0x80, 0x2153, 0x2190, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, }; static int hi[] = { 0x30, 0x40, 0x80, 0xA6, 0x2184, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, 0x2300, }; static int nxcells[] = { 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static int nycells[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; // non-zero values Must be consistent with nxcells and nycells. static int offset[] = { 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0, }; // 30 possible FCI values. #define FCI_COMBINATIONS 30 static PLUNICODE fci[] = { 0x80000000, 0x80000001, 0x80000002, 0x80000003, 0x80000004, 0x80000010, 0x80000011, 0x80000012, 0x80000013, 0x80000014, 0x80000020, 0x80000021, 0x80000022, 0x80000023, 0x80000024, 0x80000100, 0x80000101, 0x80000102, 0x80000103, 0x80000104, 0x80000110, 0x80000111, 0x80000112, 0x80000113, 0x80000114, 0x80000120, 0x80000121, 0x80000122, 0x80000123, 0x80000124, }; static const char*family[] = { "sans-serif", "serif", "monospace", "script", "symbol", }; static const char*style[] = { "upright", "italic", "oblique", }; static const char*weight[] = { "medium", "bold", }; int main( int argc, const char *argv[] ) { PLFLT xmin, xmax, ymin, ymax, ycharacter_scale, yoffset; PLFLT chardef, charht, deltax, deltay, x, y; int i, j, page, length, slice; char cmdString[20]; PLUNICODE fci_old; PLINT ifamily, istyle, iweight; plparseopts( &argc, argv, PL_PARSE_FULL ); plinit(); for ( page = 0; page < 11; page++ ) { pladv( 0 ); // Set up viewport and window plvpor( 0.02, 0.98, 0.02, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plgspa( &xmin, &xmax, &ymin, &ymax ); plschr( 0., 0.8 ); ycharacter_scale = ( 1.0 - 0.0 ) / ( ymax - ymin ); // Factor should be 0.5, but heuristically it turns out to be larger. plgchr( &chardef, &charht ); yoffset = 1.0 * charht * ycharacter_scale; // Draw the grid using plbox plcol0( 2 ); deltax = 1.0 / ( (PLFLT) nxcells[page] ); deltay = 1.0 / ( (PLFLT) nycells[page] ); plbox( "bcg", deltax, 0, "bcg", deltay, 0 ); plcol0( 15 ); length = hi[page] - lo[page]; slice = 0; for ( j = nycells[page] - 1; j >= -1; j-- ) { y = ( 0.5 + j ) * deltay; for ( i = 0; i < nxcells[page]; i++ ) { x = ( 0.5 + i ) * deltax; if ( slice < length ) { if ( page == 0 ) { sprintf( cmdString, "#%s", Greek[slice] ); } else if ( ( page >= 1 ) && ( page <= 3 ) ) { sprintf( cmdString, "##[0x%.4x]", Type1[offset[page] + slice] ); } else if ( page >= 4 ) { sprintf( cmdString, "##[0x%.4x]", lo[page] + slice ); } plptex( x, y + yoffset, 1., 0., 0.5, &cmdString[1] ); plptex( x, y - yoffset, 1., 0., 0.5, cmdString ); } slice += 1; } } plschr( 0., 1.0 ); // Page title plmtex( "t", 1.5, 0.5, 0.5, title[page] ); } // Demonstrate methods of getting the current fonts plgfci( &fci_old ); plgfont( &ifamily, &istyle, &iweight ); printf( "For example 23 prior to page 12 the FCI is 0x%x\n", fci_old ); printf( "For example 23 prior to page 12 the font family, style and weight are %s %s %s\n", family[ifamily], style[istyle], weight[iweight] ); for ( page = 11; page < 16; page++ ) { PLFLT dy = 0.030; int family_index, style_index, weight_index; // Must be big enough to contain the prefix strings, the font-changing // commands, and the "The quick brown..." string. char string[200]; pladv( 0 ); plvpor( 0.02, 0.98, 0.02, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plsfci( 0 ); if ( page == 11 ) { plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with plsfci" ); } else if ( page == 12 ) { plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with plsfont" ); } else if ( page == 13 ) { plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with ##<0x8nnnnnnn> construct" ); } else if ( page == 14 ) { plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with ##<0xmn> constructs" ); } else if ( page == 15 ) { plmtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with ## constructs" ); } plschr( 0., 0.75 ); for ( i = 0; i < FCI_COMBINATIONS; i++ ) { family_index = i % 5; style_index = ( i / 5 ) % 3; weight_index = ( ( i / 5 ) / 3 ) % 2; if ( page == 11 ) { plsfci( fci[i] ); sprintf( string, "Page 12, %s, %s, %s: " "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index] ); } else if ( page == 12 ) { plsfont( family_index, style_index, weight_index ); sprintf( string, "Page 13, %s, %s, %s: " "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index] ); } else if ( page == 13 ) { sprintf( string, "Page 14, %s, %s, %s: " "#<0x%x>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], fci[i] ); } else if ( page == 14 ) { sprintf( string, "Page 15, %s, %s, %s: " "#<0x%1x0>#<0x%1x1>#<0x%1x2>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family_index, style_index, weight_index ); } else if ( page == 15 ) { sprintf( string, "Page 16, %s, %s, %s: " "#<%s/>#<%s/>#<%s/>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family[family_index], style[style_index], weight[weight_index] ); } plptex( 0., 1. - ( i + 0.5 ) * dy, 1., 0., 0., string ); } plschr( 0., 1.0 ); } // Restore defaults plcol0( 1 ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x27c.c 644 1750 1750 1463311650123230 157370ustar andrewandrew// $Id: x27c.c 11992 2011-10-20 22:54:16Z andrewross $ // // Drawing "spirograph" curves - epitrochoids, cycolids, roulettes // // Copyright (C) 2007 Arjen Markus // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" // Function prototypes void cycloid( void ); void spiro( PLFLT data[], int fill ); PLINT gcd( PLINT a, PLINT b ); void arcs( void ); //-------------------------------------------------------------------------- // main // // Generates two kinds of plots: // - construction of a cycloid (animated) // - series of epitrochoids and hypotrochoids //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { // R, r, p, N // R and r should be integers to give correct termination of the // angle loop using gcd. // N.B. N is just a place holder since it is no longer used // (because we now have proper termination of the angle loop). PLFLT params[9][4] = { { 21.0, 7.0, 7.0, 3.0 }, // Deltoid { 21.0, 7.0, 10.0, 3.0 }, { 21.0, -7.0, 10.0, 3.0 }, { 20.0, 3.0, 7.0, 20.0 }, { 20.0, 3.0, 10.0, 20.0 }, { 20.0, -3.0, 10.0, 20.0 }, { 20.0, 13.0, 7.0, 20.0 }, { 20.0, 13.0, 20.0, 20.0 }, { 20.0, -13.0, 20.0, 20.0 } }; int i; int fill; // plplot initialization // Parse and process command line arguments plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // Illustrate the construction of a cycloid cycloid(); // Loop over the various curves // First an overview, then all curves one by one // plssub( 3, 3 ); // Three by three window fill = 0; for ( i = 0; i < 9; i++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( ¶ms[i][0], fill ); } pladv( 0 ); plssub( 1, 1 ); // One window per curve for ( i = 0; i < 9; i++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( ¶ms[i][0], fill ); } // Fill the curves fill = 1; pladv( 0 ); plssub( 1, 1 ); // One window per curve for ( i = 0; i < 9; i++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( ¶ms[i][0], fill ); } // Finally, an example to test out plarc capabilities arcs(); // Don't forget to call plend() to finish off! plend(); exit( 0 ); } //-------------------------------------------------------------------------- // Calculate greatest common divisor following pseudo-code for the // Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm PLINT gcd( PLINT a, PLINT b ) { PLINT t; a = abs( a ); b = abs( b ); while ( b != 0 ) { t = b; b = a % b; a = t; } return a; } //-------------------------------------------------------------------------- void cycloid( void ) { // TODO } //-------------------------------------------------------------------------- void spiro( PLFLT params[], int fill ) { #define NPNT 2000 static PLFLT xcoord[NPNT + 1]; static PLFLT ycoord[NPNT + 1]; int windings; int steps; int i; PLFLT phi; PLFLT phiw; PLFLT dphi; PLFLT xmin = 0.0; PLFLT xmax = 0.0; PLFLT xrange_adjust; PLFLT ymin = 0.0; PLFLT ymax = 0.0; PLFLT yrange_adjust; // Fill the coordinates // Proper termination of the angle loop very near the beginning // point, see // http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = (int) ( abs( (int) params[1] ) / gcd( (PLINT) params[0], (PLINT) params[1] ) ); steps = NPNT / windings; dphi = 2.0 * PI / (PLFLT) steps; for ( i = 0; i <= windings * steps; i++ ) { phi = (PLFLT) i * dphi; phiw = ( params[0] - params[1] ) / params[1] * phi; xcoord[i] = ( params[0] - params[1] ) * cos( phi ) + params[2] * cos( phiw ); ycoord[i] = ( params[0] - params[1] ) * sin( phi ) - params[2] * sin( phiw ); if ( i == 0 ) { xmin = xcoord[i]; xmax = xcoord[i]; ymin = ycoord[i]; ymax = ycoord[i]; } if ( xmin > xcoord[i] ) xmin = xcoord[i]; if ( xmax < xcoord[i] ) xmax = xcoord[i]; if ( ymin > ycoord[i] ) ymin = ycoord[i]; if ( ymax < ycoord[i] ) ymax = ycoord[i]; } xrange_adjust = 0.15 * ( xmax - xmin ); xmin -= xrange_adjust; xmax += xrange_adjust; yrange_adjust = 0.15 * ( ymax - ymin ); ymin -= yrange_adjust; ymax += yrange_adjust; plwind( xmin, xmax, ymin, ymax ); plcol0( 1 ); if ( fill ) { plfill( 1 + steps * windings, xcoord, ycoord ); } else { plline( 1 + steps * windings, xcoord, ycoord ); } } void arcs() { #define NSEG 8 int i; PLFLT theta, dtheta; PLFLT a, b; theta = 0.0; dtheta = 360.0 / NSEG; plenv( -10.0, 10.0, -10.0, 10.0, 1, 0 ); // Plot segments of circle in different colors for ( i = 0; i < NSEG; i++ ) { plcol0( i % 2 + 1 ); plarc( 0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, 0 ); theta = theta + dtheta; } // Draw several filled ellipses inside the circle at different // angles. a = 3.0; b = a * tan( ( dtheta / 180.0 * M_PI ) / 2.0 ); theta = dtheta / 2.0; for ( i = 0; i < NSEG; i++ ) { plcol0( 2 - i % 2 ); plarc( a * cos( theta / 180.0 * M_PI ), a * sin( theta / 180.0 * M_PI ), a, b, 0.0, 360.0, theta, 1 ); theta = theta + dtheta; } } plplot-5.10.0+dfsg/examples/c/x08c.c 644 1750 1750 1742211666362057 157600ustar andrewandrew// $Id: x08c.c 12095 2011-12-03 08:56:15Z andrewross $ // // 3-d plot demo. // // Copyright (C) 2004 Alan W. Irwin // Copyright (C) 2004 Rafael Laboissiere // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // #include "plcdemos.h" // plexit not declared in public header! PLDLLIMPEXP void plexit( const char *errormsg ); #define XPTS 35 // Data points in x #define YPTS 46 // Data points in y static PLFLT alt[] = { 60.0, 20.0 }; static PLFLT az[] = { 30.0, 60.0 }; static void cmap1_init( int ); static const char *title[] = { "#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60", }; //-------------------------------------------------------------------------- // cmap1_init1 // // Initializes color map 1 in HLS space. // Basic grayscale variation from half-dark (which makes more interesting // looking plot compared to dark) to light. // An interesting variation on this: // s[1] = 1.0 //-------------------------------------------------------------------------- static void cmap1_init( int gray ) { PLFLT i[2], h[2], l[2], s[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary if ( gray ) { h[0] = 0.0; // hue -- low: red (arbitrary if s=0) h[1] = 0.0; // hue -- high: red (arbitrary if s=0) l[0] = 0.5; // lightness -- low: half-dark l[1] = 1.0; // lightness -- high: light s[0] = 0.0; // minimum saturation s[1] = 0.0; // minimum saturation } else { h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; } plscmap1n( 256 ); c_plscmap1l( 0, 2, i, h, l, s, NULL ); } //-------------------------------------------------------------------------- // main // // Does a series of 3-d plots for a given data set, with different // viewing options in each plot. //-------------------------------------------------------------------------- static int sombrero; static PLOptionTable options[] = { { "sombrero", // Turns on use of Sombrero function NULL, NULL, &sombrero, PL_OPT_BOOL, "-sombrero", "Use the \"sombrero\" function." }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; #define LEVELS 10 int main( int argc, const char *argv[] ) { int i, j, k; PLFLT *x, *y, **z, *z_row_major, *z_col_major; PLfGrid2 grid_c, grid_row_major, grid_col_major; PLFLT xx, yy, r; PLINT ifshade; PLFLT zmin, zmax, step; PLFLT clevel[LEVELS]; PLINT nlevel = LEVELS; int rosen = 1; // Parse and process command line arguments plMergeOpts( options, "x08c options", NULL ); (void) plparseopts( &argc, argv, PL_PARSE_FULL ); if ( sombrero ) rosen = 0; // Initialize plplot plinit(); // Allocate data structures x = (PLFLT *) calloc( XPTS, sizeof ( PLFLT ) ); y = (PLFLT *) calloc( YPTS, sizeof ( PLFLT ) ); plAlloc2dGrid( &z, XPTS, YPTS ); z_row_major = (PLFLT *) malloc( XPTS * YPTS * sizeof ( PLFLT ) ); z_col_major = (PLFLT *) malloc( XPTS * YPTS * sizeof ( PLFLT ) ); if ( !z_row_major || !z_col_major ) plexit( "Memory allocation error" ); grid_c.f = z; grid_row_major.f = (PLFLT **) z_row_major; grid_col_major.f = (PLFLT **) z_col_major; grid_c.nx = grid_row_major.nx = grid_col_major.nx = XPTS; grid_c.ny = grid_row_major.ny = grid_col_major.ny = YPTS; for ( i = 0; i < XPTS; i++ ) { x[i] = ( (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ) ); if ( rosen ) x[i] *= 1.5; } for ( i = 0; i < YPTS; i++ ) { y[i] = (double) ( i - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ); if ( rosen ) y[i] += 0.5; } for ( i = 0; i < XPTS; i++ ) { xx = x[i]; for ( j = 0; j < YPTS; j++ ) { yy = y[j]; if ( rosen ) { z[i][j] = pow( 1. - xx, 2. ) + 100. * pow( yy - pow( xx, 2. ), 2. ); // The log argument may be zero for just the right grid. if ( z[i][j] > 0. ) z[i][j] = log( z[i][j] ); else z[i][j] = -5.; // -MAXFLOAT would mess-up up the scale } else { r = sqrt( xx * xx + yy * yy ); z[i][j] = exp( -r * r ) * cos( 2.0 * M_PI * r ); } z_row_major[i * YPTS + j] = z[i][j]; z_col_major[i + XPTS * j] = z[i][j]; } } plMinMax2dGrid( (const PLFLT * const *) z, XPTS, YPTS, &zmax, &zmin ); step = ( zmax - zmin ) / ( nlevel + 1 ); for ( i = 0; i < nlevel; i++ ) clevel[i] = zmin + step + step * i; pllightsource( 1., 1., 1. ); for ( k = 0; k < 2; k++ ) { for ( ifshade = 0; ifshade < 4; ifshade++ ) { pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -0.9, 1.1 ); plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, title[k] ); plcol0( 1 ); if ( rosen ) plw3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k] ); else plw3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); plcol0( 2 ); if ( ifshade == 0 ) // diffuse light surface plot { cmap1_init( 1 ); plfsurf3d( x, y, plf2ops_c(), (PLPointer) z, XPTS, YPTS, 0, NULL, 0 ); } else if ( ifshade == 1 ) // magnitude colored plot { cmap1_init( 0 ); plfsurf3d( x, y, plf2ops_grid_c(), ( PLPointer ) & grid_c, XPTS, YPTS, MAG_COLOR, NULL, 0 ); } else if ( ifshade == 2 ) // magnitude colored plot with faceted squares { cmap1_init( 0 ); plfsurf3d( x, y, plf2ops_grid_row_major(), ( PLPointer ) & grid_row_major, XPTS, YPTS, MAG_COLOR | FACETED, NULL, 0 ); } else // magnitude colored plot with contours { cmap1_init( 0 ); plfsurf3d( x, y, plf2ops_grid_col_major(), ( PLPointer ) & grid_col_major, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT, clevel, nlevel ); } } } // Clean up free( (void *) x ); free( (void *) y ); plFree2dGrid( z, XPTS, YPTS ); free( (void *) z_row_major ); free( (void *) z_col_major ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x06c.c 644 1750 1750 440011462631041 157100ustar andrewandrew// $Id: x06c.c 11289 2010-10-29 20:44:17Z airwin $ // // Font demo. // #include "plcdemos.h" //-------------------------------------------------------------------------- // main // // Displays the entire "plpoin" symbol (font) set. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { char text[10]; int i, j, k, kind_font, font, maxfont; PLFLT x, y; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); for ( kind_font = 0; kind_font < 2; kind_font++ ) { plfontld( kind_font ); if ( kind_font == 0 ) maxfont = 1; else maxfont = 4; for ( font = 0; font < maxfont; font++ ) { plfont( font + 1 ); pladv( 0 ); // Set up viewport and window plcol0( 2 ); plvpor( 0.1, 1.0, 0.1, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.3 ); // Draw the grid using plbox plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame plcol0( 15 ); for ( i = 0; i <= 9; i++ ) { sprintf( text, "%d", i ); plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } k = 0; for ( i = 0; i <= 12; i++ ) { // Write the digits to the left of the frame sprintf( text, "%d", 10 * i ); plmtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, text ); for ( j = 0; j <= 9; j++ ) { x = 0.1 * j + 0.05; y = 1.25 - 0.1 * i; // Display the symbols (plpoin expects that x and y are arrays so // pass pointers) if ( k < 128 ) plpoin( 1, &x, &y, k ); k = k + 1; } } if ( kind_font == 0 ) plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); else plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); } } plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/README.plplotcanvas 644 1750 1750 154211446720244 203630ustar andrewandrew PLPLOTCANVAS EXAMPLES ~~~~~~~~~~~~~~~~~~~~~ N.B. gcw, gnome2, and pygcw have been retired since the 5.9.6 release. See README.release in the top-level directory for the reasons for this decision. Therefore, none of what follows (which depends upon gnome2) will work any more. The PlplotCanvas examples are: plplotcanvas_demo.c plplotcanvas_animation.c The are not part of the general PLplot testbed of examples, but are instead designed to demonstrate the use of the GCW "Gnome Canvas Widget" driver to embed plots in Gnome/GTK applications. PlplotCanvas is a special GnomeCanvas-based widget that provides an easy-to-use object-oriented interface for this task. Both GCW and PlplotCanvas are described in detail in the PLplot Programmers's Reference Manual. BUILD INSTRUCTIONS ~~~~~~~~~~~~~~~~~~ Run "make" in the installed examples/c directory. plplot-5.10.0+dfsg/examples/c/x11c.c 644 1750 1750 1142211704406556 157400ustar andrewandrew// $Id: x11c.c 12129 2012-01-14 23:19:10Z airwin $ // // Mesh plot demo. // // Copyright (C) 2004 Rafael Laboissiere // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #include "plcdemos.h" #define XPTS 35 // Data points in x #define YPTS 46 // Data points in y #define LEVELS 10 static int opt[] = { DRAW_LINEXY, DRAW_LINEXY }; static PLFLT alt[] = { 33.0, 17.0 }; static PLFLT az[] = { 24.0, 115.0 }; static const char *title[4] = { "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3", }; static void cmap1_init( void ) { PLFLT i[2], h[2], l[2], s[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; plscmap1n( 256 ); c_plscmap1l( 0, 2, i, h, l, s, NULL ); } //-------------------------------------------------------------------------- // main // // Does a series of mesh plots for a given data set, with different // viewing options in each plot. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i, j, k; PLFLT *x, *y, **z; PLFLT xx, yy; int nlevel = LEVELS; PLFLT clevel[LEVELS]; PLFLT zmin, zmax, step; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); x = (PLFLT *) calloc( XPTS, sizeof ( PLFLT ) ); y = (PLFLT *) calloc( YPTS, sizeof ( PLFLT ) ); plAlloc2dGrid( &z, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { x[i] = 3. * (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); } for ( i = 0; i < YPTS; i++ ) y[i] = 3. * (double) ( i - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ); for ( i = 0; i < XPTS; i++ ) { xx = x[i]; for ( j = 0; j < YPTS; j++ ) { yy = y[j]; z[i][j] = 3. * ( 1. - xx ) * ( 1. - xx ) * exp( -( xx * xx ) - ( yy + 1. ) * ( yy + 1. ) ) - 10. * ( xx / 5. - pow( xx, 3. ) - pow( yy, 5. ) ) * exp( -xx * xx - yy * yy ) - 1. / 3. * exp( -( xx + 1 ) * ( xx + 1 ) - ( yy * yy ) ); if ( 0 ) // Jungfraujoch/Interlaken { if ( z[i][j] < -1. ) z[i][j] = -1.; } } } plMinMax2dGrid( (const PLFLT * const *) z, XPTS, YPTS, &zmax, &zmin ); step = ( zmax - zmin ) / ( nlevel + 1 ); for ( i = 0; i < nlevel; i++ ) clevel[i] = zmin + step + step * i; cmap1_init(); for ( k = 0; k < 2; k++ ) { for ( i = 0; i < 4; i++ ) { pladv( 0 ); plcol0( 1 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.5 ); plw3d( 1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt[k], az[k] ); plbox3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4 ); plcol0( 2 ); // wireframe plot if ( i == 0 ) plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, opt[k] ); // magnitude colored wireframe plot else if ( i == 1 ) plmesh( x, y, (const PLFLT * const *) z, XPTS, YPTS, opt[k] | MAG_COLOR ); // magnitude colored wireframe plot with sides else if ( i == 2 ) plot3d( x, y, (const PLFLT * const *) z, XPTS, YPTS, opt[k] | MAG_COLOR, 1 ); // magnitude colored wireframe plot with base contour else if ( i == 3 ) plmeshc( x, y, (const PLFLT * const *) z, XPTS, YPTS, opt[k] | MAG_COLOR | BASE_CONT, clevel, nlevel ); plcol0( 3 ); plmtex( "t", 1.0, 0.5, 0.5, title[k] ); } } // Clean up free( (void *) x ); free( (void *) y ); plFree2dGrid( z, XPTS, YPTS ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x05c.c 644 1750 1750 161311462631041 157120ustar andrewandrew// $Id: x05c.c 11289 2010-10-29 20:44:17Z airwin $ // // Histogram demo. // #include "plcdemos.h" #define NPTS 2047 //-------------------------------------------------------------------------- // main // // Draws a histogram from sample data. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i; PLFLT data[NPTS], delta; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // Fill up data points delta = 2.0 * M_PI / (double) NPTS; for ( i = 0; i < NPTS; i++ ) data[i] = sin( i * delta ); plcol0( 1 ); plhist( NPTS, data, -1.1, 1.1, 44, 0 ); plcol0( 2 ); pllab( "#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator" ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x32c.c 644 1750 1750 1107411543675237 157530ustar andrewandrew// $Id: x32c.c 11680 2011-03-27 17:57:51Z airwin $ // // Box plot demo. // // Copyright (C) 2008 by FLLL // Author: Robert Pollak // Copyright (C) 2009 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" void plfbox( PLFLT x, PLFLT y25, PLFLT y50, PLFLT y75, PLFLT lw, PLFLT uw ); void plcircle( PLFLT x, PLFLT y ); //-------------------------------------------------------------------------- // main // // Does a box plot. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i; char string[20]; PLFLT x0; // quartiles static PLFLT y25[] = { 0.984, 0.980, 0.976, 0.975, 0.973, 0.967, 0.974, 0.954, 0.987, 0.991 }; static PLFLT y50[] = { 0.994, 0.999, 1.035, 0.995, 1.002, 0.997, 1.034, 0.984, 1.007, 1.017 }; static PLFLT y75[] = { 1.054, 1.040, 1.066, 1.025, 1.043, 1.017, 1.054, 1.004, 1.047, 1.031 }; // lower and upper whisker static PLFLT lw[] = { 0.964, 0.950, 0.926, 0.955, 0.963, 0.937, 0.944, 0.924, 0.967, 0.941 }; static PLFLT uw[] = { 1.071, 1.062, 1.093, 1.045, 1.072, 1.067, 1.085, 1.024, 1.057, 1.071 }; // outliers static PLFLT outx[] = { 3.5, 6.5 }; static PLFLT outy[] = { 0.89, 1.09 }; // // static PLFLT pos[] = {0.0, 0.25, 0.5, 0.75, 1.0}; // static PLFLT red[] = {0.0, 0.25, 0.5, 1.0, 1.0}; // static PLFLT green[] = {1.0, 0.5, 0.5, 0.5, 1.0}; // static PLFLT blue[] = {1.0, 1.0, 0.5, 0.25, 0.0}; // // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); plvsta(); x0 = 1.; plwind( x0, x0 + 10, 0.85, 1.15 ); plcol0( 1 ); plbox( "bc", 1.0, 0, "bcgnst", 0, 0 ); pllab( "Group", "Value", "#frPLplot Example 32" ); // plscmap1l(1,5,pos,red,green,blue,NULL); for ( i = 0; i < 10; i++ ) { plcol1( i / 9.0 ); plfbox( ( x0 + i ), y25[i], y50[i], y75[i], lw[i], uw[i] ); sprintf( string, "%d", (int) x0 + i ); plmtex( "b", 1.0, ( ( i + 1 ) * .1 - .05 ), 0.5, string ); } // some outliers plotted with intermediate-sized circles, see PLplot // example 06 for other possibilities. plpoin( 2, outx, outy, 22 ); // Don't forget to call plend() to finish off! plend(); exit( 0 ); } void plfbox( PLFLT x, PLFLT y25, PLFLT y50, PLFLT y75, PLFLT lw, PLFLT uw ) { PLFLT px[5], py[5], mx[2], my[2], wx[2], wy[2], barx[2], bary[2]; PLFLT spacing; PLFLT xmin, xmax; PLFLT xmid, xwidth; spacing = .4; // in x axis units xmin = x + spacing / 2.; xmax = x + 1. - spacing / 2.; // box px[0] = xmin; py[0] = y25; px[1] = xmin; py[1] = y75; px[2] = xmax; py[2] = y75; px[3] = xmax; py[3] = y25; px[4] = xmin; py[4] = y25; plpsty( 0 ); plfill( 4, px, py ); plcol0( 1 ); pllsty( 1 ); plline( 5, px, py ); // median mx[0] = xmin; my[0] = y50; mx[1] = xmax; my[1] = y50; pllsty( 1 ); plline( 2, mx, my ); // lower whisker xmid = ( xmin + xmax ) / 2.; xwidth = xmax - xmin; wx[0] = xmid; wy[0] = lw; wx[1] = xmid; wy[1] = y25; pllsty( 2 ); // short dashes and gaps plline( 2, wx, wy ); barx[0] = xmid - xwidth / 4.; bary[0] = lw; barx[1] = xmid + xwidth / 4.; bary[1] = lw; pllsty( 1 ); plline( 2, barx, bary ); // upper whisker xmid = ( xmin + xmax ) / 2.; xwidth = xmax - xmin; wy[0] = y75; wy[1] = uw; pllsty( 2 ); // short dashes and gaps plline( 2, wx, wy ); bary[0] = uw; bary[1] = uw; pllsty( 1 ); plline( 2, barx, bary ); } plplot-5.10.0+dfsg/examples/c/x20c.c 644 1750 1750 3243011666362057 157460ustar andrewandrew// $Id: x20c.c 12095 2011-12-03 08:56:15Z andrewross $ // // plimage demo // // #include "plcdemos.h" #include "plevent.h" #include #define XDIM 260 #define YDIM 220 void save_plot( char * ); void gray_cmap( PLINT ); int read_img( const char *, PLFLT ***, int *, int *, int * ); int get_clip( PLFLT *, PLFLT *, PLFLT *, PLFLT * ); int dbg = 0; int nosombrero = 0; int nointeractive = 0; char *f_name = NULL; struct stretch_data { PLFLT xmin, xmax, ymin, ymax; PLFLT stretch; }; static PLOptionTable options[] = { { "dbg", // extra debugging plot NULL, NULL, &dbg, PL_OPT_BOOL, "-dbg", "Extra debugging plot" }, { "nosombrero", // Turns on test of xor function NULL, NULL, &nosombrero, PL_OPT_BOOL, "-nosombrero", "No sombrero plot" }, { "nointeractive", // Turns on test of xor function NULL, NULL, &nointeractive, PL_OPT_BOOL, "-nointeractive", "No interactive selection" }, { "save", // For saving in postscript NULL, NULL, &f_name, PL_OPT_STRING, "-save filename", "Save sombrero plot in color postscript `filename'" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; // Transformation function static void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ) { struct stretch_data *s = (struct stretch_data *) pltr_data; PLFLT x0, y0, dy; x0 = ( s->xmin + s->xmax ) * 0.5; y0 = ( s->ymin + s->ymax ) * 0.5; dy = ( s->ymax - s->ymin ) * 0.5; *tx = x0 + ( x0 - x ) * ( 1.0 - s->stretch * cos( ( y - y0 ) / dy * M_PI * 0.5 ) ); *ty = y; } int main( int argc, const char *argv[] ) { PLFLT x[XDIM], y[YDIM], **z, **r; PLFLT xi, yi, xe, ye; int i, j, width, height, num_col; PLFLT **img_f; PLFLT img_min; PLFLT img_max; struct stretch_data stretch; PLcGrid2 cgrid2; PLFLT xx, yy; // // Bugs in plimage(): // -at high magnifications, the left and right edge are ragged, try // ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 // // Bugs in x20c.c: // -if the window is resized after a selection is made on "lena", when // making a new selection the old one will re-appear. // // Parse and process command line arguments plMergeOpts( options, "x20c options", NULL ); plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); plAlloc2dGrid( &z, XDIM, YDIM ); // view image border pixels if ( dbg ) { plenv( 1., (PLFLT) XDIM, 1., (PLFLT) YDIM, 1, 1 ); // no plot box // build a one pixel square border, for diagnostics for ( i = 0; i < XDIM; i++ ) z[i][YDIM - 1] = 1.; // right for ( i = 0; i < XDIM; i++ ) z[i][0] = 1.; // left for ( i = 0; i < YDIM; i++ ) z[0][i] = 1.; // top for ( i = 0; i < YDIM; i++ ) z[XDIM - 1][i] = 1.; // botton pllab( "...around a blue square.", " ", "A red border should appear..." ); plimage( (const PLFLT * const *) z, XDIM, YDIM, 1., (PLFLT) XDIM, 1., (PLFLT) YDIM, 0., 0., 1., (PLFLT) XDIM, 1., (PLFLT) YDIM ); } // sombrero-like demo if ( !nosombrero ) { plAlloc2dGrid( &r, XDIM, YDIM ); plcol0( 2 ); // draw a yellow plot box, useful for diagnostics! :( plenv( 0., 2. * M_PI, 0, 3. * M_PI, 1, -1 ); for ( i = 0; i < XDIM; i++ ) x[i] = i * 2. * M_PI / (PLFLT) ( XDIM - 1 ); for ( i = 0; i < YDIM; i++ ) y[i] = i * 3. * M_PI / (PLFLT) ( YDIM - 1 ); for ( i = 0; i < XDIM; i++ ) for ( j = 0; j < YDIM; j++ ) { r[i][j] = sqrt( x[i] * x[i] + y[j] * y[j] ) + 1e-3; z[i][j] = sin( r[i][j] ) / ( r[i][j] ); } pllab( "No, an amplitude clipped \"sombrero\"", "", "Saturn?" ); plptex( 2., 2., 3., 4., 0., "Transparent image" ); plimage( (const PLFLT * const *) z, XDIM, YDIM, 0., 2. * M_PI, 0., 3. * M_PI, 0.05, 1., 0., 2. * M_PI, 0., 3. * M_PI ); plFree2dGrid( r, XDIM, YDIM ); // save the plot if ( f_name ) save_plot( f_name ); } plFree2dGrid( z, XDIM, YDIM ); // read Lena image // Note we try two different locations to cover the case where this // examples is being run from the test_c.sh script if ( read_img( "lena.pgm", &img_f, &width, &height, &num_col ) ) { if ( read_img( "../lena.pgm", &img_f, &width, &height, &num_col ) ) { fprintf( stderr, "No such file" ); plend(); exit( 1 ); } } // set gray colormap gray_cmap( num_col ); // display Lena plenv( 1., width, 1., height, 1, -1 ); if ( !nointeractive ) pllab( "Set and drag Button 1 to (re)set selection, Button 2 to finish.", " ", "Lena..." ); else pllab( "", " ", "Lena..." ); plimage( (const PLFLT * const *) img_f, width, height, 1., width, 1., height, 0., 0., 1., width, 1., height ); // plend();exit(0); // selection/expansion demo if ( !nointeractive ) { xi = 200.; xe = 330.; yi = 280.; ye = 220.; if ( get_clip( &xi, &xe, &yi, &ye ) ) // get selection rectangle { plend(); exit( 0 ); } // // I'm unable to continue, clearing the plot and advancing to the next // one, without hiting the enter key, or pressing the button... help! // // Forcing the xwin driver to leave locate mode and destroying the // xhairs (in GetCursorCmd()) solves some problems, but I still have // to press the enter key or press Button-2 to go to next plot, even // if a pladv() is not present! Using plbop() solves the problem, but // it shouldn't be needed! // // plbop(); // // plspause(0), pladv(0), plspause(1), also works, // but the above question remains. // With this approach, the previous pause state is lost, // as there is no API call to get its current state. // plspause( 0 ); pladv( 0 ); // display selection only plimage( (const PLFLT * const *) img_f, width, height, 1., width, 1., height, 0., 0., xi, xe, ye, yi ); plspause( 1 ); // zoom in selection plenv( xi, xe, ye, yi, 1, -1 ); plimage( (const PLFLT * const *) img_f, width, height, 1., width, 1., height, 0., 0., xi, xe, ye, yi ); } // Base the dynamic range on the image contents. plMinMax2dGrid( (const PLFLT * const *) img_f, width, height, &img_max, &img_min ); // Draw a saturated version of the original image. Only use the middle 50% // of the image's full dynamic range. plcol0( 2 ); plenv( 0, width, 0, height, 1, -1 ); pllab( "", "", "Reduced dynamic range image example" ); plimagefr( (const PLFLT * const *) img_f, width, height, 0., width, 0., height, 0., 0., img_min + img_max * 0.25, img_max - img_max * 0.25, NULL, NULL ); // Draw a distorted version of the original image, showing its full dynamic range. plenv( 0, width, 0, height, 1, -1 ); pllab( "", "", "Distorted image example" ); stretch.xmin = 0; stretch.xmax = width; stretch.ymin = 0; stretch.ymax = height; stretch.stretch = 0.5; // In C / C++ the following would work, with plimagefr directly calling // mypltr. For compatibilty with other language bindings the same effect // can be achieved by generating the transformed grid first and then // using pltr2. // plimagefr((const PLFLT **) img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, mypltr, (PLPointer) &stretch); plAlloc2dGrid( &cgrid2.xg, width + 1, height + 1 ); plAlloc2dGrid( &cgrid2.yg, width + 1, height + 1 ); cgrid2.nx = width + 1; cgrid2.ny = height + 1; for ( i = 0; i <= width; i++ ) { for ( j = 0; j <= height; j++ ) { mypltr( i, j, &xx, &yy, ( PLPointer ) & stretch ); cgrid2.xg[i][j] = xx; cgrid2.yg[i][j] = yy; } } plimagefr( (const PLFLT * const *) img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, pltr2, &cgrid2 ); plFree2dGrid( cgrid2.xg, width + 1, height + 1 ); plFree2dGrid( cgrid2.yg, width + 1, height + 1 ); plFree2dGrid( img_f, width, height ); plend(); exit( 0 ); } // read image from file in binary ppm format int read_img( const char *fname, PLFLT ***img_f, int *width, int *height, int *num_col ) { FILE *fp; unsigned char *img; char ver[80]; int i, j, w, h; PLFLT **imf; // naive grayscale binary ppm reading. If you know how to, improve it if ( ( fp = fopen( fname, "rb" ) ) == NULL ) return 1; if ( fscanf( fp, "%s\n", ver ) != 1 ) // version { fclose( fp ); return 1; } // printf("version: %s\n", ver); if ( strcmp( ver, "P5" ) ) // I only understand this! { fclose( fp ); return 1; } while ( ( i = fgetc( fp ) ) == '#' ) { if ( fgets( ver, 80, fp ) == NULL ) // comments { fclose( fp ); return 1; } // printf("%s", ver); } ungetc( i, fp ); if ( fscanf( fp, "%d%d%d\n", &w, &h, num_col ) != 3 ) // width, height num colors { fclose( fp ); return 1; } // printf("width=%d height=%d num_col=%d\n", w, h, *num_col); img = (unsigned char *) malloc( (size_t) ( w * h ) * sizeof ( char ) ); plAlloc2dGrid( &imf, w, h ); if ( (int) fread( img, sizeof ( char ), (size_t) ( w * h ), fp ) != w * h ) { fclose( fp ); free( img ); plFree2dGrid( imf, w, h ); return 1; } fclose( fp ); for ( i = 0; i < w; i++ ) for ( j = 0; j < h; j++ ) imf[i][j] = img[( h - 1 - j ) * w + i]; // flip image up-down free( img ); *width = w; *height = h; *img_f = imf; return 0; } // save plot void save_plot( char *fname ) { PLINT cur_strm, new_strm; plgstrm( &cur_strm ); // get current stream plmkstrm( &new_strm ); // create a new one plsdev( "psc" ); // new device type. Use a known existing driver plsfnam( fname ); // file name plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream plreplot(); // do the save plend1(); // close new device plsstrm( cur_strm ); // and return to previous one } // get selection square interactively int get_clip( PLFLT *xi, PLFLT *xe, PLFLT *yi, PLFLT *ye ) { PLGraphicsIn gin; PLFLT xxi = *xi, yyi = *yi, xxe = *xe, yye = *ye, t; PLINT st, start = 0; plxormod( 1, &st ); // enter xor mode to draw a selection rectangle if ( st ) // driver has xormod capability, continue { while ( 1 ) { PLFLT sx[5], sy[5]; plxormod( 0, &st ); plGetCursor( &gin ); plxormod( 1, &st ); if ( gin.button == 1 ) { xxi = gin.wX; yyi = gin.wY; if ( start ) plline( 5, sx, sy ); // clear previous rectangle start = 0; sx[0] = xxi; sy[0] = yyi; sx[4] = xxi; sy[4] = yyi; } if ( gin.state & 0x100 ) { xxe = gin.wX; yye = gin.wY; if ( start ) plline( 5, sx, sy ); // clear previous rectangle start = 1; sx[2] = xxe; sy[2] = yye; sx[1] = xxe; sy[1] = yyi; sx[3] = xxi; sy[3] = yye; plline( 5, sx, sy ); // draw new rectangle } if ( gin.button == 3 || gin.keysym == PLK_Return || gin.keysym == 'Q' ) { if ( start ) plline( 5, sx, sy ); // clear previous rectangle break; } } plxormod( 0, &st ); // leave xor mod if ( xxe < xxi ) { t = xxi; xxi = xxe; xxe = t; } if ( yyi < yye ) { t = yyi; yyi = yye; yye = t; } *xe = xxe; *xi = xxi; *ye = yye; *yi = yyi; return ( gin.keysym == 'Q' ); } else // driver has no xormod capability, just do nothing return 0; } // set gray colormap void gray_cmap( PLINT num_col ) { PLFLT r[2], g[2], b[2], pos[2]; r[0] = g[0] = b[0] = 0.0; r[1] = g[1] = b[1] = 1.0; pos[0] = 0.0; pos[1] = 1.0; plscmap1n( num_col ); plscmap1l( 1, 2, pos, r, g, b, NULL ); } plplot-5.10.0+dfsg/examples/c/x07c.c 644 1750 1750 403111462631041 157110ustar andrewandrew// $Id: x07c.c 11289 2010-10-29 20:44:17Z airwin $ // // Font demo. // #ifdef MSDOS #pragma optimize("",off) #endif #include "plcdemos.h" static int base[20] = { 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900 }; //-------------------------------------------------------------------------- // main // // Displays the entire "plsym" symbol (font) set. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { char text[10]; int i, j, k, l; PLFLT x, y; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); plfontld( 0 ); for ( l = 0; l < 20; l++ ) { if ( l == 2 ) plfontld( 1 ); pladv( 0 ); // Set up viewport and window plcol0( 2 ); plvpor( 0.15, 0.95, 0.1, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); // Draw the grid using plbox plbox( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame plcol0( 15 ); for ( i = 0; i <= 9; i++ ) { sprintf( text, "%d", i ); plmtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } k = 0; for ( i = 0; i <= 9; i++ ) { // Write the digits to the left of the frame sprintf( text, "%d", base[l] + 10 * i ); plmtex( "lv", 1.0, ( 0.95 - 0.1 * i ), 1.0, text ); for ( j = 0; j <= 9; j++ ) { x = 0.1 * j + 0.05; y = 0.95 - 0.1 * i; // Display the symbols plsym( 1, &x, &y, base[l] + k ); k = k + 1; } } if ( l < 2 ) plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); else plmtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x14c.c 644 1750 1750 2367411666362057 157630ustar andrewandrew// $Id: x14c.c 12095 2011-12-03 08:56:15Z andrewross $ // // Demo of multiple stream/window capability (requires Tk or Tcl-DP). // // Maurice LeBrun // IFS, University of Texas at Austin // // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; static PLINT space0 = 0, mark0 = 0, space1 = 1500, mark1 = 1500; void plot1( void ); void plot2( void ); void plot3( void ); void plot4( void ); void plot5( void ); void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ); //-------------------------------------------------------------------------- // main // // Plots several simple functions from other example programs. // // This version sends the output of the first 4 plots (one page) to two // independent streams. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int digmax; // Select either TK or DP driver and use a small window // Using DP results in a crash at the end due to some odd cleanup problems // The geometry strings MUST be in writable memory char geometry_master[] = "500x410+100+200"; char geometry_slave[] = "500x410+650+200"; char driver[80] = ""; PLINT fam, num, bmax; PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; int valid_geometry; // plplot initialization // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // If valid geometry specified on command line, use it for both streams. plgpage( &xp0, &yp0, &xleng0, &yleng0, &xoff0, &yoff0 ); valid_geometry = ( xleng0 > 0 && yleng0 > 0 ); // Set up first stream if ( valid_geometry ) plspage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); else plsetopt( "geometry", geometry_master ); plssub( 2, 2 ); plinit(); plgdev( driver ); plgfam( &fam, &num, &bmax ); printf( "Demo of multiple output streams via the %s driver.\n", driver ); printf( "Running with the second stream as slave to the first.\n" ); printf( "\n" ); // Start next stream plsstrm( 1 ); if ( valid_geometry ) plspage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); else plsetopt( "geometry", geometry_slave ); // Turn off pause to make this a slave (must follow master) plspause( 0 ); plsdev( driver ); plsfam( fam, num, bmax ); // Currently number of digits in format number can only be // set via the command line option plsetopt( "fflen", "2" ); plinit(); // Set up the data & plot // Original case plsstrm( 0 ); xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; plot1(); // Set up the data & plot xscale = 1.; yscale = 1.e+6; plot1(); // Set up the data & plot xscale = 1.; yscale = 1.e-6; digmax = 2; plsyax( digmax, 0 ); plot1(); // Set up the data & plot xscale = 1.; yscale = 0.0014; yoff = 0.0185; digmax = 5; plsyax( digmax, 0 ); plot1(); // To slave // The pleop() ensures the eop indicator gets lit. plsstrm( 1 ); plot4(); pleop(); // Back to master plsstrm( 0 ); plot2(); plot3(); // To slave plsstrm( 1 ); plot5(); pleop(); // Back to master to wait for user to advance plsstrm( 0 ); pleop(); // Call plend to finish off. plend(); exit( 0 ); } //-------------------------------------------------------------------------- void plot1( void ) { int i; PLFLT xmin, xmax, ymin, ymax; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * pow( x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 6 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points plcol0( 9 ); plpoin( 6, xs, ys, 9 ); // Draw the line through the data plcol0( 4 ); plline( 60, x, y ); plflush(); } //-------------------------------------------------------------------------- void plot2( void ) { int i; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). plcol0( 1 ); plenv( -2.0, 10.0, -0.4, 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line plcol0( 3 ); plline( 100, x, y ); plflush(); } //-------------------------------------------------------------------------- void plot3( void ) { int i; // For the final graph we wish to override the default tick intervals, and // so do not use PLENV pladv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. plvsta(); plwind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl // expects a pointer!! plstyl( 1, &mark1, &space1 ); plcol0( 2 ); plbox( "g", 30.0, 0, "g", 0.2, 0 ); plstyl( 0, &mark0, &space0 ); plcol0( 3 ); pllab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * M_PI / 180.0 ); } plcol0( 4 ); plline( 101, x, y ); plflush(); } //-------------------------------------------------------------------------- void plot4( void ) { int i, j; PLFLT dtr, theta, dx, dy, r; char text[4]; PLFLT x0[361], y0[361]; PLFLT x1[361], y1[361]; dtr = M_PI / 180.0; for ( i = 0; i <= 360; i++ ) { x0[i] = cos( dtr * i ); y0[i] = sin( dtr * i ); } // Set up viewport and window, but do not draw box plenv( -1.3, 1.3, -1.3, 1.3, 1, -2 ); for ( i = 1; i <= 10; i++ ) { for ( j = 0; j <= 360; j++ ) { x1[j] = 0.1 * i * x0[j]; y1[j] = 0.1 * i * y0[j]; } // Draw circles for polar grid plline( 361, x1, y1 ); } plcol0( 2 ); for ( i = 0; i <= 11; i++ ) { theta = 30.0 * i; dx = cos( dtr * theta ); dy = sin( dtr * theta ); // Draw radial spokes for polar grid pljoin( 0.0, 0.0, dx, dy ); sprintf( text, "%d", ROUND( theta ) ); // Write labels for angle // Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) plptex( dx, dy, dx, dy, -0.15, text ); else plptex( dx, dy, -dx, -dy, 1.15, text ); } // Draw the graph for ( i = 0; i <= 360; i++ ) { r = sin( dtr * ( 5 * i ) ); x1[i] = x0[i] * r; y1[i] = y0[i] * r; } plcol0( 3 ); plline( 361, x1, y1 ); plcol0( 4 ); plmtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); plflush(); } //-------------------------------------------------------------------------- // Demonstration of contour plotting #define XPTS 35 #define YPTS 46 #define XSPA 2. / ( XPTS - 1 ) #define YSPA 2. / ( YPTS - 1 ) PLFLT tr[6] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; // pltr_data argument is unused so mark it with the PL_UNUSED macro void mypltr( PLFLT xx, PLFLT yy, PLFLT *tx, PLFLT *ty, void * PL_UNUSED( pltr_data ) ) { *tx = tr[0] * xx + tr[1] * yy + tr[2]; *ty = tr[3] * xx + tr[4] * yy + tr[5]; } static PLFLT clevel[11] = { -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. }; void plot5( void ) { int i, j; PLFLT xx, yy; PLFLT **z, **w; static PLINT mark = 1500, space = 1500; // Set up function arrays plAlloc2dGrid( &z, XPTS, YPTS ); plAlloc2dGrid( &w, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } plenv( -1.0, 1.0, -1.0, 1.0, 0, 0 ); plcol0( 2 ); plcont( (const PLFLT * const *) z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); plstyl( 1, &mark, &space ); plcol0( 3 ); plcont( (const PLFLT * const *) w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); plcol0( 1 ); pllab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); plflush(); // Clean up plFree2dGrid( z, XPTS, YPTS ); plFree2dGrid( w, XPTS, YPTS ); } plplot-5.10.0+dfsg/examples/c/tutor.c 644 1750 1750 1721111462631041 163310ustar andrewandrew// $Id: tutor.c 11289 2010-10-29 20:44:17Z airwin $ // // Tony Richardson // // This program is intended to be used as a template for creating simple // two-dimensional plotting programs which use the PLplot plotting // library. The program was written with an emphasis on trying to clearly // illustrate how to use the PLplot library functions. // // This program reads data for M lines with N points each from an input // data file and plots them on the same graph using different symbols. It // draws axes with labels and places a title at the top of the figure. A // legend is drawn to the right of the figure. The input data file must // have the following format: // // M N // x[1] y[1][1] y[1][2] . . . y[1][M] // x[2] y[2][1] y[2][2] . . . y[2][M] // x[3] y[3][1] y[3][2] . . . y[3][M] // . . . . . . . // . . . . . . . // . . . . . . . // x[N] y[N][1] y[N][2] . . . y[N][M] // // (The first line contains the integer values M and N. The succeeding // N lines contain the x-coordinate and the corresponding y-coordinates // of each of the M lines.) // #include "plcdemos.h" static int error( char *str ); // // You can select a different set of symbols to use when plotting the // lines by changing the value of OFFSET. // #define OFFSET 2 int main( int argc, char *argv[] ) { // ============== Begin variable definition section. ============= // // i, j, and k are counting variables used in loops and such. M is the // number of lines to be plotted and N is the number of sample points // for each line. // int i, j, k, M, N, leglen; // // x is a pointer to an array containing the N x-coordinate values. y // points to an array of M pointers each of which points to an array // containing the N y-coordinate values for that line. // PLFLT *x, **y; // Define storage for the min and max values of the data. PLFLT xmin, xmax, ymin, ymax, xdiff, ydiff; // Define storage for the filename and define the input file pointer. char filename[80], string[80], tmpstr[80]; FILE *datafile; // Here are the character strings that appear in the plot legend. static char *legend[] = { "Aardvarks", "Gnus", "Llamas", NULL }; // Make sure last element is NULL // ============== Read in data from input file. ============= // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // First prompt the user for the input data file name printf( "Enter input data file name. " ); scanf( "%s", filename ); // and open the file. datafile = fopen( filename, "r" ); if ( datafile == NULL ) // error opening input file error( "Error opening input file." ); // Read in values of M and N k = fscanf( datafile, "%d %d", &M, &N ); if ( k != 2 ) // something's wrong error( "Error while reading data file." ); // Allocate memory for all the arrays. x = (PLFLT *) malloc( N * sizeof ( PLFLT ) ); if ( x == NULL ) error( "Out of memory!" ); y = (PLFLT **) malloc( M * sizeof ( PLFLT * ) ); if ( y == NULL ) error( "Out of memory!" ); for ( i = 0; i < M; i++ ) { y[i] = (PLFLT *) malloc( N * sizeof ( PLFLT ) ); if ( y[i] == NULL ) error( "Out of memory!" ); } // Now read in all the data. for ( i = 0; i < N; i++ ) // N points { k = fscanf( datafile, "%f", &x[i] ); if ( k != 1 ) error( "Error while reading data file." ); for ( j = 0; j < M; j++ ) // M lines { k = fscanf( datafile, "%f", &y[j][i] ); if ( k != 1 ) error( "Error while reading data file." ); } } // ============== Graph the data. ============= // Set graph to portrait orientation. (Default is landscape.) // (Portrait is usually desired for inclusion in TeX documents.) plsori( 1 ); // Initialize plplot plinit(); // // We must call pladv() to advance to the first (and only) subpage. // You might want to use plenv() instead of the pladv(), plvpor(), // plwind() sequence. // pladv( 0 ); // // Set up the viewport. This is the window into which the data is // plotted. The size of the window can be set with a call to // plvpor(), which sets the size in terms of normalized subpage // coordinates. I want to plot the lines on the upper half of the // page and I want to leave room to the right of the figure for // labelling the lines. We must also leave room for the title and // labels with plvpor(). Normally a call to plvsta() can be used // instead. // plvpor( 0.15, 0.70, 0.5, 0.9 ); // // We now need to define the size of the window in user coordinates. // To do this, we first need to determine the range of the data // values. // xmin = xmax = x[0]; ymin = ymax = y[0][0]; for ( i = 0; i < N; i++ ) { if ( x[i] < xmin ) xmin = x[i]; if ( x[i] > xmax ) xmax = x[i]; for ( j = 0; j < M; j++ ) { if ( y[j][i] < ymin ) ymin = y[j][i]; if ( y[j][i] > ymax ) ymax = y[j][i]; } } // // Now set the size of the window. Leave a small border around the // data. // xdiff = ( xmax - xmin ) / 20.; ydiff = ( ymax - ymin ) / 20.; plwind( xmin - xdiff, xmax + xdiff, ymin - ydiff, ymax + ydiff ); // // Call plbox() to draw the axes (see the PLPLOT manual for // information about the option strings.) // plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); // // Label the axes and title the graph. The string "#gm" plots the // Greek letter mu, all the Greek letters are available, see the // PLplot manual. // pllab( "Time (weeks)", "Height (#gmparsecs)", "Specimen Growth Rate" ); // // Plot the data. plpoin() draws a symbol at each point. plline() // connects all the points. // for ( i = 0; i < M; i++ ) { plpoin( N, x, y[i], i + OFFSET ); plline( N, x, y[i] ); } // // Draw legend to the right of the chart. Things get a little messy // here. You may want to remove this section if you don't want a // legend drawn. First find length of longest string. // leglen = 0; for ( i = 0; i < M; i++ ) { if ( legend[i] == NULL ) break; j = strlen( legend[i] ); if ( j > leglen ) leglen = j; } // // Now build the string. The string consists of an element from the // legend string array, padded with spaces, followed by one of the // symbols used in plpoin above. // for ( i = 0; i < M; i++ ) { if ( legend[i] == NULL ) break; strcpy( string, legend[i] ); j = strlen( string ); if ( j < leglen ) // pad string with spaces { for ( k = j; k < leglen; k++ ) string[k] = ' '; string[k] = '\0'; } // pad an extra space strcat( string, " " ); j = strlen( string ); // insert the ASCII value of the symbol plotted with plpoin() string[j] = i + OFFSET; string[j + 1] = '\0'; // plot the string plmtex( "rv", 1., 1. - (double) ( i + 1 ) / ( M + 1 ), 0., string ); } // Tell plplot we are done with this page. pladv( 0 ); // advance page // Don't forget to call plend() to finish off! plend(); exit( 0 ); } static int error( char *str ) { fprintf( stderr, "%s\n", str ); exit( 1 ); } plplot-5.10.0+dfsg/examples/c/x13c.c 644 1750 1750 453611645760320 157260ustar andrewandrew// $Id: x13c.c 11968 2011-10-14 07:12:16Z andrewross $ // // Pie chart demo. // #include "plcdemos.h" static const char *text[] = { "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" }; //-------------------------------------------------------------------------- // main // // Does a simple pie chart. //-------------------------------------------------------------------------- int main( int argc, const char *argv[] ) { int i, j, dthet, theta0, theta1, theta; PLFLT just, dx, dy; static PLFLT x[500], y[500], per[5]; per[0] = 10.; per[1] = 32.; per[2] = 12.; per[3] = 30.; per[4] = 16.; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); pladv( 0 ); // Ensure window has aspect ratio of one so circle is // plotted as a circle. plvasp( 1.0 ); plwind( 0., 10., 0., 10. ); // plenv(0., 10., 0., 10., 1, -2); plcol0( 2 ); // n.b. all theta quantities scaled by 2*M_PI/500 to be integers to avoid // floating point logic problems. theta0 = 0; dthet = 1; for ( i = 0; i <= 4; i++ ) { j = 0; x[j] = 5.; y[j++] = 5.; // n.b. the theta quantities multiplied by 2*M_PI/500 afterward so // in fact per is interpreted as a percentage. theta1 = (int) ( theta0 + 5 * per[i] ); if ( i == 4 ) theta1 = 500; for ( theta = theta0; theta <= theta1; theta += dthet ) { x[j] = 5 + 3 * cos( ( 2. * M_PI / 500. ) * theta ); y[j++] = 5 + 3 * sin( ( 2. * M_PI / 500. ) * theta ); } plcol0( i + 1 ); plpsty( ( i + 3 ) % 8 + 1 ); plfill( j, x, y ); plcol0( 1 ); plline( j, x, y ); just = ( 2. * M_PI / 500. ) * ( theta0 + theta1 ) / 2.; dx = .25 * cos( just ); dy = .25 * sin( just ); if ( ( theta0 + theta1 ) < 250 || ( theta0 + theta1 ) > 750 ) just = 0.; else just = 1.; plptex( ( x[j / 2] + dx ), ( y[j / 2] + dy ), 1.0, 0.0, just, text[i] ); theta0 = theta - dthet; } plfont( 2 ); plschr( 0., 1.3 ); plptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" ); // Don't forget to call PLEND to finish off! plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x19c.c 644 1750 1750 1151112221050115 157240ustar andrewandrew// $Id: x19c.c 12532 2013-09-26 15:18:37Z andrewross $ // // Illustrates backdrop plotting of world, US maps. // Contributed by Wesley Ebisuzaki. // #include "plcdemos.h" void map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ); void mapform19( PLINT n, PLFLT *x, PLFLT *y ); PLFLT normalize_longitude( PLFLT lon ); void geolocation_labeler( PLINT axis, PLFLT value, char *label, PLINT length, PLPointer data ); void map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer PL_UNUSED( data ) ) { double radius; radius = 90.0 - y; *xt = radius * cos( x * M_PI / 180.0 ); *yt = radius * sin( x * M_PI / 180.0 ); } //-------------------------------------------------------------------------- // mapform19 // // Defines specific coordinate transformation for example 19. // Not to be confused with mapform in src/plmap.c. // x[], y[] are the coordinates to be plotted. //-------------------------------------------------------------------------- void mapform19( PLINT n, PLFLT *x, PLFLT *y ) { int i; double xp, yp; for ( i = 0; i < n; i++ ) { map_transform( x[i], y[i], &xp, &yp, NULL ); x[i] = xp; y[i] = yp; } } // "Normalize" longitude values so that they always fall between -180.0 and // 180.0 PLFLT normalize_longitude( PLFLT lon ) { PLFLT times; if ( lon >= -180.0 && lon <= 180.0 ) { return ( lon ); } else { times = floor( ( fabs( lon ) + 180.0 ) / 360.0 ); if ( lon < 0.0 ) { return ( lon + 360.0 * times ); } else { return ( lon - 360.0 * times ); } } } // A custom axis labeling function for longitudes and latitudes. void geolocation_labeler( PLINT axis, PLFLT value, char *label, PLINT length, PLPointer PL_UNUSED( data ) ) { const char *direction_label = NULL; PLFLT label_val = 0.0; if ( axis == PL_Y_AXIS ) { label_val = value; if ( label_val > 0.0 ) { direction_label = " N"; } else if ( label_val < 0.0 ) { direction_label = " S"; } else { direction_label = "Eq"; } } else if ( axis == PL_X_AXIS ) { label_val = normalize_longitude( value ); if ( label_val > 0.0 ) { direction_label = " E"; } else if ( label_val < 0.0 ) { direction_label = " W"; } else { direction_label = ""; } } if ( axis == PL_Y_AXIS && value == 0.0 ) { // A special case for the equator snprintf( label, (size_t) length, "%s", direction_label ); } else { snprintf( label, (size_t) length, "%.0f%s", fabs( label_val ), direction_label ); } } //-------------------------------------------------------------------------- // main // // Shows two views of the world map. //-------------------------------------------------------------------------- int main( int argc, const char **argv ) { PLFLT minx, maxx, miny, maxy; PLFLT x, y; // Parse and process command line arguments (void) plparseopts( &argc, argv, PL_PARSE_FULL ); // Longitude (x) and latitude (y) miny = -70; maxy = 80; plinit(); // Cartesian plots // Most of world minx = -170; maxx = minx + 360; // Setup a custom latitude and longitude-based scaling function. plslabelfunc( geolocation_labeler, NULL ); plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( NULL, "usaglobe", minx, maxx, miny, maxy ); // The Americas minx = 190; maxx = 340; plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( NULL, "usaglobe", minx, maxx, miny, maxy ); // Clear the labeling function plslabelfunc( NULL, NULL ); // Polar, Northern hemisphere minx = 0; maxx = 360; plenv( -75., 75., -75., 75., 1, -1 ); plmap( mapform19, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0; maxx = 360; plstransform( map_transform, NULL ); pllsty( 1 ); plenv( -75., 75., -75., 75., 1, -1 ); // No need to set the map transform here as the global transform will be // used. plmap( NULL, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( NULL, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Show Baltimore, MD on the map plcol0( 2 ); plssym( 0.0, 2.0 ); x = -76.6125; y = 39.2902778; plpoin( 1, &x, &y, 18 ); plssym( 0.0, 1.0 ); plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); // For C, this is how the global transform is cleared plstransform( NULL, NULL ); plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/c/x00c.c 644 1750 1750 322711652165607 157230ustar andrewandrew// $Id: x00c.c 12001 2011-10-27 05:26:31Z airwin $ // // Simple demo of a 2D line plot. // // Copyright (C) 2011 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plcdemos.h" #define NSIZE 101 int main( int argc, const char *argv[] ) { PLFLT x[NSIZE], y[NSIZE]; PLFLT xmin = 0., xmax = 1., ymin = 0., ymax = 100.; int i; // Prepare data to be plotted. for ( i = 0; i < NSIZE; i++ ) { x[i] = (PLFLT) ( i ) / (PLFLT) ( NSIZE - 1 ); y[i] = ymax * x[i] * x[i]; } // Parse and process command line arguments plparseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot plinit(); // Create a labelled box to hold the plot. plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ); // Plot the data that was prepared above. plline( NSIZE, x, y ); // Close PLplot library plend(); exit( 0 ); } plplot-5.10.0+dfsg/examples/CMakeLists.txt 644 1750 1750 12700412274613723 173610ustar andrewandrew# examples/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006-2013 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. if(CORE_BUILD) # Configure Makefile.examples with some specific variables for the # traditional Makefile + pkg-config installed examples build. # cxx and tk subdirectories are special cases. if(PLD_ps) if(NOT ENABLE_ada) set(PSC_ADA_COMMENT "#") endif(NOT ENABLE_ada) if(NOT ENABLE_d) set(PSC_D_COMMENT "#") endif(NOT ENABLE_d) if(NOT ENABLE_f95) set(PSC_F95_COMMENT "#") endif(NOT ENABLE_f95) if(NOT ENABLE_java) set(PSC_JAVA_COMMENT "#") endif(NOT ENABLE_java) if(NOT ENABLE_ocaml) set(PSC_OCAML_COMMENT "#") endif(NOT ENABLE_ocaml) if(NOT ENABLE_octave) set(PSC_OCTAVE_COMMENT "#") endif(NOT ENABLE_octave) if(NOT ENABLE_pdl) set(PSC_PERL_COMMENT "#") endif(NOT ENABLE_pdl) if(NOT ENABLE_python) set(PSC_PYTHON_COMMENT "#") endif(NOT ENABLE_python) if(NOT ENABLE_tcl) set(PSC_TCL_COMMENT "#") endif(NOT ENABLE_tcl) if(NOT ENABLE_lua) set(PSC_LUA_COMMENT "#") endif(NOT ENABLE_lua) else(PLD_ps) set(PSC_ADA_COMMENT "#") set(PSC_C_COMMENT "#") set(PSC_D_COMMENT "#") set(PSC_F95_COMMENT "#") set(PSC_JAVA_COMMENT "#") set(PSC_OCAML_COMMENT "#") set(PSC_OCTAVE_COMMENT "#") set(PSC_PERL_COMMENT "#") set(PSC_PYTHON_COMMENT "#") set(PSC_TCL_COMMENT "#") endif(PLD_ps) if(NOT(ENABLE_cxx AND (PLD_ps OR ENABLE_qt))) set(CXX_COMMENT "#") endif(NOT(ENABLE_cxx AND (PLD_ps OR ENABLE_qt))) if(NOT ENABLE_tkX) set(TK_COMMENT "#") endif(NOT ENABLE_tkX) if(NOT PLD_pdfcairo) set(PDFCAIRO_COMMENT "#") endif(NOT PLD_pdfcairo) if(NOT PLD_pngcairo) set(PNGCAIRO_COMMENT "#") endif(NOT PLD_pngcairo) if(NOT PLD_pscairo) set(PSCAIRO_COMMENT "#") endif(NOT PLD_pscairo) if(NOT PLD_epscairo) set(EPSCAIRO_COMMENT "#") endif(NOT PLD_epscairo) if(NOT PLD_svgcairo) set(SVGCAIRO_COMMENT "#") endif(NOT PLD_svgcairo) if(NOT PLD_gif) set(GIF_COMMENT "#") endif(NOT PLD_gif) if(NOT PLD_jpeg) set(JPEG_COMMENT "#") endif(NOT PLD_jpeg) if(NOT PLD_png) set(PNG_COMMENT "#") endif(NOT PLD_png) if(NOT PLD_psttf) set(PSTTFC_COMMENT "#") endif(NOT PLD_psttf) if(NOT PLD_svg) set(SVG_COMMENT "#") endif(NOT PLD_svg) if(NOT PLD_xfig) set(XFIG_COMMENT "#") endif(NOT PLD_xfig) if(NOT PLD_pstex) set(PSTEX_COMMENT "#") endif(NOT PLD_pstex) if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(COMPARE_COMMENT) else(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(COMPARE_COMMENT "#") endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) if(NOT PLD_cgm) set(CGM_COMMENT "#") endif(NOT PLD_cgm) if(NOT PLD_bmpqt) set(BMPQT_COMMENT "#") endif(NOT PLD_bmpqt) if(NOT PLD_jpgqt) set(JPGQT_COMMENT "#") endif(NOT PLD_jpgqt) if(NOT PLD_pngqt) set(PNGQT_COMMENT "#") endif(NOT PLD_pngqt) if(NOT PLD_ppmqt) set(PPMQT_COMMENT "#") endif(NOT PLD_ppmqt) if(NOT PLD_tiffqt) set(TIFFQT_COMMENT "#") endif(NOT PLD_tiffqt) if(NOT PLD_svgqt) set(SVGQT_COMMENT "#") endif(NOT PLD_svgqt) if(NOT PLD_epsqt) set(EPSQT_COMMENT "#") endif(NOT PLD_epsqt) if(NOT PLD_pdfqt) set(PDFQT_COMMENT "#") endif(NOT PLD_pdfqt) if(FORCE_EXTERNAL_STATIC) # This experiment option untested, but it should work as well as # FORCE_EXTERNAL_STATIC does for the CMake linking case for the # core build in the build tree. That is, not well at all (drivers # limited to those without external dependencies and languages limited # to C, C++, D, and Fortran 95) because # of severe limitations in static library support on Linux. # pkg-config does use --static option for traditional installed examples build. set(PC_STATIC_OPTION "--static") else(FORCE_EXTERNAL_STATIC) # pkg-config does not use --static option for traditional installed examples build. set(PC_STATIC_OPTION) endif(FORCE_EXTERNAL_STATIC) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples RENAME Makefile ) # Sort out RPATH issues for traditional build of installed examples using # */Makefiles configured in each * subdirectory from */Makefile.examples.in. if(USE_RPATH) get_target_property(_LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH) if(_LIB_INSTALL_RPATH) string(REGEX REPLACE ";" ":" LIB_INSTALL_RPATH "${_LIB_INSTALL_RPATH}") set(RPATHCMD "-Wl,-rpath -Wl,${LIB_INSTALL_RPATH}") if(PLD_extqt) if(ENABLE_DYNDRIVERS) get_target_property(_qt_INSTALL_RPATH qt INSTALL_RPATH) if(_qt_INSTALL_RPATH) string(REGEX REPLACE ";" ":" qt_INSTALL_RPATH "${_qt_INSTALL_RPATH}") set(qt_RPATHCMD "-Wl,-rpath -Wl,${LIB_INSTALL_RPATH}:${qt_INSTALL_RPATH}:${DRV_DIR}") else(_qt_INSTALL_RPATH) set(qt_RPATHCMD) endif(_qt_INSTALL_RPATH) else(ENABLE_DYNDRIVERS) set(qt_RPATHCMD ${RPATHCMD}) endif(ENABLE_DYNDRIVERS) endif(PLD_extqt) if(ENABLE_tcl) get_target_property(_plplottcltk_Main_INSTALL_RPATH plplottcltk_Main${LIB_TAG} INSTALL_RPATH) if(_plplottcltk_Main_INSTALL_RPATH) string(REGEX REPLACE ";" ":" plplottcltk_Main_INSTALL_RPATH "${_plplottcltk_Main_INSTALL_RPATH}") set(plplottcltk_Main_RPATHCMD "-Wl,-rpath -Wl,${LIB_INSTALL_RPATH}:${plplottcltk_Main_INSTALL_RPATH}") else(_plplottcltk_Main_INSTALL_RPATH) set(plplottcltk_Main_RPATHCMD) endif(_plplottcltk_Main_INSTALL_RPATH) endif(ENABLE_tcl) else(_LIB_INSTALL_RPATH) set(RPATHCMD) set(qt_RPATHCMD) set(plplottcltk_Main_RPATHCMD) endif(_LIB_INSTALL_RPATH) endif(USE_RPATH) # Install lena.pgm in installed examples directory so that all implementations # of example 20 in the various examples subdirectories can conveniently # access this file. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lena.pgm DESTINATION ${DATA_DIR}/examples ) endif(CORE_BUILD) if(CORE_BUILD) # These variables (normally not set or needed for a core build) are # needed below for the tests of the languages and devices. They # are also needed to configure plplot_configure.cmake whose template # file is plplot_configure.cmake_installed_examples.in and which # ends up installed in examples/cmake/module. set(ENABLE_c ON) set(PLD_psc ${PLD_ps}) set(PLD_psttfc ${PLD_psttf}) # The psc device handled separately below so don't add it to # FILE_DEVICES_LIST. if(PLD_psttfc) list(APPEND FILE_DEVICES_LIST psttfc:psttf:OFF) endif(PLD_psttfc) # Start configuration/installation of CMake-based build system for # installed examples. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt DESTINATION ${DATA_DIR}/examples ) # language_info_LIST contains information about the languages used in # the noninteractive tests. The first field is language (which must be # consistent with the list of languages configured by set commands in # examples/plplot_configure.cmake_installed_examples.in). The second # field is the subdirectory corresponding to the language. The third # field is the file suffix on plplot-test.sh results for that language. # N.B. this list is configured in plplot_configure.cmake below and # is therefore available both for the core build of the tests and # the installed-examples build of the tests below. set(language_info_LIST ada:ada:a c:c:c cxx:c++:cxx d:d:d f95:f95:f95 java:java:j lua:lua:lua ocaml:ocaml:ocaml octave:octave:o pdl:perl:pdl python:python:p tcl:tcl:t ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plplot_configure.cmake_installed_examples.in ${CMAKE_CURRENT_BINARY_DIR}/plplot_configure.cmake_installed_examples @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot_configure.cmake_installed_examples DESTINATION ${DATA_DIR}/examples/cmake/modules RENAME plplot_configure.cmake ) # function support for CMake-based build system for installed examples. install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/plplot_functions.cmake DESTINATION ${DATA_DIR}/examples/cmake/modules ) # pkg-config support for CMake-based build system for installed examples. install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/pkg-config.cmake DESTINATION ${DATA_DIR}/examples/cmake/modules ) # Install soft-landing support for compiler detection/testing. install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/language_support.cmake DESTINATION ${DATA_DIR}/examples/cmake/modules ) # Install qt support file. if(ANY_QT_DEVICE) install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/ndp_UseQt4.cmake DESTINATION ${DATA_DIR}/examples/cmake/modules ) endif(ANY_QT_DEVICE) # Install PLplot-specific language support files needed for CMake-based # build of installed examples. # N.B. This list of files must be maintained consistently with the file # lists in cmake/modules/language_support.cmake. set(LANG_SUPPORT_FILES) if(ENABLE_ada) set(LANG_SUPPORT_FILES ${LANG_SUPPORT_FILES} language_support/cmake:CMakeAdaCompiler.cmake.in language_support/cmake:CMakeAdaInformation.cmake language_support/cmake:CMakeDetermineAdaCompiler.cmake language_support/cmake:CMakeTestAdaCompiler.cmake ) endif(ENABLE_ada) if(ENABLE_d) set(LANG_SUPPORT_FILES ${LANG_SUPPORT_FILES} language_support/cmake:CMakeD_Copyright.txt language_support/cmake:CMakeDCompiler.cmake.in language_support/cmake:CMakeDInformation.cmake language_support/cmake:CMakeDetermineDCompiler.cmake language_support/cmake:CMakeTestDCompiler.cmake language_support/cmake/Platform:Darwin-dmd.cmake language_support/cmake/Platform:Linux-dmd.cmake language_support/cmake/Platform:Linux-gdc.cmake language_support/cmake/Platform:Windows-dmd.cmake language_support/cmake/Platform:Windows-gdc.cmake language_support/cmake/Platform:Windows-gdc.cmake ) endif(ENABLE_d) if(LANG_SUPPORT_FILES) foreach(LANG_SUPPORT_info ${LANG_SUPPORT_FILES}) string(REGEX REPLACE "^(.*):.*$" "\\1" LANG_SUPPORT_DIR ${LANG_SUPPORT_info}) string(REGEX REPLACE "^.*:(.*)$" "\\1" LANG_SUPPORT_FILE ${LANG_SUPPORT_info}) install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/${LANG_SUPPORT_DIR}/${LANG_SUPPORT_FILE} DESTINATION ${DATA_DIR}/examples/cmake/modules/${LANG_SUPPORT_DIR} ) endforeach(LANG_SUPPORT_info ${LANG_SUPPORT_FILES}) endif(LANG_SUPPORT_FILES) else(CORE_BUILD) project(installed_plplot_examples NONE) message(STATUS "CMake version = ${CMAKE_VERSION}") message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") # The minimum version and policy settings normally follow what is # done for the core build. Check the core build for the reasons for # these decisions. cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) if(POLICY CMP0022) message(STATUS "Explicitly setting policy CMP0022 to OLD") cmake_policy(SET CMP0022 OLD) endif(POLICY CMP0022) if(POLICY CMP0023) message(STATUS "Explicitly setting policy CMP0023 to OLD") cmake_policy(SET CMP0023 OLD) endif(POLICY CMP0023) message(STATUS "CMAKE_PLATFORM_INFO_DIR = ${CMAKE_PLATFORM_INFO_DIR}") # Locations where PLplot cmake build system first looks for cmake modules. set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake ${PROJECT_SOURCE_DIR}/cmake/modules/language_support/cmake-2.8 ) #Configure variables and enable languages as needed. include(plplot_configure) include(export_plplot) endif(CORE_BUILD) if(CORE_BUILD AND BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") endif(CORE_BUILD AND BUILD_TEST) # Decide on device to be used for generic interactive tests. if(PLD_xwin) # Typically for Unix with X set(generic_interactive_device xwin) elseif(PLD_ntk) # Typically for all platforms if ntk is available but not xwin set(generic_interactive_device ntk) elseif(PLD_wingcc) # Typically for Windows if -dev ntk is not available set(generic_interactive_device wingcc) else(PLD_xwin) set(generic_interactive_device) endif(PLD_xwin) # language_info_LIST excludes the tk subdirectly since noninteractive # tests and file results do not involve tk. However, the tk # subdirectory does have to be processed just like the rest # so add it to this loop. foreach(language_info ${language_info_LIST} "tk:tk:nothing") string(REGEX REPLACE "^(.*):.*:.*$" "\\1" language ${language_info}) string(REGEX REPLACE "^.*:(.*):.*$" "\\1" subdir ${language_info}) #message(STATUS "DEBUG: language, subdir = ${language},${subdir}") if(ENABLE_${language}) add_subdirectory(${subdir}) get_property(targets_examples_${language} GLOBAL PROPERTY TARGETS_examples_${language}) get_property(files_examples_${language} GLOBAL PROPERTY FILES_examples_${language}) endif(ENABLE_${language}) endforeach(language_info ${language_info_LIST} "tk:tk:nothing") if(BUILD_TEST) # lena.pgm needed in build tree for the examples that are run from there. # Done at cmake time without dependencies because cannot see how this # file will ever change on short time scales. execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lena.pgm ${CMAKE_CURRENT_BINARY_DIR}/lena.pgm ) find_program(VALGRIND_EXECUTABLE valgrind) if(VALGRIND_EXECUTABLE) option(VALGRIND_ALL_TESTS "Apply valgrind to all runs of plplot_test/plplot-test.sh" OFF) if(VALGRIND_ALL_TESTS) set(plplot_test_debug --debug) else(VALGRIND_ALL_TESTS) set(plplot_test_debug) endif(VALGRIND_ALL_TESTS) else(VALGRIND_EXECUTABLE) set(plplot_test_debug) endif(VALGRIND_EXECUTABLE) if(CORE_BUILD) set(custom_test_script ${CMAKE_BINARY_DIR}/plplot_test/plplot-test.sh) set(custom_env EXAMPLES_DIR=${CMAKE_BINARY_DIR}/examples SRC_EXAMPLES_DIR=${CMAKE_SOURCE_DIR}/examples) set(java_custom_env ${custom_env} PLPLOT_JAVA_WRAP_DIR=${CMAKE_BINARY_DIR}/bindings/java/ PLPLOT_CLASSPATH=${CMAKE_BINARY_DIR}/examples/java/plplot.jar) set(compare_script ${CMAKE_BINARY_DIR}/plplot_test/test_diff.sh) else(CORE_BUILD) set(custom_test_script ${CMAKE_CURRENT_SOURCE_DIR}/plplot-test.sh) set(custom_env SRC_EXAMPLES_DIR=${CMAKE_CURRENT_SOURCE_DIR}) set(java_custom_env ${custom_env}) set(compare_script ${CMAKE_CURRENT_SOURCE_DIR}/test_diff.sh) endif(CORE_BUILD) set(custom_test_command ${SH_EXECUTABLE} ${custom_test_script}) set(compare_command ${SH_EXECUTABLE} ${compare_script}) if(PLD_psc) set(compare_file_depends ${custom_test_script}) if(ENABLE_DYNDRIVERS) # The ps shared object implements both the psc (and ps) devices. get_property(FILE_DEPENDS_ps GLOBAL PROPERTY FILE_DEPENDS_ps_dyndriver) # FILE_DEPENDS_ps contains the filename associated with testing ps. # It is empty if not a core build. # The file dependency on ps takes care of all # target and file dependencies associated with ps. list(APPEND compare_file_depends ${FILE_DEPENDS_ps} ps) endif(ENABLE_DYNDRIVERS) set(diff_targets_LIST) set(diff_files_LIST) # language_info_LIST set above. Each list member consists of a # colon-separated language name, subdirectory name, # and the associated filename suffix used by plplot-test.sh. foreach(language_info ${language_info_LIST}) string(REGEX REPLACE "^(.*):.*:.*$" "\\1" language ${language_info}) string(REGEX REPLACE "^.*:.*:(.*)$" "\\1" suffix ${language_info}) if(ENABLE_${language}) set(compare_file_depends_${language} ${compare_file_depends}) #message(STATUS "DEBUG: files_examples_${language} = ${file_examples_${language}}") #message(STATUS "DEBUG: targets_examples_${language} = ${targets_examples_${language}}") if(files_examples_${language}) # files_examples_${language} is true if the # subdirectory created targets with add_custom_target which # depended on an add_custom_command. For this special case, # you cannot use the created targets for file dependencies # because of CMake implementation constraints. Instead you # must use _files_ (contained in files_examples_${language} # for file dependencies. # Another case covered here is when the subdirectory # contains non-generated examples files. In this case also you must # (of course) use _files_ for file dependencies. list(APPEND compare_file_depends_${language} ${files_examples_${language}}) else(files_examples_${language}) # files_examples_${language} is only false if the # subdirectory creates targets with add_executable. For # this special case, CMake allows use of the created targets # for file dependencies. if(targets_examples_${language}) list(APPEND compare_file_depends_${language} ${targets_examples_${language}}) endif(targets_examples_${language}) endif(files_examples_${language}) #message(STATUS "DEBUG: compare_file_depends_${language} = ${compare_file_depends_${language}}") if(language STREQUAL "java") set(environment ${java_custom_env}) else(language STREQUAL "java") set(environment ${custom_env}) endif(language STREQUAL "java") list_example_files(${CMAKE_CURRENT_BINARY_DIR} psc ${suffix} output_list) add_custom_command( OUTPUT ${output_list} COMMAND ${CMAKE_COMMAND} -E echo "Generate ${language} results for psc device" COMMAND env ${environment} ${custom_test_command} --verbose --front-end=${language} --device=psc ${plplot_test_debug} DEPENDS ${compare_file_depends_${language}} VERBATIM ) add_custom_target(test_${language}_psc DEPENDS ${output_list} ) list(APPEND diff_targets_LIST test_${language}_psc) list(APPEND diff_files_LIST ${output_list}) # If the subdirectory used an add_custom_target (as indicated # by both files_examples_${language} and targets_examples_${language} # being true), then for that special case must add a target-level # dependency as demanded by the CMake implementation. if(files_examples_${language} AND targets_examples_${language}) #message(STATUS "DEBUG: targets_examples_${language} = ${targets_examples_${language}}") add_dependencies(test_${language}_psc ${targets_examples_${language}}) endif(files_examples_${language} AND targets_examples_${language}) # FILE_DEPENDS_ps is empty if test_ps_dyndriver target is not defined. if(FILE_DEPENDS_ps) add_dependencies(test_${language}_psc test_ps_dyndriver) endif(FILE_DEPENDS_ps) endif(ENABLE_${language}) endforeach(language_info ${language_info_LIST}) if(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) # Note this target has complete file and target dependencies for # a comparison of stdout and PostScript results. add_custom_target(test_diff_psc COMMAND ${compare_command} DEPENDS ${diff_files_LIST} ) add_dependencies(test_diff_psc ${diff_targets_LIST}) set(noninteractive_targets_LIST test_diff_psc) else(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) set(noninteractive_targets_LIST) endif(CMP_EXECUTABLE OR DIFF_EXECUTABLE AND TAIL_EXECUTABLE) else(PLD_psc) set(noninteractive_targets_LIST) endif(PLD_psc) # ENABLE_c is always ON by construction, but test it anyway for # consistency sake. if(ENABLE_c) set(device_depends ${custom_test_script}) # See explanation above about what to do with files_examples_c and # targets_examples_c. if(files_examples_c) list(APPEND device_depends ${files_examples_c}) else(files_examples_c) if(targets_examples_c) list(APPEND device_depends ${targets_examples_c}) endif(targets_examples_c) endif(files_examples_c) # FILE_DEVICES_LIST is set in cmake/modules/drivers-finish.cmake # for all enabled _file_ devices and adjusted above for the # special case of the psttfc device. It is thus available for the # core build. It is also configured in plplot_configure.cmake and # is thus available for the installed examples tests. Each list # member consists of a colon-separated device name, driver name, # and a Boolean variable that indicates if device has familied # output in plplot-test.sh. # N.B. device psc is deliberately excluded from list because it is # handled in a different way above. foreach(file_devices_info ${FILE_DEVICES_LIST}) string(REGEX REPLACE "^(.*):.*:.*$" "\\1" device ${file_devices_info}) string(REGEX REPLACE "^.*:(.*):.*$" "\\1" driver ${file_devices_info}) string(REGEX REPLACE "^.*:.*:(.*)$" "\\1" familied ${file_devices_info}) set(file_device_depends_${device} ${device_depends}) if(ENABLE_DYNDRIVERS) get_property(FILE_DEPENDS_${driver} GLOBAL PROPERTY FILE_DEPENDS_${driver}_dyndriver ) list(APPEND file_device_depends_${device} ${FILE_DEPENDS_${driver}} ${driver} ) endif(ENABLE_DYNDRIVERS) #message("DEBUG:file_device_depends_${device} = ${file_device_depends_${device}}") list_example_files(${CMAKE_CURRENT_BINARY_DIR} ${device} c output_list) add_custom_command( OUTPUT ${output_list} COMMAND ${CMAKE_COMMAND} -E echo "Generate C results for ${device} file device" COMMAND env ${custom_env} ${custom_test_command} --verbose --front-end=c --device=${device} ${plplot_test_debug} DEPENDS ${file_device_depends_${device}} VERBATIM ) add_custom_target(test_c_${device} DEPENDS ${output_list} ) list(APPEND noninteractive_targets_LIST test_c_${device}) # Follow what was done above. if(files_examples_c AND targets_examples_c) add_dependencies(test_c_${device} ${targets_examples_c}) endif(files_examples_c AND targets_examples_c) if(FILE_DEPENDS_${driver}) add_dependencies(test_c_${device} test_${driver}_dyndriver) endif(FILE_DEPENDS_${driver}) endforeach(file_devices_info ${FILE_DEVICES_LIST}) if(ENABLE_DYNDRIVERS) # These required for some of the following special targets that are # not handled by the foreach loop over interactive devices. Therefore, # this list of variables does not need to be complete over all # interactive devices. get_property(FILE_DEPENDS_cairo GLOBAL PROPERTY FILE_DEPENDS_cairo_dyndriver ) set(cairo_target ${FILE_DEPENDS_cairo} cairo) get_property(FILE_DEPENDS_gcw GLOBAL PROPERTY FILE_DEPENDS_gcw_dyndriver ) set(gcw_target ${FILE_DEPENDS_gcw} gcw) get_property(FILE_DEPENDS_qt GLOBAL PROPERTY FILE_DEPENDS_qt_dyndriver ) set(qt_target ${FILE_DEPENDS_qt} qt) get_property(FILE_DEPENDS_wxwidgets GLOBAL PROPERTY FILE_DEPENDS_wxwidgets_dyndriver ) set(wxwidgets_target ${FILE_DEPENDS_wxwidgets} wxwidgets) get_property(FILE_DEPENDS_xwin GLOBAL PROPERTY FILE_DEPENDS_xwin_dyndriver ) set(xwin_target ${FILE_DEPENDS_xwin} xwin) if(generic_interactive_device) get_property(FILE_DEPENDS_${generic_interactive_device} GLOBAL PROPERTY FILE_DEPENDS_${generic_interactive_device}_dyndriver ) set(${generic_interactive_device}_target ${FILE_DEPENDS_${generic_interactive_device}} ${generic_interactive_device}) endif(generic_interactive_device) endif(ENABLE_DYNDRIVERS) if(PLD_extcairo) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ext-cairo-test.ps COMMAND ext-cairo-test -drvopt set_background=1 DEPENDS ext-cairo-test ${cairo_target} ) add_custom_target(test_extcairo DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ext-cairo-test.ps ) if(FILE_DEPENDS_cairo) add_dependencies(test_extcairo test_cairo_dyndriver) endif(FILE_DEPENDS_cairo) list(APPEND noninteractive_targets_LIST test_extcairo) endif(PLD_extcairo) add_custom_target(test_noninteractive) if(noninteractive_targets_LIST) add_dependencies(test_noninteractive ${noninteractive_targets_LIST}) endif(noninteractive_targets_LIST) set(interactive_targets_LIST) # INTERACTIVE_DEVICES_LIST is set in # cmake/modules/drivers-finish.cmake for all enabled _interactive_ # devices and is thus available for the core build. It is also # configured in plplot_configure.cmake and is thus available # for the installed examples tests. Each list member consists of # a colon-separated device name and driver name. foreach(interactive_devices_info ${INTERACTIVE_DEVICES_LIST}) string(REGEX REPLACE "^(.*):.*$" "\\1" device ${interactive_devices_info}) string(REGEX REPLACE "^.*:(.*)$" "\\1" driver ${interactive_devices_info}) set(interactive_device_depends_${device}) # See explanation above about what to do with files_examples_c and # targets_examples_c. if(files_examples_c) list(APPEND interactive_device_depends_${device} ${files_examples_c}) else(files_examples_c) if(targets_examples_c) list(APPEND interactive_device_depends_${device} ${targets_examples_c}) endif(targets_examples_c) endif(files_examples_c) if(ENABLE_DYNDRIVERS) get_property(FILE_DEPENDS_${driver} GLOBAL PROPERTY FILE_DEPENDS_${driver}_dyndriver ) list(APPEND interactive_device_depends_${device} ${FILE_DEPENDS_${driver}} ${driver} ) if(device STREQUAL "tk") list(APPEND interactive_device_depends_${device} ${FILE_DEPENDS_xwin} xwin ) endif(device STREQUAL "tk") endif(ENABLE_DYNDRIVERS) add_custom_target(test_c_${device} COMMAND ${CMAKE_COMMAND} -E echo "Generate C results for ${device} interactive device" COMMAND env ${custom_env} ${custom_test_command} --verbose --interactive --device=${device} ${plplot_test_debug} DEPENDS ${interactive_device_depends_${device}} VERBATIM ) if(FILE_DEPENDS_${driver}) add_dependencies(test_c_${device} test_${driver}_dyndriver) endif(FILE_DEPENDS_${driver}) if(device STREQUAL "tk") if(CORE_BUILD) add_dependencies(test_c_tk tclIndex_tk tclIndex_tcl plserver) if(FILE_DEPENDS_xwin) add_dependencies(test_c_${device} test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) else(CORE_BUILD) add_dependencies(test_c_tk plserver) endif(CORE_BUILD) endif(device STREQUAL "tk") # Follow what was done above. if(files_examples_c AND targets_examples_c) add_dependencies(test_c_${device} ${targets_examples_c}) endif(files_examples_c AND targets_examples_c) list(APPEND interactive_targets_LIST test_c_${device}) if(ENABLE_octave) get_property(targets_examples_octave GLOBAL PROPERTY TARGETS_examples_octave) get_property(files_examples_octave GLOBAL PROPERTY FILES_examples_octave) add_custom_target(test_octave_${device} COMMAND ${CMAKE_COMMAND} -E echo "Generate interactive octave results for ${device} interactive device" COMMAND env ${custom_env} ${custom_test_command} --verbose --interactive_octave --device=${device} ${plplot_test_debug} DEPENDS ${interactive_device_depends_${device}} ${files_examples_octave} VERBATIM ) add_dependencies(test_octave_${device} ${targets_examples_octave}) if(FILE_DEPENDS_${driver}) add_dependencies(test_octave_${device} test_${driver}_dyndriver) endif(FILE_DEPENDS_${driver}) if(device STREQUAL "tk") if(CORE_BUILD) add_dependencies(test_octave_tk tclIndex_tk tclIndex_tcl plserver) if(FILE_DEPENDS_xwin) add_dependencies(test_octave_tk test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) else(CORE_BUILD) add_dependencies(test_octave_tk plserver) endif(CORE_BUILD) endif(device STREQUAL "tk") message(STATUS "WARNING: The test_octave_${device} target can be run independently but does not work reliably so it is temporarily excluded from being a dependency of other more general interactive test targets") #list(APPEND interactive_targets_LIST test_octave_${device}) endif(ENABLE_octave) endforeach(interactive_devices_info ${INTERACTIVE_DEVICES_LIST}) if(PLD_xcairo) add_custom_target(test_extXdrawable COMMAND extXdrawable_demo DEPENDS extXdrawable_demo ${cairo_target} ) if(FILE_DEPENDS_cairo) add_dependencies(test_extXdrawable test_cairo_dyndriver) endif(FILE_DEPENDS_cairo) list(APPEND interactive_targets_LIST test_extXdrawable) endif(PLD_xcairo) if(ENABLE_gnome2) add_custom_target(test_plplotcanvas COMMAND plplotcanvas_demo COMMAND plplotcanvas_animation DEPENDS plplotcanvas_demo plplotcanvas_animation ${gcw_target} ) if(FILE_DEPENDS_gcw) add_dependencies(test_plplotcanvas test_gcw_dyndriver) endif(FILE_DEPENDS_gcw) list(APPEND interactive_targets_LIST test_plplotcanvas) endif(ENABLE_gnome2) endif(ENABLE_c) if(ENABLE_cxx) if(ENABLE_wxwidgets) add_custom_target(test_wxPLplotDemo COMMAND wxPLplotDemo DEPENDS wxPLplotDemo ${wxwidgets_target} ) if(FILE_DEPENDS_wxwidgets) add_dependencies(test_wxPLplotDemo test_wxwidgets_dyndriver) endif(FILE_DEPENDS_wxwidgets) list(APPEND interactive_targets_LIST test_wxPLplotDemo) endif(ENABLE_wxwidgets) if(PLD_extqt) add_custom_target(test_qt_example COMMAND qt_example DEPENDS qt_example ${qt_target} ) if(FILE_DEPENDS_qt) add_dependencies(test_qt_example test_qt_dyndriver) endif(FILE_DEPENDS_qt) list(APPEND interactive_targets_LIST test_qt_example) endif(PLD_extqt) endif(ENABLE_cxx) if(ENABLE_pyqt4) if(CORE_BUILD) add_custom_target(test_pyqt4_example COMMAND ${CMAKE_CURRENT_BINARY_DIR}/python/pyqt4_example.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python ) add_dependencies(test_pyqt4_example plplot_pyqt4 python_examples _plplotcmodule qt ) if(FILE_DEPENDS_qt) add_dependencies(test_pyqt4_example test_qt_dyndriver) endif(FILE_DEPENDS_qt) else(CORE_BUILD) add_custom_target(test_pyqt4_example COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/python/pyqt4_example.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python ) add_dependencies(test_pyqt4_example plplot_pyqt4 _plplotcmodule qt ) endif(CORE_BUILD) list(APPEND interactive_targets_LIST test_pyqt4_example) endif(ENABLE_pyqt4) if(ENABLE_pygcw) if(CORE_BUILD) add_custom_target(test_pygcw COMMAND ${CMAKE_CURRENT_BINARY_DIR}/python/plplotcanvas_demo.py COMMAND ${CMAKE_CURRENT_BINARY_DIR}/python/plplotcanvas_animation.py DEPENDS gcwmodule cplplotcanvasmodule ${gcw_target} _plplotcmodule ${CMAKE_CURRENT_BINARY_DIR}/python/plplotcanvas_demo.py ${CMAKE_CURRENT_BINARY_DIR}/python/plplotcanvas_animation.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python ) add_dependencies(test_pygcw copy_plplotcanvas) if(FILE_DEPENDS_gcw) add_dependencies(test_pygcw test_gcw_dyndriver) endif(FILE_DEPENDS_gcw) else(CORE_BUILD) add_custom_target(test_pygcw COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/python/plplotcanvas_demo.py COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/python/plplotcanvas_animation.py DEPENDS gcwmodule cplplotcanvasmodule ${gcw_target} _plplotcmodule WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python ) endif(CORE_BUILD) list(APPEND interactive_targets_LIST test_pygcw) endif(ENABLE_pygcw) if(ENABLE_tcl AND PLD_${generic_interactive_device}) add_custom_target(test_pltcl_standard_examples COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tcl/pltcl_standard_examples -dev ${generic_interactive_device} -np DEPENDS ${${generic_interactive_device}_target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tcl ) add_dependencies(test_pltcl_standard_examples pltcl tcl_examples tclIndex_tcl ${generic_interactive_device} ) if(FILE_DEPENDS_${generic_interactive_device}) add_dependencies(test_pltcl_standard_examples test_${generic_interactive_device}_dyndriver) endif(FILE_DEPENDS_${generic_interactive_device}) list(APPEND interactive_targets_LIST test_pltcl_standard_examples) if(BUILD_SHARED_LIBS) # tests that use "package require Pltcl" only work if # BUILD_SHARED_LIBS is true. add_custom_target(test_tclsh_standard_examples COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tcl/tclsh_standard_examples DEPENDS ${${generic_interactive_device}_target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tcl ) add_dependencies(test_tclsh_standard_examples plplottcltk${LIB_TAG} tcl_examples tclIndex_tcl ${generic_interactive_device} ) if(FILE_DEPENDS_${generic_interactive_device}) add_dependencies(test_tclsh_standard_examples test_${generic_interactive_device}_dyndriver) endif(FILE_DEPENDS_${generic_interactive_device}) list(APPEND interactive_targets_LIST test_tclsh_standard_examples) endif(BUILD_SHARED_LIBS) endif(ENABLE_tcl AND PLD_${generic_interactive_device}) if(ENABLE_tkX AND PLD_tk) set(targets_examples_tk) add_custom_target(test_tk_01 COMMAND xtk01 -f ${CMAKE_CURRENT_BINARY_DIR}/tk/tk01 DEPENDS ${xwin_target} ) add_dependencies(test_tk_01 tclIndex_tcl tclIndex_tk xwin ) if(FILE_DEPENDS_xwin) add_dependencies(test_tk_01 test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) list(APPEND targets_examples_tk test_tk_01) add_custom_target(test_tk_03 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/tk03 DEPENDS ${xwin_target} ) add_dependencies(test_tk_03 plserver tclIndex_tcl tclIndex_tk xwin ) if(FILE_DEPENDS_xwin) add_dependencies(test_tk_03 test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) list(APPEND targets_examples_tk test_tk_03) if(CORE_BUILD) add_custom_target(test_tk_plgrid COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/plgrid DEPENDS ${xwin_target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tcl ) else(CORE_BUILD) add_custom_target(test_tk_plgrid COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/plgrid DEPENDS ${xwin_target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tcl ) endif(CORE_BUILD) add_dependencies(test_tk_plgrid plserver tcl_examples tclIndex_tcl tclIndex_tk xwin ) if(FILE_DEPENDS_xwin) add_dependencies(test_tk_plgrid test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) list(APPEND targets_examples_tk test_tk_plgrid) add_custom_target(test_plserver_standard_examples COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/plserver_standard_examples DEPENDS ${xwin_target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tk ) add_dependencies(test_plserver_standard_examples plserver tcl_examples tclIndex_tcl tclIndex_tk tclIndex_examples_tk xwin ) if(FILE_DEPENDS_xwin) add_dependencies(test_plserver_standard_examples test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) list(APPEND targets_examples_tk test_plserver_standard_examples) if(BUILD_SHARED_LIBS) # tests that use "package require Pltk" only work if # BUILD_SHARED_LIBS is true. add_custom_target(test_wish_standard_examples COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/wish_standard_examples WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tk ) add_dependencies(test_wish_standard_examples plplottcltk${LIB_TAG} tk xwin tcl_examples tclIndex_tcl tclIndex_tk tclIndex_examples_tk ) if(FILE_DEPENDS_xwin) add_dependencies(test_wish_standard_examples test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) # Temporarily suspend adding this target to the rest of the Tk # interactive targets (and therefore also this target is not added # to the overall list of targets run by the test_interactive # target) because of a segfault generated by this target. The # cause of that segfault is the Tcl exit command is somehow not # compatible with how we have implemented the Tcl plframe command # that is run by tkdemos.tcl in the wish case, but that is as much # as we know at this stage. message(STATUS "WARNING: The test_wish_standard_examples target can be run independently but it segfaults at the end so it is temporarily excluded from being a dependency of other more general interactive test targets") # list(APPEND targets_examples_tk test_wish_standard_examples) endif(BUILD_SHARED_LIBS) if(ENABLE_itkX) add_custom_target(test_tk_02 COMMAND xtk02 -f ${CMAKE_CURRENT_BINARY_DIR}/tk/tk02 DEPENDS ${xwin_target} ) add_dependencies(test_tk_02 tclIndex_tcl tclIndex_tk xwin ) if(FILE_DEPENDS_xwin) add_dependencies(test_tk_02 test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) if(USE_INCRTCL_VERSION_4) message(STATUS "WARNING: The test_tk_02 target can be run independently but it currently does not work for version 4 of Itcl and friends so it is temporarily excluded from being a dependency of other more general interactive test targets") else(USE_INCRTCL_VERSION_4) list(APPEND targets_examples_tk test_tk_02) endif(USE_INCRTCL_VERSION_4) add_custom_target(test_tk_04 COMMAND xtk04 -f ${CMAKE_CURRENT_BINARY_DIR}/tk/tk04 DEPENDS ${xwin_target} ) add_dependencies(test_tk_04 tclIndex_tcl tclIndex_tk xwin ) if(FILE_DEPENDS_xwin) add_dependencies(test_tk_04 test_xwin_dyndriver) endif(FILE_DEPENDS_xwin) if(USE_INCRTCL_VERSION_4) message(STATUS "WARNING: The test_tk_04 target can be run independently but it currently does not work for version 4 of Itcl and friends so it is temporarily excluded from being a dependency of other more general interactive test targets") else(USE_INCRTCL_VERSION_4) list(APPEND targets_examples_tk test_tk_04) endif(USE_INCRTCL_VERSION_4) add_custom_target(test_plserver_runAllDemos COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/plserver_runAllDemos WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tk ) add_dependencies(test_plserver_runAllDemos plserver tcl_examples tclIndex_tcl tclIndex_tk tclIndex_examples_tk xwin ) message(STATUS "WARNING: The test_plserver_runAlldemos target can be run independently but there are several issues with this target so it is temporarily excluded from being a dependency of other more general interactive test targets") #list(APPEND targets_examples_tk test_plserver_runAllDemos) if(BUILD_SHARED_LIBS) # tests that use "package require Plplotter" only work if # BUILD_SHARED_LIBS is true. add_custom_target(test_wish_runAllDemos COMMAND ${CMAKE_CURRENT_BINARY_DIR}/tk/wish_runAllDemos WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tk ) add_dependencies(test_wish_runAllDemos plplottcltk${LIB_TAG} tkwin tcl_examples tclIndex_tcl tclIndex_tk tclIndex_examples_tk ) message(STATUS "WARNING: The test_wish_runAlldemos target can be run independently but there are several issues with this target so it is temporarily excluded from being a dependency of other more general interactive test targets") # list(APPEND targets_examples_tk test_wish_runAlldemos) endif(BUILD_SHARED_LIBS) endif(ENABLE_itkX) endif(ENABLE_tkX AND PLD_tk) if(targets_examples_tk) list(APPEND interactive_targets_LIST ${targets_examples_tk}) endif(targets_examples_tk) add_custom_target(test_interactive) if(interactive_targets_LIST) add_dependencies(test_interactive ${interactive_targets_LIST}) endif(interactive_targets_LIST) # List of custom targets that test all of qt devices/special examples. # Must be maintained. set(qt_test_target_LIST test_c_bmpqt test_c_epsqt test_c_jpgqt test_c_pdfqt test_c_pngqt test_c_ppmqt test_c_qtwidget test_c_svgqt test_c_tiffqt #test_octave_qtwidget test_pyqt4_example test_qt_example ) set(qt_test_target_DEPENDS) foreach(qt_test_target ${qt_test_target_LIST}) if(TARGET ${qt_test_target}) list(APPEND qt_test_target_DEPENDS ${qt_test_target}) endif(TARGET ${qt_test_target}) endforeach(qt_test_target ${qt_test_target_LIST}) if(qt_test_target_DEPENDS) add_custom_target(test_all_qt) add_dependencies(test_all_qt ${qt_test_target_DEPENDS}) endif(qt_test_target_DEPENDS) # List of custom targets that test all of cairo devices/special examples. # Must be maintained. set(cairo_test_target_LIST test_c_pdfcairo test_c_pngcairo test_c_pscairo test_c_epscairo test_c_svgcairo test_extcairo test_c_xcairo test_extXdrawable ) set(cairo_test_target_DEPENDS) foreach(cairo_test_target ${cairo_test_target_LIST}) if(TARGET ${cairo_test_target}) list(APPEND cairo_test_target_DEPENDS ${cairo_test_target}) endif(TARGET ${cairo_test_target}) endforeach(cairo_test_target ${cairo_test_target_LIST}) if(cairo_test_target_DEPENDS) add_custom_target(test_all_cairo) add_dependencies(test_all_cairo ${cairo_test_target_DEPENDS}) endif(cairo_test_target_DEPENDS) endif(BUILD_TEST) if(NOT CORE_BUILD) set(summary_results " Summary of CMake build system results for the installed examples Noninteractive device drivers: PLD_pdfcairo: ${PLD_pdfcairo} PLD_pngcairo: ${PLD_pngcairo} PLD_pscairo: ${PLD_pscairo} PLD_epscairo: ${PLD_epscairo} PLD_svgcairo: ${PLD_svgcairo} PLD_cgm: ${PLD_cgm} PLD_dg300: ${PLD_dg300} PLD_epsqt: ${PLD_epsqt} PLD_pdfqt: ${PLD_pdfqt} PLD_bmpqt: ${PLD_bmpqt} PLD_jpgqt: ${PLD_jpgqt} PLD_pngqt: ${PLD_pngqt} PLD_ppmqt: ${PLD_ppmqt} PLD_tiffqt: ${PLD_tiffqt} PLD_svgqt: ${PLD_svgqt} PLD_gif: ${PLD_gif} PLD_jpeg: ${PLD_jpeg} PLD_png: ${PLD_png} PLD_hp7470: ${PLD_hp7470} PLD_hp7580: ${PLD_hp7580} PLD_lj_hpgl: ${PLD_lj_hpgl} PLD_imp: ${PLD_imp} PLD_ljii: ${PLD_ljii} PLD_ljiip: ${PLD_ljiip} PLD_pbm: ${PLD_pbm} PLD_pdf: ${PLD_pdf} PLD_ps: ${PLD_ps} PLD_psc: ${PLD_psc} PLD_pstex: ${PLD_pstex} PLD_psttf: ${PLD_psttf} PLD_psttfc: ${PLD_psttfc} PLD_svg: ${PLD_svg} PLD_tek4010f: ${PLD_tek4010f} PLD_tek4107f: ${PLD_tek4107f} PLD_wxpng: ${PLD_wxpng} PLD_xfig: ${PLD_xfig} Interactive device drivers: PLD_xcairo: ${PLD_xcairo} PLD_extcairo: ${PLD_extcairo} N.B. The above devices are all that are currently configurable by the installed examples build system. Additional interactive device drivers are likely supplied by the PLplot core and configured as part of plplot-test-interactive.sh that is run by make test_interactive but the build system for the installed examples cannot configure anything with those device drivers so we don't bother to retreive them from the core build system or output them here. Noninteractive bindings: ENABLE_ada: ${ENABLE_ada} ENABLE_c: ${ENABLE_c} ENABLE_cxx: ${ENABLE_cxx} ENABLE_d: ${ENABLE_d} ENABLE_f95: ${ENABLE_f95} ENABLE_java: ${ENABLE_java} ENABLE_lua: ${ENABLE_lua} ENABLE_ocaml: ${ENABLE_ocaml} ENABLE_octave: ${ENABLE_octave} ENABLE_pdl: ${ENABLE_pdl} ENABLE_python: ${ENABLE_python} ENABLE_tcl: ${ENABLE_tcl} Interactive bindings: ENABLE_qt: ${ENABLE_qt} ENABLE_tk: ${ENABLE_tk} ENABLE_gnome2: ${ENABLE_gnome2} ENABLE_wxwidgets: ${ENABLE_wxwidgets} ") message("${summary_results}") endif(NOT CORE_BUILD) plplot-5.10.0+dfsg/examples/Makefile.examples.in 644 1750 1750 2645712276771565 205100ustar andrewandrew# examples/Makefile.examples.in for PLplot # configured by our CMake-based build system to examples/Makefile.examples # in the build tree and installed as examples/Makefile in the install tree. # Copyright (C) 2004, 2008 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This Makefile should not be used in the build tree. It is meant for use # only in the install tree. It is first configured, then installed # (with the name Makefile) in the _installed_ examples directory # It combines building all the examples that need to be built along # with testing all examples. all: c/x01c@EXEEXT@ c/x01c@EXEEXT@: cd c; $(MAKE) c_clean: cd c; $(MAKE) clean .PHONY: c_clean clean: c_clean x01c.psc: c/x01c@EXEEXT@ @echo Generate C results for psc device ./plplot-test.sh --verbose --front-end=c --device=psc test_noninteractive: x01c.psc @COMPARE_COMMENT@compare: x01c.psc # Just for c, c++, and tk directories test_interactive: c/x01c@EXEEXT@ @PSC_ADA_COMMENT@all: ada/x01a@EXEEXT@ @PSC_ADA_COMMENT@ada/x01a@EXEEXT@: @PSC_ADA_COMMENT@ cd ada; $(MAKE) @PSC_ADA_COMMENT@ada_clean: @PSC_ADA_COMMENT@ cd ada; $(MAKE) clean @PSC_ADA_COMMENT@.PHONY: ada_clean @PSC_ADA_COMMENT@clean: ada_clean @PSC_ADA_COMMENT@x01a.psc: ada/x01a@EXEEXT@ @PSC_ADA_COMMENT@ @echo Generate Ada results for psc device @PSC_ADA_COMMENT@ ./plplot-test.sh --verbose --front-end=ada --device=psc @PSC_ADA_COMMENT@test_noninteractive: x01a.psc @PSC_ADA_COMMENT@@COMPARE_COMMENT@compare: x01a.psc @CXX_COMMENT@all: c++/x01@EXEEXT@ @CXX_COMMENT@c++/x01@EXEEXT@: @CXX_COMMENT@ cd c++; $(MAKE) @CXX_COMMENT@cxx_clean: @CXX_COMMENT@ cd c++; $(MAKE) clean @CXX_COMMENT@.PHONY: cxx_clean @CXX_COMMENT@clean: cxx_clean @CXX_COMMENT@x01cxx.psc: c++/x01@EXEEXT@ @CXX_COMMENT@ @echo Generate C++ results for psc device @CXX_COMMENT@ ./plplot-test.sh --verbose --front-end=cxx --device=psc @CXX_COMMENT@test_noninteractive: x01cxx.psc @CXX_COMMENT@@COMPARE_COMMENT@compare: x01cxx.psc # Just for c, c++, and tk directories @CXX_COMMENT@test_interactive: c++/x01@EXEEXT@ @PSC_D_COMMENT@all: d/x01d@EXEEXT@ @PSC_D_COMMENT@d/x01d@EXEEXT@: @PSC_D_COMMENT@ cd d; $(MAKE) @PSC_D_COMMENT@d_clean: @PSC_D_COMMENT@ cd d; $(MAKE) clean @PSC_D_COMMENT@.PHONY: d_clean @PSC_D_COMMENT@clean: d_clean @PSC_D_COMMENT@x01d.psc: d/x01d@EXEEXT@ @PSC_D_COMMENT@ @echo Generate d results for psc device @PSC_D_COMMENT@ ./plplot-test.sh --verbose --front-end=d --device=psc @PSC_D_COMMENT@test_noninteractive: x01d.psc @PSC_D_COMMENT@@COMPARE_COMMENT@compare: x01d.psc @PSC_F95_COMMENT@all: f95/x01f@EXEEXT@ @PSC_F95_COMMENT@f95/x01f@EXEEXT@: @PSC_F95_COMMENT@ cd f95; $(MAKE) @PSC_F95_COMMENT@f95_clean: @PSC_F95_COMMENT@ cd f95; $(MAKE) clean @PSC_F95_COMMENT@.PHONY: f95_clean @PSC_F95_COMMENT@clean: f95_clean @PSC_F95_COMMENT@x01f95.psc: f95/x01f@EXEEXT@ @PSC_F95_COMMENT@ @echo Generate Fortran 95 results for psc device @PSC_F95_COMMENT@ ./plplot-test.sh --verbose --front-end=f95 --device=psc @PSC_F95_COMMENT@test_noninteractive: x01f95.psc @PSC_F95_COMMENT@@COMPARE_COMMENT@compare: x01f95.psc @PSC_JAVA_COMMENT@all: java/x01.class @PSC_JAVA_COMMENT@java/x01.class: @PSC_JAVA_COMMENT@ cd java; $(MAKE) @PSC_JAVA_COMMENT@java_clean: @PSC_JAVA_COMMENT@ cd java; $(MAKE) clean @PSC_JAVA_COMMENT@.PHONY: java_clean @PSC_JAVA_COMMENT@clean: java_clean @PSC_JAVA_COMMENT@x01j.psc: java/x01.class @PSC_JAVA_COMMENT@ @echo Generate Java results for psc device @PSC_JAVA_COMMENT@ ./plplot-test.sh --verbose --front-end=java --device=psc @PSC_JAVA_COMMENT@test_noninteractive: x01j.psc @PSC_JAVA_COMMENT@@COMPARE_COMMENT@compare: x01j.psc @PSC_OCAML_COMMENT@all: ocaml/x01ocaml@EXEEXT@ @PSC_OCAML_COMMENT@ocaml/x01ocaml@EXEEXT@: @PSC_OCAML_COMMENT@ cd ocaml; $(MAKE) @PSC_OCAML_COMMENT@ocaml_clean: @PSC_OCAML_COMMENT@ cd ocaml; $(MAKE) clean @PSC_OCAML_COMMENT@.PHONY: ocaml_clean @PSC_OCAML_COMMENT@clean: ocaml_clean @PSC_OCAML_COMMENT@x01ocaml.psc: ocaml/x01ocaml@EXEEXT@ @PSC_OCAML_COMMENT@ @echo Generate OCaml results for psc device @PSC_OCAML_COMMENT@ ./plplot-test.sh --verbose --front-end=ocaml --device=psc @PSC_OCAML_COMMENT@test_noninteractive: x01ocaml.psc @PSC_OCAML_COMMENT@@COMPARE_COMMENT@compare: x01ocaml.psc @PSC_OCTAVE_COMMENT@x01o.psc: octave/x01c.m @PSC_OCTAVE_COMMENT@ @echo Generate Octave results for psc device @PSC_OCTAVE_COMMENT@ ./plplot-test.sh --verbose --front-end=octave --device=psc @PSC_OCTAVE_COMMENT@test_noninteractive: x01o.psc @PSC_OCTAVE_COMMENT@@COMPARE_COMMENT@compare: x01o.psc @PSC_PERL_COMMENT@x01pdl.psc: perl/x01.pl @PSC_PERL_COMMENT@ @echo Generate Perl/PDL results for psc device @PSC_PERL_COMMENT@ ./plplot-test.sh --verbose --front-end=pdl --device=psc @PSC_PERL_COMMENT@test_noninteractive: x01pdl.psc @PSC_PERL_COMMENT@@COMPARE_COMMENT@compare: x01pdl.psc @PSC_PYTHON_COMMENT@x01p.psc: python/x01 @PSC_PYTHON_COMMENT@ @echo Generate Python results for psc device @PSC_PYTHON_COMMENT@ ./plplot-test.sh --verbose --front-end=python --device=psc @PSC_PYTHON_COMMENT@test_noninteractive: x01p.psc @PSC_PYTHON_COMMENT@@COMPARE_COMMENT@compare: x01p.psc @PSC_TCL_COMMENT@x01t.psc: tcl/x01 @PSC_TCL_COMMENT@ @echo Generate Tcl results for psc device @PSC_TCL_COMMENT@ ./plplot-test.sh --verbose --front-end=tcl --device=psc @PSC_TCL_COMMENT@test_noninteractive: x01t.psc @PSC_TCL_COMMENT@@COMPARE_COMMENT@compare: x01t.psc @PSC_LUA_COMMENT@x01lua.psc: lua/x01.lua @PSC_LUA_COMMENT@ @echo Generate Lua results for psc device @PSC_LUA_COMMENT@ ./plplot-test.sh --verbose --front-end=lua --device=psc @PSC_LUA_COMMENT@test_noninteractive: x01lua.psc @PSC_LUA_COMMENT@@COMPARE_COMMENT@compare: x01lua.psc @PDFCAIRO_COMMENT@x01c.pdfcairo: c/x01c@EXEEXT@ @PDFCAIRO_COMMENT@ @echo Generate C results for pdfcairo device @PDFCAIRO_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=pdfcairo @PDFCAIRO_COMMENT@test_noninteractive: x01c.pdfcairo @PNGCAIRO_COMMENT@x01c01.pngcairo: c/x01c@EXEEXT@ @PNGCAIRO_COMMENT@ @echo Generate C results for pngcairo device @PNGCAIRO_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=pngcairo @PNGCAIRO_COMMENT@test_noninteractive: x01c01.pngcairo @PSCAIRO_COMMENT@x01c.pscairo: c/x01c@EXEEXT@ @PSCAIRO_COMMENT@ @echo Generate C results for pscairo device @PSCAIRO_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=pscairo @PSCAIRO_COMMENT@test_noninteractive: x01c.pscairo @SVGCAIRO_COMMENT@x01c01.svgcairo: c/x01c@EXEEXT@ @SVGCAIRO_COMMENT@ @echo Generate C results for svgcairo device @SVGCAIRO_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=svgcairo @SVGCAIRO_COMMENT@test_noninteractive: x01c01.svgcairo @GIF_COMMENT@x01c01.gif : c/x01c@EXEEXT@ @GIF_COMMENT@ @echo Generate C results for gif device @GIF_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=gif @GIF_COMMENT@test_noninteractive: x01c01.gif @JPEG_COMMENT@x01c01.jpeg: c/x01c@EXEEXT@ @JPEG_COMMENT@ @echo Generate C results for jpeg device @JPEG_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=jpeg @JPEG_COMMENT@test_noninteractive: x01c01.jpeg @PNG_COMMENT@x01c01.png: c/x01c@EXEEXT@ @PNG_COMMENT@ @echo Generate C results for png device @PNG_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=png @PNG_COMMENT@test_noninteractive: x01c01.png @PSTTFC_COMMENT@x01c.psttfc: c/x01c@EXEEXT@ @PSTTFC_COMMENT@ @echo Generate C results for psttfc device @PSTTFC_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=psttfc @PSTTFC_COMMENT@test_noninteractive: x01c.psttfc @SVG_COMMENT@x01c01.svg: c/x01c@EXEEXT@ @SVG_COMMENT@ @echo Generate C results for svg device @SVG_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=svg @SVG_COMMENT@test_noninteractive: x01c01.svg @XFIG_COMMENT@x01c01.xfig: c/x01c@EXEEXT@ @XFIG_COMMENT@ @echo Generate C results for xfig device @XFIG_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=xfig @XFIG_COMMENT@test_noninteractive: x01c01.xfig @PSTEX_COMMENT@x01c.pstex: c/x01c@EXEEXT@ @PSTEX_COMMENT@ @echo Generate C results for pstex device @PSTEX_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=pstex @PSTEX_COMMENT@test_noninteractive: x01c.pstex @CGM_COMMENT@x01c.cgm : c/x01c@EXEEXT@ @CGM_COMMENT@ @echo Generate C results for cgm device @CGM_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=cgm @CGM_COMMENT@test_noninteractive: x01c.cgm @BMPQT_COMMENT@x01c01.bmpqt : c/x01c@EXEEXT@ @BMPQT_COMMENT@ @echo Generate C results for bmpqt device @BMPQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=bmpqt @BMPQT_COMMENT@test_noninteractive: x01c01.bmpqt @JPGQT_COMMENT@x01c01.jpgqt : c/x01c@EXEEXT@ @JPGQT_COMMENT@ @echo Generate C results for jpgqt device @JPGQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=jpgqt @JPGQT_COMMENT@test_noninteractive: x01c01.jpgqt @PNGQT_COMMENT@x01c01.pngqt : c/x01c@EXEEXT@ @PNGQT_COMMENT@ @echo Generate C results for pngqt device @PNGQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=pngqt @PNGQT_COMMENT@test_noninteractive: x01c01.pngqt @PPMQT_COMMENT@x01c01.ppmqt : c/x01c@EXEEXT@ @PPMQT_COMMENT@ @echo Generate C results for ppmqt device @PPMQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=ppmqt @PPMQT_COMMENT@test_noninteractive: x01c01.ppmqt @TIFFQT_COMMENT@x01c01.tiffqt : c/x01c@EXEEXT@ @TIFFQT_COMMENT@ @echo Generate C results for tiffqt device @TIFFQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=tiffqt @TIFFQT_COMMENT@test_noninteractive: x01c01.tiffqt @SVGQT_COMMENT@x01c01.svgqt : c/x01c@EXEEXT@ @SVGQT_COMMENT@ @echo Generate C results for svgqt device @SVGQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=svgqt @SVGQT_COMMENT@test_noninteractive: x01c01.svgqt @EPSQT_COMMENT@x01c01.epsqt : c/x01c@EXEEXT@ @EPSQT_COMMENT@ @echo Generate C results for epsqt device @EPSQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=epsqt @EPSQT_COMMENT@test_noninteractive: x01c01.epsqt @PDFQT_COMMENT@x01c01.pdfqt : c/x01c@EXEEXT@ @PDFQT_COMMENT@ @echo Generate C results for pdfqt device @PDFQT_COMMENT@ ./plplot-test.sh --verbose --front-end=c --device=pdfqt @PDFQT_COMMENT@test_noninteractive: x01c01.pdfqt @COMPARE_COMMENT@compare: @COMPARE_COMMENT@ @echo Compare non-C language psc and stdout results with corresponding C results @COMPARE_COMMENT@ -./test_diff.sh @COMPARE_COMMENT@ touch compare @COMPARE_COMMENT@test_noninteractive: compare @TK_COMMENT@all: tk/xtk01$(EXEEXT) @TK_COMMENT@tk/xtk01$(EXEEXT): @TK_COMMENT@ cd tk; $(MAKE) @TK_COMMENT@tk_clean: @TK_COMMENT@ cd tk; $(MAKE) clean @TK_COMMENT@.PHONY: tk_clean @TK_COMMENT@clean: tk_clean @TK_COMMENT@test_interactive: tk/xtk01$(EXEEXT) test_interactive: ./plplot-test-interactive.sh test_clean: rm -f *.psc *.pdfcairo *.pngcairo *.pscairo *.svgcairo \ *.gif *.jpeg *.png *.psttfc *.svg *.xfig *.pstex* *.*qt *.cgm \ *_*.txt test.error \ compare clean: test_clean .PHONY : all clean test_noninteractive test_clean test_interactive plplot-5.10.0+dfsg/examples/octave/ 775 1750 1750 012406243570 157545ustar andrewandrewplplot-5.10.0+dfsg/examples/octave/x18c.m 644 1750 1750 660711511024332 167710ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. 1; global alt = [20.0, 35.0, 50.0, 65.0]; global az = [30.0, 40.0, 50.0, 60.0]; ## Does a series of 3-d plots for a given data set, with different ## viewing options in each plot. function ix18c global alt; global az; global opt = [ 1, 0, 1, 0 ]; NPTS = 1000; ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); for k=0:3 test_poly(k); endfor ## From the mind of a sick and twisted physicist... */ for i = 0:NPTS-1 z(i+1) = -1. + 2. * i / NPTS; ## Pick one ... */ # r = 1. - ( (float) i / (float) NPTS ); */ r = z(i+1); x(i+1) = r * cos( 2. * pi * 6. * i / NPTS ); y(i+1) = r * sin( 2. * pi * 6. * i / NPTS ); endfor for k = 0:3 pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -0.9, 1.1); plcol0(1); plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt(k+1), az(k+1)); plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); plcol0(2); if (opt(k+1)) plline3( x', y', z' ); else ## U+22C5 DOT OPERATOR. plstring3( x', y', z', "⋅" ); endif plcol0(3); title=sprintf("#frPLplot Example 18 - Alt=%.0f, Az=%.0f", alt(k+1), az(k+1)); plmtex("t", 1.0, 0.5, 0.5, title); endfor plend1(); endfunction function y = THETA(a) y = 2 * pi * (a) /20.; endfunction function y= PHI(a) y = pi * (a) / 20.1; endfunction function test_poly(k) global alt; global az; draw = [ 1, 1, 1, 1; 1, 0, 1, 0; 0, 1, 0, 1; 1, 1, 0, 0]; two_pi = 2. * pi; pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -0.9, 1.1); plcol0(1); plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt(k+1), az(k+1)); plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); plcol0(2); for i=0:19 for j=0:19 pj=pi*j/20.1; pj1=pi*(j+1)/20.1; ti=2*pi*i/20; ti1=2*pi*(i+1)/20; x(1) = sin( pj ) * cos( ti ); y(1) = sin( pj ) * sin( ti ); z(1) = cos( pj ); x(2) = sin( pj1 ) * cos( ti ); y(2) = sin( pj1 ) * sin( ti ); z(2) = cos( pj1 ); x(3) = sin( pj1 ) * cos( ti1 ); y(3) = sin( pj1 ) * sin( ti1 ); z(3) = cos( pj1 ); x(4) = sin( pj ) * cos( ti1 ); y(4) = sin( pj ) * sin( ti1 ); z(4) = cos( pj ); x(5) = sin( pj ) * cos( ti ); y(5) = sin( pj ) * sin( ti ); z(5) = cos( pj ); plpoly3(x', y', z', draw(k+1,:)', -1); ## added an extra argument, with the sign endfor endfor plcol0(3); plmtex("t", 1.0, 0.5, 0.5, "unit radius sphere" ); endfunction ix18c plplot-5.10.0+dfsg/examples/octave/x25c.m 644 1750 1750 326411307271361 167740ustar andrewandrew## $Id: x25c.m 10700 2009-12-07 21:26:09Z andrewross $ ## ## Bar chart demo. ## ##-------------------------------------------------------------------------- ## main ## ## Test program for filling polygons and proper clipping ##-------------------------------------------------------------------------- 1; function ix25c npts = 0; ## Parse and process command line arguments ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plssub(3,3); plinit; xextreme = [-120,120;-120,120;-120,120;-80,80;-220,-120;-20,20;-20,20;-80,80;20,120]; yextreme = [-120,120;20,120;-20,120;-20,120;-120,120;-120,120;-20,20;-80,80;-120,120]; for k=0:1 for j=0:3 if ( j == 0 ) ## Polygon 1: a diamond x0 = [0;-100;0;100]; y0 = [-100;0;100;0]; npts = 4 ; endif if ( j == 1 ) ## Polygon 1: a diamond - reverse direction x0 = [100;0;-100;0]; y0 = [0;100;0;-100]; npts = 4 ; endif if ( j == 2 ) ## Polygon 2: a square with punctures x0 = [-100;-100;80;-100;-100;-80;0;80;100;100]; y0 = [-100;-80;0;80;100;100;80;100;100;-100]; npts = 10 ; endif if ( j == 3 ) ## Polygon 2: a square with punctures - reversed direction x0 = [100;100;80;0;-80;-100;-100;80;-100;-100]; y0 = [-100;100;100;80;100;100;80;0;-80;-100]; npts = 10 ; endif for i = 1:9 pladv(0); plvsta; plwind(xextreme(i,1), xextreme(i,2), yextreme(i,1), yextreme(i,2)); plcol0(2) ; plbox("bc", 1.0, 0, "bcnv", 10.0, 0); plcol0(1) ; plpsty(0) ; if (k == 0) plfill(x0,y0) ; else plgradient(x0,y0,45.) ; endif plcol0(2) ; pllsty(1) ; plline(x0,y0) ; endfor endfor endfor ## Don't forget to call plend() to finish off! plend1; end ix25c plplot-5.10.0+dfsg/examples/octave/x29c.m 644 1750 1750 2042211543675237 170270ustar andrewandrew## $Id: x29c.m 11680 2011-03-27 17:57:51Z airwin $ ## ## Sample plots using date / time formatting for axes ## ## Copyright (C) 2007, 2008 Andrew Ross ## ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 1; ## function ix29c ## Parse command line arguments */ ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit(); plsesc('@'); plot1(); plot2(); plot3(); plot4(); ## Clean up plend1(); endfunction ## Plot a model diurnal cycle of temperature function plot1 ## Data points every 10 minutes for 1 day npts = 73; xmin = 0; xmax = 60.0*60.0*24.0; ## Number of seconds in a day ymin = 10.0; ymax = 20.0; i = 0:npts-1; x = i*xmax/npts; y = 15.0 - 5.0*cos( 2*pi*i/npts); xerr1 = x-60.0*5.0; xerr2 = x+60.0*5.0; yerr1 = y-0.1; yerr2 = y+0.1; pladv(0); ## Rescale major ticks marks by 0.5 plsmaj(0.0,0.5); ## Rescale minor ticks and error bar marks by 0.5 plsmin(0.0,0.5); plvsta(); plwind(xmin, xmax, ymin, ymax); ## Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. plcol0(1); ## Set time format to be hours:minutes pltimefmt("%H:%M"); plbox("bcnstd", 3.0*60*60, 3, "bcnstv", 1, 5); plcol0(3); pllab("Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature"); plcol0(4); plline(x', y'); plcol0(2); plerrx(xerr1', xerr2', y'); plcol0(3); plerry(x', yerr1', yerr2'); ## Rescale major / minor tick marks back to default plsmin(0.0,1.0); plsmaj(0.0,1.0); endfunction ## Plot the number of hours of daylight as a function of day for a year function plot2 ## Latitude for London lat = 51.5; npts = 365; xmin = 0; xmax = npts*60.0*60.0*24.0; ymin = 0; ymax = 24; ## Formula for hours of daylight from ## "A Model Comparison for Daylength as a Function of Latitude and ## Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. i = 0:npts-1; x = i*60.0*60.0*24.0; p = asin(0.39795*cos(0.2163108 + 2*atan(0.9671396*tan(0.00860*(i-186))))); d = 24.0 - (24.0/pi)*acos( (sin(0.8333*pi/180.0) + \ sin(lat*pi/180.0)*sin(p)) \ ./(cos(lat*pi/180.0)*cos(p)) ); y = d; plcol0(1); ## Set time format to be abbreviated month name followed by day of month pltimefmt("%b %d"); plprec(1,1); plenv(xmin, xmax, ymin, ymax, 0, 40); plcol0(3); pllab("Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N"); plcol0(4); plline(x', y'); plprec(0,0); endfunction function plot3 ## Calculate seconds since the Unix epoch for 2005-12-01 UTC. tm.year = 105; ## Years since 1900 tm.mon = 11; ## 0 == January, 11 = December tm.mday = 1; ## 1 = 1st of month tm.hour = 0; tm.min = 0; tm.sec = 0; ## NB - no need to call tzset in octave - it doesn't exist. tz = getenv("TZ"); putenv("TZ",""); ## tstart is a time_t value (cast to PLFLT) which represents the number ## of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated ## Universal Time (UTC). tstart = mktime(tm); ## Note currently octave appears to have no way to unset a env ## variable. putenv("TZ",tz); npts = 62; xmin = tstart; xmax = xmin + npts*60.0*60.0*24.0; ymin = 0.0; ymax = 5.0; i = 0:npts-1; x = xmin + i*60.0*60.0*24.0; y = 1.0 + sin( 2*pi*i / 7.0 ) + exp( min(i,npts-i) / 31.0); pladv(0); plvsta(); plwind(xmin, xmax, ymin, ymax); plcol0(1); ## Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is ## equivalent to %f for C99 compliant implementations of strftime. pltimefmt("%Y-%m-%d"); ## Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox("bcnstd", 14*24.0*60.0*60.0,14, "bcnstv", 1, 4); plcol0(3); pllab("Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"); plcol0(4); ## Rescale symbol size (used by plpoin) by 0.5 plssym(0.0,0.5); plpoin(x', y', 2); plline(x', y'); endfunction function plot4 ## TAI-UTC (seconds) as a function of time. ## Use Besselian epochs as the continuous time interval just to prove ## this does not introduce any issues. ## Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch ## B = 1900. + (JD -2415020.31352)/365.242198781 ## ==> (as calculated with aid of "bc -l" command) ## B = (MJD + 678940.364163900)/365.242198781 ## ==> ## MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781; offset1 = -678940.; offset2 = -0.3641639; plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); for kind=0:6 if (kind == 0) xmin = plctime(1950,0,2,0,0,0.); xmax = plctime(2020,0,2,0,0,0.); npts = 70*12 + 1; ymin = 0.0; ymax = 36.0; time_format = "%Y%"; if_TAI_time_format = 1; title_suffix = "from 1950 to 2020"; xtitle = "Year"; xlabel_step = 10.; elseif (kind == 1 || kind ==2) xmin = plctime(1961,7,1,0,0,1.64757-.20); xmax = plctime(1961,7,1,0,0,1.64757+.20); npts = 1001; ymin = 1.625; ymax = 1.725; time_format = "%S%2%"; title_suffix = "near 1961-08-01 (TAI)"; xlabel_step = 0.05/(scale*86400.); if (kind == 1) if_TAI_time_format = 1; xtitle = "Seconds (TAI)"; else if_TAI_time_format = 0; xtitle = "Seconds (TAI) labelled with corresponding UTC"; endif elseif (kind == 3 || kind ==4) xmin = plctime(1963,10,1,0,0,2.6972788-.20); xmax = plctime(1963,10,1,0,0,2.6972788+.20); npts = 1001; ymin = 2.55; ymax = 2.75; time_format = "%S%2%"; title_suffix = "near 1963-11-01 (TAI)"; xlabel_step = 0.05/(scale*86400.); if (kind == 3) if_TAI_time_format = 1; xtitle = "Seconds (TAI)"; else if_TAI_time_format = 0; xtitle = "Seconds (TAI) labelled with corresponding UTC"; endif elseif (kind == 5 || kind == 6) xmin = plctime(2009,0,1,0,0,34.-5.); xmax = plctime(2009,0,1,0,0,34.+5.); npts = 1001; ymin = 32.5; ymax = 34.5; time_format = "%S%2%"; title_suffix = "near 2009-01-01 (TAI)"; xlabel_step = 1./(scale*86400.); if (kind == 5) if_TAI_time_format = 1; xtitle = "Seconds (TAI)"; else if_TAI_time_format = 0; xtitle = "Seconds (TAI) labelled with corresponding UTC"; endif endif x = xmin + (0:npts-1)*(xmax-xmin)/(npts-1); plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); tai = x; for i=1:npts [tai_year(i) , tai_month(i), tai_day(i), tai_hour(i), tai_min(i), tai_sec(i)] = plbtime(tai(i)); endfor plconfigtime(scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0.); for i=1:npts [utc_year(i), utc_month(i), utc_day(i), utc_hour(i), utc_min(i), utc_sec(i)] = plbtime(tai(i)); endfor plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); for i=1:npts utc(i) = plctime(utc_year(i), utc_month(i), utc_day(i), utc_hour(i), utc_min(i), utc_sec(i)); endfor y = (tai-utc)*scale*86400.0; pladv(0); plvsta(); plwind(xmin, xmax, ymin, ymax); plcol0(1); if (if_TAI_time_format) plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); else plconfigtime(scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0.); endif pltimefmt(time_format); plbox("bcnstd", xlabel_step, 0, "bcnstv", 0., 0); plcol0(3); title = ["@frPLplot Example 29 - TAI-UTC ", title_suffix]; pllab(xtitle, "TAI-UTC (sec)", title); plcol0(4); plline(x', y'); endfor endfunction ix29c plplot-5.10.0+dfsg/examples/octave/x30c.m 644 1750 1750 727411543675237 170110ustar andrewandrew## $Id: x30c.m 11680 2011-03-27 17:57:51Z airwin $ ## ## Alpha color values demonstration. ## ## Copyright (C) 2008 Hazen Babcock ## Copyright (C) 2008 Andrew Ross ## ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 1; ## function ix30c red = [ 0, 255, 0, 0]; green = [ 0, 0, 255, 0]; blue = [ 0, 0, 0, 255]; alpha = [1.0, 1.0, 1.0, 1.0]; px = [0.1, 0.5, 0.5, 0.1]; py = [0.1, 0.1, 0.5, 0.5]; pos = [0.0, 1.0]; rcoord = [1.0, 1.0]; gcoord = [0.0, 0.0]; bcoord = [0.0, 0.0]; acoord = [0.0, 1.0]; rev = [0, 0]; ## plparseopts (&argc, argv, PL_PARSE_FULL); plinit (); plscmap0n (4); plscmap0a (red', green', blue', alpha'); ## ## Page 1: ## ## This is a series of red, green and blue rectangles overlaid ## on each other with gradually increasing transparency. ## ## Set up the window pladv (0); plvpor (0.0, 1.0, 0.0, 1.0); plwind (0.0, 1.0, 0.0, 1.0); plcol0 (0); plbox ("", 1.0, 0, "", 1.0, 0); ## Draw the boxes for i=0:8 icol = mod(i,3) + 1; ## Get a color, change its transparency and ## set it as the current color. [r,g,b,a] = plgcol0a (icol); plscol0a (icol, r, g, b, 1.0 - i/9.0); plcol0 (icol); ## Draw the rectangle plfill (px', py'); ## Shift the rectangles coordinates px += 0.5/9.0; py += 0.5/9.0; endfor ## ## Page 2: ## ## This is a bunch of boxes colored red, green or blue with a single ## large (red) box of linearly varying transparency overlaid. The ## overlaid box is completely transparent at the bottom and completely ## opaque at the top. ## ## Set up the window pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.0); ## Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for i = 0:4 ## Set box X position px(1) = 0.05 + 0.2 * i; px(2) = px(1) + 0.1; px(3) = px(2); px(4) = px(1); ## We don't want the boxes to be transparent, so since we changed ## the colors transparencies in the first example we have to change ## the transparencies back to completely opaque. icol = mod(i,3) + 1; [r,g,b,a] = plgcol0a (icol); plscol0a (icol, r, g, b, 1.0); plcol0 (icol); for j=0:4 ## Set box y position and draw the box. py(1) = 0.05 + 0.2 * j; py(2) = py(1); py(3) = py(1) + 0.1; py(4) = py(3); plfill(px', py'); endfor endfor ## The overlaid box is drawn using plshades with a color map that is ## the same color but has a linearly varying transparency. ## Create the color map with 128 colors and use plscmap1la to initialize ## the color values with a linear varying transparency (or alpha) plscmap1n(128); plscmap1la(1, pos', rcoord', gcoord', bcoord', acoord', rev'); ## Use that cmap1 to create a transparent red gradient for the whole ## window. px(1) = 0.; px(2) = 1.; px(3) = 1.; px(4) = 0.; py(1) = 0.; py(2) = 0.; py(3) = 1.; py(4) = 1.; plgradient( px', py', 90. ); plend1(); endfunction ix30c; plplot-5.10.0+dfsg/examples/octave/p20.m 644 1750 1750 202611366136213 166100ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p20 plclearplot; multiplot(4,4) subwindow(1, 1) p1 subwindow(3 ,4) p2 subwindow(1 ,4) p3 subwindow(3 ,1) p4 subwindow(2 ,4) p5 subwindow(2 ,1) p6 subwindow(2 ,3) p7 subwindow(2 ,2) p8 subwindow(3 ,3) p9 subwindow(3 ,2) p11 subwindow(1 ,3) p13 subwindow(4 ,1) p10 subwindow(4 ,2) p15 subwindow(4 ,3) p14(1) subwindow(1 ,2) p12(1) subwindow(4, 4) p17(1) oneplot; endfunction plplot-5.10.0+dfsg/examples/octave/p4.m 644 1750 1750 151211244733610 165300ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p4 global pl_automatic_replot; t = pl_automatic_replot; pl_automatic_replot = 0; x=0.01:0.1:10; y=exp(x); og = grid ("minor"); title("Log-log example"); loglog(x,y,'y') grid (og); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/p14.m 644 1750 1750 310111135341325 166020ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p14(fg) ## And now, in the Theatre near you, "Octave, the movie" global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; if (!nargin) plsetopt "db"; fig( free_fig); # unused plot window title("Octave, the movie"); else title(""); endif ylabel ""; xlabel ""; l = 2; x = y = linspace(-l, l, 30); [xx,yy] = meshgrid(x,y); r = yy .* exp(-(xx.^2 .+ yy.^2)); axis([-l l -l l min(min(r)) max(max(r))]); colormap(bgr); for k = linspace(0.01, 3.5*pi, 30) meshc(x, y, sin(k).*r); endfor if(!nargin) for k = linspace(0.01, 2*pi, 15) surf(x, y, sin(k).*r); endfor shading "flat"; colormap (gray); for k = linspace(0.01, 3*pi, 30) surfl(x, y, sin(k).*r); endfor endif axis; # reset axis to automatic mode if (!nargin) closefig; # the "db" option has negative side effects on other plots. plsetopt "reset"; # reset options endif pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x03c.m 644 1750 1750 412111541504455 167640ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Generates polar plot, with 1-1 scaling. function x03c ## Initialize plplot */ ## Set orientation to portrait - note not all device drivers ## support this, in particular most interactive drivers do not */ plsori(1); plinit; dtr = pi / 180.0; i=0:360; x0 = cos(dtr * i); y0 = sin(dtr * i); ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Set up viewport and window, but do not draw box */ plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); ## Draw circles for polar grid for i=1:10 plarc(0.0, 0.0, 0.1 * i, 0.1 * i, 0.0, 360.0, 0.0, 0); endfor plcol0(2); for i=0:11 theta = 30.0 * i; dx = cos(dtr * theta); dy = sin(dtr * theta); ## Draw radial spokes for polar grid */ pljoin(0.0, 0.0, dx, dy); text=sprintf("%d", theta); ## Write labels for angle */ if (theta < 9.99) offset = 0.45; elseif (theta < 99.9) offset = 0.30; else offset = 0.15; endif if (dx >= -0.00001) plptex(dx, dy, dx, dy, -offset, text); else plptex(dx, dy, -dx, -dy, 1.+offset, text); endif endfor ## Draw the graph */ i=0:360; r = sin(dtr * (5 * i)); x = x0 .* r; y = y0 .* r; plcol0(3); plline(x', y'); plcol0(4); plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); ## Close the plot at end */ plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/p13.m 644 1750 1750 244311135341325 166110ustar andrewandrew## Copyright (C) 1999-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p13 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; legend("opaque"); title("Matrix with individual line attributes"); fmt=["bo-;Complex;"; "-15;Trivial;"; "@-g;Normal;"]; g = [ 1.0026965 -0.7056316 0.5318182 -1.2488487 0.0075065 0.3397433 -0.1075725 -0.0359792 1.3446770 0.9289222 1.4904782 2.0537617 0.6826819 -0.5042874 -0.7685230 1.4587288 1.3862166 1.8868312 0.2481350 0.5269746 -2.6129537 0.2621972 -2.1017077 -1.3780762 -0.5563111 -0.2584848 0.5026832 -0.2354172 -1.6008980 -1.7502134]; ## plot(randn(10,3),fmt) plot(g,fmt) pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x06c.m 644 1750 1750 403011505745551 167720ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Displays the entire "plpoin" symbol (font) set. function x06c ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); for kind_font = 0:1 plfontld( kind_font ); if (kind_font == 0) maxfont = 1; else maxfont = 4; endif for font = 1:maxfont plfont( font ); pladv(0); ## Set up viewport and window */ plcol0(2); plvpor(0.1, 1.0, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.3); ## Draw the grid using plbox */ plbox("bcg", 0.1, 0, "bcg", 0.1, 0); ## Write the digits below the frame */ plcol0(15); for i=0:9 text=sprintf("%d", i); plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, text); endfor k = 0; for i=0:12 ## Write the digits to the left of the frame */ text=sprintf("%d", 10 * i); plmtex("lv", 1.0, (1.0 - (2 * i + 1) / 26.0), 1.0, text); for j=0:9 x = 0.1 * j + 0.05; y = 1.25 - 0.1 * i; ## Display the symbols if (k < 128) plpoin(x, y, k); endif k = k + 1; endfor endfor if (kind_font == 0) plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)"); else plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)"); endif endfor endfor plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/CMakeLists.txt 644 1750 1750 552411722014037 205720ustar andrewandrew# examples/octave/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(examples_octave p1.m p2.m p3.m p4.m p5.m p6.m p7.m p8.m p9.m p10.m p11.m p12.m p13.m p14.m p15.m p16.m p17.m p18.m p19.m p20.m p21.m x00c.m x01c.m x02c.m x03c.m x04c.m x05c.m x06c.m x07c.m x08c.m x09c.m x10c.m x11c.m x12c.m x13c.m x14c.m x15c.m x16c.m x17c.m x18c.m x19c.m x20c.m x21c.m x22c.m x23c.m x24c.m x25c.m x26c.m x27c.m x28c.m x29c.m x30c.m x31c.m x33c.m plplot_octave_demo.m lena.img ) if(BUILD_TEST) set(full_examples_octave) foreach(example ${examples_octave}) list(APPEND full_examples_octave ${CMAKE_CURRENT_SOURCE_DIR}/${example}) endforeach(example ${examples_octave}) if(CORE_BUILD) get_property(files_plplot_stub.m_built GLOBAL PROPERTY FILES_plplot_stub.m_built) set_property(GLOBAL PROPERTY TARGETS_examples_octave plplot_octave plplot_stub.m_built ) set_property(GLOBAL PROPERTY FILES_examples_octave ${full_examples_octave} ${files_plplot_stub.m_built} ) else(CORE_BUILD) # For this case, the (custom) target plplot_stub.m_built and its # associated file dependencies, files_plplot_stub.m_built are not # defined. set_property(GLOBAL PROPERTY TARGETS_examples_octave plplot_octave ) set_property(GLOBAL PROPERTY FILES_examples_octave ${full_examples_octave} ) endif(CORE_BUILD) endif(BUILD_TEST) if(CORE_BUILD) install(FILES ${examples_octave} DESTINATION ${DATA_DIR}/examples/octave) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lena.img DESTINATION ${DATA_DIR}/examples ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/octave ) endif(CORE_BUILD) plplot-5.10.0+dfsg/examples/octave/x17c.m 644 1750 1750 545411505745551 170070ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. function x17c nsteps = 1000; ## If db is used the plot is much more smooth. However, because of the ## async X behaviour, one does not have a real-time scripcharter. ## plSetOpt("db", ""); ## plSetOpt("np", ""); ## Specify some reasonable defaults for ymin and ymax */ ## The plot will grow automatically if needed (but not shrink) */ ymin = -0.1; ymax = 0.1; ## Specify initial tmin and tmax -- this determines length of window. */ ## Also specify maximum jump in t */ ## This can accomodate adaptive timesteps */ tmin = 0.; tmax = 10.; tjump = 0.3; ## percentage of plot to jump ## Axes options same as plbox. */ ## Only automatic tick generation and label placement allowed */ ## Eventually I'll make this fancier */ colbox = 1; collab = 3; styline(1) = colline(1) = 2; ## pens color and line style styline(2) = colline(2) = 3; styline(3) = colline(3) = 4; styline(4) = colline(4) = 5; ## legline = ["sum"; "sin"; "sin*noi"; "sin+noi";]; xlab = 0.; ylab = 0.25; ## legend position autoy = 1; ## autoscale y acc = 1; ## dont strip, accumulate ## Initialize plplot */ plinit(); pladv(0); plvsta(); id1= plstripc("bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline', styline', "sum", "sin", "sin*noi", "sin+noi", "t", "", "Strip chart demo"); autoy = 0; acc = 1; ## This is to represent a loop over time */ ## Let's try a random walk process */ y1 = y2 = y3 = y4 = 0.0; dt = 0.1; for n = 0:nsteps-1 t = n * dt; noise = plrandd()-0.5; y1 = y1 + noise; y2 = sin(t*pi/18.); y3 = y2 * noise; y4 = y2 + noise/3.; ## there is no need for all pens to have the same number of points ## or beeing equally time spaced. if (rem(n,2)) plstripa(id1, 0, t, y1); endif if rem(n,3) plstripa(id1, 1, t, y2); endif if rem(n,4) plstripa(id1, 2, t, y3); endif if rem(n,5) plstripa(id1, 3, t, y4); endif endfor ## Destroy strip chart and it's memory */ plstripd(id1); plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/p8.m 644 1750 1750 155011135341325 165330ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p8 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; xlabel("X"); ylabel("Y"); title("Mesh example"); [x y z]=rosenbrock;z=log(z); colormap(pink); mesh(x,y,z) pause(1); meshc(x,y,z) pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x11c.m 644 1750 1750 507611512412416 167660ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Does a series of mesh plots for a given data set, with different ## viewing options in each plot. 1; function cmap1_init() i = [0; 1]; # left boundary, right boundary h = [240; 0]; # blue -> green -> yellow -> red l = [0.6; 0.6]; s = [0.8; 0.8]; plscmap1n(256); plscmap1l(0, i, h, l, s, zeros(2,1)); endfunction function ix11c global DRAW_LINEXY MAG_COLOR BASE_CONT XPTS = 35; ## Data points in x */ YPTS = 46; ## Datat points in y */ opt = [DRAW_LINEXY, DRAW_LINEXY ]'; alt = [33, 17]'; az = [24, 115]'; title = ["#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3"]; ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); xx = 3.0*((0:XPTS-1) - fix(XPTS / 2)) / fix(XPTS / 2); yy = 3.0*((0:YPTS-1) - fix(YPTS / 2)) / fix(YPTS / 2); [x,y] = meshgrid (xx,yy); z = 3 * (1-x).^2 .* exp(-(x.^2) - (y+1).^2) - ... 10 * (x/5 - x.^3 - y.^5) .* exp(-x.^2 - y.^2)- ... 1/3 * exp(-(x+1).^2 - y.^2); nlevel = 10; zmax = max(max(z)); zmin = min(min(z)); step = (zmax-zmin)/(nlevel+1); clevel = linspace(zmin+step, zmax-step, nlevel)'; cmap1_init; for k=1:2 for i=0:3 pladv(0); plcol0(1); plvpor(0, 1, 0, 0.9); plwind(-1, 1, -1, 1.5); plw3d(1, 1, 1.2, -3, 3, -3, 3, zmin, zmax, alt(k), az(k)); plbox3("bnstu", "x axis", 0, 0, "bnstu", "y axis", 0, 0, "bcdmnstuv", "z axis", 0, 4); plcol0(2); switch (i) case 0 plmesh(xx', yy', z', opt(k)); case 1 plmesh(xx', yy', z', opt(k) + MAG_COLOR); case 2 plot3d(xx', yy', z', opt(k) + MAG_COLOR, 1); case 3 plmeshc(xx', yy', z', opt(k) + MAG_COLOR + BASE_CONT, clevel); endswitch plcol0(3); plmtex("t", 1.0, 0.5, 0.5, deblank(title(k,:))); endfor endfor plend1(); endfunction ix11c plplot-5.10.0+dfsg/examples/octave/x33c.m 644 1750 1750 7643012152722753 170250ustar andrewandrew## -*- coding: utf-8; -*- ## $Id: x33c.m 12353 2013-06-02 20:07:07Z andrewross $ ## Copyright (C) 2010 Alan W. Irwin ## ## Demonstrate most pllegend capability including unicode symbols. ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ### ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ### ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## ## This example designed just for devices (e.g., the cairo-related and ## qt-related devices) where the best choice of glyph is automatically ## selected by the related libraries (pango/cairo or Qt4) for each ## unicode character depending on what system fonts are installed. Of ## course, you must have the appropriate TrueType fonts installed to ## have access to all the required glyphs. 1; global position_options special_symbols colorbar_option_kinds colorbar_option_kind_labels colorbar_position_options colorbar_position_option_labels colorbar_label_options colorbar_label_option_labels colorbar_cap_options colorbar_cap_option_labels global COLORBAR_KINDS COLORBAR_POSITIONS COLORBAR_LABELS COLORBAR_CAPS position_options = [ bitor(PL_POSITION_LEFT, bitor(PL_POSITION_TOP, PL_POSITION_OUTSIDE)); bitor(PL_POSITION_TOP, PL_POSITION_OUTSIDE); bitor(PL_POSITION_RIGHT, bitor(PL_POSITION_TOP, PL_POSITION_OUTSIDE)); bitor(PL_POSITION_RIGHT, PL_POSITION_OUTSIDE); bitor(PL_POSITION_RIGHT, bitor(PL_POSITION_BOTTOM, PL_POSITION_OUTSIDE)); bitor(PL_POSITION_BOTTOM, PL_POSITION_OUTSIDE); bitor(PL_POSITION_LEFT, bitor(PL_POSITION_BOTTOM, PL_POSITION_OUTSIDE)); bitor(PL_POSITION_LEFT, PL_POSITION_OUTSIDE); bitor(PL_POSITION_LEFT, bitor(PL_POSITION_TOP, PL_POSITION_INSIDE)); bitor(PL_POSITION_TOP, PL_POSITION_INSIDE); bitor(PL_POSITION_RIGHT, bitor(PL_POSITION_TOP, PL_POSITION_INSIDE)); bitor(PL_POSITION_RIGHT, PL_POSITION_INSIDE); bitor(PL_POSITION_RIGHT, bitor(PL_POSITION_BOTTOM, PL_POSITION_INSIDE)); bitor(PL_POSITION_BOTTOM, PL_POSITION_INSIDE); bitor(PL_POSITION_LEFT, bitor(PL_POSITION_BOTTOM, PL_POSITION_INSIDE)); bitor(PL_POSITION_LEFT, PL_POSITION_INSIDE) ]; ## Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). special_symbols = [ "✰"; "✴"; "✱"; "✽"; "✦" ]; # plcolorbar options # Colorbar type options COLORBAR_KINDS = 4; colorbar_option_kinds = [ PL_COLORBAR_SHADE; bitor(PL_COLORBAR_SHADE,PL_COLORBAR_SHADE_LABEL); PL_COLORBAR_IMAGE; PL_COLORBAR_GRADIENT ]; colorbar_option_kind_labels = { "Shade colorbars"; "Shade colorbars with custom labels"; "Image colorbars"; "Gradient colorbars" }; # Which side of the page are we positioned relative to? COLORBAR_POSITIONS = 4; colorbar_position_options = [ PL_POSITION_LEFT; PL_POSITION_RIGHT; PL_POSITION_TOP; PL_POSITION_BOTTOM ]; colorbar_position_option_labels = { "Left", "Right", "Top", "Bottom" }; # Colorbar label positioning options COLORBAR_LABELS = 4; colorbar_label_options = [ PL_COLORBAR_LABEL_LEFT; PL_COLORBAR_LABEL_RIGHT; PL_COLORBAR_LABEL_TOP; PL_COLORBAR_LABEL_BOTTOM ]; colorbar_label_option_labels = { "Label left", "Label right", "Label top", "Label bottom" }; # Colorbar cap options COLORBAR_CAPS = 4; colorbar_cap_options = [ PL_COLORBAR_CAP_NONE; PL_COLORBAR_CAP_LOW; PL_COLORBAR_CAP_HIGH; bitor(PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH) ]; colorbar_cap_option_labels = { "No caps"; "Low cap"; "High cap"; "Low and high caps" }; function plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ) global COLORBAR_POSITIONS colorbar_option_kinds colorbar_option_kind_labels colorbar_position_options colorbar_position_option_labels colorbar_label_options colorbar_label_option_labels colorbar_cap_options colorbar_cap_option_labels global PL_POSITION_LEFT PL_POSITION_RIGHT PL_POSITION_BOTTOM PL_COLORBAR_BOUNDING_BOX PL_COLORBAR_BACKGROUND label_opts = zeros(1,1); ticks = zeros(1,1); sub_ticks = zeros(1,1); n_values_array(1,:) = length(values); values_array(1,:) = values; low_cap_color = 0.0; high_cap_color = 1.0; # Start a new page pladv( 0 ); # Draw one colorbar relative to each side of the page for position_i = 1:COLORBAR_POSITIONS position = colorbar_position_options(position_i); opt = bitor( colorbar_option_kinds(kind_i), bitor( colorbar_label_options(label_i), colorbar_cap_options(cap_i) ) ); vertical = bitand(position, PL_POSITION_LEFT) || bitand(position, PL_POSITION_RIGHT); ifn = bitand(position, PL_POSITION_LEFT) || bitand(position, PL_POSITION_BOTTOM); # Set the offset position on the page if ( vertical ) x = 0.0; y = 0.0; x_length = 0.05; y_length = 0.5; else x = 0.0; y = 0.0; x_length = 0.5; y_length = 0.05; endif # Set appropriate labelling options. if ( ifn ) if ( cont_color == 0 || cont_width == 0. ) axis_opts(1,:) = "uwtivn"; else axis_opts(1,:) = "uwxvn"; endif else if ( cont_color == 0 || cont_width == 0. ) axis_opts(1,:) = "uwtivm"; else axis_opts(1,:) = "uwxvm"; endif endif label = cstrcat(char(colorbar_position_option_labels(position_i)), ", ", char(colorbar_label_option_labels(label_i)) ); # Smaller text plschr( 0.0, 0.75 ); # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); plvpor( 0.20, 0.80, 0.20, 0.80 ); plwind( 0.0, 1.0, 0.0, 1.0 ); # Set interesting background colour. plscol0a( 15, 0, 0, 0, 0.20 ); [colorbar_width, colorbar_height] = plcolorbar( \ bitor(opt, bitor(PL_COLORBAR_BOUNDING_BOX, PL_COLORBAR_BACKGROUND)), \ position, x, y, x_length, y_length, \ 15, 1, 1, low_cap_color, high_cap_color, \ cont_color, cont_width, label_opts, label, \ axis_opts, ticks, sub_ticks, \ n_values_array, values_array ); # Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); endfor # Draw a page title title = cstrcat(char(colorbar_option_kind_labels(kind_i)), " - ", char(colorbar_cap_option_labels(cap_i)) ); plvpor( 0.0, 1.0, 0.0, 1.0 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); endfunction function plcolorbar_example( palette, kind_i, cont_color, cont_width, values ) global COLORBAR_LABELS COLORBAR_CAPS # Load the color palette plspal1( palette, 1 ); for label_i = 1:COLORBAR_LABELS for cap_i = 1:COLORBAR_CAPS plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ); endfor endfor endfunction function ix33c() ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot ## set global attributes for PLplot variables used in this function. global PL_FCI_SANS PL_FCI_MONO PL_LEGEND_NONE PL_LEGEND_COLOR_BOX PL_LEGEND_LINE PL_LEGEND_SYMBOL PL_LEGEND_TEXT_LEFT PL_LEGEND_BACKGROUND PL_LEGEND_BOUNDING_BOX PL_LEGEND_ROW_MAJOR global PL_POSITION_LEFT PL_POSITION_RIGHT PL_POSITION_TOP PL_POSITION_BOTTOM PL_POSITION_INSIDE PL_POSITION_OUTSIDE PL_POSITION_SUBPAGE global PL_COLORBAR_IMAGE PL_COLORBAR_SHADE PL_COLORBAR_GRADIENT PL_COLORBAR_SHADE_LABEL global position_options special_symbols global COLORBAR_KINDS plinit(); ## First page illustrating the 16 standard positions. pladv(0); plvpor(0.25, 0.75, 0.25, 0.75); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont(PL_FCI_SANS, -1, -1); plmtex("t", 8.0, 0.5, 0.5, "The 16 standard legend positions with"); plmtex("t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y"); ## Set up legend arrays with the correct size, type. In octave this may ## be done by clearing the array (in case it was used before) and then ## writing the last element of the array with a placeholder of the right ## type. Note that for strings the right placeholder length doesn't ## matter. Octave keeps track of the longest string in each array and pads ## out all other members with blanks to that length if a subsequent string ## assignment for an array element exceeds that length. nlegend = 1; opt_array = 0; text_colors = 0; text = " "; box_colors = 0; box_patterns = 0; box_scales = 0.; box_line_widths = 0.; line_colors = 0; line_styles = 0; line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; symbols = " "; opt_array(nlegend,1) = 0; text_colors(nlegend,1) = 0; text(nlegend,1:length(" ")) = " "; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; symbols(nlegend,1:length(" ")) = " "; ## Only specify legend data that are required according to the ## value of opt_array for that entry. opt_base = bitor(PL_LEGEND_BACKGROUND, PL_LEGEND_BOUNDING_BOX); opt_array(1) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); line_styles(1) = 1; line_widths(1) = 1.; symbol_scales(1) = 1.; symbol_numbers(1) = 4; symbols(1,1:length("*")) = "*"; ## Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO , -1, -1); plscol0a( 15, 32, 32, 32, 0.70 ); for k=0:15 position = position_options(k+1); opt = opt_base; string = sprintf("%2.2d", k); text(1,1:length(string)) = string; text_colors(1) = 1 + mod(k, 8); line_colors(1) = 1 + mod(k, 8); symbol_colors(1) = 1 + mod(k, 8); [legend_width, legend_height] = \ pllegend( opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); endfor ## Second page illustrating effect of nrow, ncolumn for the same legend ## data. pladv(0); plvpor(0.25, 0.75, 0.25, 0.75); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont(PL_FCI_SANS, -1, -1); plmtex("t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,"); plmtex("t", 6.0, 0.5, 0.5, "and position for the same legend data"); ## Set up legend arrays with the correct size, type. In octave this may ## be done by clearing the array (in case it was used before) and then ## writing the last element of the array with a placeholder of the right ## type. Note that for strings the right placeholder length doesn't ## matter. Octave keeps track of the longest string in each array and pads ## out all other members with blanks to that length if a subsequent string ## assignment for an array element exceeds that length. nlegend = 7; opt_array = 0; text_colors = 0; text = " "; box_colors = 0; box_patterns = 0; box_scales = 0.; box_line_widths = 0.; line_colors = 0; line_styles = 0; line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; symbols = " "; opt_array(nlegend,1) = 0; text_colors(nlegend,1) = 0; text(nlegend,1:length(" ")) = " "; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; symbols(nlegend,1:length(" ")) = " "; ## Only specify legend data that are required according to the ## value of opt_array for that entry. opt_base = bitor(PL_LEGEND_BACKGROUND, PL_LEGEND_BOUNDING_BOX); for k=0:nlegend-1 opt_array(k+1) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); line_styles(k+1) = 1; line_widths(k+1) = 1.; symbol_scales(k+1) = 1.; symbol_numbers(k+1) = 2; symbols(k+1,1:length("*")) = "*"; string = sprintf("%2.2d",k); text(k+1,1:length(string)) = string; text_colors(k+1) = 1 + mod(k,8); line_colors(k+1) = 1 + mod(k,8); symbol_colors(k+1) = 1 + mod(k,8); endfor ## Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1); plscol0a( 15, 32, 32, 32, 0.70 ); position = bitor(PL_POSITION_TOP, PL_POSITION_OUTSIDE); opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = bitor(PL_POSITION_BOTTOM, PL_POSITION_OUTSIDE); opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = bitor(PL_POSITION_LEFT, PL_POSITION_OUTSIDE); opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = bitor(PL_POSITION_RIGHT, PL_POSITION_OUTSIDE); opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = bitor(PL_POSITION_LEFT, bitor(PL_POSITION_TOP, PL_POSITION_INSIDE)); opt = opt_base; x = 0.; y = 0.; nrow = 6; ncolumn = 2; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = bitor(PL_POSITION_RIGHT, bitor(PL_POSITION_TOP, PL_POSITION_INSIDE)); opt = bitor(opt_base, PL_LEGEND_ROW_MAJOR); x = 0.; y = 0.; nrow = 6; ncolumn = 2; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = bitor(PL_POSITION_BOTTOM, PL_POSITION_INSIDE); opt = bitor(opt_base, PL_LEGEND_ROW_MAJOR); x = 0.; y = 0.; nrow = 3; ncolumn = 3; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); ## Third page demonstrating legend alignment pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(0.0, 1.0, 0.0, 1.0); plsfont(PL_FCI_SANS, -1, -1); plmtex("t", 2.0, 0.5, 0.5, "Demonstrate legend alignment"); x = 0.1; y = 0.1; nturn = 4; nlegend = 0; position = bitor(bitor(PL_POSITION_LEFT, PL_POSITION_TOP), PL_POSITION_SUBPAGE); opt_base = bitor(PL_LEGEND_BACKGROUND, PL_LEGEND_BOUNDING_BOX); opt = opt_base; for i=0:8 ## Set up legend arrays with the correct size, type. In octave this may ## be done by clearing the array (in case it was used before) and then ## writing the last element of the array with a placeholder of the right ## type. Note that for strings the right placeholder length doesn't ## matter. Octave keeps track of the longest string in each array and pads ## out all other members with blanks to that length if a subsequent string ## assignment for an array element exceeds that length. if( i <= nturn) nlegend += 1; else nlegend -= 1; endif nlegend = max(1, nlegend); opt_array = 0; text_colors = 0; text = " "; box_colors = 0; box_patterns = 0; box_scales = 0.; box_line_widths = 0.; line_colors = 0; line_styles = 0; line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; symbols = " "; opt_array(nlegend,1) = 0; text_colors(nlegend,1) = 0; text(nlegend,1:length(" ")) = " "; box_colors(nlegend,1) = 0; box_patterns(nlegend,1) = 0; box_scales(nlegend,1) = 0.; box_line_widths(nlegend,1) = 0.; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; symbols(nlegend,1:length(" ")) = " "; ## Only specify legend data that are required according to the ## value of opt_array for that entry. for k=0:nlegend-1 opt_array(k+1) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); line_styles(k+1) = 1; line_widths(k+1) = 1.; symbol_scales(k+1) = 1.; symbol_numbers(k+1) = 2; symbols(k+1,1:length("*")) = "*"; string = sprintf("%2.2d",k); text(k+1,1:length(string)) = string; text_colors(k+1) = 1 + mod(k,8); line_colors(k+1) = 1 + mod(k,8); symbol_colors(k+1) = 1 + mod(k,8); endfor ## Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1); plscol0a( 15, 32, 32, 32, 0.70 ); nrow = min(3, nlegend); ncolumn = 0; [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); if(i == nturn) position = bitor(bitor(PL_POSITION_RIGHT, PL_POSITION_TOP), PL_POSITION_SUBPAGE); opt = opt_base; x = 1. - x; y += legend_height; else x += legend_width; y += legend_height; endif endfor ## Fourth page illustrating various kinds of legends max_height = 0.; xstart = 0.0; ystart = 0.1; x = xstart; y = ystart; text_scale = 0.90; pladv(0); plvpor(0.0, 1., 0.0, 0.90); plwind(0.0, 1.0, 0.0, 1.0); ## plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont(PL_FCI_SANS, -1, -1); plmtex("t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends"); ## Set up legend arrays with the correct size, type. In octave this may ## be done by clearing the array (in case it was used before) and then ## writing the last element of the array with a placeholder of the right ## type. Note that for strings the right placeholder length doesn't ## matter. Octave keeps track of the longest string in each array and pads ## out all other members with blanks to that length if a subsequent string ## assignment for an array element exceeds that length. nlegend = 5; opt_array = 0; text_colors = 0; text = " "; box_colors = 0; box_patterns = 0; box_scales = 0.; box_line_widths = 0.; line_colors = 0; line_styles = 0; line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; symbols = " "; opt_array(nlegend,1) = 0; text_colors(nlegend,1) = 0; text(nlegend,1:length(" ")) = " "; box_colors(nlegend,1) = 0; box_patterns(nlegend,1) = 0; box_scales(nlegend,1) = 0.; box_line_widths(nlegend,1) = 0.; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; symbols(nlegend,1:length(" ")) = " "; ## Only specify legend data that are required according to the ## value of opt_array for that entry. position = bitor(PL_POSITION_LEFT, PL_POSITION_TOP); opt_base = bitor(PL_LEGEND_BACKGROUND, bitor(PL_LEGEND_BOUNDING_BOX, PL_LEGEND_TEXT_LEFT)); ## Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array(1) = PL_LEGEND_NONE; text(1,1:length("None")) = "None"; text_colors(1) = 1; opt_array(2) = PL_LEGEND_COLOR_BOX; text(2,1:length("Box")) = "Box"; text_colors(2) = 2; box_colors(2) = 2; box_patterns(2) = 0; box_scales(2) = 0.8; box_line_widths(2) = 1.; opt_array(3) = PL_LEGEND_LINE; text(3,1:length("Line")) = "Line"; text_colors(3) = 3; line_colors(3) = 3; line_styles(3) = 1; line_widths(3) = 1.; opt_array(4) = PL_LEGEND_SYMBOL; text(4,1:length("Symbol")) = "Symbol"; text_colors(4) = 4; symbol_colors(4) = 4; symbol_scales(4) = text_scale; symbol_numbers(4) = 4; symbols(4,1:length(special_symbols(3,:))) = special_symbols(3,:); opt_array(5) = bitor(PL_LEGEND_SYMBOL, PL_LEGEND_LINE); text(5,1:length("L & S")) = "L & S"; text_colors(5) = 5; line_colors(5) = 5; line_styles(5) = 1; line_widths(5) = 1.; symbol_colors(5) = 5; symbol_scales(5) = text_scale; symbol_numbers(5) = 4; symbols(5,1:length(special_symbols(3,:))) = special_symbols(3,:); opt = opt_base; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); max_height = max(max_height, legend_height); ## Set up symbol legend entries with various symbols. ## Reset text and symbols, because otherwise legend may come out with ## the wrong length text/symbol with prior results embedded. text = " "; text(nlegend,1:length(" ")) = " "; symbols = " "; symbols(nlegend,1:length(" ")) = " "; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_SYMBOL; string = ["Symbol ",special_symbols(i+1,:)]; text(i+1,1:length(string)) = string; text_colors(i+1) = i+1; symbol_colors(i+1) = i+1; symbol_scales(i+1) = text_scale; symbol_numbers(i+1) = 4; symbols(i+1,1:length(special_symbols(i+1,:))) = special_symbols(i+1,:); endfor opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, [], [], [], [], [], [], [], symbol_colors, symbol_scales, symbol_numbers, symbols ); max_height = max(max_height, legend_height); ## Set up symbol legend entries with various numbers of symbols. ## Reset text and symbols, because otherwise legend may come out with ## the wrong length text/symbol with prior results embedded. text = " "; text(nlegend,1:length(" ")) = " "; symbols = " "; symbols(nlegend,1:length(" ")) = " "; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_SYMBOL; string = sprintf("Symbol Number %d", (i+2)); text(i+1,1:length(string)) = string; text_colors(i+1) = i+1; symbol_colors(i+1) = i+1; symbol_scales(i+1) = text_scale; symbol_numbers(i+1) = i+2; symbols(i+1,1:length(special_symbols(3,:))) = special_symbols(3,:); endfor opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, [], [], [], [], [], [], [], symbol_colors, symbol_scales, symbol_numbers, symbols ); max_height = max(max_height, legend_height); ## Set up box legend entries with various colours. ## Reset text and symbols, because otherwise legend may come out with ## the wrong length text/symbol with prior results embedded. text = " "; text(nlegend,1:length(" ")) = " "; symbols = " "; symbols(nlegend,1:length(" ")) = " "; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_COLOR_BOX; string = sprintf("%s %d", "Box Color",i+1); text(i+1,1:length(string)) = string; text_colors(i+1) = i+1; box_colors(i+1) = i+1; box_patterns(i+1) = 0; box_scales(i+1) = 0.8; box_line_widths(i+1) = 1.; endfor opt = opt_base; ## Use new origin x = xstart; y += max_height; max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, [], [], [], [], [], [], [] ); max_height = max(max_height, legend_height); ## Set up box legend entries with various patterns. ## Reset text and symbols, because otherwise legend may come out with ## the wrong length text/symbol with prior results embedded. text = " "; text(nlegend,1:length(" ")) = " "; symbols = " "; symbols(nlegend,1:length(" ")) = " "; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_COLOR_BOX; string = sprintf("%s %d", "Box Pattern",i); text(i+1,1:length(string)) = string; text_colors(i+1) = 2; box_colors(i+1) = 2; box_patterns(i+1) = i; box_scales(i+1) = 0.8; box_line_widths(i+1) = 1.; endfor opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, [], [], [], [], [], [], [] ); max_height = max(max_height, legend_height); ## Set up box legend entries with various box pattern line widths. ## Reset text and symbols, because otherwise legend may come out with ## the wrong length text/symbol with prior results embedded. text = " "; text(nlegend,1:length(" ")) = " "; symbols = " "; symbols(nlegend,1:length(" ")) = " "; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_COLOR_BOX; string = sprintf("%s %d", "Box Line Width",i+1); text(i+1,1:length(string)) = string; text_colors(i+1) = 2; box_colors(i+1) = 2; box_patterns(i+1) = 3; box_scales(i+1) = 0.8; box_line_widths(i+1) = double(i+1); endfor opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, [], [], [], [], [], [], [] ); max_height = max(max_height, legend_height); ## Set up line legend entries with various colours. ## From here on use the cell array of strings paradigm for ## text (and symbols) to show that the PLplot interface works properly for ## this case (and also to demonstrate how to use a cell array of strings ## with PLplot). ## Reset text and symbols cell arrays. text = {}; text{nlegend} = ""; symbols = {}; symbols{nlegend} = ""; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_LINE; text{i+1} = sprintf("%s %d", "Line Color",i+1); text_colors(i+1) = i+1; line_colors(i+1) = i+1; line_styles(i+1) = 1; line_widths(i+1) = 1; endfor opt = opt_base; ## Use new origin x = xstart; y += max_height; max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text', [], [], [], [], line_colors, line_styles, line_widths, [], [], [], [] ); max_height = max(max_height, legend_height); ## Set up line legend entries with various styles ## Reset text and symbols cell arrays. text = {}; text{nlegend} = ""; symbols = {}; symbols{nlegend} = ""; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_LINE; text{i+1} = sprintf("%s %d", "Line Style",i+1); text_colors(i+1) = 2; line_colors(i+1) = 2; line_styles(i+1) = i+1; line_widths(i+1) = 1; endfor opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text', [], [], [], [], line_colors, line_styles, line_widths, [], [], [], [] ); max_height = max(max_height, legend_height); ## Set up line legend entries with various widths. ## Reset text and symbols cell arrays. text = {}; text{nlegend} = ""; symbols = {}; symbols{nlegend} = ""; for i=0:nlegend-1 opt_array(i+1) = PL_LEGEND_LINE; text{i+1} = sprintf("%s %d", "Line Width",i+1); text_colors(i+1) = 2; line_colors(i+1) = 2; line_styles(i+1) = 1; line_widths(i+1) = i+1; endfor opt = opt_base; x += legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text', [], [], [], [], line_colors, line_styles, line_widths, [], [], [], [] ); max_height = max(max_height, legend_height); # Color bar examples values_small = [ -1.0e-200, 1.0e-200 ]; values_uneven = [ -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 ]; values_even = [ -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 ]; # Use unsaturated green background colour to contrast with black caps. plscolbg( 70, 185, 70 ); # Cut out the greatest and smallest bits of the color spectrum to # leave colors for the end caps. plscmap1_range( 0.01, 0.99 ); # We can only test image and gradient colorbars with two element arrays for i = 3:COLORBAR_KINDS plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ); endfor # Test shade colorbars with larger arrays for i = 1:2 plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ); endfor for i = 1:2 plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ); endfor plend1(); endfunction ix33c() plplot-5.10.0+dfsg/examples/octave/x10c.m 644 1750 1750 223711505745551 167740ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Demonstrates absolute positioning of graphs on a page. function x10c ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); pladv(0); plvpor(0.0, 1.0, 0.0, 1.0); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plsvpa(50.0, 150.0, 50.0, 100.0); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plptex(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)"); plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/p1.m 644 1750 1750 205511135341325 165250ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p1 global pl_automatic_replot; t = pl_automatic_replot; pl_automatic_replot = 0; xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; m=60; x = xoff + xscale * ((1:m) + 1) / m; y = yoff + yscale * (x.^2); n=5; xs = x((1:n) * 10 + 3); ys = y((1:n) * 10 + 3); ## Plot the data points */ xlabel("(x)"); ylabel("(y)"); title("#frPLplot Example 1 - y=x#u2"); plot(x, y, xs, ys, 'og; ;'); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/p16.m 644 1750 1750 156611135341325 166210ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p16 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; multiplot(1, 2); p1; subwindow(1, 2); [x, y, z] = peaks; colormap(bgr); title "Peaks"; xlabel ""; ylabel ""; shade(x, y, z); oneplot; pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x08c.m 644 1750 1750 663511512412416 167760ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Does a series of 3-d plots for a given data set, with different ## viewing options in each plot. 1; function cmap1_init(g) i = [0; 1]; # left boundary, right boundary if (g) h = [0; 0]; # hue -- low: red (arbitrary if s=0) -- high: red (arbitrary if s=0) l = [0.5; 1]; # lightness -- low: half-dark -- high: light s = [0; 0]; # minimum saturation else h = [240; 0]; # blue -> green -> yellow -> red l = [0.6; 0.6]; s = [0.8; 0.8]; endif plscmap1n(256); plscmap1l(0, i, h, l, s, zeros(2,1)); endfunction function ix08c global MAG_COLOR BASE_CONT SURF_CONT FACETED XPTS=35; ## Data points in x YPTS=46; ## Datat points in y alt=[60.0, 20.0]; az =[30.0, 60.0]; title=["#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60"]; ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit(); rosen = 1; x = ((0:XPTS-1) - fix(XPTS / 2)) / fix(XPTS / 2); y = ((0:YPTS-1) - fix(YPTS / 2)) / fix(YPTS / 2); if (rosen) x = x * 1.5; y = y + 0.5; endif [xx, yy] = meshgrid(x,y); if (rosen) z = (1 - xx) .^ 2 + 100 .* (yy - xx .^ 2) .^ 2; if exist ("do_fortran_indexing") of = do_fortran_indexing; do_fortran_indexing = 1; endif z(z <= 0) = exp(-5); # make sure the minimum after applying log() is -5 if exist ("do_fortran_indexing") do_fortran_indexing = of; endif z = log(z); else r = sqrt(xx .* xx + yy .* yy); z = exp(-r .* r) .* cos(2.0 * 3.141592654 .* r); endif pllightsource(1.,1.,1.); n_col = 100; plscmap1n(n_col); nlevel = 10; zmax = max(max(z)); zmin = min(min(z)); step = (zmax-zmin)/(nlevel+1); clevel = linspace(zmin+step, zmax-step, nlevel)'; for k=1:2 for ifshade=0:3 pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -0.9, 1.1); plcol0(3); plmtex("t", 1.0, 0.5, 0.5, title(k,:)); plcol0(1); if (rosen) plw3d(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, \ alt(k), az(k)); else plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, \ alt(k), az(k)); endif plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); plcol0(2); switch(ifshade) case 0 cmap1_init(1); plsurf3d(x', y', z', 0, 0); case 1 cmap1_init(0); plsurf3d(x', y', z', MAG_COLOR, 0); case 2 plsurf3d(x', y', z', MAG_COLOR + FACETED, 0); otherwise plsurf3d(x', y', z', MAG_COLOR + SURF_CONT + BASE_CONT, clevel); endswitch endfor endfor plend1(); endfunction ix08c plplot-5.10.0+dfsg/examples/octave/x21c.m 644 1750 1750 1310212140615235 167760ustar andrewandrew## $Id: x21c.m 12330 2013-05-03 02:02:05Z airwin $ ## Grid data demo ## ## Copyright (C) 2004 Joao Cardoso ## Copyright (C) 2006 Andrew Ross ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 1; function cmap1_init i(1) = 0.0; ## left boundary i(2) = 1.0; ## right boundary h(1) = 240; ## blue -> green -> yellow -> h(2) = 0; ## -> red l(1) = 0.6; l(2) = 0.6; s(1) = 0.8; s(2) = 0.8; plscmap1n(256); plscmap1l(0, i', h', l', s', zeros(2,1)); endfunction function ix21c ## Global plplot constants used here global GRID_CSA GRID_DTLI GRID_NNLI GRID_NNI; global DRAW_LINEXY MAG_COLOR BASE_CONT; pts = 500; xp = 25; yp = 20; nl = 16; knn_order = 20; threshold = 1.001; wmin = -1e3; randn = 0; rosen = 0; title = ["Cubic Spline Approximation"; "Delaunay Linear Interpolation"; "Natural Neighbors Interpolation"; "KNN Inv. Distance Weighted"; "3NN Linear Interpolation"; "4NN Around Inv. Dist. Weighted"]; opt = zeros(6,1); xm = -0.2; ym = -0.2; xM = 0.6; yM = 0.6; ##plMergeOpts(options, "x21c options", NULL); ##plparseopts(&argc, argv, PL_PARSE_FULL); opt(3) = wmin; opt(4) = knn_order; opt(5) = threshold; ## Initialize plplot plinit; cmap1_init; plseed(5489); [x, y, z] = create_data(pts, xm, xM, ym, yM, randn, rosen); ## the sampled data zmax = max(z); zmin = min(z); [xg, yg] = create_grid(xp, yp, xm, xM, ym, yM); ## grid the data at plcol0(1); plenv(xm, xM, ym, yM, 2, 0); plcol0(15); pllab("X", "Y", "The original data sampling"); for i=1:pts plcol1( ( z(i) - zmin ) / ( zmax - zmin ) ); plstring( x(i), y(i), "#(727)" ); end pladv(0); plssub(3,2); for k=0:1 pladv(0); for alg=1:6 zg = plgriddata(x, y, z, xg, yg, alg, opt(alg)); ## - CSA can generate NaNs (only interpolates?!). ## - DTLI and NNI can generate NaNs for points outside the convex hull ## of the data points. ## - NNLI can generate NaNs if a sufficiently thick triangle is not found ## ## PLplot should be NaN/Inf aware, but changing it now is quite a job... ## so, instead of not plotting the NaN regions, a weighted average over ## the neighbors is done. ## if (alg == GRID_CSA || alg == GRID_DTLI || alg == GRID_NNLI || alg == GRID_NNI) for i=1:xp for j=1:yp ## average (IDW) over the 8 neighbors for NaN's if isnan(zg(i,j)) zg(i,j) = 0.; dist = 0.; for ii=i-1:i+1 for jj=j-1:j+1 if (ii >= 1 && jj >= 1 && ii<=xp && jj <=yp && !isnan(zg(ii,jj))) if ((abs(ii-i) + abs(jj-j)) == 1) d = 1.; else d = 1.4142; endif zg(i,j) += zg(ii,jj)/(d*d); dist += d; endif endfor endfor if (dist != 0.) zg(i,j) /= dist; else zg(i,j) = zmin; endif endif endfor endfor endif lzM = max(max(zg)); lzm = min(min(zg)); lzm = min(lzm, zmin)-0.01; lzM = max(lzM, zmax)+0.01; plcol0(1); pladv(alg); if (k == 0) i = (0:nl-1)'; clev = lzm + (lzM-lzm)/(nl-1)*i; plenv0(xm, xM, ym, yM, 2, 0); plcol0(15); pllab("X", "Y", deblank(title(alg,:))); plshades(zg, xm, xM, ym, yM, clev, 1., 0, 1., 1); plcol0(2); else i=(0:nl-1)'; clev = lzm + (lzM-lzm)/(nl-1)*i; plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.1, 0.75, -0.65, 1.20); ## ## For the comparition to be fair, all plots should have the ## same z values, but to get the max/min of the data generated ## by all algorithms would imply two passes. Keep it simple. ## ## plw3d(1., 1., 1., xm, xM, ym, yM, zmin, zmax, 30, -60); ## plw3d(1., 1., 1., xm, xM, ym, yM, lzm, lzM, 30., -40.); plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); plcol0(15); pllab("", "", deblank(title(alg,:))); plot3dc(xg, yg, zg, bitor(DRAW_LINEXY,bitor(MAG_COLOR,BASE_CONT)), clev); endif endfor endfor plend1; endfunction function [x, y] = create_grid(px, py, xm, xM, ym, yM) i = (0:px-1)'; x = xm + (xM-xm)*i/(px-1.0); i = (0:py-1)'; y = ym + (yM-ym)*i/(py-1.0); endfunction function [x, y, z] = create_data(pts, xm, xM, ym, yM, randn, rosen) ## This would be a much more efficient way of generating an array of ## random numbers, but we stick with plrandd for compatibility between ## examples. ## x = rand(pts,1); ## y = rand(pts,1); x = zeros(pts,1); y = zeros(pts,1); for i=1:pts x(i) = (xM-xm)*plrandd(); y(i) = (yM-ym)*plrandd(); endfor if (!randn) x = x + xm; y = y + ym; else ## std=1, meaning that many points are outside the plot range x = sqrt(-2.*log(x)) * cos(2.*pi*y) + xm; y = sqrt(-2.*log(x)) * sin(2.*pi*y) + ym; endif if (!rosen) r = sqrt(x.*x + y.*y); z = exp(-r .* r) .* cos(2.0 * pi * r); else z = log((1. - x).^2 + 100. * (y - x.^2).^2); endif endfunction ix21c; plplot-5.10.0+dfsg/examples/octave/p9.m 644 1750 1750 207411135341325 165360ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p9 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; as = autostyle; autostyle ("off"); ls = legend; legend "off" step = 0.2; x = -2:step:2; y = -2:step:2; [xx,yy] = meshgrid(x,y); z = xx .* exp(-xx.^2 - yy.^2); [gy, gx] = gradn(z,step,step); title("Vector field example"); contour(x,y,z) hold on; arrows(yy,xx,gx./2,gy./2); hold off plflush; legend(ls); autostyle(as); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x09c.m 644 1750 1750 1721711505771466 170340ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Does several contour plots using different coordinate mappings. 1; global XPTS=35; ## Data points in x global YPTS=46; ## Datat points in y global tr = [2/(XPTS-1); 0.0; -1.0; 0.0; 2/(YPTS-1); -1.0]; function [tx ty] = mypltr(x, y) global XPTS global YPTS global tr tx = tr(1) * x + tr(2) * y + tr(3); ty = tr(4) * x + tr(5) * y + tr(6); endfunction function _polar plenv(-1., 1., -1., 1., 0, -2); plcol0(1); ## Perimeter PERIMETERPTS = 100; RPTS = 40; THETAPTS = 40; i = 0:PERIMETERPTS-1; t = (2.*pi/(PERIMETERPTS-1))*i; px = cos(t); py = sin(t); plline(px', py'); ## create data to be contoured i = 0:RPTS-1; r = i/(RPTS-1); z = r'*ones(1,RPTS); j = (0:THETAPTS-1)'; theta = (2.*pi/(THETAPTS-1))*j; xg = cos(theta)*r; yg = sin(theta)*r; i = 0:9; lev = 0.05 + 0.10* i'; plcol0(2); plcont2(z, 1, RPTS, 1, THETAPTS, lev, xg', yg'); plcol0(1); pllab("", "", "Polar Contour Plot"); endfunction ## shielded potential contour plot example. function potential PPERIMETERPTS = 100; PRPTS = 40; PTHETAPTS = 64; PNLEVEL = 20; ## create data to be contoured i = 0:PRPTS-1; r = 0.5 + i; j = (0:PTHETAPTS-1)'; theta = (2.*pi/(PTHETAPTS-1))*(0.5 + j); xg = (cos(theta)*r)'; yg = (sin(theta)*r)'; rmax = max(r); xmin = min(min(xg)); xmax = max(max(xg)); ymin = min(min(yg)); ymax = max(max(yg)); x0 = (xmin + xmax)/2; y0 = (ymin + ymax)/2; ## Expanded limits peps = 0.05; xpmin = xmin - abs(xmin)*peps; xpmax = xmax + abs(xmax)*peps; ypmin = ymin - abs(ymin)*peps; ypmax = ymax + abs(ymax)*peps; ## Potential inside a conducting cylinder (or sphere) by method of images. ## Charge 1 is placed at (d1, d1), with image charge at (d2, d2). ## Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). ## Also put in smoothing term at small distances. eeps = 2.; q1 = 1.; d1 = rmax/4.; q1i = - q1*rmax/d1; d1i = rmax^2/d1; q2 = -1.; d2 = rmax/4.; q2i = - q2*rmax/d2; d2i = rmax^2/d2; div1 = sqrt((xg-d1).^2 + (yg-d1).^2 + eeps^2); div1i = sqrt((xg-d1i).^2 + (yg-d1i).^2 + eeps^2); div2 = sqrt((xg-d2).^2 + (yg+d2).^2 + eeps^2); div2i = sqrt((xg-d2i).^2 + (yg+d2i).^2 + eeps^2); z = q1./div1 + q1i./div1i + q2./div2 + q2i./div2i; zmin = min(min(z)); zmax = max(max(z)); ## Positive and negative contour levels. dz = (zmax-zmin)/ PNLEVEL; i = 0:PNLEVEL-1; clevel = zmin + ( i + 0.5)*dz; clevelneg = clevel(clevel <= 0); clevelpos = clevel(clevel > 0); nlevelneg = columns( clevelneg); nlevelpos = columns( clevelpos); ## Colours! ncollin = 11; ncolbox = 1; ncollab = 2; ## Finally start plotting this page! pladv(0); plcol0(ncolbox); plvpas(0.1, 0.9, 0.1, 0.9, 1.0); plwind(xpmin, xpmax, ypmin, ypmax); plbox("", 0., 0, "", 0., 0); plcol0(ncollin); if(nlevelneg >0) ## Negative contours pllsty(2); plcont2(z, 1, PRPTS, 1, PTHETAPTS, clevelneg', xg, yg); endif if(nlevelpos >0) ## Positive contours pllsty(1); plcont2(z, 1, PRPTS, 1, PTHETAPTS, clevelpos', xg, yg); endif ## Draw outer boundary i = 0:PPERIMETERPTS-1; t = (2.*pi/(PPERIMETERPTS-1))*i; px = x0 + rmax*cos(t); py = y0 + rmax*sin(t); plcol0(ncolbox); plline(px', py'); plcol0(ncollab); pllab("", "", "Shielded potential of charges in a conducting sphere"); endfunction function ix09c global XPTS global YPTS global tr clevel = linspace(-1,1,11)'; ## Hack to ensure that zero contour really is zero ## and not a very small number. ## For me problem only occurs on i386 32 bit Debian 3.1 ## with octave 2.1.69. ## 64-bit Ubuntu Dapper with octave 2.1.72 seems ok. clevel(6) = 0.0; mark0 = []; space0 = []; mark1 = [1500]; space1 = [1500]; ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit(); ## Set up function arrays for i=0:XPTS-1 xx = (i - fix(XPTS / 2)) / fix(XPTS / 2); yy = ((0:YPTS-1) - fix(YPTS / 2)) / fix(YPTS / 2) - 1.0; z(i+1,:) = xx * xx - yy .* yy; w(i+1,:) = 2 * xx .* yy; endfor ## Plot using identity transform if (0) pl_setcontlabelparam(0.006, 0.3, 0.1, 0); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, tr); plstyl(mark1, space1); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, tr); plstyl(mark0, space0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); endif pl_setcontlabelformat(4,3); pl_setcontlabelparam(0.006, 0.3, 0.1, 1); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, tr); plstyl(mark1, space1); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, tr); plstyl(mark0, space0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); ## Set up grids for i=0:XPTS-1 [xx yy] = mypltr(i, (0:YPTS-1)); argx = xx * pi/2; argy = yy * pi/2; distort = 0.4; xg3(i+1,:) = xx .+ distort .* cos(argx); yg3(i+1,:) = yy .- distort .* cos(argy); xg2(i+1,:) = xx .+ distort .* cos(argx) .* cos(argy); yg2(i+1,:) = yy .- distort .* cos(argx) .* cos(argy); endfor xg1 = xg3(:,1); yg1 = yg3(XPTS,:)'; ## Plot using 1d coordinate transform pl_setcontlabelparam(0.006, 0.3, 0.1, 0); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont1(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1); plstyl(mark1, space1); plcol0(3); plcont1(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1); plstyl(mark0, space0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); if(0) pl_setcontlabelparam(0.006, 0.3, 0.1, 1); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont1(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1); plstyl(mark1, space1); plcol0(3); plcont1(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1); plstyl(mark0, space0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); endif ## Plot using 2d coordinate transform pl_setcontlabelparam(0.006, 0.3, 0.1, 0); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont2(z, 1, XPTS, 1, YPTS, clevel, xg2, yg2); plstyl(mark1, space1); plcol0(3); plcont2(w, 1, XPTS, 1, YPTS, clevel, xg2, yg2); plstyl(mark0, space0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); if(0) pl_setcontlabelparam(0.006, 0.3, 0.1, 1); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont1(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1); plstyl(mark1, space1); plcol0(3); plcont1(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1); plstyl(mark0, space0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); endif pl_setcontlabelparam(0.006, 0.3, 0.1, 0); _polar(); ## pl_setcontlabelparam(0.006, 0.3, 0.1, 1); ## _polar(); pl_setcontlabelparam(0.006, 0.3, 0.1, 0); potential(); ## pl_setcontlabelparam(0.006, 0.3, 0.1, 1); ## potential(); plend1(); endfunction ix09c plplot-5.10.0+dfsg/examples/octave/plplot_octave_demo.m 644 1750 1750 266011051040414 220560ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. printf("\n\n\ This demo runs script files x01c.m to x19c.m, which are the octave\n\ versions of the equivalent C files.\n\ The Octave version is an almost direct copy of the C sources,\n\ and only in a few cases the code is vectorized.\n\n\ To advance from one plot to the next, hit the Enter key or\n\ press the right mouse button. If you endup with an undesired\n\ plot window, type at the Octave prompt \"plend1\".\n\n\ Some demos print instructions, so keep this window visible.\n\n\ Press any key to continue...\n"); fflush(stdout); kbhit; plplot_stub; for i=[1:30]; ## To set defaults, use plSetOpt, as used in the command line, e.g. ## plSetOpt("dev", "png"); ## plSetOpt("o", "foo.ps"); ## plSetOpt("fam", "1"); plSetOpt("dev", "xwin"); cmd = sprintf("x%.2dc",i); printf("Demo %s\n", cmd); fflush(stdout); eval(cmd); endfor plplot-5.10.0+dfsg/examples/octave/x14c.m 644 1750 1750 1770111507733652 170230ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot, but doesn't ## use the tk driver. # Demo of multiple stream/window capability # ## Plots several simple functions from other example programs. # ## This version sends the output of the first 4 plots (one page) to two ## independent streams. 1; function ix14c(fname2,strm) if (nargin < 2) strm = stdout; endif xleng0 = 400; yleng0 = 300; xoff0 = 200; yoff0 = 200; xleng1 = 400; yleng1 = 300; xoff1 = 500; yoff1 = 500; ## The geometry strings MUST be in writable memory */ geometry_master = "500x410+100+200"; geometry_slave = "500x410+650+200"; ## Set up first stream */ plSetOpt("geometry", geometry_master); plssub(2,2); plinit(); device = sprintf("%s",plgdev'); if(isempty(device)) device = "xwin"; endif [fam, num, bmax] = plgfam(); fprintf(strm,"Demo of multiple output streams via the %s driver.\n", device); fprintf(strm,"Running with the second stream as slave to the first.\n"); ##fprintf(strm,"To advance to the next plot, press the third mouse button\n"); ##fprintf(strm,"or the enter key in the first (left) window\n"); fprintf(strm,"\n"); ## This is an entirely bogus message since the output file name is ## set by the function arguments - but it does ensure that stdout ## is identical to the C version of the example for ctest. if (strm != stdout) fprintf(strm,"Enter graphics output file name: "); endif ## fflush(strm); ## Start next stream */ plsstrm(1); ## Turn off pause to make this a slave (must follow master) */ plSetOpt("geometry", geometry_slave); plspause(0); ## This is an addition to C version to allow second file name to be ## set as a function argument. This is required for the test scripts. if (nargin >= 1) plsfnam(fname2); endif plsdev(device); plsfam(fam,num,bmax); plinit(); ## Set up the data & plot */ ## Original case */ plsstrm(0); xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; plot1(xoff,xscale,yoff,yscale); ## Set up the data & plot */ xscale = 1.; yscale = 1.e+6; plot1(xoff,xscale,yoff,yscale); ## Set up the data & plot */ xscale = 1.; yscale = 1.e-6; digmax = 2; plsyax(digmax, 0); plot1(xoff,xscale,yoff,yscale); ## Set up the data & plot */ xscale = 1.; yscale = 0.0014; yoff = 0.0185; digmax = 5; plsyax(digmax, 0); plot1(xoff,xscale,yoff,yscale); ## To slave */ ## The pleop() ensures the eop indicator gets lit. */ plsstrm(1); plot4(); pleop(); ## Back to master */ plsstrm(0); plot2(); plot3(); ## To slave */ plsstrm(1); plot5(); pleop(); ## Back to master to wait for user to advance */ plsstrm(0); pleop(); ## Call plend1 to finish off. */ ## close slave first plsstrm(1); plend1(); ## close master plsstrm(0); plend1(); endfunction function plot1(xoff,xscale,yoff,yscale) for i=0:59 x(i+1) = xoff + xscale * (i + 1) / 60.0; y(i+1) = yoff + yscale * x(i+1).^2.; endfor xmin = min(x); xmax = max(x); ymin = min(y); ymax = max(y); for i=0:5 xs(i+1) = x(i * 10 + 3 +1); ys(i+1) = y(i * 10 + 3 +1); endfor ## Set up the viewport and window using PLENV. The range in X is */ ## 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are */ ## scaled separately (just = 0), and we just draw a labelled */ ## box (axis = 0). */ plcol0(1); plenv(xmin, xmax, ymin, ymax, 0, 0); plcol0(6); pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); ## Plot the data points */ plcol0(9); plpoin(xs', ys', 9); ## Draw the line through the data */ plcol0(4); plline(x', y'); plflush;#pleop(); endfunction function plot2() ## Set up the viewport and window using PLENV. The range in X is -2.0 to ## 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately ## (just = 0), and we draw a box with axes (axis = 1). plcol0(1); plenv(-2.0, 10.0, -0.4, 1.2, 0, 1); plcol0(2); pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); ## Fill up the arrays */ for i=0:99 x(i+1) = (i - 19.0) / 6.0; y(i+1) = 1.0; if (x(i+1) != 0.0) y(i+1) = sin(x(i+1)) / x(i+1); endif endfor ## Draw the line */ plcol0(3); plline(x', y'); plflush;#pleop(); endfunction function plot3() space0 = []; mark0 = []; space1 = [1500]; mark1 = [1500]; ## For the final graph we wish to override the default tick intervals, and ## so do not use PLENV */ pladv(0); ## Use standard viewport, and define X range from 0 to 360 degrees, Y range ## from -1.2 to 1.2. */ plvsta(); plwind(0.0, 360.0, -1.2, 1.2); ## Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. */ plcol0(1); plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2); ## Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl ## expects a pointer!! */ plstyl(mark1, space1); plcol0(2); plbox("g", 30.0, 0, "g", 0.2, 0); plstyl(mark0, space0); plcol0(3); pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); for i = 0:100 x(i+1) = 3.6 * i; y(i+1) = sin(x(i+1) * 3.141592654 / 180.0); endfor plcol0(4); plline(x', y'); plflush;#pleop(); endfunction function plot4() dtr = pi / 180.0; zz=0:360; x0 = cos(dtr * zz'); y0 = sin(dtr * zz'); ## Set up viewport and window, but do not draw box */ plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); for i = 1:10 x = 0.1 * i * x0; y = 0.1 * i * y0; ## Draw circles for polar grid */ plline(x, y); endfor plcol0(2); for i = 0:11 theta = 30.0 * i; dx = cos(dtr * theta); dy = sin(dtr * theta); ## Draw radial spokes for polar grid */ pljoin(0.0, 0.0, dx, dy); text=sprintf("%d", round(theta)); ## Write labels for angle */ if (dx >= -0.00001) plptex(dx, dy, dx, dy, -0.15, text); else plptex(dx, dy, -dx, -dy, 1.15, text); endif endfor ## Draw the graph */ r = sin(dtr * (5 * zz')); x = x0 .* r; y = y0 .* r; plcol0(3); plline(x, y); plcol0(4); plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); plflush;#pleop(); endfunction ## Demonstration of contour plotting */ function plot5() XPTS= 35; YPTS= 46; XSPA= 2./(XPTS-1); YSPA= 2./(YPTS-1); tr=[XSPA, 0.0, -1.0, 0.0, YSPA, -1.0]'; ## this is builtin in plplot_octave ## It is based on the corresponding demo function of PLplot.## ## mypltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data) ## { ## *tx = tr(0) * x + tr(1) * y + tr(2); ## *ty = tr(3) * x + tr(4) * y + tr(5); ## } clevel =[-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.]'; mark = [1500]; space = [1500]; ## Set up function arrays */ for i = 0:XPTS-1 xx = (i - fix(XPTS / 2)) / fix(XPTS / 2); for j = 0:YPTS-1 yy = (j - fix(YPTS / 2)) / fix(YPTS / 2) - 1.0; z(i+1,j+1) = xx * xx - yy * yy; w(i+1,j+1) = 2 * xx * yy; endfor endfor plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, tr); plstyl(mark, space); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, tr); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); plflush;#pleop(); endfunction if (exist("file2","var")) if (exist("strm","var")) ix14c(file2,strm); else ix14c(file2); endif else ix14c() endif plplot-5.10.0+dfsg/examples/octave/x04c.m 644 1750 1750 1074012140615235 170040ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Illustration of logarithmic axes, and redefinition of window. ## this file defines several functions: 1; function ix04c ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); plfont(2); ## Make log plots using two different styles. */ plot1(0); plot1(1); plend1(); endfunction ## Log-linear plot. function plot1(type) global PL_LEGEND_LINE PL_LEGEND_SYMBOL PL_LEGEND_BACKGROUND PL_LEGEND_BOUNDING_BOX pladv(0); ## Set up data for log plot */ f0 = 1.0; i=0:100; freql = -2.0 + i / 20.0; freq = 10.0 .^ freql; ampl = 20.0 * log10(1.0 ./ sqrt(1.0 + (freq ./ f0).^ 2.)); phase = -(180.0 / 3.141592654) * atan(freq ./ f0); plvpor(0.15, 0.85, 0.1, 0.9); plwind(-2.0, 3.0, -80.0, 0.0); ## Try different axis and labelling styles. */ plcol0(1); switch (type) case 0 plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); case 1 plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); endswitch ## Plot ampl vs freq */ plcol0(2); plline(freql', ampl'); plcol0(2); plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade"); ## Put labels on */ plcol0(1); plmtex("b", 3.2, 0.5, 0.5, "Frequency"); plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter"); plcol0(2); plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)"); ## For the gridless case, put phase vs freq on same plot */ if (type == 0) plcol0(1); plwind(-2.0, 3.0, -100.0, 0.0); plbox("", 0.0, 0, "cmstv", 30.0, 3); plcol0(3); plline(freql', phase'); plstring(freql', phase', "*"); plcol0(3); plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)"); nlegend = 2; else nlegend = 1; endif ## Draw a legend. ## Set up legend arrays with the correct size, type. In octave this may ## be done by clearing the array (in case it was used before) and then ## writing the last element of the array with a placeholder of the right ## type. Note that for strings the right placeholder length doesn't ## matter. Octave keeps track of the longest string in each array and pads ## out all other members with blanks to that length if a subsequent string ## assignment for an array element exceeds that length. opt_array = 0; text_colors = 0; text = " "; line_colors = 0; line_styles = 0; line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; symbols = " "; opt_array(nlegend,1) = 0; text_colors(nlegend,1) = 0; text(nlegend,1:length(" ")) = " "; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; symbols(nlegend,1:length(" ")) = " "; ## Only specify legend data that are required according to the ## value of opt_array for that entry. ## Data for first legend entry. opt_array(1) = PL_LEGEND_LINE; text_colors(1) = 2; text(1,1:length("Amplitude")) = "Amplitude"; line_colors(1) = 2; line_styles(1) = 1; line_widths(1) = 1.; ## Data for second legend entry. if(nlegend > 1) opt_array(2) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); text_colors(2) = 3; text(2,1:length("Phase shift")) = "Phase shift"; line_colors(2) = 3; line_styles(2) = 1; line_widths(2) = 1.; symbol_colors(2) = 3; symbol_scales(2) = 1.; symbol_numbers(2) = 4; symbols(2,1:length("*")) = "*"; endif plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( bitor(PL_LEGEND_BACKGROUND, PL_LEGEND_BOUNDING_BOX), 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, [], [], [], [], line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); endfunction ix04c plplot-5.10.0+dfsg/examples/octave/p2.m 644 1750 1750 166611135341325 165350ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p2 global pl_automatic_replot; t = pl_automatic_replot; pl_automatic_replot = 0; legend("opaque",0) title("PLplot Example 2"); x=-pi/2:0.1:2*pi; y1=sinc(x); y2=sin(x).*cos(2*x); y3=x.*sin(x); plot(x, y1, ';sinc(x);', x, y2, 'b;sin(x)*cos(2*x);', x, y3, 'g;x*sin(x);'); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x01c.m 644 1750 1750 1174412102122103 167670ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. # Simple line plot and multiple windows demo. 1; function ix01c(strm) # Redirect output to file if required if (nargin == 0) strm = stdout; endif ## plplot initialization */ ## Parse and process command line arguments */ ## plMergeOpts(options, "x01c options", notes); ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Get version number, just for kicks */ ver=plgver'; fprintf(strm,"PLplot library version: %s\n", ver); ## Initialize plplot */ ## Divide page into 2x2 plots unless user overrides */ plstar(2,2); ## Set up the data */ ## Original case */ xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; ## Do a plot */ plot1(xscale, yscale, xoff, yoff); ## Set up the data */ xscale = 1.; yscale = 0.0014; yoff = 0.0185; ## Do a plot */ digmax = 5; plsyax(digmax, 0); plot1(xscale, yscale, xoff, yoff); plot2; plot3; ## Let's get some user input */ ## the "gin" structure is as follows: # ## int state; /* key or button mask */ ## int keysym; /* key selected */ ## int button; /* mouse button selected */ ## char string; /* translated string */ ## int pX, pY; /* absolute device coordinates of pointer */ ## float dX, dY; /* relative device coordinates of pointer */ ## float wX, wY; /* world coordinates of pointer */ if (!exist("file") || (exist("file") && isempty(file))) printf("\n\nYou are in Locate mode. Click any mouse button or press any key\n\ and the current cursor position will be printed.\n\ Please keep and off.\n\ Terminate locate mode with the key.\n\ Finish the plot with the or key or the 3d mouse button\n"); fflush(stdout); while(1) [status, mod, keysym, button, string, pX, pY, dX, dY, wX, wY, swin] = plGetCursor; if (keysym == hex2dec("0D")); break; endif if (status != 0) printf("wx=%.3f wy=%.3f dx=%.3f dy=%.3f c=0x%02x str=%s mb=%d mod=%0x swin=%d\n", ... wX, wY, dX, dY, keysym, string, button, mod, swin); else break; endif fflush(stdout); endwhile endif ## Don't forget to call plend1 to finish off! */ plend1(); endfunction function plot1(xscale, yscale, xoff, yoff) m=60; i=1:m; x = xoff + xscale * i / m; y = yoff + yscale * (x.^2.); xmin = min(x); xmax = max(x); ymin = min(y); ymax = max(y); i=0:5; xs = x(i * 10 + 4); ys = y(i * 10 + 4); ## Set up the viewport and window using PLENV. The range in X is ## * 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are ## * scaled separately (just = 0), and we just draw a labelled ## * box (axis = 0). plcol0(1); plenv(xmin, xmax, ymin, ymax, 0, 0); plcol0(2); pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); ## Plot the data points */ plcol0(4); plpoin(xs', ys', 9); ## Draw the line through the data */ plcol0(3); plline(x', y'); endfunction function plot2 ## Set up the viewport and window using PLENV. The range in X is -2.0 to ## * 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately ## * (just = 0), and we draw a box with axes (axis = 1). plcol0(1); plenv(-2.0, 10.0, -0.4, 1.2, 0, 1); plcol0(2); pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); ## Fill up the arrays */ i=0:99; x = (i - 19.0) / 6.0; y = sin(x) ./ x; y(x==0) = 1; ## Draw the line */ plcol0(3); plwidth(2); plline(x', y'); plwidth(1); endfunction function plot3 space0 = []; mark0 = []; space1 = [1500]; mark1 = [1500]; ## For the final graph we wish to override the default tick intervals, and ## * so do not use plenv . pladv(0); ## Use standard viewport, and define X range from 0 to 360 degrees, Y range ## * from -1.2 to 1.2. plvsta; plwind(0.0, 360.0, -1.2, 1.2); ## Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. */ plcol0(1); plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2); ## Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl(mark1, space1); plcol0(2); plbox("g", 30.0, 0, "g", 0.2, 0); plstyl(mark0, space0); plcol0(3); pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); i=0:100; x = 3.6 * i; y = sin(x * pi / 180.0); plcol0(4); plline(x', y'); endfunction if (exist("strm","var")) ix01c(strm) else ix01c() endif plplot-5.10.0+dfsg/examples/octave/x00c.m 644 1750 1750 300711722016102 167470ustar andrewandrew## $Id: x00c.m 12179 2012-02-24 23:24:50Z andrewross $ ## ## Simple demo of a 2D line plot. ## ## Copyright (C) 2011 Alan W. Irwin ## Copyright (C) 2012 Andrew Ross ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## ## function x00c NSIZE = 101; xmin = 0.; xmax = 1.; ymin = 0.; ymax = 100.; ## Prepare data to be plotted. x = (0:NSIZE-1) / (NSIZE-1); y = ymax*x.*x; ## Parse and process command line arguments ## plparseopts( &argc, argv, PL_PARSE_FULL ); ## Initialize plplot plinit(); ## Create a labelled box to hold the plot. plenv( xmin, xmax, ymin, ymax, 0, 0 ); pllab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ); ## Plot the data that was prepared above. plline( x', y' ); ## Close PLplot library plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/x05c.m 644 1750 1750 217611505745551 170020ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Draws a histogram from sample data. function x05c ## Initialize plplot */ plinit; NPTS=2047; ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Fill up data points */ delta = 2.0 * pi / NPTS; i=0:NPTS-1; data = sin(i * delta); plcol0(1); plhist(data', -1.1, 1.1, 44, 0); plcol0(2); pllab("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator"); plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/p17.m 644 1750 1750 241111511343031 166020ustar andrewandrew## Copyright (C) 2002-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p17(fg) global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; if(!exist('imread')) warning('Example p17 requires imread from octave-forge'); return; end title "Click and Drag button 1 to select"; xlabel "Button 2 to restart and button 3 to finish"; ylabel ""; [img, map]= imread (file_in_loadpath ("lena.img")); colormap(map); plimage (img); if (!nargin) [x1, y1, x2, y2] = plrb(1); % Prevent case where range is zero if (x1 == x2) x2 = x1+1; end if (y1 == y2) y2 = y1+1; end title "Lena"; xlabel ""; plimage (img, x1, x2, y1, y2); endif pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x23c.m 644 1750 1750 2065311543675237 170270ustar andrewandrew## $Id: x23c.m 11680 2011-03-27 17:57:51Z airwin $ ## ## Displays Greek letters and mathematically interesting Unicode ranges ## Copyright (C) 2005 Alan Irwin ## Copyright (C) 2005 Andrew Ross ## ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 1; ## Displays Greek letters and mathematically interesting Unicode ranges function ix23c(strm) # Redirect output to file if required if (nargin == 0) strm = stdout; endif Greek = [\ "#gA";"#gB";"#gG";"#gD";"#gE";"#gZ";"#gY";"#gH";"#gI";"#gK";"#gL";"#gM";\ "#gN";"#gC";"#gO";"#gP";"#gR";"#gS";"#gT";"#gU";"#gF";"#gX";"#gQ";"#gW";\ "#ga";"#gb";"#gg";"#gd";"#ge";"#gz";"#gy";"#gh";"#gi";"#gk";"#gl";"#gm";\ "#gn";"#gc";"#go";"#gp";"#gr";"#gs";"#gt";"#gu";"#gf";"#gx";"#gq";"#gw";\ ]; Type1 = [\ 0x0020,0x0021,0x0023,0x0025,0x0026,\ 0x0028,0x0029,0x002b,0x002c,0x002e,\ 0x002f,0x0030,0x0031,0x0032,0x0033,\ 0x0034,0x0035,0x0036,0x0037,0x0038,\ 0x0039,0x003a,0x003b,0x003c,0x003d,\ 0x003e,0x003f,0x005b,0x005d,0x005f,\ 0x007b,0x007c,0x007d,0x00a9,0x00ac,\ 0x00ae,0x00b0,0x00b1,0x00d7,0x00f7,\ 0x0192,0x0391,0x0392,0x0393,0x0394,\ 0x0395,0x0396,0x0397,0x0398,0x0399,\ 0x039a,0x039b,0x039c,0x039d,0x039e,\ 0x039f,0x03a0,0x03a1,0x03a3,0x03a4,\ 0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,\ 0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,\ 0x03b6,0x03b7,0x03b8,0x03b9,0x03ba,\ 0x03bb,0x03bc,0x03bd,0x03be,0x03bf,\ 0x03c0,0x03c1,0x03c2,0x03c3,0x03c4,\ 0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,\ 0x03d1,0x03d2,0x03d5,0x03d6,0x2022,\ 0x2026,0x2032,0x2033,0x203e,0x2044,\ 0x2111,0x2118,0x211c,0x2122,0x2126,\ 0x2135,0x2190,0x2191,0x2192,0x2193,\ 0x2194,0x21b5,0x21d0,0x21d1,0x21d2,\ 0x21d3,0x21d4,0x2200,0x2202,0x2203,\ 0x2205,0x2206,0x2207,0x2208,0x2209,\ 0x220b,0x220f,0x2211,0x2212,0x2215,\ 0x2217,0x221a,0x221d,0x221e,0x2220,\ 0x2227,0x2228,0x2229,0x222a,0x222b,\ 0x2234,0x223c,0x2245,0x2248,0x2260,\ 0x2261,0x2264,0x2265,0x2282,0x2283,\ 0x2284,0x2286,0x2287,0x2295,0x2297,\ 0x22a5,0x22c5,0x2320,0x2321,0x2329,\ 0x232a,0x25ca,0x2660,0x2663,0x2665,\ 0x2666,\ ]; title = {\ "#<0x10>PLplot Example 23 - Greek Letters";\ "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)";\ "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)";\ "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)";\ "#<0x10>PLplot Example 23 - Number Forms Unicode Block";\ "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)";\ "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)";\ "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"\ }; lo = [\ 0x0,\ 0x0,\ 0x40,\ 0x80,\ 0x2153,\ 0x2190,\ 0x21d0,\ 0x2200,\ 0x2240,\ 0x2280,\ 0x22c0,\ ]; hi = [\ 0x30,\ 0x40,\ 0x80,\ 0xA6,\ 0x2184,\ 0x21d0,\ 0x2200,\ 0x2240,\ 0x2280,\ 0x22c0,\ 0x2300,\ ]; nxcells = [\ 12,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ ]; nycells = [\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ 8,\ ]; ## non-zero values Must be consistent with nxcells and nycells. offset = [\ 0,\ 0,\ 64,\ 128,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ ]; ## 30 possible FCI values. FCI_COMBINATIONS = 30; fci = [\ 0x80000000,\ 0x80000001,\ 0x80000002,\ 0x80000003,\ 0x80000004,\ 0x80000010,\ 0x80000011,\ 0x80000012,\ 0x80000013,\ 0x80000014,\ 0x80000020,\ 0x80000021,\ 0x80000022,\ 0x80000023,\ 0x80000024,\ 0x80000100,\ 0x80000101,\ 0x80000102,\ 0x80000103,\ 0x80000104,\ 0x80000110,\ 0x80000111,\ 0x80000112,\ 0x80000113,\ 0x80000114,\ 0x80000120,\ 0x80000121,\ 0x80000122,\ 0x80000123,\ 0x80000124,\ ]; family = [\ "sans-serif";\ "serif";\ "monospace";\ "script";\ "symbol"\ ]; style = [\ "upright";\ "italic";\ "oblique"\ ]; weight = [\ "medium";\ "bold"\ ]; ## plparseopts(&argc, argv, PL_PARSE_FULL); plinit; for page=1:11 pladv(0); ## Set up viewport and window plvpor(0.02, 0.98, 0.02, 0.90); plwind(0.0, 1.0, 0.0, 1.0); [xmin, xmax, ymin, ymax] = plgspa; plschr(0., 0.8); ycharacter_scale = (1.0 - 0.0)/(ymax-ymin); ## Factor should be 0.5, but heuristically it turns out to be larger. [chardef, charht] = plgchr; yoffset = 1.0*charht*ycharacter_scale; ## Draw the grid using plbox plcol0(2); deltax = 1.0/nxcells(page); deltay = 1.0/nycells(page); plbox("bcg", deltax, 0, "bcg", deltay, 0); plcol0(15); length=hi(page)-lo(page); slice = 0; for j=nycells(page)-1:-1:0; y = (0.5+j)*deltay; for i=0:nxcells(page)-1; x = (0.5+i)*deltax; if (slice < length) if (page == 1) cmdString = sprintf("#%s",Greek(slice+1,:)); elseif ((page >= 2) && (page <= 4)) cmdString = sprintf("##[0x%.4x]",Type1(offset(page)+slice+1)); elseif (page >= 5) cmdString = sprintf("##[0x%.4x]",lo(page)+slice); end strlen = size(cmdString)(2); plptex(x,y+yoffset,1.,0.,0.5, cmdString(2:strlen)); plptex(x,y-yoffset,1.,0.,0.5, cmdString); end slice += 1; end end plschr(0., 1.0); ## Page title plmtex("t", 1.5, 0.5, 0.5, title(page,:)); end ## Demonstrate methods of getting the current fonts fci_old = plgfci(); [ifamily,istyle,iweight] = plgfont(); fprintf(strm,"For example 23 prior to page 12 the FCI is 0x%x\n",fci_old); fprintf(strm,"For example 23 prior to page 12 the font family, style and weight are %s %s %s\n",deblank(family(ifamily+1,:)), deblank(style(istyle+1,:)), deblank(weight(iweight+1,:))); for page=11:15 dy = 0.030; pladv(0); plvpor(0.02, 0.98, 0.02, 0.90); plwind(0.0, 1.0, 0.0, 1.0); plsfci(0); if (page == 11) plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with plsfci"); elseif (page == 12) plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with plsfont"); elseif (page == 13) plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct"); elseif(page == 14) plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs"); elseif(page == 15) plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ## constructs"); endif plschr(0., 0.75); for i = 0:FCI_COMBINATIONS-1 family_index = mod(i,5); style_index = mod(floor(i/5),3); weight_index = mod(floor((i/5)/3),2); if(page == 11) plsfci(fci(i+1)); string = sprintf("Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:))); elseif(page == 12) plsfont(family_index, style_index, weight_index); string = sprintf("Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:))); elseif(page == 13) string = sprintf("Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:)),fci(i+1)); elseif(page == 14) string = sprintf("Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:)),family_index,style_index,weight_index); elseif(page == 15) string = sprintf("Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>The quick brown fox jumps over the lazy dog",deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:)),deblank(family(family_index+1,:)),deblank(style(style_index+1,:)),deblank(weight(weight_index+1,:))); endif plptex (0., 1. - (i+0.5)*dy, 1., 0., 0., string); endfor plschr(0., 1.0); endfor ## Restore defaults plcol0(1); plend1; end if (exist("strm","var")) ix23c(strm); else ix23c(); endif plplot-5.10.0+dfsg/examples/octave/x19c.m 644 1750 1750 1017612221050115 170030ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. 1; ## Shows two views of the world map. function ix19c ## Parse and process command line arguments ## (void) plparseopts( &argc, argv, PL_PARSE_FULL ); ## Longitude (x) and latitude (y) miny = -70; maxy = 80; plinit(); ## Cartesian plots ## Most of world minx = -170; maxx = minx + 360; ## Setup a custom latitude and longitude-based scaling function. plslabelfunc( @geolocation_labeler, [] ); plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( [], "usaglobe", minx, maxx, miny, maxy ); ## The Americas minx = 190; maxx = 340; plcol0( 1 ); plenv( minx, maxx, miny, maxy, 1, 70 ); plmap( [], "usaglobe", minx, maxx, miny, maxy ); ## Clear the labeling function plslabelfunc( [], [] ); ## Polar, Northern hemisphere minx = 0; maxx = 360; plenv( -75., 75., -75., 75., 1, -1 ); plmap( @mapform19, "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( @mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); ## Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0; maxx = 360; plstransform( @map_transform, [] ); pllsty( 1 ); plenv( -75., 75., -75., 75., 1, -1 ); ## No need to set the map transform here as the global transform will be ## used. plmap( [], "globe", minx, maxx, miny, maxy ); pllsty( 2 ); plmeridians( [], 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); ## Show Baltimore, MD on the map plcol0( 2 ); plssym( 0.0, 2.0 ); x = -76.6125; y = 39.2902778; plpoin( x, y, 18 ); plssym( 0.0, 1.0 ); plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); ## For C, this is how the global transform is cleared plstransform( [], [] ); plend1(); endfunction function [xt, yt] = map_transform( x, y, data ) radius = 90.0 - y; xt = radius .* cos( x * pi / 180.0 ); yt = radius .* sin( x * pi / 180.0 ); endfunction ##-------------------------------------------------------------------------- ## mapform19 ## ## Defines specific coordinate transformation for example 19. ## Not to be confused with mapform in src/plmap.c. ## x[], y[] are the coordinates to be plotted. ##-------------------------------------------------------------------------- function [xp, yp] = mapform19( x, y ) [xp, yp] = map_transform( x, y, [] ); endfunction ## "Normalize" longitude values so that they always fall between -180.0 and ## 180.0 function norm = normalize_longitude( lon ) if ( lon >= -180.0 && lon <= 180.0 ) norm = lon; else times = floor( ( abs( lon ) + 180.0 ) / 360.0 ); if ( lon < 0.0 ) norm = lon + 360.0 * times; else norm = lon - 360.0 * times; endif endif endfunction ## A custom axis labeling function for longitudes and latitudes. function label = geolocation_labeler( axis, value, data ) global PL_X_AXIS PL_Y_AXIS if ( axis == PL_Y_AXIS ) label_val = value; if ( label_val > 0.0 ) direction_label = " N"; elseif ( label_val < 0.0 ) direction_label = " S"; else direction_label = "Eq"; endif elseif ( axis == PL_X_AXIS ) label_val = normalize_longitude( value ); if ( label_val > 0.0 ) direction_label = " E"; elseif ( label_val < 0.0 ) direction_label = " W"; else direction_label = ""; endif endif if ( axis == PL_Y_AXIS && value == 0.0 ) ## A special case for the equator label = sprintf( "%s", direction_label ); else label = sprintf( "%.0f%s", abs( label_val ), direction_label ); endif endfunction ix19c plplot-5.10.0+dfsg/examples/octave/p6.m 644 1750 1750 154311135341325 165330ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p6 [x y z] = rosenbrock; z = log(z); global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; as = autostyle; autostyle "off"; title("Contour example"); contour(x,y,z) autostyle(as); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/p21.m 644 1750 1750 343011135341325 166050ustar andrewandrew## Copyright (C) 2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p21 global GRID_CSA GRID_DTLI GRID_NNI GRID_NNIDW GRID_NNLI GRID_NNAIDW ##ocmap = colormap; colormap(bgr); global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; gx = 30; gy = 40; n = 600; alg = ["Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted"]; opt = [0, 0, -1, 50, 1.001, 0]; x = rand(n,1)*6-3; y = rand(n,1)*6-3; z = 3 * (1-x).^2 .* exp(-(x.^2) - (y+1).^2) - ... 10 * (x/5 - x.^3 - y.^5) .* exp(-x.^2 - y.^2)- ... 1/3 * exp(-(x+1).^2 - y.^2); xg = linspace (-2.5, 3, gx)'; yg = linspace (-3, 2.5, gy)'; multiplot(3,2); j = 1; for i = [GRID_CSA GRID_DTLI GRID_NNI GRID_NNIDW GRID_NNLI GRID_NNAIDW] pladv(j++); zg = griddata(x, y, z, xg, yg, i, opt(i)); ## zg(isnan(zg)) = 0; old_dofi = warning("query","Octave:fortran-indexing"); warning("off","Octave:fortran-indexing"); zg(isnan(zg)) = 0; warning(old_dofi.state,"Octave:fortran-indexing"); title(alg(i,:)); meshc(xg, yg, zg'); endfor pl_automatic_replot = t; ##colormap(ocmap); endfunction plplot-5.10.0+dfsg/examples/octave/x12c.m 644 1750 1750 371211505771466 170010ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Does a simple bar chart, using color fill. If color fill is ## unavailable, pattern fill is used instead (automatic). 1; function ix12c ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); pladv(0); plvsta(); plwind(1980.0, 1990.0, 0.0, 35.0); plbox("bc", 1.0, 0, "bcnv", 10.0, 0); plcol0(2); pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12"); y0 = [5; 15; 12; 24; 28;30; 20; 8; 12; 3]; pos = [0.0; 0.25; 0.5; 0.75; 1.0]; red = [0.0; 0.25; 0.5; 1.00; 1.0]; green = [1.0; 0.50; 0.5; 0.50; 1.0]; blue = [1.0; 1.0; 0.5; 0.25; 0.0]; rev = [0; 0; 0; 0; 0]; plscmap1l(1,pos,red,green,blue,rev); for i=0:9 ##plcol0(i + 1); plcol1(i/9.0); plpsty(0); plfbox((1980. + i), y0(i+1)); string=sprintf("%.0f", y0(i+1)); plptex((1980. + i + .5), (y0(i+1) + 1.), 1.0, 0.0, .5, string); string=sprintf("%d", 1980 + i); plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string); endfor plend1(); endfunction function plfbox(x0, y0) x(1) = x0; y(1) = 0.; x(2) = x0; y(2) = y0; x(3) = x0 + 1.; y(3) = y0; x(4) = x0 + 1.; y(4) = 0.; plfill(x', y'); plcol0(1); pllsty(1); plline(x', y'); endfunction ix12c plplot-5.10.0+dfsg/examples/octave/x22c.m 644 1750 1750 1331412245372171 170110ustar andrewandrew## Copyright (C) 2004-2006 Andrew Ross ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. # Simple line plot and multiple windows demo. 1; global xmax; function ix22c ## Parse and process command line arguments */ ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit; ## Set up the data */ ## Original case */ circulation; narr = 6; fill = 0; arrow_x = [-0.5 0.5 0.3 0.5 0.3 0.5]; arrow_y = [0.0 0.0 0.2 0.0 -0.2 0.0]; arrow2_x = [-0.5 0.3 0.3 0.5 0.3 0.3]; arrow2_y = [0.0 0.0 0.2 0.0 -0.2 0.0]; ## Set arrow style using arrow_x and arrow_y then ## plot using these arrows. plsvect(arrow_x', arrow_y', fill); constriction(1); ## Set arrow style using arrow2_x and arrow2_y then ## plot using these filled arrows. */ fill = 1; plsvect(arrow2_x', arrow2_y', fill); constriction(2); constriction2; plsvect([],[],0); potential; ## Don't forget to call plend1 to finish off! */ plend1(); endfunction function circulation nx = 20; ny = 20; dx = 1.0; dy = 1.0; xmin = -nx/2*dx; xmax = nx/2*dx; ymin = -ny/2*dy; ymax = ny/2*dy; xg = [xmin+dx/2:dx:xmax-dx/2]'*ones(1,ny); yg = ones(nx,1)*[ymin+dy/2:dy:ymax-dy/2]; u = yg; v = -xg; ## Plot vectors with default arrows plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - circulation"); plcol0(2); plvect2(u,v,0.0,xg,yg); plcol0(1); end ## Vector plot of flow through a constricted pipe function constriction( astyle ) nx = 20; ny = 20; dx = 1.0; dy = 1.0; xmin = -nx/2*dx; xmax = nx/2*dx; ymin = -ny/2*dy; ymax = ny/2*dy; Q = 2.0; xg = [xmin+dx/2:dx:xmax-dx/2]'*ones(1,ny); yg = ones(nx,1)*[ymin+dy/2:dy:ymax-dy/2]; b = ymax/4.0.*(3-cos(pi*xg/xmax)); dbdx = ymax/4.0.*sin(pi*xg/xmax)*pi/xmax.*yg./b; u = Q*ymax./b.*(abs(yg)1.0E-5 || abs(wy-0.5*(ymin+ymax))>1.0E-5) fputs(stderr,"plcalc_world test failed\n"); status = 1; endif ## Retrieve and print the name of the output file (if any) ## This goes to stderr not stdout since it will vary between tests and ## we want stdout to be identical for compare test. fnam = plgfnam(); if (fnam(1) == "\0") fputs(strm,"No output file name is set\n"); else fputs(strm,"Output file name read\n"); endif fprintf(stderr,"Output file name is %s\n",fnam); ## Set and get the number of digits used to display axis labels ## Note digits is currently ignored in pls[xyz]ax and ## therefore it does not make sense to test the returned ## value. plsxax(3,0); [digmax,digits] = plgxax(); fprintf(strm,"x axis parameters: digmax, digits = %d %d\n", digmax, digits); if (digmax != 3) fputs(stderr,"plgxax test failed\n"); status = 1; return; endif plsyax(4,0); [digmax,digits] = plgyax(); fprintf(strm,"y axis parameters: digmax, digits = %d %d\n", digmax, digits); if (digmax != 4) fputs(stderr,"plgyax test failed\n"); status = 1; endif plszax(5,0); [digmax,digits] = plgzax(); fprintf(strm,"z axis parameters: digmax, digits = %d %d\n", digmax, digits); if (digmax != 5) fputs(stderr,"plgzax test failed\n"); status = 1; endif plsdidev(0.05, PL_NOTSET, 0.1, 0.2); [mar, aspect, jx, jy] = plgdidev(); fprintf(strm,"device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n" , mar, aspect, jx, jy); if (mar != 0.05 || jx != 0.1 || jy != 0.2) fputs(stderr,"plgdidev test failed\n"); status = 1; endif plsdiori(1.0); ori = plgdiori(); fprintf(strm,"ori parameter = %f\n", ori); if (ori != 1.0) fputs(stderr,"plgdiori test failed\n"); status = 1; endif plsdiplt(0.1, 0.2, 0.9, 0.8); [xmin, ymin, xmax, ymax] = plgdiplt(); fprintf(strm,"plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", xmin, ymin, xmax, ymax); if (xmin != 0.1 || xmax != 0.9 || ymin != 0.2 || ymax != 0.8) fputs(stderr,"plgdiplt test failed\n"); status = 1; endif plsdiplz(0.1, 0.1, 0.9, 0.9); [zxmin, zymin, zxmax, zymax] = plgdiplt(); fprintf(strm,"zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", zxmin, zymin, zxmax, zymax); if ( abs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0E-5 || abs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0E-5 || abs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0E-5 || abs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 ) fputs(stderr,"plsdiplz test failed\n"); status = 1; endif plscolbg(10,20,30); [r, g, b] = plgcolbg(); fprintf(strm,"background colour parameters: r, g, b = %d %d %d\n", r, g, b); if (r != 10 || g != 20 || b != 30) fputs(stderr,"plgcolbg test failed\n"); status = 1; endif plscolbga(20,30,40,0.5); [r, g, b, a] = plgcolbga(); fprintf(strm,"background/transparency colour parameters: r, g, b, a = %d %d %d %f\n", r, g, b, a); if (r != 20 || g != 30 || b != 40 || a != 0.5) fputs(stderr,"plgcolbga test failed\n"); status = 1; endif plend(); endfunction if (exist("strm","var")) ix31c(strm); else ix31c(); endif plplot-5.10.0+dfsg/examples/octave/p7.m 644 1750 1750 170411135341325 165330ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p7 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; [x y z]=rosenbrock;z=log(z); title("Shade example"); colormap('default') shade(x,y,z,15) pause(1) colormap(pink); axis([0.5 1.2 0 1.3]); hold on; shade(x,y,z,15,3); pause(1) hold off shade(x,y,z,15,3); axis; pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x20c.m 644 1750 1750 1704211505771466 170210ustar andrewandrew## $Id: x20c.m 11391 2010-12-27 02:00:22Z airwin $ ## ## plimage demo ## ## 1; ##dbg = 0; ##nosombrero = 0; ##nointeractive = 1; ##f_name = ""; function ix20c xdim = 260; ydim = 220; ## Bugs in plimage(): ## -at high magnifications, the left and right edge are ragged, try ## ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 ## ## Bugs in x20c.c: ## -if the window is resized after a selection is made on "lena", when ## making a new selection the old one will re-appear. ## Parse and process command line arguments ## plMergeOpts(options, "x20c options", NULL); ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit; ## view image border pixels if (exist("dbg","var")) plenv(1., xdim, 1., ydim, 1, 1); ## no plot box ## build a one pixel square border, for diagnostics z = zeros(xdim,ydim); z(:,ydim) = 1; ## right z(:,1) = 1; ## left z(0,:) = 1; ## top z(xdim,:) = 1; ## bottom pllab("...around a blue square."," ","A red border should appear..."); pplimage(z, 1.0, xdim, 1.0, ydim, 0.0, 0.0, 1.0, xdim, 1.0, ydim); endif ## sombrero-like demo if (!exist("nosombrero","var")) plcol0(2); ## draw a yellow plot box, useful for diagnostics! plenv(0.0, 2.0*pi, 0, 3.0*pi, 1, -1); i=0:xdim-1; x = i*2.0*pi/(xdim-1); i=0:ydim-1; y = i*3.0*pi/(ydim-1); for i=1:xdim r(i,:) = sqrt(x(i)*x(i)+y.*y)+1e-3; z(i,:) = sin(r(i,:)) ./ r(i,:); endfor pllab("No, an amplitude clipped \"sombrero\"", "", "Saturn?"); plptex(2., 2., 3., 4., 0., "Transparent image"); pplimage(z, 0., 2.*pi, 0, 3.*pi, 0.05, 1., 0., 2.*pi, 0, 3.*pi); ## save the plot if (exist("f_name","var")) save_plot(f_name); endif endif ## read Lena image if (exist("lena.pgm","file")) [ret, img, width, height, num_col] = read_img("lena.pgm"); elseif (exist("../lena.pgm","file")) [ret, img, width, height, num_col] = read_img("../lena.pgm"); else printf("Error: No such file\n"); plend1; return; endif ## set gray colormap gray_cmap(num_col); ## display Lena plenv(1., width, 1., height, 1, -1); if (!exist("nointeractive","var")) pllab("Set and drag Button 1 to (re)set selection, Button 2 to finish."," ","Lena..."); else pllab(""," ","Lena..."); endif pplimage(img, 1.0, width, 1.0, height, 0.0, 0.0, 1.0, width, 1.0, height); ## selection/expansion demo if (!exist("nointeractive","var")) [ret, xi, xe, yi, ye] = get_clip; ## get selection rectangle if (ret == 1) plend1; return; endif ## ## I'm unable to continue, clearing the plot and advancing to the next ## one, without hiting the enter key, or pressing the button... help! ## ## Forcing the xwin driver to leave locate mode and destroying the ## xhairs (in GetCursorCmd()) solves some problems, but I still have ## to press the enter key or press Button-2 to go to next plot, even ## if a pladv() is not present! Using plbop() solves the problem, but ## it shouldn't be needed! ## ## plbop(); ## ## plspause(0), pladv(0), plspause(1), also works, ## but the above question remains. ## With this approach, the previous pause state is lost, ## as there is no API call to get its current state. ## plspause(0); pladv(0); ## display selection only pplimage(img, 1.0, width, 1.0, height, 0.0, 0.0, xi, xe, ye, yi); plspause(1); ## zoom in selection plenv(xi, xe, ye, yi, 1, -1); pplimage(img, 1.0, width, 1.0, height, 0.0, 0.0, xi, xe, ye, yi); endif ## Base the dynamic range on the image contents. img_max = max(max(img)); img_min = min(min(img)); plcol0(2) plenv(0., width, 0., height, 1, -1) pllab("", "", "Reduced dynamic range image example") plimagefr(img, 0., width, 0., height, 0., 0., img_min + img_max * 0.25, img_max - img_max * 0.25) ## Draw a distorted version of the original image, showing its ## full dynamic range. plenv(0., width, 0., height, 1, -1) pllab("", "", "Distorted image example") ## Populate the 2-d grids used for the distortion ## NB grids must be 1 larger in each dimension than the image ## since the coordinates are for the corner of each pixel. x0 = 0.5*width; y0 = 0.5*height; dy = 0.5*height; stretch = 0.5; ## The following can cause a crash on octave 2.1. #xg = [0:width]'*ones(1,height+1); #yg = ones(width+1,1)*[0:height]; ## Using repmat seems to work round the bug xg = repmat([0:width]',1,height+1); yg = repmat([0:height],width+1,1); xg = x0 + (x0-xg).*(1-stretch*cos((yg-y0)/dy*pi*0.5)); plimagefr2(img, 0., width, 0., height, 0., 0., img_min, img_max, xg, yg); plend1; endfunction ## read image from file in binary ppm format function [status, img_f, width, height, num_col] = read_img(fname) ## naive grayscale binary ppm reading. if ((fp = fopen(fname,"rb")) == -1) status = 1; img_f = []; width = 0; height = 0; num_col = 0; return; endif ver = fgetl(fp); ## version if (strcmp(ver, "P5") == 0) ## I only understand this! status = 1; img_f = []; width = 0; height = 0; num_col = 0; return; endif while((i=fread(fp,1,"char")) == "#") fgetl(fp); ## comments endwhile fseek(fp,-1,SEEK_CUR); str = fgetl(fp); [width,height] = sscanf(str,"%d %d","C"); ## width and height str = fgetl(fp); num_col = sscanf(str,"%d","C"); ## num colors img = fread(fp, [width,height],"uchar"); fclose(fp); img_f = fliplr(img); status = 0; endfunction ## save plot function save_plot(fname) cur_strm = plgstrm; ## get current stream new_strm = plmkstrm; ## create a new one plsdev("psc"); ## new device type. Use a known existing driver plsfnam(fname); ## file name plcpstrm(cur_strm, 0); ## copy old stream parameters to new stream plreplot; ## do the save plend1; ## close new device plsstrm(cur_strm); ## and return to previous one endfunction ## get selection square interactively function [ret, xi, xe, yi, ye] = get_clip start = 0; sx = zeros(5,1); sy = zeros(5,1); st = plxormod(1); ## enter xor mode to draw a selection rectangle xi = 200.; xe = 330.; yi = 280.; ye = 220.; keysym = 0; if (st) ## driver has xormod capability, continue while(1) st = plxormod(0); [retval, state, keysym, button, string, pX, pY, dX, dY, wX, wY, subwin] = plGetCursor(); st = plxormod(1); if (button == 1) xi = wX; yi = wY; if (start) plline(sx, sy); ## clear previous rectangle endif start = 0; sx(1) = xi; sy(1) = yi; sx(5) = xi; sy(5) = yi; endif if (state && 0x100) xe = wX; ye = wY; if (start) plline(sx, sy); ## clear previous rectangle endif start = 1; sx(3) = xe; sy(3) = ye; sx(2) = xe; sy(2) = yi; sx(4) = xi; sy(4) = ye; plline(sx, sy); ## draw new rectangle endif ## Can't use PLK_Return here since PLK_ constant are not ## currently defined for the octave bindings if (button == 3 || keysym == 0x0D || keysym == 'Q') if (start) plline(sx, sy); ## clear previous rectangle endif break; endif endwhile st = plxormod(0); ## leave xor mod endif if (xe < xi) t=xi; xi=xe; xe=t; endif if (yi < ye) t=yi; yi=ye; ye=t; endif ret = (keysym == 'Q'); endfunction ## set gray colormap function gray_cmap(num_col) r(1) = g(1) = b(1) = 0.0; r(2) = g(2) = b(2) = 1.0; pos(1) = 0.0; pos(2) = 1.0; plscmap1n(num_col); plscmap1l(1, pos', r', g', b', zeros(2,1)); endfunction ix20c; plplot-5.10.0+dfsg/examples/octave/p11.m 644 1750 1750 261611135341325 166110ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p11 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; title("Stripchart demo 1 (sliding)"); xlabel("Time"); ylabel("Sliding"); legend("on", 0.75,0.75); id1 = stripc(0, 10, 0.3, -1, 1, "sin", "cos", "sin+noi", "cos+noi", 0, 0); y1 = 0.0; for t = 0:0.1:5*pi for i=1:1000;endfor # small delay noise = randn; y1 = sin(t); y2 = cos(t); y3 = 1+y1 + noise/3; y4 = -1+y2 + noise/4; ## there is no need for all pens to have the same number of points ## or beeing equally time spaced. stripc_add(id1, 0, t, y1); stripc_add(id1, 1, t, y2); stripc_add(id1, 2, t, y3); stripc_add(id1, 3, t, y4); pleop; endfor ## Destroy strip chart and it's memory */ stripc_del(id1); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x24c.m 644 1750 1750 514111543675237 170030ustar andrewandrew## $Id: x24c.m 11680 2011-03-27 17:57:51Z airwin $ ## ## Unicode Pace Flag ## ## Copyright (C) 2005 Rafael Laboissiere ## ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## ## ## For Debian, the required font packages are the following: ## ttf-arphic-bkai00mp ## ttf-freefont ## ttf-devanagari-fonts ## ttf-unfonts ## ttf-bengali-fonts ## ## For the latest Ubuntu systems lohit_hi.ttf has been moved to the ## ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you ## will have to use this package instead and update the font path. 1; function ix24c red = [240; 204; 204; 204; 0; 39; 125]; green = [240; 0; 125; 204; 204; 80; 0]; blue = [240; 0; 0; 0; 0; 204; 125]; px = [0.0; 0.0; 1.0; 1.0]; py = [0.0; 0.25; 0.25; 0.0]; sx = [ 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 ]; sy = [ 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 ]; ## Taken from http://www.columbia.edu/~fdc/pace/ peace = [ ## Mandarin "#<0x00>和平"; ## Hindi "#<0x20>शांति"; ## English "#<0x10>Peace"; ## Hebrew "#<0x10>שלום"; ## Russian "#<0x10>Мир"; ## German "#<0x10>Friede"; ## Korean "#<0x30>평화"; ## French "#<0x10>Paix"; ## Spanish "#<0x10>Paz"; ## Arabic "#<0x10>ﺳﻼم"; ## Turkish "#<0x10>Barış"; ## Kurdish "#<0x10>Hasîtî" ]; ## plparseopts (&argc, argv, PL_PARSE_FULL); plinit; pladv (0); plvpor (0.0, 1.0, 0.0, 1.0); plwind (0.0, 1.0, 0.0, 1.0); plcol0 (0); plbox ("", 1.0, 0, "", 1.0, 0); plscmap0n (7); plscmap0 (red, green, blue); plschr (0, 4.0); plfont (1); for i = 1:4 plcol0 (i); plfill (px, py); py += 1.0 / 4.0; endfor plcol0 (0); for i=1:12 plptex (sx (i), sy (i), 1.0, 0.0, 0.5, deblank(peace (i,:))); endfor plend1; end ix24c plplot-5.10.0+dfsg/examples/octave/x27c.m 644 1750 1750 1153211616626173 170230ustar andrewandrew## $Id: x27c.m 11857 2011-08-04 23:34:19Z andrewross $ ## ## Drawing "spirograph" curves - epitrochoids, cycolids, roulettes ## ## Copyright (C) 2007 Arjen Markus ## Copyright (C) 2008 Andrew Ross ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 1; function ix27c ##--------------------------------------------------------------------------*\ ## Generates two kinds of plots: ## - construction of a cycloid (animated) ## - series of epitrochoids and hypotrochoids ##--------------------------------------------------------------------------*/ ## R, r, p, N ## R and r should be integers to give correct termination of the ## angle loop using gcd. ## N.B. N is just a place holder since it is no longer used ## (because we now have proper termination of the angle loop). params = [ 21.0, 7.0, 7.0, 3.0; ## Deltoid 21.0, 7.0, 10.0, 3.0; 21.0, -7.0, 10.0, 3.0; 20.0, 3.0, 7.0, 20.0; 20.0, 3.0, 10.0, 20.0; 20.0, -3.0, 10.0, 20.0; 20.0, 13.0, 7.0, 20.0; 20.0, 13.0, 20.0, 20.0; 20.0,-13.0, 20.0, 20.0]; ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit(); ## Illustrate the construction of a cycloid cycloid(); ## Loop over the various curves ## First an overview, then all curves one by one plssub(3, 3); ## Three by three window fill = 0; for i = 1:9 pladv(0); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params(i,:), fill ); endfor pladv(0); plssub(1, 1); ## One window per curve for i=1:9 pladv(0); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params(i,:), fill ); endfor ## Fill the curves. fill = 1; pladv( 0 ); plssub( 1, 1 ); ## One window per curve for i=1:9 pladv(0); plvpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params(i,:), fill ); endfor ## Finally, an example to test out plarc capabilities arcs(); ## Don't forget to call plend() to finish off! plend1(); end ##------------------------------------------------------------------------ ## Calculate greatest common divisor following pseudo-code for the ## Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm function [value] = gcd (a, b) a = floor(abs(a)); b = floor(abs(b)); while(b!=0) t = b; b = mod(a,b); a = t; endwhile value = a; end ## =============================================================== function cycloid() ## TODO endfunction ## =============================================================== function spiro(params, fill) NPNT=2000; ## Fill the coordinates ## Proper termination of the angle loop very near the beginning ## point, see ## http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = floor(abs(params(2))/gcd(params(1), params(2))); steps = floor(NPNT/windings); dphi = 2.0*pi/steps; i = (0:windings*steps)'; phi = i*dphi; phiw = (params(1)-params(2))/params(2)*phi; xcoord = (params(1)-params(2))*cos(phi) + params(3)*cos(phiw); ycoord = (params(1)-params(2))*sin(phi) - params(3)*sin(phiw); xmin = min(xcoord); xmax = max(xcoord); ymin = min(ycoord); ymax = max(ycoord); xrange_adjust = 0.15 * (xmax - xmin); xmin -= xrange_adjust; xmax += xrange_adjust; yrange_adjust = 0.15 * (ymax - ymin); ymin -= yrange_adjust; ymax += yrange_adjust; plwind( xmin, xmax, ymin, ymax ); plcol0(1); if ( fill ) plfill( xcoord, ycoord ); else plline( xcoord, ycoord ); endif endfunction function arcs NSEG = 8; theta = 0.0; dtheta = 360.0 / NSEG; plenv( -10.0, 10.0, -10.0, 10.0, 1, 0 ); ## Plot segments of circle in different colors for i = 0:NSEG-1 plcol0( mod(i,2) + 1 ); plarc(0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, 0); theta = theta + dtheta; endfor ## Draw several filled ellipses inside the circle at different ## angles. a = 3.0; b = a * tan( (dtheta/180.0*pi)/2.0 ); theta = dtheta/2.0; for i = 0:NSEG-1 plcol0( 2 - mod(i,2) ); plarc( a*cos(theta/180.0*pi), a*sin(theta/180.0*pi), a, b, 0.0, 360.0, theta, 1); theta = theta + dtheta; endfor endfunction ix27c plplot-5.10.0+dfsg/examples/octave/x15c.m 644 1750 1750 1421112140615235 170030ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## Copyright (C) 2008 Andrew Ross ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Does a variety of shade plots. 1; function ix15c XPTS= 35; ## Data points in x */ YPTS= 46; ## Datat points in y */ global tr = [2/(XPTS-1); 0.0; -1.0; 0.0; 2/(YPTS-1); -1.0]; ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Set up color map 0 */ ## plscmap0n(3); ## Set up color map 1 */ cmap1_init2(); ## Initialize plplot */ plinit(); ## Set up data array */ for i = 0:XPTS-1; xx = (i - fix(XPTS / 2)) / fix(XPTS / 2); for j = 0:YPTS-1; yy = (j - fix(YPTS / 2)) / fix(YPTS / 2) - 1.0; z(i+1,j+1) = xx*xx - yy*yy + (xx - yy)/(xx*xx+yy*yy + 0.1); endfor endfor zmin=min(min(z)); zmax=max(max(z)); plot1(z,zmin,zmax); plot2(z,zmin,zmax); plot3(); plend1(); endfunction ## Initializes color map 1 in HLS space. function cmap1_init1 i(1) = 0; ### left boundary */ i(2) = 0.45; ### just before center */ i(3) = 0.55; ### just after center */ i(4) = 1; ### right boundary */ h(1) = 260; ### hue -- low: blue-violet */ h(2) = 260; ### only change as we go over vertex */ h(3) = 20; ### hue -- high: red */ h(4) = 20; ### keep fixed */ #if 1 l(1) = 0.5; ### lightness -- low */ l(2) = 0.0; ### lightness -- center */ l(3) = 0.0; ### lightness -- center */ l(4) = 0.5; ### lightness -- high */ #else plscolbg(255,255,255); l(1) = 0.5; ### lightness -- low */ l(2) = 1.0; ### lightness -- center */ l(3) = 1.0; ### lightness -- center */ l(4) = 0.5; ### lightness -- high */ #endif s(1) = 1; ### maximum saturation */ s(2) = 1; ### maximum saturation */ s(3) = 1; ### maximum saturation */ s(4) = 1; ### maximum saturation */ plscmap1l(0, i', h', l', s', zeros(4,1)); endfunction ### Initializes color map 1 in HLS space. function cmap1_init2() i(1) = 0; ### left boundary */ i(2) = 0.45; ### just before center */ i(3) = 0.55; ### just after center */ i(4) = 1; ### right boundary */ h(1) = 260; ### hue -- low: blue-violet */ h(2) = 260; ### only change as we go over vertex */ h(3) = 20; ### hue -- high: red */ h(4) = 20; ### keep fixed */ if 1 l(1) = 0.6; ### lightness -- low */ l(2) = 0.0; ### lightness -- center */ l(3) = 0.0; ### lightness -- center */ l(4) = 0.6; ### lightness -- high */ else plscolbg(255,255,255); l(1) = 0.5; ### lightness -- low */ l(2) = 1.0; ### lightness -- center */ l(3) = 1.0; ### lightness -- center */ l(4) = 0.5; ### lightness -- high */ endif s(1) = 1; ### saturation -- low */ s(2) = 0.5; ### saturation -- center */ s(3) = 0.5; ### saturation -- center */ s(4) = 1; ### saturation -- high */ plscmap1l(0, i', h', l', s', [ 0 0 0 0]'); endfunction ### Illustrates a single shaded region. function plot1(z,zmin,zmax) global tr sh_cmap = 0; min_color = 0; min_width = 0.; max_color = 0; max_width = 0.; pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); ### Plot using identity transform */ shade_min = zmin + (zmax-zmin)*0.4; shade_max = zmin + (zmax-zmin)*0.6; sh_color = 7; sh_width = 2.; min_color = 9; max_color = 2; min_width = 2.; max_width = 2.; plpsty(8); plshade(z, 0, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1, tr); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon flux"); endfunction ### Illustrates multiple adjacent shaded regions, using different fill function plot2(z,zmin,zmax) global tr sh_cmap = 0; min_color = 0; min_width = 0.; max_color = 0; max_width = 0.; nlin = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]; inc = [450, 0; -450, 0; 0, 0; 900, 0; 300, 0; 450,-450; 0, 900; 0, 450; 450, -450; 0, 900]; del = [2000, 2000; 2000, 2000; 2000, 2000; 2000, 2000; 2000, 2000; 2000, 2000; 2000, 2000; 2000, 2000; 4000, 4000; 4000, 2000 ]; pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); ## Plot using identity transform */ for i = 0:9 shade_min = zmin + (zmax - zmin) * i / 10.0; shade_max = zmin + (zmax - zmin) * (i +1) / 10.0; sh_color = i+6; sh_width = 2.; n = nlin(i+1); plpat(inc(i+1,1:n)',del(i+1,1:n)'); plshade(z, 0, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width,1,tr); endfor plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon flux"); endfunction ## Illustrates shaded regions in 3d, using a different fill pattern for ## each region. function plot3 xx = [ -1.0, 1.0, 1.0, -1.0, -1.0; -1.0, 1.0, 1.0, -1.0, -1.0 ]; yy = [ 1.0, 1.0, 0.0, 0.0, 1.0; -1.0, -1.0, 0.0, 0.0, -1.0 ]; zz = [ 0.0, 0.0, 1.0, 1.0, 0.0; 0.0, 0.0, 1.0, 1.0, 0.0 ]; pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plw3d(1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40); ## Plot using identity transform plcol0(1); plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); plcol0(2); pllab("","","3-d polygon filling"); plcol0(3); plpsty(1); plline3(xx(1,:)', yy(1,:)', zz(1,:)'); plfill3(xx(1,1:4)', yy(1,1:4)', zz(1,1:4)'); plpsty(2); plline3(xx(2,:)', yy(2,:)', zz(2,:)'); plfill3(xx(2,1:4)', yy(2,1:4)', zz(2,1:4)'); endfunction ix15c plplot-5.10.0+dfsg/examples/octave/p12.m 644 1750 1750 177111366136213 166170ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p12(fg) global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; title("War Game"); legend("off"); x=0:0.1:4; plot(x,exp(x)); text(1,20,"Click Here -> + "); if (!nargin) [x y]=ginput(1); if (round(x) != 2 || round(y) != 20) text(x,y,"You missed!") else text(x,y,"ouch! Gently!") endif endif legend("on"); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/p19.m 644 1750 1750 416711135341325 166240ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p19 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; f0=figure; multiplot(1,2); title("Stripchard demo 1 (sliding)"); xlabel("Time"); ylabel("Sliding"); legend("on", 0.75,0.75); id1 = stripc(0, 10, 0.3, -1, 1, "sum", "sin", "sin*noi", "sin+noi", 0, 0); subwindow(1,2); title("Stripchard demo 1 (accumulating)"); xlabel("Time"); ylabel("Accum"); legend("on", 0.75,0.75); id2 = stripc(0, 10, 0.3, -1, 1, "sum", "sin", "sin*noi", "sin+noi", 1, 0); subwindow(1,1); f1=figure(free_fig); oneplot; title("Stripchard demo 2 (acumulating)"); xlabel("Time"); ylabel("Acumulating"); legend("on", 0, 1); id3 = stripc(0, 10, 0.3, -1, 1, "sin+noise", "", "", "", 1, 0); figure(f0); y1 = 0.0; for t = 0:0.1:10*pi noise = randn; y1 = y1 + noise/10; y2 = sin(t); y3 = y2 * noise/3; y4 = y2 + noise/4; ## there is no need for all pens to have the same number of points ## or beeing equally time spaced. if (rem(t,2)) stripc_add(id1, 0, t, y1); endif if rem(t,3) stripc_add(id1, 1, t, y2); endif if rem(t,4) subwindow(1,2); stripc_add(id2, 2, t, y3); subwindow(1,1); endif if rem(t,5) figure(f1); stripc_add(id3, 0, t, y4); plflush;pleop; figure(f0); endif plflush;pleop; endfor ## Destroy strip chart and it's memory */ stripc_del(id1); stripc_del(id2); stripc_del(id3); closefig(f1); oneplot; pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/p15.m 644 1750 1750 200011135341325 166000ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p15 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; title "Lighted and shaded surface"; xlabel ""; ylabel ""; [x, y, z] = rosenbrock; z = log(z); set_view(30, -60); colormap(gray); shading("flat"); surfl(x, y, z); pause(1); set_view(50, 40); colormap(bgr); shading("faceted"); surf(x, y, z); colormap('default'); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x26c.m 644 1750 1750 1717612140615235 170220ustar andrewandrew## -*- coding: utf-8; -*- ## ## $Id: x26c.m 12330 2013-05-03 02:02:05Z airwin $ ## ## Multi-lingual version of the first page of example 4. ## ## Copyright (C) 2006 Alan Irwin ## Copyright (C) 2006 Andrew Ross ## ## Thanks to the following for providing translated strings for this example: ## Valery Pipin (Russian) ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## ## ## This example designed just for devices (e.g., psttfc and the ## cairo-related devices) that use the pango and fontconfig libraries. The ## best choice of glyph is selected by fontconfig and automatically rendered ## by pango in way that is sensitive to complex text layout (CTL) language ## issues for each unicode character in this example. Of course, you must ## have the appropriate TrueType fonts installed to have access to all the ## required glyphs. ## ## Translation instructions: The strings to be translated are given by ## x_label, y_label, alty_label, title_label, and line_label below. The ## encoding used must be UTF-8. ## ## The following strings to be translated involve some scientific/mathematical ## jargon which is now discussed further to help translators. ## ## (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . ## (2) degrees is an angular measure, see ## http://en.wikipedia.org/wiki/Degree_(angle) . ## (3) low-pass filter is one that transmits (passes) low frequencies. ## (4) pole is in the mathematical sense, see ## http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" ## means a particular mathematical transformation of the filter function has ## a single pole, see ## http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . ## Furthermore, a single-pole filter must have an inverse square decline ## (or -20 db/decade). Since the filter plotted here does have that ## characteristic, it must by definition be a single-pole filter, see also ## http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm ## (5) decade represents a factor of 10, see ## http://en.wikipedia.org/wiki/Decade_(log_scale) . ## 1; function ix26c x_label = [ "Frequency"; "Частота"; ]; y_label = [ "Amplitude (dB)"; "Амплитуда (dB)"; ]; alty_label = [ "Phase shift (degrees)"; "Фазовый сдвиг (градусы)"; ]; title_label = [ "Single Pole Low-Pass Filter"; "Однополюсный Низко-Частотный Фильтр"; ]; line_label = [ "-20 dB/decade"; "-20 dB/десяток"; ]; ## Short rearranged versions of y_label and alty_label. legend_text = { ["Amplitude"; "Phase shift"], ["Амплитуда"; "Фазовый сдвиг"] }; ## Illustration of logarithmic axes, and redefinition of window. ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot plinit; plfont(2); ## Make log plots using two different styles. for i = 1:size(x_label)(1); plot1(0, deblank(x_label(i,:)), deblank(y_label(i,:)), deblank(alty_label(i,:)), deblank(title_label(i,:)), deblank(line_label(i,:)), legend_text{i}); endfor plend1; endfunction ## Log-linear plot. function plot1(plottype, x_label, y_label, alty_label, title_label, line_label, legend_text) global PL_LEGEND_LINE PL_LEGEND_SYMBOL PL_LEGEND_BACKGROUND PL_LEGEND_BOUNDING_BOX pladv(0); ## Set up data for log plot */ f0 = 1.0; i=0:100; freql = -2.0 + i / 20.0; freq = 10.0 .^ freql; ampl = 20.0 * log10(1.0 ./ sqrt(1.0 + (freq ./ f0).^ 2.)); phase = -(180.0 / 3.141592654) * atan(freq ./ f0); plvpor(0.15, 0.85, 0.1, 0.9); plwind(-2.0, 3.0, -80.0, 0.0); ## Try different axis and labelling styles. */ plcol0(1); switch (plottype) case 0 plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); case 1 plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); endswitch ## Plot ampl vs freq */ plcol0(2); plline(freql', ampl'); plcol0(2); plptex(1.6, -30.0, 1.0, -20.0, 0.5, line_label); ## Put labels on */ plcol0(1); plmtex("b", 3.2, 0.5, 0.5, x_label); plmtex("t", 2.0, 0.5, 0.5, title_label); plcol0(2); plmtex("l", 5.0, 0.5, 0.5, y_label); ## For the gridless case, put phase vs freq on same plot */ if (plottype == 0) plcol0(1); plwind(-2.0, 3.0, -100.0, 0.0); plbox("", 0.0, 0, "cmstv", 30.0, 3); plcol0(3); plline(freql', phase'); plstring(freql', phase', "*"); plcol0(3); plmtex("r", 5.0, 0.5, 0.5, alty_label); nlegend = 2; else nlegend = 1 endif ## Set up legend arrays with the correct size, type. In octave this may ## be done by clearing the array (in case it was used before) and then ## writing the last element of the array with a placeholder of the right ## type. Note that for strings the right placeholder length doesn't ## matter. Octave keeps track of the longest string in each array and pads ## out all other members with blanks to that length if a subsequent string ## assignment for an array element exceeds that length. opt_array = 0; text_colors = 0; text = " "; box_colors = 0; box_patterns = 0; box_scales = 0.; box_line_widths = 0.; line_colors = 0; line_styles = 0; line_widths = 0.; symbol_colors = 0; symbol_scales = 0.; symbol_numbers = 0; symbols = " "; opt_array(nlegend,1) = 0; text_colors(nlegend,1) = 0; text(nlegend,1:length(" ")) = " "; box_colors(nlegend,1) = 0; box_patterns(nlegend,1) = 0; box_scales(nlegend,1) = 0.; box_line_widths(nlegend,1) = 0.; line_colors(nlegend,1) = 0; line_styles(nlegend,1) = 0; line_widths(nlegend,1) = 0.; symbol_colors(nlegend,1) = 0; symbol_scales(nlegend,1) = 0.; symbol_numbers(nlegend,1) = 0; symbols(nlegend,1:length(" ")) = " "; ## Only specify legend data that are required according to the ## value of opt_array for that entry. ## Data for first legend entry. opt_array(1) = PL_LEGEND_LINE; text_colors(1) = 2; text(1,1:length(legend_text(1,:))) = legend_text(1,:); line_colors(1) = 2; line_styles(1) = 1; line_widths(1) = 1.; ## Data for second legend entry. if(nlegend > 1) opt_array(2) = bitor(PL_LEGEND_LINE, PL_LEGEND_SYMBOL); text_colors(2) = 3; text(2,1:length(legend_text(1,:))) = legend_text(2,:); line_colors(2) = 3; line_styles(2) = 1; line_widths(2) = 1.; symbol_colors(2) = 3; symbol_scales(2) = 1.; symbol_numbers(2) = 4; symbols(2,1:length("*")) = "*"; endif plscol0a( 15, 32, 32, 32, 0.70 ); [legend_width, legend_height] = \ pllegend( bitor(PL_LEGEND_BACKGROUND, PL_LEGEND_BOUNDING_BOX), 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); endfunction ix26c plplot-5.10.0+dfsg/examples/octave/p10.m 644 1750 1750 150511135341325 166040ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p10 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; title("Comet"); xlabel ""; ylabel ""; t = -pi:pi/200:0; comet(t,tan(sin(t))-sin(tan(t))); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x16c.m 644 1750 1750 2360412152722753 170210ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## plshade demo, using color fill. 1; ## Set up transformation function global nx = 35; ## Default number of data points in x global ny = 46; ## Default number of data points in y global tr = [2/(nx-1); 0.0; -1.0; 0.0; 2/(ny-1); -1.0]; function [tx ty] = mypltr( x, y) global tr tx = tr(1) * x + tr(2) * y + tr(3); ty = tr(4) * x + tr(5) * y + tr(6); endfunction function ix16c global tr; global nx; global ny; global PL_COLORBAR_LABEL_BOTTOM; global PL_COLORBAR_SHADE; global PL_COLORBAR_SHADE_LABEL; ## Fundamental settings. See notes[] for more info. ns = 20; ## Default number of shade levels notes = [ "To get smoother color variation, increase ns, nx, and ny. To get faster", "response (especially on a serial link), decrease them. A decent but quick", "test results from ns around 5 and nx, ny around 25."]; sh_cmap = 1; fill_width = 2.; cont_color = 0; cont_width = 0.; num_axes = 1; n_axis_opts = num_axes; axis_opts = { "bcvtm" }; values = zeros(num_axes,ns+1); axis_ticks = zeros(1,1); axis_subticks = zeros(1,1); num_labels = 1; label_opts = [ PL_COLORBAR_LABEL_BOTTOM ]; labels = { "Magnitude" }; ## Parse and process command line arguments ## plMergeOpts(options, "x16c options", notes); ## plparseopts(&argc, argv, PL_PARSE_FULL); ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display ## Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_gray.pal",1); plscmap0n(3); ## Initialize plplot plinit(); ## Set up data array for i = 0:nx-1 x = (i - fix(nx / 2)) / fix(nx / 2); j = 0:ny-1; y = (j .- fix(ny / 2)) ./ fix(ny / 2) - 1.0; z(i+1,:) = - sin(7.*x) .* cos(7.*y) .+ x*x - y.*y; w(i+1,:) = - cos(7.*x) .* sin(7.*y) .+ 2 .* x .* y; endfor zmin=min(min(z)); zmax=max(max(z)); i = 0:ns-1; clevel = (zmin .+ (zmax - zmin) .* (i + 0.5) ./ ns)'; i = 0:ns; shedge = zmin + (zmax - zmin) * i / ns; ## Set up coordinate grids for i = 0:nx-1 j = 0:ny-1; [x y] = mypltr( i, j); argx = x * pi/2; argy = y * pi/2; distort = 0.4; xg1(i+1,:) = x .+ distort .* cos(argx); yg1(i+1,:) = y .- distort .* cos(argy); xg2(i+1,:) = x .+ distort .* cos(argx) .* cos(argy); yg2(i+1,:) = y .- distort .* cos(argx) .* cos(argy); endfor xg1 = xg1(:,1); yg1 = yg1(1,:)'; ## Plot using identity transform pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades(z, -1., 1., -1., 1., shedge', fill_width, cont_color, cont_width, 1); # Smaller text plschr( 0.0, 0.75 ); # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values(1) = ns + 1; values(1,:) = shedge; [colorbar_width, colorbar_height] = plcolorbar( bitor(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); # Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); ## plcont(w, 1, nx, 1, ny, clevel, tr); pllab("distance", "altitude", "Bogon density"); ## Plot using 1d coordinate transform ## Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_blue_yellow.pal",1); ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades1(z, -1., 1., -1., 1., shedge', fill_width, cont_color, cont_width, 1, xg1, yg1); # Smaller text plschr( 0.0, 0.75 ); # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values(1) = ns + 1; values(1,:) = shedge; [colorbar_width, colorbar_height] = plcolorbar( bitor(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); # Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); ## plcont1(w, 1, nx, 1, ny, clevel, xg1, yg1); pllab("distance", "altitude", "Bogon density"); ## Plot using 2d coordinate transform ## Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_blue_red.pal",1); ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades2(z, -1., 1., -1., 1., shedge', fill_width, cont_color, cont_width, 0, xg2, yg2); # Smaller text plschr( 0.0, 0.75 ); # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values(1) = ns + 1; values(1,:) = shedge; [colorbar_width, colorbar_height] = plcolorbar( bitor(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); # Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); plcont2(w, 1, nx, 1, ny, clevel, xg2, yg2); pllab("distance", "altitude", "Bogon density, with streamlines"); ## Plot using 2d coordinate transform ## Load colour palettes plspal0(""); plspal1("",1); ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades2(z, -1., 1., -1., 1., shedge', fill_width, 2, 3., 0, xg2, yg2); # Smaller text plschr( 0.0, 0.75 ); # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values(1) = ns + 1; values(1,:) = shedge; [colorbar_width, colorbar_height] = plcolorbar( bitor(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); # Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); ## plcont2(w, 1, nx, 1, ny, clevel, xg2, yg2); pllab("distance", "altitude", "Bogon density"); ## Note this exclusion API will probably change. ## Plot using 2d coordinate transform and exclusion if (0) ## exclusion not implemented ## Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_gray.pal",1); ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades2(z, -1., 1., -1., 1., shedge', fill_width, cont_color, cont_width, 0, xg2, yg2); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); pllab("distance", "altitude", "Bogon density with exclusion"); endif ### Example with polar coordinates. PERIMETERPTS=100; ## Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_gray.pal",1); ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); pladv(0); plvpor( .1, .9, .1, .9 ); plwind( -1., 1., -1., 1. ); plpsty(0); ## Build new coordinate matrices. for i = 0:nx-1; r = i/ (nx-1); j = 0:ny-1; t = (2*pi/(ny-1))*j; xg2(i+1,:) = r.*cos(t); yg2(i+1,:) = r.*sin(t); z(i+1,:) = exp(-r.*r).*cos(5*pi*r).*cos(5*t); endfor ## Need a new shedge to go along with the new data set. zmin = min(min(z)); zmax = max(max(z)); i = 0:ns; shedge = zmin + (zmax - zmin) * i / ns; ## Now we can shade the interior region. plshades2(z, -1, 1, -1, 1, shedge', fill_width, cont_color, cont_width, 0, xg2, yg2); # Smaller text plschr( 0.0, 0.75 ); # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ); plsmin( 0.0, 0.5 ); num_values(1) = ns + 1; values(1,:) = shedge; [colorbar_width, colorbar_height] = plcolorbar( bitor(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); # Reset text and tick sizes plschr( 0.0, 1.0 ); plsmaj( 0.0, 1.0 ); plsmin( 0.0, 1.0 ); ## Now we can draw the perimeter. (If do before, shade stuff may overlap.) i = 0:PERIMETERPTS-1; t = (2*pi/(PERIMETERPTS-1))*i; px = cos(t); py = sin(t); plcol0(1); plline(px', py'); ## And label the plot. plcol0(2); pllab( "", "", "Tokamak Bogon Instability" ); ## Clean up plend1(); endfunction ix16c plplot-5.10.0+dfsg/examples/octave/p5.m 644 1750 1750 151411244733610 165330ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p5 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; x=-pi:0.01:pi; y=sin(x).+cos(3*x); og = grid ("on"); title("Polar example"); polar(x,y,'y') grid (og); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/x07c.m 644 1750 1750 373611505745551 170070ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Displays the entire "plsym" symbol (font) set. function x07c ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); base=[0, 100, 0, 100, 200, 500, 600, 700, 800, 900, \ 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900]; plfontld(0); for l=0:19 if ( l == 2 ) plfontld( 1 ); endif pladv(0); ## Set up viewport and window */ plcol0(2); plvpor(0.15, 0.95, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.0); ## Draw the grid using plbox */ plbox("bcg", 0.1, 0, "bcg", 0.1, 0); ## Write the digits below the frame */ plcol0(15); for i=0:9 text=sprintf("%d", i); plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, text); endfor k = 0; for i=0:9 ## Write the digits to the left of the frame */ text=sprintf("%d", base(l+1) + 10 * i); plmtex("lv", 1.0, (0.95 - 0.1 * i), 1.0, text); for j=0:9 x = 0.1 * j + 0.05; y = 0.95 - 0.1 * i; ## Display the symbols */ plsym(x, y, base(l+1) + k); k = k + 1; endfor endfor if ( l < 2 ) plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)"); else plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)"); endif endfor plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/x28c.m 644 1750 1750 2471211543675237 170340ustar andrewandrew## $Id: x28c.m 11680 2011-03-27 17:57:51Z airwin $ ## ## plmtex3, plptex3 demo ## ## Copyright (C) 2007 Alan Irwin ## Copyright (C) 2007 Andrew Ross ## ## ## This file is part of PLplot. ## ## PLplot is free software; you can redistribute it and/or modify ## it under the terms of the GNU Library General Public License as published ## by the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## PLplot is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU Library General Public License for more details. ## ## You should have received a copy of the GNU Library General Public License ## along with PLplot; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 1; ## Demonstrate plotting text in 3D function ix28c ## Choose these values to correspond to tick marks XPTS = 2; YPTS = 2; NREVOLUTION = 16; NROTATION = 8; NSHEAR = 8; ## PLplot constants used in this example DRAW_LINEXY = 3; xmin = 0.0; xmax = 1.0; xmid = 0.5*(xmin+xmax); xrange = xmax-xmin; ymin = 0.0; ymax = 1.0; ymid = 0.5*(ymin+ymax); yrange = ymax-ymin; zmin = 0.0; zmax = 1.0; zmid = 0.5*(zmin+zmax); zrange = zmax-zmin; ysmin = ymin + 0.1 * yrange; ysmax = ymax - 0.1 * yrange; ysrange = ysmax - ysmin; dysrot = ysrange / ( NROTATION - 1 ); dysshear = ysrange / ( NSHEAR - 1 ); zsmin = zmin + 0.1 * zrange; zsmax = zmax - 0.1 * zrange; zsrange = zsmax - zsmin; dzsrot = zsrange / ( NROTATION - 1 ); dzsshear = zsrange / ( NSHEAR - 1 ); pstring = "The future of our civilization depends on software freedom."; x = xmin + (0:(XPTS-1))*xrange/(XPTS-1); y = ymin + (0:(XPTS-1))*yrange/(YPTS-1); z = zeros(XPTS,YPTS); ## Parse and process command line arguments ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); plinit(); ## Page 1: Demonstrate inclination and shear capability pattern. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.); plcol0(2); plbox3("b", "", xrange, 0, \ "b", "", yrange, 0, \ "bcd", "", zrange, 0); ## z = zmin. plschr(0., 1.0); for i = 0:NREVOLUTION-1 omega = 2.*pi*(i/NREVOLUTION); sin_omega = sin(omega); cos_omega = cos(omega); x_inclination = 0.5*xrange*cos_omega; y_inclination = 0.5*yrange*sin_omega; z_inclination = 0.; x_shear = -0.5*xrange*sin_omega; y_shear = 0.5*yrange*cos_omega; z_shear = 0.; plptex3(xmid, ymid, zmin, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.0, " revolution"); endfor ## x = xmax. plschr(0., 1.0); for i=0:NREVOLUTION-1 omega = 2.*pi*(i/NREVOLUTION); sin_omega = sin(omega); cos_omega = cos(omega); x_inclination = 0.; y_inclination = -0.5*yrange*cos_omega; z_inclination = 0.5*zrange*sin_omega; x_shear = 0.; y_shear = 0.5*yrange*sin_omega; z_shear = 0.5*zrange*cos_omega; plptex3(xmax, ymid, zmid, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.0, " revolution"); endfor ## y = ymax. plschr(0., 1.0); for i = 0:NREVOLUTION-1 omega = 2.*pi*(i/NREVOLUTION); sin_omega = sin(omega); cos_omega = cos(omega); x_inclination = 0.5*xrange*cos_omega; y_inclination = 0.; z_inclination = 0.5*zrange*sin_omega; x_shear = -0.5*xrange*sin_omega; y_shear = 0.; z_shear = 0.5*zrange*cos_omega; plptex3( \ xmid, ymax, zmid, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.0, " revolution"); endfor ## Draw minimal 3D grid to finish defining the 3D box. plmesh(x', y', z', DRAW_LINEXY); ## Page 2: Demonstrate rotation of string around its axis. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.); plcol0(2); plbox3("b", "", xrange, 0, \ "b", "", yrange, 0, \ "bcd", "", zrange, 0); ## y = ymax. plschr(0., 1.0); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for i = 0:NROTATION-1 omega = 2.*pi*(i/NROTATION); sin_omega = sin(omega); cos_omega = cos(omega); y_shear = 0.5*yrange*sin_omega; z_shear = 0.5*zrange*cos_omega; zs = zsmax - dzsrot*i; plptex3( \ xmid, ymax, zs, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, "rotation for y = y#dmax#u"); endfor ## x = xmax. plschr(0., 1.0); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; y_shear = 0.; for i = 0:NROTATION-1 omega = 2.*pi*(i/NROTATION); sin_omega = sin(omega); cos_omega = cos(omega); x_shear = 0.5*xrange*sin_omega; z_shear = 0.5*zrange*cos_omega; zs = zsmax - dzsrot*i; plptex3( \ xmax, ymid, zs, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, "rotation for x = x#dmax#u"); endfor ## z = zmin. plschr(0., 1.0); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for i = 0:NROTATION-1 omega = 2.*pi*(i/NROTATION); sin_omega = sin(omega); cos_omega = cos(omega); y_shear = 0.5*yrange*cos_omega; z_shear = 0.5*zrange*sin_omega; ys = ysmax - dysrot*i; plptex3( \ xmid, ys, zmin, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, "rotation for z = z#dmin#u"); endfor ## Draw minimal 3D grid to finish defining the 3D box. plmesh(x', y', z', DRAW_LINEXY); ## Page 3: Demonstrate shear of string along its axis. ## Work around xcairo and pngcairo (but not pscairo) problems for ## shear vector too close to axis of string. (N.B. no workaround ## would be domega = 0.) domega = 0.05; pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.); plcol0(2); plbox3("b", "", xrange, 0, \ "b", "", yrange, 0, \ "bcd", "", zrange, 0); ## y = ymax. plschr(0., 1.0); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; y_shear = 0.; for i = 0:NSHEAR-1 omega = domega + 2.*pi*(i/NSHEAR); sin_omega = sin(omega); cos_omega = cos(omega); x_shear = 0.5*xrange*sin_omega; z_shear = 0.5*zrange*cos_omega; zs = zsmax-dzsshear*i; plptex3( \ xmid, ymax, zs, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, "shear for y = y#dmax#u"); endfor ## x = xmax. plschr(0., 1.0); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; x_shear = 0.; for i = 0:NSHEAR-1 omega = domega + 2.*pi*(i/NSHEAR); sin_omega = sin(omega); cos_omega = cos(omega); y_shear = -0.5*yrange*sin_omega; z_shear = 0.5*zrange*cos_omega; zs = zsmax-dzsshear*i; plptex3( \ xmax, ymid, zs, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, "shear for x = x#dmax#u"); endfor ## z = zmin. plschr(0., 1.0); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; z_shear = 0.; for i = 0:NSHEAR-1 omega = domega + 2.*pi*(i/NSHEAR); sin_omega = sin(omega); cos_omega = cos(omega); y_shear = 0.5*yrange*cos_omega; x_shear = 0.5*xrange*sin_omega; ys = ysmax-dysshear*i; plptex3( \ xmid, ys, zmin, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, "shear for z = z#dmin#u"); endfor ## Draw minimal 3D grid to finish defining the 3D box. plmesh(x', y', z', DRAW_LINEXY); ## Page 4: Demonstrate drawing a string on a 3D path. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30.); plcol0(2); plbox3("b", "", xrange, 0, \ "b", "", yrange, 0, \ "bcd", "", zrange, 0); plschr(0., 1.2); ## domega controls the spacing between the various characters of the ## string and also the maximum value of omega for the given number ## of characters in pstring. domega = 2.*pi/length(pstring); omega = 0.; ## 3D function is a helix of the given radius and pitch radius = 0.5; pitch = 1./(2.*pi); for i=1:length(pstring) sin_omega = sin(omega); cos_omega = cos(omega); xpos = xmid + radius*sin_omega; ypos = ymid - radius*cos_omega; zpos = zmin + pitch*omega; ## In general, the inclination is proportional to the derivative of ## the position wrt theta. x_inclination = radius*cos_omega; y_inclination = radius*sin_omega; z_inclination = pitch; ## The shear vector should be perpendicular to the 3D line with Z ## component maximized, but for low pitch a good approximation is ## a constant vector that is parallel to the Z axis. x_shear = 0.; y_shear = 0.; z_shear = 1.; p1string = pstring(i:i); plptex3( \ xpos, ypos, zpos, \ x_inclination, y_inclination, z_inclination, \ x_shear, y_shear, z_shear, \ 0.5, p1string); omega += domega; endfor ## Draw minimal 3D grid to finish defining the 3D box. plmesh(x', y', z', DRAW_LINEXY); ## Page 5: Demonstrate plmtex3 axis labelling capability pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.); plcol0(2); plbox3("b", "", xrange, 0, \ "b", "", yrange, 0, \ "bcd", "", zrange, 0); plschr(0., 1.0); plmtex3("xp", 3.0, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("xp", 4.5, 0.5, 0.5, "primary X-axis label"); plmtex3("xs", -2.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("xs", -1.0, 0.5, 0.5, "secondary X-axis label"); plmtex3("yp", 3.0, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("yp", 4.5, 0.5, 0.5, "primary Y-axis label"); plmtex3("ys", -2.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("ys", -1.0, 0.5, 0.5, "secondary Y-axis label"); plmtex3("zp", 4.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("zp", 3.0, 0.5, 0.5, "primary Z-axis label"); plmtex3("zs", -2.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("zs", -1.0, 0.5, 0.5, "secondary Z-axis label"); ## Draw minimal 3D grid to finish defining the 3D box. plmesh(x', y', z', DRAW_LINEXY); ## Clean up. plend1(); endfunction ix28cplplot-5.10.0+dfsg/examples/octave/x02c.m 644 1750 1750 632712102122103 167510ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. # Multiple window and color map 0 demo. 1; function ix02c ## Initialize plplot */ plinit(); ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); demo1(); demo2(); plend1(); endfunction function draw_windows(nw, cmap0_offset) ##-------------------------------------------------------------------------- ## draw_windows ## ## Draws a set of numbered boxes with colors according to cmap0 entry. ##-------------------------------------------------------------------------- plschr(0.0, 3.5); plfont(4); for i=0:nw-1 plcol0(i+cmap0_offset); text=sprintf("%d", i); pladv(0); vmin = 0.1; vmax = 0.9; for j=0:2 plwidth(j + 1); plvpor(vmin, vmax, vmin, vmax); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); vmin = vmin + 0.1; vmax = vmax - 0.1; endfor plwidth(1); plptex(0.5, 0.5, 1.0, 0.0, 0.5, text); endfor endfunction ##-------------------------------------------------------------------------- ## demo1 ## ## Demonstrates multiple windows and default color map 0 palette. ##-------------------------------------------------------------------------- function demo1 plbop(); ## Divide screen into 16 regions plssub(4, 4); draw_windows( 16, 0 ); pleop(); endfunction ##-------------------------------------------------------------------------- ## demo2 ## ## Demonstrates multiple windows, user-modified color map 0 palette, and ## HLS -> RGB translation. ##-------------------------------------------------------------------------- function demo2 ## Set up cmap0 ## Use 100 custom colors in addition to base 16 ## Min & max lightness values lmin = 0.15; lmax = 0.85; plbop; ## Divide screen into 100 regions plssub(10, 10); for i=0:99 ## Bounds on HLS, from plhlsrgb() commentary -- ## hue [0., 360.] degrees ## lightness [0., 1.] magnitude ## saturation [0., 1.] magnitude ## ## Vary hue uniformly from left to right h = (360. / 10. ) * mod(i,10); ## Vary lightness uniformly from top to bottom, between min & max l = lmin + (lmax - lmin) * fix(i / 10) / 9.; ## Use max saturation s = 1.0; [r1, g1, b1] = plhlsrgb(h, l, s); r(i+17) = r1 * 255.001; g(i+17) = g1 * 255.001; b(i+17) = b1 * 255.001; endfor ## Load default cmap0 colors into our custom set for i=1:16 [r(i),g(i),b(i)] = plgcol0(i-1); endfor ## Now set cmap0 all at once (faster, since fewer driver calls) plscmap0(r', g', b'); draw_windows( 100, 16 ); pleop; endfunction ix02c; plplot-5.10.0+dfsg/examples/octave/x13c.m 644 1750 1750 410711505771466 170010ustar andrewandrew## Copyright (C) 1998, 1999, 2000 Joao Cardoso ## Copyright (C) 2004 Rafael Laboissiere ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. ## It is based on the corresponding demo function of PLplot. ## Does a simple pie chart. function x13c text =[ "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" ]; per(1) = 10.; per(2) = 32.; per(3) = 12.; per(4) = 30.; per(5) = 16.; ## Parse and process command line arguments */ ## (void) plparseopts(&argc, argv, PL_PARSE_FULL); ## Initialize plplot */ plinit(); pladv(0); ## Ensure window has aspect ratio of one so circle is ## plotted as a circle. */ plvasp(1.0); plwind(0., 10., 0., 10.); ##plenv(0., 10., 0., 10., 1, -2); plcol0(2); theta0 = 0.; dthet = 2 * pi / 500; for i=0:4 x = []; y = []; j = 0; x(j+1) = 5.; y(j+1) = 5.; j=j+1; theta1 = theta0 + 2 * pi * per(i+1) / 100.; if (i == 4) theta1 = 2 * pi; endif for theta = theta0:dthet:theta1 x(j+1) = 5 + 3 * cos(theta); y(j+1) = 5 + 3 * sin(theta); j=j+1; endfor plcol0(i+1); plpsty(rem((i + 3), 8) + 1); plfill(x', y'); plcol0(1); plline(x', y'); just = (theta0 + theta1) / 2.; dx = .25 * cos(just); dy = .25 * sin(just); if ((just < pi / 2) || (just > 3 * pi / 2) ) just = 0.; else just = 1.; endif plptex((x((j / 2) +1) + dx), (y((j / 2) +1) + dy), 1.0, 0.0, just, deblank(text(i+1,:))); theta0 = theta1; endfor plfont(2); plschr(0., 1.3); plptex(5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales"); plend1(); endfunction plplot-5.10.0+dfsg/examples/octave/p18.m 644 1750 1750 172311135341325 166160ustar andrewandrew## Copyright (C) 2002 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p18 global pl_automatic_replot t = pl_automatic_replot; pl_automatic_replot = 0; plsetopt "db"; fig( free_fig); # unused plot window [x, y, z] = peaks; colormap(bgr); title("Set and drag button 1"); xlabel "Button 2 to finish"; ylabel "Button 3 to restart"; meshc( x, y, z); set_view("meshc", x, y, z); closefig pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/octave/p3.m 644 1750 1750 214411135341325 165260ustar andrewandrew## Copyright (C) 1998-2003 Joao Cardoso. ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## This file is part of plplot_octave. function p3 global pl_automatic_replot; t = pl_automatic_replot; pl_automatic_replot = 0; xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; m=60; x = xoff + xscale * ((1:m) + 1) / m; y = yoff + yscale * (x.^2); n=5; xs = x((1:n) * 10 + 3); ys = y((1:n) * 10 + 3); xe = (1:n)./5; yel = ys - (1:n); yer = ys + 2*(1:n); ## Plot the data points */ title("#frPLplot Example 3 - y=x#u2 #d(with error bars)"); plot(x, y, [xs' xe'], [ys' yel' yer'], '~g; ;'); pl_automatic_replot = t; endfunction plplot-5.10.0+dfsg/examples/tcl/ 775 1750 1750 012406243570 152555ustar andrewandrewplplot-5.10.0+dfsg/examples/tcl/x05 755 1750 1750 743 7602154465 156470ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x05 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x05.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x05.tcl plinit x05 plend plplot-5.10.0+dfsg/examples/tcl/x14 755 1750 1750 105310011353406 156620ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x14 5314 2004-02-08 06:28:22Z airwin $ # # Maurice LeBrun # 12/24/02 # # A front-end to x14.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x14.tcl # Note, both plinit (twice with potentially two devices) and plend # done inside x14 x14 plplot-5.10.0+dfsg/examples/tcl/x12 755 1750 1750 743 7602154465 156450ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x12 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x12.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x12.tcl plinit x12 plend plplot-5.10.0+dfsg/examples/tcl/x02.tcl 644 1750 1750 670612102122103 164360ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x02.tcl 12288 2013-01-30 04:40:35Z airwin $ #---------------------------------------------------------------------------- proc x02 {{w loopback}} { x02_demo1 $w x02_demo2 $w # Restore defaults $w cmd plssub 1 1 $w cmd plfont 1 # $w cmd plcol0 1 } # Demonstrates multiple windows and default color map 0 palette. # Divides screen into 16 regions. proc x02_demo1 {w} { $w cmd plbop $w cmd plssub 4 4 x02_draw_windows $w 16 $w cmd pleop } # Demonstrates multiple windows, user-modified color map 0 palette, and # HLS -> RGB translation. Divides screen into 100 regions. proc x02_demo2 {w} { $w cmd plbop $w cmd plssub 10 10 # Set up cmap0 # Use 100 custom colors in addition to base 16 set npts 100 set offset 16 set ntot [expr $npts + $offset] matrix r f $ntot matrix g f $ntot matrix b f $ntot # Min & max lightness values set lmin 0.15 set lmax 0.85 # The faster way to allocate also crashes, so stick with the slow way until we # can resolve this. Set the following to 1 to see the bug.. :) set see_the_bug 0 if !$see_the_bug { $w cmd plscmap0n $ntot } for {set i 0} {$i < $npts} {incr i} { set i1 [expr $i + $offset] # Bounds on HLS, from plhlsrgb() commentary -- # hue [0., 360.] degrees # lightness [0., 1.] magnitude # saturation [0., 1.] magnitude # Vary hue uniformly from left to right set h [expr (360. / 10. ) * ( $i % 10 )] # Vary lightness uniformly from top to bottom, between min & max set l [expr $lmin + ($lmax - $lmin) * ($i / 10) / 9.] # Use max saturation set s 1.0 $w cmd plhlsrgb $h $l $s r1 g1 b1 # puts [format "%3d %15.9f %15.9f %15.9f %15.9f %15.9f %15.9f" $i1 $h $l $s $r1 $g1 $b1] if $see_the_bug { r $i1 = [expr int($r1 * 255.001)] g $i1 = [expr int($g1 * 255.001)] b $i1 = [expr int($b1 * 255.001)] } else { set r2 [expr int($r1 * 255.001)] set g2 [expr int($g1 * 255.001)] set b2 [expr int($b1 * 255.001)] # puts [format "%3d %3d %3d %3d" $i1 $r2 $g2 $b2] $w cmd plscol0 $i1 $r2 $g2 $b2 } } if $see_the_bug { # Load default cmap0 colors into our custom set for {set i 0} {$i < $offset} {incr i} { plgcol0 $i r1 g1 b1 r $i = [expr int($r1)] g $i = [expr int($g1)] b $i = [expr int($b1)] } # temporary for {set i 0} {$i < $ntot} {incr i} { set r1 [expr [r $i]] set g1 [expr [g $i]] set b1 [expr [b $i]] puts [format "%3d %3d %3d %3d" $i $r1 $g1 $b1] } # The following call currently segfaults. $w cmd plscmap0 r g b $ntot } x02_draw_windows $w 100 $offset $w cmd pleop } # Draws a set of numbered boxes with colors according to cmap0 entry. proc x02_draw_windows { w nw {cmap0_offset 0} } { $w cmd plschr 0.0 3.5 $w cmd plfont 4 for {set i 0} {$i < $nw} {incr i} { $w cmd plcol0 [expr $i + $cmap0_offset] $w cmd pladv 0 set vmin 0.1 set vmax 0.9 for {set j 0} {$j <= 2} {incr j} { $w cmd plwidth [expr $j+1] $w cmd plvpor $vmin $vmax $vmin $vmax $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plbox "bc" 0.0 0 "bc" 0.0 0 set vmin [expr $vmin+0.1] set vmax [expr $vmax-0.1] } $w cmd plwidth 1 $w cmd plptex 0.5 0.5 1.0 0.0 0.5 $i } $w cmd pleop } plplot-5.10.0+dfsg/examples/tcl/x13.tcl 644 1750 1750 354311530413277 164570ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x13.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- # Does a simple pie chart. proc x13 {{w loopback}} { set text0 "Maurice" set text1 "Geoffrey" set text2 "Alan" set text3 "Rafael" set text4 "Vince" # int i, j; # PLFLT dthet, theta0, theta1, theta, just, dx, dy; # static PLFLT x[500], y[500], per[5]; matrix x f 500 matrix y f 500 matrix per f 5 = {10., 32., 12., 30., 16.} $w cmd pladv 0 $w cmd plvasp 1. $w cmd plwind 0. 10. 0. 10. # $w cmd plenv 0. 10. 0. 10. 1 -2 $w cmd plcol0 2 set theta0 0. set factor [expr {2. * $::PLPLOT::PL_PI / 500.}] set dthet 1.0 for {set i 0} {$i <= 4} {incr i} { set j 0 x $j = 5. y $j = 5. incr j set theta1 [expr {$theta0 + 5.0 * [per $i]}] if {$i == 4} { set theta1 500.0 } for {set theta $theta0} {$theta <= $theta1} { set theta [expr {$theta + $dthet}]} { x $j = [expr {5. + 3. * cos($factor*$theta)} ] y $j = [expr {5. + 3. * sin($factor*$theta)} ] incr j } $w cmd plcol0 [expr {$i + 1}] $w cmd plpsty [expr {($i + 3) % 8 + 1}] $w cmd plfill $j x y $w cmd plcol0 1 $w cmd plline $j x y set just [expr {$factor * ($theta0 + $theta1) / 2.}] set dx [expr {.25 * cos($just)}] set dy [expr {.25 * sin($just)}] if { ($theta0 + $theta1) < 250.0 || ($theta0 + $theta1) > 750.0 } { set just 0. } else { set just 1. } set halfj [expr {$j/2}] $w cmd plptex [expr {[x $halfj] + $dx}] \ [expr {[y $halfj] + $dy}] 1.0 0.0 $just [set text$i] set theta0 [expr {$theta - $dthet}] } $w cmd plfont 2 $w cmd plschr 0. 1.3 $w cmd plptex 5.0 9.0 1.0 0.0 0.5 "Percentage of Sales" # Restore defaults # $w cmd plcol0 1 $w cmd plfont 1 } plplot-5.10.0+dfsg/examples/tcl/stats.log 644 1750 1750 42061 7620266263 172050ustar andrewandrew# Web server load statistics # Plot parameters follow: # # set title "Web server activity" # set xlab "time (min)" # set ylab "load avg" # set ymin 0.0 # set ymax 5.0 # set dx 0.083333 # set nfilt 128 # # Machines: dejanews dejanews3 dejanews4 dejanews5 0 0.85 0.83 1.56 1.27 1 0.86 0.77 1.39 2.77 2 0.73 0.64 1.28 2.81 3 0.75 0.68 1.26 2.82 4 0.69 0.62 1.16 2.91 5 0.88 0.81 1.14 2.84 6 1.12 0.91 1.05 3.34 7 1.20 0.83 1.29 3.47 8 1.01 0.77 1.47 3.08 9 1.01 0.70 1.51 2.84 10 0.93 0.67 1.63 3.01 11 0.85 0.61 1.74 2.77 12 0.79 0.57 1.68 2.86 13 0.72 0.52 1.79 2.63 14 0.66 0.64 1.80 2.50 15 0.93 0.91 1.66 2.30 16 0.93 0.83 1.77 2.44 17 1.10 0.85 1.62 2.24 18 1.84 0.94 1.67 1.98 19 1.77 0.79 1.53 2.06 20 1.63 0.81 1.65 2.29 21 1.74 0.74 1.68 2.59 22 1.68 0.68 1.54 3.18 23 1.62 0.63 1.42 3.01 24 1.57 0.66 1.39 3.33 25 1.61 0.61 1.27 4.34 26 1.48 0.55 1.25 4.07 27 1.41 0.51 1.06 3.82 28 1.38 0.47 1.21 3.91 29 1.27 0.70 1.12 3.60 30 1.25 0.64 1.03 3.55 31 1.39 0.59 0.95 3.51 32 1.36 1.02 0.95 3.23 33 1.41 1.02 0.87 2.97 34 1.77 0.94 0.80 2.73 35 1.71 0.94 0.82 2.67 36 1.60 1.10 0.69 2.41 37 1.55 1.09 0.63 2.45 38 1.67 1.24 0.82 2.26 39 1.61 1.30 0.84 2.16 40 1.48 1.36 0.93 2.54 41 1.93 1.33 0.86 2.34 42 1.85 1.30 0.79 2.15 43 1.78 1.20 0.80 2.06 44 1.64 1.10 0.90 1.89 45 2.15 1.01 1.63 1.74 46 2.05 0.93 1.58 1.84 47 1.74 0.86 1.41 1.56 48 1.60 1.03 1.62 1.59 49 1.55 1.03 1.57 1.79 50 1.51 0.95 1.84 1.72 51 1.39 1.11 1.86 1.59 52 1.36 1.02 1.79 1.78 53 1.25 1.26 1.64 1.63 54 1.14 1.24 1.51 1.50 55 1.05 1.14 1.47 2.26 56 0.89 1.20 1.40 1.99 57 0.82 1.35 1.29 1.91 58 0.91 1.40 1.18 2.07 59 0.84 1.45 1.09 1.91 60 0.93 1.57 1.16 2.00 61 1.10 1.45 1.14 1.84 62 1.01 1.33 1.54 1.69 63 1.01 1.30 1.49 1.55 64 0.93 1.25 1.37 1.71 65 1.18 1.15 1.31 1.74 66 1.33 1.05 1.21 1.60 67 1.38 0.97 1.11 1.47 68 1.43 0.97 1.02 1.35 69 1.48 1.13 0.94 1.32 70 1.36 1.04 0.86 1.21 71 1.41 0.96 1.36 1.12 72 1.38 0.96 1.25 1.11 73 1.27 0.81 1.14 1.10 74 1.48 0.75 1.20 0.93 75 1.55 0.77 1.19 0.93 76 1.50 0.95 1.17 0.94 77 1.86 1.19 1.08 0.86 78 1.71 1.25 1.15 0.88 79 1.74 1.23 1.14 1.04 80 1.60 1.21 1.77 0.96 81 1.71 1.12 1.71 0.96 82 1.73 1.27 1.57 1.29 83 1.83 1.07 1.44 1.18 84 1.77 0.98 1.33 1.23 85 1.73 0.91 1.58 1.13 86 1.83 0.83 1.46 1.20 87 1.68 1.01 1.34 1.51 88 1.95 1.00 1.23 1.39 89 1.79 0.93 1.13 1.52 90 1.97 1.09 1.28 1.95 91 2.13 1.08 1.50 2.12 92 2.44 1.00 1.38 1.95 93 2.48 1.07 1.27 2.03 94 2.29 0.99 1.48 2.03 95 2.34 0.91 1.53 2.48 96 2.43 1.08 1.53 2.29 97 2.31 0.99 1.57 2.34 98 2.13 0.91 1.44 2.23 99 2.44 0.84 1.33 2.05 100 2.24 1.01 1.22 1.89 101 2.38 1.09 1.20 1.74 102 2.19 1.08 1.19 1.60 103 2.25 1.15 1.33 1.71 104 2.39 1.14 1.36 1.52 105 2.82 1.45 1.25 1.40 106 2.59 1.49 1.15 1.45 107 2.46 1.37 1.14 1.41 108 2.35 1.26 1.29 1.38 109 2.48 1.24 1.18 1.43 110 2.36 1.30 1.09 1.52 111 2.17 1.17 1.00 1.96 112 2.00 1.08 1.16 2.04 113 2.01 0.99 1.21 1.88 114 2.01 0.99 1.11 1.97 115 2.09 1.15 1.02 1.89 116 2.00 1.22 1.02 2.30 117 1.92 1.28 0.94 2.68 118 2.25 1.18 0.86 2.54 119 2.46 1.09 0.87 2.66 120 2.27 1.00 0.80 2.45 121 2.33 0.99 0.90 2.15 122 2.14 0.91 0.82 2.05 123 1.97 0.92 0.85 1.89 124 1.97 0.93 1.18 1.82 125 1.97 0.85 1.09 1.67 126 1.89 0.78 1.00 1.62 127 1.74 1.12 1.08 1.57 128 1.76 1.03 1.23 1.52 129 1.62 1.03 1.21 1.48 130 1.49 1.11 1.12 1.40 131 1.53 1.40 1.11 1.29 132 1.49 1.29 1.17 1.26 133 1.65 1.34 1.08 1.16 134 1.59 1.24 0.99 1.07 135 1.46 1.38 0.91 1.38 136 1.51 1.43 0.84 1.27 137 1.39 1.31 0.85 1.49 138 1.44 1.61 0.78 1.69 139 1.32 1.44 1.12 1.66 140 1.21 1.40 1.03 1.68 141 1.69 1.37 0.87 1.71 142 2.04 1.26 0.80 1.65 143 1.87 1.48 0.73 1.76 144 1.96 1.84 0.92 2.66 145 1.80 1.77 0.84 2.45 146 2.06 1.63 0.93 2.33 147 2.05 1.66 0.94 2.22 148 1.97 1.53 0.86 2.36 149 1.97 1.29 0.88 2.25 150 2.46 1.35 0.96 2.23 151 2.34 1.40 1.42 2.61 152 2.16 1.29 1.30 2.48 153 2.30 1.18 1.20 2.29 154 2.36 1.41 1.10 2.10 155 2.25 1.30 1.18 2.01 156 2.07 1.75 1.08 2.09 157 2.54 1.85 1.23 1.92 158 2.50 1.86 1.21 1.85 159 2.30 1.82 1.12 2.60 160 2.02 1.83 0.95 3.36 161 1.86 1.77 0.87 3.09 162 2.11 1.62 0.80 2.92 163 2.02 1.73 0.89 3.57 164 1.94 1.75 0.82 4.24 165 1.79 1.93 0.91 4.54 166 1.64 1.78 1.16 4.42 167 1.59 1.71 1.07 4.14 168 2.26 1.90 1.22 3.81 169 2.30 1.76 1.12 3.22 170 2.43 1.78 0.95 2.96 171 2.39 1.71 0.88 2.73 172 2.45 1.58 0.80 2.99 173 2.25 1.45 0.82 2.83 174 2.23 1.34 0.75 2.60 175 2.21 1.55 0.77 2.47 176 2.11 1.42 0.79 2.36 177 1.94 1.39 0.73 2.57 178 1.95 1.52 0.83 2.17 179 2.11 1.43 0.76 2.00 180 2.18 1.39 0.70 2.00 181 2.00 1.36 0.74 2.24 182 1.84 1.25 0.68 2.30 183 1.70 1.15 0.86 2.59 184 1.56 1.14 0.88 2.62 185 1.43 1.13 0.80 2.41 186 1.56 1.20 0.90 2.30 187 1.43 1.26 0.83 2.12 188 1.56 1.16 0.92 2.03 189 1.59 1.46 0.85 1.71 190 1.73 1.34 0.94 1.66 191 1.60 1.24 0.88 1.93 192 1.55 1.14 1.04 2.25 193 1.91 1.05 1.04 2.15 194 1.83 0.96 1.04 2.38 195 1.77 0.88 0.95 2.19 196 1.62 0.81 1.12 2.17 197 1.57 0.99 1.11 2.16 198 1.45 0.91 1.10 2.05 199 1.22 0.91 1.01 1.88 200 1.12 0.92 0.86 2.37 201 1.04 0.85 1.02 2.18 202 0.95 0.86 1.10 2.09 203 0.88 0.95 1.02 1.92 204 0.80 0.88 0.93 1.84 205 1.06 0.80 0.86 1.70 206 1.05 1.14 0.79 1.64 207 0.97 1.05 0.73 1.46 208 0.82 0.89 0.75 1.43 209 1.07 0.81 1.00 1.47 210 1.15 0.99 0.92 1.43 211 1.14 0.91 0.84 1.48 212 1.04 0.84 1.02 1.52 213 1.04 0.77 0.93 1.80 214 0.96 1.03 0.86 2.38 215 1.36 1.02 1.19 2.58 216 1.25 0.94 1.18 2.27 217 1.06 0.87 1.08 2.16 218 0.97 1.12 0.91 1.99 219 0.89 1.03 0.84 1.83 220 0.98 0.95 0.77 1.77 221 0.98 1.19 0.79 2.34 222 1.07 1.25 1.13 3.60 223 1.14 1.23 1.04 3.31 224 1.05 1.14 0.95 3.20 225 1.04 1.04 0.88 3.18 226 1.04 1.57 1.05 3.17 227 1.04 1.45 1.04 3.55 228 1.59 1.41 0.96 3.27 229 1.47 1.38 0.88 3.97 230 1.35 1.27 1.05 4.61 231 1.24 1.40 1.13 5.12 232 1.38 1.85 1.04 4.87 233 1.43 1.70 0.95 4.64 234 1.32 1.57 1.04 4.27 235 1.21 1.44 1.04 3.93 236 1.02 1.69 1.04 3.70 237 1.66 1.71 0.95 4.12 238 1.69 1.57 0.88 3.79 239 1.55 1.53 0.80 3.49 240 1.43 1.41 0.74 3.61 241 1.39 1.29 0.84 3.56 242 2.24 1.67 1.17 3.27 243 2.06 1.70 1.08 3.25 244 2.06 1.56 0.99 3.15 245 1.89 1.72 0.91 2.81 246 1.75 1.58 0.92 2.83 247 1.77 1.54 0.86 2.92 248 1.71 1.41 1.19 2.93 249 1.73 1.30 1.25 2.85 250 1.75 1.19 1.15 2.62 251 1.61 1.66 1.06 3.05 252 1.48 1.52 0.97 3.05 253 1.52 1.56 0.98 3.04 254 1.72 1.44 0.90 2.88 255 1.58 1.80 0.92 3.29 256 1.45 1.84 0.93 3.34 257 1.30 1.78 0.85 3.23 258 1.28 1.79 0.86 3.78 259 1.34 1.73 0.88 3.48 260 1.31 1.59 0.88 3.52 261 1.29 1.46 0.81 3.23 262 1.34 1.34 0.75 3.46 263 1.23 1.24 1.03 3.18 264 1.29 1.29 1.19 3.31 265 1.17 1.26 1.09 3.04 266 1.07 1.16 1.09 2.80 267 1.23 1.07 1.08 2.66 268 1.45 0.98 0.99 2.60 269 1.41 0.90 1.07 2.39 270 1.38 0.99 0.91 2.28 271 1.70 0.98 0.83 2.38 272 1.56 0.98 0.77 2.27 273 2.00 1.07 0.95 2.89 274 1.91 1.22 0.87 3.14 275 2.08 1.12 0.96 2.96 276 2.07 1.19 0.96 2.73 277 1.99 1.10 0.88 2.75 278 2.23 1.01 0.97 3.09 279 2.13 1.17 0.90 2.84 280 2.12 1.07 0.99 3.82 281 2.32 0.91 1.07 3.52 282 2.46 0.84 1.14 3.23 283 2.26 0.77 1.05 3.21 284 2.16 0.71 0.97 3.28 285 1.98 0.89 0.89 3.41 286 2.23 0.98 1.22 3.54 287 2.05 0.90 1.12 3.26 288 2.12 0.83 1.35 3.08 289 1.95 0.84 1.32 2.83 290 1.80 0.93 1.12 3.00 291 1.59 1.10 1.43 3.77 292 1.62 1.01 1.55 3.54 293 1.73 0.93 2.07 3.42 294 1.59 0.86 1.90 3.23 295 1.55 1.03 1.75 3.29 296 1.90 0.95 1.61 3.10 297 1.75 0.87 1.48 2.93 298 1.61 0.96 1.36 2.86 299 1.48 0.96 1.41 3.19 300 1.60 1.05 1.34 3.02 301 1.57 0.96 1.32 2.79 302 1.53 0.89 1.21 2.88 303 1.65 0.98 1.19 2.89 304 1.75 0.90 1.26 2.82 305 2.02 0.82 1.55 2.75 306 2.01 0.76 1.51 2.53 307 1.85 0.86 1.71 2.33 308 2.10 0.95 1.57 2.22 309 2.18 0.87 1.53 2.04 310 2.08 0.88 1.64 2.20 311 1.99 0.75 1.47 1.93 312 1.83 0.77 1.51 1.94 313 1.68 0.86 1.39 1.79 314 1.55 0.88 1.28 1.64 315 1.42 0.80 1.18 1.67 316 1.31 0.82 1.16 1.54 317 1.68 1.15 1.07 1.41 318 1.95 1.38 1.54 1.30 319 1.87 1.35 1.39 1.20 320 1.72 1.32 1.36 1.50 321 1.82 1.28 1.25 1.64 322 1.94 1.18 1.55 1.59 323 1.79 1.16 1.74 1.54 324 1.72 1.15 1.76 1.57 325 1.66 1.05 1.78 1.77 326 1.61 0.97 1.64 1.71 327 1.48 1.21 1.51 1.65 328 1.76 1.60 1.55 1.60 329 1.62 1.47 1.50 2.03 330 1.73 1.35 1.34 2.18 331 1.75 1.32 1.23 2.16 332 1.93 1.12 1.14 2.39 333 1.78 1.03 1.12 2.36 334 1.88 0.95 1.04 2.25 335 1.80 0.87 1.11 2.47 336 1.66 0.80 1.42 2.35 337 1.52 0.73 1.31 2.40 338 1.56 0.68 1.20 2.29 339 1.76 0.94 1.86 2.09 340 1.70 0.95 1.79 2.24 341 1.75 0.80 1.65 2.06 342 1.77 0.73 1.52 2.06 343 1.62 0.76 1.39 2.05 344 1.57 0.86 1.28 1.89 345 1.69 0.87 1.50 1.90 346 1.71 0.80 1.38 1.98 347 1.66 0.73 1.51 2.39 348 1.52 0.67 1.55 2.20 349 1.48 0.62 1.38 2.08 350 1.44 0.57 1.27 2.08 351 1.33 0.77 1.65 2.23 352 1.34 0.64 1.92 2.13 353 1.32 0.59 1.84 2.44 354 1.29 0.62 1.70 2.57 355 1.59 0.66 1.56 2.60 356 1.46 0.60 1.52 2.71 357 1.58 0.63 1.79 2.57 358 1.46 0.58 1.65 2.53 359 1.34 0.54 1.48 3.95 360 1.23 0.49 1.60 4.04 361 1.28 0.50 1.63 3.88 362 1.26 0.62 1.66 4.04 363 1.16 0.64 1.61 4.04 364 1.22 0.84 1.48 3.80 365 1.53 0.77 1.52 3.57 366 1.48 0.70 1.64 3.37 367 1.36 0.65 1.77 3.40 368 1.25 0.60 1.70 3.21 369 1.23 0.55 1.57 2.95 370 1.59 0.62 1.68 2.95 371 1.54 0.81 1.87 3.12 372 1.42 0.83 1.80 3.35 373 1.39 0.76 1.65 3.56 374 1.27 1.02 1.52 3.36 375 1.41 0.94 1.45 3.41 376 1.30 0.94 1.33 3.43 377 1.32 1.11 1.22 3.16 378 1.22 1.09 1.29 2.98 379 1.28 1.09 1.26 2.74 380 1.34 1.00 1.40 2.52 381 1.23 1.00 1.53 3.12 382 1.21 1.16 1.37 3.27 383 1.20 1.14 1.26 3.30 384 1.34 1.05 1.32 3.28 385 1.21 0.89 1.38 3.34 386 1.11 0.82 1.34 3.79 387 1.10 0.83 1.32 3.64 388 1.09 0.77 1.21 3.35 389 1.16 0.70 1.11 3.24 390 1.23 0.73 1.18 3.38 391 1.13 0.67 1.09 3.35 392 1.20 0.70 1.00 2.92 393 1.11 0.64 0.91 2.68 394 1.16 0.77 1.32 2.71 395 1.15 0.71 1.21 3.37 396 1.05 0.73 1.12 3.10 397 0.97 0.68 1.03 3.57 398 0.97 0.62 1.43 3.93 399 1.21 0.73 1.39 3.69 400 1.12 0.91 1.44 3.71 401 1.19 0.84 1.22 3.66 402 1.25 0.77 1.12 3.61 403 1.59 0.65 1.03 3.48 404 1.62 0.84 0.95 3.28 405 1.57 0.85 0.87 3.42 406 1.52 0.79 0.80 3.46 407 1.40 0.72 0.82 3.50 408 1.69 0.90 0.75 3.30 409 2.27 0.91 0.63 3.12 410 2.09 0.84 1.06 3.19 411 1.92 0.93 1.70 2.94 412 1.85 0.86 1.64 3.34 413 1.93 1.04 1.59 3.23 414 1.94 1.12 1.54 3.05 415 2.02 1.19 1.58 3.13 416 1.86 1.33 1.77 2.96 417 1.87 1.39 1.63 3.29 418 1.72 1.27 2.14 3.42 419 1.66 1.57 1.97 3.14 420 1.53 1.53 1.66 2.89 421 1.48 1.72 1.69 2.66 422 1.37 1.59 1.64 2.25 423 1.34 1.46 1.50 2.39 424 1.13 1.39 1.38 2.20 425 1.04 1.76 1.43 2.58 426 0.96 1.78 1.56 2.38 427 1.04 1.72 1.59 2.43 428 1.04 1.58 2.11 2.31 429 1.11 1.45 1.94 2.29 430 1.02 1.45 1.79 2.18 431 1.02 1.23 1.73 2.33 432 0.94 1.13 1.67 2.14 433 0.95 1.68 1.70 1.97 434 0.88 1.62 1.80 1.81 435 0.97 1.57 1.66 1.66 436 1.21 1.69 1.60 1.53 437 1.27 1.88 1.55 1.49 438 1.17 2.04 1.51 1.45 439 1.16 2.28 1.47 1.41 440 1.06 2.01 1.59 1.38 441 0.98 1.85 1.50 1.16 442 1.47 1.78 1.62 1.15 443 1.35 1.71 1.65 1.46 444 1.32 1.58 1.60 1.50 445 1.30 1.45 1.47 1.54 446 1.51 1.66 1.83 1.42 447 1.39 1.52 1.84 1.30 448 1.28 1.40 1.86 1.20 449 1.34 1.37 2.03 1.18 450 1.23 1.23 1.86 1.33 451 1.21 1.53 1.89 1.22 452 1.10 1.73 1.90 1.59 453 1.09 1.75 2.15 1.46 454 1.08 1.69 2.30 1.59 455 1.23 1.55 2.11 1.54 456 1.21 1.51 2.02 1.58 457 1.12 1.87 1.94 1.53 458 1.03 1.81 2.02 1.41 459 1.02 1.66 1.86 1.61 460 1.09 1.53 2.03 1.53 461 1.09 1.49 1.87 1.64 462 1.08 1.69 2.12 1.83 463 0.99 1.55 1.95 1.68 464 1.15 1.75 1.87 1.55 465 1.22 1.61 1.96 1.43 466 1.20 1.48 1.88 1.39 467 1.11 1.25 1.81 1.52 468 1.08 1.23 1.70 1.56 469 1.07 1.13 1.56 1.40 470 1.31 1.12 1.43 1.52 471 1.20 1.11 1.48 2.04 472 1.11 1.02 1.36 2.92 473 1.18 1.18 1.41 2.69 474 1.08 1.09 1.62 2.47 475 1.00 1.08 1.57 2.27 476 0.92 0.99 1.44 2.33 477 1.16 1.56 1.73 2.14 478 1.23 1.99 1.94 1.97 479 1.12 2.15 1.86 1.89 480 1.11 1.98 1.79 2.06 481 1.18 2.14 1.73 1.89 482 1.25 1.97 1.99 1.82 483 1.23 1.89 2.07 1.91 484 1.13 2.14 2.46 1.84 485 1.04 2.05 2.67 1.70 486 0.95 2.10 2.26 1.80 487 0.95 1.93 2.16 1.73 488 0.96 1.86 2.14 1.86 489 0.96 1.79 1.97 1.95 490 0.88 1.80 1.97 2.27 491 0.81 1.82 2.46 2.41 492 0.91 1.68 2.42 2.22 493 0.91 1.86 2.23 2.20 494 1.16 1.71 2.12 2.18 495 0.98 1.57 1.96 2.17 496 1.06 1.64 1.80 2.00 497 1.06 1.59 1.52 1.91 498 1.53 1.62 1.56 2.16 499 1.41 1.49 1.59 2.15 500 1.30 1.77 1.71 2.21 501 1.19 1.71 1.73 2.04 502 1.10 1.65 2.15 2.11 503 1.01 1.52 2.38 1.95 504 1.49 1.48 2.51 1.87 505 1.41 1.70 2.31 2.12 506 1.38 1.80 2.03 2.59 507 1.51 1.82 2.03 2.19 508 1.95 1.91 2.19 2.18 509 2.11 1.92 2.01 2.16 510 2.02 1.84 2.25 2.15 511 1.86 2.10 2.39 2.14 512 1.87 1.93 2.76 2.12 513 1.80 1.86 2.78 2.27 514 1.66 1.79 3.11 2.49 515 1.55 1.58 2.86 2.45 516 1.58 1.62 2.50 3.24 517 1.46 1.57 3.26 3.46 518 1.58 1.68 3.24 3.42 519 1.45 1.55 2.98 3.15 520 1.41 1.50 2.98 2.89 521 1.30 1.38 2.82 2.98 522 1.20 1.51 2.59 2.98 523 1.26 1.55 2.39 2.75 524 1.39 1.50 2.75 2.61 525 1.28 1.58 2.61 2.48 526 1.41 1.61 2.60 2.28 527 1.30 1.48 2.39 2.17 528 1.20 1.68 2.20 1.99 529 1.42 1.55 2.26 1.99 530 1.30 1.66 2.40 2.15 531 1.44 1.77 2.29 2.06 532 1.32 1.71 2.34 1.97 533 1.46 1.73 2.48 1.82 534 1.23 1.76 2.48 1.99 535 1.61 1.86 2.28 1.84 536 1.57 1.71 2.10 2.10 537 1.52 1.57 2.09 2.41 538 1.48 1.69 2.32 2.38 539 1.52 1.55 2.21 2.18 540 2.20 1.43 2.20 2.57 541 2.18 1.31 2.02 2.45 542 2.01 1.21 2.10 2.33 543 2.42 1.11 1.93 2.46 544 2.38 1.02 1.78 2.27 545 2.59 0.94 1.50 2.00 546 2.55 1.10 1.86 1.84 547 2.42 1.01 2.11 1.69 548 2.79 0.93 2.10 1.95 549 3.12 0.86 1.93 2.04 550 2.88 1.27 1.94 2.03 551 2.88 1.32 1.79 2.03 552 2.81 1.22 1.64 2.35 553 2.59 1.52 1.51 2.16 554 2.67 1.40 1.39 2.14 555 2.45 1.57 1.28 2.05 556 2.34 1.45 1.40 2.06 557 2.23 1.49 1.37 2.13 558 2.69 1.37 1.90 1.96 559 2.55 1.34 1.75 2.12 560 2.59 1.31 1.77 1.95 561 2.54 1.37 1.86 1.80 562 2.15 1.26 2.11 1.89 563 2.22 1.38 1.87 2.06 564 2.68 1.27 1.72 2.05 565 2.46 1.25 1.82 1.96 566 2.27 1.47 1.84 1.89 567 2.73 1.91 1.77 1.98 568 2.75 1.92 1.62 1.82 569 2.53 1.77 1.57 1.67 570 2.48 1.62 1.69 1.54 571 2.25 1.49 1.55 1.66 572 2.55 1.42 1.43 1.76 573 2.50 1.31 1.53 2.03 574 2.46 1.20 1.64 2.18 575 2.67 1.19 1.59 2.25 576 2.86 1.41 1.55 2.07 577 2.62 1.46 1.42 2.22 578 2.73 1.42 1.55 2.61 579 2.68 1.31 1.42 2.55 580 2.57 1.55 1.31 2.35 581 2.61 1.51 1.62 2.50 582 2.39 1.39 1.49 2.54 583 2.77 1.36 1.37 2.82 584 2.70 2.05 1.34 2.84 585 2.48 1.96 1.39 2.77 586 2.93 1.96 1.28 3.34 587 2.77 1.89 1.26 3.72 588 2.55 1.74 1.16 3.54 589 2.46 1.54 1.07 3.41 590 2.26 1.58 1.05 3.38 591 2.08 1.45 0.96 3.27 592 2.39 1.34 0.96 3.09 593 2.36 1.23 0.89 3.08 594 2.41 1.29 0.90 3.00 595 2.46 1.19 1.23 2.69 596 2.98 1.17 1.12 2.55 597 2.68 1.08 1.04 2.91 598 2.47 1.07 1.19 2.75 599 2.67 0.98 1.09 3.02 600 2.94 0.91 1.00 2.93 601 3.18 0.91 0.92 2.94 602 3.09 0.92 0.85 2.78 603 3.32 0.84 0.78 2.72 604 3.05 0.94 0.96 2.58 605 2.89 1.10 1.04 2.50 606 2.74 1.01 0.96 2.30 607 2.79 0.93 0.88 2.11 608 2.96 1.34 0.98 2.02 609 2.73 1.63 0.98 1.86 610 2.51 1.58 0.91 1.71 611 2.71 1.45 0.83 1.65 612 2.65 1.34 1.09 1.70 613 2.52 1.47 1.00 1.64 614 2.29 1.40 1.00 1.99 615 2.59 1.45 0.84 2.23 616 2.38 1.41 1.02 2.21 617 2.27 1.30 0.93 2.28 618 2.09 1.20 1.18 2.17 619 2.16 1.26 1.09 2.64 620 1.99 1.48 1.08 2.51 621 1.99 1.44 0.99 2.47 622 2.15 1.32 0.99 2.17 623 1.98 1.30 1.07 1.99 624 1.83 1.25 1.06 1.83 625 1.68 1.14 1.05 2.01 626 1.63 1.05 1.21 1.93 627 1.58 1.29 1.43 1.85 628 1.61 1.43 1.48 1.78 629 1.56 1.39 1.52 1.64 630 1.68 1.60 1.40 1.46 631 1.58 1.51 1.68 1.35 632 1.69 1.55 1.75 1.24 633 1.80 1.75 1.61 1.14 634 1.65 1.61 1.48 1.05 635 1.60 1.64 1.36 1.04 636 1.47 1.67 1.33 0.96 637 2.07 2.02 1.22 0.88 638 1.99 1.93 1.29 0.89 639 1.83 1.78 1.18 0.82 640 1.92 1.58 1.16 0.76 641 1.85 1.70 1.07 0.93 642 2.42 2.12 1.30 0.86 643 2.30 2.99 1.20 0.87 644 2.28 2.75 1.34 0.80 645 2.10 2.53 1.39 0.89 646 1.93 2.33 1.84 0.98 647 1.77 2.38 1.69 1.06 648 1.74 2.27 1.72 0.97 649 1.60 2.14 1.58 1.21 650 1.47 1.97 1.42 1.12 651 1.59 2.37 1.30 1.27 652 1.71 2.18 1.20 1.17 653 1.65 2.09 1.18 1.15 654 1.52 2.08 1.17 1.06 655 1.39 1.91 1.07 1.05 656 1.44 1.84 0.99 0.97 657 1.65 2.25 0.99 0.90 658 1.47 2.15 0.99 0.83 659 1.35 2.14 0.99 0.76 660 1.48 2.03 0.91 0.94 661 1.84 1.87 0.84 0.86 662 1.93 1.72 0.77 0.95 663 1.78 1.58 0.71 0.96 664 1.64 1.45 0.71 1.12 665 2.07 1.41 0.65 1.27 666 1.90 1.30 0.60 1.25 667 1.83 1.20 0.55 1.59 668 1.68 1.18 0.54 1.86 669 1.50 1.09 0.82 1.88 670 1.54 0.92 0.75 1.80 671 1.41 0.84 0.69 1.66 672 1.38 1.10 0.64 1.53 673 1.91 1.01 0.59 1.40 674 2.32 1.17 0.62 1.37 675 2.37 1.63 0.57 1.34 676 2.58 2.14 0.57 1.68 677 2.38 1.97 0.55 1.62 678 2.39 1.97 0.51 1.66 679 2.28 1.82 0.47 1.60 680 2.42 1.76 0.59 1.47 681 2.30 1.78 0.54 1.36 682 2.52 1.79 0.50 1.49 683 2.48 1.65 0.46 1.69 684 2.44 1.68 0.42 1.71 685 2.64 1.54 0.39 1.59 686 2.43 1.42 0.33 1.47 687 2.29 1.30 0.78 1.43 688 2.11 1.32 0.88 1.32 689 1.94 1.22 0.81 1.53 690 1.86 1.12 0.74 1.49 691 2.36 1.11 1.08 1.77 692 2.16 1.10 1.32 1.62 693 2.31 1.33 1.53 1.98 694 2.53 1.39 1.73 1.90 695 2.40 1.27 1.67 1.75 696 2.37 1.17 1.61 1.96 697 2.16 1.23 1.85 2.20 698 2.23 1.37 1.70 2.02 699 2.05 1.26 1.56 1.86 700 2.04 1.32 1.44 1.71 701 2.20 1.21 1.88 1.73 702 3.06 1.11 2.29 1.68 703 3.78 1.18 2.11 1.62 704 3.64 1.09 1.94 1.49 705 3.91 1.00 2.50 2.61 706 3.59 1.25 2.43 2.96 707 3.12 1.14 2.55 2.88 708 3.03 1.05 2.35 2.65 709 2.87 1.05 2.16 2.44 710 2.88 0.96 1.99 2.24 711 2.80 0.89 1.83 2.38 712 2.66 0.82 2.08 2.19 713 2.53 0.99 1.92 2.26 714 2.48 0.91 1.84 2.14 715 2.37 1.00 1.70 1.97 716 2.08 1.32 2.41 1.89 717 2.07 1.29 2.38 1.82 718 2.31 1.19 2.35 1.91 719 2.12 1.17 2.32 1.92 720 1.95 1.08 2.13 1.77 plplot-5.10.0+dfsg/examples/tcl/x01 755 1750 1750 104011401011053 156430ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x01 11045 2010-05-31 19:46:51Z airwin $ # # Maurice LeBrun # 12/24/02 # # A front-end to x01.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x01.tcl plgver ver puts [format "PLplot library version: %s" $ver ] plinit x01 plend plplot-5.10.0+dfsg/examples/tcl/x27 755 1750 1750 74511052570456 156710ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x27 8680 2008-08-19 16:13:34Z arjenmarkus $ # # Arjen Markus # 08/18/08 # # A front-end to x26.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x27.tcl plinit x27 plend plplot-5.10.0+dfsg/examples/tcl/x19.tcl 644 1750 1750 1152012221050115 164610ustar andrewandrew# $Id: x19.tcl 12532 2013-09-26 15:18:37Z andrewross $ # # Copyright (C) 2002 Alan W. Irwin # Copyright (C) 2009 Arjen Markus # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # Illustrates backdrop plotting of world, US maps. # Contributed by Wesley Ebisuzaki. # # # # The coordinate transformation works directly on the two matrices # containing the x and y coordinates # proc map_transform { x y } { set scale [expr acos(-1.) / 180.] set radius [expr {90. - $y}] return [list \ [expr {$radius * cos( $x * $scale )}] \ [expr {$radius * sin( $x * $scale )}]] } proc mapform19 {n matx maty} { set deg_to_rad [expr {$::PLPLOT::PL_PI/180.0}] for {set i 0} {$i < $n} {incr i} { set x [$matx $i] set y [$maty $i] set radius [expr {90.0 - $y}] set xp [expr {$radius * cos($x * $deg_to_rad)}] set yp [expr {$radius * sin($x * $deg_to_rad)}] $matx $i = $xp $maty $i = $yp } } # "Normalize" longitude values so that they always fall between -180.0 and # 180.0 proc normalize_longitude {lon} { if {$lon >= -180.0 && $lon <= 180.0} { return $lon } else { set times [expr {floor ((abs($lon) + 180.0) / 360.0)}] if {$lon < 0.0} { return [expr {($lon + 360.0 * $times)}] } else { return [expr {($lon - 360.0 * $times)}] } } } # A custom axis labeling function for longitudes and latitudes. proc geolocation_labeler {axis value} { if {$axis == 2} { set label_val $value if {$label_val > 0.0} { set direction_label " N" } elseif {$label_val < 0.0} { set direction_label " S" } else { set direction_label "Eq" } } elseif {$axis == 1} { set label_val [normalize_longitude $value] if {$label_val > 0.0} { set direction_label " E" } elseif {$label_val < 0.0} { set direction_label " W" } else { set direction_label "" } } if {$axis == 2 && $value == 0.0} { # A special case for the equator set label $direction_label } else { set label [ format "%.0f%s" [expr {abs($label_val)}] $direction_label] } return $label } proc x19 {{w loopback}} { set miny -70 set maxy 80 # Cartesian plots # Most of the world set minx -170 set maxx 190 # Setup a custom latitude and longitude-based scaling function. $w cmd plslabelfunc "geolocation_labeler" $w cmd plcol0 1 $w cmd plenv $minx $maxx $miny $maxy 1 70 $w cmd plmap usaglobe $minx $maxx $miny $maxy # The Americas set minx 190 set maxx 340 $w cmd plcol0 1 $w cmd plenv $minx $maxx $miny $maxy 1 70 $w cmd plmap usaglobe $minx $maxx $miny $maxy # Clear the labeling function $w cmd plslabelfunc "" # Polar, Northern hemisphere # Note: the first argument now is the name of the procedure # that transforms the coordinates (plmap and plmeridians) set minx 0 set maxx 360 $w cmd plenv -75 75 -75 75 1 -1 $w cmd plmap mapform19 globe $minx $maxx $miny $maxy $w cmd pllsty 2 $w cmd plmeridians mapform19 10.0 10.0 0.0 360.0 -10.0 80.0 # Polar, Northern hemisphere # This time we use a global coordinate transformation, so no coordinate # transform function is required on the plmap/plmeridians calls. set minx 0 set maxx 360 $w cmd plstransform map_transform $w cmd pllsty 1 $w cmd plenv -75 75 -75 75 1 -1 $w cmd plmap globe $minx $maxx $miny $maxy $w cmd pllsty 2 $w cmd plmeridians 10.0 10.0 0.0 360.0 -10.0 80.0 # Show Baltimore, MD on the map. $w cmd plcol0 2 $w cmd plssym 0. 2. # This is kind of a messy way to use plpoin for plotting a single symbol. # But it's what we have for now. matrix x f 1 matrix y f 1 x 0 = -76.6125 y 0 = 39.2902778 $w cmd plpoin 1 x y 18 $w cmd plssym 0. 1. $w cmd plptex -76.6125 43. 0.0 0.0 0.0 "Baltimore, MD" $w cmd plstransform NULL $w cmd pllsty 1 # No defaults to restore } plplot-5.10.0+dfsg/examples/tcl/x22.tcl 644 1750 1750 1744412247353236 165100ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x22.tcl 12806 2013-12-03 13:03:26Z andrewross $ #---------------------------------------------------------------------------- # Vector plot demo. proc x22 {{w loopback}} { matrix arrow_x f 6 = {-0.5, 0.5, 0.3, 0.5, 0.3, 0.5} matrix arrow_y f 6 = {0.0, 0.0, 0.2, 0.0, -0.2, 0.0} matrix arrow2_x f 6 = {-0.5, 0.3, 0.3, 0.5, 0.3, 0.3} matrix arrow2_y f 6 = {0.0, 0.0, 0.2, 0.0, -0.2, 0.0} circulation $w set narr 6 set fill 0 $w cmd plsvect arrow_x arrow_y $fill constriction $w 1 set fill 1 $w cmd plsvect arrow2_x arrow2_y $fill constriction $w 2 constriction2 $w $w cmd plsvect NULL NULL 0 potential $w } # Vector plot of circulation about the origin proc circulation {w} { set nx 20 set ny 20 set dx 1.0 set dy 1.0 set xmin [expr {-$nx/2*$dx}] set xmax [expr {$nx/2*$dx}] set ymin [expr {-$ny/2*$dy}] set ymax [expr {$ny/2*$dy}] matrix xg f $nx $ny matrix yg f $nx $ny matrix u f $nx $ny matrix v f $nx $ny # Create data - circulation around the origin. for {set i 0} {$i < $nx} {incr i} { set x [expr {($i-$nx/2+0.5)*$dx} ] for {set j 0} {$j < $ny} {incr j} { set y [expr {($j-$ny/2+0.5)*$dy}] xg $i $j = $x yg $i $j = $y u $i $j = $y v $i $j = [expr {-1.0*$x}] } } # Plot vectors with default arrows $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd pllab "(x)" "(y)" "#frPLplot Example 22 - circulation" $w cmd plcol0 2 $w cmd plvect u v 0.0 "pltr2" xg yg $w cmd plcol0 1 } # Vector plot of flow through a constricted pipe proc constriction {w astyle} { set nx 20 set ny 20 set dx 1.0 set dy 1.0 set xmin [expr {-$nx/2*$dx}] set xmax [expr {$nx/2*$dx}] set ymin [expr {-$ny/2*$dy}] set ymax [expr {$ny/2*$dy}] matrix xg f $nx $ny matrix yg f $nx $ny matrix u f $nx $ny matrix v f $nx $ny set Q 2.0 # Create data - circulation around the origin. for {set i 0} {$i < $nx} {incr i} { set x [expr {($i-$nx/2+0.5)*$dx} ] for {set j 0} {$j < $ny} {incr j} { set y [expr {($j-$ny/2+0.5)*$dy}] xg $i $j = $x yg $i $j = $y set b [expr {$ymax/4.0*(3.0-cos($::PLPLOT::PL_PI*$x/$xmax))}] if {abs($y) < $b} { set dbdx [expr {$ymax/4.0*sin($::PLPLOT::PL_PI*$x/$xmax)*$::PLPLOT::PL_PI/$xmax*$y/$b}] u $i $j = [expr {$Q*$ymax/$b}] v $i $j = [expr {$Q*$ymax/$b*$dbdx}] } else { u $i $j = 0.0 v $i $j = 0.0 } } } # Plot vectors with default arrows $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd pllab "(x)" "(y)" [format "#frPLplot Example 22 - constriction (arrow style %d)" $astyle] $w cmd plcol0 2 $w cmd plvect u v -1.0 "pltr2" xg yg $w cmd plcol0 1 } proc transform { x y } { global xmax return [list \ [expr {$x}] \ [expr {$y / 4.0 * (3.0 - cos($::PLPLOT::PL_PI * $x / $xmax) ) }]] } # Vector plot of flow through a constricted pipe # with a coordinate transform proc constriction2 {w} { set nx 20 set ny 20 set nc 11 set nseg 20 set dx 1.0 set dy 1.0 global xmax set xmin [expr {-$nx/2*$dx}] set xmax [expr {$nx/2*$dx}] set ymin [expr {-$ny/2*$dy}] set ymax [expr {$ny/2*$dy}] $w cmd plstransform transform matrix xg f $nx $ny matrix yg f $nx $ny matrix u f $nx $ny matrix v f $nx $ny set Q 2.0 # Create data - circulation around the origin. for {set i 0} {$i < $nx} {incr i} { set x [expr {($i-$nx/2+0.5)*$dx} ] for {set j 0} {$j < $ny} {incr j} { set y [expr {($j-$ny/2+0.5)*$dy}] xg $i $j = $x yg $i $j = $y set b [expr {$ymax/4.0*(3.0-cos($::PLPLOT::PL_PI*$x/$xmax))}] u $i $j = [expr {$Q*$ymax/$b}] v $i $j = 0.0 } } matrix clev f $nc for {set i 0} {$i < $nc} {incr i} { clev $i = [expr {$Q + $i * $Q / ($nc - 1)}] } # Plot vectors with default arrows $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd pllab "(x)" "(y)" "#frPLplot Example 22 - constriction with plstransform" $w cmd plcol0 2 $w cmd plshades u [expr {$xmin + $dx/2}] [expr {$xmax - $dx/2}] \ [expr {$ymin + $dy/2}] [expr {$ymax - $dy/2}] \ clev 0.0 1 1.0 0 NULL $w cmd plvect u v -1.0 "pltr2" xg yg $w cmd plpath $nseg $xmin $ymax $xmax $ymax $w cmd plpath $nseg $xmin $ymin $xmax $ymin $w cmd plcol0 1 $w cmd plstransform NULL } # Vector plot of the gradient of a shielded potential (see example 9) proc potential {w} { set nr 20 set ntheta 20 set nper 100 set nlevel 10 matrix xg f $nr $ntheta matrix yg f $nr $ntheta matrix u f $nr $ntheta matrix v f $nr $ntheta matrix z f $nr $ntheta # Potential inside a conducting cylinder (or sphere) by method of images. # Charge 1 is placed at (d1, d1), with image charge at (d2, d2). # Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). # Also put in smoothing term at small distances. set rmax $nr set eps 2. set q1 1. set d1 [expr {$rmax/4.}] set q1i [expr {- $q1*$rmax/$d1}] set d1i [expr {pow($rmax,2)/$d1}] set q2 -1. set d2 [expr {$rmax/4.}] set q2i [expr {- $q2*$rmax/$d2}] set d2i [expr {pow($rmax,2)/$d2}] for {set i 0} {$i < $nr} {incr i} { set r [expr {0.5 + $i}] for {set j 0} {$j < $ntheta} {incr j} { set theta [expr {(2. * $::PLPLOT::PL_PI / ($ntheta - 1.))*(0.5 + $j)}] set x [expr {$r * cos($theta)}] set y [expr {$r * sin($theta)}] xg $i $j = $x yg $i $j = $y set div1 [expr {sqrt(pow($x-$d1,2) + pow($y-$d1,2) + pow($eps,2))}] set div1i [expr {sqrt(pow($x-$d1i,2) + pow($y-$d1i,2) + pow($eps,2))}] set div2 [expr {sqrt(pow($x-$d2,2) + pow($y+$d2,2) + pow($eps,2))}] set div2i [expr {sqrt(pow($x-$d2i,2) + pow($y+$d2i,2) + pow($eps,2))}] z $i $j = [expr {$q1/$div1 + $q1i/$div1i + $q2/$div2 + $q2i/$div2i}] u $i $j = [expr {-$q1*($x-$d1)/pow($div1,3) - $q1i*($x-$d1i)/pow($div1i,3) - $q2*($x-$d2)/pow($div2,3) - $q2i*($x-$d2i)/pow($div2i,3)}] v $i $j = [expr {-$q1*($y-$d1)/pow($div1,3) - $q1i*($y-$d1i)/pow($div1i,3) - $q2*($y+$d2)/pow($div2,3) - $q2i*($y+$d2i)/pow($div2i,3)}] } } set xmin [xg 0 0] set xmax $xmin set ymin [yg 0 0] set ymax $ymin set zmin [z 0 0] set zmax $zmin for {set i 0} {$i < $nr} {incr i} { for {set j 0} {$j < $ntheta} {incr j} { if {[xg $i $j] < $xmin} { set xmin [xg $i $j] } if {[xg $i $j] > $xmax} { set xmax [xg $i $j] } if {[yg $i $j] < $ymin} { set ymin [yg $i $j] } if {[yg $i $j] > $ymax} { set ymax [yg $i $j] } if {[z $i $j] < $zmin} { set zmin [z $i $j] } if {[z $i $j] > $zmax} { set zmax [z $i $j] } } } $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd pllab "(x)" "(y)" "#frPLplot Example 22 - potential gradient vector plot" # Plot contours of the potential set dz [expr {($zmax-$zmin)/$nlevel}] matrix clevel f $nlevel for {set i 0} {$i < $nlevel} {incr i} { clevel $i = [expr {$zmin + ($i + 0.5)*$dz}] } $w cmd plcol0 3 $w cmd pllsty 2 $w cmd plcont z clevel "pltr2" xg yg $w cmd pllsty 1 $w cmd plcol0 1 # Plot vectors with default arrows $w cmd plcol0 2 $w cmd plvect u v 25.0 "pltr2" xg yg $w cmd plcol0 1 # Plot the perimeter of the cylinder matrix px f $nper matrix py f $nper set dtheta [expr {2.0*$::PLPLOT::PL_PI/($nper-1.0)}] for {set i 0} {$i < $nper} {incr i} { set theta [expr {$dtheta*$i}] px $i = [expr {$rmax*cos($theta)}] py $i = [expr {$rmax*sin($theta)}] } $w cmd plline $nper px py } plplot-5.10.0+dfsg/examples/tcl/x12.tcl 644 1750 1750 317611530413277 164600ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x12.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- # Does a simple bar chart, using color fill. If color fill is # unavailable, pattern fill is used instead (automatic). proc x12 {{w loopback}} { matrix y0 f 10 = {5., 15., 12., 24., 28., 30., 20., 8., 12., 3.} matrix pos f 5 = {0.0, 0.25, 0.5, 0.75, 1.0} matrix red f 5 = {0.0, 0.25, 0.5, 1.0, 1.0} matrix green f 5 = {1.0, 0.5, 0.5, 0.5, 1.0} matrix blue f 5 = {1.0, 1.0, 0.5, 0.25, 0.0} matrix rev i 5 = {0, 0, 0, 0, 0} $w cmd pladv 0 $w cmd plvsta $w cmd plwind 1980.0 1990.0 0.0 35.0 $w cmd plbox "bc" 1.0 0 "bcnv" 10.0 0 $w cmd plcol0 2 $w cmd pllab "Year" "Widget Sales (millions)" "#frPLplot Example 12" $w cmd plscmap1l 1 5 pos red green blue rev for {set i 0} {$i < 10} {incr i} { # $w cmd plcol0 [expr {$i+1}] $w cmd plcol1 [expr {$i / 9.0} ] $w cmd plpsty 0 plfbox $w [expr {1980. + $i}] [y0 $i] set string [format "%.0f" [y0 $i] ] $w cmd plptex [expr {1980. + $i + .5}] [expr {[y0 $i] + 1.}] \ 1.0 0.0 .5 $string set string [format "%d" [expr {1980 + $i}] ] $w cmd plmtex "b" 1.0 [expr {($i + 1) * .1 - .05}] 0.5 $string } # Restore defaults # $w cmd plcol0 1 } proc plfbox {w x0 y0} { matrix x f 4; matrix y f 4 x 0 = $x0 y 0 = 0. x 1 = $x0 y 1 = $y0 x 2 = [expr {$x0 + 1.}] y 2 = $y0 x 3 = [expr {$x0 + 1.}] y 3 = 0. $w cmd plfill 4 x y $w cmd plcol0 1 $w cmd pllsty 1 $w cmd plline 4 x y } plplot-5.10.0+dfsg/examples/tcl/x08 755 1750 1750 743 7602154465 156520ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x08 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x08.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x08.tcl plinit x08 plend plplot-5.10.0+dfsg/examples/tcl/x22 755 1750 1750 74610053415650 156570ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x22 5605 2004-05-21 15:09:28Z andrewross $ # # Maurice LeBrun # 12/24/02 # # A front-end to x22.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x22.tcl plinit x22 plend plplot-5.10.0+dfsg/examples/tcl/x21 755 1750 1750 74711054231163 156540ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x21 8708 2008-08-24 10:05:39Z arjenmarkus $ # # Maurice LeBrun # 12/24/02 # # A front-end to x06.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x21.tcl plinit x21 plend plplot-5.10.0+dfsg/examples/tcl/x21.tcl 644 1750 1750 2473212240400010 164550ustar andrewandrew# $Id: x21.tcl 12683 2013-11-12 10:16:40Z airwin $ # Grid data demo. # # Copyright (C) 2004 Joao Cardoso # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Note: # This example uses NaNs (not-a-number) and these special "numbers" # are only properly supported by Tcl 8.5 and later (in the sense # that a NaN does not stop the program with an error message). proc x21 {{w loopback}} { set PI $::PLPLOT::PL_PI set pts 500 set xp 25 set yp 20 set nl 16 set knn_order 20 set threshold 1.001 set wmin -1e3 set randn 0 set rosen 0 matrix x f $pts matrix y f $pts matrix z f $pts matrix clev f $nl matrix xg f $xp matrix yg f $yp matrix zg f $xp $yp set title {"-dummy-" "Cubic Spline Approximation" "Delaunay Linear Interpolation" "Natural Neighbors Interpolation" "KNN Inv. Distance Weighted" "3NN Linear Interpolation" "4NN Around Inv. Dist. Weighted"} matrix opt f 6 = { 0.0 0.0 0.0 0.0 0.0 0.0 } set xmin -0.2 set ymin -0.2 set xmax 0.6 set ymax 0.6 opt 2 = $wmin opt 3 = [expr {double($knn_order)}] opt 4 = $threshold $w cmd plseed 5489 cmap1_init $w for {set i 0} {$i < $pts} {incr i} { set xt [expr {($xmax-$xmin)*[$w cmd plrandd]}] set yt [expr {($ymax-$ymin)*[$w cmd plrandd]}] if {$randn == 0} { x $i = [expr {$xt + $xmin}] y $i = [expr {$yt + $ymin}] } else { x $i = [expr {sqrt(-2.*log($xt)) * cos(2.*$PI*$yt) + $xmin}] y $i = [expr {sqrt(-2.*log($xt)) * sin(2.*$PI*$yt) + $ymin}] } if {$rosen == 0} { set xx [x $i] set yy [y $i] set r [expr {sqrt($xx*$xx + $yy*$yy)}] z $i = [expr {exp(-$r*$r)*cos(2.*$PI*$r)}] } else { set xx [x $i] set yy [y $i] z $i = [expr {log(pow(1.-$xx,2)) + 100.*pow($yy-pow($xx,2),2)}] } } set zmin [z 0] set zmax [z 0] for {set i 1} {$i < $pts} {incr i} { set zmax [max $zmax [z $i]] set zmin [min $zmin [z $i]] } for {set i 0} {$i < $xp} {incr i} { xg $i = [expr {$xmin + ($xmax-$xmin)*$i/double($xp-1.)}] } for {set i 0} {$i < $yp} {incr i} { yg $i = [expr {$ymin + ($ymax-$ymin)*$i/double($yp-1.)}] } $w cmd plcol0 1 $w cmd plenv $xmin $xmax $ymin $ymax 2 0 $w cmd plcol0 15 $w cmd pllab "X" "Y" "The original data sampling" matrix xstr f 1 = {0.0} matrix ystr f 1 = {0.0} for {set i 0} {$i < $pts} {incr i} { $w cmd plcol1 [expr {([z $i] - $zmin ) / ( $zmax - $zmin )}] # The following plstring call should be the the equivalent of # plpoin( 1, &x[i], &y[i], 5 ); Use plstring because it is # not deprecated like plpoin and has much more powerful # capabilities. N.B. symbol 141 works for Hershey devices # (e.g., -dev xwin) only if plfontld( 0 ) has been called # while symbol 727 works only if plfontld( 1 ) has been # called. The latter is the default which is why we use 727 # here to represent a centred X (multiplication) symbol. # This dependence on plfontld is one of the limitations of # the Hershey escapes for PLplot, but the upside is you get # reasonable results for both Hershey and Unicode devices. xstr 0 = [x $i] ystr 0 = [y $i] $w cmd plstring 1 xstr ystr "#(727)" } $w cmd pladv 0 $w cmd plssub 3 2 for {set k 0} {$k < 2} {incr k} { $w cmd pladv 0 for {set alg 1} {$alg <= 6} {incr alg} { $w cmd plgriddata x y z xg yg zg $alg [opt [expr {$alg-1}]] # - CSA can generate NaNs (only interpolates? #). # - DTLI and NNI can generate NaNs for points outside the convex hull # of the data points. # - NNLI can generate NaNs if a sufficiently thick triangle is not found # # PLplot should be NaN/Inf aware, but changing it now is quite a job... # so, instead of not plotting the NaN regions, a weighted average over # the neighbors is done. # if {($alg == $::PLPLOT::GRID_CSA) || ($alg == $::PLPLOT::GRID_DTLI) || ($alg == $::PLPLOT::GRID_NNLI) || ($alg == $::PLPLOT::GRID_NNI)} { for {set i 0} {$i < $xp} {incr i} { for {set j 0} {$j < $yp} {incr j} { if { [isnan [zg $i $j]] } { # average (IDW) over the 8 neighbors zg $i $j = 0. set dist 0. set ii [expr {$i-1}] while {($ii <= $i+1) && ($ii < $xp)} { set jj [expr {$j-1}] while {($jj <= $j+1) && ($jj < $yp)} { if {($ii >= 0) && ($jj >= 0) && ![isnan [zg $ii $jj]] } { if {abs($ii-$i) + abs($jj-$j) == 1} { set d 1. } else { set d 1.4142 } zg $i $j = [expr {[zg $i $j] + [zg $ii $jj]/($d*$d)}] set dist [expr {$dist + $d}] } incr jj } incr ii } if {$dist != 0.} { zg $i $j = [expr {[zg $i $j] / $dist}] } else { zg $i $j = $zmin } } } } } a2mnmx zg $xp $yp lzmin lzmax set lzmin [min $lzmin $zmin] set lzmax [max $lzmax $zmax] set lzmin [expr {$lzmin - 0.01}] set lzmax [expr {$lzmax + 0.01}] $w cmd plcol0 1 $w cmd pladv $alg if {$k == 0} { for {set i 0} {$i < $nl} {incr i} { clev $i = [expr {$lzmin + ($lzmax-$lzmin)/double($nl-1.)*$i}] } $w cmd plenv0 $xmin $xmax $ymin $ymax 2 0 $w cmd plcol0 15 $w cmd pllab "X" "Y" [lindex $title $alg] $w cmd plshades zg $xmin $xmax $ymin $ymax clev 1. 0 1. 1 "NULL" $w cmd plcol0 2 } else { for {set i 0} {$i < $nl} {incr i} { clev $i = [expr {$lzmin + ($lzmax-$lzmin)/double($nl-1.)*$i}] } $w cmd plvpor 0. 1. 0. 0.9 $w cmd plwind -1.1 0.75 -0.65 1.20 # # For the comparison to be fair, all plots should have the # same z values, but to get the max/min of the data generated # by all algorithms would imply two passes. Keep it simple. # # plw3d(1., 1., 1., xmin, xmax, ymin, ymax, zmin, zmax, 30, -60); # $w cmd plw3d 1. 1. 1. $xmin $xmax $ymin $ymax \ $lzmin $lzmax 30. -40. $w cmd plbox3 "bntu" "X" 0. 0 \ "bntu" "Y" 0. 0 \ "bcdfntu" "Z" 0.5 0 $w cmd plcol0 15 $w cmd pllab "" "" [lindex $title $alg] $w cmd plot3dc xg yg zg $xp $yp \ [expr {$::PLPLOT::DRAW_LINEXY|$::PLPLOT::MAG_COLOR|$::PLPLOT::BASE_CONT}] clev $nl } } } $w cmd plflush #$w cmd plend $w cmd plssub 1 1 } #---------------------------------------------------------------------------- # isnan # # Note: the current string interface exposes the string representation # of NaNs to the Tcl side. As there is a very wide variety of such # represetations (NAN, nan, "-1.#IND", "1.#QNAN" being but a few # - see also: http://wiki.apache.org/stdcxx/FloatingPoint) # we take a shortcut: # - x is supposed to be a valid number, finite or NaN # - if it is not recognised as a double precision number, it is assumed # to be NaN # - if it is not equal to itself, it definitely is a NaN, as that is # the distinguishing property of NaNs. # # proc isnan {x} { if {![string is double $x] || $x != $x} { return 1 } else { return 0 } } #---------------------------------------------------------------------------- # proc max and min proc min {args} { set x [lindex $args 0] foreach i $args { if {$i<$x} {set x $i} } return $x } proc max {args} { set x [lindex $args 0] foreach i $args { if {$i>$x} {set x $i} } return $x } #---------------------------------------------------------------------------- # proc cmap1_init # Set up the colour map proc cmap1_init {w} { matrix i f 2 matrix h f 2 matrix l f 2 matrix s f 2 matrix r i 2 i 0 = 0. i 1 = 1. h 0 = 240. h 1 = 0. l 0 = 0.6 l 1 = 0.6 s 0 = 0.8 s 1 = 0.8 r 0 = 0 r 1 = 0 $w cmd plscmap1n 256 $w cmd plscmap1l 0 2 i h l s r } #---------------------------------------------------------------------------- # proc a2mnmx # Minimum and the maximum elements of a 2-d array. proc a2mnmx {f nx ny fmin fmax} { upvar 1 $fmin vmin upvar 1 $fmax vmax set vmax [$f 0 0] set vmin $vmax for {set j 0} {$j < $ny} {incr j} { for {set i 0} {$i < $nx} {incr i} { set vmax [max $vmax [$f $i $j]] set vmin [min $vmin [$f $i $j]] } } } plplot-5.10.0+dfsg/examples/tcl/x04.tcl 644 1750 1750 641612140437446 164630ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x04.tcl 12322 2013-05-02 10:25:42Z arjenmarkus $ #---------------------------------------------------------------------------- proc x04 {{w loopback}} { $w cmd plfont 2 plot41 $w 0 plot41 $w 1 # Restore defaults $w cmd plfont 1 # $w cmd plcol0 1 } proc plot41 {w type} { matrix freql f 101 matrix ampl f 101 matrix phase f 101 $w cmd pladv 0 set f0 1.0 for {set i 0} {$i <= 100} {incr i} { freql $i = [expr {-2.0 + $i / 20.0}] set freq [expr {pow(10.0, [freql $i])}] ampl $i = [expr {20.0 * log10(1.0 / sqrt(1.0 + pow(($freq/$f0), 2)))}] phase $i = [expr {-(180.0 / $::PLPLOT::PL_PI) * atan($freq/$f0)}] } $w cmd plvpor 0.15 0.85 0.1 0.9 $w cmd plwind -2.0 3.0 -80.0 0.0 $w cmd plcol0 1 if {$type == 0} { $w cmd plbox "bclnst" 0.0 0 "bnstv" 0.0 0 } elseif {$type ==1} { $w cmd plbox "bcfghlnst" 0.0 0 "bcghnstv" 0.0 0 } else { puts "error: type must be either 0 or 1" } $w cmd plcol0 2 $w cmd plline 101 freql ampl $w cmd plcol0 2 $w cmd plptex 1.6 -30.0 1.0 -20.0 0.5 "-20 dB/decade" # Put labels on $w cmd plcol0 1 $w cmd plmtex "b" 3.2 0.5 0.5 "Frequency" $w cmd plmtex "t" 2.0 0.5 0.5 "Single Pole Low-Pass Filter" $w cmd plcol0 2 $w cmd plmtex "l" 5.0 0.5 0.5 "Amplitude (dB)" set nlegend 1 # For the gridless case, put phase vs freq on same plot if {$type == 0} { $w cmd plcol0 1 $w cmd plwind -2.0 3.0 -100.0 0.0 $w cmd plbox "" 0.0 0 "cmstv" 30.0 3 $w cmd plcol0 3 $w cmd plline 101 freql phase $w cmd plstring 101 freql phase "*" $w cmd plcol0 3 $w cmd plmtex "r" 5.0 0.5 0.5 "Phase shift (degrees)" set nlegend 2 } # Draw a legend # First legend entry. set opt_array [list $::PLPLOT::PL_LEGEND_LINE] set text_colors [list 2] set text [list Amplitude] set line_colors [list 2] set line_styles [list 1] set line_widths [list 1.0] # note from the above opt_array the first symbol (and box) indices # will not be used, but they have to be specified anyway! # (make sure the values are reasonable) # Second legend entry. lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}] lappend text_colors 3 lappend text "Phase shift" lappend line_colors 3 lappend line_styles 1 lappend line_widths 1 set symbol_colors [list 0 3] set symbol_scales [list 0.0 1.0] set symbol_numbers [list 0 4] set symbols [list "" "*"] # from the above opt_arrays we can completely ignore everything # to do with boxes. $w cmd plscol0a 15 32 32 32 0.70 foreach { legend_width legend_height } \ [$w cmd pllegend [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}] 0 \ 0.0 0.0 0.1 15 \ 1 1 0 0 \ [lrange $opt_array 0 [expr {$nlegend-1}]] \ 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols] { break } } plplot-5.10.0+dfsg/examples/tcl/x33 755 1750 1750 175411534612754 157120ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x33 11604 2011-03-06 05:04:44Z airwin $ # # Arjen Markus # 08/18/08 # # A front-end to x26.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} # # This example uses UTF-8 characters, placed directly in the source code # if { [encoding system] != "utf-8" } { if { [package vsatisfies [info patch] 8.5] } { source -encoding utf-8 x33.tcl } else { # # Pre-Tcl 8.5 # set infile [open "x33.tcl"] set contents [read $infile] close $infile eval [encoding convertfrom utf-8 \ [encoding convertto [encoding system] $contents]] } } else { # # Plain source will do # source x33.tcl } plinit x33 plend plplot-5.10.0+dfsg/examples/tcl/x18.tcl 644 1750 1750 655111534600676 164730ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x18.tcl 11603 2011-03-06 03:38:38Z airwin $ #---------------------------------------------------------------------------- proc x18 {{w loopback}} { matrix opt i 4 = {1, 0, 1, 0} matrix alt f 4 = {20.0, 35.0, 50.0, 65.0} matrix az f 4 = {30.0, 40.0, 50.0, 60.0} set npts 1000 for {set k 0} {$k < 4} {incr k} { test_poly $w $k } matrix x f $npts matrix y f $npts matrix z f $npts # From the mind of a sick and twisted physicist... for {set i 0} {$i < $npts} {incr i} { z $i = [expr {-1. + 2. * $i / $npts}] # Pick one ... # r = 1. - ( (float) i / (float) NPTS ); set r [z $i] x $i = [expr {$r * cos( 2. * $::PLPLOT::PL_PI * 6. * $i / $npts )}] y $i = [expr {$r * sin( 2. * $::PLPLOT::PL_PI * 6. * $i / $npts )}] } for {set k 0} {$k < 4} {incr k} { $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 0.9 $w cmd plwind -1.0 1.0 -0.9 1.1 $w cmd plcol0 1 $w cmd plw3d 1.0 1.0 1.0 -1.0 1.0 -1.0 1.0 -1.0 1.0 [alt $k], [az $k] $w cmd plbox3 "bnstu" "x axis" 0.0 0 \ "bnstu" "y axis" 0.0 0 \ "bcdmnstuv" "z axis" 0.0 0 $w cmd plcol0 2 if {[opt $k]} { $w cmd plline3 $npts x y z } else { # U+22C5 DOT OPERATOR. $w cmd plstring3 $npts x y z "⋅" } $w cmd plcol0 3 set title [format "#frPLplot Example 18 - Alt=%.0f, Az=%.0f" \ [alt $k] [az $k]] $w cmd plmtex t 1.0 0.5 0.5 "$title" } # Restore defaults # $w cmd plcol0 1 } proc test_poly {{w loopback} k} { matrix draw0 i 4 = { 1, 1, 1, 1 } matrix draw1 i 4 = { 1, 0, 1, 0 } matrix draw2 i 4 = { 0, 1, 0, 1 } matrix draw3 i 4 = { 1, 1, 0, 0 } set pi $::PLPLOT::PL_PI; set two_pi [expr {2. * $pi}] matrix x f 5 matrix y f 5 matrix z f 5 $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 0.9 $w cmd plwind -1.0 1.0 -0.9 1.1 $w cmd plcol0 1 $w cmd plw3d 1.0 1.0 1.0 -1.0 1.0 -1.0 1.0 -1.0 1.0 [alt $k] [az $k] $w cmd plbox3 "bnstu" "x axis" 0.0 0 \ "bnstu" "y axis" 0.0 0 \ "bcdmnstuv" "z axis" 0.0 0 $w cmd plcol0 2 #define THETA(a) (two_pi * (a) /20.) #define PHI(a) (pi * (a) / 20.1) # x = r sin(phi) cos(theta) # y = r sin(phi) sin(theta) # z = r cos(phi) # r = 1 :=) for {set i 0} {$i < 20} {incr i} { for {set j 0} {$j < 20} {incr j} { x 0 = [expr {sin( $pi * $j / 20.1 ) * cos( $two_pi * $i / 20 )}] y 0 = [expr {sin( $pi * $j / 20.1 ) * sin( $two_pi * $i / 20 )}] z 0 = [expr {cos( $pi * $j / 20.1 )}] x 1 = [expr {sin( $pi * ($j+1) / 20.1 ) * cos( $two_pi * $i / 20 )}] y 1 = [expr {sin( $pi * ($j+1) / 20.1 ) * sin( $two_pi * $i / 20 )}] z 1 = [expr {cos( $pi * ($j+1) / 20.1 )}] x 2 = [expr {sin($pi * ($j+1) / 20.1) * cos($two_pi * ($i+1) / 20)}] y 2 = [expr {sin($pi * ($j+1) / 20.1) * sin($two_pi * ($i+1) / 20)}] z 2 = [expr {cos($pi * ($j+1) / 20.1)}] x 3 = [expr {sin( $pi * $j / 20.1 ) * cos( $two_pi * ($i+1) / 20 )}] y 3 = [expr {sin( $pi * $j / 20.1 ) * sin( $two_pi * ($i+1) / 20 )}] z 3 = [expr {cos( $pi * $j / 20.1 )}] x 4 = [expr {sin( $pi * $j / 20.1 ) * cos( $two_pi * $i / 20 )}] y 4 = [expr {sin( $pi * $j / 20.1 ) * sin( $two_pi * $i / 20 )}] z 4 = [expr {cos( $pi * $j / 20.1 )}] $w cmd plpoly3 5 x y z draw$k 1 } } $w cmd plcol0 3 $w cmd plmtex "t" 1.0 0.5 0.5 "unit radius sphere" } plplot-5.10.0+dfsg/examples/tcl/x30.tcl 644 1750 1750 1010711543675237 165020ustar andrewandrew# # Alpha color values demonstration. # # Copyright (C) 2008 Hazen Babcock # Copyright (C) 2008 Andrew Ross # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # This example will only really be interesting when used with devices that # support or alpha (or transparency) values, such as the cairo device family. # proc x30 {{w loopback}} { matrix red i 4 = { 0, 255, 0, 0} matrix green i 4 = { 0, 0, 255, 0} matrix blue i 4 = { 0, 0, 0, 255} matrix alpha f 4 = {1.0, 1.0, 1.0, 1.0} matrix px f 4 = {0.1, 0.5, 0.5, 0.1} matrix py f 4 = {0.1, 0.1, 0.5, 0.5} matrix pos f 2 = {0.0, 1.0} matrix rcoord f 2 = {1.0, 1.0} matrix gcoord f 2 = {0.0, 0.0} matrix bcoord f 2 = {0.0, 0.0} matrix acoord f 2 = {0.0, 1.0} matrix rev i 2 = {0, 0} $w cmd plscmap0n 4 $w cmd plscmap0a red green blue alpha 4 # # Page 1: # # This is a series of red, green and blue rectangles overlaid # on each other with gradually increasing transparency. # # Set up the window $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 1.0 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plcol0 0 $w cmd plbox "" 1.0 0 "" 1.0 0 # Draw the boxes for {set i 0} {$i < 9} {incr i} { set icol [expr {$i%3 + 1}] # Get a color, change its transparency and # set it as the current color. $w cmd plgcol0a $icol r g b a $w cmd plscol0a $icol $r $g $b [expr {1.0 - double($i)/9.0}] $w cmd plcol0 $icol # Draw the rectangle $w cmd plfill 4 px py # Shift the rectangles coordinates for {set j 0} {$j < 4} {incr j} { px $j = [expr {[px $j] + 0.5/9.0}] py $j = [expr {[py $j] + 0.5/9.0}] } } # # Page 2: # # This is a bunch of boxes colored red, green or blue with a single # large (red) box of linearly varying transparency overlaid. The # overlaid box is completely transparent at the bottom and completely # opaque at the top. # # Set up the window $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind 0.0 1.0 0.0 1.0 # Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for {set i 0} {$i < 5} {incr i} { # Set box X position px 0 = [expr {0.05 + 0.2 * $i}] px 1 = [expr {[px 0] + 0.1}] px 2 = [px 1] px 3 = [px 0] # We don't want the boxes to be transparent, so since we changed # the colors transparencies in the first example we have to change # the transparencies back to completely opaque. set icol [expr {$i%3 + 1}] $w cmd plgcol0a $icol r g b a $w cmd plscol0a $icol $r $g $b 1.0 $w cmd plcol0 $icol for {set j 0} {$j < 5} {incr j} { # Set box y position and draw the box. py 0 = [expr {0.05 + 0.2 * $j}] py 1 = [py 0] py 2 = [expr {[py 0] + 0.1}] py 3 = [py 2] $w cmd plfill 4 px py } } # The overlaid box is drawn using plshades with a color map that is # the same color but has a linearly varying transparency. # Create the color map with 128 colors and use plscmap1la to initialize # the color values with a linear varying transparency (or alpha) $w cmd plscmap1n 128 $w cmd plscmap1la 1 2 pos rcoord gcoord bcoord acoord rev # Use that cmap1 to create a transparent red gradient for the whole # window. px 0 = 0. px 1 = 1. px 2 = 1. px 3 = 0. py 0 = 0. py 1 = 0. py 2 = 1. py 3 = 1. $w cmd plgradient 4 px py 90. } plplot-5.10.0+dfsg/examples/tcl/README.tcldemos 644 1750 1750 515612244724244 200350ustar andrewandrewRunning the Tcl Demos. Note these directions as well as taking proper care of all the dependencies have been incorporated into our CMake-based build systems for the core build and the installed examples build. So the tests below of the Tcl component of PLplot can be done by simply running make test_interactive However, we preserve the directions below for historical reasons and in case you want to do any of these commands by hand. There are two ways to run the examples below, where the alternatives are indicated by "|". The first alternative should only be used if you have changed directories to $prefix/share/plplot$VERSION/examples/tcl where $prefix is the PLplot install prefix and $VERSION is the PLplot release version, e.g., 5.9.10. (That is, the first alternative should be used if you have changed directories to the installed tk examples directory.) The second alternative should only be used if you have changed directories to bindings/examples/tk in the build tree. To run individual examples, run the x?? script corresponding to the x??.tcl example, where ?? is 00 through 33 (except for 32), e.g., ./x00 -dev xwin | env PATH=../../utils:$PATH ./x00 -dev xwin Note, -dev xwin is just one possible PLplot driver, and there are many others. To find out all the possible command-line options run pltcl -h or x?? -h (every x?? script runs pltcl). To run the plot.tcl demo follow the directions in that file to run it under pltcl with the various standard devices. To run the plgrid.tcl demo follow the directions in that file to run it under pltcl with the various standard devices. tcldemos.tcl runs all the standard examples except for example 32. There are two ways to run tcldemos.tcl: (1) pltcl | ../../bindings/tcl/pltcl plinit source tcldemos.tcl 0 1 2 .... Note the pltcl command has normal PLplot command-line options (run pltcl -h to find out what they are). In fact, you can specify, e.g., -dev tk or -dev xwin, but since plinit has to be run in any case, you might as well use the device driver chooser in that case. (2) Note, fill in $prefix below with whatever you configured for the install prefix (/usr/local/plplot or whatever) and $VERSION with the plplot VERSION you are running at this time (5.2.0 or whatever). tclsh lappend auto_path $prefix/share/plplot$VERSION | ../../bindings/tcl package require Pltcl plinit source tcldemos.tcl 0 1 2 .... To find out more about the tclsh command (which comes as part of the tcl package) use man tclsh. Both the pltcl and tclsh methods execute the various x??.tcl examples corresponding to the numbers (in the range from 0 to 33, except for 32) specified by the user. plplot-5.10.0+dfsg/examples/tcl/x25 755 1750 1750 74311512720010 156450ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x25 11467 2011-01-11 00:10:48Z airwin $ # # Maurice LeBrun # 12/24/02 # # A front-end to x25.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x25.tcl plinit x25 plend plplot-5.10.0+dfsg/examples/tcl/x16.tcl 644 1750 1750 2221712172206257 165020ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x16.tcl 12431 2013-07-19 09:53:51Z arjenmarkus $ #---------------------------------------------------------------------------- # plshades demo, using color fill. proc x16 {{w loopback}} { set ns 20 set nx 35 set ny 46 set fill_width 2.; set cont_color 0; set cont_width 0. matrix clevel f $ns matrix shedge f [expr $ns+1] matrix xg1 f $nx matrix yg1 f $ny matrix xg2 f $nx $ny matrix yg2 f $nx $ny matrix zz f $nx $ny matrix ww f $nx $ny # Colorbar - note: single values, as we have only one bar set n_axis_opts 1 set axis_opts "bcvtm" set axis_ticks 0.0 set axis_subticks 0 set label_opts $::PLPLOT::PL_COLORBAR_LABEL_BOTTOM set labels "Magnitude" # Set up data array for {set i 0} {$i < $nx} {incr i} { set x [expr {double($i - ($nx/2)) / double($nx/2)}] for {set j 0} {$j < $ny} {incr j} { set y [expr {double($j - $ny/2) / double($ny/2) - 1.}] zz $i $j = [expr {-sin(7.*$x) * cos(7.*$y) + $x*$x - $y*$y} ] ww $i $j = [expr {-cos(7.*$x) * sin(7.*$y) + 2 * $x * $y} ] } } set zmin [zz 0 0] set zmax $zmin for {set i 0} {$i < $nx} {incr i} { for {set j 0} {$j < $ny} {incr j} { if {[zz $i $j] < $zmin} { set zmin [zz $i $j] } if {[zz $i $j] > $zmax} { set zmax [zz $i $j] } } } for {set i 0} {$i < $ns} {incr i} { clevel $i = [expr {$zmin + ($zmax - $zmin) * ($i + .5) / double($ns)}] } for {set i 0} {$i < $ns+1} {incr i} { shedge $i = [expr {$zmin + ($zmax - $zmin) * double($i) / double($ns)}] } # Build the 1-d coord arrays. set distort .4 for {set i 0} {$i < $nx} {incr i} { set xx [expr {-1. + $i * ( 2. / ($nx-1.) )}] xg1 $i = [expr {$xx + $distort * cos( .5 * $::PLPLOT::PL_PI * $xx )} ] } for {set j 0} {$j < $ny} {incr j} { set yy [expr {-1. + $j * ( 2. / ($ny-1.) )}] yg1 $j = [expr {$yy - $distort * cos( .5 * $::PLPLOT::PL_PI * $yy )} ] } # Build the 2-d coord arrays. for {set i 0} {$i < $nx} {incr i} { set xx [expr {-1. + $i * ( 2. / ($nx-1.) )}] for {set j 0} {$j < $ny} {incr j} { set yy [expr {-1. + $j * ( 2. / ($ny-1.) )}] set argx [expr {.5 * $::PLPLOT::PL_PI * $xx}] set argy [expr {.5 * $::PLPLOT::PL_PI * $yy}] xg2 $i $j = [expr {$xx + $distort * cos($argx) * cos($argy)} ] yg2 $i $j = [expr {$yy - $distort * cos($argx) * cos($argy)} ] } } # Plot using identity transform $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plpsty 0 $w cmd plshades zz -1. 1. -1. 1. \ shedge $fill_width $cont_color $cont_width \ 1 "NULL" # Colorbar: # We draw only one bar, so use single values, not lists # # Smaller text $w cmd plschr 0.0 0.75 # Small ticks on the vertical axis $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plcolorbar \ [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ $cont_color $cont_width \ $label_opts $labels \ $axis_opts \ $axis_ticks $axis_subticks \ shedge # Reset text and tick sizes $w cmd plschr 0.0 1.0 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 # plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, mypltr, NULL); $w cmd pllab "distance" "altitude" "Bogon density" # Plot using 1d coordinate transform $w cmd plspal0 "cmap0_black_on_white.pal" $w cmd plspal1 "cmap1_blue_yellow.pal" 1 $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plpsty 0 $w cmd plshades zz -1. 1. -1. 1. \ shedge $fill_width $cont_color $cont_width \ 1 pltr1 xg1 yg1 # Colorbar: # We draw only one bar, so use single values, not lists # # Smaller text $w cmd plschr 0.0 0.75 # Small ticks on the vertical axis $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plcolorbar \ [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ $cont_color $cont_width \ $label_opts $labels \ $axis_opts \ $axis_ticks $axis_subticks \ shedge # Reset text and tick sizes $w cmd plschr 0.0 1.0 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 # plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr1, (void *) &cgrid1); $w cmd pllab "distance" "altitude" "Bogon density" # Plot using 2d coordinate transform $w cmd plspal0 "cmap0_black_on_white.pal" $w cmd plspal1 "cmap1_blue_red.pal" 1 $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plpsty 0 $w cmd plshades zz -1. 1. -1. 1. \ shedge $fill_width $cont_color $cont_width \ 0 pltr2 xg2 yg2 # Colorbar: # We draw only one bar, so use single values, not lists # # Smaller text $w cmd plschr 0.0 0.75 # Small ticks on the vertical axis $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plcolorbar \ [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ $cont_color $cont_width \ $label_opts $labels \ $axis_opts \ $axis_ticks $axis_subticks \ shedge # Reset text and tick sizes $w cmd plschr 0.0 1.0 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 $w cmd plcont ww clevel pltr2 xg2 yg2 $w cmd pllab "distance" "altitude" "Bogon density, with streamlines" # Plot using 2d coordinate transform with both shades and contours. $w cmd plspal0 "" $w cmd plspal1 "" 1 $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plpsty 0 $w cmd plshades zz -1. 1. -1. 1. \ shedge $fill_width 2 3 \ 0 pltr2 xg2 yg2 # Colorbar: # We draw only one bar, so use single values, not lists # # Smaller text $w cmd plschr 0.0 0.75 # Small ticks on the vertical axis $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plcolorbar \ [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ 2 3.0 \ $label_opts $labels \ $axis_opts \ $axis_ticks $axis_subticks \ shedge # Reset text and tick sizes $w cmd plschr 0.0 1.0 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 $w cmd plcol0 1 $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 $w cmd plcol0 2 $w cmd pllab "distance" "altitude" "Bogon density" # Polar plot example demonstrating wrapping support. $w cmd plspal0 "cmap0_black_on_white.pal" $w cmd plspal1 "cmap1_gray.pal" 1 # Build the new coordinate matrices. set nylim [expr $ny - 1]; set wrap 2; matrix xg f $nx $nylim matrix yg f $nx $nylim matrix z f $nx $nylim for {set i 0} {$i < $nx} {incr i} { set r [expr {$i / ($nx - 1.)}] for {set j 0} {$j < $nylim} {incr j} { set t [expr {2. * $::PLPLOT::PL_PI * $j / ($ny - 1.)}] xg $i $j = [expr {$r * cos($t)}] yg $i $j = [expr {$r * sin($t)}] z $i $j = [expr {exp(-$r*$r) * cos(5.*$t) * cos(5.*$::PLPLOT::PL_PI*$r)} ] } } # Need a new shedge to go along with the new data set. set zmin [z 0 0] set zmax $zmin for {set i 0} {$i < $nx} {incr i} { for {set j 0} {$j < $nylim} {incr j} { if {[z $i $j] < $zmin} { set zmin [z $i $j] } if {[z $i $j] > $zmax} { set zmax [z $i $j] } } } for {set i 0} {$i < [expr $ns+1]} {incr i} { shedge $i = [expr {$zmin + ($zmax - $zmin)/double($ns) * double($i)}] } $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plpsty 0 $w cmd plshades z -1. 1. -1. 1. \ shedge $fill_width $cont_color $cont_width \ 0 pltr2 xg yg $wrap # Colorbar: # We draw only one bar, so use single values, not lists # # Smaller text $w cmd plschr 0.0 0.75 # Small ticks on the vertical axis $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plcolorbar \ [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \ 0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \ $cont_color $cont_width \ $label_opts $labels \ $axis_opts \ $axis_ticks $axis_subticks \ shedge # Reset text and tick sizes $w cmd plschr 0.0 1.0 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 # Hold perimeter matrix px f 100; matrix py f 100 for {set i 0} {$i < 100} {incr i} { set t [expr {2. * $::PLPLOT::PL_PI * $i / 99.}] px $i = [expr {cos($t)}] py $i = [expr {sin($t)}] } # draw the perimeter. $w cmd plcol0 1 $w cmd plline 100 px py # And label the plot. $w cmd plcol0 2 $w cmd pllab "" "" "Tokamak Bogon Instability" # Restore defaults # $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/x33.tcl 644 1750 1750 10631412240400010 164750ustar andrewandrew# $Id: x33.tcl 12683 2013-11-12 10:16:40Z airwin $ # # Demonstrate most pllegend capability including unicode symbols. # # Copyright (C) 2010 Alan Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # This example designed just for devices (e.g., the cairo-related and # qt-related devices) where the best choice of glyph is automatically # selected by the related libraries (pango/cairo or Qt4) for each # unicode character depending on what system fonts are installed. Of # course, you must have the appropriate TrueType fonts installed to # have access to all the required glyphs. # TODO #set options [list { # { # "colorbar", // Turns on pages showing colorbars # NULL, # NULL, # &colorbar, # PL_OPT_BOOL, # "-colorbar", # "Plot the \"color bar\" pages." # }, # { # NULL, // option # NULL, // handler # NULL, // client data # NULL, // address of variable to set # 0, // mode flag # NULL, // short syntax # NULL # } // long syntax #}; # -------------------------------------------------------------------------- # main # # Demonstrate most pllegend capability including unicode symbols. # -------------------------------------------------------------------------- set MAX_NLEGEND 7 proc x33 {{w loopback}} { set position_options [list \ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_OUTSIDE}] \ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] \ [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_INSIDE}] ] # Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). set special_symbols [list \ "✰" \ "✴" \ "✱" \ "✽" \ "✦" ] # plcolorbar options # Colorbar type options set ::colorbar_option_kinds [list \ $::PLPLOT::PL_COLORBAR_SHADE \ [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] \ $::PLPLOT::PL_COLORBAR_IMAGE \ $::PLPLOT::PL_COLORBAR_GRADIENT] set ::colorbar_option_kind_labels [list \ "Shade colorbars" \ "Shade colorbars with custom labels" \ "Image colorbars" \ "Gradient colorbars"] # Which side of the page are we positioned relative to? set ::colorbar_position_options [list \ $::PLPLOT::PL_POSITION_LEFT \ $::PLPLOT::PL_POSITION_RIGHT \ $::PLPLOT::PL_POSITION_TOP \ $::PLPLOT::PL_POSITION_BOTTOM] set ::colorbar_position_option_labels [list \ "Left" \ "Right" \ "Top" \ "Bottom"] # Colorbar label positioning options set ::colorbar_label_options [list \ $::PLPLOT::PL_COLORBAR_LABEL_LEFT \ $::PLPLOT::PL_COLORBAR_LABEL_RIGHT \ $::PLPLOT::PL_COLORBAR_LABEL_TOP \ $::PLPLOT::PL_COLORBAR_LABEL_BOTTOM] set ::colorbar_label_option_labels [list \ "Label left" \ "Label right" \ "Label top" \ "Label bottom"] # Colorbar cap options set ::colorbar_cap_options [list \ $::PLPLOT::PL_COLORBAR_CAP_NONE \ $::PLPLOT::PL_COLORBAR_CAP_LOW \ $::PLPLOT::PL_COLORBAR_CAP_HIGH \ [expr {$::PLPLOT::PL_COLORBAR_CAP_LOW | $::PLPLOT::PL_COLORBAR_CAP_HIGH}]] set ::colorbar_cap_option_labels [list \ "No caps" \ "Low cap" \ "High cap" \ "Low and high caps"] set colorbar 1 ;# By default do not plot plcolorbar pages # for now while we are working out the API. set notes { "Make sure you get it right!" NULL } # Parse and process command line arguments # TODO # plMergeOpts options "x33c options" notes # void plparseopts &argc argv PL_PARSE_FULL # First page illustrating the 16 standard positions. $w cmd pladv 0 $w cmd plvpor 0.25 0.75 0.25 0.75 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plbox "bc" 0.0 0 "bc" 0.0 0 $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1 $w cmd plmtex "t" 8.0 0.5 0.5 "The 16 standard legend positions with" $w cmd plmtex "t" 6.0 0.5 0.5 "the same (0.05) offset in x and y" set nlegend 1 # Only specify legend data that are required according to the # value of opt_array for that entry. set opt_base [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}] set opt_array [list [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}]] set line_styles [list 1] set line_widths [list 1.] set symbol_scales [list 1.] set symbol_numbers [list 4] set symbols [list "*"] # Use monotype fonts so that all legends are the same size. $w cmd plsfont [expr {$::PLPLOT::PL_FCI_MONO}] -1 -1 $w cmd plscol0a 15 32 32 32 0.70 for {set k 0} {$k < 16} {incr k} { set position [lindex $position_options $k] set opt $opt_base set text [list [format "%2.2d" $k]] set text_colors [list [expr {1 + $k % 8}]] set line_colors [list [expr {1 + $k % 8}]] set symbol_colors [list [expr {1 + $k % 8}]] $w cmd pllegend $opt $position 0.05 0.05 \ 0.1 15 1 1 0 0 \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols } # Second page illustrating effect of nrow, ncolumn for the same legend # data. $w cmd pladv 0 $w cmd plvpor 0.25 0.75 0.25 0.75 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plbox "bc" 0.0 0 "bc" 0.0 0 $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1 $w cmd plmtex "t" 8.0 0.5 0.5 "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR," $w cmd plmtex "t" 6.0 0.5 0.5 "and position for the same legend data" set nlegend 7 # Only specify legend data that are required according to the # value of opt_array for that entry. set opt_base [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}] set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] for {set k 0} {$k < $nlegend} {incr k} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}] lappend line_styles 1 lappend line_widths 1. lappend symbol_scales 1. lappend symbol_numbers 2 lappend symbols "*" lappend text [format "%2.2d" $k] lappend text_colors [expr {1 + $k % 8}] lappend line_colors [expr {1 + $k % 8}] lappend symbol_colors [expr {1 + $k % 8}] } # Use monotype fonts so that all legends are the same size. $w cmd plsfont [expr {$::PLPLOT::PL_FCI_MONO}] -1 -1 $w cmd plscol0a 15 32 32 32 0.70 set position [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_OUTSIDE}] set opt $opt_base set x 0. set y 0.1 set nrow 1 set ncolumn $nlegend $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols set position [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_OUTSIDE}] set opt $opt_base set x 0. set y 0.1 set nrow 1 set ncolumn $nlegend $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols set position [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_OUTSIDE}] set opt $opt_base set x 0.1 set y 0. set nrow $nlegend set ncolumn 1 $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols set position [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_OUTSIDE}] set opt $opt_base set x 0.1 set y 0. set nrow $nlegend set ncolumn 1 $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols set position [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] set opt $opt_base set x 0. set y 0. set nrow 6 set ncolumn 2 $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols set position [expr {$::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_INSIDE}] set opt [expr {$opt_base | $::PLPLOT::PL_LEGEND_ROW_MAJOR}] set x 0. set y 0. set nrow 6 set ncolumn 2 $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols set position [expr {$::PLPLOT::PL_POSITION_BOTTOM | $::PLPLOT::PL_POSITION_INSIDE}] set opt [expr {$opt_base | $::PLPLOT::PL_LEGEND_ROW_MAJOR}] set x 0. set y 0. set nrow 3 set ncolumn 3 $w cmd pllegend $opt $position $x $y \ 0.05 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 2.0 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols # Third page demonstrating legend alignment $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 0.9 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1 $w cmd plmtex "t" 2.0 0.5 0.5 "Demonstrate legend alignment" set x 0.1 set y 0.1 set nturn 4 set nlegend 0 set position [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_SUBPAGE}] set opt_base [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}] set opt $opt_base for {set i 0} {$i < 9} {incr i} { # Set up legend arrays with the correct size, type. if { $i <= $nturn } { incr nlegend 1 } else { incr nlegend -1 } set nlegend [max 1 $nlegend] # nly specify legend data that are required according to the # value of opt_array for that entry. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] for {set k 0} {$k < $nlegend} {incr k} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}] lappend line_styles 1 lappend line_widths 1. lappend symbol_scales 1. lappend symbol_numbers 2 lappend symbols "*" lappend text [format "%2.2d" $k] lappend text_colors [expr {1 + $k % 8}] lappend line_colors [expr {1 + $k % 8}] lappend symbol_colors [expr {1 + $k % 8}] } # Use monotype fonts so that all legends are the same size. $w cmd plsfont [expr {$::PLPLOT::PL_FCI_MONO}] -1 -1 $w cmd plscol0a 15 32 32 32 0.70 set nrow [min 3 $nlegend] set ncolumn 0 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.025 15 1 1 $nrow $ncolumn \ $opt_array 1.0 1.0 1.5 \ 1. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols] foreach {legend_width legend_height} $legend_data {break} if { $i == $nturn } { set position [expr {$::PLPLOT::PL_POSITION_TOP | $::PLPLOT::PL_POSITION_RIGHT | $::PLPLOT::PL_POSITION_SUBPAGE}] set opt $opt_base set x [expr {1. - $x}] set y [expr {$y + $legend_height}] } else { set x [expr {$x + $legend_width}] set y [expr {$y + $legend_height}] } } # Fourth page illustrating various kinds of legends set max_height 0. set xstart 0.0 set ystart 0.1 set x $xstart set y $ystart set text_scale 0.90 $w cmd pladv 0 $w cmd plvpor 0.0 1. 0.0 0.90 $w cmd plwind 0.0 1.0 0.0 1.0 # $w cmd plbox"bc" 0.0 0 "bc" 0.0 0 $w cmd plsfont [expr {$::PLPLOT::PL_FCI_SANS}] -1 -1 $w cmd plmtex "t" 2.0 0.5 0.5 "Demonstrate Various Kinds of Legends" set nlegend 5 # Only specify legend data that are required according to the # value of opt_array for that entry. set position [expr {$::PLPLOT::PL_POSITION_LEFT | $::PLPLOT::PL_POSITION_TOP}] set opt_base [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX | $::PLPLOT::PL_LEGEND_TEXT_LEFT}] # Set up None, Box, Line, Symbol, and Line & Symbol legend entries. set opt_array [list [expr {$::PLPLOT::PL_LEGEND_NONE}]] set text [list "None"] set text_colors [list 1] set line_colors [list {}] set line_styles [list {}] set line_widths [list {}] set box_colors [list {}] set box_patterns [list {}] set box_scales [list {}] set box_line_widths [list {}] set symbol_scales [list {}] set symbol_numbers [list {}] set symbols [list {}] set symbol_colors [list {}] lappend opt_array [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}] lappend text "Box" lappend text_colors 2 lappend line_colors {} lappend line_styles {} lappend line_widths {} lappend box_colors 2 lappend box_patterns 0 lappend box_scales 0.8 lappend box_line_widths 1 lappend symbol_scales {} lappend symbol_numbers {} lappend symbols {} lappend symbol_colors {} lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE}] lappend text "Line" lappend text_colors 3 lappend line_colors 3 lappend line_styles 1 lappend line_widths 1 lappend box_colors {} lappend box_patterns {} lappend box_scales {} lappend box_line_widths {} lappend symbol_scales {} lappend symbol_numbers {} lappend symbols {} lappend symbol_colors {} lappend opt_array [expr {$::PLPLOT::PL_LEGEND_SYMBOL}] lappend text "Symbol" lappend text_colors 4 lappend line_colors {} lappend line_styles {} lappend line_widths {} lappend box_colors {} lappend box_patterns {} lappend box_scales {} lappend box_line_widths {} lappend symbol_colors 4 lappend symbol_scales $text_scale lappend symbol_numbers 4 lappend symbols [lindex $special_symbols 2] lappend opt_array [expr {$::PLPLOT::PL_LEGEND_SYMBOL | $::PLPLOT::PL_LEGEND_LINE}] lappend text "L & S" lappend text_colors 5 lappend line_colors 5 lappend line_styles 1 lappend line_widths 1 lappend box_colors {} lappend box_patterns {} lappend box_scales {} lappend box_line_widths {} lappend symbol_colors 5 lappend symbol_scales $text_scale lappend symbol_numbers 4 lappend symbols [lindex $special_symbols 2] set opt $opt_base $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ $box_colors $box_patterns $box_scales $box_line_widths \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up symbol legend entries with various symbols. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for { set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_SYMBOL}] lappend text "Symbol [lindex $special_symbols $i]" lappend text_colors [expr {$i + 1}] lappend symbol_colors [expr {$i + 1}] lappend symbol_scales $text_scale lappend symbol_numbers 4 lappend symbols [lindex $special_symbols $i] } set opt $opt_base set x [expr {$x + $legend_width}] $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ {} {} {} {} \ {} {} {} \ $symbol_colors $symbol_scales $symbol_numbers $symbols] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up symbol legend entries with various numbers of symbols. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_SYMBOL}] lappend text [format "%s %d" "Symbol Number" [expr {$i + 2}]] lappend text_colors [expr {$i + 1}] lappend symbol_colors [expr {$i + 1}] lappend symbol_scales $text_scale lappend symbol_numbers [expr {$i + 2}] lappend symbols [lindex $special_symbols 2] } set opt $opt_base set x [expr {$x + $legend_width}] $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ {} {} {} {} \ {} {} {} \ $symbol_colors $symbol_scales $symbol_numbers $symbols] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up box legend entries with various colours. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}] lappend text [format "%s %d" "Box Color" [expr {$i + 1}]] lappend text_colors [expr {$i + 1}] lappend box_colors [expr {$i + 1}] lappend box_patterns 0 lappend box_scales 0.8 lappend box_line_widths 1 } set opt $opt_base # Use new origin set x $xstart set y [expr {$y + $max_height}] set max_height 0. $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ $box_colors $box_patterns $box_scales $box_line_widths \ {} {} {} \ {} {} {} {}] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up box legend entries with various patterns. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}] lappend text [format "%s %d" "Box Pattern" $i] lappend text_colors 2 lappend box_colors 2 lappend box_patterns $i lappend box_scales 0.8 lappend box_line_widths 1 } set opt $opt_base set x [expr {$x + $legend_width}] $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ $box_colors $box_patterns $box_scales $box_line_widths \ {} {} {} \ {} {} {} {}] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up box legend entries with various box pattern line widths. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_COLOR_BOX}] lappend text [format "%s %d" "Box Line Width" [expr {$i + 1}]] lappend text_colors 2 lappend box_colors 2 lappend box_patterns 3 lappend box_scales 0.8 lappend box_line_widths [expr {$i + 1}] } set opt $opt_base set x [expr {$x + $legend_width}] $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ $box_colors $box_patterns $box_scales $box_line_widths \ {} {} {} \ {} {} {} {}] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up line legend entries with various colours. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE}] lappend text [format "%s %d" "Line Color" [expr {$i + 1}]] lappend text_colors [expr {$i + 1}] lappend line_colors [expr {$i + 1}] lappend line_styles 1 lappend line_widths 1 } set opt $opt_base # Use new origin set x $xstart set y [expr {$y + $max_height}] set max_height 0. $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ {} {} {} {}] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up line legend entries with various styles. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE}] lappend text [format "%s %d" "Line Style" [expr {$i + 1}]] lappend text_colors 2 lappend line_colors 2 lappend line_styles [expr {$i + 1}] lappend line_widths 1 } set opt $opt_base set x [expr {$x + $legend_width}] $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ {} {} {} {}] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] # Set up line legend entries with various widths. set opt_array [list] set line_styles [list] set line_widths [list] set symbol_scales [list] set symbol_numbers [list] set symbols [list] set text [list] set text_colors [list] set line_colors [list] set symbol_colors [list] set box_colors [list] set box_patterns [list] set box_scales [list] set box_line_widths [list] for {set i 0} {$i < $nlegend} {incr i} { lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE}] lappend text [format "%s %d" "Line Width" [expr {$i + 1}]] lappend text_colors 2 lappend line_colors 2 lappend line_styles 1 lappend line_widths [expr {$i + 1}] } set opt $opt_base set x [expr {$x + $legend_width}] $w cmd plscol0a 15 32 32 32 0.70 set legend_data [$w cmd pllegend $opt $position $x $y \ 0.1 15 1 1 0 0 \ $opt_array 1.0 $text_scale 2.0 \ 0. $text_colors $text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ {} {} {} {}] foreach {legend_width legend_height} $legend_data {break} set max_height [max $max_height $legend_height] if {$colorbar} { # Color bar examples matrix values_small f 2 matrix values_uneven f 9 matrix values_even f 9 foreach i {0 1} v {-1.0e-200 1.0e-200 } { values_small $i = $v } foreach i {0 1 2 3 4 5 6 7 8} vu {-1.0e-200 2.0e-200 2.6e-200 3.4e-200 6.0e-200 7.0e-200 8.0e-200 9.0e-200 10.0e-200 } \ ve {-2.0e-200 -1.0e-200 0.0e-200 1.0e-200 2.0e-200 3.0e-200 4.0e-200 5.0e-200 6.0e-200 } { values_uneven $i = $vu values_even $i = $ve } # Use unsaturated green background colour to contrast with black caps. $w cmd plscolbg 70 185 70 # Cut out the greatest and smallest bits of the color spectrum to # leave colors for the end caps. $w cmd plscmap1_range 0.01 0.99 # We can only test image and gradient colorbars with two element arrays # # Note: we pass the name of the matrices! # for {set i 2} {$i < [llength $::colorbar_option_kinds]} {incr i} { plcolorbar_example $w "cmap1_blue_yellow.pal" $i 0 0 values_small } # Test shade colorbars with larger arrays for {set i 0} {$i < 2} {incr i} { plcolorbar_example $w "cmap1_blue_yellow.pal" $i 4 2 values_even } for {set i 0} {$i < 2} {incr i} { plcolorbar_example $w "cmap1_blue_yellow.pal" $i 0 0 values_uneven } } } proc plcolorbar_example_page {w kind_i label_i cap_i cont_color cont_width values} { global colorbar_position global colorbar_position_options global colorbar_position_option_labels global colorbar_option_kinds global colorbar_option_kind_labels global colorbar_label_options global colorbar_label_option_labels global colorbar_cap_options global colorbar_cap_option_labels # Parameters for the colorbars on this page set ticks { 0.0 } set sub_ticks { 0 } set label_opts { 0 } set low_cap_color 0.0 set high_cap_color 1.0 # Start a new page $w cmd pladv 0 # Draw one colorbar relative to each side of the page for {set position_i 0} {$position_i < [llength $colorbar_position_options]} {incr position_i} { set position [lindex $colorbar_position_options $position_i] set opt [expr {[lindex $colorbar_option_kinds $kind_i] | [lindex $colorbar_label_options $label_i] | [lindex $colorbar_cap_options $cap_i]}] set vertical [expr {($position & $::PLPLOT::PL_POSITION_LEFT) || ($position & $::PLPLOT::PL_POSITION_RIGHT) }] set ifn [expr {($position & $::PLPLOT::PL_POSITION_LEFT) || ($position & $::PLPLOT::PL_POSITION_BOTTOM)}] # Set the offset position on the page if {$vertical} { set x 0.0 set y 0.0 set x_length 0.05 set y_length 0.5 } else { set x 0.0 set y 0.0 set x_length 0.5 set y_length 0.05 } # Set appropriate labelling options. if {$ifn} { if {$cont_color == 0 || $cont_width == 0.} { set axis_opts [list "uwtivn"] } else { set axis_opts [list "uwxvn"] } } else { if {$cont_color == 0 || $cont_width == 0.} { set axis_opts [list "uwtivm"] } else { set axis_opts [list "uwxvm"] } } set label [list "[lindex $colorbar_position_option_labels $position_i], [lindex $colorbar_label_option_labels $label_i]"] # Smaller text $w cmd plschr 0.0 0.75 # Small ticks on the vertical axis $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plvpor 0.20 0.80 0.20 0.80 $w cmd plwind 0.0 1.0, 0.0, 1.0 # Set interesting background colour. $w cmd plscol0a 15 0 0 0 0.20 $w cmd plcolorbar \ [expr {$opt | $::PLPLOT::PL_COLORBAR_BOUNDING_BOX | $::PLPLOT::PL_COLORBAR_BACKGROUND}] $position \ $x $y $x_length $y_length \ 15 1 1 \ $low_cap_color $high_cap_color \ $cont_color $cont_width \ $label_opts $label \ $axis_opts \ $ticks $sub_ticks \ $values # Reset text and tick sizes $w cmd plschr 0.0 1.0 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 } # Draw a page title set title "[lindex $colorbar_option_kind_labels $kind_i] - [lindex $colorbar_cap_option_labels $cap_i]" $w cmd plvpor 0.0 1.0 0.0 1.0 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plptex 0.5 0.5 0.0 0.0 0.5 $title } proc plcolorbar_example {w palette kind_i cont_color cont_width values} { # Load the color palette $w cmd plspal1 $palette 1 for { set label_i 0} { $label_i < [llength $::colorbar_label_options] } { incr label_i } { for { set cap_i 0 } { $cap_i < [llength $::colorbar_cap_options] } { incr cap_i } { plcolorbar_example_page $w $kind_i $label_i $cap_i $cont_color $cont_width $values } } } # Auxiliary routines proc min {args} { set x [lindex $args 0] foreach i $args { if {$i<$x} {set x $i} } return $x } proc max {args} { set x [lindex $args 0] foreach i $args { if {$i>$x} {set x $i} } return $x } plplot-5.10.0+dfsg/examples/tcl/x01.tcl 644 1750 1750 640112102122103 164250ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x01.tcl 12288 2013-01-30 04:40:35Z airwin $ #---------------------------------------------------------------------------- proc x01 {{w loopback}} { global xscale yscale xoff yoff # For starting from scratch this call to pladv increments cursub, but # then the following plssub sets it to zero so the whole thing is # essentially a nop. However, for the case when other examples are run # first, this call to pladv is absolutely essential to finish the # preceding page. $w cmd pladv 0 $w cmd plssub 2 2 # First plot set xscale 6.0 set yscale 1.0 set xoff 0.0 set yoff 0.0 plot1 $w # Second set xscale 1.0 set yscale 0.0014 set yoff 0.0185 $w cmd plsyax 5 plot1 $w # Third plot2 $w # Fourth plot3 $w # Restore defaults # $w cmd plcol0 1 $w cmd plssub 1 1 $w cmd pleop } # This is supposed to work just like the plot1() in x01c.c proc plot1 {w} { global xscale yscale xoff yoff set npts 60 matrix x f $npts matrix y f $npts for {set i 0} {$i < $npts} {incr i} { x $i = [expr $xoff + ($xscale * ($i + 1)) / $npts] y $i = [expr $yoff + $yscale * pow([x $i],2)] } set xmin [x [expr 0]] set xmax [x [expr $npts-1]] set ymin [y [expr 0]] set ymax [y [expr $npts-1]] matrix x1 f 6 matrix y1 f 6 for {set i 0} {$i < 6} {incr i} { set j [expr $i*10+3] x1 $i = [x $j] y1 $i = [y $j] } $w cmd plcol0 1 $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd plcol0 2 $w cmd pllab "(x)" "(y)" "#frPLplot Example 1 - y=x#u2" # plot the data points $w cmd plcol0 4 $w cmd plpoin 6 x1 y1 9 # draw the line through the data $w cmd plcol0 3 $w cmd plline $npts x y } # This is supposed to work just like the plot2() in x01c.c proc plot2 {w} { $w cmd plcol0 1 $w cmd plenv -2 10 -.4 1.2 0 1 $w cmd plcol0 2 $w cmd pllab "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function" # Fill up the array matrix x1 f 101 matrix y1 f 101 for {set i 0} {$i < 100} {incr i} { set x [expr ($i - 19.)/6.] x1 $i = $x y1 $i = 1 if {$x != 0} { y1 $i = [expr sin($x)/$x] } } $w cmd plcol0 3 $w cmd plwidth 2 $w cmd plline 100 x1 y1 $w cmd plwidth 1 } # This is supposed to work just like the plot3() in x01c.c proc plot3 {w} { $w cmd pladv 0 $w cmd plvsta $w cmd plwind 0.0 360.0 -1.2 1.2 # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. $w cmd plcol0 1 $w cmd plbox "bcnst" 60.0 2 "bcnstv" 0.2 2 # Superimpose a dashed line grid, with 1.5 mm marks and spaces. # plstyl expects two integer matrices for mark and space! matrix mark i 1 matrix space i 1 mark 0 = 1500 space 0 = 1500 $w cmd plstyl 1 mark space $w cmd plcol0 2 $w cmd plbox "g" 30.0 0 "g" 0.2 0 mark 0 = 0 space 0 = 0 $w cmd plstyl 0 mark space $w cmd plcol0 3 $w cmd pllab "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function" matrix x f 101 matrix y f 101 for {set i 0} {$i < 101} {incr i} { x $i = [expr 3.6 * $i] y $i = [expr sin([x $i] * $::PLPLOT::PL_PI / 180.0)] } $w cmd plcol0 4 $w cmd plline 101 x y } plplot-5.10.0+dfsg/examples/tcl/x30 755 1750 1750 74211123040313 156370ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x30 9210 2008-12-20 00:48:11Z airwin $ # # Maurice LeBrun # 12/24/02 # # A front-end to x30.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x30.tcl plinit x30 plend plplot-5.10.0+dfsg/examples/tcl/x15.tcl 644 1750 1750 1076612140437446 165100ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x15.tcl 12322 2013-05-02 10:25:42Z arjenmarkus $ #---------------------------------------------------------------------------- proc x15 {{w loopback}} { set xpts 35 set ypts 46 matrix z f $xpts $ypts # Comment out set up of cmap0 with limited number of colours # $w cmd plscmap0n 3 # Comment out set up of cmap1 since actually cmap0 is used, and to # fiddle with this affects other tcl plots bundled with this example. # cmap1_init152 $w for {set i 0} {$i < $xpts} {incr i} { set x [expr {double($i - ($xpts/2)) / double($xpts/2)}] for {set j 0} {$j < $ypts} {incr j} { set y [expr {double($j - ($ypts/2)) / double($ypts/2) - 1.}] z $i $j = [expr {$x*$x - $y*$y + ($x - $y)/($x * $x + $y * $y + .1)} ] } } set zmin [z 0 0] set zmax $zmin for {set i 0} {$i < $xpts} {incr i} { for {set j 0} {$j < $ypts} {incr j} { if {[z $i $j] < $zmin} { set zmin [z $i $j] } if {[z $i $j] > $zmax} { set zmax [z $i $j] } } } plot151 $w $z $zmin $zmax plot152 $w $z $zmin $zmax plot153 $w } proc cmap1_init152 { w } { matrix i f 4 matrix h f 4 matrix l f 4 matrix s f 4 matrix rev f 4 i 0 = 0.0 i 1 = 0.45 i 2 = 0.55 i 3 = 1.0 h 0 = 260.0 h 1 = 260.0 h 2 = 20.0 h 3 = 20.0 l 0 = 0.6 l 1 = 0.0 l 2 = 0.0 l 3 = 0.6 s 0 = 1.0 s 1 = 0.5 s 2 = 0.5 s 3 = 1.0 rev 0 = 0 rev 1 = 0 rev 2 = 0 rev 3 = 0 $w cmd plscmap1l 0 4 i h l s rev } proc plot151 { w z zmin zmax } { set sh_width 2 set min_color 9 set max_color 2 set min_width 2. set max_width 2. # N.B. this flag set to use cmap0 set sh_cmap 0 set shade_min [expr {$zmin + ($zmax - $zmin)*.4} ] set shade_max [expr {$zmin + ($zmax - $zmin)*.6} ] set sh_color 7 $w cmd pladv 0 $w cmd plvpor .1 .9 .1 .9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plpsty 8 $w cmd plshade z -1. 1. -1. 1. $shade_min $shade_max \ $sh_cmap $sh_color $sh_width \ $min_color $min_width $max_color $max_width 1 "NULL" $w cmd plcol0 1 $w cmd plbox bcnst 0.0 0 bcnstv 0.0 0 $w cmd plcol0 2 $w cmd pllab "distance" "altitude" "Bogon flux" } proc plot152 { w z zmin zmax } { set sh_width 2 set min_color 0 set max_color 0 set min_width 0. set max_width 0. # N.B. this flag set to use cmap0 set sh_cmap 0 matrix nlin i 10 = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2} matrix inc0 i 1 = {450} matrix inc1 i 1 = {-450} matrix inc2 i 1 = {0} matrix inc3 i 1 = {900} matrix inc4 i 1 = {300} matrix inc5 i 2 = {450, -450} matrix inc6 i 2 = {0, 900} matrix inc7 i 2 = {0, 450} matrix inc8 i 2 = {450, -450} matrix inc9 i 2 = {0, 900} matrix del0 i 2 = {2000, 2000} matrix del1 i 2 = {2000, 2000} matrix del2 i 2 = {2000, 2000} matrix del3 i 2 = {2000, 2000} matrix del4 i 2 = {2000, 2000} matrix del5 i 2 = {2000, 2000} matrix del6 i 2 = {2000, 2000} matrix del7 i 2 = {2000, 2000} matrix del8 i 2 = {4000, 4000} matrix del9 i 2 = {4000, 2000} $w cmd pladv 0 $w cmd plvpor .1 .9 .1 .9 $w cmd plwind -1.0 1.0 -1.0 1.0 for {set i 0} {$i < 10} {incr i} { set shade_min [expr {$zmin + ($zmax - $zmin)*$i/10.0} ] set shade_max [expr {$zmin + ($zmax - $zmin)*($i + 1)/10.0} ] set sh_color [expr {$i + 6}] $w cmd plpat [nlin $i] inc$i del$i $w cmd plshade z -1. 1. -1. 1. $shade_min $shade_max \ $sh_cmap $sh_color $sh_width \ $min_color $min_width $max_color $max_width 1 "NULL" } $w cmd plcol0 1 $w cmd plbox bcnst 0.0 0 bcnstv 0.0 0 $w cmd plcol0 2 $w cmd pllab "distance" "altitude" "Bogon flux" # Restore defaults # $w cmd plcol0 1 } proc plot153 { w } { matrix xx0 f 5 = {-1.0, 1.0, 1.0, -1.0, -1.0} matrix xx1 f 5 = {-1.0, 1.0, 1.0, -1.0, -1.0} matrix yy0 f 5 = {1.0, 1.0, 0.0, 0.0, 1.0} matrix yy1 f 5 = {-1.0, -1.0, 0.0, 0.0, -1.0} matrix zz0 f 5 = {0.0, 0.0, 1.0, 1.0, 0.0} matrix zz1 f 5 = {0.0, 0.0, 1.0, 1.0, 0.0} $w cmd pladv 0 $w cmd plvpor 0.1 0.9 0.1 0.9 $w cmd plwind -1.0 1.0 -1.0 1.0 $w cmd plw3d 1. 1. 1. -1.0 1.0 -1.0 1.0 0.0 1.5 30 -40 # Plot using identity transform $w cmd plcol0 1 $w cmd plbox3 "bntu" "X" 0.0 0 "bntu" "Y" 0.0 0 "bcdfntu" "Z" 0.5 0 $w cmd plcol0 2 $w cmd pllab "" "" "3-d polygon filling" $w cmd plcol0 3 $w cmd plpsty 1 $w cmd plline3 5 xx0 yy0 zz0 $w cmd plfill3 4 xx0 yy0 zz0 $w cmd plpsty 2 $w cmd plline3 5 xx1 yy1 zz1 $w cmd plfill3 4 xx1 yy1 zz1 # Restore defaults # $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/CMakeLists.txt 644 1750 1750 1142412245713450 201150ustar andrewandrew# examples/tcl/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006-2012 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(tcl_FILES README.tcldemos plgrid.tcl plot.dat plot.tcl r.dat stats.log tcldemos.tcl ) set(tcl_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) set(tcl_SCRIPTS) foreach(STRING_INDEX ${tcl_STRING_INDICES}) set(tcl_FILES ${tcl_FILES} x${STRING_INDEX}.tcl) set(tcl_SCRIPTS ${tcl_SCRIPTS} x${STRING_INDEX}) endforeach(STRING_INDEX ${tcl_STRING_INDICES}) # pltcl_standard_examples is a configured shell script that runs all # the standard examples under pltcl. get_target_property(pltcl_LOCATION pltcl LOCATION) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/pltcl_standard_examples.in ${CMAKE_CURRENT_BINARY_DIR}/pltcl_standard_examples @ONLY ) # tclsh_standard_examples is a configured shell script that runs all # the standard examples under tclsh use a TEA-based approach. # pkgIndex_LOCATION is the directory where the relevant pkgIndex.tcl # file is located. if(CORE_BUILD) set(pkgIndex_LOCATION ${CMAKE_BINARY_DIR}/bindings/tcl) else(CORE_BUILD) set(pkgIndex_LOCATION ${DATA_DIR}) endif(CORE_BUILD) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/tclsh_standard_examples.in ${CMAKE_CURRENT_BINARY_DIR}/tclsh_standard_examples @ONLY ) # Copy file and scripts to the binary directory if different to the # source directory. Needed for ctest, but also so the tclIndex file # is generated in the binary tree not the source tree. set(tclIndex_DEPENDS) foreach(file ${tcl_SCRIPTS} ${tcl_FILES}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) list(APPEND tclIndex_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${file}) endforeach(file ${tcl_SCRIPTS} ${tcl_FILES}) add_custom_target(tcl_examples ALL DEPENDS ${tclIndex_DEPENDS}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS} DEPENDS ${tclIndex_DEPENDS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_target(tclIndex_examples_tcl ALL DEPENDS ${tclIndex_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex ) # These two custom targets file-depend on common files so must serialize. add_dependencies(tclIndex_examples_tcl tcl_examples) if(CORE_BUILD) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/tclIndex DESTINATION ${DATA_DIR}/examples/tcl ) install(FILES ${tcl_FILES} DESTINATION ${DATA_DIR}/examples/tcl) install(PROGRAMS ${tcl_SCRIPTS} pltcl_standard_examples.in tclsh_standard_examples.in DESTINATION ${DATA_DIR}/examples/tcl ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/tcl ) endif(CORE_BUILD) if(BUILD_TEST) if(CORE_BUILD) set_property(GLOBAL PROPERTY TARGETS_examples_tcl tcl_examples tclIndex_examples_tcl plplottcltk${LIB_TAG} pltcl plplot.tcl_target tclIndex_tcl ) get_property(files_plplot.tcl_target GLOBAL PROPERTY FILES_plplot.tcl_target) get_property(files_tclIndex_tcl GLOBAL PROPERTY FILES_tclIndex_tcl) set_property(GLOBAL PROPERTY FILES_examples_tcl ${tclIndex_DEPENDS} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex plplottcltk${LIB_TAG} pltcl ${files_plplot.tcl_target} ${files_tclIndex_tcl} ) else(CORE_BUILD) set_property(GLOBAL PROPERTY TARGETS_examples_tcl tcl_examples plplottcltk${LIB_TAG} ) set_property(GLOBAL PROPERTY FILES_examples_tcl ${tclIndex_DEPENDS} plplottcltk${LIB_TAG} ) endif(CORE_BUILD) endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/tcl/x31.tcl 644 1750 1750 1520411530663125 164730ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x31.tcl 11574 2011-02-22 07:31:33Z arjenmarkus $ #---------------------------------------------------------------------------- proc x31 {{w loopback}} { # Test setting / getting familying parameters before plinit. # Save values set by plparseopts to be restored later. $w cmd plgfam fam0 num0 bmax0 set fam1 0 set num1 10 set bmax1 1000 $w cmd plsfam $fam1 $num1 $bmax1 # Retrieve the same values? $w cmd plgfam fam2 num2 bmax2 puts [ format "family parameters: fam, num, bmax = %d %d %d" $fam2 $num2 $bmax2 ] if {$fam2 != $fam1 || $num2 != $num1 || $bmax2 != $bmax1} { puts stderr "plgfam test failed" set status 1 } # Restore values set initially by plparseopts. $w cmd plsfam $fam0 $num0 $bmax0 # Test setting / getting page parameters before plinit. # Save values set by plparseopts to be restored later. $w cmd plgpage xp0 yp0 xleng0 yleng0 xoff0 yoff0 set xp1 200. set yp1 200. set xleng1 400 set yleng1 200 set xoff1 10 set yoff1 20 $w cmd plspage $xp1 $yp1 $xleng1 $yleng1 $xoff1 $yoff1 # Retrieve the same values? $w cmd plgpage xp2 yp2 xleng2 yleng2 xoff2 yoff2 puts [ format "page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d" $xp2 $yp2 $xleng2 $yleng2 $xoff2 $yoff2 ] if {$xp2 != $xp1 || $yp2 != $yp1 || $xleng2 != $xleng1 || $yleng2 != $yleng1 || $xoff2 != $xoff1 || $yoff2 != $yoff1} { puts stderr "plgpage test failed" set status 1 } # Restore values set initially by plparseopts. $w cmd plspage $xp0 $yp0 $xleng0 $yleng0 $xoff0 $yoff0 # Test setting / getting compression parameter across plinit. set compression1 95 $w cmd plscompression $compression1 $w cmd plinit set status 0 # Test if device initialization screwed around with the preset # compression parameter. $w cmd plgcompression compression2 puts [ format "Output various PLplot parameters" ] puts [ format "compression parameter = %d" $compression2 ] if {$compression2 != $compression1} { puts stderr "plgcompression test failed" set status 1 } # Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure # they work without any obvious error messages. $w cmd plscolor 1 matrix r1 i 2 = {0, 255} matrix g1 i 2 = {255, 0} matrix b1 i 2 = {0, 0} matrix a1 f 2 = {1.0, 1.0} $w cmd plscmap1 r1 g1 b1 2 $w cmd plscmap1a r1 g1 b1 a1 2 $w cmd plglevel level2 puts [ format "level parameter = %d" $level2 ] if {$level2 != 1} { puts stderr "plglevel test failed." set status 1 } $w cmd pladv 0 $w cmd plvpor 0.01 0.99 0.02 0.49 $w cmd plgvpd xmin xmax ymin ymax puts [ format "plvpor: xmin, xmax, ymin, ymax = %f %f %f %f" $xmin $xmax $ymin $ymax ] if {$xmin != 0.01 || $xmax != 0.99 || $ymin != 0.02 || $ymax != 0.49} { puts stderr "plgvpd test failed" set status 1 } set xmid [ expr {0.5*($xmin+$xmax)} ] set ymid [ expr {0.5*($ymin+$ymax)} ] $w cmd plwind 0.2 0.3 0.4 0.5 $w cmd plgvpw xmin xmax ymin ymax puts [ format "plwind: xmin, xmax, ymin, ymax = %f %f %f %f" $xmin $xmax $ymin $ymax ] if {$xmin != 0.2 || $xmax != 0.3 || $ymin != 0.4 || $ymax != 0.5} { puts stderr "plgvpw test failed" set status 1 } # Get world coordinates for middle of viewport $w cmd plcalc_world $xmid $ymid wx wy win puts [ format "world parameters: wx, wy, win = %f %f %d" $wx $wy $win ] if {abs($wx-0.5*($xmin+$xmax)) > 1.0E-5 || abs($wy-0.5*($ymin+$ymax)) > 1.0E-5} { puts stderr "plcalc_world test failed" set status 1 } # Retrieve and print the name of the output file (if any) $w cmd plgfnam fnam if {$fnam == ""} { puts [ format "No output file name is set" ] } {else} { puts [ format "Output file name read" ] } puts stderr [ format "Output file name is %s" $fnam ] # Set and get the number of digits used to display axis labels # Note digits is currently ignored in pls[xyz]ax and # therefore it does not make sense to test the returned value. $w cmd plsxax 3 0 $w cmd plgxax digmax digits puts [ format "x axis parameters: digmax, digits = %d %d" $digmax $digits ] if {$digmax != 3} { puts stderr "plgxax test failed" set status 1 } $w cmd plsyax 4 0 $w cmd plgyax digmax digits puts [ format "y axis parameters: digmax, digits = %d %d" $digmax $digits ] if {$digmax != 4} { puts stderr "plgyax test failed" set status 1 } $w cmd plszax 5 0 $w cmd plgzax digmax digits puts [ format "z axis parameters: digmax, digits = %d %d" $digmax $digits ] if {$digmax != 5} { puts stderr "plgzax test failed" set status 1 } $w cmd plsdidev 0.05 [expr {$::PLPLOT::PL_NOTSET}] 0.1 0.2 $w cmd plgdidev mar aspect jx jy puts [ format "device-space window parameters: mar, aspect, jx, jy = %f %f %f %f" $mar $aspect $jx $jy ] if {$mar != 0.05 || $jx != 0.1 || $jy != 0.2} { puts stderr "plgdidev test failed" set status 1 } $w cmd plsdiori 1.0 $w cmd plgdiori ori puts [ format "ori parameter = %f" $ori ] if {$ori != 1.0 } { puts stderr "plgdiori test failed" set status 1 } $w cmd plsdiplt 0.1 0.2 0.9 0.8 $w cmd plgdiplt xmin ymin xmax ymax puts [ format "plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f" $xmin $ymin $xmax $ymax ] if {$xmin != 0.1 || $xmax != 0.9 || $ymin != 0.2 || $ymax != 0.8} { puts stderr "plgdiplt test failed" set status 1 } $w cmd plsdiplz 0.1 0.1 0.9 0.9 $w cmd plgdiplt zxmin zymin zxmax zymax puts [ format "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f" $zxmin $zymin $zxmax $zymax ] if {abs($zxmin -($xmin + ($xmax-$xmin)*0.1)) > 1.0E-5 || abs($zxmax -($xmin+($xmax-$xmin)*0.9)) > 1.0E-5 || abs($zymin -($ymin+($ymax-$ymin)*0.1)) > 1.0E-5 || abs($zymax -($ymin+($ymax-$ymin)*0.9)) > 1.0E-5 } { puts stderr "plsdiplz test failed" set status 1 } $w cmd plscolbg 10 20 30 $w cmd plgcolbg r g b puts [ format "background colour parameters: r, g, b = %d %d %d" $r $g $b ] if {$r != 10 || $g != 20 || $b != 30} { puts stderr "plgcolbg test failed" set status 1 } $w cmd plscolbga 20 30 40 0.5 $w cmd plgcolbga r g b a puts [ format "background/transparency colour parameters: r, g, b, a = %d %d %d %f" $r $g $b $a ] if {$r != 20 || $g != 30 || $b != 40 || $a != 0.5} { puts stderr "plgcolbga test failed" set status 1 } # Restore defaults # $w cmd plcol0 1 $w cmd plend } plplot-5.10.0+dfsg/examples/tcl/x06.tcl 644 1750 1750 340511530413277 164560ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x06.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- proc x06 {{w loopback}} { matrix x f 1 matrix y f 1 for {set kind_font 0} {$kind_font < 2} {incr kind_font} { $w cmd plfontld $kind_font if {$kind_font == 0} { set maxfont 1 } else { set maxfont 4 } for {set font 0} {$font < $maxfont} {incr font} { $w cmd plfont [expr {$font+1}] $w cmd pladv 0 # Set up viewport and window $w cmd plcol0 2 $w cmd plvpor 0.1 1.0 0.1 0.9 $w cmd plwind 0.0 1.0 0.0 1.3 # Draw the grid using plbox $w cmd plbox "bcg" 0.1 0 "bcg" 0.1 0 # Write the digits below the frame $w cmd plcol0 15 for {set i 0} {$i <= 9} {incr i} { $w cmd plmtex "b" 1.5 [expr {0.1 * $i + 0.05}] 0.5 $i } set k 0 for {set i 0} {$i <= 12} {incr i} { # Write the digits to the left of the frame $w cmd plmtex "lv" 1.0 [expr {1.0 - (2 * $i + 1)/26.0}] 1.0 [expr {10*$i}] for {set j 0} {$j <= 9} {incr j} { x 0 = [expr {0.1 * $j + 0.05}] y 0 = [expr {1.25 - 0.1 * $i}] # Display the symbols if {$k < 128} { $w cmd plpoin 1 x y $k } incr k } } if {$kind_font==0} { $w cmd plmtex "t" 1.5 0.5 0.5 "PLplot Example 6 - plpoin symbols (compact)" } else { $w cmd plmtex "t" 1.5 0.5 0.5 "PLplot Example 6 - plpoin symbols (extended)" } } } # Restore defaults # $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/x28.tcl 644 1750 1750 3107111543675237 165140ustar andrewandrew# $Id: x28.tcl 11680 2011-03-27 17:57:51Z airwin $ # # plmtex3, plptex3 demo. # # Copyright (C) 2007 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # # Demonstrates plotting text in 3D. # proc x28 {{w loopback}} { # Choose these values to correspond to tick marks. set XPTS 2 set YPTS 2 set NREVOLUTION 16 set NROTATION 8 set NSHEAR 8 set pi $::PLPLOT::PL_PI set xmin 0. set xmax 1.0 set xmid [expr {0.5*($xmax + $xmin)}] set xrange [expr {$xmax - $xmin}] set ymin 0. set ymax 1.0 set ymid [expr {0.5*($ymax + $ymin)}] set yrange [expr {$ymax - $ymin}] set zmin 0. set zmax 1.0 set zmid [expr {0.5*($zmax + $zmin)}] set zrange [expr {$zmax - $zmin}] set ysmin [expr {$ymin + 0.1 * $yrange}] set ysmax [expr {$ymax - 0.1 * $yrange}] set ysrange [expr {$ysmax - $ysmin}] set dysrot [expr {$ysrange / ( $NROTATION - 1 )}] set dysshear [expr {$ysrange / ( $NSHEAR - 1 )}] set zsmin [expr {$zmin + 0.1 * $zrange}] set zsmax [expr {$zmax - 0.1 * $zrange}] set zsrange [expr {$zsmax - $zsmin}] set dzsrot [expr {$zsrange / ( $NROTATION - 1 )}] set dzsshear [expr {$zsrange / ( $NSHEAR - 1 )}] # p1string must be exactly one character + the null termination # character. set p1string "O" set pstring "The future of our civilization depends on software freedom." # Allocate and define the minimal x, y, and z to insure 3D box matrix x f $XPTS matrix y f $YPTS matrix z f $XPTS $YPTS for {set i 0} {$i < $XPTS} {incr i} { x $i = [expr {$xmin + double($i) * ($xmax-$xmin)/ double($XPTS-1)}] } for {set j 0} {$j < $YPTS} {incr j} { y $j = [expr {$ymin + double($j) * ($ymax-$ymin)/ double($YPTS-1)}] } for {set i 0} {$i < $XPTS} {incr i} { for {set j 0} {$j < $YPTS} {incr j} { z $i $j = 0. } } # Page 1: Demonstrate inclination and shear capability pattern. $w cmd pladv 0 $w cmd plvpor -0.15 1.15 -0.05 1.05 $w cmd plwind -1.2 1.2 -0.8 1.5 $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45. $w cmd plcol0 2 $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \ "b" "" [expr {$ymax-$ymin}] 0 \ "bcd" "" [expr {$zmax-$zmin}] 0 # z = zmin. $w cmd plschr 0. 1.0 for {set i 0} {$i < $NREVOLUTION} {incr i} { set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set x_inclination [expr {0.5*$xrange*$cos_omega}] set y_inclination [expr {0.5*$yrange*$sin_omega}] set z_inclination 0. set x_shear [expr {-0.5*$xrange*$sin_omega}] set y_shear [expr {0.5*$yrange*$cos_omega}] set z_shear 0. $w cmd plptex3 \ $xmid $ymid $zmin \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.0 " revolution" } # x = xmax. $w cmd plschr 0. 1.0 for {set i 0} {$i < $NREVOLUTION} {incr i} { set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set x_inclination 0. set y_inclination [expr {-0.5*$yrange*$cos_omega}] set z_inclination [expr {0.5*$zrange*$sin_omega}] set x_shear 0. set y_shear [expr {0.5*$yrange*$sin_omega}] set z_shear [expr {0.5*$zrange*$cos_omega}] $w cmd plptex3 \ $xmax $ymid $zmid \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.0 " revolution" } # y = ymax. $w cmd plschr 0., 1.0 for {set i 0} {$i < $NREVOLUTION} {incr i} { set omega [expr {2.*$pi*double($i)/double($NREVOLUTION)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set x_inclination [expr {0.5*$xrange*$cos_omega}] set y_inclination 0. set z_inclination [expr {0.5*$zrange*$sin_omega}] set x_shear [expr {-0.5*$xrange*$sin_omega}] set y_shear 0. set z_shear [expr {0.5*$zrange*$cos_omega}] $w cmd plptex3 \ $xmid $ymax $zmid \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.0 " revolution" } # Draw minimal 3D grid to finish defining the 3D box. $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}] # Page 2: Demonstrate rotation of string around its axis. $w cmd pladv 0 $w cmd plvpor -0.15 1.15 -0.05 1.05 $w cmd plwind -1.2 1.2 -0.8 1.5 $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45. $w cmd plcol0 2 $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \ "b" "" [expr {$ymax-$ymin}] 0 \ "bcd" "" [expr {$zmax-$zmin}] 0 # y = ymax. $w cmd plschr 0. 1.0 set x_inclination 1. set y_inclination 0. set z_inclination 0. set x_shear 0. for {set i 0} {$i < $NROTATION} {incr i} { set omega [expr {2.*$pi*double($i)/double($NROTATION)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set y_shear [expr {0.5*$yrange*$sin_omega}] set z_shear [expr {0.5*$zrange*$cos_omega}] set zs [expr {$zsmax - $dzsrot*$i}] $w cmd plptex3 \ $xmid $ymax $zs \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 "rotation for y = y#dmax#u" } # x = xmax. $w cmd plschr 0. 1.0 set x_inclination 0. set y_inclination -1. set z_inclination 0. set y_shear 0. for {set i 0} {$i < $NROTATION} {incr i} { set omega [expr {2.*$pi*double($i)/double($NROTATION)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set x_shear [expr {0.5*$xrange*$sin_omega}] set z_shear [expr {0.5*$zrange*$cos_omega}] set zs [expr {$zsmax - $dzsrot*$i}] $w cmd plptex3 \ $xmax $ymid $zs \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 "rotation for x = x#dmax#u" } # z = zmin. $w cmd plschr 0. 1.0 set x_inclination 1. set y_inclination 0. set z_inclination 0. set x_shear 0. for {set i 0} {$i < $NROTATION} {incr i} { set omega [expr {2.*$pi*double($i)/double($NROTATION)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set y_shear [expr {0.5*$yrange*$cos_omega}] set z_shear [expr {0.5*$zrange*$sin_omega}] set ys [expr {$ysmax - $dysrot*$i}] $w cmd plptex3 \ $xmid $ys $zmin \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 "rotation for z = z#dmin#u" } # Draw minimal 3D grid to finish defining the 3D box. $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}] # Page 3: Demonstrate shear of string along its axis. # Work around xcairo and pngcairo (but not pscairo) problems for # shear vector too close to axis of string. (N.B. no workaround # would be domega = 0.) set domega 0.05 $w cmd pladv 0 $w cmd plvpor -0.15 1.15 -0.05 1.05 $w cmd plwind -1.2 1.2 -0.8 1.5 $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45. $w cmd plcol0 2 $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \ "b" "" [expr {$ymax-$ymin}] 0 \ "bcd" "" [expr {$zmax-$zmin}] 0 # y = ymax. $w cmd plschr 0. 1.0 set x_inclination 1. set y_inclination 0. set z_inclination 0. set y_shear 0. for {set i 0} {$i < $NSHEAR} {incr i} { set omega [expr {$domega + 2.*$pi*double($i)/double($NSHEAR)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set x_shear [expr {0.5*$xrange*$sin_omega}] set z_shear [expr {0.5*$zrange*$cos_omega}] set zs [expr {$zsmax - $dzsshear*$i}] $w cmd plptex3 \ $xmid $ymax $zs \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 "shear for y = y#dmax#u" } # x = xmax. $w cmd plschr 0. 1.0 set x_inclination 0. set y_inclination -1. set z_inclination 0. set x_shear 0. for {set i 0} {$i < $NSHEAR} {incr i} { set omega [expr {$domega + 2.*$pi*double($i)/double($NSHEAR)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set y_shear [expr {-0.5*$yrange*$sin_omega}] set z_shear [expr {0.5*$zrange*$cos_omega}] set zs [expr {$zsmax - $dzsshear*$i}] $w cmd plptex3 \ $xmax $ymid $zs \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 "shear for x = x#dmax#u" } # z = zmin. $w cmd plschr 0. 1.0 set x_inclination 1. set y_inclination 0. set z_inclination 0. set z_shear 0. for {set i 0} {$i < $NSHEAR} {incr i} { set omega [expr {$domega + 2.*$pi*double($i)/double($NSHEAR)}] set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set y_shear [expr {0.5*$yrange*$cos_omega}] set x_shear [expr {0.5*$xrange*$sin_omega}] set ys [expr {$ysmax - $dysshear*$i}] $w cmd plptex3 \ $xmid $ys $zmin \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 "shear for z = z#dmin#u" } # Draw minimal 3D grid to finish defining the 3D box. $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}] # Page 4: Demonstrate drawing a string on a 3D path. $w cmd pladv 0 $w cmd plvpor -0.15 1.15 -0.05 1.05 $w cmd plwind -1.2 1.2 -0.8 1.5 $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 40. -30. $w cmd plcol0 2 $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \ "b" "" [expr {$ymax-$ymin}] 0 \ "bcd" "" [expr {$zmax-$zmin}] 0 $w cmd plschr 0. 1.2 # domega controls the spacing between the various characters of the # string and also the maximum value of omega for the given number # of characters in *pstring. set pslen [string length $pstring] set domega [expr {2.*$pi/$pslen}] set omega 0. # 3D function is a helix of the given radius and pitch set radius 0.5 set pitch [expr {1./(2.*$pi)}] for {set i 0} {$i < $pslen} {incr i} { set sin_omega [expr {sin($omega)}] set cos_omega [expr {cos($omega)}] set xpos [expr {$xmid + $radius*$sin_omega}] set ypos [expr {$ymid - $radius*$cos_omega}] set zpos [expr {$zmin + $pitch*$omega}] # In general, the inclination is proportional to the derivative of # the position wrt theta. set x_inclination [expr {$radius*$cos_omega}] set y_inclination [expr {$radius*$sin_omega}] set z_inclination [expr {$pitch}] # The shear vector should be perpendicular to the 3D line with Z # component maximized, but for low pitch a good approximation is # a constant vector that is parallel to the Z axis. set x_shear 0. set y_shear 0. set z_shear 1. $w cmd plptex3 \ $xpos $ypos $zpos \ $x_inclination $y_inclination $z_inclination \ $x_shear $y_shear $z_shear \ 0.5 [string range $pstring $i $i] set omega [expr {$omega + $domega}] } # Draw minimal 3D grid to finish defining the 3D box. $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}] # Page 5: Demonstrate plmtex3 axis labelling capability $w cmd pladv 0 $w cmd plvpor -0.15 1.15 -0.05 1.05 $w cmd plwind -1.2 1.2 -0.8 1.5 $w cmd plw3d 1.0 1.0 1.0 $xmin $xmax $ymin $ymax $zmin $zmax 20. 45. $w cmd plcol0 2 $w cmd plbox3 "b" "" [expr {$xmax-$xmin}] 0 \ "b" "" [expr {$ymax-$ymin}] 0 \ "bcd" "" [expr {$zmax-$zmin}] 0 $w cmd plschr 0. 1.0 $w cmd plmtex3 "xp" 3.0 0.5 0.5 "Arbitrarily displaced" $w cmd plmtex3 "xp" 4.5 0.5 0.5 "primary X-axis label" $w cmd plmtex3 "xs" -2.5 0.5 0.5 "Arbitrarily displaced" $w cmd plmtex3 "xs" -1.0 0.5 0.5 "secondary X-axis label" $w cmd plmtex3 "yp" 3.0 0.5 0.5 "Arbitrarily displaced" $w cmd plmtex3 "yp" 4.5 0.5 0.5 "primary Y-axis label" $w cmd plmtex3 "ys" -2.5 0.5 0.5 "Arbitrarily displaced" $w cmd plmtex3 "ys" -1.0 0.5 0.5 "secondary Y-axis label" $w cmd plmtex3 "zp" 4.5 0.5 0.5 "Arbitrarily displaced" $w cmd plmtex3 "zp" 3.0 0.5 0.5 "primary Z-axis label" $w cmd plmtex3 "zs" -2.5 0.5 0.5 "Arbitrarily displaced" $w cmd plmtex3 "zs" -1.0 0.5 0.5 "secondary Z-axis label" # Draw minimal 3D grid to finish defining the 3D box. $w cmd plmesh x y z $XPTS $YPTS [expr {$::PLPLOT::DRAW_LINEXY}] } plplot-5.10.0+dfsg/examples/tcl/x02 755 1750 1750 743 7602154465 156440ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x02 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x02.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x02.tcl plinit x02 plend plplot-5.10.0+dfsg/examples/tcl/x09.tcl 644 1750 1750 2463011530413277 165040ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x09.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- # Contour plot demo. proc x09 {{w loopback}} { set xpts 35 set ypts 46 matrix clevel f 11 = {-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.} matrix mark i 1 = { 1500 } matrix space i 1 = { 1500 } matrix zz f $xpts $ypts matrix ww f $xpts $ypts # Calculate the data matrices. for {set i 0} {$i < $xpts} {incr i} { set xx [expr {($i - ($xpts / 2)) / double($xpts / 2)} ] for {set j 0} {$j < $ypts} {incr j} { set yy [expr {($j - ($ypts / 2)) / double($ypts / 2) - 1.0} ] zz $i $j = [expr {$xx * $xx - $yy * $yy} ] ww $i $j = [expr {2. * $xx * $yy} ] } } matrix xg0 f $xpts matrix yg0 f $ypts matrix xg1 f $xpts matrix yg1 f $ypts matrix xg2 f $xpts $ypts matrix yg2 f $xpts $ypts set distort .4 # Build the 1-d coord arrays. for {set i 0} {$i < $xpts} {incr i} { set xx [expr {-1. + $i * ( 2. / ($xpts-1.) )}] xg0 $i = [expr {$xx}] xg1 $i = [expr {$xx + $distort * cos( .5 * $::PLPLOT::PL_PI * $xx )} ] } for {set j 0} {$j < $ypts} {incr j} { set yy [expr {-1. + $j * ( 2. / ($ypts-1.) )}] yg0 $j = [expr {$yy}] yg1 $j = [expr {$yy - $distort * cos( .5 * $::PLPLOT::PL_PI * $yy )} ] } # Build the 2-d coord arrays. for {set i 0} {$i < $xpts} {incr i} { set xx [expr {-1. + $i * ( 2. / ($xpts-1.) )}] for {set j 0} {$j < $ypts} {incr j} { set yy [expr {-1. + $j * ( 2. / ($ypts-1.) )}] set argx [expr .5 * $::PLPLOT::PL_PI * $xx] set argy [expr .5 * $::PLPLOT::PL_PI * $yy] xg2 $i $j = [expr {$xx + $distort * cos($argx) * cos($argy)} ] yg2 $i $j = [expr {$yy - $distort * cos($argx) * cos($argy)} ] } } # Plot using scaled identity transformation used to create # xg0 and yg0. The implementation is different, but this gives # the same results as the mypltr transformation for the first # plots in x09c. # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 0 # $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 # $w cmd plcol0 2 # $w cmd plcont zz clevel pltr1 xg0 yg0 # $w cmd plstyl 1 mark space # $w cmd plcol0 3 # $w cmd plcont ww clevel pltr1 xg0 yg0 # $w cmd plstyl 0 mark space # $w cmd plcol0 1 # $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" $w cmd pl_setcontlabelformat 4 3 $w cmd pl_setcontlabelparam 0.006 0.3 0.1 1 $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 $w cmd plcol0 2 $w cmd plcont zz clevel pltr1 xg0 yg0 $w cmd plstyl 1 mark space $w cmd plcol0 3 $w cmd plcont ww clevel pltr1 xg0 yg0 $w cmd plstyl 0 mark space $w cmd plcol0 1 $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" # Plot using 1d coordinate transform $w cmd pl_setcontlabelparam 0.006 0.3 0.1 0 $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 $w cmd plcol0 2 $w cmd plcont zz clevel pltr1 xg1 yg1 $w cmd plstyl 1 mark space $w cmd plcol0 3 $w cmd plcont ww clevel pltr1 xg1 yg1 $w cmd plstyl 0 mark space $w cmd plcol0 1 $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 1 # $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 # $w cmd plcol0 2 # $w cmd plcont zz clevel pltr1 xg1 yg1 # $w cmd plstyl 1 mark space # $w cmd plcol0 3 # $w cmd plcont ww clevel pltr1 xg1 yg1 # $w cmd plstyl 0 mark space # $w cmd plcol0 1 # $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" # Plot using 2d coordinate transform # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 0 $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 $w cmd plcol0 2 $w cmd plcont zz clevel pltr2 xg2 yg2 $w cmd plstyl 1 mark space $w cmd plcol0 3 $w cmd plcont ww clevel pltr2 xg2 yg2 $w cmd plstyl 0 mark space $w cmd plcol0 1 $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 1 # $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 # $w cmd plcol0 2 # $w cmd plcont zz clevel pltr2 xg2 yg2 # $w cmd plstyl 1 mark space # $w cmd plcol0 3 # $w cmd plcont ww clevel pltr2 xg2 yg2 # $w cmd plstyl 0 mark space # $w cmd plcol0 1 # $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" #polar contour example. $w cmd pl_setcontlabelparam 0.006 0.3 0.1 0 x09_polar $w # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 1 # x09_polar $w #potential contour example. $w cmd pl_setcontlabelparam 0.006 0.3 0.1 0 x09_potential $w # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 1 # x09_potential $w # Restore defaults # $w cmd plcol0 1 # $w cmd pl_setcontlabelparam 0.006 0.3 0.1 0 $w cmd pllsty 1 } # Demonstrate plotting of wrapped data. What is significant to # understand about this example is that for the common case of # plotting polar data (or other forms of coordinates that wrap on # themselves) you can do it from Tcl /without/ having to go to the # trouble to construct a special data plotting matrix with an extra # row or column and then copy the data into it, replicating the first # row/col into the extra row/col. proc x09_polar {{w loopback}} { $w cmd plenv -1 1 -1 1 0 -2 $w cmd plcol0 1 # Hold perimeter matrix px f 100; matrix py f 100 for {set i 0} {$i < 100} {incr i} { set t [expr {2. * $::PLPLOT::PL_PI * $i / 99.}] px $i = [expr {cos($t)}] py $i = [expr {sin($t)}] } $w cmd plline 100 px py set xpts 40; set ypts 40; set ylim [expr {$ypts - 1}]; set wrap 2 matrix xg f $xpts $ylim matrix yg f $xpts $ylim matrix z f $xpts $ylim for {set i 0} {$i < $xpts} {incr i} { set r [expr {$i / ($xpts - 1.)}] for {set j 0} {$j < $ylim} {incr j} { set t [expr {2. * $::PLPLOT::PL_PI * $j / ($ypts - 1.)}] xg $i $j = [expr {$r * cos($t)}] yg $i $j = [expr {$r * sin($t)}] z $i $j = $r } } matrix lev f 10 = { .05, .15, .25, .35, .45, .55, .65, .75, .85, .95 } $w cmd plcol0 2 $w cmd plcont z lev pltr2 xg yg $wrap $w cmd plcol0 1 $w cmd pllab "" "" "Polar Contour Plot" } proc x09_potential {{w loopback}} { # Shielded potential contour plot example set xpts 40; set ypts 64; set ylim [expr {$ypts - 1}]; set wrap 2; set perimeterpts 100; set nlevel 20 # Create data to be contoured. matrix xg f $xpts $ylim matrix yg f $xpts $ylim matrix z f $xpts $ylim for {set i 0} {$i < $xpts} {incr i} { set r [expr {0.5 + $i}] for {set j 0} {$j < $ylim} {incr j} { set theta [expr {(2. * $::PLPLOT::PL_PI / ($ypts - 1.))*(0.5 + $j)}] xg $i $j = [expr {$r * cos($theta)}] yg $i $j = [expr {$r * sin($theta)}] } } set rmax $r set xmin [xg 0 0] set xmax $xmin set ymin [yg 0 0] set ymax $ymin for {set i 0} {$i < $xpts} {incr i} { for {set j 0} {$j < $ylim} {incr j} { if {[xg $i $j] < $xmin} { set xmin [xg $i $j] } if {[xg $i $j] > $xmax} { set xmax [xg $i $j] } if {[yg $i $j] < $ymin} { set ymin [yg $i $j] } if {[yg $i $j] > $ymax} { set ymax [yg $i $j] } } } set x0 [expr {($xmin + $xmax)/2.}] set y0 [expr {($ymin + $ymax)/2.}] # Expanded limits. set peps 0.05 set xpmin [expr {$xmin - abs($xmin)*$peps}] set xpmax [expr {$xmax + abs($xmax)*$peps}] set ypmin [expr {$ymin - abs($ymin)*$peps}] set ypmax [expr {$ymax + abs($ymax)*$peps}] # Potential inside a conducting cylinder (or sphere) by method of images. # Charge 1 is placed at (d1, d1), with image charge at (d2, d2). # Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). # Also put in smoothing term at small distances. set eps 2. set q1 1. set d1 [expr {$rmax/4.}] set q1i [expr {- $q1*$rmax/$d1}] set d1i [expr {pow($rmax,2)/$d1}] set q2 -1. set d2 [expr {$rmax/4.}] set q2i [expr {- $q2*$rmax/$d2}] set d2i [expr {pow($rmax,2)/$d2}] for {set i 0} {$i < $xpts} {incr i} { for {set j 0} {$j < $ylim} {incr j} { set div1 [expr {sqrt(pow([xg $i $j]-$d1,2) + pow([yg $i $j]-$d1,2) + pow($eps,2))}] set div1i [expr {sqrt(pow([xg $i $j]-$d1i,2) + pow([yg $i $j]-$d1i,2) + pow($eps,2))}] set div2 [expr {sqrt(pow([xg $i $j]-$d2,2) + pow([yg $i $j]+$d2,2) + pow($eps,2))}] set div2i [expr {sqrt(pow([xg $i $j]-$d2i,2) + pow([yg $i $j]+$d2i,2) + pow($eps,2))}] z $i $j = [expr {$q1/$div1 + $q1i/$div1i + $q2/$div2 + $q2i/$div2i}] } } set zmin [z 0 0] set zmax $zmin for {set i 0} {$i < $xpts} {incr i} { for {set j 0} {$j < $ylim} {incr j} { if {[z $i $j] < $zmin} { set zmin [z $i $j] } if {[z $i $j] > $zmax} { set zmax [z $i $j] } } } # Positive and negative contour levels. set dz [expr {($zmax-$zmin)/$nlevel}] set nlevelneg 0 set nlevelpos 0 matrix clevelneg f $nlevel matrix clevelpos f $nlevel for {set i 0} {$i < $nlevel} {incr i} { set clevel [expr {$zmin + ($i + 0.5)*$dz}] if {$clevel <= 0.} { clevelneg $nlevelneg = $clevel; incr nlevelneg } else { clevelpos $nlevelpos = $clevel; incr nlevelpos } } # Colours! set ncollin 11 set ncolbox 1 set ncollab 2 # Finally start plotting this page! $w cmd pladv 0 $w cmd plcol0 $ncolbox $w cmd plvpas 0.1 0.9 0.1 0.9 1.0 $w cmd plwind $xpmin $xpmax $ypmin $ypmax $w cmd plbox "" 0. 0 "" 0. 0 $w cmd plcol0 $ncollin if {$nlevelneg >0} { # Negative contours # copy partially full clevelneg to full levneg required by plcont matrix levneg f $nlevelneg for {set i 0} {$i < $nlevelneg} {incr i} { levneg $i = [clevelneg $i] } $w cmd pllsty 2 $w cmd plcont z levneg pltr2 xg yg $wrap } if {$nlevelpos >0} { # Positive contours # copy partially full clevelpos to full levpos required by plcont matrix levpos f $nlevelpos for {set i 0} {$i < $nlevelpos} {incr i} { levpos $i = [clevelpos $i] } $w cmd pllsty 1 $w cmd plcont z levpos pltr2 xg yg $wrap } #Draw outer boundary matrix px f $perimeterpts matrix py f $perimeterpts for {set i 0} {$i < $perimeterpts} {incr i} { set t [expr {(2.*$::PLPLOT::PL_PI/($perimeterpts-1))*$i}] px $i = [expr {$x0 + $rmax*cos($t)}] py $i = [expr {$y0 + $rmax*sin($t)}] } $w cmd plcol0 $ncolbox $w cmd plline $perimeterpts px py $w cmd plcol0 $ncollab $w cmd pllab "" "" "Shielded potential of charges in a conducting sphere" } plplot-5.10.0+dfsg/examples/tcl/x10.tcl 644 1750 1750 105411052523130 164340ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x10.tcl 8674 2008-08-19 10:54:16Z andrewross $ #---------------------------------------------------------------------------- proc x10 {{w loopback}} { $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 1.0 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plbox bc 0.0 0 bc 0.0 0 $w cmd plsvpa 50.0 150.0 50.0 100.0 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plbox bc 0.0 0 bc 0.0 0 $w cmd plptex 0.5 0.5 1.0 0.0 0.5 "BOX at (50,150,50,100)" # Restore defaults # $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/x26 755 1750 1750 176111511542345 157030ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x26 11447 2011-01-07 07:46:45Z arjenmarkus $ # # Arjen Markus # 08/18/08 # # A front-end to x26.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} # # This example uses UTF-8 characters, placed directly in the source code # if { [encoding system] != "utf-8" } { if { [package vsatisfies [info patch] 8.5] } { source -encoding utf-8 x26.tcl } else { # # Pre-Tcl 8.5 # set infile [open "x26.tcl"] set contents [read $infile] close $infile eval [encoding convertfrom utf-8 \ [encoding convertto [encoding system] $contents]] } } else { # # Plain source will do # source x26.tcl } plinit x26 plend plplot-5.10.0+dfsg/examples/tcl/tcldemos.tcl 644 1750 1750 360412015507201 176420ustar andrewandrew#---------------------------------------------------------------------------- # $Id: tcldemos.tcl 12225 2012-08-23 20:11:45Z airwin $ # # PLplot TCL demos # # Maurice LeBrun # IFS, University of Texas at Austin # 23-Jun-1994 # # To plot these, start up pltcl with the argument "standard_examples". # Choose one of the devices to start the demo. Press the space bar # to move to the next window or to the next example # # Note: each demo proc is supplied a widget argument if run from a widget, # or "loopback" if being run from pltcl. In the latter case, the # "loopback cmd" does nothing but is required to make the two styles of # Tcl scripts compatible. #---------------------------------------------------------------------------- proc sourceUtf8 {sourceFile} { if { [encoding system] != "utf-8" } { if { [package vsatisfies [info patch] 8.5] } { source -encoding utf-8 $sourceFile } else { # # Pre-Tcl 8.5 # set infile [open $sourceFile] set contents [read $infile] close $infile eval [encoding convertfrom utf-8 \ [encoding convertto [encoding system] $contents]] } } else { source $sourceFile } } set utf8_examples {4 18 24 26 33} for {set i 0} {$i <= 33} {incr i} { if {$i != 32} { set demo x[format "%02d" $i] # # If the source code contains UTF-8 characters (beyond the # ASCII-7 encoding), take special measures # if { [lsearch $utf8_examples $i] < 0 } { source $demo.tcl } else { sourceUtf8 $demo.tcl } # restore defaults proc $i {} " $demo loopback cmd pleop loopback cmd plcol0 1 loopback cmd plsori 0 loopback cmd plspal0 cmap0_default.pal loopback cmd plspal1 cmap1_default.pal 1 loopback cmd plstransform NULL " } } plplot-5.10.0+dfsg/examples/tcl/x03.tcl 644 1750 1750 426711541504455 164630ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x03.tcl 11665 2011-03-20 23:09:33Z hezekiahcarty $ #---------------------------------------------------------------------------- proc x03 {{w loopback}} { set twopi [expr {2. * $::PLPLOT::PL_PI}] # Set up viewport and window, but do not draw box $w cmd plenv -1.3 1.3 -1.3 1.3 1 -2 # Draw circles for polar grid set ni 10 set nj 360 set nj1 [expr {$nj + 1}] set dr [expr {1. / $ni}] set dtheta [expr {$twopi / $nj}] matrix xj f $nj1 matrix yj f $nj1 for {set i 1} {$i <= $ni} {incr i} { $w cmd plarc 0.0 0.0 [expr {0.1 * $i}]] [expr {0.1 * $i}] 0.0 360.0 0.0 0 } # Draw radial spokes for polar grid and write labels for angle $w cmd plcol0 2 for {set j 0} {$j <= 11} {incr j} { set theta [expr {$j * $twopi / 12.}] set xg [expr {cos($theta)}] set yg [expr {sin($theta)}] $w cmd pljoin 0.0 0.0 $xg $yg set theta_deg [expr {$theta*360./$twopi}] if {$theta_deg < 9.99} { set offset 0.45 } elseif {$theta_deg < 99.9} { set offset 0.30 } else { set offset 0.15 } # Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if {$xg >= -0.00001} { set dx $xg set dy $yg set just [expr {-$offset}] } else { set dx [expr {-$xg}] set dy [expr {-$yg}] set just [expr {1. + $offset}] } set label [expr {round($theta*360./$twopi)}] # N.B. cannot get this command to give same postscript output. Also visual # inspection shows 90 deg label jumping around slightly compared to python # and C front ends. No idea why (AWI comment). $w cmd plptex $xg $yg $dx $dy $just $label } # Draw the graph set npts 360 set npts1 [expr {$npts+1}] set dtheta [expr {$twopi / $npts}] matrix x f $npts1 matrix y f $npts1 for {set j 0} {$j <= $npts} {incr j} { set theta [expr {$j * $dtheta}] set r [expr {sin(5 * $theta)}] x $j = [expr {$r * cos($theta)}] y $j = [expr {$r * sin($theta)}] } $w cmd plcol0 3 $w cmd plline $npts1 x y $w cmd plcol0 4 $w cmd plmtex "t" 2.0 0.5 0.5 "#frPLplot Example 3 - r(#gh)=sin 5#gh" # Restore defaults # $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/x31 755 1750 1750 100311123041377 156620ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x31 9211 2008-12-20 00:57:35Z airwin $ # # Maurice LeBrun # 12/24/02 # # A front-end to x31.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x31.tcl # Note x31.tcl handles both plinit and plend. x31 plplot-5.10.0+dfsg/examples/tcl/x29 755 1750 1750 74611053257456 156770ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x29 8697 2008-08-21 12:27:26Z andrewross $ # # Maurice LeBrun # 12/24/02 # # A front-end to x29.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x29.tcl plinit x29 plend plplot-5.10.0+dfsg/examples/tcl/x24.tcl 644 1750 1750 662111543675237 164730ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x24.tcl 11680 2011-03-27 17:57:51Z airwin $ #---------------------------------------------------------------------------- # Unicode Pace Flag # # Copyright (C) 2005 Rafael Laboissiere # Copyright (C) 2008 Andrew Ross # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # In Debian, run like this: # # ( TTFDIR=/usr/share/fonts/truetype ; \ # PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \ # PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \ # PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \ # PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \ # PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \ # ./x24 -dev png -o x24t.png ) # # Packages needed: # # ttf-arphic-bkai00mp # ttf-freefont # ttf-devanagari-fonts # ttf-unfonts # ttf-bengali-fonts # # For the latest Ubuntu systems lohit_hi.ttf has been moved to the # ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you # will have to use this package instead and update the font path. proc x24 {{w loopback}} { matrix red i 7 = {240, 204, 204, 204, 0, 39, 125} matrix green i 7 = {240, 0, 125, 204, 204, 80, 0} matrix blue i 7 = {240, 0, 0, 0, 0, 204, 125} matrix px f 4 = {0.0, 0.0, 1.0, 1.0} matrix py f 4 = {0.0, 0.25, 0.25, 0.0} matrix sx f 12 = { 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 } matrix sy f 12 = { 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 } # Taken from http://www.columbia.edu/~fdc/pace/ # Mandarin # Hindi # English # Hebrew # Russian # German # Korean # French # Spanish # Arabic # Turkish # Kurdish set peace { "#<0x00>和平" "#<0x20>शांति" "#<0x10>Peace" "#<0x10>שלום" "#<0x10>Мир" "#<0x10>Friede" "#<0x30>평화" "#<0x10>Paix" "#<0x10>Paz" "#<0x10>ﺳﻼم" "#<0x10>Barış" "#<0x10>Hasîtî" } $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 1.0 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plcol0 0 $w cmd plbox "" 1.0 0 "" 1.0 0 $w cmd plscmap0n 7 $w cmd plscmap0 red green blue 7 $w cmd plschr 0 4.0 $w cmd plfont 1 for {set i 0} {$i < 4} {incr i} { $w cmd plcol0 [expr {$i + 1}] $w cmd plfill 4 px py for {set j 0} {$j < 4} {incr j} { py $j = [expr {[py $j] + 1.0 / 4.0}] } } $w cmd plcol0 0 set i 0 foreach pl $peace { $w cmd plptex [sx $i] [sy $i] 1.0 0.0 0.5 $pl set i [expr {$i+1}] } } plplot-5.10.0+dfsg/examples/tcl/x04 755 1750 1750 743 7602154465 156460ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x04 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x04.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x04.tcl plinit x04 plend plplot-5.10.0+dfsg/examples/tcl/pltcl_standard_examples.in 755 1750 1750 61112245713450 225400ustar andrewandrew#!@SH_EXECUTABLE@ # Examples 14 and 31 left out - see Tk standard_examples.in # Note the backslash at the end of the comments - this causes Tcl to # ignore the next line. It becomes a valid Tcl script as well as valid # shell script \ exec @pltcl_LOCATION@ "$0" "$@" source tcldemos.tcl plinit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 plspause 0 21 22 23 24 25 26 27 28 29 30 33 exit plplot-5.10.0+dfsg/examples/tcl/x15 755 1750 1750 743 7602154465 156500ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x15 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x15.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x15.tcl plinit x15 plend plplot-5.10.0+dfsg/examples/tcl/x03 755 1750 1750 75411400747465 156660ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x03 11043 2010-05-31 15:01:09Z airwin $ # # Maurice LeBrun # 12/24/02 # # A front-end to x03.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x03.tcl plsori 1 plinit x03 plend plplot-5.10.0+dfsg/examples/tcl/x08.tcl 644 1750 1750 1456511543675237 165230ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x08.tcl 11680 2011-03-27 17:57:51Z airwin $ # # Copyright (C) 2004 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #---------------------------------------------------------------------------- # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. # Routine for restoring colour map1 to default. # See static void plcmap1_def(void) in plctrl.c for reference. proc restore_cmap1_8 {w} { # For center control points, pick black or white, whichever is closer to bg # Be careful to pick just short of top or bottom else hue info is lost $w cmd plgcolbg rbg gbg bbg set vertex [expr {($rbg + $gbg + $bbg)/(3.*255.)}] if {$vertex < 0.5} { set vertex 0.01 set midpt 0.10 } else { set vertex 0.99 set midpt 0.90 } # Independent variable of control points. matrix i f 6 = {0., 0.44, 0.50, 0.50, 0.56, 1.} # Hue for control points. Blue-violet to red matrix h f 6 = {260., 260., 260., 0., 0., 0.} # Lightness ranging from medium to vertex to medium # double quotes required rather than braces so that variables # get evaluated for initialization. matrix l f 6 = "0.5, $midpt, $vertex, $vertex, $midpt, 0.5" # Saturation is complete for default matrix s f 6 = {1., 1., 1., 1., 1., 1.} # Integer flag array is zero (no interpolation along far-side of colour # figure) matrix rev i 6 = {0, 0, 0, 0, 0, 0} # Default number of cmap1 colours $w cmd plscmap1n 128 # Interpolate between control points to set up default cmap1. $w cmd plscmap1l 0 6 i h l s rev } # Routine for initializing color map 1 in HLS space. # Basic grayscale variation from half-dark (which makes more interesting # looking plot compared to dark) to light. proc cmap1_init_8 {w gray} { # Independent variable of control points. matrix i f 2 = {0., 1.} if {$gray == 1} { # Hue for control points. Doesn't matter since saturation is zero. matrix h f 2 = {0., 0.} # Lightness ranging from half-dark (for interest) to light. matrix l f 2 = {0.5, 1.} # Gray scale has zero saturation. matrix s f 2 = {0., 0.} } else { # Hue ranges from blue (240 deg) to red (0 or 360 deg) matrix h f 2 = {240., 0.} # Lightness and saturation are constant (values taken from C example). matrix l f 2 = {0.6, 0.6} matrix s f 2 = {0.8, 0.8} } # Integer flag array is zero (no interpolation along far-side of colour # figure matrix rev i 2 = {0, 0} # Number of cmap1 colours is 256 in this case. $w cmd plscmap1n 256 # Interpolate between control points to set up default cmap1. $w cmd plscmap1l 0 2 i h l s rev } proc x08 {{w loopback}} { # these should be defined elsewhere. set rosen 1 matrix alt f 2 = {60.0, 20.0} matrix az f 2 = {30.0, 60.0} set xpts 35 set ypts 46 set n_col 256 set two_pi [expr {2.0 * $::PLPLOT::PL_PI} ] matrix x f $xpts matrix y f $ypts matrix z f $xpts $ypts for {set i 0} {$i < $xpts} {incr i} { x $i = [expr {($i - ($xpts/2)) / double($xpts/2)} ] if {$rosen == 1} { x $i = [expr {1.5* [x $i]}] } } for {set i 0} {$i < $ypts} {incr i} { y $i = [expr {($i - ($ypts/2)) / double($ypts/2)} ] if {$rosen == 1} { y $i = [expr {0.5 + [y $i]}] } } for {set i 0} {$i < $xpts} {incr i} { set xx [x $i] for {set j 0} {$j < $ypts} {incr j} { set yy [y $j] if {$rosen == 1} { z $i $j = [expr {(pow(1. - $xx,2) + \ 100 * pow($yy - pow($xx,2),2))}] set zz [z $i $j] if {$zz > 0.} { z $i $j = [expr {log($zz)}] } else { z $i $j = [expr {-5.0}] } } else { set r [expr {sqrt( $xx * $xx + $yy * $yy )} ] z $i $j = [expr {exp(-$r * $r) * cos( $two_pi * $r )} ] } } } set zmin [z min [ expr $xpts * $ypts]] set zmax [z max [ expr $xpts * $ypts]] set nlev 10 matrix clev f $nlev set step [expr {($zmax-$zmin)/($nlev+1)}] for {set i 0} {$i < $nlev} {incr i} { clev $i = [expr {$zmin + ($i+1) * $step}] } $w cmd pllightsource 1. 1. 1. for {set k 0} {$k < 2} {incr k} { for {set ifshade 0} {$ifshade < 4} {incr ifshade} { $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 0.9 $w cmd plwind -1.0 1.0 -0.9 1.1 $w cmd plcol0 3 set title [format "#frPLplot Example 8 - Alt=%.0f, Az=%.0f" \ [alt $k] [az $k]] $w cmd plmtex "t" 1.0 0.5 0.5 $title $w cmd plcol0 1 if {$rosen == 1} { $w cmd plw3d 1.0 1.0 1.0 -1.5 1.5 -0.5 1.5 $zmin $zmax [alt $k] [az $k] } else { $w cmd plw3d 1.0 1.0 1.0 -1.0 1.0 -1.0 1.0 $zmin $zmax [alt $k] [az $k] } $w cmd plbox3 "bnstu" "x axis" 0.0 0 \ "bnstu" "y axis" 0.0 0 \ "bcdmnstuv" "z axis" 0.0 0 $w cmd plcol0 2 # diffuse light surface plot if {$ifshade == 0} { cmap1_init_8 $w 1 $w cmd plsurf3d x y z 0 # magnitude colored plot } elseif {$ifshade == 1} { cmap1_init_8 $w 0 # Note: the [expr] command is essential here - plsurf3d doesn't accept # the hexadecimal form apparently! $w cmd plsurf3d x y z [expr {$::PLPLOT::MAG_COLOR}] # magnitude colored plot with faceted squares } elseif {$ifshade == 2} { cmap1_init_8 $w 0 $w cmd plsurf3d x y z [expr {$::PLPLOT::MAG_COLOR | $::PLPLOT::FACETED}] # magnitude colored plot with contours. } else { cmap1_init_8 $w 0 $w cmd plsurf3d x y z $xpts $ypts \ [expr {$::PLPLOT::MAG_COLOR | $::PLPLOT::SURF_CONT | $::PLPLOT::BASE_CONT}] clev $nlev } } } # Restore defaults # $w cmd plcol0 1 restore_cmap1_8 $w } plplot-5.10.0+dfsg/examples/tcl/plgrid.tcl 644 1750 1750 374111540631600 173160ustar andrewandrew#---------------------------------------------------------------------------- # $Id: plgrid.tcl 11645 2011-03-18 10:27:12Z andrewross $ # # Demo polar grid plotter # # # This programme uses the loopback widget so it can be run from either pltcl # with a choice of the standard drivers or plserver with the plframe widget. # (1) pltcl: # execute pltcl and type plinit to get a selection of # device types. Choose one of the devices then type # "source plgrid.tcl" (this file), then type "plgrid" # with no arguments. # (2) plserver # execute plserver then type the following (see ../tk/tkdemos.tcl for # many other working examples of this method). # plstdwin . # plxframe .plw # pack append . .plw {left expand fill} # source plgrid.tcl # proc 1 {} "plgrid .plw.plwin" # to execute this procedure that you have just created execute the "1" # command. #---------------------------------------------------------------------------- proc plgrid {{w loopback}} { set ni 10 set nj 20 set nj1 [expr $nj + 1] matrix xi f $ni matrix yi f $ni matrix xj f $nj1 matrix yj f $nj1 set dr [expr 1. / $ni] set dtheta [expr 2. * 3.14159265358979323846 / $nj] # Set up viewport and window, but do not draw box $w cmd plssub 1 1 $w cmd plcol0 1 $w cmd plenv -1.3 1.3 -1.3 1.3 1 -2 # Draw i-lines for {set i 0} {$i < $ni} {incr i} { for {set j 0} {$j < $nj1} {incr j} { set r [expr $i * $dr] set theta [expr $j * $dtheta] set psi [expr $theta + 0.5 * $r * sin($theta)] xj $j = [expr $r * cos($psi)] yj $j = [expr $r * sin($psi)] } $w cmd plline $nj1 xj yj } # Draw j-lines for {set j 0} {$j < $nj} {incr j} { for {set i 0} {$i < $ni} {incr i} { set r [expr $i * $dr] set theta [expr $j * $dtheta] set psi [expr $theta + 0.5 * $r * sin($theta)] xi $i = [expr $r * cos($psi)] yi $i = [expr $r * sin($psi)] } $w cmd plline $ni xi yi } } plplot-5.10.0+dfsg/examples/tcl/x17 755 1750 1750 743 7602154465 156520ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x17 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x17.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x17.tcl plinit x17 plend plplot-5.10.0+dfsg/examples/tcl/x20 755 1750 1750 74711056170020 156470ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x20 8722 2008-08-30 07:00:32Z arjenmarkus $ # # Maurice LeBrun # 12/24/02 # # A front-end to x06.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x20.tcl plinit x20 plend plplot-5.10.0+dfsg/examples/tcl/x07.tcl 644 1750 1750 303311530413277 164540ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x07.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- proc x07 {{w loopback}} { matrix base i 20 = \ {0, 100, 0, 100, 200, 500, 600, 700, 800, 900, \ 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900} matrix x f 1 matrix y f 1 $w cmd plfontld 0 for {set l 0} {$l < 20} {incr l} { if {$l == 2} { $w cmd plfontld 1 } $w cmd pladv 0 # Set up viewport and window $w cmd plcol0 2 $w cmd plvpor 0.15 0.95 0.1 0.9 $w cmd plwind 0.0 1.0 0.0 1.0 # Draw the grid using plbox $w cmd plbox "bcg" 0.1 0 "bcg" 0.1 0 # Write the digits below the frame $w cmd plcol0 15 for {set i 0} {$i <= 9} {incr i} { $w cmd plmtex "b" 1.5 [expr {0.1 * $i + 0.05}] 0.5 $i } set k 0 for {set i 0} {$i <= 9} {incr i} { # Write the digits to the left of the frame $w cmd plmtex "lv" 1.0 [expr {0.95 - 0.1 * $i}] 1.0 \ [expr {[base $l] + 10*$i}] for {set j 0} {$j <= 9} {incr j} { x 0 = [expr {0.1 * $j + 0.05}] y 0 = [expr {0.95 - 0.1 * $i}] # Display the symbols $w cmd plsym 1 x y [expr {[base $l] + $k}] incr k } } if {$l < 2} { $w cmd plmtex "t" 1.5 0.5 0.5 "PLplot Example 7 - PLSYM symbols (compact)" } else { $w cmd plmtex "t" 1.5 0.5 0.5 "PLplot Example 7 - PLSYM symbols (extended)" } } # Restore defaults # $w cmd plcol0 1 $w cmd plfontld 0 } plplot-5.10.0+dfsg/examples/tcl/x09 755 1750 1750 743 7602154465 156530ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x09 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x09.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x09.tcl plinit x09 plend plplot-5.10.0+dfsg/examples/tcl/x25.tcl 644 1750 1750 763411543675237 165010ustar andrewandrew# $Id: x25.tcl 11680 2011-03-27 17:57:51Z airwin $ # # Filling and clipping polygons. # # Copyright (C) 2005 Arjen Markus # Copyright (C) 2008 Andrew Ross # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #-------------------------------------------------------------------------- # main # # Test program for filling polygons and proper clipping #-------------------------------------------------------------------------- proc x25 {{w loopback}} { set npts 0 $w cmd pladv 0 $w cmd plssub 3 3 matrix xextreme f 10 2 matrix yextreme f 10 2 matrix x0 f 10 matrix y0 f 10 xextreme 0 0 = -120.0 xextreme 0 1 = 120.0 yextreme 0 0 = -120.0 yextreme 0 1 = 120.0 xextreme 1 0 = -120.0 xextreme 1 1 = 120.0 yextreme 1 0 = 20.0 yextreme 1 1 = 120.0 xextreme 2 0 = -120.0 xextreme 2 1 = 120.0 yextreme 2 0 = -20.0 yextreme 2 1 = 120.0 xextreme 3 0 = -80.0 xextreme 3 1 = 80.0 yextreme 3 0 = -20.0 yextreme 3 1 = 120.0 xextreme 4 0 = -220.0 xextreme 4 1 = -120.0 yextreme 4 0 = -120.0 yextreme 4 1 = 120.0 xextreme 5 0 = -20.0 xextreme 5 1 = 20.0 yextreme 5 0 = -120.0 yextreme 5 1 = 120.0 xextreme 6 0 = -20.0 xextreme 6 1 = 20.0 yextreme 6 0 = -20.0 yextreme 6 1 = 20.0 xextreme 7 0 = -80.0 xextreme 7 1 = 80.0 yextreme 7 0 = -80.0 yextreme 7 1 = 80.0 xextreme 8 0 = 20.0 xextreme 8 1 = 120.0 yextreme 8 0 = -120.0 yextreme 8 1 = 120.0 for {set k 0} {$k < 2} {incr k} { for {set j 0} {$j < 4} {incr j} { if { $j == 0 } { # Polygon 1: a diamond x0 0 = 0 y0 0 = -100 x0 1 = -100 y0 1 = 0 x0 2 = 0 y0 2 = 100 x0 3 = 100 y0 3 = 0 set npts 4 } if { $j == 1 } { # Polygon 1: a diamond - reverse direction x0 3 = 0 y0 3 = -100 x0 2 = -100 y0 2 = 0 x0 1 = 0 y0 1 = 100 x0 0 = 100 y0 0 = 0 set npts 4 } if { $j == 2 } { # Polygon 2: a square with punctures x0 0 = -100 y0 0 = -100 x0 1 = -100 y0 1 = -80 x0 2 = 80 y0 2 = 0 x0 3 = -100 y0 3 = 80 x0 4 = -100 y0 4 = 100 x0 5 = -80 y0 5 = 100 x0 6 = 0 y0 6 = 80 x0 7 = 80 y0 7 = 100 x0 8 = 100 y0 8 = 100 x0 9 = 100 y0 9 = -100 set npts 10 } if { $j == 3 } { # Polygon 2: a square with punctures - reversed direction x0 9 = -100 y0 9 = -100 x0 8 = -100 y0 8 = -80 x0 7 = 80 y0 7 = 0 x0 6 = -100 y0 6 = 80 x0 5 = -100 y0 5 = 100 x0 4 = -80 y0 4 = 100 x0 3 = 0 y0 3 = 80 x0 2 = 80 y0 2 = 100 x0 1 = 100 y0 1 = 100 x0 0 = 100 y0 0 = -100 set npts 10 } for {set i 0} {$i < 9} {incr i} { $w cmd pladv 0 $w cmd plvsta $w cmd plwind [xextreme $i 0] [xextreme $i 1] [yextreme $i 0] [yextreme $i 1] $w cmd plcol0 2 $w cmd plbox "bc" 1.0 0 "bcnv" 10.0 0 $w cmd plcol0 1 $w cmd plpsty 0 if { $k == 0 } { $w cmd plfill $npts x0 y0 } else { $w cmd plgradient $npts x0 y0 45.0 } $w cmd plcol0 2 $w cmd pllsty 1 $w cmd plline $npts x0 y0 } } } # Restore defaults $w cmd plssub 1 1 $w cmd pleop } plplot-5.10.0+dfsg/examples/tcl/x11 755 1750 1750 743 7602154465 156440ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x11 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x11.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x11.tcl plinit x11 plend plplot-5.10.0+dfsg/examples/tcl/r.dat 644 1750 1750 576 6041313240 162240ustar andrewandrew# # Test query data # Plot parameters follow: # # set lsty 0 # set poin 6 # set title "DejaNews activity 10/10/95" # set xlab time # set xmax 60 # set ylab queries/sec # set ymax 0.6 0000 0.183333 0005 0.466667 0010 0.403333 0015 0.400000 0020 0.393333 0025 0.473333 0030 0.320000 0035 0.426667 0040 0.443333 0045 0.396667 0050 0.440000 0055 0.403333 plplot-5.10.0+dfsg/examples/tcl/x26.tcl 644 1750 1750 1555712140437446 165150ustar andrewandrew# -*- coding: utf-8; -*- # # $Id: x26.tcl 12322 2013-05-02 10:25:42Z arjenmarkus $ # # Multi-lingual version of the first page of example 4. # # Copyright (C) 2006 Alan Irwin # Copyright (C) 2006,2008 Andrew Ross # Copyright (C) 2008 Arjen Markus # # Thanks to the following for providing translated strings for this example: # Valery Pipin (Russian) # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # # This example designed just for devices (e.g., psttfc and the # cairo-related devices) that utilise the pango and fontconfig libraries. The # best choice of glyph is selected by fontconfig and automatically rendered # by pango in way that is sensitive to complex text layout (CTL) language # issues for each unicode character in this example. Of course, you must # have the appropriate TrueType fonts installed to have access to all the # required glyphs. # # Translation instructions: The strings to be translated are given by # x_label, y_label, alty_label, title_label, and line_label below. The # encoding used must be UTF-8. # # The following strings to be translated involve some scientific/mathematical # jargon which is now discussed further to help translators. # # (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . # (2) degrees is an angular measure, see # http://en.wikipedia.org/wiki/Degree_(angle) . # (3) low-pass filter is one that transmits (passes) low frequencies. # (4) pole is in the mathematical sense, see # http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" # means a particular mathematical transformation of the filter function has # a single pole, see # http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . # Furthermore, a single-pole filter must have an inverse square decline # (or -20 db/decade). Since the filter plotted here does have that # characteristic, it must by definition be a single-pole filter, see also # http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm # (5) decade represents a factor of 10, see # http://en.wikipedia.org/wiki/Decade_(log_scale) . # # # # -------------------------------------------------------------------------- # main # # Illustration of logarithmic axes, and redefinition of window. # -------------------------------------------------------------------------- proc x26 {{w loopback}} { set x_label { "Frequency" "Частота" } set y_label { "Amplitude (dB)" "Амплитуда (dB)" } set alty_label { "Phase shift (degrees)" "Фазовый сдвиг (градусы)" } # Short rearranged versions of y_label and alty_label. set legend_text { { "Amplitude" "Phase shift" } { "Амплитуда" "Фазовый сдвиг" }} set title_label { "Single Pole Low-Pass Filter" "Однополюсный Низко-Частотный Фильтр" } set line_label { "-20 dB/decade" "-20 dB/десяток" } # Parse and process command line arguments # AM: TODO # plparseopts? # Initialize plplot $w cmd plfont 2 # Make log plots using two different styles. foreach xl $x_label yl $y_label altyl $alty_label legend $legend_text title $title_label linel $line_label { plot261 $w 0 $xl $yl $altyl $legend $title $linel } # Restore defauls $w cmd plfont 1 } # -------------------------------------------------------------------------- # plot1 # # Log-linear plot. # -------------------------------------------------------------------------- proc plot261 { w type x_label y_label alty_label legend_text title_label line_label } { matrix freql f 101 matrix ampl f 101 matrix phase f 101 $w cmd pladv 0 # Set up data for log plot set f0 1.0 for {set i 0} {$i < 101} {incr i} { freql $i = [expr {-2.0 + $i / 20.0}] set freq [expr {pow(10.0,[freql $i])}] ampl $i = [expr {20.0 * log10(1.0 / sqrt(1.0 + pow($freq/$f0,2)))}] phase $i = [expr {-(180.0 / $::PLPLOT::PL_PI) * atan($freq / $f0)}] } $w cmd plvpor 0.15 0.85 0.1 0.9 $w cmd plwind -2.0 3.0 -80.0 0.0 # Try different axis and labelling styles. $w cmd plcol0 1 if { $type == 0 } { $w cmd plbox "bclnst" 0.0 0 "bnstv" 0.0 0 } if { $type == 1 } { $w cmd plbox "bcfghlnst" 0.0 0 "bcghnstv" 0.0 0 } # Plot ampl vs freq $w cmd plcol0 2 $w cmd plline 101 freql ampl $w cmd plcol0 2 $w cmd plptex 1.6 -30.0 1.0 -20.0 0.5 $line_label # Put labels on $w cmd plcol0 1 $w cmd plmtex "b" 3.2 0.5 0.5 $x_label $w cmd plmtex "t" 2.0 0.5 0.5 $title_label $w cmd plcol0 2 $w cmd plmtex "l" 5.0 0.5 0.5 $y_label # For the gridless case, put phase vs freq on same plot if {$type == 0} { $w cmd plcol0 1 $w cmd plwind -2.0 3.0 -100.0 0.0 $w cmd plbox "" 0.0 0 "cmstv" 30.0 3 $w cmd plcol0 3 $w cmd plline 101 freql phase $w cmd plstring 101 freql phase "*" $w cmd plcol0 3 $w cmd plmtex "r" 5.0 0.5 0.5 $alty_label } # Draw a legend # First legend entry. set opt_array [list $::PLPLOT::PL_LEGEND_LINE] set text_colors [list 2] set line_colors [list 2] set line_styles [list 1] set line_widths [list 1.] # note from the above opt_array the first symbol (and box) indices # will not be used, but they have to be specified anyway! # (make sure the values are reasonable) # Second legend entry. lappend opt_array [expr {$::PLPLOT::PL_LEGEND_LINE | $::PLPLOT::PL_LEGEND_SYMBOL}] lappend text_colors 3 lappend line_colors 3 lappend line_styles 1 lappend line_widths 1. set symbol_colors [list 0 3] set symbol_scales [list 0.0 1.] set symbol_numbers [list 0 4] set symbols [list "" "*"] # from the above opt_arrays we can completely ignore everything # to do with boxes. $w cmd plscol0a 15 32 32 32 0.70 $w cmd pllegend \ [expr {$::PLPLOT::PL_LEGEND_BACKGROUND | $::PLPLOT::PL_LEGEND_BOUNDING_BOX}] 0 \ 0.0 0.0 0.10 15 \ 1 1 0 0 \ $opt_array \ 1.0 1.0 2.0 \ 1. $text_colors $legend_text \ {} {} {} {} \ $line_colors $line_styles $line_widths \ $symbol_colors $symbol_scales $symbol_numbers $symbols } plplot-5.10.0+dfsg/examples/tcl/x10 755 1750 1750 743 7602154465 156430ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x10 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x10.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x10.tcl plinit x10 plend plplot-5.10.0+dfsg/examples/tcl/x23 755 1750 1750 74611052742773 156710ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x23 8684 2008-08-20 07:21:31Z andrewross $ # # Maurice LeBrun # 12/24/02 # # A front-end to x23.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x23.tcl plinit x23 plend plplot-5.10.0+dfsg/examples/tcl/x17.tcl 644 1750 1750 722211543675237 164730ustar andrewandrew# $Id: x17.tcl 11680 2011-03-27 17:57:51Z airwin $ # # Copyright (C) 2009 Arjen Markus # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Plots a simple stripchart with four pens. # proc x17 {{w loopback}} { # If db is used the plot is much more smooth. However, because of the # async X behaviour, one does not have a real-time scripcharter. # # plsetopt "db" "" # plsetopt "np" "" # User sets up plot completely except for window and data # Eventually settings in place when strip chart is created will be # remembered so that multiple strip charts can be used simultaneously. # # Specify some reasonable defaults for ymin and ymax # The plot will grow automatically if needed (but not shrink) set nsteps 1000 set ymin -0.1 set ymax 0.1 # Specify initial tmin and tmax -- this determines length of window. # Also specify maximum jump in t # This can accomodate adaptive timesteps set tmin 0. set tmax 10. set tjump 0.3 ;# percentage of plot to jump # Axes options same as plbox. # Only automatic tick generation and label placement allowed # Eventually I'll make this fancier set colbox 1 set collab 3 matrix styline i 4 = {2 3 4 5} ;# pens color and line style matrix colline i 4 = {2 3 4 5} set legline {"sum" "sin" "sin*noi" "sin+noi"} ;# pens legend set xlab 0. ;# legend position set ylab 0.25 set autoy 1 ;# autoscale y set acc 1 ;# don't scrip, accumulate # Initialize plplot $w cmd pladv 0 $w cmd plvsta $w cmd plstripc id1 "bcnst" "bcnstv" \ $tmin $tmax $tjump $ymin $ymax \ $xlab $ylab $autoy $acc \ $colbox $collab \ colline styline $legline \ "t" "" "Strip chart demo" set autoy 0 ;# autoscale y set acc 1 ;# accumulate # This is to represent a loop over time # Let's try a random walk process set y1 0.0 set y2 0.0 set y3 0.0 set y4 0.0 set dt 0.1 for {set n 0 } {$n < $nsteps} {incr n} { after 10 ;# Wait for 10 ms set t [expr {double($n) * $dt}] set noise [expr {[$w cmd plrandd] - 0.5}] set y1 [expr {$y1 + $noise}] set y2 [expr {sin($t*$::PLPLOT::PL_PI/18.)}] set y3 [expr {$y2 * $noise}] set y4 [expr {$y2 + $noise/3.}] # There is no need for all pens to have the same number of # points or being equally time spaced. if { $n%2 } { $w cmd plstripa $id1 0 $t $y1 } if { $n%3 } { $w cmd plstripa $id1 1 $t $y2 } if { $n%4 } { $w cmd plstripa $id1 2 $t $y3 } if { $n%5 } { $w cmd plstripa $id1 3 $t $y4 } #$w cmd pleop ;# use double buffer (-db on command line) } # Destroy strip chart and it's memory $w cmd plstripd $id1 # Restore defaults $w cmd pllsty 1 } plplot-5.10.0+dfsg/examples/tcl/x18 755 1750 1750 176311511542345 157060ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x18 11447 2011-01-07 07:46:45Z arjenmarkus $ # # Maurice LeBrun # 12/24/02 # # A front-end to x18.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} # # This example uses UTF-8 characters, placed directly in the source code # if { [encoding system] != "utf-8" } { if { [package vsatisfies [info patch] 8.5] } { source -encoding utf-8 x18.tcl } else { # # Pre-Tcl 8.5 # set infile [open "x18.tcl"] set contents [read $infile] close $infile eval [encoding convertfrom utf-8 \ [encoding convertto [encoding system] $contents]] } } else { # # Plain source will do # source x18.tcl } plinit x18 plend plplot-5.10.0+dfsg/examples/tcl/tclsh_standard_examples.in 755 1750 1750 116412264404031 225540ustar andrewandrew#!@SH_EXECUTABLE@ # Examples 14 and 31 commented out - see Tk standard_examples.in # The following exec command reexecutes the script under tclsh. This # is possible because all comment lines are ignored by tclsh including # continued ones with a trailing backslash like this one \ exec @TCL_TCLSH@ "$0" "$@" lappend auto_path @pkgIndex_LOCATION@ package require Pltcl source tcldemos.tcl plsdev "@generic_interactive_device@" plinit # Disable pausing. plspause 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 #14 15 16 17 18 19 20 # example 20 enables plspause so must disable it again. plspause 0 21 22 23 24 25 26 27 28 29 30 #31 33 exit plplot-5.10.0+dfsg/examples/tcl/x00.tcl 644 1750 1750 141411720236353 164450ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x00.tcl 12172 2012-02-19 18:18:19Z airwin $ #---------------------------------------------------------------------------- # Simple demo of 2D line plot. proc x00 {{w loopback}} { set xmin 0.0 set xmax 1.0 set ymin 0.0 set ymax 100.0 set nsize 101 matrix x f $nsize matrix y f $nsize for {set i 0} {$i < $nsize} {incr i} { set xi [expr {$i / double($nsize - 1)}] x $i = $xi y $i = [expr {$ymax * $xi * $xi}] } # Create a labelled box to hold the plot $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd pllab "x" "y=100 x#u2#d" "Simple PLplot demo of a 2D line plot" # Plot the data that was prepared above $w cmd plline $nsize x y } plplot-5.10.0+dfsg/examples/tcl/x28 755 1750 1750 74611053247361 156700ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x28 8695 2008-08-21 11:18:09Z andrewross $ # # Maurice LeBrun # 12/24/02 # # A front-end to x28.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x28.tcl plinit x28 plend plplot-5.10.0+dfsg/examples/tcl/x14.tcl 644 1750 1750 1702611530413277 165010ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x14.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- proc x14 {{w loopback}} { global xscale yscale xoff yoff set geometry_master "500x410+100+200" set geometry_slave "500x410+650+200" # Set up first stream $w cmd plsetopt "geometry" $geometry_master $w cmd plssub 2 2 $w cmd plinit $w cmd plgdev driver $w cmd plgfam fam num bmax puts "Demo of multiple output streams via the $driver driver." puts "Running with the second stream as slave to the first." puts "" # Start next stream $w cmd plsstrm 1 # Turn off pause to make this a slave (must follow master) $w cmd plsetopt "geometry" $geometry_slave $w cmd plspause 0 if {$driver != ""} { $w cmd plsdev $driver } $w cmd plsfam $fam $num $bmax $w cmd plsetopt "fflen" "2" $w cmd plinit # Set up the data & plot # Original case $w cmd plsstrm 0 set xscale 6.0 set yscale 1.0 set xoff 0.0 set yoff 0.0 plot141 $w # Set up the data & plot set xscale 1. set yscale 1.e+6 plot141 $w # Set up the data & plot set xscale 1. set yscale 1.e-6 set digmax 2 $w cmd plsyax digmax 0 plot141 $w # Set up the data & plot set xscale 1. set yscale 0.0014 set yoff 0.0185 set digmax 5 $w cmd plsyax digmax 0 plot141 $w # To slave # The pleop() ensures the eop indicator gets lit. $w cmd plsstrm 1 plot144 $w $w cmd pleop # Back to master $w cmd plsstrm 0 plot142 $w plot143 $w # To slave */ $w cmd plsstrm 1 plot145 $w $w cmd pleop # Back to master to wait for user to advance $w cmd plsstrm 0 $w cmd pleop # Call plend to finish off. $w cmd plend } # This is supposed to work just like the plot1() in x01c.c proc plot141 {w} { global xscale yscale xoff yoff set npts 60 matrix x f $npts matrix y f $npts for {set i 0} {$i < $npts} {incr i} { x $i = [expr {$xoff + ($xscale * ($i + 1)) / $npts}] y $i = [expr {$yoff + $yscale * pow([x $i],2)}] } set xmin [x 0] set xmax [x [expr {$npts-1}]] set ymin [y 0] set ymax [y [expr {$npts-1}]] matrix x1 f 6 matrix y1 f 6 for {set i 0} {$i < 6} {incr i} { set j [expr {$i*10+3}] x1 $i = [x $j] y1 $i = [y $j] } $w cmd plcol0 1 $w cmd plenv $xmin $xmax $ymin $ymax 0 0 $w cmd plcol0 6 $w cmd pllab "(x)" "(y)" "#frPLplot Example 1 - y=x#u2" # plot the data points $w cmd plcol0 9 $w cmd plpoin 6 x1 y1 9 # draw the line through the data $w cmd plcol0 4 $w cmd plline $npts x y $w cmd plflush } # This is supposed to work just like the plot2() in x01c proc plot142 {w} { $w cmd plcol0 1 $w cmd plenv -2 10 -.4 1.2 0 1 $w cmd plcol0 2 $w cmd pllab "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function" # Fill up the array matrix x1 f 101 matrix y1 f 101 for {set i 0} {$i < 100} {incr i} { set x [expr {($i - 19.)/6.}] x1 $i = $x y1 $i = 1 if {$x != 0} { y1 $i = [expr {sin($x)/$x}] } } $w cmd plcol0 3 $w cmd plline 100 x1 y1 $w cmd plflush } # This is supposed to work just like the plot3() in x01c.c proc plot143 {w} { $w cmd pladv 0 $w cmd plvsta $w cmd plwind 0.0 360.0 -1.2 1.2 # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. $w cmd plcol0 1 $w cmd plbox "bcnst" 60.0 2 "bcnstv" 0.2 2 # Superimpose a dashed line grid, with 1.5 mm marks and spaces. # plstyl expects two integer matrices for mark and space! matrix mark i 1 matrix space i 1 mark 0 = 1500 space 0 = 1500 $w cmd plstyl 1 mark space $w cmd plcol0 2 $w cmd plbox "g" 30.0 0 "g" 0.2 0 mark 0 = 0 space 0 = 0 $w cmd plstyl 0 mark space $w cmd plcol0 3 $w cmd pllab "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function" matrix x f 101 matrix y f 101 for {set i 0} {$i < 101} {incr i} { x $i = [expr 3.6 * $i] y $i = [expr sin([x $i] * $::PLPLOT::PL_PI / 180.0)] } $w cmd plcol0 4 $w cmd plline 101 x y $w cmd plflush } # This is supposed to work like example 3. proc plot144 {w} { set twopi [expr {2. * $::PLPLOT::PL_PI}] # Set up viewport and window, but do not draw box $w cmd plenv -1.3 1.3 -1.3 1.3 1 -2 # Draw circles for polar grid set ni 10 set nj 360 set nj1 [expr {$nj + 1}] set dr [expr {1. / $ni}] set dtheta [expr {$twopi / $nj}] matrix xj f $nj1 matrix yj f $nj1 for {set i 1} {$i <= $ni} {incr i} { for {set j 0} {$j < $nj1} {incr j} { set r [expr {$i * $dr}] set theta [expr {$j * $dtheta}] xj $j = [expr {$r * cos($theta)}] yj $j = [expr {$r * sin($theta)}] } $w cmd plline $nj1 xj yj } # Draw radial spokes for polar grid and write labels for angle $w cmd plcol0 2 for {set j 0} {$j <= 11} {incr j} { set theta [expr {$j * $twopi / 12.}] set xg [expr {cos($theta)}] set yg [expr {sin($theta)}] $w cmd pljoin 0.0 0.0 $xg $yg # Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if {$xg >= -0.00001} { set dx $xg set dy $yg set just -0.15 } else { set dx [expr {-$xg}] set dy [expr {-$yg}] set just 1.15 } set label [expr {round($theta*360./$twopi)}] # N.B. cannot get this command to give same postscript output. Also visual # inspection shows 90 deg label jumping around slightly compared to python # and C front ends. No idea why (AWI comment). $w cmd plptex $xg $yg $dx $dy $just $label } # Draw the graph set npts 360 set npts1 [expr {$npts+1}] set dtheta [expr {$twopi / $npts}] matrix x f $npts1 matrix y f $npts1 for {set j 0} {$j <= $npts} {incr j} { set theta [expr {$j * $dtheta}] set r [expr {sin(5 * $theta)}] x $j = [expr {$r * cos($theta)}] y $j = [expr {$r * sin($theta)}] } $w cmd plcol0 3 $w cmd plline $npts1 x y $w cmd plcol0 4 $w cmd plmtex "t" 2.0 0.5 0.5 "#frPLplot Example 3 - r(#gh)=sin 5#gh" $w cmd plflush } # This is supposed to work like first page of example 9. proc plot145 {w} { set xpts 35 set ypts 46 matrix clevel f 11 = {-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.} matrix mark i 1 = { 1500 } matrix space i 1 = { 1500 } matrix zz f $xpts $ypts matrix ww f $xpts $ypts # Calculate the data matrices. for {set i 0} {$i < $xpts} {incr i} { set xx [expr {($i - ($xpts / 2)) / double($xpts / 2)} ] for {set j 0} {$j < $ypts} {incr j} { set yy [expr {($j - ($ypts / 2)) / double($ypts / 2) - 1.0} ] zz $i $j = [expr {$xx * $xx - $yy * $yy} ] ww $i $j = [expr {2. * $xx * $yy} ] } } matrix xg0 f $xpts matrix yg0 f $ypts # Build the 1-d coord arrays. for {set i 0} {$i < $xpts} {incr i} { set xx [expr {-1. + $i * ( 2. / ($xpts-1.) )}] xg0 $i = $xx } for {set j 0} {$j < $ypts} {incr j} { set yy [expr {-1. + $j * ( 2. / ($ypts-1.) )}] yg0 $j = $yy } # Plot using scaled identity transformation used to create # xg0 and yg0. The implementation is different, but this gives # the same results as the mypltr transformation for the first # plots in x09c. $w cmd plenv -1.0 1.0 -1.0 1.0 0 0 $w cmd plcol0 2 $w cmd plcont zz clevel pltr1 xg0 yg0 $w cmd plstyl 1 mark space $w cmd plcol0 3 $w cmd plcont ww clevel pltr1 xg0 yg0 $w cmd plstyl 0 mark space $w cmd plcol0 1 $w cmd pllab "X Coordinate" "Y Coordinate" "Streamlines of flow" $w cmd plflush } plplot-5.10.0+dfsg/examples/tcl/x24 755 1750 1750 176311511542345 157030ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x24 11447 2011-01-07 07:46:45Z arjenmarkus $ # # Maurice LeBrun # 12/24/02 # # A front-end to x22.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} # # This example uses UTF-8 characters, placed directly in the source code # if { [encoding system] != "utf-8" } { if { [package vsatisfies [info patch] 8.5] } { source -encoding utf-8 x24.tcl } else { # # Pre-Tcl 8.5 # set infile [open "x24.tcl"] set contents [read $infile] close $infile eval [encoding convertfrom utf-8 \ [encoding convertto [encoding system] $contents]] } } else { # # Plain source will do # source x24.tcl } plinit x24 plend plplot-5.10.0+dfsg/examples/tcl/x19 755 1750 1750 743 7602154465 156540ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x19 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x19.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x19.tcl plinit x19 plend plplot-5.10.0+dfsg/examples/tcl/plot.tcl 644 1750 1750 1764011540631600 170360ustar andrewandrew#---------------------------------------------------------------------------- # $Id: plot.tcl 11645 2011-03-18 10:27:12Z andrewross $ # # Interactive plotting driver for pltcl (plplot-enhanced tclsh) # # Maurice LeBrun # 10/18/95 # DejaNews, Inc. # # Generates line plot(s) given a file of ASCII data (similar to the GNUPLOT # "plot" command). Can be easily modified to particular needs. # # To run this demo execute pltcl. Then simply type 'plot '. # For other options see the usage section below. # # Note: this relies on Tcl autoloading to automatically find & source the # plot.tcl source file where the Tcl plot proc is contained. If for some # reason autoloading isn't working right, you'll have to run 'source # plot.tcl' yourself (from pltcl). # #---------------------------------------------------------------------------- # Usage: # # plot [data file [columns]] # # Examples: # # plot stats.log {1 4} # # would plot columns 1 & 4 (y) vs column 0 (x). # # plot stats.log # # would plot columns 1,2,3,4 (y) vs column 0 (x) # # plot r.dat # plot plot.dat # # give illustrative plots with other example data sets. # The layout of the data file is as follows: # # # ... # [etc] # # The number of dependent vars to plot defaults to the number found in the # data file, up to a maximum of 10 (you can plot more by specifying ny in # the call). When there are more than one, they are plotted in different # colors (chosen from cmap0). # # Two powerful mechanisms are used to allow customization of the output. # First, local plotting options may be specified in the data file itself. # Comment lines of the form "# set " are stripped of their # leading "# " and evaluated. The local plot options are given below. # # Second, a global associative array -- plopts -- can be used to set the # local plotting options as well. E.g. to set "xlab", set plopt(xlab) to # the desired value at global scope. Values specified this way take # precedence over those set in the data file in order to allow interactive # customization without having to edit the data file. # # Local plot options are as follows: # # Name Meaning Default value # ---- ------- ------------- # file data file (none) [1] # title plot title (none) # xlab x-axis label x # ylab y-axis label y # xopt x axis options bcnst (passed to plbox) # yopt y axis options bcnstv (same) # lsty line style 1 [2] # poin point symbol -1 or 1, depending on value of lsty [3] # xmin min x value (data minimum - x) # xmax max x value (data maximum - x) # ymin min y value (data minimum - y) # ymax max y value (data maximum - y) # nfilt filter points 0 (no filtering) # dx x scale value 1 # # control parameters: # # noeop - if set, the plot is not ended (so you can overlay stuff) # # Notes: # 1. The data file MUST be specified, either through a global variable # or via the invocation line. Otherwise we return with an error. # # 2. Line styles are as follows: # 0 : none (only points plotted) # 1 : continuous # 2-8: built-in plplot broken line pattern # # 3. Default is -1, which means do not plot points separately, however, if # a line style of -1 is specified, default is 1 (single point). To see # all of the valid point types, refer to the manual. Here's just a few: # 0 box # 1 dot # 2 cross # 3 asterisk # 4 circle # 5 x # 6 box (what, again?) # 7 triangle #---------------------------------------------------------------------------- proc plot {{file {}} {columns {}}} { global plopt # Make sure there is a data file if {$file == ""} { if {[info exists plopt(file)]} { set file $plopt(file) } else { error "Error: no data file specified" } } # Set up plot option defaults set title "" set xlab x set ylab y set xopt bcnst set yopt bcnstv set lsty 1 set poin -1 set nfilt 0 set dx 1 # If plinit hasn't been called, do it now. plgdev device if {$device == ""} { plinit plgdev device } # Initialize data arrays set matlen 128 set matinc 128 matrix x f $matlen set nx 0 set first_time 1 # Open file and read into data arrays set fileid [open $file] while {[expr [gets $fileid input] > -1]} { set first_char [string index [lindex $input 0] 0] # Ignore blank lines if {$first_char == ""} continue # Comments or set commands if {$first_char == "\#"} { set nextword [lindex $input 1] if {"$nextword" == "set"} { set command [lrange $input 1 end] eval $command } continue } # Now we should be to the data part. First time through only, allocate # sufficient arrays for holding all the dependent data (faster this way # than putting too much control logic in this loop). If you are missing # entries later on, this will probably fail. if {$first_time} { set first_time 0 set nymax [expr [llength $input] - 1] for {set iy 1} {$iy <= $nymax} {incr iy} { matrix y$iy f $matlen } if {$columns == {}} { set columns 1 for {set iy 2} {$iy <= $nymax} {incr iy} { set columns "$columns $iy" } } } # Increase array bounds if necessary if {$nx == $matlen} { incr matlen $matinc x redim $matlen for {set iy 1} {$iy <= $nymax} {incr iy} { y$iy redim $matlen } } # Read data into arrays x $nx = [lindex $input 0] for {set iy 1} {$iy <= $nymax} {incr iy} { y$iy $nx = [lindex $input $iy] } incr nx } close $fileid set ny [llength $columns] puts "Read $nx data points, $ny separate streams" # Filter if necessary if {$nfilt != 0} { for {set iy 0} {$iy < $ny} {incr iy} { set jy [lindex $columns $iy] y$jy filter $nfilt } } # Get data min/max if {![info exists xmin]} { set xmin [x min $nx] } if {![info exists xmax]} { set xmax [x max $nx] } if {![info exists ymin]} { set jy [lindex $columns 0] set ymin [y$jy min $nx] for {set iy 1} {$iy < $ny} {incr iy} { set jy [lindex $columns $iy] set y1min [y$jy min $nx] if {[expr $y1min < $ymin]} then {set ymin $y1min} } } if {![info exists ymax]} { set jy [lindex $columns 0] set ymax [y$jy max $nx] for {set iy 1} {$iy < $ny} {incr iy} { set jy [lindex $columns $iy] set y1max [y$jy max $nx] if {[expr $y1max < $ymax]} then {set ymax $y1max} } } # Rescale if necessary if {$dx != 1} { x scale $dx set xmin [expr $xmin * $dx] set xmax [expr $xmax * $dx] } # Set up plot options if {[info exists plopt(title)]} {set title $plopt(title)} if {[info exists plopt(xlab)]} {set xlab $plopt(xlab)} if {[info exists plopt(ylab)]} {set ylab $plopt(ylab)} if {[info exists plopt(xopt)]} {set xopt $plopt(xopt)} if {[info exists plopt(yopt)]} {set yopt $plopt(yopt)} if {[info exists plopt(lsty)]} {set lsty $plopt(lsty)} if {[info exists plopt(poin)]} {set poin $plopt(poin)} if {[info exists plopt(xmin)]} {set xmin $plopt(xmin)} if {[info exists plopt(xmax)]} {set xmax $plopt(xmax)} if {[info exists plopt(ymin)]} {set ymin $plopt(ymin)} if {[info exists plopt(ymax)]} {set ymax $plopt(ymax)} if {[info exists plopt(nfilt)]} {set nfilt $plopt(nfilt)} if {[info exists plopt(dx)]} {set dx $plopt(dx)} if {[info exists plopt(noeop)]} {set noeop $plopt(noeop)} # Set up the plot plbop plvpor 0.15 0.85 0.1 0.9 plwind $xmin $xmax $ymin $ymax plcol0 1 pllsty 1 plbox $xopt 0.0 0 $yopt 0.0 0 plcol0 2 pllab "$xlab" "$ylab" "$title" # Plot the data if { $lsty > 0 } { pllsty $lsty for {set iy 0} {$iy < $ny} {incr iy} { set jy [lindex $columns $iy] plcol0 [expr 2 + $jy] plline $nx x y$jy } } else { if { $poin < 0 } {set poin 1} for {set iy 0} {$iy < $ny} {incr iy} { set jy [lindex $columns $iy] plcol0 [expr 2 + $jy] plpoin $nx x y$jy $poin } } # End the page (see note about pause above). pllsty 1 if {[info exists noeop] == 0} pleop } plplot-5.10.0+dfsg/examples/tcl/x29.tcl 644 1750 1750 2252012240774070 165020ustar andrewandrew# $Id: x29.tcl 12693 2013-11-13 22:07:52Z airwin $ # # Sample plots using date / time formatting for axes # # Copyright (C) 2007,2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # Draws several plots which demonstrate the use of date / time formats for # the axis labels. # Time formatting is done using the system strftime routine. See the # documentation of this for full details of the available formats. # # 1) Plotting temperature over a day (using hours / minutes) # 2) Plotting # # Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). # proc x29 {{w loopback}} { $w cmd plsesc "@" x29_plot1 $w x29_plot2 $w x29_plot3 $w x29_plot4 $w # Restore escape character back to default so we don't affect # later plots made after this one. $w cmd plsesc "#" } # Plot a model diurnal cycle of temperature proc x29_plot1 {{w loopback}} { # Data points every 10 minutes for 1 day set npts 73 matrix x f $npts matrix y f $npts matrix xerr1 f $npts matrix xerr2 f $npts matrix yerr1 f $npts matrix yerr2 f $npts set xmin 0 # Number of seconds in a day set xmax [expr {60.0*60.0*24.0}] set ymin 10.0 set ymax 20.0 for {set i 0} {$i<$npts} {incr i} { set xx [expr {$xmax*double($i)/double($npts)}] set yy [expr {15.0 - 5.0*cos( 2*$::PLPLOT::PL_PI*double($i)/double($npts))}] x $i = $xx y $i = $yy xerr1 $i = [expr {$xx - 60.0*5.0}] xerr2 $i = [expr {$xx + 60.0*5.0}] yerr1 $i = [expr {$yy - 0.1}] yerr2 $i = [expr {$yy + 0.1}] } $w cmd pladv 0 $w cmd plsmaj 0.0 0.5 $w cmd plsmin 0.0 0.5 $w cmd plvsta $w cmd plwind $xmin $xmax $ymin $ymax # Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. $w cmd plcol0 1 # Set time format to be hours:minutes $w cmd pltimefmt "%H:%M" $w cmd plbox "bcnstd" [expr {3.0*60*60}] 3 "bcnstv" 1 5 $w cmd plcol0 3 $w cmd pllab "Time (hours:mins)" "Temperature (degC)" \ "@frPLplot Example 29 - Daily temperature" $w cmd plcol0 4 $w cmd plline $npts x y $w cmd plcol0 2 $w cmd plerrx $npts xerr1 xerr2 y $w cmd plcol0 3 $w cmd plerry $npts x yerr1 yerr2 $w cmd plsmaj 0.0 1.0 $w cmd plsmin 0.0 1.0 } # Plot the number of hours of daylight as a function of day for a year proc x29_plot2 {{w loopback}} { set pi $::PLPLOT::PL_PI # Latitude for London set lat 51.5 set npts 365 matrix x f $npts matrix y f $npts set xmin 0 set xmax [expr {$npts*60.0*60.0*24.0}] set ymin 0 set ymax 24 # Formula for hours of daylight from # "A Model Comparison for Daylength as a Function of Latitude and # Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for {set j 0} {$j < $npts} {incr j} { x $j = [expr {$j*60.0*60.0*24.0}] set p [expr {asin(0.39795*cos(0.2163108 + 2*atan(0.9671396*tan(0.00860*($j-186))))) }] set d [expr {24.0 - (24.0/$pi)* \ acos( (sin(0.8333*$pi/180.0) + \ sin($lat*$pi/180.0)*sin($p)) / \ (cos($lat*$pi/180.0)*cos($p)) )}] y $j = $d } $w cmd plcol0 1 # Set time format to be abbreviated month name followed by day of month $w cmd pltimefmt "%b %d" $w cmd plprec 1 1 $w cmd plenv $xmin $xmax $ymin $ymax 0 40 $w cmd plcol0 3 $w cmd pllab "Date" "Hours of daylight" \ "@frPLplot Example 29 - Hours of daylight at 51.5N" $w cmd plcol0 4 $w cmd plline $npts x y $w cmd plprec 0 0 } proc x29_plot3 {{w loopback}} { # Calculate seconds since the Unix epoch for 2005-12-01 UTC. # On newer versions of tcl should use the -format "%Y-%m-%d" # option rather than free-form scanning, but this doesn't # seem to work on tcl8.4 # Also -timezone :UTC should be used instead of -gmt set tstart [clock scan "2005-12-01" \ -gmt true ] set npts 62 matrix x f $npts matrix y f $npts set xmin $tstart set xmax [expr {$xmin + $npts*60.0*60.0*24.0}] set ymin 0.0 set ymax 5.0 for {set i 0} {$i<$npts} {incr i} { x $i = [expr {$xmin + $i*60.0*60.0*24.0}] set imin [expr {$i < $npts-$i ? $i : $npts-$i}] y $i = [expr {1.0 + sin( 2*$::PLPLOT::PL_PI*double($i)/7.0 ) + \ exp( double($imin) / 31.0) }] } $w cmd pladv 0 $w cmd plvsta $w cmd plwind $xmin $xmax $ymin $ymax $w cmd plcol0 1 # Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is # equivalent to %f for C99 compliant implementations of strftime. $w cmd pltimefmt "%Y-%m-%d" # Draw a box with ticks spaced every 14 days in X and 1 hour in Y. $w cmd plbox "bcnstd" [expr {14*24.0*60.0*60.0}] 14 "bcnstv" 1 4 $w cmd plcol0 3 $w cmd pllab "Date" "Hours of television watched" \ "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006" $w cmd plcol0 4 $w cmd plssym 0.0 0.5 $w cmd plpoin $npts x y 2 $w cmd plline $npts x y } proc x29_plot4 {{w loopback}} { # TAI-UTC (seconds) as a function of time. # Use Besselian epochs as the continuous time interval just to prove # this does not introduce any issues. # Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch # B = 1900. + (JD -2415020.31352)/365.242198781 # ==> (as calculated with aid of "bc -l" command) # B = (MJD + 678940.364163900)/365.242198781 # ==> # MJD = B*365.24219878 - 678940.364163900 set ::tcl_precision 17 set scale 365.242198781 set offset1 -678940.0 set offset2 -0.3641639 matrix x f 1001 matrix y f 1001 $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. for {set kind 0} {$kind < 7} {incr kind} { if {$kind == 0} { $w cmd plctime 1950 0 2 0 0 0. xmin $w cmd plctime 2020 0 2 0 0 0. xmax set npts [expr {70*12 + 1}] set ymin 0.0 set ymax 36.0 set time_format "%Y%" set if_TAI_time_format 1 set title_suffix "from 1950 to 2020" set xtitle "Year" set xlabel_step 10. } elseif {$kind == 1 || $kind == 2} { $w cmd plctime 1961 7 1 0 0 [expr {1.64757-0.20}] xmin $w cmd plctime 1961 7 1 0 0 [expr {1.64757+0.20}] xmax set npts 1001 set ymin 1.625 set ymax 1.725 set time_format "%S%2%" set title_suffix "near 1961-08-01 (TAI)" set xlabel_step [expr {0.05/($scale*86400.)}] if {$kind == 1} { set if_TAI_time_format 1 set xtitle "Seconds (TAI)" } else { set if_TAI_time_format 0 set xtitle "Seconds (TAI) labelled with corresponding UTC" } } elseif {$kind == 3 || $kind == 4} { $w cmd plctime 1963 10 1 0 0 [expr {2.6972788-.20}] xmin $w cmd plctime 1963 10 1 0 0 [expr {2.6972788+.20}] xmax set npts 1001 set ymin 2.55 set ymax 2.75 set time_format "%S%2%" set title_suffix "near 1963-11-01 (TAI)" set xlabel_step [expr {0.05/($scale*86400.)}] if {$kind == 3} { set if_TAI_time_format 1 set xtitle "Seconds (TAI)" } else { set if_TAI_time_format 0 set xtitle "Seconds (TAI) labelled with corresponding UTC" } } elseif {$kind == 5 || $kind == 6} { $w cmd plctime 2009 0 1 0 0 [expr {34.-5.}] xmin $w cmd plctime 2009 0 1 0 0 [expr {34.+5.}] xmax set npts 1001 set ymin 32.5 set ymax 34.5 set time_format "%S%2%" set title_suffix "near 2009-01-01 (TAI)" set xlabel_step [expr {1./($scale*86400.)}] if {$kind == 5} { set if_TAI_time_format 1 set xtitle "Seconds (TAI)" } else { set if_TAI_time_format 0 set xtitle "Seconds (TAI) labelled with corresponding UTC" } } for {set i 0} {$i<$npts} {incr i} { set tai [expr {$xmin + $i*($xmax-$xmin)/double($npts-1)}] x $i = $tai $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. $w cmd plbtime tai_year tai_month tai_day tai_hour tai_min tai_sec $tai $w cmd plconfigtime $scale $offset1 $offset2 2 0 0 0 0 0 0 0. $w cmd plbtime utc_year utc_month utc_day utc_hour utc_min utc_sec $tai $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. $w cmd plctime $utc_year $utc_month $utc_day $utc_hour $utc_min $utc_sec utc set yy [expr {($tai-$utc)*$scale*86400.}] y $i = $yy } $w cmd pladv 0 $w cmd plvsta $w cmd plwind $xmin $xmax $ymin $ymax $w cmd plcol0 1 if {$if_TAI_time_format == 1} { $w cmd plconfigtime $scale $offset1 $offset2 0 0 0 0 0 0 0 0. } else { $w cmd plconfigtime $scale $offset1 $offset2 2 0 0 0 0 0 0 0. } $w cmd pltimefmt $time_format $w cmd plbox "bcnstd" $xlabel_step 0 "bcnstv" 0. 0 $w cmd plcol0 3 set title "@frPLplot Example 29 - TAI-UTC " append title $title_suffix $w cmd pllab $xtitle "TAI-UTC (sec)" $title $w cmd plcol0 4 $w cmd plline $npts x y } } plplot-5.10.0+dfsg/examples/tcl/x11.tcl 644 1750 1750 1232511530413277 164730ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x11.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- # Does a series of mesh plots for a given data set, with different # viewing options in each plot. # Routine for restoring colour map1 to default. # See static void plcmap1_def(void) in plctrl.c for reference. proc restore_cmap1_11 {w} { # For center control points, pick black or white, whichever is closer to bg # Be careful to pick just short of top or bottom else hue info is lost $w cmd plgcolbg rbg gbg bbg set vertex [expr {($rbg + $gbg + $bbg)/(3.*255.)}] if {$vertex < 0.5} { set vertex 0.01 set midpt 0.10 } else { set vertex 0.99 set midpt 0.90 } # Independent variable of control points. matrix i f 6 = {0., 0.44, 0.50, 0.50, 0.56, 1.} # Hue for control points. Blue-violet to red matrix h f 6 = {260., 260., 260., 0., 0., 0.} # Lightness ranging from medium to vertex to medium # double quotes required rather than braces so that variables # get evaluated for initialization. matrix l f 6 = "0.5, $midpt, $vertex, $vertex, $midpt, 0.5" # Saturation is complete for default matrix s f 6 = {1., 1., 1., 1., 1., 1.} # Integer flag array is zero (no interpolation along far-side of colour # figure matrix rev i 6 = {0, 0, 0, 0, 0, 0} # Default number of cmap1 colours $w cmd plscmap1n 128 # Interpolate between control points to set up default cmap1. $w cmd plscmap1l 0 6 i h l s rev } # Routine for initializing color map 1 in HLS space. # Basic grayscale variation from half-dark (which makes more interesting # looking plot compared to dark) to light. proc cmap1_init_11 {w gray} { # Independent variable of control points. matrix i f 2 = {0., 1.} if {$gray == 1} { # Hue for control points. Doesn't matter since saturation is zero. matrix h f 2 = {0., 0.} # Lightness ranging from half-dark (for interest) to light. matrix l f 2 = {0.5, 1.} # Gray scale has zero saturation. matrix s f 2 = {0., 0.} } else { # Hue ranges from blue (240 deg) to red (0 or 360 deg) matrix h f 2 = {240., 0.} # Lightness and saturation are constant (values taken from C example). matrix l f 2 = {0.6, 0.6} matrix s f 2 = {0.8, 0.8} } # Integer flag array is zero (no interpolation along far-side of colour # figure matrix rev i 2 = {0, 0} # Number of cmap1 colours is 256 in this case. $w cmd plscmap1n 256 # Interpolate between control points to set up default cmap1. $w cmd plscmap1l 0 2 i h l s rev } proc x11 {{w loopback}} { # these should be defined elsewhere. # Must use numerical rather than hex value for this one since used # inside an array matrix opt i 2 = "[expr {$::PLPLOT::DRAW_LINEXY}], [expr {$::PLPLOT::DRAW_LINEXY}]" matrix alt f 2 = {33.0, 17.0} matrix az f 2 = {24.0, 115.0} set xpts 35 set ypts 46 matrix x f $xpts matrix y f $ypts matrix z f $xpts $ypts for {set i 0} {$i < $xpts} {incr i} { x $i = [expr {3.* ($i - ($xpts/2)) / double($xpts/2)} ] } for {set i 0} {$i < $ypts} {incr i} { y $i = [expr {3.* ($i - ($ypts/2)) / double($ypts/2)} ] } for {set i 0} {$i < $xpts} {incr i} { set xx [x $i] for {set j 0} {$j < $ypts} {incr j} { set yy [y $j] z $i $j = [expr {3. * (1.-$xx)*(1.-$xx) * exp(-($xx*$xx) - \ ($yy+1.)*($yy+1.)) - 10. * ($xx/5. - pow($xx,3.) - \ pow($yy,5.)) * exp(-$xx*$xx-$yy*$yy) - \ 1./3. * exp(-($xx+1)*($xx+1) - ($yy*$yy))}] # Jungfraujoch/Interlaken if {1==2} { set zz [z $i $j] if {$zz <= -1.} { z $i $j = -1.0 } } } } set zmin [z min [ expr {$xpts * $ypts}]] set zmax [z max [ expr {$xpts * $ypts}]] set nlev 10 matrix clev f $nlev set step [expr {($zmax-$zmin)/($nlev+1)}] for {set i 0} {$i < $nlev} {incr i} { clev $i = [expr {$zmin + ($i+1) * $step}] } cmap1_init_11 $w 0 for {set k 0} {$k < 2} {incr k} { for {set i 0} {$i < 4} {incr i} { $w cmd pladv 0 $w cmd plcol0 1 $w cmd plvpor 0.0 1.0 0.0 0.9 $w cmd plwind -1.0 1.0 -1.0 1.5 $w cmd plw3d 1.0 1.0 1.2 -3.0 3.0 -3.0 3.0 $zmin $zmax [alt $k] [az $k] $w cmd plbox3 "bnstu" "x axis" 0.0 0 \ "bnstu" "y axis" 0.0 0 \ "bcdmnstuv" "z axis" 0.0 4 $w cmd plcol0 2 # wireframe plot if {$i == 0} { $w cmd plmesh x y z [expr {[opt $k]}] # magnitude colored wireframe plot } elseif {$i == 1} { $w cmd plmesh x y z [expr {[opt $k] | $::PLPLOT::MAG_COLOR}] # magnitude colored wireframe plot with sides } elseif {$i == 2} { $w cmd plot3d x y z [expr {[opt $k] | $::PLPLOT::MAG_COLOR}] 1 # magnitude colored wireframe plot with base contour } elseif {$i == 3} { $w cmd plmeshc x y z $xpts $ypts \ [expr {[opt $k] | $::PLPLOT::MAG_COLOR | $::PLPLOT::BASE_CONT}] clev $nlev } $w cmd plcol0 3 set title [format "#frPLplot Example 11 - Alt=%.0f, Az=%.0f, Opt=%d" \ [alt $k] [az $k] [opt $k] ] $w cmd plmtex "t" 1.0 0.5 0.5 $title } } # Restore defaults # $w cmd plcol0 1 restore_cmap1_11 $w } plplot-5.10.0+dfsg/examples/tcl/x00 755 1750 1750 74711722014037 156520ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x00 12177 2012-02-24 23:07:11Z andrewross $ # # Maurice LeBrun # 12/24/02 # # A front-end to x00.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x00.tcl plinit x00 plend plplot-5.10.0+dfsg/examples/tcl/x23.tcl 644 1750 1750 2345411543675237 165150ustar andrewandrew# $Id: x23.tcl 11680 2011-03-27 17:57:51Z airwin $ # # Displays Greek letters and mathematically interesting Unicode ranges # Copyright (C) 2005,2008 Alan Irwin # Copyright (C) 2005,2008 Andrew Ross # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # Displays Greek letters and mathematically interesting Unicode ranges # proc x23 {{w loopback}} { set Greek0 "#gA" set Greek1 "#gB" set Greek2 "#gG" set Greek3 "#gD" set Greek4 "#gE" set Greek5 "#gZ" set Greek6 "#gY" set Greek7 "#gH" set Greek8 "#gI" set Greek9 "#gK" set Greek10 "#gL" set Greek11 "#gM" set Greek12 "#gN" set Greek13 "#gC" set Greek14 "#gO" set Greek15 "#gP" set Greek16 "#gR" set Greek17 "#gS" set Greek18 "#gT" set Greek19 "#gU" set Greek20 "#gF" set Greek21 "#gX" set Greek22 "#gQ" set Greek23 "#gW" set Greek24 "#ga" set Greek25 "#gb" set Greek26 "#gg" set Greek27 "#gd" set Greek28 "#ge" set Greek29 "#gz" set Greek30 "#gy" set Greek31 "#gh" set Greek32 "#gi" set Greek33 "#gk" set Greek34 "#gl" set Greek35 "#gm" set Greek36 "#gn" set Greek37 "#gc" set Greek38 "#go" set Greek39 "#gp" set Greek40 "#gr" set Greek41 "#gs" set Greek42 "#gt" set Greek43 "#gu" set Greek44 "#gf" set Greek45 "#gx" set Greek46 "#gq" set Greek47 "#gw" matrix Type1 i 166 = { 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0028, 0x0029, 0x002b, 0x002c, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x005b, 0x005d, 0x005f, 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac, 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7, 0x0192, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022, 0x2026, 0x2032, 0x2033, 0x203e, 0x2044, 0x2111, 0x2118, 0x211c, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, 0x2215, 0x2217, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329, 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665, 0x2666 } set title0 "#<0x10>PLplot Example 23 - Greek Letters" set title1 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)" set title2 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)" set title3 "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)" set title4 "#<0x10>PLplot Example 23 - Number Forms Unicode Block" set title5 "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)" set title6 "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)" set title7 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)" set title8 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)" set title9 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)" set title10 "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)" matrix lo i 11 = { 0x0, 0x0, 0x40, 0x80, 0x2153, 0x2190, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0 } matrix hi i 11 = { 0x30, 0x40, 0x80, 0xA6, 0x2184, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, 0x2300 } matrix nxcells i 11 = { 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } matrix nycells i 11 = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } # non-zero values Must be consistent with nxcells and nycells. matrix offset i 11 = { 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0 } # 30 possible FCI values. matrix fci i 30 = { 0x80000000, 0x80000001, 0x80000002, 0x80000003, 0x80000004, 0x80000010, 0x80000011, 0x80000012, 0x80000013, 0x80000014, 0x80000020, 0x80000021, 0x80000022, 0x80000023, 0x80000024, 0x80000100, 0x80000101, 0x80000102, 0x80000103, 0x80000104, 0x80000110, 0x80000111, 0x80000112, 0x80000113, 0x80000114, 0x80000120, 0x80000121, 0x80000122, 0x80000123, 0x80000124, } set family(0) "sans-serif" set family(1) "serif" set family(2) "monospace" set family(3) "script" set family(4) "symbol" set style(0) "upright" set style(1) "italic" set style(2) "oblique" set weight(0) "medium" set weight(1) "bold" for {set page 0} {$page<11} {incr page} { $w cmd pladv 0 # Set up viewport and window $w cmd plvpor 0.02 0.98 0.02 0.90 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plgspa xmin xmax ymin ymax $w cmd plschr 0.0 0.8 set ycharacter_scale [ expr {1.0/($ymax-$ymin)} ] # Factor should be 0.5, but heuristically it turns out to be larger. $w cmd plgchr chardef charht set yoffset [ expr {1.0*$charht*$ycharacter_scale} ] # Draw the grid using plbox $w cmd plcol0 2 set deltax [ expr {1.0/[nxcells $page]} ] set deltay [ expr {1.0/[nycells $page]} ] $w cmd plbox "bcg" $deltax 0 "bcg" $deltay 0 $w cmd plcol0 15 set length [ expr {[hi $page]-[lo $page]} ] set slice 0 for {set j [ expr {[nycells $page]-1} ]} {$j>=-1} {incr j -1} { set y [ expr {(0.5+$j)*$deltay} ] for {set i 0} {$i<[nxcells $page]} {incr i} { set x [ expr {(0.5+$i)*$deltax} ] if {$slice < $length} { if {$page == 0} { set cmdString [format "#%s" [set Greek$slice]] } elseif {$page <= 3} { set cmdString [format "##\[0x%.4x\]" [ Type1 [expr {[offset $page]+$slice}] ] ] } else { set cmdString [format "##\[0x%.4x\]" [expr {[lo $page]+$slice}]] } $w cmd plptex $x [ expr {$y+$yoffset}] 1. 0. 0.5 [ string range $cmdString 1 end ] $w cmd plptex $x [ expr {$y-$yoffset}] 1. 0. 0.5 $cmdString } incr slice } } $w cmd plschr 0. 1.0 # Page title $w cmd plmtex "t" 1.5 0.5 0.5 [set title$page] } # Demonstrate methods of getting the current fonts $w cmd plgfci fci_old $w cmd plgfont ifamily istyle iweight puts [ format "For example 23 prior to page 12 the FCI is 0x%x" $fci_old ] puts [ format "For example 23 prior to page 12 the font family, style and weight are %s %s %s" \ $family($ifamily) $style($istyle) $weight($iweight) ] for {set page 11} {$page<16} {incr page} { set dy 0.030 $w cmd pladv 0 $w cmd plvpor 0.02 0.98 0.02 0.90 $w cmd plwind 0.0 1.0 0.0 1.0 $w cmd plsfci 0 if {$page == 11} { $w cmd plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with plsfci" } elseif {$page == 12} { $w cmd plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with plsfont" } elseif {$page == 13} { $w cmd plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct" } elseif {$page == 14} { $w cmd plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs" } elseif {$page == 15} { $w cmd plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with ## constructs" } $w cmd plschr 0. 0.75 for {set i 0} {$i< 30} {incr i} { set family_index [ expr {$i % 5}] set style_index [ expr {($i/5) % 3}] set weight_index [ expr {(($i/5)/3) % 2}] if {$page == 11} { $w cmd plsfci [fci $i] set string [format "Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog" \ $family($family_index) \ $style($style_index) \ $weight($weight_index) \ ] } elseif {$page == 12} { $w cmd plsfont $family_index $style_index $weight_index set string [format \ "Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog" \ $family($family_index) \ $style($style_index) \ $weight($weight_index) \ ] } elseif {$page == 13} { set string [format \ "Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog" \ $family($family_index) \ $style($style_index) \ $weight($weight_index) \ [fci $i] \ ] } elseif {$page == 14} { set string [format \ "Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>The quick brown fox jumps over the lazy dog" \ $family($family_index) \ $style($style_index) \ $weight($weight_index) \ $family_index \ $style_index \ $weight_index \ ] } elseif {$page == 15} { set string [format \ "Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>The quick brown fox jumps over the lazy dog" \ $family($family_index) \ $style($style_index) \ $weight($weight_index) \ $family($family_index) \ $style($style_index) \ $weight($weight_index) \ ] } $w cmd plptex 0. [ expr {1. - ($i+0.5)*$dy}] 1. 0. 0. $string } $w cmd plschr 0. 1.0 } # Restore defaults $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/x13 755 1750 1750 743 7602154465 156460ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x13 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x13.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x13.tcl plinit x13 plend plplot-5.10.0+dfsg/examples/tcl/x20.tcl 644 1750 1750 3302512240400010 164470ustar andrewandrew# $Id: x20.tcl 12683 2013-11-12 10:16:40Z airwin $ # # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2008 Arjen Markus # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # plimage demo # # #static PLOptionTable options[] = { #{ # "dbg", /* extra debugging plot */ # NULL, # NULL, # &dbg, # PL_OPT_BOOL, # "-dbg", # "Extra debugging plot" }, #{ # "nosombrero", /* Turns on test of xor function */ # NULL, # NULL, # &nosombrero, # PL_OPT_BOOL, # "-nosombrero", # "No sombrero plot" }, #{ # "nointeractive", /* Turns on test of xor function */ # NULL, # NULL, # &nointeractive, # PL_OPT_BOOL, # "-nointeractive", # "No interactive selection" }, #{ # "save", /* For saving in postscript */ # NULL, # NULL, # &f_name, # PL_OPT_STRING, # "-save filename", # "Save sombrero plot in color postscript `filename'" }, #{ # NULL, /* option */ # NULL, /* handler */ # NULL, /* client data */ # NULL, /* address of variable to set */ # 0, /* mode flag */ # NULL, /* short syntax */ # NULL } /* long syntax */ #}; proc x20 {{w loopback}} { set PI $::PLPLOT::PL_PI set XDIM 260 set YDIM 220 matrix x f $XDIM matrix y f $YDIM matrix z f $XDIM $YDIM matrix r f $XDIM $YDIM # # Bugs in plimage(): # -at high magnifications, the left and right edge are ragged, try # ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 # # Bugs in x20c.c: # -if the window is resized after a selection is made on 'lena', when # making a new selection the old one will re-appear. # # # Parse and process command line arguments # # $w cmd plMergeOpts options "x20c options" NULL set dbg 0 set nosombrero 0 set nointeractive 0 set f_name "" set XDIMM1 [expr {$XDIM-1}] set YDIMM1 [expr {$YDIM-1}] # View image border pixels if { $dbg} { $w cmd plenv 1. $XDIM 1. $YDIM 1 1 for { set i 0 } { $i < $YDIM } { incr i } { for { set j 0 } { $j < $YDIM } { incr j } { z $i $j = 0.0 } } # Build a one pixel square border, for diagnostics for { set i 0 } { $i <$XDIM } { incr i } { # Right z $i $YDIMM1 = 1.0 # Left z $i 0 = 1.0 } for { set i 0 } { $i <$YDIM } { incr i } { # Top z 0 $i = 1.0 # Bottom z $XDIMM1 $i = 1.0 } $w cmd pllab "...around a blue square." " " \ "A red border should appear..." $w cmd plimage z 1. $XDIM 1. $YDIM 0. 0. 1. $XDIM 1.$YDIM } # Sombrero-like demo if { ! $nosombrero } { # draw a yellow plot box, useful for diagnostics# :( $w cmd plcol0 2 $w cmd plenv 0. [expr {2.*$PI}] 0.0 [expr {3.*$PI}] 1 -1 for { set i 0 } { $i < $XDIM } { incr i } { x $i = [expr {double($i)*2.*$PI/double($XDIMM1)}] } for { set i 0 } { $i < $YDIM } { incr i } { y $i = [expr {double($i)*3.*$PI/double($YDIMM1)}] } for { set i 0 } { $i < $XDIM } { incr i } { for { set j 0 } { $j < $YDIM } { incr j } { set xx [x $i] set yy [y $j] r $i $j = [expr {sqrt($xx*$xx+$yy*$yy)+0.001}] set rr [r $i $j] z $i $j = [expr {sin($rr) / $rr}] } } $w cmd pllab "No, an amplitude clipped \"sombrero\"" "" "Saturn?" $w cmd plptex 2. 2. 3. 4. 0. "Transparent image" $w cmd plimage z 0. [expr {2.*$PI}] 0.0 [expr {3.*$PI}] \ 0.05 1. 0. [expr {2.*$PI}] 0. [expr {3.*$PI}] # Save the plot if { $f_name != "" } { save_plot $w $f_name } } # # Read Lena image # Note we try two different locations to cover the case where this # examples is being run from the test_c.sh script # if { ![read_img "lena.pgm" img_f width height num_col] } { if { ![read_img "../lena.pgm" img_f width height num_col] } { #C $w cmd plabort "No such file" puts "Image could not be read" # $w cmd plend return } } # Set gray colormap gray_cmap $w $num_col # Display Lena $w cmd plenv 1. $width 1. $height 1 -1 if { !$nointeractive } { $w cmd pllab "Set and drag Button 1 to (re)set selection, Button 2 to finish." \ " " "Lena..." } else { $w cmd pllab "" " " "Lena..." } $w cmd plimage img_f 1. $width 1. $height 0. 0. 1. $width 1. $height # Selection/expansion demo if { !$nointeractive } { set xi 200.0 set xe 330.0 set yi 280.0 set ye 220.0 if { [get_clip $w $xi $xe $yi $ye] } { # $w cmd plend return } # # I'm unable to continue, clearing the plot and advancing to the next # one, without hiting the enter key, or pressing the button... help# # Forcing the xwin driver to leave locate mode and destroying the # xhairs in GetCursorCmd solves some problems but I still have # to press the enter key or press Button-2 to go to next plot, even # if a pladv() is not present# Using plbop() solves the problem, but # it shouldn't be needed# # # plspause(0), pladv(0), plspause(1), also works, # but the above question remains. # With this approach, the previous pause state is lost, # as there is no API $w cmd to get its current state. # $w cmd plspause 0 $w cmd pladv 0 # Display selection only $w cmd plimage img_f 1. $width 1. $height 0. 0. $xi $xe $ye $yi $w cmd plspause 1 # Zoom in selection $w cmd plenv $xi $xe $ye $yi 1 -1 $w cmd plimage img_f 1. $width 1. $height 0. 0. $xi $xe $ye $yi } # Base the dynamic range on the image contents. a2mnmx img_f $width $height img_min img_max $w cmd plcol0 2 $w cmd plenv 0. $width 0. $height 1 -1 $w cmd pllab "" "" "Reduced dynamic range image example" $w cmd plimagefr img_f 0. $width 0. $height 0. 0. \ [expr {$img_min + $img_max * 0.25}] \ [expr {$img_max - $img_max * 0.25}] # Draw a distorted version of the original image, showing its # full dynamic range. $w cmd plenv 0. $width 0. $height 1 -1 $w cmd pllab "" "" "Distorted image example" # Populate the 2-d grids used for the distortion # NB grids must be 1 larger in each dimension than the image # since the coordinates are for the corner of each pixel. set widthp1 [expr {$width+1}] set heightp1 [expr {$height+1}] matrix xg f $widthp1 $heightp1 matrix yg f $widthp1 $heightp1 set x0 [expr {0.5*$width}] set y0 [expr {0.5*$height}] set dy [expr {0.5*$height}] set stretch 0.5 for { set i 0 } { $i < $widthp1 } { incr i } { for { set j 0 } { $j < $heightp1 } { incr j } { xg $i $j = [expr {$x0 + ($x0-double($i))*(1.0 - $stretch * cos((double($j)-$y0)/$dy*$PI*0.5))}] yg $i $j = $j } } $w cmd plimagefr img_f 0. $width 0. $height 0. 0. $img_min \ $img_max xg yg # $w cmd plend } # ------------------------------------------- # Read image from file in binary ppm format proc read_img {fname img_f_name width_name height_name num_col_name} { upvar 1 $img_f_name img_f upvar 1 $width_name width upvar 1 $height_name height upvar 1 $num_col_name num_col # Naive grayscale binary ppm reading. If you know how to, improve it if { [catch { set infile [open $fname r] }] } { return 0 ;# File does not exist } if { [catch { # I only understand "P5"# set ver [gets $infile] if { $ver != "P5" } { return 0 } while {1} { set ver [gets $infile] if { [string index $ver 0] != "#" } { break } } # Found the line with the sizes scan $ver "%d %d" w h set ver [gets $infile] scan $ver "%d" num_col matrix img_f f $w $h # # Read the second part - it becomes binary # fconfigure $infile -translation binary set picture [read $infile] close $infile # # The picture needs to be flipped vertically. # So do that rightaway # # set count 0 for { set j 0 } { $j < $h } { incr j } { for { set i 0 } { $i < $w } { incr i } { # The u flag for binary scan is only available # with tcl8.5 onwards - use a simpler method # for compatibility. #binary scan [string index $picture $count] cu value binary scan [string index $picture $count] c value set value [expr ( $value + 0x100 ) % 0x100] img_f $i [expr {$h-$j-1}] = $value incr count } } set width $w set height $h } msg] } { # Some error occurred puts "Error reading picture file: $msg" return 0 } else { return 1 } } # Save plot proc save_plot {w fname} { # Get current stream $w cmd plgstrm cur_strm # Create a new one $w cmd plmkstrm new_strm # New device type. Use a known existing driver $w cmd plsdev "psc" $w cmd plsfnam $fname # Copy old stream parameters to new stream $w cmd plcpstrm $cur_strm 0 $w cmd plreplot $w cmd plend1 # Return to previous one $w cmd plsstrm $cur_strm } # Get selection square interactively proc get_clip {w xi xe yi ye} { # How do we translate that? # type(PLGraphicsIn) :: gin return 0 ;# getcursor not supported! matrix sx f 5 matrix sy f 5 set PLK_Return "\r" scan "Q" %c Q set xxi $xi set yyi $yi set xxe $xe set yye $ye set start 0 # Enter xor mode to draw a selection rectangle $w cmd plxormod 1 st # Driver has xormod capability, continue if { $st } { while {1} { $w cmd plxormod 0 st $w cmd plgetcursor gin $w cmd plxormod 1 st if { $gin_button == 1 } { set xxi $gin_wX set yyi $gin_wY if { $start } { #C clear previous rectangle $w cmd plline 5 sx sy } set start 0 sx 0 = $xxi sy 0 = $yyi sx 4 = $xxi sy 4 = $yyi } if { $gin_state & 0x100 != 0 } { set xxe $gin_wX set yye $gin_wY if { $start } { # Clear previous rectangle $w cmd plline 5 sx sy } set start 1 sx 2 = $xxe sy 2 = $yye sx 1 = $xxe sy 1 = $yyi sx 3 = $xxi sy 3 = $yye # Draw new rectangle $w cmd plline 5 sx sy } if {($gin_button == 3) || ($gin_keysym == $PLK_Return) || \ ($gin_keysym == $Q) } { if { $start } { # Clear previous rectangle $w cmd plline 5 sx sy break } } } # Leave xor mode $w cmd plxormod 0 st if { $xxe < $xxi } { set t $xxi set xxi $xxe set xxe $t } if { $yyi < $yye } { set t $yyi set yyi $yye set yye $t } set xe $xxe set xi $xxi set ye $yye set yi $yyi set get_clip [expr { $gin_keysym == $Q}] } else { # driver has no xormod capability, just do nothing return 0 } } # Set gray colormap proc gray_cmap {w num_col} { matrix R f 2 matrix G f 2 matrix B f 2 matrix pos f 2 matrix rev i 2 R 0 = 0.0 G 0 = 0.0 B 0 = 0.0 R 1 = 1.0 G 1 = 1.0 B 1 = 1.0 pos 0 = 0.0 pos 1 = 1.0 rev 0 = 0 rev 1 = 0 $w cmd plscmap1n $num_col $w cmd plscmap1l 1 2 pos R G B rev } #---------------------------------------------------------------------------- # proc max and min proc min {args} { set x [lindex $args 0] foreach i $args { if {$i<$x} {set x $i} } return $x } proc max {args} { set x [lindex $args 0] foreach i $args { if {$i>$x} {set x $i} } return $x } #---------------------------------------------------------------------------- # proc a2mnmx # Minimum and the maximum elements of a 2-d array. proc a2mnmx {f nx ny fmin fmax} { upvar 1 $fmin vmin upvar 1 $fmax vmax set vmax [$f 0 0] set vmin $vmax for {set j 0} {$j < $ny} {incr j} { for {set i 0} {$i < $nx} {incr i} { set vmax [max $vmax [$f $i $j]] set vmin [min $vmin [$f $i $j]] } } } plplot-5.10.0+dfsg/examples/tcl/x27.tcl 644 1750 1750 1265111616726012 165030ustar andrewandrew# $Id: x27.tcl 11859 2011-08-05 08:38:34Z andrewross $ # # Drawing "spirograph" curves - epitrochoids, cycolids, roulettes # # Copyright (C) 2007 Arjen Markus # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # -------------------------------------------------------------------------- # main # # Generates two kinds of plots: # - construction of a cycloid (animated) # - series of epitrochoids and hypotrochoids # -------------------------------------------------------------------------- proc x27 {{w loopback}} { # R, r, p, N set params { { 21.0 7.0 7.0 3.0 } { 21.0 7.0 10.0 3.0 } { 21.0 -7.0 10.0 3.0 } { 20.0 3.0 7.0 20.0 } { 20.0 3.0 10.0 20.0 } { 20.0 -3.0 10.0 20.0 } { 20.0 13.0 7.0 20.0 } { 20.0 13.0 20.0 20.0 } { 20.0 -13.0 20.0 20.0 }} # Illustrate the construction of a cycloid cycloid $w # Loop over the various curves # First an overview, then all curves one by one $w cmd pladv 0 $w cmd plssub 3 3 set fill 0 for { set i 0 } { $i < 9 } { incr i } { $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 1.0 spiro $w [lindex $params $i] $fill } $w cmd pladv 0 $w cmd plssub 1 1 for { set i 0 } { $i < 9 } { incr i } { $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 1.0 spiro $w [lindex $params $i] $fill } # Fill the curves set fill 1 $w cmd pladv 0 $w cmd plssub 1 1 ;# One window per curve for { set i 0 } { $i < 9 } { incr i } { $w cmd pladv 0 $w cmd plvpor 0.0 1.0 0.0 1.0 spiro $w [lindex $params $i] $fill } arcs $w } #-------------------------------------------------------------------------- # Calculate greatest common divisor following pseudo-code for the # Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm proc gcd {a b} { set a [expr {int(abs($a))}] set b [expr {int(abs($b))}] while { $b != 0 } { set t $b set b [expr {$a % $b}] set a $t } return $a } # =============================================================== proc cycloid {w} { # TODO } # =============================================================== proc spiro {w params fill} { foreach {param1 param2 param3 param4} $params {break} set NPNT 2000 matrix xcoord f [expr {$NPNT+1}] matrix ycoord f [expr {$NPNT+1}] # Fill the coordinates # Proper termination of the angle loop very near the beginning # point, see # http://mathforum.org/mathimages/index.php/Hypotrochoid. set windings [expr {int(abs($param2)/[gcd $param1 $param2])}] set steps [expr {int($NPNT/$windings)}] set dphi [expr {2.0*$::PLPLOT::PL_PI/double($steps)}] # puts [ format "windings, steps, dphi = %d, %d, %f" $windings $steps $dphi ] set n [expr {int($windings*$steps)+1}] for { set i 0 } { $i < $n } { incr i } { set phi [expr {double($i) * $dphi}] set phiw [expr {($param1-$param2)/$param2*$phi}] xcoord $i = [expr {($param1-$param2)*cos($phi)+$param3*cos($phiw)}] ycoord $i = [expr {($param1-$param2)*sin($phi)-$param3*sin($phiw)}] if { $i == 0} { set xmin [xcoord 0] set xmax [xcoord 0] set ymin [ycoord 0] set ymax [ycoord 0] } if { $xmin > [xcoord $i] } { set xmin [xcoord $i] } if { $xmax < [xcoord $i] } { set xmax [xcoord $i] } if { $ymin > [ycoord $i] } { set ymin [ycoord $i] } if { $ymax < [ycoord $i] } { set ymax [ycoord $i] } } set xrange_adjust [expr {0.15 * ($xmax - $xmin) }] set xmin [expr {$xmin - $xrange_adjust }] set xmax [expr {$xmax + $xrange_adjust }] set yrange_adjust [expr {0.15 * ($ymax - $ymin) }] set ymin [expr {$ymin - $yrange_adjust }] set ymax [expr {$ymax + $yrange_adjust }] $w cmd plwind $xmin $xmax $ymin $ymax $w cmd plcol0 1 if { $fill } { $w cmd plfill $n xcoord ycoord } else { $w cmd plline $n xcoord ycoord } } proc arcs {w} { set NSEG 8 set pi $::PLPLOT::PL_PI set theta 0.0 set dtheta [expr {360.0 / $NSEG}] $w cmd plenv -10.0 10.0 -10.0 10.0 1 0 # Plot segments of circle in different colors for { set i 0 } { $i < $NSEG } {incr i} { $w cmd plcol0 [expr {$i%2 + 1}] $w cmd plarc 0.0 0.0 8.0 8.0 $theta [expr {$theta + $dtheta}] 0.0 0 set theta [expr {$theta + $dtheta}] } # Draw several filled ellipses inside the circle at different # angles. set a 3.0 set b [expr {$a * tan( ($dtheta/180.0*$pi)/2.0 )}] set theta [expr {$dtheta/2.0}] for {set i 0} { $i < $NSEG } { incr i } { $w cmd plcol0 [expr {2 - $i%2}] $w cmd plarc [expr {$a*cos($theta/180.0*$pi)}] [expr {$a*sin($theta/180.0*$pi)}] $a $b 0.0 360.0 $theta 1 set theta [expr {$theta + $dtheta}] } } plplot-5.10.0+dfsg/examples/tcl/plot.dat 644 1750 1750 3527 5752765634 170120ustar andrewandrew-3.166667 -0.007917 -3.000000 0.047040 -2.833333 0.107083 -2.666667 0.171477 -2.500000 0.239389 -2.333333 0.309894 -2.166667 0.381997 -2.000000 0.454649 -1.833333 0.526764 -1.666667 0.597245 -1.500000 0.664997 -1.333333 0.728953 -1.166667 0.788096 -1.000000 0.841471 -0.833333 0.888212 -0.666667 0.927555 -0.500000 0.958851 -0.333333 0.981584 -0.166667 0.995377 0.000000 1.000000 0.166667 0.995377 0.333333 0.981584 0.500000 0.958851 0.666667 0.927555 0.833333 0.888212 1.000000 0.841471 1.166667 0.788096 1.333333 0.728953 1.500000 0.664997 1.666667 0.597245 1.833333 0.526764 2.000000 0.454649 2.166667 0.381997 2.333333 0.309894 2.500000 0.239389 2.666667 0.171477 2.833333 0.107083 3.000000 0.047040 3.166667 -0.007917 3.333333 -0.057170 3.500000 -0.100224 3.666667 -0.136712 3.833333 -0.166403 4.000000 -0.189201 4.166667 -0.205141 4.333333 -0.214388 4.500000 -0.217229 4.666667 -0.214062 4.833333 -0.205385 5.000000 -0.191785 5.166667 -0.173918 5.333333 -0.152499 5.500000 -0.128280 5.666667 -0.102035 5.833333 -0.074543 6.000000 -0.046569 6.166667 -0.018852 6.333333 0.007915 6.500000 0.033095 6.666667 0.056123 6.833333 0.076509 7.000000 0.093855 7.166667 0.107854 7.333333 0.118295 7.500000 0.125067 7.666667 0.128153 7.833333 0.127632 8.000000 0.123670 8.166667 0.116512 8.333333 0.106475 8.500000 0.093940 8.666667 0.079333 8.833333 0.063120 9.000000 0.045791 9.166667 0.027846 9.333333 0.009784 9.500000 -0.007911 9.666667 -0.024780 9.833333 -0.040402 10.000000 -0.054402 10.166667 -0.066460 10.333333 -0.076318 10.500000 -0.083781 10.666667 -0.088725 10.833333 -0.091095 11.000000 -0.090908 11.166667 -0.088245 11.333333 -0.083250 11.500000 -0.076126 11.666667 -0.067127 11.833333 -0.056546 12.000000 -0.044714 12.166667 -0.031985 12.333333 -0.018724 12.500000 -0.005306 12.666667 0.007905 12.833333 0.020556 13.000000 0.032321 13.166667 0.042903 13.333333 0.052046 plplot-5.10.0+dfsg/examples/tcl/x06 755 1750 1750 743 7602154465 156500ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x06 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x06.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x06.tcl plinit x06 plend plplot-5.10.0+dfsg/examples/tcl/x05.tcl 644 1750 1750 124511530413277 164550ustar andrewandrew#---------------------------------------------------------------------------- # $Id: x05.tcl 11572 2011-02-21 07:39:43Z arjenmarkus $ #---------------------------------------------------------------------------- proc x05 {{w loopback}} { set npts 2047 matrix data f $npts # Fill up data points set delta [expr 2.0 * $::PLPLOT::PL_PI / $npts] for {set i 0} {$i < $npts} {incr i} { data $i = [expr sin($i * $delta)] } $w cmd plcol0 1 $w cmd plhist $npts data -1.1 1.1 44 0 $w cmd plcol0 2 $w cmd pllab "#frValue" "#frFrequency" \ "#frPLplot Example 5 - Probability function of Oscillator" # Restore defaults # $w cmd plcol0 1 } plplot-5.10.0+dfsg/examples/tcl/x07 755 1750 1750 743 7602154465 156510ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x07 4212 2002-12-24 22:01:25Z mlebrun $ # # Maurice LeBrun # 12/24/02 # # A front-end to x07.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x07.tcl plinit x07 plend plplot-5.10.0+dfsg/examples/tcl/x16 755 1750 1750 117011400674630 156740ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: x16 11042 2010-05-31 08:55:52Z arjenmarkus $ # # Maurice LeBrun # 12/24/02 # # A front-end to x16.tcl for running directly from the command line, locating # pltcl via PATH. # Handles all usual plplot command arguments. See "pltcl -h" for info. #-----------------------------------------------------------------------------# #\ exec pltcl -f "$0" ${1+"$@"} source x16.tcl # Reducing the size of the colour map needs to be done before plinit plspal0 "cmap0_black_on_white.pal" plspal1 "cmap1_gray.pal" 1 plscmap0n 3 plinit x16 plend plplot-5.10.0+dfsg/examples/python/ 775 1750 1750 012406243570 160145ustar andrewandrewplplot-5.10.0+dfsg/examples/python/test_symbol_clip.py 755 1750 1750 54111300351526 217730ustar andrewandrew#!/usr/bin/env python # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() plssym(0., 10.) plenv(0,1,0,1,0,0) plpoin([1.0],[0.5],0) plend() plplot-5.10.0+dfsg/examples/python/plplotcanvas_animation.py 755 1750 1750 1467011276127065 232500ustar andrewandrew#!/usr/bin/env python """ animation.py - Demonstrates the use of the plplot canvas widget with gtk. Copyright (C) 2004, 2005 Thomas J. Duck All rights reserved. Thomas J. Duck Department of Physics and Atmospheric Science, Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 $Author: airwin $ $Revision: 10568 $ $Date: 2009-11-09 16:05:09 -0800 (Mon, 09 Nov 2009) $ $Name$ NOTICE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA DESCRIPTION This program demonstrates the use of the plplot canvas widget with gtk. Two graphs are draw in a window. When the Execute button is pressed, two different waves progress through the graph in real time. Plotting to the two graphs is handled in two different threads. """ import sys,threading import plplot_python_start import plplot_py_demos import plplotcanvas import gtk # The number of time steps STEPS = 100 # The number of points and period for the first wave NPTS = 100 PERIOD = 30 # The width and height for each plot widget WIDTH = 800 HEIGHT = 300 # Run the plots in different threads thread0 = None thread1 = None # Create two different canvases canvas0=None canvas1=None # Create the x array x = plplot_py_demos.arange(NPTS) # Lock on the gtkstate so that we don't try to plot after gtk_main_quit GTKSTATE_CONTINUE=True GTKSTATE_QUIT=False gtk_state_lock = threading.Lock() gtk_state = GTKSTATE_CONTINUE # setup_plt - preparation for plotting an animation to a canvas def setup_plot(canvas,title): # Set up the viewport and window canvas.vsta() canvas.wind(x[0],x[NPTS-1],-2.,2.) # Set the pen width canvas.wid(2) # The axes should be persistent, so that they don't have to be # replotted every time (which would slow down the animation) canvas.use_persistence(True); # Draw the axes canvas.col0(15) canvas.box("bcnst",0.,0,"bcnstv",0.,0); canvas.lab("Phase","Amplitude",title); # Prepare for plotting canvas.col0(canvas.get_stream_number()+8) # The animated data should not be persistent canvas.use_persistence(False); # plot - draws a plot on a canvas def plot(canvas,offset,title): global x # Get the stream number Nstream = canvas.get_stream_number() # Generate the sinusoid y = plplot_py_demos.sin(2.*3.14*(x+offset*(Nstream+1))/PERIOD/(Nstream+1)) # Draw the line canvas.line(x, y) # Advance the page canvas.adv(0) # Delete event callback def delete_event(widget, event, data=None): return False # Destroy event calback def destroy(widget, data=None): global gtk_state gtk_state_lock.acquire() gtk_state = GTKSTATE_QUIT gtk_state_lock.release() gtk.main_quit() def plot_thread(canvas,title): # Draw plots in succession for i in range(STEPS): gtk.gdk.threads_enter() # Lock the current gtk state gtk_state_lock.acquire() # Check to make sure gtk hasn't quit if gtk_state == GTKSTATE_QUIT: gtk_state_lock.release() gtk.gdk.threads_leave() return # Draw the plot plot(canvas,i,title) # Release the lock gtk_state_lock.release() gtk.gdk.threads_leave() # Start threads callback from execute button def start_threads(widget,data): global thread0 global thread1 # Ignore call if threads are currently active if (thread0!=None or thread1!=None) and \ (thread0.isAlive() or thread1.isAlive()): return # Create the two plotting threads thread0 = threading.Thread(None,plot_thread, kwargs={"canvas":canvas0, "title":"A phase-progressing wave"}) thread0.start() thread1 = threading.Thread(None,plot_thread, kwargs={"canvas":canvas1, "title":"Another phase-progressing wave"}) thread1.start() if __name__ == "__main__": # Parse the options plplot_py_demos.plparseopts(sys.argv,plplot_py_demos.PL_PARSE_FULL); # Initialize gtk.gdk.threads_init() # Create the first canvas, set its size, draw some axes on it, and # place it in a frame canvas0=plplotcanvas.Canvas() canvas0.set_size(WIDTH,HEIGHT) canvas0.adv(0) # Advance the page to finalize the plot setup_plot(canvas0,"A phase-progressing wave") canvas0frame=gtk.Frame() canvas0frame.set_shadow_type(type=gtk.SHADOW_ETCHED_OUT) canvas0frame.add(canvas0) # Create the second canvas, set its size, draw some axes on it, and # place it in a frame canvas1=plplotcanvas.Canvas() canvas1.set_size(WIDTH,HEIGHT) canvas1.adv(0) # Advance the page to finalize the plot setup_plot(canvas1,"Another phase-progressing wave") canvas1frame=gtk.Frame() canvas1frame.set_shadow_type(type=gtk.SHADOW_ETCHED_OUT) canvas1frame.add(canvas1) # Create a button and put it in a box button = gtk.Button (stock=gtk.STOCK_EXECUTE); button.connect("clicked", start_threads, None) button.set_border_width(10) buttonbox = gtk.HBox() buttonbox.pack_start(button,True,False,0) # Create and fill the vbox with the widgets vbox = gtk.VBox() vbox.pack_start(canvas0frame,True,False,0) vbox.pack_start(canvas1frame,True,False,10) vbox.pack_start(buttonbox,True,False,0) # Create a new window window = gtk.Window(gtk.WINDOW_TOPLEVEL) # Set the border width of the window window.set_border_width(10) # Connect the signal handlers to the window decorations window.connect("delete_event",delete_event) window.connect("destroy",destroy) # Put the vbox into the window window.add(vbox) # Display everything window.show_all() # Start the gtk main loop gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() plplot-5.10.0+dfsg/examples/python/x05 755 1750 1750 216510233632313 164310ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw05 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x14 755 1750 1750 145511117620021 164250ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import xw14 plplot-5.10.0+dfsg/examples/python/x12 755 1750 1750 216510233632313 164270ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw12 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x16.py 755 1750 1750 1241211541217123 170770ustar andrewandrew#!/usr/bin/env python #---------------------------------------------------------------------------- # PLplot Python demo #16 # # Based heavily on the Tcl demo 16. # #---------------------------------------------------------------------------- # plshade demo, using color fill. from numpy import * from math import * def main(w): ns = 20 nx = 35 ny = 46 sh_cmap = 1 min_color = 1; min_width = 0; max_color = 0; max_width = 0 clevel = zeros(ns,'d') xg1 = zeros(nx,'d') yg1 = zeros(ny,'d') xg2 = reshape( zeros(nx*ny,'d'), (nx,ny) ) #yg2 = zeros(nx,ny) #zz = zeros(nx,ny) #ww = zeros(nx,ny) yg2 = reshape( zeros(nx*ny,'d'), (nx,ny) ) zz = reshape( zeros(nx*ny,'d'), (nx,ny) ) ww = reshape( zeros(nx*ny,'d'), (nx,ny) ) # Set up data array for i in range(nx): x = (i - .5*nx) / (nx/2.) for j in range(ny): y = (j - .5*ny) / (ny/2.) - 1. zz[i,j] = -sin(7.*x) * cos(7.*y) + x*x - y*y ww[i,j] = -cos(7.*x) * sin(7.*y) + 2.*x*y #zmin = min(zz.reshape()) #zmax = max(zz.reshape()) zmin = min(min(zz)) zmax = max(max(zz)) print "zmin=", zmin, " zmax=", zmax for i in range(ns): clevel[i] = zmin + (zmax - zmin) * (i+.5)/ns # Build the 1-d coord arrays. distort = .4 for i in range(nx): xx = -1. + i *( 2./(nx-1)) xg1[i] = xx + distort * cos( .5 * pi * xx ) for j in range(ny): yy = -1. + j * (2./(ny-1.)) yg1[j] = yy - distort * cos( .5 * pi * yy ) # Build the 2-d coord arrays. for i in range(nx): xx = -1. + i * (2./(nx-1.)) for j in range(ny): yy = -1. + j * (2./(ny-1.)) argx = .5 * pi * xx argy = .5 * pi * yy xg2[i,j] = xx + distort * cos(argx) * cos(argy) yg2[i,j] = yy - distort * cos(argx) * cos(argy) # Plot using identity transform w.pladv(0) w.plvpor( .1, .9, .1, .9 ) w.plwind( -1., 1., -1., 1. ) for i in range(ns): shade_min = zmin + (zmax - zmin) * i / ns shade_max = zmin + (zmax - zmin) * (i+1) / ns sh_color = i/(ns-1.) sh_width = 2 w.plpsty(0) w.plshade( zz, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1 ) w.plcol0(1) w.plbox( "bcnst", 0., 0, "bcnstv", 0., 0 ) w.plcol0(2) # plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, mypltr, NULL); w.pllab( "distance", "altitude", "Bogon density" ) w.pleop() # Plot using 1d coordinate transform w.pladv(0) w.plvpor( .1, .9, .1, .9 ) w.plwind( -1., 1., -1., 1. ) for i in range(ns): shade_min = zmin + (zmax - zmin) * i / ns shade_max = zmin + (zmax - zmin) * (i+1) / ns sh_color = i/ (ns-1.) sh_width=2 w.plpsty(0) w.plshade( zz, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1, 'pltr1', xg1, yg1 ) w.plcol0(1) w.plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ) w.plcol0(2) # plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr1, (void *) &cgrid1); w.pllab( "distance", "altitude", "Bogon density" ) w.pleop() # Plot using 2d coordinate transform w.pladv(0) w.plvpor( .1, .9, .1, .9 ) w.plwind( -1., 1., -1., 1. ) for i in range(ns): shade_min = zmin + (zmax - zmin) * i / ns shade_max = zmin + (zmax - zmin) * (i+1) / ns sh_color = i/ (ns-1.) sh_width=2 w.plpsty(0) w.plshade( zz, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 0, 'pltr2', xg2, yg2 ) w.plcol0(1) w.plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ) w.plcol0(2) # plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr2, (void *) &cgrid2); w.pllab( "distance", "altitude", "Bogon density, with streamlines" ) w.pleop() # Do it again, but show wrapping support. w.pladv(0) w.plvpor( .1, .9, .1, .9 ) w.plwind( -1., 1., -1., 1. ) # Hold perimeter px = zeros(100,'d'); py = zeros(100,'d') for i in range(100): t = 2.*pi*i/99. px[i] = cos(t) py[i] = sin(t) # We won't draw it now b/c it should be drawn /after/ the plshade stuff. # Now build the new coordinate matrices. #xg = zeros(nx,ny); yg= zeros(nx,ny); z = zeros(nx,ny) xg = reshape( zeros(nx*ny,'d'), (nx,ny) ) yg = reshape( zeros(nx*ny,'d'), (nx,ny) ) z = reshape( zeros(nx*ny,'d'), (nx,ny) ) for i in range(nx): r = i/(nx-1.) for j in range(ny): t = 2.*pi*j/(ny-1.) xg[i,j] = r * cos(t) yg[i,j] = r * sin(t) z [i,j] = exp(-r*r) * cos(5.*t) * cos( 5.*pi*r) # Need a new clevel to go along with the new data set. #zmin = min(z.reshape()) #zmax = max(z.reshape()) zmin = min(min(z)) zmax = max(max(z)) for i in range(ns): clevel[i] = zmin + (zmax - zmin) * (i+.5)/ns # Now we can shade the interior region. for i in range(ns): shade_min = zmin + (zmax - zmin) * i / ns shade_max = zmin + (zmax - zmin) * (i+1) / ns sh_color = i/ (ns-1.) sh_width=2 w.plpsty(0) w.plshade( z, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 0, 'pltr2', xg, yg, 2 ) # Now we can draw the perimeter. w.plcol0(1) w.plline( px, py ) # And label the plot. w.plcol0(2) w.pllab( "", "", "Tokamak Bogon Instability" ) plplot-5.10.0+dfsg/examples/python/test_type1.py 755 1750 1750 614011366206125 205500ustar andrewandrew#!/usr/bin/env python # $Id: test_type1.py 10948 2010-04-29 04:34:29Z airwin $ # Copyright 2010 Alan W. Irwin # This file is part of PLplot. # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Plots the first 256 unicode glyphs. # N.B. If ps.c is edited to #define PL_TEST_TYPE1 (which interprets # unicode in the range from 0 to 255 directly as Type1 font indices) and # if the -dev ps -drvopt hrshsym=0 command-line options are used, then # the results are similar to the results obtained from the historical # gfontview application that is no longer available under Linux. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot_py_demos import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() # main # # Displays all available Type1 glyphs. family = ( "sans-serif", "serif", "monospace", "script", "symbol", ) style = ( "upright", "italic", "oblique", ) weight = ( "medium", "bold", ) def main(): FCI_COMBINATIONS = 30 plsfont(0, 0, 0) for index_fci in range(0,FCI_COMBINATIONS): family_index = index_fci % 5 style_index = (index_fci/5) % 3 weight_index = ((index_fci/5)/3) % 2 title = "Type 1 glyphs for family = " + family[family_index] + ", style = " + style[style_index] + ", weight = " + weight[weight_index] pladv(0) # Set up viewport and window plcol0(2) plvpor(0.1, 1.0, 0.1, 0.9) plwind(0.0, 1.0, 0.0, 1.0) # Draw the grid using plbox plbox("bcg", 1./16., 0, "bcg", 1./16., 0) # Write the digits below the frame plcol0(15) for i in range(16): plmtex("b", 1.5, ((i+0.5)/16.), 0.5, str(i)) k = 0 plmtex("t", 1.5, 0.5, 0.5, title) for i in range(16): # Write the digits to the left of the frame plmtex("lv", 1.0, (1.0 - (i+0.5)/16.), 1.0, str(16 * i)) plsfont(family_index, style_index, weight_index) for j in range(16): x = (j+0.5)/16. y = 1. - (i+0.5)/16 # Display the Type 1 glyph corresponding to k glyph_string = unichr(k).encode('utf-8') # Escape the escape. if glyph_string == "#": glyph_string = "##" plptex(x, y, 1., 0., 0.5, glyph_string) k = k + 1 plsfont(0, 0, 0) # Restore defaults #plcol0(1) main() plend() plplot-5.10.0+dfsg/examples/python/x11.py 755 1750 1750 347211541217123 170600ustar andrewandrew#!/usr/bin/env python # # x11c.c # # Mesh plot demo. from numpy import * import math #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) XPTS = 35 # Data points in x YPTS = 46 # Data points in y opt = [1, 2, 3, 3] alt = [60.0, 20.0, 60.0, 60.0] az = [30.0, 60.0, 120.0, 160.0] title = ["#frPLplot Example 11 - Alt=60, Az=30, Opt=1", "#frPLplot Example 11 - Alt=20, Az=60, Opt=2", "#frPLplot Example 11 - Alt=60, Az=120, Opt=3", "#frPLplot Example 11 - Alt=60, Az=160, Opt=3"] # main # # Does a series of mesh plots for a given data set, with different # viewing options in each plot. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() x = zeros(XPTS,'d'); y = zeros(YPTS,'d') #z = zeros(XPTS,YPTS) z = reshape( zeros( XPTS*YPTS, 'd' ), (XPTS, YPTS) ) ## x = [] ## y = [] ## z = [] for i in range(XPTS): x[i] = float(i - (XPTS / 2)) / float(XPTS / 2) for i in range(YPTS): y[i] = float(i - (YPTS / 2)) / float(YPTS / 2) for i in range(XPTS): xx = x[i] zz = [] for j in range(YPTS): yy = y[j] ## zz.append(math.cos(2.0 * math.pi * xx) * ## math.sin(2.0 * math.pi * yy)) ## z.append(zz) z[i,j] = math.cos(2.0 * math.pi * xx) * \ math.sin(2.0 * math.pi * yy) for k in range(4): w.pladv(0) w.plcol0(1) w.plvpor(0.0, 1.0, 0.0, 0.8) w.plwind(-1.0, 1.0, -1.0, 1.5) w.plw3d(1.0, 1.0, 1.2, -1.0, 1.0, -1.0, 1.0, -1.5, 1.5, alt[k], az[k]) w.plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4) w.plcol0(2) w.plmesh(x, y, z, opt[k]) w.plcol0(3) w.plmtex("t", 1.0, 0.5, 0.5, title[k]) w.pleop() ##main() plplot-5.10.0+dfsg/examples/python/x01 755 1750 1750 226311406176520 164320ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) version = plgver() print "PLplot library version: " + version # Initialize plplot plinit() import xw01 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw13.py 644 1750 1750 446611543675237 172720ustar andrewandrew# $Id: xw13.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Pie chart demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * text = ["Maurice", "Geoffrey", "Alan", "Rafael", "Vince"] # main # # Does a simple pie chart. def main(): pladv(0) # Ensure window has aspect ratio of one so circle is # plotted as a circle. plvasp(1.0) plwind(0., 10., 0., 10.) #plenv(0., 10., 0., 10., 1, -2) plcol0(2) #if these don't add up to 100, the logic adds to the last to make #up the balance. per = [10., 32., 12., 30., 16.] theta0 = 0 for i in range(5): #theta quantities scaled as integers to make logic independent of #floating point considerations. #n.b. theta multiplied by 2 pi/500 afterward so per is in fact #interpreted as a percentage. theta1 = theta0 + int(5.*per[i]) if i == 4: theta1 = 500 theta = arange(theta0,theta1+1) x = concatenate((array([5.]), (5. + 3.*cos((2.*pi/500.)*theta)))) y = concatenate((array([5.]), (5. + 3.*sin((2.*pi/500.)*theta)))) plcol0(i + 1) plpsty((i + 3) % 8 + 1) plfill(x, y) plcol0(1) plline(x, y) just = (2.*pi/500.)*(theta0 + theta1) / 2. dx = .25 * cos(just) dy = .25 * sin(just) if (theta0 + theta1) < 250 or (theta0 + theta1) > 750: just = 0. else: just = 1. mid = len(x) / 2 plptex((x[mid] + dx), (y[mid] + dy), 1.0, 0.0, just, text[i]) theta0 = theta[-1] plfont(2) plschr(0., 1.3) plptex(5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales") # Restore defaults plfont(1) #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/x27 755 1750 1750 212111050560315 164250ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw27 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw08.py 644 1750 1750 1126411543675237 173100ustar andrewandrew# $Id: xw08.py 11680 2011-03-27 17:57:51Z airwin $ # xw08.py PLplot demo for Python # # Copyright (C) 2004 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from plplot_py_demos import * XPTS = 35 # Data points in x YPTS = 46 # Data points in y alt = [60.0, 20.0] az = [30.0, 60.0] title = ["#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60"] # Routine for restoring colour map1 to default. # See static void plcmap1_def(void) in plctrl.c for reference. def restore_cmap1(): # For center control points, pick black or white, whichever is closer to bg # Be careful to pick just short of top or bottom else hue info is lost vertex = sum(array(plgcolbg()))/(3.*255.) if vertex < 0.5: vertex = 0.01 midpt = 0.10 else: vertex = 0.99 midpt = 0.90 # Independent variable of control points. i = array((0., 0.44, 0.50, 0.50, 0.56, 1.)) # Hue for control points. Blue-violet to red h = array((260., 260., 260., 0., 0., 0.)) # Lightness ranging from medium to vertex to medium l = array((0.5, midpt, vertex, vertex, midpt, 0.5)) # Saturation is complete for default s = array((1., 1., 1., 1., 1., 1.)) # Default number of cmap1 colours plscmap1n(128) # Interpolate between control points to set up default cmap1. plscmap1l(0, i, h, l, s) # Routine for defining a specific color map 1 in HLS space. # if gray is true, use basic grayscale variation from half-dark to light. # otherwise use false color variation from blue (240 deg) to red (360 deg). def cmap1_init(gray): # Independent variable of control points. i = array((0., 1.)) if gray: # Hue for control points. Doesn't matter since saturation is zero. h = array((0., 0.)) # Lightness ranging from half-dark (for interest) to light. l = array((0.5, 1.)) # Gray scale has zero saturation s = array((0., 0.)) else: # Hue ranges from blue (240 deg) to red (0 or 360 deg) h = array((240., 0.)) # Lightness and saturation are constant (values taken from C example). l = array((0.6, 0.6)) s = array((0.8, 0.8)) # number of cmap1 colours is 256 in this case. plscmap1n(256) # Interpolate between control points to set up cmap1. plscmap1l(0, i, h, l, s) # main # # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. def main(): rosen = 1 x = (arange(XPTS) - (XPTS / 2)) / float(XPTS / 2) y = (arange(YPTS) - (YPTS / 2)) / float(YPTS / 2) if rosen == 1: x = 1.5*x y = 0.5 + y x.shape = (-1,1) r2 = (x*x) + (y*y) if rosen == 1: z = (1. - x)*(1. - x) + 100 * (x*x - y)*(x*x - y) # The log argument may be zero for just the right grid. */ z = log(choose(greater(z,0.), (exp(-5.), z))) else: z = exp(-r2)*cos((2.0*pi)*sqrt(r2)) x.shape = (-1,) zmin = min(z.flat) zmax = max(z.flat) nlevel = 10 step = (zmax-zmin)/(nlevel+1) clevel = zmin + step + arange(nlevel)*step pllightsource(1., 1., 1.) for k in range(2): for ifshade in range(4): pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -0.9, 1.1) plcol0(3) plmtex("t", 1.0, 0.5, 0.5, title[k]) plcol0(1) if rosen == 1: plw3d(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k]) else: plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0) plcol0(2) if ifshade == 0: # diffuse light surface plot. # set up modified gray scale cmap1. cmap1_init(1) plsurf3d(x, y, z, 0, ()) elif ifshade == 1: # magnitude colored plot. cmap1_init(0) plsurf3d(x, y, z, MAG_COLOR, ()) elif ifshade == 2: # magnitude colored plot with faceted squares cmap1_init(0) plsurf3d(x, y, z, MAG_COLOR | FACETED, ()) elif ifshade == 3: # magnitude colored plot with contours cmap1_init(0) plsurf3d(x, y, z, MAG_COLOR | SURF_CONT | BASE_CONT, clevel) # Restore defaults #plcol0(1) restore_cmap1() main() plplot-5.10.0+dfsg/examples/python/xw12.py 644 1750 1750 371211543675237 172620ustar andrewandrew# $Id: xw12.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Bar chart demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Does a simple bar chart, using color fill. If color fill is # unavailable, pattern fill is used instead (automatic). def main(): pos = array ([0.0, 0.25, 0.5, 0.75, 1.0]) red = array ([0.0, 0.25, 0.5, 1.0, 1.0]) green = array ([1.0, 0.5, 0.5, 0.5, 1.0]) blue = array ([1.0, 1.0, 0.5, 0.25, 0.0]) pladv(0) plvsta() plwind(1980.0, 1990.0, 0.0, 35.0) plbox("bc", 1.0, 0, "bcnv", 10.0, 0) plcol0(2) pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12") y0 = [5, 15, 12, 24, 28, 30, 20, 8, 12, 3] plscmap1l(1, pos, red, green, blue) for i in range(10): # plcol0(i + 1) plcol1(i / 9.0) plpsty(0) fbox( (1980. + i), y0[i] ) string = `y0[i]` plptex((1980. + i + .5), (y0[i] + 1.), 1.0, 0.0, .5, string) string = `1980 + i` plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string) # Restore defaults #plcol0(1) def fbox( x0, y0 ): x = [x0, x0, x0 + 1., x0 + 1.] y = [0., y0, y0, 0.] plfill(x, y) plcol0(1) pllsty(1) plline(x, y) main() plplot-5.10.0+dfsg/examples/python/plplot_python_start.py.in 644 1750 1750 77612167062047 231750ustar andrewandrew# Append to effective python path so that can find plplot modules # depending on how python_location[12] are set. # Note, by careful choice of python_location[12] for the build-tree # case and the install tree case you can achieve # a clear separation between build and install tree case. import sys sys.path.insert (0, "@python_location1@") sys.path.insert (0, "@python_location2@") sys.path.insert (0, "@python_location3@") sys.path.insert (0, "@python_location4@") sys.path.insert (0, "@python_location5@") plplot-5.10.0+dfsg/examples/python/x08 755 1750 1750 216510233632313 164340ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw08 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x22 755 1750 1750 216510233632313 164300ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw22 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x21 755 1750 1750 217211466547637 164540ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004,2007 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw21 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw14.py 755 1750 1750 1650212143270264 172740ustar andrewandrew#!/usr/bin/env python # $Id: xw14.py 12340 2013-05-10 22:12:04Z andrewross $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Demo of multiple stream/window capability. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Simple line plot and multiple windows demo. from plplot_py_demos import * def main(): geometry_master = "500x410+100+200" geometry_slave = "500x410+650+200" driver = plgdev() (fam, num, bmax) = plgfam() print "Demo of multiple output streams via the %s driver." % driver print "Running with the second stream as slave to the first." print "" # Set up the first stream. plsetopt("geometry", geometry_master) plsdev(driver) plssub(2, 2) plinit() # Start next stream. plsstrm(1) # Turn off pause to make this a slave (must follow master) plsetopt("geometry", geometry_slave) plspause(0) plsdev(driver) plsfam(fam, num, bmax) plsetopt("fflen","2") plinit() # Set up the data & plot # Original case plsstrm(0) xscale = 6. yscale = 1. xoff = 0. yoff = 0. plot1(xscale, yscale, xoff, yoff) # Set up the data & plot xscale = 1. yscale = 1.e+6 plot1(xscale, yscale, xoff, yoff) # Set up the data & plot xscale = 1. yscale = 1.e-6 digmax = 2 plsyax(digmax, 0) plot1(xscale, yscale, xoff, yoff) # Set up the data & plot xscale = 1. yscale = 0.0014 yoff = 0.0185 digmax = 5 plsyax(digmax, 0) plot1(xscale, yscale, xoff, yoff) # To slave # The pleop() ensures the eop indicator gets lit. plsstrm(1) plot4() pleop() # Back to master plsstrm(0) plot2() plot3() # To slave plsstrm(1) plot5() pleop() # Back to master to wait for user to advance plsstrm(0) pleop() # =============================================================== def plot1(xscale, yscale, xoff, yoff): x = xoff + (xscale/60.)*(1+arange(60)) y = yoff + yscale*pow(x,2.) xmin = x[0] xmax = x[59] ymin = y[0] ymax = y[59] xs = x[3::10] ys = y[3::10] # Set up the viewport and window using pl.env. The range in X # is 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes # are scaled separately (just = 0), and we just draw a # labelled box (axis = 0). plcol0(1) plenv(xmin, xmax, ymin, ymax, 0, 0) plcol0(6) pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2") # Plot the data points plcol0(9) plpoin(xs, ys, 9) # Draw the line through the data plcol0(4) plline(x, y) plflush() # =============================================================== def plot2(): # Set up the viewport and window using pl.env. The range in X # is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes # are scaled separately (just = 0), and we draw a box with # axes (axis = 1). plcol0(1) plenv(-2.0, 10.0, -0.4, 1.2, 0, 1) plcol0(2) pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function") # Fill up the arrays x = (arange(100)-19)/6.0 if 0.0 in x: #replace 0.0 by small value that gives the same sinc(x) result. x[list(x).index(0.0)] = 1.e-30 y = sin(x)/x # Draw the line plcol0(3) plline(x, y) plflush() # =============================================================== def plot3(): # For the final graph we wish to override the default tick # intervals, so do not use pl.env pladv(0) # Use standard viewport, and define X range from 0 to 360 # degrees, Y range from -1.2 to 1.2. plvsta() plwind(0.0, 360.0, -1.2, 1.2) # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0(1) plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2) # Superimpose a dashed line grid, with 1.5 mm marks and spaces. # plstyl expects a pointer!! plstyl([1500], [1500]) plcol0(2) plbox("g", 30.0, 0, "g", 0.2, 0) plstyl([], []) plcol0(3) pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function") x = 3.6*arange(101) y = sin((pi/180.)*x) plcol0(4) plline(x, y) plflush() # =============================================================== def plot4(): dtr = pi / 180.0 x0 = cos(dtr*arange(361)) y0 = sin(dtr*arange(361)) # Set up viewport and window, but do not draw box plenv(-1.3, 1.3, -1.3, 1.3, 1, -2) i = 0.1*arange(1,11) #outerproduct(i,x0) and outerproduct(i,y0) is what we are #mocking up here since old Numeric version does not have outerproduct. i.shape = (-1,1) x=i*x0 y=i*y0 # Draw circles for polar grid for i in range(10): plline(x[i], y[i]) plcol0(2) for i in range(12): theta = 30.0 * i dx = cos(dtr * theta) dy = sin(dtr * theta) # Draw radial spokes for polar grid pljoin(0.0, 0.0, dx, dy) # Write labels for angle text = `int(theta)` #Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if dx >= -0.00001: plptex(dx, dy, dx, dy, -0.15, text) else: plptex(dx, dy, -dx, -dy, 1.15, text) # Draw the graph r = sin((dtr*5.)*arange(361)) x = x0*r y = y0*r plcol0(3) plline(x, y) plcol0(4) plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh") plflush() # =============================================================== XPTS = 35 YPTS = 46 XSPA = 2./(XPTS-1) YSPA = 2./(YPTS-1) tr = array((XSPA, 0.0, -1.0, 0.0, YSPA, -1.0)) def mypltr(x, y, data): result0 = data[0] * x + data[1] * y + data[2] result1 = data[3] * x + data[4] * y + data[5] return array((result0, result1)) def plot5(): mark = 1500 space = 1500 clevel = -1. + 0.2*arange(11) xx = (arange(XPTS) - XPTS/2) / float((XPTS/2)) yy = (arange(YPTS) - YPTS/2) / float((YPTS/2)) - 1. xx.shape = (-1,1) z = (xx*xx)-(yy*yy) # 2.*outerproduct(xx,yy) for new versions of Numeric which have outerproduct. w = 2.*xx*yy plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) plcol0(2) plcont(z, clevel, mypltr, tr) plstyl([mark], [space]) plcol0(3) plcont(w, clevel, mypltr, tr) plstyl([], []) plcol0(1) pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") plflush() # =============================================================== main() plend() plplot-5.10.0+dfsg/examples/python/xw10.py 644 1750 1750 252211543675237 172560ustar andrewandrew# $Id: xw10.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Window positioning demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Demonstrates absolute positioning of graphs on a page. def main(): pladv(0) plvpor(0.0, 1.0, 0.0, 1.0) plwind(0.0, 1.0, 0.0, 1.0) plbox("bc", 0.0, 0, "bc", 0.0, 0) plsvpa(50.0, 150.0, 50.0, 100.0) plwind(0.0, 1.0, 0.0, 1.0) plbox("bc", 0.0, 0, "bc", 0.0, 0) plptex(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)") # Restore defaults #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/x33 755 1750 1750 216411466546317 164520ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw33 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw05.py 644 1750 1750 244511543675237 172660ustar andrewandrew# $Id: xw05.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Histogram demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * NPTS = 2047 # main # # Draws a histogram from sample data. def main(): # Fill up data points delta = 2.0 * pi / NPTS data = sin(delta*arange(NPTS)) plcol0(1) plhist(data, -1.1, 1.1, 44, 0) plcol0(2) pllab("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator") # Restore defaults #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/x25 755 1750 1750 217311466547637 164610ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004, 2005 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw25 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x10.py 755 1750 1750 135411222464600 170540ustar andrewandrew#!/usr/bin/env python # # x10c.c # # Window positioning demo. import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # main # # Demonstrates absolute positioning of graphs on a page. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.pladv(0) w.plvpor(0.0, 1.0, 0.0, 1.0) w.plwind(0.0, 1.0, 0.0, 1.0) w.plbox("bc", 0.0, 0, "bc", 0.0, 0) w.plsvpa(50.0, 150.0, 50.0, 100.0) w.plwind(0.0, 1.0, 0.0, 1.0) w.plbox("bc", 0.0, 0, "bc", 0.0, 0) w.plptex(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)") w.pleop() ##main() plplot-5.10.0+dfsg/examples/python/xw25.py 644 1750 1750 575511543675237 172770ustar andrewandrew# $Id: xw25.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2007, 2008 Andrew Ross # Filling and clipping polygons. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Test program for filling polygons and proper clipping def main(): plssub(3,3) xextreme = [ [ -120.0, 120.0 ], [ -120.0, 120.0 ], [ -120.0, 120.0 ], [ -80.0, 80.0 ], [ -220.0, -120.0 ], [ -20.0, 20.0 ], [ -20.0, 20.0 ], [ -80.0, 80.0 ], [ 20.0, 120.0 ] ] yextreme = [ [ -120.0, 120.0 ], [ 20.0, 120.0 ], [ -20.0, 120.0 ], [ -20.0, 120.0 ], [ -120.0, 120.0 ], [ -120.0, 120.0 ], [ -20.0, 20.0 ], [ -80.0, 80.0 ], [ -120.0, 120.0 ] ] for k in range(2): for j in range(4): # Polygon 1: a diamond if (j == 0): x0 = [0, -100, 0, 100] y0 = [-100, 0, 100, 0] # Polygon 2: a diamond - reverse direction elif (j == 1): x0 = [100, 0, -100, 0] y0 = [0, 100, 0, -100] # Polygon 3: a square with punctures elif (j == 2): x0 = [-100, -100, 80, -100, -100, -80, 0, 80, 100, 100] y0 = [-100, -80, 0, 80, 100, 100, 80, 100, 100, -100] # Polygon 4: a square with punctures - reverse direction elif (j == 3): x0 = [100, 100, 80, 0, -80, -100, -100, 80, -100, -100] y0 = [-100, 100, 100, 80, 100, 100, 80, 0, -80, -100] for i in range(9): pladv(0) plvsta() plwind(xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1]) plcol0(2) plbox("bc", 1.0, 0, "bcnv", 10.0, 0) plcol0(1) plpsty(0) if (k == 0): plfill(x0,y0) else: plgradient(x0, y0, 45.) plcol0(2) pllsty(1) plline(x0,y0) main() plplot-5.10.0+dfsg/examples/python/test_fill.py 755 1750 1750 132511304074707 204350ustar andrewandrew#!/usr/bin/env python # Simple test of plfill for the case where the polygon is just outside the # window. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() plcol0(2) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) xmin,xmax,ymin,ymax = (0., 1., 0., 1.) plwind(xmin, xmax, ymin, ymax) # Just to show edges of viewport plbox("bc", 0., 0, "bc", 0., 0) plcol0(1) eps = 0.001 xmin,xmax,ymin,ymax = (xmin - eps, xmax + eps, ymin - eps, ymax + eps) x = (xmin, xmax, xmax, xmin) y = (ymin, ymin, ymax, ymax) plfill(x,y) plend() plplot-5.10.0+dfsg/examples/python/x14.py 755 1750 1750 446 7261473541 170350ustar andrewandrew#!/usr/bin/env python # # x14c.c # # Demo of multiple stream/window capability (requires Tk or Tcl-DP). # # Maurice LeBrun # IFS, University of Texas at Austin # This demo could not be converted to Python because it uses a part of # the plplot API that has not yet been implemented in Python. plplot-5.10.0+dfsg/examples/python/xw17.py 755 1750 1750 702211177710737 172660ustar andrewandrew#!/usr/bin/env python # $Id: xw17.py 9904 2009-05-05 01:09:51Z airwin $ # Copyright 2002 Gary Bishop # Copyright 2004 Alan W. Irwin # This file is part of PLplot. # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Plots a simple stripchart with four pens. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot_py_demos import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() from time import sleep def main(): nsteps = 1000 # If db is used the plot is much more smooth. However, because of the # async X behaviour, one does not have a real-time scripcharter. # plsetopt("db", "") # plsetopt("np", "") # User sets up plot completely except for window and data # Eventually settings in place when strip chart is created will be # remembered so that multiple strip charts can be used simultaneously. # # Specify some reasonable defaults for ymin and ymax # The plot will grow automatically if needed (but not shrink) ymin = -0.1 ymax = 0.1 # Specify initial tmin and tmax -- this determines length of window. # Also specify maximum jump in t # This can accomodate adaptive timesteps tmin = 0. tmax = 10. tjump = 0.3 # percentage of plot to jump # Axes options same as plbox. # Only automatic tick generation and label placement allowed # Eventually I ll make this fancier colbox = 1 collab = 3 styline = [2, 3, 4, 5] colline = [2, 3, 4, 5] legline = ["sum", "sin", "sin*noi", "sin+noi"] xlab = 0. ylab = 0.25 # legend position autoy = 1 # autoscale y acc = 1 # don t scrip, accumulate pladv(0) plvsta() # Register our error variables with PLplot # From here on, we're handling all errors here #plsError(&pl_errcode, errmsg) id1 = plstripc("bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo") # Let plplot handle errors from here on #plsError(NULL, NULL) autoy = 0 # autoscale y acc = 1 # accumulate # This is to represent a loop over time # Let's try a random walk process y1 = y2 = y3 = y4 = 0.0 dt = 0.1 for n in range(nsteps): sleep(0.01) t = n * dt noise = plrandd() - 0.5 y1 = y1 + noise y2 = sin(t*pi/18.) y3 = y2 * noise y4 = y2 + noise/3. # There is no need for all pens to have the same number of # points or beeing equally time spaced. if n%2: plstripa(id1, 0, t, y1) if n%3: plstripa(id1, 1, t, y2) if n%4: plstripa(id1, 2, t, y3) if n%5: plstripa(id1, 3, t, y4) # Destroy strip chart and it's memory plstripd(id1) # No defaults changed so nothing to restore main() plend() plplot-5.10.0+dfsg/examples/python/test_hebrew_diacritic.py 755 1750 1750 332211543675237 230070ustar andrewandrew#!/usr/bin/env python # -*- coding: utf-8; -*- # $Id: test_hebrew_diacritic.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2010 Alan W. Irwin # Displays Genesis Chapter 1 verse 3 "And God said: 'Let there be # light.' And there was light" in Hebrew as a test of diacritical # mark positioning. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() from plplot_py_demos import * def main(): pladv(0) plcol0(2) plvpor(0.02, 0.98, 0.02, 0.90) plwind(0.0, 1.0, 0.0, 1.0) plsfci(0) plschr(0., 2.5) # The text is Genesis, Chapter 1 verse 3 in Hebrew. plptex (0.5, 0.5, 1., 0., 0.5, "וַיֹּאמֶר אֱלֹהִים יְהִי אוֹר וַיְהִי אוֹר וַיַּרְא") plschr(0., 1.0) # Restore defaults plcol0(1) main() plend() plplot-5.10.0+dfsg/examples/python/x30 755 1750 1750 212011466547637 164450ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw30 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw01.py 644 1750 1750 1037612143270264 172700ustar andrewandrew# $Id: xw01.py 12340 2013-05-10 22:12:04Z andrewross $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Simple line plot and multiple windows demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Generates several simple line plots. Demonstrates: # - subwindow capability # - setting up the window, drawing plot, and labelling # - changing the color # - automatic axis rescaling to exponential notation # - placing the axes in the middle of the box # - gridded coordinate axes def main(): # For starting from scratch this call to pladv increments cursub, but # then the following plssub sets it to zero so the whole thing is # essentially a nop. However, for the case when other examples are run # first, this call to pladv is absolutely essential to finish the # preceding page. pladv(0) # Do plots on 4 subwindows of the first page plssub(2, 2) # Do a plot with one range of data plot1(6., 1., 0., 0.) # Do a plot with another range of data digmax = 5 plsyax(digmax, 0) plot1(1., 0.0014, 0., 0.0185) plot2() plot3() # Restore defaults # plcol0(1) plssub(1, 1) pleop() # =============================================================== def plot1(xscale, yscale, xoff, yoff): x = xoff + (xscale/60.)*(1+arange(60)) y = yoff + yscale*pow(x,2.) xmin = x[0] xmax = x[59] ymin = y[0] ymax = y[59] xs = x[3::10] ys = y[3::10] # Set up the viewport and window using pl.env. The range in X # is 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes # are scaled separately (just = 0), and we just draw a # labelled box (axis = 0). plcol0(1) plenv(xmin, xmax, ymin, ymax, 0, 0) plcol0(2) pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2") # Plot the data points plcol0(4) plpoin(xs, ys, 9) # Draw the line through the data plcol0(3) plline(x, y) # =============================================================== def plot2(): # Set up the viewport and window using pl.env. The range in X # is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes # are scaled separately (just = 0), and we draw a box with # axes (axis = 1). plcol0(1) plenv(-2.0, 10.0, -0.4, 1.2, 0, 1) plcol0(2) pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function") # Fill up the arrays x = (arange(100)-19)/6.0 if 0.0 in x: #replace 0.0 by small value that gives the same sinc(x) result. x[list(x).index(0.0)] = 1.e-30 y = sin(x)/x # Draw the line plcol0(3) plwidth(2) plline(x, y) plwidth(1) # =============================================================== def plot3(): # For the final graph we wish to override the default tick # intervals, so do not use pl.env pladv(0) # Use standard viewport, and define X range from 0 to 360 # degrees, Y range from -1.2 to 1.2. plvsta() plwind(0.0, 360.0, -1.2, 1.2) # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0(1) plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2) # Superimpose a dashed line grid, with 1.5 mm marks and spaces. # plstyl expects a pointer!! plstyl([1500], [1500]) plcol0(2) plbox("g", 30.0, 0, "g", 0.2, 0) plstyl([], []) plcol0(3) pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function") x = 3.6*arange(101) y = sin((pi/180.)*x) plcol0(4) plline(x, y) main() plplot-5.10.0+dfsg/examples/python/xw28.py 644 1750 1750 2375611543675237 173230ustar andrewandrew# $Id: xw28.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2007 Alan W. Irwin # plmtex3, plptex3 demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # Choose these values to correspond to tick marks. XPTS = 2 YPTS = 2 NREVOLUTION = 16 NROTATION = 8 NSHEAR = 8 xmin = 0. xmax = 1.0 xmid = 0.5*(xmax + xmin) xrange = xmax - xmin ymin = 0. ymax = 1.0 ymid = 0.5*(ymax + ymin) yrange = ymax - ymin zmin = 0. zmax = 1.0 zmid = 0.5*(zmax + zmin) zrange = zmax - zmin ysmin = ymin + 0.1 * yrange ysmax = ymax - 0.1 * yrange ysrange = ysmax - ysmin dysrot = ysrange / float( NROTATION - 1 ) dysshear = ysrange / float( NSHEAR - 1 ) zsmin = zmin + 0.1 * zrange zsmax = zmax - 0.1 * zrange zsrange = zsmax - zsmin dzsrot = zsrange / float( NROTATION - 1 ) dzsshear = zsrange / float( NSHEAR - 1 ) pstring = "The future of our civilization depends on software freedom." def main(): if 1: x = xmin + (xmax-xmin)*arange(XPTS)/float(XPTS-1) y = ymin + (ymax-ymin)*arange(YPTS)/float(YPTS-1) z = reshape(0.+zeros(XPTS*YPTS),[XPTS,YPTS]) if 1: # Page 1: Demonstrate inclination and shear capability pattern. pladv(0) plvpor(-0.15, 1.15, -0.05, 1.05) plwind(-1.2, 1.2, -0.8, 1.5) plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.) plcol0(2) plbox3( "b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) # z = zmin. plschr(0., 1.0) for i in range(NREVOLUTION): omega = 2.*pi*(float(i)/float(NREVOLUTION)) sin_omega = sin(omega) cos_omega = cos(omega) x_inclination = 0.5*xrange*cos_omega y_inclination = 0.5*yrange*sin_omega z_inclination = 0. x_shear = -0.5*xrange*sin_omega y_shear = 0.5*yrange*cos_omega z_shear = 0. plptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution") # x = xmax. plschr(0., 1.0) for i in range(NREVOLUTION): omega = 2.*pi*(float(i)/float(NREVOLUTION)) sin_omega = sin(omega) cos_omega = cos(omega) x_inclination = 0. y_inclination = -0.5*yrange*cos_omega z_inclination = 0.5*zrange*sin_omega x_shear = 0. y_shear = 0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega plptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution") # y = ymax. plschr(0., 1.0) for i in range(NREVOLUTION): omega = 2.*pi*(float(i)/float(NREVOLUTION)) sin_omega = sin(omega) cos_omega = cos(omega) x_inclination = 0.5*xrange*cos_omega y_inclination = 0. z_inclination = 0.5*zrange*sin_omega x_shear = -0.5*xrange*sin_omega y_shear = 0. z_shear = 0.5*zrange*cos_omega plptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution") # Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY) # Page 2: Demonstrate rotation of string around its axis. pladv(0) plvpor(-0.15, 1.15, -0.05, 1.05) plwind(-1.2, 1.2, -0.8, 1.5) plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.) plcol0(2) plbox3( "b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) # y = ymax. plschr(0., 1.0) x_inclination = 1. y_inclination = 0. z_inclination = 0. x_shear = 0. for i in range(NROTATION): omega = 2.*pi*(float(i)/float(NROTATION)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = 0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsrot * float(i) plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u") # x = xmax. plschr(0., 1.0) x_inclination = 0. y_inclination = -1. z_inclination = 0. y_shear = 0. for i in range(NROTATION): omega = 2.*pi*(float(i)/float(NROTATION)) sin_omega = sin(omega) cos_omega = cos(omega) x_shear = 0.5*xrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsrot * float(i) plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u") # z = zmin. plschr(0., 1.0) x_inclination = 1. y_inclination = 0. z_inclination = 0. x_shear = 0. for i in range(NROTATION): omega = 2.*pi*(float(i)/float(NROTATION)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = 0.5*yrange*cos_omega z_shear = 0.5*zrange*sin_omega ys = ysmax - dysrot * float(i) plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u") # Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY) # Page 3: Demonstrate shear of string along its axis. # Work around xcairo and pngcairo (but not pscairo) problems for # shear vector too close to axis of string. (N.B. no workaround # would be domega = 0.) domega = 0.05 pladv(0) plvpor(-0.15, 1.15, -0.05, 1.05) plwind(-1.2, 1.2, -0.8, 1.5) plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.) plcol0(2) plbox3( "b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) # y = ymax. plschr(0., 1.0) x_inclination = 1. y_inclination = 0. z_inclination = 0. y_shear = 0. for i in range(NSHEAR): omega = domega + 2.*pi*(float(i)/float(NSHEAR)) sin_omega = sin(omega) cos_omega = cos(omega) x_shear = 0.5*xrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsshear * float(i) plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u") # x = xmax. plschr(0., 1.0) x_inclination = 0. y_inclination = -1. z_inclination = 0. x_shear = 0. for i in range(NSHEAR): omega = domega + 2.*pi*(float(i)/float(NSHEAR)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = -0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsshear * float(i) plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u") # z = zmin. plschr(0., 1.0) x_inclination = 1. y_inclination = 0. z_inclination = 0. z_shear = 0. for i in range(NSHEAR): omega = domega + 2.*pi*(float(i)/float(NSHEAR)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = 0.5*yrange*cos_omega x_shear = 0.5*xrange*sin_omega ys = ysmax - dysshear * float(i) plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u") # Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY) # Page 4: Demonstrate drawing a string on a 3D path. pladv(0) plvpor(-0.15, 1.15, -0.05, 1.05) plwind(-1.2, 1.2, -0.8, 1.5) plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30.) plcol0(2) plbox3( "b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) plschr(0., 1.2) # domega controls the spacing between the various characters of the # string and also the maximum value of omega for the given number # of characters in *pstring. domega = 2.*pi/len(pstring) omega = 0. # 3D function is a helix of the given radius and pitch radius = 0.5 pitch = 1./(2.*pi) for character in pstring: sin_omega = sin(omega) cos_omega = cos(omega) xpos = xmid + radius*sin_omega ypos = ymid - radius*cos_omega zpos = zmin + pitch*omega # In general, the inclination is proportional to the derivative of # the position wrt theta. x_inclination = radius*cos_omega y_inclination = radius*sin_omega z_inclination = pitch # The shear vector should be perpendicular to the 3D line with Z # component maximized, but for low pitch a good approximation is # a constant vector that is parallel to the Z axis. x_shear = 0. y_shear = 0. z_shear = 1. plptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, character) omega += domega # Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY) # Page 5: Demonstrate plmtex3 axis labelling capability. pladv(0) plvpor(-0.15, 1.15, -0.05, 1.05) plwind(-1.2, 1.2, -0.8, 1.5) plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45.) plcol0(2) plbox3( "b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0) plschr(0., 1.0) plmtex3("xp", 3.0, 0.5, 0.5, "Arbitrarily displaced") plmtex3("xp", 4.5, 0.5, 0.5, "primary X-axis label") plmtex3("xs", -2.5, 0.5, 0.5, "Arbitrarily displaced") plmtex3("xs", -1.0, 0.5, 0.5, "secondary X-axis label") plmtex3("yp", 3.0, 0.5, 0.5, "Arbitrarily displaced") plmtex3("yp", 4.5, 0.5, 0.5, "primary Y-axis label") plmtex3("ys", -2.5, 0.5, 0.5, "Arbitrarily displaced") plmtex3("ys", -1.0, 0.5, 0.5, "secondary Y-axis label") plmtex3("zp", 4.5, 0.5, 0.5, "Arbitrarily displaced") plmtex3("zp", 3.0, 0.5, 0.5, "primary Z-axis label") plmtex3("zs", -2.5, 0.5, 0.5, "Arbitrarily displaced") plmtex3("zs", -1.0, 0.5, 0.5, "secondary Z-axis label") # Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY) main() plplot-5.10.0+dfsg/examples/python/x05.py 755 1750 1750 147611541217123 170650ustar andrewandrew#!/usr/bin/env python # # x05c.c # # Histogram demo. from numpy import * import math #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) NPTS = 2047 # main # # Draws a histogram from sample data. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() # Fill up data points delta = 2.0 * math.pi / NPTS data = zeros(NPTS,'d') ## data = [] for i in range(NPTS): data[i] = math.sin(i * delta) w.plcol0(1) w.plhist(data, -1.1, 1.1, 44, 0) w.plcol0(2) w.pllab("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator") w.pleop() ## pl.end() ## ##main() plplot-5.10.0+dfsg/examples/python/CMakeLists.txt 644 1750 1750 1771112264404031 206520ustar andrewandrew# examples/python/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006, 2007, 2008, 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. # N.B. examples 14, 17, and 31 handled independently while 32 has # not yet been implemented. set(python_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "15" "16" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "33" ) set(python_SCRIPTS) set(python_DATA) foreach(STRING_INDEX ${python_STRING_INDICES}) set(python_SCRIPTS ${python_SCRIPTS} x${STRING_INDEX}) set(python_DATA ${python_DATA} xw${STRING_INDEX}.py) endforeach(STRING_INDEX ${python_STRING_INDICES}) # This list contains standalone scripts which are executable and which # should be installed in the examples/python directory. set( python_SCRIPTS ${python_SCRIPTS} pythondemos.py x14 x17 x31 xw14.py xw17.py xw31.py plplot_logo.py test_circle.py test_axis_precision.py test_symbol_clip.py testh.py test_superscript_subscript.py test_plplot_encodings.py test_fill.py test_gradient.py test_type1.py test_hebrew_diacritic.py test_style.py test_linebreak.py ) if(ENABLE_tkX) set(python_SCRIPTS ${python_SCRIPTS} pytkdemo x01.py x02.py x03.py x04.py x05.py x06.py x07.py x08.py x09.py x10.py x11.py x12.py x13.py x14.py x15.py x16.py x17.py x18.py x19.py ) endif(ENABLE_tkX) if(ENABLE_pyqt4) set( python_SCRIPTS ${python_SCRIPTS} pyqt4_example.py ) endif(ENABLE_pyqt4) if(ENABLE_pygcw) set( python_SCRIPTS ${python_SCRIPTS} plplotcanvas_demo.py plplotcanvas_animation.py ) endif(ENABLE_pygcw) # This list contains python modules which are not executable on their own and # data files that should be installed in the examples/python directory. set( python_DATA ${python_DATA} plplot_py_demos.py README.pythondemos README.rendering_tests README.logo ) if(ENABLE_pygcw) set( python_DATA ${python_DATA} README.plplotcanvas ) endif(ENABLE_pygcw) if(CORE_BUILD) if(BUILD_TEST) # equivalent to install commands but at "make" time rather than # "make install" time, to the build tree if different than the source # tree, and skipping plplot_python_start.py since it is already # in the build tree. set(command_depends) foreach(file ${python_SCRIPTS} ${python_DATA}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) list(APPEND command_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${file}) endforeach(file ${python_SCRIPTS} ${python_DATA}) add_custom_target(python_examples ALL DEPENDS ${command_DEPENDS}) set_property(GLOBAL PROPERTY TARGETS_examples_python python_examples _plplotcmodule plplot_widgetmodule) set_property(GLOBAL PROPERTY FILES_examples_python ${command_DEPENDS}) if(ENABLE_pygcw) add_custom_target(copy_plplotcanvas DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_demo.py ${CMAKE_CURRENT_BINARY_DIR}/plplotcanvas_animation.py ) endif(ENABLE_pygcw) endif(BUILD_TEST) set(PLSMEM_DEVICE_LIST) foreach(memdriver mem memcairo memqt) if(PLD_${memdriver}) list(APPEND PLSMEM_DEVICE_LIST ${memdriver}) endif(PLD_${memdriver}) endforeach(memdriver mem memcairo memqt) if(PLSMEM_DEVICE_LIST) string(REGEX REPLACE ";" "\", \"" PLSMEM_DEVICE_LIST "${PLSMEM_DEVICE_LIST}") set(PLSMEM_DEVICE_LIST "[\"${PLSMEM_DEVICE_LIST}\"]") else(PLSMEM_DEVICE_LIST) set(PLSMEM_DEVICE_LIST "[]") endif(PLSMEM_DEVICE_LIST) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/test_plsmem.py.in ${CMAKE_CURRENT_BINARY_DIR}/test_plsmem.py ) set(PERM_SCRIPTS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) install(FILES ${python_SCRIPTS} ${CMAKE_CURRENT_BINARY_DIR}/test_plsmem.py DESTINATION ${DATA_DIR}/examples/python PERMISSIONS ${PERM_SCRIPTS} ) set(PERM_DATA OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) install(FILES ${python_DATA} DESTINATION ${DATA_DIR}/examples/python PERMISSIONS ${PERM_DATA} ) set(python_location1 ${CMAKE_SOURCE_DIR}/bindings/python) set(python_location2 ${CMAKE_BINARY_DIR}/bindings/python) set(python_location3 ${CMAKE_BINARY_DIR}/examples/python) if(USE_DLL_SUBDIRECTORY) set(python_location4 ${CMAKE_BINARY_DIR}/dll) else(USE_DLL_SUBDIRECTORY) set(python_location4) endif(USE_DLL_SUBDIRECTORY) set(python_location5 ${CMAKE_BINARY_DIR}/bindings/qt_gui/pyqt4) set(python_location6 ${CMAKE_BINARY_DIR}/bindings/gnome2/python) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plplot_python_start.py.in ${CMAKE_CURRENT_BINARY_DIR}/plplot_python_start.py @ONLY ) set(python_location1 ${PYTHON_INSTDIR}) set(python_location2) set(python_location3) set(python_location4) set(python_location5) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plplot_python_start.py.in ${CMAKE_CURRENT_BINARY_DIR}/plplot_python_start.py_install @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot_python_start.py_install DESTINATION ${DATA_DIR}/examples/python PERMISSIONS ${PERM_DATA} RENAME plplot_python_start.py ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/python ) else(CORE_BUILD) set_property(GLOBAL PROPERTY FILES_examples_python) foreach(file ${python_SCRIPTS} ${python_DATA} plplot_python_start.py plplot_py_demos.py test_plsmem.py) set_property(GLOBAL APPEND PROPERTY FILES_examples_python ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) endforeach(file ${python_SCRIPTS} ${python_DATA} plplot_python_start.py plplot_py_demos.py) endif(CORE_BUILD) # Custom target to build logo (Unix only with ImageMagick installed). if(BUILD_TEST) if(CORE_BUILD) set(working_directory ${CMAKE_CURRENT_BINARY_DIR}) else(CORE_BUILD) set(working_directory ${CMAKE_CURRENT_SOURCE_DIR}) endif(CORE_BUILD) set(command_file ${working_directory}/plplot_logo.py) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.svg ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.jpg COMMAND ${command_file} -dev svg -geometry 760x120 -o ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.svg COMMAND convert ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.svg ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.jpg DEPENDS ${command_file} WORKING_DIRECTORY ${working_directory} ) add_custom_target(plplot_logo DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.svg ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.jpg ) if(CORE_BUILD) add_dependencies(plplot_logo python_examples _plplotcmodule) else(CORE_BUILD) add_dependencies(plplot_logo _plplotcmodule) endif(CORE_BUILD) endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/python/xw02.py 644 1750 1750 550712102122103 172300ustar andrewandrew# $Id: xw02.py 12288 2013-01-30 04:40:35Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Multiple window and color map 0 demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # Demonstrates multiple windows and default color map 0 palette. # Draws a set of numbered boxes with colors according to cmap0 entry def draw_windows(nw, cmap0_offset): plschr(0.0, 3.5) plfont(4) for i in range(nw): plcol0(i+cmap0_offset) pladv(0) vmin = 0.1 vmax = 0.9 for j in range(3): plwidth(j + 1) plvpor(vmin, vmax, vmin, vmax) plwind(0.0, 1.0, 0.0, 1.0) plbox("bc", 0.0, 0, "bc", 0.0, 0) vmin = vmin + 0.1 vmax = vmax - 0.1 plwidth(1) plptex(0.5, 0.5, 1.0, 0.0, 0.5, `i`) # Demonstrate multiple windows and default color map 0 palette. def demo1(): plbop() # Divide screen into 16 regions plssub(4, 4) draw_windows(16,0) pleop() def demo2(): lmin = 0.15 lmax = 0.85 plbop() # Divide screen into 100 regions plssub(10,10) r = zeros(116,"int") g = zeros(116,"int") b = zeros(116,"int") for i in range(100): h = (360./10.) * (i%10) l = lmin + (lmax-lmin)*(i/10)/9 s = 1.0 rgb = plhlsrgb(h, l, s) r[i+16] = rgb[0]*255.001 g[i+16] = rgb[1]*255.001 b[i+16] = rgb[2]*255.001 # Load default cmap0 colors into out custom set for i in range(16): rgb = plgcol0(i) r[i] = rgb[0] g[i] = rgb[1] b[i] = rgb[2] # Now set cmap0 all at once (faster, since fewer driver calls) plscmap0(r,g,b) draw_windows(100,16) pleop() def main(): # For starting from scratch this call to pladv increments cursub, but # then the following plssub sets it to zero so the whole thing is # essentially a nop. However, for the case when other examples are run # first, this call to pladv is absolutely essential to finish the # preceding page. pladv(0) # Run demos demo1() demo2() # Restore defaults plssub(1, 1) plfont(1) # plcol0(1) pleop() main() plplot-5.10.0+dfsg/examples/python/tutor.py 755 1750 1750 12246 7774004106 176330ustar andrewandrew#!/usr/bin/env python # # tutor.c # Tony Richardson # # This program is intended to be used as a template for creating simple # two-dimensional plotting programs which use the PLplot plotting # library. The program was written with an emphasis on trying to clearly # illustrate how to use the PLplot library functions. # # This program reads data for M lines with N points each from an input # data file and plots them on the same graph using different symbols. It # draws axes with labels and places a title at the top of the figure. A # legend is drawn to the right of the figure. The input data file must # have the following format: # # x[1] x[2] x[3] . . . x[N] # y1[1] y1[2] y1[3] . . . y1[N] # y2[1] y2[2] y2[3] . . . y2[N] # . . . . . . . # . . . . . . . # . . . . . . . # yM[1] yM[2] yM[3] . . . yM[N] # # For example: # # 0 1 2 3 4 # 1.2 1.5 1.6 1.9 2.0 # 1.1 1.3 1.8 2.1 2.3 # 1.3 1.6 1.8 2.0 2.2 # # (The first line contains the x-coordinates. The succeeding M lines # contain the y-coordinates of each of the M lines.) import pl import string import sys # You can select a different set of symbols to use when plotting the # lines by changing the value of OFFSET. OFFSET = 2 def main(): # Here are the character strings that appear in the plot legend. legend = ["Aardvarks", "Gnus", "Llamas"] # ============== Read in data from input file. ============= # Parse and process command line arguments pl.ParseOpts(sys.argv, pl.PARSE_FULL) # First prompt the user for the input data file name filename = raw_input("Enter input data file name.\n") # and open the file. try: datafile = open(filename, "r") except: error("Error opening input file.") # Read in all the data. try: lines = datafile.readlines() datafile.close() x = [] data = string.split(lines[0]) for num in data: x.append(string.atof(num)) y = [] del lines[0] for line in lines: yy = [] data = string.split(line) for num in data: yy.append(string.atof(num)) y.append(yy) except: error("Error while reading data file.") # ============== Graph the data. ============= # Set graph to portrait orientation. (Default is landscape.) # (Portrait is usually desired for inclusion in TeX documents.) pl.sori(-1) # Initialize plplot pl.init() # We must call pladv() to advance to the first (and only) subpage. # You might want to use plenv() instead of the pladv(), plvpor(), # plwind() sequence. pl.adv(0) # Set up the viewport. This is the window into which the data is # plotted. The size of the window can be set with a call to # plvpor(), which sets the size in terms of normalized subpage # coordinates. I want to plot the lines on the upper half of the # page and I want to leave room to the right of the figure for # labelling the lines. We must also leave room for the title and # labels with plvpor(). Normally a call to plvsta() can be used # instead. pl.vpor(0.15, 0.70, 0.5, 0.9) # We now need to define the size of the window in user coordinates. # To do this, we first need to determine the range of the data # values. xmin, xmax = min(x), max(x) ymin = ymax = y[0][0] for yy in y: yymin, yymax = min(yy), max(yy) if yymin < ymin: ymin = yymin if yymax > ymax: ymax = yymax # Now set the size of the window. Leave a small border around the # data. xdiff = (xmax - xmin) / 20. ydiff = (ymax - ymin) / 20. pl.wind(xmin - xdiff, xmax + xdiff, ymin - ydiff, ymax + ydiff) # Call plbox() to draw the axes (see the PLPLOT manual for # information about the option strings.) pl.box("bcnst", 0.0, 0, "bcnstv", 0.0, 0) # Label the axes and title the graph. The string "#gm" plots the # Greek letter mu, all the Greek letters are available, see the # PLplot manual. pl.lab("Time (weeks)", "Height (#gmparsecs)", "Specimen Growth Rate") # Plot the data. plpoin() draws a symbol at each point. plline() # connects all the points. i = 0 for yy in y: pl.poin(x, yy, i + OFFSET) pl.line(x, yy) i = i + 1 # Draw legend to the right of the chart. Things get a little messy # here. You may want to remove this section if you don't want a # legend drawn. First find length of longest string. leglen = 0 for leg in legend: j = len(leg) if j > leglen: leglen = j # Now build the string. The string consists of an element from the # legend string array, padded with spaces, followed by one of the # symbols used in plpoin above. M = len(y) i = 0 for leg in legend: if i >= M: break text = leg j = len(text) if j < leglen: # pad string with spaces k = leglen - j text = text + ' ' * k # pad an extra space text = text + ' ' # insert the ASCII value of the symbol plotted with plpoin() text = text + chr(i + OFFSET) # plot the string pl.mtex("rv", 1., 1. - float(i + 1) / (M + 1), 0., text) i = i + 1 # Don't forget to call PLEND to finish off! pl.end() def error(str): sys.stderr.write(str) sys.stderr.write('\n') sys.exit(1) main() plplot-5.10.0+dfsg/examples/python/x07.py 755 1750 1750 241711541217123 170630ustar andrewandrew#!/usr/bin/env python # # x07c.c # # Font demo. #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # main # # Displays the entire "plsym" symbol (font) set. def main(w): base = [0, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900] ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.plfontld(1) for l in range(17): w.pladv(0) # Set up viewport and window w.plcol0(2) w.plvpor(0.15, 0.95, 0.1, 0.9) w.plwind(0.0, 1.0, 0.0, 1.0) # Draw the grid using plbox w.plbox("bcg", 0.1, 0, "bcg", 0.1, 0) # Write the digits below the frame w.plcol0(15) for i in range(10): w.plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, `i`) k = 0 for i in range(10): # Write the digits to the left of the frame text = `base[l] + 10 * i` w.plmtex("lv", 1.0, (0.95 - 0.1 * i), 1.0, text) for j in range(10): x = [ 0.1 * j + 0.05 ] y = [ 0.95 - 0.1 * i ] # Display the symbols w.plsym(x, y, base[l] + k) k = k + 1 w.plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols") w.pleop() ## pl.end() ## ##main() plplot-5.10.0+dfsg/examples/python/x02 755 1750 1750 216510233632313 164260ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw02 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/plplotcanvas_demo.py 755 1750 1750 513211276127065 221660ustar andrewandrew#!/usr/bin/env python """ demo.py - Demonstrates the simplest use of the plplot canvas widget with gtk. Copyright (C) 2004, 2005 Thomas J. Duck All rights reserved. Thomas J. Duck Department of Physics and Atmospheric Science, Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 $Author: airwin $ $Revision: 10568 $ $Date: 2009-11-09 16:05:09 -0800 (Mon, 09 Nov 2009) $ $Name$ NOTICE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """ import plplot_python_start import plplot_py_demos import plplotcanvas import gtk import sys # The width and height of the plplot canvas widget WIDTH = 1000 # 500 HEIGHT = 600 # 300 # Delete event callback def delete_event(widget, event, data=None): return False # Destroy event calback def destroy(widget, data=None): gtk.main_quit() # Parse the options plplot_py_demos.plparseopts(sys.argv,plplot_py_demos.PL_PARSE_FULL); # The data to plot x = plplot_py_demos.arange(11) y = x**2/10. # Create the canvas and set its size; during the creation process, # the gcw driver is loaded into plplot, and plinit() is invoked. canvas=plplotcanvas.Canvas() canvas.set_size(WIDTH,HEIGHT) # Create a new window and stuff the canvas into it window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_border_width(10) window.add(canvas) # Connect the signal handlers to the window decorations window.connect("delete_event",delete_event) window.connect("destroy",destroy) # Display everything window.show_all() # Draw on the canvas with Plplot canvas.adv(0) # Advance the page canvas.col0(15) # Set color to black canvas.wid(2) # Set the pen width canvas.vsta() # Set the viewport canvas.wind(0.,10.,0.,10.); # Set the window canvas.box("bcnst",0.,0,"bcnstv",0.,0); # Set the box canvas.lab("x-axis","y-axis","A Simple Plot") # Draw some labels # Draw the line canvas.col0(1) # Set the pen color canvas.line(x,y) # Advancing the page finalizes this plot canvas.adv(0) # Start the gtk main loop gtk.main() plplot-5.10.0+dfsg/examples/python/x03.py 755 1750 1750 312611541217123 170550ustar andrewandrew#!/usr/bin/env python # # x03c.c # # Polar plot demo. from numpy import * import math #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # main # # Generates polar plot, with 1-1 scaling. def main(w): dtr = math.pi / 180.0 x0 = zeros(361,'d'); y0 = zeros(361,'d') for i in range(361): x0[i] = math.cos(dtr * i) y0[i] = math.sin(dtr * i) ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.plcol0(1) # Set up viewport and window, but do not draw box w.plenv(-1.3, 1.3, -1.3, 1.3, 1, -2) x = zeros(11*361,'d'); y = zeros(11*361,'d') k=0 for i in range(11): for j in range(361): x[k] = 0.1 * i * x0[j] y[k] = 0.1 * i * y0[j] k = k + 1 # Draw circles for polar grid w.plline(x, y) w.plcol0(2) for i in range(12): theta = 30.0 * i dx = math.cos(dtr * theta) dy = math.sin(dtr * theta) # Draw radial spokes for polar grid w.pljoin(0.0, 0.0, dx, dy) # Write labels for angle text = `int(theta)` if dx >= 0: w.plptex(dx, dy, dx, dy, -0.15, text) else: w.plptex(dx, dy, -dx, -dy, 1.15, text) # Draw the graph x = zeros(361,'d'); y = zeros(361,'d') for i in range(361): r = math.sin(dtr * (5 * i)) x[i] = x0[i] * r y[i] = y0[i] * r w.plcol0(3) w.plline(x, y) w.plcol0(4) w.plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh") # Close the plot at end w.pleop() ## ## pl.end() ## ##main() plplot-5.10.0+dfsg/examples/python/xw27.py 644 1750 1750 1041611616726012 172740ustar andrewandrew# $Id: xw27.py 11859 2011-08-05 08:38:34Z andrewross $ # # Copyright (C) 2007 Arjen Markus # Copyright (C) 2008 Andrew Ross # Drawing "spirograph" curves - epitrochoids, cycolids, roulettes # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * import types # main # # Generates two kinds of plots: # - construction of a cycloid (animated) # - series of epitrochoids and hypotrochoids def main(): # R, r, p, N # R and r should be integers to give correct termination of the # angle loop using gcd. # N.B. N is just a place holder since it is no longer used # (because we now have proper termination of the angle loop). params = [ [21.0, 7.0, 7.0, 3.0], # Deltoid [21.0, 7.0, 10.0, 3.0], [21.0, -7.0, 10.0, 3.0], [20.0, 3.0, 7.0, 20.0], [20.0, 3.0, 10.0, 20.0], [20.0, -3.0, 10.0, 20.0], [20.0, 13.0, 7.0, 20.0], [20.0, 13.0, 20.0, 20.0], [20.0,-13.0, 20.0, 20.0] ] # Illustrate the construction of a cycloid # TODO #cycloid() # Loop over the various curves # First an overview, then all curves one by one plssub(3, 3) # Three by three window for i in range(9) : pladv(0) plvpor( 0.0, 1.0, 0.0, 1.0 ) spiro( params[i], 0 ) pladv(0) plssub(1, 1) # One window per curve for i in range(9): pladv(0) plvpor( 0.0, 1.0, 0.0, 1.0 ) spiro( params[i], 0 ) # Fill the curves. pladv(0) plssub(1, 1) # One window per curve for i in range(9): pladv(0) plvpor( 0.0, 1.0, 0.0, 1.0 ) spiro( params[i], 1 ) arcs() def gcd(a, b): if not (type(a) is types.IntType and type(b) is types.IntType): raise RuntimeError, "gcd arguments must be integers" a = abs(a); b = abs(b); while(b != 0): t = b b = a % b a = t return a def spiro(params, fill): # Fill the coordinates NPNT = 2000 # Proper termination of the angle loop very near the beginning # point, see # http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = int(abs(params[1])/gcd(int(params[0]), int(params[1]))) steps = int(NPNT/windings) dphi = 2.0*pi/float(steps) phi = arange(windings*steps+1)*dphi phiw = (params[0]-params[1])/params[1]*phi xcoord = (params[0]-params[1])*cos(phi) + params[2]*cos(phiw) ycoord = (params[0]-params[1])*sin(phi) - params[2]*sin(phiw) xmin = min(xcoord) xmax = max(xcoord) ymin = min(ycoord) ymax = max(ycoord) xrange_adjust = 0.15 * (xmax - xmin) xmin -= xrange_adjust xmax += xrange_adjust yrange_adjust = 0.15 * (ymax - ymin) ymin -= yrange_adjust ymax += yrange_adjust plwind( xmin, xmax, ymin, ymax ) plcol0(1) if fill: plfill( xcoord, ycoord ) else: plline( xcoord, ycoord ) def arcs() : NSEG = 8 theta = 0.0 dtheta = 360.0 / NSEG plenv( -10.0, 10.0, -10.0, 10.0, 1, 0 ) # Plot segments of circle in different colors for i in range (NSEG) : plcol0( i%2 + 1 ) plarc(0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, 0) theta = theta + dtheta # Draw several filled ellipses inside the circle at different # angles. a = 3.0 b = a * tan( (dtheta/180.0*pi)/2.0 ) theta = dtheta/2.0 for i in range(NSEG): plcol0( 2 - i%2 ) plarc( a*cos(theta/180.0*pi), a*sin(theta/180.0*pi), a, b, 0.0, 360.0, theta, 1) theta = theta + dtheta main() plplot-5.10.0+dfsg/examples/python/xw11.py 644 1750 1750 1110111543675237 172700ustar andrewandrew# $Id: xw11.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Mesh plot demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * XPTS = 35 # Data points in x YPTS = 46 # Data points in y opt = [3, 3] alt = [33.0, 17.0] az = [24.0, 115.0] title = ["#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3"] # Routine for restoring colour map1 to default. # See static void plcmap1_def(void) in plctrl.c for reference. def restore_cmap1(): # For center control points, pick black or white, whichever is closer to bg # Be careful to pick just short of top or bottom else hue info is lost vertex = sum(array(plgcolbg()))/(3.*255.) if vertex < 0.5: vertex = 0.01 midpt = 0.10 else: vertex = 0.99 midpt = 0.90 # Independent variable of control points. i = array((0., 0.44, 0.50, 0.50, 0.56, 1.)) # Hue for control points. Blue-violet to red h = array((260., 260., 260., 0., 0., 0.)) # Lightness ranging from medium to vertex to medium l = array((0.5, midpt, vertex, vertex, midpt, 0.5)) # Saturation is complete for default s = array((1., 1., 1., 1., 1., 1.)) # Default number of cmap1 colours plscmap1n(128) # Interpolate between control points to set up default cmap1. plscmap1l(0, i, h, l, s) # Routine for defining a specific color map 1 in HLS space. # if gray is true, use basic grayscale variation from half-dark to light. # otherwise use false color variation from blue (240 deg) to red (360 deg). def cmap1_init(gray): # Independent variable of control points. i = array((0., 1.)) if gray: # Hue for control points. Doesn't matter since saturation is zero. h = array((0., 0.)) # Lightness ranging from half-dark (for interest) to light. l = array((0.5, 1.)) # Gray scale has zero saturation s = array((0., 0.)) else: # Hue ranges from blue (240 deg) to red (0 or 360 deg) h = array((240., 0.)) # Lightness and saturation are constant (values taken from C example). l = array((0.6, 0.6)) s = array((0.8, 0.8)) # number of cmap1 colours is 256 in this case. plscmap1n(256) # Interpolate between control points to set up cmap1. plscmap1l(0, i, h, l, s) # main # # Does a series of mesh plots for a given data set, with different # viewing options in each plot. def main(): x = 3.*(arange(XPTS) - (XPTS / 2)) / float(XPTS / 2) y = 3.*(arange(YPTS) - (YPTS / 2)) / float(YPTS / 2) x.shape = (-1,1) z = 3. * (1.-x)*(1.-x) * exp(-(x*x) - (y+1.)*(y+1.)) - \ 10. * (x/5. - pow(x,3.) - pow(y,5.)) * exp(-x*x-y*y) - \ 1./3. * exp(-(x+1)*(x+1) - (y*y)) # if 0: #Jungfraujoch/Interlaken # Not sure this is correct coding for truncating at -1, but # not activated anyway so ignore this question for now. # z = max(z,-1) x.shape = (-1,) zmin = min(z.flat) zmax = max(z.flat) nlevel = 10 step = (zmax-zmin)/(nlevel+1) clevel = zmin + step + arange(nlevel)*step cmap1_init(0) for k in range(2): for i in range(4): pladv(0) plcol0(1) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -1.0, 1.5) plw3d(1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4) plcol0(2) #wireframe plot if i==0: plmesh(x, y, z, opt[k]) # magnitude colored wireframe plot elif i==1: plmesh(x, y, z, opt[k] | MAG_COLOR) # magnitude colored wireframe plot with sides elif i==2: plot3d(x, y, z, opt[k] | MAG_COLOR, 1) # magnitude colored wireframe plot with base contour elif i==3: plmeshc(x, y, z, opt[k] | MAG_COLOR | BASE_CONT, clevel) plcol0(3) plmtex("t", 1.0, 0.5, 0.5, title[k]) # Restore defaults #plcol0(1) restore_cmap1() main() plplot-5.10.0+dfsg/examples/python/x26 755 1750 1750 220110452003015 164150ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004, 2005, 2006 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw26 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x15.py 755 1750 1750 402 7261473541 170260ustar andrewandrew#!/usr/bin/env python # # x15c.c # # Shade plot demo. # # Maurice LeBrun # IFS, University of Texas at Austin # 31 Aug 1993 # This demo could not be converted to Python because it uses a part of # the plplot API that has not yet been implemented in Python. plplot-5.10.0+dfsg/examples/python/test_gradient.py 755 1750 1750 132311304423773 213030ustar andrewandrew#!/usr/bin/env python # Simple test of plgradient for a complicated polygon. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * from math import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) xmin,xmax,ymin,ymax = (0., 1., 0., 1.) x = (0., 0.2, 1., 0.3) y = (0., 1., 0.2, 0.6) #x = (0., 0., 1., 1.) #y = (0., 1., 1., 0.) # Initialize plplot plinit() for i in range(1): plcol0(2) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(xmin, xmax, ymin, ymax) # Just to show edges of viewport plbox("bc", 0., 0, "bc", 0., 0) plcol0(1) plgradient(x,y, 45. + i) plend() plplot-5.10.0+dfsg/examples/python/x19.py 755 1750 1750 377 7261473541 170450ustar andrewandrew#!/usr/bin/env python # # x19c.c # # Illustrates backdrop plotting of world, US maps. # Contributed by Wesley Ebisuzaki. # This demo could not be converted to Python because it uses a part of # the plplot API that has not yet been implemented in Python. plplot-5.10.0+dfsg/examples/python/xw21.py 644 1750 1750 1144612140522542 172650ustar andrewandrew# $Id: xw21.py 12323 2013-05-02 17:41:54Z airwin $ # Copyright (C) 2007, 2008 Andrew Ross # Grid data demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * import time pts = 500 xp = 25 yp = 20 nl = 16 knn_order = 20 threshold = 1.001 wmin = -1e3 randn = 0 rosen = 0 def cmap1_init(): i = [0, 1] h = [240, 0] l = [0.6, 0.6] s = [0.8, 0.8] plscmap1n(256) plscmap1l(0, i, h, l, s) # main # # def main(): title = ["Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted"] opt = [0., 0., 0., 0., 0., 0.] xm = -0.2 ym = -0.2 xM = 0.6 yM = 0.6 opt[2] = wmin opt[3] = knn_order opt[4] = threshold cmap1_init() plseed(5489) # Create the sampled data # For consistency across languages use plrandd to create the # pseudo-random data that are required. xt = zeros(pts) yt = zeros(pts) for i in range(pts) : xt[i] = (xM-xm)*plrandd() yt[i] = (yM-ym)*plrandd() if randn == 0 : x = xt + xm y = yt + ym else: x = sqrt(-2.*log(xt))*cos(2.*pi*yt) + xm y = sqrt(-2.*log(xt))*sin(2.*pi*yt) + ym if rosen == 0: r = sqrt( x*x + y*y) z = exp(-r*r)*cos(2*pi*r) else: z = log(pow(1.-x,2) + 100.*pow(y-pow(x,2),2)) zmin = min(z) zmax = max(z) # Create regular grid xg = xm + (xM-xm)*arange(xp)/(xp-1.) yg = ym + (yM-ym)*arange(yp)/(yp-1.) xx = zeros(1) yy = zeros(1) plcol0(1) plenv(xm,xM,ym,yM,2,0) plcol0(15) pllab('X','Y','The original data sampling') for i in range(pts): plcol1( ( z[i] - zmin )/( zmax - zmin ) ) xx[0] = x[i] yy[0] = y[i] plstring( xx, yy, '#(727)' ) pladv(0) plssub(3,2) for k in range(2): pladv(0) for alg in range(1,7): zg = plgriddata(x, y, z, xg, yg, alg, opt[alg-1]) if alg == GRID_CSA or alg == GRID_DTLI or alg == GRID_NNLI or alg == GRID_NNI: for i in range(xp): for j in range(yp): # Average (IDW) over the 8 neighbours for Nan if isnan(zg[i][j]): zg[i][j] = 0.0 dist = 0.0 for ii in range(max(i-1,0),min(i+2,xp)): for jj in range(max(j-1,0),min(j+2,yp)): if (not isnan(zg[ii][jj])): d = abs(ii-i) + abs(jj-j) if (d != 1.0) : d = 1.4142 zg[i][j] += zg[ii][jj]/(d*d) dist += d if dist != 0.0 : zg[i][j] /= dist else: zg[i][j] = zmin lzM = max(zg.flat) lzm = min(zg.flat) lzm = min(lzm,zmin) lzM = max(lzM,zmax) lzm = lzm - 0.01 lzM = lzM + 0.01 plcol0(1) pladv(alg) if (k == 0): clev = lzm + (lzM-lzm)*arange(nl)/(nl-1) plenv0(xm,xM,ym,yM,2,0) plcol0(15) pllab('X','Y',title[alg-1]) plshades(zg, xm, xM, ym, yM, clev, 1., 1, None, None) plcol0(2) else: clev = lzm + (lzM-lzm)*arange(nl)/(nl-1) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.1, 0.75, -0.65, 1.20) plw3d(1.0, 1.0, 1.0, xm, xM, ym, yM, lzm, lzM, 30.0, -40.0) plbox3('bntu', 'X', 0.0, 0,'bntu', 'Y', 0.0, 0,'bcdfntu', 'Z', 0.5, 0) plcol0(15) pllab('','',title[alg-1]) plot3dc(xg, yg, zg, DRAW_LINEXY | MAG_COLOR | BASE_CONT, clev) main() plplot-5.10.0+dfsg/examples/python/test_superscript_subscript.py 755 1750 1750 424211606356160 241720ustar andrewandrew#!/usr/bin/env python # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() # Like yellow lines better. plcol0(2) pladv(0) plvpor(0.2, 0.8, 0.2, 0.8) plwind(0., 1., 0., 1.) plbox("bc", 0., 0, "bc", 0., 0) plptex(0.5, 0.8, 1., 0., 0.5, "X#d0#d#1#d2#u3#u4#u5#u6#u7#u8#d9#d0#d1") plptex(0.5, 0.8, 1., 0., 0.5, "X#u0#u#1#u2#d3#d4#d5#d6#d7#d8#u9#u0#u1") plptex(0.5, 0.6, 1., 0., 0.5, "#ga#uaa#gad#gdp#gr#gf#d, #ga#u#ga#gaad#gdp#gr#gf#d, B#ua#a#gad#gdp#gr#gf#d, B#u#ga#gaad#gdp#gr#gf#d") plptex(0.5, 0.4, 1., 0., 0.5, "#ga#daa#gad#gdp#gr#gf#u, #ga#d#ga#gaad#gdp#gr#gf#u, B#da#a#gad#gdp#gr#gf#u, B#d#ga#gaad#gdp#gr#gf#u") plptex(0.5, 0.2, 1., 0., 1.1, "B#uf#d, B#ur#d") plptex(0.5, 0.2, 1., 0., -0.1, "B#df#u, B#dr#u") pladv(0) plvpor(0.2, 0.8, 0.2, 0.8) plwind(0., 1.e-200, 0., 1.e-200) plbox("bcmnt", 0., 0, "bcmntv", 0., 0) # Some fiducial marks that show yoffset problems with the pdf device. plmtex("t", -5.125, 0.1, 0.5, "X") plmtex("t", -5.125, 0.2, 0.5, "X#d") plmtex("t", -5.125, 0.3, 0.5, "X#u") #plmtex("t", -10.250, 0.1, 0.5, "X") #plmtex("t", -15.375, 0.1, 0.5, "X") #plmtex("t", -20.500, 0.1, 0.5, "X") # Roughly duplicate plptex tests of superscript/subscript. plmtex("t", -5.125, 0.5, 0.5, "X#d0#d1#d2#u3#u4#u5#u6#u7#u8#d9#d0#d1") plmtex("t", -5.125, 0.5, 0.5, "X#u0#u1#u2#d3#d4#d5#d6#d7#d8#u9#u0#u1") plmtex("t", -10.250, 0.5, 0.5, "#ga#uaa#gad#gdp#gr#gf#d, #ga#u#ga#gaad#gdp#gr#gf#d, B#uaa#gad#gdp#gr#gf#d, B#u#ga#gaad#gdp#gr#gf#d") plmtex("t", -15.375, 0.5, 0.5, "#ga#daa#gad#gdp#gr#gf#u, #ga#d#ga#gaad#gdp#gr#gf#u, B#daa#gad#gdp#gr#gf#u, B#d#ga#gaad#gdp#gr#gf#u") plmtex("t", -20.500, 0.5, 1.1, "B#uf#d, B#ur#d") plmtex("t", -20.500, 0.5, -0.1, "B#df#u, B#dr#u") # These four tests mimic what occurs for badly scaled plbox axes. plmtex("t", 3.2, 1.0, 0.5, "(x10#u-100#d)") plmtex("b", 3.2, 1.0, 0.5, "(x10#u-100#d)") plmtex("t", 2.0, 0.0-0.02, 1.0, "(x10#u-100#d)") plmtex("t", 2.0, 1.0+0.02, 0.0, "(x10#u-100#d)") # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw09.py 644 1750 1750 1744512143270264 173040ustar andrewandrew# $Id: xw09.py 12340 2013-05-10 22:12:04Z andrewross $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Contour plot demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * XPTS = 35 YPTS = 46 XSPA = 2./(XPTS-1) YSPA = 2./(YPTS-1) #polar plot data PERIMETERPTS = 100 RPTS = 40 THETAPTS = 40 #potential plot data PPERIMETERPTS = 100 PRPTS = 40 PTHETAPTS = 64 tr = array((XSPA, 0.0, -1.0, 0.0, YSPA, -1.0)) def mypltr(x, y, data): result0 = data[0] * x + data[1] * y + data[2] result1 = data[3] * x + data[4] * y + data[5] return array((result0, result1)) def polar(): #polar contour plot example. plenv(-1., 1., -1., 1., 0, -2,) plcol0(1) # Perimeter t = (2.*pi/(PERIMETERPTS-1))*arange(PERIMETERPTS) px = cos(t) py = sin(t) plline(px, py) # create data to be contoured. r = arange(RPTS)/float(RPTS-1) r.shape = (-1,1) theta = (2.*pi/float(THETAPTS-1))*arange(THETAPTS-1) xg = r*cos(theta) yg = r*sin(theta) zg = r*ones(THETAPTS-1) lev = 0.05 + 0.10*arange(10) plcol0(2) plcont(zg, lev, pltr2, xg, yg, 2) # ^-- :-). Means: "2nd coord is wrapped." plcol0(1) pllab("", "", "Polar Contour Plot") def potential(): #shielded potential contour plot example. # create data to be contoured. r = 0.5 + arange(PRPTS) r.shape = (-1,1) theta = (2.*pi/float(PTHETAPTS-1))*(0.5+arange(PTHETAPTS-1)) xg = r*cos(theta) yg = r*sin(theta) rmax = max(r.flat) xmin = min(xg.flat) xmax = max(xg.flat) ymin = min(yg.flat) ymax = max(yg.flat) x0 = (xmin + xmax)/2. y0 = (ymin + ymax)/2. #perturbed (expanded) limits peps = 0.05 xpmin = xmin - abs(xmin)*peps xpmax = xmax + abs(xmax)*peps ypmin = ymin - abs(ymin)*peps ypmax = ymax + abs(ymax)*peps # Potential inside a conducting cylinder (or sphere) by method of images. # Charge 1 is placed at (d1, d1), with image charge at (d2, d2). # Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). # Also put in smoothing term at small distances. eps = 2. q1 = 1. d1 = rmax/4. q1i = - q1*rmax/d1 d1i = rmax**2/d1 q2 = -1. d2 = rmax/4. q2i = - q2*rmax/d2 d2i = rmax**2/d2 div1 = sqrt((xg-d1)**2 + (yg-d1)**2 + eps**2) div1i = sqrt((xg-d1i)**2 + (yg-d1i)**2 + eps**2) div2 = sqrt((xg-d2)**2 + (yg+d2)**2 + eps**2) div2i = sqrt((xg-d2i)**2 + (yg+d2i)**2 + eps**2) zg = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i zmin = min(zg.flat) zmax = max(zg.flat) # print "%.15g %.15g %.15g %.15g %.15g %.15g %.15g %.15g \n" % \ # (q1, d1, q1i, d1i, q2, d2, q2i, d2i) # print "%.15g %.15g %.15g %.15g %.15g %.15g \n" % \ # (xmin, xmax, ymin, ymax, zmin, zmax) # Positive and negative contour levels. nlevel = 20 dz = (zmax-zmin)/float(nlevel) clevel = zmin + (arange(20)+0.5)*dz clevelpos = compress(clevel > 0., clevel) clevelneg = compress(clevel <= 0., clevel) #Colours! ncollin = 11 ncolbox = 1 ncollab = 2 #Finally start plotting this page! pladv(0) plcol0(ncolbox) plvpas(0.1, 0.9, 0.1, 0.9, 1.0) plwind(xpmin, xpmax, ypmin, ypmax) plbox("", 0., 0, "", 0., 0) plcol0(ncollin) # Negative contours pllsty(2) plcont(zg, clevelneg, pltr2, xg, yg, 2) # Positive contours pllsty(1) plcont(zg, clevelpos, pltr2, xg, yg, 2) # Draw outer boundary t = (2.*pi/(PPERIMETERPTS-1))*arange(PPERIMETERPTS) px = x0 + rmax*cos(t) py = y0 + rmax*sin(t) plcol0(ncolbox) plline(px, py) plcol0(ncollab) pllab("", "", "Shielded potential of charges in a conducting sphere") def main(): mark = 1500 space = 1500 clevel = -1. + 0.2*arange(11) xx = (arange(XPTS) - XPTS/2) / float((XPTS/2)) yy = (arange(YPTS) - YPTS/2) / float((YPTS/2)) - 1. xx.shape = (-1,1) z = (xx*xx)-(yy*yy) # 2.*outerproduct(xx,yy) for new versions of Numeric which have outerproduct. w = 2.*xx*yy # Set up grids. # Note *for the given* tr, mypltr(i,j,tr)[0] is only a function of i # and mypltr(i,j,tr)[1] is only function of j. xg0 = mypltr(arange(XPTS),0,tr)[0] yg0 = mypltr(0,arange(YPTS),tr)[1] distort = 0.4 cos_x = cos((pi/2.)*xg0) cos_y = cos((pi/2.)*yg0) xg1 = xg0 + distort*cos_x yg1 = yg0 - distort*cos_y # Need independent copy here so the shape changes for xg0t do not affect # xg0. xg0t = xg0.copy() cos_x.shape = (-1,1) xg0t.shape = (-1,1) xg2 = xg0t + distort*cos_x*cos_y yg2 = yg0 - distort*cos_x*cos_y # Plot using mypltr (scaled identity) transformation used to create # xg0 and yg0 # pl_setcontlabelparam(0.006, 0.3, 0.1, 0) # plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) # plcol0(2) # plcont(z, clevel, mypltr, tr) # plstyl([mark], [space]) # plcol0(3) # plcont(w, clevel, mypltr, tr) # plstyl([], []) # plcol0(1) # pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") pl_setcontlabelformat(4,3) pl_setcontlabelparam(0.006, 0.3, 0.1, 1) plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) plcol0(2) plcont(z, clevel, mypltr, tr) plstyl([mark], [space]) plcol0(3) plcont(w, clevel, mypltr, tr) plstyl([], []) plcol0(1) pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") # Plot using 1D coordinate transformation. pl_setcontlabelparam(0.006, 0.3, 0.1, 0) plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) plcol0(2) plcont(z, clevel, pltr1, xg1, yg1) plstyl([mark], [space]) plcol0(3) plcont(w, clevel, pltr1, xg1, yg1) plstyl([], []) plcol0(1) pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") # pl_setcontlabelparam(0.006, 0.3, 0.1, 1) # plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) # plcol0(2) # plcont(z, clevel, pltr1, xg1, yg1) # plstyl([mark], [space]) # plcol0(3) # plcont(w, clevel, pltr1, xg1, yg1) # plstyl([], []) # plcol0(1) # pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") # pl_setcontlabelparam(0.006, 0.3, 0.1, 0) # # Plot using 2D coordinate transformation. plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) plcol0(2) plcont(z, clevel, pltr2, xg2, yg2) plstyl([mark], [space]) plcol0(3) plcont(w, clevel, pltr2, xg2, yg2) plstyl([], []) plcol0(1) pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") # pl_setcontlabelparam(0.006, 0.3, 0.1, 1) # plenv(-1.0, 1.0, -1.0, 1.0, 0, 0) # plcol0(2) # plcont(z, clevel, pltr2, xg2, yg2) # plstyl([mark], [space]) # plcol0(3) # plcont(w, clevel, pltr2, xg2, yg2) # plstyl([], []) # plcol0(1) # pllab("X Coordinate", "Y Coordinate", "Streamlines of flow") # # polar contour examples. pl_setcontlabelparam(0.006, 0.3, 0.1, 0) polar() # pl_setcontlabelparam(0.006, 0.3, 0.1, 1) # polar() # potential contour examples. pl_setcontlabelparam(0.006, 0.3, 0.1, 0) potential() # pl_setcontlabelparam(0.006, 0.3, 0.1, 1) # potential() # Restore defaults #plcol0(1) pl_setcontlabelparam(0.006, 0.3, 0.1, 0) main() plplot-5.10.0+dfsg/examples/python/xw22.py 644 1750 1750 1450412245360636 172760ustar andrewandrew# $Id: xw22.py 12765 2013-11-27 12:12:14Z andrewross $ # Copyright (C) 2004, 2005, 2006, 2007, 2008 Andrew Ross # Simple vector plot example. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # Pairs of points making the line segments used to plot the user defined arrow arrow_x = [-0.5, 0.5, 0.3, 0.5, 0.3, 0.5] arrow_y = [0.0, 0.0, 0.2, 0.0, -0.2, 0.0] arrow2_x = [-0.5, 0.3, 0.3, 0.5, 0.3, 0.3] arrow2_y = [0.0, 0.0, 0.2, 0.0, -0.2, 0.0] xmax = 0.0 def circulation(): nx = 20 ny = 20 dx = 1.0 dy = 1.0 xmin = -nx/2*dx xmax = nx/2*dx ymin = -ny/2*dy ymax = ny/2*dy # Create data - circulation around the origin. ix = ones(nx) iy = ones(ny) x = arange(nx)+0.5-nx/2.0 y = arange(ny)+0.5-ny/2.0 xg = multiply.outer(x,iy) yg = multiply.outer(ix,y) u = yg v = -xg # Plot vectors with default arrows plenv(xmin, xmax, ymin, ymax, 0, 0) pllab("(x)", "(y)", "#frPLplot Example 22 - circulation") plcol0(2) scaling = 0.0 plvect(u,v,scaling,pltr2,xg,yg) plcol0(1) # Vector plot of flow through a constricted pipe def constriction( astyle ): nx = 20 ny = 20 dx = 1.0 dy = 1.0 xmin = -nx/2*dx xmax = nx/2*dx ymin = -ny/2*dy ymax = ny/2*dy Q = 2.0 ix = ones(nx) iy = ones(ny) x = (arange(nx)-nx/2+0.5)*dx y = (arange(ny)-ny/2+0.5)*dy xg = multiply.outer(x,iy) yg = multiply.outer(ix,y) b = ymax/4.0*(3-cos(pi*x/xmax)) b2 = multiply.outer(b,iy) mask = greater.outer(b,abs(y)) dbdx = ymax/4.0*(sin(pi*xg/xmax)*pi/xmax*yg/b2) u = Q*ymax/b2*mask v = dbdx*u plenv(xmin, xmax, ymin, ymax, 0, 0) pllab("(x)", "(y)", "#frPLplot Example 22 - constriction (arrow style "+str(astyle)+")") plcol0(2) scaling=-1.0 plvect(u,v,scaling,pltr2,xg,yg) plcol0(1) def transform( x, y, xt, yt, data ): xt[0] = x yt[0] = y / 4.0 * ( 3 - cos( pi * x / xmax ) ) # Vector plot of flow through a constricted pipe def constriction2(): global xmax nx = 20 ny = 20 nc = 11 nseg = 20 dx = 1.0 dy = 1.0 xmin = -nx/2*dx xmax = nx/2*dx ymin = -ny/2*dy ymax = ny/2*dy plstransform( transform, None ) Q = 2.0 ix = ones(nx) iy = ones(ny) x = (arange(nx)-nx/2+0.5)*dx y = (arange(ny)-ny/2+0.5)*dy xg = multiply.outer(x,iy) yg = multiply.outer(ix,y) b = ymax/4.0*(3-cos(pi*x/xmax)) b2 = multiply.outer(b,iy) u = Q*ymax/b2 v = multiply.outer(zeros(nx),iy) clev = Q + arange(nc)*Q/(nc-1) plenv(xmin, xmax, ymin, ymax, 0, 0) pllab("(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform") plcol0(2) plshades(u,xmin+dx/2,xmax-dx/2,ymin+dy/2,ymax-dy/2,clev,0.0,1,1.0,0,None,None) scaling=-1.0 plvect(u,v,scaling,pltr2,xg,yg) plpath(nseg,xmin,ymax,xmax,ymax) plpath(nseg,xmin,ymin,xmax,ymin) plcol0(1) plstransform(None,None) # Vector plot of the gradient of a shielded potential (see example 9) def potential(): nper = 100 nlevel = 10 nr = 20 ntheta = 20 # Create data to be contoured r = 0.5+arange(nr) r.shape = (-1,1) theta = (2.*pi/float(ntheta-1))*(0.5+arange(ntheta)) xg = r*cos(theta) yg = r*sin(theta) rmax = nr xmin = min(xg.flat) xmax = max(xg.flat) ymin = min(yg.flat) ymax = max(yg.flat) x = xg y = yg # Potential inside a conducting cylinder (or sphere) by method of images. # Charge 1 is placed at (d1, d1), with image charge at (d2, d2). # Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). # Also put in smoothing term at small distances. eps = 2. q1 = 1. d1 = rmax/4. q1i = - q1*rmax/d1 d1i = rmax**2/d1 q2 = -1. d2 = rmax/4. q2i = - q2*rmax/d2 d2i = rmax**2/d2 div1 = sqrt((x-d1)**2 + (y-d1)**2 + eps**2) div1i = sqrt((x-d1i)**2 + (y-d1i)**2 + eps**2) div2 = sqrt((x-d2)**2 + (y+d2)**2 + eps**2) div2i = sqrt((x-d2i)**2 + (y+d2i)**2 + eps**2) zg = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i zmin = min(zg.flat) zmax = max(zg.flat) ug = -q1*(x-d1)/div1**3 - q1i*(x-d1i)/div1i**3 \ - q2*(x-d2)/div2**3 - q2i*(x-d2i)/div2i**3 vg = -q1*(y-d1)/div1**3 - q1i*(y-d1i)/div1i**3 \ - q2*(y+d2)/div2**3 - q2i*(y+d2i)/div2i**3 umin = min(ug.flat) umax = max(ug.flat) vmin = min(vg.flat) vmax = max(vg.flat) plenv(xmin, xmax, ymin, ymax, 0, 0) pllab("(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot") # Plot contours of the potential dz = (zmax-zmin)/float(nlevel) clevel = zmin + (arange(nlevel)+0.5)*dz du = (umax-umin)/float(nlevel) clevelu = umin + (arange(nlevel)+0.5)*du dv = (vmax-vmin)/float(nlevel) clevelv = vmin + (arange(nlevel)+0.5)*dv plcol0(3) pllsty(2) plcont(zg,clevel,pltr2,xg,yg) pllsty(1) plcol0(1) # Plot the vectors of the gradient of the potential plcol0(2) scaling = 25.0 plvect(ug,vg,scaling,pltr2,xg,yg) plcol0(1) # Perimeter t = (2.*pi/(nper-1))*arange(nper) px = rmax*cos(t) py = rmax*sin(t) plline(px,py) # main # # Does a series of vector plots # def main(): circulation() narr = 6 fill = 0 # Set arrow style using arrow_x and arrow_y then # plot using these arrows. plsvect(arrow_x, arrow_y, fill) constriction(1) # Set arrow style using arrow2_x and arrow2_y then # plot using these filled arrows. fill = 1 plsvect(arrow2_x, arrow2_y, fill) constriction(2) constriction2() plsvect( None, None, 0) potential() # Vector plot of the circulation about the origin main() plplot-5.10.0+dfsg/examples/python/test_axis_precision.py 755 1750 1750 77611300440420 225000ustar andrewandrew#!/usr/bin/env python # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() # Choose 5 here so there is room for non-exponential notation for an axis # label of +0.08. plsyax(5, 0) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0.00, 1.00, 0.00, 0.08) plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plend() plplot-5.10.0+dfsg/examples/python/pytkdemo 755 1750 1750 1176511434724443 177110ustar andrewandrew#!/usr/bin/env python # -*-python-*- # Geoffrey Furnish # # A Python/Tk script to interactively run the various Python demos. from Tkinter import * from plplot import * from plplot_widget import * import Plframe from Plframe import * import x01 import x02 import x03 import x04 import x05 import x06 import x07 import x08 ##import x09 import x10 import x11 import x12 import x13 ##import x14 ##import x15 import x16 ##import x17 ##import x18 ##import x19 class DemoApp(Frame): def __init__( s, master=None ): Frame.__init__( s, master ) print "Building the Python Tk demo application main window." s.create_widgets() s.pack( expand=1, fill=BOTH ) #plspause(1) def create_widgets(s): s.f = Frame(s) s.make_demo_bar( s.f ) print "Time to register the plframe with the interp..." Pltk_init( s.tk.interpaddr() ); s.plf = PlXframe(s, width="17c", height="17c" ) s.f2 = Frame(s) s.f2.clone = Button( s.f2, text="Clone", command=s.clone ) s.f2.clone.pack( side=LEFT, expand=1, fill=X ) s.f2.reload = Button( s.f2, text="Reload", command=s.reload ) s.f2.reload.pack( side=LEFT, expand=1, fill=X ) s.f2.quit = Button( s.f2, text="Dismiss", command=s.master.destroy ) s.f2.quit.pack( side=LEFT, expand=1, fill=X ) s.f2.pack( side=BOTTOM, fill=X ) s.f.pack( side=LEFT ) s.plf.pack( side=RIGHT, expand=1, fill=BOTH ) def make_demo_bar( s, f ): f.x01 = Button( f, text="Example 1", command=s.demo_x01 ) f.x01.pack( expand=1, fill=X ) f.x02 = Button( f, text="Example 2", command=s.demo_x02 ) f.x02.pack( expand=1, fill=X ) f.x03 = Button( f, text="Example 3", command=s.demo_x03 ) f.x03.pack( expand=1, fill=X ) f.x04 = Button( f, text="Example 4", command=s.demo_x04 ) f.x04.pack( expand=1, fill=X ) f.x05 = Button( f, text="Example 5", command=s.demo_x05 ) f.x05.pack( expand=1, fill=X ) f.x06 = Button( f, text="Example 6", command=s.demo_x06 ) f.x06.pack( expand=1, fill=X ) f.x07 = Button( f, text="Example 7", command=s.demo_x07 ) f.x07.pack( expand=1, fill=X ) f.x08 = Button( f, text="Example 8", command=s.demo_x08 ) f.x08.pack( expand=1, fill=X ) f.x09 = Button( f, text="Example 9", command=s.demo_x09, state='disabled' ) f.x09.pack( expand=1, fill=X ) f.x10 = Button( f, text="Example 10", command=s.demo_x10 ) f.x10.pack( expand=1, fill=X ) f.x11 = Button( f, text="Example 11", command=s.demo_x11 ) f.x11.pack( expand=1, fill=X ) f.x12 = Button( f, text="Example 12", command=s.demo_x12 ) f.x12.pack( expand=1, fill=X ) f.x13 = Button( f, text="Example 13", command=s.demo_x13 ) f.x13.pack( expand=1, fill=X ) f.x14 = Button( f, text="Example 14", command=s.demo_x14, state='disabled' ) f.x14.pack( expand=1, fill=X ) f.x15 = Button( f, text="Example 15", command=s.demo_x15, state='disabled' ) f.x15.pack( expand=1, fill=X ) f.x16 = Button( f, text="Example 16", command=s.demo_x16 ) f.x16.pack( expand=1, fill=X ) f.x17 = Button( f, text="Example 17", command=s.demo_x17, state='disabled' ) f.x17.pack( expand=1, fill=X ) f.x18 = Button( f, text="Example 18", command=s.demo_x18, state='disabled' ) f.x18.pack( expand=1, fill=X ) f.x19 = Button( f, text="Example 19", command=s.demo_x19, state='disabled' ) f.x19.pack( expand=1, fill=X ) # Others here. ## f.quit = Button( f, text="Quit", command=f.quit ) ## f.quit.pack( expand=1, fill=X ) ## A nice addition would be for these functions to not only call the ## demos, but to also stuff their source code into a text widget, so ## the user can easily see the correspondence between the source and ## the visual effects. def demo_x01(s): x01.main( s.plf ) def demo_x02(s): x02.main( s.plf ) def demo_x03(s): x03.main( s.plf ) def demo_x04(s): x04.main( s.plf ) def demo_x05(s): x05.main( s.plf ) def demo_x06(s): x06.main( s.plf ) def demo_x07(s): x07.main( s.plf ) def demo_x08(s): x08.main( s.plf ) def demo_x09(s): x09.main( s.plf ) def demo_x10(s): x10.main( s.plf ) def demo_x11(s): x11.main( s.plf ) def demo_x12(s): x12.main( s.plf ) def demo_x13(s): x13.main( s.plf ) def demo_x14(s): x14.main( s.plf ) def demo_x15(s): x15.main( s.plf ) def demo_x16(s): x16.main( s.plf ) def demo_x17(s): x17.main( s.plf ) def demo_x18(s): x18.main( s.plf ) def demo_x19(s): x19.main( s.plf ) def clone(s): "Make a new instance of this demo megawidget." take2 = DemoApp( Toplevel() ) pass def reload(s): """Reload all the demo modules. Facilitates modification of the demos, which is most useful during hte period of implementing the demos in Python.""" reload( x01 ) reload( x02 ) reload( x03 ) reload( x04 ) reload( x05 ) reload( x06 ) reload( x07 ) reload( x08 ) ## reload( x09 ) reload( x10 ) reload( x11 ) reload( x12 ) reload( x13 ) ## reload( x14 ) ## reload( x15 ) reload( x16 ) ## reload( x17 ) ## reload( x18 ) ## reload( x19 ) # Let's also reload the Plframe module, so we can hack on that # freely too. #reload( Plframe ) # Doesn't work, don't know why. Grrr. demo = DemoApp() demo.mainloop() plplot-5.10.0+dfsg/examples/python/x09.py 755 1750 1750 716011633643740 170770ustar andrewandrew#!/usr/bin/env python import math from numpy import * from pl import * import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) #define XPTS 35 /* Data points in x */ #define YPTS 46 /* Datat points in y */ xpts = 35 ypts = 46 #define XSPA 2./(XPTS-1) #define YSPA 2./(YPTS-1) ##static PLFLT clevel[11] = ##{-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.}; clevel = array( [-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.] ) #/* Transformation function */ ##PLFLT tr[6] = ##/*{XSPA, 0.0, -1.0, 0.0, YSPA, -1.0};*/ ##{1.0, 0.0, 0.0, 0.0, 1.0, 0.0}; ## ##void ##mypltr(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data) ##{ ## *tx = tr[0] * x + tr[1] * y + tr[2]; ## *ty = tr[3] * x + tr[4] * y + tr[5]; ##} ##/*--------------------------------------------------------------------------*\ ## * main ## * ## * Does several contour plots using different coordinate mappings. ##\*--------------------------------------------------------------------------*/ ## ##int ##main(int argc, char *argv[]) ##{ def main(): ## int i, j; ## PLFLT xx, yy, argx, argy, distort; ## static PLINT mark = 1500, space = 1500; mark = 1500 space = 1500 ## PLFLT **z, **w; ## PLFLT xg1[XPTS], yg1[YPTS]; ## PLcGrid cgrid1; ## PLcGrid2 cgrid2; ## ##/* Initialize plplot */ plinit() ##/* Set up function arrays */ ## plAlloc2dGrid(&z, XPTS, YPTS); ## plAlloc2dGrid(&w, XPTS, YPTS); ## ## for (i = 0; i < XPTS; i++) { ## xx = (double) (i - (XPTS / 2)) / (double) (XPTS / 2); ## for (j = 0; j < YPTS; j++) { ## yy = (double) (j - (YPTS / 2)) / (double) (YPTS / 2) - 1.0; ## z[i][j] = xx * xx - yy * yy; ## w[i][j] = 2 * xx * yy; ## } ## } z = zeros( xpts, ypts ) w = zeros( xpts, ypts ) for i in range(xpts): xx = (i - .5*xpts) / (.5*xpts) for j in range(ypts): yy = (j - .5*ypts) / (.5*ypts) - 1. z[i,j] = xx * xx - yy * yy w[i,j] = 2. * xx * yy ##/* Set up grids */ ## ## cgrid1.xg = xg1; ## cgrid1.yg = yg1; ## cgrid1.nx = XPTS; ## cgrid1.ny = YPTS; ## ## plAlloc2dGrid(&cgrid2.xg, XPTS, YPTS); ## plAlloc2dGrid(&cgrid2.yg, XPTS, YPTS); ## cgrid2.nx = XPTS; ## cgrid2.ny = YPTS; ## ## for (i = 0; i < XPTS; i++) { ## for (j = 0; j < YPTS; j++) { ## mypltr((PLFLT) i, (PLFLT) j, &xx, &yy, NULL); ## ## argx = xx * PI/2; ## argy = yy * PI/2; ## distort = 0.4; ## ## cgrid1.xg[i] = xx + distort * cos(argx); ## cgrid1.yg[j] = yy - distort * cos(argy); ## ## cgrid2.xg[i][j] = xx + distort * cos(argx) * cos(argy); ## cgrid2.yg[i][j] = yy - distort * cos(argx) * cos(argy); ## } ## } ## ##/* Plot using identity transform */ ## ##/* plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); ## */ ## plenv(.0, 1.*XPTS, .0, 1.*YPTS, 0, 0); ## plcol0(2); ##/* plcont(z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL); ## */ ## plcont(z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, pltr0, NULL); ## plstyl(1, &mark, &space); ## plcol0(3); ##/* plcont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL); ## */ ## plcont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, pltr0, NULL); ## plstyl(0, &mark, &space); ## plcol0(1); ## pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); plenv( 0., 1.*xpts, 0., 1.*ypts, 0, 0 ) plcol0(2) plcont2( z, 1, xpts, 1, ypts, clevel ) plstyl( 1, mark, space ) plcol0(3) plcont2( w, 1, 1.*xpts, 1, 1.*ypts, clevel ) plstyl( 0, mark, space ) # other stuff plcol0(1) pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); pleop() main() plplot-5.10.0+dfsg/examples/python/x31 755 1750 1750 44611122036212 164020ustar andrewandrew#!/usr/bin/env python # This is a standalone example since at least one of the tests spans # plinit so must be done in the same module. # However, provide this wrapper for the standalone module so that it # can be run just like the other python examples that are not standalone. import xw31 plplot-5.10.0+dfsg/examples/python/xw00.py 644 1750 1750 251411722016102 172310ustar andrewandrew# $Id: xw00.py 12179 2012-02-24 23:24:50Z andrewross $ # # Simple demo of a 2D line plot. # # Copyright (C) 2011 Alan W. Irwin # Copyright (C) 2012 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # from plplot_py_demos import * NSIZE = 101 def main(): xmin = 0. xmax = 1. ymin = 0. ymax = 100. # Prepare data to be plotted. x = arange(NSIZE) / float( NSIZE - 1 ) y = ymax*x**2 # Create a labelled box to hold the plot. plenv( xmin, xmax, ymin, ymax, 0, 0 ) pllab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ) # Plot the data that was prepared above. plline( x, y ) main() plplot-5.10.0+dfsg/examples/python/test_plsmem.py.in 755 1750 1750 771211543675237 214310ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2010 Simon Wood # Copyright (C) 2010 Hazen Babcock # Copyright (C) Alan W. Irwin # Simple amalgamated demo of plsmem and plsmema under Python for the # mem, memcairo, and memqt devices. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # import Image import math import numpy.numarray from plplot_python_start import * from plplot import * def plot(device_name, ifRGBA, width, height, my_buffer, x, y, data, max_val): if ifRGBA: colour_code = "RGBA" # initialise for mem-style RGBA device plsmema(width,height,my_buffer) else: colour_code = "RGB" # initialise for mem-style RGB device plsmem(width,height,my_buffer) plstart (device_name, 1, 1); plcol0(2) plenv(0, 360, 0, 90, 0, 2) plcol0(2) pllab("Azimuth", "Elevation", "Rectangular Sky View with " + colour_code + " " + device_name + " device") # plot binned density plimage(data, 0, 360, 0, 90, 0, max_val, 0, 360, 0, 90) # plot points plpoin(x,y,5) # have to finish plotting so that the plot data gets transferred # back from the cairo working surface to the user supplied memory. plend1() # Use fromstring as frombuffer will invert the image my_image = Image.fromstring(colour_code, (width,height), my_buffer) my_image.save(device_name + "_" + colour_code + ".png") # --------------------------------------------------- # Build random array (aka fake data) plseed(1234) x=[] y=[] for i in range(500) : x.append(plrandd() * 360) y.append(plrandd() * 90) # compute binned density on 15' boundaries # 360' gives 24 divisions # 90' gives 6 divisions width = 24 height = 6 max_val = 0 data = numpy.numarray.zeros((width,height)) for i in range(len(x)): data[int(x[i]/(360/width))][int(y[i]/(90/height))] += 1 if data[int(x[i]/(360/width))][int(y[i]/(90/height))] > max_val: max_val +=1 # --------------------------------------------------- # Initialise buffer # Start from a blank canvas width = 480 height = 320 # Dark gray background (necessarily opaque for RGB format). background = numpy.numarray.zeros(3, numpy.uint8) + 30 my_buffer = numpy.numarray.zeros((height,width,3), numpy.uint8) + background # Dark gray semi-transparent background. background = numpy.numarray.zeros(4, numpy.uint8) + 30 background[3] = 200 my_buffera = numpy.numarray.zeros((height,width,4), numpy.uint8) + background ''' # Or open an existing image # (note 'asarray' will fail as it sees PIL image as an array already and # does not perform a copy to make a writable array) src_img = Image.open("input.png") my_buffer = numpy.array(src_img.convert('RGB'), numpy.uint8) (width, height) = src_img.size ''' # Configured device_list depends on what plsmem and plsmema devices # are available from the PLplot build. device_list = @PLSMEM_DEVICE_LIST@ for device_name in device_list: # plot writes on top of buffer each time so must use an independent (deep) copy. buffer = numpy.array(my_buffer,copy=True) plot(device_name, False, width, height, buffer, x, y, data, max_val) # "mem" device does not (yet) have RGBA capability. if device_name != "mem": buffer = numpy.array(my_buffera,copy=True) plot(device_name, True, width, height, buffer, x, y, data, max_val) plplot-5.10.0+dfsg/examples/python/x13.py 755 1750 1750 262211541217123 170560ustar andrewandrew#!/usr/bin/env python # # x13c.c # # Pie chart demo. import math import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) text = ["Maurice", "Randy", "Mark", "Steve", "Warner"] # main # # Does a simple pie chart. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.plenv(0., 10., 0., 10., 1, -2) w.plcol0(2) per = [10, 32, 12, 30, 16] theta0 = 0. dthet = 2 * math.pi / 500 for i in range(5): x = [5.] y = [5.] theta1 = theta0 + 2 * math.pi * per[i] / 100. if i == 4: theta1 = 2 * math.pi theta = theta0 while theta <= theta1: x.append(5 + 3 * math.cos(theta)) y.append(5 + 3 * math.sin(theta)) theta = theta + dthet w.plcol0(i + 1) w.plpsty((i + 3) % 8 + 1) w.plfill(x, y) w.plcol0(1) w.plline(x, y) just = (theta0 + theta1) / 2. dx = .25 * math.cos(just) dy = .25 * math.sin(just) if just < math.pi / 2 or just > 3 * math.pi / 2: just = 0. else: just = 1. mid = len(x) / 2 w.plptex((x[mid] + dx), (y[mid] + dy), 1.0, 0.0, just, text[i]) theta0 = theta - dthet w.plfont(2) w.plschr(0., 1.3) w.plptex(5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales") # Don't forget to call PLEND to finish off! w.pleop() ## pl.end() ## ##main() plplot-5.10.0+dfsg/examples/python/x29 755 1750 1750 212011466547637 164550ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw29 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x04 755 1750 1750 216510233632313 164300ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw04 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x15 755 1750 1750 216510233632313 164320ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw15 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x03 755 1750 1750 237211301232165 164250ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Set orientation to portrait - note not all device drivers # support this, in particular most interactive drivers do not plsori(1) # Initialize plplot plinit() import xw03 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x17 755 1750 1750 145511117620021 164300ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import xw17 plplot-5.10.0+dfsg/examples/python/xw29.py 644 1750 1750 1725411543675237 173200ustar andrewandrew# $Id: xw29.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2008 Andrew Ross # Sample plots using date / time formatting for axes # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * import calendar #-------------------------------------------------------------------------- # main # # Draws several plots which demonstrate the use of date / time formats for # the axis labels. # Time formatting is done using the system strftime routine. See the # documentation of this for full details of the available formats. # # 1) Plotting temperature over a day (using hours / minutes) # 2) Plotting # # Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). # #-------------------------------------------------------------------------- def main(): plsesc('@') plot1() plot2() plot3() plot4() # Plot a model diurnal cycle of temperature def plot1(): # Data points every 10 minutes for 1 day npts = 73; xmin = 0.0; xmax = 60.0*60.0*24.0; # Number of seconds in a day ymin = 10.0; ymax = 20.0; x = xmax*arange(npts)/float(npts) y = 15.0 - 5.0*cos(2*pi*x/xmax) xerr1 = x-60.0*5.0 xerr2 = x+60.0*5.0 yerr1 = y-0.1 yerr2 = y+0.1 pladv(0) plsmaj(0.0,0.5) plsmin(0.0,0.5) plvsta() plwind(xmin, xmax, ymin, ymax) # Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. plcol0(1) # Set time format to be hours:minutes pltimefmt("%H:%M") plbox("bcnstd", 3.0*60*60, 3, "bcnstv", 1, 5) plcol0(3) pllab("Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature") plcol0(4) plline(x, y) plcol0(2) plerrx(xerr1,xerr2,y) plcol0(3) plerry(x,yerr1,yerr2) plsmin(0.0,1.0) plsmaj(0.0,1.0) # Plot the number of hours of daylight as a function of day for a year def plot2(): # Latitude for London lat = 51.5 npts = 365 xmin = 0.0 xmax = npts*60.0*60.0*24.0 ymin = 0.0 ymax = 24.0 # Formula for hours of daylight from # "A Model Comparison for Daylength as a Function of Latitude and # Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. x = arange(npts)*60.0*60.0*24.0 p = arcsin(0.39795*cos(0.2163108 + 2*arctan(0.9671396*tan(0.00860*(arange(npts)-186))))) d = 24.0 - (24.0/pi)*arccos( (sin(0.8333*pi/180.0) + sin(lat*pi/180.0)*sin(p)) / (cos(lat*pi/180.0)*cos(p)) ) y = d plcol0(1) # Set time format to be abbreviated month name followed by day of month pltimefmt("%b %d") plprec(1,1) plenv(xmin, xmax, ymin, ymax, 0, 40) plcol0(3) pllab("Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N") plcol0(4) plline(x, y) plprec(0,0) def plot3(): # number of seconds elapsed since the Unix epoch (1970-01-01, UTC) for # 2005-12-01, UTC. xmin = plctime(2005,11,1,0,0,0.) npts = 62 xmax = xmin + npts*60.0*60.0*24.0 ymin = 0.0 ymax = 5.0 i = arange(npts) imin = float(npts)/2.0-abs(i - float(npts)/2.0) x = xmin + i*60.0*60.0*24.0 y = 1.0 + sin(2*pi*i/7.0) + exp( imin / 31.0) pladv(0) plvsta() plwind(xmin, xmax, ymin, ymax) plcol0(1) # Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is # equivalent to %f for C99 compliant implementations of strftime. pltimefmt("%Y-%m-%d") # Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox("bcnstd", 14*24.0*60.0*60.0,14, "bcnstv", 1, 4) plcol0(3) pllab("Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006") plcol0(4) plssym(0.0,0.5) plpoin(x, y, 2) plline(x, y) def plot4(): # TAI-UTC (seconds) as a function of time. # Use Besselian epochs as the continuous time interval just to prove # this does not introduce any issues. # Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch # # B = 1900. + (JD -2415020.31352)/365.242198781 # ==> (as calculated with aid of "bc -l" command) # B = (MJD + 678940.364163900)/365.242198781 # ==> # MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781 offset1 = -678940. offset2 = -0.3641639 plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.) for kind in range(7): if kind == 0: xmin = plctime(1950,0,2,0,0,0.) xmax = plctime(2020,0,2,0,0,0.) npts = 70*12 + 1 ymin = 0.0 ymax = 36.0 time_format = "%Y%" if_TAI_time_format = True title_suffix = "from 1950 to 2020" xtitle = "Year" xlabel_step = 10. elif kind == 1 or kind ==2: xmin = plctime(1961,7,1,0,0,1.64757-.20) xmax = plctime(1961,7,1,0,0,1.64757+.20) npts = 1001 ymin = 1.625 ymax = 1.725 time_format = "%S%2%" title_suffix = "near 1961-08-01 (TAI)" xlabel_step = 0.05/(scale*86400.) if kind == 1: if_TAI_time_format = True xtitle = "Seconds (TAI)" else: if_TAI_time_format = False xtitle = "Seconds (TAI) labelled with corresponding UTC" elif kind == 3 or kind ==4: xmin = plctime(1963,10,1,0,0,2.6972788-.20) xmax = plctime(1963,10,1,0,0,2.6972788+.20) npts = 1001 ymin = 2.55 ymax = 2.75 time_format = "%S%2%" title_suffix = "near 1963-11-01 (TAI)" xlabel_step = 0.05/(scale*86400.) if kind == 3: if_TAI_time_format = True xtitle = "Seconds (TAI)" else: if_TAI_time_format = False xtitle = "Seconds (TAI) labelled with corresponding UTC" elif kind == 5 or kind == 6: xmin = plctime(2009,0,1,0,0,34.-5.) xmax = plctime(2009,0,1,0,0,34.+5.) npts = 1001 ymin = 32.5 ymax = 34.5 time_format = "%S%2%" title_suffix = "near 2009-01-01 (TAI)" xlabel_step = 1./(scale*86400.) if kind == 5: if_TAI_time_format = True xtitle = "Seconds (TAI)" else: if_TAI_time_format = False xtitle = "Seconds (TAI) labelled with corresponding UTC" i = arange(npts) x = xmin + i*(xmax-xmin)/float(npts-1) y = zeros(npts) for j in range(npts): plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.) tai = x[j] (tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec) = plbtime(tai) plconfigtime(scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0.) (utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec) = plbtime(tai) plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.) utc = plctime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec) y[j]=(tai-utc)*scale*86400. pladv(0) plvsta() plwind(xmin, xmax, ymin, ymax) plcol0(1) if if_TAI_time_format: plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.) else: plconfigtime(scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0.) pltimefmt(time_format) plbox("bcnstd", xlabel_step, 0, "bcnstv", 0., 0) plcol0(3) pllab(xtitle, "TAI-UTC (sec)", "@frPLplot Example 29 - TAI-UTC " + title_suffix) plcol0(4) plline(x, y) main() plplot-5.10.0+dfsg/examples/python/x20 755 1750 1750 216511466547637 164550ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw20 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw33.py 644 1750 1750 6450012147245131 172720ustar andrewandrew# -*- coding: utf-8; -*- # $Id: xw33.py 12347 2013-05-22 22:44:41Z andrewross $ # Copyright (C) 2010 Alan W. Irwin # Demonstrate most pllegend capability including unicode symbols. # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # This example designed just for devices (e.g., the cairo-related and # qt-related devices) where the best choice of glyph is automatically # selected by the related libraries (pango/cairo or Qt4) for each # unicode character depending on what system fonts are installed. Of # course, you must have the appropriate TrueType fonts installed to # have access to all the required glyphs. from plplot_py_demos import * position_options = [ PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT| PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT| PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_INSIDE, ] # Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). special_symbols = [ "✰", "✴", "✱", "✽", "✦", ] # Colorbar type options COLORBAR_KINDS = 4 colorbar_option_kinds = [ PL_COLORBAR_SHADE, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT ] colorbar_option_kind_labels = [ "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars" ] # Which side of the page are we positioned relative to? COLORBAR_POSITIONS = 4 colorbar_position_options = [ PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM ] colorbar_position_option_labels = [ "Left", "Right", "Top", "Bottom" ] # Colorbar label positioning options COLORBAR_LABELS = 4 colorbar_label_options = [ PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM ] colorbar_label_option_labels = [ "Label left", "Label right", "Label top", "Label bottom" ] # Colorbar cap options COLORBAR_CAPS = 4 colorbar_cap_options = [ PL_COLORBAR_CAP_NONE, PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH ] colorbar_cap_option_labels = [ "No caps", "Low cap", "High cap", "Low and high caps" ] def plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ): n_axes = 1 axis_opts = zeros(n_axes,"S100") ticks = zeros(n_axes) sub_ticks = zeros(n_axes,"int") label_opts = zeros(n_axes,"int") label_opts[0] = PL_COLORBAR_LABEL_BOTTOM label = zeros(n_axes,"S100") n_values_array = zeros(n_axes,"int") n_values_array[0] = len(values) values_array = reshape(values,[1,len(values)]) low_cap_color = 0.0 high_cap_color = 1.0 # Start a new page pladv( 0 ) # Draw one colorbar relative to each side of the page for position_i in range(COLORBAR_POSITIONS): position = colorbar_position_options[position_i] opt = colorbar_option_kinds[kind_i] | colorbar_label_options[label_i] | colorbar_cap_options[cap_i] vertical = (position & PL_POSITION_LEFT) or (position & PL_POSITION_RIGHT) ifn = position & PL_POSITION_LEFT or position & PL_POSITION_BOTTOM # Set the offset position on the page if vertical: x = 0.0 y = 0.0 x_length = 0.05 y_length = 0.5 else: x = 0.0 y = 0.0 x_length = 0.5 y_length = 0.05 # Set appropriate labelling options. if ifn: if ( cont_color == 0 or cont_width == 0. ): axis_opts[0] = "uwtivn" else: axis_opts[0] = "uwxvn"; else: if ( cont_color == 0 or cont_width == 0. ): axis_opts[0] = "uwtivm" else: axis_opts[0] = "uwxvm" label[0] = "%s, %s" % (colorbar_position_option_labels[position_i] , colorbar_label_option_labels[label_i]) # Smaller text plschr( 0.0, 0.75 ) # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ) plsmin( 0.0, 0.5 ) plvpor( 0.20, 0.80, 0.20, 0.80 ) plwind( 0.0, 1.0, 0.0, 1.0 ) # Set interesting background colour. plscol0a( 15, 0, 0, 0, 0.20 ) (colorbar_width, colorbar_height) = plcolorbar( \ opt | PL_COLORBAR_BOUNDING_BOX | PL_COLORBAR_BACKGROUND, position, \ x, y, x_length, y_length, \ 15, 1, 1, \ low_cap_color, high_cap_color, \ cont_color, cont_width, \ label_opts, label, \ axis_opts, ticks, sub_ticks, \ n_values_array, values_array ) # Reset text and tick sizes plschr( 0.0, 1.0 ) plsmaj( 0.0, 1.0 ) plsmin( 0.0, 1.0 ) # Draw a page title title = "%s - %s" % (colorbar_option_kind_labels[kind_i] , colorbar_cap_option_labels[cap_i]) plvpor( 0.0, 1.0, 0.0, 1.0 ) plwind( 0.0, 1.0, 0.0, 1.0 ) plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ) def plcolorbar_example( palette, kind_i, cont_color, cont_width, values ): # Load the color palette plspal1( palette, 1 ) for label_i in arange(COLORBAR_LABELS): for cap_i in arange(COLORBAR_CAPS): plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ) def main(): # First page illustrating the 16 standard positions. pladv(0) plvpor(0.25, 0.75, 0.25, 0.75) plwind(0.0, 1.0, 0.0, 1.0) plbox("bc", 0.0, 0, "bc", 0.0, 0) plsfont(PL_FCI_SANS, -1, -1) plmtex("t", 8.0, 0.5, 0.5, "The 16 standard legend positions with") plmtex("t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y") # Set up legend arrays with the correct size, type. nlegend = 1 opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S200") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S100") # Only specify legend data that are required according to the # value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL line_styles[0] = 1 line_widths[0] = 1. symbol_scales[0] = 1. symbol_numbers[0] = 4 symbols[0] = "*" # Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1) plscol0a( 15, 32, 32, 32, 0.70 ) for k in range(16): position = position_options[k] opt = opt_base text[0] = "%2.2d" % k text_colors[0] = 1 + (k % 8) line_colors[0] = 1 + (k % 8) symbol_colors[0] = 1 + (k % 8) (legend_width, legend_height) = \ pllegend( opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) # Second page illustrating effect of nrow, ncolumn for the same legend # data. pladv(0) plvpor(0.25, 0.75, 0.25, 0.75) plwind(0.0, 1.0, 0.0, 1.0) plbox("bc", 0.0, 0, "bc", 0.0, 0) plsfont(PL_FCI_SANS, -1, -1) plmtex("t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,") plmtex("t", 6.0, 0.5, 0.5, "and position for the same legend data") # Set up legend arrays with the correct size, type. nlegend = 7 opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S200") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S100") # Only specify legend data that are required according to the # value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX for k in range(nlegend): opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL line_styles[k] = 1 line_widths[k] = 1. symbol_scales[k] = 1. symbol_numbers[k] = 2 symbols[k] = "*" text[k] = "%2.2d" % k text_colors[k] = 1 + (k % 8) line_colors[k] = 1 + (k % 8) symbol_colors[k] = 1 + (k % 8) # Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1) plscol0a( 15, 32, 32, 32, 0.70 ) position = PL_POSITION_TOP | PL_POSITION_OUTSIDE opt = opt_base x = 0. y = 0.1 nrow = 1 ncolumn = nlegend (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE opt = opt_base x = 0. y = 0.1 nrow = 1 ncolumn = nlegend (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE opt = opt_base x = 0.1 y = 0. nrow = nlegend ncolumn = 1 (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE opt = opt_base x = 0.1 y = 0. nrow = nlegend ncolumn = 1 (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE opt = opt_base x = 0. y = 0. nrow = 6 ncolumn = 2 (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE opt = opt_base | PL_LEGEND_ROW_MAJOR x = 0. y = 0. nrow = 6 ncolumn = 2 (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE opt = opt_base | PL_LEGEND_ROW_MAJOR x = 0. y = 0. nrow = 3 ncolumn = 3 (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) # Third page demonstrating legend alignment pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(0.0, 1.0, 0.0, 1.0) plsfont(PL_FCI_SANS, -1, -1) plmtex("t", 2.0, 0.5, 0.5, "Demonstrate legend alignment") x = 0.1 y = 0.1 nturn = 4 nlegend = 0 position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX opt = opt_base for i in range(9): # Set up legend arrays with the correct size, type. if i <= nturn: nlegend += 1 else: nlegend -= 1 nlegend = max(1, nlegend) opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S200") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S100") # Only specify legend data that are required according to the # value of opt_array for that entry. for k in range(nlegend): opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL line_styles[k] = 1 line_widths[k] = 1. symbol_scales[k] = 1. symbol_numbers[k] = 2 symbols[k] = "*" text[k] = "%2.2d" % k text_colors[k] = 1 + (k % 8) line_colors[k] = 1 + (k % 8) symbol_colors[k] = 1 + (k % 8) # Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1) plscol0a( 15, 32, 32, 32, 0.70 ) nrow = min(3, nlegend) ncolumn = 0 (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) if i == nturn: position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE opt = opt_base x = 1. - x y += legend_height else: x += legend_width y += legend_height # Fourth page illustrating various kinds of legends max_height = 0. xstart = 0.0 ystart = 0.1 x = xstart y = ystart text_scale = 0.90 pladv(0) plvpor(0.0, 1., 0.0, 0.90) plwind(0.0, 1.0, 0.0, 1.0) # plbox("bc", 0.0, 0, "bc", 0.0, 0) plsfont(PL_FCI_SANS, -1, -1) plmtex("t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends") # Set up legend arrays with the correct size, type. nlegend = 5 opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S200") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S100") # Only specify legend data that are required according to the # value of opt_array for that entry. position = PL_POSITION_LEFT | PL_POSITION_TOP opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT # Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array[0] = PL_LEGEND_NONE text[0] = "None" text_colors[0] = 1 opt_array[1] = PL_LEGEND_COLOR_BOX text[1] = "Box" text_colors[1] = 2 box_colors[1] = 2 box_patterns[1] = 0 box_scales[1] = 0.8 box_line_widths[1] = 1. opt_array[2] = PL_LEGEND_LINE text[2] = "Line" text_colors[2] = 3 line_colors[2] = 3 line_styles[2] = 1 line_widths[2] = 1. opt_array[3] = PL_LEGEND_SYMBOL text[3] = "Symbol" text_colors[3] = 4 symbol_colors[3] = 4 symbol_scales[3] = text_scale symbol_numbers[3] = 4 symbols[3] = special_symbols[2] opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE text[4] = "L & S" text_colors[4] = 5 line_colors[4] = 5 line_styles[4] = 1 line_widths[4] = 1. symbol_colors[4] = 5 symbol_scales[4] = text_scale symbol_numbers[4] = 4 symbols[4] = special_symbols[2] opt = opt_base plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up symbol legend entries with various symbols. for i in range(nlegend): opt_array[i] = PL_LEGEND_SYMBOL text[i] = "Symbol " + special_symbols[i] text_colors[i] = i+1 symbol_colors[i] = i+1 symbol_scales[i] = text_scale symbol_numbers[i] = 4 symbols[i] = special_symbols[i] opt = opt_base x += legend_width plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up symbol legend entries with various numbers of symbols. for i in range(nlegend): opt_array[i] = PL_LEGEND_SYMBOL text[i] = "Symbol Number %d" % (i+2) text_colors[i] = i+1 symbol_colors[i] = i+1 symbol_scales[i] = text_scale symbol_numbers[i] = i+2 symbols[i] = special_symbols[2] opt = opt_base x += legend_width plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up box legend entries with various colours. for i in range(nlegend): opt_array[i] = PL_LEGEND_COLOR_BOX text[i] = "%s %d" % ("Box Color",i+1) text_colors[i] = i+1 box_colors[i] = i+1 box_patterns[i] = 0 box_scales[i] = 0.8 box_line_widths[i] = 1. opt = opt_base # Use new origin x = xstart y += max_height max_height = 0. plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up box legend entries with various patterns. for i in range(nlegend): opt_array[i] = PL_LEGEND_COLOR_BOX text[i] = "%s %d" % ("Box Pattern",i) text_colors[i] = 2 box_colors[i] = 2 box_patterns[i] = i box_scales[i] = 0.8 box_line_widths[i] = 1. opt = opt_base x += legend_width plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up box legend entries with various box pattern line widths. for i in range(nlegend): opt_array[i] = PL_LEGEND_COLOR_BOX text[i] = "%s %d" % ("Box Line Width",i+1) text_colors[i] = 2 box_colors[i] = 2 box_patterns[i] = 3 box_scales[i] = 0.8 box_line_widths[i] = float(i+1) opt = opt_base x += legend_width plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up line legend entries with various colours. for i in range(nlegend): opt_array[i] = PL_LEGEND_LINE text[i] = "%s %d" % ("Line Color",i+1) text_colors[i] = i+1 line_colors[i] = i+1 line_styles[i] = 1 line_widths[i] = 1. opt = opt_base # Use new origin x = xstart y += max_height max_height = 0. plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up line legend entries with various styles for i in range(nlegend): opt_array[i] = PL_LEGEND_LINE text[i] = "%s %d" % ("Line Style",i+1) text_colors[i] = 2 line_colors[i] = 2 line_styles[i] = i+1 line_widths[i] = 1. opt = opt_base x += legend_width plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Set up line legend entries with various widths. for i in range(nlegend): opt_array[i] = PL_LEGEND_LINE text[i] = "%s %d" % ("Line Width",i+1) text_colors[i] = 2 line_colors[i] = 2 line_styles[i] = 1 line_widths[i] = float(i+1) opt = opt_base x += legend_width plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max(max_height, legend_height) # Color bar examples values_small = [ -1.0e-200, 1.0e-200 ] values_uneven = [ -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 ] values_even = [ -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 ] # Use unsaturated green background colour to contrast with black caps. plscolbg( 70, 185, 70 ) # Cut out the greatest and smallest bits of the color spectrum to # leave colors for the end caps. plscmap1_range( 0.01, 0.99 ) # We can only test image and gradient colorbars with two element arrays for i in arange(COLORBAR_KINDS-2)+2: plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ) # Test shade colorbars with larger arrays for i in arange(2): plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ) for i in arange(2): plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ) main() plplot-5.10.0+dfsg/examples/python/test_style.py 755 1750 1750 625411603264311 206470ustar andrewandrew#!/usr/bin/env python # Test of all line styles and box styles using pllegend. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * from math import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) xmin,xmax,ymin,ymax = (0., 1., 0., 1.) # Initialize plplot plinit() # Set up legend arrays with the correct size, type. # pllsty takes integers from 1 to 8. nlegend = 8 opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S200") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend, "int") line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend, "int") symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S100") # Only specify legend data that are required according to the # value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(xmin, xmax, ymin, ymax) text_scale = 0.90 # Set up line legend entries with various styles for i in range(nlegend): opt_array[i] = PL_LEGEND_LINE text[i] = "%s %d" % ("Line Style",i+1) text_colors[i] = 2 line_colors[i] = 2 line_styles[i] = i+1 line_widths[i] = 1 opt = opt_base plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, PL_POSITION_LEFT, 0., 0., 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) # Set up legend arrays with the correct size, type. # plpsty takes integers from 0 to 8. nlegend = 9 opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S200") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend, "int") line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend, "int") symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S100") # Set up box legend entries with various patterns. for i in range(nlegend): opt_array[i] = PL_LEGEND_COLOR_BOX text[i] = "%s %d" % ("Box Pattern",i) text_colors[i] = 2 box_colors[i] = 2 box_patterns[i] = i box_scales[i] = 0.8 box_line_widths[i] = 1 opt = opt_base plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( opt, PL_POSITION_RIGHT, 0., 0., 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) plend() plplot-5.10.0+dfsg/examples/python/x09 755 1750 1750 216510233632313 164350ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw09 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw23.py 644 1750 1750 2055411543675237 173070ustar andrewandrew# $Id: xw23.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2005, 2006, 2007, 2008 Alan W. Irwin # Displays Greek letters and mathematically interesting Unicode ranges. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Displays Greek letters and mathematically interesting Unicode ranges Greek = ( "#gA","#gB","#gG","#gD","#gE","#gZ","#gY","#gH","#gI","#gK","#gL","#gM", "#gN","#gC","#gO","#gP","#gR","#gS","#gT","#gU","#gF","#gX","#gQ","#gW", "#ga","#gb","#gg","#gd","#ge","#gz","#gy","#gh","#gi","#gk","#gl","#gm", "#gn","#gc","#go","#gp","#gr","#gs","#gt","#gu","#gf","#gx","#gq","#gw", ) Type1 = ( "0x0020","0x0021","0x0023","0x0025","0x0026", "0x0028","0x0029","0x002b","0x002c","0x002e", "0x002f","0x0030","0x0031","0x0032","0x0033", "0x0034","0x0035","0x0036","0x0037","0x0038", "0x0039","0x003a","0x003b","0x003c","0x003d", "0x003e","0x003f","0x005b","0x005d","0x005f", "0x007b","0x007c","0x007d","0x00a9","0x00ac", "0x00ae","0x00b0","0x00b1","0x00d7","0x00f7", "0x0192","0x0391","0x0392","0x0393","0x0394", "0x0395","0x0396","0x0397","0x0398","0x0399", "0x039a","0x039b","0x039c","0x039d","0x039e", "0x039f","0x03a0","0x03a1","0x03a3","0x03a4", "0x03a5","0x03a6","0x03a7","0x03a8","0x03a9", "0x03b1","0x03b2","0x03b3","0x03b4","0x03b5", "0x03b6","0x03b7","0x03b8","0x03b9","0x03ba", "0x03bb","0x03bc","0x03bd","0x03be","0x03bf", "0x03c0","0x03c1","0x03c2","0x03c3","0x03c4", "0x03c5","0x03c6","0x03c7","0x03c8","0x03c9", "0x03d1","0x03d2","0x03d5","0x03d6","0x2022", "0x2026","0x2032","0x2033","0x203e","0x2044", "0x2111","0x2118","0x211c","0x2122","0x2126", "0x2135","0x2190","0x2191","0x2192","0x2193", "0x2194","0x21b5","0x21d0","0x21d1","0x21d2", "0x21d3","0x21d4","0x2200","0x2202","0x2203", "0x2205","0x2206","0x2207","0x2208","0x2209", "0x220b","0x220f","0x2211","0x2212","0x2215", "0x2217","0x221a","0x221d","0x221e","0x2220", "0x2227","0x2228","0x2229","0x222a","0x222b", "0x2234","0x223c","0x2245","0x2248","0x2260", "0x2261","0x2264","0x2265","0x2282","0x2283", "0x2284","0x2286","0x2287","0x2295","0x2297", "0x22a5","0x22c5","0x2320","0x2321","0x2329", "0x232a","0x25ca","0x2660","0x2663","0x2665", "0x2666", ) title = ( "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)", ) lo = ( "0x0", "0x0", "0x40", "0x80", "0x2153", "0x2190", "0x21d0", "0x2200", "0x2240", "0x2280", "0x22c0", ) hi = ( "0x30", "0x40", "0x80", "0xA6", "0x2184", "0x21d0", "0x2200", "0x2240", "0x2280", "0x22c0", "0x2300", ) nxcells = ( 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ) nycells = ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ) # non-zero values Must be consistent with nxcells and nycells. offset = ( 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0, ) # 30 possible FCI values. fci = ( 0x80000000, 0x80000001, 0x80000002, 0x80000003, 0x80000004, 0x80000010, 0x80000011, 0x80000012, 0x80000013, 0x80000014, 0x80000020, 0x80000021, 0x80000022, 0x80000023, 0x80000024, 0x80000100, 0x80000101, 0x80000102, 0x80000103, 0x80000104, 0x80000110, 0x80000111, 0x80000112, 0x80000113, 0x80000114, 0x80000120, 0x80000121, 0x80000122, 0x80000123, 0x80000124, ) family = ( "sans-serif", "serif", "monospace", "script", "symbol", ) style = ( "upright", "italic", "oblique", ) weight = ( "medium", "bold", ) def main(): for page in range(11): pladv(0) # Set up viewport and window plvpor(0.02, 0.98, 0.02, 0.90) plwind(0.0, 1.0, 0.0, 1.0) mm = plgspa() plschr(0., 0.8) ycharacter_scale = (1.0 - 0.0)/(mm[3]-mm[2]) # Factor should be 0.5, but heuristically it turns out to be larger. yoffset = 1.0*plgchr()[1]*ycharacter_scale # Draw the grid using plbox plcol0(2) deltax = 1./float(nxcells[page]) deltay = 1./float(nycells[page]) plbox("bcg", deltax, 0, "bcg", deltay, 0) plcol0(15) length = int(hi[page],16) - int(lo[page],16) slice = 0 for y in (0.5+arange(nycells[page]-1,-1,-1))*deltay: for x in (0.5+arange(nxcells[page]))*deltax: if slice < length: if page == 0: # Greek letters. CommandString = str(Greek[slice]); elif 1 <= page and page <= 3: # Unicode for Type 1 Symbol Glyphs. CommandString = "#[" + str(Type1\ [offset[page]+slice]) + "]" elif page >= 4: CommandString = "#[" + hex(int(lo[page],16)+slice) + "]" plptex(x,y+yoffset,1.,0.,0.5, CommandString) plptex(x,y-yoffset,1.,0.,0.5, "#" +CommandString) slice += 1 plschr(0., 1.0) # Page title plmtex("t", 1.5, 0.5, 0.5, title[page]) # Demonstrate methods of getting the current fonts fci_old = plgfci() font = plgfont() ifamily = font[0] istyle = font[1] iweight = font[2] print "For example 23 prior to page 12 the FCI is",hex(fci_old) print "For example 23 prior to page 12 the font family, style and weight are %s %s %s" % (family[ifamily],style[istyle],weight[iweight]) FCI_COMBINATIONS = 30 dy = 0.030 for page in range(11,16): pladv(0) plvpor(0.02, 0.98, 0.02, 0.90) plwind(0.0, 1.0, 0.0, 1.0) plsfci(0) if(page == 11): plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with plsfci") elif(page == 12): plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with plsfont") elif(page == 13): plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct") elif(page == 14): plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs") elif(page == 15): plmtex("t", 1.5, 0.5, 0.5,"#<0x10>PLplot Example 23 - Set Font with ## constructs") plschr(0., 0.75) for i in range(0,FCI_COMBINATIONS): family_index = i % 5 style_index = (i/5) % 3 weight_index = ((i/5)/3) % 2 if(page == 11): plsfci(fci[i]) string = "Page 12, "+family[family_index]+", "+style[style_index]+", "+weight[weight_index]+": "+"The quick brown fox jumps over the lazy dog" elif(page == 12): plsfont(family_index, style_index, weight_index) string = "Page 13, "+family[family_index]+", "+style[style_index]+", "+weight[weight_index]+": "+"The quick brown fox jumps over the lazy dog" elif(page == 13): string = "Page 14, "+family[family_index]+", "+style[style_index]+", "+weight[weight_index]+": #<"+hex(fci[i]).rstrip('L')+">"+"The quick brown fox jumps over the lazy dog" elif(page == 14): string = "Page 15, "+family[family_index]+", "+style[style_index]+", "+weight[weight_index]+": #<"+hex(family_index)+"0>"+"#<"+hex(style_index)+"1>"+"#<"+hex(weight_index)+"2>"+"The quick brown fox jumps over the lazy dog" elif(page == 15): string = "Page 16, "+family[family_index]+", "+style[style_index]+", "+weight[weight_index]+": #<"+family[family_index]+"/>#<"+style[style_index]+"/>#<"+weight[weight_index]+"/>"+"The quick brown fox jumps over the lazy dog" plptex (0., 1. - (i+0.5)*dy, 1., 0., 0., string) plschr(0., 1.0) # Restore defaults plcol0(1) main() plplot-5.10.0+dfsg/examples/python/pyqt4_example.py 755 1750 1750 1244512276771565 213100ustar andrewandrew#!/usr/bin/env python # # A simple PLplot/PyQt example # # Copyright (C) 2009 Hazen Babcock # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # import sys import numpy from plplot_python_start import * import plplot # An indirect side effect of this import statement is a consistent set # of Qt4 libraries are loaded (e.g., if those are from some downloaded # non-system version in a non-standard location). import plplot_pyqt4 # This import statement must go after the one above to insure a # consistent set of Qt4 libraries are used for the case of the # downloaded, non-standard location of those libraries. from PyQt4 import QtCore, QtGui class QPlot(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self, None) # UI setup self.curvesAct = QtGui.QAction("Curves", self) self.histogramAct = QtGui.QAction("Histogram", self) self.interactiveAct = QtGui.QAction("Interactive Selection", self) self.plotMenu = self.menuBar().addMenu("Plot") self.plotMenu.addAction(self.curvesAct) self.plotMenu.addAction(self.histogramAct) self.plotMenu.addAction(self.interactiveAct) self.connect(self.curvesAct, QtCore.SIGNAL("triggered()"), self.plotCurves) self.connect(self.histogramAct, QtCore.SIGNAL("triggered()"), self.plotHistogram) self.connect(self.interactiveAct, QtCore.SIGNAL("triggered()"), self.interactive) # PLplot setup self.plot = plplot_pyqt4.QtExtWidget(842, 595, self) self.setCentralWidget(self.plot) plplot_pyqt4.plsetqtdev(self.plot) plplot.plsdev("extqt") plplot.plinit() self.resize(600,600) plplot.pladv(0) def cleanup(self): plplot.plend() plplot_pyqt4.plfreeqtdev() def paintEvent(self, event): # plplot.pladv(0) # plplot.plenv(0, 10, 0, 10, 0, 0) # plplot.pllab("X", "Y", "Y vs X") self.plot.show() def plotCurves(self): self.plot.clearWidget() # 1st plot indexes = numpy.arange(0, 360.1, 1.0) sine = numpy.sin(indexes * 3.14159 / 180.0) cosine = numpy.cos(indexes * 3.14159 / 180.0) plplot.pladv(0) plplot.plvpor(0.05, 0.95, 0.05, 0.45) plplot.plwind(0.0, 360.0, -1.2, 1.2) plplot.plcol0(2) plplot.plbox("bcnst", 0., 0, "bcnst", 0., 0) plplot.plcol0(1) plplot.plwidth(2) plplot.plline(indexes, sine) plplot.plcol0(3) plplot.plwidth(1) plplot.pllsty(2) plplot.plline(indexes, cosine) plplot.pllsty(1) plplot.plcol0(2) plplot.plmtex("t", 1., 0.5, 0.5, "Sines") # 2nd plot indexes = numpy.arange(-1.0, 1.0, 0.01) square = indexes * indexes cubic = square * indexes plplot.plvpor(0.05, 0.95, 0.55, 0.95) plplot.plwind(-1., 1., -1., 1.) plplot.plcol0(2) plplot.plbox("bcnst", 0., 0, "bcnst", 0., 0) plplot.plcol0(1) plplot.plwidth(2) plplot.plline(indexes, square) plplot.plcol0(3) plplot.plwidth(1) plplot.pllsty(2) plplot.plline(indexes, cubic) plplot.pllsty(1) plplot.plcol0(2) plplot.plmtex("t", 1., 0.5, 0.5, "Square & Cubic") self.update() def plotHistogram(self): def plfbox(x0, y0): x = numpy.array([x0, x0, x0 + 1.0, x0 + 1.0]) y = numpy.array([0.0, y0, y0, 0.0]) plplot.plfill(x, y) plplot.plcol0(1) plplot.pllsty(1) plplot.plline(x, y) self.plot.clearWidget(); y0 = numpy.array([5, 15, 12, 24, 28, 30, 20, 8, 12, 3]) pos = numpy.array([0.0, 0.25, 0.5, 0.75, 1.0]) red = numpy.array([0.0, 0.25, 0.5, 1.0, 1.0]) green = numpy.array([1.0, 0.5, 0.5, 0.5, 1.0]) blue = numpy.array([1.0, 1.0, 0.5, 0.25, 0.0]) plplot.pladv(0) plplot.plvsta() plplot.plcol0(2) plplot.plwind(1980.0, 1990.0, 0.0, 35.0) plplot.plbox("bc", 1.0, 0, "bcnv", 10.0, 0) plplot.plcol0(2) plplot.pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12") plplot.plscmap1l(1,pos,red,green,blue) for i in range(10): plplot.plcol1(i/9.0) plplot.plpsty(0) plfbox((1980. + i), y0[i]) string = "%.0f" % (y0[i]) plplot.plptex((1980. + i + .5), (y0[i] + 1.), 1.0, 0.0, .5, string) string = "%d" % (1980 + i) plplot.plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string) self.update() def interactive(self): [mx, my] = self.plot.captureMousePlotCoords() msg_box = QtGui.QMessageBox() msg_box.setText("Selection: (%f, %f)" % (mx, my)) msg_box.exec_() app = QtGui.QApplication(sys.argv) plot = QPlot() plot.show() app.exec_() plot.cleanup() plplot-5.10.0+dfsg/examples/python/xw04.py 644 1750 1750 762012140522542 172450ustar andrewandrew# $Id: xw04.py 12323 2013-05-02 17:41:54Z airwin $ # Copyright (C) 2001-1010 Alan W. Irwin # Log plot demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Illustration of logarithmic axes, and redefinition of window. def main(): plfont(2) plot1(0) plot1(1) # Restore defaults plfont(1) #plcol0(1) def plot1(type): pladv(0) f0 = 1.0 freql = -2.0 + arange(101)/20.0 freq = pow(10.0, freql) ampl = 20.0 * log10(1.0 / sqrt(1.0 + pow((freq / f0), 2.))) phase = -(180.0 / pi) * arctan(freq / f0) plvpor(0.15, 0.85, 0.1, 0.9) plwind(-2., 3.0, -80.0, 0.0) plcol0(1) if type == 0: plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0) elif type == 1: plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0) else: print "error: type must be either 0 or 1" plcol0(2) plline(freql, ampl) plcol0(2) plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade") # Put labels on plcol0(1) plmtex("b", 3.2, 0.5, 0.5, "Frequency") plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter") plcol0(2) plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)") # For the gridless case, put phase vs freq on same plot if type == 0: plcol0(1) plwind(-2.0, 3.0, -100.0, 0.0) plbox("", 0.0, 0, "cmstv", 30.0, 3) plcol0(3) plline(freql, phase) plstring(freql, phase, "*") plcol0(3) plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)") nlegend = 2 else: nlegend = 1 # Draw a legend. # Set up legend arrays with the correct size, type. opt_array = zeros(nlegend, "int") text_colors = zeros(nlegend, "int") text = zeros(nlegend, "S20") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S10") # Only specify legend data that are required according to the # value of opt_array for that entry. # Data for first legend entry. opt_array[0] = PL_LEGEND_LINE text_colors[0] = 2 text[0] = "Amplitude" line_colors[0] = 2 line_styles[0] = 1 line_widths[0] = 1. # Data for second legend entry. if nlegend > 1: opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL text_colors[1] = 3 text[1] = "Phase shift" line_colors[1] = 3 line_styles[1] = 1 line_widths[1] = 1. symbol_colors[1] = 3 symbol_scales[1] = 1. symbol_numbers[1] = 4 symbols[1] = "*" plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) main() plplot-5.10.0+dfsg/examples/python/x01.py 755 1750 1750 1173711541217123 171020ustar andrewandrew#!/usr/bin/env python # # x01c.c # # Simple line plot and multiple windows demo. import math #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) from numpy import * from plplot import * # main # # Generates several simple line plots. Demonstrates: # - subwindow capability # - setting up the window, drawing plot, and labelling # - changing the color # - automatic axis rescaling to exponential notation # - placing the axes in the middle of the box # - gridded coordinate axes def main(w): global xscale, yscale, xoff, yoff # plplot initialization # Divide page into 2x2 plots unless user overrides ## pl.ssub(2, 2) ## ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Get version number, just for kicks ## ## print "PLplot library version:", pl.gver() ## ## # Initialize plplot ## ## pl.init() # Set up the data # Original case xscale = 6. yscale = 1. xoff = 0. yoff = 0. # Do a plot plot1(w) # Set up the data xscale = 1. yscale = 0.0014 yoff = 0.0185 # Do a plot digmax = 5 plsyax(digmax, 0) plot1(w) plot2(w) plot3(w) # Let's get some user input ## while 1: ## plc = pl.GetCursor() ## if len(plc) == 4: ## pl.text() ## print " wx =", plc[2] ## print " wy =", plc[3] ## print " vx =", plc[0] ## print " vy =", plc[1] ## pl.gra() ## continue ## else: ## break # Don't forget to call pl.end to finish off! # Uh, I don't think so. # =============================================================== def plot1(w): global x, y, xscale, yscale, xoff, yoff, xs, ys w.plbop() ## x = [] ## y = [] ## for i in range(60): ## x.append(xoff + xscale * (i + 1) / 60.0) ## y.append(yoff + yscale * pow(x[i], 2.)) x = zeros(60,'d'); y = zeros(60,'d') for i in range(60): x[i] = xoff + xscale * (i + 1) / 60.0 y[i] = yoff + yscale * pow(x[i], 2.) xmin = x[0] xmax = x[59] ymin = y[0] ymax = y[59] ## xs = [] ## ys = [] ## for i in range(6): ## xs.append(x[i * 10 + 3]) ## ys.append(y[i * 10 + 3]) xs = zeros(6,'d'); ys = zeros(6,'d') for i in range(6): xs[i] = x[i * 10 + 3] ys[i] = y[i * 10 + 3] # Set up the viewport and window using pl.env. The range in X # is 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes # are scaled separately (just = 0), and we just draw a # labelled box (axis = 0). w.plcol0(1) w.plenv(xmin, xmax, ymin, ymax, 0, 0) w.plcol0(2) w.pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2") # Plot the data points w.plcol0(4) w.plpoin(xs, ys, 9) # Draw the line through the data w.plcol0(3) w.plline(x, y) w.pleop() # =============================================================== def plot2(w): global x, y, xscale, yscale, xoff, yoff, xs, ys w.plbop() # Set up the viewport and window using pl.env. The range in X # is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes # are scaled separately (just = 0), and we draw a box with # axes (axis = 1). ## pl.col(1) ## pl.env(-2.0, 10.0, -0.4, 1.2, 0, 1) ## pl.col(2) ## pl.lab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function") w.plcol0(1) w.plenv(-2.0, 10.0, -0.4, 1.2, 0, 1) w.plcol0(2) w.pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function") # Fill up the arrays ## x = [] ## y = [] ## for i in range(100): ## x.append((i - 19.0) / 6.0) ## if x[i] == 0.0: ## y.append(1.0) ## else: ## y.append(math.sin(x[i]) / x[i]) x = zeros(100,'d'); y = zeros(100,'d') for i in range(100): x[i] = (i - 19.0) / 6.0 if x[i] == 0.0: y[i] = 1. else: y[i] = math.sin(x[i]) / x[i] # Draw the line ## pl.col(3) ## pl.line(x, y) w.plcol0(3) w.plline(x, y) w.pleop() # =============================================================== def plot3(w): global x, y, xscale, yscale, xoff, yoff, xs, ys # For the final graph we wish to override the default tick # intervals, so do not use pl.env w.pladv(0) # Use standard viewport, and define X range from 0 to 360 # degrees, Y range from -1.2 to 1.2. w.plvsta() w.plwind(0.0, 360.0, -1.2, 1.2) # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. w.plcol0(1) w.plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2) # Superimpose a dashed line grid, with 1.5 mm marks and spaces. # plstyl expects a pointer!! #w.plstyl([1500], [1500]) w.plcol0(2) w.plbox("g", 30.0, 0, "g", 0.2, 0) #w.plstyl([], []) w.plcol0(3) w.pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function") ## x = [] ## y = [] ## for i in range(101): ## x.append(3.6 * i) ## y.append(math.sin(x[i] * math.pi / 180.0)) x = zeros(101,'d'); y = zeros(101,'d') for i in range(101): x[i] = 3.6 * i y[i] = math.sin(x[i] * math.pi / 180.0) w.plcol0(4) w.plline(x, y) w.pleop() ## Do something to make the demo run if not under the Tk demo gui. ## Something about the if __name__ == __main__ business, but need to ## cobble together a "loopback" widget or some such, so it will work. plplot-5.10.0+dfsg/examples/python/xw07.py 644 1750 1750 403411543675237 172640ustar andrewandrew# $Id: xw07.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Font demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Displays the entire "plsym" symbol (font) set. def main(): base = [0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900] plfontld( 0 ) for l in range(20): if l == 2: plfontld( 1 ) pladv(0) # Set up viewport and window plcol0(2) plvpor(0.15, 0.95, 0.1, 0.9) plwind(0.0, 1.0, 0.0, 1.0) # Draw the grid using plbox plbox("bcg", 0.1, 0, "bcg", 0.1, 0) # Write the digits below the frame plcol0(15) for i in range(10): plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, `i`) k = 0 for i in range(10): # Write the digits to the left of the frame text = `base[l] + 10 * i` plmtex("lv", 1.0, (0.95 - 0.1 * i), 1.0, text) for j in range(10): x = [ 0.1 * j + 0.05 ] y = [ 0.95 - 0.1 * i ] # Display the symbols plsym(x, y, base[l] + k) k = k + 1 if l < 2 : plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)") else : plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)") # Restore defaults #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/x11 755 1750 1750 216510233632313 164260ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw11 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x04.py 755 1750 1750 330111541217123 170510ustar andrewandrew#!/usr/bin/env python # # x04c.c # # Log plot demo. from numpy import * import math #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # main # # Illustration of logarithmic axes, and redefinition of window. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.pladv(0) w.plfont(2) f0 = 1000.0 freql = zeros(101,'d'); ampl = zeros(101,'d'); phase=zeros(101,'d') ## freql = [] ## ampl = [] ## phase = [] for i in range(101): ## freql.append(1.0 + i / 20.0) freql[i] = 1.0 + i / 20.0 ## freq = pow(10.0, freql[i]) freq = pow( 10.0, freql[i] ) ## ampl.append( ## 20.0 * math.log10(1.0 / math.sqrt(1.0 + pow((freq / f0), 2.))) ## ) ampl[i] = 20.0 * math.log10(1.0 / math.sqrt(1.0 + pow((freq / f0), 2.))) ## phase.append(-(180.0 / math.pi) * math.atan(freq / f0)) phase[i] = -(180.0 / math.pi) * math.atan(freq / f0) w.plvpor(0.15, 0.85, 0.1, 0.9) w.plwind(1.0, 6.0, -80.0, 0.0) w.plcol0(1) w.plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0) w.plcol0(2) w.plline(freql, ampl) w.plcol0(1) w.plptex(5.0, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade") w.plwind(1.0, 6.0, -100.0, 0.0) w.plbox("", 0.0, 0, "cmstv", 30.0, 3) w.plcol0(3) w.plline(freql, phase) w.plcol0(1) w.plmtex("b", 3.2, 0.5, 0.5, "Frequency") w.plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter") w.plcol0(2) w.plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)") w.plcol0(3) w.plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)") w.pleop() ##main() plplot-5.10.0+dfsg/examples/python/test_linebreak.py 755 1750 1750 174211746355574 214640ustar andrewandrew#!/usr/bin/env python # -*- coding: utf-8; -*- # Test whether line breaks work for utf8 "Peace" strings. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Taken from http://www.columbia.edu/~fdc/pace/ peace = [ "和平 (Mandarin)", "शांति (Hindi)", "Peace (English)", "שלום (Hebrew)", "Мир (Russian)", "Friede (German)", "평화 (Korean)", "Paix (French)", "Paz (Spanish)", "ﺳﻼم (Arabic)", "Barış (Turkish)", "Hasîtî (Kurdish)", ] # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() plcol0(2) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0., 1., 0., 1.) # Just to show edges of viewport plbox("bc", 0., 0, "bc", 0., 0) plcol0(1) plschr(0., 1.4) for i in arange(6): plptex(0.01, 0.90 - 0.16*i, 1., 0., 0., peace[2*i] + "\n" + peace[2*i+1]) plend() plplot-5.10.0+dfsg/examples/python/test_plplot_encodings.py 755 1750 1750 155211304070515 230450ustar andrewandrew#!/usr/bin/env python # -*- coding: utf-8; -*- # Test whether utf8 and PLplot #[0x...] unicode encoding give same result. # Also test whether # form works to change font # characteristics on the fly. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() plcol0(2) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0., 1., 0., 1.) # Just to show edges of viewport plbox("bc", 0., 0, "bc", 0., 0) plcol0(1) plschr(0., 2.) plptex(0.5, 0.5, 1., 0., 0.5, "##[0x222e] is a path integral sign.") # semitransparent green. plscol0a(2, 0, 255, 0, 0.5) plcol0(2) plptex(0.5, 0.5, 1., 0., 0.5, "#∮ is a path integral sign.") plend() plplot-5.10.0+dfsg/examples/python/xw31.py 755 1750 1750 1656611543675237 173210ustar andrewandrew#!/usr/bin/env python # $Id: xw31.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2008 Alan W. Irwin # Set/get tester. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Test setting / getting familying parameters before plinit # Save values set by plparseopts to be restored later. (fam0, num0, bmax0) = plgfam() fam1 = False num1 = 10 bmax1 = 1000 plsfam(fam1, num1, bmax1) # Retrieve the same values? (fam2, num2, bmax2) = plgfam() sys.stdout.write("family parameters: fam, num, bmax = %d %d %d\n" % (fam2, num2, bmax2)) if fam2 != fam1 or num2 != num1 or bmax2 != bmax1: sys.stderr.write("plgfam test failed\n") status = 1 # Restore values set initially by plparseopts. plsfam(fam0, num0, bmax0) # Test setting / getting page parameters before plinit. # Save values set by plparseopts to be restored later. (xp0, yp0, xleng0, yleng0, xoff0, yoff0) = plgpage() xp1 = 200. yp1 = 200. xleng1 = 400 yleng1 = 200 xoff1 = 10 yoff1 = 20 plspage(xp1, yp1, xleng1, yleng1, xoff1, yoff1) (xp2, yp2, xleng2, yleng2, xoff2, yoff2) = plgpage() sys.stdout.write("page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d\n" % (xp2, yp2, xleng2, yleng2, xoff2, yoff2)) if xp2 != xp1 or yp2 != yp1 or xleng2 != xleng1 or yleng2 != yleng1 or xoff2 != xoff1 or yoff2 != yoff1: sys.stderr.write("plgpage test failed\n") status = 1 # Restore values set initially by plparseopts. plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) # Test setting / getting compression parameter across plinit. compression1 = 95 plscompression(compression1) # Initialize plplot plinit() from plplot_py_demos import * def main(): status = 0 # Test if device initialization screwed around with the preset # compression parameter. compression2 = plgcompression() sys.stdout.write("Output various PLplot parameters\n") sys.stdout.write("compression parameter = %d\n" % compression2) if compression2 != compression1: sys.stderr.write("plgcompression test failed\n") status = 1 # Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure # they work without any obvious error messages. plscolor(1) plscol0(1, 255, 0, 0) r1 = [0, 255] g1 = [255, 0] b1 = [0, 0] a1 = [1.0, 1.0] plscmap1(r1,g1,b1) plscmap1a(r1,g1,b1,a1) level2 = plglevel() sys.stdout.write("level parameter = %d\n" % level2) if level2 != 1: sys.stderr.write("plglevel test failed.\n") status = 1 pladv(0) plvpor(0.01, 0.99, 0.02, 0.49) (xmin, xmax, ymin, ymax) = plgvpd() sys.stdout.write("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f\n" % (xmin, xmax, ymin, ymax)) if xmin != 0.01 or xmax != 0.99 or ymin != 0.02 or ymax != 0.49: sys.stderr.write("plgvpd test failed\n") status = 1 xmid = 0.5*(xmin+xmax) ymid = 0.5*(ymin+ymax) plwind(0.2, 0.3, 0.4, 0.5) (xmin, xmax, ymin, ymax) = plgvpw() sys.stdout.write("plwind: xmin, xmax, ymin, ymax = %f %f %f %f\n" % (xmin, xmax, ymin, ymax)) if xmin != 0.2 or xmax != 0.3 or ymin != 0.4 or ymax != 0.5: sys.stderr.write("plgvpw test failed\n") status = 1 # Get world coordinates for middle of viewport (wx, wy, win) = plcalc_world(xmid,ymid) sys.stdout.write("world parameters: wx, wy, win = %f %f %d\n" % (wx, wy, win)) if abs(wx-0.5*(xmin+xmax)) > 1.0E-5 or abs(wy-0.5*(ymin+ymax)) > 1.0E-5: sys.stderr.write("plcalc_world test failed\n") status = 1 # Retrieve and print the name of the output file (if any) fnam = plgfnam() if fnam == '' : sys.stdout.write("No output file name is set\n") else : sys.stdout.write("Output file name read\n") sys.stderr.write("Output file name is %s\n" % fnam) # Set and get the number of digits used to display axis labels # Note digits is currently ignored in pls[xyz]ax and # therefore it does not make sense to test the returned value. plsxax(3,0) (digmax, digits) = plgxax() sys.stdout.write("x axis parameters: digmax, digits = %d %d\n" % (digmax, digits)) if digmax != 3: sys.stderr.write("plgxax test failed\n") status = 1 plsyax(4,0) (digmax, digits) = plgyax() sys.stdout.write("y axis parameters: digmax, digits = %d %d\n" % (digmax, digits)) if digmax != 4: sys.stderr.write("plgyax test failed\n") status = 1 plszax(5,0) (digmax, digits) = plgzax() sys.stdout.write("z axis parameters: digmax, digits = %d %d\n" % (digmax, digits)) if digmax != 5: sys.stderr.write("plgzax test failed\n") status = 1 plsdidev(0.05, PL_NOTSET, 0.1, 0.2) (mar, aspect, jx, jy) = plgdidev() sys.stdout.write("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n" % (mar, aspect, jx, jy)) if mar != 0.05 or jx != 0.1 or jy != 0.2: sys.stderr.write("plgdidev test failed\n") status = 1 plsdiori(1.0) ori = plgdiori() sys.stdout.write("ori parameter = %f\n" % ori) if ori != 1.0 : sys.stderr.write("plgdiori test failed\n") status = 1 plsdiplt(0.1, 0.2, 0.9, 0.8) (xmin, ymin, xmax, ymax) = plgdiplt() sys.stdout.write("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n" % (xmin, ymin, xmax, ymax)) if xmin != 0.1 or xmax != 0.9 or ymin != 0.2 or ymax != 0.8: sys.stderr.write("plgdiplt test failed\n") status = 1 plsdiplz(0.1, 0.1, 0.9, 0.9) (zxmin, zymin, zxmax, zymax) = plgdiplt() sys.stdout.write("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n" % (zxmin, zymin, zxmax, zymax)) if abs(zxmin -(xmin + (xmax-xmin)*0.1)) > 1.0E-5 or abs(zxmax -(xmin+(xmax-xmin)*0.9)) > 1.0E-5 or abs(zymin -(ymin+(ymax-ymin)*0.1)) > 1.0E-5 or abs(zymax -(ymin+(ymax-ymin)*0.9)) > 1.0E-5 : sys.stderr.write("plsdiplz test failed\n") status = 1 plscolbg(10,20,30) (r, g, b) = plgcolbg() sys.stdout.write("background colour parameters: r, g, b = %d %d %d\n" % (r, g, b)) if r != 10 or g != 20 or b != 30: sys.stderr.write("plgcolbg test failed\n") status = 1 plscolbga(20, 30, 40, 0.5) (r, g, b, a) = plgcolbga() sys.stdout.write("background/transparency colour parameters: r, g, b, a = %d %d %d %f\n" % (r, g, b, a)) if r != 20 or g != 30 or b != 40 or a != 0.5: sys.stderr.write("plgcolbga test failed\n") status = 1 # Restore defaults #plcol0(1) if status != 0 : sys.exit(status) main() # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x10 755 1750 1750 216510233632313 164250ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw10 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x23 755 1750 1750 217310233632313 164300ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004, 2005 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw23 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw03.py 644 1750 1750 407111543675237 172610ustar andrewandrew# $Id: xw03.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Polar plot demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Generates polar plot, with 1-1 scaling. def main(): dtr = pi / 180.0 x0 = cos(dtr*arange(361)) y0 = sin(dtr*arange(361)) # Set up viewport and window, but do not draw box plenv(-1.3, 1.3, -1.3, 1.3, 1, -2) # Draw circles for polar grid for i in range(10): plarc(0.0, 0.0, 0.1*(i+1), 0.1*(i+1), 0.0, 360.0, 0.0, 0) plcol0(2) for i in range(12): theta = 30.0 * i dx = cos(dtr * theta) dy = sin(dtr * theta) # Draw radial spokes for polar grid pljoin(0.0, 0.0, dx, dy) # Write labels for angle text = `int(theta)` if theta < 9.99: offset = 0.45 elif theta < 99.9: offset = 0.30 else: offset = 0.15 #Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if dx >= -0.00001: plptex(dx, dy, dx, dy, -offset, text) else: plptex(dx, dy, -dx, -dy, 1.+offset, text) # Draw the graph r = sin((dtr*5.)*arange(361)) x = x0*r y = y0*r plcol0(3) plline(x, y) plcol0(4) plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh") # Restore defaults #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/x06.py 755 1750 1750 231211541217123 170540ustar andrewandrew#!/usr/bin/env python # # x06c.c # # Font demo. #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # main # # Displays the entire "plpoin" symbol (font) set. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.pladv(0) # Set up viewport and window w.plcol0(2) w.plvpor(0.1, 1.0, 0.1, 0.9) w.plwind(0.0, 1.0, 0.0, 1.3) # Draw the grid using plbox w.plbox("bcg", 0.1, 0, "bcg", 0.1, 0) # Write the digits below the frame w.plcol0(15) for i in range(10): w.plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, `i`) k = 0 for i in range(13): # Write the digits to the left of the frame w.plmtex("lv", 1.0, (1.0 - (2 * i + 1) / 26.0), 1.0, `10 * i`) for j in range(10): x = 0.1 * j + 0.05 y = 1.25 - 0.1 * i # Display the symbol (plpoin expects that x # and y are arrays so pass lists) if k < 128: w.plpoin([x], [y], k) k = k + 1 w.plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols") w.pleop() ## w.plend() ## ##main() plplot-5.10.0+dfsg/examples/python/x18 755 1750 1750 216510233632313 164350ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw18 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xtkpy 755 1750 1750 1054711434724443 172310ustar andrewandrew#!/usr/bin/env python # This is a Python/Tk toolbar to run the Python demos. Perhpas # eventually we will be able to have plframe in a Python/Tk context. from Tkinter import * import string class PyDemo(Frame): def __init__(self, master=None): Frame.__init__(self,master) self.create_demo_bar() self.pack() def create_demo_bar(s): # Build a button for each PLplot python example program. s.x01 = Button( s, { "text" : "Example 1", "command" : s.x01m } ) s.x02 = Button( s, { "text" : "Example 2", "command" : s.x02m } ) s.x03 = Button( s, { "text" : "Example 3", "command" : s.x03m } ) s.x04 = Button( s, { "text" : "Example 4", "command" : s.x04m } ) s.x05 = Button( s, { "text" : "Example 5", "command" : s.x05m } ) s.x06 = Button( s, { "text" : "Example 6", "command" : s.x06m } ) s.x07 = Button( s, { "text" : "Example 7", "command" : s.x07m } ) s.x08 = Button( s, { "text" : "Example 8", "command" : s.x08m } ) s.x09 = Button( s, { "text" : "Example 9", "command" : s.x09m } ) s.x10 = Button( s, { "text" : "Example 10", "command" : s.x10m } ) s.x11 = Button( s, { "text" : "Example 11", "command" : s.x11m } ) s.x12 = Button( s, { "text" : "Example 12", "command" : s.x12m } ) s.x13 = Button( s, { "text" : "Example 13", "command" : s.x13m } ) s.x14 = Button( s, { "text" : "Example 14", "command" : s.x14m } ) s.x15 = Button( s, { "text" : "Example 15", "command" : s.x15m } ) s.x16 = Button( s, { "text" : "Example 16", "command" : s.x16m } ) s.x17 = Button( s, { "text" : "Example 17", "command" : s.x17m } ) s.x18 = Button( s, { "text" : "Example 18", "command" : s.x18m } ) s.x19 = Button( s, { "text" : "Example 19", "command" : s.x19m } ) # Now pack them all. s.x01.pack() s.x02.pack() s.x03.pack() s.x04.pack() s.x05.pack() s.x06.pack() s.x07.pack() s.x08.pack() s.x09.pack() s.x10.pack() s.x11.pack() s.x12.pack() s.x13.pack() s.x14.pack() s.x15.pack() s.x16.pack() s.x17.pack() s.x18.pack() s.x19.pack() # It sure seems to me that it ought to have been possible to do this # dynamically, but I couldn't get it to work. The following was my # feeble effort, but it failed b/c I could never figure out how to get # the command action to bind to the method I was trying to define in # this class. Very annoying. ## for i in range(2,5): ## n = string.zfill( `i`, 2 ) ## print i, "fn will be x" + n + "m" ## exec( "def x"+n+"m(s): import x"+n+"; x"+n+".main()", ## globals(), locals() ) ## #### exec( """ #### def x""" + n + """m(s): #### print "xxx" """ ) ## ## exec( "s.x" + n + " = Button( s, {" + ## "'text' : 'Example " + `i` + "'," + ## "'command' : s.x" + n + "m" + ## "} )", globals(), locals() ) ## exec( "s.x"+ n +".pack()" ) ## #### exec( "s.x"+`i`+" = Button(s, {" + #### "'text' : 'Example " + `i` + "'," + #### "'command' : s.x"+`i` + "m" + #### "} )" ) ## #### exec( "def x" + `i` +"m(s): #### import x" + # Don't forget the quit button! s.quit = Button( s, { "text" : "Quit", "command" : s.quit } ) s.quit.pack() # Build some methods for all the button actions, which run the # corresponding demo. Unfortunately, this isn't really doing what I # want. What I want si to run the demo. If I use execfile, there si # some nonsense about it not running in the right namespace or # something. I can't understand. If I use import, they work, but on # second invocations nothing is done. If I add an explicit call to # x01.main() here, then it runs twice the first time, once # thereafter. Can't win. Obviously there is something I don't # understand about the Python execution model. Probably the # difficulties with dynamically defining the methods are all bundled # up in the same problem here. def x01m(s): import x01 def x02m(s): import x02 def x03m(s): import x03 def x04m(s): import x04 def x05m(s): import x05 def x06m(s): import x06 def x07m(s): import x07 def x08m(s): import x08 def x09m(s): import x09 def x10m(s): import x10 def x11m(s): import x11 def x12m(s): import x12 def x13m(s): import x13 def x14m(s): import x14 def x15m(s): import x15 def x16m(s): import x16 def x17m(s): import x17 def x18m(s): import x18 def x19m(s): import x19 demoapp = PyDemo() demoapp.mainloop() plplot-5.10.0+dfsg/examples/python/x28 755 1750 1750 220010677527573 164530ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004, 2005, 2006 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw28 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw06.py 644 1750 1750 470111543675237 172640ustar andrewandrew# $Id: xw06.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Font demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * # main # # Displays the entire "plpoin" symbol (font) set. def main(): for kind_font in range(2): plfontld( kind_font ) if kind_font == 0 : maxfont = 1 else : maxfont = 4 for font in range(maxfont): plfont( font + 1 ) pladv(0) # Set up viewport and window plcol0(2) plvpor(0.1, 1.0, 0.1, 0.9) plwind(0.0, 1.0, 0.0, 1.3) # Draw the grid using plbox plbox("bcg", 0.1, 0, "bcg", 0.1, 0) # Write the digits below the frame plcol0(15) for i in range(10): plmtex("b", 1.5, (0.1 * i + 0.05), 0.5, `i`) k = 0 for i in range(13): # Write the digits to the left of the frame plmtex("lv", 1.0, (1.0 - (2 * i + 1) / 26.0), 1.0, `10 * i`) for j in range(10): x = 0.1 * j + 0.05 y = 1.25 - 0.1 * i # Display the symbol (plpoin expects that x # and y are arrays so pass lists) if k < 128: plpoin([x], [y], k) k = k + 1 if kind_font == 0 : plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)") else : plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)") # Restore defaults #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/xw15.py 644 1750 1750 1107012140522542 172610ustar andrewandrew# $Id: xw15.py 12323 2013-05-02 17:41:54Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # Shade plot demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * XPTS = 35 # Data points in x YPTS = 46 # Data points in y def main(): # Does a variety of shade plots with discrete colours and patterns. # Do not fiddle with cmap1 since this example actually uses cmap0. # Furthermore, if you do fiddle with cmap1, it will screw up other # plots (unless you return to default cmap1 like is done with eighth # example. x = (arange(XPTS) - (XPTS / 2)) / float(XPTS / 2) y = ((arange(YPTS) - (YPTS / 2)) / float(YPTS / 2)) - 1. x.shape = (-1,1) z = x*x - y*y + (x - y)/(x*x+y*y + 0.1) x.shape = (-1,) zmin = min(z.flat) zmax = max(z.flat) plot1(z, zmin, zmax) plot2(z, zmin, zmax) plot3() # Restore defaults #plcol0(1) def plot1(z, zmin, zmax): # Illustrates a single shaded region pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) shade_min = zmin + (zmax-zmin)*0.4 shade_max = zmin + (zmax-zmin)*0.6 sh_cmap = 0 sh_color = 7 sh_width = 2. min_color = 9 min_width = 2. max_color = 2 max_width = 2. plpsty(8) # Just use identity transform on indices of z mapped to -1, 1 range # in X and Y coordinates plshade( z, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1, None, None) plcol0(1) plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0) plcol0(2) pllab("distance", "altitude", "Bogon flux") def plot2(z, zmin, zmax): # Illustrates multiple adjacent shaded regions, using different fill # patterns for each region. nlin = array( [1, 1, 1, 1, 1, 2, 2, 2, 2, 2] ) inc = array( [ [450, 0], [-450, 0], [0, 0], [900, 0], [300, 0], [450,-450], [0, 900], [0, 450], [450, -450], [0, 900] ] ) spa = array( [ [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [4000, 4000], [4000, 2000] ] ) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) sh_cmap = 0 sh_width = 2. min_color = 0 min_width = 0. max_color = 0 max_width = 0. for i in range(10): shade_min = zmin + (zmax - zmin) * i / 10.0 shade_max = zmin + (zmax - zmin) * (i +1) / 10.0 sh_color = i+6 n = nlin[i] plpat(inc[i][0:n], spa[i][0:n]) # Just use identity transform on indices of z mapped to -1, 1 range # in X and Y coordinates plshade( z, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, 1, None, None) plcol0(1) plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0) plcol0(2) pllab("distance", "altitude", "Bogon flux") def plot3(): # Illustrates shaded regions in 3d, using a different fill pattern for # each region. xx = array( [ [-1.0, 1.0, 1.0, -1.0, -1.0], [-1.0, 1.0, 1.0, -1.0, -1.0] ] ) yy = array( [ [1.0, 1.0, 0.0, 0.0, 1.0], [-1.0, -1.0, 0.0, 0.0, -1.0] ] ) zz = array( [ [0.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0] ] ) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) plw3d(1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40) # Plot using identity transform plcol0(1) plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0) plcol0(2) pllab("","","3-d polygon filling") plcol0(3) plpsty(1) plline3(xx[0], yy[0], zz[0]) plfill3(xx[0][0:4], yy[0][0:4], zz[0][0:4]) plpsty(2) plline3(xx[1], yy[1], zz[1]) plfill3(xx[1][0:4], yy[1][0:4], zz[1][0:4]) main() plplot-5.10.0+dfsg/examples/python/xw26.py 644 1750 1750 1552012140522542 172670ustar andrewandrew# -*- coding: utf-8; -*- # $Id: xw26.py 12323 2013-05-02 17:41:54Z airwin $ # Copyright (C) 2006-2010 Alan W. Irwin # Multi-lingual version of the first page of example 4. # Thanks to the following for providing translated strings for this example: # Valery Pipin (Russian) # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # This example designed just for devices (e.g., psttfc and the # cairo-related devices) that use the pango and fontconfig libraries. The # best choice of glyph is selected by fontconfig and automatically rendered # by pango in way that is sensitive to complex text layout (CTL) language # issues for each unicode character in this example. Of course, you must # have the appropriate TrueType fonts installed to have access to all the # required glyphs. # # Translation instructions: The strings to be translated are given by # x_label, y_label, alty_label, title_label, and line_label below. The encoding # used must be UTF-8. # The following strings to be translated involve some scientific/mathematical jargon # which is now discussed further to help translators. # (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . # (2) degrees is an angular measure, see http://en.wikipedia.org/wiki/Degree_(angle) . # (3) low-pass filter is one that transmits (passes) low frequencies. # (4) pole is in the mathematical sense, see # http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" # means a particular mathematical transformation of the filter function has # a single pole, see # http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . Furthermore, # a single-pole filter must have an inverse square decline (or -20 db/decade). # Since the filter plotted here does have that characteristic, it must by # definition be a single-pole filter, see also # http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm # (5) decade represents a factor of 10, see # http://en.wikipedia.org/wiki/Decade_(log_scale) . from plplot_py_demos import * # main # # Illustration of first page of example 4 in different languages. def main(): x_label = [\ "Frequency",\ "Частота",\ ] y_label = [\ "Amplitude (dB)",\ "Амплитуда (dB)",\ ] alty_label = [\ "Phase shift (degrees)",\ "Фазовый сдвиг (градусы)",\ ] # Short rearranged versions of y_label and alty_label. legend_text = [\ [ "Amplitude", "Phase shift"],\ [ "Амплитуда", "Фазовый сдвиг" ],\ ] title_label = [\ "Single Pole Low-Pass Filter",\ "Однополюсный Низко-Частотный Фильтр",\ ] line_label = [\ "-20 dB/decade",\ "-20 dB/десяток",\ ] nlang = len(x_label) if len(y_label) != nlang or \ len(alty_label) != nlang or \ len(title_label) != nlang or \ len(line_label) != nlang: raise RuntimeError, "Internal inconsistency in label dimension" plfont(2) for i in range(nlang): plot1(0, x_label[i], y_label[i], alty_label[i], \ title_label[i], line_label[i], legend_text[i]) # Restore defaults plfont(1) #plcol0(1) def plot1(type, x_label, y_label, alty_label, title_label, line_label, legend_text): pladv(0) f0 = 1.0 freql = -2.0 + arange(101)/20.0 freq = pow(10.0, freql) ampl = 20.0 * log10(1.0 / sqrt(1.0 + pow((freq / f0), 2.))) phase = -(180.0 / pi) * arctan(freq / f0) plvpor(0.15, 0.85, 0.1, 0.9) plwind(-2., 3.0, -80.0, 0.0) plcol0(1) if type == 0: plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0) elif type == 1: plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0) else: print "error: type must be either 0 or 1" plcol0(2) plline(freql, ampl) plcol0(2) plptex(1.6, -30.0, 1.0, -20.0, 0.5, line_label) # Put labels on plcol0(1) plmtex("b", 3.2, 0.5, 0.5, x_label) plmtex("t", 2.0, 0.5, 0.5, title_label) plcol0(2) plmtex("l", 5.0, 0.5, 0.5, y_label) # For the gridless case, put phase vs freq on same plot if type == 0: plcol0(1) plwind(-2.0, 3.0, -100.0, 0.0) plbox("", 0.0, 0, "cmstv", 30.0, 3) plcol0(3) plline(freql, phase) plstring(freql, phase, "*") plcol0(3) plmtex("r", 5.0, 0.5, 0.5, alty_label) nlegend = 2 else: nlegend = 1 # Draw a legend. # Set up legend arrays with the correct size, type. # legend_text is already supplied by argument. opt_array = zeros(nlegend, "int") # Be generous with size of string since raw UTF-8 is involved. text = zeros(nlegend, "S100") text_colors = zeros(nlegend, "int") box_colors = zeros(nlegend, "int") box_patterns = zeros(nlegend, "int") box_scales = zeros(nlegend) box_line_widths = zeros(nlegend) line_colors = zeros(nlegend, "int") line_styles = zeros(nlegend, "int") line_widths = zeros(nlegend) symbol_colors = zeros(nlegend, "int") symbol_scales = zeros(nlegend) symbol_numbers = zeros(nlegend, "int") symbols = zeros(nlegend, "S10") # Only specify legend data that are required according to the # value of opt_array for that entry. # Data for first legend entry. opt_array[0] = PL_LEGEND_LINE text_colors[0] = 2 text[0] = legend_text[0] line_colors[0] = 2 line_styles[0] = 1 line_widths[0] = 1. # Data for second legend entry. if nlegend > 1: opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL text_colors[1] = 3 text[1] = legend_text[1] line_colors[1] = 3 line_styles[1] = 1 line_widths[1] = 1. symbol_colors[1] = 3 symbol_scales[1] = 1. symbol_numbers[1] = 4 symbols[1] = "*" plscol0a( 15, 32, 32, 32, 0.70 ) (legend_width, legend_height) = \ pllegend( PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ) main() plplot-5.10.0+dfsg/examples/python/x24 755 1750 1750 216510241212617 164320ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw24 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/README.plplotcanvas 644 1750 1750 103610217560145 214550ustar andrewandrew PLPLOTCANVAS EXAMPLES ~~~~~~~~~~~~~~~~~~~~~ The PlplotCanvas examples are: plplotcanvas_demo.py plplotcanvas_animation.py The are not part of the general PLplot testbed of examples, but are instead designed to demonstrate the use of the GCW "Gnome Canvas Widget" driver to embed plots in Gnome/GTK applications. PlplotCanvas is a special GnomeCanvas-based widget that provides an easy-to-use object-oriented interface for this task. Both GCW and PlplotCanvas are described in detail in the PLplot Programmer's Reference Manual. plplot-5.10.0+dfsg/examples/python/xw16.py 644 1750 1750 2177612147245131 173030ustar andrewandrew# $Id: xw16.py 12347 2013-05-22 22:44:41Z andrewross $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # plshade demo, using color fill. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * NS = 20 NX = 35 NY = 46 PERIMETERPTS = 100 NUM_AXES = 1 NUM_LABELS = 1 XSPA = 2./(NX-1) YSPA = 2./(NY-1) tr = array((XSPA, 0.0, -1.0, 0.0, YSPA, -1.0)) def mypltr(x, y, data): result0 = data[0] * x + data[1] * y + data[2] result1 = data[3] * x + data[4] * y + data[5] return array((result0, result1)) def main(): fill_width = 2. cont_color = 0 cont_width = 0. n_axis_opts = NUM_AXES axis_opts = zeros(NUM_AXES,"S100") axis_opts[0] = "bcvtm" num_values = zeros(NUM_AXES,"int"); values = reshape(zeros(NUM_AXES*(NS+1)),[NUM_AXES,NS+1]) axis_ticks = zeros(NUM_AXES) axis_subticks = zeros(NUM_AXES,"int") n_labels = NUM_LABELS label_opts = zeros(NUM_LABELS,"int") labels = zeros(NUM_LABELS,"S100") label_opts[0] = PL_COLORBAR_LABEL_BOTTOM labels[0] = "Magnitude" # Set up data array x = (arange(NX) - (NX/2)) / float(NX/2) x.shape = (-1,1) y = (arange(NY) - (NY/2)) / float(NY/2) - 1. zz = -sin(7.*x) * cos(7.*y) + x*x - y*y ww = -cos(7.*x) * sin(7.*y) + 2.*x*y zmin = min(zz.flat) zmax = max(zz.flat) clevel = zmin + (zmax - zmin) * (arange(NS)+0.5)/NS shedge = zmin + (zmax - zmin) * (arange(NS+1))/NS # Build the identity transformation between grid and world coordinates # using mypltr. # Note that *for the given* tr, mypltr(i,j,tr)[0] is only a function of i # and mypltr(i,j,tr)[1] is only function of j. xg0 = mypltr(arange(NX),0,tr)[0] yg0 = mypltr(0,arange(NY),tr)[1] # Build the 1-d coord arrays. distort = .4 xx = xg0 xg1 = xx + distort * cos( .5 * pi * xx ) yy = yg0 yg1 = yy - distort * cos( .5 * pi * yy ) # Build the 2-d coord arrays. xx.shape = (-1,1) xg2 = xx + distort*cos((0.5*pi)*xx)*cos((0.5*pi)*yy) yg2 = yy - distort*cos((0.5*pi)*xx)*cos((0.5*pi)*yy) # Plot using identity transform pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) plpsty(0) # Note another alternative to produce the identical result in a different way # is to use the command: # plshades(zz, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, 1) # The above command works because xmin, xmax, ymin, and ymax do an effective # linear transformation on the index ranges. (We could have dropped # xmin, xmax, ymin, ymax since the defaults are -1.0, 1.0, -1.0, 1.0, but # for pedagogical reasons we left them in.) The alternative below using # mypltr does the exact same linear transformation because of the way that # the tr array has been defined. Note that when pltr and pltr_data are # defined, xmin, xmax, ymin, ymax are completely ignored so we can drop # them from the argument list. plshades(zz, shedge, fill_width, 1, mypltr, tr) # Smaller text plschr(0.0, 0.75 ) # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ) plsmin( 0.0, 0.5 ) num_values[0] = NS + 1 values[0] = shedge (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) # Reset text and tick sizes plschr( 0.0, 1.0 ) plsmaj( 0.0, 1.0 ) plsmin( 0.0, 1.0 ) plcol0(1) plbox( "bcnst", 0., 0, "bcnstv", 0., 0 ) plcol0(2) pllab( "distance", "altitude", "Bogon density" ) # Plot using 1d coordinate transform plspal0("cmap0_black_on_white.pal") plspal1("cmap1_blue_yellow.pal",1) plscmap0n(3) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) plpsty(0) plshades(zz, shedge, fill_width, 1, pltr1, xg1, yg1) # Smaller text plschr(0.0, 0.75 ) # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ) plsmin( 0.0, 0.5 ) num_values[0] = NS + 1 values[0] = shedge (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) # Reset text and tick sizes plschr( 0.0, 1.0 ) plsmaj( 0.0, 1.0 ) plsmin( 0.0, 1.0 ) plcol0(1) plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ) plcol0(2) pllab( "distance", "altitude", "Bogon density" ) # Plot using 2d coordinate transform plspal0("cmap0_black_on_white.pal") plspal1("cmap1_blue_red.pal",1) plscmap0n(3) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) plpsty(0) plshades(zz, shedge, fill_width, 0, pltr2, xg2, yg2) # Smaller text plschr(0.0, 0.75 ) # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ) plsmin( 0.0, 0.5 ) num_values[0] = NS + 1 values[0] = shedge (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) # Reset text and tick sizes plschr( 0.0, 1.0 ) plsmaj( 0.0, 1.0 ) plsmin( 0.0, 1.0 ) plcol0(1) plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ) plcol0(2) plcont(ww, clevel, pltr2, xg2, yg2) pllab( "distance", "altitude", "Bogon density, with streamlines" ) # Plot using 2d coordinate transform (with contours generated by plshades) plspal0("") plspal1("",1) plscmap0n(3) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) plpsty(0) # Note default cont_color and cont_width are zero so that no contours # are done with other calls to plshades. But for this call we specify # non-zero values so that contours are drawn. plshades(zz, shedge, fill_width, 2, 3.0, 0, pltr2, xg2, yg2) # Smaller text plschr(0.0, 0.75 ) # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ) plsmin( 0.0, 0.5 ) num_values[0] = NS + 1 values[0] = shedge (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3.0, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) # Reset text and tick sizes plschr( 0.0, 1.0 ) plsmaj( 0.0, 1.0 ) plsmin( 0.0, 1.0 ) plcol0(1) plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ) plcol0(2) # plcont(ww, clevel, "pltr2", xg2, yg2, 0) pllab( "distance", "altitude", "Bogon density" ) # Example with polar coordinates that demonstrates python wrap support. plspal0("cmap0_black_on_white.pal") plspal1("cmap1_gray.pal",1) plscmap0n(3) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(-1.0, 1.0, -1.0, 1.0) # Build new coordinate matrices. r = arange(NX)/(NX-1.) r.shape = (-1,1) t = (2.*pi/(NY-1.))*arange(NY-1) xg = r*cos(t) yg = r*sin(t) z = exp(-r*r)*cos(5.*pi*r)*cos(5.*t) # Need a new shedge to go along with the new data set. zmin = min(z.flat) zmax = max(z.flat) shedge = zmin + ((zmax - zmin)/NS) * (arange(NS+1)) plpsty(0) # Now we can shade the interior region. Use wrap=2 to simulate additional # point at t = 2 pi. plshades(z, shedge, fill_width, 0, pltr2, xg, yg, 2) # Smaller text plschr(0.0, 0.75 ) # Small ticks on the vertical axis plsmaj( 0.0, 0.5 ) plsmin( 0.0, 0.5 ) num_values[0] = NS + 1 values[0] = shedge (colorbar_width, colorbar_height) = plcolorbar ( PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values) # Reset text and tick sizes plschr( 0.0, 1.0 ) plsmaj( 0.0, 1.0 ) plsmin( 0.0, 1.0 ) # Now we can draw the perimeter. (If do before, plshades may overlap.) t = 2.*pi*arange(PERIMETERPTS)/(PERIMETERPTS-1.) px = cos(t) py = sin(t) plcol0(1) plline( px, py ) # And label the plot. plcol0(2) pllab( "", "", "Tokamak Bogon Instability" ) # Restore defaults #plcol0(1) main() plplot-5.10.0+dfsg/examples/python/x19 755 1750 1750 216510461437121 164410ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw19 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw30.py 644 1750 1750 676511543675237 172750ustar andrewandrew# $Id: xw30.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2008 Hazen Babcock # Copyright (C) 2008 Andrew Ross # Alpha color values demonstration. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * red = array([ 0, 255, 0, 0]) green = array([ 0, 0, 255, 0]) blue = array([ 0, 0, 0, 255]) alpha = array([1.0, 1.0, 1.0, 1.0]) pos = array([0.0, 1.0]) rcoord = array([1.0, 1.0]) gcoord = array([0.0, 0.0]) bcoord = array([0.0, 0.0]) acoord = array([0.0, 1.0]) rev = array([0, 0]) def main(): px = array([0.1, 0.5, 0.5, 0.1]) py = array([0.1, 0.1, 0.5, 0.5]) plscmap0n (4) plscmap0a (red, green, blue, alpha) # # Page 1: # # This is a series of red, green and blue rectangles overlaid # on each other with gradually increasing transparency. # Set up the window pladv (0) plvpor (0.0, 1.0, 0.0, 1.0) plwind (0.0, 1.0, 0.0, 1.0) plcol0 (0) plbox ("", 1.0, 0, "", 1.0, 0) # Draw the boxes for i in range(9): icol = i%3 + 1 # Get a color, change its transparency and # set it as the current color. rgba = plgcol0a (icol) plscol0a (icol, rgba[0], rgba[1], rgba[2], 1.0 - float(i)/9.0) plcol0 (icol) # Draw the rectangle plfill (px, py) # Shift the rectangles coordinates px += 0.5/9.0 py += 0.5/9.0 # # Page 2: # # This is a bunch of boxes colored red, green or blue with a single # large (red) box of linearly varying transparency overlaid. The # overlaid box is completely transparent at the bottom and completely # opaque at the top. # Set up the window pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0.0, 1.0, 0.0, 1.0) # Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for i in range(5): # Set box X position px[0] = 0.05 + 0.2 * i px[1] = px[0] + 0.1 px[2] = px[1] px[3] = px[0] # We don't want the boxes to be transparent, so since we changed # the colors transparencies in the first example we have to change # the transparencies back to completely opaque. icol = i%3 + 1 rgba = plgcol0a (icol) plscol0a (icol, rgba[0], rgba[1], rgba[2], 1.0) plcol0 (icol) for j in range(5): # Set box y position and draw the box. py[0] = 0.05 + 0.2 * j py[1] = py[0] py[2] = py[0] + 0.1 py[3] = py[2] plfill(px, py) # Create the color map with 128 colors and use plscmap1la to initialize # the color values with a linearly varying red transparency (or alpha) plscmap1n(128) plscmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev) # Use that cmap1 to create a transparent red gradient for the whole # window. px[0] = 0. px[1] = 1. px[2] = 1. px[3] = 0. py[0] = 0. py[1] = 0. py[2] = 1. py[3] = 1. plgradient(px, py, 90.) main() plplot-5.10.0+dfsg/examples/python/README.rendering_tests 644 1750 1750 1031411240631440 221570ustar andrewandrewWe have implemented a number of simple python standalone scripts to test for rendering issues with our PLplot device drivers. N.B. these tests should not be propagated to other languages. python is ideal for rapid development and evaluation. Given this, it is expected these tests will change substantially over time and more tests will be added. Thus, propagating those expected changes to other languages is largely pointless. N.B. the SVG test results for "firefox", "konqueror", and "display" reported below at this time of writing (2009-08-12) are for Debian Lenny where firefox is iceweasel Version 2.0.0.14-2, konqueror is Version 4:3.5.9.dfsg.1-6, and by default display (Version 7:6.3.7.9.dfsg2-1~lenny1) uses the rsvg2 GNOME library to render svg files. Your SVG viewing results will differ for other versions of firefox, konqueror, and display. They will also differ for other SVG-aware applications because SVG viewing and rendering within Linux is still a bit problematic, even though Linux is probably in better SVG shape than other platforms. * test_circle.py (only useful for testing unicode-aware devices) renders a series of "LARGE CIRCLE" and "BOX DRAWINGS LIGHT DIAGONAL CROSS" unicode characters from (very) large sizes to small sizes to check there is no vertical drift in the alignment of the characters, and also to check that very large versions of characters are rendered correctly. -dev xcairo results have good alignment and good character rendering. -dev svg results validate correctly at http://validator.w3.org/, have good alignment and good character rendering according to the ImageMagick "display" application and firefox, but those same results cannot be rendered by konqueror because it cannot find the appropriate system fonts. -dev qtwidget results have good alignment, but the large character rendering is not reliable ("squashed" left edge of "LARGE CIRCLE" for the three largest sizes, but no squashing at the smaller sizes). * testh.py renders a vertical line at the left edge of the window, a horizontal line marking the center of the vertical line, and a centred string of 7 "H" characters superimposed on top of the vertical line so the horizontal bar of the "H" is very close to the vertical line and parallel with it. All drivers we have tested generate correct interactive or file results for this figure. Also, the -dev svg output file validates at http://validator.w3.org/, and I get good rendering results for both firefox and konqueror for that output file. However, those output file results are _not_ rendered correctly by the GNOME library, librsvg2, which is used in a number of applications (e.g., all GNOME text rendering applications which are svg aware such as eog and (depending on how ImageMagick is compiled) the ImageMagick "display" application). See http://bugzilla.gnome.org/show_bug.cgi?id=525023 for more details. * test_superscript_subscript.py renders a series of nested superscripts and subscripts for single numbers from 0 to 9 and also tries some simple superscripts and subscripts for Greek letters and ordinary (Roman) letters. Devices that use our traditional Hershey fonts (e.g., -dev xwin) have good results for this example, but there is work to do to get similar good results for our more modern devices that use other means of superscripting and subscripting. The one current exception to this is -dev svg where the resulting output file validates at http://validator.w3.org/, and the dy attribute of the nested span tags is written correctly. Furthermore, I get good rendering results for this output file using the ImageMagick "display" application. However, in this case the vertical positioning after the Greek superscript or subscript letters in the output svg file is not rendered correctly by mozilla and konqueror. On the other hand, those applications have no trouble rendering the text after superscript/subscript Roman (ordinary) letters. It appears those applications are having trouble dealing with a nested series of span tags when there is a font change (e.g., for Greek letters) in the middle of the series. The results for the pdf, cairo, and qt devices for this example are poor (e.g., do not agree with the good -dev xwin results), but it is planned to deal with those issues soon. plplot-5.10.0+dfsg/examples/python/test_circle.py 755 1750 1750 445711706444371 207650ustar andrewandrew#!/usr/bin/env python # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * x = [0.5] y = [0.5] title = [ "Large Circle + Light Diagonal Cross with plptex", "Ascii Asterisk with plptex", "Plplot Encoded Unicode Indexed Asterisk with plptex", "Plplot Encoded Hershey Indexed Asterisk with plptex", "Asterisk with plsym", "Asterisk with plpoin", "Plplot Encoded Hershey Indexed Asterisk with plstring", ] ifunicode = True # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() for kind in range(7): pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0., 1., 0., 1.) # Just to show edges of viewport plcol0(1) plbox("bc", 0., 0, "bc", 0., 0) plcol0(2) plschr(0., 1.) plmtex("t", 1., 0.5, 0.5, title[kind]) k=0 for size in 2.**arange(2,-3,-1): k+=1 plcol0(k) if kind==0: if ifunicode: plschr(0., 4.*size) # LARGE CIRCLE has a centre of symmetry which is about one-eighth the # radius below the centre of symmetry of the box for DejaVu Sans. plptex(0.5, 0.5, 1., 0., 0.5, "#[0x25ef]") # BOX DRAWINGS LIGHT DIAGONAL CROSS is one of the best centred symmetrical # glyphs I have found using gucharmap for DejaVu Sans. plptex(0.5, 0.5, 1., 0., 0.5, "#[0x2573]") else: plschr(0., 4.*size) plptex(0.5, 0.5, 1., 0., 0.5, "#(907)") elif kind ==1: # Print an ascii asterisk using plptex plschr(0., 8.*size) plptex(0.5, 0.5, 1., 0., 0.5, "*") elif kind ==2: # Print a (PLplot encoded) unicode indexed asterisk using plptex plschr(0., 8.*size) plptex(0.5, 0.5, 1., 0., 0.5, "#[0x002a]") elif kind ==3: # Print a (PLplot encoded) Hershey indexed asterisk using plptex plschr(0., 8.*size) plptex(0.5, 0.5, 1., 0., 0.5, "#(728)") elif kind ==4: # Print an asterisk using plsym plssym(0., 8.*size) plsym(x, y, 728) elif kind ==5: # Print an asterisk using plpoin plssym(0., 8.*size) plpoin(x, y, 3) elif kind ==6: # Print a (PLplot encoded) Hershey indexed asterisk using plstring plschr(0., 8.*size) plstring(x, y, "#(728)") # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/testh.py 755 1750 1750 121111240631440 175610ustar andrewandrew#!/usr/bin/env python # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * from numpy import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() # Like yellow lines better. plcol0(2) pladv(0) plvpor(0.1, 0.9, 0.1, 0.9) plwind(0., 1., 0., 1.) x=0.*arange(2) y=1.*arange(2) plline(x,y) x=0.1*arange(2) y=0.5+0.*arange(2) plline(x,y) plschr(0., 4.) #plmtex("l", 0., 0.5, 0.5, "#[0x00d7]#[0x00d7]#[0x00d7]#[0x00d7]#[0x00d7]#[0x00d7]#[0x00d7]") plmtex("l", 0., 0.5, 0.5, "HHHHHHH") # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw20.py 644 1750 1750 1670612143270264 172740ustar andrewandrew# $Id: xw20.py 12340 2013-05-10 22:12:04Z andrewross $ # Copyright (C) 2007, 2008 Andrew Ross # plimage demo # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * import os.path import sys XDIM = 260 YDIM = 220 dbg = 0 nosombrero = 0 nointeractive = 0 f_name = "" def gray_cmap(num_col): r = [0.0, 1.0] g = [0.0, 1.0] b = [0.0, 1.0] pos = [0.0, 1.0] plscmap1n(num_col) plscmap1l(1, pos, r, g, b) def save_plot(fname): # Get current stream and create a new one cur_strm = plgstrm() new_strm = plmkstrm() # Set new device type and file name - use a known existing driver plsdev("psc") plsfnam(fname) # Copy old stream parameters to new stream, do the save, # then close new device. plcpstrm(cur_strm,0) plreplot() plend1() # Return to previous stream plsstrm(cur_strm) def read_img(fname): if (not os.path.exists(fname)): return [1,[],0,0,0] fp = open(fname, mode='rb') # Check correct version ver = fp.readline() if (ver != "P5\n"): fp.close() return [1,[],0,0,0] # Skip over comments ptr = fp.tell() while ( fp.read(1) == '#' ): fp.readline() ptr = fp.tell() fp.seek(ptr) # Get width, height, num colors [w, h] = fp.readline().split(' ') w = int(w) h = int(h) nc = int(fp.readline()) tmp = fp.read(w*h) img = zeros(w*h) for i in range(w): for j in range(h): img[i*h+j] = ord(tmp[(h-1-j)*w+i]) img = reshape(img,[w,h]) fp.close() return [0,img,w,h,nc] def get_clip(xi, xe, yi, ye): sx = zeros(5) sy = zeros(5) start = 0 st = plxormod(1) if (st): gin = PLGraphicsIn() gin.button = 0 while (1): st = plxormod(0) plGetCursor(gin) st = plxormod(1) if (gin.button == 1): xi = gin.wX yi = gin.wY if (start): plline(sx,sy) # Clear previous rectangle start = 0 sx[0] = xi sy[0] = yi sx[4] = xi sy[4] = yi if (gin.state & 0x100): xe = gin.wX ye = gin.wY if (start): plline(sx,sy) start = 1 sx[2] = xe sy[2] = ye sx[1] = xe sy[1] = yi sx[3] = xi sy[3] = ye plline(sx,sy) # Draw new rectangle if (gin.button == 3 or gin.keysym == 0x0D or gin.keysym == 'Q'): if (start): plline(sx,sy) # Clear previous rectangle break st = plxormod(0) # Leave xor mode if (xe < xi): t = xi xi = xe xe = t if (yi < ye): t = yi yi = ye ye = t return [gin.keysym == 'Q', xi, xe, yi, ye] else: # Driver has no xormod capability, just do nothing return [0, xi, xe, yi, ye] def mypltr(x, y, stretch): x0 = (stretch[0] + stretch[1])*0.5 y0 = (stretch[2] + stretch[3])*0.5 dy = (stretch[3] - stretch[2])*0.5 result0 = x0 + multiply.outer((x0-x),(1.0 - stretch[4]*cos((y-y0)/dy*pi*0.5))) result1 = multiply.outer(ones(len(x)),y) return array((result0, result1)) # main # # def main(): z = reshape(zeros(XDIM*YDIM),[XDIM,YDIM]) # View image border pixels if (dbg): plenv(1.0, XDIM, 1.0, YDIM, 1, 1) for i in range(XDIM): z[i][YDIM-1] = 1.0 z[i][0] = 1.0 for j in range(YDIM): z[0][j] = 1.0 z[XDIM-1][j] = 1.0 pllab("...around a blue square."," ","A ref border should appear...") plimage(z, 1.0, XDIM, 1.0, YDIM, 0.0, 0.0, 1.0, XDIM, 1.0, YDIM) if (not nosombrero): plcol0(2) # Draw a yellow box, useful for diagnostics! plenv(0.0, 2.0*pi, 0, 3.0*pi, 1, -1) x = arange(XDIM)*2.0*pi/(XDIM-1) y = arange(YDIM)*3.0*pi/(YDIM-1) r = sqrt( multiply.outer(x*x,ones(YDIM)) + multiply.outer(ones(XDIM),y*y)) + 1e-3 z = sin(r) / r pllab("No, an amplitude clipped \"sombrero\"", "", "Saturn?") plptex(2., 2., 3., 4., 0., "Transparent image") plimage(z, 0., 2.*pi, 0, 3.*pi, 0.05, 1.,0., 2.*pi, 0, 3.*pi) # Save the plot if (f_name != ""): save_plot(f_name) # Read Lena image # Note: we try two different locations to cover the case where # this example is being run from the test_c.sh script [err, img, width, height, num_col] = read_img("lena.pgm") if (err): [err, img, width, height, num_col] = read_img("../lena.pgm") if (err): plabort("No such file") plend() sys.exit(1) # Set gray colormap gray_cmap(num_col) # Display Lena plenv(1., width, 1., height, 1, -1) if (not nointeractive): pllab("Set and drag Button 1 to (re)set selection, Button 2 to finish."," ","Lena...") else: pllab(""," ","Lena...") plimage(img, 1., width, 1., height, 0., 0., 1., width, 1., height) # selection/expansion demo if (not nointeractive): xi = 200. xe = 330. yi = 280. ye = 220. [err, xi, xe, yi, ye] = get_clip(xi, xe, yi, ye) if (err): plend() sys.exit(0) plspause(0) pladv(0) # display selection only plimage(img, 1., width, 1., height, 0., 0., xi, xe, ye, yi) plspause(1) # zoom in selection plenv(xi, xe, ye, yi, 1, -1) plimage(img, 1., width, 1., height, 0., 0., xi, xe, ye, yi) # Base the dynamic range on the image contents. img_min = min(img.flat) img_max = max(img.flat) # Draw a saturated version of the original image. Only use the middle 50% # of the image's full dynamic range. plcol0(2) plenv(0, width, 0, height, 1, -1) pllab("", "", "Reduced dynamic range image example") plimagefr(img, 0., width, 0., height, 0., 0., img_min + img_max * 0.25, \ img_max - img_max * 0.25) # Draw a distorted version of the original image, showing its full dynamic range. plenv(0, width, 0, height, 1, -1) pllab("", "", "Distorted image example") stretch = zeros(5) stretch[1] = width stretch[3] = height stretch[4] = 0.5 xg = mypltr(arange(width+1),arange(height+1),stretch)[0] yg = mypltr(arange(width+1),arange(height+1),stretch)[1] plimagefr(img, 0., width, 0., height, 0., 0., img_min, img_max, \ pltr2, xg, yg) main() plplot-5.10.0+dfsg/examples/python/README.logo 644 1750 1750 777311306237000 177140ustar andrewandrewTo produce an SVG form of the logo with -dev svg (which is the device which plplot_logo.py has been explicitly tuned for) execute make plplot_logo in either the top-level of the build tree (configured with cmake option -DBUILD_TEST=ON) or (after "make install" is run) in the build tree of the installed examples configured by the new CMake-based build system for those examples. The above command actually runs the equivalent of ./plplot_logo.py -dev svg -geometry 760x120 -o plplot_logo.svg with proper dependencies and with plplot_logo.py run from the correct directory with correct directory prefix on the output. It also generates plplot_logo.jpg (see below). Both output files end up in examples/python (if working in the top-level of the core build tree) or python (if working in the top-level of the installed examples build tree). The plplot_logo.svg results look great on konqueror, but they are slow to render. The results also look good for display (for the default compensation for text shifts) and take very little time to render. Partially because of the file-bloating issue discussed on list (lots of graphical objects outside device boundaries that are still included in the file), the size of the file is 1.8M. (Of course, another reason for this large file size is there is incredible detail (many triangles) used to represent the surface. If I compress that file using gzip -c | plplot_logo.svgz then the result is only 97 K (which is almost reasonable) and a factor of almost 20 (!) in size over uncompressed. Other results follow: (1) The compressed result can still be quickly rendered with "display". (2) The compressed result makes no difference to the slow konqueror rendering, but that is konqueror's problem and not ours because of how quickly "display" renders the result. (3) Firefox 2 does not know what to do with the compressed result. For the uncompressed result it does not recognize the gradient. These two issues should be checked for firefox 3. (4) scribus-ng quickly imports the compressed result with the same issues (no clipping of results at the stated boundary of the device) as for the uncompressed results. (5) The compressed result is completely unrecognized by the w3c validator. However, the uncompressed result (after a long upload) validates properly at w3c. Until the *.svgz compressed form becomes well-recognized (not least of all by w3c), it is probably best to convert to jpeg to improve rendering speed/reduce bandwidth compared to the uncompressed svg file. This convert step (also done with the above "make plplot_logo" command) appears to get rid of everything outside the device boundaries. convert plplot_logo.svg plplot_logo.jpg The result has a file size of 34K compared to the original jpeg logo (www/img/header.jpg) put together by Werner (with external editor?) which has a file size of 42K and which lacks a legend for the logo. The "z axis" label is shifted a bit by ImageMagick because of the librsvg-2.22 bug, and until this bug is fixed I have put a default option into the original plplot_logo.py file to compensate for this bug. The result looks essentially the same as the original logo (by design and fine-tuning of plplot_logo.py), but the *.svgz form looks substantially better (if only it would be more widely recognized). The future prospects of reducing the uncompressed size of the *.svg result to a reasonable value and the compressed size of the *.svgz result to a miniscule value are good. First, the solution of the file bloating issue discussed on list (many graphical objects outside the device boundary clipping limits are included unnecessarily in the file) should reduce the file size by roughly a factor of three. An even bigger reduction factor for file size is expected when native gradients for file formats that support them become supported by PLplot since that means the triangles used to represent colour surfaces in PLplot can be made much larger without compromising how good the result looks. Alan W. Irwin 2008-10-19 (revised 2009-12-04) plplot-5.10.0+dfsg/examples/python/x00 755 1750 1750 212111722016102 164100ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2012 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw00 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x12.py 755 1750 1750 226111541217123 170540ustar andrewandrew#!/usr/bin/env python # # x12c.c # # Bar chart demo. import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # main # # Does a simple bar chart, using color fill. If color fill is # unavailable, pattern fill is used instead (automatic). def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.pladv(0) w.plvsta() w.plwind(1980.0, 1990.0, 0.0, 35.0) w.plbox("bc", 1.0, 0, "bcnv", 10.0, 0) w.plcol0(2) w.pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12") y0 = [5, 15, 12, 24, 28, 30, 20, 8, 12, 3] for i in range(10): w.plcol0(i + 1) w.plpsty(0) fbox( w, (1980. + i), y0[i] ) string = `y0[i]` w.plptex((1980. + i + .5), (y0[i] + 1.), 1.0, 0.0, .5, string) string = `1980 + i` w.plmtex("b", 1.0, ((i + 1) * .1 - .05), 0.5, string) # Don't forget to call PLEND to finish off! w.pleop() def fbox( w, x0, y0 ): x = [x0, x0, x0 + 1., x0 + 1.] y = [0., y0, y0, 0.] w.plfill(x, y) w.plcol0(1) w.pllsty(1) w.plline(x, y) ##main() plplot-5.10.0+dfsg/examples/python/x18.py 755 1750 1750 624710224562004 170700ustar andrewandrew#!/usr/bin/env python # # x18c.c # # 3-d line and point plot demo. Adapted from x08c.c. import math import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) opt = [1, 0, 1, 0] alt = [20.0, 35.0, 50.0, 65.0] az = [30.0, 40.0, 50.0, 60.0] # main # # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. NPTS = 1000 def main(): # Parse and process command line arguments # pl.ParseOpts(sys.argv, pl.PARSE_FULL) # Initialize plplot pl.init() for k in range(4): test_poly(k) x = [] y = [] z = [] # From the mind of a sick and twisted physicist... for i in range(NPTS): z.append(-1. + 2. * i / NPTS) # Pick one ... ## r = 1. - ( (float) i / (float) NPTS ) r = z[i] x.append(r * math.cos( 2. * math.pi * 6. * i / NPTS )) y.append(r * math.sin( 2. * math.pi * 6. * i / NPTS )) for k in range(4): pl.adv(0) pl.vpor(0.0, 1.0, 0.0, 0.9) pl.wind(-1.0, 1.0, -0.9, 1.1) pl.col(1) pl.w3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) pl.box3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0) pl.col(2) if opt[k]: pl.line3(x, y, z) else: pl.poin3(x, y, z, 1) pl.col(3) title = "#frPLplot Example 18 - Alt=%.0f, Az=%.0f" % (alt[k], az[k]) pl.mtex("t", 1.0, 0.5, 0.5, title) pl.end() def test_poly(k): draw = [ [ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ] ] pl.adv(0) pl.vpor(0.0, 1.0, 0.0, 0.9) pl.wind(-1.0, 1.0, -0.9, 1.1) pl.col(1) pl.w3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) pl.box3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0) pl.col(2) def THETA(a): return 2. * math.pi * (a) / 20. def PHI(a): return math.pi * (a) / 20.1 ## x = r sin(phi) cos(theta) ## y = r sin(phi) sin(theta) ## z = r cos(phi) ## r = 1 :=) for i in range(20): for j in range(20): x = [] y = [] z = [] x.append(math.sin( PHI(j) ) * math.cos( THETA(i) )) y.append(math.sin( PHI(j) ) * math.sin( THETA(i) )) z.append(math.cos( PHI(j) )) x.append(math.sin( PHI(j) ) * math.cos( THETA(i+1) )) y.append(math.sin( PHI(j) ) * math.sin( THETA(i+1) )) z.append(math.cos( PHI(j) )) x.append(math.sin( PHI(j+1) ) * math.cos( THETA(i+1) )) y.append(math.sin( PHI(j+1) ) * math.sin( THETA(i+1) )) z.append(math.cos( PHI(j+1) )) x.append(math.sin( PHI(j+1) ) * math.cos( THETA(i) )) y.append(math.sin( PHI(j+1) ) * math.sin( THETA(i) )) z.append(math.cos( PHI(j+1) )) x.append(math.sin( PHI(j) ) * math.cos( THETA(i) )) y.append(math.sin( PHI(j) ) * math.sin( THETA(i) )) z.append(math.cos( PHI(j) )) # N.B.: The Python poly3 no longer takes a # (possibly negative) length argument, so if # you want to pass a counterclockwise polygon # you now have to reverse the list. The code # above was rearranged to create a clockwise # polygon instead of a counterclockwise # polygon. pl.poly3(x, y, z, draw[k]) pl.col(3) pl.mtex("t", 1.0, 0.5, 0.5, "unit radius sphere" ) main() plplot-5.10.0+dfsg/examples/python/pythondemos.py 755 1750 1750 315611134500753 210210ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() # Exclude interactive demos 14, 17, 31 which call plinit in the xw??.py # script failed = [] for i in range(1, 14)+[15,16]+range(18,31): script = 'xw' + '%02d' % i try: __import__(script, globals(), locals(), []) except: failed.append(script) # Reset color here rather than in individual examples to ensure results # for individual tests are identical to C versions plcol0(1) # Terminate plplot plend() if len(failed) != 0: import string print "Failed script(s): " + string.join(failed,", ") sys.exit(1) plplot-5.10.0+dfsg/examples/python/x13 755 1750 1750 216510233632313 164300ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw13 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/plplot_py_demos.py 644 1750 1750 5112223224223 216000ustar andrewandrewfrom plplot import * from numpy import * plplot-5.10.0+dfsg/examples/python/xw24.py 644 1750 1750 656111543675237 172720ustar andrewandrew# -*- coding: utf-8; -*- # $Id: xw24.py 11680 2011-03-27 17:57:51Z airwin $ # # Unicode Pace Flag # # Copyright (C) 2005 Rafael Laboissiere # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # # In Debian, run like this: # # ( TTFDIR=/usr/share/fonts/truetype ; \ # PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \ # PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \ # PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \ # PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \ # PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \ # ./x24 -dev png -o x24p.png ) # # Packages needed: # # ttf-arphic-bkai00mp # ttf-freefont # ttf-devanagari-fonts # ttf-unfonts # ttf-bengali-fonts # # For the latest Ubuntu systems lohit_hi.ttf has been moved to the # ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you # will have to use this package instead and update the font path. # # Translated from x24c.c into python by Thomas J. Duck from plplot_py_demos import * def main(): red = array([240, 204, 204, 204, 0, 39, 125]) green = array([240, 0, 125, 204, 204, 80, 0]) blue = array([240, 0, 0, 0, 0, 204, 125]) px = array([0.0, 0.0, 1.0, 1.0]) py = array([0.0, 0.25, 0.25, 0.0]) sx = array([ 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 ]) sy = array([ 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 ]) # Taken from http://www.columbia.edu/~fdc/pace/ peace = [ # Mandarin "#<0x00>和平", # Hindi "#<0x20>शांति", # English "#<0x10>Peace", # Hebrew "#<0x10>שלום", # Russian "#<0x10>Мир", # German "#<0x10>Friede", # Korean "#<0x30>평화", # French "#<0x10>Paix", # Spanish "#<0x10>Paz", # Arabic "#<0x10>ﺳﻼم", # Turkish "#<0x10>Barış", # Kurdish "#<0x10>Hasîtî", ] pladv(0) plvpor(0.0, 1.0, 0.0, 1.0) plwind(0.0, 1.0, 0.0, 1.0) plcol0(0) plbox("", 1.0, 0, "", 1.0, 0) plscmap0n(7) plscmap0(red, green, blue) plschr(0, 4.0) plfont(1) for i in range(4): plcol0(i + 1) plfill(px, py) for j in range(4): py[j] += 1.0 / 4.0 plcol0(0) for i in range(12): plptex(sx[i], sy[i], 1.0, 0.0, 0.5, peace[i]) main() plplot-5.10.0+dfsg/examples/python/x06 755 1750 1750 216510233632313 164320ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw06 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw18.py 644 1750 1750 706011543675237 172700ustar andrewandrew# -*- coding: utf-8; -*- # $Id: xw18.py 11680 2011-03-27 17:57:51Z airwin $ # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin # 3-d line and point plot demo. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * opt = [1, 0, 1, 0] alt = [20.0, 35.0, 50.0, 65.0] az = [30.0, 40.0, 50.0, 60.0] # main # # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. NPTS = 1000 def main(): for k in range(4): test_poly(k) # From the mind of a sick and twisted physicist... z = -1. + (2./NPTS) * arange(NPTS) x = z*cos((2.*pi*6./NPTS)*arange(NPTS)) y = z*sin((2.*pi*6./NPTS)*arange(NPTS)) for k in range(4): pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -0.9, 1.1) plcol0(1) plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0) plcol0(2) if opt[k]: plline3(x, y, z) else: # U+22C5 DOT OPERATOR. plstring3(x, y, z, "⋅") plcol0(3) title = "#frPLplot Example 18 - Alt=%.0f, Az=%.0f" % (alt[k], az[k]) plmtex("t", 1.0, 0.5, 0.5, title) # Restore defaults #plcol0(1) def THETA(a): return 2. * pi * (a) / 20. def PHI(a): return pi * (a) / 20.1 def test_poly(k): draw = [ [ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ] ] pladv(0) plvpor(0.0, 1.0, 0.0, 0.9) plwind(-1.0, 1.0, -0.9, 1.1) plcol0(1) plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0) plcol0(2) ## x = r sin(phi) cos(theta) ## y = r sin(phi) sin(theta) ## z = r cos(phi) ## r = 1 :=) cosi0 = cos(THETA(arange(20))) cosi1 = cos(THETA(arange(1,21))) sini0 = sin(THETA(arange(20))) sini1 = sin(THETA(arange(1,21))) cosi0.shape = (-1,1) cosi1.shape = (-1,1) sini0.shape = (-1,1) sini1.shape = (-1,1) cosj0 = cos(PHI(arange(20))) cosj1 = cos(PHI(arange(1,21))) sinj0 = sin(PHI(arange(20))) sinj1 = sin(PHI(arange(1,21))) x0 = cosi0*sinj0 y0 = sini0*sinj0 z0 = cosj0 x1 = cosi0*sinj1 y1 = sini0*sinj1 z1 = cosj1 x2 = cosi1*sinj1 y2 = sini1*sinj1 z2 = cosj1 x3 = cosi1*sinj0 y3 = sini1*sinj0 z3 = cosj0 x4 = x0 y4 = y0 z4 = z0 for i in range(20): for j in range(20): x = [x0[i,j],x1[i,j],x2[i,j],x3[i,j],x4[i,j]] y = [y0[i,j],y1[i,j],y2[i,j],y3[i,j],y4[i,j]] z = [z0[j],z1[j],z2[j],z3[j],z4[j]] # Since negative dimensions don't make sense here # to specify that points are to be drawn in # counter-clockwise direction (as in x18c.c and # x18.tcl) this must be specified with an optional # extra argument in python API. plpoly3(x, y, z, draw[k], 1) plcol0(3) plmtex("t", 1.0, 0.5, 0.5, "unit radius sphere" ) main() plplot-5.10.0+dfsg/examples/python/README.pythondemos 644 1750 1750 177611224256311 213270ustar andrewandrewThe Status of the Python Examples For details of how we build PLplot access from Python please consult ../../bindings/python/README.pythonbuild. The principal module is plplot.py. This make all the common PLplot API available to python in a user-friendly way. plplot.py wraps the swig-generated plplotc.py which in turn wraps the _plplotc extension module (built with the aid of swig). The extension module, plplot_widget contains support for loading plframe from python. This functionality is demonstrated with pytkdemo which uses the old x??.py examples. Plans are afoot (2009-07-05) to drop using those old, limited and buggy examples, and instead use the modern xw??.py examples. Once that works, we will remove all the old examples and rename all the modern xw??.py examples as x??.py (which is a better namespace). Stay tuned. To try out the xw??.py examples without a widget simply run pythondemos.py in the installed directory to run all of them, or alternatively run them one at at time by executing x??. plplot-5.10.0+dfsg/examples/python/x02.py 755 1750 1750 200712102122103 170340ustar andrewandrew#!/usr/bin/env python # # x02c.c # # Multiple window and color map 0 demo. #import pl import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) # Demonstrates multiple windows and default color map 0 palette. def main(w): w.plbop() # Divide screen into 16 regions w.plssub(4, 4) ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() w.plschr(0.0, 3.5) w.plfont(4) for i in range(16): w.plcol0(i) w.pladv(0) vmin = 0.1 vmax = 0.9 for j in range(3): w.plwidth(j + 3) w.plvpor(vmin, vmax, vmin, vmax) w.plwind(0.0, 1.0, 0.0, 1.0) w.plbox("bc", 0.0, 0, "bc", 0.0, 0) vmin = vmin + 0.1 vmax = vmax - 0.1 w.plwidth(1) w.plptex(0.5, 0.5, 1.0, 0.0, 0.5, `i`) # Now finish up. w.pleop() # And revert the screen to one plot per page. w.plssub(1,1) ## pl.end() ## ##main() plplot-5.10.0+dfsg/examples/python/x07 755 1750 1750 216510233632313 164330ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() import xw07 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/x17.py 755 1750 1750 267 7261473541 170410ustar andrewandrew#!/usr/bin/env python # # x17c.c # The C demo doesn't work yet, and even if it did it probably could # not be converted to pure Python since it seems to require the Tcl/Tk # driver. plplot-5.10.0+dfsg/examples/python/x08.py 755 1750 1750 352111541217123 170610ustar andrewandrew#!/usr/bin/env python # # x08c.c # # 3-d plot demo. from numpy import * import math import sys import os module_dir = "@MODULE_DIR@" if module_dir[0] == '@': module_dir = os.getcwd () sys.path.insert (0, module_dir) XPTS = 35 # Data points in x YPTS = 46 # Data points in y opt = [1, 2, 3, 3] alt = [60.0, 20.0, 60.0, 60.0] az = [30.0, 60.0, 120.0, 160.0] title = ["#frPLplot Example 8 - Alt=60, Az=30, Opt=1", "#frPLplot Example 8 - Alt=20, Az=60, Opt=2", "#frPLplot Example 8 - Alt=60, Az=120, Opt=3", "#frPLplot Example 8 - Alt=60, Az=160, Opt=3"] # main # # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. def main(w): ## # Parse and process command line arguments ## ## pl.ParseOpts(sys.argv, pl.PARSE_FULL) ## ## # Initialize plplot ## ## pl.init() ## x = [] ## y = [] ## z = [] x = zeros( XPTS, 'd' ); y = zeros( YPTS, 'd' ) #z = zeros( (XPTS, YPTS), 'd' ) z = reshape( zeros( XPTS*YPTS, 'd' ), (XPTS, YPTS) ) for i in range(XPTS): x[i] = float(i - (XPTS / 2)) / float(XPTS / 2) for i in range(YPTS): y[i] = float(i - (YPTS / 2)) / float(YPTS / 2) for i in range(XPTS): xx = x[i] ## zz = [] for j in range(YPTS): yy = y[j] r = math.sqrt(xx * xx + yy * yy) ## zz.append(math.exp(-r * r) * ## math.cos(2.0 * math.pi * r)) z[i,j] = math.exp(-r * r) * math.cos(2.0 * math.pi * r) ## z.append(zz) for k in range(4): w.pladv(0) w.plvpor(0.0, 1.0, 0.0, 0.9) w.plwind(-1.0, 1.0, -0.9, 1.1) w.plcol0(1) w.plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k]) w.plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0) w.plcol0(2) w.plot3d(x, y, z, opt[k], 1) w.plcol0(3) w.plmtex("t", 1.0, 0.5, 0.5, title[k]) w.pleop() ## pl.end() ## ##main() plplot-5.10.0+dfsg/examples/python/x16 755 1750 1750 233211243255301 164270ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2004 Alan W. Irwin # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Run all python plplot examples non-interactively. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Load colour palettes plspal0("cmap0_black_on_white.pal") plspal1("cmap1_gray.pal",1) plscmap0n(3) # Initialize plplot plinit() import xw16 # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/plplot_logo.py 755 1750 1750 1056412102122103 210040ustar andrewandrew#!/usr/bin/env python # Copyright (C) 2008 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Generate PLplot logo. # Append to effective python path so that can find plplot modules. from plplot_python_start import * import sys from plplot import * # Parse and process command line arguments plparseopts(sys.argv, PL_PARSE_FULL) # Initialize plplot plinit() from plplot_py_demos import * XPTS = 35 # Data points in x YPTS = 46 # Data points in y alt = 60.0 az = 30.0 # Routine for defining a specific color map 1 in HLS space. # if gray is true, use basic grayscale variation from half-dark to light. # otherwise use false color variation from blue (240 deg) to red (360 deg). def cmap1_init(gray): # Independent variable of control points. i = array((0., 1.)) if gray: # Hue for control points. Doesn't matter since saturation is zero. h = array((0., 0.)) # Lightness ranging from half-dark (for interest) to light. l = array((0.5, 1.)) # Gray scale has zero saturation s = array((0., 0.)) else: # Hue ranges from blue (240 deg) to red (0 or 360 deg) h = array((240., 0.)) # Lightness and saturation are constant (values taken from C example). l = array((0.6, 0.6)) s = array((0.8, 0.8)) # number of cmap1 colours is 256 in this case. plscmap1n(256) # Interpolate between control points to set up cmap1. plscmap1l(0, i, h, l, s) def main(): x = (arange(XPTS) - (XPTS / 2)) / float(XPTS / 2) y = (arange(YPTS) - (YPTS / 2)) / float(YPTS / 2) x = 1.5*x y = 0.5 + y x.shape = (-1,1) r2 = (x*x) + (y*y) z = (1. - x)*(1. - x) + 100 * (x*x - y)*(x*x - y) # The log argument may be zero for just the right grid. */ z = log(choose(greater(z,0.), (exp(-5.), z))) x.shape = (-1,) zmin = min(z.flat) zmax = max(z.flat) nlevel = 10 step = (zmax-zmin)/(nlevel+1) clevel = zmin + step + arange(nlevel)*step plschr(0., 1.8) plwidth(1) pladv(0) plvpor(0.0, 1.0, 0.0, 1.0) plwind(-0.43, 0.840, 0.05, 0.48) plcol0(1) plw3d(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt, az) plbox3("bnstu", "", 0.0, 0, "bnstu", "", 0.0, 0, "bcdmnstuv", "", 0.0, 0) # If converting the -dev svg result later with the ImageMagick # "convert" application or viewing the svg result with the ImageMagick # "display" application must compensate for the librsvg-2.22 # positioning bug since librsvg is what ImageMagick uses # to interpret SVG results. if_rsvg_bug = True if if_rsvg_bug: shift = 1.00 else: shift = 1.07 plmtex3("zs", 5.0, shift, 1.0, "z axis") plcol0(2) # magnitude colored plot with faceted squares cmap1_init(0) plsurf3d(x, y, z, MAG_COLOR | FACETED, ()) # Shading to provide a good background for legend. x1 = 0.10 x2 = 0.8 plvpor(0.0, 1.0, 0.0, 1.0) plwind(0.0, 1.0, 0.0, 1.0) # Completely opaque from 0. to x1 plscol0a(15, 0, 0, 0, 1.0) plcol0(15) x=array([0., 0., x1, x1]) y=array([0., 1., 1., 0.]) plfill(x,y) # Black transparent gradient. pos = array([0.0, 1.0]) rcoord = array([0.0, 0.0]) gcoord = array([0.0, 0.0]) bcoord = array([0.0, 0.0]) acoord = array([1.0, 0.0]) rev = array([0, 0]) plscmap1n(2) plscmap1la(1, pos, rcoord, gcoord, bcoord, acoord, rev) x=array([x1, x1, x2, x2]) plgradient(x,y,0.) # Logo Legend plscol0a(15, 255, 255, 255, 1.0) plcol0(15) x1 = 0.03 plschr(0., 2.9) plsfont(PL_FCI_SANS, PL_FCI_UPRIGHT, PL_FCI_BOLD) plptex(x1, 0.57, 1.0, 0.0, 0.0, "PLplot") plschr(0., 1.5) plptex(x1, 0.30, 1.0, 0.0, 0.0, "The ultimate in cross-platform plotting") main() # Terminate plplot plend() plplot-5.10.0+dfsg/examples/python/xw19.py 644 1750 1750 1043312221050115 172570ustar andrewandrew# $Id: xw19.py 12532 2013-09-26 15:18:37Z andrewross $ # Copyright (C) Wesley Ebisuzaki # Copyright (C) 2009 Andrew Ross # # Illustrates backdrop plotting of world, US maps. # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # from plplot_py_demos import * def map_transform( x, y, xt, yt, data ): radius = 90.0 - y xt[0] = radius * cos( x * pi / 180.0 ) yt[0] = radius * sin( x * pi / 180.0 ) # mapform19 # # Defines specific coordinate transformation for example 19. # Not to be confused with mapform in src/plmap.c. # x[], y[] are the coordinates to be plotted. def mapform19(n, x, y): for i in range(n): radius = 90.0 - y[i] xp = radius * cos(x[i] * pi / 180.0) yp = radius * sin(x[i] * pi / 180.0) x[i] = xp y[i] = yp return [x,y] ## "Normalize" longitude values so that they always fall between -180.0 and ## 180.0 def normalize_longitude(lon): if ((lon >= -180.0) and (lon <= 180.0)): return lon else : times = floor ((fabs(lon) + 180.0) / 360.0) if (lon < 0.0) : return(lon + 360.0 * times) else : return(lon - 360.0 * times) ## A custom axis labeling function for longitudes and latitudes. def geolocation_labeler(axis, value, data): if (axis == PL_Y_AXIS) : label_val = value if (label_val > 0.0) : direction_label = " N" elif (label_val < 0.0) : direction_label = " S" else : direction_label = "Eq" elif (axis == PL_X_AXIS) : label_val = normalize_longitude(value) if (label_val > 0.0) : direction_label = " E" elif (label_val < 0.0) : direction_label = " W" else : direction_label = "" if (axis == PL_Y_AXIS and value == 0.0) : # A special case for the equator label = direction_label else : label = `int(abs(label_val))` + direction_label return label # main # # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. def main(): # Longitude (x) and latitude (y) miny = -70 maxy = 80 # Cartesian plots # Most of world minx = -170 maxx = minx+360 # Setup a custom latitude and longitude-based scaling function. plslabelfunc(geolocation_labeler, None) plcol0(1) plenv(minx, maxx, miny, maxy, 1, 70) plmap(None,"usaglobe", minx, maxx, miny, maxy) # The Americas minx = 190 maxx = 340 plcol0(1) plenv(minx, maxx, miny, maxy, 1, 70) plmap(None, "usaglobe", minx, maxx, miny, maxy) # Clear the labeling function plslabelfunc(None, None) # Polar, Northern hemisphere minx = 0 maxx = 360 plenv(-75., 75., -75., 75., 1, -1) plmap(mapform19,"globe", minx, maxx, miny, maxy) pllsty(2) plmeridians(mapform19,10.0, 10.0, 0.0, 360.0, -10.0, 80.0) # Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0 maxx = 360 plstransform( map_transform, None ) pllsty( 1 ) plenv( -75., 75., -75., 75., 1, -1 ) # No need to set the map transform here as the global transform will be # used. plmap( None, "globe", minx, maxx, miny, maxy ) pllsty( 2 ) plmeridians( None, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ) # Show Baltimore, MD on the map plcol0( 2 ) plssym( 0.0, 2.0 ) x = [ -76.6125 ] y = [ 39.2902778 ] plpoin( x, y, 18 ) plssym( 0.0, 1.0 ) plptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ) # For C, this is how the global transform is cleared plstransform( None, None ) main() plplot-5.10.0+dfsg/examples/plplot_configure.cmake_installed_examples.in 644 1750 1750 1755412264404031 255150ustar andrewandrew# -*- mode: cmake -*- # This file used to configure CMake variables that are used to build the # installed examples. # Identify that this is the build system for the installed examples. set(BUILD_TEST ON) set(CORE_BUILD OFF) # ======================================================================= # Useful functions. # ======================================================================= include(plplot_functions) # ======================================================================= # pkg-config support as well as macros to put link flags in standard # *.pc (pkg-config) form as well as standard fullpath form used by cmake. # PKG_CONFIG_EXECUTABLE can be used to discover whether pkg-config was # found or not. # ======================================================================= include(pkg-config) set(LIB_TAG "@LIB_TAG@") set(INCLUDE_DIR "@INCLUDE_DIR@") set(MATH_LIB @MATH_LIB@) set(SH_EXECUTABLE @SH_EXECUTABLE@) set(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) set(language_info_LIST @language_info_LIST@) # This list of set commands must be consistent with language_info_LIST # set in examples/CMakeLists.txt and configured just above. Thus, # some consistent maintenance of that list and the current list of set # commands must be done on the rare occasions when a language is added # to PLplot. Cannot make the list of set commands automatically with # a foreach loop because explicit configuration of each name is required. set(ENABLE_ada @ENABLE_ada@) set(ENABLE_c @ENABLE_c@) set(ENABLE_cxx @ENABLE_cxx@) set(ENABLE_d @ENABLE_d@) set(ENABLE_f95 @ENABLE_f95@) set(ENABLE_java @ENABLE_java@) set(ENABLE_lua @ENABLE_lua@) set(ENABLE_ocaml @ENABLE_ocaml@) set(ENABLE_octave @ENABLE_octave@) set(ENABLE_pdl @ENABLE_pdl@) set(ENABLE_python @ENABLE_python@) set(ENABLE_pyqt4 @ENABLE_pyqt4@) set(ENABLE_tcl @ENABLE_tcl@) # Interactive bindings set(ENABLE_tk @ENABLE_tk@) set(ENABLE_tkX @ENABLE_tkX@) set(ENABLE_gnome2 @ENABLE_gnome2@) set(ENABLE_wxwidgets @ENABLE_wxwidgets@) set(ENABLE_qt @ENABLE_qt@) if(ENABLE_python) set(ENABLE_pygcw @ENABLE_pygcw@) endif(ENABLE_python) # Check for all officially supported CMake compilers that we use with # soft-landing support. include(language_support) # First field is lower-case language string, second field is # mixed-case language string used for official CMake variables, third # field is language string to be used in output messages, and final # field is whether it is a fatal error if this language is missing/not # working. set(COMPILED_LANGUAGE_INFO_LIST "c:C:C:ON" "ada:Ada:Ada:OFF" "cxx:CXX:C++:OFF" "d:D:D:OFF" "f95:Fortran:Fortran:OFF" "java:Java:Java:OFF" ) foreach(COMPILED_LANGUAGE_INFO ${COMPILED_LANGUAGE_INFO_LIST}) string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" language ${COMPILED_LANGUAGE_INFO}) string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" Language ${COMPILED_LANGUAGE_INFO}) string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" language_output ${COMPILED_LANGUAGE_INFO}) string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" fatal_language ${COMPILED_LANGUAGE_INFO}) if(ENABLE_${language} AND NOT PLPLOT_${Language}_COMPILER_WORKS) workaround_9220(${Language} PLPLOT_${Language}_COMPILER_WORKS) if(NOT PLPLOT_${Language}_COMPILER_WORKS) if(fatal_language) message(FATAL_ERROR "${language_output} compiler absolutely required to build this project.") endif(fatal_language) message(STATUS "WARNING: no working ${language_output} compiler so disabling ${language} examples.") set(ENABLE_${language} OFF CACHE BOOL "Enable ${language} bindings" FORCE) endif(NOT PLPLOT_${Language}_COMPILER_WORKS) endif(ENABLE_${language} AND NOT PLPLOT_${Language}_COMPILER_WORKS) if(ENABLE_${language}) # Find and check ${Language} compiler enable_language(${Language} OPTIONAL) if(NOT CMAKE_${Language}_COMPILER_WORKS) if(fatal_language) message(FATAL_ERROR "${language_output} compiler absolutely required to build this project.") endif(fatal_language) message(STATUS "WARNING: no working ${language_output} compiler so disabling ${language} examples.") set(ENABLE_${language} OFF CACHE BOOL "Enable ${language} bindings" FORCE) endif(NOT CMAKE_${Language}_COMPILER_WORKS) endif(ENABLE_${language}) endforeach(COMPILED_LANGUAGE_INFO ${COMPILED_LANGUAGE_INFO_LIST}) if(ENABLE_ada) set(ADA_INCLUDE_DIR "@ADA_INCLUDE_DIR@") set(ADA_LIB_DIR "@ADA_LIB_DIR@") endif(ENABLE_ada) if(ENABLE_f95) set(F95_MOD_DIR "@F95_MOD_DIR@") endif(ENABLE_f95) if(ENABLE_java) find_package(JNI) set(JAR_DIR "@JAR_DIR@") endif(ENABLE_java) if(ENABLE_ocaml) set(OCAMLC @OCAMLC@) set(OCAMLOPT @OCAMLOPT@) set(OCAMLFIND @OCAMLFIND@) set(OCAML_HAS_CAIRO @OCAML_HAS_CAIRO@) set(OCAML_HAS_GTK @OCAML_HAS_GTK@) set(CMAKE_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@") set(OCAML_INSTALL_DIR "@OCAML_INSTALL_DIR@") endif(ENABLE_ocaml) if(ENABLE_tcl OR ENABLE_tk) set(TCL_TCLSH @TCL_TCLSH@) set(MKTCLINDEX ${CMAKE_SOURCE_DIR}/tcl/mktclIndex) set(MKTCLINDEX_ARGS @MKTCLINDEX_ARGS@) # Needed to configure tclsh_standard_examples and wish_standard_examples set(DATA_DIR @DATA_DIR@) endif(ENABLE_tcl OR ENABLE_tk) if(ENABLE_tk) set(ENABLE_itk @ENABLE_itk@) set(ENABLE_itkX @ENABLE_itkX@) set(TCL_INCLUDE_PATH @TCL_INCLUDE_PATH@) set(TK_INCLUDE_PATH @TK_INCLUDE_PATH@) set(TCL_LIBRARY @TCL_LIBRARY@) set(TK_LIBRARY @TK_LIBRARY@) endif(ENABLE_tk) if(ENABLE_wxwidgets) # Use identical compile and link flags to build wxwidgets application. set(wxwidgets_COMPILE_FLAGS "@wxwidgets_COMPILE_FLAGS@") set(wxwidgets_LINK_FLAGS @wxwidgets_LINK_FLAGS@) endif(ENABLE_wxwidgets) if(ENABLE_qt) set(CORE_QT_VERSION_MAJOR @QT_VERSION_MAJOR@) set(CORE_QT_VERSION_MINOR @QT_VERSION_MINOR@) set(CORE_QT_VERSION_PATCH @QT_VERSION_PATCH@) endif(ENABLE_qt) set(ENABLE_DYNDRIVERS @ENABLE_DYNDRIVERS@) set(FILE_DEVICES_LIST @FILE_DEVICES_LIST@) # This list of set commands must be consistent with the above list which # implies a maintenance issue. set(PLD_pdfcairo @PLD_pdfcairo@) set(PLD_pngcairo @PLD_pngcairo@) set(PLD_pscairo @PLD_pscairo@) set(PLD_epscairo @PLD_epscairo@) set(PLD_svgcairo @PLD_svgcairo@) set(PLD_cgm @PLD_cgm@) set(PLD_dg300 @PLD_dg300@) set(PLD_epsqt @PLD_epsqt@) set(PLD_pdfqt @PLD_pdfqt@) set(PLD_bmpqt @PLD_bmpqt@) set(PLD_jpgqt @PLD_jpgqt@) set(PLD_pngqt @PLD_pngqt@) set(PLD_ppmqt @PLD_ppmqt@) set(PLD_tiffqt @PLD_tiffqt@) set(PLD_svgqt @PLD_svgqt@) set(PLD_gif @PLD_gif@) set(PLD_jpeg @PLD_jpeg@) set(PLD_png @PLD_png@) set(PLD_hp7470 @PLD_hp7470@) set(PLD_hp7580 @PLD_hp7580@) set(PLD_lj_hpgl @PLD_lj_hpgl@) set(PLD_imp @PLD_imp@) set(PLD_ljii @PLD_ljii@) set(PLD_ljiip @PLD_ljiip@) set(PLD_pbm @PLD_pbm@) set(PLD_pdf @PLD_pdf@) set(PLD_ps @PLD_ps@) set(PLD_pstex @PLD_pstex@) set(PLD_psttf @PLD_psttf@) set(PLD_svg @PLD_svg@) set(PLD_tek4010f @PLD_tek4010f@) set(PLD_tek4107f @PLD_tek4107f@) set(PLD_wxpng @PLD_wxpng@) set(PLD_xfig @PLD_xfig@) # These only used for testing, but not core build set(PLD_psc @PLD_psc@) set(PLD_psttfc @PLD_psttfc@) set(INTERACTIVE_DEVICES_LIST @INTERACTIVE_DEVICES_LIST@) # Set interactive devices that are needed to build certain examples. This # list should be consistent with INTERACTIVE_DEVICES_LIST which implies a # maintenance issue. set(PLD_aqt @PLD_aqt@) set(PLD_gcw @PLD_gcw@) set(PLD_ntk @PLD_ntk@) set(PLD_qtwidget @PLD_qtwidget@) set(PLD_tk @PLD_tk@) set(PLD_wincairo @PLD_wincairo@) set(PLD_wingcc @PLD_wingcc@) set(PLD_wxwidgets @PLD_wxwidgets@) set(PLD_xcairo @PLD_xcairo@) set(PLD_xwin @PLD_xwin@) # Set external devices that are needed to build certain examples. set(PLD_extcairo @PLD_extcairo@) set(PLD_extqt @PLD_extqt@) # Needed to check if diff and tail on system for test_diff_psc target. set(DIFF_EXECUTABLE @DIFF_EXECUTABLE@) set(TAIL_EXECUTABLE @TAIL_EXECUTABLE@) set(CMP_EXECUTABLE @CMP_EXECUTABLE@) # ocaml examples build needs this. set(USE_RPATH @USE_RPATH@) # WIN32 and CYGWIN derived variables set(WIN32_AND_NOT_CYGWIN @WIN32_AND_NOT_CYGWIN@) set(WIN32_OR_CYGWIN @WIN32_OR_CYGWIN@) plplot-5.10.0+dfsg/examples/ada/ 775 1750 1750 012406243570 152205ustar andrewandrewplplot-5.10.0+dfsg/examples/ada/xthick04a.adb 644 1750 1750 1767212143252635 176020ustar andrewandrew-- $Id: xthick04a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- -- Log plot demo. -- Copyright (C) 2007 - 2011 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use System, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick04a is procedure plot1(Plot_Type : Integer) is freql, ampl, phase : Real_Vector(0 .. 100); f0, freq : Long_Float; begin Advance_To_Subpage(Next_Subpage); f0 := 1.0; for i in freql'range loop freql(i) := -2.0 + Long_Float(i) / 20.0; freq := 10.0 ** freql(i); ampl(i) := 20.0 * log(1.0 / sqrt(1.0 + (freq / f0) ** 2.0), 10.0); phase(i) := -(180.0 / pi) * arctan(freq / f0); end loop; Set_Viewport_Normalized(0.15, 0.85, 0.1, 0.9); Set_Viewport_World(-2.0, 3.0, -80.0, 0.0); -- Try different axis and labelling styles. Set_Pen_Color(Red); if Plot_Type = 0 then Box_Around_Viewport("bclnst", 0.0, 0, "bnstv", 0.0, 0); elsif Plot_Type = 1 then Box_Around_Viewport("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); end if; -- Plot ampl vs freq Set_Pen_Color(Yellow); Draw_Curve(freql, ampl); Set_Pen_Color(Yellow); Write_Text_World(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade"); -- Put labels on Set_Pen_Color(Red); Write_Text_Viewport("b", 3.2, 0.5, 0.5, "Frequency"); Write_Text_Viewport("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter"); Set_Pen_Color(Yellow); Write_Text_Viewport("l", 5.0, 0.5, 0.5, "Amplitude (dB)"); -- For the gridless case, put phase vs freq on same plot if Plot_Type = 0 then Set_Pen_Color(Red); Set_Viewport_World(-2.0, 3.0, -100.0, 0.0); Box_Around_Viewport("", 0.0, 0, "cmstv", 30.0, 3); Set_Pen_Color(Green); Draw_Curve(freql, phase); Draw_String(freql, phase, "*"); Set_Pen_Color(Green); Write_Text_Viewport("r", 5.0, 0.5, 0.5, "Phase shift (degrees)"); end if; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); -- Draw the legends. if Plot_Type = 0 then -- Make a legend with two entries. declare text, symbols : Legend_String_Array_Type(0 .. 1); opt_array : Integer_Array_1D(0 .. 1); text_colors, line_colors, line_styles : Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); line_widths, symbol_scales : Real_Vector(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin -- First legend entry. opt_array(0) := Legend_Line; text_colors(0) := Yellow; text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := Yellow; -- fixme Use declared constants, not integers. line_styles(0) := 1; line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. -- Second legend entry. opt_array(1) := Legend_Line + Legend_Symbol; text_colors(1) := Green; text(1) := To_Unbounded_String("Phase shift"); line_colors(1) := Green; line_styles(1) := 1; line_widths(1) := 1.0; symbol_colors(1) := Green; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; symbols(1) := To_Unbounded_String("*"); Create_Legend(legend_width, legend_height, Legend_Background + Legend_Bounding_Box, 0, 0.0, 0.0, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end; -- declare block elsif Plot_Type = 1 then -- Make a legend with one entry. declare text, symbols : Legend_String_Array_Type(0 .. 0); opt_array : Integer_Array_1D(0 .. 0); text_colors, line_colors, line_styles : Integer_Array_1D(0..0); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 0); line_widths, symbol_scales : Real_Vector(0 .. 0); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 0); Box_Scales, Box_Line_Widths : Real_Vector(0 .. 0); begin -- First legend entry. opt_array(0) := Legend_Line; text_colors(0) := Yellow; text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := Yellow; -- fixme Use declared constants, not integers. line_styles(0) := 1; line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. Box_Colors(0) := 0; Box_Patterns(0) := 0; Box_Line_Widths(0) := 0.0; Box_Scales(0) := 0.0; Create_Legend(legend_width, legend_height, Legend_Background + Legend_Bounding_Box, 0, 0.0, 0.0, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end; -- declare block end if; end plot1; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; Set_Font_Style(Roman_Font); -- Make log plots using two different styles. plot1(0); plot1(1); End_PLplot; end xthick04a; plplot-5.10.0+dfsg/examples/ada/x26a.adb 644 1750 1750 2123212143252635 165460ustar andrewandrew-- $Id: x26a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- Multi-lingual version of the first page of example 4. -- Copyright (C) 2008 - 2011 Jerry Bauck -- This file is part of PLplot. -- Thanks to the following for providing translated strings for this example: -- Valery Pipin (Russian) -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- This example designed just for devices (e.g., psttfc and the -- cairo-related devices) that use the pango and fontconfig libraries. The -- best choice of glyph is selected by fontconfig and automatically rendered -- by pango in way that is sensitive to complex text layout (CTL) language -- issues for each unicode character in this example. Of course, you must -- have the appropriate TrueType fonts installed to have access to all the -- required glyphs. -- Translation instructions: The strings to be translated are given by -- x_label, y_label, alty_label, title_label, and line_label below.-- The -- encoding used must be UTF-8. -- The following strings to be translated involve some scientific/mathematical -- jargon which is now discussed further to help translators. -- (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . -- (2) degrees is an angular measure, see -- http://en.wikipedia.org/wiki/Degree_(angle) . -- (3) low-pass filter is one that transmits (passes) low frequencies. -- (4) pole is in the mathematical sense, see -- http://en.wikipedia.org/wiki/Pole_(complex_analysis) .-- "Single Pole" -- means a particular mathematical transformation of the filter function has -- a single pole, see -- http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html .-- -- Furthermore, a single-pole filter must have an inverse square decline -- (or -20 db/decade). Since the filter plotted here does have that -- characteristic, it must by definition be a single-pole filter, see also -- http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm -- (5) decade represents a factor of 10, see -- http://en.wikipedia.org/wiki/Decade_(log_scale) . with Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x26a is -- Here we show two ways of passing strings for plot1... -- ...a function... --function x_label(which : Integer) return String is --begin -- if which = 0 then return "Frequency"; end if; -- if which = 1 then return "Частота"; end if; -- return "oops"; --end x_label; -- ...or an array of unbounded strings. -- (TUB renames Ada.Strings.Unbounded.To_Unbounded_String in plplot_traditional.ads.) x_label : array(0 .. 1) of Unbounded_String := (TUB("Frequency"), TUB("Частота")); function y_label(which : Integer) return String is begin if which = 0 then return "Amplitude (dB)"; end if; if which = 1 then return "Амплитуда (dB)"; end if; return "oops"; end y_label; function alty_label(which : Integer) return String is begin if which = 0 then return "Phase shift (degrees)"; end if; if which = 1 then return "Фазовый сдвиг (градусы)"; end if; return "oops"; end alty_label; -- Short rearranged versions of y_label and alty_label. -- (TUB renames Ada.Strings.Unbounded.To_Unbounded_String in plplot_traditional.ads.) Legend_0 : Legend_String_Array_Type(0..1) := (TUB("Amplitude"), TUB("Phase shift")); Legend_1 : Legend_String_Array_Type(0..1) := (TUB("Амплитуда"), TUB("Фазовый сдвиг")); Legend_text : array(0 .. 1) of Legend_String_Array_Type(0..1) := (Legend_0, Legend_1); function title_label(which : Integer) return String is begin if which = 0 then return "Single Pole Low-Pass Filter"; end if; if which = 1 then return "Однополюсный Низко-Частотный Фильтр"; end if; return "oops"; end title_label; function line_label(which : Integer) return String is begin if which = 0 then return "-20 dB/decade"; end if; if which = 1 then return "-20 dB/десяток"; end if; return "oops"; end line_label; procedure plot1 (x_label, y_label, alty_label : String; L_Text : Legend_String_Array_Type; title_label, line_label : String) is freql, ampl, phase : Real_Vector(0 .. 100); f0, freq : Long_Float; opt_array : Integer_Array_1D(0 .. 1); text_colors, line_colors, line_styles : Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); line_widths, symbol_scales : Real_Vector(0 .. 1); symbols : Legend_String_Array_Type(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin pladv(0); f0 := 1.0; for i in freql'range loop freql(i) := -2.0 + Long_Float(i) / 20.0; freq := 10.0 ** freql(i); ampl(i) := 20.0 * log(1.0 / sqrt(1.0 + (freq / f0) ** 2.0), 10.0); phase(i) := -(180.0 / pi) * arctan(freq / f0); end loop; plvpor(0.15, 0.85, 0.1, 0.9); plwind(-2.0, 3.0, -80.0, 0.0); -- Try different axis and labelling styles. plcol0(1); plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); -- Plot ampl vs freq plcol0(2); plline(freql, ampl); plcol0(2); plptex(1.6, -30.0, 1.0, -20.0, 0.5, line_label); -- Put labels on plcol0(1); plmtex("b", 3.2, 0.5, 0.5, x_label); plmtex("t", 2.0, 0.5, 0.5, title_label); plcol0(2); plmtex("l", 5.0, 0.5, 0.5, y_label); -- For the gridless case, put phase vs freq on same plot plcol0(1); plwind(-2.0, 3.0, -100.0, 0.0); plbox("", 0.0, 0, "cmstv", 30.0, 3); plcol0(3); plline(freql, phase); plstring(freql, phase, "*"); plcol0(3); plmtex("r", 5.0, 0.5, 0.5, alty_label); -- Draw a legend -- First legend entry. opt_array(0) := Legend_Line; text_colors(0) := 2; line_colors(0) := 2; line_styles(0) := 1; line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. -- Second legend entry. opt_array(1) := Legend_Line + Legend_Symbol; text_colors(1) := 3; line_colors(1) := 3; line_styles(1) := 1; line_widths(1) := 1.0; symbol_colors(1) := 3; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; symbols(1) := To_Unbounded_String("*"); plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, Legend_Background + Legend_Bounding_Box, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, L_Text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end plot1; begin -- Parse and process command line arguments */ plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; plfont(2); -- Make log plots using two different styles. for i in 0 .. 1 loop plot1(To_String(x_label(i)), y_label(i), alty_label(i), legend_text(i), title_label(i), line_label(i)); end loop; plend; end x26a; plplot-5.10.0+dfsg/examples/ada/x06a.adb 644 1750 1750 613211543675237 165400ustar andrewandrew-- $Id: x06a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Displays the entire "plpoin" symbol (font) set. -- Copyright (C) 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x06a is k, maxfont : Integer; x, y : Real_Vector(1 .. 1); begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; for Kind_Font in 0 .. 1 loop plfontld(Kind_Font); if Kind_Font = 0 then maxfont := 1; else maxfont := 4; end if; for font in 0 .. maxfont - 1 loop plfont(font + 1); pladv(0); -- Set up viewport and window plcol0(2); plvpor(0.1, 1.0, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.3); -- Draw the grid using plbox plbox("bcg", 0.1, 0, "bcg", 0.1, 0); -- Write the digits below the frame plcol0(15); for i in 0 .. 9 loop plmtex("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); end loop; k := 0; for i in 0 .. 12 loop -- Write the digits to the left of the frame plmtex("lv", 1.0, (1.0 - (2.0 * Long_Float(i) + 1.0) / 26.0), 1.0, Trim(Integer'image(10 * i), Left)); for j in 0 .. 9 loop x(1) := 0.1 * Long_Float(j) + 0.05; y(1) := 1.25 - 0.1 * Long_Float(i); -- Display the symbols (plpoin expects that x and y are arrays so -- pass pointers) if k < 128 then plpoin(x, y, k); end if; k := k + 1; end loop; end loop; if Kind_Font = 0 then plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)"); else plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)"); end if; end loop; -- font end loop; -- Kind_Font plend; end x06a; plplot-5.10.0+dfsg/examples/ada/x04a.adb 644 1750 1750 1710112143252635 165420ustar andrewandrew-- $Id: x04a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- -- Log plot demo. -- Copyright (C) 2007 - 2011 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use System, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x04a is procedure plot1(Plot_Type : Integer) is freql, ampl, phase : Real_Vector(0 .. 100); f0, freq : Long_Float; begin pladv(0); f0 := 1.0; for i in freql'range loop freql(i) := -2.0 + Long_Float(i) / 20.0; freq := 10.0 ** freql(i); ampl(i) := 20.0 * log(1.0 / sqrt(1.0 + (freq / f0) ** 2.0), 10.0); phase(i) := -(180.0 / pi) * arctan(freq / f0); end loop; plvpor(0.15, 0.85, 0.1, 0.9); plwind(-2.0, 3.0, -80.0, 0.0); -- Try different axis and labelling styles. plcol0(1); if Plot_Type = 0 then plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0); elsif Plot_Type = 1 then plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0); end if; -- Plot ampl vs freq plcol0(2); plline(freql, ampl); plcol0(2); plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade"); -- Put labels on plcol0(1); plmtex("b", 3.2, 0.5, 0.5, "Frequency"); plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter"); plcol0(2); plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)"); -- For the gridless case, put phase vs freq on same plot if Plot_Type = 0 then plcol0(1); plwind(-2.0, 3.0, -100.0, 0.0); plbox("", 0.0, 0, "cmstv", 30.0, 3); plcol0(3); plline(freql, phase); plstring(freql, phase, "*"); plcol0(3); plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)"); end if; plscol0a(15, 32, 32, 32, 0.70); -- Draw the legends. if Plot_Type = 0 then -- Make a legend with two entries. declare text, symbols : Legend_String_Array_Type(0 .. 1); opt_array : Integer_Array_1D(0 .. 1); text_colors, line_colors, line_styles: Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); line_widths, symbol_scales : Real_Vector(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin -- First legend entry. opt_array(0) := Legend_Line; text_colors(0) := 2; text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := 2; line_styles(0) := 1; line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. -- Second legend entry. opt_array(1) := Legend_Line + Legend_Symbol; text_colors(1) := 3; text(1) := To_Unbounded_String("Phase shift"); line_colors(1) := 3; line_styles(1) := 1; line_widths(1) := 1.0; symbol_colors(1) := 3; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; symbols(1) := To_Unbounded_String("*"); pllegend(legend_width, legend_height, Legend_Background + Legend_Bounding_Box, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end; -- declare block elsif Plot_Type = 1 then -- Make a legend with one entry. declare text, symbols : Legend_String_Array_Type(0 .. 0); opt_array : Integer_Array_1D(0 .. 0); text_colors, line_colors, line_styles : Integer_Array_1D(0..0); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 0); line_widths, symbol_scales : Real_Vector(0 .. 0); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 0); Box_Scales, Box_Line_Widths : Real_Vector(0 .. 0); begin -- First legend entry. opt_array(0) := Legend_Line; text_colors(0) := 2; text(0) := To_Unbounded_String("Amplitude"); line_colors(0) := 2; -- fixme Use declared constants, not integers. line_styles(0) := 1; line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. Box_Colors(0) := 0; Box_Patterns(0) := 0; Box_Line_Widths(0) := 0.0; Box_Scales(0) := 0.0; pllegend(legend_width, legend_height, Legend_Background + Legend_Bounding_Box, 0, 0.0, 0.0, 0.1, 15, -- fixme Replace colors and styles with names. 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end; -- declare block end if; end plot1; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; plfont(2); -- Make log plots using two different styles. plot1(0); plot1(1); plend; end x04a; plplot-5.10.0+dfsg/examples/ada/xthick19a.adb 644 1750 1750 2264112221050115 175620ustar andrewandrew-- $Id: xthick19a.adb 12532 2013-09-26 15:18:37Z andrewross $ -- Illustrates backdrop plotting of world, US maps. -- Contributed by Wesley Ebisuzaki. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Text_IO, Interfaces.C, System.Storage_Elements, Ada.Strings, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings.Unbounded, PLplot_Auxiliary, PLplot; use Text_IO, Interfaces.C, System.Storage_Elements, Ada.Strings, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings.Unbounded, PLplot_Auxiliary, PLplot; -- Shows two views of the world map. procedure xthick19a is minx, maxx, miny, maxy : Long_Float; x, y : Real_Vector(1 .. 1); -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. procedure map_transform (x, y : Long_Float; xt, yt : out Long_Float; data : PLPointer); pragma Convention(C, map_transform); procedure map_transform (x, y : Long_Float; xt, yt : out Long_Float; data : PLPointer) is radius : Long_Float; begin radius := 90.0 - y; xt := radius * cos(x * pi / 180.0); yt := radius * sin(x * pi / 180.0); end map_transform; -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array); pragma Convention(C, mapform19); -- Defines specific coordinate transformation for example 19. -- Not to be confused with mapform in src/Draw_Map.c. -- x(), y() are the coordinates to be plotted. -- Ada note: Passing the array length as the first argument is the easiest -- way (for the developer of the bindings) and maintain a C-compatible -- argument list. It might be possible to instead pass a pointer to something -- with an argument list (x, y : in out Real_Vector) instead, and write a -- wrapper function inside Draw_Map and Draw_Latitude_Longitude that has the "correct" C -- argument list, and then pass a pointer to _that_ when calling Draw_Map and -- plmeridian. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array) is xp, yp : Long_Float; begin -- DO NOT use x'range for this loop because the C function which calls -- this function WILL NOT SEE IT AND YOU WILL GET A SEGFAULT. Simply -- use 0 .. n - 1 explicitly. for i in 0 .. n - 1 loop map_transform(x(i), y(i), xp, yp, System.Null_Address); x(i) := xp; y(i) := yp; end loop; end mapform19; -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. -- See Ada note above, for mapform19. -- a_length is used only for bounds checking against the C-allocated memory -- for label. procedure geolocation_labeler (axis : Integer; a_value : Long_Float; label : out Label_String_Type; a_length : size_t; data : PLpointer); pragma Convention(C, geolocation_labeler); -- A custom axis labeling function for longitudes and latitudes. procedure geolocation_labeler (axis : Integer; a_value : Long_Float; label : out Label_String_Type; a_length : size_t; data : PLpointer) is direction_label : Unbounded_String; label_val : Long_Float; -- "Normalize" longitude values so that they always fall between -180.0 and 180.0. function normalize_longitude(lon : Long_Float) return Long_Float is times : Long_Float; begin -- normalize_longitude if lon >= -180.0 and lon <= 180.0 then return lon; else times := Long_Float'Floor((abs(lon) + 180.0) / 360.0); if lon < 0.0 then return lon + 360.0 * times; else return lon - 360.0 * times; end if; end if; end normalize_longitude; -- Function to convert an unbounded string to a fixed-length C string with the -- null terminator somewhere in the middle and spaces after. The result, of type -- Label_String_Type, is fixed to a length by C, currently at 41, and is -- indexed in Ada as 0 .. PLplot_Traditional.Max_Label_String_Length. function Unbounded_To_Weird_C (Item : Unbounded_String; C_Length : size_t) return Label_String_Type is Temp : Unbounded_String; begin -- Check length and adjust if necessary. if Length(Item) >= Integer(C_Length) then Put_Line("*** Warning: Custom label was truncated to" & Integer'Image(Integer(C_Length)) & " characters. ***"); Temp := Head(Item, Integer(C_Length)); return To_C(To_String(Temp), True); else return To_C(To_String(Item & ASCII.nul & (Max_Label_String_Length - Length(Item)) * " "), False); end if; end Unbounded_To_Weird_C; begin -- geolocation_labeler if axis = Label_Y_Axis then label_val := a_value; if label_val > 0.0 then direction_label := To_Unbounded_String(" N"); elsif label_val < 0.0 then direction_label := To_Unbounded_String(" S"); else direction_label := To_Unbounded_String("Eq"); end if; elsif axis = Label_X_Axis then label_val := normalize_longitude(a_value); if label_val > 0.0 then direction_label := To_Unbounded_String(" E"); elsif label_val < 0.0 then direction_label := To_Unbounded_String(" W"); else direction_label := To_Unbounded_String(""); end if; end if; if axis = Label_Y_Axis and a_value = 0.0 then -- A special case for the equator null; else direction_label := Trim(Integer'Image(Integer(abs(label_val))) & direction_label, Left); end if; label := Unbounded_To_Weird_C(direction_label, a_length); end geolocation_labeler; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); Initialize_PLplot; -- Longitude (x) and latitude (y) miny := -70.0; maxy := 80.0; -- Cartesian plots -- Most of world minx := -170.0; maxx := minx + 360.0; -- Setup a custom latitude and longitude-based scaling function. Set_Custom_Label(geolocation_labeler'Unrestricted_Access, System.Null_Address); Set_Pen_Color(Red); Set_Environment(minx, maxx, miny, maxy, Justified, Custom_Labels_Linear_Box_Plus); Draw_Map(null, USA_States_and_Continents, minx, maxx, miny, maxy); -- The Americas minx := 190.0; maxx := 340.0; Set_Pen_Color(Red); Set_Environment(minx, maxx, miny, maxy, Justified, Custom_Labels_Linear_Box_Plus); Draw_Map(null, USA_States_and_Continents, minx, maxx, miny, maxy); -- Clear the labeling function. Use_Default_Labels; -- or... -- plslabelfunc(Null, System.Null_Address); -- Polar, Northern hemisphere minx := 0.0; maxx := 360.0; Set_Environment(-75.0, 75.0, -75.0, 75.0, Justified, Box); Draw_Map(mapform19'Unrestricted_Access, Continents, minx, maxx, miny, maxy); Select_Line_Style(Line_Style => 2); Draw_Latitude_Longitude(mapform19'Unrestricted_Access, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); -- Polar, Northern hemisphere, this time with a PLplot-wide transform minx := 0.0; maxx := 360.0; Set_Custom_Coordinate_Transform(map_transform'Unrestricted_Access, System.Null_Address); Select_Line_Style(1); Set_Environment(-75.0, 75.0, -75.0, 75.0, Justified, Box); -- No need to set the map transform here as the global transform will be used. Draw_Map(null, Continents, minx, maxx, miny, maxy); Select_Line_Style(2); Draw_Latitude_Longitude(null, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); -- Show Baltimore, MD on the map. Set_Pen_Color(Yellow); Set_Symbol_Size(0.0, 2.0); x(1) := -76.6125; y(1) := 39.2902778; Draw_Points(x, y, 18); Set_Symbol_Size(0.0, 1.0); Write_Text_World(-76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD"); -- Clear the global transform. Clear_Custom_Coordinate_Transform; -- or... -- Set_Custom_Coordinate_Transform(null, System.Null_Address); End_PLplot; end xthick19a; plplot-5.10.0+dfsg/examples/ada/xthick15a.adb 644 1750 1750 2075612143252635 176010ustar andrewandrew-- $Id: xthick15a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- Shade plot demo. -- Maurice LeBrun -- IFS, University of Texas at Austin -- 31 Aug 1993 -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, System, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; procedure xthick15a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y zmin, zmax, xx, yy : Long_Float; z : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); ---------------------------------------------------------------------------- -- cmap1_init2 -- Initializes color map 1 in HLS space. ---------------------------------------------------------------------------- procedure cmap1_init2 is i, h, l, s : Real_Vector(0 .. 3); begin -- Set control points. i(0) := 0.0; -- left boundary i(1) := 0.45; -- just before center i(2) := 0.55; -- just after center i(3) := 1.0; -- right boundary -- Set hue levels. h(0) := 260.0; -- low: blue-violet h(1) := 260.0; -- only change as we go over vertex h(2) := 20.0; -- hue -- high: red h(3) := 20.0; -- keep fixed -- Set lightness levels. l(0) := 0.6; -- low l(1) := 0.0; -- center l(2) := 0.0; -- center l(3) := 0.6; -- high -- Set saturation levels. s(0) := 1.0; -- low s(1) := 0.5; -- center s(2) := 0.5; -- center s(3) := 1.0; -- high Set_Color_Map_1_Piecewise(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init2; ---------------------------------------------------------------------------- -- plot1 -- Illustrates a single shaded region. ---------------------------------------------------------------------------- procedure plot1 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; sh_width : Long_Float; min_color, max_color : Integer; min_width, max_width : Long_Float; begin Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); -- Plot using identity transform -- shade_min := zmin + (zmax-zmin) * 0.4; shade_max := zmin + (zmax-zmin) * 0.6; sh_color := 7.0; sh_width := 2.0; min_color := 9; max_color := 2; min_width := 2.0; max_width := 2.0; Select_Fill_Pattern(8); Shade_Region_1(z, Mask_Function_No_Mask'access, -1.0, 1.0, -1.0, 1.0, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, Fill_Polygon'access, True, Null, System.Null_Address); Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Yellow); Write_Labels("distance", "altitude", "Bogon flux"); end plot1; ---------------------------------------------------------------------------- -- plot2 -- Illustrates multiple adjacent shaded regions, using different fill -- patterns for each region. ---------------------------------------------------------------------------- procedure plot2 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; sh_width : Long_Float; min_color, max_color : Integer := 0; min_width, max_width : Long_Float := 0.0; -- C run amok. The following arrays are made to accommodate the -- original example which is written in perverse C. inc_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); inc_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := ((450, -450), (0, 900), (0, 450), (450, -450), (0, 900)); del_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); del_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := ((2000, 2000), (2000, 2000), (2000, 2000), (4000, 4000), (4000, 2000)); begin -- Initialize the rest of the amokified arrays. inc_0_To_4(0)(0) := 450; inc_0_To_4(1)(0) := -450; inc_0_To_4(2)(0) := 0; inc_0_To_4(3)(0) := 900; inc_0_To_4(4)(0) := 300; del_0_To_4(0)(0) := 2000; del_0_To_4(1)(0) := 2000; del_0_To_4(2)(0) := 2000; del_0_To_4(3)(0) := 2000; del_0_To_4(4)(0) := 2000; sh_width := 2.0; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); -- Plot using identity transform for i in 0 .. 9 loop shade_min := zmin + (zmax - zmin) * Long_Float(i) / 10.0; shade_max := zmin + (zmax - zmin) * Long_Float(i +1) / 10.0; sh_color := Long_Float(i + 6); if i in 0 .. 4 then Set_Fill_Pattern(inc_0_To_4(i), del_0_To_4(i)); else Set_Fill_Pattern(inc_5_To_9(i), del_5_To_9(i)); end if; Shade_Region_1(z, Mask_Function_No_Mask'access, -1.0, 1.0, -1.0, 1.0, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, Fill_Polygon'access, True, Null, System.Null_Address); end loop; Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Yellow); Write_Labels("distance", "altitude", "Bogon flux"); end plot2; ---------------------------------------------------------------------------- -- plot3 -- Illustrates shaded regions in 3d, using a different fill pattern for -- each region. ---------------------------------------------------------------------------- procedure plot3 is xx : array (0 .. 1) of Real_Vector(0 ..4) := ((-1.0, 1.0, 1.0, -1.0, -1.0), (-1.0, 1.0, 1.0, -1.0, -1.0)); yy : array (0 .. 1) of Real_Vector(0 ..4) := ((1.0, 1.0, 0.0, 0.0, 1.0), (-1.0, -1.0, 0.0, 0.0, -1.0)); zz : array (0 .. 1) of Real_Vector(0 ..4) := ((0.0, 0.0, 1.0, 1.0, 0.0), (0.0, 0.0, 1.0, 1.0, 0.0)); begin Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Set_Up_3D(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30.0, -40.0); -- Plot using identity transform Set_Pen_Color(Red); Box_Around_Viewport_3D("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); Set_Pen_Color(Yellow); Write_Labels("","","3-d polygon filling"); Set_Pen_Color(Green); Select_Fill_Pattern(1); Draw_Curve_3D(xx(0), yy(0), zz(0)); Fill_Polygon_3D(xx(0)(0 .. 3), yy(0)(0 .. 3), zz(0)(0 .. 3)); Select_Fill_Pattern(2); Draw_Curve_3D(xx(1), yy(1), zz(1)); Fill_Polygon_3D(xx(1)(0 .. 3), yy(1)(0 .. 3), zz(1)(0 .. 3)); end; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Set up color map 1 cmap1_init2; -- Initialize plplot Initialize_PLplot; -- Set up data array for i in z'range(1) loop xx := Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); for j in z'range(2) loop yy := Long_Float(j - YPTS / 2) / Long_Float(YPTS / 2) - 1.0; z(i, j) := xx*xx - yy*yy + (xx - yy)/(xx*xx+yy*yy + 0.1); end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_Max(z); plot1; plot2; plot3; End_PLplot; end xthick15a; plplot-5.10.0+dfsg/examples/ada/xthick25a.adb 644 1750 1750 1276111543675237 176110ustar andrewandrew-- $Id: xthick25a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Filling and clipping polygons. -- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with PLplot_Auxiliary, PLplot; use PLplot_Auxiliary, PLplot; -- Test program for filling polygons and proper clipping procedure xthick25a is npts : Integer := 0; xextreme, yextreme : Real_Matrix(0 .. 8, 0 .. 1); x0, y0 : Real_Vector(0 .. 9); begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Set_Number_Of_Subpages(3,3); Initialize_PLplot; xextreme(0, 0) := -120.0; xextreme(0, 1) := 120.0; yextreme(0, 0) := -120.0; yextreme(0, 1) := 120.0; xextreme(1, 0) := -120.0; xextreme(1, 1) := 120.0; yextreme(1, 0) := 20.0; yextreme(1, 1) := 120.0; xextreme(2, 0) := -120.0; xextreme(2, 1) := 120.0; yextreme(2, 0) := -20.0; yextreme(2, 1) := 120.0; xextreme(3, 0) := -80.0; xextreme(3, 1) := 80.0; yextreme(3, 0) := -20.0; yextreme(3, 1) := 120.0; xextreme(4, 0) := -220.0; xextreme(4, 1) := -120.0; yextreme(4, 0) := -120.0; yextreme(4, 1) := 120.0; xextreme(5, 0) := -20.0; xextreme(5, 1) := 20.0; yextreme(5, 0) := -120.0; yextreme(5, 1) := 120.0; xextreme(6, 0) := -20.0; xextreme(6, 1) := 20.0; yextreme(6, 0) := -20.0; yextreme(6, 1) := 20.0; xextreme(7, 0) := -80.0; xextreme(7, 1) := 80.0; yextreme(7, 0) := -80.0; yextreme(7, 1) := 80.0; xextreme(8, 0) := 20.0; xextreme(8, 1) := 120.0; yextreme(8, 0) := -120.0; yextreme(8, 1) := 120.0; for k in 0 .. 1 loop for j in 0 .. 3 loop if j = 0 then -- Polygon 1: a diamond x0(0) := 0.0; y0(0) := -100.0; x0(1) := -100.0; y0(1) := 0.0; x0(2) := 0.0; y0(2) := 100.0; x0(3) := 100.0; y0(3) := 0.0; npts := 4; end if; if j = 1 then -- Polygon 1: a diamond - reverse direction x0(3) := 0.0; y0(3) := -100.0; x0(2) := -100.0; y0(2) := 0.0; x0(1) := 0.0; y0(1) := 100.0; x0(0) := 100.0; y0(0) := 0.0; npts := 4; end if; if j = 2 then -- Polygon 2: a square with punctures x0(0) := -100.0; y0(0) := -100.0; x0(1) := -100.0; y0(1) := -80.0; x0(2) := 80.0; y0(2) := 0.0; x0(3) := -100.0; y0(3) := 80.0; x0(4) := -100.0; y0(4) := 100.0; x0(5) := -80.0; y0(5) := 100.0; x0(6) := 0.0; y0(6) := 80.0; x0(7) := 80.0; y0(7) := 100.0; x0(8) := 100.0; y0(8) := 100.0; x0(9) := 100.0; y0(9) := -100.0; npts := 10; end if; if j = 3 then -- Polygon 2: a square with punctures - reversed direction x0(9) := -100.0; y0(9) := -100.0; x0(8) := -100.0; y0(8) := -80.0; x0(7) := 80.0; y0(7) := 0.0; x0(6) := -100.0; y0(6) := 80.0; x0(5) := -100.0; y0(5) := 100.0; x0(4) := -80.0; y0(4) := 100.0; x0(3) := 0.0; y0(3) := 80.0; x0(2) := 80.0; y0(2) := 100.0; x0(1) := 100.0; y0(1) := 100.0; x0(0) := 100.0; y0(0) := -100.0; npts := 10; end if; for i in xextreme'range(1) loop Advance_To_Subpage(Next_Subpage); Set_Viewport_Standard; Set_Viewport_World(xextreme(i, 0), xextreme(i, 1), yextreme(i, 0), yextreme(i, 1)); declare x0_Stop_Sucking, y0_Stop_Sucking : Real_Vector(0 .. npts - 1); begin x0_Stop_Sucking := x0(0 .. npts - 1); y0_Stop_Sucking := y0(0 .. npts - 1); Set_Pen_Color(Yellow); Box_Around_Viewport("bc", 1.0, 0, "bcnv", 10.0, 0); Set_Pen_Color(Red); Select_Fill_Pattern(0); -- Solid fill or gradient fill if k = 0 then Fill_Polygon(x0_Stop_Sucking, y0_Stop_Sucking); else Fill_Polygon_Gradient(x0_Stop_Sucking, y0_Stop_Sucking, 45.0); end if; Set_Pen_Color(Yellow); Select_Line_Style(1); Draw_Curve(x0_Stop_Sucking, y0_Stop_Sucking); end; end loop; -- i end loop; -- j end loop; -- k -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick25a; plplot-5.10.0+dfsg/examples/ada/xthick18a.adb 644 1750 1750 1251311543675237 176060ustar andrewandrew-- $Id: xthick18a.adb 11680 2011-03-27 17:57:51Z airwin $ -- 3-d line and point plot demo. Adapted from x08c.c. -- Copyright (C) 2008 - 2011 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, System, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; procedure xthick18a is ---------------------------------------------------------------------------- -- Does a series of 3-d plots for a given data set, with different -- viewing options in each plot. ---------------------------------------------------------------------------- opt : array(0 .. 3) of Boolean := (True, False, True, False); alt : Real_Vector(0 .. 3) := (20.0, 35.0, 50.0, 65.0); az : Real_Vector(0 .. 3) := (30.0, 40.0, 50.0, 60.0); NPTS : constant Integer := 1000; x, y, z : Real_Vector(0 .. NPTS - 1); r : Long_Float; procedure test_poly(k : Integer) is x, y, z : Real_Vector(0 .. 4); Two_Pi : Long_Float := 2.0 * pi; draw : array(0 .. 3) of Boolean_Array_1D(0 .. 3); function THETA(a : Integer) return Long_Float is begin return Two_Pi * Long_Float(a) / 20.0; end; function PHI(a : Integer) return Long_Float is begin return pi * Long_Float(a) / 20.1; end; begin draw(0) := (True, True, True, True); draw(1) := (True, False, True, False); draw(2) := (False, True, False, True); draw(3) := (True, True, False, False); Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.9); Set_Viewport_World(-1.0, 1.0, -0.9, 1.1); Set_Pen_Color(Red); Set_Up_3D(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt(k), az(k)); Box_Around_Viewport_3D("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); Set_Pen_Color(Yellow); for i in 0 .. 19 loop for j in 0 .. 19 loop x(0) := sin(PHI(j)) * cos(THETA(i)); y(0) := sin(PHI(j)) * sin(THETA(i)); z(0) := cos(PHI(j)); x(1) := sin(PHI(j + 1)) * cos(THETA(i)); y(1) := sin(PHI(j + 1)) * sin(THETA(i)); z(1) := cos(PHI(j + 1)); x(2) := sin(PHI(j + 1)) * cos(THETA(i + 1)); y(2) := sin(PHI(j + 1)) * sin(THETA(i + 1)); z(2) := cos(PHI(j + 1)); x(3) := sin(PHI(j)) * cos(THETA(i + 1)); y(3) := sin(PHI(j)) * sin(THETA(i + 1)); z(3) := cos(PHI(j)); x(4) := sin(PHI(j)) * cos(THETA(i)); y(4) := sin(PHI(j)) * sin(THETA(i)); z(4) := cos(PHI(j)); Draw_Polygon_3D(x, y, z, draw(k), True ); end loop; end loop; Set_Pen_Color(Green); Write_Text_Viewport("t", 1.0, 0.5, 0.5, "unit radius sphere" ); end test_poly; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; for k in 0 .. 3 loop test_poly(k); end loop; -- From the mind of a sick and twisted physicist... for i in x'range loop z(i) := -1.0 + 2.0 * Long_Float(i) / Long_Float(NPTS); -- Pick one... r := z(i); x(i) := r * cos( 2.0 * pi * 6.0 * Long_Float(i) / Long_Float(NPTS) ); y(i) := r * sin( 2.0 * pi * 6.0 * Long_Float(i) / Long_Float(NPTS) ); end loop; for k in opt'range loop Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.9); Set_Viewport_World(-1.0, 1.0, -0.9, 1.1); Set_Pen_Color(Red); Set_Up_3D(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt(k), az(k)); Box_Around_Viewport_3D("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); Set_Pen_Color(Yellow); if opt(k) then Draw_Curve_3D(x, y, z); else Draw_String_3D(x, y, z, "⋅"); end if; Set_Pen_Color(Green); Write_Text_Viewport("t", 1.0, 0.5, 0.5, "#frPLplot Example 18 - Alt=" & Trim(Integer'image(Integer(alt(k))), Left) & ", Az=" & Trim(Integer'image(Integer( az(k))), Left)); end loop; End_PLplot; end xthick18a; plplot-5.10.0+dfsg/examples/ada/x00a.adb 644 1750 1750 357311653727550 165360ustar andrewandrew-- $Id: x00a.adb 12021 2011-11-01 08:35:52Z jbauck $ -- -- Simple demo of a 2D line plot. -- -- Copyright (C) 2011 Jerry Bauck -- -- This file is part of PLplot. -- -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- See x00_easy_a.adb for an easier way to generate similar results using -- Ada-specific extensions to PLplot. -- See x00thicka.adb for a version of this program that uses easy-to-read names. with PLplot_Auxiliary, PLplot_Traditional; use PLplot_Auxiliary, PLplot_Traditional; procedure x00a is x, y : Real_Vector(0 .. 100); x_Min, y_Min : Long_Float := 0.0; x_Max : Long_Float := 1.0; y_Max : Long_Float := 100.0; begin -- Prepare data to be plotted. for i in x'range loop x(i) := Long_Float(i) / Long_Float(x'length - 1); y(i) := y_Max * x(i)**2; end loop; -- Parse and process command line arguments. plparseopts(PL_PARSE_FULL); -- Initialize plplot. plinit; -- Create a labelled box to hold the plot. plenv(x_Min, x_Max, y_Min, y_Max, 0, 0); pllab("x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot"); -- Plot the data that was prepared above. plline(x, y); -- Close PLplot library. plend; end x00a;plplot-5.10.0+dfsg/examples/ada/x15a.adb 644 1750 1750 2005212143252635 165430ustar andrewandrew-- $Id: x15a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- Shade plot demo. -- Maurice LeBrun -- IFS, University of Texas at Austin -- 31 Aug 1993 -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, System, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; procedure x15a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y zmin, zmax, xx, yy : Long_Float; z : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); ---------------------------------------------------------------------------- -- cmap1_init2 -- Initializes color map 1 in HLS space. ---------------------------------------------------------------------------- procedure cmap1_init2 is i, h, l, s : Real_Vector(0 .. 3); begin -- Set control points. i(0) := 0.0; -- left boundary i(1) := 0.45; -- just before center i(2) := 0.55; -- just after center i(3) := 1.0; -- right boundary -- Set hue levels. h(0) := 260.0; -- low: blue-violet h(1) := 260.0; -- only change as we go over vertex h(2) := 20.0; -- hue -- high: red h(3) := 20.0; -- keep fixed -- Set lightness levels. l(0) := 0.6; -- low l(1) := 0.0; -- center l(2) := 0.0; -- center l(3) := 0.6; -- high -- Set saturation levels. s(0) := 1.0; -- low s(1) := 0.5; -- center s(2) := 0.5; -- center s(3) := 1.0; -- high plscmap1l(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init2; ---------------------------------------------------------------------------- -- plot1 -- Illustrates a single shaded region. ---------------------------------------------------------------------------- procedure plot1 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; sh_width : Long_Float; min_color, max_color : Integer; min_width, max_width : Long_Float; begin pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); -- Plot using identity transform -- shade_min := zmin + (zmax-zmin) * 0.4; shade_max := zmin + (zmax-zmin) * 0.6; sh_color := 7.0; sh_width := 2.0; min_color := 9; max_color := 2; min_width := 2.0; max_width := 2.0; plpsty(8); plshade1(z, Mask_Function_No_Mask'access, -1.0, 1.0, -1.0, 1.0, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plfill'access, True, Null, System.Null_Address); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon flux"); end plot1; ---------------------------------------------------------------------------- -- plot2 -- Illustrates multiple adjacent shaded regions, using different fill -- patterns for each region. ---------------------------------------------------------------------------- procedure plot2 is shade_min, shade_max, sh_color : Long_Float; sh_cmap : Integer := 0; sh_width : Long_Float; min_color, max_color : Integer := 0; min_width, max_width : Long_Float := 0.0; -- C run amok. The following arrays are made to accommodate the -- original example which is written in perverse C. inc_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); inc_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := ((450, -450), (0, 900), (0, 450), (450, -450), (0, 900)); del_0_To_4 : array (0 .. 4) of Integer_Array_1D(0 .. 0); del_5_To_9 : array (5 .. 9) of Integer_Array_1D(0 .. 1) := ((2000, 2000), (2000, 2000), (2000, 2000), (4000, 4000), (4000, 2000)); begin -- Initialize the rest of the amokified arrays. inc_0_To_4(0)(0) := 450; inc_0_To_4(1)(0) := -450; inc_0_To_4(2)(0) := 0; inc_0_To_4(3)(0) := 900; inc_0_To_4(4)(0) := 300; del_0_To_4(0)(0) := 2000; del_0_To_4(1)(0) := 2000; del_0_To_4(2)(0) := 2000; del_0_To_4(3)(0) := 2000; del_0_To_4(4)(0) := 2000; sh_width := 2.0; pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); -- Plot using identity transform for i in 0 .. 9 loop shade_min := zmin + (zmax - zmin) * Long_Float(i) / 10.0; shade_max := zmin + (zmax - zmin) * Long_Float(i +1) / 10.0; sh_color := Long_Float(i + 6); if i in 0 .. 4 then plpat(inc_0_To_4(i), del_0_To_4(i)); else plpat(inc_5_To_9(i), del_5_To_9(i)); end if; plshade1(z, Mask_Function_No_Mask'access, -1.0, 1.0, -1.0, 1.0, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plfill'access, True, Null, System.Null_Address); end loop; plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon flux"); end plot2; ---------------------------------------------------------------------------- -- plot3 -- Illustrates shaded regions in 3d, using a different fill pattern for -- each region. ---------------------------------------------------------------------------- procedure plot3 is xx : array (0 .. 1) of Real_Vector(0 ..4) := ((-1.0, 1.0, 1.0, -1.0, -1.0), (-1.0, 1.0, 1.0, -1.0, -1.0)); yy : array (0 .. 1) of Real_Vector(0 ..4) := ((1.0, 1.0, 0.0, 0.0, 1.0), (-1.0, -1.0, 0.0, 0.0, -1.0)); zz : array (0 .. 1) of Real_Vector(0 ..4) := ((0.0, 0.0, 1.0, 1.0, 0.0), (0.0, 0.0, 1.0, 1.0, 0.0)); begin pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30.0, -40.0); -- Plot using identity transform plcol0(1); plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); plcol0(2); pllab("","","3-d polygon filling"); plcol0(3); plpsty(1); plline3(xx(0), yy(0), zz(0)); plfill3(xx(0)(0 .. 3), yy(0)(0 .. 3), zz(0)(0 .. 3)); plpsty(2); plline3(xx(1), yy(1), zz(1)); plfill3(xx(1)(0 .. 3), yy(1)(0 .. 3), zz(1)(0 .. 3)); end; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Set up color map 1 cmap1_init2; -- Initialize plplot plinit; -- Set up data array for i in z'range(1) loop xx := Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); for j in z'range(2) loop yy := Long_Float(j - YPTS / 2) / Long_Float(YPTS / 2) - 1.0; z(i, j) := xx*xx - yy*yy + (xx - yy)/(xx*xx+yy*yy + 0.1); end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_Max(z); plot1; plot2; plot3; plend; end x15a; plplot-5.10.0+dfsg/examples/ada/xthick24a.adb 644 1750 1750 711111543675237 175610ustar andrewandrew-- $Id: xthick24a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Unicode Pace Flag -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with PLplot_Auxiliary, PLplot; use PLplot_Auxiliary, PLplot; procedure xthick24a is red : Integer_Array_1D(0 .. 6) := (240, 204, 204, 204, 0, 39, 125); green : Integer_Array_1D(0 .. 6) := (240, 0, 125, 204, 204, 80, 0); blue : Integer_Array_1D(0 .. 6) := (240, 0, 0, 0, 0, 204, 125); px : Real_Vector(0 .. 3) := (0.0, 0.0, 1.0, 1.0); py : Real_Vector(0 .. 3) := (0.0, 0.25, 0.25, 0.0); sx : Real_Vector(0 .. 11) := ( 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647); sy : Real_Vector(0 .. 11) := ( 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875); -- Taken from http://www.columbia.edu/~fdc/pace/ function peace(which : Integer) return String is begin -- Mandarin if which = 0 then return "#<0x00>和平"; end if; -- Hindi if which = 1 then return "#<0x20>शांति"; end if; -- English if which = 2 then return "#<0x10>Peace"; end if; -- Hebrew if which = 3 then return "#<0x10>שלום"; end if; -- Russian if which = 4 then return "#<0x10>Мир"; end if; -- German if which = 5 then return "#<0x10>Friede"; end if; -- Korean if which = 6 then return "#<0x30>평화"; end if; -- French if which = 7 then return "#<0x10>Paix"; end if; -- Spanish if which = 8 then return "#<0x10>Paz"; end if; -- Arabic if which = 9 then return "#<0x10>ﺳﻼم"; end if; -- Turkish if which = 10 then return "#<0x10>Barış"; end if; -- Kurdish if which = 11 then return "#<0x10>Hasîtî"; end if; return "oops"; end peace; begin Parse_Command_Line_Arguments(Parse_Full); Initialize_PLplot; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Set_Pen_Color(Black); Box_Around_Viewport("", 1.0, 0, "", 1.0, 0); Set_Number_Of_Colors_Map_0(7); Set_Color_Map_0(red, green, blue); Set_Character_Height(0.0, 4.0); Set_Font_Style(Normal_Font); for i in 0 .. 3 loop Set_Pen_Color(i + 1); Fill_Polygon(4, px, py); for j in 0 .. 3 loop py(j) := py(j) + 1.0 / 4.0; end loop; end loop; Set_Pen_Color(Black); for i in 0 .. 11 loop Write_Text_World(sx(i), sy(i), 1.0, 0.0, 0.5, peace(i)); end loop; End_PLplot; end xthick24a; plplot-5.10.0+dfsg/examples/ada/xthick27a.adb 644 1750 1750 2017311616742251 175770ustar andrewandrew-- $Id: xthick27a.adb 11860 2011-08-05 10:23:37Z andrewross $ -- Drawing "spirograph" curves - epitrochoids, cycolids, roulettes -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; ------------------------------------------------------------------------------ -- Generates two kinds of plots: -- - construction of a cycloid (animated) -- - series of epitrochoids and hypotrochoids ------------------------------------------------------------------------------ procedure xthick27a is -- R, r, p, N -- R and r should be integers to give correct termination of the -- angle loop using gcd. -- N.B. N is just a place holder since it is no longer used -- (because we now have proper termination of the angle loop). params : Real_Matrix(0 .. 8, 0 .. 3) := ((21.0, 7.0, 7.0, 3.0), (21.0, 7.0, 10.0, 3.0), (21.0, -7.0, 10.0, 3.0), (20.0, 3.0, 7.0, 20.0), (20.0, 3.0, 10.0, 20.0), (20.0, -3.0, 10.0, 20.0), (20.0, 13.0, 7.0, 20.0), (20.0, 13.0, 20.0, 20.0), (20.0,-13.0, 20.0, 20.0)); fill : Boolean; -- To understand why spiro is written this way you need to understand the -- C code from which this was derived. In the main C program, params -- is a two-dimensional array with 9 rows numbered 0 .. 8 and 4 columns -- numbered 0 .. 3. When spiro is called, it is passed the _address_ of the -- element of params's ith row, 0th column--nothing else. Then, inside spiro, -- the corresponding entity (also called params!) appears as a -- _one-dimensional_ array whose 0th element shares the same address as what -- was passed from the main program. So memory locations starting there, -- and numbered from 0, represent the 1D array equivalent to the ith row of -- params in the main program. Wilma, call Barney--we're programming a -- micaprocessor here. procedure spiro(params : Real_Matrix; row : Integer; fill : Boolean) is NPNT : constant Integer := 2000; xcoord, ycoord : Real_Vector(0 .. NPNT); windings : Integer; steps : Integer; phi : Long_Float; phiw : Long_Float; dphi : Long_Float; xmin : Long_Float; xmax : Long_Float; xrange_adjust : Long_Float; ymin : Long_Float; ymax : Long_Float; yrange_adjust : Long_Float; function Trunc(a : Long_Float) return Integer renames PLplot_Auxiliary.Trunc; -- Calculate greatest common divisor following pseudo-code for the -- Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm function gcd(a, b : Integer) return Integer is t : Integer; aa : Integer := a; bb : Integer := b; begin aa := abs(aa); bb := abs(bb); while bb /= 0 loop t := bb; bb := aa mod bb; aa := t; end loop; return aa; end gcd; begin -- spiro -- Fill the coordinates. -- Proper termination of the angle loop very near the beginning -- point, see http://mathforum.org/mathimages/index.php/Hypotrochoid windings := Trunc(abs(params(row, 1)) / Long_Float(gcd(Trunc(params(row, 0)), Trunc(params(row, 1))))); steps := NPNT / windings; dphi := 2.0 * pi / Long_Float(steps); for i in 0 .. windings * steps loop phi := Long_Float(i) * dphi; phiw := (params(row, 0) - params(row, 1)) / params(row, 1) * phi; xcoord(i) := (params(row, 0) - params(row, 1)) * cos(phi) + params(row, 2) * cos(phiw); ycoord(i) := (params(row, 0) - params(row, 1)) * sin(phi) - params(row, 2) * sin(phiw); if i = 0 then xmin := xcoord(i); xmax := xcoord(i); ymin := ycoord(i); ymax := ycoord(i); end if; if xmin > xcoord(i) then xmin := xcoord(i); end if; if xmax < xcoord(i) then xmax := xcoord(i); end if; if ymin > ycoord(i) then ymin := ycoord(i); end if; if ymax < ycoord(i) then ymax := ycoord(i); end if; end loop; xrange_adjust := 0.15 * (xmax - xmin); xmin := xmin - xrange_adjust; xmax := xmax + xrange_adjust; yrange_adjust := 0.15 * (ymax - ymin); ymin := ymin - yrange_adjust; ymax := ymax + yrange_adjust; Set_Viewport_World(xmin, xmax, ymin, ymax); Set_Pen_Color(Red); declare xcoord_local, ycoord_local : Real_Vector(0 .. steps * windings); begin xcoord_local := xcoord(0 .. steps * windings); ycoord_local := ycoord(0 .. steps * windings); if fill then Fill_Polygon(xcoord_local, ycoord_local); else Draw_Curve(xcoord_local, ycoord_local); end if; end; end spiro; procedure cycloid is begin null; -- TODO end cycloid; procedure arcs is NSEG : constant Integer := 8; theta : Long_Float; dtheta : Long_Float; a : Long_Float; b : Long_Float; begin theta := 0.0; dtheta := 360.0/Long_Float(NSEG); Set_Environment( -10.0, 10.0, -10.0, 10.0, 1, 0 ); -- Plot segments of circle in different colors for i in 0 .. NSEG-1 loop Set_Pen_Color( (i mod 2) + 1 ); Draw_Arc(0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, False); theta := theta + dtheta; end loop; -- Draw several filled ellipses inside the circle at different -- angles. a := 3.0; b := a * tan( (dtheta/180.0*pi)/2.0 ); theta := dtheta/2.0; for i in 0 .. NSEG-1 loop Set_Pen_Color( 2 - (i mod 2 ) ); Draw_Arc( a*cos(theta/180.0*pi), a*sin(theta/180.0*pi), a, b, 0.0, 360.0, theta, True); theta := theta + dtheta; end loop; end arcs; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; -- Illustrate the construction of a cycloid cycloid; -- Loop over the various curves. -- First an overview, then all curves one by one Set_Number_Of_Subpages(3, 3) ; -- Three by three window -- Overview fill := False; for i in params'range(1) loop Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized( 0.0, 1.0, 0.0, 1.0); spiro(params, i, fill); end loop; -- Don't fill the curves. Advance_To_Subpage(Next_Subpage); Set_Number_Of_Subpages(1, 1) ; -- One window per curve for i in params'range(1) loop Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); spiro(params, i, fill); end loop; -- Fill the curves fill := True; Advance_To_Subpage(Next_Subpage); Set_Number_Of_Subpages(1, 1); -- One window per curve for i in params'range(1) loop Advance_To_Subpage(Next_Subpage) ; Set_Viewport_Normalized( 0.0, 1.0, 0.0, 1.0 ) ; spiro(params, i, fill); end loop; arcs; -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick27a; plplot-5.10.0+dfsg/examples/ada/xthick29a.adb 644 1750 1750 3333211543675237 176120ustar andrewandrew-- $Id: xthick29a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Sample plots using date / time formatting for axes -- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; -------------------------------------------------------------------------------- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. -- Time formatting is done using the strfqsas routine from the qsastime -- library. This is similar to strftime, but works for a broad -- date range even on 32-bit systems. See the -- documentation of strfqsas for full details of the available formats. -- -- 1) Plotting temperature over a day (using hours / minutes) -- 2) Plotting -- -- Note: We currently use the default call for plconfigtime (done in -- plinit) which means continuous times are interpreted as seconds since -- 1970-01-01, but that may change in future, more extended versions of -- this example. -------------------------------------------------------------------------------- -- NOTE: The Ada user is reminded that Ada.Calendar is very capable and complete. -- See especially Time_Of. procedure xthick29a is -- Plot a model diurnal cycle of temperature procedure plot1 is x, y : Real_Vector(0 .. 72); xerr1, xerr2, yerr1, yerr2 : Real_Vector(0 .. 72); -- Data points every 10 minutes for 1 day xmin, xmax, ymin, ymax : Long_Float; begin xmin := 0.0; xmax := 60.0 * 60.0 * 24.0; -- Number of seconds in a day ymin := 10.0; ymax := 20.0; for i in x'range loop x(i) := xmax * Long_Float(i) / Long_Float(x'length); y(i) := 15.0 - 5.0 * cos( 2.0 * pi * Long_Float(i) / Long_Float(x'length)); -- Set x error bars to +/- 5 minute xerr1(i) := x(i) - Long_Float(60 * 5); xerr2(i) := x(i) + Long_Float(60 * 5); -- Set y error bars to +/- 0.1 deg C */ yerr1(i) := y(i) - 0.1; yerr2(i) := y(i) + 0.1; end loop; Advance_To_Subpage(Next_Subpage); -- Rescale major ticks marks by 0.5 Set_Major_Tick_Length(0.0, 0.5); -- Rescale minor ticks and error bar marks by 0.5 Set_Minor_Tick_Length(0.0, 0.5); Set_Viewport_Standard; Set_Viewport_World(xmin, xmax, ymin, ymax); -- Draw a box with ticks spaced every 3 hours in X and 1 degree C in Y. Set_Pen_Color(Red); -- Set time format to be hours:minutes Set_Date_Time_Label_Format("%H:%M"); Box_Around_Viewport("bcnstd", 3.0 * 60.0 * 60.0, 3, "bcnstv", 1.0, 5); Set_Pen_Color(Green); Write_Labels("Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature"); Set_Pen_Color(Aquamarine); Draw_Curve(x, y); Set_Pen_Color(Yellow); Draw_Error_Bars_X(xerr1, xerr2, y); Set_Pen_Color(Green); Draw_Error_Bars_Y(x, yerr1, yerr2); -- Rescale major / minor tick marks back to default Set_Minor_Tick_Length(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); end plot1; -- Plot the number of hours of daylight as a function of day for a year procedure plot2 is xmin, xmax, ymin, ymax : Long_Float; lat, p, d : Long_Float; x, y : Real_Vector(0 .. 364); begin -- Latitude for London lat := 51.5; xmin := 0.0; xmax := Long_Float(x'length) * 60.0 * 60.0 * 24.0; ymin := 0.0; ymax := 24.0; -- Formula for hours of daylight from -- "A Model Comparison for Daylength as a Function of Latitude and -- Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for j in x'range loop x(j):= Long_Float(j) * 60.0 * 60.0 * 24.0; p := arcsin(0.39795 * cos(0.2163108 + 2.0 * arctan(0.9671396 * tan(0.00860 * Long_Float(j-186))))); d := 24.0 - (24.0 / pi) * arccos((sin(0.8333 * pi / 180.0) + sin(lat * pi / 180.0) * sin(p)) / (cos(lat * pi / 180.0) * cos(p))); y(j):= d; end loop; Set_Pen_Color(Red); -- Set time format to be abbreviated month name followed by day of month Set_Date_Time_Label_Format("%b %d"); Set_Numeric_Label_Precision(True, 1); Set_Environment(xmin, xmax, ymin, ymax, 0, 40); Set_Pen_Color(Green); Write_Labels("Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N"); Set_Pen_Color(Aquamarine); Draw_Curve(x, y); Set_Numeric_Label_Precision(False, 0); end plot2; procedure plot3 is xmin, xmax, ymin, ymax, tstart : Long_Float; x, y : Real_Vector(0 .. 61); begin -- Calculate continuous time corresponding to 2005-12-01 UTC. Continuous_From_Broken_Down_Time(2005, 11, 01, 0, 0, 0.0, tstart); xmin := tstart; xmax := xmin + Long_Float(x'length) * 60.0 * 60.0 * 24.0; ymin := 0.0; ymax := 5.0; for i in x'range loop x(i) := xmin + Long_Float(i) * 60.0 * 60.0 * 24.0; y(i) := 1.0 + sin(2.0 * pi * Long_Float(i) / 7.0) + exp((Long_Float(Integer'min(i, x'length - i))) / 31.0); end loop; Advance_To_Subpage(Next_Subpage); Set_Viewport_Standard; Set_Viewport_World(xmin, xmax, ymin, ymax); Set_Pen_Color(Red); -- Set time format to be ISO 8601 standard YYYY-MM-DD. Set_Date_Time_Label_Format("%F"); -- Draw a box with ticks spaced every 14 days in X and 1 hour in Y. Box_Around_Viewport("bcnstd", 14.0 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1.0, 4); Set_Pen_Color(Green); Write_Labels("Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"); Set_Pen_Color(Aquamarine); -- Rescale symbol size (used by Draw_Points) by 0.5 Set_Symbol_Size(0.0,0.5); Draw_Points(x, y, 2); Draw_Curve(x, y); end plot3; procedure plot4 is -- TAI-UTC (seconds) as a function of time. -- Use Besselian epochs as the continuous time interval just to prove -- this does not introduce any issues. scale, offset1, offset2 : Long_Float; xmin, xmax, ymin, ymax, xlabel_step : Long_Float; npts : Integer; if_TAI_time_format : Boolean; time_format : Unbounded_String := To_Unbounded_String(""); title_suffix : Unbounded_String := To_Unbounded_String(""); xtitle : Unbounded_String := To_Unbounded_String(""); title : Unbounded_String := To_Unbounded_String(""); x, y : Real_Vector(0 .. 1000); tai_year, tai_month, tai_day, tai_hour, tai_min : Integer; tai_sec, tai : Long_Float; utc_year, utc_month, utc_day, utc_hour, utc_min : Integer; utc_sec, utc : Long_Float; begin -- Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch -- B = 1900. + (JD -2415020.31352)/365.242198781 -- => (as calculated with aid of "bc -l" command) -- B = (MJD + 678940.364163900)/365.242198781 -- => -- MJD = B*365.24219878 - 678940.364163900 scale := 365.242198781; offset1 := -678940.0; offset2 := -0.3641639; Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); for kind in 0 .. 6 loop if kind = 0 then Continuous_From_Broken_Down_Time(1950, 0, 2, 0, 0, 0.0, xmin); Continuous_From_Broken_Down_Time(2020, 0, 2, 0, 0, 0.0, xmax); npts := 70 * 12 + 1; ymin := 0.0; ymax := 36.0; time_format := To_Unbounded_String("%Y%"); if_TAI_time_format := True; title_suffix := To_Unbounded_String("from 1950 to 2020"); xtitle := To_Unbounded_String("Year"); xlabel_step := 10.0; elsif kind = 1 or kind = 2 then Continuous_From_Broken_Down_Time(1961, 7, 1, 0, 0, 1.64757 - 0.20, xmin); Continuous_From_Broken_Down_Time(1961, 7, 1, 0, 0, 1.64757 + 0.20, xmax); npts := 1001; ymin := 1.625; ymax := 1.725; time_format := To_Unbounded_String("%S%2%"); title_suffix := To_Unbounded_String("near 1961-08-01 (TAI)"); xlabel_step := 0.05 / (scale * 86400.0); if kind = 1 then if_TAI_time_format := True; xtitle := To_Unbounded_String("Seconds (TAI)"); else if_TAI_time_format := False; xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); end if; elsif kind = 3 or kind = 4 then Continuous_From_Broken_Down_Time(1963, 10, 1, 0, 0, 2.6972788 - 0.20, xmin); Continuous_From_Broken_Down_Time(1963, 10, 1, 0, 0, 2.6972788 + 0.20, xmax); npts := 1001; ymin := 2.55; ymax := 2.75; time_format := To_Unbounded_String("%S%2%"); title_suffix := To_Unbounded_String("near 1963-11-01 (TAI)"); xlabel_step := 0.05 / (scale * 86400.0); if kind = 3 then if_TAI_time_format := True; xtitle := To_Unbounded_String("Seconds (TAI)"); else if_TAI_time_format := False; xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); end if; elsif kind = 5 or kind = 6 then Continuous_From_Broken_Down_Time(2009, 0, 1, 0, 0, 34.0 - 5.0, xmin); Continuous_From_Broken_Down_Time(2009, 0, 1, 0, 0, 34.0 + 5.0, xmax); npts := 1001; ymin := 32.5; ymax := 34.5; time_format := To_Unbounded_String("%S%2%"); title_suffix := To_Unbounded_String("near 2009-01-01 (TAI)"); xlabel_step := 1.0 / (scale * 86400.0); if kind = 5 then if_TAI_time_format := True; xtitle := To_Unbounded_String("Seconds (TAI)"); else if_TAI_time_format := False; xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); end if; end if; for i in 0 .. npts - 1 loop x(i) := xmin + Long_Float(i) * (xmax - xmin) / (Long_Float(npts - 1)); Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); tai := x(i); Broken_Down_From_Continuous_Time(tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec, tai); Configure_Time_Transformation(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); Broken_Down_From_Continuous_Time(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, tai); Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); Continuous_From_Broken_Down_Time(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, utc); y(i) := (tai - utc) * scale * 86400.0; end loop; Advance_To_Subpage(Next_Subpage); Set_Viewport_Standard; Set_Viewport_World(xmin, xmax, ymin, ymax); Set_Pen_Color(Red); if if_TAI_time_format then Configure_Time_Transformation(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); else Configure_Time_Transformation(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); end if; Set_Date_Time_Label_Format(To_String(time_format)); Box_Around_Viewport("bcnstd", xlabel_step, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Green); title := To_Unbounded_String("@frPLplot Example 29 - TAI-UTC "); title := title & title_suffix; Write_Labels(To_String(xtitle), "TAI-UTC (sec)", To_String(title)); Set_Pen_Color(Aquamarine); if kind = 0 then -- Shorter x and y Draw_Curve(x(0 .. 70 * 12), y(0 .. 70 * 12)); else -- Longer x and y Draw_Curve(x, y); end if; end loop; -- kind end plot4; begin -- main -- Parse command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Change the escape character to a '@' instead of the default '#' Set_Escape_Character('@'); -- Initialize plplot Initialize_PLplot; plot1; plot2; plot3; plot4; -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick29a; plplot-5.10.0+dfsg/examples/ada/x13a.adb 644 1750 1750 760511543675237 165440ustar andrewandrew-- $Id: x13a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Pie chart demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; ------------------------------------------------------------------------------ -- Does a simple pie chart. ------------------------------------------------------------------------------ procedure x13a is j, dthet, theta0, theta1, theta : Integer; just, dx, dy : Long_Float; x, y : Real_Vector(0 .. 499); per : Real_Vector(0 .. 4) := (10.0, 32.0, 12.0, 30.0, 16.0); begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; pladv(0); -- Ensure window has aspect ratio of one so circle is plotted as a circle. plvasp(1.0); plwind(0.0, 10.0, 0.0, 10.0); -- plenv(0.0, 10.0, 0.0, 10.0, 1, -2); plcol0(2); -- n.b. all theta quantities scaled by 2 * pi / 500 to be integers to avoid -- floating point logic problems. theta0 := 0; dthet := 1; for i in per'range loop j := 0; x(j) := 5.0; y(j) := 5.0; j := j + 1; -- n.b. the theta quantities multiplied by 2 * pi / 500 afterward so -- in fact per is interpreted as a percentage. theta1 := Integer(Long_Float(theta0) + 5.0 * per(i)); if i = 4 then theta1 := 500; end if; theta := theta0; while theta <= theta1 loop x(j) := 5.0 + 3.0 * cos((2.0 * pi / 500.0) * Long_Float(theta)); y(j) := 5.0 + 3.0 * sin((2.0 * pi / 500.0) * Long_Float(theta)); j := j + 1; theta := theta + dthet; end loop; plcol0(i + 1); plpsty((i + 3) mod 8 + 1); declare x_Temp, y_Temp : Real_Vector(0 .. j - 1); begin x_Temp := x(0 .. j - 1); y_Temp := y(0 .. j - 1); plfill(x_Temp, y_Temp); plcol0(1); plline(x_Temp, y_Temp); end; just := (2.0 * pi / 500.0) * Long_Float((theta0 + theta1))/2.0; dx := 0.25 * cos(just); dy := 0.25 * sin(just); if (theta0 + theta1) < 250 or (theta0 + theta1) > 750 then just := 0.0; else just := 1.0; end if; if i = 0 then plptex(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Maurice"); elsif i = 1 then plptex(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Geoffrey"); elsif i = 2 then plptex(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Alan"); elsif i = 3 then plptex(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Rafael"); elsif i = 4 then plptex(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Vince"); end if; theta0 := theta - dthet; end loop; plfont(2); plschr(0.0, 1.3); plptex(5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales"); -- Don't forget to call PLEND to finish off! plend; end x13a; plplot-5.10.0+dfsg/examples/ada/x05a.adb 644 1750 1750 334111543675237 165360ustar andrewandrew-- $Id: x05a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Histogram demo. -- Draws a histogram from sample data. -- Copyright (C) 2007 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x05a is NPTS : constant Integer := 2047; data : Real_Vector(0 .. NPTS - 1); delt : Long_Float; -- delta is a reserved word in Ada. begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; -- Fill up data points delt := 2.0 * pi / Long_Float(NPTS); for i in data'range loop data(i) := sin(Long_Float(i) * delt); end loop; plcol0(1); plhist(data, -1.1, 1.1, 44, 0); plcol0(2); pllab("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator"); plend; end x05a; plplot-5.10.0+dfsg/examples/ada/x02a.adb 644 1750 1750 1241612122203655 165370ustar andrewandrew-- $Id: x02a.adb 12300 2013-03-20 00:49:49Z jbauck $ -- Multiple window and color map 0 demo. -- Copyright (C) 2007 Alan W. Irwin -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; ------------------------------------------------------------------------------ -- Demonstrates multiple windows and color map 0 palette, both default and -- user-modified. ------------------------------------------------------------------------------ procedure x02a is -------------------------------------------------------------------------- -- draw_windows -- Draws a set of numbered boxes with colors according to cmap0 entry. -------------------------------------------------------------------------- procedure draw_windows(nw, cmap0_offset : Integer) is vmin, vmax : Long_Float; begin plschr(0.0, 3.5); plfont(4); for i in 0..(nw-1) loop plcol0(i+cmap0_offset); pladv(0); vmin := 0.1; vmax := 0.9; for j in 0..2 loop plwidth(Long_Float(j + 1)); plvpor(vmin, vmax, vmin, vmax); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); vmin := vmin + 0.1; vmax := vmax - 0.1; end loop; plwidth(1.0); plptex(0.5, 0.5, 1.0, 0.0, 0.5, Trim(Integer'image(i), Left)); end loop; end draw_windows; -------------------------------------------------------------------------- -- demo1 -- Demonstrates multiple windows and default color map 0 palette. -------------------------------------------------------------------------- procedure demo1 is begin plbop; -- Divide screen into 16 regions plssub(4, 4); draw_windows(16, 0); pleop; end demo1; -------------------------------------------------------------------------- -- demo2 -- Demonstrates multiple windows, user-modified color map 0 palette, and -- HLS -> RGB translation. -------------------------------------------------------------------------- procedure demo2 is -- Set up cmap0 -- Use 100 custom colors in addition to base 16 r, g, b: Integer_Array_1D(0..115); -- Min & max lightness values lmin : Long_Float := 0.15; lmax : Long_Float := 0.85; h, l, s : Long_Float; r1, g1, b1 : Long_Float; begin plbop; -- Divide screen into 100 regions. plssub(10, 10); for i in 0..99 loop -- Bounds on HLS, from plhlsrgb() commentary -- hue [0., 360.] degrees -- lightness [0., 1.] magnitude -- saturation [0., 1.] magnitude -- Vary hue uniformly from left to right h := (360.0 / 10.0 ) * Long_Float( i mod 10 ); -- Vary lightness uniformly from top to bottom, between min & max. l := lmin + (lmax - lmin) * Long_Float(i / 10) / 9.0; -- Use max saturation. s := 1.0; plhlsrgb(h, l, s, r1, g1, b1); -- Ada converts floats to integers by rounding while C does so by -- truncation. There is no fool-proof way to fix that but this is pretty -- close: Add a bit less than 1/2 to the float before converting. A good -- number to use appears to be about 0.5 - 10^-16 which _might_ -- be an exact fix for 64-bit floats since they have about 16 digits -- of accuracy. r(i+16) := Integer((r1 * 255.001) - 0.499999999999999); g(i+16) := Integer((g1 * 255.001) - 0.499999999999999); b(i+16) := Integer((b1 * 255.001) - 0.499999999999999); end loop; -- Load default cmap0 colors into our custom set. for i in 0..15 loop plgcol0(i, r(i), g(i), b(i)); end loop; -- Now set cmap0 all at once (faster, since fewer driver calls). plscmap0(r, g, b); draw_windows(100, 16); pleop; end demo2; begin -- Parse and process command line arguments. plparseopts(PL_PARSE_FULL); -- Initialize plplot. plinit; -- Run demos. demo1; demo2; -- Don't forget to call plend to finish off! plend; end x02a; plplot-5.10.0+dfsg/examples/ada/x08a.adb 644 1750 1750 1353312012305413 165370ustar andrewandrew-- $Id: x08a.adb 12212 2012-08-13 23:17:31Z airwin $ -- 3-d plot demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; procedure x08a is XPTS : Integer := 35; YPTS : Integer := 46; x : Real_Vector(0 .. XPTS - 1); y : Real_Vector(0 .. YPTS - 1); z : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); xx, yy, r : Long_Float; zmin, zmax, step : Long_Float; LEVELS : Integer := 10; clevel: Real_Vector(0 .. LEVELS - 1); nlevel : Integer := LEVELS; rosen : Boolean := True; sombrero : Boolean := False; alt : Real_Vector(0 .. 1) := (60.0, 20.0); az : Real_Vector(0 .. 1) := (30.0, 60.0); title : array(0 .. 1) of String(1 .. 35) := ("#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60"); ------------------------------------------------------------------------------ -- cmap1_init1 -- Initializes color map 1 in HLS space. -- Basic grayscale variation from half-dark (which makes more interesting -- looking plot compared to dark) to light. -- An interesting variation on this: -- s[1] = 1.0 ---------------------------------------------------------------------------- procedure cmap1_init(gray : Boolean) is i, h, l, s : Real_Vector(0 .. 1); begin i(0) := 0.0; -- left boundary i(1) := 1.0; -- right boundary if gray then h(0) := 0.0; -- hue -- low: red (arbitrary if s=0) h(1) := 0.0; -- hue -- high: red (arbitrary if s=0) l(0) := 0.5; -- lightness -- low: half-dark l(1) := 1.0; -- lightness -- high: light s(0) := 0.0; -- minimum saturation s(1) := 0.0; -- minimum saturation else h(0) := 240.0; -- blue -> green -> yellow -> h(1) := 0.0; -- -> red l(0) := 0.6; l(1) := 0.6; s(0) := 0.8; s(1) := 0.8; end if; plscmap1n(256); plscmap1l(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); if sombrero then rosen := False; end if; -- Initialize plplot plinit; for i in x'range loop x(i) := Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); if rosen then x(i) := x(i) * 1.5; end if; end loop; for i in y'range loop y(i) := Long_Float(i - YPTS / 2) / Long_Float(YPTS / 2); if rosen then y(i) := y(i) + 0.5; end if; end loop; for i in x'range loop xx := x(i); for j in y'range loop yy := y(j); if rosen then z(i, j) := (1.0 - xx) * (1.0 - xx) + 100.0 * (yy - (xx * xx)) * (yy - (xx * xx)); -- The log argument may be zero for just the right grid. if z(i, j) > 0.0 then z(i, j) := log(z(i, j)); else z(i, j) := -5.0; -- -MAXFLOAT would mess-up up the scale end if; else -- Sombrero is True. r := sqrt(xx * xx + yy * yy); z(i, j) := exp(-r * r) * cos(2.0 * pi * r); end if; end loop; -- j end loop; -- i zmin := Matrix_Min(z); zmax := Matrix_Max(z); step := (zmax - zmin) / Long_Float(nlevel + 1); for i in clevel'range loop clevel(i) := zmin + step + step * Long_Float(i); end loop; pllightsource(1.0, 1.0, 1.0); for k in alt'range loop for ifshade in 0 .. 3 loop pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -0.9, 1.1); plcol0(3); plmtex("t", 1.0, 0.5, 0.5, title(k)); plcol0(1); if rosen then plw3d(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt(k), az(k)); else plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt(k), az(k)); end if; plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); plcol0(2); if ifshade = 0 then -- diffuse light surface plot cmap1_init(True); plsurf3d(x, y, z, 0, clevel); -- clevel is not used here elsif ifshade = 1 then -- magnitude colored plot cmap1_init(False); plsurf3d(x, y, z, MAG_COLOR, clevel); elsif ifshade = 2 then -- magnitude colored plot with faceted squares cmap1_init(False); plsurf3d(x, y, z, MAG_COLOR + FACETED, clevel); else -- magnitude colored plot with contours cmap1_init(False); plsurf3d(x, y, z, MAG_COLOR + SURF_CONT + BASE_CONT, clevel); end if; end loop; -- ifshade end loop; -- k plend; end x08a; plplot-5.10.0+dfsg/examples/ada/x17a.adb 644 1750 1750 1263611543675237 165700ustar andrewandrew-- $Id: x17a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Plots a simple stripchart with four pens. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Text_IO, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x17a is autoy, acc : Boolean; pl_errcode : Integer := 0; id1 : Integer; nsteps : Integer := 1000; colbox, collab : Integer; colline, styline : Integer_Array_1D(0 .. 3); y1, y2, y3, y4, ymin, ymax, xlab, ylab : Long_Float; t, tmin, tmax, tjump, dt, noise : Long_Float; legline : Stripchart_Label_String_Array_Type := (To_Unbounded_String("sum"), To_Unbounded_String("sin"), To_Unbounded_String("sin*noi"), To_Unbounded_String("sin+noi")); begin -- plplot initialization -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- If db is used the plot is much more smooth. However, because of the -- async X behaviour, one does not have a real-time scripcharter. -- plsetopt("db", ""); -- plsetopt("np", ""); -- User sets up plot completely except for window and data -- Eventually settings in place when strip chart is created will be -- remembered so that multiple strip charts can be used simultaneously. -- Specify some reasonable defaults for ymin and ymax -- The plot will grow automatically if needed (but not shrink) ymin := -0.1; ymax := 0.1; -- Specify initial tmin and tmax -- this determines length of window. -- Also specify maximum jump in t -- This can accomodate adaptive timesteps tmin := 0.0; tmax := 10.0; tjump := 0.3; -- percentage of plot to jump -- Axes options same as plbox. -- Only automatic tick generation and label placement allowed. -- Eventually I'll make this fancier. colbox := 1; collab := 3; styline(0) := 2; -- pens line style styline(1) := 3; styline(2) := 4; styline(3) := 5; colline(0) := 2; -- pens color colline(1) := 3; colline(2) := 4; colline(3) := 5; xlab := 0.0; -- legend position ylab := 0.25; autoy := True; -- autoscale y acc := True; -- don't scrip, accumulate -- Initialize plplot plinit; pladv(0); plvsta; -- Register our error variables with PLplot -- From here on, we're handling all errors here -- plsError(pl_errcode, errmsg); -- Ada note: plsError is not yet implemented in Ada. Thus, pl_errcode is -- hardwired to 0 for now and no effective error handling is done. plstripc(id1, "bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo"); -- Ada note: this would handle errors if error handling were implemented. if pl_errcode /= 0 then Put_Line("There was a problem which caused the program to quit."); plend; return; end if; -- Let plplot handle errors from here on -- plsError(NULL, NULL); autoy := False; -- autoscale y acc := True; -- accumulate -- This is to represent a loop over time -- Let's try a random walk process y1 := 0.0; y2 := 0.0; y3 := 0.0; y4 := 0.0; dt := 0.1; for n in 0 .. nsteps - 1 loop -- The Ada standard requires that the delay statement have a granularity -- of at most 20 ms but strongly recommends at most 100 microseconds. -- We'll try 10 ms to match the C example, x17c, but in theory this -- might fail to compile on some Ada systems. If so, the cure is to set -- the delay to 0.02. delay 0.01; -- wait a little (10 ms) to simulate time elapsing t := Long_Float(n) * dt; noise := plrandd - 0.5; y1 := y1 + noise; y2 := sin(t * pi / 18.0); y3 := y2 * noise; y4 := y2 + noise / 3.0; -- There is no need for all pens to have the same number of -- points or being equally time spaced. if n mod 2 /= 0 then plstripa(id1, 0, t, y1); end if; if n mod 3 /= 0 then plstripa(id1, 1, t, y2); end if; if n mod 4 /= 0 then plstripa(id1, 2, t, y3); end if; if n mod 5 /= 0 then plstripa(id1, 3, t, y4); end if; -- pleop; -- use double buffer (-db on command line) end loop; -- Destroy strip chart and its memory plstripd(id1); plend; end x17a; plplot-5.10.0+dfsg/examples/ada/x33a.adb 644 1750 1750 11214112220264404 165550ustar andrewandrew-- -*- coding: utf-8; -*- -- -- $Id: x33a.adb 12523 2013-09-24 10:27:16Z jbauck $ -- -- Demonstrate most pllegend capability including unicode symbols. -- -- Copyright (C) 2011-2013 Jerry Bauck -- -- This file is part of PLplot. -- -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- -- This example designed just for devices (e.g., the cairo-related and -- qt-related devices) where the best choice of glyph is automatically -- selected by the related libraries (pango/cairo or Qt4) for each -- unicode character depending on what system fonts are installed. Of -- course, you must have the appropriate TrueType fonts installed to -- have access to all the required glyphs. -- Ada note: The function TUB is Ada.Strings.Unbounded.To_Unbounded_String -- renamed. See PLplot_Traditional.ads or PLplot.ads. with Ada.Strings.Unbounded, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; use Ada.Strings.Unbounded, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; ---------------------------------------------------------------------------- -- Demonstrate most pllegend capability including unicode symbols. ---------------------------------------------------------------------------- procedure x33a is position_options : Integer_Array_1D(0 .. 15) := (Pl_Position_Left + Pl_Position_Top + Pl_Position_Outside, Pl_Position_Top + Pl_Position_Outside, Pl_Position_Right + Pl_Position_Top + Pl_Position_Outside, Pl_Position_Right + Pl_Position_Outside, Pl_Position_Right + Pl_Position_Bottom + Pl_Position_Outside, Pl_Position_Bottom + Pl_Position_Outside, Pl_Position_Left + Pl_Position_Bottom + Pl_Position_Outside, Pl_Position_Left + Pl_Position_Outside, Pl_Position_Left + Pl_Position_Top + Pl_Position_Inside, Pl_Position_Top + Pl_Position_Inside, Pl_Position_Right + Pl_Position_Top + Pl_Position_Inside, Pl_Position_Right + Pl_Position_Inside, Pl_Position_Right + Pl_Position_Bottom + Pl_Position_Inside, Pl_Position_Bottom + Pl_Position_Inside, Pl_Position_Left + Pl_Position_Bottom + Pl_Position_Inside, Pl_Position_Left + Pl_Position_Inside); -- Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). special_symbols : Legend_String_Array_Type(0 .. 4) := (TUB("✰"), TUB("✴"), TUB("✱"), TUB("✽"), TUB("✦")); -- TUB is renamed To_Unbounded_String. -- plcolorbar options -- Colorbar type options Colorbar_Kinds : constant Integer := 4; colorbar_option_kinds : Integer_Array_1D(0 .. Colorbar_Kinds - 1) := ( Pl_Colorbar_Shade, Pl_Colorbar_Shade + Pl_Colorbar_Shade_Label, Pl_Colorbar_Image, Pl_Colorbar_Gradient); colorbar_option_kind_labels : Legend_String_Array_Type(0 .. Colorbar_Kinds - 1) := (TUB("Shade colorbars"), TUB("Shade colorbars with custom labels"), TUB("Image colorbars"), TUB("Gradient colorbars")); -- Which side of the page are we positioned relative to? Colorbar_Positions :constant Integer := 4; colorbar_position_options : Integer_Array_1D(0 .. Colorbar_Positions - 1) := (Pl_Position_Left, Pl_Position_Right, Pl_Position_Top, Pl_Position_Bottom); colorbar_position_option_labels : Legend_String_Array_Type(0 .. Colorbar_Positions - 1) := (TUB("Left"), TUB("Right"), TUB("Top"), TUB("Bottom")); -- Colorbar label positioning options Colorbar_Labels : constant Integer := 4; colorbar_label_options : Integer_Array_1D(0 .. Colorbar_Labels - 1) := (Pl_Colorbar_Label_Left, Pl_Colorbar_Label_Right, Pl_Colorbar_Label_Top, Pl_Colorbar_Label_Bottom); colorbar_label_option_labels : Legend_String_Array_Type(0 .. Colorbar_Labels - 1) := (TUB("Label left"), TUB("Label right"), TUB("Label top"), TUB("Label bottom")); -- Colorbar cap options Colorbar_Caps : constant Integer := 4; colorbar_cap_options : Integer_Array_1D(0 .. Colorbar_Caps - 1) := (Pl_Colorbar_Cap_None, Pl_Colorbar_Cap_Low, Pl_Colorbar_Cap_High, Pl_Colorbar_Cap_Low + Pl_Colorbar_Cap_High); colorbar_cap_option_labels : Legend_String_Array_Type(0 .. Colorbar_Caps - 1) := (TUB("No caps"), TUB("Low cap"), TUB("High cap"), TUB("Low and high caps")); procedure plcolorbar_example_page(kind_i : Integer; label_i : Integer; cap_i : Integer; cont_color : Integer; cont_width : Long_Float; n_values : Integer; values : Real_Vector) is -- Parameters for the colorbars on this page position, opt : Integer; x, y, x_length, y_length : Long_Float; ticks : Real_Vector(0 .. 0) := (others => 0.0); sub_ticks : Integer_Array_1D(0 .. 0) := (others => 0); low_cap_color, high_cap_color : Long_Float; vertical, ifn : Boolean; n_axes : Integer := 1; axis_opts : Legend_String_Array_Type(0 .. 0); n_labels : Integer := 1; label_opts : Integer_Array_1D(0 .. 0) := (others => 0); label : Legend_String_Array_Type(0 .. 0); title : Unbounded_String; colorbar_width, colorbar_height : Long_Float; n_values_array : Integer_Array_1D(0 .. 0); values_array : Real_Matrix(0 .. 0, values'first .. values'last); type Stupid is mod 2**7; -- To cover Legend_Colorbar_Position_Type in plplot_thin.ads. begin n_values_array(0) := n_values; for i in values'range loop values_array(0, i) := values(i); end loop; low_cap_color := 0.0; high_cap_color := 1.0; -- Start a new page. pladv(0); -- Draw one colorbar relative to each side of the page. for position_i in 0 .. Colorbar_Positions - 1 loop position := colorbar_position_options(position_i); opt := colorbar_option_kinds(kind_i) + colorbar_label_options(label_i) + colorbar_cap_options(cap_i); -- We have to convert these integers to modular type Stupid before and-ing the bits. -- That's because manipulating bits of non-modular types is nonsense but other -- languages seem to not care about stuff like this. vertical := ((Stupid(position) and Stupid(Pl_Position_Left)) > 0) or ((Stupid(position) and Stupid(Pl_Position_Right)) > 0); ifn := ((Stupid(position) and Stupid(Pl_Position_Left)) > 0) or ((Stupid(position) and Stupid(Pl_Position_Bottom)) > 0); -- Set the offset position on the page. if vertical then x := 0.0; y := 0.0; x_length := 0.05; y_length := 0.5; else x := 0.0; y := 0.0; x_length := 0.5; y_length := 0.05; end if; -- Set appropriate labelling options. if ifn then if cont_color = 0 or cont_width = 0.0 then axis_opts(0) := TUB("uwtivn"); -- TUB is renamed To_Unbounded_String. else axis_opts(0) := TUB("uwxvn"); end if; else if cont_color = 0 or cont_width = 0.0 then axis_opts(0) := TUB("uwtivm"); else axis_opts(0) := TUB("uwxvm"); end if; end if; label(0) := colorbar_position_option_labels(position_i) & ", " & colorbar_label_option_labels(label_i); -- Smaller text plschr(0.0, 0.75); -- Small ticks on the vertical axis plsmaj(0.0, 0.5); plsmin(0.0, 0.5); plvpor(0.20, 0.80, 0.20, 0.80); plwind(0.0, 1.0, 0.0, 1.0); -- Set interesting background colour. plscol0a(15, 0, 0, 0, 0.20); plcolorbar(colorbar_width, colorbar_height, opt + Pl_Colorbar_Bounding_Box + Pl_Colorbar_Background, position, x, y, x_length, y_length, 15, 1, 1, low_cap_color, high_cap_color, cont_color, cont_width, label_opts, label, axis_opts, ticks, sub_ticks, n_values_array, values_array); -- Reset text and tick sizes plschr(0.0, 1.0); plsmaj(0.0, 1.0); plsmin(0.0, 1.0); end loop; -- Draw a page title title := colorbar_option_kind_labels(kind_i) & " - " & colorbar_cap_option_labels(cap_i); plvpor(0.0, 1.0, 0.0, 1.0); plwind(0.0, 1.0, 0.0, 1.0); plptex(0.5, 0.5, 0.0, 0.0, 0.5, To_String(title)); end plcolorbar_example_page; procedure plcolorbar_example(palette : String; kind_i : Integer; cont_color : Integer; cont_width : Long_Float; n_values : Integer; values : Real_Vector) is begin -- Load the color palette plspal1(palette, True); for label_i in 0 .. Colorbar_Labels - 1 loop for cap_i in 0 .. Colorbar_Caps - 1 loop plcolorbar_example_page(kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ); end loop; end loop; end plcolorbar_example; colorbar : Boolean := True; -- By default do not plot plcolorbar pages -- for now while we are working out the API. opt : Integer; nlegend : Integer; nturn : Integer; legend_width, legend_height, x, y, xstart, ystart : Long_Float; max_height, text_scale : Long_Float; position, opt_base, nrow, ncolumn : Integer; begin -- main plparseopts(Pl_Parse_Full); -- Initialize plplot plinit; -- First page illustrating the 16 standard positions. declare nlegend : constant Integer := 1; opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin pladv(0); plvpor(0.25, 0.75, 0.25, 0.75); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont(PL_FCI_SANS, -1, -1); plmtex("t", 8.0, 0.5, 0.5, "The 16 standard legend positions with"); plmtex("t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y"); -- Only specify legend data that are required according to the -- value of opt_array for that entry. opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box; opt_array(0) := Pl_Legend_Line + Pl_Legend_Symbol; line_styles(0) := 1; line_widths(0) := 1.0; symbol_scales(0) := 1.0; symbol_numbers(0) := 4; symbols(0) := TUB("*"); -- Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1); plscol0a(15, 32, 32, 32, 0.70); for k in 0 .. 15 loop position := position_options(k); opt := opt_base; -- Make a 2-digit string with leading 0 for 0 .. 9. if k >= 10 then text(0) := To_Unbounded_String(Trim(Integer'image(k), Left)); else text(0) := To_Unbounded_String("0" & Trim(Integer'image(k), Left)); end if; text_colors(0) := 1 + (k mod 8); line_colors(0) := 1 + (k mod 8); symbol_colors(0) := 1 + (k mod 8); pllegend(legend_width, legend_height, opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end loop; end; -- declare -- Second page illustrating effect of nrow, ncolumn for the same legend data. declare nlegend : constant Integer := 7; opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin pladv(0); plvpor(0.25, 0.75, 0.25, 0.75); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plsfont(PL_FCI_SANS, -1, -1); plmtex("t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,"); plmtex("t", 6.0, 0.5, 0.5, "and position for the same legend data"); -- Only specify legend data that are required according to the -- value of opt_array for that entry. opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box; for k in 0 .. nlegend - 1 loop opt_array(k) := Pl_Legend_Line + Pl_Legend_Symbol; line_styles(k) := 1; line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); -- Make 2-digit strings with leading 0 for 0 .. 9. if k >= 10 then text(k) := To_Unbounded_String(Trim(Integer'image(k), Left)); else text(k) := To_Unbounded_String("0" & Trim(Integer'image(k), Left)); end if; text_colors(k) := 1 + (k mod 8); line_colors(k) := 1 + (k mod 8); symbol_colors(k) := 1 + (k mod 8); end loop; -- Use monotype fonts so that all legends are the same size. plsfont(PL_FCI_MONO, -1, -1); plscol0a(15, 32, 32, 32, 0.70); position := Pl_Position_Top + Pl_Position_Outside; opt := opt_base; x := 0.0; y := 0.1; nrow := 1; ncolumn := nlegend; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Bottom + Pl_Position_Outside; opt := opt_base; x := 0.0; y := 0.1; nrow := 1; ncolumn := nlegend; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Left + Pl_Position_Outside; opt := opt_base; x := 0.1; y := 0.0; nrow := nlegend; ncolumn := 1; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Right + Pl_Position_Outside; opt := opt_base; x := 0.1; y := 0.0; nrow := nlegend; ncolumn := 1; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Left + Pl_Position_Top + Pl_Position_Inside; opt := opt_base; x := 0.0; y := 0.0; nrow := 6; ncolumn := 2; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Right + Pl_Position_Top + Pl_Position_Inside; opt := opt_base + Pl_Legend_Row_Major; x := 0.0; y := 0.0; nrow := 6; ncolumn := 2; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Bottom + Pl_Position_Inside; opt := opt_base + Pl_Legend_Row_Major; x := 0.0; y := 0.0; nrow := 3; ncolumn := 3; pllegend(legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end; -- declare -- Third page demonstrating legend alignment pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(0.0, 1.0, 0.0, 1.0); plsfont(Pl_Fci_Sans, -1, -1); plmtex("t", 2.0, 0.5, 0.5, "Demonstrate legend alignment"); x := 0.1; y := 0.1; nturn := 4; nlegend := 0; position := Pl_Position_Top + Pl_Position_Left + Pl_Position_Subpage; opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box; opt := opt_base; for i in 0 .. 8 loop -- Set up legend arrays with the correct size, type. if i <= nturn then nlegend := nlegend + 1; else nlegend := nlegend - 1; end if; nlegend := Integer'max(1, nlegend); declare opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin -- Only specify legend data that are required according to the -- value of opt_array for that entry. for k in 0 .. nlegend - 1 loop opt_array(k) := Pl_Legend_Line + Pl_Legend_Symbol; line_styles(k) := 1; line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); -- Make 2-digit strings with leading 0 for 0 .. 9. if k >= 10 then text(k) := To_Unbounded_String(Trim(Integer'image(k), Left)); else text(k) := To_Unbounded_String("0" & Trim(Integer'image(k), Left)); end if; text_colors(k) := 1 + (k mod 8); line_colors(k) := 1 + (k mod 8); symbol_colors(k) := 1 + (k mod 8); end loop; -- k -- Use monotype fonts so that all legends are the same size. plsfont(Pl_Fci_Mono, -1, -1); plscol0a(15, 32, 32, 32, 0.70); nrow := Integer'min(3, nlegend); ncolumn := 0; pllegend(legend_width, legend_height, opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); if i = nturn then position := Pl_Position_Top + Pl_Position_Right + Pl_Position_Subpage; opt := opt_base; x := 1.0 - x; y := y + legend_height; else x := x + legend_width; y := y + legend_height; end if; end; -- declare end loop; -- i -- Fourth page illustrating various kinds of legends declare nlegend : constant Integer := 5; opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin max_height := 0.0; xstart := 0.0; ystart := 0.1; x := xstart; y := ystart; text_scale := 0.90; pladv(0); plvpor(0.0, 1.0, 0.0, 0.90); plwind(0.0, 1.0, 0.0, 1.0); plsfont(Pl_Fci_Sans, -1, -1); plmtex("t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends"); -- Only specify legend data that are required according to the -- value of opt_array for that entry. position := Pl_Position_Left + Pl_Position_Top; opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box + Pl_Legend_Text_Left; -- Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array(0) := Pl_Legend_None; text(0) := TUB("None"); text_colors(0) := 1; opt_array(1) := Pl_Legend_Color_Box; text(1) := TUB("Box"); text_colors(1) := 2; box_colors(1) := 2; box_patterns(1) := 0; box_scales(1) := 0.8; box_line_widths(1) := 1.0; opt_array(2) := Pl_Legend_Line; text(2) := TUB("Line"); text_colors(2) := 3; line_colors(2) := 3; line_styles(2) := 1; line_widths(2) := 1.0; opt_array(3) := Pl_Legend_Symbol; text(3) := TUB("Symbol"); text_colors(3) := 4; symbol_colors(3) := 4; symbol_scales(3) := text_scale; symbol_numbers(3) := 4; symbols(3) := special_symbols(2); opt_array(4) := Pl_Legend_Symbol + Pl_Legend_Line; text(4) := TUB("L & S"); text_colors(4) := 5; line_colors(4) := 5; line_styles(4) := 1; line_widths(4) := 1.0; symbol_colors(4) := 5; symbol_scales(4) := text_scale; symbol_numbers(4) := 4; symbols(4) := special_symbols(2); opt := opt_base; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up symbol legend entries with various symbols. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Symbol; text(i) := TUB("Symbol ") & special_symbols(i); text_colors(i) := i + 1; symbol_colors(i) := i + 1; symbol_scales(i) := text_scale; symbol_numbers(i) := 4; symbols(i) := special_symbols(i); end loop; opt := opt_base; x := x + legend_width; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up symbol legend entries with various numbers of symbols. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Symbol; text(i) := TUB("Symbol Number" & Integer'image(i + 2)); text_colors(i) := i + 1; symbol_colors(i) := i + 1; symbol_scales(i) := text_scale; symbol_numbers(i) := i + 2; symbols(i) := special_symbols(2); end loop; opt := opt_base; x := x + legend_width; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up box legend entries with various colours. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Color_Box; text(i) := TUB("Box Color" & Integer'image(i + 1)); text_colors(i) := i + 1; box_colors(i) := i + 1; box_patterns(i) := 0; box_scales(i) := 0.8; box_line_widths(i) := 1.0; end loop; opt := opt_base; -- Use new origin x := xstart; y := y + max_height; max_height := 0.0; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up box legend entries with various patterns. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Color_Box; text(i) := TUB("Box Pattern" & Integer'image(i)); text_colors(i) := 2; box_colors(i) := 2; box_patterns(i) := i; box_scales(i) := 0.8; box_line_widths(i) := 1.0; end loop; opt := opt_base; x := x + legend_width; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up box legend entries with various box pattern line widths. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Color_Box; text(i) := TUB("Box Line Width" & Integer'image(i + 1)); text_colors(i) := 2; box_colors(i) := 2; box_patterns(i) := 3; box_scales(i) := 0.8; box_line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; x := x + legend_width; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up line legend entries with various colours. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Line; text(i) := TUB("Line Color" & Integer'image(i + 1)); text_colors(i) := i + 1; line_colors(i) := i + 1; line_styles(i) := 1; line_widths(i) := 1.0; end loop; opt := opt_base; -- Use new origin x := xstart; y := y + max_height; max_height := 0.0; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up line legend entries with various styles. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Line; text(i) := TUB("Line Style" & Integer'image(i + 1)); text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := i + 1; line_widths(i) := 1.0; end loop; opt := opt_base; x := x + legend_width; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up line legend entries with various widths. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Line; text(i) := TUB("Line Width" & Integer'image(i + 1)); text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := 1; line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; x := x + legend_width; plscol0a(15, 32, 32, 32, 0.70); pllegend(legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); end; -- declare if colorbar then -- Color bar examples declare values_small : Real_Vector(0 .. 1) := (-1.0e-200, 1.0e-200); values_uneven : Real_Vector(0 .. 8) := (-1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200); values_even : Real_Vector(0 .. 8) := (-2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200); begin -- Use unsaturated green background colour to contrast with black caps. plscolbg(70, 185, 70); -- Cut out the greatest and smallest bits of the color spectrum to -- leave colors for the end caps. plscmap1_range(0.01, 0.99); -- We can only test image and gradient colorbars with two element arrays for i in 2 .. COLORBAR_KINDS - 1 loop plcolorbar_example("cmap1_blue_yellow.pal", i, 0, 0.0, 2, values_small); end loop; -- Test shade colorbars with larger arrays for i in 0 .. 1 loop plcolorbar_example("cmap1_blue_yellow.pal", i, 4, 2.0, 9, values_even); end loop; for i in 0 .. 1 loop plcolorbar_example("cmap1_blue_yellow.pal", i, 0, 0.0, 9, values_uneven); end loop; end; end if; plend; end x33a; plplot-5.10.0+dfsg/examples/ada/xthick11a.adb 644 1750 1750 1147212012305413 175540ustar andrewandrew-- $Id: xthick11a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Mesh plot demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; procedure xthick11a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y LEVELS : constant Integer := 10; opt : Integer_Array_1D(0 ..1) := (DRAW_LINEXY, DRAW_LINEXY); alt : Real_Vector(0 ..1) := (33.0, 17.0); az : Real_Vector(0 ..1) := (24.0, 115.0); title0 : String(1 .. 43) := ("#frPLplot Example 11 - Alt=33, Az=24, Opt=3"); title1 : String(1 .. 44) := ("#frPLplot Example 11 - Alt=17, Az=115, Opt=3"); x : Real_Vector(0 .. XPTS - 1); y : Real_Vector(0 .. YPTS - 1); z : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); xx, yy : Long_Float; nlevel : Integer := LEVELS; clevel : Real_Vector(0 .. LEVELS - 1); zmin, zmax, step : Long_Float; procedure cmap1_init is i, h, l, s : Real_Vector(0 .. 1); begin i(0) := 0.0; -- left boundary i(1) := 1.0; -- right boundary h(0) := 240.0; -- blue -> green -> yellow -> h(1) := 0.0; -- -> red l(0) := 0.6; l(1) := 0.6; s(0) := 0.8; s(1) := 0.8; Set_Number_Of_Colors_In_Color_Map_1(256); Set_Color_Map_1_Piecewise(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init; -- Does a series of mesh plots for a given data set, with different -- viewing options in each plot. begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; for i in x'range loop x(i) := 3.0 * Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); end loop; for i in y'range loop y(i) := 3.0 * Long_Float(i - YPTS / 2) / Long_Float(YPTS / 2); end loop; for i in x'range loop xx := x(i); for j in y'range loop yy := y(j); z(i, j) := 3.0 * (1.0-xx)*(1.0-xx) * exp(-(xx*xx) - (yy+1.0)*(yy+1.0)) - 10.0 * (xx/5.0 - xx**3 - yy**5) * exp(-xx*xx-yy*yy) - 1.0/3.0 * exp(-(xx+1.0)*(xx+1.0) - (yy*yy)); -- if(0) {-- Jungfraujoch/Interlaken -- if (z(i)(j) < -1.) -- z(i)(j) := -1.; -- } end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_max(z); step := (zmax - zmin) / Long_Float(nlevel + 1); for i in clevel'range loop clevel(i) := zmin + step + step * Long_Float(i); end loop; cmap1_init; for k in 0 .. 1 loop for i in 0 .. 3 loop Advance_To_Subpage(Next_Subpage); Set_Pen_Color(Red); Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.5); Set_Up_3D(1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt(k), az(k)); Box_Around_Viewport_3D("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4); Set_Pen_Color(Yellow); -- wireframe plot if i = 0 then Mesh_3D(x, y, z, opt(k)); -- magnitude colored wireframe plot elsif i = 1 then Mesh_3D(x, y, z, opt(k) + MAG_COLOR); -- magnitude colored wireframe plot with sides elsif i = 2 then Plot_3D(x, y, z, opt(k) + MAG_COLOR, True); -- magnitude colored wireframe plot with base contour elsif i = 3 then Mesh_3D_Base_Contour(x, y, z, opt(k) + MAG_COLOR + BASE_CONT, clevel); end if; Set_Pen_Color(Green); if k = 0 then Write_Text_Viewport("t", 1.0, 0.5, 0.5, title0); end if; if k = 1 then Write_Text_Viewport("t", 1.0, 0.5, 0.5, title1); end if; end loop; end loop; -- Clean up End_PLplot; end xthick11a; plplot-5.10.0+dfsg/examples/ada/xthick02a.adb 644 1750 1750 1255212122203655 175630ustar andrewandrew-- $Id: xthick02a.adb 12300 2013-03-20 00:49:49Z jbauck $ -- Multiple window and color map 0 demo. -- Copyright (C) 2007 Alan W. Irwin -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; ------------------------------------------------------------------------------ -- Demonstrates multiple windows and color map 0 palette, both default and -- user-modified. ------------------------------------------------------------------------------ procedure xthick02a is -------------------------------------------------------------------------- -- draw_windows -- Draws a set of numbered boxes with colors according to cmap0 entry. -------------------------------------------------------------------------- procedure draw_windows(nw, cmap0_offset : Integer) is vmin, vmax : Long_Float; begin Set_Character_Height(0.0, 3.5); Set_Font_Style(Script_Font); for i in 0..(nw-1) loop Set_Pen_Color(i+cmap0_offset); Advance_To_Subpage(Next_Subpage); vmin := 0.1; vmax := 0.9; for j in 0..2 loop Set_Pen_Width(Long_Float(j + 1)); Set_Viewport_Normalized(vmin, vmax, vmin, vmax); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Box_Around_Viewport("bc", 0.0, 0, "bc", 0.0, 0); vmin := vmin + 0.1; vmax := vmax - 0.1; end loop; Set_Pen_Width(1.0); Write_Text_World(0.5, 0.5, 1.0, 0.0, 0.5, Trim(Integer'image(i), Left)); end loop; end draw_windows; -------------------------------------------------------------------------- -- demo1 -- Demonstrates multiple windows and default color map 0 palette. -------------------------------------------------------------------------- procedure demo1 is begin Begin_New_Page; -- Divide screen into 16 regions Set_Number_Of_Subpages(4, 4); draw_windows(16, 0); Eject_Current_Page; end demo1; -------------------------------------------------------------------------- -- demo2 -- Demonstrates multiple windows, user-modified color map 0 palette, and -- HLS -> RGB translation. -------------------------------------------------------------------------- procedure demo2 is -- Set up cmap0 -- Use 100 custom colors in addition to base 16 r, g, b: Integer_Array_1D(0..115); -- Min & max lightness values lmin : Long_Float := 0.15; lmax : Long_Float := 0.85; h, l, s : Long_Float; r1, g1, b1 : Long_Float; begin Begin_New_Page; -- Divide screen into 100 regions. Set_Number_Of_Subpages(10, 10); for i in 0..99 loop -- Bounds on HLS, from Set_Color_HLSrgb() commentary -- hue [0., 360.] degrees -- lightness [0., 1.] magnitude -- saturation [0., 1.] magnitude -- Vary hue uniformly from left to right h := (360.0 / 10.0 ) * Long_Float( i mod 10 ); -- Vary lightness uniformly from top to bottom, between min & max. l := lmin + (lmax - lmin) * Long_Float(i / 10) / 9.0; -- Use max saturation. s := 1.0; HLS_To_RGB(h, l, s, r1, g1, b1); -- Ada rounds to nearest integer. We want to truncate -- approximately like C to match that example. -0.5 produces -- at least one -1 result (rather than zero) so we subtract -- something with a slightly smaller absolute value. r(i+16) := Integer((r1 * 255.001) - 0.499999999999999); g(i+16) := Integer((g1 * 255.001) - 0.499999999999999); b(i+16) := Integer((b1 * 255.001) - 0.499999999999999); end loop; -- Load default cmap0 colors into our custom set. for i in 0..15 loop Get_Color_RGB(i, r(i), g(i), b(i)); end loop; -- Now set cmap0 all at once (faster, since fewer driver calls). Set_Color_Map_0(r, g, b); draw_windows(100, 16); Eject_Current_Page; end demo2; begin -- Parse and process command line arguments. Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot. Initialize_PLplot; -- Run demos. demo1; demo2; -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick02a; plplot-5.10.0+dfsg/examples/ada/CMakeLists.txt 644 1750 1750 1130611722014037 200510ustar andrewandrew# examples/ada/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2007, 2008, 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(ada_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" "thick00" "thick01" "thick02" "thick03" "thick04" "thick05" "thick06" "thick07" "thick08" "thick09" "thick10" "thick11" "thick12" "thick13" "thick14" "thick15" "thick16" "thick17" "thick18" "thick19" "thick20" "thick21" "thick22" "thick23" "thick24" "thick25" "thick26" "thick27" "thick28" "thick29" "thick30" "thick31" "thick33" ) if(CORE_BUILD) set(ada_SRCS) foreach(STRING_INDEX ${ada_STRING_INDICES}) set(SOURCE_FILE x${STRING_INDEX}a.adb) list(APPEND ada_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) endforeach(STRING_INDEX ${ada_STRING_INDICES}) install(FILES ${ada_SRCS} DESTINATION ${DATA_DIR}/examples/ada) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/ada RENAME Makefile ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt DESTINATION ${DATA_DIR}/examples/ada ) endif(CORE_BUILD) if(BUILD_TEST) if(CORE_BUILD) include_directories( ${CMAKE_BINARY_DIR}/examples/ada ${CMAKE_SOURCE_DIR}/bindings/ada ) else(CORE_BUILD) include_directories(${INCLUDE_DIR} ${ADA_INCLUDE_DIR}) endif(CORE_BUILD) # The first -aI option in adalinkflags is required to find .adb # (see comment below). The second -aI option gives access to the # libplplotada spec files. The -aL option gives access to the # libplplotada *.ali files. (That location currently works but is # probably not guaranteed indefinitely for future versions of # CMake.) if(CORE_BUILD) set(adalinkflags "-aI${CMAKE_SOURCE_DIR}/examples/ada -aI${CMAKE_SOURCE_DIR}/bindings/ada -aL${CMAKE_BINARY_DIR}/bindings/ada/CMakeFiles/plplotada${LIB_TAG}.dir") else(CORE_BUILD) set(adalinkflags "-aI${CMAKE_SOURCE_DIR}/ada -aI${ADA_INCLUDE_DIR} -aL${ADA_LIB_DIR}") endif(CORE_BUILD) foreach(STRING_INDEX ${ada_STRING_INDICES}) set(TARGET_NAME x${STRING_INDEX}a) set(SOURCE_FILE x${STRING_INDEX}a.adb) set(adasrcfile ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}) # Note due to limitations of the Ada language support for CMake, # the nominal source file for add_executable is compiled (which is # why a real file has to be specified), but otherwise it is # ignored except for its .adb suffix which identifies the Ada # language. The actual source file name for the internal gnatmake # command that creates the executable is constructed from # .adb. Since no directory can be specified from this # construction (don't ask), you must specify the directory of # .adb with a -aI option (see above comment of adalinkflags). add_executable(${TARGET_NAME} ${adasrcfile}) set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS ${adalinkflags}) target_link_libraries(${TARGET_NAME} plplotada${LIB_TAG} plplot${LIB_TAG}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_ada ${TARGET_NAME}) list(APPEND ada_extra_clean_files "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.o;${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.ali") endforeach(STRING_INDEX ${ada_STRING_INDICES}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ada_extra_clean_files}") endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/ada/xthick26a.adb 644 1750 1750 2171612143252635 176000ustar andrewandrew-- $Id: xthick26a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- Multi-lingual version of the first page of example 4. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- Thanks to the following for providing translated strings for this example: -- Valery Pipin (Russian) -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- This example designed just for devices (e.g., psttfc and the -- cairo-related devices) that use the pango and fontconfig libraries. The -- best choice of glyph is selected by fontconfig and automatically rendered -- by pango in way that is sensitive to complex text layout (CTL) language -- issues for each unicode character in this example. Of course, you must -- have the appropriate TrueType fonts installed to have access to all the -- required glyphs. -- Translation instructions: The strings to be translated are given by -- x_label, y_label, alty_label, title_label, and line_label below.-- The -- encoding used must be UTF-8. -- The following strings to be translated involve some scientific/mathematical -- jargon which is now discussed further to help translators. -- (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . -- (2) degrees is an angular measure, see -- http://en.wikipedia.org/wiki/Degree_(angle) . -- (3) low-pass filter is one that transmits (passes) low frequencies. -- (4) pole is in the mathematical sense, see -- http://en.wikipedia.org/wiki/Pole_(complex_analysis) .-- "Single Pole" -- means a particular mathematical transformation of the filter function has -- a single pole, see -- http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html .-- -- Furthermore, a single-pole filter must have an inverse square decline -- (or -20 db/decade). Since the filter plotted here does have that -- characteristic, it must by definition be a single-pole filter, see also -- http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm -- (5) decade represents a factor of 10, see -- http://en.wikipedia.org/wiki/Decade_(log_scale) . with Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick26a is -- Here we show two ways of passing strings for plot1... -- ...a function... --function x_label(which : Integer) return String is --begin -- if which = 0 then return "Frequency"; end if; -- if which = 1 then return "Частота"; end if; -- return "oops"; --end x_label; -- ...or an array of unbounded strings. -- (TUB renames Ada.Strings.Unbounded.To_Unbounded_String in plplot_traditional.ads.) x_label : array(0 .. 1) of Unbounded_String := (TUB("Frequency"), TUB("Частота")); function y_label(which : Integer) return String is begin if which = 0 then return "Amplitude (dB)"; end if; if which = 1 then return "Амплитуда (dB)"; end if; return "oops"; end y_label; function alty_label(which : Integer) return String is begin if which = 0 then return "Phase shift (degrees)"; end if; if which = 1 then return "Фазовый сдвиг (градусы)"; end if; return "oops"; end alty_label; -- Short rearranged versions of y_label and alty_label. -- (TUB renames Ada.Strings.Unbounded.To_Unbounded_String in plplot_traditional.ads.) Legend_0 : Legend_String_Array_Type(0..1) := (TUB("Amplitude"), TUB("Phase shift")); Legend_1 : Legend_String_Array_Type(0..1) := (TUB("Амплитуда"), TUB("Фазовый сдвиг")); Legend_text : array(0 .. 1) of Legend_String_Array_Type(0..1) := (Legend_0, Legend_1); function title_label(which : Integer) return String is begin if which = 0 then return "Single Pole Low-Pass Filter"; end if; if which = 1 then return "Однополюсный Низко-Частотный Фильтр"; end if; return "oops"; end title_label; function line_label(which : Integer) return String is begin if which = 0 then return "-20 dB/decade"; end if; if which = 1 then return "-20 dB/десяток"; end if; return "oops"; end line_label; procedure plot1 (x_label, y_label, alty_label : String; L_Text : Legend_String_Array_Type; title_label, line_label : String) is freql, ampl, phase : Real_Vector(0 .. 100); f0, freq : Long_Float; opt_array : Integer_Array_1D(0 .. 1); text_colors, line_colors, line_styles : Integer_Array_1D(0..1); symbol_numbers, symbol_colors : Integer_Array_1D(0 .. 1); line_widths, symbol_scales : Real_Vector(0 .. 1); symbols : Legend_String_Array_Type(0 .. 1); legend_width, legend_height : Long_Float; -- Dummy arrays for unused entities. C uses null arguments but we can't. Box_Colors, Box_Patterns : Integer_Array_1D(0 .. 1):= (others => 0); Box_Scales, Box_Line_Widths : Real_Vector(0 .. 1):= (others => 1.0); begin Advance_To_Subpage(Next_Subpage); f0 := 1.0; for i in freql'range loop freql(i) := -2.0 + Long_Float(i) / 20.0; freq := 10.0 ** freql(i); ampl(i) := 20.0 * log(1.0 / sqrt(1.0 + (freq / f0) ** 2.0), 10.0); phase(i) := -(180.0 / pi) * arctan(freq / f0); end loop; Set_Viewport_Normalized(0.15, 0.85, 0.1, 0.9); Set_Viewport_World(-2.0, 3.0, -80.0, 0.0); -- Try different axis and labelling styles. Set_Pen_Color(Red); Box_Around_Viewport("bclnst", 0.0, 0, "bnstv", 0.0, 0); -- Plot ampl vs freq Set_Pen_Color(Yellow); Draw_Curve(freql, ampl); Set_Pen_Color(Yellow); Write_Text_World(1.6, -30.0, 1.0, -20.0, 0.5, line_label); -- Put labels on Set_Pen_Color(Red); Write_Text_Viewport("b", 3.2, 0.5, 0.5, x_label); Write_Text_Viewport("t", 2.0, 0.5, 0.5, title_label); Set_Pen_Color(Yellow); Write_Text_Viewport("l", 5.0, 0.5, 0.5, y_label); -- For the gridless case, put phase vs freq on same plot Set_Pen_Color(Red); Set_Viewport_World(-2.0, 3.0, -100.0, 0.0); Box_Around_Viewport("", 0.0, 0, "cmstv", 30.0, 3); Set_Pen_Color(Green); Draw_Curve(freql, phase); Draw_String(freql, phase, "*"); Set_Pen_Color(Green); Write_Text_Viewport("r", 5.0, 0.5, 0.5, alty_label); -- Draw a legend -- First legend entry. opt_array(0) := Legend_Line; text_colors(0) := 2; line_colors(0) := 2; line_styles(0) := 1; line_widths(0) := 1.0; symbol_colors(0) := 3; -- Don't care; not used. symbol_scales(0) := 1.0; -- Don't care; not used. symbol_numbers(0) := 4; -- Don't care; not used. symbols(0) := To_Unbounded_String("*"); -- Don't care; not used. -- Second legend entry. opt_array(1) := Legend_Line + Legend_Symbol; text_colors(1) := 3; line_colors(1) := 3; line_styles(1) := 1; line_widths(1) := 1.0; symbol_colors(1) := 3; symbol_scales(1) := 1.0; symbol_numbers(1) := 4; symbols(1) := To_Unbounded_String("*"); Set_One_Color_Map_0_And_Alpha(15, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, Legend_Background + Legend_Bounding_Box, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, L_Text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end plot1; begin -- Parse and process command line arguments */ Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; Set_Font_Style(Roman_Font); -- Make log plots using two different styles. for i in 0 .. 1 loop plot1(To_String(x_label(i)), y_label(i), alty_label(i), legend_text(i), title_label(i), line_label(i)); end loop; End_PLplot; end xthick26a; plplot-5.10.0+dfsg/examples/ada/xthick01a.adb 644 1750 1750 1253212122203655 175600ustar andrewandrew-- $Id: xthick01a.adb 12300 2013-03-20 00:49:49Z jbauck $ -- Simple line plot and multiple windows demo. -- Copyright (C) 2007 - 2011 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Text_IO, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick01a is xs, ys : Real_Vector (0 .. 5); xscale, yscale, xoff, yoff : Long_Float; fontset : Integer := 1; notes : String := "Make sure you get it right!"; procedure plot1 is xmin, xmax, ymin, ymax : Long_Float; x, y : Real_Vector (0 .. 59); begin for i in x'Range loop x(i) := xoff + xscale * Long_Float(i + 1) / Long_Float(x'Length); y(i) := yoff + yscale * x(i)**2.0; end loop; xmin := x(x'First); xmax := x(x'Last); ymin := y(y'First); ymax := y(y'Last); for i in xs'Range loop xs(i) := x(i * 10 + 3); ys(i) := y(i * 10 + 3); end loop; -- Set up the viewport and window using Set_Environment. The range in X is -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are -- scaled separately (just = 0), and we just draw a labelled -- box (axis = 0). Set_Pen_Color(Red); Set_Environment(xmin, xmax, ymin, ymax, Not_Justified, Linear_Box_Plus); Set_Pen_Color(Yellow); Write_Labels("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); -- Plot the data points Set_Pen_Color(Aquamarine); Draw_Points(xs, ys, 9); -- Draw the line through the data Set_Pen_Color(Green); Draw_Curve(x, y); end plot1; procedure plot2 is x, y : Real_Vector (0 .. 99); begin -- Set up the viewport and window using PLENV. The range in X is -2.0 to -- 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately -- (just = 0), and we draw a box with axes (axis = 1). Set_Pen_Color(Red); Set_Environment(-2.0, 10.0, -0.4, 1.2, Not_Justified, Linear_Zero_Axes); Set_Pen_Color(Yellow); Write_Labels("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); -- Fill up the arrays for i in x'Range loop x(i) := (Long_Float(i) - 19.0) / 6.0; y(i) := 1.0; if x(i) /= 0.0 then y(i) := sin(x(i)) / x(i); end if; end loop; -- Draw the line Set_Pen_Color(Green); Set_Pen_Width(2.0); Draw_Curve(x, y); Set_Pen_Width(1.0); end plot2; procedure plot3 is x, y : Real_Vector (0 .. 100); space1, mark1 : Integer_Array_1D(1 .. 1) := (others => 1500); begin Advance_To_Subpage(Next_SubPage); -- Use standard viewport, and define X range from 0 to 360 degrees, -- Y range from -1.2 to 1.2. Set_Viewport_Standard; Set_Viewport_World(0.0, 360.0, -1.2, 1.2); -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 60.0, 2, "bcnstv", 0.2, 2); -- Superimpose a dashed line grid, with 1.5 mm marks and spaces. -- Set_Line_Style expects a pointer! (-- Not Ada.) Set_Line_Style(mark1, space1); Set_Pen_Color(Yellow); Box_Around_Viewport("g", 30.0, 0, "g", 0.2, 0); Set_Line_Style(Default_Continuous_Line); Set_Pen_Color(Green); Write_Labels("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); for i in x'Range loop x(i) := 3.6 * Long_Float(i); y(i) := sin(x(i) * pi / 180.0); end loop; Set_Pen_Color(Aquamarine); Draw_Curve(x, y); end plot3; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Get version number, just for kicks Put_Line("PLplot library version: " & Get_Version_Number); -- Initialize plplot -- Divide page into 2x2 plots unless user overrides Initialize_Query_Device(2, 2); -- Set up the data -- Original case xscale := 6.0; yscale := 1.0; xoff := 0.0; yoff := 0.0; -- Do a plot plot1; -- Set up the data xscale := 1.0; yscale := 0.0014; yoff := 0.0185; -- Do a plot Set_Floating_Point_Display_Y(Max_Digits => 5, Field_Digits => 0); plot1; plot2; plot3; -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick01a; plplot-5.10.0+dfsg/examples/ada/xthick00a.adb 644 1750 1750 407312011235527 175400ustar andrewandrew-- $Id: xthick00a.adb 12205 2012-08-10 16:48:23Z airwin $ -- -- Simple demo of a 2D line plot. -- -- Copyright (C) 2011 Jerry Bauck -- -- This file is part of PLplot. -- -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- See x00_easy_a.adb for an easier way to generate similar results using -- Ada-specific extensions to PLplot. -- See x00a.adb for a version of this program that uses traditional plplot names. with PLplot_Auxiliary, PLplot; use PLplot_Auxiliary, PLplot; procedure xthick00a is x, y : Real_Vector(0 .. 100); x_Min, y_Min : Long_Float := 0.0; x_Max : Long_Float := 1.0; y_Max : Long_Float := 100.0; begin -- Prepare data to be plotted. for i in x'range loop x(i) := Long_Float(i) / Long_Float(x'length - 1); y(i) := y_Max * x(i)**2; end loop; -- Parse and process command line arguments. Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot. Initialize_PLplot; -- Create a labelled box to hold the plot. Set_Environment(x_Min, x_Max, y_Min, y_Max, Justification => Not_Justified, Axis_Style => Linear_Box_Plus); Write_Labels (X_Label => "x", Y_Label => "y=100 x#u2#d", Title_Label => "Simple PLplot demo of a 2D line plot"); -- Plot the data that was prepared above. Draw_Curve(x, y); -- Close PLplot library. End_PLplot; end xthick00a; plplot-5.10.0+dfsg/examples/ada/x18a.adb 644 1750 1750 1213311543675237 165610ustar andrewandrew-- $Id: x18a.adb 11680 2011-03-27 17:57:51Z airwin $ -- 3-d line and point plot demo. Adapted from x08c.c. -- Copyright (C) 2008 - 2011 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, System, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; procedure x18a is ---------------------------------------------------------------------------- -- Does a series of 3-d plots for a given data set, with different -- viewing options in each plot. ---------------------------------------------------------------------------- opt : array(0 .. 3) of Boolean := (True, False, True, False); alt : Real_Vector(0 .. 3) := (20.0, 35.0, 50.0, 65.0); az : Real_Vector(0 .. 3) := (30.0, 40.0, 50.0, 60.0); NPTS : constant Integer := 1000; x, y, z : Real_Vector(0 .. NPTS - 1); r : Long_Float; procedure test_poly(k : Integer) is x, y, z : Real_Vector(0 .. 4); Two_Pi : Long_Float := 2.0 * pi; draw : array(0 .. 3) of Boolean_Array_1D(0 .. 3); function THETA(a : Integer) return Long_Float is begin return Two_Pi * Long_Float(a) / 20.0; end; function PHI(a : Integer) return Long_Float is begin return pi * Long_Float(a) / 20.1; end; begin draw(0) := (True, True, True, True); draw(1) := (True, False, True, False); draw(2) := (False, True, False, True); draw(3) := (True, True, False, False); pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -0.9, 1.1); plcol0(1); plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt(k), az(k)); plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); plcol0(2); for i in 0 .. 19 loop for j in 0 .. 19 loop x(0) := sin(PHI(j)) * cos(THETA(i)); y(0) := sin(PHI(j)) * sin(THETA(i)); z(0) := cos(PHI(j)); x(1) := sin(PHI(j + 1)) * cos(THETA(i)); y(1) := sin(PHI(j + 1)) * sin(THETA(i)); z(1) := cos(PHI(j + 1)); x(2) := sin(PHI(j + 1)) * cos(THETA(i + 1)); y(2) := sin(PHI(j + 1)) * sin(THETA(i + 1)); z(2) := cos(PHI(j + 1)); x(3) := sin(PHI(j)) * cos(THETA(i + 1)); y(3) := sin(PHI(j)) * sin(THETA(i + 1)); z(3) := cos(PHI(j)); x(4) := sin(PHI(j)) * cos(THETA(i)); y(4) := sin(PHI(j)) * sin(THETA(i)); z(4) := cos(PHI(j)); plpoly3(x, y, z, draw(k), True ); end loop; end loop; plcol0(3); plmtex("t", 1.0, 0.5, 0.5, "unit radius sphere" ); end test_poly; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; for k in 0 .. 3 loop test_poly(k); end loop; -- From the mind of a sick and twisted physicist... for i in x'range loop z(i) := -1.0 + 2.0 * Long_Float(i) / Long_Float(NPTS); -- Pick one... r := z(i); x(i) := r * cos( 2.0 * pi * 6.0 * Long_Float(i) / Long_Float(NPTS) ); y(i) := r * sin( 2.0 * pi * 6.0 * Long_Float(i) / Long_Float(NPTS) ); end loop; for k in opt'range loop pladv(0); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -0.9, 1.1); plcol0(1); plw3d(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt(k), az(k)); plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); plcol0(2); if opt(k) then plline3(x, y, z); else -- U+22C5 DOT OPERATOR. plstring3(x, y, z, "⋅"); end if; plcol0(3); plmtex("t", 1.0, 0.5, 0.5, "#frPLplot Example 18 - Alt=" & Trim(Integer'image(Integer(alt(k))), Left) & ", Az=" & Trim(Integer'image(Integer( az(k))), Left)); end loop; plend; end x18a; plplot-5.10.0+dfsg/examples/ada/xthick07a.adb 644 1750 1750 572311543675237 175710ustar andrewandrew-- $Id: xthick07a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Font demo. -- Copyright (C) 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick07a is k : Integer; x, y : Real_Vector(1 .. 1); base : array(0 .. 19) of Integer := (0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900); begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; Set_Characer_Set(0); for l in 0 .. 19 loop if l = 2 then Set_Characer_Set(1); end if; Advance_To_Subpage(Next_Subpage); -- Set up viewport and window Set_Pen_Color(2); Set_Viewport_Normalized(0.15, 0.95, 0.1, 0.9); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); -- Draw the grid using Box_Around_Viewport Box_Around_Viewport("bcg", 0.1, 0, "bcg", 0.1, 0); -- Write the digits below the frame Set_Pen_Color(15); for i in 0 .. 9 loop Write_Text_Viewport("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); end loop; k := 0; for i in 0 .. 9 loop -- Write the digits to the left of the frame Write_Text_Viewport("lv", 1.0, (0.95 - 0.1 * Long_Float(i)), 1.0, Trim(Integer'image(base(l) + 10 * i), Left)); for j in 0 .. 9 loop x(1) := 0.1 * Long_Float(j) + 0.05; y(1) := 0.95 - 0.1 * Long_Float(i); -- Display the symbols Draw_Hershey_Symbol(x, y, base(l) + k); k := k + 1; end loop; end loop; if l < 2 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)"); else Write_Text_Viewport("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)"); end if; end loop; End_PLplot; end xthick07a; plplot-5.10.0+dfsg/examples/ada/x23a.adb 644 1750 1750 3723311543675237 165650ustar andrewandrew-- $Id: x23a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Displays Greek letters and mathematically interesting Unicode ranges. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x23a is Greek : array(0 .. 47) of String(1 .. 3) := ( "#gA","#gB","#gG","#gD","#gE","#gZ","#gY","#gH","#gI","#gK","#gL","#gM", "#gN","#gC","#gO","#gP","#gR","#gS","#gT","#gU","#gF","#gX","#gQ","#gW", "#ga","#gb","#gg","#gd","#ge","#gz","#gy","#gh","#gi","#gk","#gl","#gm", "#gn","#gc","#go","#gp","#gr","#gs","#gt","#gu","#gf","#gx","#gq","#gw"); Type1 : array (0 .. 165) of Integer := ( 16#0020#,16#0021#,16#0023#,16#0025#,16#0026#, 16#0028#,16#0029#,16#002b#,16#002c#,16#002e#, 16#002f#,16#0030#,16#0031#,16#0032#,16#0033#, 16#0034#,16#0035#,16#0036#,16#0037#,16#0038#, 16#0039#,16#003a#,16#003b#,16#003c#,16#003d#, 16#003e#,16#003f#,16#005b#,16#005d#,16#005f#, 16#007b#,16#007c#,16#007d#,16#00a9#,16#00ac#, 16#00ae#,16#00b0#,16#00b1#,16#00d7#,16#00f7#, 16#0192#,16#0391#,16#0392#,16#0393#,16#0394#, 16#0395#,16#0396#,16#0397#,16#0398#,16#0399#, 16#039a#,16#039b#,16#039c#,16#039d#,16#039e#, 16#039f#,16#03a0#,16#03a1#,16#03a3#,16#03a4#, 16#03a5#,16#03a6#,16#03a7#,16#03a8#,16#03a9#, 16#03b1#,16#03b2#,16#03b3#,16#03b4#,16#03b5#, 16#03b6#,16#03b7#,16#03b8#,16#03b9#,16#03ba#, 16#03bb#,16#03bc#,16#03bd#,16#03be#,16#03bf#, 16#03c0#,16#03c1#,16#03c2#,16#03c3#,16#03c4#, 16#03c5#,16#03c6#,16#03c7#,16#03c8#,16#03c9#, 16#03d1#,16#03d2#,16#03d5#,16#03d6#,16#2022#, 16#2026#,16#2032#,16#2033#,16#203e#,16#2044#, 16#2111#,16#2118#,16#211c#,16#2122#,16#2126#, 16#2135#,16#2190#,16#2191#,16#2192#,16#2193#, 16#2194#,16#21b5#,16#21d0#,16#21d1#,16#21d2#, 16#21d3#,16#21d4#,16#2200#,16#2202#,16#2203#, 16#2205#,16#2206#,16#2207#,16#2208#,16#2209#, 16#220b#,16#220f#,16#2211#,16#2212#,16#2215#, 16#2217#,16#221a#,16#221d#,16#221e#,16#2220#, 16#2227#,16#2228#,16#2229#,16#222a#,16#222b#, 16#2234#,16#223c#,16#2245#,16#2248#,16#2260#, 16#2261#,16#2264#,16#2265#,16#2282#,16#2283#, 16#2284#,16#2286#,16#2287#,16#2295#,16#2297#, 16#22a5#,16#22c5#,16#2320#,16#2321#,16#2329#, 16#232a#,16#25ca#,16#2660#,16#2663#,16#2665#, 16#2666#); function title(which : Integer) return String is begin if which = 0 then return "#<0x10>PLplot Example 23 - Greek Letters"; end if; if which = 1 then return "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)"; end if; if which = 2 then return "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)"; end if; if which = 3 then return "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)"; end if; if which = 4 then return "#<0x10>PLplot Example 23 - Number Forms Unicode Block"; end if; if which = 5 then return "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)"; end if; if which = 6 then return "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)"; end if; if which = 7 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)"; end if; if which = 8 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)"; end if; if which = 9 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)"; end if; if which = 10 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"; end if; return "oops"; end title; lo : array (0 .. 10) of Integer := ( 16#0#, 16#0#, 16#40#, 16#80#, 16#2153#, 16#2190#, 16#21d0#, 16#2200#, 16#2240#, 16#2280#, 16#22c0# ); hi : array (0 .. 10) of Integer := ( 16#30#, 16#40#, 16#80#, 16#A6#, 16#2184#, 16#21d0#, 16#2200#, 16#2240#, 16#2280#, 16#22c0#, 16#2300# ); nxcells : array (0 .. 10) of Integer := ( 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ); nycells : array (0 .. 10) of Integer := ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ); -- non-zero values must be consistent with nxcells and nycells. offset : array (0 .. 10) of Integer := ( 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0 ); -- 30 possible FCI values. FCI_COMBINATIONS : constant integer := 30; fci : array (0 .. 29) of Unicode := ( 16#80000000#, 16#80000001#, 16#80000002#, 16#80000003#, 16#80000004#, 16#80000010#, 16#80000011#, 16#80000012#, 16#80000013#, 16#80000014#, 16#80000020#, 16#80000021#, 16#80000022#, 16#80000023#, 16#80000024#, 16#80000100#, 16#80000101#, 16#80000102#, 16#80000103#, 16#80000104#, 16#80000110#, 16#80000111#, 16#80000112#, 16#80000113#, 16#80000114#, 16#80000120#, 16#80000121#, 16#80000122#, 16#80000123#, 16#80000124# ); function family(which : Integer) return String is begin if which = 0 then return "sans-serif"; end if; if which = 1 then return "serif"; end if; if which = 2 then return "monospace"; end if; if which = 3 then return "script"; end if; if which = 4 then return "symbol"; end if; return "oops"; end family; function style(which : Integer) return String is begin if which = 0 then return "upright"; end if; if which = 1 then return "italic"; end if; if which = 2 then return "oblique"; end if; return "oops"; end style; function weight(which : Integer) return String is begin if which = 0 then return "medium"; end if; if which = 1 then return "bold"; end if; return "oops"; end weight; xmin, xmax, ymin, ymax, ycharacter_scale, yoffset : Long_Float; chardef, charht, deltax, deltay, x, y : Long_Float; length, slice : Integer; cmdString : Unbounded_String; fci_old : Unicode; ifamily, istyle, iweight : Integer; dy : Long_Float := 0.030; family_index, style_index, weight_index : Integer; -- Must be big enough to contain the prefix strings, the font-changing -- commands, and the "The quick brown..." string. a_string : Unbounded_String; package Unicode_IO is new Ada.Text_IO.Modular_IO(Unicode); -- fix this probably not used use Unicode_IO; -- Make a four-character hexadecimal string image of integers. -- Useful for font manipulations. -- To_Lower is used to make C-like output for A..F -- so that the PostScript files generated by C and Ada are identical. -- Integer values greater than 65535 (2^16-1) are treated modulo 2^16. -- Based on Stephen Leake's SAL.Generic_Hex_Image. -- Original: Copyright (C) 2005 Stephen Leake. All Rights Reserved, and -- offered under GNU General Public License version 2 or later. function Hex_Image_4 (Item : in Integer) return String is Temp : Integer := Item; Nibble : Integer; Image : String (1 .. 4); begin for I in reverse Image'Range loop Nibble := Temp mod 16; Temp := Temp / 16; if Nibble > 9 then Image (I) := Character'Val (Character'Pos ('A') + Nibble - 10); else Image (I) := Character'Val (Character'Pos ('0') + Nibble); end if; end loop; Image := Ada.Characters.Handling.To_Lower(Image); return Image; end Hex_Image_4; -- Make a eight-character hexadecimal string image of Unicode. function Hex_Image_8 (Item : in Unicode) return String is -- Long_Long_Integer so don't overflow Integer Temp : Long_Long_Integer := Long_Long_Integer(Item); Nibble : Long_Long_Integer; Image : String (1 .. 8); begin for I in reverse Image'Range loop Nibble := Temp mod 16; Temp := Temp / 16; if Nibble > 9 then Image (I) := Character'Val(Character'Pos ('A') + Nibble - 10); else Image (I) := Character'Val(Character'Pos ('0') + Nibble); end if; end loop; Image := Ada.Characters.Handling.To_Lower(Image); return Image; end Hex_Image_8; begin plparseopts(PL_PARSE_FULL); plinit; for page in 0 .. 10 loop pladv(0); -- Set up viewport and window plvpor(0.02, 0.98, 0.02, 0.90); plwind(0.0, 1.0, 0.0, 1.0); plgspa(xmin, xmax, ymin, ymax); plschr(0.0, 0.8); ycharacter_scale := (1.0 - 0.0) / (ymax - ymin); -- Factor should be 0.5, but heuristically it turns out to be larger. plgchr(chardef, charht); yoffset := 1.0 * charht * ycharacter_scale; -- Draw the grid using plbox plcol0(2); deltax := 1.0 / Long_Float(nxcells(page)); deltay := 1.0 / Long_Float(nycells(page)); plbox("bcg", deltax, 0, "bcg", deltay, 0); plcol0(15); length := hi(page) - lo(page); slice := 0; for j in reverse -1 .. nycells(page) - 1 loop y := (0.5 + Long_Float(j)) * deltay; for i in 0 .. nxcells(page) - 1 loop x := (0.5 + Long_Float(i)) * deltax; if slice < length then if page = 0 then cmdString := To_Unbounded_String(Greek(slice)); elsif page >= 1 and page <= 3 then cmdString := To_Unbounded_String("#[0x" & Hex_Image_4(Type1(offset(page)+slice)) & "]"); elsif page >= 4 then cmdString := To_Unbounded_String("#[0x" & Hex_Image_4(lo(page)+slice) & "]"); end if; plptex(x, y + yoffset, 1.0, 0.0, 0.5, To_String(cmdString)); plptex(x, y - yoffset, 1.0, 0.0, 0.5, "#" & To_String(cmdString)); end if; slice := slice + 1; end loop; -- i end loop; -- j plschr(0.0, 1.0); -- Page title plmtex("t", 1.5, 0.5, 0.5, title(page)); end loop; --page -- Demonstrate methods of getting the current fonts plgfci(fci_old); plgfont(ifamily, istyle, iweight); Put("For example 23 prior to page 12 the FCI is "); -- The following hack in outputting the hexadecimal value of fci_old in "C" -- style, e.g. 0x00000000 instead of "Ada" style 16#00000000#, is done in -- order to create the same textual output as the C example x23c. -- Put(fci_old, Base => 16, Width => 0); -- Outputs "Ada" style. Put("0x" & Hex_Image_8(fci_old)); -- Outputs "C" style. New_Line; Put("For example 23 prior to page 12 the font family, style and weight are " & family(ifamily) & " " & style(istyle) & " " & weight(iweight)); New_Line; for page in 11 .. 15 loop pladv(0); plvpor(0.02, 0.98, 0.02, 0.90); plwind(0.0, 1.0, 0.0, 1.0); plsfci(0); if page = 11 then plmtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with plsfci"); elsif page = 12 then plmtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with plsfont"); elsif page = 13 then plmtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with ##<0x8nnnnnnn> construct"); elsif page = 14 then plmtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with ##<0xmn> constructs"); elsif page = 15 then plmtex("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with ## constructs"); end if; plschr(0.0, 0.75); for i in 0 .. FCI_COMBINATIONS - 1 loop family_index := i mod 5; style_index := (i / 5) mod 3; weight_index := ((i / 5) / 3) mod 2; if page = 11 then plsfci(fci(i)); a_string := To_Unbounded_String( "Page 12, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "The quick brown fox jumps over the lazy dog"); elsif page = 12 then plsfont(family_index, style_index, weight_index); a_string := To_Unbounded_String( "Page 13, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "The quick brown fox jumps over the lazy dog"); elsif page = 13 then a_string := To_Unbounded_String( "Page 14, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "#<0x" & Hex_Image_8(fci(i)) & ">" & "The quick brown fox jumps over the lazy dog"); elsif page = 14 then a_string := To_Unbounded_String( "Page 15, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "#<0x" & Trim(Integer'Image(family_index), Left) & "0>#<0x" & Trim(Integer'Image(style_index), Left) & "1>#<0x" & Trim(Integer'Image(weight_index), Left) & "2>" & "The quick brown fox jumps over the lazy dog"); elsif page = 15 then a_string := To_Unbounded_String( "Page 16, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "#<" & family(family_index) & "/>#<" & style (style_index) & "/>#<" & weight(weight_index) & "/>" & "The quick brown fox jumps over the lazy dog"); end if; plptex (0.0, 1.0 - (Long_Float(i) + 0.5) * dy, 1.0, 0.0, 0.0, To_String(a_string)); end loop; -- i plschr(0.0, 1.0); end loop; -- page -- Restore defaults plcol0(1); plend; end x23a; plplot-5.10.0+dfsg/examples/ada/xthick09a.adb 644 1750 1750 3207411543675237 176120ustar andrewandrew-- $Id: xthick09a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Contour plot demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, System, PLplot, PLplot_Auxiliary; -------------------------------------------------------------------------- -- Does several contour plots using different coordinate mappings. -------------------------------------------------------------------------- procedure xthick09a is XPTS : Integer := 35; -- Number of data points in x YPTS : Integer := 46; -- Number of data points in y -- polar plot data PERIMETERPTS : Integer := 100; RPTS : Integer := 40; THETAPTS : Integer := 40; -- potential plot data PPERIMETERPTS : Integer := 100; PRPTS : Integer := 40; PTHETAPTS : Integer := 64; PNLEVEL : Integer := 20; xx, yy, argx, argy, distort : Long_Float; mark : Integer_Array_1D(1 .. 1); space : Integer_Array_1D(1 .. 1); zgdummy : Real_Vector(0 .. 0); -- not used z, w : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); clevel : Real_Vector(0 .. 10) := (-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0); cgrid1 : aliased Transformation_Data_Type (x_Last => XPTS - 1, y_Last => YPTS - 1, z_Last => 0); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => XPTS - 1, y_Last => YPTS - 1); -- Quick and dirty function for converting from C. Apparently C lacks an -- exponentiation operator. -- Don't have a cow over the abs(a) in pow because all calls to pow() in -- this example have an exponent of 2.0, i.e., squaring. Without the abs() -- Ada raises an exception. (Why doesn't C?) function pow(a, b : Long_Float) return Long_Float is aa : Long_Float; begin aa := abs(a); return aa ** b; end pow; procedure mypltr -- This spec is necessary to accommodate pragma Convention(). (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer); pragma Convention(Convention => C, Entity => mypltr); procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer) is -- Transformation function XSPA : Long_Float := 2.0 / Long_Float(XPTS - 1); YSPA : Long_Float := 2.0 / Long_Float(YPTS - 1); tr : Real_Vector(0 .. 5) := (XSPA, 0.0, -1.0, 0.0, YSPA, -1.0); begin -- mypltr tx := tr(0) * x + tr(1) * y + tr(2); ty := tr(3) * x + tr(4) * y + tr(5); end mypltr; -- Polar contour plot example procedure polar is t, r, theta : Long_Float; px, py : Real_Vector(0 .. PERIMETERPTS - 1); lev : Real_Vector(0 .. 9); z : Real_Matrix(0 .. RPTS - 1, 0 .. THETAPTS - 1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => RPTS - 1, y_Last => THETAPTS - 1); begin -- polar Set_Environment(-1.0, 1.0, -1.0, 1.0, Not_Justified, No_Box); Set_Pen_Color(Red); -- Perimeter for i in 0 .. PERIMETERPTS - 1 loop t := (2.0 * pi / Long_Float(PERIMETERPTS - 1)) * Long_Float(i); px(i) := cos(t); py(i) := sin(t); end loop; Draw_Curve(px, py); for i in 0 .. RPTS - 1 loop r := Long_Float(i) / Long_Float(RPTS - 1); for j in 0 .. THETAPTS - 1 loop theta := (2.0 * pi / Long_Float(THETAPTS - 1)) * Long_Float(j); cgrid2.xg(i, j) := r * cos(theta); cgrid2.yg(i, j) := r * sin(theta); z(i, j) := r; end loop; end loop; for i in lev'range loop lev(i) := 0.05 + 0.10 * Long_Float(i); end loop; Set_Pen_Color(Yellow); Contour_Plot(z, 1, RPTS, 1, THETAPTS, lev, Plot_Transformation_2'access, cgrid2'Address); Set_Pen_Color(Red); Write_Labels("", "", "Polar Contour Plot"); end polar; -- Shielded potential contour plot example procedure potential is nlevelneg, nlevelpos : Integer; ncollin, ncolbox, ncollab : Integer; rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax : Long_Float; peps, xpmin, xpmax, ypmin, ypmax : Long_Float; eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i : Long_Float; div1, div1i, div2, div2i : Long_Float; t, r, theta : Long_Float; dz, clevel : Long_Float; clevelneg : Real_Vector(0 .. 9); -- Compare with x09c.c which clevelpos : Real_Vector(0 .. 9); -- over-allocates these arrays. px, py : Real_Vector(0 .. PPERIMETERPTS - 1); z : Real_Matrix(0 .. PRPTS - 1, 0 .. PTHETAPTS - 1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => PRPTS - 1, y_Last => PTHETAPTS - 1); begin -- potential -- Create data to be contoured. for i in 0 .. PRPTS - 1 loop r := 0.5 + Long_Float(i); for j in 0 .. PTHETAPTS - 1 loop theta := (2.0 * pi / Long_Float(PTHETAPTS - 1)) * (0.5 + Long_Float(j)); cgrid2.xg(i, j) := r * cos(theta); cgrid2.yg(i, j) := r * sin(theta); end loop; end loop; rmax := r; xmin := Matrix_Min(cgrid2.xg); xmax := Matrix_Max(cgrid2.xg); ymin := Matrix_Min(cgrid2.yg); ymax := Matrix_Max(cgrid2.yg); x0 := (xmin + xmax) / 2.0; y0 := (ymin + ymax) / 2.0; -- Expanded limits peps := 0.05; xpmin := xmin - abs(xmin) * peps; xpmax := xmax + abs(xmax) * peps; ypmin := ymin - abs(ymin) * peps; ypmax := ymax + abs(ymax) * peps; -- Potential inside a conducting cylinder (or sphere) by method of images -- Charge 1 is placed at (d1, d1), with image charge at (d2, d2). -- Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). -- Also put in smoothing term at small distances. eps := 2.0; q1 := 1.0; d1 := rmax / 4.0; q1i := -q1 * rmax / d1; d1i := rmax * rmax / d1; q2 := -1.0; d2 := rmax / 4.0; q2i := -q2 * rmax / d2; d2i := rmax * rmax / d2; for i in 0 .. PRPTS - 1 loop for j in 0 .. PTHETAPTS - 1 loop div1 := sqrt(pow(cgrid2.xg(i, j)-d1, 2.0) + pow(cgrid2.yg(i, j)-d1, 2.0) + pow(eps, 2.0)); div1i := sqrt(pow(cgrid2.xg(i, j)-d1i, 2.0) + pow(cgrid2.yg(i, j)-d1i, 2.0) + pow(eps, 2.0)); div2 := sqrt(pow(cgrid2.xg(i, j)-d2, 2.0) + pow(cgrid2.yg(i, j)+d2, 2.0) + pow(eps, 2.0)); div2i := sqrt(pow(cgrid2.xg(i, j)-d2i, 2.0) + pow(cgrid2.yg(i, j)+d2i, 2.0) + pow(eps, 2.0)); z(i, j) := q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_Max(z); -- Positive and negative contour levels. dz := (zmax - zmin) / Long_Float(PNLEVEL); nlevelneg := 0; nlevelpos := 0; for i in 0 .. PNLEVEL - 1 loop clevel := zmin + (Long_Float(i) + 0.5) * dz; if clevel <= 0.0 then clevelneg(nlevelneg) := clevel; nlevelneg := nlevelneg + 1; else clevelpos(nlevelpos) := clevel; nlevelpos := nlevelpos + 1; end if; end loop; -- Colours! ncollin := Cyan; ncolbox := Red; ncollab := Yellow; -- Finally start plotting this page! Advance_To_Subpage(Next_Subpage); Set_Pen_Color(ncolbox); Set_Viewport_Maximized_For_Aspect_Ratio(0.1, 0.9, 0.1, 0.9, 1.0); Set_Viewport_World(xpmin, xpmax, ypmin, ypmax); Box_Around_Viewport("", 0.0, 0, "", 0.0, 0); Set_Pen_Color(ncollin); if nlevelneg >0 then -- Negative contours Select_Line_Style(2); Contour_Plot(z, 1, PRPTS, 1, PTHETAPTS, clevelneg, Plot_Transformation_2'access, cgrid2'Address); end if; if nlevelpos > 0 then -- Positive contours Select_Line_Style(1); Contour_Plot(z, 1, PRPTS, 1, PTHETAPTS, clevelpos, Plot_Transformation_2'access, cgrid2'Address); end if; -- Draw outer boundary for i in 0 .. PPERIMETERPTS - 1 loop t := (2.0 * pi / Long_Float(PPERIMETERPTS - 1)) * Long_Float(i); px(i) := x0 + rmax * cos(t); py(i) := y0 + rmax * sin(t); end loop; Set_Pen_Color(ncolbox); Draw_Curve(px, py); Set_Pen_Color(ncollab); Write_Labels("", "", "Shielded potential of charges in a conducting sphere"); end potential; begin -- main -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; -- Take care of limitation on singleton positional aggregates. mark(1) := 1500; space(1) := 1500; zgdummy(0) := 0.0; for i in 0 .. XPTS - 1 loop xx := Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); for j in 0 .. YPTS - 1 loop yy := Long_Float(j - YPTS / 2) / Long_Float(YPTS / 2) - 1.0; z(i, j) := xx * xx - yy * yy; w(i, j) := 2.0 * xx * yy; end loop; end loop; -- Set up grids cgrid1.zg := zgdummy; -- dummy; not used for i in 0 .. XPTS - 1 loop for j in 0 .. YPTS - 1 loop mypltr(Long_Float(i), Long_Float(j), xx, yy, System.Null_Address); --here argx := xx * pi / 2.0; argy := yy * pi / 2.0; distort := 0.4; cgrid1.xg(i) := xx + distort * cos(argx); cgrid1.yg(j) := yy - distort * cos(argy); cgrid2.xg(i, j) := xx + distort * cos(argx) * cos(argy); cgrid2.yg(i, j) := yy - distort * cos(argx) * cos(argy); end loop; end loop; -- The following use of Unrestricted_Access works but is GNAT-specific. -- I don't know how else to solve the problem of having a user-specified -- function that is passed through five or so levels of C as a callback -- while also not requiring the user to modify the source for plplot_thin.adb -- which is where the type for the "pltr" subprograms is declared. Even if -- I move that type declaration into the thick bindings, the problem remains. Set_Contour_Label_Format(4,3); Set_Contour_Label_Parameters(0.006, 0.3, 0.1, True); Set_Environment(-1.0, 1.0, -1.0, 1.0, Not_Justified, Linear_Box_Plus); Set_Pen_Color(Yellow); Contour_Plot(z, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); Set_Line_Style(mark, space); Set_Pen_Color(Green); Contour_Plot(w, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); Set_Line_Style(0); Set_Pen_Color(Red); Write_Labels("X Coordinate", "Y Coordinate", "Streamlines of flow"); -- Plot using 1d coordinate transform Set_Contour_Label_Parameters(0.006, 0.3, 0.1, False); Set_Environment(-1.0, 1.0, -1.0, 1.0, Not_Justified, Linear_Box_Plus); Set_Pen_Color(Yellow); Contour_Plot(z, 1, XPTS, 1, YPTS, clevel, Plot_Transformation_1'access, cgrid1'Address); Set_Line_Style(mark, space); Set_Pen_Color(Green); Contour_Plot(w, 1, XPTS, 1, YPTS, clevel, Plot_Transformation_1'access, cgrid1'Address); Set_Line_Style(0); Set_Pen_Color(Red); Write_Labels("X Coordinate", "Y Coordinate", "Streamlines of flow"); -- Plot using 2d coordinate transform Set_Environment(-1.0, 1.0, -1.0, 1.0, Not_Justified, Linear_Box_Plus); Set_Pen_Color(Yellow); Contour_Plot(z, 1, XPTS, 1, YPTS, clevel, Plot_Transformation_2'access, cgrid2'Address); Set_Line_Style(mark, space); Set_Pen_Color(Green); Contour_Plot(w, 1, XPTS, 1, YPTS, clevel, Plot_Transformation_2'access, cgrid2'Address); Set_Line_Style(0); Set_Pen_Color(Red); Write_Labels("X Coordinate", "Y Coordinate", "Streamlines of flow"); -- Make polar plot. Set_Contour_Label_Parameters(0.006, 0.3, 0.1, False); polar; -- Make potential plot. Set_Contour_Label_Parameters(0.006, 0.3, 0.1, False); potential; End_PLplot; end xthick09a; plplot-5.10.0+dfsg/examples/ada/x07a.adb 644 1750 1750 541511543675237 165440ustar andrewandrew-- $Id: x07a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Font demo. -- Copyright (C) 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x07a is k : Integer; x, y : Real_Vector(1 .. 1); base : array(0 .. 19) of Integer := (0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900); begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; plfontld(0); for l in 0 .. 19 loop if l = 2 then plfontld(1); end if; pladv(0); -- Set up viewport and window plcol0(2); plvpor(0.15, 0.95, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.0); -- Draw the grid using plbox plbox("bcg", 0.1, 0, "bcg", 0.1, 0); -- Write the digits below the frame plcol0(15); for i in 0 .. 9 loop plmtex("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); end loop; k := 0; for i in 0 .. 9 loop -- Write the digits to the left of the frame plmtex("lv", 1.0, (0.95 - 0.1 * Long_Float(i)), 1.0, Trim(Integer'image(base(l) + 10 * i), Left)); for j in 0 .. 9 loop x(1) := 0.1 * Long_Float(j) + 0.05; y(1) := 0.95 - 0.1 * Long_Float(i); -- Display the symbols plsym(x, y, base(l) + k); k := k + 1; end loop; end loop; if l < 2 then plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)"); else plmtex("t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)"); end if; end loop; plend; end x07a; plplot-5.10.0+dfsg/examples/ada/xthick20a.adb 644 1750 1750 3560112012305413 175540ustar andrewandrew-- $Id: xthick20a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Draw_Image_Color_Map_1_Automatic demo -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Interfaces.C, System, Ada.Sequential_IO, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Text_IO, Interfaces.C, System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; procedure xthick20a is XDIM : constant Integer := 260; YDIM : constant Integer := 220; PLK_Return : constant unsigned := 16#0D#; dbg : Integer := 0; nosombrero : Integer := 0; nointeractive : Integer := 0; x : Real_Vector(0 .. XDIM - 1); y : Real_Vector(0 .. YDIM - 1); z, r : Real_Matrix(0 .. XDIM - 1, 0 .. YDIM - 1); xi, yi, xe, ye : Long_Float; width, height, num_col : Integer; img_f : Real_Matrix(0 .. 398, 0 .. 485); -- Lena is width 399, height 486. img_min, img_max : Long_Float; Get_Clip_Return : Integer; type stretch_data is record xmin, xmax, ymin, ymax : Long_Float; stretch : Long_Float; end record; stretch : stretch_data; xx, yy : Long_Float; f_name : String(1 .. 200); f_name_length : Integer; Save_Sombrero : Boolean := False; -- Read image from file in binary ppm format. procedure read_img (fname : String; img_f : out Real_Matrix; width, height, num_col : out Integer) is type Byte is mod 2 ** 8; A_Byte : Byte; package Lena_IO is new Ada.Sequential_IO(Byte); use Lena_IO; Input_File : Lena_IO.File_Type; begin -- Naive grayscale binary ppm reading. If you know how to, improve it. -- Mine is naiver than yours. -- lena.pgm has 133 bytes of header followed by 399 * 486 bytes of 8-bit pixels. Lena_IO.Open(Input_File, In_File, fname); for i in 1 .. 133 loop Lena_IO.Read(Input_File, A_Byte); end loop; width := 399; -- columns height := 486; -- rows num_col := 255; -- number of colors for j in img_f'range(2) loop for i in img_f'range(1) loop Lena_IO.Read(Input_File, A_Byte); img_f(i, height - j - 1) := Long_Float(A_Byte); -- Flip image up-down. end loop; end loop; end read_img; -- Save plot. procedure save_plot(fname : String) is cur_strm, new_strm : Integer; begin Get_Stream_Number(cur_strm); -- Get current stream. Make_Stream(new_strm); -- Create a new one. Set_Device_Name("psc"); -- New device type. Use a known existing driver. Set_Output_File_Name(fname); -- Set the file name. Copy_State_Parameters(cur_strm, False); -- Copy old stream parameters to new stream. Replot; -- Do the save. End_PLplot_Current_Stream; -- Close new device... Set_Stream_Number(cur_strm); -- ...and return to previous one. end save_plot; -- Get selection square interactively. procedure get_clip(xi, xe, yi, ye : in out Long_Float; Return_This : out Integer) is gin : Graphics_Input_Record_Type; xxi : Long_Float := xi; yyi : Long_Float := yi; xxe : Long_Float := xe; yye : Long_Float := ye; t : Long_Float; start : Integer := 0; st : Boolean := False; sx, sy : Real_Vector(0 .. 4); begin Set_XOR_Mode(True, st); -- Enter xor mode to draw a selection rectangle. if st then -- Driver has xormod capability. Continue. loop Set_XOR_Mode(False, st); Get_Cursor(gin); Set_XOR_Mode(True, st); if gin.button = 1 then xxi := gin.wX; yyi := gin.wY; if start /= 0 then -- Suppress warning """sy"" may be referenced before it has a value". pragma Warnings(Off); Draw_Curve(sx, sy); -- Clear previous rectangle. pragma Warnings(On); end if; start := 0; sx(0) := xxi; sy(0) := yyi; sx(4) := xxi; sy(4) := yyi; end if; if (gin.state and Unsigned(16#100#)) /= 0 then xxe := gin.wX; yye := gin.wY; if start /= 0 then Draw_Curve(sx, sy); -- Clear previous rectangle. end if; start := 1; sx(2) := xxe; sy(2) := yye; sx(1) := xxe; sy(1) := yyi; sx(3) := xxi; sy(3) := yye; Draw_Curve(sx, sy); -- Draw new rectangle. end if; if gin.button = 3 or gin.keysym = PLK_Return or gin.keysym = unsigned(Character'pos('Q')) then if start /= 0 then Draw_Curve(sx, sy); -- Clear previous rectangle. end if; exit; end if; end loop; Set_XOR_Mode(False, st); -- Leave xor mod. if xxe < xxi then t := xxi; xxi := xxe; xxe := t; end if; if yyi < yye then t :=yyi; yyi := yye; yye := t; end if; xe := xxe; xi := xxi; ye := yye; yi := yyi; if gin.keysym = unsigned(Character'pos('Q')) then Return_This := 1; else Return_This := 0; end if; else -- Driver has no xormod capability; just do nothing. Return_This := 0; end if; end get_clip; -- Set gray colormap. procedure gray_cmap(num_col : Integer) is r, g, b, pos : Real_Vector(0 .. 1); begin r(0) := 0.0; g(0) := 0.0; b(0) := 0.0; r(1) := 1.0; g(1) := 1.0; b(1) := 1.0; pos(0) := 0.0; pos(1) := 1.0; Set_Number_Of_Colors_In_Color_Map_1(num_col); Set_Color_Map_1_Piecewise(RGB, pos, r, g, b, Alt_Hue_Path_None); end gray_cmap; procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; s : stretch_data) is x0, y0, dy : Long_Float; begin x0 := (s.xmin + s.xmax) * 0.5; y0 := (s.ymin + s.ymax) * 0.5; dy := (s.ymax - s.ymin) * 0.5; tx := x0 + (x0 - x) * (1.0 - s.stretch * cos((y - y0) / dy * pi * 0.5)); ty := y; end mypltr; begin -- Bugs in Draw_Image_Color_Map_1_Automatic(): -- -at high magnifications, the left and right edge are ragged. Try -- ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5. -- Bugs in x20c.c: -- -if the window is resized after a selection is made on "lena", when -- making a new selection the old one will re-appear. -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; -- View image border pixels. if dbg /= 0 then Set_Environment(1.0, Long_Float(XDIM), 1.0, Long_Float(YDIM), 1, 1); -- no plot box -- Build a one pixel square border, for diagnostics. for i in z'range(1) loop z(i, YDIM - 1) := 1.0; -- right end loop; for i in z'range(1) loop z(i, 0) := 1.0; -- left end loop; for i in z'range(2) loop z(0, i) := 1.0; -- top end loop; for i in z'range(2) loop z(XDIM - 1, i) := 1.0; -- botton end loop; Write_Labels("...around a blue square."," ","A red border should appear..."); Draw_Image_Color_Map_1_Automatic(z, 1.0, Long_Float(XDIM), 1.0, Long_Float(YDIM), 0.0, 0.0, 1.0, Long_Float(XDIM), 1.0, Long_Float(YDIM)); end if; -- sombrero-like demo if nosombrero = 0 then Set_Pen_Color(Yellow); -- Draw a yellow plot box, useful for diagnostics! :( Set_Environment(0.0, 2.0 * pi, 0.0, 3.0 * pi, 1, -1); for i in x'range loop x(i) := Long_Float(i) * 2.0 * pi / Long_Float(XDIM - 1); end loop; for i in y'range loop y(i) := Long_Float(i) * 3.0 * pi / Long_Float(YDIM - 1); end loop; for i in z'range(1) loop for j in z'range(2) loop r(i, j) := sqrt(x(i) * x(i) + y(j) * y(j)) + 1.0e-3; z(i, j) := sin(r(i, j)) / (r(i, j)); end loop; end loop; Write_Labels("No, an amplitude clipped ""sombrero""", "", "Saturn?"); Write_Text_World(2.0, 2.0, 3.0, 4.0, 0.0, "Transparent image"); Draw_Image_Color_Map_1_Automatic(z, 0.0, 2.0 * pi, 0.0, 3.0 * pi, 0.05, 1.0, 0.0, 2.0 * pi, 0.0, 3.0 * pi); -- Save the plot. if Save_Sombrero then Put("Enter a path and name to save the Postscript file or RETURN to not save: "); Get_Line(f_name, f_name_length); if f_name'Length /= 0 then save_plot(f_name(1 .. f_name_length)); end if; end if; end if; -- Read the Lena image. -- Note we try two different locations to cover the case where this -- examples is being run from the test_c.sh script. begin read_img("./lena.pgm", img_f, width, height, num_col); exception when NAME_ERROR => null; begin read_img("../lena.pgm", img_f, width, height, num_col); exception when NAME_ERROR => Put_Line("Failed to open lena.pgm. Aborting."); End_PLplot; return; end; -- second exception block end; -- first exception block -- Set gray colormap. gray_cmap(num_col); -- Display Lena. Set_Environment(1.0, Long_Float(width), 1.0, Long_Float(height), Justified, Box); if nointeractive = 0 then Write_Labels("Set and drag Button 1 to (re)set selection, Button 2 to finish."," ","Lena..."); else Write_Labels(""," ","Lena..."); end if; Draw_Image_Color_Map_1_Automatic(img_f, 1.0, Long_Float(width), 1.0, Long_Float(height), 0.0, 0.0, 1.0, Long_Float(width), 1.0, Long_Float(height)); -- Selection/expansion demo if nointeractive = 0 then xi := 200.0; xe := 330.0; yi := 280.0; ye := 220.0; get_clip(xi, xe, yi, ye, Get_Clip_Return); -- get selection rectangle if Get_Clip_Return /= 0 then End_PLplot; end if; -- I'm unable to continue, clearing the plot and advancing to the next -- one, without hiting the enter key, or pressing the button... help! -- Forcing the xwin driver to leave locate mode and destroying the -- xhairs (in GetCursorCmd()) solves some problems, but I still have -- to press the enter key or press Button-2 to go to next plot, even -- if a Advance_To_Subpage() is not present! Using Begin_New_Page() solves the problem, but -- it shouldn't be needed! -- Begin_New_Page(); -- Set_Pause(0), Advance_To_Subpage(Next_Subpage), Set_Pause(1), also works, -- but the above question remains. -- With this approach, the previous pause state is lost, -- as there is no API call to get its current state. Set_Pause(False); Advance_To_Subpage(Next_Subpage); -- Display selection only. Draw_Image_Color_Map_1_Automatic(img_f, 1.0, Long_Float(width), 1.0, Long_Float(height), 0.0, 0.0, xi, xe, ye, yi); Set_Pause(True); -- Zoom in selection. Set_Environment(xi, xe, ye, yi, Justified, Box); Draw_Image_Color_Map_1_Automatic(img_f, 1.0, Long_Float(width), 1.0, Long_Float(height), 0.0, 0.0, xi, xe, ye, yi); end if; -- Base the dynamic range on the image contents. img_min := Matrix_Min(img_f); img_max := Matrix_Max(img_f); -- Draw a saturated version of the original image. Use only the middle 50% -- of the image's full dynamic range. Set_Pen_Color(Yellow); Set_Environment(0.0, Long_Float(width), 0.0, Long_Float(height), Justified, Box); Write_Labels("", "", "Reduced dynamic range image example"); Draw_Image_Color_Map_1(img_f, 0.0, Long_Float(width), 0.0, Long_Float(height), 0.0, 0.0, img_min + img_max * 0.25, img_max - img_max * 0.25, Null, System.Null_Address); -- Draw a distorted version of the original image, showing its full dynamic range. Set_Environment(0.0, Long_Float(width), 0.0, Long_Float(height), Justified, Box); Write_Labels("", "", "Distorted image example"); stretch.xmin := 0.0; stretch.xmax := Long_Float(width); stretch.ymin := 0.0; stretch.ymax := Long_Float(height); stretch.stretch := 0.5; -- In C / C++ the following would work, with Draw_Image_Color_Map_1 directly calling -- mypltr. For compatibilty with other language bindings the same effect -- can be achieved by generating the transformed grid first and then -- using Plot_Transformation_2. -- Draw_Image_Color_Map_1(img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, mypltr, (PLPointer) &stretch); declare -- Declare block is based on runtime-determined values of width, height. cgrid2 : aliased Transformation_Data_Type_2 (x_Last => width, y_Last => height); begin for i in 0 .. width loop for j in 0 .. height loop mypltr(Long_Float(i), Long_Float(j), xx, yy, stretch); cgrid2.xg(i, j) := xx; cgrid2.yg(i, j) := yy; end loop; end loop; Draw_Image_Color_Map_1(img_f, 0.0, Long_Float(width), 0.0, Long_Float(height), 0.0, 0.0, img_min, img_max, Plot_Transformation_2'access, cgrid2'Address); end; End_PLplot; end xthick20a; plplot-5.10.0+dfsg/examples/ada/xthick23a.adb 644 1750 1750 4015211543675237 176020ustar andrewandrew-- $Id: xthick23a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Displays Greek letters and mathematically interesting Unicode ranges. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded, Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick23a is Greek : array(0 .. 47) of String(1 .. 3) := ( "#gA","#gB","#gG","#gD","#gE","#gZ","#gY","#gH","#gI","#gK","#gL","#gM", "#gN","#gC","#gO","#gP","#gR","#gS","#gT","#gU","#gF","#gX","#gQ","#gW", "#ga","#gb","#gg","#gd","#ge","#gz","#gy","#gh","#gi","#gk","#gl","#gm", "#gn","#gc","#go","#gp","#gr","#gs","#gt","#gu","#gf","#gx","#gq","#gw"); Type1 : array (0 .. 165) of Integer := ( 16#0020#,16#0021#,16#0023#,16#0025#,16#0026#, 16#0028#,16#0029#,16#002b#,16#002c#,16#002e#, 16#002f#,16#0030#,16#0031#,16#0032#,16#0033#, 16#0034#,16#0035#,16#0036#,16#0037#,16#0038#, 16#0039#,16#003a#,16#003b#,16#003c#,16#003d#, 16#003e#,16#003f#,16#005b#,16#005d#,16#005f#, 16#007b#,16#007c#,16#007d#,16#00a9#,16#00ac#, 16#00ae#,16#00b0#,16#00b1#,16#00d7#,16#00f7#, 16#0192#,16#0391#,16#0392#,16#0393#,16#0394#, 16#0395#,16#0396#,16#0397#,16#0398#,16#0399#, 16#039a#,16#039b#,16#039c#,16#039d#,16#039e#, 16#039f#,16#03a0#,16#03a1#,16#03a3#,16#03a4#, 16#03a5#,16#03a6#,16#03a7#,16#03a8#,16#03a9#, 16#03b1#,16#03b2#,16#03b3#,16#03b4#,16#03b5#, 16#03b6#,16#03b7#,16#03b8#,16#03b9#,16#03ba#, 16#03bb#,16#03bc#,16#03bd#,16#03be#,16#03bf#, 16#03c0#,16#03c1#,16#03c2#,16#03c3#,16#03c4#, 16#03c5#,16#03c6#,16#03c7#,16#03c8#,16#03c9#, 16#03d1#,16#03d2#,16#03d5#,16#03d6#,16#2022#, 16#2026#,16#2032#,16#2033#,16#203e#,16#2044#, 16#2111#,16#2118#,16#211c#,16#2122#,16#2126#, 16#2135#,16#2190#,16#2191#,16#2192#,16#2193#, 16#2194#,16#21b5#,16#21d0#,16#21d1#,16#21d2#, 16#21d3#,16#21d4#,16#2200#,16#2202#,16#2203#, 16#2205#,16#2206#,16#2207#,16#2208#,16#2209#, 16#220b#,16#220f#,16#2211#,16#2212#,16#2215#, 16#2217#,16#221a#,16#221d#,16#221e#,16#2220#, 16#2227#,16#2228#,16#2229#,16#222a#,16#222b#, 16#2234#,16#223c#,16#2245#,16#2248#,16#2260#, 16#2261#,16#2264#,16#2265#,16#2282#,16#2283#, 16#2284#,16#2286#,16#2287#,16#2295#,16#2297#, 16#22a5#,16#22c5#,16#2320#,16#2321#,16#2329#, 16#232a#,16#25ca#,16#2660#,16#2663#,16#2665#, 16#2666#); function title(which : Integer) return String is begin if which = 0 then return "#<0x10>PLplot Example 23 - Greek Letters"; end if; if which = 1 then return "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)"; end if; if which = 2 then return "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)"; end if; if which = 3 then return "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)"; end if; if which = 4 then return "#<0x10>PLplot Example 23 - Number Forms Unicode Block"; end if; if which = 5 then return "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)"; end if; if which = 6 then return "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)"; end if; if which = 7 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)"; end if; if which = 8 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)"; end if; if which = 9 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)"; end if; if which = 10 then return "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"; end if; return "oops"; end title; lo : array (0 .. 10) of Integer := ( 16#0#, 16#0#, 16#40#, 16#80#, 16#2153#, 16#2190#, 16#21d0#, 16#2200#, 16#2240#, 16#2280#, 16#22c0# ); hi : array (0 .. 10) of Integer := ( 16#30#, 16#40#, 16#80#, 16#A6#, 16#2184#, 16#21d0#, 16#2200#, 16#2240#, 16#2280#, 16#22c0#, 16#2300# ); nxcells : array (0 .. 10) of Integer := ( 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ); nycells : array (0 .. 10) of Integer := ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ); -- non-zero values must be consistent with nxcells and nycells. offset : array (0 .. 10) of Integer := ( 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0 ); -- 30 possible FCI values. FCI_COMBINATIONS : constant integer := 30; fci : array (0 .. 29) of Unicode := ( 16#80000000#, 16#80000001#, 16#80000002#, 16#80000003#, 16#80000004#, 16#80000010#, 16#80000011#, 16#80000012#, 16#80000013#, 16#80000014#, 16#80000020#, 16#80000021#, 16#80000022#, 16#80000023#, 16#80000024#, 16#80000100#, 16#80000101#, 16#80000102#, 16#80000103#, 16#80000104#, 16#80000110#, 16#80000111#, 16#80000112#, 16#80000113#, 16#80000114#, 16#80000120#, 16#80000121#, 16#80000122#, 16#80000123#, 16#80000124# ); function family(which : Integer) return String is begin if which = 0 then return "sans-serif"; end if; if which = 1 then return "serif"; end if; if which = 2 then return "monospace"; end if; if which = 3 then return "script"; end if; if which = 4 then return "symbol"; end if; return "oops"; end family; function style(which : Integer) return String is begin if which = 0 then return "upright"; end if; if which = 1 then return "italic"; end if; if which = 2 then return "oblique"; end if; return "oops"; end style; function weight(which : Integer) return String is begin if which = 0 then return "medium"; end if; if which = 1 then return "bold"; end if; return "oops"; end weight; xmin, xmax, ymin, ymax, ycharacter_scale, yoffset : Long_Float; chardef, charht, deltax, deltay, x, y : Long_Float; length, slice : Integer; cmdString : Unbounded_String; fci_old : Unicode; ifamily, istyle, iweight : Integer; dy : Long_Float := 0.030; family_index, style_index, weight_index : Integer; -- Must be big enough to contain the prefix strings, the font-changing -- commands, and the "The quick brown..." string. a_string : Unbounded_String; package Unicode_IO is new Ada.Text_IO.Modular_IO(Unicode); -- fix this probably not used use Unicode_IO; -- Make a four-character hexadecimal string image of integers. -- Useful for font manipulations. -- To_Lower is used to make C-like output for A..F -- so that the PostScript files generated by C and Ada are identical. -- Integer values greater than 65535 (2^16-1) are treated modulo 2^16. -- Based on Stephen Leake's SAL.Generic_Hex_Image. -- Original: Copyright (C) 2005 Stephen Leake. All Rights Reserved, and -- offered under GNU General Public License version 2 or later. function Hex_Image_4 (Item : in Integer) return String is Temp : Integer := Item; Nibble : Integer; Image : String (1 .. 4); begin for I in reverse Image'Range loop Nibble := Temp mod 16; Temp := Temp / 16; if Nibble > 9 then Image (I) := Character'Val (Character'Pos ('A') + Nibble - 10); else Image (I) := Character'Val (Character'Pos ('0') + Nibble); end if; end loop; Image := Ada.Characters.Handling.To_Lower(Image); return Image; end Hex_Image_4; -- Make a eight-character hexadecimal string image of Unicode. function Hex_Image_8 (Item : in Unicode) return String is -- Long_Long_Integer so don't overflow Integer Temp : Long_Long_Integer := Long_Long_Integer(Item); Nibble : Long_Long_Integer; Image : String (1 .. 8); begin for I in reverse Image'Range loop Nibble := Temp mod 16; Temp := Temp / 16; if Nibble > 9 then Image (I) := Character'Val(Character'Pos ('A') + Nibble - 10); else Image (I) := Character'Val(Character'Pos ('0') + Nibble); end if; end loop; Image := Ada.Characters.Handling.To_Lower(Image); return Image; end Hex_Image_8; begin Parse_Command_Line_Arguments(Parse_Full); Initialize_PLplot; for page in 0 .. 10 loop Advance_To_Subpage(Next_Subpage); -- Set up viewport and window Set_Viewport_Normalized(0.02, 0.98, 0.02, 0.90); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Get_Subpage_Boundaries(xmin, xmax, ymin, ymax); Set_Character_Height(0.0, 0.8); ycharacter_scale := (1.0 - 0.0) / (ymax - ymin); -- Factor should be 0.5, but heuristically it turns out to be larger. Get_Character_Height(chardef, charht); yoffset := 1.0 * charht * ycharacter_scale; -- Draw the grid using Box_Around_Viewport Set_Pen_Color(Yellow); deltax := 1.0 / Long_Float(nxcells(page)); deltay := 1.0 / Long_Float(nycells(page)); Box_Around_Viewport("bcg", deltax, 0, "bcg", deltay, 0); Set_Pen_Color(White); length := hi(page) - lo(page); slice := 0; for j in reverse -1 .. nycells(page) - 1 loop y := (0.5 + Long_Float(j)) * deltay; for i in 0 .. nxcells(page) - 1 loop x := (0.5 + Long_Float(i)) * deltax; if slice < length then if page = 0 then cmdString := To_Unbounded_String(Greek(slice)); elsif page >= 1 and page <= 3 then cmdString := To_Unbounded_String("#[0x" & Hex_Image_4(Type1(offset(page)+slice)) & "]"); elsif page >= 4 then cmdString := To_Unbounded_String("#[0x" & Hex_Image_4(lo(page)+slice) & "]"); end if; Write_Text_World(x, y + yoffset, 1.0, 0.0, 0.5, To_String(cmdString)); Write_Text_World(x, y - yoffset, 1.0, 0.0, 0.5, "#" & To_String(cmdString)); end if; slice := slice + 1; end loop; -- i end loop; -- j Set_Character_Height(0.0, 1.0); -- Page title Write_Text_Viewport("t", 1.5, 0.5, 0.5, title(page)); end loop; --page -- Demonstrate methods of getting the current fonts Get_Font_Characterization_Integer(fci_old); Get_Font(ifamily, istyle, iweight); Put("For example 23 prior to page 12 the FCI is "); -- The following hack in outputting the hexadecimal value of fci_old in "C" -- style, e.g. 0x00000000 instead of "Ada" style 16#00000000#, is done in -- order to create the same textual output as the C example x23c. -- Put(fci_old, Base => 16, Width => 0); -- Outputs "Ada" style. Put("0x" & Hex_Image_8(fci_old)); -- Outputs "C" style. New_Line; Put("For example 23 prior to page 12 the font family, style and weight are " & family(ifamily) & " " & style(istyle) & " " & weight(iweight)); New_Line; for page in 11 .. 15 loop Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.02, 0.98, 0.02, 0.90); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Set_Font_Characterization_Integer(0); if page = 11 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with plsfci"); elsif page = 12 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with plsfont"); elsif page = 13 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with ##<0x8nnnnnnn> construct"); elsif page = 14 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with ##<0xmn> constructs"); elsif page = 15 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " & "Set Font with ## constructs"); end if; Set_Character_Height(0.0, 0.75); for i in 0 .. FCI_COMBINATIONS - 1 loop family_index := i mod 5; style_index := (i / 5) mod 3; weight_index := ((i / 5) / 3) mod 2; if page = 11 then Set_Font_Characterization_Integer(fci(i)); a_string := To_Unbounded_String( "Page 12, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "The quick brown fox jumps over the lazy dog"); elsif page = 12 then Set_Font(family_index, style_index, weight_index); a_string := To_Unbounded_String( "Page 13, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "The quick brown fox jumps over the lazy dog"); elsif page = 13 then a_string := To_Unbounded_String( "Page 14, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "#<0x" & Hex_Image_8(fci(i)) & ">" & "The quick brown fox jumps over the lazy dog"); elsif page = 14 then a_string := To_Unbounded_String( "Page 15, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "#<0x" & Trim(Integer'Image(family_index), Left) & "0>#<0x" & Trim(Integer'Image(style_index), Left) & "1>#<0x" & Trim(Integer'Image(weight_index), Left) & "2>" & "The quick brown fox jumps over the lazy dog"); elsif page = 15 then a_string := To_Unbounded_String( "Page 16, " & family(family_index) & ", " & style (style_index) & ", " & weight(weight_index) & ": " & "#<" & family(family_index) & "/>#<" & style (style_index) & "/>#<" & weight(weight_index) & "/>" & "The quick brown fox jumps over the lazy dog"); end if; Write_Text_World (0.0, 1.0 - (Long_Float(i) + 0.5) * dy, 1.0, 0.0, 0.0, To_String(a_string)); end loop; -- i Set_Character_Height(0.0, 1.0); end loop; -- page -- Restore defaults Set_Pen_Color(Red); End_PLplot; end xthick23a; plplot-5.10.0+dfsg/examples/ada/x25a.adb 644 1750 1750 1246711543675237 165710ustar andrewandrew-- $Id: x25a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Filling and clipping polygons. -- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with PLplot_Auxiliary, PLplot_Traditional; use PLplot_Auxiliary, PLplot_Traditional; -- Test program for filling polygons and proper clipping procedure x25a is npts : Integer := 0; xextreme, yextreme : Real_Matrix(0 .. 8, 0 .. 1); x0, y0 : Real_Vector(0 .. 9); begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plssub(3,3); plinit; xextreme(0, 0) := -120.0; xextreme(0, 1) := 120.0; yextreme(0, 0) := -120.0; yextreme(0, 1) := 120.0; xextreme(1, 0) := -120.0; xextreme(1, 1) := 120.0; yextreme(1, 0) := 20.0; yextreme(1, 1) := 120.0; xextreme(2, 0) := -120.0; xextreme(2, 1) := 120.0; yextreme(2, 0) := -20.0; yextreme(2, 1) := 120.0; xextreme(3, 0) := -80.0; xextreme(3, 1) := 80.0; yextreme(3, 0) := -20.0; yextreme(3, 1) := 120.0; xextreme(4, 0) := -220.0; xextreme(4, 1) := -120.0; yextreme(4, 0) := -120.0; yextreme(4, 1) := 120.0; xextreme(5, 0) := -20.0; xextreme(5, 1) := 20.0; yextreme(5, 0) := -120.0; yextreme(5, 1) := 120.0; xextreme(6, 0) := -20.0; xextreme(6, 1) := 20.0; yextreme(6, 0) := -20.0; yextreme(6, 1) := 20.0; xextreme(7, 0) := -80.0; xextreme(7, 1) := 80.0; yextreme(7, 0) := -80.0; yextreme(7, 1) := 80.0; xextreme(8, 0) := 20.0; xextreme(8, 1) := 120.0; yextreme(8, 0) := -120.0; yextreme(8, 1) := 120.0; for k in 0 .. 1 loop for j in 0 .. 3 loop if j = 0 then -- Polygon 1: a diamond x0(0) := 0.0; y0(0) := -100.0; x0(1) := -100.0; y0(1) := 0.0; x0(2) := 0.0; y0(2) := 100.0; x0(3) := 100.0; y0(3) := 0.0; npts := 4; end if; if j = 1 then -- Polygon 1: a diamond - reverse direction x0(3) := 0.0; y0(3) := -100.0; x0(2) := -100.0; y0(2) := 0.0; x0(1) := 0.0; y0(1) := 100.0; x0(0) := 100.0; y0(0) := 0.0; npts := 4; end if; if j = 2 then -- Polygon 2: a square with punctures x0(0) := -100.0; y0(0) := -100.0; x0(1) := -100.0; y0(1) := -80.0; x0(2) := 80.0; y0(2) := 0.0; x0(3) := -100.0; y0(3) := 80.0; x0(4) := -100.0; y0(4) := 100.0; x0(5) := -80.0; y0(5) := 100.0; x0(6) := 0.0; y0(6) := 80.0; x0(7) := 80.0; y0(7) := 100.0; x0(8) := 100.0; y0(8) := 100.0; x0(9) := 100.0; y0(9) := -100.0; npts := 10; end if; if j = 3 then -- Polygon 2: a square with punctures - reversed direction x0(9) := -100.0; y0(9) := -100.0; x0(8) := -100.0; y0(8) := -80.0; x0(7) := 80.0; y0(7) := 0.0; x0(6) := -100.0; y0(6) := 80.0; x0(5) := -100.0; y0(5) := 100.0; x0(4) := -80.0; y0(4) := 100.0; x0(3) := 0.0; y0(3) := 80.0; x0(2) := 80.0; y0(2) := 100.0; x0(1) := 100.0; y0(1) := 100.0; x0(0) := 100.0; y0(0) := -100.0; npts := 10; end if; for i in xextreme'range(1) loop pladv(0); plvsta; plwind(xextreme(i, 0), xextreme(i, 1), yextreme(i, 0), yextreme(i, 1)); declare x0_Stop_Sucking, y0_Stop_Sucking : Real_Vector(0 .. npts - 1); begin x0_Stop_Sucking := x0(0 .. npts - 1); y0_Stop_Sucking := y0(0 .. npts - 1); plcol0(2); plbox("bc", 1.0, 0, "bcnv", 10.0, 0); plcol0(1); plpsty(0); -- Solid fill or gradient fill if k = 0 then plfill(x0_Stop_Sucking, y0_Stop_Sucking); else plgradient(x0_Stop_Sucking, y0_Stop_Sucking, 45.0); end if; plcol0(2); pllsty(1); plline(x0_Stop_Sucking, y0_Stop_Sucking); end; end loop; -- i end loop; -- j end loop; --k -- Don't forget to call plend to finish off! plend; end x25a; plplot-5.10.0+dfsg/examples/ada/x00_easy_a.adb 644 1750 1750 330111653727550 177030ustar andrewandrew-- $Id: x00_easy_a.adb 12021 2011-11-01 08:35:52Z jbauck $ -- -- Simple demo of a 2D line plot. -- -- Copyright (C) 2011 Jerry Bauck -- -- This file is part of PLplot. -- -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- This program uses Ada-specific extensions to PLplot to create similar -- results as x00a.adb and xthick00a.adb but with less effort. with PLplot_Auxiliary, PLplot; use PLplot_Auxiliary, PLplot; procedure x00_easy_a is x, y : Real_Vector(0 .. 100); x_Min, y_Min : Long_Float := 0.0; x_Max : Long_Float := 1.0; y_Max : Long_Float := 100.0; begin -- Prepare data to be plotted. for i in x'range loop x(i) := Long_Float(i) / Long_Float(x'length - 1); y(i) := y_Max * x(i)**2; end loop; -- -- Initialize plplot. Initialize_PLplot; -- Make the plot. Simple_Plot(x, y, X_Label => "x", Y_Label => "y=100 x#u2#d", Title_Label => "Simple PLplot demo of a 2D line plot"); -- Close PLplot library. End_PLplot; end x00_easy_a;plplot-5.10.0+dfsg/examples/ada/Makefile.examples.in 644 1750 1750 550412136046577 211740ustar andrewandrew# examples/ada/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2002, 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA GNAT_EXECUTABLE_BUILDER = @GNAT_EXECUTABLE_BUILDER@ \ -aI@ADA_INCLUDE_DIR@ -aL@ADA_LIB_DIR@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ RPATHCMD = @RPATHCMD@ EXECUTABLES_list = \ x00a$(EXEEXT) \ x01a$(EXEEXT) \ x02a$(EXEEXT) \ x03a$(EXEEXT) \ x04a$(EXEEXT) \ x05a$(EXEEXT) \ x06a$(EXEEXT) \ x07a$(EXEEXT) \ x08a$(EXEEXT) \ x09a$(EXEEXT) \ x10a$(EXEEXT) \ x11a$(EXEEXT) \ x12a$(EXEEXT) \ x13a$(EXEEXT) \ x14a$(EXEEXT) \ x15a$(EXEEXT) \ x16a$(EXEEXT) \ x17a$(EXEEXT) \ x18a$(EXEEXT) \ x19a$(EXEEXT) \ x20a$(EXEEXT) \ x21a$(EXEEXT) \ x22a$(EXEEXT) \ x23a$(EXEEXT) \ x24a$(EXEEXT) \ x25a$(EXEEXT) \ x26a$(EXEEXT) \ x27a$(EXEEXT) \ x28a$(EXEEXT) \ x29a$(EXEEXT) \ x30a$(EXEEXT) \ x31a$(EXEEXT) \ x33a$(EXEEXT) \ xthick00a$(EXEEXT) \ xthick01a$(EXEEXT) \ xthick02a$(EXEEXT) \ xthick03a$(EXEEXT) \ xthick04a$(EXEEXT) \ xthick05a$(EXEEXT) \ xthick06a$(EXEEXT) \ xthick07a$(EXEEXT) \ xthick08a$(EXEEXT) \ xthick09a$(EXEEXT) \ xthick10a$(EXEEXT) \ xthick11a$(EXEEXT) \ xthick12a$(EXEEXT) \ xthick13a$(EXEEXT) \ xthick14a$(EXEEXT) \ xthick15a$(EXEEXT) \ xthick16a$(EXEEXT) \ xthick17a$(EXEEXT) \ xthick18a$(EXEEXT) \ xthick19a$(EXEEXT) \ xthick20a$(EXEEXT) \ xthick21a$(EXEEXT) \ xthick22a$(EXEEXT) \ xthick23a$(EXEEXT) \ xthick24a$(EXEEXT) \ xthick25a$(EXEEXT) \ xthick26a$(EXEEXT) \ xthick27a$(EXEEXT) \ xthick28a$(EXEEXT) \ xthick29a$(EXEEXT) \ xthick30a$(EXEEXT) \ xthick31a$(EXEEXT) \ xthick33a$(EXEEXT) all: $(EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) *.ali *.o # Due to command-line limitations of gnatmake cannot continue (by trailing \) # anything after -cargs below. .adb$(EXEEXT): $(GNAT_EXECUTABLE_BUILDER) $< \ -cargs `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags plplot$(LIB_TAG)-ada` -largs $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --libs plplot$(LIB_TAG)-ada` .SUFFIXES: .adb $(EXEEXT) plplot-5.10.0+dfsg/examples/ada/x03a.adb 644 1750 1750 612411543675237 165360ustar andrewandrew-- $Id: x03a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Polar plot demo. -- Generates polar plot, with 1-1 scaling. -- Copyright (C) 2007 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; procedure x03a is dtr, theta, dx, dy, r, offset : Long_Float; x0, y0 : Real_Vector(0..360); x, y : Real_Vector(0..360); begin dtr := pi / 180.0; for i in x0'range loop x0(i) := cos(dtr * Long_Float(i)); y0(i) := sin(dtr * Long_Float(i)); end loop; -- Parse and process command line arguments. plparseopts(PL_PARSE_FULL); -- Set orientation to portrait. Note not all device drivers -- support this, in particular most interactive drivers do not. plsori(Portrait); -- Initialize plplot plinit; -- Set up viewport and window, but do not draw box. plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); -- Draw circles for polar grid. for i in 1 .. 10 loop plarc(0.0, 0.0, 0.1 * Long_Float(i), 0.1 * Long_Float(i), 0.0, 360.0, 0.0, False); end loop; plcol0(2); for i in 0..11 loop theta := 30.0 * Long_Float(i); dx := cos(dtr * theta); dy := sin(dtr * theta); -- Draw radial spokes for polar grid. pljoin(0.0, 0.0, dx, dy); -- Write labels for angle. if theta < 9.99 then offset := 0.45; elsif theta < 99.9 then offset := 0.30; else offset := 0.15; end if; -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg if dx >= -0.00001 then plptex(dx, dy, dx, dy, -offset, Trim(Integer'image(Integer(theta)), Left)); else plptex(dx, dy, -dx, -dy, 1.0 + offset, Trim(Integer'image(Integer(theta)), Left)); end if; end loop; -- Draw the graph. for i in x'range loop r := sin(dtr * Long_Float(5 * i)); x(i) := x0(i) * r; y(i) := y0(i) * r; end loop; plcol0(3); plline(x, y); plcol0(4); plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); -- Close the plot at end. plend; end x03a; plplot-5.10.0+dfsg/examples/ada/x09a.adb 644 1750 1750 3056111543675237 165660ustar andrewandrew-- $Id: x09a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Contour plot demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, System, PLplot_Traditional, PLplot_Auxiliary; -------------------------------------------------------------------------- -- Does several contour plots using different coordinate mappings. -------------------------------------------------------------------------- procedure x09a is XPTS : Integer := 35; -- Number of data points in x YPTS : Integer := 46; -- Number of data points in y -- polar plot data PERIMETERPTS : Integer := 100; RPTS : Integer := 40; THETAPTS : Integer := 40; -- potential plot data PPERIMETERPTS : Integer := 100; PRPTS : Integer := 40; PTHETAPTS : Integer := 64; PNLEVEL : Integer := 20; xx, yy, argx, argy, distort : Long_Float; mark : Integer_Array_1D(1 .. 1); space : Integer_Array_1D(1 .. 1); zgdummy : Real_Vector(0 .. 0); -- not used z, w : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); clevel : Real_Vector(0 .. 10) := (-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0); cgrid1 : aliased Transformation_Data_Type (x_Last => XPTS - 1, y_Last => YPTS - 1, z_Last => 0); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => XPTS - 1, y_Last => YPTS - 1); -- Quick and dirty function for converting from C. Apparently C lacks an -- exponentiation operator. -- Don't have a cow over the abs(a) in pow because all calls to pow() in -- this example have an exponent of 2.0, i.e., squaring. Without the abs() -- Ada raises an exception. (Why doesn't C?) function pow(a, b : Long_Float) return Long_Float is aa : Long_Float; begin aa := abs(a); return aa ** b; end pow; procedure mypltr -- This spec is necessary to accommodate pragma Convention(). (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer); pragma Convention(Convention => C, Entity => mypltr); procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer) is -- Transformation function XSPA : Long_Float := 2.0 / Long_Float(XPTS - 1); YSPA : Long_Float := 2.0 / Long_Float(YPTS - 1); tr : Real_Vector(0 .. 5) := (XSPA, 0.0, -1.0, 0.0, YSPA, -1.0); begin -- mypltr tx := tr(0) * x + tr(1) * y + tr(2); ty := tr(3) * x + tr(4) * y + tr(5); end mypltr; -- Polar contour plot example procedure polar is t, r, theta : Long_Float; px, py : Real_Vector(0 .. PERIMETERPTS - 1); lev : Real_Vector(0 .. 9); z : Real_Matrix(0 .. RPTS - 1, 0 .. THETAPTS - 1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => RPTS - 1, y_Last => THETAPTS - 1); begin -- polar plenv(-1.0, 1.0, -1.0, 1.0, 0, -2); plcol0(1); -- Perimeter for i in 0 .. PERIMETERPTS - 1 loop t := (2.0 * pi / Long_Float(PERIMETERPTS - 1)) * Long_Float(i); px(i) := cos(t); py(i) := sin(t); end loop; plline(px, py); for i in 0 .. RPTS - 1 loop r := Long_Float(i) / Long_Float(RPTS - 1); for j in 0 .. THETAPTS - 1 loop theta := (2.0 * pi / Long_Float(THETAPTS - 1)) * Long_Float(j); cgrid2.xg(i, j) := r * cos(theta); cgrid2.yg(i, j) := r * sin(theta); z(i, j) := r; end loop; end loop; for i in lev'range loop lev(i) := 0.05 + 0.10 * Long_Float(i); end loop; plcol0(2); plcont(z, 1, RPTS, 1, THETAPTS, lev, pltr2'access, cgrid2'Address); plcol0(1); pllab("", "", "Polar Contour Plot"); end polar; -- Shielded potential contour plot example procedure potential is nlevelneg, nlevelpos : Integer; ncollin, ncolbox, ncollab : Integer; rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax : Long_Float; peps, xpmin, xpmax, ypmin, ypmax : Long_Float; eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i : Long_Float; div1, div1i, div2, div2i : Long_Float; t, r, theta : Long_Float; dz, clevel : Long_Float; clevelneg : Real_Vector(0 .. 9); -- Compare with x09c.c which clevelpos : Real_Vector(0 .. 9); -- over-allocates these arrays. px, py : Real_Vector(0 .. PPERIMETERPTS - 1); z : Real_Matrix(0 .. PRPTS - 1, 0 .. PTHETAPTS - 1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => PRPTS - 1, y_Last => PTHETAPTS - 1); begin -- potential -- Create data to be contoured. for i in 0 .. PRPTS - 1 loop r := 0.5 + Long_Float(i); for j in 0 .. PTHETAPTS - 1 loop theta := (2.0 * pi / Long_Float(PTHETAPTS - 1)) * (0.5 + Long_Float(j)); cgrid2.xg(i, j) := r * cos(theta); cgrid2.yg(i, j) := r * sin(theta); end loop; end loop; rmax := r; xmin := Matrix_Min(cgrid2.xg); xmax := Matrix_Max(cgrid2.xg); ymin := Matrix_Min(cgrid2.yg); ymax := Matrix_Max(cgrid2.yg); x0 := (xmin + xmax) / 2.0; y0 := (ymin + ymax) / 2.0; -- Expanded limits peps := 0.05; xpmin := xmin - abs(xmin) * peps; xpmax := xmax + abs(xmax) * peps; ypmin := ymin - abs(ymin) * peps; ypmax := ymax + abs(ymax) * peps; -- Potential inside a conducting cylinder (or sphere) by method of images -- Charge 1 is placed at (d1, d1), with image charge at (d2, d2). -- Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). -- Also put in smoothing term at small distances. eps := 2.0; q1 := 1.0; d1 := rmax / 4.0; q1i := -q1 * rmax / d1; d1i := rmax * rmax / d1; q2 := -1.0; d2 := rmax / 4.0; q2i := -q2 * rmax / d2; d2i := rmax * rmax / d2; for i in 0 .. PRPTS - 1 loop for j in 0 .. PTHETAPTS - 1 loop div1 := sqrt(pow(cgrid2.xg(i, j)-d1, 2.0) + pow(cgrid2.yg(i, j)-d1, 2.0) + pow(eps, 2.0)); div1i := sqrt(pow(cgrid2.xg(i, j)-d1i, 2.0) + pow(cgrid2.yg(i, j)-d1i, 2.0) + pow(eps, 2.0)); div2 := sqrt(pow(cgrid2.xg(i, j)-d2, 2.0) + pow(cgrid2.yg(i, j)+d2, 2.0) + pow(eps, 2.0)); div2i := sqrt(pow(cgrid2.xg(i, j)-d2i, 2.0) + pow(cgrid2.yg(i, j)+d2i, 2.0) + pow(eps, 2.0)); z(i, j) := q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_Max(z); -- Positive and negative contour levels. dz := (zmax - zmin) / Long_Float(PNLEVEL); nlevelneg := 0; nlevelpos := 0; for i in 0 .. PNLEVEL - 1 loop clevel := zmin + (Long_Float(i) + 0.5) * dz; if clevel <= 0.0 then clevelneg(nlevelneg) := clevel; nlevelneg := nlevelneg + 1; else clevelpos(nlevelpos) := clevel; nlevelpos := nlevelpos + 1; end if; end loop; -- Colours! ncollin := 11; ncolbox := 1; ncollab := 2; -- Finally start plotting this page! pladv(0); plcol0(ncolbox); plvpas(0.1, 0.9, 0.1, 0.9, 1.0); plwind(xpmin, xpmax, ypmin, ypmax); plbox("", 0.0, 0, "", 0.0, 0); plcol0(ncollin); if nlevelneg >0 then -- Negative contours pllsty(2); plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelneg, pltr2'access, cgrid2'Address); end if; if nlevelpos > 0 then -- Positive contours pllsty(1); plcont(z, 1, PRPTS, 1, PTHETAPTS, clevelpos, pltr2'access, cgrid2'Address); end if; -- Draw outer boundary for i in 0 .. PPERIMETERPTS - 1 loop t := (2.0 * pi / Long_Float(PPERIMETERPTS - 1)) * Long_Float(i); px(i) := x0 + rmax * cos(t); py(i) := y0 + rmax * sin(t); end loop; plcol0(ncolbox); plline(px, py); plcol0(ncollab); pllab("", "", "Shielded potential of charges in a conducting sphere"); end potential; begin -- main -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; -- Take care of limitation on singleton positional aggregates. mark(1) := 1500; space(1) := 1500; zgdummy(0) := 0.0; for i in 0 .. XPTS - 1 loop xx := Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); for j in 0 .. YPTS - 1 loop yy := Long_Float(j - YPTS / 2) / Long_Float(YPTS / 2) - 1.0; z(i, j) := xx * xx - yy * yy; w(i, j) := 2.0 * xx * yy; end loop; end loop; -- Set up grids cgrid1.zg := zgdummy; -- dummy; not used for i in 0 .. XPTS - 1 loop for j in 0 .. YPTS - 1 loop mypltr(Long_Float(i), Long_Float(j), xx, yy, System.Null_Address); --here argx := xx * pi / 2.0; argy := yy * pi / 2.0; distort := 0.4; cgrid1.xg(i) := xx + distort * cos(argx); cgrid1.yg(j) := yy - distort * cos(argy); cgrid2.xg(i, j) := xx + distort * cos(argx) * cos(argy); cgrid2.yg(i, j) := yy - distort * cos(argx) * cos(argy); end loop; end loop; -- The following use of Unrestricted_Access works but is GNAT-specific. -- I don't know how else to solve the problem of having a user-specified -- function that is passed through five or so levels of C as a callback -- while also not requiring the user to modify the source for plplot_thin.adb -- which is where the type for the "pltr" subprograms is declared. Even if -- I move that type declaration into the thick bindings, the problem remains. pl_setcontlabelformat(4,3); pl_setcontlabelparam(0.006, 0.3, 0.1, True); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); plstyl(mark, space); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); plstyl(0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); -- Plot using 1d coordinate transform pl_setcontlabelparam(0.006, 0.3, 0.1, False); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, pltr1'access, cgrid1'Address); plstyl(mark, space); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, pltr1'access, cgrid1'Address); plstyl(0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); -- Plot using 2d coordinate transform plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, pltr2'access, cgrid2'Address); plstyl(mark, space); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, pltr2'access, cgrid2'Address); plstyl(0); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); -- Make polar plot. pl_setcontlabelparam(0.006, 0.3, 0.1, False); polar; -- Make potential plot. pl_setcontlabelparam(0.006, 0.3, 0.1, False); potential; plend; end x09a; plplot-5.10.0+dfsg/examples/ada/x29a.adb 644 1750 1750 3141511543675237 165670ustar andrewandrew-- $Id: x29a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Sample plots using date / time formatting for axes -- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; -------------------------------------------------------------------------------- -- Draws several plots which demonstrate the use of date / time formats for -- the axis labels. -- Time formatting is done using the strfqsas routine from the qsastime -- library. This is similar to strftime, but works for a broad -- date range even on 32-bit systems. See the -- documentation of strfqsas for full details of the available formats. -- -- 1) Plotting temperature over a day (using hours / minutes) -- 2) Plotting -- -- Note: We currently use the default call for plconfigtime (done in -- plinit) which means continuous times are interpreted as seconds since -- 1970-01-01, but that may change in future, more extended versions of -- this example. -------------------------------------------------------------------------------- -- NOTE: The Ada user is reminded that Ada.Calendar is very capable and complete. -- See especially Time_Of. procedure x29a is -- Plot a model diurnal cycle of temperature procedure plot1 is x, y : Real_Vector(0 .. 72); xerr1, xerr2, yerr1, yerr2 : Real_Vector(0 .. 72); -- Data points every 10 minutes for 1 day xmin, xmax, ymin, ymax : Long_Float; begin xmin := 0.0; xmax := 60.0 * 60.0 * 24.0; -- Number of seconds in a day ymin := 10.0; ymax := 20.0; for i in x'range loop x(i) := xmax * Long_Float(i) / Long_Float(x'length); y(i) := 15.0 - 5.0 * cos( 2.0 * pi * Long_Float(i) / Long_Float(x'length)); -- Set x error bars to +/- 5 minute xerr1(i) := x(i) - Long_Float(60 * 5); xerr2(i) := x(i) + Long_Float(60 * 5); -- Set y error bars to +/- 0.1 deg C */ yerr1(i) := y(i) - 0.1; yerr2(i) := y(i) + 0.1; end loop; pladv(0); -- Rescale major ticks marks by 0.5 plsmaj(0.0, 0.5); -- Rescale minor ticks and error bar marks by 0.5 plsmin(0.0, 0.5); plvsta; plwind(xmin, xmax, ymin, ymax); -- Draw a box with ticks spaced every 3 hours in X and 1 degree C in Y. plcol0(1); -- Set time format to be hours:minutes pltimefmt("%H:%M"); plbox("bcnstd", 3.0 * 60.0 * 60.0, 3, "bcnstv", 1.0, 5); plcol0(3); pllab("Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature"); plcol0(4); plline(x, y); plcol0(2); plerrx(xerr1, xerr2, y); plcol0(3); plerry(x, yerr1, yerr2); -- Rescale major / minor tick marks back to default plsmin(0.0, 1.0); plsmaj(0.0, 1.0); end plot1; -- Plot the number of hours of daylight as a function of day for a year procedure plot2 is xmin, xmax, ymin, ymax : Long_Float; lat, p, d : Long_Float; x, y : Real_Vector(0 .. 364); begin -- Latitude for London lat := 51.5; xmin := 0.0; xmax := Long_Float(x'length) * 60.0 * 60.0 * 24.0; ymin := 0.0; ymax := 24.0; -- Formula for hours of daylight from -- "A Model Comparison for Daylength as a Function of Latitude and -- Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for j in x'range loop x(j):= Long_Float(j) * 60.0 * 60.0 * 24.0; p := arcsin(0.39795 * cos(0.2163108 + 2.0 * arctan(0.9671396 * tan(0.00860 * Long_Float(j-186))))); d := 24.0 - (24.0 / pi) * arccos((sin(0.8333 * pi / 180.0) + sin(lat * pi / 180.0) * sin(p)) / (cos(lat * pi / 180.0) * cos(p))); y(j):= d; end loop; plcol0(1); -- Set time format to be abbreviated month name followed by day of month pltimefmt("%b %d"); plprec(True, 1); plenv(xmin, xmax, ymin, ymax, 0, 40); plcol0(3); pllab("Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N"); plcol0(4); plline(x, y); plprec(False, 0); end plot2; procedure plot3 is xmin, xmax, ymin, ymax, tstart : Long_Float; x, y : Real_Vector(0 .. 61); begin -- Calculate continuous time corresponding to 2005-12-01 UTC. plctime(2005, 11, 01, 0, 0, 0.0, tstart); xmin := tstart; xmax := xmin + Long_Float(x'length) * 60.0 * 60.0 * 24.0; ymin := 0.0; ymax := 5.0; for i in x'range loop x(i) := xmin + Long_Float(i) * 60.0 * 60.0 * 24.0; y(i) := 1.0 + sin(2.0 * pi * Long_Float(i) / 7.0) + exp((Long_Float(Integer'min(i, x'length - i))) / 31.0); end loop; pladv(0); plvsta; plwind(xmin, xmax, ymin, ymax); plcol0(1); -- Set time format to be ISO 8601 standard YYYY-MM-DD. pltimefmt("%F"); -- Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox("bcnstd", 14.0 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1.0, 4); plcol0(3); pllab("Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"); plcol0(4); -- Rescale symbol size (used by plpoin) by 0.5 plssym(0.0,0.5); plpoin(x, y, 2); plline(x, y); end plot3; procedure plot4 is -- TAI-UTC (seconds) as a function of time. -- Use Besselian epochs as the continuous time interval just to prove -- this does not introduce any issues. scale, offset1, offset2 : Long_Float; xmin, xmax, ymin, ymax, xlabel_step : Long_Float; npts : Integer; if_TAI_time_format : Boolean; time_format : Unbounded_String := To_Unbounded_String(""); title_suffix : Unbounded_String := To_Unbounded_String(""); xtitle : Unbounded_String := To_Unbounded_String(""); title : Unbounded_String := To_Unbounded_String(""); x, y : Real_Vector(0 .. 1000); tai_year, tai_month, tai_day, tai_hour, tai_min : Integer; tai_sec, tai : Long_Float; utc_year, utc_month, utc_day, utc_hour, utc_min : Integer; utc_sec, utc : Long_Float; begin -- Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch -- B = 1900. + (JD -2415020.31352)/365.242198781 -- => (as calculated with aid of "bc -l" command) -- B = (MJD + 678940.364163900)/365.242198781 -- => -- MJD = B*365.24219878 - 678940.364163900 scale := 365.242198781; offset1 := -678940.0; offset2 := -0.3641639; plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); for kind in 0 .. 6 loop if kind = 0 then plctime(1950, 0, 2, 0, 0, 0.0, xmin); plctime(2020, 0, 2, 0, 0, 0.0, xmax); npts := 70 * 12 + 1; ymin := 0.0; ymax := 36.0; time_format := To_Unbounded_String("%Y%"); if_TAI_time_format := True; title_suffix := To_Unbounded_String("from 1950 to 2020"); xtitle := To_Unbounded_String("Year"); xlabel_step := 10.0; elsif kind = 1 or kind = 2 then plctime(1961, 7, 1, 0, 0, 1.64757 - 0.20, xmin); plctime(1961, 7, 1, 0, 0, 1.64757 + 0.20, xmax); npts := 1001; ymin := 1.625; ymax := 1.725; time_format := To_Unbounded_String("%S%2%"); title_suffix := To_Unbounded_String("near 1961-08-01 (TAI)"); xlabel_step := 0.05 / (scale * 86400.0); if kind = 1 then if_TAI_time_format := True; xtitle := To_Unbounded_String("Seconds (TAI)"); else if_TAI_time_format := False; xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); end if; elsif kind = 3 or kind = 4 then plctime(1963, 10, 1, 0, 0, 2.6972788 - 0.20, xmin); plctime(1963, 10, 1, 0, 0, 2.6972788 + 0.20, xmax); npts := 1001; ymin := 2.55; ymax := 2.75; time_format := To_Unbounded_String("%S%2%"); title_suffix := To_Unbounded_String("near 1963-11-01 (TAI)"); xlabel_step := 0.05 / (scale * 86400.0); if kind = 3 then if_TAI_time_format := True; xtitle := To_Unbounded_String("Seconds (TAI)"); else if_TAI_time_format := False; xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); end if; elsif kind = 5 or kind = 6 then plctime(2009, 0, 1, 0, 0, 34.0 - 5.0, xmin); plctime(2009, 0, 1, 0, 0, 34.0 + 5.0, xmax); npts := 1001; ymin := 32.5; ymax := 34.5; time_format := To_Unbounded_String("%S%2%"); title_suffix := To_Unbounded_String("near 2009-01-01 (TAI)"); xlabel_step := 1.0 / (scale * 86400.0); if kind = 5 then if_TAI_time_format := True; xtitle := To_Unbounded_String("Seconds (TAI)"); else if_TAI_time_format := False; xtitle := To_Unbounded_String("Seconds (TAI) labelled with corresponding UTC"); end if; end if; for i in 0 .. npts - 1 loop x(i) := xmin + Long_Float(i) * (xmax - xmin) / (Long_Float(npts - 1)); plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); tai := x(i); plbtime(tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec, tai); plconfigtime(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); plbtime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, tai); plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); plctime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, utc); y(i) := (tai - utc) * scale * 86400.0; end loop; pladv(0); plvsta; plwind(xmin, xmax, ymin, ymax); plcol0(1); if if_TAI_time_format then plconfigtime(scale, offset1, offset2, 0, False, 0, 0, 0, 0, 0, 0.0); else plconfigtime(scale, offset1, offset2, 2, False, 0, 0, 0, 0, 0, 0.0); end if; pltimefmt(To_String(time_format)); plbox("bcnstd", xlabel_step, 0, "bcnstv", 0.0, 0); plcol0(3); title := To_Unbounded_String("@frPLplot Example 29 - TAI-UTC "); title := title & title_suffix; pllab(To_String(xtitle), "TAI-UTC (sec)", To_String(title)); plcol0(4); if kind = 0 then -- Shorter x and y plline(x(0 .. 70 * 12), y(0 .. 70 * 12)); else -- Longer x and y plline(x, y); end if; end loop; -- kind end plot4; begin -- main -- Parse command line arguments plparseopts(PL_PARSE_FULL); -- Change the escape character to a '@' instead of the default '#' plsesc('@'); -- Initialize plplot plinit; -- Change the escape character to a '@' instead of the default '#' plsesc('@'); plot1; plot2; plot3; plot4; -- Don't forget to call plend to finish off! plend; end x29a; plplot-5.10.0+dfsg/examples/ada/x12a.adb 644 1750 1750 607312012305413 165130ustar andrewandrew-- $Id: x12a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Bar chart demo. -- Copyright (C) 2006 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot_Traditional; ------------------------------------------------------------------------------ -- Does a simple bar chart, using color fill. If color fill is -- unavailable, pattern fill is used instead (automatic). ------------------------------------------------------------------------------ procedure x12a is y0 : Real_Vector (0 .. 9); pos : Real_Vector (0 .. 4) := (0.0, 0.25, 0.5, 0.75, 1.0); r : Real_Vector (0 .. 4) := (0.0, 0.25, 0.5, 1.0, 1.0); g : Real_Vector (0 .. 4) := (1.0, 0.5, 0.5, 0.5, 1.0); b : Real_Vector (0 .. 4) := (1.0, 1.0, 0.5, 0.25, 0.0); procedure plfbox (x0, y0 : Long_Float) is x, y : Real_Vector (0 ..3); begin x(0) := x0; y(0) := 0.0; x(1) := x0; y(1) := y0; x(2) := x0 + 1.0; y(2) := y0; x(3) := x0 + 1.0; y(3) := 0.0; plfill(x, y); plcol0(1); pllsty(1); plline(x, y); end plfbox; begin -- Parse and process command line arguments. plparseopts(PL_PARSE_FULL); -- Initialize plplot. plinit; pladv(0); plvsta; plwind(1980.0, 1990.0, 0.0, 35.0); plbox("bc", 1.0, 0, "bcnv", 10.0, 0); plcol0(2); pllab("Year", "Widget Sales (millions)", "#frPLplot Example 12"); y0(0) := 5.0; y0(1) := 15.0; y0(2) := 12.0; y0(3) := 24.0; y0(4) := 28.0; y0(5) := 30.0; y0(6) := 20.0; y0(7) := 8.0; y0(8) := 12.0; y0(9) := 3.0; plscmap1l(RGB, pos, r, g, b, Alt_Hue_Path_None); for i in y0'range loop plcol1(Long_Float(i)/9.0); plpsty(0); plfbox((1980.0 + Long_Float(i)), y0(i)); plptex(1980.0 + Long_Float(i) + 0.5, y0(i) + 1.0, 1.0, 0.0, 0.5, Trim(Integer'image(Integer(y0(i))), Left)); plmtex("b", 1.0, (Long_Float(i) + 1.0) * 0.1 - 0.05, 0.5, Trim(Integer'image(1980 + i), Left)); end loop; -- Don't forget to call plend to finish off! plend; end x12a; plplot-5.10.0+dfsg/examples/ada/x01a.adb 644 1750 1750 1161612122203655 165370ustar andrewandrew-- $Id: x01a.adb 12300 2013-03-20 00:49:49Z jbauck $ -- Simple line plot and multiple windows demo. -- Copyright (C) 2007 - 2011 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Text_IO, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x01a is xs, ys : Real_Vector (0 .. 5); xscale, yscale, xoff, yoff : Long_Float; fontset : Integer := 1; notes : String := "Make sure you get it right!"; procedure plot1 is xmin, xmax, ymin, ymax : Long_Float; x, y : Real_Vector (0 .. 59); begin for i in x'Range loop x(i) := xoff + xscale * Long_Float(i + 1) / Long_Float(x'Length); y(i) := yoff + yscale * x(i)**2.0; end loop; xmin := x(x'First); xmax := x(x'Last); ymin := y(y'First); ymax := y(y'Last); for i in xs'Range loop xs(i) := x(i * 10 + 3); ys(i) := y(i * 10 + 3); end loop; -- Set up the viewport and window using plenv. The range in X is -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are -- scaled separately (just = 0), and we just draw a labelled -- box (axis = 0). plcol0(1); plenv(xmin, xmax, ymin, ymax, 0, 0); plcol0(2); pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); -- Plot the data points plcol0(4); plpoin(xs, ys, 9); -- Draw the line through the data plcol0(3); plline(x, y); end plot1; procedure plot2 is x, y : Real_Vector (0 .. 99); begin -- Set up the viewport and window using PLENV. The range in X is -2.0 to -- 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately -- (just = 0), and we draw a box with axes (axis = 1). plcol0(1); plenv(-2.0, 10.0, -0.4, 1.2, 0, 1); plcol0(2); pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); -- Fill up the arrays for i in x'Range loop x(i) := (Long_Float(i) - 19.0) / 6.0; y(i) := 1.0; if x(i) /= 0.0 then y(i) := sin(x(i)) / x(i); end if; end loop; -- Draw the line plcol0(3); plwidth(2.0); plline(x, y); plwidth(1.0); end plot2; procedure plot3 is x, y : Real_Vector (0 .. 100); space1, mark1 : Integer_Array_1D(1 .. 1) := (others => 1500); begin pladv(0); -- Use standard viewport, and define X range from 0 to 360 degrees, -- Y range from -1.2 to 1.2. plvsta; plwind(0.0, 360.0, -1.2, 1.2); -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0(1); plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2); -- Superimpose a dashed line grid, with 1.5 mm marks and spaces. -- plstyl expects a pointer! (-- Not Ada.) plstyl(mark1, space1); plcol0(2); plbox("g", 30.0, 0, "g", 0.2, 0); plstyl(Default_Continuous_Line); plcol0(3); pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); for i in x'Range loop x(i) := 3.6 * Long_Float(i); y(i) := sin(x(i) * pi / 180.0); end loop; plcol0(4); plline(x, y); end plot3; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Get version number, just for kicks Put_Line("PLplot library version: " & plgver); -- Initialize plplot -- Divide page into 2x2 plots unless user overrides plstar(2, 2); -- Set up the data -- Original case xscale := 6.0; yscale := 1.0; xoff := 0.0; yoff := 0.0; -- Do a plot plot1; -- Set up the data xscale := 1.0; yscale := 0.0014; yoff := 0.0185; -- Do a plot plsyax(5, 0); plot1; plot2; plot3; -- Don't forget to call PLEND to finish off! plend; end x01a; plplot-5.10.0+dfsg/examples/ada/xthick05a.adb 644 1750 1750 345611543675237 175700ustar andrewandrew-- $Id: xthick05a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Histogram demo. -- Draws a histogram from sample data. -- Copyright (C) 2007 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick05a is NPTS : constant Integer := 2047; data : Real_Vector(0 .. NPTS - 1); delt : Long_Float; -- delta is a reserved word in Ada. begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; -- Fill up data points delt := 2.0 * pi / Long_Float(NPTS); for i in data'range loop data(i) := sin(Long_Float(i) * delt); end loop; Set_Pen_Color(Red); Histogram_Unbinned(data, -1.1, 1.1, 44, Histogram_Default); Set_Pen_Color(Yellow); Write_Labels("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator"); End_PLplot; end xthick05a; plplot-5.10.0+dfsg/examples/ada/xthick14a.adb 644 1750 1750 3020211543675237 175750ustar andrewandrew-- $Id: xthick14a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Demo of multiple stream/window capability (requires Tk or Tcl-DP). -- Maurice LeBrun -- IFS, University of Texas at Austin -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Text_IO, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Text_IO, Ada.Numerics, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; ------------------------------------------------------------------------------ -- Plots several simple functions from other example programs. -- -- This version sends the output of the first 4 plots (one page) to two -- independent streams. ------------------------------------------------------------------------------ procedure xthick14a is -- Select either TK or DP driver and use a small window -- Using DP results in a crash at the end due to some odd cleanup problems -- The geometry strings MUST be in writable memory geometry_master : String := "500x410+100+200"; geometry_slave : String := "500x410+650+200"; driver : Unbounded_String; digmax : Integer; xscale, yscale, xoff, yoff : Long_Float; xs, ys : Real_Vector(0 .. 5); space0 : Integer_Array_1D(1 .. 1) := (Others => 0); mark0 : Integer_Array_1D(1 .. 1) := (Others => 0); space1 : Integer_Array_1D(1 .. 1) := (Others => 1500); mark1 : Integer_Array_1D(1 .. 1) := (Others => 1500); fam : Boolean; num, bmax : Integer; xp0, yp0 : Long_Float; xleng0, yleng0, xoff0, yoff0 : Integer; valid_geometry : Boolean; procedure plot1 is xmin, xmax, ymin, ymax : Long_Float; x, y : Real_Vector(0 .. 59); begin for i in x'range loop x(i) := xoff + xscale * Long_Float(i + 1) / Long_Float(x'Length); y(i) := yoff + yscale * x(i) * x(i); end loop; xmin := x(x'First); xmax := x(x'Last); ymin := y(y'First); ymax := y(y'Last); for i in xs'range loop xs(i) := x(i * 10 + 3); ys(i) := y(i * 10 + 3); end loop; -- Set up the viewport and window using PLENV. The range in X is -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are -- scaled separately (just := 0), and we just draw a labelled -- box (axis := 0). Set_Pen_Color(Red); Set_Environment(xmin, xmax, ymin, ymax, Not_Justified, Linear_Box_Plus); Set_Pen_Color(Wheat); Write_Labels("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); -- Plot the data points Set_Pen_Color(Blue); Draw_Points(xs, ys, 9); -- Draw the line through the data Set_Pen_Color(Aquamarine); Draw_Curve(x, y); Flush_Output_Stream; end plot1; -- ================================================================ procedure plot2 is x, y : Real_Vector(0 .. 99); begin -- Set up the viewport and window using PLENV. The range in X is -2.0 to -- 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately -- (just = 0), and we draw a box with axes (axis = 1). Set_Pen_Color(Red); Set_Environment(-2.0, 10.0, -0.4, 1.2, Not_Justified, Linear_Zero_Axes); Set_Pen_Color(Yellow); Write_Labels("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); -- Fill up the arrays for i in x'range loop x(i) := (Long_Float(i) - 19.0) / 6.0; y(i) := 1.0; if x(i) /= 0.0 then y(i) := sin(x(i)) / x(i); end if; end loop; -- Draw the line Set_Pen_Color(Green); Draw_Curve(x, y); Flush_Output_Stream; end plot2; -- ================================================================ procedure plot3 is x, y : Real_Vector(0 .. 100); begin -- For the final graph we wish to override the default tick intervals, and -- so do not use PLENV Advance_To_Subpage(Next_Subpage); -- Use standard viewport, and define X range from 0 to 360 degrees, Y range -- from -1.2 to 1.2. Set_Viewport_Standard; Set_Viewport_World(0.0, 360.0, -1.2, 1.2); -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 60.0, 2, "bcnstv", 0.2, 2); -- Superimpose a dashed line grid, with 1.5 mm marks and spaces. Set_Line_Style(mark1, space1); Set_Pen_Color(Yellow); Box_Around_Viewport("g", 30.0, 0, "g", 0.2, 0); Set_Line_Style(Default_Continuous_Line); Set_Pen_Color(Green); Write_Labels("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); for i in x'range loop x(i) := 3.6 * Long_Float(i); y(i) := sin(x(i) * pi / 180.0); end loop; Set_Pen_Color(Aquamarine); Draw_Curve(x, y); Flush_Output_Stream; end plot3; -- ================================================================ procedure plot4 is dtr, theta, dx, dy, r : Long_Float; x, y, x0, y0 : Real_Vector(0 .. 360); begin dtr := pi / 180.0; for i in x0'range loop x0(i) := cos(dtr * Long_Float(i)); y0(i) := sin(dtr * Long_Float(i)); end loop; -- Set up viewport and window, but do not draw box Set_Environment(-1.3, 1.3, -1.3, 1.3, Justified, No_Box); for i in 1 .. 10 loop for j in x'range loop x(j) := 0.1 * Long_Float(i) * x0(j); y(j) := 0.1 * Long_Float(i) * y0(j); end loop; -- Draw circles for polar grid Draw_Curve(x, y); end loop; Set_Pen_Color(Yellow); for i in 0 .. 11 loop theta := 30.0 * Long_Float(i); dx := cos(dtr * theta); dy := sin(dtr * theta); -- Draw radial spokes for polar grid Draw_Line(0.0, 0.0, dx, dy); -- Write labels for angle -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if dx >= -0.00001 then Write_Text_World(dx, dy, dx, dy, -0.15, Trim(Integer'image(Integer(theta)), Left)); else Write_Text_World(dx, dy, -dx, -dy, 1.15, Trim(Integer'image(Integer(theta)), Left)); end if; end loop; -- Draw the graph for i in x'range loop r := sin(dtr * Long_Float(5 * i)); x(i) := x0(i) * r; y(i) := y0(i) * r; end loop; Set_Pen_Color(Green); Draw_Curve(x, y); Set_Pen_Color(Aquamarine); Write_Text_Viewport("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); Flush_Output_Stream; end plot4; -- ================================================================ -- Demonstration of contour plotting procedure plot5 is XPTS : constant Integer := 35; YPTS : constant Integer := 46; -- Transformation function XSPA : Long_Float := 2.0 / Long_Float(XPTS - 1); YSPA : Long_Float := 2.0 / Long_Float(YPTS - 1); tr : Real_Vector(0 .. 5) := (XSPA, 0.0, -1.0, 0.0, YSPA, -1.0); xx, yy : Long_Float; mark : Integer_Array_1D(1 .. 1) := (Others => 1500); space : Integer_Array_1D(1 .. 1) := (Others => 1500); z, w : Real_Matrix(0 .. XPTS -1, 0 .. YPTS - 1); clevel : Real_Vector(0 .. 10) := (-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0); procedure mypltr -- This spec is necessary to accommodate pragma Convention(C...). (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer); pragma Convention(Convention => C, Entity => mypltr); procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer) is begin tx := tr(0) * x + tr(1) * y + tr(2); ty := tr(3) * x + tr(4) * y + tr(5); end mypltr; begin for i in z'range(1) loop xx := Long_Float(i - (XPTS / 2)) / Long_Float(XPTS / 2); for j in z'range(2) loop yy := Long_Float(j - (YPTS / 2)) / Long_Float(YPTS / 2) - 1.0; z(i, j) := xx * xx - yy * yy; w(i, j) := 2.0 * xx * yy; end loop; end loop; Set_Environment(-1.0, 1.0, -1.0, 1.0, Not_Justified, Linear_Box_Plus); Set_Pen_Color(Yellow); Contour_Plot(z, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); Set_Line_Style(mark, space); Set_Pen_Color(Green); Contour_Plot(w, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); Set_Pen_Color(Red); Write_Labels("X Coordinate", "Y Coordinate", "Streamlines of flow"); Flush_Output_Stream; end plot5; begin -- plplot initialization -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); driver := To_Unbounded_String(Get_Device_Name); Get_File_Family_Parameters(fam, num, bmax); Put_Line("Demo of multiple output streams via the " & Get_Device_Name & " driver."); Put_Line("Running with the second stream as slave to the first."); New_Line; -- If valid geometry specified on command line, use it for both streams. Get_Page_Parameters(xp0, yp0, xleng0, yleng0, xoff0, yoff0); valid_geometry := (xleng0 > 0 and yleng0 > 0); -- Set up first stream if valid_geometry then Set_Page_Parameters(xp0, yp0, xleng0, yleng0, xoff0, yoff0); else Set_Command_Line_Option("geometry", geometry_master); end if; Set_Device_Name(To_String(driver)); Set_Number_Of_Subpages(2, 2); Initialize_PLplot; -- Start next stream Set_Stream_Number(1); if valid_geometry then Set_Page_Parameters(xp0, yp0, xleng0, yleng0, xoff0, yoff0); else Set_Command_Line_Option("geometry", geometry_slave); end if; -- Turn off pause to make this a slave (must follow master) Set_Pause(False); Set_Device_Name(To_String(driver)); Get_File_Family_Parameters(fam, num, bmax); Set_Command_Line_Option("fflen","2"); Initialize_PLplot; -- Set up the data & plot -- Original case Set_Stream_Number(0); xscale := 6.0; yscale := 1.0; xoff := 0.0; yoff := 0.0; plot1; -- Set up the data & plot xscale := 1.0; yscale := 1.0e+6; plot1; -- Set up the data & plot xscale := 1.0; yscale := 1.0e-6; digmax := 2; Set_Floating_Point_Display_Y(digmax, 0); plot1; -- Set up the data & plot xscale := 1.0; yscale := 0.0014; yoff := 0.0185; digmax := 5; Set_Floating_Point_Display_Y(digmax, 0); plot1; -- To slave -- The Eject_Current_Page ensures the eop indicator gets lit. Set_Stream_Number(1); plot4; Eject_Current_Page; -- Back to master Set_Stream_Number(0); plot2; plot3; -- To slave Set_Stream_Number(1); plot5; Eject_Current_Page; -- Back to master to wait for user to advance Set_Stream_Number(0); Eject_Current_Page; -- Call End_PLplot to finish off. End_PLplot; end xthick14a; plplot-5.10.0+dfsg/examples/ada/x28a.adb 644 1750 1750 3253111543675237 165660ustar andrewandrew-- $Id: x28a.adb 11680 2011-03-27 17:57:51Z airwin $ -- plmtex3, plptex3 demo -- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; -- Demonstrates plotting text in 3D. procedure x28a is -- Choose these values to correspond to tick marks. xpts : constant Integer := 2; ypts : constant Integer := 2; nrevolution : constant Integer := 16; nrotation : constant Integer := 8; nshear : constant Integer := 8; xmin, ymin, zmin : Long_Float := 0.0; xmax, ymax, zmax : Long_Float := 1.0; xmid : Long_Float := 0.5*(xmax + xmin); xrange : Long_Float := xmax - xmin; ymid : Long_Float := 0.5*(ymax + ymin); yrange : Long_Float := ymax - ymin; zmid : Long_Float := 0.5*(zmax + zmin); zrange : Long_Float := zmax - zmin; ysmin : Long_Float := ymin + 0.1 * yrange; ysmax : Long_Float := ymax - 0.1 * yrange; ysrange : Long_Float := ysmax - ysmin; dysrot : Long_Float := ysrange / Long_Float(nrotation - 1); dysshear : Long_Float := ysrange / Long_Float(nshear - 1); zsmin : Long_Float := zmin + 0.1 * zrange; zsmax : Long_Float := zmax - 0.1 * zrange; zsrange : Long_Float := zsmax - zsmin; dzsrot : Long_Float := zsrange / Long_Float(nrotation - 1); dzsshear : Long_Float := zsrange / Long_Float(nshear - 1); ys, zs : Long_Float; x_inclination, y_inclination, z_inclination : Long_Float; x_shear, y_shear, z_shear : Long_Float; omega, sin_omega, cos_omega, domega : Long_Float; radius, pitch, xpos, ypos, zpos : Long_Float; -- p1string must be exactly one character + the null termination character. plstring : String(1 .. 1); pstring : String := "The future of our civilization depends on software freedom."; -- Allocate and define the minimal x, y, and z to insure 3D box. x, y : Real_Vector(0 .. xpts - 1); z : Real_Matrix(0 .. xpts - 1, 0 .. ypts - 1) := ((others => 0.0), (others => 0.0)); begin for i in x'range loop x(i) := xmin + Long_Float(i) * (xmax - xmin) / Long_Float(xpts - 1); end loop; for i in y'range loop y(i) := ymin + Long_Float(i) * (ymax - ymin) / Long_Float(ypts - 1); end loop; -- Parse and process command line arguments. plparseopts(PL_PARSE_FULL); plinit; -- Page 1: Demonstrate inclination and shear capability pattern. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); plcol0(2); plbox3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); -- z = zmin plschr(0.0, 1.0); for i in 0 .. nrevolution - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrevolution); sin_omega := sin(omega); cos_omega := cos(omega); x_inclination := 0.5 * xrange * cos_omega; y_inclination := 0.5 * yrange * sin_omega; z_inclination := 0.0; x_shear := -0.5 * xrange * sin_omega; y_shear := 0.5 * yrange * cos_omega; z_shear := 0.0; plptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution"); end loop; -- x = xmax plschr(0.0, 1.0); for i in 0 .. nrevolution - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrevolution); sin_omega := sin(omega); cos_omega := cos(omega); x_inclination := 0.0; y_inclination := -0.5*yrange*cos_omega; z_inclination := 0.5*zrange*sin_omega; x_shear := 0.0; y_shear := 0.5*yrange*sin_omega; z_shear := 0.5*zrange*cos_omega; plptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution"); end loop; -- y = ymax plschr(0.0, 1.0); for i in 0 .. nrevolution - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrevolution); sin_omega := sin(omega); cos_omega := cos(omega); x_inclination := 0.5 * xrange * cos_omega; y_inclination := 0.0; z_inclination := 0.5 * zrange * sin_omega; x_shear := -0.5 * xrange * sin_omega; y_shear := 0.0; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsrot * Long_Float(i); plptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution"); end loop; -- Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY); -- Page 2: Demonstrate rotation of string around its axis. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); plcol0(2); plbox3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); -- y = ymax plschr(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; x_shear := 0.0; for i in 0 .. nrotation - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrotation); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := 0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsrot * Long_Float(i); plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u"); end loop; -- x = xmax plschr(0.0, 1.0); x_inclination := 0.0; y_inclination := -1.0; z_inclination := 0.0; y_shear := 0.0; for i in 0 .. nrotation - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrotation); sin_omega := sin(omega); cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsrot * Long_Float(i); plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u"); end loop; -- z = zmin plschr(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; x_shear := 0.0; for i in 0 .. nrotation - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrotation); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; z_shear := 0.5 * zrange * sin_omega; ys := ysmax - dysrot * Long_Float(i); plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u"); end loop; -- Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY); -- Page 3: Demonstrate shear of string along its axis. -- Work around xcairo and pngcairo (but not pscairo) problems for -- shear vector too close to axis of string. (N.B. no workaround -- would be domega := 0.) domega := 0.05; pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); plcol0(2); plbox3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); -- y = ymax plschr(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; y_shear := 0.0; for i in 0 .. nshear - 1 loop omega := domega + 2.0 * pi * Long_Float(i) / Long_Float(nshear); sin_omega := sin(omega); cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsshear * Long_Float(i); plptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u"); end loop; -- x = xmax plschr(0.0, 1.0); x_inclination := 0.0; y_inclination := -1.0; z_inclination := 0.0; x_shear := 0.0; for i in 0 .. nshear - 1 loop omega := domega + 2.0 * pi * Long_Float(i) / Long_Float(nshear); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := -0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsshear * Long_Float(i); plptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u"); end loop; -- z = zmin plschr(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; z_shear := 0.0; for i in 0 .. nshear - 1 loop omega := domega + 2.0 * pi * Long_Float(i) / Long_Float(nshear); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; x_shear := 0.5 * xrange * sin_omega; ys := ysmax - dysshear * Long_Float(i); plptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u"); end loop; -- Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY); -- Page 4: Demonstrate drawing a string on a 3D path. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40.0, -30.0); plcol0(2); plbox3("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); plschr(0.0, 1.2); -- domega controls the spacing between the various characters of the -- string and also the maximum value of omega for the given number -- of characters in pstring. domega := 2.0 * pi / Long_Float(pstring'length); omega := 0.0; -- 3D function is a helix of the given radius and pitch radius := 0.5; pitch := 1.0 / (2.0 * pi); for i in pstring'range loop sin_omega := sin(omega); cos_omega := cos(omega); xpos := xmid + radius * sin_omega; ypos := ymid - radius * cos_omega; zpos := zmin + pitch * omega; -- In general, the inclination is proportional to the derivative of -- the position wrt theta. x_inclination := radius * cos_omega; y_inclination := radius * sin_omega; z_inclination := pitch; -- The shear vector should be perpendicular to the 3D line with Z -- component maximized, but for low pitch a good approximation is -- a constant vector that is parallel to the Z axis. x_shear := 0.0; y_shear := 0.0; z_shear := 1.0; plstring(1) := pstring(i); plptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, plstring); omega := omega + domega; end loop; -- Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY); -- Page 5: Demonstrate plmtex3 axis labelling capability. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); plcol0(2); plbox3("b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0); plschr(0.0, 1.0); plmtex3("xp", 3.0, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("xp", 4.5, 0.5, 0.5, "primary X-axis label"); plmtex3("xs", -2.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("xs", -1.0, 0.5, 0.5, "secondary X-axis label"); plmtex3("yp", 3.0, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("yp", 4.5, 0.5, 0.5, "primary Y-axis label"); plmtex3("ys", -2.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("ys", -1.0, 0.5, 0.5, "secondary Y-axis label"); plmtex3("zp", 4.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("zp", 3.0, 0.5, 0.5, "primary Z-axis label"); plmtex3("zs", -2.5, 0.5, 0.5, "Arbitrarily displaced"); plmtex3("zs", -1.0, 0.5, 0.5, "secondary Z-axis label"); -- Draw minimal 3D grid to finish defining the 3D box. plmesh(x, y, z, DRAW_LINEXY); -- Clean up. plend; end x28a; plplot-5.10.0+dfsg/examples/ada/xthick03a.adb 644 1750 1750 632211543675237 175610ustar andrewandrew-- $Id: xthick03a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Polar plot demo. -- Generates polar plot, with 1-1 scaling. -- Copyright (C) 2007 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; procedure xthick03a is dtr, theta, dx, dy, r, offset : Long_Float; x0, y0 : Real_Vector(0..360); x, y : Real_Vector(0..360); begin dtr := pi / 180.0; for i in x0'range loop x0(i) := cos(dtr * Long_Float(i)); y0(i) := sin(dtr * Long_Float(i)); end loop; -- Parse and process command line arguments. Parse_Command_Line_Arguments(Parse_Full); -- Set orientation to landscape. Note not all device drivers -- support this, in particular most interactive drivers do not. Set_Orientation(Portrait); -- Initialize plplot Initialize_PLplot; -- Set up viewport and window, but do not draw box. Set_Environment(-1.3, 1.3, -1.3, 1.3, Justified, No_Box); -- Draw circles for polar grid. for i in 1 .. 10 loop Draw_Arc(0.0, 0.0, 0.1 * Long_Float(i), 0.1 * Long_Float(i), 0.0, 360.0, 0.0, False); end loop; Set_Pen_Color(2); for i in 0..11 loop theta := 30.0 * Long_Float(i); dx := cos(dtr * theta); dy := sin(dtr * theta); -- Draw radial spokes for polar grid. Draw_Line(0.0, 0.0, dx, dy); -- Write labels for angle. if theta < 9.99 then offset := 0.45; elsif theta < 99.9 then offset := 0.30; else offset := 0.15; end if; -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg if dx >= -0.00001 then Write_Text_World(dx, dy, dx, dy, -offset, Trim(Integer'image(Integer(theta)), Left)); else Write_Text_World(dx, dy, -dx, -dy, 1.0 + offset, Trim(Integer'image(Integer(theta)), Left)); end if; end loop; -- Draw the graph. for i in x'range loop r := sin(dtr * Long_Float(5 * i)); x(i) := x0(i) * r; y(i) := y0(i) * r; end loop; Set_Pen_Color(Green); Draw_Curve(x, y); Set_Pen_Color(Aquamarine); Write_Text_Viewport("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); -- Close the plot at end. End_PLplot; end xthick03a; plplot-5.10.0+dfsg/examples/ada/x20a.adb 644 1750 1750 3431412012305413 165310ustar andrewandrew-- $Id: x20a.adb 12212 2012-08-13 23:17:31Z airwin $ -- plimage demo -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Interfaces.C, System, Ada.Sequential_IO, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Text_IO, Interfaces.C, System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; procedure x20a is XDIM : constant Integer := 260; YDIM : constant Integer := 220; PLK_Return : constant unsigned := 16#0D#; dbg : Integer := 0; nosombrero : Integer := 0; nointeractive : Integer := 0; x : Real_Vector(0 .. XDIM - 1); y : Real_Vector(0 .. YDIM - 1); z, r : Real_Matrix(0 .. XDIM - 1, 0 .. YDIM - 1); xi, yi, xe, ye : Long_Float; width, height, num_col : Integer; img_f : Real_Matrix(0 .. 398, 0 .. 485); -- Lena is width 399, height 486. img_min, img_max : Long_Float; Get_Clip_Return : Integer; type stretch_data is record xmin, xmax, ymin, ymax : Long_Float; stretch : Long_Float; end record; stretch : stretch_data; xx, yy : Long_Float; f_name : String(1 .. 200); f_name_length : Integer; Save_Sombrero : Boolean := False; -- Read image from file in binary ppm format. procedure read_img (fname : String; img_f : out Real_Matrix; width, height, num_col : out Integer) is type Byte is mod 2 ** 8; A_Byte : Byte; package Lena_IO is new Ada.Sequential_IO(Byte); use Lena_IO; Input_File : Lena_IO.File_Type; begin -- Naive grayscale binary ppm reading. If you know how to, improve it. -- Mine is naiver than yours. -- lena.pgm has 133 bytes of header followed by 399 * 486 bytes of 8-bit pixels. Lena_IO.Open(Input_File, In_File, fname); for i in 1 .. 133 loop Lena_IO.Read(Input_File, A_Byte); end loop; width := 399; -- columns height := 486; -- rows num_col := 255; -- number of colors for j in img_f'range(2) loop for i in img_f'range(1) loop Lena_IO.Read(Input_File, A_Byte); img_f(i, height - j - 1) := Long_Float(A_Byte); -- Flip image up-down. end loop; end loop; end read_img; -- Save plot. procedure save_plot(fname : String) is cur_strm, new_strm : Integer; begin plgstrm(cur_strm); -- Get current stream. plmkstrm(new_strm); -- Create a new one. plsdev("psc"); -- New device type. Use a known existing driver. plsfnam(fname); -- Set the file name. plcpstrm(cur_strm, False); -- Copy old stream parameters to new stream. plreplot; -- Do the save. plend1; -- Close new device... plsstrm(cur_strm); -- ...and return to previous one. end save_plot; -- Get selection square interactively. procedure get_clip(xi, xe, yi, ye : in out Long_Float; Return_This : out Integer) is gin : Graphics_Input_Record_Type; xxi : Long_Float := xi; yyi : Long_Float := yi; xxe : Long_Float := xe; yye : Long_Float := ye; t : Long_Float; start : Integer := 0; st : Boolean := False; sx, sy : Real_Vector(0 .. 4); begin plxormod(True, st); -- Enter xor mode to draw a selection rectangle. if st then -- Driver has xormod capability. Continue. loop plxormod(False, st); plGetCursor(gin); plxormod(True, st); if gin.button = 1 then xxi := gin.wX; yyi := gin.wY; if start /= 0 then -- Suppress warning """sy"" may be referenced before it has a value". pragma Warnings(Off); plline(sx, sy); -- Clear previous rectangle. pragma Warnings(On); end if; start := 0; sx(0) := xxi; sy(0) := yyi; sx(4) := xxi; sy(4) := yyi; end if; if (gin.state and Unsigned(16#100#)) /= 0 then xxe := gin.wX; yye := gin.wY; if start /= 0 then plline(sx, sy); -- Clear previous rectangle. end if; start := 1; sx(2) := xxe; sy(2) := yye; sx(1) := xxe; sy(1) := yyi; sx(3) := xxi; sy(3) := yye; plline(sx, sy); -- Draw new rectangle. end if; if gin.button = 3 or gin.keysym = PLK_Return or gin.keysym = unsigned(Character'pos('Q')) then if start /= 0 then plline(sx, sy); -- Clear previous rectangle. end if; exit; end if; end loop; plxormod(False, st); -- Leave xor mod. if xxe < xxi then t := xxi; xxi := xxe; xxe := t; end if; if yyi < yye then t :=yyi; yyi := yye; yye := t; end if; xe := xxe; xi := xxi; ye := yye; yi := yyi; if gin.keysym = unsigned(Character'pos('Q')) then Return_This := 1; else Return_This := 0; end if; else -- Driver has no xormod capability; just do nothing. Return_This := 0; end if; end get_clip; -- Set gray colormap. procedure gray_cmap(num_col : Integer) is r, g, b, pos : Real_Vector(0 .. 1); begin r(0) := 0.0; g(0) := 0.0; b(0) := 0.0; r(1) := 1.0; g(1) := 1.0; b(1) := 1.0; pos(0) := 0.0; pos(1) := 1.0; plscmap1n(num_col); plscmap1l(RGB, pos, r, g, b, Alt_Hue_Path_None); end gray_cmap; procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; s : stretch_data) is x0, y0, dy : Long_Float; begin x0 := (s.xmin + s.xmax) * 0.5; y0 := (s.ymin + s.ymax) * 0.5; dy := (s.ymax - s.ymin) * 0.5; tx := x0 + (x0 - x) * (1.0 - s.stretch * cos((y - y0) / dy * pi * 0.5)); ty := y; end mypltr; begin -- Bugs in plimage(): -- -at high magnifications, the left and right edge are ragged. Try -- ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5. -- Bugs in x20c.c: -- -if the window is resized after a selection is made on "lena", when -- making a new selection the old one will re-appear. -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; -- View image border pixels. if dbg /= 0 then plenv(1.0, Long_Float(XDIM), 1.0, Long_Float(YDIM), 1, 1); -- no plot box -- Build a one pixel square border, for diagnostics. for i in z'range(1) loop z(i, YDIM - 1) := 1.0; -- right end loop; for i in z'range(1) loop z(i, 0) := 1.0; -- left end loop; for i in z'range(2) loop z(0, i) := 1.0; -- top end loop; for i in z'range(2) loop z(XDIM - 1, i) := 1.0; -- botton end loop; pllab("...around a blue square."," ","A red border should appear..."); plimage(z, 1.0, Long_Float(XDIM), 1.0, Long_Float(YDIM), 0.0, 0.0, 1.0, Long_Float(XDIM), 1.0, Long_Float(YDIM)); end if; -- sombrero-like demo if nosombrero = 0 then plcol0(2); -- Draw a yellow plot box, useful for diagnostics! :( plenv(0.0, 2.0 * pi, 0.0, 3.0 * pi, 1, -1); for i in x'range loop x(i) := Long_Float(i) * 2.0 * pi / Long_Float(XDIM - 1); end loop; for i in y'range loop y(i) := Long_Float(i) * 3.0 * pi / Long_Float(YDIM - 1); end loop; for i in z'range(1) loop for j in z'range(2) loop r(i, j) := sqrt(x(i) * x(i) + y(j) * y(j)) + 1.0e-3; z(i, j) := sin(r(i, j)) / (r(i, j)); end loop; end loop; pllab("No, an amplitude clipped ""sombrero""", "", "Saturn?"); plptex(2.0, 2.0, 3.0, 4.0, 0.0, "Transparent image"); plimage(z, 0.0, 2.0 * pi, 0.0, 3.0 * pi, 0.05, 1.0, 0.0, 2.0 * pi, 0.0, 3.0 * pi); -- Save the plot. if Save_Sombrero then Put("Enter a path and name to save the Postscript file or RETURN to not save: "); Get_Line(f_name, f_name_length); if f_name'Length /= 0 then save_plot(f_name(1 .. f_name_length)); end if; end if; end if; -- Read the Lena image. -- Note we try two different locations to cover the case where this -- examples is being run from the test_c.sh script. begin read_img("./lena.pgm", img_f, width, height, num_col); exception when NAME_ERROR => null; begin read_img("../lena.pgm", img_f, width, height, num_col); exception when NAME_ERROR => Put_Line("Failed to open lena.pgm. Aborting."); plend; return; end; -- second exception block end; -- first exception block -- Set gray colormap. gray_cmap(num_col); -- Display Lena. plenv(1.0, Long_Float(width), 1.0, Long_Float(height), 1, -1); if nointeractive = 0 then pllab("Set and drag Button 1 to (re)set selection, Button 2 to finish."," ","Lena..."); else pllab(""," ","Lena..."); end if; plimage(img_f, 1.0, Long_Float(width), 1.0, Long_Float(height), 0.0, 0.0, 1.0, Long_Float(width), 1.0, Long_Float(height)); -- Selection/expansion demo if nointeractive = 0 then xi := 200.0; xe := 330.0; yi := 280.0; ye := 220.0; get_clip(xi, xe, yi, ye, Get_Clip_Return); -- get selection rectangle if Get_Clip_Return /= 0 then plend; end if; -- I'm unable to continue, clearing the plot and advancing to the next -- one, without hiting the enter key, or pressing the button... help! -- Forcing the xwin driver to leave locate mode and destroying the -- xhairs (in GetCursorCmd()) solves some problems, but I still have -- to press the enter key or press Button-2 to go to next plot, even -- if a pladv() is not present! Using plbop() solves the problem, but -- it shouldn't be needed! -- plbop(); -- plspause(0), pladv(0), plspause(1), also works, -- but the above question remains. -- With this approach, the previous pause state is lost, -- as there is no API call to get its current state. plspause(False); pladv(0); -- Display selection only. plimage(img_f, 1.0, Long_Float(width), 1.0, Long_Float(height), 0.0, 0.0, xi, xe, ye, yi); plspause(True); -- Zoom in selection. plenv(xi, xe, ye, yi, 1, -1); plimage(img_f, 1.0, Long_Float(width), 1.0, Long_Float(height), 0.0, 0.0, xi, xe, ye, yi); end if; -- Base the dynamic range on the image contents. img_min := Matrix_Min(img_f); img_max := Matrix_Max(img_f); -- Draw a saturated version of the original image. Use only the middle 50% -- of the image's full dynamic range. plcol0(2); plenv(0.0, Long_Float(width), 0.0, Long_Float(height), 1, -1); pllab("", "", "Reduced dynamic range image example"); plimagefr(img_f, 0.0, Long_Float(width), 0.0, Long_Float(height), 0.0, 0.0, img_min + img_max * 0.25, img_max - img_max * 0.25, Null, System.Null_Address); -- Draw a distorted version of the original image, showing its full dynamic range. plenv(0.0, Long_Float(width), 0.0, Long_Float(height), 1, -1); pllab("", "", "Distorted image example"); stretch.xmin := 0.0; stretch.xmax := Long_Float(width); stretch.ymin := 0.0; stretch.ymax := Long_Float(height); stretch.stretch := 0.5; -- In C / C++ the following would work, with plimagefr directly calling -- mypltr. For compatibilty with other language bindings the same effect -- can be achieved by generating the transformed grid first and then -- using pltr2. -- plimagefr(img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, mypltr, (PLPointer) &stretch); declare -- Declare block is based on runtime-determined values of width, height. cgrid2 : aliased Transformation_Data_Type_2 (x_Last => width, y_Last => height); begin for i in 0 .. width loop for j in 0 .. height loop mypltr(Long_Float(i), Long_Float(j), xx, yy, stretch); cgrid2.xg(i, j) := xx; cgrid2.yg(i, j) := yy; end loop; end loop; plimagefr(img_f, 0.0, Long_Float(width), 0.0, Long_Float(height), 0.0, 0.0, img_min, img_max, pltr2'access, cgrid2'Address); end; plend; end x20a; plplot-5.10.0+dfsg/examples/ada/xthick21a.adb 644 1750 1750 2445212143252635 175730ustar andrewandrew-- $Id: xthick21a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- Grid data demo -- Copyright (C) 2007 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- Ada note: This example originally used Ada's random number generator, but in -- order to make Postscript results that are identical to the C version, a -- PLplot-specific random number generator was substituted. The original Ada -- generator lines are left in as comments for reference. with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, -- Ada.Numerics.Float_Random, Ada.Strings, Ada.Strings.Fixed, Ada.Calendar, System, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, -- Ada.Numerics.Float_Random, Ada.Strings, Ada.Strings.Fixed, Ada.Calendar, PLplot, PLplot_Auxiliary; procedure xthick21a is pts : Integer := 500; xp : Integer := 25; yp : Integer := 20; nl : Integer := 16; knn_order : Integer := 20; threshold : Long_Float := 1.001; wmin : Long_Float := -1.0e3; randn, rosen : Integer := 0; xm, xMM, ym, yMM : Long_Float; zmin, zmax, lzm, lzMM : Long_Float; dist, d : Long_Float; x, y, z : Real_Vector(0 .. pts - 1); clev : Real_Vector(0 .. nl - 1); xg : Real_Vector(0 .. xp - 1); yg : Real_Vector(0 .. yp - 1); zg : Real_Matrix(0 .. xp - 1, 0 .. yp - 1); opt : Real_Vector(0 .. 5) := (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); -- Random_Generator : Generator; -- From Ada.Numerics.Float_Random function title(which : Integer) return String is begin if which = 0 then return "Cubic Spline Approximation"; end if; if which = 1 then return "Delaunay Linear Interpolation"; end if; if which = 2 then return "Natural Neighbors Interpolation"; end if; if which = 3 then return "KNN Inv. Distance Weighted"; end if; if which = 4 then return "3NN Linear Interpolation"; end if; if which = 5 then return "4NN Around Inv. Dist. Weighted"; end if; return "oops"; end title; procedure cmap1_init is i, h, l, s : Real_Vector(0 .. 1); begin i(0) := 0.0; -- left boundary i(1) := 1.0; -- right boundary h(0) := 240.0; -- blue -> green -> yellow -> red h(1) := 0.0; l(0) := 0.6; l(1) := 0.6; s(0) := 0.8; s(1) := 0.8; Set_Number_Of_Colors_In_Color_Map_1(256); Set_Color_Map_1_Piecewise(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init; procedure create_grid(x, y : out Real_Vector) is begin for i in x'range loop x(i) := xm + (xMM - xm) * Long_Float(i) / (Long_Float(x'length) - 1.0); end loop; for i in y'range loop y(i) := ym + (yMM - ym) * Long_Float(i) / (Long_Float(y'length) - 1.0); end loop; end create_grid; procedure create_data(x, y, z : out Real_Vector) is r, xt, yt : Long_Float; begin for i in x'range loop -- xt := Long_Float(Random(Random_Generator)); -- yt := Long_Float(Random(Random_Generator)); xt := (xMM - xm) * Random_Number; -- Use the PLplot random number generator yt := (yMM - ym) * Random_Number; -- to make the same plot as C example 21. if randn = 0 then x(i) := xt + xm; y(i) := yt + ym; else -- std=1, meaning that many points are outside the plot range x(i) := sqrt(-2.0 *log(xt)) * cos(2.0 * pi * yt) + xm; x(i) := sqrt(-2.0 *log(xt)) * sin(2.0 * pi * yt) + ym; end if; if rosen = 0 then r := sqrt((x(i)) * (x(i)) + (y(i)) * (y(i))); z(i) := exp(-r * r) * cos(2.0 * pi * r); else z(i) := log((1.0 - x(i))*(1.0 - x(i)) + 100.0 * (y(i) - x(i)*x(i))*(y(i) - x(i)*x(i))); end if; end loop; end create_data; -- Ada lacks full access to IEEE 754 aka IEC 559. The following works -- because a NaN is not equal to any other float, including itself. -- Use of the 'valid attribute might also work, as might casting to a 64-bit -- Integer and comparing to the known bit pattern for NaN; but beware of -- quiet NaNs and signalling NaNs. See the discussion at -- http://groups.google.com/group/comp.lang.ada/browse_thread/thread/772ddcb41cd06d5b?hl=en function Is_NaN(x : Long_Float) return Boolean is begin return x /= x; end Is_NaN; begin xm := -0.2; ym := -0.2; xMM := 0.6; yMM := 0.6; opt(2) := wmin; opt(3) := Long_Float(knn_order); opt(4) := threshold; -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; cmap1_init; Random_Number_Seed(5489); create_data(x, y, z); -- the sampled data zmin := Vector_Min(z); zmax := Vector_Max(z); create_grid(xg, yg); -- Grid the data at the output grided data. Set_Pen_Color(Red); Set_Environment(xm, xMM, ym, yMM, Justified_Square_Box, Linear_Box_Plus); Set_Pen_Color(White); Write_Labels("X", "Y", "The original data sampling"); for i in 0 .. (pts-1) loop Set_Color_Map_1( (z(i)-zmin)/(zmax-zmin) ); Draw_String( x(i .. i), y(i .. i), "#(727)" ); end loop; Advance_To_Subpage(Next_Subpage); Set_Number_Of_Subpages(3, 2); for k in 0 .. 1 loop Advance_To_Subpage(Next_Subpage); for alg in 1 .. 6 loop Grid_Data(x, y, z, xg, yg, zg, alg, opt(alg - 1)); -- CSA can generate NaNs (only interpolates?!). -- DTLI and NNI can generate NaNs for points outside the convex hull -- of the data points. -- NNLI can generate NaNs if a sufficiently thick triangle is not found -- PLplot should be NaN/Inf aware, but changing it now is quite a job... -- so, instead of not plotting the NaN regions, a weighted average over -- the neighbors is done. if alg = GRID_CSA or alg = GRID_DTLI or alg = GRID_NNLI or alg = GRID_NNI then for i in xg'range loop for j in yg'range loop if Is_NaN(zg(i, j)) then -- average (IDW) over the 8 neighbors zg(i, j) := 0.0; dist := 0.0; for ii in i - 1 .. i + 1 loop exit when ii >= xp; for jj in j - 1 .. j + 1 loop exit when jj >= yp; if ii >= 0 and jj >= 0 then if not Is_NaN(zg(ii, jj)) then if abs(ii - i) + abs(jj - j) = 1 then d := 1.0; else d := 1.4142; end if; zg(i, j) := zg(i, j) + zg(ii, jj) / (d * d); dist := dist + d; end if; end if; end loop; -- jj end loop; -- ii if dist /= 0.0 then zg(i, j) := zg(i,j) / dist; else zg(i, j) := zmin; end if; end if; end loop; -- j end loop; -- i end if; lzm := Matrix_Min(zg); lzMM := Matrix_Max(zg); lzm := Vector_Min((lzm, zmin)); lzMM := Vector_Max((lzMM, zmax)); -- Increase limits slightly to prevent spurious contours -- due to rounding errors. lzm := lzm - 0.01; lzMM := lzMM + 0.01; Set_Pen_Color(Red); Advance_To_Subpage(alg); if k = 0 then for i in clev'range loop clev(i) := lzm + (lzMM - lzm) / Long_Float(nl-1) * Long_Float(i); end loop; Set_Environment_Clear_Subpage(xm, xMM, ym, yMM, Justified_Square_Box, Linear_Box_Plus); Set_Pen_Color(White); Write_Labels("X", "Y", title(alg - 1)); Shade_Regions(zg, null, xm, xMM, ym, yMM, clev, 1.0, 0, 1.0, Fill_Polygon'access, True, null, System.Null_Address); Set_Pen_Color(Yellow); else for i in clev'range loop clev(i) := lzm + (lzMM - lzm) / Long_Float(nl - 1) * Long_Float(i); end loop; Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.9); Set_Viewport_World(-1.1, 0.75, -0.65, 1.20); -- For the comparition to be fair, all plots should have the -- same z values, but to get the max/min of the data generated -- by all algorithms would imply two passes. Keep it simple. Set_Up_3D(1.0, 1.0, 1.0, xm, xMM, ym, yMM, lzm, lzMM, 30.0, -40.0); Box_Around_Viewport_3D("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); Set_Pen_Color(White); Write_Labels("", "", title(alg - 1)); Plot_3D_Base_Contour(xg, yg, zg, DRAW_LINEXY + MAG_COLOR + BASE_CONT, clev); end if; end loop; -- alg end loop; -- k End_PLplot; end xthick21a; plplot-5.10.0+dfsg/examples/ada/xthick06a.adb 644 1750 1750 644111543675237 175660ustar andrewandrew-- $Id: xthick06a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Displays the entire "Draw_Points" symbol (font) set. -- Copyright (C) 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Strings, Ada.Strings.Fixed, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick06a is k, maxfont : Integer; x, y : Real_Vector(1 .. 1); begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; for Kind_Font in 0 .. 1 loop Set_Characer_Set(Kind_Font); if Kind_Font = 0 then maxfont := 1; else maxfont := 4; end if; for font in 0 .. maxfont - 1 loop Set_Font_Style(font + 1); Advance_To_Subpage(Next_Subpage); -- Set up viewport and window Set_Pen_Color(2); Set_Viewport_Normalized(0.1, 1.0, 0.1, 0.9); Set_Viewport_World(0.0, 1.0, 0.0, 1.3); -- Draw the grid using Box_Around_Viewport Box_Around_Viewport("bcg", 0.1, 0, "bcg", 0.1, 0); -- Write the digits below the frame Set_Pen_Color(15); for i in 0 .. 9 loop Write_Text_Viewport("b", 1.5, (0.1 * Long_Float(i) + 0.05), 0.5, Trim(Integer'image(i), Left)); end loop; k := 0; for i in 0 .. 12 loop -- Write the digits to the left of the frame Write_Text_Viewport("lv", 1.0, (1.0 - (2.0 * Long_Float(i) + 1.0) / 26.0), 1.0, Trim(Integer'image(10 * i), Left)); for j in 0 .. 9 loop x(1) := 0.1 * Long_Float(j) + 0.05; y(1) := 1.25 - 0.1 * Long_Float(i); -- Display the symbols (Draw_Points expects that x and y are arrays so -- pass pointers) if k < 128 then Draw_Points(x, y, k); end if; k := k + 1; end loop; end loop; if Kind_Font = 0 then Write_Text_Viewport("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)"); else Write_Text_Viewport("t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)"); end if; end loop; -- font end loop; -- Kind_Font End_PLplot; end xthick06a; plplot-5.10.0+dfsg/examples/ada/xthick28a.adb 644 1750 1750 3440711543675237 176150ustar andrewandrew-- $Id: xthick28a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Write_Text_Viewport3, Write_Text_World3 demo -- Copyright (C) 2008-2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; -- Demonstrates plotting text in 3D. procedure xthick28a is -- Choose these values to correspond to tick marks. xpts : constant Integer := 2; ypts : constant Integer := 2; nrevolution : constant Integer := 16; nrotation : constant Integer := 8; nshear : constant Integer := 8; xmin, ymin, zmin : Long_Float := 0.0; xmax, ymax, zmax : Long_Float := 1.0; xmid : Long_Float := 0.5*(xmax + xmin); xrange : Long_Float := xmax - xmin; ymid : Long_Float := 0.5*(ymax + ymin); yrange : Long_Float := ymax - ymin; zmid : Long_Float := 0.5*(zmax + zmin); zrange : Long_Float := zmax - zmin; ysmin : Long_Float := ymin + 0.1 * yrange; ysmax : Long_Float := ymax - 0.1 * yrange; ysrange : Long_Float := ysmax - ysmin; dysrot : Long_Float := ysrange / Long_Float(nrotation - 1); dysshear : Long_Float := ysrange / Long_Float(nshear - 1); zsmin : Long_Float := zmin + 0.1 * zrange; zsmax : Long_Float := zmax - 0.1 * zrange; zsrange : Long_Float := zsmax - zsmin; dzsrot : Long_Float := zsrange / Long_Float(nrotation - 1); dzsshear : Long_Float := zsrange / Long_Float(nshear - 1); ys, zs : Long_Float; x_inclination, y_inclination, z_inclination : Long_Float; x_shear, y_shear, z_shear : Long_Float; omega, sin_omega, cos_omega, domega : Long_Float; radius, pitch, xpos, ypos, zpos : Long_Float; -- p1string must be exactly one character + the null termination character. plstring : String(1 .. 1); pstring : String := "The future of our civilization depends on software freedom."; -- Allocate and define the minimal x, y, and z to insure 3D box. x, y : Real_Vector(0 .. xpts - 1); z : Real_Matrix(0 .. xpts - 1, 0 .. ypts - 1) := ((others => 0.0), (others => 0.0)); begin for i in x'range loop x(i) := xmin + Long_Float(i) * (xmax - xmin) / Long_Float(xpts - 1); end loop; for i in y'range loop y(i) := ymin + Long_Float(i) * (ymax - ymin) / Long_Float(ypts - 1); end loop; -- Parse and process command line arguments. Parse_Command_Line_Arguments(Parse_Full); Initialize_PLplot; -- Page 1: Demonstrate inclination and shear capability pattern. Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(-0.15, 1.15, -0.05, 1.05); Set_Viewport_World(-1.2, 1.2, -0.8, 1.5); Set_Up_3D(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); Set_Pen_Color(Yellow); Box_Around_Viewport_3D("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); -- z = zmin Set_Character_Height(0.0, 1.0); for i in 0 .. nrevolution - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrevolution); sin_omega := sin(omega); cos_omega := cos(omega); x_inclination := 0.5 * xrange * cos_omega; y_inclination := 0.5 * yrange * sin_omega; z_inclination := 0.0; x_shear := -0.5 * xrange * sin_omega; y_shear := 0.5 * yrange * cos_omega; z_shear := 0.0; Write_Text_World_3D( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution"); end loop; -- x = xmax Set_Character_Height(0.0, 1.0); for i in 0 .. nrevolution - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrevolution); sin_omega := sin(omega); cos_omega := cos(omega); x_inclination := 0.0; y_inclination := -0.5*yrange*cos_omega; z_inclination := 0.5*zrange*sin_omega; x_shear := 0.0; y_shear := 0.5*yrange*sin_omega; z_shear := 0.5*zrange*cos_omega; Write_Text_World_3D( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution"); end loop; -- y = ymax Set_Character_Height(0.0, 1.0); for i in 0 .. nrevolution - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrevolution); sin_omega := sin(omega); cos_omega := cos(omega); x_inclination := 0.5 * xrange * cos_omega; y_inclination := 0.0; z_inclination := 0.5 * zrange * sin_omega; x_shear := -0.5 * xrange * sin_omega; y_shear := 0.0; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsrot * Long_Float(i); Write_Text_World_3D( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution"); end loop; -- Draw minimal 3D grid to finish defining the 3D box. Mesh_3D(x, y, z, DRAW_LINEXY); -- Page 2: Demonstrate rotation of string around its axis. Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(-0.15, 1.15, -0.05, 1.05); Set_Viewport_World(-1.2, 1.2, -0.8, 1.5); Set_Up_3D(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); Set_Pen_Color(Yellow); Box_Around_Viewport_3D("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); -- y = ymax Set_Character_Height(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; x_shear := 0.0; for i in 0 .. nrotation - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrotation); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := 0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsrot * Long_Float(i); Write_Text_World_3D( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u"); end loop; -- x = xmax Set_Character_Height(0.0, 1.0); x_inclination := 0.0; y_inclination := -1.0; z_inclination := 0.0; y_shear := 0.0; for i in 0 .. nrotation - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrotation); sin_omega := sin(omega); cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsrot * Long_Float(i); Write_Text_World_3D( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u"); end loop; -- z = zmin Set_Character_Height(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; x_shear := 0.0; for i in 0 .. nrotation - 1 loop omega := 2.0 * pi * Long_Float(i) / Long_Float(nrotation); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; z_shear := 0.5 * zrange * sin_omega; ys := ysmax - dysrot * Long_Float(i); Write_Text_World_3D( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u"); end loop; -- Draw minimal 3D grid to finish defining the 3D box. Mesh_3D(x, y, z, DRAW_LINEXY); -- Page 3: Demonstrate shear of string along its axis. -- Work around xcairo and pngcairo (but not pscairo) problems for -- shear vector too close to axis of string. (N.B. no workaround -- would be domega := 0.) domega := 0.05; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(-0.15, 1.15, -0.05, 1.05); Set_Viewport_World(-1.2, 1.2, -0.8, 1.5); Set_Up_3D(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); Set_Pen_Color(Yellow); Box_Around_Viewport_3D("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); -- y = ymax Set_Character_Height(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; y_shear := 0.0; for i in 0 .. nshear - 1 loop omega := domega + 2.0 * pi * Long_Float(i) / Long_Float(nshear); sin_omega := sin(omega); cos_omega := cos(omega); x_shear := 0.5 * xrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsshear * Long_Float(i); Write_Text_World_3D( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u"); end loop; -- x = xmax Set_Character_Height(0.0, 1.0); x_inclination := 0.0; y_inclination := -1.0; z_inclination := 0.0; x_shear := 0.0; for i in 0 .. nshear - 1 loop omega := domega + 2.0 * pi * Long_Float(i) / Long_Float(nshear); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := -0.5 * yrange * sin_omega; z_shear := 0.5 * zrange * cos_omega; zs := zsmax - dzsshear * Long_Float(i); Write_Text_World_3D( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u"); end loop; -- z = zmin Set_Character_Height(0.0, 1.0); x_inclination := 1.0; y_inclination := 0.0; z_inclination := 0.0; z_shear := 0.0; for i in 0 .. nshear - 1 loop omega := domega + 2.0 * pi * Long_Float(i) / Long_Float(nshear); sin_omega := sin(omega); cos_omega := cos(omega); y_shear := 0.5 * yrange * cos_omega; x_shear := 0.5 * xrange * sin_omega; ys := ysmax - dysshear * Long_Float(i); Write_Text_World_3D( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u"); end loop; -- Draw minimal 3D grid to finish defining the 3D box. Mesh_3D(x, y, z, DRAW_LINEXY); -- Page 4: Demonstrate drawing a string on a 3D path. Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(-0.15, 1.15, -0.05, 1.05); Set_Viewport_World(-1.2, 1.2, -0.8, 1.5); Set_Up_3D(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40.0, -30.0); Set_Pen_Color(Yellow); Box_Around_Viewport_3D("b", "", xmax-xmin, 0, "b", "", ymax-ymin, 0, "bcd", "", zmax-zmin, 0); Set_Character_Height(0.0, 1.2); -- domega controls the spacing between the various characters of the -- string and also the maximum value of omega for the given number -- of characters in pstring. domega := 2.0 * pi / Long_Float(pstring'length); omega := 0.0; -- 3D function is a helix of the given radius and pitch radius := 0.5; pitch := 1.0 / (2.0 * pi); for i in pstring'range loop sin_omega := sin(omega); cos_omega := cos(omega); xpos := xmid + radius * sin_omega; ypos := ymid - radius * cos_omega; zpos := zmin + pitch * omega; -- In general, the inclination is proportional to the derivative of -- the position wrt theta. x_inclination := radius * cos_omega; y_inclination := radius * sin_omega; z_inclination := pitch; -- The shear vector should be perpendicular to the 3D line with Z -- component maximized, but for low pitch a good approximation is -- a constant vector that is parallel to the Z axis. x_shear := 0.0; y_shear := 0.0; z_shear := 1.0; plstring(1) := pstring(i); Write_Text_World_3D( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, plstring); omega := omega + domega; end loop; -- Draw minimal 3D grid to finish defining the 3D box. Mesh_3D(x, y, z, DRAW_LINEXY); -- Page 5: Demonstrate Write_Text_Viewport_3D axis labelling capability. Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(-0.15, 1.15, -0.05, 1.05); Set_Viewport_World(-1.2, 1.2, -0.8, 1.5); Set_Up_3D(1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20.0, 45.0); Set_Pen_Color(Yellow); Box_Around_Viewport_3D("b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0); Set_Character_Height(0.0, 1.0); Write_Text_Viewport_3D("xp", 3.0, 0.5, 0.5, "Arbitrarily displaced"); Write_Text_Viewport_3D("xp", 4.5, 0.5, 0.5, "primary X-axis label"); Write_Text_Viewport_3D("xs", -2.5, 0.5, 0.5, "Arbitrarily displaced"); Write_Text_Viewport_3D("xs", -1.0, 0.5, 0.5, "secondary X-axis label"); Write_Text_Viewport_3D("yp", 3.0, 0.5, 0.5, "Arbitrarily displaced"); Write_Text_Viewport_3D("yp", 4.5, 0.5, 0.5, "primary Y-axis label"); Write_Text_Viewport_3D("ys", -2.5, 0.5, 0.5, "Arbitrarily displaced"); Write_Text_Viewport_3D("ys", -1.0, 0.5, 0.5, "secondary Y-axis label"); Write_Text_Viewport_3D("zp", 4.5, 0.5, 0.5, "Arbitrarily displaced"); Write_Text_Viewport_3D("zp", 3.0, 0.5, 0.5, "primary Z-axis label"); Write_Text_Viewport_3D("zs", -2.5, 0.5, 0.5, "Arbitrarily displaced"); Write_Text_Viewport_3D("zs", -1.0, 0.5, 0.5, "secondary Z-axis label"); -- Draw minimal 3D grid to finish defining the 3D box. Mesh_3D(x, y, z, DRAW_LINEXY); -- Clean up. End_PLplot; end xthick28a; plplot-5.10.0+dfsg/examples/ada/xthick17a.adb 644 1750 1750 1312311543675237 176030ustar andrewandrew-- $Id: xthick17a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Plots a simple stripchart with four pens. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Text_IO, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick17a is autoy, acc : Boolean; pl_errcode : Integer := 0; id1 : Integer; nsteps : Integer := 1000; colbox, collab : Integer; colline, styline : Integer_Array_1D(0 .. 3); y1, y2, y3, y4, ymin, ymax, xlab, ylab : Long_Float; t, tmin, tmax, tjump, dt, noise : Long_Float; legline : Stripchart_Label_String_Array_Type := (To_Unbounded_String("sum"), To_Unbounded_String("sin"), To_Unbounded_String("sin*noi"), To_Unbounded_String("sin+noi")); begin -- plplot initialization -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- If db is used the plot is much more smooth. However, because of the -- async X behaviour, one does not have a real-time scripcharter. -- Set_Command_Line_Option("db", ""); -- Set_Command_Line_Option("np", ""); -- User sets up plot completely except for window and data -- Eventually settings in place when strip chart is created will be -- remembered so that multiple strip charts can be used simultaneously. -- Specify some reasonable defaults for ymin and ymax -- The plot will grow automatically if needed (but not shrink) ymin := -0.1; ymax := 0.1; -- Specify initial tmin and tmax -- this determines length of window. -- Also specify maximum jump in t -- This can accomodate adaptive timesteps tmin := 0.0; tmax := 10.0; tjump := 0.3; -- percentage of plot to jump -- Axes options same as Box_Around_Viewport. -- Only automatic tick generation and label placement allowed. -- Eventually I'll make this fancier. colbox := 1; collab := 3; styline(0) := 2; -- pens line style styline(1) := 3; styline(2) := 4; styline(3) := 5; colline(0) := 2; -- pens color colline(1) := 3; colline(2) := 4; colline(3) := 5; xlab := 0.0; -- legend position ylab := 0.25; autoy := True; -- autoscale y acc := True; -- don't scrip, accumulate -- Initialize plplot Initialize_PLplot; Advance_To_Subpage(Next_Subpage); Set_Viewport_Standard; -- Register our error variables with PLplot -- From here on, we're handling all errors here -- plsError(pl_errcode, errmsg); -- Ada note: plsError is not yet implemented in Ada. Thus, pl_errcode is -- hardwired to 0 for now and no effective error handling is done. Create_Stripchart(id1, "bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo"); -- Ada note: this would handle errors if error handling were implemented. if pl_errcode /= 0 then Put_Line("There was a problem which caused the program to quit."); End_PLplot; return; end if; -- Let plplot handle errors from here on -- plsError(NULL, NULL); autoy := False; -- autoscale y acc := True; -- accumulate -- This is to represent a loop over time -- Let's try a random walk process y1 := 0.0; y2 := 0.0; y3 := 0.0; y4 := 0.0; dt := 0.1; for n in 0 .. nsteps - 1 loop -- The Ada standard requires that the delay statement have a granularity -- of at most 20 ms but strongly recommends at most 100 microseconds. -- We'll try 10 ms to match the C example, x17c, but in theory this -- might fail to compile on some Ada systems. If so, the cure is to set -- the delay to 0.02. delay 0.01; -- wait a little (10 ms) to simulate time elapsing t := Long_Float(n) * dt; noise := Random_Number- 0.5; y1 := y1 + noise; y2 := sin(t * pi / 18.0); y3 := y2 * noise; y4 := y2 + noise / 3.0; -- There is no need for all pens to have the same number of -- points or being equally time spaced. if n mod 2 /= 0 then Update_Stripchart(id1, 0, t, y1); end if; if n mod 3 /= 0 then Update_Stripchart(id1, 1, t, y2); end if; if n mod 4 /= 0 then Update_Stripchart(id1, 2, t, y3); end if; if n mod 5 /= 0 then Update_Stripchart(id1, 3, t, y4); end if; -- Eject_Current_Page; -- use double buffer (-db on command line) end loop; -- Destroy strip chart and its memory Delete_Stripchart(id1); End_PLplot; end xthick17a; plplot-5.10.0+dfsg/examples/ada/x31a.adb 644 1750 1750 2421611543675237 165610ustar andrewandrew-- $Id: x31a.adb 11680 2011-03-27 17:57:51Z airwin $ -- set/get tester -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Long_Float_Text_IO, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Text_IO, Ada.Long_Float_Text_IO, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; -- This example mostly outputs text. As part of the PLplot testing regime, we -- require that the text output match that of the C version, x31c.c, exactly. -- Therefore, certain extra measures were made in this Ada version to assure -- that matching text is created. procedure x31a is xmin, xmax, ymin, ymax, zxmin, zxmax, zymin, zymax : Long_Float; xmid, ymid, wx, wy : Long_Float; mar, aspect, jx, jy, ori : Long_Float; win, level2, digmax, digit, compression1, compression2 : Integer; xp0, yp0, xp1, yp1, xp2, yp2 : Long_Float; xleng0, yleng0, xoff0, yoff0 : Integer; xleng1, yleng1, xoff1, yoff1, xleng2, yleng2, xoff2, yoff2 : Integer; num0, bmax0, num1, bmax1, num2, bmax2, r, g, b : Integer; fam0, fam1, fam2 : Boolean; a : Long_Float; r1 : Integer_0_255_Array(0 .. 1) := (0, 255); g1 : Integer_0_255_Array(0 .. 1) := (0, 255); b1 : Integer_0_255_Array(0 .. 1) := (0, 0); a1 : Real_Vector(0 .. 1) := (1.0, 1.0); status : Integer; fnam : Unbounded_String; -- Convert a boolean to integers 0 or 1. function Boolean_To_Integer(B : Boolean) return Integer is begin if B then return 1; else return 0; end if; end Boolean_To_Integer; -- Function to return a formated float that looks like what C does. function PF(x : Long_Float) return String is A_String : String(1 .. 30); begin Put(A_String, x, Aft => 6, Exp => 0); return Trim(A_String, Left); end PF; begin -- Parse and process command line arguments status := 0; plparseopts(PL_PARSE_FULL); -- Test setting / getting familying parameters before plinit. -- Save values set by plparseopts to be restored later. plgfam(fam0, num0, bmax0); fam1 := False; num1 := 10; bmax1 := 1000; plsfam(fam1, num1, bmax1); -- Retrieve the same values? plgfam(fam2, num2, bmax2); Put_Line("family parameters: fam, num, bmax =" & Integer'image(Boolean_To_Integer(fam2)) & Integer'image(num2) & Integer'image(bmax2)); if fam2 /= fam1 or num2 /= num1 or bmax2 /= bmax1 then Put_Line(Standard_Error, "plgfam test failed"); status := 1; end if; -- Restore values set initially by plparseopts. plsfam(fam0, num0, bmax0); -- Test setting / getting page parameters before plinit. -- Save values set by plparseopts to be restored later. plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); xp1 := 200.0; yp1 := 200.0; xleng1 := 400; yleng1 := 200; xoff1 := 10; yoff1 := 20; plspage(xp1, yp1, xleng1, yleng1, xoff1, yoff1); -- Retrieve the same values? plgpage(xp2, yp2, xleng2, yleng2, xoff2, yoff2); Put("page parameters: xp, yp, xleng, yleng, xoff, yoff = " & PF(xp2) & " " & PF(yp2)); Put_Line(Integer'image(xleng2) & Integer'image(yleng2) & Integer'image(xoff2) & Integer'image(yoff2)); if xp2 /= xp1 or yp2 /= yp1 or xleng2 /= xleng1 or yleng2 /= yleng1 or xoff2 /= xoff1 or yoff2 /= yoff1 then Put_Line(Standard_Error, "plgpage test failed"); status := 1; end if; -- Restore values set initially by plparseopts. plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); -- Test setting / getting compression parameter across plinit. compression1 := 95; plscompression(compression1); -- Initialize plplot. plinit; -- Test if device initialization screwed around with the preset -- compression parameter. plgcompression(compression2); Put_Line("Output various PLplot parameters"); Put_Line("compression parameter =" & Integer'image(compression2)); if (compression2 /= compression1) then Put_Line(Standard_Error, "plgcompression test failed"); status := 1; end if; -- Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure -- they work without any obvious error messages. plscolor(True); plscol0(1, 255, 0, 0); plscmap1(r1, g1, b1); plscmap1a(r1, g1, b1, a1); plglevel(level2); Put_Line("level parameter =" & Integer'image(level2)); if (level2 /= 1) then Put_Line(Standard_Error, "plglevel test failed."); status := 1; end if; pladv(0); plvpor(0.01, 0.99, 0.02, 0.49); plgvpd(xmin, xmax, ymin, ymax); Put_Line("plvpor: xmin, xmax, ymin, ymax = " & PF(xmin) & " " & PF(xmax) & " " & PF(ymin) & " " & PF(ymax)); if xmin /= 0.01 or xmax /= 0.99 or ymin /= 0.02 or ymax /= 0.49 then Put_Line(Standard_Error, "plgvpd test failed"); status := 1; end if; xmid := 0.5 * (xmin + xmax); ymid := 0.5 * (ymin + ymax); plwind(0.2, 0.3, 0.4, 0.5); plgvpw(xmin, xmax, ymin, ymax); Put_Line("plwind: xmin, xmax, ymin, ymax = " & PF(xmin) & " " & PF(xmax) & " " & PF(ymin) & " " & PF(ymax)); if xmin /= 0.2 or xmax /= 0.3 or ymin /= 0.4 or ymax /= 0.5 then Put_Line(Standard_Error, "plgvpw test failed"); status := 1; end if; -- Get world coordinates for middle of viewport. plcalc_world(xmid,ymid,wx,wy,win); Put_Line("world parameters: wx, wy, win = " & PF(wx) & " " & PF(wy) & Integer'image(win)); if abs(wx-0.5*(xmin+xmax))>1.0E-5 or abs(wy-0.5*(ymin+ymax))>1.0E-5 then Put_Line(Standard_Error, "plcalc_world test failed"); status := 1; end if; -- Retrieve and print the name of the output file (if any). -- This goes to stderr not stdout since it will vary between tests and -- we want stdout to be identical for compare test. fnam := To_Unbounded_String(plgfnam); if fnam = Null_Unbounded_String then Put_Line("No output file name is set"); else Put_Line("Output file name read"); end if; Put_Line(Standard_Error, "Output file name is " & plgfnam); -- Set and get the number of digits used to display axis labels. -- Note digit is currently ignored in pls[xyz]ax and -- therefore it does not make sense to test the returned value. plsxax(3, 0); plgxax(digmax, digit); Put_Line("x axis parameters: digmax, digits =" & Integer'image(digmax) & Integer'image(digit)); if digmax /= 3 then Put_Line(Standard_Error, "plgxax test failed"); status := 1; end if; plsyax(4, 0); plgyax(digmax, digit); Put_Line("y axis parameters: digmax, digits =" & Integer'image(digmax) & Integer'image(digit)); if digmax /= 4 then Put_Line(Standard_Error, "plgyax test failed"); status := 1; end if; plszax(5, 0); plgzax(digmax, digit); Put_Line("z axis parameters: digmax, digits =" & Integer'image(digmax) & Integer'image(digit)); if digmax /= 5 then Put_Line(Standard_Error, "plgzax test failed"); status := 1; end if; plsdidev(0.05, PL_NOTSET, 0.1, 0.2); plgdidev(mar, aspect, jx, jy); Put_Line("device-space window parameters: mar, aspect, jx, jy = " & PF(mar) & " " & PF(aspect) & " " & PF(jx) & " " & PF(jy)); if mar /= 0.05 or jx /= 0.1 or jy /= 0.2 then Put_Line(Standard_Error, "plgdidev test failed"); status := 1; end if; plsdiori(1.0); plgdiori(ori); Put_Line("ori parameter = " & PF(ori)); if ori /= 1.0 then Put_Line(Standard_Error, "plgdiori test failed"); status := 1; end if; plsdiplt(0.1, 0.2, 0.9, 0.8); plgdiplt(xmin, ymin, xmax, ymax); Put_Line("plot-space window parameters: xmin, ymin, xmax, ymax = " & PF(xmin) & " " & PF(ymin) & " " & PF(xmax) & " " & PF(ymax)); if xmin /= 0.1 or xmax /= 0.9 or ymin /= 0.2 or ymax /= 0.8 then Put_Line(Standard_Error, "plgdiplt test failed"); status := 1; end if; plsdiplz(0.1, 0.1, 0.9, 0.9); plgdiplt(zxmin, zymin, zxmax, zymax); Put_Line("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = " & PF(zxmin) & " " & PF(zymin) & " " & PF(zxmax) & " " & PF(zymax)); if abs(zxmin - (xmin + (xmax - xmin) * 0.1)) > 1.0E-5 or abs(zxmax - (xmin + (xmax - xmin) * 0.9)) > 1.0E-5 or abs(zymin - (ymin + (ymax - ymin) * 0.1)) > 1.0E-5 or abs(zymax - (ymin + (ymax - ymin) * 0.9)) > 1.0E-5 then Put_Line(Standard_Error, "plsdiplz test failed"); status := 1; end if; plscolbg(10, 20, 30); plgcolbg(r, g, b); Put_Line("background colour parameters: r, g, b =" & Integer'image(r) & Integer'image(g) & Integer'image(b)); if r /= 10 or g /= 20 or b /= 30 then Put_Line(Standard_Error, "plgcolbg test failed"); status := 1; end if; plscolbga(20, 30, 40, 0.5); plgcolbga(r, g, b, a); Put_Line("background/transparency colour parameters: r, g, b, a =" & Integer'image(r) & Integer'image(g) & Integer'image(b) & " " & PF(a)); if r /= 20 or g /= 30 or b /= 40 or a /= 0.5 then Put_Line(Standard_Error, "plgcolbga test failed"); status := 1; end if; plend; end x31a; plplot-5.10.0+dfsg/examples/ada/xthick08a.adb 644 1750 1750 1407312012305413 175620ustar andrewandrew-- $Id: xthick08a.adb 12212 2012-08-13 23:17:31Z airwin $ -- 3-d plot demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; procedure xthick08a is XPTS : Integer := 35; YPTS : Integer := 46; x : Real_Vector(0 .. XPTS - 1); y : Real_Vector(0 .. YPTS - 1); z : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); xx, yy, r : Long_Float; zmin, zmax, step : Long_Float; LEVELS : Integer := 10; clevel: Real_Vector(0 .. LEVELS - 1); nlevel : Integer := LEVELS; rosen : Boolean := True; sombrero : Boolean := False; alt : Real_Vector(0 .. 1) := (60.0, 20.0); az : Real_Vector(0 .. 1) := (30.0, 60.0); title : array(0 .. 1) of String(1 .. 35) := ("#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60"); ------------------------------------------------------------------------------ -- cmap1_init1 -- Initializes color map 1 in HLS space. -- Basic grayscale variation from half-dark (which makes more interesting -- looking plot compared to dark) to light. -- An interesting variation on this: -- s[1] = 1.0 ---------------------------------------------------------------------------- procedure cmap1_init(gray : Boolean) is i, h, l, s : Real_Vector(0 .. 1); begin i(0) := 0.0; -- left boundary i(1) := 1.0; -- right boundary if gray then h(0) := 0.0; -- hue -- low: red (arbitrary if s=0) h(1) := 0.0; -- hue -- high: red (arbitrary if s=0) l(0) := 0.5; -- lightness -- low: half-dark l(1) := 1.0; -- lightness -- high: light s(0) := 0.0; -- minimum saturation s(1) := 0.0; -- minimum saturation else h(0) := 240.0; -- blue -> green -> yellow -> h(1) := 0.0; -- -> red l(0) := 0.6; l(1) := 0.6; s(0) := 0.8; s(1) := 0.8; end if; Set_Number_Of_Colors_In_Color_Map_1(256); Set_Color_Map_1_Piecewise(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init; begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); if sombrero then rosen := False; end if; -- Initialize plplot Initialize_PLplot; for i in x'range loop x(i) := Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); if rosen then x(i) := x(i) * 1.5; end if; end loop; for i in y'range loop y(i) := Long_Float(i - YPTS / 2) / Long_Float(YPTS / 2); if rosen then y(i) := y(i) + 0.5; end if; end loop; for i in x'range loop xx := x(i); for j in y'range loop yy := y(j); if rosen then z(i, j) := (1.0 - xx) * (1.0 - xx) + 100.0 * (yy - (xx * xx)) * (yy - (xx * xx)); -- The log argument may be zero for just the right grid. if z(i, j) > 0.0 then z(i, j) := log(z(i, j)); else z(i, j) := -5.0; -- -MAXFLOAT would mess-up up the scale end if; else -- Sombrero is True. r := sqrt(xx * xx + yy * yy); z(i, j) := exp(-r * r) * cos(2.0 * pi * r); end if; end loop; -- j end loop; -- i zmin := Matrix_Min(z); zmax := Matrix_Max(z); step := (zmax - zmin) / Long_Float(nlevel + 1); for i in clevel'range loop clevel(i) := zmin + step + step * Long_Float(i); end loop; Set_Light_Source(1.0, 1.0, 1.0); for k in alt'range loop for ifshade in 0 .. 3 loop Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.9); Set_Viewport_World(-1.0, 1.0, -0.9, 1.1); Set_Pen_Color(Green); Write_Text_Viewport("t", 1.0, 0.5, 0.5, title(k)); Set_Pen_Color(Red); if rosen then Set_Up_3D(1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt(k), az(k)); else Set_Up_3D(1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt(k), az(k)); end if; Box_Around_Viewport_3D("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0); Set_Pen_Color(Yellow); if ifshade = 0 then -- diffuse light surface plot cmap1_init(True); Shaded_Surface_3D(x, y, z, 0, clevel); -- clevel is not used here elsif ifshade = 1 then -- magnitude colored plot cmap1_init(False); Shaded_Surface_3D(x, y, z, MAG_COLOR, clevel); elsif ifshade = 2 then -- magnitude colored plot with faceted squares cmap1_init(False); Shaded_Surface_3D(x, y, z, MAG_COLOR + FACETED, clevel); else -- magnitude colored plot with contours cmap1_init(False); Shaded_Surface_3D(x, y, z, MAG_COLOR + SURF_CONT + BASE_CONT, clevel); end if; end loop; -- ifshade end loop; -- k End_PLplot; end xthick08a; plplot-5.10.0+dfsg/examples/ada/xthick30a.adb 644 1750 1750 1134612012305413 175550ustar andrewandrew-- $Id: xthick30a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Alpha color values demonstration -- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick30a is red : Integer_Array_1D(0 .. 3) := ( 0, 255, 0, 0); green : Integer_Array_1D(0 .. 3) := ( 0, 0, 255, 0); blue : Integer_Array_1D(0 .. 3) := ( 0, 0, 0, 255); alpha : Real_Vector(0 .. 3) := (1.0, 1.0, 1.0, 1.0); px : Real_Vector(0 .. 3) := (0.1, 0.5, 0.5, 0.1); py : Real_Vector(0 .. 3) := (0.1, 0.1, 0.5, 0.5); pos : Real_Vector(0 .. 1) := (0.0, 1.0); rcoord : Real_Vector(0 .. 1) := (1.0, 1.0); gcoord : Real_Vector(0 .. 1) := (0.0, 0.0); bcoord : Real_Vector(0 .. 1) := (0.0, 0.0); acoord : Real_Vector(0 .. 1) := (0.0, 1.0); icol, r, g, b : Integer; a : Long_Float; begin Parse_Command_Line_Arguments(Parse_Full); Initialize_PLplot; Set_Number_Of_Colors_Map_0(4); Set_Color_Map_0_And_Alpha(red, green, blue, alpha); -- Page 1: -- This is a series of red, green and blue rectangles overlaid -- on each other with gradually increasing transparency. -- Set up the window Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Set_Pen_Color(Black); Box_Around_Viewport("", 1.0, 0, "", 1.0, 0); -- Draw the boxes for i in 0 .. 8 loop icol := i mod 3 + 1; -- Get a color, change its transparency and set it as the current color. Get_Color_RGB_And_Alpha(icol, r, g, b, a); Set_One_Color_Map_0_And_Alpha(icol, r, g, b, 1.0 - Long_Float(i) / 9.0); Set_Pen_Color(icol); -- Draw the rectangle Fill_Polygon(px, py); -- Shift the rectangles coordinates for j in px'range loop px(j) := px(j) + 0.5 / 9.0; py(j) := py(j) + 0.5 / 9.0; end loop; end loop; -- Page 2: -- This is a bunch of boxes colored red, green or blue with a single -- large (red) box of linearly varying transparency overlaid. The -- overlaid box is completely transparent at the bottom and completely -- opaque at the top. -- Set up the window Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); -- Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for i in 0 .. 4 loop -- Set box X position. px(0) := 0.05 + 0.2 * Long_Float(i); px(1) := px(0) + 0.1; px(2) := px(1); px(3) := px(0); -- We don't want the boxes to be transparent, so since we changed -- the colors transparencies in the first example we have to change -- the transparencies back to completely opaque. icol := i mod 3 + 1; Get_Color_RGB_And_Alpha(icol, r, g, b, a); Set_One_Color_Map_0_And_Alpha(icol, r, g, b, 1.0); Set_Pen_Color(icol); for j in 0 ..4 loop -- Set box y position and draw the box. py(0) := 0.05 + 0.2 * Long_Float(j); py(1) := py(0); py(2) := py(0) + 0.1; py(3) := py(2); Fill_Polygon(px, py); end loop; end loop; -- Create the color map with 128 colors and use Set_Color_Map_1_RGBla to initialize -- the color values with a linearly varying transparency (or alpha). Set_Number_Of_Colors_In_Color_Map_1(128); Set_Color_Map_1_Piecewise_And_Alpha(RGB, pos, rcoord, gcoord, bcoord, acoord, Alt_Hue_Path_None); -- Use that cmap1 to create a transparent red gradient for the whole window. px(0) := 0.0; px(1) := 1.0; px(2) := 1.0; px(3) := 0.0; py(0) := 0.0; py(1) := 0.0; py(2) := 1.0; py(3) := 1.0; Fill_Polygon_Gradient(px, py, 90.0); End_PLplot; end xthick30a; plplot-5.10.0+dfsg/examples/ada/x24a.adb 644 1750 1750 661411543675237 165450ustar andrewandrew-- $Id: x24a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Unicode Pace Flag -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with PLplot_Auxiliary, PLplot_Traditional; use PLplot_Auxiliary, PLplot_Traditional; procedure x24a is red : Integer_Array_1D(0 .. 6) := (240, 204, 204, 204, 0, 39, 125); green : Integer_Array_1D(0 .. 6) := (240, 0, 125, 204, 204, 80, 0); blue : Integer_Array_1D(0 .. 6) := (240, 0, 0, 0, 0, 204, 125); px : Real_Vector(0 .. 3) := (0.0, 0.0, 1.0, 1.0); py : Real_Vector(0 .. 3) := (0.0, 0.25, 0.25, 0.0); sx : Real_Vector(0 .. 11) := ( 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647); sy : Real_Vector(0 .. 11) := ( 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875); -- Taken from http://www.columbia.edu/~fdc/pace/ function peace(which : Integer) return String is begin -- Mandarin if which = 0 then return "#<0x00>和平"; end if; -- Hindi if which = 1 then return "#<0x20>शांति"; end if; -- English if which = 2 then return "#<0x10>Peace"; end if; -- Hebrew if which = 3 then return "#<0x10>שלום"; end if; -- Russian if which = 4 then return "#<0x10>Мир"; end if; -- German if which = 5 then return "#<0x10>Friede"; end if; -- Korean if which = 6 then return "#<0x30>평화"; end if; -- French if which = 7 then return "#<0x10>Paix"; end if; -- Spanish if which = 8 then return "#<0x10>Paz"; end if; -- Arabic if which = 9 then return "#<0x10>ﺳﻼم"; end if; -- Turkish if which = 10 then return "#<0x10>Barış"; end if; -- Kurdish if which = 11 then return "#<0x10>Hasîtî"; end if; return "oops"; end peace; begin plparseopts(PL_PARSE_FULL); plinit; pladv(0); plvpor(0.0, 1.0, 0.0, 1.0); plwind(0.0, 1.0, 0.0, 1.0); plcol0(0); plbox("", 1.0, 0, "", 1.0, 0); plscmap0n(7); plscmap0(red, green, blue); plschr(0.0, 4.0); plfont(1); for i in 0 .. 3 loop plcol0(i + 1); plfill(4, px, py); for j in 0 .. 3 loop py(j) := py(j) + 1.0 / 4.0; end loop; end loop; plcol0(0); for i in 0 .. 11 loop plptex(sx(i), sy(i), 1.0, 0.0, 0.5, peace(i)); end loop; plend; end x24a; plplot-5.10.0+dfsg/examples/ada/xthick31a.adb 644 1750 1750 2606711543675237 176120ustar andrewandrew-- $Id: xthick31a.adb 11680 2011-03-27 17:57:51Z airwin $ -- set/get tester -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Text_IO, Ada.Long_Float_Text_IO, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Text_IO, Ada.Long_Float_Text_IO, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; -- This example mostly outputs text. As part of the PLplot testing regime, we -- require that the text output match that of the C version, x31c.c, exactly. -- Therefore, certain extra measures were made in this Ada version to assure -- that matching text is created. procedure xthick31a is xmin, xmax, ymin, ymax, zxmin, zxmax, zymin, zymax : Long_Float; xmid, ymid, wx, wy : Long_Float; mar, aspect, jx, jy, ori : Long_Float; win, level2, digmax, digit, compression1, compression2 : Integer; xp0, yp0, xp1, yp1, xp2, yp2 : Long_Float; xleng0, yleng0, xoff0, yoff0 : Integer; xleng1, yleng1, xoff1, yoff1, xleng2, yleng2, xoff2, yoff2 : Integer; num0, bmax0, num1, bmax1, num2, bmax2, r, g, b : Integer; fam0, fam1, fam2 : Boolean; a : Long_Float; r1 : Integer_0_255_Array(0 .. 1) := (0, 255); g1 : Integer_0_255_Array(0 .. 1) := (0, 255); b1 : Integer_0_255_Array(0 .. 1) := (0, 0); a1 : Real_Vector(0 .. 1) := (1.0, 1.0); status : Integer; fnam : Unbounded_String; -- Convert a boolean to integers 0 or 1. function Boolean_To_Integer(B : Boolean) return Integer is begin if B then return 1; else return 0; end if; end Boolean_To_Integer; -- Function to return a formated float that looks like what C does. function PF(x : Long_Float) return String is A_String : String(1 .. 30); begin Put(A_String, x, Aft => 6, Exp => 0); return Trim(A_String, Left); end PF; begin -- Parse and process command line arguments status := 0; Parse_Command_Line_Arguments(Parse_Full); -- Test setting / getting familying parameters before plinit. -- Save values set by plparseopts to be restored later. Get_File_Family_Parameters(fam0, num0, bmax0); fam1 := False; num1 := 10; bmax1 := 1000; Set_File_Family_Parameters(fam1, num1, bmax1); -- Retrieve the same values? Get_File_Family_Parameters(fam2, num2, bmax2); Put_Line("family parameters: fam, num, bmax =" & Integer'image(Boolean_To_Integer(fam2)) & Integer'image(num2) & Integer'image(bmax2)); if fam2 /= fam1 or num2 /= num1 or bmax2 /= bmax1 then Put_Line(Standard_Error, "Get_File_Family_Parameters test failed"); status := 1; end if; -- Restore values set initially by plparseopts. Set_File_Family_Parameters(fam0, num0, bmax0); -- Test setting / getting page parameters before plinit. -- Save values set by plparseopts to be restored later. Get_Page_Parameters(xp0, yp0, xleng0, yleng0, xoff0, yoff0); xp1 := 200.0; yp1 := 200.0; xleng1 := 400; yleng1 := 200; xoff1 := 10; yoff1 := 20; Set_Page_Parameters(xp1, yp1, xleng1, yleng1, xoff1, yoff1); -- Retrieve the same values? Get_Page_Parameters(xp2, yp2, xleng2, yleng2, xoff2, yoff2); Put("page parameters: xp, yp, xleng, yleng, xoff, yoff = " & PF(xp2) & " " & PF(yp2)); Put_Line(Integer'image(xleng2) & Integer'image(yleng2) & Integer'image(xoff2) & Integer'image(yoff2)); if xp2 /= xp1 or yp2 /= yp1 or xleng2 /= xleng1 or yleng2 /= yleng1 or xoff2 /= xoff1 or yoff2 /= yoff1 then Put_Line(Standard_Error, "Get_Page_Parameters test failed"); status := 1; end if; -- Restore values set initially by plparseopts. Set_Page_Parameters(xp0, yp0, xleng0, yleng0, xoff0, yoff0); -- Test setting / getting compression parameter across Initialize_PLplot. compression1 := 95; Set_Compression_Level(compression1); -- Initialize plplot. Initialize_PLplot; -- Test if device initialization screwed around with the preset -- compression parameter. Get_Compression_Level(compression2); Put_Line("Output various PLplot parameters"); Put_Line("compression parameter =" & Integer'image(compression2)); if (compression2 /= compression1) then Put_Line(Standard_Error, "Get_Compression_Level test failed"); status := 1; end if; -- Exercise Enable_Color_Output, Set_One_Color_Map_0, Set_Color_Map_1_RGB, and Set_Color_Map_1_RGBa to make sure -- they work without any obvious error messages. Enable_Color_Output(True); Set_One_Color_Map_0(1, 255, 0, 0); Set_Color_Map_1_RGB(r1, g1, b1); Set_Color_Map_1_RGB_And_Alpha(r1, g1, b1, a1); Get_Run_Level(level2); Put_Line("level parameter =" & Integer'image(level2)); if (level2 /= 1) then Put_Line(Standard_Error, "Get_Run_Level test failed."); status := 1; end if; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.01, 0.99, 0.02, 0.49); Get_Viewport_Normalized(xmin, xmax, ymin, ymax); Put_Line("plvpor: xmin, xmax, ymin, ymax = " & PF(xmin) & " " & PF(xmax) & " " & PF(ymin) & " " & PF(ymax)); if xmin /= 0.01 or xmax /= 0.99 or ymin /= 0.02 or ymax /= 0.49 then Put_Line(Standard_Error, "Get_Viewport_Normalized test failed"); status := 1; end if; xmid := 0.5 * (xmin + xmax); ymid := 0.5 * (ymin + ymax); Set_Viewport_World(0.2, 0.3, 0.4, 0.5); Get_Viewport_World(xmin, xmax, ymin, ymax); Put_Line("plwind: xmin, xmax, ymin, ymax = " & PF(xmin) & " " & PF(xmax) & " " & PF(ymin) & " " & PF(ymax)); if xmin /= 0.2 or xmax /= 0.3 or ymin /= 0.4 or ymax /= 0.5 then Put_Line(Standard_Error, "Get_Viewport_World test failed"); status := 1; end if; -- Get world coordinates for middle of viewport. World_From_Relative_Coordinates(xmid,ymid,wx,wy,win); Put_Line("world parameters: wx, wy, win = " & PF(wx) & " " & PF(wy) & Integer'image(win)); if abs(wx-0.5*(xmin+xmax))>1.0E-5 or abs(wy-0.5*(ymin+ymax))>1.0E-5 then Put_Line(Standard_Error, "World_From_Relative_Coordinates test failed"); status := 1; end if; -- Retrieve and print the name of the output file (if any). -- This goes to stderr not stdout since it will vary between tests and -- we want stdout to be identical for compare test. fnam := To_Unbounded_String(Get_Output_File_Name); if fnam = Null_Unbounded_String then Put_Line("No output file name is set"); else Put_Line("Output file name read"); end if; Put_Line(Standard_Error, "Output file name is " & Get_Output_File_Name); -- Set and get the number of digits used to display axis labels. -- Note digit is currently ignored in pls[xyz]ax and -- therefore it does not make sense to test the returned value. Set_Floating_Point_Display_X(3, 0); Get_X_Label_Parameters(digmax, digit); Put_Line("x axis parameters: digmax, digits =" & Integer'image(digmax) & Integer'image(digit)); if digmax /= 3 then Put_Line(Standard_Error, "Get_X_Label_Parameters test failed"); status := 1; end if; Set_Floating_Point_Display_Y(4, 0); Get_Y_Label_Parameters(digmax, digit); Put_Line("y axis parameters: digmax, digits =" & Integer'image(digmax) & Integer'image(digit)); if digmax /= 4 then Put_Line(Standard_Error, "Get_Y_Label_Parameters test failed"); status := 1; end if; Set_Floating_Point_Display_Z(5, 0); Get_Z_Label_Parameters(digmax, digit); Put_Line("z axis parameters: digmax, digits =" & Integer'image(digmax) & Integer'image(digit)); if digmax /= 5 then Put_Line(Standard_Error, "Get_Z_Label_Parameters test failed"); status := 1; end if; Set_Device_Window_Parameters(0.05, PL_NOTSET, 0.1, 0.2); Get_Device_Window_Parameters(mar, aspect, jx, jy); Put_Line("device-space window parameters: mar, aspect, jx, jy = " & PF(mar) & " " & PF(aspect) & " " & PF(jx) & " " & PF(jy)); if mar /= 0.05 or jx /= 0.1 or jy /= 0.2 then Put_Line(Standard_Error, "Get_Device_Window_Parameters test failed"); status := 1; end if; Set_Plot_Orientation(1.0); Get_Plot_Orientation(ori); Put_Line("ori parameter = " & PF(ori)); if ori /= 1.0 then Put_Line(Standard_Error, "Get_Plot_Orientation test failed"); status := 1; end if; Set_Device_Window_Extrema(0.1, 0.2, 0.9, 0.8); Get_Device_Window_Extrema(xmin, ymin, xmax, ymax); Put_Line("plot-space window parameters: xmin, ymin, xmax, ymax = " & PF(xmin) & " " & PF(ymin) & " " & PF(xmax) & " " & PF(ymax)); if xmin /= 0.1 or xmax /= 0.9 or ymin /= 0.2 or ymax /= 0.8 then Put_Line(Standard_Error, "Get_Device_Window_Extrema test failed"); status := 1; end if; Set_Zoom(0.1, 0.1, 0.9, 0.9); Get_Device_Window_Extrema(zxmin, zymin, zxmax, zymax); Put_Line("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = " & PF(zxmin) & " " & PF(zymin) & " " & PF(zxmax) & " " & PF(zymax)); if abs(zxmin - (xmin + (xmax - xmin) * 0.1)) > 1.0E-5 or abs(zxmax - (xmin + (xmax - xmin) * 0.9)) > 1.0E-5 or abs(zymin - (ymin + (ymax - ymin) * 0.1)) > 1.0E-5 or abs(zymax - (ymin + (ymax - ymin) * 0.9)) > 1.0E-5 then Put_Line(Standard_Error, "Set_Zoom test failed"); status := 1; end if; Set_Background_Color_RGB(10, 20, 30); Get_Background_Color_RGB(r, g, b); Put_Line("background colour parameters: r, g, b =" & Integer'image(r) & Integer'image(g) & Integer'image(b)); if r /= 10 or g /= 20 or b /= 30 then Put_Line(Standard_Error, "Get_Background_Color_RGB test failed"); status := 1; end if; Set_Background_Color_RGB_And_Alpha(20, 30, 40, 0.5); Get_Background_Color_RGB_And_Alpha(r, g, b, a); Put_Line("background/transparency colour parameters: r, g, b, a =" & Integer'image(r) & Integer'image(g) & Integer'image(b) & " " & PF(a)); if r /= 20 or g /= 30 or b /= 40 or a /= 0.5 then Put_Line(Standard_Error, "Get_Background_Color_RGBa test failed"); status := 1; end if; End_PLplot; end xthick31a; plplot-5.10.0+dfsg/examples/ada/x22a.adb 644 1750 1750 3135112252557340 165470ustar andrewandrew-- $Id: x22a.adb 12862 2013-12-13 10:18:08Z jbauck $ -- Simple vector plot example -- Copyright (C) 2008, 2013 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, System.Address_To_Access_Conversions, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, System, PLplot_Traditional, PLplot_Auxiliary; procedure x22a is -- Pairs of points making the line segments used to plot the user defined arrow arrow_x : Real_Vector(0 .. 5) := (-0.5, 0.5, 0.3, 0.5, 0.3, 0.5); arrow_y : Real_Vector(0 .. 5) := ( 0.0, 0.0, 0.2, 0.0, -0.2, 0.0); arrow2_x : Real_Vector(0 .. 5) := (-0.5, 0.3, 0.3, 0.5, 0.3, 0.3); arrow2_y : Real_Vector(0 .. 5) := ( 0.0, 0.0, 0.2, 0.0, -0.2, 0.0); -- Vector plot of the circulation about the origin procedure circulation is dx, dy, x, y : Long_Float; nx : constant Integer := 20; ny : constant Integer := 20; xmin, xmax, ymin, ymax : Long_Float; u, v : Real_Matrix(0 .. nx - 1, 0 .. ny -1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); begin dx := 1.0; dy := 1.0; xmin := Long_Float(-nx / 2) * dx; xmax := Long_Float( nx / 2) * dx; ymin := Long_Float(-ny / 2) * dy; ymax := Long_Float( ny / 2) * dy; -- Create data - circulation around the origin. for i in 0 .. nx - 1 loop x := (Long_Float(i - nx / 2) + 0.5) * dx; for j in 0 .. ny - 1 loop y := (Long_Float(j - ny / 2) + 0.5) * dy; cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; u(i, j) := y; v(i, j) := -x; end loop; end loop; -- Plot vectors with default arrows plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - circulation"); plcol0(2); plvect(u, v, 0.0, pltr2'access, cgrid2'Address); plcol0(1); end circulation; --Vector plot of flow through a constricted pipe procedure constriction(astyle : Integer) is dx, dy, x, y : Long_Float; xmin, xmax, ymin, ymax : Long_Float; Q, b, dbdx : Long_Float; nx : constant Integer := 20; ny : constant Integer := 20; u, v : Real_Matrix(0 .. nx - 1, 0 .. ny -1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); begin dx := 1.0; dy := 1.0; xmin := Long_Float(-nx / 2) * dx; xmax := Long_Float( nx / 2) * dx; ymin := Long_Float(-ny / 2) * dy; ymax := Long_Float( ny / 2) * dy; Q := 2.0; for i in 0 .. nx - 1 loop x := (Long_Float(i - nx / 2) + 0.5) * dx; for j in 0 .. ny - 1 loop y := (Long_Float(j - ny / 2) + 0.5) * dy; cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; b := ymax / 4.0 * (3.0 - cos(pi * x / xmax)); if abs(y) < b then dbdx := ymax / 4.0 * sin(pi * x / xmax) * pi / xmax * y / b; u(i, j) := Q * ymax / b; v(i, j) := dbdx * u(i, j); else u(i, j) := 0.0; v(i, j) := 0.0; end if; end loop; end loop; plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - constriction (arrow style" & Integer'image(astyle) & ")"); plcol0(2); plvect(u, v, -1.0, pltr2'access, cgrid2'Address); plcol0(1); end constriction; -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. procedure transform (x, y : Long_Float; xt, yt : out Long_Float; data : PLPointer); pragma Convention(C, transform); -- Global transform function for a constriction using data passed in -- This is the same transformation used in constriction. procedure transform(x, y : Long_Float; xt, yt : out Long_Float; Data : PLPointer) is -- Convert the generic pointer represented as System.Address to a proper Ada pointer aka -- access variable. Recall that PLpointer is a subtype of System.Address. package Data_Address_Conversions is new System.Address_To_Access_Conversions(Long_Float); Data_Pointer : Data_Address_Conversions.Object_Pointer; -- An Ada access variable xmax : Long_Float; begin Data_Pointer := Data_Address_Conversions.To_Pointer(Data); xmax := Data_Pointer.all; xt := x; yt := y / 4.0 * (3.0 - cos(Pi * x / xmax)); end transform; -- Vector plot of flow through a constricted pipe with a coordinate transform procedure constriction2 is dx, dy, x, y : Long_Float; xmin, xmax, ymin, ymax : Long_Float; Q, b : Long_Float; nx : constant Integer := 20; ny : constant Integer := 20; cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); u, v : Real_Matrix(0 .. nx - 1, 0 .. ny - 1); nc : constant Integer := 11; nseg : constant Integer := 20; clev : Real_Vector(0 .. nc - 1); begin dx := 1.0; dy := 1.0; xmin := Long_Float(-nx / 2) * dx; -- Careful; Ada / rounds, C / truncates. xmax := Long_Float( nx / 2) * dx; ymin := Long_Float(-ny / 2) * dy; ymax := Long_Float( ny / 2) * dy; plstransform(transform'Unrestricted_Access, xmax'Address); cgrid2.nx := nx; cgrid2.ny := ny; Q := 2.0; for i in 0 .. nx - 1 loop x := (Long_Float(i - nx / 2) + 0.5) * dx; for j in 0 .. ny - 1 loop y := (Long_Float(j - ny / 2) + 0.5) * dy; cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; b := ymax / 4.0 * (3.0 - cos(Pi * x / xmax)); u(i, j) := Q * ymax / b; v(i, j) := 0.0; end loop; end loop; for i in 0 .. nc - 1 loop clev(i) := Q + Long_Float(i) * Q / Long_Float(nc - 1); end loop; plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform"); plcol0(2); plshades(u, Null, xmin + dx / 2.0, xmax - dx / 2.0, ymin + dy / 2.0, ymax - dy / 2.0, clev, 0.0, 1, 1.0, plfill'access, False, Null, System.Null_Address); plvect(u, v, -1.0, pltr2'access, cgrid2'Address); -- Plot edges using plpath (which accounts for coordinate transformation) rather than plline plpath(nseg, xmin, ymax, xmax, ymax); plpath(nseg, xmin, ymin, xmax, ymin); plcol0(1); Clear_Custom_Coordinate_Transform; -- or... -- plstransform(null, System.Null_Address); end constriction2; -- Vector plot of the gradient of a shielded potential (see example 9) procedure potential is nper : constant Integer := 100; nlevel : constant Integer := 10; nr : constant Integer := 20; ntheta : constant Integer := 20; eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i : Long_Float; div1, div1i, div2, div2i : Long_Float; r, theta, x, y, dz : Long_Float; xmin, xmax, ymin, ymax, rmax, zmax, zmin : Long_Float; u, v, z : Real_Matrix(0 .. nr - 1, 0 .. ntheta - 1); px, py : Real_Vector(0 .. nper - 1); clevel : Real_Vector(0 .. nlevel - 1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nr - 1, y_Last => ntheta - 1); function pow(x, y : Long_Float) return Long_Float is Result : Long_Float := 1.0; begin for i in 1 .. Integer(y) loop Result := Result * x; end loop; return Result; end pow; begin -- Potential inside a conducting cylinder (or sphere) by method of images. -- Charge 1 is placed at (d1, d1), with image charge at (d2, d2). -- Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). -- Also put in smoothing term at small distances. rmax := Long_Float(nr); eps := 2.0; q1 := 1.0; d1 := rmax / 4.0; q1i := - q1 * rmax / d1; d1i := (rmax * rmax) / d1; q2 := -1.0; d2 := rmax / 4.0; q2i := - q2 * rmax / d2; d2i := (rmax * rmax) / d2; for i in 0 .. nr - 1 loop r := 0.5 + Long_Float(i); for j in 0 .. ntheta - 1 loop theta := 2.0 * pi / Long_Float(ntheta - 1) * (0.5 + Long_Float(j)); x := r * cos(theta); y := r * sin(theta); cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; div1 := sqrt(pow(x-d1, 2.0) + pow(y-d1, 2.0) + pow(eps, 2.0)); div1i := sqrt(pow(x-d1i, 2.0) + pow(y-d1i, 2.0) + pow(eps, 2.0)); div2 := sqrt(pow(x-d2, 2.0) + pow(y+d2, 2.0) + pow(eps, 2.0)); div2i := sqrt(pow(x-d2i, 2.0) + pow(y+d2i, 2.0) + pow(eps, 2.0)); z(i, j) := q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; u(i, j) := -q1*(x-d1)/pow(div1, 3.0) - q1i*(x-d1i)/pow(div1i, 3.00) - q2*(x-d2)/pow(div2,3.0) - q2i*(x-d2i)/pow(div2i, 3.0); v(i, j) := -q1*(y-d1)/pow(div1, 3.0) - q1i*(y-d1i)/pow(div1i, 3.00) - q2*(y+d2)/pow(div2, 3.0) - q2i*(y+d2i)/pow(div2i, 3.0); end loop; end loop; xmin := Matrix_Min(cgrid2.xg); xmax := Matrix_Max(cgrid2.xg); ymin := Matrix_Min(cgrid2.yg); ymax := Matrix_Max(cgrid2.yg); zmin := Matrix_Min(z); zmax := Matrix_Max(z); plenv(xmin, xmax, ymin, ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot"); -- Plot contours of the potential dz := (zmax - zmin) / Long_Float(nlevel); for i in clevel'range loop clevel(i) := zmin + (Long_Float(i) + 0.5) * dz; end loop; plcol0(3); pllsty(2); plcont(z, 1, nr, 1, ntheta, clevel, pltr2'access, cgrid2'Address); pllsty(1); plcol0(1); -- Plot the vectors of the gradient of the potential plcol0(2); plvect(u, v, 25.0, pltr2'access, cgrid2'Address); plcol0(1); -- Plot the perimeter of the cylinder for i in px'range loop theta := (2.0 * pi / Long_Float(nper - 1)) * Long_Float(i); px(i) := rmax * cos(theta); py(i) := rmax * sin(theta); end loop; plline(px,py); end potential; ---------------------------------------------------------------------------- -- Generates several simple vector plots. ---------------------------------------------------------------------------- begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; circulation; -- Set arrow style using arrow_x and arrow_y then plot using these arrows. plsvect(arrow_x, arrow_y, False); constriction(1); -- Set arrow style using arrow2_x and arrow2_y then plot using these filled arrows. plsvect(arrow2_x, arrow2_y, True); constriction(2); constriction2; -- Reset arrow style to the default by passing two NULL arrays. -- This line uses the awkward method of the C API to reset the default arrow style. -- plsvect(System.Null_Address, System.Null_Address, False); -- This method of resetting the default arrow style is a little more Ada-friendly... plsvect; -- ... as is this one which is identical but for name. -- Reset_Vector_Arrow_Style; potential; plend; end x22a; plplot-5.10.0+dfsg/examples/ada/x19a.adb 644 1750 1750 2220712221050115 165350ustar andrewandrew-- $Id: x19a.adb 12532 2013-09-26 15:18:37Z andrewross $ -- Illustrates backdrop plotting of world, US maps. -- Contributed by Wesley Ebisuzaki. -- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Text_IO, Interfaces.C, System.Storage_Elements, Ada.Strings, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings.Unbounded, PLplot_Auxiliary, PLplot_Traditional; use Text_IO, Interfaces.C, System.Storage_Elements, Ada.Strings, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings.Unbounded, PLplot_Auxiliary, PLplot_Traditional; -- Shows two views of the world map. procedure x19a is minx, maxx, miny, maxy : Long_Float; x, y : Real_Vector(1 .. 1); -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. procedure map_transform (x, y : Long_Float; xt, yt : out Long_Float; data : PLPointer); pragma Convention(C, map_transform); procedure map_transform (x, y : Long_Float; xt, yt : out Long_Float; data : PLPointer) is radius : Long_Float; begin radius := 90.0 - y; xt := radius * cos(x * pi / 180.0); yt := radius * sin(x * pi / 180.0); end map_transform; -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array); pragma Convention(C, mapform19); -- Defines specific coordinate transformation for example 19. -- Not to be confused with mapform in src/plmap.c. -- x(), y() are the coordinates to be plotted. -- Ada note: Passing the array length as the first argument is the easiest -- way (for the developer of the bindings) and maintain a C-compatible -- argument list. It might be possible to instead pass a pointer to something -- with an argument list (x, y : in out Real_Vector) instead, and write a -- wrapper function inside plmap and plmeridians that has the "correct" C -- argument list, and then pass a pointer to _that_ when calling plmap and -- plmeridian. procedure mapform19(n : Integer; x, y : in out Map_Form_Constrained_Array) is xp, yp : Long_Float; begin -- DO NOT use x'range for this loop because the C function which calls -- this function WILL NOT SEE IT AND YOU WILL GET A SEGFAULT. Simply -- use 0 .. n - 1 explicitly. for i in 0 .. n - 1 loop map_transform(x(i), y(i), xp, yp, System.Null_Address); x(i) := xp; y(i) := yp; end loop; end mapform19; -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. -- See Ada note above, for mapform19. -- a_length is used only for bounds checking against the C-allocated memory -- for label. procedure geolocation_labeler (axis : Integer; a_value : Long_Float; label : out Label_String_Type; a_length : size_t; data : PLpointer); pragma Convention(C, geolocation_labeler); -- A custom axis labeling function for longitudes and latitudes. procedure geolocation_labeler (axis : Integer; a_value : Long_Float; label : out Label_String_Type; a_length : size_t; data : PLpointer) is direction_label : Unbounded_String; label_val : Long_Float; -- "Normalize" longitude values so that they always fall between -180.0 and 180.0. function normalize_longitude(lon : Long_Float) return Long_Float is times : Long_Float; begin -- normalize_longitude if lon >= -180.0 and lon <= 180.0 then return lon; else times := Long_Float'Floor((abs(lon) + 180.0) / 360.0); if lon < 0.0 then return lon + 360.0 * times; else return lon - 360.0 * times; end if; end if; end normalize_longitude; -- Function to convert an unbounded string to a fixed-length C string with the -- null terminator somewhere in the middle and spaces after. The result, of type -- Label_String_Type, is fixed to a length by C, currently at 41, and is -- indexed in Ada as 0 .. PLplot_Traditional.Max_Label_String_Length. function Unbounded_To_Weird_C (Item : Unbounded_String; C_Length : size_t) return Label_String_Type is Temp : Unbounded_String; begin -- Check length and adjust if necessary. if Length(Item) >= Integer(C_Length) then Put_Line("*** Warning: Custom label was truncated to" & Integer'Image(Integer(C_Length)) & " characters. ***"); Temp := Head(Item, Integer(C_Length)); return To_C(To_String(Temp), True); else return To_C(To_String(Item & ASCII.nul & (Max_Label_String_Length - Length(Item)) * " "), False); end if; end Unbounded_To_Weird_C; begin -- geolocation_labeler if axis = PL_Y_AXIS then label_val := a_value; if label_val > 0.0 then direction_label := To_Unbounded_String(" N"); elsif label_val < 0.0 then direction_label := To_Unbounded_String(" S"); else direction_label := To_Unbounded_String("Eq"); end if; elsif axis = PL_X_AXIS then label_val := normalize_longitude(a_value); if label_val > 0.0 then direction_label := To_Unbounded_String(" E"); elsif label_val < 0.0 then direction_label := To_Unbounded_String(" W"); else direction_label := To_Unbounded_String(""); end if; end if; if axis = PL_Y_AXIS and a_value = 0.0 then -- A special case for the equator null; else direction_label := Trim(Integer'Image(Integer(abs(label_val))) & direction_label, Left); end if; label := Unbounded_To_Weird_C(direction_label, a_length); end geolocation_labeler; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); plinit; -- Longitude (x) and latitude (y) miny := -70.0; maxy := 80.0; -- Cartesian plots -- Most of world minx := -170.0; maxx := minx + 360.0; -- Setup a custom latitude and longitude-based scaling function. plslabelfunc(geolocation_labeler'Unrestricted_Access, System.Null_Address); plcol0(1); plenv(minx, maxx, miny, maxy, Justified, Custom_Labels_Linear_Box_Plus); plmap(null, USA_States_and_Continents, minx, maxx, miny, maxy); -- The Americas minx := 190.0; maxx := 340.0; plcol0(1); plenv(minx, maxx, miny, maxy, Justified, Custom_Labels_Linear_Box_Plus); plmap(null, USA_States_and_Continents, minx, maxx, miny, maxy); -- Clear the labeling function. Use_Default_Labels; -- or... -- plslabelfunc(Null, System.Null_Address); -- Polar, Northern hemisphere minx := 0.0; maxx := 360.0; plenv(-75.0, 75.0, -75.0, 75.0, Justified, Box); plmap(mapform19'Unrestricted_Access, Continents, minx, maxx, miny, maxy); pllsty(2); plmeridians(mapform19'Unrestricted_Access, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); -- Polar, Northern hemisphere, this time with a PLplot-wide transform minx := 0.0; maxx := 360.0; plstransform(map_transform'Unrestricted_Access, System.Null_Address); pllsty(1); plenv(-75.0, 75.0, -75.0, 75.0, 1, -1); -- No need to set the map transform here as the global transform will be used. plmap(null, Continents, minx, maxx, miny, maxy); pllsty(2); plmeridians(null, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0); -- Show Baltimore, MD on the map. plcol0(2); plssym(0.0, 2.0); x(1) := -76.6125; y(1) := 39.2902778; plpoin(x, y, 18); plssym(0.0, 1.0); plptex(-76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD"); -- Clear the global transform. Clear_Custom_Coordinate_Transform; -- or... -- plstransform(null, System.Null_Address); plend; end x19a; plplot-5.10.0+dfsg/examples/ada/x21a.adb 644 1750 1750 2357412143252635 165540ustar andrewandrew-- $Id: x21a.adb 12337 2013-05-10 20:16:29Z andrewross $ -- Grid data demo -- Copyright (C) 2007 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- Ada note: This example originally used Ada's random number generator, but in -- order to make Postscript results that are identical to the C version, a -- PLplot-specific random number generator was substituted. The original Ada -- generator lines are left in as comments for reference. with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, -- Ada.Numerics.Float_Random, Ada.Strings, Ada.Strings.Fixed, Ada.Calendar, System, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, -- Ada.Numerics.Float_Random, Ada.Strings, Ada.Strings.Fixed, Ada.Calendar, PLplot_Traditional, PLplot_Auxiliary; procedure x21a is pts : Integer := 500; xp : Integer := 25; yp : Integer := 20; nl : Integer := 16; knn_order : Integer := 20; threshold : Long_Float := 1.001; wmin : Long_Float := -1.0e3; randn, rosen : Integer := 0; xm, xMM, ym, yMM : Long_Float; zmin, zmax, lzm, lzMM : Long_Float; dist, d : Long_Float; x, y, z : Real_Vector(0 .. pts - 1); clev : Real_Vector(0 .. nl - 1); xg : Real_Vector(0 .. xp - 1); yg : Real_Vector(0 .. yp - 1); zg : Real_Matrix(0 .. xp - 1, 0 .. yp - 1); opt : Real_Vector(0 .. 5) := (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); -- Random_Generator : Generator; -- From Ada.Numerics.Float_Random function title(which : Integer) return String is begin if which = 0 then return "Cubic Spline Approximation"; end if; if which = 1 then return "Delaunay Linear Interpolation"; end if; if which = 2 then return "Natural Neighbors Interpolation"; end if; if which = 3 then return "KNN Inv. Distance Weighted"; end if; if which = 4 then return "3NN Linear Interpolation"; end if; if which = 5 then return "4NN Around Inv. Dist. Weighted"; end if; return "oops"; end title; procedure cmap1_init is i, h, l, s : Real_Vector(0 .. 1); begin i(0) := 0.0; -- left boundary i(1) := 1.0; -- right boundary h(0) := 240.0; -- blue -> green -> yellow -> red h(1) := 0.0; l(0) := 0.6; l(1) := 0.6; s(0) := 0.8; s(1) := 0.8; plscmap1n(256); plscmap1l(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init; procedure create_grid(x, y : out Real_Vector) is begin for i in x'range loop x(i) := xm + (xMM - xm) * Long_Float(i) / (Long_Float(x'length) - 1.0); end loop; for i in y'range loop y(i) := ym + (yMM - ym) * Long_Float(i) / (Long_Float(y'length) - 1.0); end loop; end create_grid; procedure create_data(x, y, z : out Real_Vector) is r, xt, yt : Long_Float; begin for i in x'range loop -- xt := Long_Float(Random(Random_Generator)); -- yt := Long_Float(Random(Random_Generator)); xt := (xMM - xm) * plrandd; -- Use the PLplot random number generator yt := (yMM - ym) * plrandd; -- to make the same plot as C example 21. if randn = 0 then x(i) := xt + xm; y(i) := yt + ym; else -- std=1, meaning that many points are outside the plot range x(i) := sqrt(-2.0 *log(xt)) * cos(2.0 * pi * yt) + xm; x(i) := sqrt(-2.0 *log(xt)) * sin(2.0 * pi * yt) + ym; end if; if rosen = 0 then r := sqrt((x(i)) * (x(i)) + (y(i)) * (y(i))); z(i) := exp(-r * r) * cos(2.0 * pi * r); else z(i) := log((1.0 - x(i))*(1.0 - x(i)) + 100.0 * (y(i) - x(i)*x(i))*(y(i) - x(i)*x(i))); end if; end loop; end create_data; -- Ada lacks full access to IEEE 754 aka IEC 559. The following works -- because a NaN is not equal to any other float, including itself. -- Use of the 'valid attribute might also work, as might casting to a 64-bit -- Integer and comparing to the known bit pattern for NaN; but beware of -- quiet NaNs and signalling NaNs. See the discussion at -- http://groups.google.com/group/comp.lang.ada/browse_thread/thread/772ddcb41cd06d5b?hl=en function Is_NaN(x : Long_Float) return Boolean is begin return x /= x; end Is_NaN; begin xm := -0.2; ym := -0.2; xMM := 0.6; yMM := 0.6; opt(2) := wmin; opt(3) := Long_Float(knn_order); opt(4) := threshold; -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; cmap1_init; plseed(5489); create_data(x, y, z); -- the sampled data zmin := Vector_Min(z); zmax := Vector_Max(z); create_grid(xg, yg); -- Grid the data at the output grided data. plcol0(1); plenv(xm, xMM, ym, yMM, 2, 0); plcol0(15); pllab("X", "Y", "The original data sampling"); for i in 0 .. (pts-1) loop plcol1( (z(i)-zmin)/(zmax-zmin) ); plstring(x(i .. i), y(i .. i), "#(727)"); end loop; pladv(0); plssub(3, 2); for k in 0 .. 1 loop pladv(0); for alg in 1 .. 6 loop plgriddata(x, y, z, xg, yg, zg, alg, opt(alg - 1)); -- CSA can generate NaNs (only interpolates?!). -- DTLI and NNI can generate NaNs for points outside the convex hull -- of the data points. -- NNLI can generate NaNs if a sufficiently thick triangle is not found -- PLplot should be NaN/Inf aware, but changing it now is quite a job... -- so, instead of not plotting the NaN regions, a weighted average over -- the neighbors is done. if alg = GRID_CSA or alg = GRID_DTLI or alg = GRID_NNLI or alg = GRID_NNI then for i in xg'range loop for j in yg'range loop if Is_NaN(zg(i, j)) then -- average (IDW) over the 8 neighbors zg(i, j) := 0.0; dist := 0.0; for ii in i - 1 .. i + 1 loop exit when ii >= xp; for jj in j - 1 .. j + 1 loop exit when jj >= yp; if ii >= 0 and jj >= 0 then if not Is_NaN(zg(ii, jj)) then if abs(ii - i) + abs(jj - j) = 1 then d := 1.0; else d := 1.4142; end if; zg(i, j) := zg(i, j) + zg(ii, jj) / (d * d); dist := dist + d; end if; end if; end loop; -- jj end loop; -- ii if dist /= 0.0 then zg(i, j) := zg(i,j) / dist; else zg(i, j) := zmin; end if; end if; end loop; -- j end loop; -- i end if; lzm := Matrix_Min(zg); lzMM := Matrix_Max(zg); lzm := Vector_Min((lzm, zmin)); lzMM := Vector_Max((lzMM, zmax)); -- Increase limits slightly to prevent spurious contours -- due to rounding errors. lzm := lzm - 0.01; lzMM := lzMM + 0.01; plcol0(1); pladv(alg); if k = 0 then for i in clev'range loop clev(i) := lzm + (lzMM - lzm) / Long_Float(nl-1) * Long_Float(i); end loop; plenv0(xm, xMM, ym, yMM, 2, 0); plcol0(15); pllab("X", "Y", title(alg - 1)); plshades(zg, null, xm, xMM, ym, yMM, clev, 1.0, 0, 1.0, plfill'access, True, null, System.Null_Address); plcol0(2); else for i in clev'range loop clev(i) := lzm + (lzMM - lzm) / Long_Float(nl - 1) * Long_Float(i); end loop; plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.1, 0.75, -0.65, 1.20); -- For the comparition to be fair, all plots should have the -- same z values, but to get the max/min of the data generated -- by all algorithms would imply two passes. Keep it simple. plw3d(1.0, 1.0, 1.0, xm, xMM, ym, yMM, lzm, lzMM, 30.0, -40.0); plbox3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); plcol0(15); pllab("", "", title(alg - 1)); plot3dc(xg, yg, zg, DRAW_LINEXY + MAG_COLOR + BASE_CONT, clev); end if; end loop; -- alg end loop; -- k plend; end x21a; plplot-5.10.0+dfsg/examples/ada/xthick12a.adb 644 1750 1750 640512012305413 175350ustar andrewandrew-- $Id: xthick12a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Bar chart demo. -- Copyright (C) 2006 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; ------------------------------------------------------------------------------ -- Does a simple bar chart, using color fill. If color fill is -- unavailable, pattern fill is used instead (automatic). ------------------------------------------------------------------------------ procedure xthick12a is y0 : Real_Vector (0 .. 9); pos : Real_Vector (0 .. 4) := (0.0, 0.25, 0.5, 0.75, 1.0); r : Real_Vector (0 .. 4) := (0.0, 0.25, 0.5, 1.0, 1.0); g : Real_Vector (0 .. 4) := (1.0, 0.5, 0.5, 0.5, 1.0); b : Real_Vector (0 .. 4) := (1.0, 1.0, 0.5, 0.25, 0.0); procedure plfbox (x0, y0 : Long_Float) is x, y : Real_Vector (0 ..3); begin x(0) := x0; y(0) := 0.0; x(1) := x0; y(1) := y0; x(2) := x0 + 1.0; y(2) := y0; x(3) := x0 + 1.0; y(3) := 0.0; Fill_Polygon(x, y); Set_Pen_Color(Red); Select_Line_Style(1); Draw_Curve(x, y); end plfbox; begin -- Parse and process command line arguments. Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot. Initialize_PLplot; Advance_To_Subpage(Next_Subpage); Set_Viewport_Standard; Set_Viewport_World(1980.0, 1990.0, 0.0, 35.0); Box_Around_Viewport("bc", 1.0, 0, "bcnv", 10.0, 0); Set_Pen_Color(Yellow); Write_Labels("Year", "Widget Sales (millions)", "#frPLplot Example 12"); y0(0) := 5.0; y0(1) := 15.0; y0(2) := 12.0; y0(3) := 24.0; y0(4) := 28.0; y0(5) := 30.0; y0(6) := 20.0; y0(7) := 8.0; y0(8) := 12.0; y0(9) := 3.0; Set_Color_Map_1_Piecewise(RGB, pos, r, g, b, Alt_Hue_Path_None); for i in y0'range loop Set_Color_Map_1(Long_Float(i)/9.0); Select_Fill_Pattern(0); plfbox((1980.0 + Long_Float(i)), y0(i)); Write_Text_World(1980.0 + Long_Float(i) + 0.5, y0(i) + 1.0, 1.0, 0.0, 0.5, Trim(Integer'image(Integer(y0(i))), Left)); Write_Text_Viewport("b", 1.0, (Long_Float(i) + 1.0) * 0.1 - 0.05, 0.5, Trim(Integer'image(1980 + i), Left)); end loop; -- Don't forget to call End_PLplot to finish off! End_PLplot; end xthick12a; plplot-5.10.0+dfsg/examples/ada/xthick16a.adb 644 1750 1750 3740212220264404 175670ustar andrewandrew-- $Id: xthick16a.adb 12523 2013-09-24 10:27:16Z jbauck $ -- Shade_Region demo, using color fill. -- Maurice LeBrun -- IFS, University of Texas at Austin -- 20 Mar 1994 -- Copyright (C) 2008-2013 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, System, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; procedure xthick16a is -- Fundamental settings. See notes() for more info. ns : Integer := 20; -- Default number of shade levels nx : Integer := 35; -- Default number of data points in x ny : Integer := 46; -- Default number of data points in y exclude : Boolean := False; -- By default do not plot a page illustrating -- exclusion. API is probably going to change -- anyway, and cannot be reproduced by any -- front end other than the C one. x, y, argx, argy, distort, r, t : Long_Float; px, py : Real_Vector(0 .. 99); zmin, zmax : Long_Float; z, w : Real_Matrix(0 .. nx - 1, 0 .. ny - 1); clevel : Real_Vector(0 .. ns - 1); shedge : Real_Vector(0 .. ns); cgrid1 : aliased Transformation_Data_Type (x_Last => nx - 1, y_Last => ny - 1, z_Last => 0); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); fill_width : Long_Float := 2.0; colorbar_width, colorbar_height : Long_Float; cont_color : Integer := 0; cont_width : Long_Float := 0.0; num_axes : constant Integer := 1; n_axis_opts : constant Integer := num_axes; -- TUB is renamed To_Unbounded_String. axis_opts : Legend_String_Array_Type(0 .. n_axis_opts - 1) := (others => TUB("bcvtm")); num_values : Integer_Array_1D(0 .. num_axes - 1); values : Real_Matrix(0 .. num_axes - 1, 0 .. ns); --SWAP THESE??? axis_ticks : Real_Vector(0 .. num_axes - 1) := (others => 0.0); axis_subticks : Integer_Array_1D(0 .. num_axes - 1) := (others => 0); num_labels : constant Integer := 1; label_opts : Integer_Array_1D(0 .. num_labels - 1); labels : Legend_String_Array_Type(0 .. num_labels - 1) := (others => TUB("Magnitude")); -- Transformation function tr : Real_Vector(0 .. 5); procedure mypltr -- This spec is necessary to accommodate pragma Convention(). (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer); pragma Convention(Convention => C, Entity => mypltr); procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer) is begin tx := tr(0) * x + tr(1) * y + tr(2); ty := tr(3) * x + tr(4) * y + tr(5); end mypltr; -- Masking function function zdefined(x, y : Long_Float) return Integer; pragma Convention(C, zdefined); function zdefined(x, y : Long_Float) return Integer is z : Long_Float := sqrt(x * x + y * y); begin if z < 0.4 or z > 0.6 then return 1; -- Don't mask. else return 0; -- Do mask. end if; end zdefined; begin label_opts(0) := Colorbar_Label_Bottom; ---------------------------------------------------------------------------- -- Does several shade plots using different coordinate mappings. ---------------------------------------------------------------------------- -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Load colour palettes Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); Set_Color_Map_1_From_File("cmap1_gray.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display Set_Number_Of_Colors_Map_0(3); -- Initialize plplot Initialize_PLplot; -- Set up transformation function tr(0) := 2.0 / Long_Float(nx - 1); tr(1) := 0.0; tr(2) := -1.0; tr(3) := 0.0; tr(4) := 2.0 / Long_Float(ny - 1); tr(5) := -1.0; -- Set up data array for i in z'range(1) loop x := Long_Float(i - nx / 2) / Long_Float(nx / 2); for j in z'range(2) loop y := Long_Float(j - ny / 2) / Long_Float(ny / 2) - 1.0; z(i, j) := -sin(7.0 * x) * cos(7.0 * y) + x * x - y * y; w(i, j) := -cos(7.0 * x) * sin(7.0 * y) + 2.0 * x * y; end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_Max(z); for i in clevel'range loop clevel(i) := zmin + (zmax - zmin) * (Long_Float(i) + 0.5) / Long_Float(ns); end loop; for i in shedge'range loop shedge(i) := zmin + (zmax - zmin) * Long_Float(i) / Long_Float(ns); end loop; -- Set up coordinate grids cgrid1.zg(0) := 0.0; -- Not used, but initialize anway. for i in cgrid1.xg'range loop for j in cgrid1.yg'range loop mypltr(Long_Float(i), Long_Float(j), x, y, System.Null_Address); argx := x * pi / 2.0; argy := y * pi / 2.0; distort := 0.4; cgrid1.xg(i) := x + distort * cos(argx); -- This gets assigned j times. cgrid1.yg(j) := y - distort * cos(argy); cgrid2.xg(i, j) := x + distort * cos(argx) * cos(argy); cgrid2.yg(i, j) := y - distort * cos(argx) * cos(argy); cgrid2.zg(i, j) := 0.0; -- Not used, but initialize anway. end loop; end loop; -- Plot using identity transform Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Select_Fill_Pattern(0); Shade_Regions(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, Fill_Polygon'access, True, Null, System.Null_Address); -- Smaller text Set_Character_Height(0.0, 0.75); -- Small ticks on the vertical axis Set_Major_Tick_Length(0.0, 0.5); Set_Minor_Tick_Length(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; Create_Colorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes Set_Character_Height(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); Set_Minor_Tick_Length(0.0, 1.0); Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Yellow); Write_Labels("distance", "altitude", "Bogon density"); -- Plot using 1d coordinate transform -- Load colour palettes Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); Set_Color_Map_1_From_File("cmap1_blue_yellow.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. Set_Number_Of_Colors_Map_0(3); Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Select_Fill_Pattern(0); Shade_Regions(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, Fill_Polygon'access, True, Plot_Transformation_1'access, cgrid1'Address); -- Smaller text Set_Character_Height(0.0, 0.75); -- Small ticks on the vertical axis Set_Major_Tick_Length(0.0, 0.5); Set_Minor_Tick_Length(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; Create_Colorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes Set_Character_Height(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); Set_Minor_Tick_Length(0.0, 1.0); Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Yellow); Write_Labels("distance", "altitude", "Bogon density"); -- Plot using 2d coordinate transform -- Load colour palettes Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); Set_Color_Map_1_From_File("cmap1_blue_red.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. Set_Number_Of_Colors_Map_0(3); Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Select_Fill_Pattern(0); Shade_Regions(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, Fill_Polygon'access, False, Plot_Transformation_2'access, cgrid2'Address); -- Smaller text Set_Character_Height(0.0, 0.75); -- Small ticks on the vertical axis Set_Major_Tick_Length(0.0, 0.5); Set_Minor_Tick_Length(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; Create_Colorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes Set_Character_Height(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); Set_Minor_Tick_Length(0.0, 1.0); Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Yellow); Contour_Plot(w, 1, nx, 1, ny, clevel, Plot_Transformation_2'access, cgrid2'Address); Write_Labels("distance", "altitude", "Bogon density, with streamlines"); -- Plot using 2d coordinate transform -- Load colour palettes Set_Color_Map_0_From_File(""); Set_Color_Map_1_From_File("", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. Set_Number_Of_Colors_Map_0(3); Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Select_Fill_Pattern(0); Shade_Regions(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, 2, 3.0, Fill_Polygon'access, False, Plot_Transformation_2'access, cgrid2'Address); -- Smaller text Set_Character_Height(0.0, 0.75); -- Small ticks on the vertical axis Set_Major_Tick_Length(0.0, 0.5); Set_Minor_Tick_Length(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; Create_Colorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3.0, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes Set_Character_Height(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); Set_Minor_Tick_Length(0.0, 1.0); Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Set_Pen_Color(Yellow); Write_Labels("distance", "altitude", "Bogon density"); -- Note this exclusion API will probably change. -- Plot using 2d coordinate transform and exclusion -- Ada note: This "exclusion" part works if exclude is set to True. -- In the C original example, the setting of exclude was handled by the -- the input parser which handling is not implemented in this Ada example. -- exclude := False; if exclude then -- Load colour palettes. Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); Set_Color_Map_1_From_File("cmap1_gray.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. Set_Number_Of_Colors_Map_0(3); Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Select_Fill_Pattern(0); Shade_Regions(z, zdefined'Unrestricted_Access, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, Fill_Polygon'access, False, Plot_Transformation_2'access, cgrid2'Address); Set_Pen_Color(Red); Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); Write_Labels("distance", "altitude", "Bogon density with exclusion"); end if; -- Example with polar coordinates. -- Load colour palettes. Set_Color_Map_0_From_File("cmap0_black_on_white.pal"); Set_Color_Map_1_From_File("cmap1_gray.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. Set_Number_Of_Colors_Map_0(3); Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); Set_Viewport_World(-1.0, 1.0, -1.0, 1.0); Select_Fill_Pattern(0); -- Build new coordinate matrices. for i in cgrid2.xg'range(1) loop r := Long_Float(i) / Long_Float(nx - 1); for j in cgrid2.xg'range(2) loop t := (2.0 * pi /(Long_Float(ny) - 1.0)) * Long_Float(j); cgrid2.xg(i, j) := r * cos(t); cgrid2.yg(i, j) := r * sin(t); z(i, j) := exp(-r * r) * cos(5.0 * pi * r) * cos(5.0 * t); end loop; end loop; -- Need a new shedge to go along with the new data set. zmin := Matrix_Min(z); zmax := Matrix_Max(z); for i in shedge'range loop shedge(i) := zmin + (zmax - zmin) * Long_Float(i) / Long_Float(ns); end loop; -- Now we can shade the interior region. Shade_Regions(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, Fill_Polygon'access, False, Plot_Transformation_2'access, cgrid2'Address); -- Smaller text Set_Character_Height(0.0, 0.75); -- Small ticks on the vertical axis Set_Major_Tick_Length(0.0, 0.5); Set_Minor_Tick_Length(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; Create_Colorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes Set_Character_Height(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); Set_Minor_Tick_Length(0.0, 1.0); -- Now we can draw the perimeter. (If do before, shade stuff may overlap.) for i in px'range loop t := 2.0 * pi / Long_Float(px'Length - 1) * Long_Float(i); px(i) := cos(t); py(i) := sin(t); end loop; Set_Pen_Color(Red); Draw_Curve(px, py); -- And label the plot. Set_Pen_Color(Yellow); Write_Labels("", "", "Tokamak Bogon Instability"); -- Clean up End_PLplot; end xthick16a; plplot-5.10.0+dfsg/examples/ada/x16a.adb 644 1750 1750 3434712220264404 165510ustar andrewandrew-- $Id: x16a.adb 12523 2013-09-24 10:27:16Z jbauck $ -- plshade demo, using color fill. -- Maurice LeBrun -- IFS, University of Texas at Austin -- 20 Mar 1994 -- Copyright (C) 2008-2013 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, System, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; procedure x16a is -- Fundamental settings. See notes() for more info. ns : Integer := 20; -- Default number of shade levels nx : Integer := 35; -- Default number of data points in x ny : Integer := 46; -- Default number of data points in y exclude : Boolean := False; -- By default do not plot a page illustrating -- exclusion. API is probably going to change -- anyway, and cannot be reproduced by any -- front end other than the C one. x, y, argx, argy, distort, r, t : Long_Float; px, py : Real_Vector(0 .. 99); zmin, zmax : Long_Float; z, w : Real_Matrix(0 .. nx - 1, 0 .. ny - 1); clevel : Real_Vector(0 .. ns - 1); shedge : Real_Vector(0 .. ns); cgrid1 : aliased Transformation_Data_Type (x_Last => nx - 1, y_Last => ny - 1, z_Last => 0); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); fill_width : Long_Float := 2.0; colorbar_width, colorbar_height : Long_Float; cont_color : Integer := 0; cont_width : Long_Float := 0.0; num_axes : constant Integer := 1; n_axis_opts : constant Integer := num_axes; -- TUB is renamed To_Unbounded_String. axis_opts : Legend_String_Array_Type(0 .. n_axis_opts - 1) := (others => TUB("bcvtm")); num_values : Integer_Array_1D(0 .. num_axes - 1); values : Real_Matrix(0 .. num_axes - 1, 0 .. ns); axis_ticks : Real_Vector(0 .. num_axes - 1) := (others => 0.0); axis_subticks : Integer_Array_1D(0 .. num_axes - 1) := (others => 0); num_labels : constant Integer := 1; label_opts : Integer_Array_1D(0 .. num_labels - 1); labels : Legend_String_Array_Type(0 .. num_labels - 1) := (others => TUB("Magnitude")); -- Transformation function tr : Real_Vector(0 .. 5); procedure mypltr -- This spec is necessary to accommodate pragma Convention(). (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer); pragma Convention(Convention => C, Entity => mypltr); procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer) is begin tx := tr(0) * x + tr(1) * y + tr(2); ty := tr(3) * x + tr(4) * y + tr(5); end mypltr; -- Masking function function zdefined(x, y : Long_Float) return Integer; pragma Convention(C, zdefined); function zdefined(x, y : Long_Float) return Integer is z : Long_Float := sqrt(x * x + y * y); begin if z < 0.4 or z > 0.6 then return 1; -- Don't mask. else return 0; -- Do mask. end if; end zdefined; begin label_opts(0) := COLORBAR_LABEL_BOTTOM; ---------------------------------------------------------------------------- -- Does several shade plots using different coordinate mappings. ---------------------------------------------------------------------------- -- Parse and process command line arguments. plparseopts(Parse_Full); -- Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_gray.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n(3); -- Initialize plplot plinit; -- Set up transformation function tr(0) := 2.0 / Long_Float(nx - 1); tr(1) := 0.0; tr(2) := -1.0; tr(3) := 0.0; tr(4) := 2.0 / Long_Float(ny - 1); tr(5) := -1.0; -- Set up data array for i in z'range(1) loop x := Long_Float(i - nx / 2) / Long_Float(nx / 2); for j in z'range(2) loop y := Long_Float(j - ny / 2) / Long_Float(ny / 2) - 1.0; z(i, j) := -sin(7.0 * x) * cos(7.0 * y) + x * x - y * y; w(i, j) := -cos(7.0 * x) * sin(7.0 * y) + 2.0 * x * y; end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_Max(z); for i in clevel'range loop clevel(i) := zmin + (zmax - zmin) * (Long_Float(i) + 0.5) / Long_Float(ns); end loop; for i in shedge'range loop shedge(i) := zmin + (zmax - zmin) * Long_Float(i) / Long_Float(ns); end loop; -- Set up coordinate grids cgrid1.zg(0) := 0.0; -- Not used, but initialize anway. for i in cgrid1.xg'range loop for j in cgrid1.yg'range loop mypltr(Long_Float(i), Long_Float(j), x, y, System.Null_Address); argx := x * pi / 2.0; argy := y * pi / 2.0; distort := 0.4; cgrid1.xg(i) := x + distort * cos(argx); -- This gets assigned j times. cgrid1.yg(j) := y - distort * cos(argy); cgrid2.xg(i, j) := x + distort * cos(argx) * cos(argy); cgrid2.yg(i, j) := y - distort * cos(argx) * cos(argy); cgrid2.zg(i, j) := 0.0; -- Not used, but initialize anway. end loop; end loop; -- Plot using identity transform pladv(0); -- page 1 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, plfill'access, True, Null, System.Null_Address); -- Smaller text plschr(0.0, 0.75); -- Small ticks on the vertical axis plsmaj(0.0, 0.5); plsmin(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; plcolorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes plschr(0.0, 1.0); plsmaj(0.0, 1.0); plsmin(0.0, 1.0); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon density"); -- Plot using 1d coordinate transform -- Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_blue_yellow.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. plscmap0n(3); pladv(0); -- page 2 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, plfill'access, True, pltr1'access, cgrid1'Address); -- Smaller text plschr(0.0, 0.75); -- Small ticks on the vertical axis plsmaj(0.0, 0.5); plsmin(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; plcolorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes plschr(0.0, 1.0); plsmaj(0.0, 1.0); plsmin(0.0, 1.0); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon density"); -- Plot using 2d coordinate transform -- Load colour palettes plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_blue_red.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. plscmap0n(3); pladv(0); -- page 3 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, plfill'access, False, pltr2'access, cgrid2'Address); -- Smaller text plschr(0.0, 0.75); -- Small ticks on the vertical axis plsmaj(0.0, 0.5); plsmin(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; plcolorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes plschr(0.0, 1.0); plsmaj(0.0, 1.0); plsmin(0.0, 1.0); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); plcont(w, 1, nx, 1, ny, clevel, pltr2'access, cgrid2'Address); pllab("distance", "altitude", "Bogon density, with streamlines"); -- Plot using 2d coordinate transform -- Load colour palettes plspal0(""); plspal1("", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. plscmap0n(3); pladv(0); -- page 4 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, 2, 3.0, plfill'access, False, pltr2'access, cgrid2'Address); -- Smaller text plschr(0.0, 0.75); -- Small ticks on the vertical axis plsmaj(0.0, 0.5); plsmin(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; plcolorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3.0, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes plschr(0.0, 1.0); plsmaj(0.0, 1.0); plsmin(0.0, 1.0); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); plcol0(2); pllab("distance", "altitude", "Bogon density"); -- Note this exclusion API will probably change. -- Plot using 2d coordinate transform and exclusion -- Ada note: This "exclusion" part works if exclude is set to True. -- In the C original example, the setting of exclude was handled by the -- the input parser which handling is not implemented in this Ada example. -- exclude := False; if exclude then -- Load colour palettes. plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_gray.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. plscmap0n(3); pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); plshades(z, zdefined'Unrestricted_Access, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, plfill'access, False, pltr2'access, cgrid2'Address); plcol0(1); plbox("bcnst", 0.0, 0, "bcnstv", 0.0, 0); pllab("distance", "altitude", "Bogon density with exclusion"); end if; -- Example with polar coordinates. -- Load colour palettes. plspal0("cmap0_black_on_white.pal"); plspal1("cmap1_gray.pal", True); -- Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display. plscmap0n(3); pladv(0); -- page 5 plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); plpsty(0); -- Build new coordinate matrices. for i in cgrid2.xg'range(1) loop r := Long_Float(i) / Long_Float(nx - 1); for j in cgrid2.xg'range(2) loop t := (2.0 * pi /(Long_Float(ny) - 1.0)) * Long_Float(j); cgrid2.xg(i, j) := r * cos(t); cgrid2.yg(i, j) := r * sin(t); z(i, j) := exp(-r * r) * cos(5.0 * pi * r) * cos(5.0 * t); end loop; end loop; -- Need a new shedge to go along with the new data set. zmin := Matrix_Min(z); zmax := Matrix_Max(z); for i in shedge'range loop shedge(i) := zmin + (zmax - zmin) * Long_Float(i) / Long_Float(ns); end loop; -- Now we can shade the interior region. plshades(z, Null, -1.0, 1.0, -1.0, 1.0, shedge, fill_width, cont_color, cont_width, plfill'access, False, pltr2'access, cgrid2'Address); -- Smaller text plschr(0.0, 0.75); -- Small ticks on the vertical axis plsmaj(0.0, 0.5); plsmin(0.0, 0.5); num_values(0) := ns + 1; for i in values'range(2) loop values(0, i) := shedge(i); end loop; plcolorbar(colorbar_width, colorbar_height, Colorbar_Shade + Colorbar_Shade_Label, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values); -- Reset text and tick sizes plschr(0.0, 1.0); plsmaj(0.0, 1.0); plsmin(0.0, 1.0); -- Now we can draw the perimeter. (If do before, shade stuff may overlap.) for i in px'range loop t := 2.0 * pi / Long_Float(px'Length - 1) * Long_Float(i); px(i) := cos(t); py(i) := sin(t); end loop; plcol0(1); plline(px, py); -- And label the plot. plcol0(2); pllab("", "", "Tokamak Bogon Instability"); -- Clean up plend; end x16a; plplot-5.10.0+dfsg/examples/ada/xthick10a.adb 644 1750 1750 326211543675237 175570ustar andrewandrew-- $Id: xthick10a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Window positioning demo. -- Copyright (C) 2007 Alan W. Irwin -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; procedure xthick10a is begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Box_Around_Viewport("bc", 0.0, 0, "bc", 0.0, 0); Set_Viewport_Absolute(50.0, 150.0, 50.0, 100.0); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Box_Around_Viewport("bc", 0.0, 0, "bc", 0.0, 0); Write_Text_World(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)"); End_PLplot; end xthick10a; plplot-5.10.0+dfsg/examples/ada/x14a.adb 644 1750 1750 2630711543675237 165650ustar andrewandrew-- $Id: x14a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Demo of multiple stream/window capability (requires Tk or Tcl-DP). -- Maurice LeBrun -- IFS, University of Texas at Austin -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Text_IO, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Text_IO, Ada.Numerics, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; ------------------------------------------------------------------------------ -- Plots several simple functions from other example programs. -- -- This version sends the output of the first 4 plots (one page) to two -- independent streams. ------------------------------------------------------------------------------ procedure x14a is -- Select either TK or DP driver and use a small window -- Using DP results in a crash at the end due to some odd cleanup problems -- The geometry strings MUST be in writable memory geometry_master : String := "500x410+100+200"; geometry_slave : String := "500x410+650+200"; driver : Unbounded_String; digmax : Integer; xscale, yscale, xoff, yoff : Long_Float; xs, ys : Real_Vector(0 .. 5); space0 : Integer_Array_1D(1 .. 1) := (Others => 0); mark0 : Integer_Array_1D(1 .. 1) := (Others => 0); space1 : Integer_Array_1D(1 .. 1) := (Others => 1500); mark1 : Integer_Array_1D(1 .. 1) := (Others => 1500); fam : Boolean; num, bmax : Integer; xp0, yp0 : Long_Float; xleng0, yleng0, xoff0, yoff0 : Integer; valid_geometry : Boolean; procedure plot1 is xmin, xmax, ymin, ymax : Long_Float; x, y : Real_Vector(0 .. 59); begin for i in x'range loop x(i) := xoff + xscale * Long_Float(i + 1) / Long_Float(x'Length); y(i) := yoff + yscale * x(i) * x(i); end loop; xmin := x(x'First); xmax := x(x'Last); ymin := y(y'First); ymax := y(y'Last); for i in xs'range loop xs(i) := x(i * 10 + 3); ys(i) := y(i * 10 + 3); end loop; -- Set up the viewport and window using PLENV. The range in X is -- 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are -- scaled separately (just := 0), and we just draw a labelled -- box (axis := 0). plcol0(1); plenv(xmin, xmax, ymin, ymax, 0, 0); plcol0(6); pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); -- Plot the data points plcol0(9); plpoin(xs, ys, 9); -- Draw the line through the data plcol0(4); plline(x, y); plflush; end plot1; -- ================================================================ procedure plot2 is x, y : Real_Vector(0 .. 99); begin -- Set up the viewport and window using PLENV. The range in X is -2.0 to -- 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately -- (just = 0), and we draw a box with axes (axis = 1). plcol0(1); plenv(-2.0, 10.0, -0.4, 1.2, 0, 1); plcol0(2); pllab("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); -- Fill up the arrays for i in x'range loop x(i) := (Long_Float(i) - 19.0) / 6.0; y(i) := 1.0; if x(i) /= 0.0 then y(i) := sin(x(i)) / x(i); end if; end loop; -- Draw the line plcol0(3); plline(x, y); plflush; end plot2; -- ================================================================ procedure plot3 is x, y : Real_Vector(0 .. 100); begin -- For the final graph we wish to override the default tick intervals, and -- so do not use PLENV pladv(0); -- Use standard viewport, and define X range from 0 to 360 degrees, Y range -- from -1.2 to 1.2. plvsta; plwind(0.0, 360.0, -1.2, 1.2); -- Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0(1); plbox("bcnst", 60.0, 2, "bcnstv", 0.2, 2); -- Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl(mark1, space1); plcol0(2); plbox("g", 30.0, 0, "g", 0.2, 0); plstyl(Default_Continuous_Line); plcol0(3); pllab("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); for i in x'range loop x(i) := 3.6 * Long_Float(i); y(i) := sin(x(i) * pi / 180.0); end loop; plcol0(4); plline(x, y); plflush; end plot3; -- ================================================================ procedure plot4 is dtr, theta, dx, dy, r : Long_Float; x, y, x0, y0 : Real_Vector(0 .. 360); begin dtr := pi / 180.0; for i in x0'range loop x0(i) := cos(dtr * Long_Float(i)); y0(i) := sin(dtr * Long_Float(i)); end loop; -- Set up viewport and window, but do not draw box plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); for i in 1 .. 10 loop for j in x'range loop x(j) := 0.1 * Long_Float(i) * x0(j); y(j) := 0.1 * Long_Float(i) * y0(j); end loop; -- Draw circles for polar grid plline(x, y); end loop; plcol0(2); for i in 0 .. 11 loop theta := 30.0 * Long_Float(i); dx := cos(dtr * theta); dy := sin(dtr * theta); -- Draw radial spokes for polar grid pljoin(0.0, 0.0, dx, dy); -- Write labels for angle -- Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if dx >= -0.00001 then plptex(dx, dy, dx, dy, -0.15, Trim(Integer'image(Integer(theta)), Left)); else plptex(dx, dy, -dx, -dy, 1.15, Trim(Integer'image(Integer(theta)), Left)); end if; end loop; -- Draw the graph for i in x'range loop r := sin(dtr * Long_Float(5 * i)); x(i) := x0(i) * r; y(i) := y0(i) * r; end loop; plcol0(3); plline(x, y); plcol0(4); plmtex("t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh"); plflush; end plot4; -- ================================================================ -- Demonstration of contour plotting procedure plot5 is XPTS : constant Integer := 35; YPTS : constant Integer := 46; -- Transformation function XSPA : Long_Float := 2.0 / Long_Float(XPTS - 1); YSPA : Long_Float := 2.0 / Long_Float(YPTS - 1); tr : Real_Vector(0 .. 5) := (XSPA, 0.0, -1.0, 0.0, YSPA, -1.0); xx, yy : Long_Float; mark : Integer_Array_1D(1 .. 1) := (Others => 1500); space : Integer_Array_1D(1 .. 1) := (Others => 1500); z, w : Real_Matrix(0 .. XPTS -1, 0 .. YPTS - 1); clevel : Real_Vector(0 .. 10) := (-1.0, -0.8, -0.6, -0.4, -0.2, 0.0, 0.2, 0.4, 0.6, 0.8, 1.0); procedure mypltr -- This spec is necessary to accommodate pragma Convention(C...). (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer); pragma Convention(Convention => C, Entity => mypltr); procedure mypltr (x, y : Long_Float; tx, ty : out Long_Float; pltr_data : PLpointer) is begin tx := tr(0) * x + tr(1) * y + tr(2); ty := tr(3) * x + tr(4) * y + tr(5); end mypltr; begin for i in z'range(1) loop xx := Long_Float(i - (XPTS / 2)) / Long_Float(XPTS / 2); for j in z'range(2) loop yy := Long_Float(j - (YPTS / 2)) / Long_Float(YPTS / 2) - 1.0; z(i, j) := xx * xx - yy * yy; w(i, j) := 2.0 * xx * yy; end loop; end loop; plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); plcont(z, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); plstyl(mark, space); plcol0(3); plcont(w, 1, XPTS, 1, YPTS, clevel, mypltr'Unrestricted_Access, System.Null_Address); plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); plflush; end plot5; begin -- plplot initialization -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); driver := To_Unbounded_String(plgdev); plgfam(fam, num, bmax); Put_Line("Demo of multiple output streams via the " & plgdev & " driver."); Put_Line("Running with the second stream as slave to the first."); New_Line; -- If valid geometry specified on command line, use it for both streams. plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); valid_geometry := (xleng0 > 0 and yleng0 > 0); -- Set up first stream if valid_geometry then plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); else plsetopt("geometry", geometry_master); end if; plsdev(To_String(driver)); plssub(2, 2); plinit; -- Start next stream plsstrm(1); if valid_geometry then plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0); else plsetopt("geometry", geometry_slave); end if; -- Turn off pause to make this a slave (must follow master) plspause(False); plgfam(fam, num, bmax); plsetopt("fflen","2"); plsdev(To_String(driver)); plinit; -- Set up the data & plot -- Original case plsstrm(0); xscale := 6.0; yscale := 1.0; xoff := 0.0; yoff := 0.0; plot1; -- Set up the data & plot xscale := 1.0; yscale := 1.0e+6; plot1; -- Set up the data & plot xscale := 1.0; yscale := 1.0e-6; digmax := 2; plsyax(digmax, 0); plot1; -- Set up the data & plot xscale := 1.0; yscale := 0.0014; yoff := 0.0185; digmax := 5; plsyax(digmax, 0); plot1; -- To slave -- The pleop ensures the eop indicator gets lit. plsstrm(1); plot4; pleop; -- Back to master plsstrm(0); plot2; plot3; -- To slave plsstrm(1); plot5; pleop; -- Back to master to wait for user to advance plsstrm(0); pleop; -- Call plend to finish off. plend; end x14a; plplot-5.10.0+dfsg/examples/ada/xthick33a.adb 644 1750 1750 11430012220264404 175770ustar andrewandrew-- -*- coding: utf-8; -*- -- -- $Id: xthick33a.adb 12523 2013-09-24 10:27:16Z jbauck $ -- -- Demonstrate most Create_Legend capability including unicode symbols. -- -- Copyright (C) 2011-2013 Jerry Bauck -- -- This file is part of PLplot. -- -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- -- This example designed just for devices (e.g., the cairo-related and -- qt-related devices) where the best choice of glyph is automatically -- selected by the related libraries (pango/cairo or Qt4) for each -- unicode character depending on what system fonts are installed. Of -- course, you must have the appropriate TrueType fonts installed to -- have access to all the required glyphs. -- Ada note: The function TUB is Ada.Strings.Unbounded.To_Unbounded_String -- renamed. See PLplot.ads or PLplot.ads. with Ada.Strings.Unbounded, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; use Ada.Strings.Unbounded, Ada.Strings, Ada.Strings.Fixed, PLplot_Auxiliary, PLplot; ---------------------------------------------------------------------------- -- Demonstrate most Create_Legend capability including unicode symbols. ---------------------------------------------------------------------------- procedure xthick33a is position_options : Integer_Array_1D(0 .. 15) := (Pl_Position_Left + Pl_Position_Top + Pl_Position_Outside, Pl_Position_Top + Pl_Position_Outside, Pl_Position_Right + Pl_Position_Top + Pl_Position_Outside, Pl_Position_Right + Pl_Position_Outside, Pl_Position_Right + Pl_Position_Bottom + Pl_Position_Outside, Pl_Position_Bottom + Pl_Position_Outside, Pl_Position_Left + Pl_Position_Bottom + Pl_Position_Outside, Pl_Position_Left + Pl_Position_Outside, Pl_Position_Left + Pl_Position_Top + Pl_Position_Inside, Pl_Position_Top + Pl_Position_Inside, Pl_Position_Right + Pl_Position_Top + Pl_Position_Inside, Pl_Position_Right + Pl_Position_Inside, Pl_Position_Right + Pl_Position_Bottom + Pl_Position_Inside, Pl_Position_Bottom + Pl_Position_Inside, Pl_Position_Left + Pl_Position_Bottom + Pl_Position_Inside, Pl_Position_Left + Pl_Position_Inside); -- Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). special_symbols : Legend_String_Array_Type(0 .. 4) := (TUB("✰"), TUB("✴"), TUB("✱"), TUB("✽"), TUB("✦")); -- TUB is renamed To_Unbounded_String. -- Create_Colorbar options -- Colorbar type options Colorbar_Kinds : constant Integer := 4; colorbar_option_kinds : Integer_Array_1D(0 .. Colorbar_Kinds - 1) := ( Pl_Colorbar_Shade, Pl_Colorbar_Shade + Pl_Colorbar_Shade_Label, Pl_Colorbar_Image, Pl_Colorbar_Gradient); colorbar_option_kind_labels : Legend_String_Array_Type(0 .. Colorbar_Kinds - 1) := (TUB("Shade colorbars"), TUB("Shade colorbars with custom labels"), TUB("Image colorbars"), TUB("Gradient colorbars")); -- Which side of the page are we positioned relative to? Colorbar_Positions :constant Integer := 4; colorbar_position_options : Integer_Array_1D(0 .. Colorbar_Positions - 1) := (Pl_Position_Left, Pl_Position_Right, Pl_Position_Top, Pl_Position_Bottom); colorbar_position_option_labels : Legend_String_Array_Type(0 .. Colorbar_Positions - 1) := (TUB("Left"), TUB("Right"), TUB("Top"), TUB("Bottom")); -- Colorbar label positioning options Colorbar_Labels : constant Integer := 4; colorbar_label_options : Integer_Array_1D(0 .. Colorbar_Labels - 1) := (Pl_Colorbar_Label_Left, Pl_Colorbar_Label_Right, Pl_Colorbar_Label_Top, Pl_Colorbar_Label_Bottom); colorbar_label_option_labels : Legend_String_Array_Type(0 .. Colorbar_Labels - 1) := (TUB("Label left"), TUB("Label right"), TUB("Label top"), TUB("Label bottom")); -- Colorbar cap options Colorbar_Caps : constant Integer := 4; colorbar_cap_options : Integer_Array_1D(0 .. Colorbar_Caps - 1) := (Pl_Colorbar_Cap_None, Pl_Colorbar_Cap_Low, Pl_Colorbar_Cap_High, Pl_Colorbar_Cap_Low + Pl_Colorbar_Cap_High); colorbar_cap_option_labels : Legend_String_Array_Type(0 .. Colorbar_Caps - 1) := (TUB("No caps"), TUB("Low cap"), TUB("High cap"), TUB("Low and high caps")); procedure Create_Colorbar_example_page(kind_i : Integer; label_i : Integer; cap_i : Integer; cont_color : Integer; cont_width : Long_Float; n_values : Integer; values : Real_Vector) is -- Parameters for the colorbars on this page position, opt : Integer; x, y, x_length, y_length : Long_Float; ticks : Real_Vector(0 .. 0) := (others => 0.0); sub_ticks : Integer_Array_1D(0 .. 0) := (others => 0); low_cap_color, high_cap_color : Long_Float; vertical, ifn : Boolean; n_axes : Integer := 1; axis_opts : Legend_String_Array_Type(0 .. 0); n_labels : Integer := 1; label_opts : Integer_Array_1D(0 .. 0) := (others => 0); label : Legend_String_Array_Type(0 .. 0); title : Unbounded_String; colorbar_width, colorbar_height : Long_Float; n_values_array : Integer_Array_1D(0 .. 0); values_array : Real_Matrix(0 .. 0, values'first .. values'last); type Stupid is mod 2**7; -- To cover Legend_Colorbar_Position_Type in plplot_thin.ads. begin n_values_array(0) := n_values; for i in values'range loop values_array(0, i) := values(i); end loop; low_cap_color := 0.0; high_cap_color := 1.0; -- Start a new page. Advance_To_Subpage(Next_Subpage); -- Draw one colorbar relative to each side of the page. for position_i in 0 .. Colorbar_Positions - 1 loop position := colorbar_position_options(position_i); opt := colorbar_option_kinds(kind_i) + colorbar_label_options(label_i) + colorbar_cap_options(cap_i); -- We have to convert these integers to modular type Stupid before and-ing the bits. -- That's because manipulating bits of non-modular types is nonsense but other -- languages seem to not care about stuff like this. vertical := ((Stupid(position) and Stupid(Pl_Position_Left)) > 0) or ((Stupid(position) and Stupid(Pl_Position_Right)) > 0); ifn := ((Stupid(position) and Stupid(Pl_Position_Left)) > 0) or ((Stupid(position) and Stupid(Pl_Position_Bottom)) > 0); -- Set the offset position on the page. if vertical then x := 0.0; y := 0.0; x_length := 0.05; y_length := 0.5; else x := 0.0; y := 0.0; x_length := 0.5; y_length := 0.05; end if; -- Set appropriate labelling options. if ifn then if cont_color = 0 or cont_width = 0.0 then axis_opts(0) := TUB("uwtivn"); -- TUB is renamed To_Unbounded_String. else axis_opts(0) := TUB("uwxvn"); end if; else if cont_color = 0 or cont_width = 0.0 then axis_opts(0) := TUB("uwtivm"); else axis_opts(0) := TUB("uwxvm"); end if; end if; label(0) := colorbar_position_option_labels(position_i) & ", " & colorbar_label_option_labels(label_i); -- Smaller text Set_Character_Height(0.0, 0.75); -- Small ticks on the vertical axis Set_Major_Tick_Length(0.0, 0.5); Set_Minor_Tick_Length(0.0, 0.5); Set_Viewport_Normalized(0.20, 0.80, 0.20, 0.80); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); -- Set interesting background colour. Set_One_Color_Map_0_And_Alpha(White, 0, 0, 0, 0.20); Create_Colorbar(colorbar_width, colorbar_height, opt + Pl_Colorbar_Bounding_Box + Pl_Colorbar_Background, position, x, y, x_length, y_length, White, Red, 1, low_cap_color, high_cap_color, cont_color, cont_width, label_opts, label, axis_opts, ticks, sub_ticks, n_values_array, values_array); -- Reset text and tick sizes Set_Character_Height(0.0, 1.0); Set_Major_Tick_Length(0.0, 1.0); Set_Minor_Tick_Length(0.0, 1.0); end loop; -- Draw a page title title := colorbar_option_kind_labels(kind_i) & " - " & colorbar_cap_option_labels(cap_i); Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Write_Text_World(0.5, 0.5, 0.0, 0.0, 0.5, To_String(title)); end Create_Colorbar_example_page; procedure Create_Colorbar_example(palette : String; kind_i : Integer; cont_color : Integer; cont_width : Long_Float; n_values : Integer; values : Real_Vector) is begin -- Load the color palette Set_Color_Map_1_From_File(palette, True); for label_i in 0 .. Colorbar_Labels - 1 loop for cap_i in 0 .. Colorbar_Caps - 1 loop Create_Colorbar_example_page(kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ); end loop; end loop; end Create_Colorbar_example; colorbar : Boolean := True; -- By default do not plot Create_Colorbar pages -- for now while we are working out the API. opt : Integer; nlegend : Integer; nturn : Integer; legend_width, legend_height, x, y, xstart, ystart : Long_Float; max_height, text_scale : Long_Float; position, opt_base, nrow, ncolumn : Integer; begin -- main Parse_Command_Line_Arguments(Pl_Parse_Full); -- Initialize plplot Initialize_PLplot; -- First page illustrating the 16 standard positions. declare nlegend : constant Integer := 1; opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.25, 0.75, 0.25, 0.75); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Box_Around_Viewport("bc", 0.0, 0, "bc", 0.0, 0); Set_Font(PL_FCI_SANS, -1, -1); Write_Text_Viewport("t", 8.0, 0.5, 0.5, "The 16 standard legend positions with"); Write_Text_Viewport("t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y"); -- Only specify legend data that are required according to the -- value of opt_array for that entry. opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box; opt_array(0) := Pl_Legend_Line + Pl_Legend_Symbol; line_styles(0) := 1; line_widths(0) := 1.0; symbol_scales(0) := 1.0; symbol_numbers(0) := 4; symbols(0) := TUB("*"); -- Use monotype fonts so that all legends are the same size. Set_Font(PL_FCI_MONO, -1, -1); Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); for k in 0 .. 15 loop position := position_options(k); opt := opt_base; -- Make a 2-digit string with leading 0 for 0 .. 9. if k >= 10 then text(0) := To_Unbounded_String(Trim(Integer'image(k), Left)); else text(0) := To_Unbounded_String("0" & Trim(Integer'image(k), Left)); end if; text_colors(0) := 1 + (k mod 8); line_colors(0) := 1 + (k mod 8); symbol_colors(0) := 1 + (k mod 8); Create_Legend(legend_width, legend_height, opt, position, 0.05, 0.05, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end loop; end; -- declare -- Second page illustrating effect of nrow, ncolumn for the same legend data. declare nlegend : constant Integer := 7; opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.25, 0.75, 0.25, 0.75); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Box_Around_Viewport("bc", 0.0, 0, "bc", 0.0, 0); Set_Font(PL_FCI_SANS, -1, -1); Write_Text_Viewport("t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,"); Write_Text_Viewport("t", 6.0, 0.5, 0.5, "and position for the same legend data"); -- Only specify legend data that are required according to the -- value of opt_array for that entry. opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box; for k in 0 .. nlegend - 1 loop opt_array(k) := Pl_Legend_Line + Pl_Legend_Symbol; line_styles(k) := 1; line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); -- Make 2-digit strings with leading 0 for 0 .. 9. if k >= 10 then text(k) := To_Unbounded_String(Trim(Integer'image(k), Left)); else text(k) := To_Unbounded_String("0" & Trim(Integer'image(k), Left)); end if; text_colors(k) := 1 + (k mod 8); line_colors(k) := 1 + (k mod 8); symbol_colors(k) := 1 + (k mod 8); end loop; -- Use monotype fonts so that all legends are the same size. Set_Font(PL_FCI_MONO, -1, -1); Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); position := Pl_Position_Top + Pl_Position_Outside; opt := opt_base; x := 0.0; y := 0.1; nrow := 1; ncolumn := nlegend; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Bottom + Pl_Position_Outside; opt := opt_base; x := 0.0; y := 0.1; nrow := 1; ncolumn := nlegend; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Left + Pl_Position_Outside; opt := opt_base; x := 0.1; y := 0.0; nrow := nlegend; ncolumn := 1; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Right + Pl_Position_Outside; opt := opt_base; x := 0.1; y := 0.0; nrow := nlegend; ncolumn := 1; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Left + Pl_Position_Top + Pl_Position_Inside; opt := opt_base; x := 0.0; y := 0.0; nrow := 6; ncolumn := 2; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Right + Pl_Position_Top + Pl_Position_Inside; opt := opt_base + Pl_Legend_Row_Major; x := 0.0; y := 0.0; nrow := 6; ncolumn := 2; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); position := Pl_Position_Bottom + Pl_Position_Inside; opt := opt_base + Pl_Legend_Row_Major; x := 0.0; y := 0.0; nrow := 3; ncolumn := 3; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.05, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); end; -- declare -- Third page demonstrating legend alignment Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.9); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Set_Font(Pl_Fci_Sans, -1, -1); Write_Text_Viewport("t", 2.0, 0.5, 0.5, "Demonstrate legend alignment"); x := 0.1; y := 0.1; nturn := 4; nlegend := 0; position := Pl_Position_Top + Pl_Position_Left + Pl_Position_Subpage; opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box; opt := opt_base; for i in 0 .. 8 loop -- Set up legend arrays with the correct size, type. if i <= nturn then nlegend := nlegend + 1; else nlegend := nlegend - 1; end if; nlegend := Integer'max(1, nlegend); declare opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin -- Only specify legend data that are required according to the -- value of opt_array for that entry. for k in 0 .. nlegend - 1 loop opt_array(k) := Pl_Legend_Line + Pl_Legend_Symbol; line_styles(k) := 1; line_widths(k) := 1.0; symbol_scales(k) := 1.0; symbol_numbers(k) := 2; symbols(k) := TUB("*"); -- Make 2-digit strings with leading 0 for 0 .. 9. if k >= 10 then text(k) := To_Unbounded_String(Trim(Integer'image(k), Left)); else text(k) := To_Unbounded_String("0" & Trim(Integer'image(k), Left)); end if; text_colors(k) := 1 + (k mod 8); line_colors(k) := 1 + (k mod 8); symbol_colors(k) := 1 + (k mod 8); end loop; -- k -- Use monotype fonts so that all legends are the same size. Set_Font(Pl_Fci_Mono, -1, -1); Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); nrow := Integer'min(3, nlegend); ncolumn := 0; Create_Legend(legend_width, legend_height, opt, position, x, y, 0.025, White, Red, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5, 1.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); if i = nturn then position := Pl_Position_Top + Pl_Position_Right + Pl_Position_Subpage; opt := opt_base; x := 1.0 - x; y := y + legend_height; else x := x + legend_width; y := y + legend_height; end if; end; -- declare end loop; -- i -- Fourth page illustrating various kinds of legends declare nlegend : constant Integer := 5; opt_array : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); text_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_patterns : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); box_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); box_line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); line_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_styles : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); line_widths : Real_Vector (0 .. nlegend - 1) := (others => 0.0); symbol_numbers : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_colors : Integer_Array_1D(0 .. nlegend - 1) := (others => 0); symbol_scales : Real_Vector (0 .. nlegend - 1) := (others => 0.0); text : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); symbols : Legend_String_Array_Type(0 .. nlegend - 1) := (others => TUB(" ")); begin max_height := 0.0; xstart := 0.0; ystart := 0.1; x := xstart; y := ystart; text_scale := 0.90; Advance_To_Subpage(Next_Subpage); Set_Viewport_Normalized(0.0, 1.0, 0.0, 0.90); Set_Viewport_World(0.0, 1.0, 0.0, 1.0); Set_Font(Pl_Fci_Sans, -1, -1); Write_Text_Viewport("t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends"); -- Only specify legend data that are required according to the -- value of opt_array for that entry. position := Pl_Position_Left + Pl_Position_Top; opt_base := Pl_Legend_Background + Pl_Legend_Bounding_Box + Pl_Legend_Text_Left; -- Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array(0) := Pl_Legend_None; text(0) := TUB("None"); text_colors(0) := 1; opt_array(1) := Pl_Legend_Color_Box; text(1) := TUB("Box"); text_colors(1) := 2; box_colors(1) := 2; box_patterns(1) := 0; box_scales(1) := 0.8; box_line_widths(1) := 1.0; opt_array(2) := Pl_Legend_Line; text(2) := TUB("Line"); text_colors(2) := 3; line_colors(2) := 3; line_styles(2) := 1; line_widths(2) := 1.0; opt_array(3) := Pl_Legend_Symbol; text(3) := TUB("Symbol"); text_colors(3) := 4; symbol_colors(3) := 4; symbol_scales(3) := text_scale; symbol_numbers(3) := 4; symbols(3) := special_symbols(2); opt_array(4) := Pl_Legend_Symbol + Pl_Legend_Line; text(4) := TUB("L & S"); text_colors(4) := 5; line_colors(4) := 5; line_styles(4) := 1; line_widths(4) := 1.0; symbol_colors(4) := 5; symbol_scales(4) := text_scale; symbol_numbers(4) := 4; symbols(4) := special_symbols(2); opt := opt_base; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up symbol legend entries with various symbols. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Symbol; text(i) := TUB("Symbol ") & special_symbols(i); text_colors(i) := i + 1; symbol_colors(i) := i + 1; symbol_scales(i) := text_scale; symbol_numbers(i) := 4; symbols(i) := special_symbols(i); end loop; opt := opt_base; x := x + legend_width; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up symbol legend entries with various numbers of symbols. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Symbol; text(i) := TUB("Symbol Number" & Integer'image(i + 2)); text_colors(i) := i + 1; symbol_colors(i) := i + 1; symbol_scales(i) := text_scale; symbol_numbers(i) := i + 2; symbols(i) := special_symbols(2); end loop; opt := opt_base; x := x + legend_width; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, Box_Colors, Box_Patterns, Box_Scales, Box_Line_Widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up box legend entries with various colours. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Color_Box; text(i) := TUB("Box Color" & Integer'image(i + 1)); text_colors(i) := i + 1; box_colors(i) := i + 1; box_patterns(i) := 0; box_scales(i) := 0.8; box_line_widths(i) := 1.0; end loop; opt := opt_base; -- Use new origin x := xstart; y := y + max_height; max_height := 0.0; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up box legend entries with various patterns. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Color_Box; text(i) := TUB("Box Pattern" & Integer'image(i)); text_colors(i) := 2; box_colors(i) := 2; box_patterns(i) := i; box_scales(i) := 0.8; box_line_widths(i) := 1.0; end loop; opt := opt_base; x := x + legend_width; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up box legend entries with various box pattern line widths. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Color_Box; text(i) := TUB("Box Line Width" & Integer'image(i + 1)); text_colors(i) := 2; box_colors(i) := 2; box_patterns(i) := 3; box_scales(i) := 0.8; box_line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; x := x + legend_width; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1,White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up line legend entries with various colours. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Line; text(i) := TUB("Line Color" & Integer'image(i + 1)); text_colors(i) := i + 1; line_colors(i) := i + 1; line_styles(i) := 1; line_widths(i) := 1.0; end loop; opt := opt_base; -- Use new origin x := xstart; y := y + max_height; max_height := 0.0; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up line legend entries with various styles. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Line; text(i) := TUB("Line Style" & Integer'image(i + 1)); text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := i + 1; line_widths(i) := 1.0; end loop; opt := opt_base; x := x + legend_width; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); -- Set up line legend entries with various widths. for i in 0 .. nlegend - 1 loop opt_array(i) := Pl_Legend_Line; text(i) := TUB("Line Width" & Integer'image(i + 1)); text_colors(i) := 2; line_colors(i) := 2; line_styles(i) := 1; line_widths(i) := Long_Float(i) + 1.0; end loop; opt := opt_base; x := x + legend_width; Set_One_Color_Map_0_And_Alpha(White, 32, 32, 32, 0.70); Create_Legend(legend_width, legend_height, opt, position, x, y, 0.1, White, Red, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0.0, text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols); max_height := Long_Float'max(max_height, legend_height); end; -- declare if colorbar then -- Color bar examples declare values_small : Real_Vector(0 .. 1) := (-1.0e-200, 1.0e-200); values_uneven : Real_Vector(0 .. 8) := (-1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200); values_even : Real_Vector(0 .. 8) := (-2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200); begin -- Use unsaturated green background colour to contrast with black caps. Set_Background_Color_RGB(70, 185, 70); -- Cut out the greatest and smallest bits of the color spectrum to -- leave colors for the end caps. Set_Color_Map_1_Range(0.01, 0.99); -- We can only test image and gradient colorbars with two element arrays for i in 2 .. COLORBAR_KINDS - 1 loop Create_Colorbar_example("cmap1_blue_yellow.pal", i, 0, 0.0, 2, values_small); end loop; -- Test shade colorbars with larger arrays for i in 0 .. 1 loop Create_Colorbar_example("cmap1_blue_yellow.pal", i, 4, 2.0, 9, values_even); end loop; for i in 0 .. 1 loop Create_Colorbar_example("cmap1_blue_yellow.pal", i, 0, 0.0, 9, values_uneven); end loop; end; end if; End_PLplot; end xthick33a; plplot-5.10.0+dfsg/examples/ada/xthick22a.adb 644 1750 1750 3240112252557340 175670ustar andrewandrew-- $Id: xthick22a.adb 12862 2013-12-13 10:18:08Z jbauck $ -- Simple vector plot example -- Copyright (C) 2008, 2013 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, System.Address_To_Access_Conversions, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, System, PLplot, PLplot_Auxiliary; procedure xthick22a is -- Pairs of points making the line segments used to plot the user defined arrow arrow_x : Real_Vector(0 .. 5) := (-0.5, 0.5, 0.3, 0.5, 0.3, 0.5); arrow_y : Real_Vector(0 .. 5) := ( 0.0, 0.0, 0.2, 0.0, -0.2, 0.0); arrow2_x : Real_Vector(0 .. 5) := (-0.5, 0.3, 0.3, 0.5, 0.3, 0.3); arrow2_y : Real_Vector(0 .. 5) := ( 0.0, 0.0, 0.2, 0.0, -0.2, 0.0); -- Vector plot of the circulation about the origin procedure circulation is dx, dy, x, y : Long_Float; nx : constant Integer := 20; ny : constant Integer := 20; xmin, xmax, ymin, ymax : Long_Float; u, v : Real_Matrix(0 .. nx - 1, 0 .. ny -1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); begin dx := 1.0; dy := 1.0; xmin := Long_Float(-nx / 2) * dx; xmax := Long_Float( nx / 2) * dx; ymin := Long_Float(-ny / 2) * dy; ymax := Long_Float( ny / 2) * dy; -- Create data - circulation around the origin. for i in 0 .. nx - 1 loop x := (Long_Float(i - nx / 2) + 0.5) * dx; for j in 0 .. ny - 1 loop y := (Long_Float(j - ny / 2) + 0.5) * dy; cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; u(i, j) := y; v(i, j) := -x; end loop; end loop; -- Plot vectors with default arrows Set_Environment(xmin, xmax, ymin, ymax, Not_Justified, Linear_Box_Plus); Write_Labels("(x)", "(y)", "#frPLplot Example 22 - circulation"); Set_Pen_Color(Yellow); Vector_Plot(u, v, 0.0, Plot_Transformation_2'access, cgrid2'Address); Set_Pen_Color(Red); end circulation; --Vector plot of flow through a constricted pipe procedure constriction(astyle : Integer) is dx, dy, x, y : Long_Float; xmin, xmax, ymin, ymax : Long_Float; Q, b, dbdx : Long_Float; nx : constant Integer := 20; ny : constant Integer := 20; u, v : Real_Matrix(0 .. nx - 1, 0 .. ny -1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); begin dx := 1.0; dy := 1.0; xmin := Long_Float(-nx / 2) * dx; xmax := Long_Float( nx / 2) * dx; ymin := Long_Float(-ny / 2) * dy; ymax := Long_Float( ny / 2) * dy; Q := 2.0; for i in 0 .. nx - 1 loop x := (Long_Float(i - nx / 2) + 0.5) * dx; for j in 0 .. ny - 1 loop y := (Long_Float(j - ny / 2) + 0.5) * dy; cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; b := ymax / 4.0 * (3.0 - cos(pi * x / xmax)); if abs(y) < b then dbdx := ymax / 4.0 * sin(pi * x / xmax) * pi / xmax * y / b; u(i, j) := Q * ymax / b; v(i, j) := dbdx * u(i, j); else u(i, j) := 0.0; v(i, j) := 0.0; end if; end loop; end loop; Set_Environment(xmin, xmax, ymin, ymax, Not_Justified, Linear_Box_Plus); Write_Labels("(x)", "(y)", "#frPLplot Example 22 - constriction (arrow style"&Integer'image(astyle)&")"); Set_Pen_Color(Yellow); Vector_Plot(u, v, -1.0, Plot_Transformation_2'access, cgrid2'Address); Set_Pen_Color(Red); end constriction; -- This spec is necessary in order to enforce C calling conventions, used -- in the callback by intervening C code. procedure transform (x, y : Long_Float; xt, yt : out Long_Float; data : PLPointer); pragma Convention(C, transform); -- Global transform function for a constriction using data passed in -- This is the same transformation used in constriction. procedure transform(x, y : Long_Float; xt, yt : out Long_Float; Data : PLPointer) is -- Convert the generic pointer represented as System.Address to a proper Ada pointer aka -- access variable. Recall that PLpointer is a subtype of System.Address. package Data_Address_Conversions is new System.Address_To_Access_Conversions(Long_Float); Data_Pointer : Data_Address_Conversions.Object_Pointer; -- An Ada access variable xmax : Long_Float; begin Data_Pointer := Data_Address_Conversions.To_Pointer(Data); xmax := Data_Pointer.all; xt := x; yt := y / 4.0 * (3.0 - cos(Pi * x / xmax)); end transform; -- Vector plot of flow through a constricted pipe with a coordinate transform procedure constriction2 is dx, dy, x, y : Long_Float; xmin, xmax, ymin, ymax : Long_Float; Q, b : Long_Float; nx : constant Integer := 20; ny : constant Integer := 20; cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nx - 1, y_Last => ny - 1); u, v : Real_Matrix(0 .. nx - 1, 0 .. ny - 1); nc : constant Integer := 11; nseg : constant Integer := 20; clev : Real_Vector(0 .. nc - 1); begin dx := 1.0; dy := 1.0; xmin := Long_Float(-nx / 2) * dx; -- Careful; Ada / rounds, C / truncates. xmax := Long_Float( nx / 2) * dx; ymin := Long_Float(-ny / 2) * dy; ymax := Long_Float( ny / 2) * dy; Set_Custom_Coordinate_Transform(transform'Unrestricted_Access, xmax'Address); cgrid2.nx := nx; cgrid2.ny := ny; Q := 2.0; for i in 0 .. nx - 1 loop x := (Long_Float(i - nx / 2) + 0.5) * dx; for j in 0 .. ny - 1 loop y := (Long_Float(j - ny / 2) + 0.5) * dy; cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; b := ymax / 4.0 * (3.0 - cos(Pi * x / xmax)); u(i, j) := Q * ymax / b; v(i, j) := 0.0; end loop; end loop; for i in 0 .. nc - 1 loop clev(i) := Q + Long_Float(i) * Q / Long_Float(nc - 1); end loop; Set_Environment(xmin, xmax, ymin, ymax, 0, 0); Write_Labels("(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform"); Set_Pen_Color(Yellow); Shade_Regions(u, Null, xmin + dx / 2.0, xmax - dx / 2.0, ymin + dy / 2.0, ymax - dy / 2.0, clev, 0.0, 1, 1.0, Fill_Polygon'access, False, Null, System.Null_Address); Vector_Plot(u, v, -1.0, Plot_Transformation_2'access, cgrid2'Address); -- Plot edges using plpath (which accounts for coordinate transformation) rather than plline Draw_Line_With_Transform(nseg, xmin, ymax, xmax, ymax); Draw_Line_With_Transform(nseg, xmin, ymin, xmax, ymin); Set_Pen_Color(Red); Clear_Custom_Coordinate_Transform; -- or... -- plstransform(null, System.Null_Address); end constriction2; -- Vector plot of the gradient of a shielded potential (see example 9) procedure potential is nper : constant Integer := 100; nlevel : constant Integer := 10; nr : constant Integer := 20; ntheta : constant Integer := 20; eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i : Long_Float; div1, div1i, div2, div2i : Long_Float; r, theta, x, y, dz : Long_Float; xmin, xmax, ymin, ymax, rmax, zmax, zmin : Long_Float; u, v, z : Real_Matrix(0 .. nr - 1, 0 .. ntheta - 1); px, py : Real_Vector(0 .. nper - 1); clevel : Real_Vector(0 .. nlevel - 1); cgrid2 : aliased Transformation_Data_Type_2 (x_Last => nr - 1, y_Last => ntheta - 1); function pow(x, y : Long_Float) return Long_Float is Result : Long_Float := 1.0; begin for i in 1 .. Integer(y) loop Result := Result * x; end loop; return Result; end pow; begin -- Potential inside a conducting cylinder (or sphere) by method of images. -- Charge 1 is placed at (d1, d1), with image charge at (d2, d2). -- Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). -- Also put in smoothing term at small distances. rmax := Long_Float(nr); eps := 2.0; q1 := 1.0; d1 := rmax / 4.0; q1i := - q1 * rmax / d1; d1i := (rmax * rmax) / d1; q2 := -1.0; d2 := rmax / 4.0; q2i := - q2 * rmax / d2; d2i := (rmax * rmax) / d2; for i in 0 .. nr - 1 loop r := 0.5 + Long_Float(i); for j in 0 .. ntheta - 1 loop theta := 2.0 * pi / Long_Float(ntheta - 1) * (0.5 + Long_Float(j)); x := r * cos(theta); y := r * sin(theta); cgrid2.xg(i, j) := x; cgrid2.yg(i, j) := y; div1 := sqrt(pow(x-d1, 2.0) + pow(y-d1, 2.0) + pow(eps, 2.0)); div1i := sqrt(pow(x-d1i, 2.0) + pow(y-d1i, 2.0) + pow(eps, 2.0)); div2 := sqrt(pow(x-d2, 2.0) + pow(y+d2, 2.0) + pow(eps, 2.0)); div2i := sqrt(pow(x-d2i, 2.0) + pow(y+d2i, 2.0) + pow(eps, 2.0)); z(i, j) := q1/div1 + q1i/div1i + q2/div2 + q2i/div2i; u(i, j) := -q1*(x-d1)/pow(div1, 3.0) - q1i*(x-d1i)/pow(div1i, 3.00) - q2*(x-d2)/pow(div2,3.0) - q2i*(x-d2i)/pow(div2i, 3.0); v(i, j) := -q1*(y-d1)/pow(div1, 3.0) - q1i*(y-d1i)/pow(div1i, 3.00) - q2*(y+d2)/pow(div2, 3.0) - q2i*(y+d2i)/pow(div2i, 3.0); end loop; end loop; xmin := Matrix_Min(cgrid2.xg); xmax := Matrix_Max(cgrid2.xg); ymin := Matrix_Min(cgrid2.yg); ymax := Matrix_Max(cgrid2.yg); zmin := Matrix_Min(z); zmax := Matrix_Max(z); Set_Environment(xmin, xmax, ymin, ymax, Not_Justified, Linear_Box_Plus); Write_Labels("(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot"); -- Plot contours of the potential dz := (zmax - zmin) / Long_Float(nlevel); for i in clevel'range loop clevel(i) := zmin + (Long_Float(i) + 0.5) * dz; end loop; Set_Pen_Color(Green); Select_Line_Style(2); Contour_Plot(z, 1, nr, 1, ntheta, clevel, Plot_Transformation_2'access, cgrid2'Address); Select_Line_Style(1); Set_Pen_Color(Red); -- Plot the vectors of the gradient of the potential Set_Pen_Color(Yellow); Vector_Plot(u, v, 25.0, Plot_Transformation_2'access, cgrid2'Address); Set_Pen_Color(Red); -- Plot the perimeter of the cylinder for i in px'range loop theta := (2.0 * pi / Long_Float(nper - 1)) * Long_Float(i); px(i) := rmax * cos(theta); py(i) := rmax * sin(theta); end loop; Draw_Curve(px,py); end potential; ---------------------------------------------------------------------------- -- Generates several simple vector plots. ---------------------------------------------------------------------------- begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; circulation; -- Set arrow style using arrow_x and arrow_y then plot using these arrows. Set_Arrow_Style_For_Vector_Plots(arrow_x, arrow_y, False); constriction(1); -- Set arrow style using arrow2_x and arrow2_y then plot using these filled arrows. Set_Arrow_Style_For_Vector_Plots(arrow2_x, arrow2_y, True); constriction(2); constriction2; -- Reset arrow style to the default by passing two NULL arrays. -- This line uses the awkward method of the C API to reset the default arrow style. -- Set_Arrow_Style_For_Vector_Plots(System.Null_Address, System.Null_Address, False); -- This method of resetting the default arrow style is a little more Ada-friendly... -- plsvect; -- ... as is this one which is identical but for name. Reset_Vector_Arrow_Style; potential; End_PLplot; end xthick22a; plplot-5.10.0+dfsg/examples/ada/x11a.adb 644 1750 1750 1115012012305413 165220ustar andrewandrew-- $Id: x11a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Mesh plot demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Traditional, PLplot_Auxiliary; procedure x11a is XPTS : constant Integer := 35; -- Data points in x YPTS : constant Integer := 46; -- Data points in y LEVELS : constant Integer := 10; opt : Integer_Array_1D(0 ..1) := (DRAW_LINEXY, DRAW_LINEXY); alt : Real_Vector(0 ..1) := (33.0, 17.0); az : Real_Vector(0 ..1) := (24.0, 115.0); title0 : String(1 .. 43) := ("#frPLplot Example 11 - Alt=33, Az=24, Opt=3"); title1 : String(1 .. 44) := ("#frPLplot Example 11 - Alt=17, Az=115, Opt=3"); x : Real_Vector(0 .. XPTS - 1); y : Real_Vector(0 .. YPTS - 1); z : Real_Matrix(0 .. XPTS - 1, 0 .. YPTS - 1); xx, yy : Long_Float; nlevel : Integer := LEVELS; clevel : Real_Vector(0 .. LEVELS - 1); zmin, zmax, step : Long_Float; procedure cmap1_init is i, h, l, s : Real_Vector(0 .. 1); begin i(0) := 0.0; -- left boundary i(1) := 1.0; -- right boundary h(0) := 240.0; -- blue -> green -> yellow -> h(1) := 0.0; -- -> red l(0) := 0.6; l(1) := 0.6; s(0) := 0.8; s(1) := 0.8; plscmap1n(256); plscmap1l(HLS, i, h, l, s, Alt_Hue_Path_None); end cmap1_init; -- Does a series of mesh plots for a given data set, with different -- viewing options in each plot. begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; for i in x'range loop x(i) := 3.0 * Long_Float(i - XPTS / 2) / Long_Float(XPTS / 2); end loop; for i in y'range loop y(i) := 3.0 * Long_Float(i - YPTS / 2) / Long_Float(YPTS / 2); end loop; for i in x'range loop xx := x(i); for j in y'range loop yy := y(j); z(i, j) := 3.0 * (1.0-xx)*(1.0-xx) * exp(-(xx*xx) - (yy+1.0)*(yy+1.0)) - 10.0 * (xx/5.0 - xx**3 - yy**5) * exp(-xx*xx-yy*yy) - 1.0/3.0 * exp(-(xx+1.0)*(xx+1.0) - (yy*yy)); -- if(0) {-- Jungfraujoch/Interlaken -- if (z(i)(j) < -1.) -- z(i)(j) := -1.; -- } end loop; end loop; zmin := Matrix_Min(z); zmax := Matrix_max(z); step := (zmax - zmin) / Long_Float(nlevel + 1); for i in clevel'range loop clevel(i) := zmin + step + step * Long_Float(i); end loop; cmap1_init; for k in 0 .. 1 loop for i in 0 .. 3 loop pladv(0); plcol0(1); plvpor(0.0, 1.0, 0.0, 0.9); plwind(-1.0, 1.0, -1.0, 1.5); plw3d(1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt(k), az(k)); plbox3("bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4); plcol0(2); -- wireframe plot if i = 0 then plmesh(x, y, z, opt(k)); -- magnitude colored wireframe plot elsif i = 1 then plmesh(x, y, z, opt(k) + MAG_COLOR); -- magnitude colored wireframe plot with sides elsif i = 2 then plot3d(x, y, z, opt(k) + MAG_COLOR, True); -- magnitude colored wireframe plot with base contour elsif i = 3 then plmeshc(x, y, z, opt(k) + MAG_COLOR + BASE_CONT, clevel); end if; plcol0(3); if k = 0 then plmtex("t", 1.0, 0.5, 0.5, title0); end if; if k = 1 then plmtex("t", 1.0, 0.5, 0.5, title1); end if; end loop; end loop; -- Clean up plend; end x11a; plplot-5.10.0+dfsg/examples/ada/xthick13a.adb 644 1750 1750 1016511543675237 176020ustar andrewandrew-- $Id: xthick13a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Pie chart demo. -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot; ------------------------------------------------------------------------------ -- Does a simple pie chart. ------------------------------------------------------------------------------ procedure xthick13a is j, dthet, theta0, theta1, theta : Integer; just, dx, dy : Long_Float; x, y : Real_Vector(0 .. 499); per : Real_Vector(0 .. 4) := (10.0, 32.0, 12.0, 30.0, 16.0); begin -- Parse and process command line arguments Parse_Command_Line_Arguments(Parse_Full); -- Initialize plplot Initialize_PLplot; Advance_To_Subpage(Next_Subpage); -- Ensure window has aspect ratio of one so circle is plotted as a circle. Set_Viewport_Aspect_Ratio(1.0); Set_Viewport_World(0.0, 10.0, 0.0, 10.0); -- Set_Environment(0.0, 10.0, 0.0, 10.0, Justified, No_Box); Set_Pen_Color(Yellow); -- n.b. all theta quantities scaled by 2 * pi / 500 to be integers to avoid -- floating point logic problems. theta0 := 0; dthet := 1; for i in per'range loop j := 0; x(j) := 5.0; y(j) := 5.0; j := j + 1; -- n.b. the theta quantities multiplied by 2 * pi / 500 afterward so -- in fact per is interpreted as a percentage. theta1 := Integer(Long_Float(theta0) + 5.0 * per(i)); if i = 4 then theta1 := 500; end if; theta := theta0; while theta <= theta1 loop x(j) := 5.0 + 3.0 * cos((2.0 * pi / 500.0) * Long_Float(theta)); y(j) := 5.0 + 3.0 * sin((2.0 * pi / 500.0) * Long_Float(theta)); j := j + 1; theta := theta + dthet; end loop; Set_Pen_Color(i + 1); Select_Fill_Pattern((i + 3) mod 8 + 1); declare x_Temp, y_Temp : Real_Vector(0 .. j - 1); begin x_Temp := x(0 .. j - 1); y_Temp := y(0 .. j - 1); Fill_Polygon(x_Temp, y_Temp); Set_Pen_Color(Red); Draw_Curve(x_Temp, y_Temp); end; just := (2.0 * pi / 500.0) * Long_Float((theta0 + theta1))/2.0; dx := 0.25 * cos(just); dy := 0.25 * sin(just); if (theta0 + theta1) < 250 or (theta0 + theta1) > 750 then just := 0.0; else just := 1.0; end if; if i = 0 then Write_Text_World(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Maurice"); elsif i = 1 then Write_Text_World(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Geoffrey"); elsif i = 2 then Write_Text_World(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Alan"); elsif i = 3 then Write_Text_World(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Rafael"); elsif i = 4 then Write_Text_World(x(j / 2) + dx, y(j / 2) + dy, 1.0, 0.0, just, "Vince"); end if; theta0 := theta - dthet; end loop; Set_Font_Style(Roman_Font); Set_Character_Height(0.0, 1.3); Write_Text_World(5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales"); -- Don't forget to call PLEND to finish off! End_PLplot; end xthick13a; plplot-5.10.0+dfsg/examples/ada/x27a.adb 644 1750 1750 1747311616742251 165650ustar andrewandrew-- $Id: x27a.adb 11860 2011-08-05 10:23:37Z andrewross $ -- Drawing "spirograph" curves - epitrochoids, cycolids, roulettes -- Copyright (C) 2008 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; ------------------------------------------------------------------------------ -- Generates two kinds of plots: -- - construction of a cycloid (animated) -- - series of epitrochoids and hypotrochoids ------------------------------------------------------------------------------ procedure x27a is -- R, r, p, N -- R and r should be integers to give correct termination of the -- angle loop using gcd. -- N.B. N is just a place holder since it is no longer used -- (because we now have proper termination of the angle loop). params : Real_Matrix(0 .. 8, 0 .. 3) := ((21.0, 7.0, 7.0, 3.0), (21.0, 7.0, 10.0, 3.0), (21.0, -7.0, 10.0, 3.0), (20.0, 3.0, 7.0, 20.0), (20.0, 3.0, 10.0, 20.0), (20.0, -3.0, 10.0, 20.0), (20.0, 13.0, 7.0, 20.0), (20.0, 13.0, 20.0, 20.0), (20.0,-13.0, 20.0, 20.0)); fill : Boolean; -- To understand why spiro is written this way you need to understand the -- C code from which this was derived. In the main C program, params -- is a two-dimensional array with 9 rows numbered 0 .. 8 and 4 columns -- numbered 0 .. 3. When spiro is called, it is passed the _address_ of the -- element of params's ith row, 0th column--nothing else. Then, inside spiro, -- the corresponding entity (also called params!) appears as a -- _one-dimensional_ array whose 0th element shares the same address as what -- was passed from the main program. So memory locations starting there, -- and numbered from 0, represent the 1D array equivalent to the ith row of -- params in the main program. Wilma, call Barney--we're programming a -- micaprocessor here. procedure spiro(params : Real_Matrix; row : Integer; fill : Boolean) is NPNT : constant Integer := 2000; xcoord, ycoord : Real_Vector(0 .. NPNT); windings : Integer; steps : Integer; phi : Long_Float; phiw : Long_Float; dphi : Long_Float; xmin : Long_Float; xmax : Long_Float; xrange_adjust : Long_Float; ymin : Long_Float; ymax : Long_Float; yrange_adjust : Long_Float; function Trunc(a : Long_Float) return Integer renames PLplot_Auxiliary.Trunc; -- Calculate greatest common divisor following pseudo-code for the -- Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm function gcd(a, b : Integer) return Integer is t : Integer; aa : Integer := a; bb : Integer := b; begin aa := abs(aa); bb := abs(bb); while bb /= 0 loop t := bb; bb := aa mod bb; aa := t; end loop; return aa; end gcd; begin -- spiro -- Fill the coordinates. -- Proper termination of the angle loop very near the beginning -- point, see http://mathforum.org/mathimages/index.php/Hypotrochoid windings := Trunc(abs(params(row, 1)) / Long_Float(gcd(Trunc(params(row, 0)), Trunc(params(row, 1))))); steps := NPNT / windings; dphi := 2.0 * pi / Long_Float(steps); for i in 0 .. windings * steps loop phi := Long_Float(i) * dphi; phiw := (params(row, 0) - params(row, 1)) / params(row, 1) * phi; xcoord(i) := (params(row, 0)-params(row, 1))*cos(phi)+params(row, 2)*cos(phiw); ycoord(i) := (params(row, 0)-params(row, 1))*sin(phi)-params(row, 2)*sin(phiw); if i = 0 then xmin := xcoord(i); xmax := xcoord(i); ymin := ycoord(i); ymax := ycoord(i); end if; if xmin > xcoord(i) then xmin := xcoord(i); end if; if xmax < xcoord(i) then xmax := xcoord(i); end if; if ymin > ycoord(i) then ymin := ycoord(i); end if; if ymax < ycoord(i) then ymax := ycoord(i); end if; end loop; xrange_adjust := 0.15 * (xmax - xmin); xmin := xmin - xrange_adjust; xmax := xmax + xrange_adjust; yrange_adjust := 0.15 * (ymax - ymin); ymin := ymin - yrange_adjust; ymax := ymax + yrange_adjust; plwind(xmin, xmax, ymin, ymax); plcol0(1); declare xcoord_local, ycoord_local : Real_Vector(0 .. steps * windings); begin xcoord_local := xcoord(0 .. steps * windings); ycoord_local := ycoord(0 .. steps * windings); if fill then plfill(xcoord_local, ycoord_local); else plline(xcoord_local, ycoord_local); end if; end; end spiro; procedure cycloid is begin null; -- TODO end cycloid; procedure arcs is NSEG : constant Integer := 8; theta : Long_Float; dtheta : Long_Float; a : Long_Float; b : Long_Float; begin theta := 0.0; dtheta := 360.0/Long_Float(NSEG); plenv( -10.0, 10.0, -10.0, 10.0, 1, 0 ); -- Plot segments of circle in different colors for i in 0 .. NSEG-1 loop plcol0( (i mod 2) + 1 ); plarc(0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, False); theta := theta + dtheta; end loop; -- Draw several filled ellipses inside the circle at different -- angles. a := 3.0; b := a * tan( (dtheta/180.0*pi)/2.0 ); theta := dtheta/2.0; for i in 0 .. NSEG-1 loop plcol0( 2 - (i mod 2 ) ); plarc( a*cos(theta/180.0*pi), a*sin(theta/180.0*pi), a, b, 0.0, 360.0, theta, True); theta := theta + dtheta; end loop; end arcs; begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; -- Illustrate the construction of a cycloid cycloid; -- Loop over the various curves. -- First an overview, then all curves one by one plssub(3, 3) ; -- Three by three window -- Overview fill := False; for i in params'range(1) loop pladv(0); plvpor(0.0, 1.0, 0.0, 1.0); spiro(params, i, fill); end loop; -- Don't fill the curves. pladv(0) ; plssub(1, 1) ; -- One window per curve for i in params'range(1) loop pladv(0) ; plvpor(0.0, 1.0, 0.0, 1.0); spiro(params, i, fill); end loop; -- Fill the curves fill := True; pladv(0); plssub(1, 1); -- One window per curve for i in params'range(1) loop pladv(0) ; plvpor(0.0, 1.0, 0.0, 1.0); spiro(params, i, fill); end loop; arcs; -- Don't forget to call plend to finish off! plend; end x27a; plplot-5.10.0+dfsg/examples/ada/x30a.adb 644 1750 1750 1060612012305413 165300ustar andrewandrew-- $Id: x30a.adb 12212 2012-08-13 23:17:31Z airwin $ -- Alpha color values demonstration -- Copyright (C) 2008, 2010 Jerry Bauck -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use System, Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x30a is red : Integer_Array_1D(0 .. 3) := ( 0, 255, 0, 0); green : Integer_Array_1D(0 .. 3) := ( 0, 0, 255, 0); blue : Integer_Array_1D(0 .. 3) := ( 0, 0, 0, 255); alpha : Real_Vector(0 .. 3) := (1.0, 1.0, 1.0, 1.0); px : Real_Vector(0 .. 3) := (0.1, 0.5, 0.5, 0.1); py : Real_Vector(0 .. 3) := (0.1, 0.1, 0.5, 0.5); pos : Real_Vector(0 .. 1) := (0.0, 1.0); rcoord : Real_Vector(0 .. 1) := (1.0, 1.0); gcoord : Real_Vector(0 .. 1) := (0.0, 0.0); bcoord : Real_Vector(0 .. 1) := (0.0, 0.0); acoord : Real_Vector(0 .. 1) := (0.0, 1.0); icol, r, g, b : Integer; a : Long_Float; begin plparseopts(PL_PARSE_FULL); plinit; plscmap0n(4); plscmap0a(red, green, blue, alpha); -- Page 1: -- This is a series of red, green and blue rectangles overlaid -- on each other with gradually increasing transparency. -- Set up the window pladv(0); plvpor(0.0, 1.0, 0.0, 1.0); plwind(0.0, 1.0, 0.0, 1.0); plcol0(0); plbox("", 1.0, 0, "", 1.0, 0); -- Draw the boxes for i in 0 .. 8 loop icol := i mod 3 + 1; -- Get a color, change its transparency and set it as the current color. plgcol0a(icol, r, g, b, a); plscol0a(icol, r, g, b, 1.0 - Long_Float(i) / 9.0); plcol0(icol); -- Draw the rectangle plfill(px, py); -- Shift the rectangles coordinates for j in px'range loop px(j) := px(j) + 0.5 / 9.0; py(j) := py(j) + 0.5 / 9.0; end loop; end loop; -- Page 2: -- This is a bunch of boxes colored red, green or blue with a single -- large (red) box of linearly varying transparency overlaid. The -- overlaid box is completely transparent at the bottom and completely -- opaque at the top. -- Set up the window pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.0); -- Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for i in 0 .. 4 loop -- Set box X position. px(0) := 0.05 + 0.2 * Long_Float(i); px(1) := px(0) + 0.1; px(2) := px(1); px(3) := px(0); -- We don't want the boxes to be transparent, so since we changed -- the colors transparencies in the first example we have to change -- the transparencies back to completely opaque. icol := i mod 3 + 1; plgcol0a(icol, r, g, b, a); plscol0a(icol, r, g, b, 1.0); plcol0(icol); for j in 0 ..4 loop -- Set box y position and draw the box. py(0) := 0.05 + 0.2 * Long_Float(j); py(1) := py(0); py(2) := py(0) + 0.1; py(3) := py(2); plfill(px, py); end loop; end loop; -- Create the color map with 128 colors and use plscmap1la to initialize -- the color values with a linearly varying transparency (or alpha). plscmap1n(128); plscmap1la(RGB, pos, rcoord, gcoord, bcoord, acoord, Alt_Hue_Path_None); -- Use that cmap1 to create a transparent red gradient for the whole window. px(0) := 0.0; px(1) := 1.0; px(2) := 1.0; px(3) := 0.0; py(0) := 0.0; py(1) := 0.0; py(2) := 1.0; py(3) := 1.0; plgradient(px, py, 90.0); plend; end x30a; plplot-5.10.0+dfsg/examples/ada/x10a.adb 644 1750 1750 304511543675237 165330ustar andrewandrew-- $Id: x10a.adb 11680 2011-03-27 17:57:51Z airwin $ -- Window positioning demo. -- Copyright (C) 2007 Alan W. Irwin -- This file is part of PLplot. -- PLplot is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as published -- by the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- PLplot is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU Library General Public License for more details. -- You should have received a copy of the GNU Library General Public License -- along with PLplot; if not, write to the Free Software -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA with Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; use Ada.Numerics, Ada.Numerics.Long_Elementary_Functions, PLplot_Auxiliary, PLplot_Traditional; procedure x10a is begin -- Parse and process command line arguments plparseopts(PL_PARSE_FULL); -- Initialize plplot plinit; pladv(0); plvpor(0.0, 1.0, 0.0, 1.0); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plsvpa(50.0, 150.0, 50.0, 100.0); plwind(0.0, 1.0, 0.0, 1.0); plbox("bc", 0.0, 0, "bc", 0.0, 0); plptex(0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)"); plend; end x10a; plplot-5.10.0+dfsg/examples/ocaml/ 775 1750 1750 012406243570 155665ustar andrewandrewplplot-5.10.0+dfsg/examples/ocaml/x18.ml 644 1750 1750 632711507472273 166330ustar andrewandrew(* $Id: x18.ml 11409 2011-01-01 00:26:35Z hezekiahcarty $ 3-d line and point plot demo. Adapted from x08c.c. *) open Plplot open Printf let opt = [|1; 0; 1; 0|] let alt = [|20.0; 35.0; 50.0; 65.0|] let az = [|30.0; 40.0; 50.0; 60.0|] let npts = 1000 let pi = atan 1.0 *. 4.0 let test_poly k = let draw = [| [| true; true; true; true|]; [| true; false; true; false|]; [|false; true; false; true|]; [| true; true; false; false|] |] in let two_pi = 2.0 *. pi in pladv 0; plvpor 0.0 1.0 0.0 0.9; plwind (-1.0) 1.0 (-0.9) 1.1; plcol0 1; plw3d 1.0 1.0 1.0 (-1.0) 1.0 (-1.0) 1.0 (-1.0) 1.0 alt.(k) az.(k); plbox3 "bnstu" "x axis" 0.0 0 "bnstu" "y axis" 0.0 0 "bcdmnstuv" "z axis" 0.0 0; plcol0 2; let theta a = two_pi *. float_of_int a /. 20.0 in let phi a = pi *. float_of_int a /. 20.1 in let x = Array.make 5 0.0 in let y = Array.make 5 0.0 in let z = Array.make 5 0.0 in for i = 0 to 19 do for j = 0 to 19 do x.(0) <- sin (phi j) *. cos (theta i); y.(0) <- sin (phi j) *. sin (theta i); z.(0) <- cos (phi j); x.(1) <- sin (phi (j + 1)) *. cos (theta i); y.(1) <- sin (phi (j + 1)) *. sin (theta i); z.(1) <- cos (phi (j + 1)); x.(2) <- sin (phi (j + 1)) *. cos (theta (i + 1)); y.(2) <- sin (phi (j + 1)) *. sin (theta (i + 1)); z.(2) <- cos (phi (j + 1)); x.(3) <- sin (phi j) *. cos (theta (i+1)); y.(3) <- sin (phi j) *. sin (theta (i+1)); z.(3) <- cos (phi j); x.(4) <- sin (phi j) *. cos (theta i); y.(4) <- sin (phi j) *. sin (theta i); z.(4) <- cos (phi j); plpoly3 x y z draw.(k) true; done done; plcol0 3; plmtex "t" 1.0 0.5 0.5 "unit radius sphere"; () (*--------------------------------------------------------------------------*\ * Does a series of 3-d plots for a given data set, with different * viewing options in each plot. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); for k = 0 to 3 do test_poly k done; (* From the mind of a sick and twisted physicist... *) let z = Array.init npts ( fun i -> ~-.1.0 +. 2.0 *. float_of_int i /. float_of_int npts ) in let x = Array.mapi ( fun i r -> r *. cos (2.0 *. pi *. 6.0 *. float_of_int i /. float_of_int npts) ) z in let y = Array.mapi ( fun i r -> r *. sin (2.0 *. pi *. 6.0 *. float_of_int i /. float_of_int npts) ) z in for k = 0 to 3 do pladv 0; plvpor 0.0 1.0 0.0 0.9; plwind (-1.0) 1.0 (-0.9) 1.1; plcol0 1; plw3d 1.0 1.0 1.0 (-1.0) 1.0 (-1.0) 1.0 (-1.0) 1.0 alt.(k) az.(k); plbox3 "bnstu" "x axis" 0.0 0 "bnstu" "y axis" 0.0 0 "bcdmnstuv" "z axis" 0.0 0; plcol0 2; if opt.(k) <> 0 then plline3 x y z else (* U+22C5 DOT OPERATOR. *) plstring3 x y z "⋅"; plcol0 3; let title = sprintf "#frPLplot Example 18 - Alt=%.0f, Az=%.0f" alt.(k) az.(k) in plmtex "t" 1.0 0.5 0.5 title; done; (* Clean up *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x29.ml 644 1750 1750 2416411543675237 166610ustar andrewandrew(* $Id: x29.ml 11680 2011-03-27 17:57:51Z airwin $ Sample plots using date / time formatting for axes Copyright (C) 2007 Andrew Ross Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot open Printf let pi = atan 1.0 *. 4.0 (* Plot a model diurnal cycle of temperature *) let plot1 () = (* Data points every 10 minutes for 1 day *) let npts = 73 in let xmin = 0.0 in let xmax = 60.0 *. 60.0 *. 24.0 in (* Number of seconds in a day *) let ymin = 10.0 in let ymax = 20.0 in let x = Array.init npts (fun i -> xmax *. float_of_int i /. float_of_int npts) in let y = Array.init npts ( fun i -> 15.0 -. 5.0 *. cos (2.0 *. pi *. (float_of_int i /. float_of_int npts)) ) in (* Set x error bars to +/- 5 minute *) let xerr1 = Array.map (fun xi -> xi -. 60.0 *. 5.0) x in let xerr2 = Array.map (fun xi -> xi +. 60.0 *. 5.0) x in (* Set y error bars to +/- 0.1 deg C *) let yerr1 = Array.map (fun yi -> yi -. 0.1) y in let yerr2 = Array.map (fun yi -> yi +. 0.1) y in pladv 0; (* Rescale major ticks marks by 0.5 *) plsmaj 0.0 0.5; (* Rescale minor ticks and error bar marks by 0.5 *) plsmin 0.0 0.5; plvsta (); plwind xmin xmax ymin ymax; (* Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. *) plcol0 1; (* Set time format to be hours:minutes *) pltimefmt "%H:%M"; plbox "bcnstd" (3.0 *. 60.0 *. 60.0) 3 "bcnstv" 1.0 5; plcol0 3; pllab "Time (hours:mins)" "Temperature (degC)" "#frPLplot Example 29 - Daily temperature"; plcol0 4; plline x y; plcol0 2; plerrx xerr1 xerr2 y; plcol0 3; plerry x yerr1 yerr2; (* Rescale major / minor tick marks back to default *) plsmin 0.0 1.0; plsmaj 0.0 1.0; () (* Plot the number of hours of daylight as a function of day for a year *) let plot2 () = (* Latitude for London *) let lat = 51.5 in let npts = 365 in let xmin = 0.0 in let xmax = float_of_int npts *. 60.0 *. 60.0 *. 24.0 in let ymin = 0.0 in let ymax = 24.0 in let x = Array.make npts 0.0 in let y = Array.make npts 0.0 in (* Formula for hours of daylight from * "A Model Comparison for Daylength as a Function of Latitude and * Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. *) for j = 0 to npts - 1 do x.(j) <- float_of_int j *. 60.0 *. 60.0 *. 24.0; let p = asin (0.39795 *. cos (0.2163108 +. 2.0 *. atan (0.9671396 *. tan (0.00860 *. (float_of_int j -. 186.0)))) ) in let d = 24.0 -. (24.0 /. pi) *. acos (( sin (0.8333 *. pi /. 180.0) +. sin (lat *. pi /. 180.0) *. sin p) /. (cos (lat *. pi /. 180.0) *. cos p) ) in y.(j) <- d; done; plcol0 1; (* Set time format to be abbreviated month name followed by day of month *) pltimefmt "%b %d"; plprec 1 1; plenv xmin xmax ymin ymax 0 40; plcol0 3; pllab "Date" "Hours of daylight" "#frPLplot Example 29 - Hours of daylight at 51.5N"; plcol0 4; plline x y; plprec 0 0; () let plot3 () = (* Calculate seconds since the Unix epoch for 2005-12-01 UTC. *) (* Adopt the known result for POSIX-compliant systems. *) let tstart = 1133395200.0 in let npts = 62 in let xmin = tstart in let xmax = xmin +. float_of_int npts *. 60.0 *. 60.0 *. 24.0 in let ymin = 0.0 in let ymax = 5.0 in let x = Array.init npts (fun i -> xmin +. float_of_int i *. 60.0 *. 60.0 *. 24.0) in let y = Array.init npts ( fun i -> 1.0 +. sin (2.0 *. pi *. float_of_int i /. 7.0) +. exp (float_of_int (min i (npts - i)) /. 31.0) ) in pladv 0; plvsta (); plwind xmin xmax ymin ymax; plcol0 1; (* Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is equivalent to %f for C99 compliant implementations of strftime. *) pltimefmt "%Y-%m-%d"; (* Draw a box with ticks spaced every 14 days in X and 1 hour in Y. *) plbox "bcnstd" (14.0 *. 24.0 *. 60.0 *. 60.0) 14 "bcnstv" 1.0 4; plcol0 3; pllab "Date" "Hours of television watched" "#frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"; plcol0 4; (* Rescale symbol size (used by plpoin) by 0.5 *) plssym 0.0 0.5; plpoin x y 2; plline x y; () let plot4 () = (* TAI-UTC (seconds) as a function of time. Use Besselian epochs as the continuous time interval just to prove this does not introduce any issues. *) (* Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch * B = 1900. + (JD -2415020.31352)/365.242198781 * ==> (as calculated with aid of "bc -l" command) * B = (MJD + 678940.364163900)/365.242198781 * ==> * MJD = B*365.24219878 - 678940.364163900 *) let scale = 365.242198781 in let offset1 = -678940.0 in let offset2 = -0.3641639 in plconfigtime scale offset1 offset2 0x0 false 0 0 0 0 0 0.0; let xmin = ref 0.0 in let xmax = ref 0.0 in let npts = ref 0 in let ymin = ref 0.0 in let ymax = ref 0.0 in let time_format = ref "" in let if_TAI_time_format = ref false in let title_suffix = ref "" in let xtitle = ref "" in let xlabel_step = ref 0.0 in for kind = 0 to 6 do let () = match kind with | 0 -> xmin := plctime 1950 0 2 0 0 0.0; xmax := plctime 2020 0 2 0 0 0.0; npts := 70 * 12 + 1; ymin := 0.0; ymax := 36.0; time_format := "%Y%"; if_TAI_time_format := true; title_suffix := "from 1950 to 2020"; xtitle := "Year"; xlabel_step := 10.0; | 1 | 2 -> xmin := plctime 1961 7 1 0 0 (1.64757 -. 0.20); xmax := plctime 1961 7 1 0 0 (1.64757 +. 0.20); npts := 1001; ymin := 1.625; ymax := 1.725; time_format := "%S%2%"; title_suffix := "near 1961-08-01 (TAI)"; xlabel_step := 0.05 /. (scale *. 86400.0); if kind = 1 then ( if_TAI_time_format := true; xtitle := "Seconds (TAI)"; ) else ( if_TAI_time_format := false; xtitle := "Seconds (TAI) labelled with corresponding UTC"; ) | 3 | 4 -> xmin := plctime 1963 10 1 0 0 (2.6972788 -. 0.20); xmax := plctime 1963 10 1 0 0 (2.6972788 +. 0.20); npts := 1001; ymin := 2.55; ymax := 2.75; time_format := "%S%2%"; title_suffix := "near 1963-11-01 (TAI)"; xlabel_step := 0.05 /. (scale *. 86400.0); if kind = 3 then ( if_TAI_time_format := true; xtitle := "Seconds (TAI)"; ) else ( if_TAI_time_format := false; xtitle := "Seconds (TAI) labelled with corresponding UTC"; ) | 5 | 6 -> xmin := plctime 2009 0 1 0 0 (34.0 -. 5.0); xmax := plctime 2009 0 1 0 0 (34.0 +. 5.0); npts := 1001; ymin := 32.5; ymax := 34.5; time_format := "%S%2%"; title_suffix := "near 2009-01-01 (TAI)"; xlabel_step := 1.0 /. (scale *. 86400.0); if kind = 5 then ( if_TAI_time_format := true; xtitle := "Seconds (TAI)"; ) else ( if_TAI_time_format := false; xtitle := "Seconds (TAI) labelled with corresponding UTC"; ) | _ -> failwith "Bad plot kind" in let x = Array.make 1001 0.0 in let y = Array.make 1001 0.0 in for i = 0 to !npts - 1 do x.(i) <- !xmin +. float_of_int i *. (!xmax -. !xmin) /. (float_of_int (!npts - 1)); plconfigtime scale offset1 offset2 0x0 false 0 0 0 0 0 0.0; let tai = x.(i) in (* The "full" calls to plbtime are commented out to avoid OCaml compilation warnings. *) (* let tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec = plbtime tai in *) ignore (plbtime tai); plconfigtime scale offset1 offset2 0x2 false 0 0 0 0 0 0.0; let utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec = plbtime tai in plconfigtime scale offset1 offset2 0x0 false 0 0 0 0 0 0.0; let utc = plctime utc_year utc_month utc_day utc_hour utc_min utc_sec in y.(i) <- (tai -. utc) *. scale *. 86400.0; done; pladv 0; plvsta (); plwind !xmin !xmax !ymin !ymax; plcol0 1; plconfigtime scale offset1 offset2 (if !if_TAI_time_format then 0x0 else 0x2) false 0 0 0 0 0 0.0; pltimefmt !time_format; plbox "bcnstd" !xlabel_step 0 "bcnstv" 0.0 0; plcol0 3; let title = sprintf "#frPLplot Example 29 - TAI-UTC %s" !title_suffix in pllab !xtitle "TAI-UTC (sec)" title; plcol0 4; plline (Array.sub x 0 !npts) (Array.sub y 0 !npts); done; () (*--------------------------------------------------------------------------*\ * Draws several plots which demonstrate the use of date / time formats for * the axis labels. * Time formatting is done using the system strftime routine. See the * documentation of this for full details of the available formats. * * 1) Plotting temperature over a day (using hours / minutes) * 2) Plotting * * Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). \*--------------------------------------------------------------------------*) let () = (* Parse command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); plot1 (); plot2 (); plot3 (); plot4 (); (* Don't forget to call plend() to finish off! *) plend(); () plplot-5.10.0+dfsg/examples/ocaml/x07.ml 644 1750 1750 314711367044520 166200ustar andrewandrew(* $Id: x07.ml 10957 2010-05-01 15:31:28Z hezekiahcarty $ Font demo. *) open Plplot let base = [|0; 100; 0; 100; 200; 500; 600; 700; 800; 900; 2000; 2100; 2200; 2300; 2400; 2500; 2600; 2700; 2800; 2900|] (*--------------------------------------------------------------------------*\ * Displays the entire "plsym" symbol (font) set. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); plfontld 0; for l = 0 to 19 do if l = 2 then plfontld 1; pladv 0; (* Set up viewport and window *) plcol0 2; plvpor 0.15 0.95 0.1 0.9; plwind 0.0 1.0 0.0 1.0; (* Draw the grid using plbox *) plbox "bcg" 0.1 0 "bcg" 0.1 0; (* Write the digits below the frame *) plcol0 15; for i = 0 to 9 do plmtex "b" 1.5 (0.1 *. float_of_int i +. 0.05) 0.5 (string_of_int i); done; let k = ref 0 in for i = 0 to 9 do (* Write the digits to the left of the frame *) plmtex "lv" 1.0 (0.95 -. 0.1 *. float_of_int i) 1.0 (string_of_int (base.(l) + 10 * i)); for j = 0 to 9 do let x = 0.1 *. float_of_int j +. 0.05 in let y = 0.95 -. 0.1 *. float_of_int i in (* Display the symbols *) plsym [|x|] [|y|] (base.(l) + !k); incr k; done; done; if l < 2 then plmtex "t" 1.5 0.5 0.5 "PLplot Example 7 - PLSYM symbols (compact)" else plmtex "t" 1.5 0.5 0.5 "PLplot Example 7 - PLSYM symbols (extended)" done; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x03.ml 644 1750 1750 545511543675237 166330ustar andrewandrew(* $Id: x03.ml 11680 2011-03-27 17:57:51Z airwin $ Polar plot demo. Copyright (C) 2008, 2009 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 (*--------------------------------------------------------------------------*\ * main * * Generates polar plot, with 1-1 scaling. \*--------------------------------------------------------------------------*) let main () = let dtr = pi /. 180.0 in let x0 = Array.init 361 (fun i -> cos (dtr *. float_of_int i)) in let y0 = Array.init 361 (fun i -> sin (dtr *. float_of_int i)) in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Set orientation to portrait - note not all device drivers * support this, in particular most interactive drivers do not *) plsori 1; (* Initialize plplot *) plinit (); (* Set up viewport and window, but do not draw box *) plenv (-1.3) 1.3 (-1.3) 1.3 1 (-2); for i = 1 to 10 do (* Draw circles for polar grid *) let r = 0.1 *. float_of_int i in plarc 0.0 0.0 r r 0.0 360.0 0.0 false; done; plcol0 2; for i = 0 to 11 do let theta = 30.0 *. float_of_int i in let dx = cos (dtr *. theta) in let dy = sin (dtr *. theta) in (* Draw radial spokes for polar grid *) pljoin 0.0 0.0 dx dy; let text = string_of_int (int_of_float (floor (theta +. 0.5))) in (* Write labels for angle *) let offset = if theta < 9.99 then 0.45 else if theta < 99.9 then 0.30 else 0.15 in (* Slightly off zero to avoid floating point logic flips at 90 and 270 deg.*) if dx >= -0.00001 then plptex dx dy dx dy (-.offset) text else plptex dx dy (-.dx) (-.dy) (1.+.offset) text done; (* Draw the graph *) let x = Array.init 361 (fun i -> x0.(i) *. sin (dtr *. float_of_int (5 * i))) in let y = Array.init 361 (fun i -> y0.(i) *. sin (dtr *. float_of_int (5 * i))) in plcol0 3; plline x y; plcol0 4; plmtex "t" 2.0 0.5 0.5 "#frPLplot Example 3 - r(#gh)=sin 5#gh"; (* Close the plot at end *) plend (); () let () = main () plplot-5.10.0+dfsg/examples/ocaml/x09.ml 644 1750 1750 2243111543675237 166520ustar andrewandrew(* $Id: x09.ml 11680 2011-03-27 17:57:51Z airwin $ Contour plot demo. Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 let xpts = 35 (* Data points in x *) let ypts = 46 (* Data points in y *) let xspa = 2.0 /. float_of_int (xpts - 1) let yspa = 2.0 /. float_of_int (ypts - 1) (* polar plot data *) let perimeterpts = 100 let rpts = 40 let thetapts = 40 (* potential plot data *) let pperimeterpts = 100 let prpts = 40 let pthetapts = 64 let pnlevel = 20 let clevel = [|-1.0; -0.8; -0.6; -0.4; -0.2; 0.0; 0.2; 0.4; 0.6; 0.8; 1.0|] (* Transformation function *) let tr = [|xspa; 0.0; -1.0; 0.0; yspa; -1.0|] let mypltr x y = tr.(0) *. x +. tr.(1) *. y +. tr.(2), tr.(3) *. x +. tr.(4) *. y +. tr.(5) (* Polar contour plot example. *) let polar () = plenv (-1.0) 1.0 (-1.0) 1.0 0 (-2); plcol0 1; (* Perimeter *) let t = Array.init perimeterpts ( fun i -> (2.0 *. pi /. float_of_int (perimeterpts - 1)) *. float_of_int i ) in let px = Array.map cos t in let py = Array.map sin t in plline px py; (* Create data to be contoured. *) let xg = Array.make_matrix rpts thetapts 0.0 in let yg = Array.make_matrix rpts thetapts 0.0 in let z = Array.make_matrix rpts thetapts 0.0 in for i = 0 to rpts - 1 do let r = float_of_int i /. float_of_int (rpts - 1) in for j = 0 to thetapts - 1 do let theta = (2.0 *. pi /. float_of_int (thetapts - 1)) *. float_of_int j in xg.(i).(j) <- r *. cos theta; yg.(i).(j) <- r *. sin theta; z.(i).(j) <- r; done done; let lev = Array.init 10 (fun i -> 0.05 +. 0.10 *. float_of_int i) in plcol0 2; plset_pltr (pltr2 xg yg); plcont z 1 rpts 1 thetapts lev; plunset_pltr (); plcol0 1; pllab "" "" "Polar Contour Plot"; () (*--------------------------------------------------------------------------*\ * f2mnmx * * Returns min & max of input 2d array. \*--------------------------------------------------------------------------*) let f2mnmx f = let fmax = ref f.(0).(0) in let fmin = ref f.(0).(0) in for i = 0 to Array.length f - 1 do for j = 0 to Array.length f.(i) - 1 do fmax := max !fmax f.(i).(j); fmin := min !fmin f.(i).(j); done done; !fmin, !fmax (* Shielded potential contour plot example. *) let potential () = (* Create data to be contoured. *) let xg = Array.make_matrix prpts pthetapts 0.0 in let yg = Array.make_matrix prpts pthetapts 0.0 in let z = Array.make_matrix prpts pthetapts 0.0 in let r = ref 0.0 in for i = 0 to prpts - 1 do r := 0.5 +. float_of_int i; for j = 0 to pthetapts - 1 do let theta = (2.0 *. pi /. float_of_int (pthetapts - 1)) *. (0.5 +. float_of_int j) in xg.(i).(j) <- !r *. cos theta; yg.(i).(j) <- !r *. sin theta; done done; let rmax = !r in let xmin, xmax = f2mnmx xg in let ymin, ymax = f2mnmx yg in let x0 = (xmin +. xmax) /. 2.0 in let y0 = (ymin +. ymax) /. 2.0 in (* Expanded limits *) let peps = 0.05 in let xpmin = xmin -. abs_float xmin *. peps in let xpmax = xmax +. abs_float xmax *. peps in let ypmin = ymin -. abs_float ymin *. peps in let ypmax = ymax +. abs_float ymax *. peps in (* Potential inside a conducting cylinder (or sphere) by method of images. Charge 1 is placed at (d1, d1), with image charge at (d2, d2). Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). Also put in smoothing term at small distances. *) let eps = 2.0 in let q1 = 1.0 in let d1 = rmax /. 4.0 in let q1i = ~-. q1 *. rmax /. d1 in let d1i = rmax**2.0 /. d1 in let q2 = -1.0 in let d2 = rmax /. 4.0 in let q2i = ~-. q2 *. rmax /. d2 in let d2i = rmax**2.0 /. d2 in for i = 0 to prpts - 1 do for j = 0 to pthetapts - 1 do let div1 = sqrt ((xg.(i).(j) -. d1)**2.0 +. (yg.(i).(j) -. d1)**2.0 +. eps**2.0) in let div1i = sqrt ((xg.(i).(j) -. d1i)**2.0 +. (yg.(i).(j) -. d1i)**2.0 +. eps**2.0) in let div2 = sqrt ((xg.(i).(j) -. d2)**2.0 +. (yg.(i).(j) +. d2)**2.0 +. eps**2.0) in let div2i = sqrt ((xg.(i).(j) -. d2i)**2.0 +. (yg.(i).(j) +. d2i)**2.0 +. eps**2.0) in z.(i).(j) <- q1 /. div1 +. q1i /. div1i +. q2 /. div2 +. q2i /. div2i; done done; let zmin, zmax = f2mnmx z in (* Positive and negative contour levels. *) let dz = (zmax -. zmin) /. float_of_int pnlevel in let nlevelneg = ref 0 in let nlevelpos = ref 0 in let clevelneg = Array.make pnlevel 0.0 in let clevelpos = Array.make pnlevel 0.0 in for i = 0 to pnlevel - 1 do let clevel = zmin +. (float_of_int i +. 0.5) *. dz in if clevel <= 0.0 then ( clevelneg.(!nlevelneg) <- clevel; incr nlevelneg; ) else ( clevelpos.(!nlevelpos) <- clevel; incr nlevelpos; ) done; (* Colors! *) let ncollin = 11 in let ncolbox = 1 in let ncollab = 2 in (* Finally start plotting this page! *) pladv 0; plcol0 ncolbox; plvpas 0.1 0.9 0.1 0.9 1.0; plwind xpmin xpmax ypmin ypmax; plbox "" 0.0 0 "" 0.0 0; plcol0 ncollin; plset_pltr (pltr2 xg yg); if !nlevelneg > 0 then ( (* Negative contours *) pllsty 2; plcont z 1 prpts 1 pthetapts (Array.sub clevelneg 0 !nlevelneg); ); if !nlevelpos > 0 then ( (* Positive contours*) pllsty 1; plcont z 1 prpts 1 pthetapts (Array.sub clevelpos 0 !nlevelpos); ); plunset_pltr (); (* Draw outer boundary *) let px = Array.make pperimeterpts 0.0 in let py = Array.make pperimeterpts 0.0 in for i = 0 to pperimeterpts - 1 do let t = (2.0 *. pi /. float_of_int (pperimeterpts - 1)) *. float_of_int i in px.(i) <- x0 +. rmax *. cos t; py.(i) <- y0 +. rmax *. sin t; done; plcol0 ncolbox; plline px py; plcol0 ncollab; pllab "" "" "Shielded potential of charges in a conducting sphere"; () (*--------------------------------------------------------------------------*\ * Does several contour plots using different coordinate mappings. \*--------------------------------------------------------------------------*) let () = let mark = [|1500|] in let space = [|1500|] in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Set up function arrays *) let z = Array.make_matrix xpts ypts 0.0 in let w = Array.make_matrix xpts ypts 0.0 in for i = 0 to xpts - 1 do let xx = float_of_int (i - (xpts / 2)) /. float_of_int (xpts / 2) in for j = 0 to ypts - 1 do let yy = float_of_int (j - (ypts / 2)) /. float_of_int (ypts / 2) -. 1.0 in z.(i).(j) <- xx *. xx -. yy *. yy; w.(i).(j) <- 2.0 *. xx *. yy; done done; (* Set up grids *) let cgrid1_xg = Array.make xpts 0.0 in let cgrid1_yg = Array.make ypts 0.0 in let cgrid2_xg = Array.make_matrix xpts ypts 0.0 in let cgrid2_yg = Array.make_matrix xpts ypts 0.0 in for i = 0 to xpts - 1 do for j = 0 to ypts - 1 do let xx, yy = mypltr (float_of_int i) (float_of_int j) in let argx = xx *. pi /. 2.0 in let argy = yy *. pi /. 2.0 in let distort = 0.4 in cgrid1_xg.(i) <- xx +. distort *. cos argx; cgrid1_yg.(j) <- yy -. distort *. cos argy; cgrid2_xg.(i).(j) <- xx +. distort *. cos argx *. cos argy; cgrid2_yg.(i).(j) <- yy -. distort *. cos argx *. cos argy; done done; (* Plot using identity transform *) pl_setcontlabelformat 4 3; pl_setcontlabelparam 0.006 0.3 0.1 1; plenv (-1.0) 1.0 (-1.0) 1.0 0 0; plcol0 2; plset_pltr mypltr; plcont z 1 xpts 1 ypts clevel; plstyl mark space; plcol0 3; plcont w 1 xpts 1 ypts clevel; plstyl [||] [||]; plcol0 1; pllab "X Coordinate" "Y Coordinate" "Streamlines of flow"; pl_setcontlabelparam 0.006 0.3 0.1 0; (* Plot using 1d coordinate transform *) plenv (-1.0) 1.0 (-1.0) 1.0 0 0; plcol0 2; plset_pltr (pltr1 cgrid1_xg cgrid1_yg); plcont z 1 xpts 1 ypts clevel; plstyl mark space; plcol0 3; plcont w 1 xpts 1 ypts clevel; plstyl [||] [||]; plcol0 1; pllab "X Coordinate" "Y Coordinate" "Streamlines of flow"; (* Plot using 2d coordinate transform *) plenv (-1.0) 1.0 (-1.0) 1.0 0 0; plcol0 2; plset_pltr (pltr2 cgrid2_xg cgrid2_yg); plcont z 1 xpts 1 ypts clevel; plstyl mark space; plcol0 3; plcont w 1 xpts 1 ypts clevel; plstyl [||] [||]; plcol0 1; pllab "X Coordinate" "Y Coordinate" "Streamlines of flow"; (* Unset the plotting coordinate transformation function *) plunset_pltr (); pl_setcontlabelparam 0.006 0.3 0.1 0; polar (); pl_setcontlabelparam 0.006 0.3 0.1 0; potential (); plend (); () plplot-5.10.0+dfsg/examples/ocaml/x23.ml 644 1750 1750 2323711550471073 166410ustar andrewandrew(* Displays Greek letters and mathematically interesting Unicode ranges Copyright (C) 2005,2008 Alan Irwin Copyright (C) 2005,2008 Andrew Ross Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot open Printf (* * Displays Greek letters and mathematically interesting Unicode ranges *) let greek = [| "#gA";"#gB";"#gG";"#gD";"#gE";"#gZ";"#gY";"#gH";"#gI";"#gK";"#gL";"#gM"; "#gN";"#gC";"#gO";"#gP";"#gR";"#gS";"#gT";"#gU";"#gF";"#gX";"#gQ";"#gW"; "#ga";"#gb";"#gg";"#gd";"#ge";"#gz";"#gy";"#gh";"#gi";"#gk";"#gl";"#gm"; "#gn";"#gc";"#go";"#gp";"#gr";"#gs";"#gt";"#gu";"#gf";"#gx";"#gq";"#gw"; |] let type1 = [| 0x0020;0x0021;0x0023;0x0025;0x0026; 0x0028;0x0029;0x002b;0x002c;0x002e; 0x002f;0x0030;0x0031;0x0032;0x0033; 0x0034;0x0035;0x0036;0x0037;0x0038; 0x0039;0x003a;0x003b;0x003c;0x003d; 0x003e;0x003f;0x005b;0x005d;0x005f; 0x007b;0x007c;0x007d;0x00a9;0x00ac; 0x00ae;0x00b0;0x00b1;0x00d7;0x00f7; 0x0192;0x0391;0x0392;0x0393;0x0394; 0x0395;0x0396;0x0397;0x0398;0x0399; 0x039a;0x039b;0x039c;0x039d;0x039e; 0x039f;0x03a0;0x03a1;0x03a3;0x03a4; 0x03a5;0x03a6;0x03a7;0x03a8;0x03a9; 0x03b1;0x03b2;0x03b3;0x03b4;0x03b5; 0x03b6;0x03b7;0x03b8;0x03b9;0x03ba; 0x03bb;0x03bc;0x03bd;0x03be;0x03bf; 0x03c0;0x03c1;0x03c2;0x03c3;0x03c4; 0x03c5;0x03c6;0x03c7;0x03c8;0x03c9; 0x03d1;0x03d2;0x03d5;0x03d6;0x2022; 0x2026;0x2032;0x2033;0x203e;0x2044; 0x2111;0x2118;0x211c;0x2122;0x2126; 0x2135;0x2190;0x2191;0x2192;0x2193; 0x2194;0x21b5;0x21d0;0x21d1;0x21d2; 0x21d3;0x21d4;0x2200;0x2202;0x2203; 0x2205;0x2206;0x2207;0x2208;0x2209; 0x220b;0x220f;0x2211;0x2212;0x2215; 0x2217;0x221a;0x221d;0x221e;0x2220; 0x2227;0x2228;0x2229;0x222a;0x222b; 0x2234;0x223c;0x2245;0x2248;0x2260; 0x2261;0x2264;0x2265;0x2282;0x2283; 0x2284;0x2286;0x2287;0x2295;0x2297; 0x22a5;0x22c5;0x2320;0x2321;0x2329; 0x232a;0x25ca;0x2660;0x2663;0x2665; 0x2666; |] let title = [| "#<0x10>PLplot Example 23 - Greek Letters"; "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)"; "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)"; "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)"; "#<0x10>PLplot Example 23 - Number Forms Unicode Block"; "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)"; "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)"; "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)"; "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)"; "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)"; "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)"; |] let lo = [| 0x0; 0x0; 0x40; 0x80; 0x2153; 0x2190; 0x21d0; 0x2200; 0x2240; 0x2280; 0x22c0; |] let hi = [| 0x30; 0x40; 0x80; 0xA6; 0x2184; 0x21d0; 0x2200; 0x2240; 0x2280; 0x22c0; 0x2300; |] let nxcells = [| 12; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; |] let nycells = [| 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; 8; |] (* non-zero values Must be consistent with nxcells and nycells. *) let offset = [| 0; 0; 64; 128; 0; 0; 0; 0; 0; 0; 0; |] (* 30 possible FCI values. *) let fci_combinations = 30 let fci = [| 0x80000000L; 0x80000001L; 0x80000002L; 0x80000003L; 0x80000004L; 0x80000010L; 0x80000011L; 0x80000012L; 0x80000013L; 0x80000014L; 0x80000020L; 0x80000021L; 0x80000022L; 0x80000023L; 0x80000024L; 0x80000100L; 0x80000101L; 0x80000102L; 0x80000103L; 0x80000104L; 0x80000110L; 0x80000111L; 0x80000112L; 0x80000113L; 0x80000114L; 0x80000120L; 0x80000121L; 0x80000122L; 0x80000123L; 0x80000124L; |] let family = [| "sans-serif"; "serif"; "monospace"; "script"; "symbol"; |] let style = [| "upright"; "italic"; "oblique"; |] let weight = [| "medium"; "bold"; |] let family_of_int = [| PL_FCI_SANS; PL_FCI_SERIF; PL_FCI_MONO; PL_FCI_SCRIPT; PL_FCI_SYMBOL; |] let style_of_int = [| PL_FCI_UPRIGHT; PL_FCI_ITALIC; PL_FCI_OBLIQUE; |] let weight_of_int = [| PL_FCI_MEDIUM; PL_FCI_BOLD; |] let () = plparseopts Sys.argv [PL_PARSE_FULL]; plinit (); for page = 0 to 10 do pladv 0; (* Set up viewport and window *) plvpor 0.02 0.98 0.02 0.90; plwind 0.0 1.0 0.0 1.0; let xmin, xmax, ymin, ymax = plgspa () in plschr 0.0 0.8; let ycharacter_scale = 1.0 /. (ymax -. ymin) in (* Factor should be 0.5, but heuristically it turns out to be larger. *) let chardef, charht = plgchr () in let yoffset = 1.0 *. charht *. ycharacter_scale in (* Draw the grid using plbox *) plcol0 2; let deltax = 1.0 /. float_of_int nxcells.(page) in let deltay = 1.0 /. float_of_int nycells.(page) in plbox "bcg" deltax 0 "bcg" deltay 0; plcol0 15; let length = hi.(page) - lo.(page) in let slice = ref 0 in for j = nycells.(page) - 1 downto -1 do let y = (0.5 +. float_of_int j) *. deltay in for i = 0 to nxcells.(page) - 1 do let x = (0.5 +. float_of_int i) *. deltax in if !slice < length then ( let cmdString = match page with 0 -> sprintf "#%s" greek.(!slice) | 1 | 2 | 3 -> sprintf "##[0x%.4x]" type1.(offset.(page) + !slice) | _ -> sprintf "##[0x%.4x]" (lo.(page) + !slice); in let cmdString' = String.sub cmdString 1 (String.length cmdString - 1) in plptex x (y +. yoffset) 1.0 0.0 0.5 cmdString'; plptex x (y -. yoffset) 1.0 0.0 0.5 cmdString; ); incr slice; done done; plschr 0.0 1.0; (* Page title *) plmtex "t" 1.5 0.5 0.5 title.(page); done; (* Demonstrate methods of getting the current fonts *) let fci_old = plgfci () in let ifamily, istyle, iweight = plgfont () in printf "For example 23 prior to page 12 the FCI is 0x%lx\n" (Int64.to_int32 fci_old); printf "For example 23 prior to page 12 the font family, style and weight are %s %s %s\n" family.(ifamily) style.(istyle) weight.(iweight); for page = 11 to 15 do let dy = 0.030 in pladv 0; plvpor 0.02 0.98 0.02 0.90; plwind 0.0 1.0 0.0 1.0; plsfci 0L; let () = match page with 11 -> plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with plsfci"; | 12 -> plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with plsfont"; | 13 -> plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct"; | 14 -> plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs"; | 15 -> plmtex "t" 1.5 0.5 0.5 "#<0x10>PLplot Example 23 - Set Font with ## constructs"; | _ -> failwith "Invalid page" in plschr 0.0 0.75; for i = 0 to fci_combinations - 1 do let family_index = i mod 5 in let style_index = (i / 5) mod 3 in let weight_index = ((i / 5) / 3) mod 2 in let text_string = match page with 11 -> plsfci fci.(i); sprintf "Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog" family.(family_index) style.(style_index) weight.(weight_index); | 12 -> plsfont family_of_int.(family_index) style_of_int.(style_index) weight_of_int.(weight_index); sprintf "Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog" family.(family_index) style.(style_index) weight.(weight_index); | 13 -> sprintf "Page 14, %s, %s, %s: #<0x%Lx>The quick brown fox jumps over the lazy dog" family.(family_index) style.(style_index) weight.(weight_index) fci.(i); | 14 -> sprintf "Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>The quick brown fox jumps over the lazy dog" family.(family_index) style.(style_index) weight.(weight_index) family_index style_index weight_index; | 15 -> sprintf "Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>The quick brown fox jumps over the lazy dog" family.(family_index) style.(style_index) weight.(weight_index) family.(family_index) style.(style_index) weight.(weight_index); | _ -> failwith "Invalid page" in plptex 0.0 (1.0 -. (float_of_int i +. 0.5) *. dy) 1.0 0.0 0.0 text_string; done; plschr 0.0 1.0; done; (* Restore defaults *) plcol0 1; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x31.ml 644 1750 1750 1647711543675237 166620ustar andrewandrew(* $Id: x31.ml 11680 2011-03-27 17:57:51Z airwin $ Copyright (C) 2008 Alan W. Irwin Copyright (C) 2008 Andrew Ross Copyright (C) 2008 Hezekiah M. Carty set/get tester This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Printf open Plplot let () = let r1 = [|0; 255|] in let g1 = [|255; 0|] in let b1 = [|0; 0|] in let a1 = [|1.0; 1.0|] in let status = ref 0 in let failed_if t s = if t then ( eprintf s; status := 1; ); in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Test setting / getting familying parameters before plinit *) (* Save values set by plparseopts to be restored later. *) let fam0, num0, bmax0 = plgfam () in let fam1 = 0 in let num1 = 10 in let bmax1 = 1000 in plsfam fam1 num1 bmax1; (* Retrieve the same values? *) let fam2, num2, bmax2 = plgfam () in printf "family parameters: fam, num, bmax = %d %d %d\n" fam2 num2 bmax2; failed_if (fam2 <> fam1 || num2 <> num1 || bmax2 <> bmax1) "plgfam test failed\n"; (* Restore values set initially by plparseopts. *) plsfam fam0 num0 bmax0; (* Test setting / getting page parameters before plinit *) (* Save values set by plparseopts to be restored later. *) let xp0, yp0, xleng0, yleng0, xoff0, yoff0 = plgpage () in let xp1 = 200. in let yp1 = 200. in let xleng1 = 400 in let yleng1 = 200 in let xoff1 = 10 in let yoff1 = 20 in plspage xp1 yp1 xleng1 yleng1 xoff1 yoff1; (* Retrieve the same values? *) let xp2, yp2, xleng2, yleng2, xoff2, yoff2 = plgpage () in printf "page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d\n" xp2 yp2 xleng2 yleng2 xoff2 yoff2; failed_if (xp2 <> xp1 || yp2 <> yp1 || xleng2 <> xleng1 || yleng2 <> yleng1 || xoff2 <> xoff1 || yoff2 <> yoff1) "plgpage test failed\n"; (* Restore values set initially by plparseopts. *) plspage xp0 yp0 xleng0 yleng0 xoff0 yoff0; (* Test setting / getting compression parameter across plinit. *) let compression1 = 95 in plscompression compression1; (* Initialize plplot *) plinit (); (* Test if device initialization screwed around with the preset compression parameter. *) let compression2 = plgcompression () in printf "Output various PLplot parameters\n"; printf "compression parameter = %d\n" compression2; failed_if (compression2 <> compression1) "plgcompression test failed\n"; (* Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure they work without any obvious error messages. *) plscolor 1; plscol0 1 255 0 0; plscmap1 r1 g1 b1; plscmap1a r1 g1 b1 a1; let level2 = plglevel () in (* WARNING: The use of Obj.magic here is a cheat. This really should be replaced by a proper int_of_plplot_run_level function. This example is the only place it would be needed though, so it is not worth it at this time. *) printf "level parameter = %d\n" (Obj.magic level2); failed_if (level2 <> PL_INITIALIZED) "plglevel test failed.\n"; pladv 0; plvpor 0.01 0.99 0.02 0.49; let xmin, xmax, ymin, ymax = plgvpd () in printf "plvpor: xmin, xmax, ymin, ymax = %f %f %f %f\n" xmin xmax ymin ymax; failed_if (xmin <> 0.01 || xmax <> 0.99 || ymin <> 0.02 || ymax <> 0.49) "plgvpd test failed\n"; let xmid = 0.5 *. (xmin +. xmax) in let ymid = 0.5 *. (ymin +. ymax) in plwind 0.2 0.3 0.4 0.5; let xmin, xmax, ymin, ymax = plgvpw () in printf "plwind: xmin, xmax, ymin, ymax = %f %f %f %f\n" xmin xmax ymin ymax; failed_if (xmin <> 0.2 || xmax <> 0.3 || ymin <> 0.4 || ymax <> 0.5) "plgvpw test failed\n"; (* Get world coordinates for middle of viewport *) let wx, wy, win = plcalc_world xmid ymid in printf "world parameters: wx, wy, win = %f %f %d\n" wx wy win; failed_if ( abs_float (wx -. 0.5 *. (xmin +. xmax)) > 1.0E-5 || abs_float (wy -. 0.5 *. (ymin +. ymax)) > 1.0E-5 ) "plcalc_world test failed\n"; (* Retrieve and print the name of the output file (if any). This goes to stderr not stdout since it will vary between tests and we want stdout to be identical for compare test. *) let fnam = plgfnam () in if String.length fnam = 0 then printf "No output file name is set\n" else printf"Output file name read\n"; eprintf "Output file name is %s\n" fnam; (* Set and get the number of digits used to display axis labels *) (* Note digits is currently ignored in pls[xyz]ax and therefore it does not make sense to test the returned value *) plsxax 3 0; let digmax, digits = plgxax () in printf "x axis parameters: digmax, digits = %d %d\n" digmax digits; failed_if (digmax <> 3) "plgxax test failed\n"; plsyax 4 0; let digmax, digits = plgyax () in printf "y axis parameters: digmax, digits = %d %d\n" digmax digits; failed_if (digmax <> 4) "plgyax test failed\n"; plszax 5 0; let digmax, digits = plgzax () in printf "z axis parameters: digmax, digits = %d %d\n" digmax digits; failed_if (digmax <> 5) "plgzax test failed\n"; plsdidev 0.05 (-42.0) 0.1 0.2; let mar, aspect, jx, jy = plgdidev () in printf "device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n" mar aspect jx jy; failed_if (mar <> 0.05 || jx <> 0.1 || jy <> 0.2) "plgdidev test failed\n"; plsdiori 1.0; let ori = plgdiori () in printf "ori parameter = %f\n" ori; failed_if (ori <> 1.0) "plgdiori test failed\n"; plsdiplt 0.1 0.2 0.9 0.8; let xmin, ymin, xmax, ymax = plgdiplt () in printf "plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n" xmin ymin xmax ymax; failed_if (xmin <> 0.1 || xmax <> 0.9 || ymin <> 0.2 || ymax <> 0.8) "plgdiplt test failed\n"; plsdiplz 0.1 0.1 0.9 0.9; let zxmin, zymin, zxmax, zymax = plgdiplt () in printf "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n" zxmin zymin zxmax zymax; failed_if ( abs_float (zxmin -. (xmin +. (xmax -. xmin) *. 0.1)) > 1.0E-5 || abs_float (zxmax -. (xmin +. (xmax -. xmin) *. 0.9)) > 1.0E-5 || abs_float (zymin -. (ymin +. (ymax -. ymin) *. 0.1)) > 1.0E-5 || abs_float (zymax -. (ymin +. (ymax -. ymin) *. 0.9)) > 1.0E-5 ) "plsdiplz test failed\n"; plscolbg 10 20 30; let r, g, b = plgcolbg () in printf "background colour parameters: r, g, b = %d %d %d\n" r g b; failed_if (r <> 10 || g <> 20 || b <> 30) "plgcolbg test failed\n"; plscolbga 20 30 40 0.5; let r, g, b, a = plgcolbga () in printf "background/transparency colour parameters: r, g, b, a = %d %d %d %f\n" r g b a; failed_if (r <> 20 || g <> 30 || b <> 40 || a <> 0.5) "plgcolbga test failed\n"; plend (); exit !status plplot-5.10.0+dfsg/examples/ocaml/x33.ml 644 1750 1750 4747012140065762 166470ustar andrewandrew(* -*- coding: utf-8; -*- $Id$ Demonstrate most pllegend capability including unicode symbols. Copyright (C) 2010 Alan Irwin Copyright (C) 2011 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) (* This example designed just for devices (e.g., the cairo-related and qt-related devices) where the best choice of glyph is automatically selected by the related libraries (pango/cairo or Qt4) for each unicode character depending on what system fonts are installed. Of course, you must have the appropriate TrueType fonts installed to have access to all the required glyphs. *) open Plplot open Printf let position_options = [| [PL_POSITION_LEFT; PL_POSITION_TOP; PL_POSITION_OUTSIDE]; [PL_POSITION_TOP; PL_POSITION_OUTSIDE]; [PL_POSITION_RIGHT; PL_POSITION_TOP; PL_POSITION_OUTSIDE]; [PL_POSITION_RIGHT; PL_POSITION_OUTSIDE]; [PL_POSITION_RIGHT; PL_POSITION_BOTTOM; PL_POSITION_OUTSIDE]; [PL_POSITION_BOTTOM; PL_POSITION_OUTSIDE]; [PL_POSITION_LEFT; PL_POSITION_BOTTOM; PL_POSITION_OUTSIDE]; [PL_POSITION_LEFT; PL_POSITION_OUTSIDE]; [PL_POSITION_LEFT; PL_POSITION_TOP; PL_POSITION_INSIDE]; [PL_POSITION_TOP; PL_POSITION_INSIDE]; [PL_POSITION_RIGHT; PL_POSITION_TOP; PL_POSITION_INSIDE]; [PL_POSITION_RIGHT; PL_POSITION_INSIDE]; [PL_POSITION_RIGHT; PL_POSITION_BOTTOM; PL_POSITION_INSIDE]; [PL_POSITION_BOTTOM; PL_POSITION_INSIDE]; [PL_POSITION_LEFT; PL_POSITION_BOTTOM; PL_POSITION_INSIDE]; [PL_POSITION_LEFT; PL_POSITION_INSIDE]; |] (* Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). *) let special_symbols = [| "✰"; "✴"; "✱"; "✽"; "✦"; |] (* main Demonstrate most pllegend capability including unicode symbols. *) let max_nlegend = 7 let () = let opt_array = Array.make max_nlegend [] in let box_colors = Array.make max_nlegend 0 in let box_patterns = Array.make max_nlegend 0 in let box_scales = Array.make max_nlegend 0.0 in let box_line_widths = Array.make max_nlegend 0.0 in let line_colors = Array.make max_nlegend 0 in let line_styles = Array.make max_nlegend 0 in let line_widths = Array.make max_nlegend 0.0 in let symbol_numbers = Array.make max_nlegend 0 in let symbol_colors = Array.make max_nlegend 0 in let symbol_scales = Array.make max_nlegend 0.0 in let symbols = Array.make max_nlegend "" in let text = Array.make max_nlegend "" in let text_colors = Array.make max_nlegend 0 in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* First page illustrating the 16 standard positions. *) pladv 0; plvpor 0.25 0.75 0.25 0.75; plwind 0.0 1.0 0.0 1.0; plbox "bc" 0.0 0 "bc" 0.0 0; plsfont PL_FCI_SANS PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plmtex "t" 8.0 0.5 0.5 "The 16 standard legend positions with"; plmtex "t" 6.0 0.5 0.5 "the same (0.05) offset in x and y"; let nlegend = 1 in (* Only specify legend data that are required according to the value of opt_array for that entry. *) let opt_base = [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] in opt_array.(0) <- [PL_LEGEND_LINE; PL_LEGEND_SYMBOL]; line_styles.(0) <- 1; line_widths.(0) <- 1.0; symbol_scales.(0) <- 1.; symbol_numbers.(0) <- 4; symbols.(0) <- "*"; (* Use monotype fonts so that all legends are the same size. *) plsfont PL_FCI_MONO PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plscol0a 15 32 32 32 0.70; for k = 0 to 15 do let opt_array = Array.sub opt_array 0 nlegend in let position = position_options.(k) in let opt = opt_base in text.(0) <- sprintf "%2.2d" k; text_colors.(0) <- 1 + ( k mod 8 ); line_colors.(0) <- 1 + ( k mod 8 ); symbol_colors.(0) <- 1 + ( k mod 8 ); ignore ( pllegend opt position 0.05 0.05 0.1 15 1 1 0 0 opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); done; (* Second page illustrating effect of nrow, ncolumn for the same legend data. *) pladv 0; plvpor 0.25 0.75 0.25 0.75; plwind 0.0 1.0 0.0 1.0; plbox "bc" 0.0 0 "bc" 0.0 0; plsfont PL_FCI_SANS PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plmtex "t" 8.0 0.5 0.5 "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,"; plmtex "t" 6.0 0.5 0.5 "and position for the same legend data"; let nlegend = 7 in (* Only specify legend data that are required according to the value of opt_array for that entry. *) let opt_base = [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] in for k = 0 to nlegend - 1 do opt_array.(k) <- [PL_LEGEND_LINE; PL_LEGEND_SYMBOL]; line_styles.(k) <- 1; line_widths.(k) <- 1.0; symbol_scales.(k) <- 1.0; symbol_numbers.(k) <- 2; symbols.(k) <- "*"; text.(k) <- sprintf "%2.2d" k; text_colors.(k) <- 1 + (k mod 8); line_colors.(k) <- 1 + (k mod 8); symbol_colors.(k) <- 1 + (k mod 8); done; (* Use monotype fonts so that all legends are the same size. *) plsfont PL_FCI_MONO PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plscol0a 15 32 32 32 0.70; let position = [PL_POSITION_TOP; PL_POSITION_OUTSIDE] in let opt = opt_base in let x = 0.0 in let y = 0.1 in let nrow = 1 in let ncolumn = nlegend in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols; ); let position = [PL_POSITION_BOTTOM; PL_POSITION_OUTSIDE] in let opt = opt_base in let x = 0.0 in let y = 0.1 in let nrow = 1 in let ncolumn = nlegend in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); let position = [PL_POSITION_LEFT; PL_POSITION_OUTSIDE] in let opt = opt_base in let x = 0.1 in let y = 0.0 in let nrow = nlegend in let ncolumn = 1 in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols; ); let position = [PL_POSITION_RIGHT; PL_POSITION_OUTSIDE] in let opt = opt_base in let x = 0.1 in let y = 0.0 in let nrow = nlegend in let ncolumn = 1 in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); let position = [PL_POSITION_LEFT; PL_POSITION_TOP; PL_POSITION_INSIDE] in let opt = opt_base in let x = 0.0 in let y = 0.0 in let nrow = 6 in let ncolumn = 2 in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); let position = [PL_POSITION_RIGHT; PL_POSITION_TOP; PL_POSITION_INSIDE] in let opt = PL_LEGEND_ROW_MAJOR :: opt_base in let x = 0.0 in let y = 0.0 in let nrow = 6 in let ncolumn = 2 in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); let position = [PL_POSITION_BOTTOM; PL_POSITION_INSIDE] in let opt = PL_LEGEND_ROW_MAJOR :: opt_base in let x = 0.0 in let y = 0.0 in let nrow = 3 in let ncolumn = 3 in ignore ( let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.05 15 1 1 nrow ncolumn opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); (* Third page demonstrating legend alignment *) pladv 0; plvpor 0.0 1.0 0.0 0.9; plwind 0.0 1.0 0.0 1.0; plsfont PL_FCI_SANS PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plmtex "t" 2.0 0.5 0.5 "Demonstrate legend alignment"; let x = ref 0.1 in let y = ref 0.1 in let nturn = 4 in let nlegend = ref 0 in let position = ref [PL_POSITION_TOP; PL_POSITION_LEFT; PL_POSITION_SUBPAGE] in let opt_base = [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] in let opt = ref opt_base in for i = 0 to 8 do (* Set up legend arrays with the correct size, type. *) if i <= nturn then incr nlegend else decr nlegend; nlegend := max 1 !nlegend; (* Only specify legend data that are required according to the value of opt_array for that entry. *) for k = 0 to !nlegend - 1 do opt_array.(k) <- [PL_LEGEND_LINE; PL_LEGEND_SYMBOL]; line_styles.(k) <- 1; line_widths.(k) <- 1.0; symbol_scales.(k) <- 1.; symbol_numbers.(k) <- 2; symbols.(k) <- "*"; text.(k) <- sprintf "%2.2d" k; text_colors.(k) <- 1 + (k mod 8); line_colors.(k) <- 1 + (k mod 8); symbol_colors.(k) <- 1 + (k mod 8); done; (* Use monotype fonts so that all legends are the same size. *) plsfont PL_FCI_MONO PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plscol0a 15 32 32 32 0.70; let nrow = min 3 !nlegend in let ncolumn = 0 in let legend_width, legend_height = let opt_array = Array.sub opt_array 0 !nlegend in pllegend !opt !position !x !y 0.025 15 1 1 nrow ncolumn opt_array 1.0 1.0 1.5 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols in if i = nturn then ( position := [PL_POSITION_TOP; PL_POSITION_RIGHT; PL_POSITION_SUBPAGE]; opt := opt_base; x := 1.0 -. !x; y := !y +. legend_height; ) else ( x := !x +. legend_width; y := !y +. legend_height; ); done; (* Fourth page illustrating various kinds of legends *) let max_height = 0.0 in let xstart = 0.0 in let ystart = 0.1 in let x = xstart in let y = ystart in let text_scale = 0.90 in pladv 0; plvpor 0.0 1.0 0.0 0.90; plwind 0.0 1.0 0.0 1.0; plsfont PL_FCI_SANS PL_FCI_STYLE_UNCHANGED PL_FCI_WEIGHT_UNCHANGED; plmtex "t" 2.0 0.5 0.5 "Demonstrate Various Kinds of Legends"; let nlegend = 5 in (* Only specify legend data that are required according to the value of opt_array for that entry. *) let position = [PL_POSITION_LEFT; PL_POSITION_TOP] in let opt_base = [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX; PL_LEGEND_TEXT_LEFT] in (* Set up None, Box, Line, Symbol, and Line & Symbol legend entries. *) opt_array.(0) <- [PL_LEGEND_NONE]; text.(0) <- sprintf "%s" "None"; text_colors.(0) <- 1; opt_array.(1) <- [PL_LEGEND_COLOR_BOX]; text.(1) <- sprintf "%s" "Box"; text_colors.(1) <- 2; box_colors.(1) <- 2; box_patterns.(1) <- 0; box_scales.(1) <- 0.8; box_line_widths.(1) <- 1.0; opt_array.(2) <- [PL_LEGEND_LINE]; text.(2) <- sprintf "%s" "Line"; text_colors.(2) <- 3; line_colors.(2) <- 3; line_styles.(2) <- 1; line_widths.(2) <- 1.0; opt_array.(3) <- [PL_LEGEND_SYMBOL]; text.(3) <- sprintf "%s" "Symbol"; text_colors.(3) <- 4; symbol_colors.(3) <- 4; symbol_scales.(3) <- text_scale; symbol_numbers.(3) <- 4; symbols.(3) <- special_symbols.(2); opt_array.(4) <- [PL_LEGEND_SYMBOL; PL_LEGEND_LINE]; text.(4) <- sprintf "%s" "L & S"; text_colors.(4) <- 5; line_colors.(4) <- 5; line_styles.(4) <- 1; line_widths.(4) <- 1.0; symbol_colors.(4) <- 5; symbol_scales.(4) <- text_scale; symbol_numbers.(4) <- 4; symbols.(4) <- special_symbols.(2); let opt = opt_base in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text box_colors box_patterns box_scales box_line_widths line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols in let max_height = max max_height legend_height in (* Set up symbol legend entries with various symbols. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_SYMBOL]; text.(i) <- sprintf "%s%s" "Symbol " special_symbols.(i); text_colors.(i) <- i + 1; symbol_colors.(i) <- i + 1; symbol_scales.(i) <- text_scale; symbol_numbers.(i) <- 4; symbols.(i) <- special_symbols.(i); done; let opt = opt_base in let x = x +. legend_width in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text [||] [||] [||] [||] [||] [||] [||] symbol_colors symbol_scales symbol_numbers symbols in let max_height = max max_height legend_height in (* Set up symbol legend entries with various numbers of symbols. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_SYMBOL]; text.(i) <- sprintf "%s %d" "Symbol Number" (i + 2); text_colors.(i) <- i + 1; symbol_colors.(i) <- i + 1; symbol_scales.(i) <- text_scale; symbol_numbers.(i) <- i + 2; symbols.(i) <- special_symbols.(2); done; let opt = opt_base in let x = x +. legend_width in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text [||] [||] [||] [||] [||] [||] [||] symbol_colors symbol_scales symbol_numbers symbols in let max_height = max max_height legend_height in (* Set up box legend entries with various colours. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_COLOR_BOX]; text.(i) <- sprintf "%s %d" "Box Color" (i + 1); text_colors.(i) <- i + 1; box_colors.(i) <- i + 1; box_patterns.(i) <- 0; box_scales.(i) <- 0.8; box_line_widths.(i) <- 1.0; done; let opt = opt_base in (* Use new origin *) let x = xstart in let y = y +. max_height in let max_height = 0.0 in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text box_colors box_patterns box_scales box_line_widths [||] [||] [||] [||] [||] [||] [||] in let max_height = max max_height legend_height in (* Set up box legend entries with various patterns. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_COLOR_BOX]; text.(i) <- sprintf "%s %d" "Box Pattern" i; text_colors.(i) <- 2; box_colors.(i) <- 2; box_patterns.(i) <- i; box_scales.(i) <- 0.8; box_line_widths.(i) <- 1.0; done; let opt = opt_base in let x = x +. legend_width in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text box_colors box_patterns box_scales box_line_widths [||] [||] [||] [||] [||] [||] [||] in let max_height = max max_height legend_height in (* Set up box legend entries with various box pattern line widths. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_COLOR_BOX]; text.(i) <- sprintf "%s %d" "Box Line Width" (i + 1); text_colors.(i) <- 2; box_colors.(i) <- 2; box_patterns.(i) <- 3; box_scales.(i) <- 0.8; box_line_widths.(i) <- float i +. 1.0; done; let opt = opt_base in let x = x +. legend_width in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text box_colors box_patterns box_scales box_line_widths [||] [||] [||] [||] [||] [||] [||] in let max_height = max max_height legend_height in (* Set up line legend entries with various colours. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_LINE]; text.(i) <- sprintf "%s %d" "Line Color" (i + 1); text_colors.(i) <- i + 1; line_colors.(i) <- i + 1; line_styles.(i) <- 1; line_widths.(i) <- 1.0; done; let opt = opt_base in (* Use new origin *) let x = xstart in let y = y +. max_height in let max_height = 0.0 in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths [||] [||] [||] [||] in let max_height = max max_height legend_height in (* Set up line legend entries with various styles. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_LINE]; text.(i) <- sprintf "%s %d" "Line Style" (i + 1); text_colors.(i) <- 2; line_colors.(i) <- 2; line_styles.(i) <- i + 1; line_widths.(i) <- 1.0; done; let opt = opt_base in let x = x +. legend_width in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths [||] [||] [||] [||] in let max_height = max max_height legend_height in (* Set up line legend entries with various widths. *) for i = 0 to nlegend - 1 do opt_array.(i) <- [PL_LEGEND_LINE]; text.(i) <- sprintf "%s %d" "Line Width" (i + 1); text_colors.(i) <- 2; line_colors.(i) <- 2; line_styles.(i) <- 1; line_widths.(i) <- float i +. 1.0; done; let opt = opt_base in let x = x +. legend_width in plscol0a 15 32 32 32 0.70; let legend_width, legend_height = let opt_array = Array.sub opt_array 0 nlegend in pllegend opt position x y 0.1 15 1 1 0 0 opt_array 1.0 text_scale 2.0 0.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths [||] [||] [||] [||] in let max_height = max max_height legend_height in (* Silence a warning, so the reset is here one the plcolorbar pages are added. *) ignore (max_height); plend(); () plplot-5.10.0+dfsg/examples/ocaml/CMakeLists.txt 644 1750 1750 2210311722014037 204140ustar andrewandrew# -*- mode: cmake -*- # examples/ocaml/CMakeLists.txt ### Process this file with cmake to produce Makefile # # # Copyright (C) 2008 Andrew Ross # Copyright (C) 2009 Alan W. Irwin # Copyright (C) 2009 Hezekiah M. Carty # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(ocaml_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" "34" "plot01" ) set(plcairo_STRING_INDICES "gtk_interface" ) # PLplot examples if(CORE_BUILD) set(ocaml_SRCS) foreach(STRING_INDEX ${ocaml_STRING_INDICES}) list(APPEND ocaml_SRCS x${STRING_INDEX}.ml) endforeach(STRING_INDEX ${ocaml_STRING_INDICES}) if(OCAMLOPT) set(OCAML_EXAMPLE_COMPILER ${OCAMLOPT}) set(OCAML_EXAMPLE_LIBEXT cmxa) else(OCAMLOPT) set(OCAML_EXAMPLE_COMPILER ${OCAMLC}) set(OCAML_EXAMPLE_LIBEXT cma) endif(OCAMLOPT) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${ocaml_SRCS} DESTINATION ${DATA_DIR}/examples/ocaml ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/ocaml RENAME Makefile ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/ocaml ) endif(CORE_BUILD) if(BUILD_TEST) # Default to using ocaml if ocamlopt is not available. Make sure the proper # files are cleaned up after a build, depending on the compiler used. if (OCAMLOPT) set(ocaml_compiler ${OCAMLOPT}) set(ocaml_lib_extension cmxa) set(ocaml_cleanup_extensions cmx cmi o) else (OCAMLOPT) set(ocaml_compiler ${OCAMLC}) set(ocaml_lib_extension cma) set(ocaml_cleanup_extensions cmo cmi) endif (OCAMLOPT) set(ocaml_EXTRA_CLEAN_FILES) if(CORE_BUILD) set(I_OPTION ${CMAKE_BINARY_DIR}/bindings/ocaml) if(BUILD_SHARED_LIBS) set(ccopt_OPTION -ccopt "-L ${CMAKE_BINARY_DIR}/src -Wl,-rpath -Wl,${CMAKE_BINARY_DIR}/src ") endif() else(CORE_BUILD) set(I_OPTION ${OCAML_INSTALL_DIR}/plplot) if(BUILD_SHARED_LIBS) if(USE_RPATH) set(ccopt_OPTION -ccopt "-L ${CMAKE_INSTALL_LIBDIR} -Wl,-rpath -Wl,${CMAKE_INSTALL_LIBDIR} ") else(USE_RPATH) set(ccopt_OPTION -ccopt "-L ${CMAKE_INSTALL_LIBDIR} ") endif(USE_RPATH) endif() endif(CORE_BUILD) get_property(files_plplot_ocaml GLOBAL PROPERTY FILES_plplot_ocaml) set_property(GLOBAL PROPERTY TARGETS_examples_ocaml) set_property(GLOBAL PROPERTY FILES_examples_ocaml) foreach(STRING_INDEX ${ocaml_STRING_INDICES}) set(EXECUTABLE_NAME x${STRING_INDEX}ocaml) set(SOURCE_FILE x${STRING_INDEX}.ml) foreach(EXTENSION ${ocaml_cleanup_extensions}) set(ocaml_EXTRA_CLEAN_FILES ${ocaml_EXTRA_CLEAN_FILES} x${STRING_INDEX}.${EXTENSION}) endforeach(EXTENSION ocaml_cleanup_extensions) # Copy source code to build tree since ocamlc is a bit broken and will # otherwise litter the source tree with intermediate files if(STRING_INDEX STREQUAL "17") set(unix_lib unix.${ocaml_lib_extension}) else(STRING_INDEX STREQUAL "17") set(unix_lib) endif(STRING_INDEX STREQUAL "17") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} COMMAND ${ocaml_compiler} -g -I ${I_OPTION} ${ccopt_OPTION} plplot.${ocaml_lib_extension} ${unix_lib} -o ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} ${files_plplot_ocaml} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM ) add_custom_target( target_${EXECUTABLE_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} ) if(CORE_BUILD) add_dependencies(target_${EXECUTABLE_NAME} plplot_ocaml) endif(CORE_BUILD) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_ocaml target_${EXECUTABLE_NAME}) set_property(GLOBAL APPEND PROPERTY FILES_examples_ocaml ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}) endforeach(STRING_INDEX ${ocaml_STRING_INDICES}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ocaml_EXTRA_CLEAN_FILES}") endif(BUILD_TEST) # Plcairo examples if(OCAML_HAS_CAIRO AND OCAML_HAS_GTK) if(CORE_BUILD) set(ocaml_SRCS) foreach(STRING_INDEX ${plcairo_STRING_INDICES}) list(APPEND ocaml_SRCS x${STRING_INDEX}.ml) endforeach(STRING_INDEX ${plcairo_STRING_INDICES}) install(FILES ${ocaml_SRCS} DESTINATION ${DATA_DIR}/examples/ocaml ) endif(CORE_BUILD) if(BUILD_TEST) # Default to using ocaml if ocamlopt is not available. Make sure the proper # files are cleaned up after a build, depending on the compiler used. if (OCAMLOPT) set(ocaml_compiler opt) set(ocaml_lib_extension cmxa) set(ocaml_cleanup_extensions cmx cmi o) else (OCAMLOPT) set(ocaml_compiler c) set(ocaml_lib_extension cma) set(ocaml_cleanup_extensions cmo cmi) endif (OCAMLOPT) set(ocaml_EXTRA_CLEAN_FILES) if(CORE_BUILD) set(I_OPTION_PLPLOT ${CMAKE_BINARY_DIR}/bindings/ocaml) set(I_OPTION_PLCAIRO ${CMAKE_BINARY_DIR}/bindings/ocaml/plcairo) set(ccopt_OPTION "-L ${CMAKE_BINARY_DIR}/src -Wl,-rpath -Wl,${CMAKE_BINARY_DIR}/src ") else(CORE_BUILD) set(I_OPTION_PLPLOT ${OCAML_INSTALL_DIR}/plplot) set(I_OPTION_PLCAIRO ${OCAML_INSTALL_DIR}/plcairo) if(USE_RPATH) set(ccopt_OPTION "-L ${CMAKE_INSTALL_LIBDIR} -Wl,-rpath -Wl,${CMAKE_INSTALL_LIBDIR} ") else(USE_RPATH) set(ccopt_OPTION "-L ${CMAKE_INSTALL_LIBDIR} ") endif(USE_RPATH) endif(CORE_BUILD) get_property(files_plcairo_ocaml GLOBAL PROPERTY FILES_plcairo_ocaml) # These are set above, in the core PLplot examples section #set_property(GLOBAL PROPERTY TARGETS_examples_ocaml) #set_property(GLOBAL PROPERTY FILES_examples_ocaml) foreach(STRING_INDEX ${plcairo_STRING_INDICES}) set(EXECUTABLE_NAME x${STRING_INDEX}ocaml) set(SOURCE_FILE x${STRING_INDEX}.ml) foreach(EXTENSION ${ocaml_cleanup_extensions}) set(ocaml_EXTRA_CLEAN_FILES ${ocaml_EXTRA_CLEAN_FILES} x${STRING_INDEX}.${EXTENSION}) endforeach(EXTENSION ocaml_cleanup_extensions) # Copy source code to build tree since ocamlc is a bit broken and will # otherwise litter the source tree with intermediate files add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} COMMAND ${OCAMLFIND} ${ocaml_compiler} -package cairo.lablgtk2 -linkpkg -g -I ${I_OPTION_PLPLOT} -I ${I_OPTION_PLCAIRO} -ccopt ${ccopt_OPTION} plplot.${ocaml_lib_extension} plcairo.${ocaml_lib_extension} -o ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} ${files_plplot_ocaml} ${files_plcairo_ocaml} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM ) add_custom_target( target_${EXECUTABLE_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} ) if(CORE_BUILD) add_dependencies(target_${EXECUTABLE_NAME} plcairo_ocaml cairo) endif(CORE_BUILD) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_ocaml target_${EXECUTABLE_NAME}) set_property(GLOBAL APPEND PROPERTY FILES_examples_ocaml ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME}) endforeach(STRING_INDEX ${ocaml_STRING_INDICES}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ocaml_EXTRA_CLEAN_FILES}") endif(BUILD_TEST) endif(OCAML_HAS_CAIRO AND OCAML_HAS_GTK) plplot-5.10.0+dfsg/examples/ocaml/x08.ml 644 1750 1750 1211211543675237 166440ustar andrewandrew(* $Id: x08.ml 11680 2011-03-27 17:57:51Z airwin $ 3-d plot demo. Copyright (C) 2004 Alan W. Irwin Copyright (C) 2004 Rafael Laboissiere Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 let xpts = 35 (* Data points in x *) let ypts = 46 (* Data points in y *) let alt = [|60.0; 20.0|] let az = [|30.0; 60.0|] let title = [| "#frPLplot Example 8 - Alt=60, Az=30"; "#frPLplot Example 8 - Alt=20, Az=60"; |] (*--------------------------------------------------------------------------*\ * cmap1_init1 * * Initializes color map 1 in HLS space. * Basic grayscale variation from half-dark (which makes more interesting * looking plot compared to dark) to light. * An interesting variation on this: * s[1] = 1.0 \*--------------------------------------------------------------------------*) let cmap1_init gray = let i = [|0.0; 1.0|] in (* left and right boundaries *) let h, l, s = if gray then ( [|0.0; 0.0|], (* hue -- low: red (arbitrary if s=0) *) (* hue -- high: red (arbitrary if s=0) *) [|0.5; 1.0|], (* lightness -- low: half-dark *) (* lightness -- high: light *) [|0.0; 0.0|] (* minimum saturation *) (* minimum saturation *) ) else ( [|240.0; 0.0|], (* blue -> green -> yellow -> *) (* -> red *) [|0.6; 0.6|], [|0.8; 0.8|] ) in plscmap1n 256; plscmap1l false i h l s None; () let levels = 10 (*--------------------------------------------------------------------------*\ * Does a series of 3-d plots for a given data set, with different * viewing options in each plot. \*--------------------------------------------------------------------------*) let () = let nlevel = levels in let rosen = true in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Allocate data structures *) let z = Array.make_matrix xpts ypts 0.0 in let x = Array.init xpts ( fun i -> (float_of_int (i - (xpts / 2)) /. float_of_int (xpts / 2)) *. if rosen then 1.5 else 1.0 ) in let y = Array.init ypts ( fun i -> float_of_int (i - (ypts / 2)) /. float_of_int (ypts / 2) +. if rosen then 0.5 else 0.0 ) in for i = 0 to xpts - 1 do let xx = x.(i) in for j = 0 to ypts - 1 do let yy = y.(j) in if rosen then ( z.(i).(j) <- (1.0 -. xx)**2. +. 100. *. (yy -. xx**2.)**2.0; (* The log argument may be zero for just the right grid. *) if z.(i).(j) > 0.0 then z.(i).(j) <- log z.(i).(j) else z.(i).(j) <- -5. (* -MAXFLOAT would mess-up up the scale *) ) else ( let r = sqrt (xx *. xx +. yy *. yy) in z.(i).(j) <- exp (-.r *. r) *. cos (2.0 *. pi *. r) ) done done; let zmax, zmin = plMinMax2dGrid z in let step = (zmax -. zmin) /. float_of_int (nlevel + 1) in let clevel = Array.init nlevel (fun i -> zmin +. step +. step *. float_of_int i) in pllightsource 1.0 1.0 1.0; for k = 0 to 1 do for ifshade = 0 to 3 do pladv 0; plvpor 0.0 1.0 0.0 0.9; plwind (-1.0) 1.0 (-0.9) 1.1; plcol0 3; plmtex "t" 1.0 0.5 0.5 title.(k); plcol0 1; if rosen then plw3d 1.0 1.0 1.0 (-1.5) 1.5 (-0.5) 1.5 zmin zmax alt.(k) az.(k) else plw3d 1.0 1.0 1.0 (-1.0) 1.0 (-1.0) 1.0 zmin zmax alt.(k) az.(k); plbox3 "bnstu" "x axis" 0.0 0 "bnstu" "y axis" 0.0 0 "bcdmnstuv" "z axis" 0.0 0; plcol0 2; match ifshade with 0 -> (* diffuse light surface plot *) cmap1_init true; plsurf3d x y z [PL_DIFFUSE] [||]; | 1 -> (* magnitude colored plot *) cmap1_init false; plsurf3d x y z [PL_MAG_COLOR] [||]; | 2 -> (* magnitude colored plot with faceted squares *) cmap1_init false; plsurf3d x y z [PL_MAG_COLOR; PL_FACETED] [||]; | _ -> (* magnitude colored plot with contours *) cmap1_init false; plsurf3d x y z [PL_MAG_COLOR; PL_SURF_CONT; PL_BASE_CONT] clevel; done done; (* Clean up *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x16.ml 644 1750 1750 1732112233577345 166500ustar andrewandrew(* $Id: x16.ml 12639 2013-10-29 00:18:45Z hezekiahcarty $ plshade demo, using color fill. Maurice LeBrun IFS, University of Texas at Austin 20 Mar 1994 *) open Plplot let colorbar ?color ?contour values = (* Smaller text *) plschr 0.0 0.75; (* Small ticks on the vertical axis *) plsmaj 0.0 0.5; plsmin 0.0 0.5; let axis = [ `frame0; `frame1; `vertical_label; `unconventional_label; `major_ticks; ] in let shade = Plot.shade_colorbar ~custom:true ~axis values in let pos = Plot.viewport_pos ~inside:false 0.005 0.0 in Plot.plot [ Plot.colorbar ?color ?contour ~orient:(`top (0.0375, 0.875)) ~label:[`bottom "Magnitude"] ~pos shade; ]; (* Reset text and tick sizes *) plschr 0.0 1.0; plsmaj 0.0 1.0; plsmin 0.0 1.0 let pi = atan 1.0 *. 4.0 (* Fundamental settings. See notes[] for more info. *) let ns = 20 (* Default number of shade levels *) let nx = 35 (* Default number of data points in x *) let ny = 46 (* Default number of data points in y *) let exclude = false (* By default do not plot a page illustrating exclusion. *) (* polar plot data *) let perimeterpts = 100 (* Transformation function *) let mypltr x y tr = tr.(0) *. x +. tr.(1) *. y +. tr.(2), tr.(3) *. x +. tr.(4) *. y +. tr.(5) let zdefined x y = let z = sqrt (x *. x +. y *. y) in if z < 0.4 || z > 0.6 then 1 else 0 (*--------------------------------------------------------------------------*\ * f2mnmx * * Returns min & max of input 2d array. \*--------------------------------------------------------------------------*) let f2mnmx f = let fmax = ref f.(0).(0) in let fmin = ref f.(0).(0) in for i = 0 to Array.length f - 1 do for j = 0 to Array.length f.(i) - 1 do fmax := max !fmax f.(i).(j); fmin := min !fmin f.(i).(j); done done; !fmin, !fmax (*--------------------------------------------------------------------------*\ * Does several shade plots using different coordinate mappings. \*--------------------------------------------------------------------------*) let () = let fill_width = 2.0 in let cont_color = 0 in let cont_width = 0.0 in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Load color palettes *) plspal0 "cmap0_black_on_white.pal"; plspal1 "cmap1_gray.pal" true; (* Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display *) plscmap0n 3; (* Initialize plplot *) plinit (); (* Set up transformation function *) let tr = [| 2.0 /. float_of_int (nx - 1); 0.0; -1.0; 0.0; 2.0 /. float_of_int (ny-1); -1.0; |] in (* Set up data arrays *) let z = Array.make_matrix nx ny 0.0 in let w = Array.make_matrix nx ny 0.0 in for i = 0 to nx - 1 do let x = float_of_int (i - (nx / 2)) /. float_of_int (nx / 2) in for j = 0 to ny - 1 do let y = float_of_int (j - (ny / 2)) /. float_of_int (ny / 2) -. 1.0 in z.(i).(j) <- -. sin (7.0 *. x) *. cos (7.0 *. y) +. x *. x -. y *. y; w.(i).(j) <- -. cos (7.0 *. x) *. sin (7.0 *. y) +. 2.0 *. x *. y; done done; let zmin, zmax = f2mnmx z in let clevel = Array.init ns ( fun i -> zmin +. (zmax -. zmin) *. (float_of_int i +. 0.5) /. float_of_int ns ) in let shedge = Array.init (ns + 1) ( fun i -> zmin +. (zmax -. zmin) *. float_of_int i /. float_of_int ns ) in (* Set up coordinate grids *) let xg1 = Array.make nx 0.0 in let yg1 = Array.make ny 0.0 in let xg2 = Array.make_matrix nx ny 0.0 in let yg2 = Array.make_matrix nx ny 0.0 in for i = 0 to nx - 1 do for j = 0 to ny - 1 do let x, y = mypltr (float_of_int i) (float_of_int j) tr in let argx = x *. pi /. 2.0 in let argy = y *. pi /. 2.0 in let distort = 0.4 in xg1.(i) <- x +. distort *. cos argx; yg1.(j) <- y -. distort *. cos argy; xg2.(i).(j) <- x +. distort *. cos argx *. cos argy; yg2.(i).(j) <- y -. distort *. cos argx *. cos argy; done done; (* Plot using identity transform *) pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plpsty 0; plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width true; colorbar shedge; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; plcol0 2; pllab "distance" "altitude" "Bogon density"; (* Plot using 1d coordinate transform *) (* Load color palettes *) plspal0 "cmap0_black_on_white.pal"; plspal1 "cmap1_blue_yellow.pal" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plpsty 0; plset_pltr (pltr1 xg1 yg1); plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width true; colorbar shedge; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; plcol0 2; pllab "distance" "altitude" "Bogon density"; (* Plot using 2d coordinate transform *) (* Load color palettes *) plspal0 "cmap0_black_on_white.pal"; plspal1 "cmap1_blue_red.pal" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plpsty 0; plset_pltr (pltr2 xg2 yg2); plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width false; colorbar shedge; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; plcol0 2; plcont w 1 nx 1 ny clevel; pllab "distance" "altitude" "Bogon density, with streamlines"; (* Plot using 2d coordinate transform *) (* Load color palettes *) plspal0 ""; plspal1 "" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plpsty 0; plshades z (-1.0) 1.0 (-1.) 1.0 shedge fill_width 2 3.0 false; colorbar ~color:(`index 2) ~contour:(`index 2, 3.0) shedge; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; plcol0 2; pllab "distance" "altitude" "Bogon density"; (* Note this exclusion API will probably change. *) (* Plot using 2d coordinate transform and exclusion*) if exclude then ( pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plpsty 0; plset_defined zdefined; plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width false; colorbar shedge; plunset_defined (); plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; pllab "distance" "altitude" "Bogon density with exclusion"; ); (* Example with polar coordinates. *) (* Load colour palettes*) plspal0 "cmap0_black_on_white.pal"; plspal1 "cmap1_gray.pal" true; pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plpsty 0; (* Build new coordinate matrices. *) for i = 0 to nx - 1 do let r = float_of_int i /. float_of_int (nx - 1) in for j = 0 to ny - 1 do let t = (2.0 *. pi /. (float_of_int ny -. 1.0)) *. float_of_int j in xg2.(i).(j) <- r *. cos t; yg2.(i).(j) <- r *. sin t; z.(i).(j) <- exp (~-.r *. r) *. cos (5.0 *. pi *. r) *. cos (5.0 *. t); done done; (* Need a new shedge to go along with the new data set. *) let zmin, zmax = f2mnmx z in let shedge = Array.init (ns + 1) ( fun i -> zmin +. (zmax -. zmin) *. float_of_int i /. float_of_int ns ) in (* Now we can shade the interior region. *) plshades z (-1.0) 1.0 (-1.0) 1.0 shedge fill_width cont_color cont_width false; colorbar shedge; (* Now we can draw the perimeter. (If do before, shade stuff may overlap.) *) let px = Array.make perimeterpts 0.0 in let py = Array.make perimeterpts 0.0 in for i = 0 to perimeterpts - 1 do let t = (2.0 *. pi /. float_of_int (perimeterpts - 1)) *. float_of_int i in px.(i) <- cos t; py.(i) <- sin t; done; plcol0 1; plline px py; (* And label the plot.*) plcol0 2; pllab "" "" "Tokamak Bogon Instability"; (* Clean up *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x14.ml 644 1750 1750 2013611543675237 166460ustar andrewandrew(* $Id: x14.ml 11680 2011-03-27 17:57:51Z airwin $ Demo of multiple stream/window capability (requires Tk or Tcl-DP). Maurice LeBrun IFS, University of Texas at Austin Copyright (C) 2004 Alan W. Irwin Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Printf open Plplot let pi = atan 1.0 *. 4.0 let space0 = [||] let mark0 = [||] let space1 = [|1500|] let mark1 = [|1500|] let plot1 xscale yscale xoff yoff = let x = Array.init 60 (fun i -> xoff +. xscale *. float_of_int (i + 1) /. 60.0) in let y = Array.init 60 (fun i -> yoff +. yscale *. x.(i)**2.0) in let xmin = x.(0) in let xmax = x.(59) in let ymin = y.(0) in let ymax = y.(59) in let xs = Array.init 6 (fun i -> x.(i * 10 + 3)) in let ys = Array.init 6 (fun i -> y.(i * 10 + 3)) in (* Set up the viewport and window using PLENV. The range in X is *) (* 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are *) (* scaled separately (just = 0), and we just draw a labelled *) (* box (axis = 0). *) plcol0 1; plenv xmin xmax ymin ymax 0 0; plcol0 6; pllab "(x)" "(y)" "#frPLplot Example 1 - y=x#u2"; (* Plot the data points *) plcol0 9; plpoin xs ys 9; (* Draw the line through the data *) plcol0 4; plline x y; plflush (); () let plot2 () = (* Set up the viewport and window using PLENV. The range in X is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately (just = 0), and we draw a box with axes (axis = 1). *) plcol0 1; plenv (-2.0) 10.0 (-0.4) 1.2 0 1; plcol0 2; pllab "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; (* Fill up the arrays *) let x = Array.init 100 (fun i -> (float_of_int i -. 19.0) /. 6.0) in let y = Array.map (fun xi -> if xi <> 0.0 then sin xi /. xi else 1.0) x in (* Draw the line *) plcol0 3; plline x y; plflush (); () let plot3 () = (* For the final graph we wish to override the default tick intervals, and so do not use PLENV *) pladv 0; (* Use standard viewport, and define X range from 0 to 360 degrees, Y range from -1.2 to 1.2. *) plvsta (); plwind 0.0 360.0 (-1.2) 1.2; (* Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. *) plcol0 1; plbox "bcnst" 60.0 2 "bcnstv" 0.2 2; (* Superimpose a dashed line grid, with 1.5 mm marks and spaces. *) plstyl mark1 space1; plcol0 2; plbox "g" 30.0 0 "g" 0.2 0; plstyl mark0 space0; plcol0 3; pllab "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function"; let x = Array.init 101 (fun i -> 3.6 *. float_of_int i) in let y = Array.map (fun xi -> sin (xi *. pi /. 180.0)) x in plcol0 4; plline x y; plflush (); () let plot4 () = let dtr d = float_of_int d *. pi /. 180.0 in let x0 = Array.init 361 (fun i -> cos (dtr i)) in let y0 = Array.init 361 (fun i -> sin (dtr i)) in (* Set up viewport and window, but do not draw box *) plenv (-1.3) 1.3 (-1.3) 1.3 1 (-2); for i = 1 to 10 do let x = Array.map (fun xj -> 0.1 *. float_of_int i *. xj) x0 in let y = Array.map (fun yj -> 0.1 *. float_of_int i *. yj) y0 in (* Draw circles for polar grid *) plline x y; done; plcol0 2; for i = 0 to 11 do let theta = 30 * i in let dx = cos (dtr theta) in let dy = sin (dtr theta) in (* Draw radial spokes for polar grid *) pljoin 0.0 0.0 dx dy; let text = sprintf "%d" theta in (* Write labels for angle *) (* Slightly off zero to avoid floating point logic flips at 90 and 270 deg. *) if dx >= -0.00001 then plptex dx dy dx dy (-0.15) text else plptex dx dy (-.dx) (-.dy) 1.15 text; done; (* Draw the graph *) let rs = Array.init 361 (fun i -> sin (dtr (5 * i))) in let x = Array.mapi (fun i xi -> xi *. rs.(i)) x0 in let y = Array.mapi (fun i yi -> yi *. rs.(i)) y0 in plcol0 3; plline x y; plcol0 4; plmtex "t" 2.0 0.5 0.5 "#frPLplot Example 3 - r(#gh)=sin 5#gh"; plflush (); () (* Demonstration of contour plotting *) let xpts = 35 let ypts = 46 let xspa = 2.0 /. float_of_int (xpts - 1) let yspa = 2.0 /. float_of_int (ypts - 1) let tr = [|xspa; 0.0; -1.0; 0.0; yspa; -1.0|] let mypltr x y = tr.(0) *. x +. tr.(1) *. y +. tr.(2), tr.(3) *. x +. tr.(4) *. y +. tr.(5) let clevel = [|-1.0; -0.8; -0.6; -0.4; -0.2; 0.0; 0.2; 0.4; 0.6; 0.8; 1.0|] let plot5 () = let mark = [|1500|] in let space = [|1500|] in (* Set up function arrays *) let z = Array.make_matrix xpts ypts 0.0 in let w = Array.make_matrix xpts ypts 0.0 in for i = 0 to xpts - 1 do let xx = float_of_int (i - (xpts / 2)) /. float_of_int (xpts / 2) in for j = 0 to ypts - 1 do let yy = float_of_int (j - (ypts / 2)) /. float_of_int (ypts / 2) -. 1.0 in z.(i).(j) <- xx *. xx -. yy *. yy; w.(i).(j) <- 2.0 *. xx *. yy; done done; plenv (-1.0) 1.0 (-1.0) 1.0 0 0; plcol0 2; plset_pltr mypltr; plcont z 1 xpts 1 ypts clevel; plstyl mark space; plcol0 3; plcont w 1 xpts 1 ypts clevel; plcol0 1; pllab "X Coordinate" "Y Coordinate" "Streamlines of flow"; plflush (); () (*--------------------------------------------------------------------------*\ * Plots several simple functions from other example programs. * * This version sends the output of the first 4 plots (one page) to two * independent streams. \*--------------------------------------------------------------------------*) let () = let geometry_master = "500x410+100+200" in let geometry_slave = "500x410+650+200" in (* plplot initialization *) (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* If valid geometry specified on command line, use it for both streams. *) let xp0, yp0, xleng0, yleng0, xoff0, yoff0 = plgpage () in let valid_geometry = ( xleng0 > 0 && yleng0 > 0 ) in (* Set up first stream *) if valid_geometry then plspage xp0 yp0 xleng0 yleng0 xoff0 yoff0 else plsetopt "geometry" geometry_master; plssub 2 2; plinit (); let driver = plgdev () in let fam, num, bmax = plgfam () in printf "Demo of multiple output streams via the %s driver.\n" driver; printf "Running with the second stream as slave to the first.\n"; printf "\n"; (* Start next stream *) plsstrm 1; if valid_geometry then plspage xp0 yp0 xleng0 yleng0 xoff0 yoff0 else plsetopt "geometry" geometry_slave; (* Turn off pause to make this a slave (must follow master) *) plspause false; plsdev driver; plsfam fam num bmax; plsetopt "fflen" "2"; plinit (); (* Set up the data & plot *) (* Original case *) plsstrm 0; let xscale = 6.0 in let yscale = 1.0 in let xoff = 0.0 in let yoff = 0.0 in plot1 xscale yscale xoff yoff; (* Set up the data & plot *) let xscale = 1.0 in let yscale = 1.0e+6 in plot1 xscale yscale xoff yoff; (* Set up the data & plot *) let xscale = 1.0 in let yscale = 1.e-6 in let digmax = 2 in plsyax digmax 0; plot1 xscale yscale xoff yoff; (* Set up the data & plot *) let xscale = 1.0 in let yscale = 0.0014 in let yoff = 0.0185 in let digmax = 5 in plsyax digmax 0; plot1 xscale yscale xoff yoff; (* To slave *) (* The pleop() ensures the eop indicator gets lit. *) plsstrm 1; plot4 (); pleop (); (* Back to master *) plsstrm 0; plot2 (); plot3 (); (* To slave *) plsstrm 1; plot5 (); pleop (); (* Back to master to wait for user to advance *) plsstrm 0; pleop (); (* Call plend to finish off. *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x11.ml 644 1750 1750 746711543675237 166370ustar andrewandrew(* $Id: x11.ml 11680 2011-03-27 17:57:51Z airwin $ Mesh plot demo. Copyright (C) 2004 Rafael Laboissiere Copyright 2008 Hezekiah M. Carty (OCaml adaptation) This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let xpts = 35 (* Data points in x *) let ypts = 46 (* Data points in y *) let levels = 10 let opt = [|PL_DRAW_LINEXY; PL_DRAW_LINEXY|] let alt = [|33.0; 17.0|] let az = [|24.0; 115.0|] let title = [| "#frPLplot Example 11 - Alt=33, Az=24, Opt=3"; "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" |] let cmap1_init () = let i = [|0.0; 1.0|] in (* Left and right bounds *) let h = [|240.0; 0.0|] in(* blue -> green -> yellow -> red *) let l = [|0.6; 0.6|] in let s = [|0.8; 0.8|] in plscmap1n 256; plscmap1l false i h l s None; () (*--------------------------------------------------------------------------*\ * Does a series of mesh plots for a given data set, with different * viewing options in each plot. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); let nlevel = levels in let x = Array.init xpts ( fun i -> 3.0 *. float_of_int (i - xpts / 2) /. float_of_int (xpts / 2) ) in let y = Array.init ypts ( fun i -> 3.0 *. float_of_int (i - ypts / 2) /. float_of_int (ypts / 2) ) in let z = Array.make_matrix xpts ypts 0.0 in for i = 0 to xpts - 1 do let xx = x.(i) in for j = 0 to ypts - 1 do let yy = y.(j) in z.(i).(j) <- 3.0 *. (1.0 -. xx) *. (1.0 -. xx) *. exp (~-.(xx *. xx) -. (yy +. 1.0) *. (yy +. 1.0)) -. 10.0 *. (xx /. 5.0 -. xx**3.0 -. yy**5.0) *. exp (~-.xx *. xx -. yy *. yy) -. 1.0 /. 3.0 *. exp (~-.(xx +. 1.0) *. (xx +. 1.0) -. (yy *. yy)); done done; let zmax, zmin = plMinMax2dGrid z in let step = (zmax -. zmin) /. float_of_int (nlevel + 1) in let clevel = Array.init nlevel (fun i -> zmin +. step +. step *. float_of_int i) in cmap1_init (); for k = 0 to 1 do for i = 0 to 3 do pladv 0; plcol0 1; plvpor 0.0 1.0 0.0 0.9; plwind (-1.0) 1.0 (-1.0) 1.5; plw3d 1.0 1.0 1.2 (-3.0) 3.0 (-3.0) 3.0 zmin zmax alt.(k) az.(k); plbox3 "bnstu" "x axis" 0.0 0 "bnstu" "y axis" 0.0 0 "bcdmnstuv" "z axis" 0.0 4; plcol0 2; (* wireframe plot *) let () = match i with 0 -> plmesh x y z [opt.(k)] | 1 -> (* magnitude colored wireframe plot *) plmesh x y z [opt.(k); PL_MAG_COLOR] | 2 -> (* magnitude colored wireframe plot with sides *) plot3d x y z [opt.(k); PL_MAG_COLOR] true | 3 -> (* magnitude colored wireframe plot with base contour *) plmeshc x y z [opt.(k); PL_MAG_COLOR; PL_BASE_CONT] clevel | _ -> raise (Failure "You let i get too big!") in plcol0 3; plmtex "t" 1.0 0.5 0.5 title.(k); done done; (* Clean up *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x20.ml 644 1750 1750 1435311264462447 166440ustar andrewandrew(* $Id: x20.ml 10524 2009-10-11 23:07:19Z hezekiahcarty $ plimage demo *) open Plplot let pi = atan 1.0 *. 4.0 let xdim = 260 let ydim = 220 (* Change this to 'Some "outfile.psc"' if you want to test the plot saving option. *) let filename = None type stretch_data = { xmin : float; xmax : float; ymin : float; ymax : float; stretch : float; } (* Transformation function *) let mypltr pltr_data x y = let x0 = (pltr_data.xmin +. pltr_data.xmax) *. 0.5 in let y0 = (pltr_data.ymin +. pltr_data.ymax) *. 0.5 in let dy = (pltr_data.ymax -. pltr_data.ymin) *. 0.5 in x0 +. (x0 -. x) *. (1.0 -. pltr_data.stretch *. cos ((y -. y0) /. dy *. pi *. 0.5)), y (* read image from file in binary ppm format *) let read_img fname = (* naive grayscale binary ppm reading. If you know how to, improve it *) let fp = open_in fname in let ver = input_line fp in (* version *) if ver <> "P5" then raise (Invalid_argument ("Unable to read image: " ^ fname)) else (); (* This will skip comments. *) let rec ignore_comments_then_get_w_h () = let maybe_comment = input_line fp in if maybe_comment.[0] = '#' then ignore_comments_then_get_w_h () else (* This line has the width and height in it *) maybe_comment in (* width, height num colors *) let w_h_line = ignore_comments_then_get_w_h () in let num_col_line = input_line fp in let w, h = Scanf.sscanf w_h_line "%d %d" (fun w h -> w, h) in let num_col = Scanf.sscanf num_col_line "%d" (fun n -> n) in let img = String.make (w * h) ' ' in let imf = Array.make_matrix w h 0.0 in (* Note that under 32bit OCaml, this will only work when reading strings up to ~16 megabytes. *) really_input fp img 0 (w * h); close_in fp; for i = 0 to w - 1 do for j = 0 to h - 1 do imf.(i).(j) <- (* flip image up-down *) float_of_int (int_of_char (img.[(h - 1 - j ) * w + i])); done done; imf, w, h, num_col (* save plot *) let save_plot fname = let cur_strm = plgstrm () in (* get current stream *) let _ = plmkstrm () in (* create a new one *) plsdev "psc"; (* new device type. Use a known existing driver *) plsfnam fname; (* file name *) plcpstrm cur_strm false; (* copy old stream parameters to new stream *) plreplot (); (* do the save *) plend1 (); (* close new device *) plsstrm cur_strm; (* and return to previous one *) () (* set gray colormap *) let gray_cmap num_col = let r = [|0.0; 1.0|] in let g = [|0.0; 1.0|] in let b = [|0.0; 1.0|] in let pos = [|0.0; 1.0|] in plscmap1n num_col; plscmap1l true pos r g b None; () let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); let z = Array.make_matrix xdim ydim 0.0 in let r = Array.make_matrix xdim ydim 0.0 in (* sombrero-like demo *) plcol0 2; (* draw a yellow plot box, useful for diagnostics *) plenv 0.0 (2.0 *. pi) 0.0 (3.0 *. pi) 1 (-1); let x = Array.init xdim ( fun i -> float_of_int i *. 2.0 *. pi /. float_of_int (xdim - 1) ) in let y = Array.init ydim ( fun i -> float_of_int i *. 3.0 *. pi /. float_of_int (ydim - 1) ) in for i = 0 to xdim - 1 do for j = 0 to ydim - 1 do r.(i).(j) <- sqrt (x.(i) *. x.(i) +. y.(j) *. y.(j)) +. 1e-3; z.(i).(j) <- sin r.(i).(j) /. r.(i).(j); done done; pllab "No, an amplitude clipped \"sombrero\"" "" "Saturn?"; plptex 2.0 2.0 3.0 4.0 0.0 "Transparent image"; plimage z 0.0 (2.0 *. pi) 0.0 (3.0 *. pi) 0.05 1.0 0.0 (2.0 *. pi) 0.0 (3.0 *. pi); (* save the plot *) let () = match filename with Some f -> save_plot f | None -> () in (* read Lena image *) (* Note we try two different locations to cover the case where this * examples is being run from the test_ocaml.sh script *) let img_f, width, height, num_col = try read_img "lena.pgm" with _ -> ( try read_img "../lena.pgm" with Invalid_argument _ -> plend (); raise (Failure "No such file") ) in let width = float_of_int width in let height = float_of_int height in (* set gray colormap *) gray_cmap num_col; (* display Lena *) plenv 1.0 width 1.0 height 1 (-1); pllab "Set and drag Button 1 to (re)set selection, Button 2 to finish." " " "Lena..."; plimage img_f 1.0 width 1.0 height 0.0 0.0 1.0 width 1.0 height; (* selection/expansion demo *) let xi = 200.0 in let xe = 330.0 in let yi = 280.0 in let ye = 220.0 in plspause false; pladv 0; (* display selection only *) plimage img_f 1.0 width 1.0 height 0.0 0.0 xi xe ye yi; plspause true; (* zoom in selection *) plenv xi xe ye yi 1 (-1); plimage img_f 1.0 width 1.0 height 0.0 0.0 xi xe ye yi; (* Base the dynamic range on the image contents. *) let img_max, img_min = plMinMax2dGrid img_f in (* Draw a saturated version of the original image. Only use the middle 50% of the image's full dynamic range. *) plcol0 2; plenv 0.0 width 0.0 height 1 (-1); pllab "" "" "Reduced dynamic range image example"; plimagefr img_f 0.0 width 0.0 height 0.0 0.0 (img_min +. img_max *. 0.25) (img_max -. img_max *. 0.25); (* Draw a distorted version of the original image, showing its full dynamic range. *) plenv 0.0 width 0.0 height 1 (-1); pllab "" "" "Distorted image example"; let stretch = { xmin = 0.0; xmax = width; ymin = 0.0; ymax = height; stretch = 0.5; } in (* OCaml supports arbitrary coordinate transform callbacks, so take advantage of that to use mypltr directly and skip the use of pltr2. *) plset_pltr (mypltr stretch); (* Comment the above line, and uncomment the following section to use pltr2 *) (* let xg = Array.make_matrix (int_of_float width + 1) (int_of_float height + 1) 0.0 in let yg = Array.make_matrix (int_of_float width + 1) (int_of_float height + 1) 0.0 in for i = 0 to int_of_float width do for j = 0 to int_of_float height do let xx, yy = mypltr (float_of_int i) (float_of_int j) stretch in xg.(i).(j) <- xx; yg.(i).(j) <- yy; done done; plset_pltr (pltr2 xg yg); *) plimagefr img_f 0.0 width 0.0 height 0.0 0.0 img_min img_max; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x22.ml 644 1750 1750 2200312250743154 166260ustar andrewandrew(* $Id: x22.ml 12826 2013-12-08 01:07:56Z hezekiahcarty $ Simple vector plot example Copyright (C) 2004 Andrew Ross Copyright (C) 2004 Rafael Laboissiere Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 (* Pairs of points making the line segments used to plot the user defined arrow. *) let arrow_x = [|-0.5; 0.5; 0.3; 0.5; 0.3; 0.5|] let arrow_y = [|0.0; 0.0; 0.2; 0.0; -0.2; 0.0|] let arrow2_x = [|-0.5; 0.3; 0.3; 0.5; 0.3; 0.3|] let arrow2_y = [|0.0; 0.0; 0.2; 0.0; -0.2; 0.0|] (*--------------------------------------------------------------------------*\ * Generates several simple vector plots. \*--------------------------------------------------------------------------*) (* * Vector plot of the circulation about the origin *) let circulation () = let nx = 20 in let ny = 20 in let dx = 1.0 in let dy = 1.0 in let xmin = -. float_of_int nx /. 2.0 *. dx in let xmax = float_of_int nx /. 2.0 *. dx in let ymin = -. float_of_int ny /. 2.0 *. dy in let ymax = float_of_int ny /. 2.0 *. dy in let xg = Array.make_matrix nx ny 0.0 in let yg = Array.make_matrix nx ny 0.0 in let u = Array.make_matrix nx ny 0.0 in let v = Array.make_matrix nx ny 0.0 in (* Create data - circulation around the origin. *) for i = 0 to nx - 1 do let x = (float_of_int i -. float_of_int nx /. 2.0 +. 0.5) *. dx in for j = 0 to ny - 1 do let y = (float_of_int j -. float_of_int ny /. 2.0 +. 0.5) *. dy in xg.(i).(j) <- x; yg.(i).(j) <- y; u.(i).(j) <- y; v.(i).(j) <- -. x; done done; (* Plot vectors with default arrows *) plenv xmin xmax ymin ymax 0 0; pllab "(x)" "(y)" "#frPLplot Example 22 - circulation"; plcol0 2; plset_pltr (pltr2 xg yg); plvect u v 0.0; plcol0 1; () (* * Vector plot of flow through a constricted pipe *) let constriction astyle = let nx = 20 in let ny = 20 in let dx = 1.0 in let dy = 1.0 in let xmin = -. float_of_int nx /. 2.0 *. dx in let xmax = float_of_int nx /. 2.0 *. dx in let ymin = -. float_of_int ny /. 2.0 *. dy in let ymax = float_of_int ny /. 2.0 *. dy in let xg = Array.make_matrix nx ny 0.0 in let yg = Array.make_matrix nx ny 0.0 in let u = Array.make_matrix nx ny 0.0 in let v = Array.make_matrix nx ny 0.0 in let q = 2.0 in for i = 0 to nx - 1 do let x = (float_of_int i -. float_of_int nx /. 2.0 +. 0.5) *. dx in for j = 0 to ny - 1 do let y = (float_of_int j -. float_of_int ny /. 2.0 +. 0.5) *. dy in xg.(i).(j) <- x; yg.(i).(j) <- y; let b = ymax /. 4.0 *. (3.0 -. cos (pi *. x /. xmax)) in if abs_float y < b then ( let dbdx = ymax /. 4.0 *. sin (pi *. x /. xmax) *. pi /. xmax *. y /. b in u.(i).(j) <- q *. ymax /. b; v.(i).(j) <- dbdx *. u.(i).(j); ) else ( u.(i).(j) <- 0.0; v.(i).(j) <- 0.0; ) done done; plenv xmin xmax ymin ymax 0 0; let title =Printf.sprintf "%s%d%s" "#frPLplot Example 22 - constriction (arrow style " astyle ")" in pllab "(x)" "(y)" title; plcol0 2; plset_pltr (pltr2 xg yg); plvect u v (-1.0); plcol0 1; () let f2mnmx f = let fmax = ref f.(0).(0) in let fmin = ref f.(0).(0) in for i = 0 to Array.length f - 1 do for j = 0 to Array.length f.(i) - 1 do fmax := max !fmax f.(i).(j); fmin := min !fmin f.(i).(j); done done; !fmin, !fmax (* * Vector plot of the gradient of a shielded potential (see example 9) *) let potential () = let nper = 100 in let nlevel = 10 in let nr = 20 in let ntheta = 20 in (* Potential inside a conducting cylinder (or sphere) by method of images. Charge 1 is placed at (d1, d1), with image charge at (d2, d2). Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). Also put in smoothing term at small distances. *) let rmax = float_of_int nr in let eps = 2.0 in let q1 = 1.0 in let d1 = rmax /. 4.0 in let q1i = -. q1 *. rmax /. d1 in let d1i = rmax**2.0 /. d1 in let q2 = -1.0 in let d2 = rmax /. 4.0 in let q2i = -. q2 *. rmax /. d2 in let d2i = rmax**2.0 /. d2 in let xg = Array.make_matrix nr ntheta 0.0 in let yg = Array.make_matrix nr ntheta 0.0 in let u = Array.make_matrix nr ntheta 0.0 in let v = Array.make_matrix nr ntheta 0.0 in let z = Array.make_matrix nr ntheta 0.0 in for i = 0 to nr - 1 do let r = 0.5 +. float_of_int i in for j = 0 to ntheta - 1 do let theta = 2.0 *. pi /. float_of_int (ntheta - 1) *. (0.5 +. float_of_int j) in let x = r *. cos theta in let y = r *. sin theta in xg.(i).(j) <- x; yg.(i).(j) <- y; let div1 = sqrt ((x -. d1)**2.0 +. (y -. d1)**2.0 +. eps**2.0) in let div1i = sqrt ((x -. d1i)**2.0 +. (y -. d1i)**2.0 +. eps**2.0) in let div2 = sqrt ((x -. d2)**2.0 +. (y +. d2)**2.0 +. eps**2.0) in let div2i = sqrt ((x -. d2i)**2.0 +. (y +. d2i)**2.0 +. eps**2.0) in z.(i).(j) <- q1 /. div1 +. q1i /. div1i +. q2 /. div2 +. q2i /. div2i; u.(i).(j) <- ~-. q1 *. (x -. d1) /. div1**3.0 -. q1i *. (x -. d1i) /. div1i**3.0 -. q2 *. (x -. d2) /. div2**3.0 -. q2i *. (x -. d2i) /. div2i**3.0; v.(i).(j) <- ~-. q1 *. (y -. d1) /. div1**3.0 -. q1i *. (y -. d1i) /. div1i**3.0 -. q2 *. (y +. d2) /. div2**3.0 -. q2i *. (y +. d2i) /. div2i**3.0; done done; let xmin, xmax = f2mnmx xg in let ymin, ymax = f2mnmx yg in let zmin, zmax = f2mnmx z in plenv xmin xmax ymin ymax 0 0; pllab "(x)" "(y)" "#frPLplot Example 22 - potential gradient vector plot"; (* Plot contours of the potential *) let dz = (zmax -. zmin) /. float_of_int nlevel in let clevel = Array.init nlevel (fun i -> zmin +. (float_of_int i +. 0.5) *. dz) in plcol0 3; pllsty 2; plset_pltr (pltr2 xg yg); plcont z 1 nr 1 ntheta clevel; pllsty 1; plcol0 1; (* Plot the vectors of the gradient of the potential *) plcol0 2; plvect u v 25.0; plcol0 1; let px = Array.make nper 0.0 in let py = Array.make nper 0.0 in (* Plot the perimeter of the cylinder *) for i=0 to nper - 1 do let theta = (2.0 *. pi /. float_of_int (nper - 1)) *. float_of_int i in px.(i) <- rmax *. cos theta; py.(i) <- rmax *. sin theta; done; plline px py; () let transform xmax x y = x, y /. 4.0 *. (3.0 -. cos (pi *. x /. xmax)) (* Vector plot of flow through a constricted pipe with a coordinate transform *) let constriction2 () = let nx, ny = 20, 20 in let nc = 11 in let nseg = 20 in let dx, dy = 1.0, 1.0 in let xmin = float ~-nx /. 2.0 *. dx in let xmax = float nx /. 2.0 *. dx in let ymin = float ~-ny /. 2.0 *. dy in let ymax = float ny /. 2.0 *. dy in plstransform (transform xmax); let cgrid2_xg = Array.make_matrix nx ny 0.0 in let cgrid2_yg = Array.make_matrix nx ny 0.0 in let u = Array.make_matrix nx ny 0.0 in let v = Array.make_matrix nx ny 0.0 in let q = 2.0 in for i = 0 to nx - 1 do let x = (float i -. float nx /. 2.0 +. 0.5) *. dx in for j = 0 to ny - 1 do let y = (float j -. float ny /. 2.0 +. 0.5) *. dy in cgrid2_xg.(i).(j) <- x; cgrid2_yg.(i).(j) <- y; let b = ymax /. 4.0 *. (3.0 -. cos (pi *. x /. xmax)) in u.(i).(j) <- q *. ymax /. b; v.(i).(j) <- 0.0 done done; let clev = Array.init nc (fun i -> q +. float i *. q /. float (nc - 1)) in plenv xmin xmax ymin ymax 0 0; pllab "(x)" "(y)" "#frPLplot Example 22 - constriction with plstransform"; plcol0 2; plshades u (xmin +. dx /. 2.0) (xmax -. dx /. 2.0) (ymin +. dy /. 2.0) (ymax -. dy /. 2.0) clev 0.0 1 1.0 false; plset_pltr (pltr2 cgrid2_xg cgrid2_yg); plvect u v ~-.1.0; plunset_pltr (); plpath nseg xmin ymax xmax ymax; plpath nseg xmin ymin xmax ymin; plcol0 1; plunset_transform (); () let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); circulation (); let fill = false in (* Set arrow style using arrow_x and arrow_y then plot using these arrows. *) plsvect arrow_x arrow_y fill; constriction ( 1 ); (* Set arrow style using arrow2_x and arrow2_y then plot using these filled arrows. *) let fill = true in plsvect arrow2_x arrow2_y fill; constriction ( 2 ); constriction2 (); (* Reset arrow style to the default *) plsvect_reset (); potential (); plend (); () plplot-5.10.0+dfsg/examples/ocaml/x17.ml 644 1750 1750 1032511543675237 166500ustar andrewandrew(* $Id: x17.ml 11680 2011-03-27 17:57:51Z airwin $ Copyright (C) 2009 Hezekiah M. Carty Plots a simple stripchart with four pens. Direct adaptation of the C version. This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 (** [sleep time] sleeps for [time] seconds. *) let sleep time = ignore (Unix.select [] [] [] time) let () = let nsteps = 1000 in (* plplot initialization *) (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* If db is used the plot is much more smooth. However, because of the async X behaviour, one does not have a real-time scripcharter. *) (* plsetopt "db" ""; plsetopt "np" ""; *) (* User sets up plot completely except for window and data Eventually settings in place when strip chart is created will be remembered so that multiple strip charts can be used simultaneously. *) (* Specify some reasonable defaults for ymin and ymax *) (* The plot will grow automatically if needed (but not shrink) *) let ymin = -0.1 in let ymax = 0.1 in (* Specify initial tmin and tmax -- this determines length of window. *) (* Also specify maximum jump in t *) (* This can accomodate adaptive timesteps *) let tmin = 0.0 in let tmax = 10.0 in let tjump = 0.3 in (* percentage of plot to jump *) (* Axes options same as plbox. *) (* Only automatic tick generation and label placement allowed *) (* Eventually I'll make this fancier *) let colbox = 1 in let collab = 3 in (* pens' color and line style *) let styline = [|2; 3; 4; 5|] in let colline = [|2; 3; 4; 5|] in (* pens legend *) let legline = [|"sum"; "sin"; "sin*noi"; "sin+noi"|] in (* legend position *) let xlab = 0.0 in let ylab = 0.25 in let autoy = true in (* autoscale y *) let acc = true in (* don't scrip, accumulate *) (* Initialize plplot *) plinit (); pladv 0; plvsta (); (* Register our error variables with PLplot *) (* From here on, we're handling all errors here *) (* TODO : Eventually wrap plsError plsError pl_errcode errmsg; *) let id1 = plstripc "bcnst" "bcnstv" tmin tmax tjump ymin ymax xlab ylab autoy acc colbox collab colline styline legline "t" "" "Strip chart demo" in (* TODO : This should either be removed or plsError should be properly wrapped. if pl_errcode then ( eprintf "%s\n" errmsg; exit 1; ); *) (* Let plplot handle errors from here on *) (* plsError(NULL, NULL); *) (* XXX : These seem unused? let autoy = 0 in (* autoscale y *) let acc = 1 in (* accumulate *) *) (* This is to represent a loop over time *) (* Let's try a random walk process *) let y1 = ref 0.0 in let y2 = ref 0.0 in let y3 = ref 0.0 in let y4 = ref 0.0 in let dt = 0.1 in for n = 0 to nsteps - 1 do (* Wait a little (10 ms) to simulate time elapsing *) sleep 1e-2; let t = float_of_int n *. dt in let noise = plrandd () -. 0.5 in y1 := !y1 +. noise; y2 := sin (t *. pi /. 18.0); y3 := !y2 *. noise; y4 := !y2 +. noise /. 3.0; (* There is no need for all pens to have the same number of points or beeing equally time spaced. *) if n mod 2 <> 0 then plstripa id1 0 t !y1; if n mod 3 <> 0 then plstripa id1 1 t !y2; if n mod 4 <> 0 then plstripa id1 2 t !y3; if n mod 5 <> 0 then plstripa id1 3 t !y4; (*pleop (); use double buffer (-db on command line) *) done; (* Destroy strip chart and it's memory *) plstripd id1; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x13.ml 644 1750 1750 423311256505632 166150ustar andrewandrew(* $Id: x13.ml 10463 2009-09-23 20:56:58Z hezekiahcarty $ Pie chart demo. *) open Plplot let pi = atan 1.0 *. 4.0 let text = [| "Maurice"; "Geoffrey"; "Alan"; "Rafael"; "Vince"; |] (*--------------------------------------------------------------------------*\ * Does a simple pie chart. \*--------------------------------------------------------------------------*) let () = let x = Array.make 500 0.0 in let y = Array.make 500 0.0 in let per = [|10.0; 32.0; 12.0; 30.0; 16.0|] in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); pladv 0; (* Ensure window has aspect ratio of one so circle is * plotted as a circle. *) plvasp 1.0; plwind 0. 10. 0. 10.; (* plenv 0.0 10.0 0.0 10.0 1 (-2); *) plcol0 2; (* All theta quantities scaled by 2*M_PI/500 to be integers to avoid floating point logic problems. *) let theta0 = ref 0 in for i = 0 to 4 do let j = ref 0 in x.(!j) <- 5.0; y.(!j) <- 5.0; incr j; (* Theta quantities multiplied by 2*M_PI/500 afterward so in fact per is interpreted as a percentage. *) let theta1 = if i = 4 then 500 else int_of_float (float_of_int !theta0 +. 5.0 *. per.(i)) in for theta = !theta0 to theta1 do x.(!j) <- 5.0 +. 3.0 *. cos ((2.0 *. pi /. 500.0) *. float_of_int theta); y.(!j) <- 5.0 +. 3.0 *. sin ((2.0 *. pi /. 500.0) *. float_of_int theta); incr j; done; let x' = Array.sub x 0 !j in let y' = Array.sub y 0 !j in plcol0 (i + 1); plpsty ((i + 3) mod 8 + 1); plfill x' y'; plcol0 1; plline x' y'; let just = (2.0 *. pi /. 500.0) *. float_of_int (!theta0 + theta1) /. 2.0 in let dx = 0.25 *. cos just in let dy = 0.25 *. sin just in let just = if (!theta0 + theta1 < 250 || !theta0 + theta1 > 750) then 0.0 else 1.0 in plptex (x.(!j / 2) +. dx) (y.(!j / 2) +. dy) 1.0 0.0 just text.(i); theta0 := theta1; done; plfont 2; plschr 0.0 1.3; plptex 5.0 9.0 1.0 0.0 0.5 "Percentage of Sales"; (* Don't forget to call PLEND to finish off! *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x21.ml 644 1750 1750 1554412140065762 166410ustar andrewandrew(* $Id: x21.ml 12313 2013-05-01 01:12:18Z hezekiahcarty $ Grid data demo Copyright (C) 2004 Joao Cardoso Copyright (C) 2008, 2012 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 let is_nan x = match classify_float x with FP_nan -> true | _ -> false (* Options data structure definition. *) let pts = 500 let xp = 25 let yp = 20 let nl = 16 let knn_order = 20 let threshold = 1.001 let wmin = -1e3 let xm = -0.2 let ym = -0.2 let xM = 0.6 let yM = 0.6 let cmap1_init () = let i = [|0.0; 1.0|] in let h = [|240.0; 0.0|] in (* blue -> green -> yellow -> red *) let l = [|0.6; 0.6|] in let s = [|0.8; 0.8|] in plscmap1n 256; plscmap1l false i h l s None; () let create_grid px py = let xg = Array.init px (fun i -> xm +. (xM -. xm) *. float_of_int i /. (float_of_int px -. 1.0)) in let yg = Array.init py (fun i -> ym +. (yM -. ym) *. float_of_int i /. (float_of_int py -. 1.0)) in (xg, yg) let create_data pts = let x = Array.make pts 0.0 in let y = Array.make pts 0.0 in let z = Array.make pts 0.0 in for i = 0 to pts - 1 do let xt = (xM -. xm) *. plrandd () in let yt = (yM -. ym) *. plrandd () in x.(i) <- xt +. xm; y.(i) <- yt +. ym; let r = sqrt (x.(i) *. x.(i) +. y.(i) *. y.(i)) in z.(i) <- exp (~-.r *. r) *. cos (2.0 *. pi *. r); done; (x, y, z) let () = (* In the C PLplot API, the interpolation method identifiers are just names #define-d as integers. In the OCaml bindings, the names and their related integer values are distinct. The array provides a mapping to make conversion of this example from C easier. *) let alg_array = [|PL_GRID_CSA; PL_GRID_DTLI; PL_GRID_NNI; PL_GRID_NNIDW; PL_GRID_NNLI; PL_GRID_NNAIDW|] in let title = [| "Cubic Spline Approximation"; "Delaunay Linear Interpolation"; "Natural Neighbors Interpolation"; "KNN Inv. Distance Weighted"; "3NN Linear Interpolation"; "4NN Around Inv. Dist. Weighted"; |] in let opt = [|0.0; 0.0; wmin; float_of_int knn_order; threshold; 0.0|] in plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Use a locally defined continuous color map *) cmap1_init (); (* Initialize the random number generator with a common seed *) plseed (5489L); (* The sampled data *) let x, y, z = create_data pts in let zmin = Array.fold_left min infinity z in let zmax = Array.fold_left max neg_infinity z in (* Grid the data *) let xg, yg = create_grid xp yp in plcol0 1; plenv xm xM ym yM 2 0; plcol0 15; pllab "X" "Y" "The original data sampling"; for i = 0 to pts - 1 do plcol1 ((z.(i) -. zmin) /. (zmax -. zmin)); plstring [|x.(i)|] [|y.(i)|] "#(727)"; done; pladv 0; plssub 3 2; for k = 0 to 1 do pladv 0; for alg = 1 to 6 do let named_alg = alg_array.(alg - 1) in let zg = plgriddata x y z xg yg named_alg opt.(alg - 1) in (* - CSA can generate NaNs (only interpolates?!). * - DTLI and NNI can generate NaNs for points outside the convex hull * of the data points. * - NNLI can generate NaNs if a sufficiently thick triangle is not found * * PLplot should be NaN/Inf aware, but changing it now is quite a job... * so, instead of not plotting the NaN regions, a weighted average over * the neighbors is done. *) if named_alg = PL_GRID_CSA || named_alg = PL_GRID_DTLI || named_alg = PL_GRID_NNLI || named_alg = PL_GRID_NNI then ( for i = 0 to xp - 1 do for j = 0 to yp - 1 do if is_nan zg.(i).(j) then ( (* average (IDW) over the 8 neighbors *) zg.(i).(j) <- 0.0; let dist = ref 0.0 in for ii = i - 1 to i + 1 do if ii < xp then ( for jj = j - 1 to j + 1 do if jj < yp then ( if ii >= 0 && jj >= 0 && not (is_nan zg.(ii).(jj)) then ( let d = if abs (ii - i) + abs (jj - j) = 1 then 1.0 else 1.4142 in zg.(i).(j) <- zg.(i).(j) +. zg.(ii).(jj) /. (d *. d); dist := !dist +. d; ) else () ) done ) done; if !dist <> 0.0 then zg.(i).(j) <- zg.(i).(j) /. !dist else zg.(i).(j) <- zmin ) done done ); let lzM, lzm = plMinMax2dGrid zg in let lzm = min lzm zmin in let lzM = max lzM zmax in (* Increase limits slightly to prevent spurious contours due to rounding errors *) let lzm = lzm -. 0.01 in let lzM = lzM +. 0.01 in plcol0 1; pladv alg; if k = 0 then ( let clev = Array.init nl ( fun i -> lzm +. (lzM -. lzm) /. float_of_int (nl - 1) *. float_of_int i ) in plenv0 xm xM ym yM 2 0; plcol0 15; pllab "X" "Y" title.(alg - 1); plshades zg xm xM ym yM clev 1.0 0 1.0 true; plcol0 2; ) else ( let clev = Array.init nl ( fun i -> lzm +. (lzM -. lzm) /. float_of_int (nl - 1) *. float_of_int i ) in plvpor 0.0 1.0 0.0 0.9; plwind (-1.1) 0.75 (-0.65) 1.20; (* For the comparison to be fair, all plots should have the same z values, but to get the max/min of the data generated by all algorithms would imply two passes. Keep it simple. *) plw3d 1.0 1.0 1.0 xm xM ym yM lzm lzM 30.0 (-40.0); plbox3 "bntu" "X" 0.0 0 "bntu" "Y" 0.0 0 "bcdfntu" "Z" 0.5 0; plcol0 15; pllab "" "" title.(alg - 1); plot3dc xg yg zg [PL_DRAW_LINEXY; PL_MAG_COLOR; PL_BASE_CONT] clev; ); done done; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x26.ml 644 1750 1750 1475612140065762 166520ustar andrewandrew(* -*- coding: utf-8; -*- $Id: x26.ml 12313 2013-05-01 01:12:18Z hezekiahcarty $ Multi-lingual version of the first page of example 4. Copyright (C) 2006 Alan Irwin Copyright (C) 2006 Andrew Ross Copyright (C) 2008 Hezekiah M. Carty Thanks to the following for providing translated strings for this example: Valery Pipin (Russian) This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) (* This example designed just for devices (e.g., psttfc and the cairo-related devices) that use the pango and fontconfig libraries. The best choice of glyph is selected by fontconfig and automatically rendered by pango in way that is sensitive to complex text layout (CTL) language issues for each unicode character in this example. Of course, you must have the appropriate TrueType fonts installed to have access to all the required glyphs. Translation instructions: The strings to be translated are given by x_label, y_label, alty_label, title_label, and line_label below. The encoding used must be UTF-8. The following strings to be translated involve some scientific/mathematical jargon which is now discussed further to help translators. (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . (2) degrees is an angular measure, see http://en.wikipedia.org/wiki/Degree_(angle) . (3) low-pass filter is one that transmits (passes) low frequencies. (4) pole is in the mathematical sense, see http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" means a particular mathematical transformation of the filter function has a single pole, see http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . Furthermore, a single-pole filter must have an inverse square decline (or -20 db/decade). Since the filter plotted here does have that characteristic, it must by definition be a single-pole filter, see also http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm (5) decade represents a factor of 10, see http://en.wikipedia.org/wiki/Decade_(log_scale) . *) open Plplot let x_label = [| "Frequency"; "Частота"; |] let y_label = [| "Amplitude (dB)"; "Амплитуда (dB)"; |] let alty_label = [| "Phase shift (degrees)"; "Фазовый сдвиг (градусы)"; |] let title_label = [| "Single Pole Low-Pass Filter"; "Однополюсный Низко-Частотный Фильтр"; |] let line_label = [| "-20 dB/decade"; "-20 dB/десяток"; |] (* Short rearranged versions of y_label and alty_label. *) let legend_text = [| [|"Amplitude"; "Phase shift"|]; [|"Амплитуда"; "Фазовый сдвиг"|]; |] let pi = atan 1.0 *. 4.0 (*--------------------------------------------------------------------------*\ * plot1 * * Log-linear plot. \*--------------------------------------------------------------------------*) let plot1 label_type x_label y_label alty_label legend_text title_label line_label = pladv 0; (* Set up data for log plot *) let freql = Array.init 101 (fun i -> ~-.2.0 +. float_of_int i /. 20.0) in let freq = Array.map (fun f -> 10.0**f) freql in let f0 = 1.0 in let ampl = Array.map ( fun f -> 20.0 *. log10 (1.0 /. sqrt (1.0 +. (f /. f0)**2.0)) ) freq in let phase = Array.map ( fun f -> ~-.(180.0 /. pi) *. atan (f /. f0) ) freq in plvpor 0.15 0.85 0.1 0.9; plwind (-2.0) 3.0 (-80.0) 0.0; (* Try different axis and labelling styles. *) plcol0 1; let () = match label_type with 0 -> plbox "bclnst" 0.0 0 "bnstv" 0.0 0; | 1 -> plbox "bcfghlnst" 0.0 0 "bcghnstv" 0.0 0; | _ -> raise (Failure "invalid label_type") in (* Plot ampl vs freq *) plcol0 2; plline freql ampl; plcol0 2; plptex 1.6 (-30.0) 1.0 (-20.0) 0.5 line_label; (* Put labels on *) plcol0 1; plmtex "b" 3.2 0.5 0.5 x_label; plmtex "t" 2.0 0.5 0.5 title_label; plcol0 2; plmtex "l" 5.0 0.5 0.5 y_label; (* For the gridless case, put phase vs freq on same plot *) if label_type = 0 then ( plcol0 1; plwind (-2.0) 3.0 (-100.0) 0.0; plbox "" 0.0 0 "cmstv" 30.0 3; plcol0 3; plline freql phase; plstring freql phase "*"; plcol0 3; plmtex "r" 5.0 0.5 0.5 alty_label; ); (* Draw a legend *) (* First legend entry. *) let opt_array = [| [PL_LEGEND_LINE]; [PL_LEGEND_LINE; PL_LEGEND_SYMBOL] |] in let text_colors = [| 2; 3 |] in let line_colors = [| 2; 3 |] in let line_styles = [| 1; 1 |] in let line_widths = [| 1.0; 1.0 |] in (* note from the above opt_array the first symbol (and box) indices do not matter *) (* Second legend entry. *) let symbol_colors = [| 0; 3 |] in let symbol_scales = [| 0.0; 1.0 |] in let symbol_numbers = [| 0; 4 |] in let symbols = [| ""; "*" |] in (* from the above opt_arrays we can completely ignore everything to do with boxes *) plscol0a 15 32 32 32 0.70; let _, _ = pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] [] 0.0 0.0 0.10 15 1 1 0 0 opt_array 1.0 1.0 2.0 1.0 text_colors legend_text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols in () (*--------------------------------------------------------------------------*\ * Illustration of logarithmic axes, and redefinition of window. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); plfont 2; (* Make log plots using two different styles. *) Array.iteri ( fun i xl -> plot1 0 xl y_label.(i) alty_label.(i) legend_text.(i) title_label.(i) line_label.(i) ) x_label; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x30.ml 644 1750 1750 712211543675237 166240ustar andrewandrew(* Alpha color values demonstration. Copyright (C) 2008 Hazen Babcock Copyright (C) 2008, 2010 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA This example will only really be interesting when used with devices that support or alpha (or transparency) values, such as the cairo device family. *) open Plplot let red = [|0; 255; 0; 0|] let green = [|0; 0; 255; 0|] let blue = [|0; 0; 0; 255|] let alpha = [|1.0; 1.0; 1.0; 1.0|] let px = [|0.1; 0.5; 0.5; 0.1|] let py = [|0.1; 0.1; 0.5; 0.5|] let pos = [|0.0; 1.0|] let rcoord = [|1.0; 1.0|] let gcoord = [|0.0; 0.0|] let bcoord = [|0.0; 0.0|] let acoord = [|0.0; 1.0|] let rev = [|false; false|] let () = plparseopts Sys.argv [PL_PARSE_FULL]; plinit (); plscmap0n 4; plscmap0a red green blue alpha; (* Page 1: This is a series of red, green and blue rectangles overlaid on each other with gradually increasing transparency. *) (* Set up the window *) pladv 0; plvpor 0.0 1.0 0.0 1.0; plwind 0.0 1.0 0.0 1.0; plcol0 0; plbox "" 1.0 0 "" 1.0 0; (* Draw the boxes *) for i = 0 to 8 do let icol = i mod 3 + 1 in (* Get a color, change its transparency and set it as the current color. *) let r, g, b, a = plgcol0a icol in plscol0a icol r g b (1.0 -. float_of_int i /. 9.0); plcol0 icol; (* Draw the rectangle *) let translate a = Array.map (fun x -> x +. 0.5 /. 9.0 *. float_of_int i) a in plfill (translate px) (translate py); done; (* Page 2: This is a bunch of boxes colored red, green or blue with a single large (red) box of linearly varying transparency overlaid. The overlaid box is completely transparent at the bottom and completely opaque at the top. *) (* Set up the window *) pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind 0.0 1.0 0.0 1.0; (* Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. *) for i = 0 to 4 do (* Set box X position *) let px0 = 0.05 +. 0.2 *. float_of_int i in let px1 = px0 +. 0.1 in let px = [|px0; px1; px1; px0|] in (* We don't want the boxes to be transparent, so since we changed the colors transparencies in the first example we have to change the transparencies back to completely opaque. *) let icol = i mod 3 + 1 in let r, g, b, a = plgcol0a icol in plscol0a icol r g b 1.0; plcol0 icol; for j = 0 to 4 do (* Set box y position and draw the box. *) let py0 = 0.05 +. 0.2 *. float_of_int j in let py2 = py0 +. 0.1 in let py = [|py0; py0; py2; py2|] in plfill px py; done done; let px = [|0.0; 1.0; 1.0; 0.0|] in let py = [|0.0; 0.0; 1.0; 1.0|] in (* Create the color map with 128 colors and use plscmap1la to initialize the color values with a linear varying transparency (or alpha) *) plscmap1n 128; plscmap1la true pos rcoord gcoord bcoord acoord (Some rev); plgradient px py 90.0; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x12.ml 644 1750 1750 305011256505632 166100ustar andrewandrew(* $Id: x12.ml 10463 2009-09-23 20:56:58Z hezekiahcarty $ Bar chart demo. *) open Plplot let plfbox x0 y0 = let x = [|x0; x0; x0 +. 1.0; x0 +. 1.0|] in let y = [|0.0; y0; y0; 0.0|] in plfill x y; plcol0 1; pllsty 1; plline x y; () (*--------------------------------------------------------------------------*\ * Does a simple bar chart, using color fill. If color fill is * unavailable, pattern fill is used instead (automatic). \*--------------------------------------------------------------------------*) let pos = [|0.0; 0.25; 0.5; 0.75; 1.0|] let red = [|0.0; 0.25; 0.5; 1.00; 1.0|] let green = [|1.0; 0.50; 0.5; 0.50; 1.0|] let blue = [|1.0; 1.0; 0.5; 0.25; 0.0|] let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); pladv 0; plvsta (); plwind 1980.0 1990.0 0.0 35.0; plbox "bc" 1.0 0 "bcnv" 10.0 0; plcol0 2; pllab "Year" "Widget Sales (millions)" "#frPLplot Example 12"; let y0 = [|5.0; 15.0; 12.0; 24.0; 28.0; 30.0; 20.0; 8.0; 12.0; 3.0|] in plscmap1l true pos red green blue None; for i = 0 to 9 do (* plcol0 (i + 1); *) plcol1(float_of_int i /. 9.0); plpsty 0; plfbox (1980.0 +. float_of_int i) y0.(i); let text = Printf.sprintf "%.0f" y0.(i) in plptex (1980.0 +. float_of_int i +. 0.5) (y0.(i) +. 1.0) 1.0 0.0 0.5 text; let text = string_of_int (1980 + i) in plmtex "b" 1.0 (float_of_int (i + 1) *. 0.1 -. 0.05) 0.5 text; done; (* Don't forget to call plend() to finish off! *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x25.ml 644 1750 1750 664711543675237 166430ustar andrewandrew(* $Id: x25.ml 11680 2011-03-27 17:57:51Z airwin $ Filling and clipping polygons. Copyright (C) 2008, 2010 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA This example will only really be interesting when used with devices that support or alpha (or transparency) values, such as the cairo device family. *) open Plplot (*--------------------------------------------------------------------------*\ * Test program for filling polygons and proper clipping \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plssub 3 3; plinit (); let xextreme = [| [|-120.0; 120.0|]; [|-120.0; 120.0|]; [|-120.0; 120.0|]; [| -80.0; 80.0|]; [|-220.0; -120.0|]; [| -20.0; 20.0|]; [| -20.0; 20.0|]; [| -80.0; 80.0|]; [| 20.0; 120.0|]; |] in let yextreme = [| [|-120.0; 120.0|]; [| 20.0; 120.0|]; [| -20.0; 120.0|]; [| -20.0; 120.0|]; [|-120.0; 120.0|]; [|-120.0; 120.0|]; [| -20.0; 20.0|]; [| -80.0; 80.0|]; [|-120.0; 120.0|]; |] in for k = 0 to 1 do for j = 0 to 3 do let x, y = match j with 0 -> (* Polygon 1: a diamond *) [|0.0; -100.0; 0.0; 100.0|], [|-100.0; 0.0; 100.0; 0.0|] | 1 -> (* Polygon 1: a diamond - reverse direction *) [|100.0; 0.0; -100.0; 0.0;|], [|0.0; 100.0; 0.0; -100.0|] | 2 -> (* Polygon 2: a square with punctures *) [|-100.0; -100.0; 80.0; -100.0; -100.0; -80.0; 0.0; 80.0; 100.0; 100.0|], [|-100.0; -80.0; 0.0; 80.0; 100.0; 100.0; 80.0; 100.0; 100.0; -100.0|] | 3 -> (* Polygon 2: a square with punctures - reversed direction *) [|100.0; 100.0; 80.0; 0.0; -80.0; -100.0; -100.0; 80.0; -100.0; -100.0|], [|-100.0; 100.0; 100.0; 80.0; 100.0; 100.0; 80.0; 0.0; -80.0; -100.0|] | _ -> raise (Failure "only 4 shapes are available") in for i = 0 to 8 do pladv 0; plvsta (); plwind xextreme.(i).(0) xextreme.(i).(1) yextreme.(i).(0) yextreme.(i).(1); plcol0 2; plbox "bc" 1.0 0 "bcnv" 10.0 0; plcol0 1; plpsty 0; if k = 0 then ( plfill x y ) else ( plgradient x y 45.0 ); plcol0 2; pllsty 1; plline x y; done done done; (* Don't forget to call plend() to finish off! *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/Makefile.examples.in 644 1750 1750 425012136041114 215150ustar andrewandrew# examples/ocaml/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2002, 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA OCAMLC = @OCAML_EXAMPLE_COMPILER@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ RPATHCMD = -ccopt "@RPATHCMD@" OCAML_CFLAGS = -g -I @OCAML_INSTALL_DIR@/plplot OCAML_LIBS = $(RPATHCMD) -ccopt "-L@CMAKE_INSTALL_LIBDIR@" plplot.@OCAML_EXAMPLE_LIBEXT@ unix.@OCAML_EXAMPLE_LIBEXT@ EXECUTABLES_list = \ x00ocaml$(EXEEXT) \ x01ocaml$(EXEEXT) \ x02ocaml$(EXEEXT) \ x03ocaml$(EXEEXT) \ x04ocaml$(EXEEXT) \ x05ocaml$(EXEEXT) \ x06ocaml$(EXEEXT) \ x07ocaml$(EXEEXT) \ x08ocaml$(EXEEXT) \ x09ocaml$(EXEEXT) \ x10ocaml$(EXEEXT) \ x11ocaml$(EXEEXT) \ x12ocaml$(EXEEXT) \ x13ocaml$(EXEEXT) \ x14ocaml$(EXEEXT) \ x15ocaml$(EXEEXT) \ x16ocaml$(EXEEXT) \ x17ocaml$(EXEEXT) \ x18ocaml$(EXEEXT) \ x19ocaml$(EXEEXT) \ x20ocaml$(EXEEXT) \ x21ocaml$(EXEEXT) \ x22ocaml$(EXEEXT) \ x23ocaml$(EXEEXT) \ x24ocaml$(EXEEXT) \ x25ocaml$(EXEEXT) \ x26ocaml$(EXEEXT) \ x27ocaml$(EXEEXT) \ x28ocaml$(EXEEXT) \ x29ocaml$(EXEEXT) \ x30ocaml$(EXEEXT) \ x31ocaml$(EXEEXT) \ x33ocaml$(EXEEXT) all: $(EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) @OCAML_EXAMPLE_CLEAN@ .mlocaml$(EXEEXT): $(OCAMLC) $(OCAML_CFLAGS) $(OCAML_LIBS) -o $@ $< .SUFFIXES: .ml ocaml$(EXEEXT) plplot-5.10.0+dfsg/examples/ocaml/x24.ml 644 1750 1750 611311543675237 166260ustar andrewandrew(* Unicode Pace Flag Copyright (C) 2005 Rafael Laboissiere Copyright 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In Debian, run like this: ( TTFDIR=/usr/share/fonts/truetype ; \ PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \ PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \ PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \ PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \ PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \ ./x24ocaml -dev png -o x24ocaml.png ) Packages needed: ttf-arphic-bkai00mp ttf-freefont ttf-devanagari-fonts ttf-unfonts ttf-bengali-fonts For the latest Ubuntu systems lohit_hi.ttf has been moved to the ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you will have to use this package instead and update the font path. *) open Plplot let red = [|240; 204; 204; 204; 0; 39; 125|] let green = [|240; 0; 125; 204; 204; 80; 0|] let blue = [|240; 0; 0; 0; 0; 204; 125|] let px = [|0.0; 0.0; 1.0; 1.0|] let py = [|0.0; 0.25; 0.25; 0.0|] let sx = [| 0.16374; 0.15844; 0.15255; 0.17332; 0.50436; 0.51721; 0.49520; 0.48713; 0.83976; 0.81688; 0.82231; 0.82647 |] let sy = [| 0.125; 0.375; 0.625; 0.875; 0.125; 0.375; 0.625; 0.875; 0.125; 0.375; 0.625; 0.875 |] (* Taken from http://www.columbia.edu/~fdc/pace/ *) let peace = [| (* Mandarin *) "#<0x00>和平"; (* Hindi *) "#<0x20>शांति"; (* English *) "#<0x10>Peace"; (* Hebrew *) "#<0x10>שלום"; (* Russian *) "#<0x10>Мир"; (* German *) "#<0x10>Friede"; (* Korean *) "#<0x30>평화"; (* French *) "#<0x10>Paix"; (* Spanish *) "#<0x10>Paz"; (* Arabic *) "#<0x10>ﺳﻼم"; (* Turkish*) "#<0x10>Barış"; (* Kurdish *) "#<0x10>Hasîtî"; |] let () = plparseopts Sys.argv [PL_PARSE_FULL]; plinit (); pladv 0; plvpor 0.0 1.0 0.0 1.0; plwind 0.0 1.0 0.0 1.0; plcol0 0; plbox "" 1.0 0 "" 1.0 0; plscmap0n 7; plscmap0 red green blue; plschr 0.0 4.0; plfont 1; for i = 0 to 3 do plcol0 (i + 1); plfill px py; for j = 0 to 3 do py.(j) <- py.(j) +. 1.0 /. 4.0; done done; plcol0 0; for i = 0 to 11 do plptex sx.(i) sy.(i) 1.0 0.0 0.5 peace.(i); done; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x10.ml 644 1750 1750 132011256505632 166040ustar andrewandrew(* $Id: x10.ml 10463 2009-09-23 20:56:58Z hezekiahcarty $ Window positioning demo. *) open Plplot (*--------------------------------------------------------------------------*\ * Demonstrates absolute positioning of graphs on a page. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); pladv 0; plvpor 0.0 1.0 0.0 1.0; plwind 0.0 1.0 0.0 1.0; plbox "bc" 0.0 0 "bc" 0.0 0; plsvpa 50.0 150.0 50.0 100.0; plwind 0.0 1.0 0.0 1.0; plbox "bc" 0.0 0 "bc" 0.0 0; plptex 0.5 0.5 1.0 0.0 0.5 "BOX at (50,150,50,100)"; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x01.ml 644 1750 1750 2163712120511037 166240ustar andrewandrew(* $Id: x01.ml 12298 2013-03-15 03:14:39Z hezekiahcarty $ Simple line plot and multiple windows demo. A fairly straightforward translation from the original C to OCaml. Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot open Printf type ex1_params = { xscale : float; yscale : float; xoff : float; yoff : float; } let pi = atan 1.0 *. 4.0 (* /* Variables and data arrays used by plot generators */ static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; static PLGraphicsIn gin; static int locate_mode; static int test_xor; static int fontset = 1; static char *f_name = NULL; /* Options data structure definition. */ static PLOptionTable options[] = { { "locate", /* Turns on test of API locate function */ NULL, NULL, &locate_mode, PL_OPT_BOOL, "-locate", "Turns on test of API locate function" }, { "xor", /* Turns on test of xor function */ NULL, NULL, &test_xor, PL_OPT_BOOL, "-xor", "Turns on test of XOR" }, { "font", /* For switching between font set 1 & 2 */ NULL, NULL, &fontset, PL_OPT_INT, "-font number", "Selects stroke font set (0 or 1, def:1)" }, { "save", /* For saving in postscript */ NULL, NULL, &f_name, PL_OPT_STRING, "-save filename", "Save plot in color postscript `file'" }, { NULL, /* option */ NULL, /* handler */ NULL, /* client data */ NULL, /* address of variable to set */ 0, /* mode flag */ NULL, /* short syntax */ NULL } /* long syntax */ }; const char *notes[] = {"Make sure you get it right!", NULL}; *) let plot1 (do_test, test_xor) params = let x = Array.init 60 ( fun i -> params.xoff +. params.xscale *. (float_of_int i +. 1.0) /. 60.0 ) in let y = Array.init 60 ( fun i -> params.yoff +. params.yscale *. x.(i) ** 2.0 ) in let xmin = x.(0) in let xmax = x.(59) in let ymin = y.(0) in let ymax = y.(59) in let xs = Array.init 6 (fun i -> x.(i * 10 + 3)) in let ys = Array.init 6 (fun i -> y.(i * 10 + 3)) in (* Set up the viewport and window using PLENV. The range in X is 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are scaled separately (just = 0), and we just draw a labelled box (axis = 0). *) plcol0 1; plenv xmin xmax ymin ymax 0 0; plcol0 2; pllab "(x)" "(y)" "#frPLplot Example 1 - y=x#u2"; (* Plot the data points *) plcol0 4; plpoin xs ys 9; (* Draw the line through the data *) plcol0 3; plline x y; (* COMMENT THIS SECTION OUT FOR NOW, AS IT DOES NOT FUNCTION EXACTLY AS THE C EXAMPLE. (* xor mode enable erasing a line/point/text by replotting it again *) (* it does not work in double buffering mode, however *) let () = if do_test && test_xor then let st = plxormod 1 in (* enter xor mode *) if st > 0 then begin for i = 1 to 10 do let i' = i * 6 - 6 in plpoin (Array.sub x i' 1) (Array.sub y i' 1) 9; (* draw a point *) Unix.sleep 1; (* wait a little *) plflush (); (* force an update of the driver *) plpoin (Array.sub x i' 1) (Array.sub y i' 1) 9; (* erase point *) done; ignore (plxormod 0) (* leave xor mode *) end else print_endline "xor mode not supported." in END BIG BLOCK COMMENT *) (* All done. *) () let plot2 () = (* Set up the viewport and window using PLENV. The range in X is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately (just = 0), and we draw a box with axes (axis = 1). *) plcol0 1; plenv (-2.0) 10.0 (-0.4) 1.2 0 1; plcol0 2; pllab "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; (* Fill up the arrays *) let x = Array.init 100 (fun i -> (float_of_int i -. 19.0) /. 6.0) in let y = Array.init 100 ( fun i -> if x.(i) <> 0.0 then sin x.(i) /. x.(i) else 1.0 ) in (* Draw the line *) plcol0 3; plwidth 2.0; plline x y; plwidth 1.0; (* All done. *) () let plot3 () = let space1 = 1500 in let mark1 = 1500 in (* For the final graph we wish to override the default tick intervals, and so do not use plenv(). *) pladv 0; (* Use standard viewport, and define X range from 0 to 360 degrees, Y range from -1.2 to 1.2.*) plvsta (); plwind 0.0 360.0 (-1.2) 1.2; (* Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. *) plcol0 1; plbox "bcnst" 60.0 2 "bcnstv" 0.2 2; (* Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl expects a pointer!*) plstyl [|mark1|] [|space1|]; plcol0 2; plbox "g" 30.0 0 "g" 0.2 0; plstyl [||] [||]; plcol0 3; pllab "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function"; let x = Array.init 101 (fun i -> 3.6 *. float_of_int i) in let y = Array.init 101 (fun i -> sin (x.(i) *. pi /. 180.0)) in plcol0 4; plline x y; (* All done. *) () (*--------------------------------------------------------------------------*\ * main * * Generates several simple line plots. Demonstrates: * - subwindow capability * - setting up the window, drawing plot, and labelling * - changing the color * - automatic axis rescaling to exponential notation * - placing the axes in the middle of the box * - gridded coordinate axes \*--------------------------------------------------------------------------*) let main fontset = (* plplot initialization *) (* NOT IMPLEMENTED YET (* Parse and process command line arguments *) plMergeOpts(options, "x01c options", notes); *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Get version number, just for kicks *) let plplot_version = plgver () in fprintf stdout "PLplot library version: %s\n" plplot_version; (* Initialize plplot *) (* Divide page into 2x2 plots *) plstar 2 2; (* Select font set as per input flag *) plfontld (if fontset then 1 else 0); (* Set up the data *) (* Original case *) let plot1_params = { xscale = 6.0; yscale = 1.0; xoff = 0.0; yoff = 0.0; } in (* Do a plot *) plot1 (false, false) plot1_params; (* Set up the data *) let plot1_params = { plot1_params with xscale = 1.0; yscale = 0.0014; yoff = 0.0185; } in (* Do a plot *) let digmax = 5 in plsyax digmax 0; plot1 (true, true) plot1_params; plot2 (); plot3 (); (* NOT IMPLEMENTED YET (* * Show how to save a plot: * Open a new device, make it current, copy parameters, * and replay the plot buffer *) if (f_name) { /* command line option '-save filename' */ printf("The current plot was saved in color Postscript under the name `%s'.\n", f_name); plgstrm(&cur_strm); /* get current stream */ plmkstrm(&new_strm); /* create a new one */ plsfnam(f_name); /* file name */ plsdev("psc"); /* device type */ plcpstrm(cur_strm, 0); /* copy old stream parameters to new stream */ plreplot(); /* do the save by replaying the plot buffer */ plend1(); /* finish the device */ plsstrm(cur_strm); /* return to previous stream */ } /* Let's get some user input */ if (locate_mode) { for (;;) { if (! plGetCursor(&gin)) break; if (gin.keysym == PLK_Escape) break; pltext(); if (gin.keysym < 0xFF && isprint(gin.keysym)) printf("subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = '%c'\n", gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); else printf("subwin = %d, wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x\n", gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); plgra(); } } *) (* Don't forget to call plend() to finish off! *) plend (); () let () = main true plplot-5.10.0+dfsg/examples/ocaml/x06.ml 644 1750 1750 344211367044520 166150ustar andrewandrew(* $Id: x06.ml 10957 2010-05-01 15:31:28Z hezekiahcarty $ Font demo. *) open Printf open Plplot (*--------------------------------------------------------------------------*\ * Displays the entire "plpoin" symbol (font) set. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); for kind_font = 0 to 1 do plfontld kind_font; let maxfont = if kind_font = 0 then 1 else 4 in for font = 0 to maxfont - 1 do plfont (font + 1); pladv 0; (* Set up viewport and window *) plcol0 2; plvpor 0.1 1.0 0.1 0.9; plwind 0.0 1.0 0.0 1.3; (* Draw the grid using plbox *) plbox "bcg" 0.1 0 "bcg" 0.1 0; (* Write the digits below the frame *) plcol0 15; for i = 0 to 9 do plmtex "b" 1.5 (0.1 *. float_of_int i +. 0.05) 0.5 (string_of_int i); done; let k = ref 0 in for i = 0 to 12 do (* Write the digits to the left of the frame *) plmtex "lv" 1.0 (1.0 -. (2.0 *. float_of_int i +. 1.0) /. 26.0) 1.0 (string_of_int (10 * i)); for j = 0 to 9 do let x = 0.1 *. float_of_int j +. 0.05 in let y = 1.25 -. 0.1 *. float_of_int i in (* Display the symbols *) let () = if (!k < 128) then plpoin [|x|] [|y|] !k else () in incr k; done done; if kind_font = 0 then plmtex "t" 1.5 0.5 0.5 "PLplot Example 6 - plpoin symbols (compact)" else plmtex "t" 1.5 0.5 0.5 "PLplot Example 6 - plpoin symbols (extended)"; done; done; plend (); () plplot-5.10.0+dfsg/examples/ocaml/xgtk_interface.ml 644 1750 1750 555611260731725 212070ustar andrewandrew(* Copyright 2008, 2009 Hezekiah M. Carty This file is part of PLplot. PLplot is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PLplot. If not, see . *) (* An example of using PLplot + Plcairo + Cairo + lablgtk2 to show a plot in a Gtk+ application. *) open Plplot open Plcairo (* The plot surface size, much larger than the actual window. The plot will be scaled to fit in the window. *) let plot_width = 1600 let plot_height = 1000 (* The size of the GUI view of the plot *) let gui_width = plot_width / 2 let gui_height = plot_height / 2 (** Get a Cairo context from the Gtk drawing area. *) let get_cairo w = Cairo_lablgtk.create w#misc#window (** Callback to redraw the plot contents. If the window is resized then the plot will be stretched to fit the new window dimensions. *) let redraw widget plcairo _ = let cr = get_cairo widget in let { Gtk.width = width ; Gtk.height = height } = widget#misc#allocation in let width = float_of_int width in let height = float_of_int height in plblit_to_cairo ~scale_by:(`both (width, height)) plcairo cr; true let () = (* Make a simple plot. *) let plcairo = plinit_cairo ~clear:true (plot_width, plot_height) plimagecairo in plcairo_make_active plcairo; plenv (-180.0) 180.0 (-90.0) 90.0 1 0; plmap "globe" (-180.0) 180.0 (-90.0) 90.0; pllab "Latitude" "Longitude" "It's Earth!"; (* It's ok to call plend here because we have the plot already. *) plend (); (* DO NOT call Plcairo.finish yet. The Cairo surface needs to remain active in order to use it in the GUI. *) (* Create a window for the app. *) let w = GWindow.window ~title:"PLplot + Gtk Integration Demo" () in (* Quit cleanly when the close button is clicked. *) ignore (w#connect#destroy GMain.quit); (* Put a box and frame around the plot. *) let b = GPack.vbox ~spacing:6 ~border_width:12 ~packing:w#add () in let f = GBin.frame ~shadow_type:`IN ~packing:(b#pack ~expand:true ~fill:true) () in (* This drawing_area is where the plot will be displayed. *) let area = GMisc.drawing_area ~width:gui_width ~height:gui_height ~packing:f#add () in (* Be sure to update the plot display when an expose event occurs. *) ignore (area#event#connect#expose (redraw area plcairo)); (* Show the window and enter the main Gtk+ application loop. *) w#show (); GMain.main () plplot-5.10.0+dfsg/examples/ocaml/x04.ml 644 1750 1750 773612140065762 166260ustar andrewandrew(* $Id: x04.ml 12313 2013-05-01 01:12:18Z hezekiahcarty $ Log plot demo. *) open Plplot let pi = atan 1.0 *. 4.0 (*--------------------------------------------------------------------------*\ * plot1 * * Log-linear plot. \*--------------------------------------------------------------------------*) let plot1 plot_type = pladv 0; (* Set up data for log plot *) let f0 = 1.0 in let freql = Array.init 101 (fun i -> -2.0 +. float_of_int i /. 20.0) in let freq = Array.map (fun x -> 10.0**x) freql in let ampl = Array.map ( fun x -> 20.0 *. log10 (1.0 /. sqrt (1.0 +. (x /. f0)**2.0)) ) freq in let phase = Array.map (fun x -> -.(180.0 /. pi) *. atan (x /. f0)) freq in plvpor 0.15 0.85 0.1 0.9; plwind (-2.0) 3.0 (-80.0) 0.0; (* Try different axis and labelling styles. *) plcol0 1; let () = match plot_type with 0 -> plbox "bclnst" 0.0 0 "bnstv" 0.0 0; | 1 -> plbox "bcfghlnst" 0.0 0 "bcghnstv" 0.0 0; | _ -> failwith "Bad plot type specified" in (* Plot ampl vs freq *) plcol0 2; plline freql ampl; plcol0 2; plptex 1.6 (-30.0) 1.0 (-20.0) 0.5 "-20 dB/decade"; (* Put labels on *) plcol0 1; plmtex "b" 3.2 0.5 0.5 "Frequency"; plmtex "t" 2.0 0.5 0.5 "Single Pole Low-Pass Filter"; plcol0 2; plmtex "l" 5.0 0.5 0.5 "Amplitude (dB)"; (* For the gridless case, put phase vs freq on same plot *) if plot_type = 0 then ( plcol0 1; plwind (-2.0) 3.0 (-100.0) 0.0; plbox "" 0.0 0 "cmstv" 30.0 3; plcol0 3; plline freql phase; plstring freql phase "*"; plcol0 3; plmtex "r" 5.0 0.5 0.5 "Phase shift (degrees)"; (* Draw a legend *) (* First legend entry. *) let opt_array = [| [PL_LEGEND_LINE]; [PL_LEGEND_LINE; PL_LEGEND_SYMBOL] |] in let text_colors = [| 2; 3 |] in let text = [| "Amplitude"; "Phase shift" |] in let line_colors = [| 2; 3 |] in let line_styles = [| 1; 1 |] in let line_widths = [| 1.0; 1.0 |] in (* note from the above opt_array the first symbol (and box) indices do not matter *) (* Second legend entry. *) let symbol_colors = [| 0; 3 |] in let symbol_scales = [| 0.0; 1.0 |] in let symbol_numbers = [| 0; 4 |] in let symbols = [| ""; "*" |] in (* from the above opt_arrays we can completely ignore everything to do with boxes *) plscol0a 15 32 32 32 0.70; ignore ( pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] [] 0.0 0.0 0.1 15 1 1 0 0 opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths symbol_colors symbol_scales symbol_numbers symbols ); () ) else if plot_type = 1 then ( (* Draw a legend *) (* First legend entry. *) let opt_array = [| [PL_LEGEND_LINE] |] in let text_colors = [| 2 |] in let text = [| "Amplitude" |] in let line_colors = [| 2 |] in let line_styles = [| 1 |] in let line_widths = [| 1.0 |] in (* note from the above opt_array the first symbol (and box) indices do not matter *) (* from the above opt_arrays we can completely ignore everything to do with boxes and symbols *) plscol0a 15 32 32 32 0.70; ignore ( pllegend [PL_LEGEND_BACKGROUND; PL_LEGEND_BOUNDING_BOX] [] 0.0 0.0 0.1 15 1 1 0 0 opt_array 1.0 1.0 2.0 1.0 text_colors text [||] [||] [||] [||] line_colors line_styles line_widths [||] [||] [||] [||] ); () ) (*--------------------------------------------------------------------------*\ * Illustration of logarithmic axes, and redefinition of window. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit(); plfont 2; (* Make log plots using two different styles. *) plot1 0; plot1 1; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x00.ml 644 1750 1750 314311744366556 166240ustar andrewandrew(* $Id: x00.ml 12190 2012-04-20 23:12:46Z airwin $ Simple demo of a 2D line plot. Copyright (C) 2011 Alan W. Irwin Copyright (C) 2012 Andrew Ross This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let nsize = 101 let () = let xmin = 0.0 in let xmax = 1.0 in let ymin = 0.0 in let ymax = 100.0 in (* Prepare data to be plotted. *) let x = Array.init nsize (fun i -> float_of_int i /. ( float_of_int nsize -. 1.0)) in let y = Array.init nsize (fun i -> ymax *. x.(i) *. x.(i) ) in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Create a labelled box to hold the plot. *) plenv xmin xmax ymin ymax 0 0 ; pllab "x" "y=100 x#u2#d" "Simple PLplot demo of a 2D line plot" ; (* Plot the data that was prepared above. *) plline x y; (* Close PLplot library *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x27.ml 644 1750 1750 1265211616510063 166400ustar andrewandrew(* $Id: x27.ml 11855 2011-08-04 12:27:31Z hezekiahcarty $ Drawing "spirograph" curves - epitrochoids, cycolids, roulettes Copyright (C) 2007 Arjen Markus Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 let cycloid () = () (* TODO *) (* Calculate greatest common divisor following pseudo-code for the Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm *) let rec gcd a b = let a = abs a in let b = abs b in match b with | 0 -> a | _ -> gcd b (a mod b) let spiro params fill = let npnt = 2000 in let xcoord = Array.make (npnt + 1) 0.0 in let ycoord = Array.make (npnt + 1) 0.0 in (* Fill the coordinates *) (* Proper termination of the angle loop, very near the beginning point, see http://mathforum.org/mathimages/index.php/Hypotrochoid *) let windings = int_of_float (abs_float params.(1)) / gcd (int_of_float params.(0)) (int_of_float params.(1)) in let steps = npnt / windings in let dphi = 2.0 *. pi /. float_of_int steps in (* This initialisation appears to be necessary, but I (AWI) don't understand why! *) let xmin = ref 0.0 in let xmax = ref 0.0 in let ymin = ref 0.0 in let ymax = ref 0.0 in for i = 0 to windings * steps do let phi = float_of_int i *. dphi in let phiw = (params.(0) -. params.(1)) /. params.(1) *. phi in xcoord.(i) <- (params.(0) -. params.(1)) *. cos phi +. params.(2) *. cos phiw; ycoord.(i) <- (params.(0) -. params.(1)) *. sin phi -. params.(2) *. sin phiw; if i = 0 then ( xmin := xcoord.(i); xmax := xcoord.(i); ymin := ycoord.(i); ymax := ycoord.(i); ) else ( ); if !xmin > xcoord.(i) then xmin := xcoord.(i) else (); if !xmax < xcoord.(i) then xmax := xcoord.(i) else (); if !ymin > ycoord.(i) then ymin := ycoord.(i) else (); if !ymax < ycoord.(i) then ymax := ycoord.(i) else (); done; let xrange_adjust = 0.15 *. (!xmax -. !xmin) in let xmin = !xmin -. xrange_adjust in let xmax = !xmax +. xrange_adjust in let yrange_adjust = 0.15 *. (!ymax -. !ymin) in let ymin = !ymin -. yrange_adjust in let ymax = !ymax +. yrange_adjust in plwind xmin xmax ymin ymax; plcol0 1; let xcoord' = Array.sub xcoord 0 (1 + steps * windings) in let ycoord' = Array.sub ycoord 0 (1 + steps * windings) in if fill then ( plfill xcoord' ycoord'; ) else ( plline xcoord' ycoord'; ) let deg_to_rad x = x *. pi /. 180.0 let arcs () = let nseg = 8 in let theta = ref 0.0 in let dtheta = 360.0 /. float_of_int nseg in plenv ~-.10.0 10.0 ~-.10.0 10.0 1 0; (* Plot segments of circle in different colors *) for i = 0 to nseg - 1 do plcol0 (i mod 2 + 1); plarc 0.0 0.0 8.0 8.0 !theta (!theta +. dtheta) 0.0 false; theta := !theta +. dtheta; done; (* Draw several filled ellipses inside the circle at different angles. *) let a = 3.0 in let b = a *. tan (deg_to_rad dtheta /. 2.0) in theta := dtheta /. 2.0; for i = 0 to nseg - 1 do plcol0 (2 - i mod 2); plarc (a *. cos (deg_to_rad !theta)) (a *. sin (deg_to_rad !theta)) a b 0.0 360.0 !theta true; theta := !theta +. dtheta; done; () (*--------------------------------------------------------------------------*\ * Generates two kinds of plots: * - construction of a cycloid (animated) * - series of epitrochoids and hypotrochoids \*--------------------------------------------------------------------------*) let () = (* R, r, p, N *) let params = [| [|21.0; 7.0; 7.0; 3.0|]; (* Deltoid *) [|21.0; 7.0; 10.0; 3.0|]; [|21.0; -7.0; 10.0; 3.0|]; [|20.0; 3.0; 7.0; 20.0|]; [|20.0; 3.0; 10.0; 20.0|]; [|20.0; -3.0; 10.0; 20.0|]; [|20.0; 13.0; 7.0; 20.0|]; [|20.0; 13.0; 20.0; 20.0|]; [|20.0;-13.0; 20.0; 20.0|]; |] in (* plplot initialization *) (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Illustrate the construction of a cycloid *) cycloid (); (* Loop over the various curves First an overview, then all curves one by one *) (* Three by three window *) plssub 3 3; for i = 0 to 8 do pladv 0; plvpor 0.0 1.0 0.0 1.0; spiro params.(i) false; done; pladv 0; (* One window per curve *) plssub 1 1; for i = 0 to 8 do pladv 0; plvpor 0.0 1.0 0.0 1.0; spiro params.(i) false; done; (* Fill the curves *) pladv 0; (* One window per curve *) plssub 1 1; for i = 0 to 8 do pladv 0; plvpor 0.0 1.0 0.0 1.0; spiro params.(i) true; done; (* Finally, an example to test out plarc capabilities *) arcs (); (* Don't forget to call plend() to finish off! *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x05.ml 644 1750 1750 146311256505632 166200ustar andrewandrew(* $Id: x05.ml 10463 2009-09-23 20:56:58Z hezekiahcarty $ Histogram demo. *) open Plplot let pi = atan 1.0 *. 4.0 let npts = 2047 (*--------------------------------------------------------------------------*\ * Draws a histogram from sample data. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Fill up data points *) let delta = 2.0 *. pi /. float_of_int npts in let data = Array.init npts (fun i -> sin (float_of_int i *. delta)) in plcol0 1; plhist data (-1.1) 1.1 44 [PL_HIST_DEFAULT]; plcol0 2; pllab "#frValue" "#frFrequency" "#frPLplot Example 5 - Probability function of Oscillator"; plend (); () plplot-5.10.0+dfsg/examples/ocaml/x15.ml 644 1750 1750 1247012140065762 166370ustar andrewandrew(* $Id: x15.ml 12313 2013-05-01 01:12:18Z hezekiahcarty $ Shade plot demo. Maurice LeBrun IFS, University of Texas at Austin 31 Aug 1993 *) open Plplot let xpts = 35 (* Data points in x *) let ypts = 46 (* Data points in y *) (*--------------------------------------------------------------------------*\ * cmap1_init1 * * Initializes color map 1 in HLS space. \*--------------------------------------------------------------------------*) let cmap1_init1 () = let i = [|0.0; 0.45; 0.55; 1.0|] in let h = [|260.0; 260.0; 20.0; 20.0|] in let l = [|0.5; 0.0; 0.0; 0.5|] in let s = [|1.0; 1.0; 1.0; 1.0|] in plscmap1l false i h l s None; () (*--------------------------------------------------------------------------*\ * cmap1_init2 * * Initializes color map 1 in HLS space. \*--------------------------------------------------------------------------*) let cmap1_init2 () = let i = [|0.0; 0.45; 0.55; 1.0|] in let h = [|260.0; 260.0; 20.0; 20.0|] in let l = [|0.6; 0.0; 0.0; 0.6|] in let s = [|1.0; 0.5; 0.5; 1.0|] in plscmap1l false i h l s None; () (*--------------------------------------------------------------------------*\ * plot1 * * Illustrates a single shaded region. \*--------------------------------------------------------------------------*) let plot1 z zmin zmax = let sh_cmap = 0 in pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; (* Plot using identity transform *) let shade_min = zmin +. (zmax -. zmin) *. 0.4 in let shade_max = zmin +. (zmax -. zmin) *. 0.6 in let sh_color = 7.0 in let sh_width = 2.0 in let min_color = 9 in let max_color = 2 in let min_width = 2.0 in let max_width = 2.0 in plpsty 8; plshade z (-1.0) 1.0 (-1.0) 1.0 shade_min shade_max sh_cmap sh_color sh_width min_color min_width max_color max_width true; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; plcol0 2; pllab "distance" "altitude" "Bogon flux"; () (*--------------------------------------------------------------------------*\ * plot2 * * Illustrates multiple adjacent shaded regions, using different fill * patterns for each region. \*--------------------------------------------------------------------------*) let plot2 z zmin zmax = let sh_cmap = 0 in let min_color = 0 in let min_width = 0.0 in let max_color = 0 in let max_width = 0.0 in let sh_width = 2.0 in let inc = [| [|450|]; [|-450|]; [|0|]; [|900|]; [|300|]; [|450;-450|]; [|0; 900|]; [|0; 450|]; [|450; -450|]; [|0; 900|]; |] in let del = [| [|2000|]; [|2000|]; [|2000|]; [|2000|]; [|2000|]; [|2000; 2000|]; [|2000; 2000|]; [|2000; 2000|]; [|4000; 4000|]; [|4000; 2000|]; |] in pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; (* Plot using identity transform *) for i = 0 to 9 do let shade_min = zmin +. (zmax -. zmin) *. float_of_int i /. 10.0 in let shade_max = zmin +. (zmax -. zmin) *. float_of_int (i + 1) /. 10.0 in let sh_color = float_of_int (i + 6) in plpat inc.(i) del.(i); plshade z (-1.0) 1.0 (-1.0) 1.0 shade_min shade_max sh_cmap sh_color sh_width min_color min_width max_color max_width true; done; plcol0 1; plbox "bcnst" 0.0 0 "bcnstv" 0.0 0; plcol0 2; pllab "distance" "altitude" "Bogon flux"; () (*--------------------------------------------------------------------------*\ * plot3 * * Illustrates shaded regions in 3d, using a different fill pattern for * each region. \*--------------------------------------------------------------------------*) let plot3 () = let xx = [| [|-1.0; 1.0; 1.0; -1.0; -1.0|]; [|-1.0; 1.0; 1.0; -1.0; -1.0|]; |] in let yy = [| [|1.0; 1.0; 0.0; 0.0; 1.0|]; [|-1.0; -1.0; 0.0; 0.0; -1.0|]; |] in let zz = [| [|0.0; 0.0; 1.0; 1.0; 0.0|]; [|0.0; 0.0; 1.0; 1.0; 0.0|]; |] in pladv 0; plvpor 0.1 0.9 0.1 0.9; plwind (-1.0) 1.0 (-1.0) 1.0; plw3d 1.0 1.0 1.0 (-1.0) 1.0 (-1.0) 1.0 0.0 1.5 30.0 (-40.0); (* Plot using identity transform *) plcol0 1; plbox3 "bntu" "X" 0.0 0 "bntu" "Y" 0.0 0 "bcdfntu" "Z" 0.5 0; plcol0 2; pllab "" "" "3-d polygon filling"; plcol0 3; plpsty 1; plline3 xx.(0) yy.(0) zz.(0); let sub a = Array.sub a 0 4 in plfill3 (sub xx.(0)) (sub yy.(0)) (sub zz.(0)); plpsty 2; plline3 xx.(1) yy.(1) zz.(1); plfill3 (sub xx.(1)) (sub yy.(1)) (sub zz.(1)); () (*--------------------------------------------------------------------------*\ * Does a variety of shade plots. \*--------------------------------------------------------------------------*) let () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Set up color map 1 *) cmap1_init2 (); (* Initialize plplot *) plinit (); (* Set up data array *) let z = Array.make_matrix xpts ypts 0.0 in for i = 0 to xpts - 1 do let xx = float_of_int (i - (xpts / 2)) /. float_of_int (xpts / 2) in for j = 0 to ypts - 1 do let yy = float_of_int (j - (ypts / 2)) /. float_of_int (ypts / 2) -. 1.0 in z.(i).(j) <- xx *. xx -. yy *. yy +. (xx -. yy) /. (xx *. xx +. yy *. yy +. 0.1); done done; let zmax, zmin = plMinMax2dGrid z in plot1 z zmin zmax; plot2 z zmin zmax; plot3 (); plend (); () plplot-5.10.0+dfsg/examples/ocaml/x34.ml 644 1750 1750 511311617253222 166120ustar andrewandrew(* $Id$ Drawing mode setting and getting example. Copyright (C) 2011 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot (* Drawing modes to demonstrate *) let drawing_modes = [| PL_DRAWMODE_DEFAULT; PL_DRAWMODE_REPLACE; PL_DRAWMODE_XOR; |] let drawing_mode_names = [| "Default drawing mode"; "Replace destination with source"; "XOR drawing"; |] let initialize_colors () = plscol0 0 255 255 255; plscol0 1 0 0 0; plscol0 2 255 0 0; plscol0a 3 0 0 255 0.3; () let draw_page mode title = (* A triangle for the background *) let xs = [|0.0; 1.0; 0.0|] in let ys = [|0.0; 1.0; 1.0|] in (* A circle for the foreground *) let over_x = 0.5 in let over_y = 0.5 in let over_r = 0.4 in plcol0 1; (* Setup a plot window *) plenv 0.0 1.0 0.0 1.0 1 0; (* Show which mode we're using *) pllab "" "" title; (* Draw a background triangle using the default drawing mode *) plcol0 2; plsdrawmode PL_DRAWMODE_DEFAULT; plfill xs ys; (* Draw a circle in the given drawing mode *) plcol0 3; plsdrawmode mode; plarc over_x over_y over_r over_r 0.0 360.0 0.0 true; () (*-------------------------------------------------------------------------- main --------------------------------------------------------------------------*) let main = (* PLplot initialization *) (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize PLplot *) plinit (); (* Check for drawing mode support *) let mode = plgdrawmode () in if mode = PL_DRAWMODE_UNKNOWN then begin print_endline "WARNING: This driver does not support drawing mode getting/setting"; end else begin (* Setup colors *) initialize_colors (); (* Draw one page per drawing mode *) Array.iteri (fun i mode -> draw_page mode drawing_mode_names.(i)) drawing_modes; end; (* Clean up *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/xplot01.ml 644 1750 1750 1463212140161167 175270ustar andrewandrew(* Simple line plot and multiple windows demo, using the Plot module. Copyright (C) 2008, 2009 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot open Printf module P = Plot type ex1_params = { xscale : float; yscale : float; xoff : float; yoff : float; } let pi = atan 1.0 *. 4.0 (* This function will be called just before PLplot is initialized. *) let pre () = P.load_palette (P.indexed_palette "cmap0_alternate.pal"); plparseopts Sys.argv [PL_PARSE_FULL]; () let plot1 ?stream ?fontset (do_test, test_xor) params = let x = Array.init 60 ( fun i -> params.xoff +. params.xscale *. (float_of_int i +. 1.0) /. 60.0 ) in let y = Array.init 60 ( fun i -> params.yoff +. params.yscale *. x.(i) ** 2.0 ) in let xmin = x.(0) in let xmax = x.(59) in let ymin = y.(0) in let ymax = y.(59) in (* If no stream was provided, initialize a new one. *) let stream = match stream, fontset with | None, Some fs -> ( (* Initialize plplot *) (* Divide page into 2x2 plots *) (* plplot initialization *) let stream = P.init ~pre ~pages:(2, 2) (xmin, ymin) (xmax, ymax) `greedy `prompt in (* Select font set as per input flag *) P.with_stream ~stream (fun () -> plfontld (if fs then 1 else 0)); stream ) | Some s, None -> ( (* Set up the viewport and window. The range in X is 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are scaled separately, and we just draw a labelled box. *) P.set_color ~stream:s `black; P.start_page ~stream:s (xmin, ymin) (xmax, ymax) `greedy; s ) | _ -> invalid_arg "Provide a stream or font option, not both" in let xs = Array.init 6 (fun i -> x.(i * 10 + 3)) in let ys = Array.init 6 (fun i -> y.(i * 10 + 3)) in P.set_color ~stream `blue; P.plot ~stream [ (* Plot the data points *) P.points ~symbol:"⊙" `green xs ys; (* Draw the line through the data *) P.lines `red x y; (* Show the axes *) P.default_axes; (* Title and axis labels *) P.label "(x)" "(y)" "#frPLplot Example 1 - y=x#u2"; ]; (* All done. *) stream let plot2 stream = (* Set up the viewport and window. The range in X is -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately, and we draw a box with axes. *) P.set_color ~stream `black; P.start_page ~stream (-2.0, -0.4) (10.0, 1.2) `greedy; P.set_color ~stream `blue; (* Fill up the arrays *) let x = Array.init 100 (fun i -> (float_of_int i -. 19.0) /. 6.0) in let y = Array.init 100 ( fun i -> if x.(i) <> 0.0 then sin x.(i) /. x.(i) else 1.0 ) in (* Show the axes *) let x_axis, y_axis = `axis :: P.default_axis_options, `axis :: P.default_axis_options in (* Draw the line *) P.plot ~stream [ P.lines ~width:2.0 `red x y; P.axes x_axis y_axis; P.label "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function"; ]; (* All done. *) () let plot3 stream = let space1 = 1500 in let mark1 = 1500 in (* Use standard viewport, and define X range from 0 to 360 degrees, Y range from -1.2 to 1.2.*) P.start_page ~stream (0.0, -1.2) (360.0, 1.2) `greedy; P.set_color ~stream `red; let x = Array.init 101 (fun i -> 3.6 *. float_of_int i) in let y = Array.init 101 (fun i -> sin (x.(i) *. pi /. 180.0)) in (* For the final graph we wish to override the default axis attributes, including tick intervals. Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. *) let x_axis, y_axis = (* x-axis *) [`frame0; `frame1; `label; `minor_ticks; `major_tick_spacing 60.0], (* y-axis *) [ `frame0; `frame1; `label; `minor_ticks; `major_tick_spacing 0.2; `vertical_label ] in P.plot ~stream [ (* Superimpose a dashed line grid, with 1.5 mm marks and spaces. *) P.axes ~color:`yellow ~style:(`custom [mark1, space1]) [`major_grid; `major_tick_spacing 30.0] [`major_grid; `major_tick_spacing 0.2]; P.lines `brown x y; (* The normal plot axes *) P.axes x_axis y_axis; (* Plot title and axis labels *) P.label "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function"; ]; (* All done. *) () (*--------------------------------------------------------------------------*\ * main * * Generates several simple line plots. Demonstrates: * - subwindow capability * - setting up the window, drawing plot, and labelling * - changing the color * - automatic axis rescaling to exponential notation * - placing the axes in the middle of the box * - gridded coordinate axes \*--------------------------------------------------------------------------*) let main fontset = (* Get version number, just for kicks *) let plplot_version = plgver () in fprintf stdout "PLplot library version: %s\n" plplot_version; (* Set up the data *) (* Original case *) let plot1_params = { xscale = 6.0; yscale = 1.0; xoff = 0.0; yoff = 0.0; } in (* Do a plot, and receive a new stream *) let stream = plot1 ~fontset (false, false) plot1_params in (* Set up the data *) let plot1_params = { plot1_params with xscale = 1.0; yscale = 0.0014; yoff = 0.0185; } in (* Do a plot *) let digmax = 5 in P.with_stream ~stream (fun () -> plsyax digmax 0); let stream = plot1 ~stream (true, true) plot1_params in plot2 stream; plot3 stream; (* Don't forget to finish off! All we need to do here is close up the plot stream. *) P.end_stream ~stream (); () let () = main true plplot-5.10.0+dfsg/examples/ocaml/x28.ml 644 1750 1750 3015211543675237 166520ustar andrewandrew(* $Id: x28.ml 11680 2011-03-27 17:57:51Z airwin $ plmtex3, plptex3 demo. Copyright (C) 2007 Alan W. Irwin Copyright (C) 2008, 2010 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot let pi = atan 1.0 *. 4.0 (* Choose these values to correspond to tick marks. *) let xpts = 2 let ypts = 2 let nrevolution = 16 let nrotation = 8 let nshear = 8 (*--------------------------------------------------------------------------*\ * Demonstrates plotting text in 3D. \*--------------------------------------------------------------------------*) let () = let xmin = 0.0 in let xmax = 1.0 in let xmid = 0.5 *. (xmax +. xmin) in let xrange = xmax -. xmin in let ymin = 0.0 in let ymax = 1.0 in let ymid = 0.5 *. (ymax +. ymin) in let yrange = ymax -. ymin in let zmin = 0.0 in let zmax = 1.0 in let zmid = 0.5 *. (zmax +. zmin) in let zrange = zmax -. zmin in let ysmin = ymin +. 0.1 *. yrange in let ysmax = ymax -. 0.1 *. yrange in let ysrange = ysmax -. ysmin in let dysrot = ysrange /. float_of_int (nrotation - 1) in let dysshear = ysrange /. float_of_int (nshear - 1) in let zsmin = zmin +. 0.1 *. zrange in let zsmax = zmax -. 0.1 *. zrange in let zsrange = zsmax -. zsmin in let dzsrot = zsrange /. float_of_int (nrotation - 1) in let dzsshear = zsrange /. float_of_int (nshear - 1) in let pstring = "The future of our civilization depends on software freedom." in (* Allocate and define the minimal x, y, and z to insure 3D box *) let x = Array.init xpts ( fun i -> xmin +. float_of_int i *. (xmax -. xmin) /. float_of_int (xpts - 1) ) in let y = Array.init ypts ( fun j -> ymin +. float_of_int j *. (ymax -. ymin) /. float_of_int (ypts - 1) ) in let z = Array.make_matrix xpts ypts 0.0 in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; plinit (); (* Page 1: Demonstrate inclination and shear capability pattern. *) pladv 0; plvpor (-0.15) 1.15 (-0.05) 1.05; plwind (-1.2) 1.2 (-0.8) 1.5; plw3d 1.0 1.0 1.0 xmin xmax ymin ymax zmin zmax 20.0 45.0; plcol0 2; plbox3 "b" "" (xmax -. xmin) 0 "b" "" (ymax -. ymin) 0 "bcd" "" (zmax -. zmin) 0; plschr 0.0 1.0; for i = 0 to nrevolution - 1 do let omega = 2.0 *. pi *. float_of_int i /. float_of_int nrevolution in let sin_omega = sin omega in let cos_omega = cos omega in let x_inclination = 0.5 *. xrange *. cos_omega in let y_inclination = 0.5 *. yrange *. sin_omega in let z_inclination = 0.0 in let x_shear = -0.5 *. xrange *. sin_omega in let y_shear = 0.5 *. yrange *. cos_omega in let z_shear = 0.0 in plptex3 xmid ymid zmin x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.0 " revolution"; done; plschr 0.0 1.0; for i = 0 to nrevolution - 1 do let omega = 2.0 *. pi *. float_of_int i /. float_of_int nrevolution in let sin_omega = sin omega in let cos_omega = cos omega in let x_inclination = 0.0 in let y_inclination = -0.5 *. yrange *. cos_omega in let z_inclination = 0.5 *. zrange *. sin_omega in let x_shear = 0.0 in let y_shear = 0.5 *. yrange *. sin_omega in let z_shear = 0.5 *. zrange *. cos_omega in plptex3 xmax ymid zmid x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.0 " revolution"; done; plschr 0.0 1.0; for i = 0 to nrevolution - 1 do let omega = 2.0 *. pi *. float_of_int i /. float_of_int nrevolution in let sin_omega = sin omega in let cos_omega = cos omega in let x_inclination = 0.5 *. xrange *. cos_omega in let y_inclination = 0.0 in let z_inclination = 0.5 *. zrange *. sin_omega in let x_shear = -0.5 *. xrange *. sin_omega in let y_shear = 0.0 in let z_shear = 0.5 *. zrange *. cos_omega in plptex3 xmid ymax zmid x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.0 " revolution"; done; (* Draw minimal 3D grid to finish defining the 3D box. *) plmesh x y z [PL_DRAW_LINEXY]; (* Page 2: Demonstrate rotation of string around its axis. *) pladv 0; plvpor (-0.15) 1.15 (-0.05) 1.05; plwind (-1.2) 1.2 (-0.8) 1.5; plw3d 1.0 1.0 1.0 xmin xmax ymin ymax zmin zmax 20.0 45.0; plcol0 2; plbox3 "b" "" (xmax -. xmin) 0 "b" "" (ymax -. ymin) 0 "bcd" "" (zmax -. zmin) 0; plschr 0.0 1.0; let x_inclination = 1.0 in let y_inclination = 0.0 in let z_inclination = 0.0 in let x_shear = 0.0 in for i = 0 to nrotation - 1 do let omega = 2.0 *. pi *. float_of_int i /. float_of_int nrotation in let sin_omega = sin omega in let cos_omega = cos omega in let y_shear = 0.5 *. yrange *. sin_omega in let z_shear = 0.5 *. zrange *. cos_omega in let zs = zsmax -. dzsrot *. float_of_int i in plptex3 xmid ymax zs x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 "rotation for y = y#dmax#u"; done; plschr 0.0 1.0; let x_inclination = 0.0 in let y_inclination = -1.0 in let z_inclination = 0.0 in let y_shear = 0.0 in for i = 0 to nrotation - 1 do let omega = 2.0 *. pi *. float_of_int i /. float_of_int nrotation in let sin_omega = sin omega in let cos_omega = cos omega in let x_shear = 0.5 *. xrange *. sin_omega in let z_shear = 0.5 *. zrange *. cos_omega in let zs = zsmax -. dzsrot *. float_of_int i in plptex3 xmax ymid zs x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 "rotation for x = x#dmax#u"; done; plschr 0.0 1.0; let x_inclination = 1.0 in let y_inclination = 0.0 in let z_inclination = 0.0 in let x_shear = 0.0 in for i = 0 to nrotation - 1 do let omega = 2.0 *. pi *. float_of_int i /. float_of_int nrotation in let sin_omega = sin omega in let cos_omega = cos omega in let y_shear = 0.5 *. yrange *. cos_omega in let z_shear = 0.5 *. zrange *. sin_omega in let ys = ysmax -. dysrot *. float_of_int i in plptex3 xmid ys zmin x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 "rotation for z = z#dmin#u"; done; (* Draw minimal 3D grid to finish defining the 3D box. *) plmesh x y z [PL_DRAW_LINEXY]; (* Page 3: Demonstrate shear of string along its axis. *) (* Work around xcairo and pngcairo (but not pscairo) problems for shear vector too close to axis of string. (N.B. no workaround would be domega = 0.) *) let domega = 0.05 in pladv 0; plvpor (-0.15) 1.15 (-0.05) 1.05; plwind (-1.2) 1.2 (-0.8) 1.5; plw3d 1.0 1.0 1.0 xmin xmax ymin ymax zmin zmax 20.0 45.0; plcol0 2; plbox3 "b" "" (xmax -. xmin) 0 "b" "" (ymax -. ymin) 0 "bcd" "" (zmax -. zmin) 0; plschr 0.0 1.0; let x_inclination = 1.0 in let y_inclination = 0.0 in let z_inclination = 0.0 in let y_shear = 0.0 in for i = 0 to nshear - 1 do let omega = domega +. 2.0 *. pi *. float_of_int i /. float_of_int nshear in let sin_omega = sin omega in let cos_omega = cos omega in let x_shear = 0.5 *. xrange *. sin_omega in let z_shear = 0.5 *. zrange *. cos_omega in let zs = zsmax -. dzsshear *. float_of_int i in plptex3 xmid ymax zs x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 "shear for y = y#dmax#u"; done; plschr 0.0 1.0; let x_inclination = 0.0 in let y_inclination = -1.0 in let z_inclination = 0.0 in let x_shear = 0.0 in for i = 0 to nshear - 1 do let omega = domega +. 2.0 *. pi *. float_of_int i /. float_of_int nshear in let sin_omega = sin omega in let cos_omega = cos omega in let y_shear = -0.5 *. yrange *. sin_omega in let z_shear = 0.5 *. zrange *. cos_omega in let zs = zsmax -. dzsshear *. float_of_int i in plptex3 xmax ymid zs x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 "shear for x = x#dmax#u"; done; plschr 0.0 1.0; let x_inclination = 1.0 in let y_inclination = 0.0 in let z_inclination = 0.0 in let z_shear = 0.0 in for i = 0 to nshear - 1 do let omega = domega +. 2.0 *. pi *. float_of_int i /. float_of_int nshear in let sin_omega = sin omega in let cos_omega = cos omega in let y_shear = 0.5 *. yrange *. cos_omega in let x_shear = 0.5 *. xrange *. sin_omega in let ys = ysmax -. dysshear *. float_of_int i in plptex3 xmid ys zmin x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 "shear for z = z#dmin#u"; done; (* Draw minimal 3D grid to finish defining the 3D box. *) plmesh x y z [PL_DRAW_LINEXY]; (* Page 4: Demonstrate drawing a string on a 3D path. *) pladv 0; plvpor (-0.15) 1.15 (-0.05) 1.05; plwind (-1.2) 1.2 (-0.8) 1.5; plw3d 1.0 1.0 1.0 xmin xmax ymin ymax zmin zmax 40.0 (-30.0); plcol0 2; plbox3 "b" "" (xmax -. xmin) 0 "b" "" (ymax -. ymin) 0 "bcd" "" (zmax -. zmin) 0; plschr 0.0 1.2; (* domega controls the spacing between the various characters of the string and also the maximum value of omega for the given number of characters in pstring. *) let domega = 2.0 *. pi /. float_of_int (String.length pstring) in (* 3D function is a helix of the given radius and pitch *) let radius = 0.5 in let pitch = 1.0 /. (2.0 *. pi) in for i = 0 to String.length pstring - 1 do let omega = 0.0 +. float_of_int i *. domega in let sin_omega = sin omega in let cos_omega = cos omega in let xpos = xmid +. radius *. sin_omega in let ypos = ymid -. radius *. cos_omega in let zpos = zmin +. pitch *. omega in (* In general, the inclination is proportional to the derivative of the position wrt theta. *) let x_inclination = radius *. cos_omega in let y_inclination = radius *. sin_omega in let z_inclination = pitch in (* The shear vector should be perpendicular to the 3D line with Z component maximized, but for low pitch a good approximation is a constant vector that is parallel to the Z axis. *) let x_shear = 0.0 in let y_shear = 0.0 in let z_shear = 1.0 in let p1string = String.sub pstring i 1 in plptex3 xpos ypos zpos x_inclination y_inclination z_inclination x_shear y_shear z_shear 0.5 p1string; done; (* Draw minimal 3D grid to finish defining the 3D box. *) plmesh x y z [PL_DRAW_LINEXY]; (* Page 5: Demonstrate plmtex3 axis labelling capability *) pladv 0; plvpor (-0.15) 1.15 (-0.05) 1.05; plwind (-1.2) 1.2 (-0.8) 1.5; plw3d 1.0 1.0 1.0 xmin xmax ymin ymax zmin zmax 20.0 45.0; plcol0 2; plbox3 "b" "" (xmax -. xmin) 0 "b" "" (ymax -. ymin) 0 "bcd" "" (zmax -. zmin) 0; plschr 0.0 1.0; plmtex3 "xp" 3.0 0.5 0.5 "Arbitrarily displaced"; plmtex3 "xp" 4.5 0.5 0.5 "primary X-axis label"; plmtex3 "xs" (-2.5) 0.5 0.5 "Arbitrarily displaced"; plmtex3 "xs" (-1.0) 0.5 0.5 "secondary X-axis label"; plmtex3 "yp" 3.0 0.5 0.5 "Arbitrarily displaced"; plmtex3 "yp" 4.5 0.5 0.5 "primary Y-axis label"; plmtex3 "ys" (-2.5) 0.5 0.5 "Arbitrarily displaced"; plmtex3 "ys" (-1.0) 0.5 0.5 "secondary Y-axis label"; plmtex3 "zp" 4.5 0.5 0.5 "Arbitrarily displaced"; plmtex3 "zp" 3.0 0.5 0.5 "primary Z-axis label"; plmtex3 "zs" (-2.5) 0.5 0.5 "Arbitrarily displaced"; plmtex3 "zs" (-1.0) 0.5 0.5 "secondary Z-axis label"; (* Draw minimal 3D grid to finish defining the 3D box. *) plmesh x y z [PL_DRAW_LINEXY]; (* Clean up. *) plend (); () plplot-5.10.0+dfsg/examples/ocaml/x19.ml 644 1750 1750 1172212221050115 166240ustar andrewandrew(* Illustrates backdrop plotting of world, US maps. Contributed by Wesley Ebisuzaki. Updated for OCaml by Hezekiah Carty Copyright 2007, 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PLplot. If not, see . *) open Plplot open Printf (*--------------------------------------------------------------------------*\ * mapform19 * * Defines specific coordinate transformation for example 19. * Not to be confused with mapform in src/plmap.c. * x[], y[] are the coordinates to be plotted. \*--------------------------------------------------------------------------*) let pi = atan 1.0 *. 4.0 (* The mapform callback gets a single pair of x and y coordinates and their index. It should return the properly transformed coordinates a an (x,y) tuple. *) let mapform19 x y = let radius = 90.0 -. y in let xp = radius *. cos (x *. pi /. 180.0) in let yp = radius *. sin (x *. pi /. 180.0) in (xp, yp) (* "Normalize" longitude values so that they always fall between -180.0 and 180.0 *) let normalize_longitude lon = if lon >= -180.0 && lon <= 180.0 then lon else let times = floor ((abs_float lon +. 180.0) /. 360.0) in if lon < 0.0 then lon +. 360.0 *. times else lon -. 360.0 *. times (* A custom axis labeling function for longitudes and latitudes. *) let geolocation_labeler axis value = let label_val, direction_label = match axis with | PL_Y_AXIS -> let label_val = value in label_val, if label_val > 0.0 then " N" else if label_val < 0.0 then " S" else "Eq" | PL_X_AXIS -> let label_val = normalize_longitude value in label_val, if label_val > 0.0 then " E" else if label_val < 0.0 then " W" else "" | PL_Z_AXIS -> invalid_arg "Invalid axis - only X or Y are supported" in if axis = PL_Y_AXIS && label_val = 0.0 then (* A special case for the equator *) sprintf "%s" direction_label else sprintf "%.0f%s" (abs_float label_val) direction_label (*--------------------------------------------------------------------------*\ * main * * Shows two views of the world map. \*--------------------------------------------------------------------------*) let () = (* Longitude (x) and latitude (y) *) let miny = -70.0 in let maxy = 80.0 in (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; plinit(); (* Cartesian plots *) (* Most of world *) let minx = -170.0 in let maxx = minx +. 360.0 in (* Setup a custom latitude and longitude-based scaling function. *) plslabelfunc geolocation_labeler; plcol0 1; plenv minx maxx miny maxy 1 70; (* No transform function is passed to plmap. Since we have not set one yet, it defaults to using an identity function (xp = x, yp = y) *) plmap "usaglobe" minx maxx miny maxy; (* The Americas *) let minx = 190.0 in let maxx = 340.0 in plcol0 1; plenv minx maxx miny maxy 1 70; (* Again, we have not set a transform. Everything remains in a Cartesian projection. *) plmap "usaglobe" minx maxx miny maxy; (* Clear the labeling function *) plunset_labelfunc (); (* Polar, Northern hemisphere *) let minx = 0.0 in let maxx = 360.0 in plenv (-75.) 75. (-75.) 75. 1 (-1); (* Now we set mapform19 as our callback. It will be used for every following plmap and plmeridians call until set to something else. *) plset_mapform mapform19; plmap "globe" minx maxx miny maxy; pllsty 2; (* This call to plmeridians is also after the set_mapform call, so it uses the same projection as the plmap call above. *) plmeridians 10.0 10.0 0.0 360.0 (-10.0) 80.0; plunset_mapform (); (* Polar, Northern hemisphere, this time with a PLplot-wide transform *) let minx = 0.0 in let maxx = 360.0 in plstransform mapform19; pllsty 1; plenv (-75.) 75. (-75.) 75. 1 (-1); (* No need to set the map transform here as the global transform will be used. *) plmap "globe" minx maxx miny maxy; pllsty 2; plmeridians 10.0 10.0 0.0 360.0 (-10.0) 80.0; (* Show Baltimore, MD on the map *) plcol0 2; plssym 0.0 2.0; plpoin [|-76.6125|] [|39.2902778|] 18; plssym 0.0 1.0; plptex ~-.76.6125 43.0 0.0 0.0 0.0 "Baltimore, MD"; (* For OCaml, this is how the global transform is cleared *) plunset_transform (); plend (); () plplot-5.10.0+dfsg/examples/ocaml/x02.ml 644 1750 1750 1003012120511037 166060ustar andrewandrew(* $Id: x02.ml 12298 2013-03-15 03:14:39Z hezekiahcarty $ Multiple window and color map 0 demo. Copyright (C) 2008 Hezekiah M. Carty This file is part of PLplot. PLplot is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. PLplot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with PLplot; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) open Plplot (*--------------------------------------------------------------------------*\ * draw_windows * * Draws a set of numbered boxes with colors according to cmap0 entry. \*--------------------------------------------------------------------------*) let draw_windows nw cmap0_offset = plschr 0.0 3.5; plfont 4; for i = 0 to nw - 1 do plcol0 (i + cmap0_offset); let text = string_of_int i in pladv 0; let vmin = 0.1 in let vmax = 0.9 in for j = 0 to 2 do plwidth (float_of_int (j + 1)); let j' = float_of_int j *. 0.1 in plvpor (vmin +. j') (vmax -. j') (vmin +. j') (vmax -. j'); plwind 0.0 1.0 0.0 1.0; plbox "bc" 0.0 0 "bc" 0.0 0; done; plwidth 1.0; plptex 0.5 0.5 1.0 0.0 0.5 text; done; () (*--------------------------------------------------------------------------*\ * demo1 * * Demonstrates multiple windows and default color map 0 palette. \*--------------------------------------------------------------------------*) let demo1 () = plbop (); (* Divide screen into 16 regions *) plssub 4 4; draw_windows 16 0; pleop (); () (*--------------------------------------------------------------------------*\ * demo2 * * Demonstrates multiple windows, user-modified color map 0 palette, and * HLS -> RGB translation. \*--------------------------------------------------------------------------*) let demo2 () = (* Set up cmap0 *) (* Use 100 custom colors in addition to base 16 *) let r = Array.make 116 0 in let g = Array.make 116 0 in let b = Array.make 116 0 in (* Min & max lightness values *) let lmin = 0.15 and lmax = 0.85 in plbop (); (* Divide screen into 100 regions *) plssub 10 10; for i = 0 to 99 do (* Bounds on HLS, from plhlsrgb() commentary -- * hue [0., 360.] degrees * lightness [0., 1.] magnitude * saturation [0., 1.] magnitude *) (* Vary hue uniformly from left to right *) let h = (360. /. 10. ) *. float_of_int ( i mod 10 ) in (* Vary lightness uniformly from top to bottom, between min & max *) let l = lmin +. (lmax -. lmin) *. float_of_int (i / 10) /. 9. in (* Use max saturation *) let s = 1.0 in let (r1, g1, b1) = plhlsrgb h l s in r.(i+16) <- int_of_float (r1 *. 255.001); g.(i+16) <- int_of_float (g1 *. 255.001); b.(i+16) <- int_of_float (b1 *. 255.001); done; (* Load default cmap0 colors into our custom set *) for i = 0 to 15 do let (r1, g1, b1) = plgcol0 i in r.(i) <- r1; g.(i) <- g1; b.(i) <- b1; done; (* Now set cmap0 all at once (faster, since fewer driver calls) *) plscmap0 r g b; draw_windows 100 16; pleop (); () (*--------------------------------------------------------------------------*\ * main * * Demonstrates multiple windows and color map 0 palette, both default and * user-modified. \*--------------------------------------------------------------------------*) let main () = (* Parse and process command line arguments *) plparseopts Sys.argv [PL_PARSE_FULL]; (* Initialize plplot *) plinit (); (* Run demos *) demo1 (); demo2 (); plend (); () let () = main () plplot-5.10.0+dfsg/examples/perl/ 775 1750 1750 012406243570 154355ustar andrewandrewplplot-5.10.0+dfsg/examples/perl/x09.pl 755 1750 1750 1741511543675237 165350ustar andrewandrew#! /usr/bin/env perl # # Demo x09 for the PLplot PDL binding # # Contour plot demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x09c.c 1.27 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use constant XPTS => 35; # Data points in x use constant YPTS => 46; # Data points in y use constant XSPA => 2 / (XPTS - 1); use constant YSPA => 2 / (YPTS - 1); # polar plot data use constant PERIMETERPTS => 100; use constant RPTS => 40; use constant THETAPTS => 40; # potential plot data use constant PPERIMETERPTS => 100; use constant PRPTS => 40; use constant PTHETAPTS => 64; use constant PNLEVEL => 20; my $clevel = pdl [-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.]; # Transformation function my @tr = (XSPA, 0.0, -1.0, 0.0, YSPA, -1.0); sub mypltr { my ($x, $y) = @_; my $tx = $tr[0] * $x + $tr[1] * $y + $tr[2]; my $ty = $tr[3] * $x + $tr[4] * $y + $tr[5]; return ($tx, $ty); } # Polar contour plot example sub polar { plenv (-1., 1., -1., 1., 0, -2); plcol0 (1); # Perimeter my $t = (2 * pi / (PERIMETERPTS - 1)) * sequence (PERIMETERPTS); my $px = cos ($t); my $py = sin ($t); plline ($px, $py); # Create data to be contoured my $r = ((sequence (RPTS)) / (RPTS - 1))->dummy (1, THETAPTS); my $theta = ((2 * pi / (THETAPTS - 1)) * sequence (THETAPTS))->dummy (0, RPTS); my $cgrid2 = plAlloc2dGrid ($r * cos ($theta), $r * sin ($theta)); my $z = $r; my $lev = 0.05 + 0.10 * sequence (10); plcol0 (2); plcont ($z, 1, RPTS, 1, THETAPTS, $lev, \&pltr2, $cgrid2); plcol0 (1); pllab ("", "", "Polar Contour Plot"); # plFree2dGrid ($cgrid2); } # f2mnmx # # Returns min & max of input 2d array sub f2mnmx { $f = shift; my $fmin = min ($f); my $fmax = max ($f); return ($fmin, $fmax) } # Shielded potential contour plot example sub potential { # create data to be contoured my $r = (0.5 + sequence (PRPTS))->dummy (1, PTHETAPTS); my $theta = ((2 * pi / (PTHETAPTS - 1)) * (0.5 + sequence (PTHETAPTS)))->dummy (0, PRPTS); my $xg = $r * cos ($theta); my $yg = $r * sin ($theta); my $cgrid2 = plAlloc2dGrid ($xg, $yg); my $rmax = 0.5 + (PRPTS - 1); my ($xmin, $xmax) = f2mnmx ($xg); my ($ymin, $ymax) = f2mnmx ($yg); my $x0 = ($xmin + $xmax) / 2; my $y0 = ($ymin + $ymax) / 2; # Expanded limits my $peps = 0.05; my $xpmin = $xmin - abs ($xmin) * $peps; my $xpmax = $xmax + abs ($xmax) * $peps; my $ypmin = $ymin - abs ($ymin) * $peps; my $ypmax = $ymax + abs ($ymax) * $peps; # Potential inside a conducting cylinder (or sphere) by method of images. # Charge 1 is placed at (d1, d1), with image charge at (d2, d2). # Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). # Also put in smoothing term at small distances. my $eps = 2; my $q1 = 1; my $d1 = $rmax / 4; my $q1i = - $q1 * $rmax / $d1; my $d1i = ($rmax ** 2) / $d1; my $q2 = -1; my $d2 = $rmax / 4; my $q2i = - $q2 * $rmax / $d2; my $d2i = ($rmax ** 2) / $d2; $div1 = sqrt (($xg - $d1) ** 2 + ($yg - $d1) ** 2 + $eps ** 2); $div1i = sqrt (($xg - $d1i) ** 2 + ($yg - $d1i) ** 2 + $eps ** 2); $div2 = sqrt (($xg - $d2) ** 2 + ($yg + $d2) ** 2 + $eps** 2); $div2i = sqrt (($xg - $d2i) ** 2 + ($yg + $d2i) ** 2 + $eps ** 2); my $z = $q1 / $div1 + $q1i / $div1i + $q2 / $div2 + $q2i / $div2i; my ($zmin, $zmax) = f2mnmx ($z); # Positive and negative contour levels my $dz = ($zmax - $zmin) / PNLEVEL; my $clevel = $zmin + (sequence (PNLEVEL) + 0.5) * $dz;; my $idx = which ($clevel <= 0); my $nlevelneg = $idx->dim (0); my $clevelneg = zeroes ($nlevelneg); $clevelneg .= $clevel->index ($idx); $idx = which ($clevel > 0); my $nlevelpos = $idx->dim (0); my $clevelpos = zeroes ($nlevelpos); $clevelpos .= $clevel->index ($idx); # Colours! my $ncollin = 11; my $ncolbox = 1; my $ncollab = 2; # Finally start plotting this page! pladv (0); plcol0 ($ncolbox); plvpas (0.1, 0.9, 0.1, 0.9, 1.0); plwind ($xpmin, $xpmax, $ypmin, $ypmax); plbox (0., 0, 0., 0, "", ""); plcol0 ($ncollin); if ($nlevelneg > 0) { # Negative contours pllsty (2); plcont ($z, 1, PRPTS, 1, PTHETAPTS, $clevelneg, \&pltr2, $cgrid2); } if ($nlevelpos > 0) { # Positive contours pllsty (1); plcont ($z, 1, PRPTS, 1, PTHETAPTS, $clevelpos, \&pltr2, $cgrid2); } # Draw outer boundary my $t = (2 * pi / (PPERIMETERPTS - 1)) * sequence (PPERIMETERPTS); my $px = $x0 + $rmax * cos ($t); my $py = $y0 + $rmax * sin ($t); plcol0 ($ncolbox); plline ($px, $py); plcol0 ($ncollab); pllab ("", "", "Shielded potential of charges in a conducting sphere"); # plFree2dGrid ($cgrid2); } # main # # Does several contour plots using different coordinate mappings my $mark = 1500; my $space = 1500; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); # Set up function arrays $xx = ((sequence (XPTS) - int(XPTS / 2)) / int(XPTS / 2))->dummy (1, YPTS); $yy = ((sequence (YPTS) - int(YPTS / 2)) / int(YPTS / 2) - 1.0)->dummy (0, XPTS); my $z = $xx * $xx - $yy * $yy; my $w = 2 * $xx * $yy; # Set up grids $distort = 0.4; my $xx = zeroes (XPTS); my $yy = zeroes (YPTS); for (my $i = 0; $i < XPTS; $i++) { for (my $j = 0; $j < YPTS; $j++) { my ($xij, $yij) = mypltr ($i, $j, 0); $xx->index ($i) .= $xij; $yy->index ($j) .= $yij; } } my $argx = $xx * pi / 2; my $argy = $yy * pi / 2; my $cgrid1 = plAllocGrid ($xx + $distort * cos ($argx), $yy - $distort * cos ($argy)); $xx = $xx->dummy (1, YPTS); $yy = $yy->dummy (0, XPTS); $argx = $argx->dummy (1, YPTS); $argy = $argy->dummy (0, XPTS); my $cgrid2 = plAlloc2dGrid ($xx + $distort * cos ($argx) * cos ($argy), $yy - $distort * cos ($argx) * cos ($argy)); # Plot using identity transform pl_setcontlabelformat (4, 3); pl_setcontlabelparam (0.006, 0.3, 0.1, 1); plenv (-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0 (2); plcont ($z, 1, XPTS, 1, YPTS, $clevel, \&mypltr, 0); plstyl ($mark, $space); plcol0 (3); plcont ($w, 1, XPTS, 1, YPTS, $clevel, \&mypltr, 0); plstyl (pdl([]), pdl([])); plcol0 (1); pllab ("X Coordinate", "Y Coordinate", "Streamlines of flow"); pl_setcontlabelparam (0.006, 0.3, 0.1, 0); # Plot using 1d coordinate transform plenv (-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0 (2); plcont ($z, 1, XPTS, 1, YPTS, $clevel, \&pltr1, $cgrid1); plstyl ($mark, $space); plcol0 (3); plcont ($w, 1, XPTS, 1, YPTS, $clevel, \&pltr1, $cgrid1); plstyl (pdl([]), pdl([])); plcol0 (1); pllab ("X Coordinate", "Y Coordinate", "Streamlines of flow"); # Plot using 2d coordinate transform plenv (-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0 (2); plcont ($z, 1, XPTS, 1, YPTS, $clevel, \&pltr2, $cgrid2); plstyl ($mark, $space); plcol0 (3); plcont ($w, 1, XPTS, 1, YPTS, $clevel, \&pltr2, $cgrid2); plstyl (pdl([]), pdl([])); plcol0 (1); pllab ("X Coordinate", "Y Coordinate", "Streamlines of flow"); # pl_setcontlabelparam (0.006, 0.3, 0.1, 0); polar (); # pl_setcontlabelparam (0.006, 0.3, 0.1, 0); potential (); plend(); plFreeGrid ($cgrid1); plFree2dGrid ($cgrid2); plplot-5.10.0+dfsg/examples/perl/x25.pl 755 1750 1750 477211556634250 165070ustar andrewandrew#! /usr/bin/env perl # # Demo x25 for the PLplot PDL binding # # Copyright (C) 2006 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x25c.c 1.3 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Getopt::Long; my ($i, $j); # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plssub(3,3); plinit(); my $xextreme = pdl( [-120, -120, -120, -80, -220, -20, -20, -80, 20], [120, 120, 120, 80, -120, 20, 20, 80, 120]); my $yextreme = pdl( [-120, 20, -20, -20, -120, -120, -20, -80, -120], [120, 120, 120, 120, 120, 120, 20, 80, 120]); my ($x0, $y0); for ( $k = 0; $k < 2; $k++ ) { for ( $j = 0; $j < 4; $j ++ ) { if ( $j == 0 ) { # Polygon 1: a diamond $x0 = pdl( 0, -100, 0, 100); $y0 = pdl( -100, 0, 100, 0); } if ( $j == 1 ) { # Polygon 1: a diamond - reverse direction $x0 = pdl( 100, 0, -100, 0); $y0 = pdl( 0, 100, 0, -100); } if ( $j == 2 ) { # Polygon 2: a square with punctures $x0 = pdl( -100, -100, 80, -100, -100, -80, 0, 80, 100, 100); $y0 = pdl( -100, -80, 0, 80, 100, 100, 80, 100, 100, -100); } if ( $j == 3 ) { # Polygon 2: a square with punctures - reversed direction $x0 = pdl( 100, 100, 80, 0, -80, -100, -100, 80, -100, -100); $y0 = pdl( -100, 100, 100, 80, 100, 100, 80, 0, -80, -100); } for ( $i = 0; $i < 9 ; $i ++ ) { pladv(0); plvsta(); plwind($xextreme->at($i,0), $xextreme->at($i,1), $yextreme->at($i,0), $yextreme->at($i,1)); plcol0(2) ; plbox(1.0, 0, 10.0, 0, "bc", "bcnv", ); plcol0(1) ; plpsty(0) ; if ( $k == 0 ) { plfill( $x0, $y0 ); } else { plgradient( $x0, $y0, 45. ); } plcol0(2) ; pllsty(1) ; plline($x0,$y0) ; } } } # Don't forget to call plend() to finish off! plend(); plplot-5.10.0+dfsg/examples/perl/x10.pl 755 1750 1750 250411543675237 164760ustar andrewandrew#! /usr/bin/env perl # # Demo x10 for the PLplot PDL binding # # Window positioning demo. # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x10c.c 1.13 use PDL; use PDL::Graphics::PLplot; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); pladv (0); plvpor (0.0, 1.0, 0.0, 1.0); plwind (0.0, 1.0, 0.0, 1.0); plbox (0.0, 0, 0.0, 0, "bc", "bc"); plsvpa (50.0, 150.0, 50.0, 100.0); plwind (0.0, 1.0, 0.0, 1.0); plbox (0.0, 0, 0.0, 0, "bc", "bc"); plptex (0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)"); plend (); plplot-5.10.0+dfsg/examples/perl/x12.pl 755 1750 1750 442411543675237 165030ustar andrewandrew#! /usr/bin/env perl # # Demo x12 for the PLplot PDL binding # # Bar chart demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x12c.c 1.14 use PDL; use PDL::Graphics::PLplot; my $pos = double (0.0, 0.25, 0.5, 0.75, 1.0); my $red = double (0.0, 0.25, 0.5, 1.0, 1.0); my $green = double (1.0, 0.5, 0.5, 0.5, 1.0); my $blue = double (1.0, 1.0, 0.5, 0.25, 0.0); # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); pladv (0); plvsta (); plwind (1980.0, 1990.0, 0.0, 35.0); plbox (1.0, 0, 10.0, 0, "bc", "bcnv"); plcol0 (2); pllab ("Year", "Widget Sales (millions)", "#frPLplot Example 12"); my $y0 = pdl [5, 15, 12, 24, 28, 30, 20, 8, 12, 3]; plscmap1l(1, $pos, $red, $green, $blue, pdl []); for (my $i = 0; $i < 10; $i++) { # plcol0 ($i + 1); plcol1 ($i/9.0); plpsty (0); myplfbox ((1980. + $i), $y0->index ($i)); my $string = sprintf ("%.0f", $y0->index ($i)); plptex ((1980. + $i + .5), ($y0->index ($i) + 1.), 1.0, 0.0, .5, $string); $string = sprintf ("%d", 1980 + $i); plmtex (1.0, (($i + 1) * .1 - .05), 0.5, "b", $string); } # Don't forget to call plend() to finish off! plend (); # The subroutine below is called plfbox in the x12c.c examples, but # the PDL binding define already a plfbos that conflicts with this # one. Hence, it was recalled myplfbox here. sub myplfbox { my $x0 = shift; my $y0 = shift; my $x = $x0 + pdl [0, 0, 1, 1]; my $y = pdl [0, $y0->sclr, $y0->sclr, 0]; plfill ($x, $y); plcol0 (1); pllsty (1); plline ($x, $y); } plplot-5.10.0+dfsg/examples/perl/x05.pl 755 1750 1750 265111543675237 165050ustar andrewandrew#! /usr/bin/env perl # # Demo x05 for the PLplot PDL binding # # Histogram demo # (inspired from t/x05.t of module Graphics::PLplot, by Tim Jenness) # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x05c.c 1.15 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); # Fill up data points use constant NPTS => 2047; my $delta = 2 * pi / NPTS; my $data = sin (sequence (NPTS) * $delta); plcol0 (1); plhist ($data, -1.1, 1.1, 44, 0); plcol0 (2); pllab ("#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator"); plend (); plplot-5.10.0+dfsg/examples/perl/CMakeLists.txt 644 1750 1750 510611556707226 202650ustar andrewandrew# examples/perl/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(perl_STRING_INDICES "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) set(perl_SCRIPTS) foreach(STRING_INDEX ${perl_STRING_INDICES}) list(APPEND perl_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/x${STRING_INDEX}.pl) endforeach(STRING_INDEX ${c_STRING_INDICES}) # Target that must be run before any pdl tests. set_property(GLOBAL PROPERTY TARGETS_examples_pdl plplot${LIB_TAG}) # File dependencies for any pdl tests. set_property(GLOBAL PROPERTY FILES_examples_pdl plplot${LIB_TAG} ${perl_SCRIPTS}) if(CORE_BUILD) set(PERM_SCRIPTS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) # These are standalone scripts which are executable and which # should be installed in the examples/perl directory. install(FILES ${perl_SCRIPTS} DESTINATION ${DATA_DIR}/examples/perl PERMISSIONS ${PERM_SCRIPTS} ) set(perl_DATA README.perldemos) set(PERM_DATA OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) # These are data files which should be installed in the examples/perl # directory. install(FILES ${perl_DATA} DESTINATION ${DATA_DIR}/examples/perl PERMISSIONS ${PERM_DATA} ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/perl ) endif(CORE_BUILD) plplot-5.10.0+dfsg/examples/perl/check-sync.pl 755 1750 1750 255110433256175 201100ustar andrewandrew#!/usr/bin/perl -w # Check if the perl examples are in sync with the C examples # # Run like this: check-sync.pl *.pl # # Copyright (C) 2006 Rafael Laboisssiere # This file is part of PLplot and is distributed under the terms of the # GNU Lesser General Public License, version 2.1 or later. No warranties. (my $prog = $0) =~ s:.*/::; if (scalar @ARGV == 0) { print "Usage: $prog file [file ...]\n"; exit 0; } sub compver { my $v1 = shift; my $v2 = shift; my @V1 = split (/\./, $v1); my @V2 = split (/\./, $v2); my $n1 = scalar @V1; my $n2 = scalar @V2; my $retval = 0; for (my $i = 0; $i < $n1 and $i < $n2; $i++) { $retval = (int $V1 [$i] <=> int $V2 [$i]); last if $retval != 0; } $retval = ($n1 <=> $n2) if $retval == 0; return $retval; } my %currver; open (ENTRIES, "< ../c/CVS/Entries") or die "$prog: Cannot open Entries file"; while () { $currver {$1} = $2 if m{^/(x\d\dc.c)/([\d.]+)}; } foreach my $file (@ARGV) { open (IN, "< $file") or die "$prog: Cannot open $file."; while () { if (/SYNC: (x\d\dc.c) ([\d.]+)/) { my $cfile = $1; my $ver = $2; my $cver = $currver {$cfile}; print "$file: sync with ", compver ($ver, $cver) == 0 ? "$cfile $cver" : "$ver, but $cfile version is $cver", "\n"; next; } } } plplot-5.10.0+dfsg/examples/perl/x21.pl 755 1750 1750 1672311543675237 165300ustar andrewandrew#! /usr/bin/env perl # # Demo x21 for the PLplot PDL binding # # Grid data demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x21c.c 1.12 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Getopt::Long qw [:config pass_through]; use POSIX qw [clock]; sub cmap1_init { my $i = pdl ([0.0, # left boundary 1.0]); # right boundary my $h = pdl ([240, # blue -> green -> yellow -> 0]); # -> red my $l = pdl ([0.6, 0.6]); my $s = pdl ([0.8, 0.8]); plscmap1n (256); plscmap1l (0, $i, $h, $l, $s, pdl ([])); } my ($xm, $ym, $xM, $yM); my $randn = 0; my $rosen = 0; sub main { my $clev; # Options data structure definition. */ my $pts = 500; my $xp = 25; my $yp = 20; my $nl = 16; my $knn_order = 20; my $threshold = 1.001; my $wmin = -1e3; GetOptions ("npts=i" => \$pts, "randn" => \$randn, "rosen" => \$rosen, "nx=i" => \$xp, "ny=i" => \$yp, "nlevel=i" => \$nl, "knn_order=i" => \$knn_order, "threshold=f" => \$threshold, "help" => \$help); if ($help) { print (<slice ("$i,$j"))) { # average (IDW) over the 8 neighbors $zg->slice ("$i,$j") .= 0; my $dist = 0; for (my $ii = $i - 1; $ii <= $i + 1 && $ii < $xp; $ii++) { for (my $jj = $j - 1; $jj <= $j + 1 && $jj < $yp; $jj++) { my $zgij = $zg->slice ("$ii,$jj"); if ($ii >= 0 && $jj >= 0 && isfinite ($zgij)) { $d = (abs ($ii - $i) + abs ($jj - $j)) == 1 ? 1. : 1.4142; $zg->slice ("$i,$j") .= $zg->slice ("$i,$j") + $zgij / ($d * $d); $dist += $d; } } } if ($dist != 0.) { $zg->slice ("$i,$j") .= $zg->slice ("$i,$j") / $dist; } else { $zg->slice ("$i,$j") .= $zmin; } } } } } my $lzM = max ($zg); my $lzm = min ($zg); $lzm = min pdl ([$lzm, $zmin]); $lzM = max pdl ([$lzM, $zmax]); $lzm = $lzm - 0.01; $lzM = $lzM + 0.01; plcol0 (1); pladv ($alg); if ($k == 0) { $clev = $lzm + ($lzM - $lzm) * sequence ($nl)/ ($nl - 1); plenv0 ($xm, $xM, $ym, $yM, 2, 0); plcol0 (15); pllab ("X", "Y", $title [$alg - 1]); plshades ($zg, $xm, $xM, $ym, $yM, $clev, 1, 0, 1, 1, 0, 0, 0); plcol0 (2); } else { $clev = $lzm + ($lzM - $lzm) * sequence ($nl)/ ($nl - 1); cmap1_init (); plvpor (0.0, 1.0, 0.0, 0.9); plwind (-1.1, 0.75, -0.65, 1.20); # # For the comparition to be fair, all plots should have the # same z values, but to get the max/min of the data generated # by all algorithms would imply two passes. Keep it simple. # # plw3d(1., 1., 1., xm, xM, ym, yM, zmin, zmax, 30, -60); # plw3d (1., 1., 1., $xm, $xM, $ym, $yM, $lzm, $lzM, 30.0, -40.0); plbox3 (0.0, 0, 0.0, 0, 0.5, 0, "bntu", "X", "bntu", "Y", "bcdfntu", "Z"); plcol0 (15); pllab ("", "", $title [$alg - 1]); plot3dc ($xg, $yg, $zg, DRAW_LINEXY | MAG_COLOR | BASE_CONT, $clev); } } } plend (); } sub create_grid { my ($px, $py) = @_; my ($x, $y); $x = $xm + ($xM - $xm) * sequence ($px) / ($px - 1); $y = $ym + ($yM - $ym) * sequence ($py) / ($py - 1); return ($x, $y); } sub create_data { my $pts = shift; my ($x, $y, $z); # generate a vector of pseudo-random numbers 2*$pts long my $t = zeroes(2*$pts); plrandd($t); # use the PLplot standard random number generator for consistency with other demos # Use every other random number for the x vect and y vect. # This is done in this funny way to make the results identical # to the c version, which calls plrandd once for x, then once for y in a loop. my $xt = ($xM-$xm) * $t->mslice([0,(2*$pts)-2,2]); my $yt = ($yM-$ym) * $t->mslice([1,(2*$pts)-1,2]); if (not $randn) { $x = $xt + $xm; $y = $yt + $ym; } else { # std=1, meaning that many points are outside the plot range $x = sqrt(-2 * log($xt)) * cos(2 * pi * $yt) + $xm; $y = sqrt(-2 * log($xt)) * sin(2 * pi * $yt) + $ym; } if (not $rosen) { my $r = sqrt ($x ** 2 + $y ** 2); $z = exp (- $r ** 2) * cos (2 * pi * $r); } else { $z = log ((1 - $x) ** 2) + 100 * ($y - $x ** 2) ** 2; } return ($x, $y, $z); } main (); plplot-5.10.0+dfsg/examples/perl/x24.pl 755 1750 1750 612111543675237 165020ustar andrewandrew#! /usr/bin/env perl # # Demo x24 for the PLplot PDL binding # # Unicode Pace Flag # # Copyright (C) 2005 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # In Debian, run like this: # # PLPLOT_FREETYPE_SANS_FONT=/usr/share/fonts/truetype/arphic/bkai00mp.ttf \ # PLPLOT_FREETYPE_SERIF_FONT=/usr/share/fonts/truetype/freefont/FreeSerif.ttf \ # PLPLOT_FREETYPE_MONO_FONT=/usr/share/fonts/truetype/ttf-devanagari-fonts/lohit_hi.ttf \ # PLPLOT_FREETYPE_SCRIPT_FONT=/usr/share/fonts/truetype/unfonts/UnBatang.ttf \ # PLPLOT_FREETYPE_SYMBOL_FONT=/usr/share/fonts/truetype/ttf-bangla-fonts/JamrulNormal.ttf \ # ./x24.pl -dev png -o x24pdl.png # # Packages needed: # # ttf-arphic-bkai00mp # ttf-freefont # ttf-indic-fonts # ttf-unfonts # ttf-bangla-fonts # # For the latest Ubuntu systems lohit_hi.ttf has been moved to the # ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you # will have to use this package instead and update the font path. # # SYNC: x24c.c 1.6 use PDL; use PDL::Graphics::PLplot; my $red = pdl [240, 204, 204, 204, 0, 39, 125]; my $green = pdl [240, 0, 125, 204, 204, 80, 0]; my $blue = pdl [240, 0, 0, 0, 0, 204, 125]; my $px = pdl [0.0, 0.0, 1.0, 1.0]; my $py = pdl [0.0, 0.25, 0.25, 0.0]; my @sx = ( 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 ); my @sy = ( 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 ); # Taken from http://www.columbia.edu/~fdc/pace/ my @peace = ( # Mandarin "#<0x00>和平", # Hindi "#<0x20>शांति", # English "#<0x10>Peace", # Hebrew "#<0x10>שלום", # Russian "#<0x10>Мир", # German "#<0x10>Friede", # Korean "#<0x30>평화", # French "#<0x10>Paix", # Spanish "#<0x10>Paz", # Arabic "#<0x10>ﺳﻼم", # Turkis "#<0x10>Barış", # Kurdish "#<0x10>Hasîtî", ); plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); plinit (); pladv (0); plvpor (0.0, 1.0, 0.0, 1.0); plwind (0.0, 1.0, 0.0, 1.0); plcol0 (0); plbox ("", 1.0, 0, "", 1.0, 0); plscmap0n (7); plscmap0 ($red, $green, $blue); plschr (0, 4.0); plfont (1); for (my $i = 0; $i < 4; $i++) { plcol0 ($i + 1); plfill ($px, $py); $py += 1.0 / 4.0; } plcol0 (0); for (my $i = 0; $i < 12; $i++) { plptex ($sx [$i], $sy [$i], 1.0, 0.0, 0.5, $peace [$i]); } plend (); plplot-5.10.0+dfsg/examples/perl/x13.pl 755 1750 1750 547011543675237 165060ustar andrewandrew#! /usr/bin/env perl # # Demo x13 for the PLplot PDL binding # # Does a simple pie chart # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x13c.c 1.15 # N.N. Although the visual results of this script is essentially the # same as that produced by the equivalent C example x13c, the code # below is quite different from that of x13c.c. I use the vectorized # operations of PDL extensively, such that most of the "for" loops # disappeared. [R.L.] use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; my @text = ( "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" ); my $per = pdl [10, 32, 12, 30, 16]; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); pladv(0); # Ensure window has aspect ratio of one so circle is # plotted as a circle. plvasp(1.0); plwind(0., 10., 0., 10.); #plenv (0, 10, 0, 10, 1, -2); plcol0 (2); # n.b. all theta quantities scaled by 2*pi/500 to be integers to avoid # floating point logic problems. my $theta0 = 0; my $dthet = 1; for (my $i = 0; $i <= 4; $i++) { # n.b. the theta quantities multiplied by 2*pi/500 afterward so # in fact per is interpreted as a percentage. my $theta1 = 5 * $per->index ($i); my $theta = $theta0 + sequence ($theta1->sclr + 1) * $dthet; my $xx = 5 + 3 * cos ((2 * pi / 500) * $theta); my $n = ($xx->dims)[0]; my $x = zeroes ($n + 1); $x->slice("1:$n") .= $xx; $x->index (0) .= 5; my $yy = 5 + 3 * sin ((2 * pi / 500) * $theta); my $y = zeroes ($n + 1); $y->slice("1:$n") .= $yy; $y->index (0) .= 5; plcol0 ($i + 1); plpsty (($i + 3) % 8 + 1); plfill ($x, $y); plcol0 (1); plline ($x, $y); my $just = (2 * pi / 500) * ($theta0 + $theta1 / 2); my $dx = .25 * cos ($just); my $dy = .25 * sin ($just); $just = ((2 * $theta0 + $theta1) < 250 || (2 * $theta0 + $theta1) > 750) ? 0 : 1; plptex (($xx->index ($n / 2) + $dx), ($yy->index ($n / 2) + $dy), 1.0, 0.0, $just, $text[$i]); $theta0 += $theta1; } plfont (2); plschr (0, 1.3); plptex (5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales"); plend (); plplot-5.10.0+dfsg/examples/perl/x26.pl 755 1750 1750 1354211556634250 165230ustar andrewandrew#! /usr/bin/env perl # # $Id: x26.pl 11730 2011-04-29 22:16:08Z huntd $ # # -*- coding: utf-8; -*- # # Demo x26 for the PLplot PDL binding # # Multi-lingual version of the first page of example 4. # # Copyright (C) 2006 Alan Irwin # Copyright (C) 2006 Andrew Ross # # Thanks to the following for providing translated strings for this example: # Valery Pipin (Russian) # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # This example designed just for devices (e.g., psttfc and the # cairo-related devices) that use the pango and fontconfig libraries. The # best choice of glyph is selected by fontconfig and automatically rendered # by pango in way that is sensitive to complex text layout (CTL) language # issues for each unicode character in this example. Of course, you must # have the appropriate TrueType fonts installed to have access to all the # required glyphs. # Translation instructions: The strings to be translated are given by # x_label, y_label, alty_label, title_label, and line_label below. The # encoding used must be UTF-8. # The following strings to be translated involve some scientific/mathematical # jargon which is now discussed further to help translators. # (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . # (2) degrees is an angular measure, see # http://en.wikipedia.org/wiki/Degree_(angle) . # (3) low-pass filter is one that transmits (passes) low frequencies. # (4) pole is in the mathematical sense, see # http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" # means a particular mathematical transformation of the filter function has # a single pole, see # http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . # Furthermore, a single-pole filter must have an inverse square decline # (or -20 db/decade). Since the filter plotted here does have that # characteristic, it must by definition be a single-pole filter, see also # http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm # (5) decade represents a factor of 10, see # http://en.wikipedia.org/wiki/Decade_(log_scale) . # SYNC: x26c.c 1.1 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Getopt::Long; @x_label = ( "Frequency", "Частота" ); @y_label = ( "Amplitude (dB)", "Амплитуда (dB)" ); @alty_label = ( "Phase shift (degrees)", "Фазовый сдвиг (градусы)" ); @legend_text = ( [ "Amplitude", "Phase shift" ], [ "Амплитуда", "Фазовый сдвиг" ], ); @title_label = ( "Single Pole Low-Pass Filter", "Однополюсный Низко-Частотный Фильтр" ); @line_label = ( "-20 dB/decade", "-20 dB/десяток" ); sub main { # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit(); plfont(2); # Make log plots using two different styles. for (my $i=0; $iindex (0); my $xmax = $x->index (59); my $ymin = $y->index (0); my $ymax = $y->index (59); my $i = sequence (6); my $xs = $x->index ($i * 10 + 3); my $ys = $y->index ($i * 10 + 3); # Set up the viewport and window using PLENV. The range in X is # 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are # scaled separately (just = 0), and we just draw a labelled # box (axis = 0). plcol0 (1); plenv ($xmin, $xmax, $ymin, $ymax, 0, 0); plcol0 (6); pllab ("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); # Plot the data points plcol0 (9); plpoin ($xs, $ys, 9); # Draw the line through the data plcol0 (4); plline ($x, $y); plflush (); } # =============================================================== sub plot2 { # Set up the viewport and window using PLENV. The range in X is -2.0 to # 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately # ($just = 0), and we draw a box with axes (axis = 1). plcol0 (1); plenv (-2.0, 10.0, -0.4, 1.2, 0, 1); plcol0 (2); pllab ("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); # Fill up the arrays my $i = sequence (100); my $x = ($i - 19.0) / 6.0; my $y = ones (100); my $idx = which ($x); $y->index ($idx) .= sin ($x->index ($idx)) / $x->index ($idx); # Draw the line plcol0 (3); plline ($x, $y); plflush (); } # =============================================================== sub plot3 { # For the final graph we wish to override the default tick intervals, and # so do not use PLENV pladv (0); # Use standard viewport, and define X range from 0 to 360 degrees, Y range # from -1.2 to 1.2. plvsta (); plwind (0.0, 360.0, -1.2, 1.2); # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0 (1); plbox (60.0, 2, 0.2, 2, "bcnst", "bcnstv"); # Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl ($mark1, $space1); plcol0 (2); plbox (30.0, 0, 0.2, 0, "g", "g"); plstyl (pdl ([]), pdl ([])); plcol0 (3); pllab ("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); my $i = sequence (101); my $x = 3.6 * $i; my $y = sin ($x * pi / 180); plcol0 (4); plline ($x, $y); plflush (); } # =============================================================== sub plot4 { my $dtr = pi / 180; my $i = sequence (361); my $x0 = cos ($dtr * $i); my $y0 = sin ($dtr * $i); # Set up viewport and window, but do not draw box plenv (-1.3, 1.3, -1.3, 1.3, 1, -2); for my $i (1 .. 10) { my $x = pdl (0.1 * $i * $x0); my $y = pdl (0.1 * $i * $y0); # Draw circles for polar grid plline($x, $y); } plcol0 (2); for my $i (0 .. 11) { my $theta = 30 * $i; my $dx = cos ($dtr * $theta); my $dy = sin ($dtr * $theta); # Draw radial spokes for polar grid pljoin (0.0, 0.0, $dx, $dy); my $text = sprintf ("%.0f", $theta); # Write labels for angle # Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ($dx >= -0.00001) { plptex ($dx, $dy, $dx, $dy, -0.15, $text); } else { plptex ($dx, $dy, -$dx, -$dy, 1.15, $text); } } # Draw the graph my $r = sin ($dtr * 5 * sequence(361)); $x = $x0 * $r; $y = $y0 * $r; plcol0 (3); plline ($x, $y); plcol0 (4); plmtex (2.0, 0.5, 0.5, "t", "#frPLplot Example 3 - r(#gh)=sin 5#gh"); plflush (); } # =============================================================== # Demonstration of contour plotting use constant XPTS => 35; use constant YPTS => 46; use constant XSPA => 2 / (XPTS - 1); use constant YSPA => 2 / (YPTS - 1); my @tr = (XSPA, 0.0, -1.0, 0.0, YSPA, -1.0); sub mypltr { my ($x, $y) = @_; my $tx = $tr[0] * $x + $tr[1] * $y + $tr[2]; my $ty = $tr[3] * $x + $tr[4] * $y + $tr[5]; return ($tx, $ty); } my $ clevel = pdl [-1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1.]; sub plot5 { my $mark = 1500; my $space = 1500; my $xx = ((sequence (XPTS) - int(XPTS / 2)) / int(XPTS / 2))->dummy (1, YPTS); my $yy = ((sequence (YPTS) - int(YPTS / 2)) / int(YPTS / 2) - 1.0)->dummy (0, XPTS); my $z = $xx * $xx - $yy * $yy; my $w = 2 * $xx * $yy; plenv (-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0 (2); plcont ($z, 1, XPTS, 1, YPTS, $clevel, \&mypltr, 0); plstyl ($mark, $space); plcol0 (3); plcont ($w, 1, XPTS, 1, YPTS, $clevel, \&mypltr, 0); plcol0 (1); pllab ("X Coordinate", "Y Coordinate", "Streamlines of flow"); plflush (); } main (); plplot-5.10.0+dfsg/examples/perl/x07.pl 755 1750 1750 427711543675237 165150ustar andrewandrew#! /usr/bin/env perl # # Demo x07 for the PLplot PDL binding # # Font demo # # Copyright (C) 2004 Rafael Laboissiere # (inspired from t/x07.t of module Graphics::PLplot, by Tim Jenness) # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x07c.c 1.18 use PDL; use PDL::Graphics::PLplot; # Starting points for symbol lookup my @base = (0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900); # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); plfontld (0); my $l = 0; for my $base (@base) { if ( $l == 2 ) { plfontld( 1 ); } pladv (0); # Set up viewport and window plcol0 (2); plvpor (0.15, 0.95, 0.1, 0.9); plwind (0, 1, 0, 1); # Draw the grid plbox (0.1, 0, 0.1, 0, "bcg", "bcg"); # Write digits below the frame plcol0 (15); for my $i (0..9) { plmtex (1.5, (0.1 * $i + 0.05), 0.5, "b", $i); } my $k = 0; OUTER: for my $i (0..9) { # Write the digits to the left of the frame plmtex (1, (0.95 - 0.1 * $i), 1, "lv", ($base + 10 * $i)); my $y = 0.95 - 0.1 * $i; for my $j (0..9) { my $x = 0.1 * $j + 0.05; plsym ($x, $y, ($k + $base)); last OUTER if $k >= 127; $k++; } } if ($l++ <2) { plmtex (1.5, 0.5, 0.5, "t", "PLplot Example 7 - PLSYM symbols (compact)"); } else { plmtex (1.5, 0.5, 0.5, "t", "PLplot Example 7 - PLSYM symbols (extended)"); } } plend (); plplot-5.10.0+dfsg/examples/perl/x27.pl 755 1750 1750 730611556634250 165050ustar andrewandrew#! /usr/bin/env perl # $Id: x27.pl 11730 2011-04-29 22:16:08Z huntd $ # # Copyright (C) 2008 Doug Hunt # Drawing "spirograph" curves - epitrochoids, cycolids, roulettes # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # use PDL; use PDL::Graphics::PLplot; use constant PI => 4*atan2(1,1); plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); plinit (); # # Generates two kinds of plots: # - construction of a cycloid (animated) (TBD) # - series of epitrochoids and hypotrochoids # R, r, p, N # R and r should be integers to give correct termination of the # angle loop using gcd. # N.B. N is just a place holder since it is no longer used # (because we now have proper termination of the angle loop). my $params = [ [21.0, 7.0, 7.0, 3.0], # Deltoid [21.0, 7.0, 10.0, 3.0], [21.0, -7.0, 10.0, 3.0], [20.0, 3.0, 7.0, 20.0], [20.0, 3.0, 10.0, 20.0], [20.0, -3.0, 10.0, 20.0], [20.0, 13.0, 7.0, 20.0], [20.0, 13.0, 20.0, 20.0], [20.0,-13.0, 20.0, 20.0] ]; # Illustrate the construction of a cycloid # TODO #cycloid() # Loop over the various curves # First an overview, then all curves one by one plssub(3, 3); # Three by three window my $fill = 0; foreach my $parm (@$params) { pladv(0); plvpor(0, 1, 0, 1); spiro($parm, $fill); } pladv(0); plssub(1, 1); # One window per curve foreach my $parm (@$params) { pladv(0); plvpor(0, 1, 0, 1); spiro($parm, $fill); } # Fill the curves $fill = 1; pladv( 0 ); plssub( 1, 1 ); # One window per curve foreach my $parm (@$params) { pladv( 0 ); plvpor(0, 1, 0, 1); spiro( $parm, $fill); } # Don't forget to call plend() to finish off! plend(); #-------------------------------------------------------------------------- # Calculate greatest common divisor following pseudo-code for the # Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm sub gcd { my ($a, $b) = @_; $a = abs( $a ); $b = abs( $b ); while ( $b != 0 ) { my $t = $b; $b = $a % $b; $a = $t; } return $a; } sub spiro { my $params = shift; my $fill = shift; # Fill the coordinates my $NPNT = 2000; my $windings = abs($params->[1]) / gcd($params->[0], $params->[1]); my $steps = int($NPNT/$windings); my $dphi = 2.0*PI/$steps; my $phi = sequence($windings*$steps+1) * $dphi; my $phiw = ($params->[0]-$params->[1])/$params->[1]*$phi; my $xcoord = ($params->[0]-$params->[1])*cos($phi) + $params->[2]*cos($phiw); my $ycoord = ($params->[0]-$params->[1])*sin($phi) - $params->[2]*sin($phiw); my ($xmin, $xmax) = $xcoord->minmax; my ($ymin, $ymax) = $ycoord->minmax; my $xrange_adjust = 0.15 * ($xmax - $xmin); $xmin -= $xrange_adjust; $xmax += $xrange_adjust; my $yrange_adjust = 0.15 * ($ymax - $ymin); $ymin -= $yrange_adjust; $ymax += $yrange_adjust; plwind($xmin, $xmax, $ymin, $ymax); plcol0(1); if ($fill) { plfill ($xcoord, $ycoord); } else { plline ($xcoord, $ycoord); } } plplot-5.10.0+dfsg/examples/perl/x22.pl 755 1750 1750 1370711543675237 165300ustar andrewandrew#! /usr/bin/env perl # # Demo x22 for the PLplot PDL binding # # Simple vector plot example # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x22c.c 1.8 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use constant nx => 20; use constant ny => 20; use constant nr => 20; use constant ntheta => 20; use constant nper => 100; use constant nlevel => 10; # Pairs of points making the line segments used to plot the user defined # arrow my $arrow_x = pdl [-0.5, 0.5, 0.3, 0.5, 0.3, 0.5]; my $arrow_y = pdl [0.0, 0.0, 0.2, 0.0, -0.2, 0.0]; my $arrow2_x = pdl [-0.5, 0.3, 0.3, 0.5, 0.3, 0.3]; my $arrow2_y = pdl [0.0, 0.0, 0.2, 0.0, -0.2, 0.0]; # # Vector plot of the circulation about the origin # sub circulation { my $dx = 1.0; my $dy = 1.0; my $nx = nx; my $ny = ny; my $xmin = -$nx/2*$dx; my $xmax = $nx/2*$dx; my $ymin = -$ny/2*$dy; my $ymax = $ny/2*$dy; my $x = ((sequence($nx)-int($nx/2)+0.5)*$dx)->dummy(1,$ny); my $y = ((sequence($ny)-int($ny/2)+0.5)*$dy)->dummy(0,$nx); # Create data - circulation around the origin. my $cgrid2 = plAlloc2dGrid($x, $y); my $u = $y; my $v = -$x; # Plot vectors with default arrows plenv($xmin, $xmax, $ymin, $ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - circulation"); plcol0(2); plvect($u,$v,0.0,\&pltr2,$cgrid2); plcol0(1); } # # Vector plot of flow through a constricted pipe # sub constriction { my $nx = nx; my $ny = ny; my $dx = 1.0; my $dy = 1.0; my $xmin = -$nx/2*$dx; my $xmax = $nx/2*$dx; my $ymin = -$ny/2*$dy; my $ymax = $ny/2*$dy; my $x = ((sequence($nx)-int($nx/2)+0.5)*$dx)->dummy(1,$ny); my $y = ((sequence($ny)-int($ny/2)+0.5)*$dy)->dummy(0,$nx); my $cgrid2 = plAlloc2dGrid($x, $y); my $u; my $v; my $Q = 2.0; my $b = $ymax/4.0*(3-cos(pi*$x/$xmax)); my $dbdx = $ymax/4.0*sin(pi*$x/$xmax)*$y/$b; $u = $Q*4*$ymax/$b; $v = $dbdx*$u; $u->where(abs($y)>=$b) .= 0; $v->where(abs($y)>=$b) .= 0; plenv($xmin, $xmax, $ymin, $ymax, 0, 0); pllab("(x)", "(y)", "#frPLplot Example 22 - constriction"); plcol0(2); plvect($u,$v,-0.5,\&pltr2,$cgrid2); plcol0(1); } sub f2mnmx { $f = shift; my $fmin = min ($f); my $fmax = max ($f); return ($fmin, $fmax); } # Vector plot of the gradient of a shielded potential (see example 9) sub potential { # Potential inside a conducting cylinder (or sphere) by method of images. # Charge 1 is placed at (d1, d1), with image charge at (d2, d2). # Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). # Also put in smoothing term at small distances. my $rmax = nr; my $eps = 2; my $q1 = 1; my $d1 = $rmax / 4; my $q1i = - $q1 * $rmax / $d1; my $d1i = $rmax * $rmax / $d1; my $q2 = -1; my $d2 = $rmax / 4; my $q2i = - $q2 * $rmax / $d2; my $d2i = $rmax * $rmax / $d2; my $r = (0.5 + sequence (nr))->dummy (1, ntheta); my $theta = (2 * pi / (ntheta - 1) * (0.5 + sequence (ntheta)))->dummy (0, nr); my $x = $r * cos ($theta); my $y = $r * sin ($theta); my $cgrid2 = plAlloc2dGrid ($x, $y); my $div1 = sqrt (($x - $d1) ** 2 + ($y - $d1) ** 2 + $eps * $eps); my $div1i = sqrt (($x - $d1i) ** 2 + ($y - $d1i) ** 2 + $eps * $eps); my $div2 = sqrt (($x - $d2) ** 2 + ($y + $d2) ** 2 + $eps * $eps); my $div2i = sqrt (($x - $d2i) ** 2 + ($y + $d2i) ** 2 + $eps * $eps); my $z = $q1 / $div1 + $q1i / $div1i + $q2 / $div2 + $q2i / $div2i; my $u = -$q1 * ($x - $d1) / ($div1**3) - $q1i * ($x - $d1i) / ($div1i ** 3) -$q2 * ($x - $d2) / ($div2**3) - $q2i * ($x - $d2i) / ($div2i ** 3); my $v = -$q1 * ($y - $d1) / ($div1**3) - $q1i * ($y - $d1i) / ($div1i ** 3) -$q2 * ($y + $d2) / ($div2**3) - $q2i * ($y + $d2i) / ($div2i ** 3); my ($xmin, $xmax) = f2mnmx ($x); my ($ymin, $ymax) = f2mnmx ($y); my ($zmin, $zmax) = f2mnmx ($z); plenv ($xmin, $xmax, $ymin, $ymax, 0, 0); pllab ("(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot"); # Plot contours of the potential my $dz = ($zmax - $zmin) / nlevel; my $clevel = $zmin + (sequence (nlevel) + 0.5) * $dz; plcol0 (3); pllsty (2); plcont ($z, 1, nr, 1, ntheta, $clevel, \&pltr2, $cgrid2); pllsty (1); plcol0 (1); # Plot the vectors of the gradient of the potential plcol0 (2); plvect ($u, $v, 25.0, \&pltr2, $cgrid2); plcol0 (1); # Plot the perimeter of the cylinder $theta = (2 * pi / (nper - 1)) * sequence (nper); my $px = $rmax * cos ($theta); my $py = $rmax * sin ($theta); plline ($px , $py); } #-------------------------------------------------------------------------- # main # # Generates several simple vector plots. #-------------------------------------------------------------------------- # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); circulation(); # Set arrow style using arrow_x and arrow_y then # plot using these arrows. my $fill = 0; plsvect($arrow_x, $arrow_y, $fill); constriction(); # Set arrow style using arrow2_x and arrow2_y then # plot using these filled arrows. my $fill = 1; plsvect($arrow2_x, $arrow2_y, $fill); constriction(); # Example of polar plot potential (); plend (); plplot-5.10.0+dfsg/examples/perl/README.perldemos 644 1750 1750 777011556706435 204100ustar andrewandrewPerl (PDL) demos for PLplot --------------------------- The files in this directory are close translations of the PLplot demos written in C (see directory above ../c/). They use the PDL and PDL::Graphics::PLplot modules distributed with PDL. Instructions for building and installing Doug Hunt's latest version of PDL::Graphics::PLplot consistently with the latest version of PLplot that you have installed. # PLplot is a prerequisite so install the latest PLplot by running the # "make install" command _in the PLplot build tree_. N.B. that installation # is required in order to build and install PDL::Graphics::PLplot. # Furthermore, that installation is required in order for PLplot builds # subsequent to the build and install of PDL::Graphics::PLplot to # be able to detect that module, and thus run the Perl/PDL examples # that are part of PLplot. # Adjust this value to the prefix of that PLplot installation. export PLPLOT_INSTALL_PREFIX=/home/software/plplot_svn/installcmake # Check http://search.cpan.org/~dhunt/PDL-Graphics-PLplot-0.55 to see # if there is a later version than 0.55 (the latest version at this # time of writing). # Adjust this value to the latest version. export PDL_GRAPHICS_PLPLOT_VERSION=0.55 # Adjust this value to where you want the PDL Graphics PLplot module # to be installed. export PDL_GRAPHICS_PLPLOT_PREFIX=/home/software/pdl/install-$PDL_GRAPHICS_PLPLOT_VERSION # N.B. no adjustments beyond here. export TARBALL_ROOT_NAME=PDL-Graphics-PLplot-$PDL_GRAPHICS_PLPLOT_VERSION wget \ http://search.cpan.org/CPAN/authors/id/D/DH/DHUNT/$TARBALL_ROOT_NAME.tar.gz less $TARBALL_ROOT_NAME.tar.gz tar zxf $TARBALL_ROOT_NAME.tar.gz cd $TARBALL_ROOT_NAME env PLPLOT_LIBDIR=$PLPLOT_INSTALL_PREFIX/lib \ PLPLOT_INCDIR=$PLPLOT_INSTALL_PREFIX/include/plplot \ perl Makefile.PL # No hard rpath coded so that LD_LIBRARY_PATH will work env LD_RUN_PATH= \ make -e >& make.out less make.out # N.B. this is also necessary for the PLplot detection of # PDL::Graphics::PLplot to work during cmake step of PLplot build. export LD_LIBRARY_PATH=$PLPLOT_INSTALL_PREFIX/lib make test >& make_test.out less make_test.out # Remove this directory before using it for the install. rm -rf $PDL_GRAPHICS_PLPLOT_PREFIX make PREFIX=$PDL_GRAPHICS_PLPLOT_PREFIX install >& make_install.out less make_install.out # Update the install location. cd .. rm -f install ln -s install-$PDL_GRAPHICS_PLPLOT_VERSION install # Check what files have been installed find $PDL_GRAPHICS_PLPLOT_PREFIX -type f # Find the equivalent files in your PDL installation. For example, on my # system the equivalent files are /usr/lib/perl5/PDL/Graphics/PLplot.pm /usr/lib/perl5/auto/PDL/Graphics/PLplot /usr/lib/perl5/auto/PDL/Graphics/PLplot/PLplot.so /usr/lib/perl5/auto/PDL/Graphics/PLplot/PLplot.bs # Back those up (so none of your further changes are irrevocable), and # replace them (probably with the aid of symlinks for convenience). You can # ignore some of the list you generate with the above find command, but you # do have to replace/symlink the .../PDL/Graphics/PLplot directory # and also replace/symlink the individual file, # .../PDL/Graphics/PLplot.pm. Testing the Perl/PDL PLplot examples. 1a. Make sure you have set LD_LIBRARY_PATH correctly, see above, and do not remove the PLplot installation. Otherwise, cmake won't be able to find the PDL::Graphics::PLplot installation that was just done. 1b. Go ahead and remove the old PLplot installation, and skip version checks for PDL::Graphics::PLplot using -DSKIP_PDL_CHECK=ON for cmake step below. 2. Normal cmake step for PLplot build. If you want to do build-tree tests of Perl/PDl examples, then use the -DBUILD_TEST=ON option. Check the cmake output to make sure PDL::Graphics::PLplot was found with correct version if -DSKIP_PDL_CHECK=ON option was not used. Alternatively, use -DSKIP_PDL_CHECK=ON (see 1b above) which skips all version checks for PDL::Graphics::PLplot 3. Normal noninteractive test (e.g., ctest in the build tree or "make test_noninteractive" or "make test_diff_psc" in the build tree). plplot-5.10.0+dfsg/examples/perl/x04.pl 755 1750 1750 626611556634250 165040ustar andrewandrew#! /usr/bin/env perl # # Demo x04 for the PLplot PDL binding # # Log plot demo # (inspired from t/x04.t of module Graphics::PLplot, by Tim Jenness) # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x04c.c 1.17 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); plfont (2); &plot1 (0); &plot1 (1); plend (); sub plot1 { my $type = shift; pladv (0); # Set up data for log plot my $f0 = 1.0; my ($freql, $ampl, $phase); my $i = sequence (101); $freql = -2.0 + $i / 20.0; my $freq = 10 ** $freql; $ampl = 20 * log10 (1 / sqrt (1 + ($freq / $f0) ** 2 )); $phase = -(180/pi) * atan2 ($freq, $f0); plvpor (0.15, 0.85, 0.1, 0.9); plwind (-2, 3, -80, 0); # Try different axis and labelling styles plcol0 (1); if ($type == 0) { plbox (0, 0, 0, 0, "bclnst", "bnstv"); } else { plbox (0, 0, 0, 0, "bcfghlnst", "bcghnstv"); } # Plot ampl vs freq plcol0 (2); plline ($freql, $ampl); plcol0 (2); plptex (1.6, -30, 1, -20, 0.5, "-20 dB/decade"); # Put labels on plcol0 (1); plmtex (3.2, 0.5, 0.5, "b", "Frequency"); plmtex (2, 0.5, 0.5, "t", "Single Pole Low-Pass Filter"); plcol0 (2); plmtex (5, 0.5, 0.5, "l", "Amplitude (dB)"); my $nlegend = 1; # For the gridless case, put phase vs freq on same plot if ($type == 0) { plcol0 (1); plwind (-2, 3, -100, 0); plbox (0, 0, 30, 3, "", "cmstv"); plcol0 (3); plline ($freql, $phase); plstring($freql, $phase, "*"); plcol0 (3); plmtex (5, 0.5, 0.5, "r", "Phase shift (degrees)"); $nlegend = 2; } # Draw a legend my @opt_array = (PL_LEGEND_LINE, PL_LEGEND_LINE | PL_LEGEND_SYMBOL); my @text_colors = (2, 3); my @text = ("Amplitude", "Phase shift"); my @line_colors = (2, 3); my @line_styles = (1, 1); my @line_widths = (1, 1); my @symbol_colors = (3, 3); # ??? my @symbol_scales = (1, 1); # ??? my @symbol_numbers = (4, 4);# ??? my @symbols = ('*', '*'); # ??? plscol0a(15, 32, 32, 32, 0.70); my ($legend_width, $legend_height) = pllegend( PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, 0, 0, 0, 0, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols); } plplot-5.10.0+dfsg/examples/perl/x31.pl 755 1750 1750 1627411543675237 165320ustar andrewandrew#! /usr/bin/env perl # # Set/get tester. # # Window positioning demo. # # Copyright (C) 2008 Alan W. Irwin # Copyright (C) 2008 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use PDL; use PDL::Graphics::PLplot; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); my $status = 0; # Test setting / getting familying parameters before plinit #z Save values set by plparseopts to be restored later. my ($fam0, $num0, $bmax0) = plgfam (); my $fam1 = 0; my $num1 = 10; my $bmax1 = 1000; plsfam ($fam1, $num1, $bmax1); # Retrieve the same values? my ($fam2, $num2, $bmax2) = plgfam (); printf("family parameters: fam, num, bmax = %d %d %d\n", $fam2, $num2, $bmax2); if ($fam2 != $fam1 || $num2 != $num1 || $bmax2 != $bmax1) { printf STDERR ("plgfam test failed\n"); $status = 1; } # Restore values set initially by plparseopts. plsfam($fam0, $num0, $bmax0); # Test setting / getting page parameters before plinit # Save values set by plparseopts to be restored later. my ($xp0, $yp0, $xleng0, $yleng0, $xoff0, $yoff0) = plgpage (); my $xp1 = 200.; my $yp1 = 200.; my $xleng1 = 400; my $yleng1 = 200; my $xoff1 = 10; my $yoff1 = 20; plspage($xp1, $yp1, $xleng1, $yleng1, $xoff1, $yoff1); # Retrieve the same values? my ($xp2, $yp2, $xleng2, $yleng2, $xoff2, $yoff2) = plgpage (); printf("page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d\n", $xp2, $yp2, $xleng2, $yleng2, $xoff2, $yoff2); if ($xp2 != $xp1 || $yp2 != $yp1 || $xleng2 != $xleng1 || $yleng2 != $yleng1 || $xoff2 != $xoff1 || $yoff2 != $yoff1 ) { printf STDERR ("plgpage test failed\n"); $status = 1; } # Restore values set initially by plparseopts. plspage($xp0, $yp0, $xleng0, $yleng0, $xoff0, $yoff0); # Test setting / getting compression parameter across plinit. my $compression1 = 95; plscompression ($compression1); # Initialize plplot plinit (); # Test if device initialization screwed around with the preset # compression parameter. my $compression2 = plgcompression (); printf ("Output various PLplot parameters\n"); printf ("compression parameter = %d\n", $compression2); if ($compression2 != $compression1) { printf STDERR ("plgcompression test failed\n"); $status = 1; } # Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure # they work without any obvious error messages. plscolor (1); plscol0 (1, 255, 0, 0); my $r1 = pdl [0, 255]; my $g1 = pdl [255, 0]; my $b1 = pdl [0, 0]; my $a1 = pdl [1.0, 1.0]; plscmap1 ($r1, $g1, $b1); plscmap1a ($r1, $g1, $b1, $a1); my $level2 = plglevel (); printf ("level parameter = %d\n", $level2); if ($level2 != 1) { printf STDERR ("plglevel test failed.\n"); $status = 1; } pladv (0); plvpor (0.01, 0.99, 0.02, 0.49); my ($xmin, $xmax, $ymin, $ymax) = plgvpd (); printf ("plvpor: xmin, xmax, ymin, ymax = %f %f %f %f\n", $xmin, $xmax, $ymin, $ymax); if ($xmin != 0.01 || $xmax != 0.99 || $ymin != 0.02 || $ymax != 0.49) { printf STDERR ("plgvpd test failed\n"); $status = 1; } $xmid = 0.5*($xmin+$xmax); $ymid = 0.5*($ymin+$ymax); plwind (0.2, 0.3, 0.4, 0.5); my ($xmin, $xmax, $ymin, $ymax) = plgvpw (); printf("plwind: xmin, xmax, ymin, ymax = %f %f %f %f\n", $xmin, $xmax, $ymin, $ymax); if ($xmin != 0.2 || $xmax != 0.3 || $ymin != 0.4 || $ymax != 0.5) { printf STDERR ("plgvpw test failed\n"); $status = 1; } # Get world coordinates for middle of viewport my ($wx, $wy, $win) = plcalc_world ($xmid, $ymid); printf("world parameters: wx, wy, win = %f %f %d\n", $wx, $wy, $win); if (abs($wx-0.5*($xmin+$xmax)) > 1.0E-5 || abs($wy-0.5*($ymin+$ymax)) > 1.0E-5) { printf STDERR ("plcalc_world test failed\n"); $status = 1; } # Retrieve and print the name of the output file (if any) my $fnam = plgfnam(); if ($fnam eq "") { printf ("No output file name is set\n"); } else { printf ("Output file name read\n"); } printf STDERR ("Output file name is %s\n", $fnam); # Set and get the number of digits used to display axis labels # Note digits is currently ignored in pls[xyz]ax and # therefore it does not make sense to test the returned value. plsxax(3,0); my ($digmax, $digits) = plgxax(); printf ("x axis parameters: digmax, digits = %d %d\n", $digmax, $digits); if ($digmax != 3) { printf STDERR ("plgxax test failed\n"); $status = 1; } plsyax(4,0); my ($digmax, $digits) = plgyax(); printf ("y axis parameters: digmax, digits = %d %d\n", $digmax, $digits); if ($digmax != 4) { printf STDERR ("plgyax test failed\n"); $status = 1; } plszax(5,0); my ($digmax, $digits) = plgzax(); printf ("z axis parameters: digmax, digits = %d %d\n", $digmax, $digits); if ($digmax != 5) { printf STDERR ("plgzax test failed\n"); $status = 1; } plsdidev(0.05, PL_NOTSET, 0.1, 0.2); my ($mar, $aspect, $jx, $jy) = plgdidev(); printf ("device-space window parameters: mar, aspect, jx, jy = %f %f %f %f\n", $mar, $aspect, $jx, $jy); if ($mar != 0.05 || $jx != 0.1 || $jy != 0.2) { printf STDERR ("plgdidev test failed\n"); $status = 1; } plsdiori(1.0); my $ori = plgdiori(); printf ("ori parameter = %f\n", $ori); if ($ori != 1.0) { printf STDERR ("plgdiori test failed\n"); $status = 1; } plsdiplt(0.1, 0.2, 0.9, 0.8); my ($xmin, $ymin, $xmax, $ymax) = (PDL->new(0), PDL->new(0), PDL->new(0), PDL->new(0)); plgdiplt($xmin, $ymin, $xmax, $ymax); printf ("plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", $xmin, $ymin, $xmax, $ymax); if ($xmin != 0.1 || $xmax != 0.9 || $ymin != 0.2 || $ymax != 0.8) { printf STDERR ("plgdiplt test failed\n"); $status = 1; } plsdiplz(0.1, 0.1, 0.9, 0.9); my ($zxmin, $zymin, $zxmax, $zymax) = plgdiplt(); printf ("zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f\n", $zxmin, $zymin, $zxmax, $zymax); if (abs($zxmin -($xmin + ($xmax-$xmin)*0.1)) > 1.0E-5 || abs($zxmax -($xmin+($xmax-$xmin)*0.9)) > 1.0E-5 || abs($zymin -($ymin+($ymax-$ymin)*0.1)) > 1.0E-5 || abs($zymax -($ymin+($ymax-$ymin)*0.9)) > 1.0E-5 ) { printf STDERR ("plsdiplz test failed\n"); $status = 1; } plscolbg (10,20,30); my ($r, $g, $b) = plgcolbg(); printf ("background colour parameters: r, g, b = %d %d %d\n", $r, $g, $b); if ($r != 10 || $g != 20 || $b != 30) { printf STDERR ("plgcolbg test failed\n"); $status = 1; } plscolbga (20, 30, 40, 0.5); my ($r, $g, $b, $a) = plgcolbga(); printf ("background/transparency colour parameters: r, g, b, a = %d %d %d %f\n", $r, $g, $b, $a); if ($r != 20 || $g != 30 || $b != 40 || $a != 0.5) { printf STDERR ("plgcolbga test failed\n"); $status = 1; } plend (); if ($status == 1) { exit(1); } else { exit(0); } plplot-5.10.0+dfsg/examples/perl/x19.pl 755 1750 1750 1050412221050115 164760ustar andrewandrew#! /usr/bin/env perl # # Demo x19 for the PLplot PDL binding # # Illustrates backdrop plotting of world, US maps. # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x19c.c 1.10 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; #-------------------------------------------------------------------------- # main # # Shows two views of the world map. #-------------------------------------------------------------------------- # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Longitude (x) and latitude (y) my $miny = -70; my $maxy = 80; plinit (); # Cartesian plots # Most of world my $minx = -170; my $maxx = $minx + 360; # Setup a custom latitude and longitude-based scaling function. plslabelfunc(\&geolocation_labeler); plcol0 (1); plenv ($minx, $maxx, $miny, $maxy, 1, 70); plmap ($minx, $maxx, $miny, $maxy, 0, "usaglobe"); # The Americas $minx = 190; $maxx = 340; plcol0 (1); plenv ($minx, $maxx, $miny, $maxy, 1, 70); plmap ($minx, $maxx, $miny, $maxy, 0, "usaglobe"); # Clear the labeling function plslabelfunc(0); # Polar, Northern hemisphere $minx = 0; $maxx = 360; plenv (-75, 75, -75, 75, 1, -1); plmap ($minx, $maxx, $miny, $maxy, \&mapform19, "globe"); pllsty (2); plmeridians (10.0, 10.0, 0.0, 360.0, -10.0, 80.0, \&mapform19); # Polar, Northern hemisphere, this time with a PLplot-wide transform plstransform(\&mapform19); pllsty(1); plenv(-75, 75, -75, 75, 1, -1); # No need to set the map transform here as the global transform will be # used. plmap($minx, $maxx, $miny, $maxy, 0, "globe"); pllsty(2); plmeridians(10.0, 10.0, 0.0, 360.0, -10.0, 80.0, 0); # Show Baltimore, MD on the map plcol0(2); plssym(0.0, 2.0); my $x = pdl (-76.6125); my $y = pdl (39.2902778); plpoin($x, $y, 18); plssym(0.0, 1.0); plptex(-76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD"); # For perl, this is how the global transform is cleared plstransform(0); plend (); #-------------------------------------------------------------------------- # Subroutines #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # mapform19 # # Defines specific coordinate transformation for example 19. # Not to be confused with mapform in src/plmap.c. # $x and $y are the coordinates to be plotted. They can be either # perl scalars (when used as an argument to plstransform) or PDLs # (when used as an argument to plmeridians or plmap) #-------------------------------------------------------------------------- sub mapform19 { my ($x, $y) = @_; my $radius = 90.0 - $y; my $xp = $radius * cos ($x * pi / 180); my $yp = $radius * sin ($x * pi / 180); return ($xp, $yp); } #-------------------------------------------------------------------------- # geolocation_labeler # # A custom axis labeling function for longitudes and latitudes. #-------------------------------------------------------------------------- sub geolocation_labeler { my ($axis, $value, $length) = @_; my ($direction_label, $label_val); if (($axis == PL_Y_AXIS) && $value == 0) { return "Eq"; } elsif ($axis == PL_Y_AXIS) { $label_val = $value; $direction_label = ($label_val > 0) ? " N" : " S"; } elsif ($axis == PL_X_AXIS) { my $times = floor((abs($value) + 180.0 ) / 360.0); $label_val = ($value < 0) ? $value + 360.0 * $times : $value - 360.0 * $times; $direction_label = ($label_val > 0) ? " E" : ($label_val < 0) ? " W" : ""; } return substr (sprintf ("%.0f%s", abs($label_val), $direction_label), 0, $length); } plplot-5.10.0+dfsg/examples/perl/x30.pl 755 1750 1750 753211556634250 165000ustar andrewandrew#! /usr/bin/env perl # Alpha color values demonstration. # # Copyright (C) 2008 Hazen Babcock # perl/PDL version 2008 Doug Hunt # # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # This example will only really be interesting when used with devices that # support or alpha (or transparency) values, such as the cairo device family. use PDL; use PDL::NiceSlice; use PDL::Graphics::PLplot; my $red = long (0, 255, 0, 0); my $green = long (0, 0, 255, 0); my $blue = long (0, 0, 0, 255); my $alpha = double (1.0, 1.0, 1.0, 1.0); my $px = double (0.1, 0.5, 0.5, 0.1); my $py = double (0.1, 0.1, 0.5, 0.5); my $pos = double (0.0, 1.0); my $rcoord = double (1.0, 1.0); my $gcoord = double (0.0, 0.0); my $bcoord = double (0.0, 0.0); my $acoord = double (0.0, 1.0); my $rev = long (0, 0); # Parse command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); plinit (); plscmap0n (4); plscmap0a ($red, $green, $blue, $alpha); # Page 1: # # This is a series of red, green and blue rectangles overlaid # on each other with gradually increasing transparency. # Set up the window pladv (0); plvpor (0.0, 1.0, 0.0, 1.0); plwind (0.0, 1.0, 0.0, 1.0); plcol0 (0); plbox (1.0, 0, 1.0, 0, "", ""); # Draw the boxes for (my $i = 0; $i < 9; $i++) { my $icol = $i%3 + 1; # Get a color, change its transparency and # set it as the current color. my ($r, $g, $b, $a) = plgcol0a($icol); plscol0a ($icol, $r, $g, $b, 1 - $i/9); plcol0 ($icol); # Draw the rectangle plfill ($px, $py); # Shift the rectangles coordinates $px += 0.5/9; $py += 0.5/9; } # Page 2: # # This is a bunch of boxes colored red, green or blue with a single # large (red) box of linearly varying transparency overlaid. The # overlaid box is completely transparent at the bottom and completely # opaque at the top. # Set up the window pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(0.0, 1.0, 0.0, 1.0); # Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for(my $i = 0; $i < 5; $i++){ # Set box X position $px(0) .= 0.05 + 0.2 * $i; $px(1) .= $px(0) + 0.1; $px(2) .= $px(1); $px(3) .= $px(0); # We don't want the boxes to be transparent, so since we changed # the colors transparencies in the first example we have to change # the transparencies back to completely opaque. my $icol = $i%3 + 1; my ($r, $g, $b, $a) = plgcol0a ($icol); plscol0a ($icol, $r, $g, $b, 1.0); plcol0 ($icol); for(my $j = 0; $j < 5; $j++) { # Set box y position and draw the box. $py(0) .= 0.05 + 0.2 * $j; $py(1) .= $py(0); $py(2) .= $py(0) + 0.1; $py(3) .= $py(2); plfill($px, $py); } } # The overlaid box is drawn using plshades with a color map that is # the same color but has a linearly varying transparency. # Create the color map with 128 colors and use plscmap1la to initialize # the color values with a linear varying transparency (or alpha) plscmap1n(128); plscmap1la(1, $pos, $rcoord, $gcoord, $bcoord, $acoord, $rev); # Use that cmap1 to create a transparent red gradient for the whole # window. my $px = pdl(0,1,1,0); my $py = pdl(0,0,1,1); plgradient($px, $py, 90); plend(); plplot-5.10.0+dfsg/examples/perl/x06.pl 755 1750 1750 425611543675237 165110ustar andrewandrew#! /usr/bin/env perl # # Demo x06 for the PLplot PDL binding # # Font demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x06c.c 1.16 use PDL; use PDL::Graphics::PLplot; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); for ( my $kindfont = 0; $kindfont < 2; $kindfont++) { plfontld ( $kindfont ); my $maxfont; if ( $kindfont == 0 ) { $maxfont = 1; } else { $maxfont = 4; } for ( my $font = 0; $font < $maxfont; $font++ ) { plfont( $font + 1 ); pladv (0); # Set up viewport and window plcol0 (2); plvpor (0.1, 1.0, 0.1, 0.9); plwind (0.0, 1.0, 0.0, 1.3); # Draw the grid using plbox plbox (0.1, 0, 0.1, 0, "bcg", "bcg"); # Write the digits below the frame plcol0 (15); my ($i, $j, $k); for ($i = 0; $i <= 9; $i++) { plmtex (1.5, (0.1 * $i + 0.05), 0.5, "b", $i); } $k = 0; for ($i = 0; $i <= 12; $i++) { # Write the digits to the left of the frame plmtex (1.0, (1.0 - (2 * $i + 1) / 26.0), 1.0, "lv", 10 * $i); for ($j = 0; $j <= 9; $j++) { my $x = 0.1 * $j + 0.05; my $y = 1.25 - 0.1 * $i; # Display the symbols if ($k < 128) { plpoin ($x, $y, $k); $k++; } } } if ( $kindfont == 0 ) { plmtex (1.5, 0.5, 0.5, "t", "PLplot Example 6 - plpoin symbols (compact)"); } else { plmtex (1.5, 0.5, 0.5, "t", "PLplot Example 6 - plpoin symbols (extended)"); } } } plend (); plplot-5.10.0+dfsg/examples/perl/x11.pl 755 1750 1750 657611543675237 165140ustar andrewandrew#! /usr/bin/env perl # # Demo x11 for the PLplot PDL binding # # Mesh plot demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x11c.c 1.24 use PDL; use PDL::Graphics::PLplot; use constant XPTS => 35; # Data points in x use constant YPTS => 46; # Data points in y use constant LEVELS => 10; @opt = (DRAW_LINEXY, DRAW_LINEXY); @alt = (33.0, 17.0); @az = (24.0, 115.0); @title = ( "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" ); sub cmap1_init { my $i = pdl [0.0, # left boundary 1.0]; # right boundary my $h = pdl [240, # blue -> green -> yellow -> 0]; # -> red my $l = pdl [0.6, 0.6]; my $s = pdl [0.8, 0.8]; plscmap1n (256); plscmap1l(0, $i, $h, $l, $s, pdl ([])); } # main # # Does a series of mesh plots for a given data set, with different # viewing options in each plot. my $nlevel = LEVELS; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); $z = zeroes (XPTS, YPTS); my $x = 3 * (sequence (XPTS) - int(XPTS / 2)) / int(XPTS / 2); my $y = 3 * (sequence (YPTS) - int(YPTS / 2)) / int(YPTS / 2); # The code below may be vectorized to improve speed for (my $i = 0; $i < XPTS; $i++) { my $xx = $x->index ($i); for (my $j = 0; $j < YPTS; $j++) { my $yy = $y->index ($j); $z->slice ("$i,$j") .= 3. * (1.-$xx)*(1.-$xx) * exp(-($xx*$xx) - ($yy+1.)*($yy+1.)) - 10. * ($xx/5. - pow($xx,3.) - pow($yy,5.)) * exp(-$xx*$xx-$yy*$yy) - 1./3. * exp(-($xx+1)*($xx+1) - ($yy*$yy)); } } $zmax = max ($z); $zmin = min ($z); $step = ($zmax - $zmin) / ($nlevel + 1); $clevel = $zmin + $step + $step * sequence ($nlevel); cmap1_init (); for (my $k = 0; $k < 2; $k++) { for (my $i = 0; $i < 4; $i++) { pladv (0); plcol0 (1); plvpor (0.0, 1.0, 0.0, 0.9); plwind (-1.0, 1.0, -1.0, 1.5); plw3d (1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, $zmin, $zmax, $alt[$k], $az[$k]); plbox3 (0.0, 0, 0.0, 0, 0.0, 4, "bnstu", "x axis", "bnstu", "y axis", "bcdmnstuv", "z axis"); plcol0 (2); # wireframe plot if ($i == 0) { plmesh ($x, $y, $z, $opt[$k]) # magnitude colored wireframe plot } elsif ($i == 1) { plmesh ($x, $y, $z,$opt[$k] | MAG_COLOR); # magnitude colored wireframe plot with sides } elsif ($i == 2) { plot3d ($x, $y, $z, $opt[$k] | MAG_COLOR, 1); # magnitude colored wireframe plot with base contour } elsif ($i == 3) { plmeshc ($x, $y, $z, $opt[$k] | MAG_COLOR | BASE_CONT, $clevel); } plcol0 (3); plmtex (1.0, 0.5, 0.5, "t", $title[$k]); } } plend(); plplot-5.10.0+dfsg/examples/perl/x29.pl 755 1750 1750 2305011556634250 165210ustar andrewandrew#! /usr/bin/env perl # Sample plots using date / time formatting for axes # # Copyright (C) 2007 Andrew Ross # Perl/PDL version 2008 Doug Hunt # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #-------------------------------------------------------------------------- # main # # Draws several plots which demonstrate the use of date / time formats for # the axis labels. # Time formatting is done using the system strftime routine. See the # documentation of this for full details of the available formats. # # 1) Plotting temperature over a day (using hours / minutes) # 2) Plotting # # Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). # #-------------------------------------------------------------------------- use PDL; use PDL::Graphics::PLplot; use Time::Local; use List::Util; use constant PI => 4*atan2(1,1); # Parse command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit(); # Change the escape character to a '@' instead of the default '#' plsesc('@'); plot1(); plot2(); plot3(); plot4(); # Don't forget to call plend() to finish off! plend(); exit(0); # Plot a model diurnal cycle of temperature sub plot1 { # Data points every 10 minutes for 1 day my $npts = 73; my $xmin = 0; my $xmax = 60.0*60.0*24.0; # Number of seconds in a day my $ymin = 10.0; my $ymax = 20.0; my $x = $xmax * sequence($npts)/$npts; my $y = 15.0 - 5.0*cos(2*PI*sequence($npts)/$npts); my $xerr1 = $x-60.0*5.0; my $xerr2 = $x+60.0*5.0; my $yerr1 = $y-0.1; my $yerr2 = $y+0.1; pladv(0); plsmaj(0.0,0.5); plsmin(0.0,0.5); plvsta(); plwind($xmin, $xmax, $ymin, $ymax); # Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. plcol0(1); # Set time format to be hours:minutes pltimefmt("%H:%M"); plbox(3.0*60*60, 3, 1, 5, "bcnstd", "bcnstv"); plcol0(3); pllab("Time (hours:mins)", "Temperature (degC)", '@frPLplot Example 29 - Daily temperature'); plcol0(4); plline($x, $y); plcol0(2); plerrx($npts, $xerr1,$xerr2,$y); plcol0(3); plerry($npts, $x,$yerr1,$yerr2); plsmin(0.0,1.0); plsmaj(0.0,1.0); } # Plot the number of hours of daylight as a function of day for a year sub plot2 { # Latitude for London my $lat = 51.5; my $npts = 365; my $xmin = 0; my $xmax = $npts*60.0*60.0*24.0; my $ymin = 0; my $ymax = 24; # Formula for hours of daylight from # "A Model Comparison for Daylength as a Function of Latitude and # Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. my $j = sequence($npts); my $x = $j * 60.0*60.0*24.0; my $p = asin(0.39795*cos(0.2163108 + 2*atan(0.9671396*tan(0.00860*($j-186))))); my $y = 24.0 - (24.0/PI) * acos( (sin(0.8333*PI/180.0) + sin($lat*PI/180.0)*sin($p) ) / (cos($lat*PI/180)*cos($p)) ); plcol0(1); # Set time format to be abbreviated month name followed by day of month pltimefmt("%b %d"); plprec(1,1); plenv($xmin, $xmax, $ymin, $ymax, 0, 40); plcol0(3); pllab("Date", "Hours of daylight", '@frPLplot Example 29 - Hours of daylight at 51.5N'); plcol0(4); plline($x, $y); plprec(0,0); } # Return a 1D PDL consisting of the minimum of each pairwise # element of the two input 1D PDLs sub minover { return cat($_[0], $_[1])->xchg(0,1)->minimum } sub plot3 { # Calculate seconds since the Unix epoch for 2005-12-01 UTC. my $tstart = timegm(0,0,0,1,11,105); my $npts = 62; my $xmin = $tstart; my $xmax = $xmin + $npts*60.0*60.0*24.0; my $ymin = 0.0; my $ymax = 5.0; my $i = sequence($npts); my $x = $xmin + $i*60.0*60.0*24.0; my $y = 1.0 + sin( 2*PI*$i / 7 ) + exp( (minover($i,$npts-$i)) / 31.0); pladv(0); plvsta(); plwind($xmin, $xmax, $ymin, $ymax); plcol0(1); # Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is # equivalent to %f for C99 compliant implementations of strftime. pltimefmt("%Y-%m-%d"); # Draw a box with ticks spaced every 14 days in X and 1 hour in Y. plbox(14*24.0*60.0*60.0,14, 1, 4, "bcnstd", "bcnstv"); plcol0(3); pllab("Date", "Hours of television watched", '@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006'); plcol0(4); plssym(0.0,0.5); plpoin($x, $y, 2); plline($x, $y); } sub plot4 { # TAI-UTC (seconds) as a function of time. # Use Besselian epochs as the continuous time interval just to prove # this does not introduce any issues. # Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch # B = 1900. + (JD -2415020.31352)/365.242198781 # ==> (as calculated with aid of "bc -l" command) # B = (MJD + 678940.364163900)/365.242198781 # ==> # MJD = B*365.24219878 - 678940.364163900 my $scale = 365.242198781; my $offset1 = -678940.; my $offset2 = -0.3641639; plconfigtime($scale, $offset1, $offset2, 0x0, 0, 0, 0, 0, 0, 0, 0); my ($xmin, $xmax); for ( my $kind = 0; $kind < 7; $kind++ ) { if ( $kind == 0 ) { $xmin = plctime(1950, 0, 2, 0, 0, 0); $xmax = plctime(2020, 0, 2, 0, 0, 0); $npts = 70 * 12 + 1; $ymin = 0.0; $ymax = 36.0; $time_format = "%Y%"; $if_TAI_time_format = 1; $title_suffix = "from 1950 to 2020"; $xtitle = "Year"; $xlabel_step = 10; } elsif ( $kind == 1 || $kind == 2 ) { $xmin = plctime(1961, 7, 1, 0, 0, 1.64757 - .20); $xmax = plctime( 1961, 7, 1, 0, 0, 1.64757 + .20); $npts = 1001; $ymin = 1.625; $ymax = 1.725; $time_format = "%S%2%"; $title_suffix = "near 1961-08-01 (TAI)"; $xlabel_step = 0.05 / ( $scale * 86400. ); if ( $kind == 1 ) { $if_TAI_time_format = 1; $xtitle = "Seconds (TAI)"; } else { $if_TAI_time_format = 0; $xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } elsif ( $kind == 3 || $kind == 4 ) { $xmin = plctime(1963, 10, 1, 0, 0, 2.6972788 - .20); $xmax = plctime(1963, 10, 1, 0, 0, 2.6972788 + .20); $npts = 1001; $ymin = 2.55; $ymax = 2.75; $time_format = "%S%2%"; $title_suffix = "near 1963-11-01 (TAI)"; $xlabel_step = 0.05 / ( $scale * 86400. ); if ( $kind == 3 ) { $if_TAI_time_format = 1; $xtitle = "Seconds (TAI)"; } else { $if_TAI_time_format = 0; $xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } elsif ( $kind == 5 || $kind == 6 ) { $xmin = plctime(2009, 0, 1, 0, 0, 34. - 5); $xmax = plctime(2009, 0, 1, 0, 0, 34. + 5); $npts = 1001; $ymin = 32.5; $ymax = 34.5; $time_format = "%S%2%"; $title_suffix = "near 2009-01-01 (TAI)"; $xlabel_step = 1. / ( $scale * 86400. ); if ( $kind == 5 ) { $if_TAI_time_format = 1; $xtitle = "Seconds (TAI)"; } else { $if_TAI_time_format = 0; $xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } my (@x, @y); for ( $i = 0; $i < $npts; $i++ ) { $x[$i] = $xmin + $i * ( $xmax - $xmin ) / ( $npts - 1 ); plconfigtime( $scale, $offset1, $offset2, 0x0, 0, 0, 0, 0, 0, 0, 0 ); $tai = $x[$i]; ($tai_year, $tai_month, $tai_day, $tai_hour, $tai_min, $tai_sec) = plbtime($tai); plconfigtime( $scale, $offset1, $offset2, 0x2, 0, 0, 0, 0, 0, 0, 0 ); ($utc_year, $utc_month, $utc_day, $utc_hour, $utc_min, $utc_sec) = plbtime($tai); plconfigtime( $scale, $offset1, $offset2, 0x0, 0, 0, 0, 0, 0, 0, 0 ); $utc = plctime($utc_year, $utc_month, $utc_day, $utc_hour, $utc_min, $utc_sec); $y[$i] = ( $tai - $utc ) * $scale * 86400; } pladv( 0 ); plvsta(); plwind( $xmin, $xmax, $ymin, $ymax ); plcol0( 1 ); if ( $if_TAI_time_format ) { plconfigtime( $scale, $offset1, $offset2, 0x0, 0, 0, 0, 0, 0, 0, 0 ); } else { plconfigtime( $scale, $offset1, $offset2, 0x2, 0, 0, 0, 0, 0, 0, 0 ); } pltimefmt( $time_format ); plbox( $xlabel_step, 0, 0, 0, "bcnstd", "bcnstv" ); plcol0( 3 ); $title = '@frPLplot Example 29 - TAI-UTC '; $title .= $title_suffix; pllab( $xtitle, "TAI-UTC (sec)", $title ); plcol0( 4 ); plline( pdl(@x), pdl(@y) ); } } plplot-5.10.0+dfsg/examples/perl/x16.pl 755 1750 1750 2027111556634250 165170ustar andrewandrew#! /usr/bin/env perl # # Demo x16 for the PLplot PDL binding # # plshade demo, using color fill # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x16c.c 1.26 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Getopt::Long qw(:config pass_through); use Text::Wrap; $Text::Wrap::columns = 72; # Fundamental settings. See @notes for more info. use constant ns => 20; # Default number of shade levels use constant nx => 35; # Default number of data points in x use constant ny => 46; # Default number of data points in y use constant exclude => 0; # By default do not plot a page illustrating # exclusion. API is probably going to change # anyway, and cannot be reproduced by any # front end other than the C one. # polar plot data use constant PERIMETERPTS => 100; # Transformation function my @tr; sub mypltr { my ($x, $y) = @_; my $tx = $tr[0] * $x + $tr[1] * $y + $tr[2]; my $ty = $tr[3] * $x + $tr[4] * $y + $tr[5]; return ($tx, $ty); } # -------------------------------------------------------------------------- # f2mnmx # # Returns min & max of input 2d array. # -------------------------------------------------------------------------- sub f2mnmx { my $f = shift; my $fmin = min ($f); my $fmax = max ($f); return ($fmin, $fmax); } sub zdefined { my ($x, $y) = @_; my $z = sqrt ($x * $x + $y * $y); return ($z < 0.4 or $z > 0.6); } my @notes = ( "To get smoother color variation, increase ns, nx, and ny. To get faster", "response (especially on a serial link), decrease them. A decent but quick", "test results from ns around 5 and nx, ny around 25." ); # -------------------------------------------------------------------------- # main # # Does several shade plots using different coordinate mappings. # -------------------------------------------------------------------------- my $fill_width = 2; my $cont_color = 0; my $cont_width = 0; # Parse and process command line arguments my ($exclude, $ns, $nx, $ny, $help); $exclude = exclude; $ns = ns; $nx = nx; $ny = ny; GetOptions ("exclude" => \$exclude, "ns=i" => \$ns, "nx=i" => \$nx, "ny=i" => \$ny, "help" => \$help); if ($help) { print (<dummy (1, $ny); my $y = ((sequence ($ny) - int($ny / 2)) / int($ny / 2) - 1.0)->dummy (0, $nx);; my $z = -sin (7 * $x) * cos (7 * $y) + $x ** 2 - $y ** 2; my $w = -cos (7 * $x) * sin (7 * $y) + 2 * $x * $y; my ($zmin, $zmax) = f2mnmx ($z); my $clevel = $zmin + ($zmax - $zmin) * (sequence ($ns) + 0.5) / $ns; my $shedge = $zmin + ($zmax - $zmin) * sequence ($ns + 1) / $ns; # Set up coordinate grids my $distort = 0.4; my $vx = sequence ($nx); my $vy = sequence ($ny); my ($x, $y) = mypltr ($vx->dummy (1, $ny), $vy->dummy (0, $nx)); my $xx = $x->slice (',0')->squeeze (); my $yy = $y->slice ('0,')->squeeze (); my $argx = $xx * pi / 2; my $argy = $yy * pi / 2; my $cgrid1 = plAllocGrid ($xx + $distort * cos ($argx), $yy - $distort * cos ($argy)); my $argx = $x * pi / 2; my $argy = $y * pi / 2; my $cgrid2 = plAlloc2dGrid ($x + $distort * cos ($argx) * cos ($argy), $y - $distort * cos ($argx) * cos ($argy)); # Plot using identity transform pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); plpsty (0); plshades ($z, -1., 1., -1., 1., $shedge, $fill_width, $cont_color, $cont_width, 1, 0, 0, 0); plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); plcol0 (2); pllab ("distance", "altitude", "Bogon density"); # Plot using 1d coordinate transform # Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_blue_yellow.pal", 1 ); # Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); plpsty (0); plshades ($z, -1., 1., -1., 1., $shedge, $fill_width, $cont_color, $cont_width, 1, 0, \&pltr1, $cgrid1); plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); plcol0 (2); pllab ("distance", "altitude", "Bogon density"); # Plot using 2d coordinate transform # Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_blue_red.pal", 1 ); # Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); plpsty (0); plshades ($z, -1., 1., -1., 1., $shedge, $fill_width, $cont_color, $cont_width, 0, 0, \&pltr2, $cgrid2); plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); plcol0 (2); plcont ($w, 1, $nx, 1, $ny, $clevel, \&pltr2, $cgrid2); pllab ("distance", "altitude", "Bogon density, with streamlines"); # Plot using 2d coordinate transform # Load colour palettes plspal0( "" ); plspal1( "", 1 ); # Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); plpsty (0); plshades ($z, -1., 1., -1., 1., $shedge, $fill_width, 2, 3, 0, 0, \&pltr2, $cgrid2); plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); plcol0 (2); pllab("distance", "altitude", "Bogon density"); # Plot using 2d coordinate transform and exclusion if ($exclude) { pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); plpsty (0); plshades ($z, -1., 1., -1., 1., $shedge, $fill_width, $cont_color, $cont_width, 1, \&zdefined, \&pltr2, $cgrid2); plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); pllab ("distance", "altitude", "Bogon density with exclusion"); } plFreeGrid ($cgrid1); plFree2dGrid ($cgrid2); # Example with polar coordinates # Load colour palettes plspal0( "cmap0_black_on_white.pal" ); plspal1( "cmap1_gray.pal", 1 ); # Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display plscmap0n( 3 ); pladv (0); plvpor (.1, .9, .1, .9); plwind (-1., 1., -1., 1.); plpsty (0); # Build new coordinate matrices my $r = (sequence ($nx) / ($nx - 1))->dummy (1, $ny); my $t = ((2 * pi * sequence ($ny) / ($ny - 1))->dummy (0, $nx)); $cgrid2 = plAlloc2dGrid ($r * cos ($t), $r * sin ($t)); $z = exp (- $r ** 2) * cos (5 * pi * $r) * cos (5 * $t); # Need a new shedge to go along with the new data set ($zmin, $zmax) = f2mnmx ($z); $shedge = $zmin + ($zmax - $zmin) * sequence ($ns+1) / $ns; # Now we can shade the interior region plshades ($z, -1., 1., -1., 1., $shedge, $fill_width, $cont_color, $cont_width, 0, 0, \&pltr2, $cgrid2); # Now we can draw the perimeter. (If do before, shade stuff may overlap.) $t = (2 * pi / (PERIMETERPTS - 1)) * sequence (PERIMETERPTS); my $px = cos ($t); my $py = sin ($t); plcol0 (1); plline ($px, $py); # And label the plot plcol0 (2); pllab ("", "", "Tokamak Bogon Instability"); plend (); plFree2dGrid ($cgrid2); plplot-5.10.0+dfsg/examples/perl/x03.pl 755 1750 1750 476611556634250 165060ustar andrewandrew#! /usr/bin/env perl # # Demo x03 for the PLplot PDL binding # # Polar plot demo # (inspired from t/x03.t of module Graphics::PLplot, by Tim Jenness) # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x03c.c 1.18 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Set orientation to portrait - note not all device drivers # support this, in particular most interactive drivers do not plsori(1); # Initialize plplot plinit (); # Set up viewport and window but do not draw box plenv (-1.3, 1.3, -1.3, 1.3, 1, -2); my $dtr = pi / 180.0; my $x0 = cos ($dtr * sequence (361)); my $y0 = sin ($dtr * sequence (361)); my ($x, $y); for my $i (1 .. 10) { # Draw circles for polar grid # old way # my $x = pdl (0.1 * $i * $x0); # my $y = pdl (0.1 * $i * $y0); # plline ($x, $y); # new way plarc(0, 0, 0.1 * $i, 0.1 * $i, 0, 360, 0, 0); } plcol0 (2); for my $i (0 .. 11) { my $theta = 30 * $i; my $dx = cos ( $dtr * $theta ); my $dy = sin ( $dtr * $theta ); # Draw radial spokes for polar grid pljoin (0, 0, $dx, $dy); if ($theta < 9.99) { $offset = 0.45; } elsif ($theta < 99.9) { $offset = 0.30; } else { $offset = 0.15; } # Write labels for angle # Slightly off zero to avoid floating point logic flips at 90 and 270 deg if ($dx >= -0.00001) { plptex ($dx, $dy, $dx, $dy, -$offset, int ($theta)); } else { plptex ($dx, $dy, -$dx, -$dy, (1.+$offset), int ($theta)); } } # Draw the graph my $r = sin ($dtr * 5 * sequence (361)); $x = $x0 * $r; $y = $y0 * $r; plcol0 (3); plline ($x, $y); plcol0 (4); plmtex (2, 0.5, 0.5, "t", "#frPLplot Example 3 - r(#gh)=sin 5#gh"); # Close the plot at end plend(); plplot-5.10.0+dfsg/examples/perl/x01.pl 755 1750 1750 1600212102122103 164570ustar andrewandrew#! /usr/bin/env perl # # Demo x01 for the PLplot PDL binding # # Simple line plot and multiple windows demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x01c.c 1.39 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Time::HiRes qw [usleep]; use POSIX qw [isprint]; use Getopt::Long qw [:config pass_through]; use Text::Wrap; $Text::Wrap::columns = 72; $xscale = 6.; $yscale = 1.; $xoff = 0.; $yoff = 0.; my $test_xor = 0; #-------------------------------------------------------------------------- # main # # Generates several simple line plots. Demonstrates: # - subwindow capability # - setting up the window, drawing plot, and labelling # - changing the color # - automatic axis rescaling to exponential notation # - placing the axes in the middle of the box # - gridded coordinate axes #-------------------------------------------------------------------------- sub main { # Options data structure definition. */ my $locate_mode = 0; my $fontset = 1; GetOptions ("locate" => \$locate_mode, "xor" => \$test_xor, "font=i" => \$fontset, "save=s" => \$f_name, "help" => \$help); my @notes = ("Make sure you get it right!"); if ($help) { print (<index (0); $xmax = $x->index (59); $ymin = $y->index (0); $ymax = $y->index (59); my $idx = sequence (6) * 10 + 3; $xs = $x->index ($idx); $ys = $y->index ($idx); # Set up the viewport and window using PLENV. The range in X is # 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are # scaled separately (just = 0), and we just draw a labelled # box (axis = 0). plcol0 (1); plenv ($xmin, $xmax, $ymin, $ymax, 0, 0); plcol0 (2); pllab ("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); # Plot the data points plcol0 (4); plpoin ($xs, $ys, 9); # Draw the line through the data plcol0 (3); plline ($x, $y); # xor mode enable erasing a line/point/text by replotting it again # it does not work in double buffering mode, however if ($do_test and $test_xor) { my $st = plxormod (1); # enter xor mode if ($st) { for (my $i = 0; $i < 60; $i++) { my $xi = $x->index ($i); my $yi = $y->index ($i); plpoin ($xi, $yi, 9); # draw a point usleep (50000); # wait a little plflush (); # force an update of the tk driver plpoin ($xi, $yi, 9); # erase point } plxormod (0); # leave xor mode } } } sub plot2 { # Set up the viewport and window using PLENV. The range in X is -2.0 to # 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately # (just = 0), and we draw a box with axes (axis = 1). plcol0 (1); plenv (-2.0, 10.0, -0.4, 1.2, 0, 1); plcol0 (2); pllab ("(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function"); # Fill up the arrays my $x = (sequence (100) - 19.0) / 6.0; my $y = sin ($x) / $x; $y->index (which ($x == 0)) .= 1.0; # Draw the line plcol0 (3); plwidth (2); plline ($x, $y); plwidth (1); } sub plot3 { my $space1 = 1500; my $mark1 = 1500; # For the final graph we wish to override the default tick intervals, and # so do not use plenv(). pladv (0); # Use standard viewport, and define X range from 0 to 360 degrees, Y range # from -1.2 to 1.2. plvsta (); plwind (0.0, 360.0, -1.2, 1.2); # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0 (1); plbox (60.0, 2, 0.2, 2, "bcnst", "bcnstv"); # Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl ($mark1, $space1); plcol0 (2); plbox (30.0, 0, 0.2, 0, "g", "g"); plstyl (pdl([]), pdl ([])); plcol0 (3); pllab ("Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function"); my $x = 3.6 * sequence (101); my $y = sin ($x * pi / 180.0); plcol0 (4); plline ($x, $y); } main (); plplot-5.10.0+dfsg/examples/perl/x28.pl 755 1750 1750 2266311543675237 165370ustar andrewandrew#! /usr/bin/env perl # # plmtex3, plptex3 demo. # # Copyright (C) 2007 Alan W. Irwin # Perl/PDL version 2008 Doug Hunt # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Choose these values to correspond to tick marks. use PDL; use PDL::Graphics::PLplot; use constant XPTS => 2; use constant YPTS => 2; use constant NREVOLUTION => 16; use constant NROTATION => 8; use constant NSHEAR => 8; use constant PI => 4*atan2(1,1); my $xmin = 0; my $xmax = 1.0; my $xmid = 0.5*($xmax + $xmin); my $xrange = $xmax - $xmin; my $ymin = 0; my $ymax = 1.0; my $ymid = 0.5*($ymax + $ymin); my $yrange = $ymax - $ymin; my $zmin = 0; my $zmax = 1.0; my $zmid = 0.5*($zmax + $zmin); my $zrange = $zmax - $zmin; my $ysmin = $ymin + 0.1 * $yrange; my $ysmax = $ymax - 0.1 * $yrange; my $ysrange = $ysmax - $ysmin; my $dysrot = $ysrange / ( NROTATION - 1 ); my $dysshear = $ysrange / ( NSHEAR - 1 ); my $zsmin = $zmin + 0.1 * $zrange; my $zsmax = $zmax - 0.1 * $zrange; my $zsrange = $zsmax - $zsmin; my $dzsrot = $zsrange / ( NROTATION - 1 ); my $dzsshear = $zsrange / ( NSHEAR - 1 ); my $ys; my $zx; my $pstring = "The future of our civilization depends on software freedom."; my $x = $xmin + ($xmax-$xmin)*sequence(XPTS)/(XPTS-1); my $y = $ymin + ($ymax-$ymin)*sequence(YPTS)/(YPTS-1); my $z = zeroes(XPTS,YPTS); # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); plinit(); # Page 1: Demonstrate inclination and shear capability pattern. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, $xmin, $xmax, $ymin, $ymax, $zmin, $zmax, 20., 45.); plcol0(2); plbox3($xmax-$xmin, 0, $ymax-$ymin, 0, $zmax-$zmin, 0, "b", "", "b", "", "bcd", ""); # note reordered arguments! my $omega = 2*PI*(sequence(NREVOLUTION)/NREVOLUTION); # z = zmin. plschr(0., 1.0); my $x_inclination = 0.5*$xrange*cos($omega); my $y_inclination = 0.5*$yrange*sin($omega); my $z_inclination = 0; my $x_shear = -0.5*$xrange*sin($omega); my $y_shear = 0.5*$yrange*cos($omega); my $z_shear = 0; plptex3( $xmid, $ymid, $zmin, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.0, " revolution"); # x = xmax. $x_inclination = 0; $y_inclination = -0.5*$yrange*cos($omega); $z_inclination = 0.5*$zrange*sin($omega); $x_shear = 0; $y_shear = 0.5*$yrange*sin($omega); $z_shear = 0.5*$zrange*cos($omega); plptex3( $xmax, $ymid, $zmid, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.0, " revolution"); $x_inclination = 0.5*$xrange*cos($omega); $y_inclination = 0; $z_inclination = 0.5*$zrange*sin($omega); $x_shear = -0.5*$xrange*sin($omega); $y_shear = 0; $z_shear = 0.5*$zrange*cos($omega); plptex3( $xmid, $ymax, $zmid, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.0, " revolution"); # Draw minimal 3D grid to finish defining the 3D box. plmesh($x, $y, $z, DRAW_LINEXY); # Page 2: Demonstrate rotation of string around its axis. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, $xmin, $xmax, $ymin, $ymax, $zmin, $zmax, 20, 45); plcol0(2); plbox3($xmax-$xmin, 0, $ymax-$ymin, 0, $zmax-$zmin, 0, "b", "", "b", "", "bcd", ""); # y = ymax. $x_inclination = 1; $y_inclination = 0; $z_inclination = 0; $x_shear = 0; $omega = 2*PI*(sequence(NROTATION)/NROTATION); $y_shear = 0.5*$yrange*sin($omega); $z_shear = 0.5*$zrange*cos($omega); $zs = $zsmax - $dzsrot * sequence(NROTATION); plptex3( $xmid, $ymax, $zs, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, "rotation for y = y#dmax#u"); # x = xmax. $x_inclination = 0; $y_inclination = -1; $z_inclination = 0; $y_shear = 0; $x_shear = 0.5*$xrange*sin($omega); $z_shear = 0.5*$zrange*cos($omega); $zs = $zsmax - $dzsrot * sequence(NROTATION); plptex3( $xmax, $ymid, $zs, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, "rotation for x = x#dmax#u"); # z = zmin. $x_inclination = 1; $y_inclination = 0; $z_inclination = 0; $x_shear = 0.; $y_shear = 0.5*$yrange*cos($omega); $z_shear = 0.5*$zrange*sin($omega); $ys = $ysmax - $dysrot * sequence(NROTATION); plptex3( $xmid, $ys, $zmin, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, "rotation for z = z#dmin#u"); # Draw minimal 3D grid to finish defining the 3D box. plmesh($x, $y, $z, DRAW_LINEXY); # Page 3: Demonstrate shear of string along its axis. # Work around xcairo and pngcairo (but not pscairo) problems for # shear vector too close to axis of string. (N.B. no workaround # would be domega = 0.) my $domega = 0.05; pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, $xmin, $xmax, $ymin, $ymax, $zmin, $zmax, 20, 45); plcol0(2); plbox3($xmax-$xmin, 0, $ymax-$ymin, 0, $zmax-$zmin, 0, "b", "", "b", "", "bcd", ""); # y = ymax. plschr(0., 1.0); $x_inclination = 1; $y_inclination = 0; $z_inclination = 0; $y_shear = 0; $omega = $domega + 2*PI*(sequence(NSHEAR)/NSHEAR); $x_shear = 0.5*$xrange*sin($omega); $z_shear = 0.5*$zrange*cos($omega); $zs = $zsmax - $dzsshear * sequence(NSHEAR); plptex3( $xmid, $ymax, $zs, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, "shear for y = y#dmax#u"); # x = xmax. $x_inclination = 0; $y_inclination = -1; $z_inclination = 0; $x_shear = 0; $y_shear = -0.5*$yrange*sin($omega); $z_shear = 0.5*$zrange*cos($omega); $zs = $zsmax - $dzsshear * sequence(NSHEAR); plptex3( $xmax, $ymid, $zs, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, "shear for x = x#dmax#u"); # z = zmin. $x_inclination = 1; $y_inclination = 0; $z_inclination = 0; $z_shear = 0; $y_shear = 0.5*$yrange*cos($omega); $x_shear = 0.5*$xrange*sin($omega); $ys = $ysmax - $dysshear * sequence(NSHEAR); plptex3( $xmid, $ys, $zmin, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, "shear for z = z#dmin#u"); # Draw minimal 3D grid to finish defining the 3D box. plmesh($x, $y, $z, DRAW_LINEXY); # Page 4: Demonstrate drawing a string on a 3D path. pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, $xmin, $xmax, $ymin, $ymax, $zmin, $zmax, 40, -30); plcol0(2); plbox3($xmax-$xmin, 0, $ymax-$ymin, 0, $zmax-$zmin, 0, "b", "", "b", "", "bcd", ""); plschr(0, 1.2); # domega controls the spacing between the various characters of the # string and also the maximum value of omega for the given number # of characters in *pstring. my $domega = 2*PI/length($pstring); my $omega = 0; # 3D function is a helix of the given radius and pitch my $radius = 0.5; my $pitch = 1/(2*PI); # The shear vector should be perpendicular to the 3D line with Z # component maximized, but for low pitch a good approximation is # a constant vector that is parallel to the Z axis. my $x_shear = 0; my $y_shear = 0; my $z_shear = 1; foreach my $c (split '', $pstring) { my $sin_omega = sin($omega); my $cos_omega = cos($omega); my $xpos = $xmid + $radius*$sin_omega; my $ypos = $ymid - $radius*$cos_omega; my $zpos = $zmin + $pitch*$omega; # In general, the inclination is proportional to the derivative of # the position wrt theta. my $x_inclination = $radius*$cos_omega;; my $y_inclination = $radius*$sin_omega; my $z_inclination = $pitch; plptex3( $xpos, $ypos, $zpos, $x_inclination, $y_inclination, $z_inclination, $x_shear, $y_shear, $z_shear, 0.5, $c); $omega += $domega; } # Draw minimal 3D grid to finish defining the 3D box. plmesh($x, $y, $z, DRAW_LINEXY); # Page 5: Demonstrate plmtex3 axis labelling capability pladv(0); plvpor(-0.15, 1.15, -0.05, 1.05); plwind(-1.2, 1.2, -0.8, 1.5); plw3d(1.0, 1.0, 1.0, $xmin, $xmax, $ymin, $ymax, $zmin, $zmax, 20, 45); plcol0(2); plbox3($xmax-$xmin, 0, $ymax-$ymin, 0, $zmax-$zmin, 0, "b", "", "b", "", "bcd", ""); plschr(0, 1.0); plmtex3( 3.0, 0.5, 0.5, "xp", "Arbitrarily displaced"); plmtex3( 4.5, 0.5, 0.5, "xp", "primary X-axis label"); plmtex3(-2.5, 0.5, 0.5, "xs", "Arbitrarily displaced"); plmtex3(-1.0, 0.5, 0.5, "xs", "secondary X-axis label"); plmtex3( 3.0, 0.5, 0.5, "yp", "Arbitrarily displaced"); plmtex3( 4.5, 0.5, 0.5, "yp", "primary Y-axis label"); plmtex3(-2.5, 0.5, 0.5, "ys", "Arbitrarily displaced"); plmtex3(-1.0, 0.5, 0.5, "ys", "secondary Y-axis label"); plmtex3( 4.5, 0.5, 0.5, "zp", "Arbitrarily displaced"); plmtex3( 3.0, 0.5, 0.5, "zp", "primary Z-axis label"); plmtex3(-2.5, 0.5, 0.5, "zs", "Arbitrarily displaced"); plmtex3(-1.0, 0.5, 0.5, "zs", "secondary Z-axis label"); # Draw minimal 3D grid to finish defining the 3D box. plmesh($x, $y, $z, DRAW_LINEXY); plend(); plplot-5.10.0+dfsg/examples/perl/x15.pl 755 1750 1750 1612211543675237 165240ustar andrewandrew#! /usr/bin/env perl # # Demo x15 for the PLplot PDL binding # # Shade plot demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x15c.c 1.16 use PDL; use PDL::Graphics::PLplot; use constant XPTS => 35; # Data points in x use constant YPTS => 46; # Data points in y $z = zeroes (XPTS, YPTS); my $zmin, $zmax; # Function prototypes sub plot1 (); sub plot2 (); sub f2mnmx ($); sub cmap1_init1 (); sub cmap1_init2 (); # main # # Does a variety of shade plots sub main { # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Set up color map 0 # # plscmap0n(3); # # Set up color map 1 cmap1_init2 (); # Initialize plplot plinit (); # Set up data array my $xx = (sequence (XPTS) - int(XPTS / 2)) / int(XPTS / 2); my $yy = (sequence (YPTS) - int(YPTS / 2)) / int(YPTS / 2) - 1.0; for (my $i = 0; $i < XPTS; $i++) { my $xi = $xx->index ($i); for (my $j = 0; $j < YPTS; $j++) { my $yi = $yy->index ($j); $z->slice ("$i,$j") .= $xi ** 2 - $yi ** 2 + ($xi - $yi) / ($xi * $xi + $yi ** 2 + 0.1); } } ($zmin, $zmax) = f2mnmx ($z); plot1 (); plot2 (); plot3 (); plend(); } # cmap1_init1 # # Initializes color map 1 in HLS space sub cmap1_init1 () { my $i = pdl [0, # left boundary 0.45, # just before center 0.55, # just after center 1]; # right boundary my $h = pdl [260, # hue -- low: blue-violet 260, # only change as we go over vertex 20, # hue -- high: red 20]; # keep fixed my $l; if (1) { $l = pdl [0.5, # lightness -- low 0.0, # lightness -- center 0.0, # lightness -- center 0.5]; # lightness -- high } else { plscolbg (255, 255, 255); $l = pdl [0.5, # lightness -- low 1.0, # lightness -- center 1.0, # lightness -- center 0.5]; # lightness -- high } my $s = pdl [1, # maximum saturation 1, # maximum saturation 1, # maximum saturation 1]; # maximum saturation plscmap1l (0, $i, $h, $l, $s, pdl ([])); } # cmap1_init2 # # Initializes color map 1 in HLS space sub cmap1_init2 () { my $i = pdl [0, # left boundary 0.45, # just before center 0.55, # just after center 1]; # right boundary my $h = pdl [260, # hue -- low: blue-violet 260, # only change as we go over vertex 20, # hue -- high: red 20]; # keep fixed my $l; if (1) { $l = pdl [0.6, # lightness -- low 0.0, # lightness -- center 0.0, # lightness -- center 0.6]; # lightness -- high } else { plscolbg (255, 255, 255); $l = pdl [0.5, # lightness -- low 1.0, # lightness -- center 1.0, # lightness -- center 0.5]; # lightness -- high } my $s = pdl [1, # maximum saturation 0.5, # maximum saturation 0.5, # maximum saturation 1]; # maximum saturation plscmap1l (0, $i, $h, $l, $s, pdl ([])); } # plot1 # # Illustrates a single shaded region sub plot1 () { my $sh_cmap = 0; my $min_color = 0; my $min_width = 0; my $max_color = 0; my $max_width = 0; pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); # Plot using identity transform my $shade_min = $zmin + ($zmax - $zmin) * 0.4; my $shade_max = $zmin + ($zmax - $zmin) * 0.6; my $sh_color = 7; my $sh_width = 2; my $min_color = 9; my $max_color = 2; my $min_width = 2; my $max_width = 2; plpsty (8); plshade1 ($z, -1, 1, -1, 1, $shade_min, $shade_max, $sh_cmap, $sh_color, $sh_width, $min_color, $min_width, $max_color, $max_width, 1, "", "", 0); plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); plcol0 (2); pllab ("distance", "altitude", "Bogon flux"); } # plot2 # # Illustrates multiple adjacent shaded regions, using different fill # patterns for each region sub plot2 () { my $nlin = pdl [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]; my $inc = pdl [ [450, 0], [-450, 0], [0, 0], [900, 0], [300, 0], [450,-450], [0, 900], [0, 450], [450, -450], [0, 900] ]; my $spa = pdl [ [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [2000, 2000], [4000, 4000], [4000, 2000] ]; my $sh_cmap = 0; my $min_color = 0; my $min_width = 0; my $max_color = 0; my $max_width = 0; my $sh_width = 2; pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); # Plot using identity transform for (my $i = 0; $i < 10; $i++) { my $shade_min = $zmin + ($zmax - $zmin) * $i / 10.0; my $shade_max = $zmin + ($zmax - $zmin) * ($i + 1) / 10.0; my $sh_color = $i + 6; my $n = $nlin->slice("($i)"); my $nm1 = $n - 1; plpat ($n, $inc->slice("0:$nm1,($i)"), $spa->slice("0:$nm1,($i)")); plshade1 ($z, -1, 1, -1, 1, $shade_min, $shade_max, $sh_cmap, $sh_color, $sh_width, $min_color, $min_width, $max_color, $max_width, 1, "", "", 0); } plcol0 (1); plbox (0.0, 0, 0.0, 0, "bcnst", "bcnstv"); plcol0 (2); pllab ("distance", "altitude", "Bogon flux"); } # plot3 # # Illustrates shaded regions in 3d, using a different fill pattern for # each region. sub plot3 () { my $xx = pdl [ [-1.0, 1.0, 1.0, -1.0, -1.0], [-1.0, 1.0, 1.0, -1.0, -1.0] ]; my $yy = pdl [ [1.0, 1.0, 0.0, 0.0, 1.0], [-1.0, -1.0, 0.0, 0.0, -1.0] ]; my $zz = pdl [ [0.0, 0.0, 1.0, 1.0, 0.0], [0.0, 0.0, 1.0, 1.0, 0.0] ]; pladv (0); plvpor (0.1, 0.9, 0.1, 0.9); plwind (-1.0, 1.0, -1.0, 1.0); plw3d (1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30., -40,); # Plot using identity transform plcol0 (1); plbox3 (0.0, 0, 0.0, 0, 0.5, 0, "bntu", "X", "bntu", "Y", "bcdfntu", "Z"); plcol0 (2); pllab ("","","3-d polygon filling"); plcol0 (3); plpsty (1); plline3 ($xx->slice(":,0"), $yy->slice(":,0"), $zz->slice(":,0")); plfill3 (4, $xx->slice("0:4,0"), $yy->slice("0:4,0"), $zz->slice("0:4,0")); plpsty (2); plline3 ($xx->slice(":,1"), $yy->slice(":,1"), $zz->slice(":,1")); plfill3 (4, $xx->slice("0:4,1"), $yy->slice("0:4,1"), $zz->slice("0:4,1")); } # f2mnmx # # Returns min & max of input 2d array sub f2mnmx ($) { my $f = shift; return (min ($f), max ($f)); } main (); plplot-5.10.0+dfsg/examples/perl/x23.pl 755 1750 1750 2161111543675237 165220ustar andrewandrew#! /usr/bin/env perl # # # Demo x23 for the PLplot PDL binding # # Displays Greek letters and mathematically interesting Unicode ranges # # Copyright (C) 2005 Rafael Laboissiere # Unicode examples (pages 11-15) Doug Hunt # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x23c.c 1.2 $|++; # set output to immediate flush use PDL; use PDL::Graphics::PLplot; # Displays Greek letters and mathematically interesting Unicode ranges my @Greek = ( "#gA","#gB","#gG","#gD","#gE","#gZ","#gY","#gH","#gI","#gK","#gL","#gM", "#gN","#gC","#gO","#gP","#gR","#gS","#gT","#gU","#gF","#gX","#gQ","#gW", "#ga","#gb","#gg","#gd","#ge","#gz","#gy","#gh","#gi","#gk","#gl","#gm", "#gn","#gc","#go","#gp","#gr","#gs","#gt","#gu","#gf","#gx","#gq","#gw", ); my @Type1 = ( 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0028, 0x0029, 0x002b, 0x002c, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x005b, 0x005d, 0x005f, 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac, 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7, 0x0192, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022, 0x2026, 0x2032, 0x2033, 0x203e, 0x2044, 0x2111, 0x2118, 0x211c, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, 0x2215, 0x2217, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329, 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665, 0x2666 ); my @title = ( "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)" ); my @lo = ( 0x0, 0x0, 0x40, 0x80, 0x2153, 0x2190, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0 ); my @hi = ( 0x30, 0x40, 0x80, 0xA6, 0x2184, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, 0x2300 ); my @nxcells = ( 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ); my @nycells = ( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ); # non-zero values Must be consistent with nxcells and nycells my @offset = ( 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0 ); # 30 possible FCI values. use constant FCI_COMBINATIONS => 30; my @fci = ( 0x80000000, 0x80000001, 0x80000002, 0x80000003, 0x80000004, 0x80000010, 0x80000011, 0x80000012, 0x80000013, 0x80000014, 0x80000020, 0x80000021, 0x80000022, 0x80000023, 0x80000024, 0x80000100, 0x80000101, 0x80000102, 0x80000103, 0x80000104, 0x80000110, 0x80000111, 0x80000112, 0x80000113, 0x80000114, 0x80000120, 0x80000121, 0x80000122, 0x80000123, 0x80000124, ); my @family = ( "sans-serif", "serif", "monospace", "script", "symbol", ); my @style = ( "upright", "italic", "oblique", ); my @weight = ( "medium", "bold", ); plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); plinit (); for (my $page = 0; $page < 11; $page++) { pladv (0); # Set up viewport and window plvpor (0.02, 0.98, 0.02, 0.90); plwind (0.0, 1.0, 0.0, 1.0); my ($xmin, $xmax, $ymin, $ymax) = plgspa (); plschr (0., 0.8); my $ycharacter_scale = (1.0 - 0.0) / ($ymax->at (0) - $ymin->at (0)); # Factor should be 0.5, but heuristically it turns out to be larger my ($chardef, $charht) = plgchr (); my $yoffset = 1.0 * $charht->at (0) * $ycharacter_scale; # Draw the grid using plbox plcol0 (2); my $deltax = 1.0 / ($nxcells [$page]); my $deltay = 1.0 / ($nycells [$page]); plbox ($deltax, 0, $deltay, 0, "bcg", "bcg"); plcol0 (15); my $length = $hi [$page] - $lo [$page]; $slice = 0; for (my $j = $nycells [$page] - 1; $j >= -1; $j--) { my $y = (0.5 + $j) * $deltay; for (my $i = 0; $i < $nxcells [$page]; $i++) { $x = (0.5 + $i) * $deltax; if ($slice < $length) { my $cmdString; if ($page == 0) { $cmdString = "$Greek[$slice]"; } elsif (($page >= 1) and ($page <= 3)) { $cmdString = sprintf ("#[0x%.4x]", $Type1 [$offset [$page] + $slice]); } else { $cmdString = sprintf ("#[0x%.4x]", $lo [$page] + $slice); } plptex ($x, $y + $yoffset, 1., 0., 0.5, $cmdString); plptex ($x, $y - $yoffset, 1., 0., 0.5, "#$cmdString"); } $slice++; } } plschr (0., 1.0); # Page title plmtex (1.5, 0.5, 0.5, "t", $title [$page]); } # Demonstrate methods of getting the current fonts my $fci_old = plgfci(); my ($ifamily, $istyle, $iweight) = plgfont(); 1; printf("For example 23 prior to page 12 the FCI is 0x%x\n",$fci_old); printf("For example 23 prior to page 12 the font family, style and weight are %s %s %s\n", $family[$ifamily], $style[$istyle], $weight[$iweight]); for (my $page=11; $page<16; $page++) { my $dy = 0.030; pladv(0); plvpor(0.02, 0.98, 0.02, 0.90); plwind(0.0, 1.0, 0.0, 1.0); plsfci(0); if($page == 11) { plmtex(1.5, 0.5, 0.5, "t", "#<0x10>PLplot Example 23 - Set Font with plsfci"); } elsif($page == 12) { plmtex(1.5, 0.5, 0.5, "t", "#<0x10>PLplot Example 23 - Set Font with plsfont"); } elsif($page == 13) { plmtex(1.5, 0.5, 0.5, "t", "#<0x10>PLplot Example 23 - Set Font with ##<0x8nnnnnnn> construct"); } elsif($page == 14) { plmtex(1.5, 0.5, 0.5, "t", "#<0x10>PLplot Example 23 - Set Font with ##<0xmn> constructs"); } elsif($page == 15) { plmtex(1.5, 0.5, 0.5, "t", "#<0x10>PLplot Example 23 - Set Font with ## constructs"); } plschr(0., 0.75); for (my $i=0; $i < FCI_COMBINATIONS; $i++) { my $family_index = $i % 5; my $style_index = ($i/5) % 3; my $weight_index = int(int($i/5)/3) % 2; my $string = ''; if ($page == 11) { plsfci($fci[$i]); $string = sprintf( "Page 12, %s, %s, %s: The quick brown fox jumps over the lazy dog", $family[$family_index], $style[$style_index], $weight[$weight_index]); } elsif($page == 12) { plsfont($family_index, $style_index, $weight_index); $string = sprintf( "Page 13, %s, %s, %s: The quick brown fox jumps over the lazy dog", $family[$family_index], $style[$style_index], $weight[$weight_index]); } elsif($page == 13) { $string = sprintf( "Page 14, %s, %s, %s: #<0x%x>The quick brown fox jumps over the lazy dog", $family[$family_index], $style[$style_index], $weight[$weight_index], $fci[$i]); } elsif($page == 14) { $string = sprintf( "Page 15, %s, %s, %s: #<0x%1x0>#<0x%1x1>#<0x%1x2>The quick brown fox jumps over the lazy dog", $family[$family_index], $style[$style_index], $weight[$weight_index], $family_index, $style_index, $weight_index); } elsif($page == 15) { $string = sprintf( "Page 16, %s, %s, %s: #<%s/>#<%s/>#<%s/>The quick brown fox jumps over the lazy dog", $family[$family_index], $style[$style_index], $weight[$weight_index], $family[$family_index], $style[$style_index], $weight[$weight_index]); } plptex (0, 1 - ($i+0.5)*$dy, 1, 0, 0, $string); } plschr(0, 1.0); } # Restore defaults plcol0 (1); plend (); plplot-5.10.0+dfsg/examples/perl/x02.pl 755 1750 1750 664712102122103 164560ustar andrewandrew#! /usr/bin/env perl # # Demo x02 for the PLplot PDL binding # # Multiple window and color map 0 demo # (inspired from t/x02.t of module Graphics::PLplot, by Tim Jenness) # # Copyright (C) 2004 Rafael Laboissiere # 2008 Doug Hunt -- Added working, more PDL-ish demo2 # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use PDL; use PDL::Graphics::PLplot; sub main { # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialise plplot plinit (); # Run demos demo1(); demo2(); plend(); } #-------------------------------------------------------------------------- # demo1 # # Demonstrates multiple windows and default color map 0 palette. #-------------------------------------------------------------------------- sub demo1 { plbop(); # Divide screen into 16 regions plssub(4, 4); draw_windows( 16, 0 ); pleop(); } #-------------------------------------------------------------------------- # demo2 # # Demonstrates multiple windows, user-modified color map 0 palette, and # HLS -> RGB translation. #-------------------------------------------------------------------------- sub demo2 { # Set up cmap0 # Use 100 custom colors in addition to base 16 # Min & max lightness values my $lmin = 0.15; my $lmax = 0.85; plbop(); # Divide screen into 100 regions plssub(10, 10); my $basemap = sequence(16); my $custmap = sequence(100); my ($r, $g, $b) = plgcol0($basemap); my $h = (360/10) * ($custmap % 10); my $s = ones(100); my $l = $lmin + ($lmax - $lmin) * ($custmap / 10)->floor / 9; my ($r1, $g1, $b1) = plhlsrgb($h, $l, $s); $r = $r->append($r1*255.001); $g = $g->append($g1*255.001); $b = $b->append($b1*255.001); #for ($i = 0; $i < 116; $i++) { # printf("%3.0f %3.0f %3.0f %3.0f \n", $i, $r->at($i), $g->at($i), $b->at($i)); #} # Now set cmap0 all at once (faster, since fewer driver calls) plscmap0($r, $g, $b); draw_windows( 100, 16 ); pleop(); } #-------------------------------------------------------------------------- # draw_windows # # Draws a set of numbered boxes with colors according to cmap0 entry. #-------------------------------------------------------------------------- sub draw_windows { my ($nw, $cmap_offset) = @_; plschr(0.0, 3.5); plfont(4); for (my $i = 0; $i < $nw; $i++) { plcol0($i+$cmap_offset); my $text = $i; pladv(0); my $vmin = 0.1; my $vmax = 0.9; for (my $j = 0; $j <= 2; $j++) { plwidth($j + 1); plvpor($vmin, $vmax, $vmin, $vmax); plwind(0.0, 1.0, 0.0, 1.0); plbox(0,0,0,0,"bc","bc"); $vmin += 0.1; $vmax -= 0.1; } plwidth(1); plptex(0.5, 0.5, 1.0, 0.0, 0.5, $text); } } main(); plplot-5.10.0+dfsg/examples/perl/x20.pl 755 1750 1750 2037011543675237 165200ustar andrewandrew#! /usr/bin/env perl # # Demo x20 for the PLplot PDL binding # # plimage demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x20c.c 1.16 use PDL; use PDL::Graphics::PLplot; use PDL::IO::Pnm; use Math::Trig qw [pi]; use Getopt::Long qw(:config pass_through); use Text::Wrap; $Text::Wrap::columns = 72; use constant XDIM => 260; use constant YDIM => 220; sub main { my $dbg = 0; my $nosombrero = 0; my $nointeractive = 0; my $f_name = ""; GetOptions ("dbg" => \$dbg, "nosombrero" => \$nosombrero, "nointeractive" => \$nointeractive, "save=s" => \$f_name, "help" => \$help); if ($help) { print (<slice (":," . (YDIM - 1)) .= 1; # right $z->slice (":,0") .= 1; # left $z->slice ("0,:") .= 1; # top $z->slice ((XDIM - 1) . ",:") .= 1; # botton pllab ("...around a blue square."," ","A red border should appear..."); plimage ($z, 1, XDIM, 1, YDIM, 0, 0, 1, XDIM, 1, YDIM); } # sombrero-like demo if (not $nosombrero) { plcol0 (2); # draw a yellow plot box, useful for diagnostics! :( plenv (0., 2 * pi, 0, 3 * pi, 1, -1); my $x = (2 * pi * sequence (XDIM) / (XDIM - 1))->dummy (1, YDIM); my $y = (3 * pi * sequence (YDIM) / (YDIM - 1))->dummy (0, XDIM);; my $r = sqrt ($x ** 2 + $y ** 2) + 1e-3; my $z = sin ($r) / ($r); pllab ("No, an amplitude clipped \"sombrero\"", "", "Saturn?"); plptex (2, 2, 3, 4, 0, "Transparent image"); plimage ($z, 0, 2 * pi, 0, 3 * pi, 0.05, 1, 0, 2 * pi, 0, 3 * pi); # save the plot save_plot ($f_name) if $f_name; } # read Lena image my $lena = "lena.pgm"; my ($img_f, $width, $height, $num_col) = read_img ($lena); if ($width == 0 && $height == 0) { my $lena = "../lena.pgm"; ($img_f, $width, $height, $num_col) = read_img ($lena); if ($width == 0 && $height == 0) { die "Cannot find image file $lena"; } } # set gray colormap gray_cmap ($num_col); # display Lena plenv (1, $width, 1, $height, 1, -1); pllab (((not $nointeractive) ? "Set and drag Button 1 to (re)set selection, Button 2 to finish." : ""), " ", "Lena..."); plimage ($img_f, 1, $width, 1, $height, 0, 0, 1, $width, 1, $height); # selection/expansion demo if (not $nointeractive) { $xi = 200; $xe = 330; $yi = 280; $ye = 220; if (get_clip (\$xi, \$xe, \$yi, \$ye)) { # get selection rectangle plend (); exit (0); } plspause (0); pladv (0); # display selection only plimage ($img_f, 1, $width, 1, $height, 0, 0, $xi, $xe, $ye, $yi); plspause (1); # zoom in selection plenv ($xi, $xe, $ye, $yi, 1, -1); plimage ($img_f, 1, $width, 1, $height, 0, 0, $xi, $xe, $ye, $yi); } # Base the dynamic range on the image contents. my ($img_min, $img_max) = $img_f->minmax; # Draw a saturated version of the original image. Only use the middle 50% # of the image's full dynamic range. plcol0(2); plenv(0, $width, 0, $height, 1, -1); pllab("", "", "Reduced dynamic range image example"); plimagefr($img_f, 0, $width, 0, $height, 0, 0, $img_min + $img_max * 0.25, $img_max - $img_max * 0.25, 0, 0); # Draw a distorted version of the original image, showing its full dynamic range. plenv(0, $width, 0, $height, 1, -1); pllab("", "", "Distorted image example"); my $stretch = [0, $width, 0, $height, 0.5]; # both xmap and ymap are 2D my ($xmap, $ymap) = mypltr(sequence($width+1), sequence($height+1), $stretch); my $grid = plAlloc2dGrid ($xmap, $ymap); # set of 2 2D maps plimagefr($img_f, 0, $width, 0, $height, 0, 0, $img_min, $img_max, \&pltr2, $grid); plFree2dGrid ($grid); plend (); } # set up 2D transformation matrices sub mypltr { my ($x, $y, $stretch) = @_; # pdl, pdl, listref my $pi = atan2(1,1)*4; my $x0 = ($stretch->[0] + $stretch->[1])*0.5; my $y0 = ($stretch->[2] + $stretch->[3])*0.5; my $dy = ($stretch->[3] - $stretch->[2])*0.5; my $result0 = $x0 + outer(($x0-$x),(1.0 - $stretch->[4]*cos(($y-$y0)/$dy*$pi*0.5))); my $result1 = outer(ones($x->nelem),$y); return ($result0, $result1); } # set gray colormap sub gray_cmap { my $num_col = shift; my $r = pdl [0, 1]; my $g = pdl [0, 1]; my $b = pdl [0, 1]; my $pos = pdl [0, 1]; plscmap1n ($num_col); plscmap1l (1, $pos, $r, $g, $b, pdl ([])); } # read image from file in PGN format sub read_img { my $fname = shift; if (-r $fname) { my $img = rpnm ($fname); # We want the number of colours from the header, not the maximum # colour. We can't get this via PDL, so hard code it to 255. #return ($img, $img->dims (), $img->max); return ($img, $img->dims (), 255); } else { return (0,0,0,0); } } # Get selection square interactively sub get_clip { my ($xi, $xe, $yi, $ye) = @_; my $xxi = $$xi; my $yyi = $$yi; my $xxe = $$xe; my $yye = $$ye; my $start = 0; my $st = plxormod (1); # enter xor mode to draw a selection rectangle if ($st) { # driver has xormod capability, continue my $sx = zeroes (5); my $sy = zeroes (5); while (1) { plxormod (0); my %gin = plGetCursor (); plxormod (1); if ($gin{button} == 1) { $xxi = $gin{wX}; $yyi = $gin{wY}; plline ($sx, $sy) # clear previous rectangle if $start; $start = 0; $sx->index (0) .= $xxi; $sy->index (0) .= $yyi; $sx->index (4) .= $xxi; $sy->index (4) .= $yyi; } if ($gin{state} & 0x100) { $xxe = $gin{wX}; $yye = $gin{wY}; plline ($sx, $sy) # clear previous rectangle if ($start); $start = 1; $sx->index (1) .= $xxe; $sx->index (2) .= $xxe; $sx->index (3) .= $xxi; $sy->index (1) .= $yyi; $sy->index (2) .= $yye; $sy->index (3) .= $yye; plline ($sx, $sy); # draw new rectangle } if ($gin{button} == 3 or $gin{keysym} == PLK_Return or $gin{keysym} eq 'Q') { plline ($sx, $sy) # clear previous rectangle if ($start); last; } } plxormod (0); # leave xor mod if ($xxe < $xxi) { my $t = $xxi; $xxi = $xxe; $xxe = $t; } if ($yyi < $yye) { my $t = $yyi; $yyi = $yye; $yye = $t; } $$xe = $xxe; $$xi = $xxi; $$ye = $yye; $$yi = $yyi; return ($gin{keysym} eq 'Q'); } return 0; } # save plot sub save_plot { my $fname = shift; my $cur_strm = plgstrm (); # get current stream my $new_strm = plmkstrm (); # create a new one plsdev ("psc"); # new device type. Use a known existing driver plsfnam ($fname); # file name plcpstrm ($cur_strm, 0); # copy old stream parameters to new stream plreplot (); # do the save plend1 (); # close new device plsstrm ($cur_strm); # and return to previous one } main (); plplot-5.10.0+dfsg/examples/perl/x17.pl 755 1750 1750 763411543675237 165160ustar andrewandrew#! /usr/bin/env perl # # Demo x17 for the PLplot PDL binding # # Plots a simple stripchart with four pens # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x17c.c 1.16 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Time::HiRes qw [usleep]; my $nsteps = 1000; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # If db is used the plot is much more smooth. However, because of the # async X behaviour, one does not have a real-time scripcharter. # plsetopt ("db", ""); # plsetopt ("np", ""); # User sets up plot completely except for window and data # Eventually settings in place when strip chart is created will be # remembered so that multiple strip charts can be used simultaneously. # Specify some reasonable defaults for ymin and ymax # The plot will grow automatically if needed (but not shrink) my $ymin = -0.1; my $ymax = 0.1; # Specify initial tmin and tmax -- this determines length of window. # Also specify maximum jump in t # This can accomodate adaptive timesteps my $tmin = 0.; my $tmax = 10.; my $tjump = 0.3; # percentage of plot to jump # Axes options same as plbox. # Only automatic tick generation and label placement allowed # Eventually I'll make this fancier my $colbox = 1; my $collab = 3; # pens color and line style my $styline = sequence (4) + 2; my $colline = $styline; # pens legend my @legline = ("sum", "sin","sin*noi", "sin+noi"); # legend position my $xlab = 0.; my $ylab = 0.25; my $autoy = 1; # autoscale y my $acc = 1; # don't scrip, accumulate # Initialize plplot plinit (); pladv (0); plvsta (); # Register our error variables with PLplot # From here on, we're handling all errors here # N.B : plsError is not implement in the PErlDL binding # plsError (&pl_errcode, errmsg); my $id1 = plstripc ($tmin, $tmax, $tjump, $ymin, $ymax, $xlab, $ylab, $autoy, $acc, $colbox, $collab, $colline, $styline, "bcnst", "bcnstv", \@legline, "t", "", "Strip chart demo"); # N.B : plsError is not implement in the PErlDL binding # if (pl_errcode) { # fprintf(stderr, "%s\n", errmsg); # exit(1); # } # N.B : plsError is not implement in the PerlDL binding # Let plplot handle errors from here on # plsError(NULL, NULL); $autoy = 0; # autoscale y $acc = 1; # accumulate # This is to represent a loop over time # Let's try a random walk process my $y1 = my $y2 = my $y3 = my $y4 = 0.0; my $dt = 0.1; for (my $n = 0; $n < $nsteps; $n++) { usleep (10000); # wait a little (10 ms) to simulate time elapsing my $t = $n * $dt; $noise = plrandd () - 0.5; $y1 = $y1 + $noise; $y2 = sin ($t * pi / 18); $y3 = $y2 * $noise; $y4 = $y2 + $noise / 3; # There is no need for all pens to have the same number of # points or beeing equally time spaced. if ($n % 2) { plstripa ($id1, 0, $t, $y1); } if ($n % 3) { plstripa ($id1, 1, $t, $y2); } if ($n % 4) { plstripa ($id1, 2, $t, $y3); } if ($n % 5) { plstripa ($id1, 3, $t, $y4); } # pleop (); # use double buffer (-db on command line) } # Destroy strip chart and it's memory plstripd ($id1); plend (); plplot-5.10.0+dfsg/examples/perl/x18.pl 755 1750 1750 655311556633724 165150ustar andrewandrew#! /usr/bin/env perl # # Demo x18 for the PLplot PDL binding # # 3-d line and point plot demo. # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x18c.c 1.21 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; my @opt = (1, 0, 1, 0); my @alt = (20.0, 35.0, 50.0, 65.0); my @az = (30.0, 40.0, 50.0, 60.0); sub test_poly { my $k = shift; my $draw = pdl ([ 1, 1, 1, 1 ], [ 1, 0, 1, 0 ], [ 0, 1, 0, 1 ], [ 1, 1, 0, 0 ]); my $two_pi = 2 * pi; pladv (0); plvpor (0.0, 1.0, 0.0, 0.9); plwind (-1.0, 1.0, -0.9, 1.1); plcol0 (1); plw3d (1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, $alt[$k], $az[$k]); plbox3 (0.0, 0, 0.0, 0, 0.0, 0, "bnstu", "x axis", "bnstu", "y axis", "bcdmnstuv", "z axis"); plcol0 (2); # x = r sin(phi) cos(theta) # y = r sin(phi) sin(theta) # z = r cos(phi) # r = 1 :=) print $draw[0]; for (my $i = 0; $i < 20; $i++ ) { my $theta = $two_pi * ($i + pdl [0, 0, 1, 1, 0]) / 20.; for (my $j = 0; $j < 20; $j++ ) { my $phi = pi * ($j + pdl [0, 1, 1, 0, 0]) / 20.1; my $x = sin ($phi) * cos ($theta); my $y = sin ($phi) * sin ($theta); my $z = cos ($phi); plpoly3 ($x, $y, $z, $draw->slice(",$k")->squeeze, 1); } } plcol0 (3); plmtex (1.0, 0.5, 0.5, "t", "unit radius sphere"); } #-------------------------------------------------------------------------- # main # Does a series of 3-d plots for a given data set, with different # viewing options in each plot. #-------------------------------------------------------------------------- use constant NPTS => 1000; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); # Initialize plplot plinit (); for (my $k = 0; $k < 4; $k++) { test_poly ($k); } # From the mind of a sick and twisted physicist... my $i = sequence (NPTS); my $z = -1. + 2. * $i / NPTS; # Pick one ... my $r = $z; my $x = $r * cos (2 * pi * 6 * $i / NPTS); my $y = $r * sin (2 * pi * 6 * $i / NPTS ); for ($k = 0; $k < 4; $k++) { pladv (0); plvpor (0.0, 1.0, 0.0, 0.9); plwind (-1.0, 1.0, -0.9, 1.1); plcol0 (1); plw3d (1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, $alt[$k], $az[$k]); plbox3 (0.0, 0, 0.0, 0, 0.0, 0, "bnstu", "x axis", "bnstu", "y axis", "bcdmnstuv", "z axis"); plcol0 (2); if ($opt[$k]) { plline3 ($x, $y, $z); } else { # plpoin3 ($x, $y, $z, 1); # U+22C5 DOT OPERATOR. plstring3($x, $y, $z, "⋅" ); } plcol0 (3); $title = sprintf ("#frPLplot Example 18 - Alt=%.0f, Az=%.0f", $alt[$k], $az[$k]); plmtex (1.0, 0.5, 0.5, "t", $title); } plend (); plplot-5.10.0+dfsg/examples/perl/x33.pl 755 1750 1750 7312311556674674 165400ustar andrewandrew#! /usr/bin/env perl # -*- coding: utf-8; -*- # # $Id: x33.pl 11731 2011-04-30 02:53:48Z airwin $ # # Demonstrate most pllegend capability including unicode symbols. # # Copyright (C) 2010 Alan Irwin # Perl/PDL translation Copyright (C) 2011 Doug Hunt # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # This example designed just for devices (e.g., the cairo-related and # qt-related devices) where the best choice of glyph is automatically # selected by the related libraries (pango/cairo or Qt4) for each # unicode character depending on what system fonts are installed. Of # course, you must have the appropriate TrueType fonts installed to # have access to all the required glyphs. use PDL; use PDL::Graphics::PLplot; use Getopt::Long qw [:config pass_through]; my @position_options = ( PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_INSIDE, ); # Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). my @special_symbols = ( "✰", "✴", "✱", "✽", "✦", ); # plcolorbar options # Colorbar type options my @colorbar_option_kinds = ( PL_COLORBAR_SHADE, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT, ); my @colorbar_option_kind_labels = ( "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars", ); # Which side of the page are we positioned relative to? my @colorbar_position_options = ( PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM, ); my @colorbar_position_option_labels = ( "Left", "Right", "Top", "Bottom", ); # Colorbar label positioning options my @colorbar_label_options = ( PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM, ); my @colorbar_label_option_labels = ( "Label left", "Label right", "Label top", "Label bottom", ); # Colorbar cap options my @colorbar_cap_options = ( PL_COLORBAR_CAP_NONE, PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH, ); my @colorbar_cap_option_labels = ( "No caps", "Low cap", "High cap", "Low and high caps", ); my $colorbar = 0; # By default do not plot plcolorbar pages # for now while we are working out the API. GetOptions ("colorbar" => \$colorbar, "help" => \$help); if ($help) { print (< 7; use constant NULL => 0; plParseOpts(\@ARGV, PL_PARSE_FULL); # Initialize plplot plinit(); # First page illustrating the 16 standard positions. pladv( 0 ); plvpor( 0.25, 0.75, 0.25, 0.75 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( 0.0, 0, 0.0, 0, "bc", "bc" ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( 8.0, 0.5, 0.5, "t", "The 16 standard legend positions with" ); plmtex( 6.0, 0.5, 0.5, "t", "the same (0.05) offset in x and y" ); my $nlegend = 1; # Only specify legend data that are required according to the # value of opt_array for that entry. my $opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; my (@opt_array, @line_styles, @line_widths, @symbol_scales, @symbol_numbers, @symbols, @text, @text_colors, @line_colors, @symbol_colors); $opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; $line_styles[0] = 1; $line_widths[0] = 1; $symbol_scales[0] = 1.; $symbol_numbers[0] = 4; $symbols[0] = "*"; # Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); for ( $k = 0; $k < 16; $k++ ) { $position = $position_options[$k]; $opt = $opt_base; $text[0] = sprintf( "%2.2d", $k ); $text_colors[0] = 1 + ( $k % 8 ); $line_colors[0] = 1 + ( $k % 8 ); $symbol_colors[0] = 1 + ( $k % 8 ); my ($legend_width, $legend_height) = pllegend($opt, $position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); } # Second page illustrating effect of nrow, ncolumn for the same legend # data.; pladv( 0 ); plvpor( 0.25, 0.75, 0.25, 0.75 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plbox( 0.0, 0, 0.0, 0, "bc", "bc" ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( 8.0, 0.5, 0.5, "t", "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR," ); plmtex( 6.0, 0.5, 0.5, "t", "and position for the same legend data" ); $nlegend = 7; # Only specify legend data that are required according to the # value of opt_array for that entry. my $opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; for ( my $k = 0; $k < $nlegend; $k++ ) { $opt_array[$k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; $line_styles[$k] = 1; $line_widths[$k] = 1; $symbol_scales[$k] = 1.; $symbol_numbers[$k]= 2; $symbols[$k] = "*"; $text[$k] = sprintf("%2.2d", $k ); $text_colors[$k] = 1 + ( $k % 8 ); $line_colors[$k] = 1 + ( $k % 8 ); $symbol_colors[$k] = 1 + ( $k % 8 ); } # Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); $position = PL_POSITION_TOP | PL_POSITION_OUTSIDE; $opt = $opt_base; $x = 0.; $y = 0.1; $nrow = 1; $ncolumn = $nlegend; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE; $opt = $opt_base; $x = 0.; $y = 0.1; $nrow = 1; $ncolumn = $nlegend; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE; $opt = $opt_base; $x = 0.1; $y = 0.; $nrow = $nlegend; $ncolumn = 1; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE; $opt = $opt_base; $x = 0.1; $y = 0.; $nrow = $nlegend; $ncolumn = 1; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE; $opt = $opt_base; $x = 0.; $y = 0.; $nrow = 6; $ncolumn = 2; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE; $opt = $opt_base | PL_LEGEND_ROW_MAJOR; $x = 0.; $y = 0.; $nrow = 6; $ncolumn = 2; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE; $opt = $opt_base | PL_LEGEND_ROW_MAJOR; $x = 0.; $y = 0.; $nrow = 3; $ncolumn = 3; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.05, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 2.0, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); # Third page demonstrating legend alignment pladv( 0 ); plvpor( 0.0, 1.0, 0.0, 0.9 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( 2.0, 0.5, 0.5, "t", "Demonstrate legend alignment" ); $x = 0.1; $y = 0.1; $nturn = 4; $nlegend = 0; $position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE; $opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; $opt = $opt_base; for ( $i = 0; $i < 9; $i++ ) { # Set up legend arrays with the correct size, type. if ( $i <= $nturn ) { $nlegend += 1; } else { $nlegend -= 1; } $nlegend = pdl( 1, $nlegend )->max; # nly specify legend data that are required according to the # value of opt_array for that entry. for ( $k = 0; $k < $nlegend; $k++ ) { $opt_array[$k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; $line_styles[$k] = 1; $line_widths[$k] = 1; $symbol_scales[$k] = 1.; $symbol_numbers[$k] = 2; $symbols[$k] = "*"; $text[$k] = sprintf ("%2.2d", $k ); $text_colors[$k] = 1 + ( $k % 8 ); $line_colors[$k] = 1 + ( $k % 8 ); $symbol_colors[$k] = 1 + ( $k % 8 ); } # Use monotype fonts so that all legends are the same size. plsfont( PL_FCI_MONO, -1, -1 ); plscol0a( 15, 32, 32, 32, 0.70 ); $nrow = pdl( 3, $nlegend )->min; $ncolumn = 0; my ($legend_width, $legend_height) = pllegend($opt, $position, $x, $y, 0.025, 15, 1, 1, $nrow, $ncolumn, $nlegend, \@opt_array, 1.0, 1.0, 1.5, 1., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); if ( $i == $nturn ) { $position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE; $opt = $opt_base; $x = 1. - $x; $y += $legend_height; } else { $x += $legend_width; $y += $legend_height; } } # Fourth page illustrating various kinds of legends $max_height = 0.; $xstart = 0.0; $ystart = 0.1; $x = $xstart; $y = $ystart; $text_scale = 0.90; pladv( 0 ); plvpor( 0.0, 1., 0.0, 0.90 ); plwind( 0.0, 1.0, 0.0, 1.0 ); plsfont( PL_FCI_SANS, -1, -1 ); plmtex( 2.0, 0.5, 0.5, "t", "Demonstrate Various Kinds of Legends" ); $nlegend = 5; # Only specify legend data that are required according to the # value of opt_array for that entry. $position = PL_POSITION_LEFT | PL_POSITION_TOP; $opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT; # Set up None, Box, Line, Symbol, and Line & Symbol legend entries. $opt_array[0] = PL_LEGEND_NONE; $text[0] = sprintf( "%s", "None" ); $text_colors[0] = 1; $opt_array[1] = PL_LEGEND_COLOR_BOX; $text[1] = sprintf( "%s", "Box" ); $text_colors[1] = 2; $box_colors[1] = 2; $box_patterns[1] = 0; $box_scales[1] = 0.8; $box_line_widths[1] = 1; $opt_array[2] = PL_LEGEND_LINE; $text[2] = sprintf( "%s", "Line" ); $text_colors[2] = 3; $line_colors[2] = 3; $line_styles[2] = 1; $line_widths[2] = 1; $opt_array[3] = PL_LEGEND_SYMBOL; $text[3] = sprintf( "%s", "Symbol" ); $text_colors[3] = 4; $symbol_colors[3] = 4; $symbol_scales[3] = $text_scale; $symbol_numbers[3] = 4; $symbols[3] = $special_symbols[2]; $opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE; $text[4] = sprintf( "%s", "L & S" ); $text_colors[4] = 5; $line_colors[4] = 5; $line_styles[4] = 1; $line_widths[4] = 1; $symbol_colors[4] = 5; $symbol_scales[4] = $text_scale; $symbol_numbers[4] = 4; $symbols[4] = $special_symbols[2]; $opt = $opt_base; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, \@box_colors, \@box_patterns, \@box_scales, \@box_line_widths, \@line_colors, \@line_styles, \@line_widths, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $max_height = pdl( $max_height, $legend_height )->max; # Set up symbol legend entries with various symbols. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_SYMBOL; $text[$i] = sprintf( "%s%s", "Symbol ", $special_symbols[$i] ); $text_colors[$i] = $i + 1; $symbol_colors[$i] = $i + 1; $symbol_scales[$i] = $text_scale; $symbol_numbers[$i] = 4; $symbols[$i] = $special_symbols[$i]; } $opt = $opt_base; $x += $legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $max_height = pdl( $max_height, $legend_height )->max; # Set up symbol legend entries with various numbers of symbols. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_SYMBOL; $text[$i] = sprintf( "%s %d", "Symbol Number", $i + 2 ); $text_colors[$i] = $i + 1; $symbol_colors[$i] = $i + 1; $symbol_scales[$i] = $text_scale; $symbol_numbers[$i] = $i + 2; $symbols[$i] = $special_symbols[2]; } $opt = $opt_base; $x += $legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \@symbol_colors, \@symbol_scales, \@symbol_numbers, \@symbols ); $max_height = pdl( $max_height, $legend_height )->max; # Set up box legend entries with various colours. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_COLOR_BOX; $text[$i] = sprintf( "%s %d", "Box Color", $i + 1 ); $text_colors[$i] = $i + 1; $box_colors[$i] = $i + 1; $box_patterns[$i] = 0; $box_scales[$i] = 0.8; $box_line_widths[$i] = 1; } $opt = $opt_base; # Use new origin $x = $xstart; $y += $max_height; $max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, \@box_colors, \@box_patterns, \@box_scales, \@box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); $max_height = pdl( $max_height, $legend_height )->max; # Set up box legend entries with various patterns. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_COLOR_BOX; $text[$i] = sprintf( "%s %d", "Box Pattern", $i ); $text_colors[$i] = 2; $box_colors[$i] = 2; $box_patterns[$i] = $i; $box_scales[$i] = 0.8; $box_line_widths[$i] = 1; } $opt = $opt_base; $x += $legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, \@box_colors, \@box_patterns, \@box_scales, \@box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); $max_height = pdl( $max_height, $legend_height )->max; # Set up box legend entries with various box pattern line widths. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_COLOR_BOX; $text[$i] = sprintf( "%s %d", "Box Line Width", $i + 1 ); $text_colors[$i] = 2; $box_colors[$i] = 2; $box_patterns[$i] = 3; $box_scales[$i] = 0.8; $box_line_widths[$i] = $i + 1; } $opt = $opt_base; $x += $legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, \@box_colors, \@box_patterns, \@box_scales, \@box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); $max_height = pdl( $max_height, $legend_height )->max; # Set up line legend entries with various colours. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_LINE; $text[$i] = sprintf( "%s %d", "Line Color", $i + 1 ); $text_colors[$i] = $i + 1; $line_colors[$i] = $i + 1; $line_styles[$i] = 1; $line_widths[$i] = 1; } $opt = $opt_base; # Use new origin $x = $xstart; $y += $max_height; $max_height = 0.; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, NULL, NULL, NULL, NULL ); $max_height = pdl( $max_height, $legend_height )->max; # Set up line legend entries with various styles. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_LINE; $text[$i] = sprintf( "%s %d", "Line Style", $i + 1 ); $text_colors[$i] = 2; $line_colors[$i] = 2; $line_styles[$i] = $i + 1; $line_widths[$i] = 1; } $opt = $opt_base; $x += $legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, NULL, NULL, NULL, NULL ); $max_height = pdl( $max_height, $legend_height )->max; # Set up line legend entries with various widths. for ( $i = 0; $i < $nlegend; $i++ ) { $opt_array[$i] = PL_LEGEND_LINE; $text[$i] = sprintf( "%s %d", "Line Width", $i + 1 ); $text_colors[$i] = 2; $line_colors[$i] = 2; $line_styles[$i] = 1; $line_widths[$i] = $i + 1; } $opt = $opt_base; $x += $legend_width; plscol0a( 15, 32, 32, 32, 0.70 ); my ($legend_width, $legend_height) = pllegend ( $opt, $position, $x, $y, 0.1, 15, 1, 1, 0, 0, $nlegend, \@opt_array, 1.0, $text_scale, 2.0, 0., \@text_colors, \@text, NULL, NULL, NULL, NULL, \@line_colors, \@line_styles, \@line_widths, NULL, NULL, NULL, NULL ); $max_height = pdl( $max_height, $legend_height )->max; plend(); exit; ### if ( colorbar ) ### { ### # Color bar examples ### PLFLT values_small[2] = { 0.0, 1.0 }; ### PLFLT values_uneven[9] = { 0.0, 2.0, 2.6, 3.4, 6.0, 7.0, 8.0, 9.0, 10.0 }; ### PLFLT values_even[9] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 }; ### ### # Cut out the greatest and smallest bits of the color spectrum to ### # leave colors for the end caps. ### plscmap1_range( 0.01, 0.99 ); ### ### # We can only test image and gradient colorbars with two element arrays ### for ( i = 2; i < COLORBAR_KINDS; i ++ ) ### { ### plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); ### } ### # Test shade colorbars with larger arrays ### for ( i = 0; i < 2; i++ ) ### { ### plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); ### } ### for ( i = 0; i < 2; i++ ) ### { ### plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); ### } ### } ### plend(); ### exit( 0 ); ###} ### ### ### void ###plcolorbar_example_page( int kind_i, int label_i, int cap_i, PLINT cont_color, PLINT cont_width, PLINT n_values, PLFLT *values ###) ###{ ### # Parameters for the colorbars on this page ### PLINT position_i, position, opt; ### PLFLT x, y, length, width; ### PLFLT ticks; ### PLINT sub_ticks; ### PLFLT low_cap_color, high_cap_color; ### PLINT vertical; ### const char *axis_opts; ### char label[200]; ### char title[200]; ### ### length = 0.5; ### width = 0.05; ### ### ticks = 0.0; ### sub_ticks = 0; ### ### low_cap_color = 0.0; ### high_cap_color = 1.0; ### ### # Start a new page ### pladv( 0 ); ### ### # Draw one colorbar relative to each side of the page ### for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i ++ ) ### { ### position = colorbar_position_options[position_i]; ### opt = ### colorbar_option_kinds[kind_i] | ### colorbar_label_options[label_i] | ### colorbar_cap_options[cap_i]; ### ### vertical = position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT; ### ### # Set the offset position on the page ### if ( vertical ) ### { ### x = 0.1; ### y = 0.25; ### } ### else ### { ### x = 0.25; ### y = 0.1; ### } ### ### # Set appropriate labeling options ### if ( opt & PL_COLORBAR_SHADE_LABEL ) ### { ### if ( vertical ) ### axis_opts = "iv"; ### else ### axis_opts = "i"; ### } ### else ### { ### if ( sub_ticks != 0 ) ### { ### if ( vertical ) ### axis_opts = "stv"; ### else ### axis_opts = "st"; ### } ### else ### { ### if ( vertical ) ### axis_opts = "tv"; ### else ### axis_opts = "t"; ### } ### } ### ### sprintf( label, "%s, %s", ### colorbar_position_option_labels[position_i], ### colorbar_label_option_labels[label_i] ); ### ### # Smaller text ### pl = schr( 0.0### plschr( 0.0, 0.75 ); ### # Small ticks on the vertical axis ### plsmaj( 0.0, 0.5 ); ### plsmin( 0.0, 0.5 ); ### ### plcolorbar( opt, position, ### x, y, length, width, ### low_cap_color, high_cap_color, ### cont_color, cont_width, ### ticks, sub_ticks, ### axis_opts, label, ### n_values, values ); ### ### # Reset 1.0 ); ### plsmaj( 0.0, 1.0 ); ### plsmin( 0.0, 1.0 ); ### } ### ### # Draw a page title ### sprintf( title, "%s - %s", ### colorbar_option_kind_labels[kind_i], ### colorbar_cap_option_labels[cap_i] ); ### plvpor( 0.0, 1.0, 0.0, 1.0 ); ### plwind( 0.0, 1.0, 0.0, 1.0 ); ### plptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); ###} ### ###void ###plcolorbar_example( const char *palette, int kind_i, PLINT cont_color, PLINT cont_width, PLINT n_values, PLFLT *values ) ###{ ### int label_i, cap_i; ### ### # Load the color palette ### plspal1( palette, 1 ); ### ### for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) ### { ### for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) ### { ### plcolorbar_example_page( kind_i, label_i, cap_i, ### cont_color, cont_width, ### n_values, values ); ### } ### } ###} ### plplot-5.10.0+dfsg/examples/perl/x08.pl 755 1750 1750 1032411543675237 165240ustar andrewandrew#! /usr/bin/env perl # # Demo x08 for the PLplot PDL binding # # 3-d plot demo # # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # SYNC: x08c.c 1.45 use PDL; use PDL::Graphics::PLplot; use Math::Trig qw [pi]; use Getopt::Long; use constant XPTS => 35; # Data points in x use constant YPTS => 46; # Data points in y use constant LEVELS => 10; @alt = (60.0, 20.0); @az = (30.0, 60.0); @title = ( "#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60" ); sub cmap1_init { my $gray = shift; my ($i, $h, $l, $s); $i = pdl [0.0, # left boundary 1.0]; # right boundary if ($gray) { $h = pdl [0.0, # hue -- low: red (arbitrary if s=0) 0.0]; # hue -- high: red (arbitrary if s=0) $l = pdl [0.5, # lightness -- low: half-dark 1.0]; # lightness -- high: light $s = pdl [0.0, # minimum saturation 0.0]; # minimum saturation } else { $h = pdl [240, # blue -> green -> yellow -> */ 0]; # -> red $l = pdl [0.6, 0.6]; $s = pdl [0.8, 0.8]; } plscmap1n (256); plscmap1l (0, $i, $h, $l, $s, pdl []); } my $LEVELS = 10; # Parse and process command line arguments plParseOpts (\@ARGV, PL_PARSE_SKIP | PL_PARSE_NOPROGRAM); GetOptions ("sombrero" => \$sombrero); my $nlevel = LEVELS; my $rosen = 1; $rosen = 0 if $sombrero; # Initialize plplot plinit (); my $x = (sequence (XPTS) - int(XPTS / 2)) / int(XPTS / 2); $x *= 1.5 if $rosen; my $y = (sequence (YPTS) - int(YPTS / 2)) / int(YPTS / 2); $y += 0.5 if $rosen; my $z = zeroes (XPTS, YPTS); my ($i, $j); for ($i = 0; $i < XPTS; $i++) { my $xx = $x->index ($i); for ($j = 0; $j < YPTS; $j++) { my $yy = $y->index ($j); my $zz; if ($rosen) { $zz = (1 - $xx) ** 2 + 100 * ($yy - ($xx ** 2)) ** 2; # The log argument may be zero for just the right grid. if ($zz > 0.) { $zz = log ($zz); } else { $zz = -5.; # -MAXFLOAT would mess-up up the scale } } else { $r = sqrt ($xx * $xx + $yy * $yy); $zz = exp (-$r * $r) * cos (2.0 * pi * $r); } $z->index ($i)->index ($j) .= $zz; } } my $zmin = min ($z); my $zmax = max ($z); my $step = ($zmax - $zmin) / ($nlevel + 1); my $clevel = $zmin + $step + $step * sequence ($nlevel); pllightsource (1., 1., 1.); for (my $k = 0; $k < 2; $k++) { for (my $ifshade = 0; $ifshade < 4; $ifshade++) { pladv (0); plvpor (0.0, 1.0, 0.0, 0.9); plwind (-1.0, 1.0, -0.9, 1.1); plcol0 (3); plmtex (1.0, 0.5, 0.5, "t", $title[$k]); plcol0(1); if ($rosen) { plw3d (1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, $zmin, $zmax, $alt[$k], $az[$k]); } else { plw3d (1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, $zmin, $zmax, $alt[$k], $az[$k]); } plbox3 (0.0, 0, 0.0, 0, 0.0, 0, "bnstu", "x axis", "bnstu", "y axis", "bcdmnstuv", "z axis"); plcol0 (2); if ($ifshade == 0) { # diffuse light surface plot cmap1_init (1); plsurf3d ($x, $y, $z, 0, pdl []); } elsif ($ifshade == 1) { # magnitude colored plot cmap1_init (0); plsurf3d ($x, $y, $z, MAG_COLOR, pdl []); } elsif ($ifshade == 2) { # magnitude colored plot with faceted squares cmap1_init (0); plsurf3d ($x, $y, $z, MAG_COLOR | FACETED, pdl []); } else { # magnitude colored plot with contours cmap1_init (0); plsurf3d ($x, $y, $z, MAG_COLOR | SURF_CONT | BASE_CONT, $clevel); } } } plend (); plplot-5.10.0+dfsg/examples/java/ 775 1750 1750 012406243570 154145ustar andrewandrewplplot-5.10.0+dfsg/examples/java/x20.java 644 1750 1750 4040612033404504 167620ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x20.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004,2006 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 20 in Java. //-------------------------------------------------------------------------- // // Current user defined command line options are not supported in // the Java bindings // package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.io.*; import java.util.*; class x20 { // Class data PLStream pls = new PLStream(); static int XDIM = 260; static int YDIM = 220; static boolean dbg = false; static boolean nosombrero = false; static boolean nointeractive = false; static String f_name = null; //static PLOptionTable options[]; // PLOptionTable options[] = { // { // "dbg", /* extra debugging plot */ // NULL, // NULL, // &dbg, // PL_OPT_BOOL, // "-dbg", // "Extra debugging plot" }, // { // "nosombrero", /* Turns on test of xor function */ // NULL, // NULL, // &nosombrero, // PL_OPT_BOOL, // "-nosombrero", // "No sombrero plot" }, // { // "nointeractive", /* Turns on test of xor function */ // NULL, // NULL, // &nointeractive, // PL_OPT_BOOL, // "-nointeractive", // "No interactive selection" }, // { // "save", /* For saving in postscript */ // NULL, // NULL, // &f_name, // PL_OPT_STRING, // "-save filename", // "Save sombrero plot in color postscript `filename'" }, // { // NULL, /* option */ // NULL, /* handler */ // NULL, /* client data */ // NULL, /* address of variable to set */ // 0, /* mode flag */ // NULL, /* short syntax */ // NULL } /* long syntax */ // }; x20( String[] args ) { double x[] = new double[XDIM]; double y[] = new double[YDIM]; double z[][] = new double[XDIM][YDIM]; double r[][]; double xi[] = new double[1]; double yi[] = new double[1]; double xe[] = new double[1]; double ye[] = new double[1]; int i, j, width, height, num_col; int n[] = new int[1]; double img_f[][]; double img_min; double img_max; double maxmin[] = new double[2]; double x0, y0, dy, stretch; double xg[][], yg[][]; // // Bugs in plimage(): // -at high magnifications, the left and right edge are ragged, try // ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 // // Bugs in x20c.c: // -if the window is resized after a selection is made on "lena", when // making a new selection the old one will re-appear. // // plplot initialization // Parse and process command line arguments. //pls.MergeOpts(options, "x20c options", NULL); pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize PLplot. pls.init(); // view image border pixels if ( dbg ) { pls.env( 1., XDIM, 1., YDIM, 1, 1 ); // no plot box // build a one pixel square border, for diagnostics for ( i = 0; i < XDIM; i++ ) z[i][YDIM - 1] = 1.; // right for ( i = 0; i < XDIM; i++ ) z[i][0] = 1.; // left for ( i = 0; i < YDIM; i++ ) z[0][i] = 1.; // top for ( i = 0; i < YDIM; i++ ) z[XDIM - 1][i] = 1.; // botton pls.lab( "...around a blue square.", " ", "A red border should appear..." ); pls.image( z, 1., XDIM, 1., YDIM, 0., 0., 1., XDIM, 1., YDIM ); } // sombrero-like demo if ( !nosombrero ) { r = new double[XDIM][YDIM]; pls.col0( 2 ); // draw a yellow plot box, useful for diagnostics! :( pls.env( 0., 2. * Math.PI, 0, 3. * Math.PI, 1, -1 ); for ( i = 0; i < XDIM; i++ ) x[i] = i * 2. * Math.PI / ( XDIM - 1 ); for ( i = 0; i < YDIM; i++ ) y[i] = i * 3. * Math.PI / ( YDIM - 1 ); for ( i = 0; i < XDIM; i++ ) for ( j = 0; j < YDIM; j++ ) { r[i][j] = Math.sqrt( x[i] * x[i] + y[j] * y[j] ) + 1e-3; z[i][j] = Math.sin( r[i][j] ) / ( r[i][j] ); } pls.lab( "No, an amplitude clipped \"sombrero\"", "", "Saturn?" ); pls.ptex( 2., 2., 3., 4., 0., "Transparent image" ); pls.image( z, 0., 2. * Math.PI, 0., 3. * Math.PI, 0.05, 1., 0., 2. * Math.PI, 0., 3. * Math.PI ); // save the plot if ( f_name != null ) save_plot( f_name ); } // read Lena image if ( ( img_f = read_img( "lena.pgm", n ) ) == null ) { if ( ( img_f = read_img( "../lena.pgm", n ) ) == null ) { System.out.println( "File error - aborting" ); pls.end(); System.exit( 1 ); } } num_col = n[0]; width = img_f.length; height = img_f[0].length; // set gray colormap gray_cmap( num_col ); // display Lena pls.env( 1., width, 1., height, 1, -1 ); if ( !nointeractive ) pls.lab( "Set and drag Button 1 to (re)set selection, Button 2 to finish.", " ", "Lena..." ); else pls.lab( "", " ", "Lena..." ); pls.image( img_f, 1., width, 1., height, 0., 0., 1., width, 1., height ); // selection/expansion demo if ( !nointeractive ) { xi[0] = 200.; xe[0] = 330.; yi[0] = 280.; ye[0] = 220.; if ( get_clip( xi, xe, yi, ye ) ) // get selection rectangle { pls.end(); System.exit( 0 ); } // // I'm unable to continue, clearing the plot and advancing to the next // one, without hiting the enter key, or pressing the button... help! // // Forcing the xwin driver to leave locate mode and destroying the // xhairs (in GetCursorCmd()) solves some problems, but I still have // to press the enter key or press Button-2 to go to next plot, even // if a pladv() is not present! Using plbop() solves the problem, but // it shouldn't be needed! // // pls.bop(); // // spause(false), adv(0), spause(true), also works, // but the above question remains. // With this approach, the previous pause state is lost, // as there is no API call to get its current state. // pls.spause( false ); pls.adv( 0 ); // display selection only pls.image( img_f, 1., width, 1., height, 0., 0., xi[0], xe[0], ye[0], yi[0] ); pls.spause( true ); // zoom in selection pls.env( xi[0], xe[0], ye[0], yi[0], 1, -1 ); pls.image( img_f, 1., width, 1., height, 0., 0., xi[0], xe[0], ye[0], yi[0] ); } // Base the dynamic range on the image contents. f2mnmx( img_f, width, height, maxmin ); img_max = maxmin[0]; img_min = maxmin[1]; // For java we use 2-d arrays to replace the pltr function // even for the NULL case. xg = new double[width + 1][height + 1]; yg = new double[width + 1][height + 1]; for ( i = 0; i <= width; i++ ) { for ( j = 0; j <= height; j++ ) { xg[i][j] = i; yg[i][j] = j; } } // Draw a saturated version of the original image. Only use // the middle 50% of the image's full dynamic range. pls.col0( 2 ); pls.env( 0, width, 0, height, 1, -1 ); pls.lab( "", "", "Reduced dynamic range image example" ); pls.imagefr( img_f, 0., width, 0., height, 0., 0., img_min + img_max * 0.25, img_max - img_max * 0.25, xg, yg ); // Draw a distorted version of the original image, showing its full dynamic range. pls.env( 0, width, 0, height, 1, -1 ); pls.lab( "", "", "Distorted image example" ); x0 = 0.5 * width; y0 = 0.5 * height; dy = 0.5 * height; stretch = 0.5; // In C / C++ the following would work, with plimagefr directly calling // mypltr. For compatibilty with other language bindings the same effect // can be achieved by generating the transformed grid first and then // using pltr2. // plimagefr(img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, mypltr, (PLPointer) &stretch); for ( i = 0; i <= width; i++ ) { for ( j = 0; j <= height; j++ ) { xg[i][j] = x0 + ( x0 - i ) * ( 1.0 - stretch * Math.cos( ( j - y0 ) / dy * Math.PI * 0.5 ) ); yg[i][j] = j; } } pls.imagefr( img_f, 0., width, 0., height, 0., 0., img_min, img_max, xg, yg ); pls.end(); } // read image from file in binary ppm format double [][] read_img( String fname, int [] num_col ) { BufferedReader in; DataInputStream in2; double[][] img; String line; StringTokenizer st; int i, j, w, h; // naive grayscale binary ppm reading. If you know how to, improve it try { in = new BufferedReader( new FileReader( fname ) ); in2 = new DataInputStream( new DataInputStream( new BufferedInputStream( new FileInputStream( fname ) ) ) ); } catch ( FileNotFoundException e ) { System.out.println( "File " + fname + " not found" ); return null; } try { line = in.readLine(); if ( line.compareTo( "P5\n" ) == 0 ) // I only understand this! { System.out.println( line ); System.out.println( "unknown file format " + fname ); return null; } in2.skip( line.getBytes().length + 1 ); do { line = in.readLine(); in2.skip( line.getBytes().length + 1 ); } while ( line.charAt( 0 ) == '#' ); st = new StringTokenizer( line ); w = Integer.parseInt( st.nextToken() ); h = Integer.parseInt( st.nextToken() ); line = in.readLine(); in2.skip( line.getBytes().length + 1 ); st = new StringTokenizer( line ); num_col[0] = Integer.parseInt( st.nextToken() ); img = new double[w][h]; for ( j = 0; j < h; j++ ) { for ( i = 0; i < w; i++ ) { img[i][h - j - 1] = in2.readUnsignedByte(); } } } catch ( IOException e ) { System.out.println( "Error reading " + fname ); return null; } return img; } // save plot void save_plot( String fname ) { PLStream pls2 = new PLStream(); // create a new one pls2.sdev( "psc" ); // new device type. Use a known existing driver pls2.sfnam( fname ); // file name pls2.cpstrm( pls, false ); // copy old stream parameters to new stream pls2.replot(); // do the save } // get selection square interactively boolean get_clip( double[] xi, double[] xe, double[] yi, double[] ye ) { PLGraphicsIn gin = new PLGraphicsIn(); double xxi = xi[0], yyi = yi[0], xxe = xe[0], yye = ye[0], t; boolean start = false; boolean[] st = new boolean[1]; pls.xormod( true, st ); // enter xor mode to draw a selection rectangle if ( st[0] ) // driver has xormod capability, continue { double sx[] = new double[5]; double sy[] = new double[5]; while ( true ) { pls.xormod( false, st ); pls.getCursor( gin ); pls.xormod( true, st ); if ( gin.getButton() == 1 ) { xxi = gin.getWX(); yyi = gin.getWY(); if ( start ) pls.line( sx, sy ); // clear previous rectangle start = false; sx[0] = xxi; sy[0] = yyi; sx[4] = xxi; sy[4] = yyi; } if ( ( gin.getState() & 0x100 ) != 0 ) { xxe = gin.getWX(); yye = gin.getWY(); if ( start ) pls.line( sx, sy ); // clear previous rectangle start = true; sx[2] = xxe; sy[2] = yye; sx[1] = xxe; sy[1] = yyi; sx[3] = xxi; sy[3] = yye; pls.line( sx, sy ); // draw new rectangle } if ( gin.getButton() == 3 || gin.getKeysym() == 0x0D || gin.getKeysym() == 'Q' ) { if ( start ) pls.line( sx, sy ); // clear previous rectangle break; } } pls.xormod( false, st ); // leave xor mod if ( xxe < xxi ) { t = xxi; xxi = xxe; xxe = t; } if ( yyi < yye ) { t = yyi; yyi = yye; yye = t; } xe[0] = xxe; xi[0] = xxi; ye[0] = yye; yi[0] = yyi; return ( gin.getKeysym() == 'Q' ); } return false; } // set gray colormap void gray_cmap( int num_col ) { double r[] = new double[2]; double g[] = new double[2]; double b[] = new double[2]; double pos[] = new double[2]; r[0] = g[0] = b[0] = 0.0; r[1] = g[1] = b[1] = 1.0; pos[0] = 0.0; pos[1] = 1.0; pls.scmap1n( num_col ); pls.scmap1l( true, pos, r, g, b ); } // Calculate the minimum and maximum of a 2-d array void f2mnmx( double [][] f, int nx, int ny, double[] fmaxmin ) { int i, j; fmaxmin[0] = f[0][0]; fmaxmin[1] = fmaxmin[0]; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { fmaxmin[0] = Math.max( fmaxmin[0], f[i][j] ); fmaxmin[1] = Math.min( fmaxmin[1], f[i][j] ); } } } public static void main( String[] args ) { new x20( args ); } } //-------------------------------------------------------------------------- // End of x20.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x17.java 644 1750 1750 1325412033404504 167710ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x17.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 17 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x17 { // Class data PLStream pls = new PLStream(); // plerror is not implement in java at this time static int pl_errcode = 0; static String errmsg = null; x17( String[] args ) { int id1[] = new int[1]; int n, nsteps = 1000; boolean autoy, acc; double y1, y2, y3, y4, ymin, ymax, xlab, ylab; double t, tmin, tmax, tjump, dt, noise; int colbox, collab; int colline[] = new int[4]; int styline[] = new int[4]; String legline[] = new String[4]; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // If db is used the plot is much more smooth. However, because of the // async X behaviour, one does not have a real-time scripcharter. // pls.setopt("db", ""); // pls.setopt("np", ""); // Specify some reasonable defaults for ymin and ymax // The plot will grow automatically if needed (but not shrink) ymin = -0.1; ymax = 0.1; // Specify initial tmin and tmax -- this determines length of window. // Also specify maximum jump in t // This can accomodate adaptive timesteps tmin = 0.; tmax = 10.; tjump = 0.3; // percentage of plot to jump // Axes options same as plbox. // Only automatic tick generation and label placement allowed // Eventually I'll make this fancier colbox = 1; collab = 3; styline[0] = colline[0] = 2; // pens color and line style styline[1] = colline[1] = 3; styline[2] = colline[2] = 4; styline[3] = colline[3] = 5; legline[0] = "sum"; // pens legend legline[1] = "sin"; legline[2] = "sin*noi"; legline[3] = "sin+noi"; xlab = 0.; ylab = 0.25; // legend position autoy = true; // autoscale y acc = true; // don't scrip, accumulate // Initialize PLplot. pls.init(); pls.adv( 0 ); pls.vsta(); // Register our error variables with PLplot // From here on, we're handling all errors here //pls.sError(&pl_errcode, errmsg); pls.stripc( id1, "bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo" ); if ( pl_errcode != 0 ) { System.out.println( errmsg ); pls.end(); System.exit( 1 ); } // Let plplot handle errors from here on //pls.sError(NULL, NULL); autoy = false; // autoscale y acc = true; // accumulate/ // This is to represent a loop over time // Let's try a random walk process y1 = y2 = y3 = y4 = 0.0; dt = 0.1; for ( n = 0; n < nsteps; n++ ) { try { Thread.sleep( 10 ); } catch ( InterruptedException e ) { } t = n * dt; noise = pls.randd() - 0.5; y1 = y1 + noise; y2 = Math.sin( t * Math.PI / 18. ); y3 = y2 * noise; y4 = y2 + noise / 3.; // There is no need for all pens to have the same number of // points or beeing equally time spaced. if ( n % 2 != 0 ) pls.stripa( id1[0], 0, t, y1 ); if ( n % 3 != 0 ) pls.stripa( id1[0], 1, t, y2 ); if ( n % 4 != 0 ) pls.stripa( id1[0], 2, t, y3 ); if ( n % 5 != 0 ) pls.stripa( id1[0], 3, t, y4 ); // pls.eop(); // use double buffer (-db on command line) } // Destroy strip chart and it's memory pls.stripd( id1[0] ); pls.end(); } public static void main( String[] args ) { new x17( args ); } } //-------------------------------------------------------------------------- // End of x17.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x27.java 644 1750 1750 1742012033404504 167710ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x27.java 12240 2012-10-04 22:10:12Z andrewross $ // Drawing "spirograph" curves - epitrochoids, cycolids, roulettes //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2007 Arjen Markus // Copyright (C) 2008 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // Implementation of PLplot example 27 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x27 { PLStream pls = new PLStream(); public static void main( String[] args ) { new x27( args ); } //-------------------------------------------------------------------- // Generates two kinds of plots: // - construction of a cycloid (animated) // - series of epitrochoids and hypotrochoids //-------------------------------------------------------------------- public x27( String[] args ) { // R, r, p, N // R and r should be integers to give correct termination of the // angle loop using gcd. // N.B. N is just a place holder since it is no longer used // (because we now have proper termination of the angle loop). double params[][] = { { 21.0, 7.0, 7.0, 3.0 }, // Deltoid { 21.0, 7.0, 10.0, 3.0 }, { 21.0, -7.0, 10.0, 3.0 }, { 20.0, 3.0, 7.0, 20.0 }, { 20.0, 3.0, 10.0, 20.0 }, { 20.0, -3.0, 10.0, 20.0 }, { 20.0, 13.0, 7.0, 20.0 }, { 20.0, 13.0, 20.0, 20.0 }, { 20.0, -13.0, 20.0, 20.0 } }; int i; boolean fill; // plplot initialization // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); // Illustrate the construction of a cycloid cycloid(); // Loop over the various curves // First an overview, then all curves one by one pls.ssub( 3, 3 ); // Three by three window fill = false; for ( i = 0; i < 9; i++ ) { pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params[i], fill ); } pls.adv( 0 ); pls.ssub( 1, 1 ); // One window per curve for ( i = 0; i < 9; i++ ) { pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params[i], fill ); } // Fill the curves fill = true; pls.adv( 0 ); pls.ssub( 1, 1 ); // One window per curve for ( i = 0; i < 9; i++ ) { pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 1.0 ); spiro( params[i], fill ); } // Finally, an example to test out plarc capabilities arcs(); pls.end(); } //-------------------------------------------------------------------------- // Calculate greatest common divisor following pseudo-code for the // Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm int gcd( int a, int b ) { int t; a = Math.abs( a ); b = Math.abs( b ); while ( b != 0 ) { t = b; b = a % b; a = t; } return a; } // =============================================================== void cycloid() { // TODO } // =============================================================== void spiro( double params[], boolean fill ) { int NPNT = 2000; double xcoord[]; double ycoord[]; int windings; int steps; int i; double phi; double phiw; double dphi; // Initialize to quiet java compiler errors about the possibility // these variables are not initialized in the code below. double xmin = 0.; double xmax = 0.; double ymin = 0.; double ymax = 0.; double xrange_adjust; double yrange_adjust; // Fill the coordinates // Proper termination of the angle loop very near the beginning // point, see // http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = (int) Math.abs( params[1] ) / gcd( (int) params[0], (int) params[1] ); steps = NPNT / windings; dphi = 2.0 * Math.PI / steps; xcoord = new double[windings * steps + 1]; ycoord = new double[windings * steps + 1]; for ( i = 0; i <= windings * steps; i++ ) { phi = i * dphi; phiw = ( params[0] - params[1] ) / params[1] * phi; xcoord[i] = ( params[0] - params[1] ) * Math.cos( phi ) + params[2] * Math.cos( phiw ); ycoord[i] = ( params[0] - params[1] ) * Math.sin( phi ) - params[2] * Math.sin( phiw ); if ( i == 0 ) { xmin = xcoord[i]; xmax = xcoord[i]; ymin = ycoord[i]; ymax = ycoord[i]; } if ( xmin > xcoord[i] ) xmin = xcoord[i]; if ( xmax < xcoord[i] ) xmax = xcoord[i]; if ( ymin > ycoord[i] ) ymin = ycoord[i]; if ( ymax < ycoord[i] ) ymax = ycoord[i]; } xrange_adjust = 0.15 * ( xmax - xmin ); xmin -= xrange_adjust; xmax += xrange_adjust; yrange_adjust = 0.15 * ( ymax - ymin ); ymin -= yrange_adjust; ymax += yrange_adjust; pls.wind( xmin, xmax, ymin, ymax ); pls.col0( 1 ); if ( fill ) pls.fill( xcoord, ycoord ); else pls.line( xcoord, ycoord ); } void arcs() { int NSEG = 8; int i; double theta, dtheta; double a, b; theta = 0.0; dtheta = 360.0 / NSEG; pls.env( -10.0, 10.0, -10.0, 10.0, 1, 0 ); // Plot segments of circle in different colors for ( i = 0; i < NSEG; i++ ) { pls.col0( i % 2 + 1 ); pls.arc( 0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, false ); theta = theta + dtheta; } // Draw several filled ellipses inside the circle at different // angles. a = 3.0; b = a * Math.tan( ( dtheta / 180.0 * Math.PI ) / 2.0 ); theta = dtheta / 2.0; for ( i = 0; i < NSEG; i++ ) { pls.col0( 2 - i % 2 ); pls.arc( a * Math.cos( theta / 180.0 * Math.PI ), a * Math.sin( theta / 180.0 * Math.PI ), a, b, 0.0, 360.0, theta, true ); theta = theta + dtheta; } } } //-------------------------------------------------------------------------- // End of x27.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x10.java 644 1750 1750 457712033404504 167520ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x10.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 10 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x10 { public static void main( String[] args ) { new x10( args ); } public x10( String[] args ) { PLStream pls = new PLStream(); // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 1.0 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls.svpa( 50.0, 150.0, 50.0, 100.0 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls.ptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" ); pls.end(); } } //-------------------------------------------------------------------------- // End of x10.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x05.java 644 1750 1750 504712033404504 167470ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x05.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 5 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x05 { static final int NPTS = 2047; public static void main( String[] args ) { new x05( args ); } public x05( String[] args ) { PLStream pls = new PLStream(); int i; double[] data = new double[NPTS]; double delta; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); // Fill up data points. delta = 2.0 * Math.PI / NPTS; for ( i = 0; i < NPTS; i++ ) data[i] = Math.sin( i * delta ); pls.col0( 1 ); pls.hist( data, -1.1, 1.1, 44, PL_HIST_DEFAULT ); pls.col0( 2 ); pls.lab( "#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator" ); pls.end(); } } //-------------------------------------------------------------------------- // End of x05.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x06.java 644 1750 1750 1025012033404504 167600ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x06.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 6 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.text.*; class x06 { public static void main( String[] args ) { new x06( args ); } public x06( String[] args ) { PLStream pls = new PLStream(); NumberFormat nf = NumberFormat.getNumberInstance(); int i, j, k, kind_font, font, maxfont; double x[] = new double[1]; double y[] = new double[1]; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); for ( kind_font = 0; kind_font < 2; kind_font++ ) { pls.fontld( kind_font ); if ( kind_font == 0 ) maxfont = 1; else maxfont = 4; for ( font = 0; font < maxfont; font++ ) { pls.font( font + 1 ); pls.adv( 0 ); // Set up viewport and window. pls.col0( 2 ); pls.vpor( 0.1, 1.0, 0.1, 0.9 ); pls.wind( 0.0, 1.0, 0.0, 1.3 ); // Draw the grid using plbox. pls.box( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame. pls.col0( 15 ); for ( i = 0; i <= 9; i++ ) { String text = nf.format( i ); pls.mtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } k = 0; for ( i = 0; i <= 12; i++ ) { // Write the digits to the left of the frame. String text = nf.format( 10 * i ); pls.mtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, text ); for ( j = 0; j <= 9; j++ ) { x[0] = 0.1 * j + 0.05; y[0] = 1.25 - 0.1 * i; // Display the symbols (plpoin expects that x and y are arrays so // that is what we feed it). if ( k < 128 ) pls.poin( x, y, k ); k = k + 1; } } if ( kind_font == 0 ) pls.mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); else pls.mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); } } pls.end(); } } //-------------------------------------------------------------------------- // End of x06.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x15.java 644 1750 1750 1763212140566142 170010ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x15.java 12329 2013-05-02 22:44:50Z airwin $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001, 2002 Geoffrey Furnish // Copyright (C) 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 15 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x15 { static final int XPTS = 35; static final int YPTS = 46; // calculated constants and array that depends on them static final double XSPA = 2. / ( XPTS - 1 ); static final double YSPA = 2. / ( YPTS - 1 ); final double tr[] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; PLStream pls = new PLStream(); double fmin, fmax; // Compute min and max value of a 2-d array. void f2mnmx( double[][] f, int nx, int ny ) { fmax = f[0][0]; fmin = fmax; for ( int i = 0; i < nx; i++ ) for ( int j = 0; j < ny; j++ ) { if ( f[i][j] < fmin ) fmin = f[i][j]; if ( f[i][j] > fmax ) fmax = f[i][j]; } } // Does a variety of shade plots with discrete colours and patterns. public static void main( String[] args ) { new x15( args ); } public x15( String[] args ) { int i, j; double xx; double yy; double x; double y; double[][] z = new double[XPTS][YPTS]; double zmin, zmax; double[][] xg0 = new double[XPTS][YPTS]; double[][] yg0 = new double[XPTS][YPTS]; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); // no need to fiddle with color maps since example uses default cmap0 // and the cmap1 fiddling that x15c.c does is completely irrelevant // (although interesting). for ( i = 0; i < XPTS; i++ ) { xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = ( (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) ) - 1.; z[i][j] = xx * xx - yy * yy + ( xx - yy ) / ( xx * xx + yy * yy + 0.1 ); x = tr[0] * i + tr[1] * j + tr[2]; y = tr[3] * i + tr[4] * j + tr[5]; // Note xg0 ==> yg1 are one-dimensional because of arrangement of //zeros in the final tr definition above. However, for now //we are using raw interface here so must nominally treat them //as two-dimensional. xg0[i][j] = x; yg0[i][j] = y; } } f2mnmx( z, XPTS, YPTS ); zmin = fmin; zmax = fmax; plot1( xg0, yg0, z, zmin, zmax ); plot2( xg0, yg0, z, zmin, zmax ); plot3(); pls.end(); } // Illustrates a single shaded region. void plot1( double[][] xg0, double[][] yg0, double[][] z, double zmin, double zmax ) { double shade_min, shade_max, sh_color; int sh_cmap = 0; int min_color = 0, max_color = 0; double sh_width, min_width = 0., max_width = 0.; pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); // Plot using identity transform shade_min = zmin + ( zmax - zmin ) * 0.4; shade_max = zmin + ( zmax - zmin ) * 0.6; sh_color = 7; sh_width = 2.; min_color = 9; max_color = 2; min_width = 2.; max_width = 2.; pls.psty( 8 ); pls.shade( z, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, true, xg0, yg0 ); pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); pls.lab( "distance", "altitude", "Bogon flux" ); } // Illustrates multiple adjacent shaded regions, using different fill // patterns for each region. void plot2( double[][] xg0, double[][] yg0, double[][] z, double zmin, double zmax ) { double shade_min, shade_max, sh_color; int sh_cmap = 0; int min_color = 0, max_color = 0; double sh_width, min_width = 0., max_width = 0.; int i; int[][] inc = { { 450 }, { -450 }, { 0 }, { 900 }, { 300 }, {450, -450 }, { 0, 900 }, { 0, 450 }, {450, -450 }, { 0, 900 } }; int[][] del = { { 2000 }, { 2000 }, { 2000 }, { 2000 }, { 2000 }, {2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, {4000, 4000 }, { 4000, 2000 } }; sh_width = 2.; pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); // Plot using identity transform for ( i = 0; i < 10; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / 10.0; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / 10.0; sh_color = i + 6; pls.pat( inc[i], del[i] ); pls.shade( z, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, true, xg0, yg0 ); } pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); pls.lab( "distance", "altitude", "Bogon flux" ); } // Illustrates shaded regions in 3d, using a different fill pattern for // each region. void plot3() { double[][] xx = { { -1.0, 1.0, 1.0, -1.0, -1.0 }, { -1.0, 1.0, 1.0, -1.0, -1.0 } }; double[][] yy = { { 1.0, 1.0, 0.0, 0.0, 1.0 }, { -1.0, -1.0, 0.0, 0.0, -1.0 } }; double[][] zz = { { 0.0, 0.0, 1.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 1.0, 0.0 } }; pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); pls.w3d( 1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40 ); // Plot using identity transform pls.col0( 1 ); pls.box3( "bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0 ); pls.col0( 2 ); pls.lab( "", "", "3-d polygon filling" ); pls.col0( 3 ); pls.psty( 1 ); pls.line3( xx[0], yy[0], zz[0] ); pls.fill3( xx[0], yy[0], zz[0] ); pls.psty( 2 ); pls.line3( xx[1], yy[1], zz[1] ); pls.fill3( xx[1], yy[1], zz[1] ); } } //-------------------------------------------------------------------------- // End of x15.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/CMakeLists.txt 644 1750 1750 1351512223357562 202630ustar andrewandrew# examples/java/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006, 2007, 2008, 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(java_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) if(CORE_BUILD) set(java_SRCS) foreach(STRING_INDEX ${java_STRING_INDICES}) list(APPEND java_SRCS x${STRING_INDEX}.java) endforeach(STRING_INDEX ${java_STRING_INDICES}) install(FILES ${java_SRCS} README.javademos DESTINATION ${DATA_DIR}/examples/java ) set(JAVAC ${CMAKE_Java_COMPILER}) set(JAVADATA_HARDDIR ${JAR_DIR}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/java RENAME Makefile ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/java ) # Build all java examples regardless of BUILD_test to allow putting # the class files in the jar file that will be created and installed. set(java_CLASSES) get_property(files_plplot_core GLOBAL PROPERTY FILES_plplot_core) set_property(GLOBAL PROPERTY TARGETS_examples_java) set_property(GLOBAL PROPERTY FILES_examples_java) foreach(STRING_INDEX ${java_STRING_INDICES}) set(in_file ${CMAKE_CURRENT_SOURCE_DIR}/x${STRING_INDEX}.java) set(out_file ${CMAKE_CURRENT_BINARY_DIR}/plplot/examples/x${STRING_INDEX}.class ) list(APPEND java_CLASSES ${out_file}) add_custom_command( OUTPUT ${out_file} COMMAND ${CMAKE_Java_COMPILER} ${JAVACFLAGS} -classpath ${CMAKE_BINARY_DIR}/bindings/java -d ${CMAKE_CURRENT_BINARY_DIR} -encoding UTF-8 ${in_file} DEPENDS ${in_file} ${files_plplot_core} VERBATIM ) add_custom_target(x${STRING_INDEX}j ALL DEPENDS ${out_file}) add_dependencies(x${STRING_INDEX}j plplot_core) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_java x${STRING_INDEX}j) set_property(GLOBAL APPEND PROPERTY FILES_examples_java ${out_file}) endforeach(STRING_INDEX ${java_STRING_INDICES}) add_custom_target(plplot_examples DEPENDS ${java_CLASSES}) add_dependencies(plplot_examples plplot_core) # This information is duplicated from bindings/java/CMakeLists.txt. # It is required here to get the dependencies right for # the jar file. set(java_CORE_CLASSES ${CMAKE_BINARY_DIR}/bindings/java/plplot/core/PLGraphicsIn.class ${CMAKE_BINARY_DIR}/bindings/java/plplot/core/PLStream.class ${CMAKE_BINARY_DIR}/bindings/java/plplot/core/config.class ${CMAKE_BINARY_DIR}/bindings/java/plplot/core/plplotjavac.class ${CMAKE_BINARY_DIR}/bindings/java/plplot/core/plplotjavacConstants.class ${CMAKE_BINARY_DIR}/bindings/java/plplot/core/plplotjavacJNI.class ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar COMMAND ${CMAKE_Java_ARCHIVE} -cf ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar -C ${CMAKE_BINARY_DIR}/bindings/java plplot/core -C ${CMAKE_CURRENT_BINARY_DIR} plplot/examples DEPENDS ${java_CLASSES} ${java_CORE_CLASSES} ) add_custom_target(plplot_jar ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar) # The plplot_examples dependency is required to # work around CMake 2-level make recursion issue where independent # file dependency chains that refer to the same files must have # target dependencies between them in order to work for parallel # builds (and possibly some visual studio builds). add_dependencies(plplot_jar plplot_examples plplot_core) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_java plplot_jar) set_property(GLOBAL APPEND PROPERTY FILES_examples_java ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plplot.jar DESTINATION ${JAR_DIR} ) else(CORE_BUILD) set(INSTALLED_JAR_FILE ${JAR_DIR}/plplot.jar) set_property(GLOBAL PROPERTY TARGETS_examples_java) set_property(GLOBAL PROPERTY FILES_examples_java) foreach(STRING_INDEX ${java_STRING_INDICES}) set(in_file ${CMAKE_CURRENT_SOURCE_DIR}/x${STRING_INDEX}.java) set( out_file ${CMAKE_CURRENT_BINARY_DIR}/plplot/examples/x${STRING_INDEX}.class ) add_custom_command( OUTPUT ${out_file} COMMAND ${CMAKE_Java_COMPILER} ${JAVACFLAGS} -classpath ${INSTALLED_JAR_FILE} -d ${CMAKE_CURRENT_BINARY_DIR} -encoding UTF-8 ${in_file} DEPENDS ${in_file} ${INSTALLED_JAR_FILE} VERBATIM ) add_custom_target(x${STRING_INDEX}j ALL DEPENDS ${out_file}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_java x${STRING_INDEX}j) set_property(GLOBAL APPEND PROPERTY FILES_examples_java ${out_file}) endforeach(STRING_INDEX ${java_STRING_INDICES}) endif(CORE_BUILD) plplot-5.10.0+dfsg/examples/java/x33.java 644 1750 1750 10131412154201301 167740ustar andrewandrew// -*- coding: utf-8; -*- // // $Id: x33.java 12372 2013-06-06 21:44:33Z andrewross $ // // Demonstrate most pllegend capability including unicode symbols. // // Copyright (C) 2010 Alan Irwin // Copyright (C) 2011 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example designed just for devices (e.g., the cairo-related and // qt-related devices) where the best choice of glyph is automatically // selected by the related libraries (pango/cairo or Qt4) for each // unicode character depending on what system fonts are installed. Of // course, you must have the appropriate TrueType fonts installed to // have access to all the required glyphs. package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; import java.text.*; class x33 { PLStream pls = new PLStream(); public static void main( String[] args ) { new x33( args ); } static String[] special_symbols = { "✰", "✴", "✱", "✽", "✦" }; // plcolorbar options static String[] colorbar_option_kind_labels = { "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars" }; static String[] colorbar_position_option_labels = { "Left", "Right", "Top", "Bottom" }; static String[] colorbar_label_option_labels = { "Label left", "Label right", "Label top", "Label bottom" }; static String[] colorbar_cap_option_labels = { "No caps", "Low cap", "High cap", "Low and high caps" }; final static int COLORBAR_KINDS = 4; final static int COLORBAR_POSITIONS = 4; final static int COLORBAR_LABELS = 4; final static int COLORBAR_CAPS = 4; void plcolorbar_example_page( int kind_i, int label_i, int cap_i, int cont_color, double cont_width, double[] values ) { int i; // Parameters for the colorbars on this page int position_i, position, opt; double x, y, x_length, y_length; double[] ticks = { 0.0 }; int[] sub_ticks = { 0 }; double low_cap_color, high_cap_color; boolean vertical, ifn; int n_axes = 1; String[] axis_opts = new String[1]; int n_labels = 1; int[] label_opts = { 0 }; String[] label = new String[1]; String title; double[] colorbar_width = new double[1]; double[] colorbar_height = new double[1]; int[] n_values_array = new int[1]; double[][] values_array = new double[1][values.length]; // Colorbar type options int[] colorbar_option_kinds = { PL_COLORBAR_SHADE, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT }; // Which side of the page are we positioned relative to? int[] colorbar_position_options = { PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM }; // Colorbar label positioning options int[] colorbar_label_options = { PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM }; // Colorbar cap options int[] colorbar_cap_options = { PL_COLORBAR_CAP_NONE, PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH }; n_values_array[0] = values.length; for ( i = 0; i < n_values_array[0]; i++ ) values_array[0][i] = values[i]; low_cap_color = 0.0; high_cap_color = 1.0; // Start a new page pls.adv( 0 ); // Draw one colorbar relative to each side of the page for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) { position = colorbar_position_options[position_i]; opt = colorbar_option_kinds[kind_i] | colorbar_label_options[label_i] | colorbar_cap_options[cap_i]; vertical = ( ( position & PL_POSITION_LEFT ) != 0 ) || ( ( position & PL_POSITION_RIGHT ) != 0 ); ifn = ( ( position & PL_POSITION_LEFT ) != 0 ) || ( ( position & PL_POSITION_BOTTOM ) != 0 ); // Set the offset position on the page if ( vertical ) { x = 0.0; y = 0.0; x_length = 0.05; y_length = 0.5; } else { x = 0.0; y = 0.0; x_length = 0.5; y_length = 0.05; } // Set appropriate labelling options. if ( ifn ) { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivn"; } else { axis_opts[0] = "uwxvn"; } } else { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivm"; } else { axis_opts[0] = "uwxvm"; } } label[0] = colorbar_position_option_labels[position_i] + ", " + colorbar_label_option_labels[label_i]; // Smaller text pls.schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls.smaj( 0.0, 0.5 ); pls.smin( 0.0, 0.5 ); pls.vpor( 0.20, 0.80, 0.20, 0.80 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); // Set interesting background colour. pls.scol0a( 15, 0, 0, 0, 0.20 ); pls.colorbar( colorbar_width, colorbar_height, opt | PL_COLORBAR_BOUNDING_BOX | PL_COLORBAR_BACKGROUND, position, x, y, x_length, y_length, 15, 1, 1, low_cap_color, high_cap_color, cont_color, cont_width, label_opts, label, axis_opts, ticks, sub_ticks, n_values_array, values_array ); // Reset text and tick sizes pls.schr( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); pls.smin( 0.0, 1.0 ); } // Draw a page title title = colorbar_option_kind_labels[kind_i] + " - " + colorbar_cap_option_labels[cap_i]; pls.vpor( 0.0, 1.0, 0.0, 1.0 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); } void plcolorbar_example( String palette, int kind_i, int cont_color, double cont_width, double[] values ) { int label_i, cap_i; // Load the color palette pls.spal1( palette, true ); for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) { for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) { plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, values ); } } } //-------------------------------------------------------------------------- // x33 // // Demonstrate most pllegend capability including unicode symbols. //-------------------------------------------------------------------------- public x33( String[] args ) { int i, k; int opt; int nlegend, nturn; int[] opt_array; int[] text_colors; int[] box_colors; int[] box_patterns; double[] box_scales; double[] box_line_widths; int[] line_colors; int[] line_styles; double[] line_widths; int[] symbol_numbers; int[] symbol_colors; double[] symbol_scales; String[] text; String[] symbols; double[] legend_width = new double[1], legend_height = new double[1]; double x, y, xstart, ystart; double max_height, text_scale; int position, opt_base, nrow, ncolumn; int[] position_options = { PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_INSIDE }; NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumIntegerDigits( 2 ); // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); // First page illustrating the 16 standard positions. pls.adv( 0 ); pls.vpor( 0.25, 0.75, 0.25, 0.75 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls.sfont( PL_FCI_SANS, -1, -1 ); pls.mtex( "t", 8.0, 0.5, 0.5, "The 16 standard legend positions with" ); pls.mtex( "t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y" ); nlegend = 1; opt_array = new int[nlegend]; text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; text = new String[nlegend]; symbols = new String[nlegend]; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[0] = 1; line_widths[0] = 1.; symbol_scales[0] = 1.; symbol_numbers[0] = 4; symbols[0] = "*"; // Use monotype fonts so that all legends are the same size. pls.sfont( PL_FCI_MONO, -1, -1 ); pls.scol0a( 15, 32, 32, 32, 0.70 ); for ( k = 0; k < 16; k++ ) { position = position_options[k]; opt = opt_base; text[0] = nf.format( k ); text_colors[0] = 1 + ( k % 8 ); line_colors[0] = 1 + ( k % 8 ); symbol_colors[0] = 1 + ( k % 8 ); pls.legend( legend_width, legend_height, opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); } // Second page illustrating effect of nrow, ncolumn for the same legend // data.; pls.adv( 0 ); pls.vpor( 0.25, 0.75, 0.25, 0.75 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls.sfont( PL_FCI_SANS, -1, -1 ); pls.mtex( "t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR," ); pls.mtex( "t", 6.0, 0.5, 0.5, "and position for the same legend data" ); nlegend = 7; opt_array = new int[nlegend]; text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; line_widths = new double[nlegend]; box_colors = new int[nlegend]; box_patterns = new int[nlegend]; box_scales = new double[nlegend]; box_line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; text = new String[nlegend]; symbols = new String[nlegend]; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; text[k] = nf.format( k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. pls.sfont( PL_FCI_MONO, -1, -1 ); pls.scol0a( 15, 32, 32, 32, 0.70 ); position = PL_POSITION_TOP | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 3; ncolumn = 3; pls.legend( legend_width, legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); // Third page demonstrating legend alignment pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 0.9 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.sfont( PL_FCI_SANS, -1, -1 ); pls.mtex( "t", 2.0, 0.5, 0.5, "Demonstrate legend alignment" ); x = 0.1; y = 0.1; nturn = 4; nlegend = 0; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE; opt = opt_base; for ( i = 0; i < 9; i++ ) { // Set up legend arrays with the correct size, type. if ( i <= nturn ) nlegend = nlegend + 1; else nlegend = nlegend - 1; nlegend = Math.max( 1, nlegend ); opt_array = new int[nlegend]; text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; line_widths = new double[nlegend]; box_colors = new int[nlegend]; box_patterns = new int[nlegend]; box_scales = new double[nlegend]; box_line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; text = new String[nlegend]; symbols = new String[nlegend]; // Only specify legend data that are required according to the // value of opt_array for that entry. for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; text[k] = nf.format( k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. pls.sfont( PL_FCI_MONO, -1, -1 ); pls.scol0a( 15, 32, 32, 32, 0.70 ); nrow = Math.min( 3, nlegend ); ncolumn = 0; pls.legend( legend_width, legend_height, opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, opt_array, 1.0, 1.0, 1.5, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); if ( i == nturn ) { position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE; opt = opt_base; x = 1. - x; y = y + legend_height[0]; } else { x = x + legend_width[0]; y = y + legend_height[0]; } } // Fourth page illustrating various kinds of legends max_height = 0.; xstart = 0.0; ystart = 0.1; x = xstart; y = ystart; text_scale = 0.90; pls.adv( 0 ); pls.vpor( 0.0, 1., 0.0, 0.90 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); //plbox("bc", 0.0, 0, "bc", 0.0, 0); pls.sfont( PL_FCI_SANS, -1, -1 ); pls.mtex( "t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends" ); nlegend = 5; opt_array = new int[nlegend]; text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; line_widths = new double[nlegend]; box_colors = new int[nlegend]; box_patterns = new int[nlegend]; box_scales = new double[nlegend]; box_line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; text = new String[nlegend]; symbols = new String[nlegend]; // In Java symbols array needs setting to null strings first, since // even unused values are copied over in the bindings. for ( k = 0; k < nlegend; k++ ) symbols[k] = ""; // Only specify legend data that are required according to the // value of opt_array for that entry. position = PL_POSITION_LEFT | PL_POSITION_TOP; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT; // Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array[0] = PL_LEGEND_NONE; text[0] = "None"; text_colors[0] = 1; opt_array[1] = PL_LEGEND_COLOR_BOX; text[1] = "Box"; text_colors[1] = 2; box_colors[1] = 2; box_patterns[1] = 0; box_scales[1] = 0.8; box_line_widths[1] = 1.; opt_array[2] = PL_LEGEND_LINE; text[2] = "Line"; text_colors[2] = 3; line_colors[2] = 3; line_styles[2] = 1; line_widths[2] = 1.; opt_array[3] = PL_LEGEND_SYMBOL; text[3] = "Symbol"; text_colors[3] = 4; symbol_colors[3] = 4; symbol_scales[3] = text_scale; symbol_numbers[3] = 4; symbols[3] = special_symbols[2]; opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE; text[4] = "L & S"; text_colors[4] = 5; line_colors[4] = 5; line_styles[4] = 1; line_widths[4] = 1.; symbol_colors[4] = 5; symbol_scales[4] = text_scale; symbol_numbers[4] = 4; symbols[4] = special_symbols[2]; opt = opt_base; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); max_height = Math.max( max_height, legend_height[0] ); // Set up symbol legend entries with various symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; text[i] = "Symbol " + special_symbols[i]; text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = 4; symbols[i] = special_symbols[i]; } opt = opt_base; x = x + legend_width[0]; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, null, null, null, null, null, null, null, symbol_colors, symbol_scales, symbol_numbers, symbols ); max_height = Math.max( max_height, legend_height[0] ); // Set up symbol legend entries with various numbers of symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; text[i] = "Symbol Number " + ( i + 2 ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = i + 2; symbols[i] = special_symbols[2]; } opt = opt_base; x = x + legend_width[0]; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, null, null, null, null, null, null, null, symbol_colors, symbol_scales, symbol_numbers, symbols ); max_height = Math.max( max_height, legend_height[0] ); // Set up box legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; text[i] = "Box Color " + ( i + 1 ); text_colors[i] = i + 1; box_colors[i] = i + 1; box_patterns[i] = 0; box_scales[i] = 0.8; box_line_widths[i] = 1.; } opt = opt_base; // Use new origin x = xstart; y = y + max_height; max_height = 0.; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, null, null, null, null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); // Set up box legend entries with various patterns. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; text[i] = "Box Pattern " + i; text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = i; box_scales[i] = 0.8; box_line_widths[i] = 1.; } opt = opt_base; x = x + legend_width[0]; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, null, null, null, null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); // Set up box legend entries with various box pattern line widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; text[i] = "Box Line Width " + ( i + 1 ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = 3; box_scales[i] = 0.8; box_line_widths[i] = i + 1; } opt = opt_base; x = x + legend_width[0]; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, box_colors, box_patterns, box_scales, box_line_widths, null, null, null, null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); // Set up line legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; text[i] = "Line Color " + ( i + 1 ); text_colors[i] = i + 1; line_colors[i] = i + 1; line_styles[i] = 1; line_widths[i] = 1.; } opt = opt_base; // Use new origin x = xstart; y = y + max_height; max_height = 0.; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); // Set up line legend entries with various styles. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; text[i] = "Line Style " + ( i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = i + 1; line_widths[i] = 1.; } opt = opt_base; x = x + legend_width[0]; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); // Set up line legend entries with various widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; text[i] = "Line Width " + ( i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = 1; line_widths[i] = i + 1; } opt = opt_base; x = x + legend_width[0]; pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, text_scale, 2.0, 0., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, null, null, null, null ); max_height = Math.max( max_height, legend_height[0] ); // Color bar examples double[] values_small = { -1.0e-200, 1.0e-200 }; double[] values_uneven = { -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 }; double[] values_even = { -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 }; // Use unsaturated green background colour to contrast with black caps. pls.scolbg( 70, 185, 70 ); // Cut out the greatest and smallest bits of the color spectrum to // leave colors for the end caps. pls.scmap1_range( 0.01, 0.99 ); // We can only test image and gradient colorbars with two element arrays for ( i = 2; i < COLORBAR_KINDS; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_small ); } // Test shade colorbars with larger arrays for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, values_even ); } for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, values_uneven ); } pls.end(); } } plplot-5.10.0+dfsg/examples/java/x31.java 644 1750 1750 3005512033404504 167630ustar andrewandrew// $Id: x31.java 12240 2012-10-04 22:10:12Z andrewross $ // // set/get tester // // Copyright (C) 2008 Andrew Ross // Copyright (C) 2008 Alan Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.text.*; class x31 { PLStream pls = new PLStream(); x31( String[] args ) { double xmin[] = new double[1], xmax[] = new double[1]; double ymin[] = new double[1], ymax[] = new double[1]; double zxmin[] = new double[1], zxmax[] = new double[1]; double zymin[] = new double[1], zymax[] = new double[1]; double xmid, ymid; double wx[] = new double[1], wy[] = new double[1]; double mar[] = new double[1], aspect[] = new double[1]; double jx[] = new double[1], jy[] = new double[1]; double ori[] = new double[1]; int win[] = new int[1], level2[] = new int[1]; int digmax[] = new int[1], digits[] = new int[1]; int compression1[] = new int[1], compression2[] = new int[1]; double xp0[] = new double[1], yp0[] = new double[1]; double xp1, yp1; double xp2[] = new double[1], yp2[] = new double[1]; int xleng0[] = new int[1], yleng0[] = new int[1]; int xoff0[] = new int[1], yoff0[] = new int[1]; int xleng1, yleng1; int xoff1, yoff1; int xleng2[] = new int[1], yleng2[] = new int[1]; int xoff2[] = new int[1], yoff2[] = new int[1]; int fam0[] = new int[1], num0[] = new int[1], bmax0[] = new int[1]; int fam1, num1, bmax1; int fam2[] = new int[1], num2[] = new int[1], bmax2[] = new int[1]; int r[] = new int[1], g[] = new int[1], b[] = new int[1]; double a[] = new double[1]; int r1[] = { 0, 255 }; int g1[] = { 255, 0 }; int b1[] = { 0, 0 }; double a1[] = { 1.0, 1.0 }; StringBuffer fnam = new StringBuffer( 256 ); int status; // Create NumberFormat to format floating point numbers // consistent with C printf NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits( 6 ); nf.setMinimumFractionDigits( 6 ); status = 0; // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Test setting / getting familying parameters before plinit. // Save values set by plparseopts to be restored later. pls.gfam( fam0, num0, bmax0 ); fam1 = 0; num1 = 10; bmax1 = 1000; pls.sfam( fam1, num1, bmax1 ); // Retrieve the same values? pls.gfam( fam2, num2, bmax2 ); System.out.println( "family parameters: fam, num, bmax = " + fam2[0] + " " + num2[0] + " " + bmax2[0] ); if ( fam2[0] != fam1 || num2[0] != num1 || bmax2[0] != bmax1 ) { System.err.println( "plgfam test failed" ); status = 1; } // Restore values set initially by plparseopts. pls.sfam( fam0[0], num0[0], bmax0[0] ); // Test setting / getting page parameters before plinit. // Save values set by plparseopts to be restored later. pls.gpage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); xp1 = 200.; yp1 = 200.; xleng1 = 400; yleng1 = 200; xoff1 = 10; yoff1 = 20; pls.spage( xp1, yp1, xleng1, yleng1, xoff1, yoff1 ); // Retrieve the same values? pls.gpage( xp2, yp2, xleng2, yleng2, xoff2, yoff2 ); System.out.println( "page parameters: xp, yp, xleng, yleng, xoff, yoff = " + nf.format( xp2[0] ) + " " + nf.format( yp2[0] ) + " " + xleng2[0] + " " + yleng2[0] + " " + xoff2[0] + " " + yoff2[0] ); if ( xp2[0] != xp1 || yp2[0] != yp1 || xleng2[0] != xleng1 || yleng2[0] != yleng1 || xoff2[0] != xoff1 || yoff2[0] != yoff1 ) { System.err.println( "plgpage test failed" ); status = 1; } // Restore values set initially by plparseopts. pls.spage( xp0[0], yp0[0], xleng0[0], yleng0[0], xoff0[0], yoff0[0] ); // Test setting / getting compression parameter across plinit. compression1[0] = 95; pls.scompression( compression1[0] ); // Initialize plplot pls.init(); // Test if device initialization screwed around with the preset // compression parameter. pls.gcompression( compression2 ); System.out.println( "Output various PLplot parameters" ); System.out.println( "compression parameter = " + compression2[0] ); if ( compression2[0] != compression1[0] ) { System.err.println( "plgcompression test failed" ); status = 1; } // Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure // they work without any obvious error messages. pls.scolor( 1 ); pls.scol0( 1, 255, 0, 0 ); pls.scmap1( r1, g1, b1 ); pls.scmap1a( r1, g1, b1, a1 ); pls.glevel( level2 ); System.out.println( "level parameter = " + level2[0] ); if ( level2[0] != 1 ) { System.err.println( "plglevel test failed." ); status = 1; } pls.adv( 0 ); pls.vpor( 0.01, 0.99, 0.02, 0.49 ); pls.gvpd( xmin, xmax, ymin, ymax ); System.out.println( "plvpor: xmin, xmax, ymin, ymax = " + nf.format( xmin[0] ) + " " + nf.format( xmax[0] ) + " " + nf.format( ymin[0] ) + " " + nf.format( ymax[0] ) ); if ( xmin[0] != 0.01 || xmax[0] != 0.99 || ymin[0] != 0.02 || ymax[0] != 0.49 ) { System.err.println( "plgvpd test failed" ); status = 1; } xmid = 0.5 * ( xmin[0] + xmax[0] ); ymid = 0.5 * ( ymin[0] + ymax[0] ); pls.wind( 0.2, 0.3, 0.4, 0.5 ); pls.gvpw( xmin, xmax, ymin, ymax ); System.out.println( "plwind: xmin, xmax, ymin, ymax = " + nf.format( xmin[0] ) + " " + nf.format( xmax[0] ) + " " + nf.format( ymin[0] ) + " " + nf.format( ymax[0] ) ); if ( xmin[0] != 0.2 || xmax[0] != 0.3 || ymin[0] != 0.4 || ymax[0] != 0.5 ) { System.err.println( "plgvpw test failed" ); status = 1; } // Get world coordinates for middle of viewport pls.calc_world( xmid, ymid, wx, wy, win ); System.out.println( "world parameters: wx, wy, win = " + nf.format( wx[0] ) + " " + nf.format( wy[0] ) + " " + win[0] ); if ( Math.abs( wx[0] - 0.5 * ( xmin[0] + xmax[0] ) ) > 1.0E-5 || Math.abs( wy[0] - 0.5 * ( ymin[0] + ymax[0] ) ) > 1.0E-5 ) { System.err.println( "plcalc_world test failed" ); status = 1; } // Retrieve and print the name of the output file (if any). // This goes to stderr not stdout since it will vary between tests and // we want stdout to be identical for compare test. pls.gfnam( fnam ); if ( fnam.length() == 0 ) { System.out.println( "No output file name is set" ); } else { System.out.println( "Output file name read" ); } System.err.println( "Output file name is " + fnam ); // Set and get the number of digits used to display axis labels // Note digits is currently ignored in pls[xyz]ax and // therefore it does not make sense to test the returned // value pls.sxax( 3, 0 ); pls.gxax( digmax, digits ); System.out.println( "x axis parameters: digmax, digits = " + digmax[0] + " " + digits[0] ); if ( digmax[0] != 3 ) { System.err.println( "plgxax test failed" ); status = 1; } pls.syax( 4, 0 ); pls.gyax( digmax, digits ); System.out.println( "y axis parameters: digmax, digits = " + digmax[0] + " " + digits[0] ); if ( digmax[0] != 4 ) { System.err.println( "plgyax test failed" ); status = 1; } pls.szax( 5, 0 ); pls.gzax( digmax, digits ); System.out.println( "z axis parameters: digmax, digits = " + digmax[0] + " " + digits[0] ); if ( digmax[0] != 5 ) { System.err.println( "plgzax test failed" ); status = 1; } pls.sdidev( 0.05, PL_NOTSET, 0.1, 0.2 ); pls.gdidev( mar, aspect, jx, jy ); System.out.println( "device-space window parameters: mar, aspect, jx, jy = " + nf.format( mar[0] ) + " " + nf.format( aspect[0] ) + " " + nf.format( jx[0] ) + " " + nf.format( jy[0] ) ); if ( mar[0] != 0.05 || jx[0] != 0.1 || jy[0] != 0.2 ) { System.err.println( "plgdidev test failed" ); status = 1; } pls.sdiori( 1.0 ); pls.gdiori( ori ); System.out.println( "ori parameter = " + nf.format( ori[0] ) ); if ( ori[0] != 1.0 ) { System.err.println( "plgdiori test failed" ); status = 1; } pls.sdiplt( 0.1, 0.2, 0.9, 0.8 ); pls.gdiplt( xmin, ymin, xmax, ymax ); System.out.println( "plot-space window parameters: xmin, ymin, xmax, ymax = " + nf.format( xmin[0] ) + " " + nf.format( ymin[0] ) + " " + nf.format( xmax[0] ) + " " + nf.format( ymax[0] ) ); if ( xmin[0] != 0.1 || xmax[0] != 0.9 || ymin[0] != 0.2 || ymax[0] != 0.8 ) { System.err.println( "plgdiplt test failed" ); status = 1; } pls.sdiplz( 0.1, 0.1, 0.9, 0.9 ); pls.gdiplt( zxmin, zymin, zxmax, zymax ); System.out.println( "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = " + nf.format( zxmin[0] ) + " " + nf.format( zymin[0] ) + " " + nf.format( zxmax[0] ) + " " + nf.format( zymax[0] ) ); if ( Math.abs( zxmin[0] - ( xmin[0] + ( xmax[0] - xmin[0] ) * 0.1 ) ) > 1.0E-5 || Math.abs( zxmax[0] - ( xmin[0] + ( xmax[0] - xmin[0] ) * 0.9 ) ) > 1.0E-5 || Math.abs( zymin[0] - ( ymin[0] + ( ymax[0] - ymin[0] ) * 0.1 ) ) > 1.0E-5 || Math.abs( zymax[0] - ( ymin[0] + ( ymax[0] - ymin[0] ) * 0.9 ) ) > 1.0E-5 ) { System.err.println( "plsdiplz test failed" ); status = 1; } pls.scolbg( 10, 20, 30 ); pls.gcolbg( r, g, b ); System.out.println( "background colour parameters: r, g, b = " + r[0] + " " + g[0] + " " + b[0] ); if ( r[0] != 10 || g[0] != 20 || b[0] != 30 ) { System.err.println( "plgcolbg test failed" ); status = 1; } pls.scolbga( 20, 30, 40, 0.5 ); pls.gcolbga( r, g, b, a ); System.out.println( "background/transparency colour parameters: r, g, b, a = " + r[0] + " " + g[0] + " " + b[0] + " " + nf.format( a[0] ) ); if ( r[0] != 20 || g[0] != 30 || b[0] != 40 || a[0] != 0.5 ) { System.err.println( "plgcolbga test failed" ); status = 1; } pls.end(); System.exit( status ); } public static void main( String[] args ) { new x31( args ); } }; plplot-5.10.0+dfsg/examples/java/x21.java 644 1750 1750 3306212140566142 167710ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x21.java 12329 2013-05-02 22:44:50Z airwin $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2006 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 21 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x21 { // Class data PLStream pls = new PLStream(); double xm, xM, ym, yM; // Options data structure definition. static int pts = 500; static int xp = 25; static int yp = 20; static int nl = 16; static int knn_order = 20; static double threshold = 1.001; static double wmin = -1e3; static int randn = 0; static int rosen = 0; // static PLOptionTable options[]; // PLOptionTable options[] = { // { // "npts", // NULL, // NULL, // &pts, // PL_OPT_INT, // "-npts points", // "Specify number of random points to generate [500]" }, // { // "randn", // NULL, // NULL, // &randn, // PL_OPT_BOOL, // "-randn", // "Normal instead of uniform sampling -- the effective // number of points will be smaller than the specified." }, // { // "rosen", // NULL, // NULL, // &rosen, // PL_OPT_BOOL, // "-rosen", // "Generate points from the Rosenbrock function."}, // { // "nx", // NULL, // NULL, // &xp, // PL_OPT_INT, // "-nx points", // "Specify grid x dimension [25]" }, // { // "ny", // NULL, // NULL, // &yp, // PL_OPT_INT, // "-ny points", // "Specify grid y dimension [20]" }, // { // "nlevel", // NULL, // NULL, // &nl, // PL_OPT_INT, // "-nlevel ", // "Specify number of contour levels [16]" }, // { // "knn_order", // NULL, // NULL, // &knn_order, // PL_OPT_INT, // "-knn_order order", // "Specify the number of neighbors [20]" }, // { // "threshold", // NULL, // NULL, // &threshold, // PL_OPT_FLOAT, // "-threshold float", // "Specify what a thin triangle is [1. < [1.001] < 2.]" }, // { // NULL, /* option */ // NULL, /* handler */ // NULL, /* client data */ // NULL, /* address of variable to set */ // 0, /* mode flag */ // NULL, /* short syntax */ // NULL } /* long syntax */ // }; x21( String[] args ) { double x[], y[], z[], clev[]; double xg[], yg[], zg[][]; double xg0[][], yg0[][]; double xx[], yy[]; double zmin, zmax, lzm[], lzM[]; int i, j, k; int alg; String title[] = { "Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted" }; double opt[] = { 0., 0., 0., 0., 0., 0. }; xm = ym = -0.2; xM = yM = 0.6; // plplot initialization // Parse and process command line arguments. // pls.MergeOpts(options, "x22c options", NULL); pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); opt[2] = wmin; opt[3] = knn_order; opt[4] = threshold; // Initialize PLplot. pls.init(); cmap1_init(); pls.seed( 5489 ); x = new double[pts]; y = new double[pts]; z = new double[pts]; xx = new double[1]; yy = new double[1]; create_data( x, y, z ); // the sampled data zmin = z[0]; zmax = z[0]; for ( i = 1; i < pts; i++ ) { if ( z[i] > zmax ) zmax = z[i]; if ( z[i] < zmin ) zmin = z[i]; } xg = new double[xp]; yg = new double[yp]; create_grid( xg, yg ); // grid the data at zg = new double[xp][yp]; // the output grided data xg0 = new double[xp][yp]; yg0 = new double[xp][yp]; for ( i = 0; i < xp; i++ ) { for ( j = 0; j < yp; j++ ) { xg0[i][j] = xg[i]; yg0[i][j] = yg[j]; } } clev = new double[nl]; pls.col0( 1 ); pls.env( xm, xM, ym, yM, 2, 0 ); pls.col0( 15 ); pls.lab( "X", "Y", "The original data sampling" ); for ( i = 0; i < pts; i++ ) { pls.col1( ( z[i] - zmin ) / ( zmax - zmin ) ); // The following plstring call should be the the equivalent of // plpoin( 1, &x[i], &y[i], 5 ); Use plstring because it is // not deprecated like plpoin and has much more powerful // capabilities. N.B. symbol 141 works for Hershey devices // (e.g., -dev xwin) only if plfontld( 0 ) has been called // while symbol 727 works only if plfontld( 1 ) has been // called. The latter is the default which is why we use 727 // here to represent a centred X (multiplication) symbol. // This dependence on plfontld is one of the limitations of // the Hershey escapes for PLplot, but the upside is you get // reasonable results for both Hershey and Unicode devices. xx[0] = x[i]; yy[0] = y[i]; pls.string( xx, yy, "#(727)" ); } pls.adv( 0 ); pls.ssub( 3, 2 ); for ( k = 0; k < 2; k++ ) { pls.adv( 0 ); for ( alg = 1; alg < 7; alg++ ) { pls.griddata( x, y, z, xg, yg, zg, alg, opt[alg - 1] ); // - CSA can generate NaNs (only interpolates?!). // - DTLI and NNI can generate NaNs for points outside the // convex hull of the data points. // - NNLI can generate NaNs if a sufficiently thick triangle // is not found // // PLplot should be NaN/Inf aware, but changing it now is // quite a job... so, instead of not plotting the NaN // regions, a weighted average over the neighbors is done. // if ( alg == GRID_CSA || alg == GRID_DTLI || alg == GRID_NNLI || alg == GRID_NNI ) { int ii, jj; double dist, d; for ( i = 0; i < xp; i++ ) { for ( j = 0; j < yp; j++ ) { if ( Double.isNaN( zg[i][j] ) ) // average (IDW) over the 8 neighbors { zg[i][j] = 0.; dist = 0.; for ( ii = i - 1; ii <= i + 1 && ii < xp; ii++ ) { for ( jj = j - 1; jj <= j + 1 && jj < yp; jj++ ) { if ( ii >= 0 && jj >= 0 && !Double.isNaN( zg[ii][jj] ) ) { d = ( Math.abs( ii - i ) + Math.abs( jj - j ) ) == 1 ? 1. : 1.4142; zg[i][j] += zg[ii][jj] / ( d * d ); dist += d; } } } if ( dist != 0. ) zg[i][j] /= dist; else zg[i][j] = zmin; } } } } lzm = new double[1]; lzM = new double[1]; pls.minMax2dGrid( zg, lzM, lzm ); lzm[0] = Math.min( lzm[0], zmin ); lzM[0] = Math.max( lzM[0], zmax ); lzm[0] = lzm[0] - 0.01; lzM[0] = lzM[0] + 0.01; pls.col0( 1 ); pls.adv( alg ); if ( k == 0 ) { for ( i = 0; i < nl; i++ ) clev[i] = lzm[0] + ( lzM[0] - lzm[0] ) / ( nl - 1 ) * i; pls.env0( xm, xM, ym, yM, 2, 0 ); pls.col0( 15 ); pls.lab( "X", "Y", title[alg - 1] ); pls.shades( zg, xm, xM, ym, yM, clev, 1., 0, 1., true, xg0, yg0 ); pls.col0( 2 ); } else { for ( i = 0; i < nl; i++ ) clev[i] = lzm[0] + ( lzM[0] - lzm[0] ) / ( nl - 1 ) * i; pls.vpor( 0.0, 1.0, 0.0, 0.9 ); pls.wind( -1.1, 0.75, -0.65, 1.20 ); // // For the comparison to be fair, all plots should have the // same z values, but to get the max/min of the data // generated by all algorithms would imply two passes. // Keep it simple. // // plw3d(1., 1., 1., xm, xM, ym, yM, zmin, zmax, 30, -60); // pls.w3d( 1., 1., 1., xm, xM, ym, yM, lzm[0], lzM[0], 30, -40 ); pls.box3( "bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0 ); pls.col0( 15 ); pls.lab( "", "", title[alg - 1] ); pls.plot3dc( xg, yg, zg, DRAW_LINEXY | MAG_COLOR | BASE_CONT, clev ); } } } pls.end(); } void cmap1_init() { double i[] = new double[2]; double h[] = new double[2]; double l[] = new double[2]; double s[] = new double[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary h[0] = 240; // blue . green . yellow . h[1] = 0; // . red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; pls.scmap1n( 256 ); pls.scmap1l( false, i, h, l, s ); } void create_grid( double xx[], double yy[] ) { int i; int px = xx.length; int py = yy.length; for ( i = 0; i < px; i++ ) xx[i] = xm + ( xM - xm ) * i / ( px - 1. ); for ( i = 0; i < py; i++ ) yy[i] = ym + ( yM - ym ) * i / ( py - 1. ); } void create_data( double x[], double y[], double z[] ) { int i; double r; double xt, yt; int pts = x.length; for ( i = 0; i < pts; i++ ) { xt = ( xM - xm ) * pls.randd(); yt = ( yM - ym ) * pls.randd(); if ( randn == 0 ) { x[i] = xt + xm; y[i] = yt + ym; } else // std=1, meaning that many points are outside the plot range { x[i] = Math.sqrt( -2. * Math.log( xt ) ) * Math.cos( 2. * Math.PI * yt ) + xm; y[i] = Math.sqrt( -2. * Math.log( xt ) ) * Math.sin( 2. * Math.PI * yt ) + ym; } if ( rosen == 0 ) { r = Math.sqrt( ( x[i] ) * ( x[i] ) + ( y[i] ) * ( y[i] ) ); z[i] = Math.exp( -r * r ) * Math.cos( 2.0 * Math.PI * r ); } else { z[i] = Math.log( Math.pow( ( 1. - x[i] ), 2. ) + 100. * Math.pow( ( y[i] - Math.pow( x[i], 2. ) ), 2. ) ); } } } public static void main( String[] args ) { new x21( args ); } } //-------------------------------------------------------------------------- // End of x21.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/Makefile.examples.in 644 1750 1750 306712136041114 213500ustar andrewandrew# examples.class/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA JAVAC = @JAVAC@ PLPLOT_CLASSPATH = @JAVADATA_HARDDIR@/plplot.jar example_classes = \ x00.class \ x01.class \ x02.class \ x03.class \ x04.class \ x05.class \ x06.class \ x07.class \ x08.class \ x09.class \ x10.class \ x11.class \ x12.class \ x13.class \ x14.class \ x15.class \ x16.class \ x17.class \ x18.class \ x19.class \ x20.class \ x21.class \ x22.class \ x23.class \ x24.class \ x26.class \ x27.class \ x28.class \ x29.class \ x30.class \ x31.class \ x33.class all: $(example_classes) clean: rm -rf plplot $(example_classes) .java.class: $(JAVAC) $(AM_JAVACFLAGS) $(JAVACFLAGS) -d . -classpath $(PLPLOT_CLASSPATH) -encoding UTF-8 $< cp plplot/examples/$@ . .SUFFIXES: .java .class plplot-5.10.0+dfsg/examples/java/x08.java 644 1750 1750 1735612033404504 170000ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x08.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002, 2003, 2004 Alan W. Irwin // Copyright (C) 2002 Maurice LeBrun // Copyright (C) 2002 Joao Cardoso // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 8 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x08 { static final int XPTS = 35; static final int YPTS = 46; PLStream pls = new PLStream(); static double alt[] = { 60.0, 20.0 }; static double az[] = { 30.0, 60.0 }; static String[] title = { "#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60", }; // cmap1_init1 // Initializes color map 1 in HLS space. // Basic grayscale variation from half-dark (which makes more interesting // looking plot compared to dark) to light. // An interesting variation on this: // s[1] = 1.0 void cmap1_init( int gray ) { double [] i = new double[2]; double [] h = new double[2]; double [] l = new double[2]; double [] s = new double[2]; boolean [] rev = new boolean[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary if ( gray == 1 ) { h[0] = 0.0; // hue -- low: red (arbitrary if s=0) h[1] = 0.0; // hue -- high: red (arbitrary if s=0) l[0] = 0.5; // lightness -- low: half-dark l[1] = 1.0; // lightness -- high: light s[0] = 0.0; // minimum saturation s[1] = 0.0; // minimum saturation } else { h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; } rev[0] = false; // interpolate on front side of colour wheel. rev[1] = false; // interpolate on front side of colour wheel. pls.scmap1n( 256 ); pls.scmap1l( false, i, h, l, s, rev ); } // Does a series of 3-d plots for a given data set, with different viewing // options in each plot. public static void main( String[] args ) { new x08( args ); } public x08( String[] args ) { int i, j, k; final int LEVELS = 10; double[] x = new double[ XPTS ]; double[] y = new double[ YPTS ]; double[][] z = new double[XPTS][YPTS]; double clevel[] = new double[LEVELS]; double clev_null [] = new double[0]; double xx, yy, r; double zmin = Double.MAX_VALUE, zmax = Double.MIN_VALUE; int ifshade; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); boolean rosen = true; // Initialize plplot. pls.init(); for ( i = 0; i < XPTS; i++ ) { x[i] = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); if ( rosen ) x[i] *= 1.5; } for ( j = 0; j < YPTS; j++ ) { y[j] = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ); if ( rosen ) y[j] += 0.5; } for ( i = 0; i < XPTS; i++ ) { xx = x[i]; for ( j = 0; j < YPTS; j++ ) { yy = y[j]; if ( rosen ) { z[i][j] = Math.pow( 1. - xx, 2. ) + 100 * Math.pow( yy - Math.pow( xx, 2. ), 2. ); // The log argument may be zero for just the right grid. if ( z[i][j] > 0. ) z[i][j] = Math.log( z[i][j] ); else z[i][j] = -5.; // -MAXFLOAT would mess-up up the scale } else { r = Math.sqrt( xx * xx + yy * yy ); z[i][j] = Math.exp( -r * r ) * Math.cos( 2.0 * Math.PI * r ); } if ( zmin > z[i][j] ) zmin = z[i][j]; if ( zmax < z[i][j] ) zmax = z[i][j]; } } double step = ( zmax - zmin ) / ( LEVELS + 1 ); for ( i = 0; i < LEVELS; i++ ) clevel[i] = zmin + step * ( i + 1 ); pls.lightsource( 1., 1., 1. ); for ( k = 0; k < 2; k++ ) { for ( ifshade = 0; ifshade < 4; ifshade++ ) { pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 0.9 ); pls.wind( -1.0, 1.0, -0.9, 1.1 ); pls.col0( 3 ); pls.mtex( "t", 1.0, 0.5, 0.5, title[k] ); pls.col0( 1 ); if ( rosen ) pls.w3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k] ); else pls.w3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k] ); pls.box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); pls.col0( 2 ); if ( ifshade == 0 ) // diffuse light surface plot { cmap1_init( 1 ); // with new interface haven't yet made null work so have // to put in specific zero-length array. pls.surf3d( x, y, z, 0, clev_null ); } else if ( ifshade == 1 ) // magnitude colored plot { cmap1_init( 0 ); pls.surf3d( x, y, z, MAG_COLOR, clev_null ); } else if ( ifshade == 2 ) // magnitude colored plot with faceted squares { cmap1_init( 0 ); pls.surf3d( x, y, z, MAG_COLOR | FACETED, clev_null ); } else // magnitude colored plot with contours { cmap1_init( 0 ); pls.surf3d( x, y, z, MAG_COLOR | SURF_CONT | BASE_CONT, clevel ); } } } pls.end(); } } //-------------------------------------------------------------------------- // End of x08.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x01.java 644 1750 1750 2060012102122103 167400ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x01.java 12288 2013-01-30 04:40:35Z airwin $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 1 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x01 { double xscale, yscale, xoff, yoff; PLStream pls = new PLStream(); // Set this to true to test the xormod method static boolean test_xor = false; static boolean locate_mode = false; static int fontset = 1; static String f_name = null; public static void main( String[] args ) { new x01( args ); } public x01( String[] args ) { // plplot initialization // Parse and process command line arguments. // plMergeOpts(options, "x01c options", notes); pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Print out version number. StringBuffer version = new StringBuffer( 80 ); // plgver no longer works for unexplained reasons. pls.gver( version ); System.out.println( "PLplot library version: " + version ); // Initialize PLplot. // Divide page into 2x2 plots unless user overrides. pls.star( 2, 2 ); // Select the multi-stroke font. if ( fontset == 1 ) pls.fontld( 1 ); else pls.fontld( 0 ); // Set up the data // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; // Do a plot plot1( false ); // Set up the data xscale = 1.; yscale = 0.0014; yoff = 0.0185; // Do a plot int digmax = 5; pls.syax( digmax, 0 ); plot1( true ); plot2(); plot3(); // Test option to save file if ( f_name != null ) { } // Let's get some user input // if (locate_mode) { // for (;;) { // if (! plGetCursor(&gin)) break; // if (gin.keysym == PLK_Escape) break; // pltext(); // if (gin.keysym < 0xFF && isprint(gin.keysym)) // printf("wx = %f, wy = %f, dx = %f, dy = %f, c = '%c'\n", // gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); // else // printf("wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x\n", // gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); // plgra(); // } // } // Don't forget to call plend() to finish off! pls.end(); } void plot1( boolean do_test ) { int i; double xmin, xmax, ymin, ymax; double x[] = new double[60]; double y[] = new double[60]; double xs[] = new double[6]; double ys[] = new double[6]; boolean st[] = new boolean[1]; double xx[] = new double[1]; double yy[] = new double[1]; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * Math.pow( x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is 0.0 to // 6.0, and the range in Y is 0.0 to 30.0. The axes are scaled separately // (just = 0), and we just draw a labelled box (axis = 0). pls.col0( 1 ); pls.env( xmin, xmax, ymin, ymax, 0, 0 ); pls.col0( 2 ); pls.lab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points. pls.col0( 4 ); pls.poin( xs, ys, 9 ); // Draw the line through the data. pls.col0( 3 ); pls.line( x, y ); // xor mode enable erasing a line/point/text by replotting it again // it does not work in double buffering mode, however if ( do_test && test_xor ) { pls.xormod( true, st ); // enter xor mode if ( st[0] ) { for ( i = 0; i < 60; i++ ) { xx[0] = x[i]; yy[0] = y[i]; pls.poin( xx, yy, 9 ); // draw a point try { Thread.sleep( 50 ); // wait a little } catch ( InterruptedException ie ) { } pls.flush(); // force an update of the tk driver pls.poin( xx, yy, 9 ); // erase point } pls.xormod( false, st ); // leave xor mode } } } void plot2() { int i; double x[] = new double[100]; double y[] = new double[100]; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled // separately (just = 0), and we draw a box with axes (axis = 1). pls.col0( 1 ); pls.env( -2.0, 10.0, -0.4, 1.2, 0, 1 ); pls.col0( 2 ); pls.lab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays. for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = Math.sin( x[i] ) / x[i]; } // Draw the line. pls.col0( 3 ); pls.width( 2 ); pls.line( x, y ); pls.width( 1 ); } void plot3() { int i; int space0[] = {}; int mark0[] = {}; int space1[] = { 1500 }; int mark1[] = { 1500 }; double x[] = new double[101]; double y[] = new double[101]; // For the final graph we wish to override the default tick intervals, // and so do not use plenv(). pls.adv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y // range from -1.2 to 1.2. pls.vsta(); pls.wind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. pls.col0( 1 ); pls.box( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. // plstyl expects a pointer! pls.styl( mark1, space1 ); pls.col0( 2 ); pls.box( "g", 30.0, 0, "g", 0.2, 0 ); pls.styl( mark0, space0 ); pls.col0( 3 ); pls.lab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = Math.sin( x[i] * Math.PI / 180.0 ); } pls.col0( 4 ); pls.line( x, y ); } } //-------------------------------------------------------------------------- // End of x01.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x26.java 644 1750 1750 2227212141234357 170000ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x26.java 12333 2013-05-04 16:35:59Z airwin $ // Multi-lingual version of the first page of example 4. //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2006 Alan W. Irwin // Copyright (C) 2006 Andrew Ross // // Thanks to the following for providing translated strings for this example: // Valery Pipin (Russian) // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // This example designed just for devices (e.g., psttfc and the // cairo-related devices) that use the pango and fontconfig libraries. The // best choice of glyph is selected by fontconfig and automatically rendered // by pango in way that is sensitive to complex text layout (CTL) language // issues for each unicode character in this example. Of course, you must // have the appropriate TrueType fonts installed to have access to all the // required glyphs. // // Translation instructions: The strings to be translated are given by // x_label, y_label, alty_label, title_label, and line_label below. The // encoding used must be UTF-8. // // The following strings to be translated involve some scientific/mathematical // jargon which is now discussed further to help translators. // // (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . // (2) degrees is an angular measure, see // http://en.wikipedia.org/wiki/Degree_(angle) . // (3) low-pass filter is one that transmits (passes) low frequencies. // (4) pole is in the mathematical sense, see // http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" // means a particular mathematical transformation of the filter function has // a single pole, see // http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . // Furthermore, a single-pole filter must have an inverse square decline // (or -20 db/decade). Since the filter plotted here does have that // characteristic, it must by definition be a single-pole filter, see also // http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm // (5) decade represents a factor of 10, see // http://en.wikipedia.org/wiki/Decade_(log_scale) . //-------------------------------------------------------------------------- // Implementation of PLplot example 26 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x26 { PLStream pls = new PLStream(); static String[] x_label = { "Frequency", "Частота" }; static String[] y_label = { "Amplitude (dB)", "Амплитуда (dB)" }; static String[] alty_label = { "Phase shift (degrees)", "Фазовый сдвиг (градусы)" }; // Short rearranged versions of y_label and alty_label. static String[][] legend_text = { { "Amplitude", "Phase shift" }, { "Амплитуда", "Фазовый сдвиг" } }; static String[] title_label = { "Single Pole Low-Pass Filter", "Однополюсный Низко-Частотный Фильтр" }; static String[] line_label = { "-20 dB/decade", "-20 dB/десяток" }; public static void main( String[] args ) { new x26( args ); } public x26( String[] args ) { int nlang, i; nlang = x_label.length; if ( ( nlang != y_label.length ) || ( nlang != alty_label.length ) || ( nlang != title_label.length ) || ( nlang != line_label.length ) ) { System.out.println( "Internal inconsistency in label dimensions" ); pls.end(); System.exit( 1 ); } // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); pls.font( 2 ); // Make log plots using different languages. for ( i = 0; i < nlang; i++ ) { plot1( 0, x_label[i], y_label[i], alty_label[i], legend_text[i], title_label[i], line_label[i] ); } pls.end(); } // Log-linear plot. void plot1( int type, String x_label, String y_label, String alty_label, String[] legend_text, String title_label, String line_label ) { int i; double[] freql = new double[101]; double[] ampl = new double[101]; double[] phase = new double[101]; double f0, freq; int[] opt_array = new int[2]; int[] text_colors = new int[2]; int[] line_colors = new int[2]; int[] line_styles = new int[2]; double[] line_widths = new double[2]; int[] symbol_numbers = new int[2]; int[] symbol_colors = new int[2]; double[] symbol_scales = new double[2]; String[] symbols = new String[2]; double[] legend_width = new double[1]; double[] legend_height = new double[1]; pls.adv( 0 ); // Set up data for log plot. f0 = 1.0; for ( i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = Math.pow( 10.0, freql[i] ); // Unbelievably, Java has no log10() that I can find... ampl[i] = 20.0 * Math.log( 1.0 / Math.sqrt( 1.0 + Math.pow( ( freq / f0 ), 2. ) ) ) / Math.log( 10. ); phase[i] = -( 180.0 / Math.PI ) * Math.atan( freq / f0 ); } pls.vpor( 0.15, 0.85, 0.1, 0.9 ); pls.wind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. pls.col0( 1 ); switch ( type ) { case 0: pls.box( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: pls.box( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; } // Plot ampl vs freq. pls.col0( 2 ); pls.line( freql, ampl ); pls.col0( 2 ); pls.ptex( 1.6, -30.0, 1.0, -20.0, 0.5, line_label ); // Put labels on. pls.col0( 1 ); pls.mtex( "b", 3.2, 0.5, 0.5, x_label ); pls.mtex( "t", 2.0, 0.5, 0.5, title_label ); pls.col0( 2 ); pls.mtex( "l", 5.0, 0.5, 0.5, y_label ); // For the gridless case, put phase vs freq on same plot. if ( type == 0 ) { pls.col0( 1 ); pls.wind( -2.0, 3.0, -100.0, 0.0 ); pls.box( "", 0.0, 0, "cmstv", 30.0, 3 ); pls.col0( 3 ); pls.line( freql, phase ); pls.string( freql, phase, "*" ); pls.col0( 3 ); pls.mtex( "r", 5.0, 0.5, 0.5, alty_label ); } // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices // do not have to be specified EXCEPT for symbols. // Although this is unused, it can't be undefined as the String // array is copied as part of the java bindings. symbols[0] = ""; // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // from the above opt_arrays we can completely ignore everything // to do with boxes. pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.10, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, legend_text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); } } //-------------------------------------------------------------------------- // End of x26.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x25.java 644 1750 1750 1263712033404504 167740ustar andrewandrew// $Id: x25.java 12240 2012-10-04 22:10:12Z andrewross $ // // Test program for filling polygons and proper clipping // // Copyright (C) 2005 Arjen Markus // (C) 2006 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x25 { PLStream pls = new PLStream(); public x25( String[] args ) { int i, j, k; double[][] xextreme = new double[10][2]; double[][] yextreme = new double[10][2]; double[] x0 = new double[1]; double[] y0 = new double[1]; // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.ssub( 3, 3 ); pls.init(); xextreme[0][0] = -120.0; xextreme[0][1] = 120.0; yextreme[0][0] = -120.0; yextreme[0][1] = 120.0; xextreme[1][0] = -120.0; xextreme[1][1] = 120.0; yextreme[1][0] = 20.0; yextreme[1][1] = 120.0; xextreme[2][0] = -120.0; xextreme[2][1] = 120.0; yextreme[2][0] = -20.0; yextreme[2][1] = 120.0; xextreme[3][0] = -80.0; xextreme[3][1] = 80.0; yextreme[3][0] = -20.0; yextreme[3][1] = 120.0; xextreme[4][0] = -220.0; xextreme[4][1] = -120.0; yextreme[4][0] = -120.0; yextreme[4][1] = 120.0; xextreme[5][0] = -20.0; xextreme[5][1] = 20.0; yextreme[5][0] = -120.0; yextreme[5][1] = 120.0; xextreme[6][0] = -20.0; xextreme[6][1] = 20.0; yextreme[6][0] = -20.0; yextreme[6][1] = 20.0; xextreme[7][0] = -80.0; xextreme[7][1] = 80.0; yextreme[7][0] = -80.0; yextreme[7][1] = 80.0; xextreme[8][0] = 20.0; xextreme[8][1] = 120.0; yextreme[8][0] = -120.0; yextreme[8][1] = 120.0; for ( k = 0; k < 2; k++ ) { for ( j = 0; j < 4; j++ ) { if ( j == 0 ) { // Polygon 1: a diamond x0 = new double[4]; y0 = new double[4]; x0[0] = 0; y0[0] = -100; x0[1] = -100; y0[1] = 0; x0[2] = 0; y0[2] = 100; x0[3] = 100; y0[3] = 0; } if ( j == 1 ) { // Polygon 1: a diamond - reverse direction x0 = new double[4]; y0 = new double[4]; x0[3] = 0; y0[3] = -100; x0[2] = -100; y0[2] = 0; x0[1] = 0; y0[1] = 100; x0[0] = 100; y0[0] = 0; } if ( j == 2 ) { // Polygon 2: a square with punctures x0 = new double[10]; y0 = new double[10]; x0[0] = -100; y0[0] = -100; x0[1] = -100; y0[1] = -80; x0[2] = 80; y0[2] = 0; x0[3] = -100; y0[3] = 80; x0[4] = -100; y0[4] = 100; x0[5] = -80; y0[5] = 100; x0[6] = 0; y0[6] = 80; x0[7] = 80; y0[7] = 100; x0[8] = 100; y0[8] = 100; x0[9] = 100; y0[9] = -100; } if ( j == 3 ) { // Polygon 2: a square with punctures - reversed direction x0 = new double[10]; y0 = new double[10]; x0[9] = -100; y0[9] = -100; x0[8] = -100; y0[8] = -80; x0[7] = 80; y0[7] = 0; x0[6] = -100; y0[6] = 80; x0[5] = -100; y0[5] = 100; x0[4] = -80; y0[4] = 100; x0[3] = 0; y0[3] = 80; x0[2] = 80; y0[2] = 100; x0[1] = 100; y0[1] = 100; x0[0] = 100; y0[0] = -100; } for ( i = 0; i < 9; i++ ) { pls.adv( 0 ); pls.vsta(); pls.wind( xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1] ); pls.col0( 2 ); pls.box( "bc", 1.0, 0, "bcnv", 10.0, 0 ); pls.col0( 1 ); pls.psty( 0 ); if ( k == 0 ) pls.fill( x0, y0 ); else pls.gradient( x0, y0, 45. ); pls.col0( 2 ); pls.lsty( 1 ); pls.line( x0, y0 ); } } } pls.end(); } public static void main( String[] args ) { new x25( args ); } } plplot-5.10.0+dfsg/examples/java/x00.java 644 1750 1750 435412033404504 167420ustar andrewandrew// $Id: x00.java 12240 2012-10-04 22:10:12Z andrewross $ // // Simple demo of a 2D line plot. // // Copyright (C) 2011 Alan W. Irwin // Copyright (C) 2012 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x00 { PLStream pls = new PLStream(); static int NSIZE = 101; public static void main( String[] args ) { new x00( args ); } public x00( String[] args ) { double x[] = new double[NSIZE]; double y[] = new double[NSIZE]; double xmin = 0., xmax = 1., ymin = 0., ymax = 100.; int i; // Prepare data to be plotted. for ( i = 0; i < NSIZE; i++ ) { x[i] = (double) ( i ) / (double) ( NSIZE - 1 ); y[i] = ymax * x[i] * x[i]; } // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); // Create a labelled box to hold the plot. pls.env( xmin, xmax, ymin, ymax, 0, 0 ); pls.lab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ); // Plot the data that was prepared above. pls.line( x, y ); // Close PLplot library pls.end(); } } //-------------------------------------------------------------------------- // End of x00.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x12.java 644 1750 1750 734012033404504 167430ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x12.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 12 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.text.*; class x12 { static double y0[] = { 5., 15., 12., 24., 28., 30., 20., 8., 12., 3. }; static double[] pos = { 0.0, 0.25, 0.5, 0.75, 1.0 }; static double[] red = { 0.0, 0.25, 0.5, 1.0, 1.0 }; static double[] green = { 1.0, 0.5, 0.5, 0.5, 1.0 }; static double[] blue = { 1.0, 1.0, 0.5, 0.25, 0.0 }; PLStream pls = new PLStream(); public static void main( String[] args ) { new x12( args ); } public x12( String[] args ) { NumberFormat nf = NumberFormat.getNumberInstance(); // Change to this custom format to get stupid locale commas // separating hundreds and thousands place out of labels. DecimalFormat nf4 = new DecimalFormat( "####" ); int i; pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); pls.init(); pls.adv( 0 ); pls.vsta(); pls.wind( 1980.0, 1990.0, 0.0, 35.0 ); pls.box( "bc", 1.0, 0, "bcnv", 10.0, 0 ); pls.col0( 2 ); pls.lab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" ); pls.scmap1l( true, pos, red, green, blue ); for ( i = 0; i < 10; i++ ) { // pls.col0(i + 1); pls.col1( i / 9.0 ); pls.psty( 0 ); plfbox( ( 1980. + i ), y0[i] ); // sprintf(string, "%.0f", y0[i]); String text = nf.format( (int) ( y0[i] + 0.5 ) ); pls.ptex( ( 1980. + i + .5 ), ( y0[i] + 1. ), 1.0, 0.0, .5, text ); // sprintf(string, "%d", 1980 + i); String text1 = nf4.format( 1980 + i ); pls.mtex( "b", 1.0, ( ( i + 1 ) * .1 - .05 ), 0.5, text1 ); } pls.end(); } void plfbox( double x0, double y0 ) { double[] x = new double[4]; double[] y = new double[4]; x[0] = x0; y[0] = 0.; x[1] = x0; y[1] = y0; x[2] = x0 + 1.; y[2] = y0; x[3] = x0 + 1.; y[3] = 0.; pls.fill( x, y ); pls.col0( 1 ); pls.lsty( 1 ); pls.line( x, y ); } } //-------------------------------------------------------------------------- // End of x12.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x14.java 644 1750 1750 3045012033404504 167630ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x14.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2004 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 14 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; import java.text.*; class x14 { double xscale, yscale, xoff, yoff; PLStream pls1 = new PLStream(); PLStream pls2 = new PLStream(); public static void main( String[] args ) { new x14( args ); } public x14( String[] args ) { String geometry_master = "500x410+100+200"; String geometry_slave = "500x410+650+200"; int fam[] = new int[1]; int num[] = new int[1]; int bmax[] = new int[1]; double xp0[] = new double[1], yp0[] = new double[1]; int xleng0[] = new int[1], yleng0[] = new int[1]; int xoff0[] = new int[1], yoff0[] = new int[1]; boolean valid_geometry; // Parse and process command line arguments. pls1.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // If valid geometry specified on command line, use it for both streams. pls1.gpage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); valid_geometry = ( xleng0[0] > 0 && yleng0[0] > 0 ); // Set up first stream if ( valid_geometry ) pls1.spage( xp0[0], yp0[0], xleng0[0], yleng0[0], xoff0[0], yoff0[0] ); else pls1.setopt( "geometry", geometry_master ); pls1.ssub( 2, 2 ); pls1.init(); StringBuffer driver = new StringBuffer( 80 ); pls1.gdev( driver ); pls1.gfam( fam, num, bmax ); String sdriver = new String( driver ); System.out.println( "Demo of multiple output streams via the " + sdriver + " driver." ); System.out.println( "Running with the second stream as slave to the first." ); System.out.println( "" ); // Start next stream // Turn off pause to make this a slave (must follow master) if ( valid_geometry ) pls2.spage( xp0[0], yp0[0], xleng0[0], yleng0[0], xoff0[0], yoff0[0] ); else pls2.setopt( "geometry", geometry_slave ); pls2.spause( false ); pls2.sdev( sdriver ); pls2.sfam( fam[0], num[0], bmax[0] ); pls2.setopt( "fflen", "2" ); pls2.init(); //Set up the data & plot // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; plot1( pls1 ); // Set up the data & plot xscale = 1.; yscale = 1.e+6; plot1( pls1 ); // Set up the data & plot xscale = 1.; yscale = 1.e-6; int digmax = 2; pls1.syax( digmax, 0 ); plot1( pls1 ); // Set up the data & plot xscale = 1.; yscale = 0.0014; yoff = 0.0185; digmax = 5; pls1.syax( digmax, 0 ); plot1( pls1 ); // To slave // The pleop() ensures the eop indicator gets lit. plot4( pls2 ); pls2.eop(); // Back to master plot2( pls1 ); plot3( pls1 ); // To slave plot5( pls2 ); pls2.eop(); // Back to master to wait for user to advance pls1.eop(); // Call plend to finish off. //pls2.endl(); pls1.end(); } void plot1( PLStream pls ) { int i; double xmin, xmax, ymin, ymax; double x[] = new double[60]; double y[] = new double[60]; double xs[] = new double[6]; double ys[] = new double[6]; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * Math.pow( x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is 0.0 to // 6.0, and the range in Y is 0.0 to 30.0. The axes are scaled separately // (just = 0), and we just draw a labelled box (axis = 0). pls.col0( 1 ); pls.env( xmin, xmax, ymin, ymax, 0, 0 ); pls.col0( 6 ); pls.lab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points. pls.col0( 9 ); pls.poin( xs, ys, 9 ); // Draw the line through the data. pls.col0( 4 ); pls.line( x, y ); pls.flush(); } void plot2( PLStream pls ) { int i; double x[] = new double[100]; double y[] = new double[100]; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled // separately (just = 0), and we draw a box with axes (axis = 1). pls.col0( 1 ); pls.env( -2.0, 10.0, -0.4, 1.2, 0, 1 ); pls.col0( 2 ); pls.lab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays. for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = Math.sin( x[i] ) / x[i]; } // Draw the line. pls.col0( 3 ); pls.line( x, y ); pls.flush(); } void plot3( PLStream pls ) { int i; int space0[] = {}; int mark0[] = {}; int space1[] = { 1500 }; int mark1[] = { 1500 }; double x[] = new double[101]; double y[] = new double[101]; // For the final graph we wish to override the default tick intervals, // and so do not use plenv(). pls.adv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y // range from -1.2 to 1.2. pls.vsta(); pls.wind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. pls.col0( 1 ); pls.box( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. // plstyl expects a pointer! pls.styl( mark1, space1 ); pls.col0( 2 ); pls.box( "g", 30.0, 0, "g", 0.2, 0 ); pls.styl( mark0, space0 ); pls.col0( 3 ); pls.lab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = Math.sin( x[i] * Math.PI / 180.0 ); } pls.col0( 4 ); pls.line( x, y ); pls.flush(); } void plot4( PLStream pls ) { NumberFormat nf = NumberFormat.getNumberInstance(); int i, j; double dtr, theta, dx, dy, r; double[] x0 = new double[361]; double[] y0 = new double[361]; double[] x = new double[361]; double[] y = new double[361]; dtr = Math.PI / 180.0; for ( i = 0; i <= 360; i++ ) { x0[i] = Math.cos( dtr * i ); y0[i] = Math.sin( dtr * i ); } // Set up viewport and window, but do not draw box. pls.env( -1.3, 1.3, -1.3, 1.3, 1, -2 ); for ( i = 1; i <= 10; i++ ) { for ( j = 0; j <= 360; j++ ) { x[j] = 0.1 * i * x0[j]; y[j] = 0.1 * i * y0[j]; } // Draw circles for polar grid. pls.line( x, y ); } pls.col0( 2 ); for ( i = 0; i <= 11; i++ ) { theta = 30.0 * i; dx = Math.cos( dtr * theta ); dy = Math.sin( dtr * theta ); // Draw radial spokes for polar grid. pls.join( 0.0, 0.0, dx, dy ); String text = nf.format( theta ); // Write labels for angle. //Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) pls.ptex( dx, dy, dx, dy, -0.15, text ); else pls.ptex( dx, dy, -dx, -dy, 1.15, text ); } // Draw the graph. for ( i = 0; i <= 360; i++ ) { r = Math.sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } pls.col0( 3 ); pls.line( x, y ); pls.col0( 4 ); pls.mtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); pls.flush(); } static final int XPTS = 35; static final int YPTS = 46; static final double XSPA = 2. / ( XPTS - 1 ); static final double YSPA = 2. / ( YPTS - 1 ); final double clevel[] = { -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. }; // Transformation function final double tr[] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; void plot5( PLStream pls ) { int i, j; double[][] xg0 = new double[XPTS][YPTS]; double[][] yg0 = new double[XPTS][YPTS]; double[][] z = new double[XPTS][YPTS]; double[][] w = new double[XPTS][YPTS]; double xx, yy; final int[] mark = { 1500 }; final int[] space = { 1500 }; final int[] mark0 = {}; final int[] space0 = {}; // Set up function arrays for ( i = 0; i < XPTS; i++ ) { xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } // Set up grids for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { // Replacement for mypltr of x09c.c xx = tr[0] * i + tr[1] * j + tr[2]; yy = tr[3] * i + tr[4] * j + tr[5]; // Note these are one-dimensional because of arrangement of // zeros in the final tr definition above. // But I haven't found out yet, how with swig to overload // one- and two-dimensional array arguments so for now make // xg0 --> yg1 two-dimensional. xg0[i][j] = xx; yg0[i][j] = yy; } } // Plot using scaled identity transform used to create xg0 and yg0 pls.env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls.col0( 2 ); pls.cont( z, 1, XPTS, 1, YPTS, clevel, xg0, yg0 ); pls.styl( mark, space ); pls.col0( 3 ); pls.cont( w, 1, XPTS, 1, YPTS, clevel, xg0, yg0 ); pls.styl( mark0, space0 ); pls.col0( 1 ); pls.lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pls.flush(); } } //-------------------------------------------------------------------------- // End of x14.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x16.java 644 1750 1750 3476212154201301 167710ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x16.java 12372 2013-06-06 21:44:33Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 16 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x16 { // number of shade levels, x data points, y data points, and perimeter points. static final int NSHADES = 20; static final int XPTS = 35; static final int YPTS = 46; static final int PERIMETERPTS = 100; static final int NUM_AXES = 1; static final int NUM_LABELS = 1; // calculated constants and array that depends on them static final double XSPA = 2. / ( XPTS - 1 ); static final double YSPA = 2. / ( YPTS - 1 ); final double tr[] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; PLStream pls = new PLStream(); double fmin, fmax; // Compute min and max value of a 2-d array. void f2mnmx( double[][] f, int nx, int ny ) { fmax = f[0][0]; fmin = fmax; for ( int i = 0; i < nx; i++ ) for ( int j = 0; j < ny; j++ ) { if ( f[i][j] < fmin ) fmin = f[i][j]; if ( f[i][j] > fmax ) fmax = f[i][j]; } } // Does a variety of shade plots with continuous (cmap1) colours public static void main( String[] args ) { new x16( args ); } public x16( String[] args ) { int i, j; double x, y, argx, argy, distort, r, t, zmin, zmax; double[] px = new double[PERIMETERPTS]; double[] py = new double[PERIMETERPTS]; double[][] xg0 = new double[XPTS][YPTS]; double[][] yg0 = new double[XPTS][YPTS]; double[][] xg1 = new double[XPTS][YPTS]; double[][] yg1 = new double[XPTS][YPTS]; double[][] z = new double[XPTS][YPTS]; double[][] w = new double[XPTS][YPTS]; double[][] xg2 = new double[XPTS][YPTS]; double[][] yg2 = new double[XPTS][YPTS]; double[] clevel = new double[NSHADES]; double[] shedge = new double[NSHADES + 1]; final int cont_color = 0; final double fill_width = 2., cont_width = 0.; double[] colorbar_width = new double[1]; double[] colorbar_height = new double[1]; int n_axis_opts = NUM_AXES; int[] num_values = new int[NUM_AXES]; double[][] values = new double[NUM_AXES][NSHADES + 1]; String axis_opts[] = { "bcvtm" }; double axis_ticks[] = { 0.0 }; int axis_subticks[] = { 0 }; double filler_values[] = { 0.0, 1.0 }; int n_labels = NUM_LABELS; int label_opts[] = { PL_COLORBAR_LABEL_BOTTOM }; String labels[] = { "Magnitude" }; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Load colour palettes pls.spal0( "cmap0_black_on_white.pal" ); pls.spal1( "cmap1_gray.pal", true ); // Reduce colors in cmap 0 so that cmap 1 is useful on a //16-color display pls.scmap0n( 3 ); //Initialize plplot pls.init(); // Set up data array for ( i = 0; i < XPTS; i++ ) { x = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { y = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = -Math.sin( 7. * x ) * Math.cos( 7. * y ) + x * x - y * y; w[i][j] = -Math.cos( 7. * x ) * Math.sin( 7. * y ) + 2 * x * y; } } f2mnmx( z, XPTS, YPTS ); zmin = fmin; zmax = fmax; for ( i = 0; i < NSHADES; i++ ) clevel[i] = zmin + ( zmax - zmin ) * ( i + 0.5 ) / NSHADES; for ( i = 0; i < NSHADES + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * i / NSHADES; for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { // Replacement for mypltr of x16c.c x = tr[0] * i + tr[1] * j + tr[2]; y = tr[3] * i + tr[4] * j + tr[5]; argx = x * Math.PI / 2; argy = y * Math.PI / 2; distort = 0.4; // Note xg0 ==> yg1 are one-dimensional because of arrangement of //zeros in the final tr definition above. However, for now //we are using raw interface here so must nominally treat them //as two-dimensional. xg0[i][j] = x; yg0[i][j] = y; xg1[i][j] = x + distort * Math.cos( argx ); yg1[i][j] = y - distort * Math.cos( argy ); xg2[i][j] = x + distort * Math.cos( argx ) * Math.cos( argy ); yg2[i][j] = y - distort * Math.cos( argx ) * Math.cos( argy ); } } // Plot using identity transform pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); pls.psty( 0 ); pls.shades( z, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, true, xg0, yg0 ); // Smaller text pls.schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls.smaj( 0.0, 0.5 ); pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; for ( i = 0; i < NSHADES + 1; i++ ) { values[0][i] = shedge[i]; } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); // Reset text and tick sizes pls.schr( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); pls.smin( 0.0, 1.0 ); pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); pls.lab( "distance", "altitude", "Bogon density" ); // Plot using 1d coordinate transform // Load colour palettes pls.spal0( "cmap0_black_on_white.pal" ); pls.spal1( "cmap1_blue_yellow.pal", true ); // Reduce colors in cmap 0 so that cmap 1 is useful on a //16-color display pls.scmap0n( 3 ); pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); pls.psty( 0 ); pls.shades( z, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, true, xg1, yg1 ); // Smaller text pls.schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls.smaj( 0.0, 0.5 ); pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; for ( i = 0; i < NSHADES + 1; i++ ) { values[0][i] = shedge[i]; } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); // Reset text and tick sizes pls.schr( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); pls.smin( 0.0, 1.0 ); pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); pls.lab( "distance", "altitude", "Bogon density" ); // Plot using 2d coordinate transform // Load colour palettes pls.spal0( "cmap0_black_on_white.pal" ); pls.spal1( "cmap1_blue_red.pal", true ); // Reduce colors in cmap 0 so that cmap 1 is useful on a //16-color display pls.scmap0n( 3 ); pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); pls.psty( 0 ); pls.shades( z, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, false, xg2, yg2 ); // Smaller text pls.schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls.smaj( 0.0, 0.5 ); pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; for ( i = 0; i < NSHADES + 1; i++ ) { values[0][i] = shedge[i]; } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); // Reset text and tick sizes pls.schr( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); pls.smin( 0.0, 1.0 ); pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); pls.cont( w, 1, XPTS, 1, YPTS, clevel, xg2, yg2 ); pls.lab( "distance", "altitude", "Bogon density, with streamlines" ); // Plot using 2d coordinate transform // Load colour palettes pls.spal0( "" ); pls.spal1( "", true ); // Reduce colors in cmap 0 so that cmap 1 is useful on a //16-color display pls.scmap0n( 3 ); pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.0 ); pls.psty( 0 ); pls.shades( z, -1., 1., -1., 1., shedge, fill_width, 2, 3., false, xg2, yg2 ); // Smaller text pls.schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls.smaj( 0.0, 0.5 ); pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; for ( i = 0; i < NSHADES + 1; i++ ) { values[0][i] = shedge[i]; } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3.0, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); // Reset text and tick sizes pls.schr( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); pls.smin( 0.0, 1.0 ); pls.col0( 1 ); pls.box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls.col0( 2 ); pls.lab( "distance", "altitude", "Bogon density" ); // Note this exclusion API will probably change so don't bother // with it for x16.java example. //Example with polar coordinates. // Load colour palettes pls.spal0( "cmap0_black_on_white.pal" ); pls.spal1( "cmap1_gray.pal", true ); // Reduce colors in cmap 0 so that cmap 1 is useful on a //16-color display pls.scmap0n( 3 ); pls.adv( 0 ); pls.vpor( .1, .9, .1, .9 ); pls.wind( -1., 1., -1., 1. ); pls.psty( 0 ); // Build new coordinate matrices. for ( i = 0; i < XPTS; i++ ) { r = ( (double) i ) / ( XPTS - 1 ); for ( j = 0; j < YPTS; j++ ) { t = ( 2. * Math.PI / ( YPTS - 1. ) ) * j; xg2[i][j] = r * Math.cos( t ); yg2[i][j] = r * Math.sin( t ); z[i][j] = Math.exp( -r * r ) * Math.cos( 5. * Math.PI * r ) * Math.cos( 5. * t ); } } //Need a new shedge to go along with the new data set. f2mnmx( z, XPTS, YPTS ); zmin = fmin; zmax = fmax; for ( i = 0; i < NSHADES + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * i / NSHADES; pls.shades( z, -1., 1., -1., 1., shedge, fill_width, cont_color, cont_width, false, xg2, yg2 ); // Smaller text pls.schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls.smaj( 0.0, 0.5 ); pls.smin( 0.0, 0.5 ); num_values[0] = NSHADES + 1; for ( i = 0; i < NSHADES + 1; i++ ) { values[0][i] = shedge[i]; } pls.colorbar( colorbar_width, colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, label_opts, labels, axis_opts, axis_ticks, axis_subticks, num_values, values ); // Reset text and tick sizes pls.schr( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); pls.smin( 0.0, 1.0 ); // Now we can draw the perimeter. (If do before, shade stuff may overlap.) for ( i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * Math.PI / ( PERIMETERPTS - 1 ) ) * i; px[i] = Math.cos( t ); py[i] = Math.sin( t ); } pls.col0( 1 ); pls.line( px, py ); // And label the plot. pls.col0( 2 ); pls.lab( "", "", "Tokamak Bogon Instability" ); // Clean up pls.end(); } } //-------------------------------------------------------------------------- // End of x16.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x22.java 644 1750 1750 2726212251353077 170030ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x22.java 12832 2013-12-09 14:39:59Z andrewross $ // Simple vector plot example //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 22 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class Transform implements PLCallbackCT { public void coordTransform( double x, double y, double[] xt, double[] yt, Object data ) { double xmax; xmax = 10.0; xt[0] = x; yt[0] = y / 4.0 * ( 3 - Math.cos( Math.PI * x / xmax ) ); } } class x22 { double MIN( double x, double y ) { return ( x < y ? x : y ); } double MAX( double x, double y ) { return ( x > y ? x : y ); } PLStream pls = new PLStream(); double[][] u = null; double[][] v = null; double[][] xg = null; double[][] yg = null; int nx, ny, nc, nseg; // Vector plot of the circulation about the origin void circulation() { int i, j; double dx, dy, x, y; double xmin, xmax, ymin, ymax; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; // Create data - cirulation around the origin. for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { x = ( i - nx / 2 + 0.5 ) * dx; y = ( j - ny / 2 + 0.5 ) * dy; xg[i][j] = x; yg[i][j] = y; u[i][j] = y; v[i][j] = -x; } } // Plot vectors with default arrows pls.env( xmin, xmax, ymin, ymax, 0, 0 ); pls.lab( "(x)", "(y)", "#frPLplot Example 22 - circulation" ); pls.col0( 2 ); pls.vect( u, v, 0.0, xg, yg ); pls.col0( 1 ); } // Vector plot of flow through a constricted pipe void constriction( int astyle ) { int i, j; double dx, dy, x, y; double xmin, xmax, ymin, ymax; double Q, b, dbdx; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; Q = 2.0; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { x = ( i - nx / 2 + 0.5 ) * dx; y = ( j - ny / 2 + 0.5 ) * dy; xg[i][j] = x; yg[i][j] = y; b = ymax / 4.0 * ( 3 - Math.cos( Math.PI * x / xmax ) ); if ( Math.abs( y ) < b ) { dbdx = ymax / 4.0 * Math.sin( Math.PI * x / xmax ) * Math.PI / xmax * y / b; u[i][j] = Q * ymax / b; v[i][j] = dbdx * u[i][j]; } else { u[i][j] = 0.0; v[i][j] = 0.0; } } } pls.env( xmin, xmax, ymin, ymax, 0, 0 ); pls.lab( "(x)", "(y)", "#frPLplot Example 22 - constriction (arrow style " + astyle + ")" ); pls.col0( 2 ); pls.vect( u, v, -1.0, xg, yg ); pls.col0( 1 ); } // // Vector plot of flow through a constricted pipe // with a coordinate transform // void constriction2( ) { int i, j; double dx, dy, x, y; double xmin, xmax, ymin, ymax; double Q, b, dbdx; double[] clev = new double[nc]; Transform transform = new Transform(); dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; pls.stransform( transform, xmax ); Q = 2.0; for ( i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; xg[i][j] = x; yg[i][j] = y; b = ymax / 4.0 * ( 3 - Math.cos( Math.PI * x / xmax ) ); u[i][j] = Q * ymax / b; v[i][j] = 0.0; } } for ( i = 0; i < nc; i++ ) { clev[i] = Q + i * Q / ( nc - 1 ); } pls.env( xmin, xmax, ymin, ymax, 0, 0 ); pls.lab( "(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform" ); pls.col0( 2 ); pls.shades( u, xmin + dx / 2, xmax - dx / 2, ymin + dy / 2, ymax - dy / 2, clev, 0, 1, 1.0, 0, xg, yg ); pls.vect( u, v, -1.0, xg, yg ); // Plot edges using plpath (which accounts for coordinate transformation) rather than plline pls.path( nseg, xmin, ymax, xmax, ymax ); pls.path( nseg, xmin, ymin, xmax, ymin ); pls.col0( 1 ); pls.stransform( null, null ); } // Vector plot of the gradient of a shielded potential (see example 9) void potential() { final int nper = 100; final int nlevel = 10; int i, j, nr, ntheta; double eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; double div1, div1i, div2, div2i; double[][] z; double r, theta, x, y, dz, rmax; double[] xmaxmin = new double[2]; double[] ymaxmin = new double[2]; double[] zmaxmin = new double[2]; double[] px = new double[nper]; double[] py = new double[nper]; double[] clevel = new double[nlevel]; nr = nx; ntheta = ny; // Create data to be plotted z = new double[nr][ntheta]; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. rmax = nr; eps = 2.; q1 = 1.; d1 = rmax / 4.; q1i = -q1 * rmax / d1; d1i = Math.pow( rmax, 2. ) / d1; q2 = -1.; d2 = rmax / 4.; q2i = -q2 * rmax / d2; d2i = Math.pow( rmax, 2. ) / d2; for ( i = 0; i < nr; i++ ) { r = 0.5 + i; for ( j = 0; j < ntheta; j++ ) { theta = 2. * Math.PI / ( ntheta - 1 ) * ( 0.5 + j ); x = r * Math.cos( theta ); y = r * Math.sin( theta ); xg[i][j] = x; yg[i][j] = y; div1 = Math.sqrt( Math.pow( x - d1, 2. ) + Math.pow( y - d1, 2. ) + Math.pow( eps, 2. ) ); div1i = Math.sqrt( Math.pow( x - d1i, 2. ) + Math.pow( y - d1i, 2. ) + Math.pow( eps, 2. ) ); div2 = Math.sqrt( Math.pow( x - d2, 2. ) + Math.pow( y + d2, 2. ) + Math.pow( eps, 2. ) ); div2i = Math.sqrt( Math.pow( x - d2i, 2. ) + Math.pow( y + d2i, 2. ) + Math.pow( eps, 2. ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; u[i][j] = -q1 * ( x - d1 ) / Math.pow( div1, 3. ) - q1i * ( x - d1i ) / Math.pow( div1i, 3.0 ) - q2 * ( x - d2 ) / Math.pow( div2, 3. ) - q2i * ( x - d2i ) / Math.pow( div2i, 3. ); v[i][j] = -q1 * ( y - d1 ) / Math.pow( div1, 3. ) - q1i * ( y - d1i ) / Math.pow( div1i, 3.0 ) - q2 * ( y + d2 ) / Math.pow( div2, 3. ) - q2i * ( y + d2i ) / Math.pow( div2i, 3. ); } } f2mnmx( xg, nr, ntheta, xmaxmin ); f2mnmx( yg, nr, ntheta, ymaxmin ); f2mnmx( z, nr, ntheta, zmaxmin ); pls.env( xmaxmin[1], xmaxmin[0], ymaxmin[1], ymaxmin[0], 0, 0 ); pls.lab( "(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot" ); // Plot contours of the potential dz = ( zmaxmin[0] - zmaxmin[1] ) / nlevel; for ( i = 0; i < nlevel; i++ ) { clevel[i] = zmaxmin[1] + ( i + 0.5 ) * dz; } pls.col0( 3 ); pls.lsty( 2 ); pls.cont( z, 1, nr, 1, ntheta, clevel, xg, yg ); pls.lsty( 1 ); pls.col0( 1 ); // Plot the vectors of the gradient of the potential pls.col0( 2 ); pls.vect( u, v, 25.0, xg, yg ); pls.col0( 1 ); // Plot the perimeter of the cylinder for ( i = 0; i < nper; i++ ) { theta = ( 2. * Math.PI / ( nper - 1 ) ) * i; px[i] = rmax * Math.cos( theta ); py[i] = rmax * Math.sin( theta ); } pls.line( px, py ); } void f2mnmx( double [][] f, int nx, int ny, double[] fmaxmin ) { int i, j; fmaxmin[0] = f[0][0]; fmaxmin[1] = fmaxmin[0]; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { fmaxmin[0] = MAX( fmaxmin[0], f[i][j] ); fmaxmin[1] = MIN( fmaxmin[1], f[i][j] ); } } } public x22( String[] args ) { boolean fill; // Set of points making a polygon to use as the arrow final double arrow_x[] = { -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 }; final double arrow_y[] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 }; final double arrow2_x[] = { -0.5, 0.3, 0.3, 0.5, 0.3, 0.3 }; final double arrow2_y[] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 }; // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); nx = 20; ny = 20; nc = 11; nseg = 20; // Allocate arrays u = new double[nx][ny]; v = new double[nx][ny]; xg = new double[nx][ny]; yg = new double[nx][ny]; circulation(); fill = false; // Set arrow style using arrow_x and arrow_y then // plot uMath.sing these arrows. pls.svect( arrow_x, arrow_y, fill ); constriction( 1 ); // Set arrow style using arrow2_x and arrow2_y then // plot using these filled arrows. fill = true; pls.svect( arrow2_x, arrow2_y, fill ); constriction( 2 ); constriction2(); pls.svect( null, null, false ); potential(); pls.end(); } public static void main( String[] args ) { new x22( args ); } } //-------------------------------------------------------------------------- // End of x22.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x18.java 644 1750 1750 1420512033404504 167670ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x18.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 18 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; import java.text.*; class x18 { static final int NPTS = 1000; static int opt[] = { 1, 0, 1, 0 }; static double alt[] = { 20.0, 35.0, 50.0, 65.0 }; static double az[] = { 30.0, 40.0, 50.0, 60.0 }; PLStream pls = new PLStream(); double THETA( int a ) { return 2. * Math.PI * a / 20.; } double PHI( int a ) { return Math.PI * a / 20.1; } void test_poly( int k ) { int i, j; boolean [][] draw = { { true, true, true, true }, { true, false, true, false }, { false, true, false, true }, { true, true, false, false } }; double [] x = new double [5]; double [] y = new double [5]; double [] z = new double [5]; pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 0.9 ); pls.wind( -1.0, 1.0, -0.9, 1.1 ); pls.col0( 1 ); pls.w3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); pls.box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); pls.col0( 2 ); // x = r sin(phi) cos(theta) // y = r sin(phi) sin(theta) // z = r cos(phi) // r = 1 :=) for ( i = 0; i < 20; i++ ) { for ( j = 0; j < 20; j++ ) { x[0] = Math.sin( PHI( j ) ) * Math.cos( THETA( i ) ); y[0] = Math.sin( PHI( j ) ) * Math.sin( THETA( i ) ); z[0] = Math.cos( PHI( j ) ); x[1] = Math.sin( PHI( j + 1 ) ) * Math.cos( THETA( i ) ); y[1] = Math.sin( PHI( j + 1 ) ) * Math.sin( THETA( i ) ); z[1] = Math.cos( PHI( j + 1 ) ); x[2] = Math.sin( PHI( j + 1 ) ) * Math.cos( THETA( i + 1 ) ); y[2] = Math.sin( PHI( j + 1 ) ) * Math.sin( THETA( i + 1 ) ); z[2] = Math.cos( PHI( j + 1 ) ); x[3] = Math.sin( PHI( j ) ) * Math.cos( THETA( i + 1 ) ); y[3] = Math.sin( PHI( j ) ) * Math.sin( THETA( i + 1 ) ); z[3] = Math.cos( PHI( j ) ); x[4] = Math.sin( PHI( j ) ) * Math.cos( THETA( i ) ); y[4] = Math.sin( PHI( j ) ) * Math.sin( THETA( i ) ); z[4] = Math.cos( PHI( j ) ); pls.poly3( x, y, z, draw[k], true ); } } pls.col0( 3 ); pls.mtex( "t", 1.0, 0.5, 0.5, "unit radius sphere" ); } // Does a series of 3-d plots for a given data set, with different // viewing options in each plot. public static void main( String[] args ) { new x18( args ); } public x18( String[] args ) { NumberFormat nf = NumberFormat.getNumberInstance(); int i, k; double r; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); for ( k = 0; k < 4; k++ ) test_poly( k ); double[] x = new double[NPTS]; double[] y = new double[NPTS]; double[] z = new double[NPTS]; // From the mind of a sick and twisted physicist... for ( i = 0; i < NPTS; i++ ) { z[i] = -1. + 2. * i / NPTS; // Pick one ... // r = 1. - ( (double) i / (double) NPTS ); r = z[i]; x[i] = r * Math.cos( 2. * Math.PI * 6. * i / NPTS ); y[i] = r * Math.sin( 2. * Math.PI * 6. * i / NPTS ); } for ( k = 0; k < 4; k++ ) { pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 0.9 ); pls.wind( -1.0, 1.0, -0.9, 1.1 ); pls.col0( 1 ); pls.w3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); pls.box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); pls.col0( 2 ); if ( opt[k] > 0 ) pls.line3( x, y, z ); else // U+22C5 DOT OPERATOR. pls.string3( x, y, z, "⋅" ); pls.col0( 3 ); String title = "#frPLplot Example 18 - Alt=" + nf.format( (int) alt[k] ) + ", Az=" + nf.format( (int) az[k] ); pls.mtex( "t", 1.0, 0.5, 0.5, title ); } pls.end(); } } //-------------------------------------------------------------------------- // End of x18.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x02.java 644 1750 1750 1215512102122103 167470ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x02.java 12288 2013-01-30 04:40:35Z airwin $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2002 Alan W. Irwin // Copyright (C) 2004,2005 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 2 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.text.*; class x02 { private PLStream pls; public static void main( String[] args ) { new x02( args ); } x02( String[] args ) { pls = new PLStream(); // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); demo1(); demo2(); pls.end(); } void demo1() { pls.bop(); // Divide screen into 16 regions. pls.ssub( 4, 4 ); draw_windows( 16, 0 ); pls.eop(); } void demo2() { // Set up cmap0 // Use 100 custom colors in addition to base 16 int[] r = new int[116]; int[] g = new int[116]; int[] b = new int[116]; int[] r1i = new int[1]; int[] g1i = new int[1]; int[] b1i = new int[1]; // Min and max lightness values double lmin = 0.15, lmax = 0.85; int i; pls.bop(); // Divide screen into 100 regions. pls.ssub( 10, 10 ); for ( i = 0; i <= 99; i++ ) { double h, l, s; double[] r1 = new double[1]; double[] g1 = new double[1]; double[] b1 = new double[1]; // Bounds on HLS, from plhlsrgb() commentary -- // hue [0., 360.] degrees // lightness [0., 1.] magnitude // saturation [0., 1.] magnitude // // Vary hue uniformly from left to right h = ( 360. / 10. ) * ( i % 10 ); // Vary lightness uniformly from top to bottom, between min & max l = lmin + ( lmax - lmin ) * ( i / 10 ) / 9.; // Use max saturation s = 1.0; pls.hlsrgb( h, l, s, r1, g1, b1 ); r[i + 16] = (int) ( r1[0] * 255.001 ); g[i + 16] = (int) ( g1[0] * 255.001 ); b[i + 16] = (int) ( b1[0] * 255.001 ); } // Load default cmap0 colors into our custom set for ( i = 0; i <= 15; i++ ) { pls.gcol0( i, r1i, g1i, b1i ); r[i] = r1i[0]; g[i] = g1i[0]; b[i] = b1i[0]; } // Now set cmap0 all at once (faster, since fewer driver calls) pls.scmap0( r, g, b ); draw_windows( 100, 16 ); pls.eop(); } // -------------------------------------------------------------------- // draw_windows // // Draws a set of numbered boxes with colors according to cmap0 entry. // -------------------------------------------------------------------- void draw_windows( int nw, int cmap0_offset ) { int i, j; double vmin, vmax; NumberFormat nf = NumberFormat.getNumberInstance(); pls.schr( 0.0, 3.5 ); pls.font( 4 ); for ( i = 0; i < nw; i++ ) { pls.col0( i + cmap0_offset ); String text = nf.format( i ); pls.adv( 0 ); vmin = 0.1; vmax = 0.9; for ( j = 0; j <= 2; j++ ) { pls.width( j + 1 ); pls.vpor( vmin, vmax, vmin, vmax ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.box( "bc", 0.0, 0, "bc", 0.0, 0 ); vmin = vmin + 0.1; vmax = vmax - 0.1; } pls.width( 1 ); pls.ptex( 0.5, 0.5, 1.0, 0.0, 0.5, text ); } } } //-------------------------------------------------------------------------- // End of x02.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x23.java 644 1750 1750 3430512033404504 167660ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x23.java 12240 2012-10-04 22:10:12Z andrewross $ // Displays Greek letters and mathematically interesting Unicode ranges //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2005 Alan Irwin // Copyright (C) 2005 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 23 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; // // Displays Greek letters and mathematically interesting Unicode ranges // class x23 { PLStream pls = new PLStream(); static String[] Greek = { "#gA", "#gB", "#gG", "#gD", "#gE", "#gZ", "#gY", "#gH", "#gI", "#gK", "#gL", "#gM", "#gN", "#gC", "#gO", "#gP", "#gR", "#gS", "#gT", "#gU", "#gF", "#gX", "#gQ", "#gW", "#ga", "#gb", "#gg", "#gd", "#ge", "#gz", "#gy", "#gh", "#gi", "#gk", "#gl", "#gm", "#gn", "#gc", "#go", "#gp", "#gr", "#gs", "#gt", "#gu", "#gf", "#gx", "#gq", "#gw" }; static String[] Type1 = { "0x0020", "0x0021", "0x0023", "0x0025", "0x0026", "0x0028", "0x0029", "0x002b", "0x002c", "0x002e", "0x002f", "0x0030", "0x0031", "0x0032", "0x0033", "0x0034", "0x0035", "0x0036", "0x0037", "0x0038", "0x0039", "0x003a", "0x003b", "0x003c", "0x003d", "0x003e", "0x003f", "0x005b", "0x005d", "0x005f", "0x007b", "0x007c", "0x007d", "0x00a9", "0x00ac", "0x00ae", "0x00b0", "0x00b1", "0x00d7", "0x00f7", "0x0192", "0x0391", "0x0392", "0x0393", "0x0394", "0x0395", "0x0396", "0x0397", "0x0398", "0x0399", "0x039a", "0x039b", "0x039c", "0x039d", "0x039e", "0x039f", "0x03a0", "0x03a1", "0x03a3", "0x03a4", "0x03a5", "0x03a6", "0x03a7", "0x03a8", "0x03a9", "0x03b1", "0x03b2", "0x03b3", "0x03b4", "0x03b5", "0x03b6", "0x03b7", "0x03b8", "0x03b9", "0x03ba", "0x03bb", "0x03bc", "0x03bd", "0x03be", "0x03bf", "0x03c0", "0x03c1", "0x03c2", "0x03c3", "0x03c4", "0x03c5", "0x03c6", "0x03c7", "0x03c8", "0x03c9", "0x03d1", "0x03d2", "0x03d5", "0x03d6", "0x2022", "0x2026", "0x2032", "0x2033", "0x203e", "0x2044", "0x2111", "0x2118", "0x211c", "0x2122", "0x2126", "0x2135", "0x2190", "0x2191", "0x2192", "0x2193", "0x2194", "0x21b5", "0x21d0", "0x21d1", "0x21d2", "0x21d3", "0x21d4", "0x2200", "0x2202", "0x2203", "0x2205", "0x2206", "0x2207", "0x2208", "0x2209", "0x220b", "0x220f", "0x2211", "0x2212", "0x2215", "0x2217", "0x221a", "0x221d", "0x221e", "0x2220", "0x2227", "0x2228", "0x2229", "0x222a", "0x222b", "0x2234", "0x223c", "0x2245", "0x2248", "0x2260", "0x2261", "0x2264", "0x2265", "0x2282", "0x2283", "0x2284", "0x2286", "0x2287", "0x2295", "0x2297", "0x22a5", "0x22c5", "0x2320", "0x2321", "0x2329", "0x232a", "0x25ca", "0x2660", "0x2663", "0x2665", "0x2666" }; static String[] title = { "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)", }; static int[] lo = { 0x0, 0x0, 0x40, 0x80, 0x2153, 0x2190, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, }; static int[] hi = { 0x30, 0x40, 0x80, 0xA6, 0x2184, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, 0x2300, }; static int[] nxcells = { 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static int[] nycells = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; // non-zero values Must be consistent with nxcells and nycells. static int[] offset = { 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0, }; // 30 possible FCI values. static int FCI_COMBINATIONS = 30; static long fci[] = { 0x80000000L, 0x80000001L, 0x80000002L, 0x80000003L, 0x80000004L, 0x80000010L, 0x80000011L, 0x80000012L, 0x80000013L, 0x80000014L, 0x80000020L, 0x80000021L, 0x80000022L, 0x80000023L, 0x80000024L, 0x80000100L, 0x80000101L, 0x80000102L, 0x80000103L, 0x80000104L, 0x80000110L, 0x80000111L, 0x80000112L, 0x80000113L, 0x80000114L, 0x80000120L, 0x80000121L, 0x80000122L, 0x80000123L, 0x80000124L, }; static String family[] = { "sans-serif", "serif", "monospace", "script", "symbol", }; static String style[] = { "upright", "italic", "oblique", }; static String weight[] = { "medium", "bold", }; public x23( String[] args ) { double xmin[], xmax[], ymin[], ymax[], ycharacter_scale, yoffset; double chardef[], charht[], deltax, deltay, x, y; int i, j, page, length, slice; String cmdString = null; pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); pls.init(); for ( page = 0; page < 11; page++ ) { pls.adv( 0 ); // Set up viewport and window pls.vpor( 0.02, 0.98, 0.02, 0.90 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); xmin = new double[1]; xmax = new double[1]; ymin = new double[1]; ymax = new double[1]; pls.gspa( xmin, xmax, ymin, ymax ); pls.schr( 0., 0.8 ); ycharacter_scale = ( 1.0 - 0.0 ) / ( ymax[0] - ymin[0] ); // Factor should be 0.5, but heuristically it turns out to be larger. chardef = new double[1]; charht = new double[1]; pls.gchr( chardef, charht ); yoffset = 1.0 * charht[0] * ycharacter_scale; // Draw the grid using PLStream.box pls.col0( 2 ); deltax = 1.0 / ( nxcells[page] ); deltay = 1.0 / ( nycells[page] ); pls.box( "bcg", deltax, 0, "bcg", deltay, 0 ); pls.col0( 15 ); length = hi[page] - lo[page]; slice = 0; for ( j = nycells[page] - 1; j >= -1; j-- ) { y = ( 0.5 + j ) * deltay; for ( i = 0; i < nxcells[page]; i++ ) { x = ( 0.5 + i ) * deltax; if ( slice < length ) { if ( page == 0 ) { cmdString = Greek[slice]; } else if ( ( page >= 1 ) && ( page <= 3 ) ) { cmdString = "#[" + Type1[offset[page] + slice] + "]"; } else if ( page >= 4 ) { cmdString = "#[0x" + Integer.toHexString( lo[page] + slice ) + "]"; } pls.ptex( x, y + yoffset, 1., 0., 0.5, cmdString ); pls.ptex( x, y - yoffset, 1., 0., 0.5, "#" + cmdString ); } slice += 1; } } pls.schr( 0., 1.0 ); // Page title pls.mtex( "t", 1.5, 0.5, 0.5, title[page] ); } // Demonstrate methods of getting the current fonts long[] fci_old = new long[1]; int[] ifamily = new int[1]; int[] istyle = new int[1]; int[] iweight = new int[1]; pls.gfci( fci_old ); pls.gfont( ifamily, istyle, iweight ); System.out.println( "For example 23 prior to page 12 the FCI is 0x" + Long.toHexString( fci_old[0] ) ); System.out.println( "For example 23 prior to page 12 the font family, style and weight are " + family[ifamily[0]] + " " + style[istyle[0]] + " " + weight[iweight[0]] );; for ( page = 11; page < 16; page++ ) { double dy = 0.030; int family_index, style_index, weight_index; // Must be big enough to contain the prefix strings, the // font-changing commands, and the "The quick brown..." string. String string = ""; pls.adv( 0 ); pls.vpor( 0.02, 0.98, 0.02, 0.90 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.sfci( 0 ); if ( page == 11 ) { pls.mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " + "Set Font with plsfci" ); } else if ( page == 12 ) { pls.mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " + "Set Font with plsfont" ); } else if ( page == 13 ) { pls.mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " + "Set Font with ##<0x8nnnnnnn> construct" ); } else if ( page == 14 ) { pls.mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " + "Set Font with ##<0xmn> constructs" ); } else if ( page == 15 ) { pls.mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " + "Set Font with ## constructs" ); } pls.schr( 0., 0.75 ); for ( i = 0; i < FCI_COMBINATIONS; i++ ) { family_index = i % 5; style_index = ( i / 5 ) % 3; weight_index = ( ( i / 5 ) / 3 ) % 2; if ( page == 11 ) { pls.sfci( fci[i] ); string = "Page 12, " + family[family_index] + ", " + style[style_index] + ", " + weight[weight_index] + ": The quick brown fox jumps over the lazy dog"; } else if ( page == 12 ) { pls.sfont( family_index, style_index, weight_index ); string = "Page 13, " + family[family_index] + ", " + style[style_index] + ", " + weight[weight_index] + ": The quick brown fox jumps over the lazy dog"; } else if ( page == 13 ) { string = "Page 14, " + family[family_index] + ", " + style[style_index] + ", " + weight[weight_index] + ": #<0x" + Long.toHexString( fci[i] ) + ">" + "The quick brown fox jumps over the lazy dog"; } else if ( page == 14 ) { string = "Page 15, " + family[family_index] + ", " + style[style_index] + ", " + weight[weight_index] + ": " + "#<0x" + Integer.toHexString( family_index ) + "0>" + "#<0x" + Integer.toHexString( style_index ) + "1>" + "#<0x" + Integer.toHexString( weight_index ) + "2>" + "The quick brown fox jumps over the lazy dog"; } else if ( page == 15 ) { string = "Page 16, " + family[family_index] + ", " + style[style_index] + ", " + weight[weight_index] + ": " + "#<" + family[family_index] + "/>" + "#<" + style[style_index] + "/>" + "#<" + weight[weight_index] + "/>" + "The quick brown fox jumps over the lazy dog"; } pls.ptex( 0., 1. - ( i + 0.5 ) * dy, 1., 0., 0., string ); } pls.schr( 0., 1.0 ); } // Restore defaults pls.col0( 1 ); pls.end(); } public static void main( String[] args ) { new x23( args ); } } //-------------------------------------------------------------------------- // End of x23.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x30.java 644 1750 1750 1210112033404504 167520ustar andrewandrew// $Id: x30.java 12240 2012-10-04 22:10:12Z andrewross $ // // Alpha color values demonstration. // // Copyright (C) 2008 Hazen Babcock // Copyright (C) 2008 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example will only really be interesting when used with devices that // support or alpha (or transparency) values, such as the cairo device family. // package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x30 { PLStream pls = new PLStream(); static int[] red = { 0, 255, 0, 0 }; static int[] green = { 0, 0, 255, 0 }; static int[] blue = { 0, 0, 0, 255 }; static double[] alpha = { 1.0, 1.0, 1.0, 1.0 }; static double[] px = { 0.1, 0.5, 0.5, 0.1 }; static double[] py = { 0.1, 0.1, 0.5, 0.5 }; static double[] pos = { 0.0, 1.0 }; static double[] rcoord = { 1.0, 1.0 }; static double[] gcoord = { 0.0, 0.0 }; static double[] bcoord = { 0.0, 0.0 }; static double[] acoord = { 0.0, 1.0 }; x30( String[] args ) { int i, j; int icol; int[] r = new int[1]; int[] g = new int[1]; int[] b = new int[1]; double[] a = new double[1]; pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); pls.init(); pls.scmap0n( 4 ); pls.scmap0a( red, green, blue, alpha ); // // Page 1: // // This is a series of red, green and blue rectangles overlaid // on each other with gradually increasing transparency. // // Set up the window pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 1.0 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.col0( 0 ); pls.box( "", 1.0, 0, "", 1.0, 0 ); // Draw the boxes for ( i = 0; i < 9; i++ ) { icol = i % 3 + 1; // Get a color, change its transparency and // set it as the current color. pls.gcol0a( icol, r, g, b, a ); pls.scol0a( icol, r[0], g[0], b[0], 1.0 - i / 9.0 ); pls.col0( icol ); // Draw the rectangle pls.fill( px, py ); // Shift the rectangles coordinates for ( j = 0; j < 4; j++ ) { px[j] += 0.5 / 9.0; py[j] += 0.5 / 9.0; } } // // Page 2: // // This is a bunch of boxes colored red, green or blue with a single // large (red) box of linearly varying transparency overlaid. The // overlaid box is completely transparent at the bottom and completely // opaque at the top. // // Set up the window pls.adv( 0 ); pls.vpor( 0.1, 0.9, 0.1, 0.9 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); // Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for ( i = 0; i < 5; i++ ) { // Set box X position px[0] = 0.05 + 0.2 * i; px[1] = px[0] + 0.1; px[2] = px[1]; px[3] = px[0]; // We don't want the boxes to be transparent, so since we changed // the colors transparencies in the first example we have to change // the transparencies back to completely opaque. icol = i % 3 + 1; pls.gcol0a( icol, r, g, b, a ); pls.scol0a( icol, r[0], g[0], b[0], 1.0 ); pls.col0( icol ); for ( j = 0; j < 5; j++ ) { // Set box y position and draw the box. py[0] = 0.05 + 0.2 * j; py[1] = py[0]; py[2] = py[0] + 0.1; py[3] = py[2]; pls.fill( px, py ); } } // Create the color map with 128 colors and use plscmap1la to initialize // the color values with a linearly varying red transparency (or alpha) pls.scmap1n( 128 ); pls.scmap1la( true, pos, rcoord, gcoord, bcoord, acoord ); //Use that cmap1 to create a transparent red gradient for the whole // window. px[0] = 0.; px[1] = 1.; px[2] = 1.; px[3] = 0.; py[0] = 0.; py[1] = 0.; py[2] = 1.; py[3] = 1.; pls.gradient( px, py, 90. ); pls.end(); } public static void main( String[] args ) { new x30( args ); } }; plplot-5.10.0+dfsg/examples/java/x29.java 644 1750 1750 3217012033404504 167720ustar andrewandrew// $Id: x29.java 12240 2012-10-04 22:10:12Z andrewross $ // // Sample plots using date / time formatting for axes // // Copyright (C) 2008 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.util.*; class x29 { PLStream pls = new PLStream(); //------------------------------------------------------------------------ // main // // Draws several plots which demonstrate the use of date / time formats // for the axis labels. // Time formatting is done using the system strftime routine. See the // documentation of this for full details of the available formats. // // 1) Plotting temperature over a day (using hours / minutes) // 2) Plotting // // Note: Times are stored as seconds since the epoch (usually // 1st Jan 1970). // //------------------------------------------------------------------------ x29( String[] args ) { // Parse command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); pls.sesc( '@' ); plot1(); plot2(); plot3(); plot4(); pls.end(); } // Plot a model diurnal cycle of temperature void plot1() { int i, npts; double xmin, xmax, ymin, ymax; double x[], y[], xerr1[], xerr2[], yerr1[], yerr2[]; // Data points every 10 minutes for 1 day npts = 73; x = new double[npts]; y = new double[npts]; xerr1 = new double[npts]; xerr2 = new double[npts]; yerr1 = new double[npts]; yerr2 = new double[npts]; xmin = 0; xmax = 60.0 * 60.0 * 24.0; // Number of seconds in a day ymin = 10.0; ymax = 20.0; for ( i = 0; i < npts; i++ ) { x[i] = xmax * ( (double) i / (double) npts ); y[i] = 15.0 - 5.0 * Math.cos( 2 * Math.PI * ( (double) i / (double) npts ) ); // Set x error bars to +/- 5 minute xerr1[i] = x[i] - 60 * 5; xerr2[i] = x[i] + 60 * 5; // Set y error bars to +/- 0.1 deg C yerr1[i] = y[i] - 0.1; yerr2[i] = y[i] + 0.1; } pls.adv( 0 ); // Rescale major ticks marks by 0.5 pls.smaj( 0.0, 0.5 ); // Rescale minor ticks and error bar marks by 0.5 pls.smin( 0.0, 0.5 ); pls.vsta(); pls.wind( xmin, xmax, ymin, ymax ); // Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. pls.col0( 1 ); // Set time format to be hours:minutes pls.timefmt( "%H:%M" ); pls.box( "bcnstd", 3.0 * 60 * 60, 3, "bcnstv", 1, 5 ); pls.col0( 3 ); pls.lab( "Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature" ); pls.col0( 4 ); pls.line( x, y ); pls.col0( 2 ); pls.errx( xerr1, xerr2, y ); pls.col0( 3 ); pls.erry( x, yerr1, yerr2 ); // Rescale major / minor tick marks back to default pls.smin( 0.0, 1.0 ); pls.smaj( 0.0, 1.0 ); } // Plot the number of hours of daylight as a function of day for a year void plot2() { int j, npts; double xmin, xmax, ymin, ymax; double lat, p, d; double x[], y[]; // Latitude for London lat = 51.5; npts = 365; x = new double[npts]; y = new double[npts]; xmin = 0; xmax = npts * 60.0 * 60.0 * 24.0; ymin = 0; ymax = 24; // Formula for hours of daylight from // "A Model Comparison for Daylength as a Function of Latitude and // Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for ( j = 0; j < npts; j++ ) { x[j] = j * 60.0 * 60.0 * 24.0; p = Math.asin( 0.39795 * Math.cos( 0.2163108 + 2 * Math.atan( 0.9671396 * Math.tan( 0.00860 * ( j - 186 ) ) ) ) ); d = 24.0 - ( 24.0 / Math.PI ) * Math.acos( ( Math.sin( 0.8333 * Math.PI / 180.0 ) + Math.sin( lat * Math.PI / 180.0 ) * Math.sin( p ) ) / ( Math.cos( lat * Math.PI / 180.0 ) * Math.cos( p ) ) ); y[j] = d; } pls.col0( 1 ); // Set time format to be abbreviated month name followed by day of month pls.timefmt( "%b %d" ); pls.prec( 1, 1 ); pls.env( xmin, xmax, ymin, ymax, 0, 40 ); pls.col0( 3 ); pls.lab( "Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N" ); pls.col0( 4 ); pls.line( x, y ); pls.prec( 0, 0 ); } void plot3() { int i, npts; double xmin, xmax, ymin, ymax; long tstart; double x[], y[]; TimeZone tz = TimeZone.getTimeZone( "UTC" ); Calendar cal = Calendar.getInstance( tz ); cal.set( 2005, 11, 1, 0, 0, 0 ); tstart = cal.getTimeInMillis() / 1000; npts = 62; x = new double[npts]; y = new double[npts]; xmin = tstart; xmax = xmin + npts * 60.0 * 60.0 * 24.0; ymin = 0.0; ymax = 5.0; for ( i = 0; i < npts; i++ ) { x[i] = xmin + i * 60.0 * 60.0 * 24.0; y[i] = 1.0 + Math.sin( 2 * Math.PI * ( i ) / 7.0 ) + Math.exp( ( Math.min( i, npts - i ) ) / 31.0 ); } pls.adv( 0 ); pls.vsta(); pls.wind( xmin, xmax, ymin, ymax ); pls.col0( 1 ); // Set time format to be ISO 8601 standard YYYY-MM-HH. Note that this is // equivalent to %f for C99 compliant implementations of strftime. pls.timefmt( "%Y-%m-%d" ); // Draw a box with ticks spaced every 14 days in X and 1 hour in Y. pls.box( "bcnstd", 14 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1, 4 ); pls.col0( 3 ); pls.lab( "Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006" ); pls.col0( 4 ); pls.ssym( 0.0, 0.5 ); pls.poin( x, y, 2 ); pls.line( x, y ); } void plot4() { // TAI-UTC (seconds) as a function of time. // Use Besselian epochs as the continuous time interval just to prove // this does not introduce any issues. double scale, offset1, offset2; double xmin[] = new double[1], xmax[] = new double[1]; double ymin = 0.0, ymax = 0.0, xlabel_step = 0.0; int kind, npts = 1001, i; boolean if_TAI_time_format = false; String time_format = ""; String title_suffix = ""; String xtitle = ""; String title = ""; double x[]; double y[]; int tai_year[] = new int[1], tai_month[] = new int[1], tai_day[] = new int[1], tai_hour[] = new int[1], tai_min[] = new int[1]; double tai_sec[] = new double[1], tai; int utc_year[] = new int[1], utc_month[] = new int[1], utc_day[] = new int[1], utc_hour[] = new int[1], utc_min[] = new int[1]; double utc_sec[] = new double[1], utc[] = new double[1]; // Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch // B = 1900. + (JD -2415020.31352)/365.242198781 // ==> (as calculated with aid of "bc -l" command) // B = (MJD + 678940.364163900)/365.242198781 // ==> // MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781; offset1 = -678940.; offset2 = -0.3641639; pls.configtime( scale, offset1, offset2, 0x0, false, 0, 0, 0, 0, 0, 0. ); for ( kind = 0; kind < 7; kind++ ) { if ( kind == 0 ) { pls.ctime( 1950, 0, 2, 0, 0, 0., xmin ); pls.ctime( 2020, 0, 2, 0, 0, 0., xmax ); npts = 70 * 12 + 1; ymin = 0.0; ymax = 36.0; time_format = "%Y%"; if_TAI_time_format = true; title_suffix = "from 1950 to 2020"; xtitle = "Year"; xlabel_step = 10.; } else if ( kind == 1 || kind == 2 ) { pls.ctime( 1961, 7, 1, 0, 0, 1.64757 - .20, xmin ); pls.ctime( 1961, 7, 1, 0, 0, 1.64757 + .20, xmax ); npts = 1001; ymin = 1.625; ymax = 1.725; time_format = "%S%2%"; title_suffix = "near 1961-08-01 (TAI)"; xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 1 ) { if_TAI_time_format = true; xtitle = "Seconds (TAI)"; } else { if_TAI_time_format = false; xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } else if ( kind == 3 || kind == 4 ) { pls.ctime( 1963, 10, 1, 0, 0, 2.6972788 - .20, xmin ); pls.ctime( 1963, 10, 1, 0, 0, 2.6972788 + .20, xmax ); npts = 1001; ymin = 2.55; ymax = 2.75; time_format = "%S%2%"; title_suffix = "near 1963-11-01 (TAI)"; xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 3 ) { if_TAI_time_format = true; xtitle = "Seconds (TAI)"; } else { if_TAI_time_format = false; xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } else if ( kind == 5 || kind == 6 ) { pls.ctime( 2009, 0, 1, 0, 0, 34. - 5., xmin ); pls.ctime( 2009, 0, 1, 0, 0, 34. + 5., xmax ); npts = 1001; ymin = 32.5; ymax = 34.5; time_format = "%S%2%"; title_suffix = "near 2009-01-01 (TAI)"; xlabel_step = 1. / ( scale * 86400. ); if ( kind == 5 ) { if_TAI_time_format = true; xtitle = "Seconds (TAI)"; } else { if_TAI_time_format = false; xtitle = "Seconds (TAI) labelled with corresponding UTC"; } } x = new double[npts]; y = new double[npts]; for ( i = 0; i < npts; i++ ) { x[i] = xmin[0] + i * ( xmax[0] - xmin[0] ) / ( npts - 1 ); pls.configtime( scale, offset1, offset2, 0x0, false, 0, 0, 0, 0, 0, 0. ); tai = x[i]; pls.btime( tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec, tai ); pls.configtime( scale, offset1, offset2, 0x2, false, 0, 0, 0, 0, 0, 0. ); pls.btime( utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, tai ); pls.configtime( scale, offset1, offset2, 0x0, false, 0, 0, 0, 0, 0, 0. ); pls.ctime( utc_year[0], utc_month[0], utc_day[0], utc_hour[0], utc_min[0], utc_sec[0], utc ); y[i] = ( tai - utc[0] ) * scale * 86400.; } pls.adv( 0 ); pls.vsta(); pls.wind( xmin[0], xmax[0], ymin, ymax ); pls.col0( 1 ); if ( if_TAI_time_format ) pls.configtime( scale, offset1, offset2, 0x0, false, 0, 0, 0, 0, 0, 0. ); else pls.configtime( scale, offset1, offset2, 0x2, false, 0, 0, 0, 0, 0, 0. ); pls.timefmt( time_format ); pls.box( "bcnstd", xlabel_step, 0, "bcnstv", 0., 0 ); pls.col0( 3 ); title = "@frPLplot Example 29 - TAI-UTC " + title_suffix; pls.lab( xtitle, "TAI-UTC (sec)", title ); pls.col0( 4 ); pls.line( x, y ); } } public static void main( String[] args ) { new x29( args ); } }; plplot-5.10.0+dfsg/examples/java/x13.java 644 1750 1750 1033112033404504 167560ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x13.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 13 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x13 { static String[] text = { "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" }; static int per[] = { 10, 32, 12, 30, 16 }; public static void main( String[] args ) { new x13( args ); } public x13( String[] args ) { PLStream pls = new PLStream(); int i, j, dthet, theta0, theta1, theta; double just, dx, dy; double[] x = new double[ 500 ]; double[] y = new double[ 500 ]; pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); pls.init(); pls.adv( 0 ); // Ensure window has aspect ratio of one so circle is // plotted as a circle. pls.vasp( 1.0 ); pls.wind( 0., 10., 0., 10. ); //pls.env(0., 10., 0., 10., 1, -2); pls.col0( 2 ); // n.b. all theta quantities scaled by 2*pi/500 to be integers to avoid // floating point logic problems. theta0 = 0; dthet = 1; for ( i = 0; i <= 4; i++ ) { j = 0; x[j] = 5.; y[j++] = 5.; // n.b. the theta quantities multiplied by 2*pi/500 afterward so // in fact per is interpreted as a percentage. theta1 = theta0 + 5 * per[i]; if ( i == 4 ) theta1 = 500; for ( theta = theta0; theta <= theta1; theta += dthet ) { x[j] = 5 + 3 * Math.cos( ( 2. * Math.PI / 500. ) * theta ); y[j++] = 5 + 3 * Math.sin( ( 2. * Math.PI / 500. ) * theta ); } pls.col0( i + 1 ); pls.psty( ( i + 3 ) % 8 + 1 ); // Make array of correct size to copy to. double [] xsized = new double[j]; double [] ysized = new double[j]; System.arraycopy( x, 0, xsized, 0, j ); System.arraycopy( y, 0, ysized, 0, j ); pls.fill( xsized, ysized ); pls.col0( 1 ); pls.line( xsized, ysized ); just = ( 2. * Math.PI / 500. ) * ( theta0 + theta1 ) / 2.; dx = .25 * Math.cos( just ); dy = .25 * Math.sin( just ); if ( ( theta0 + theta1 ) < 250 || ( theta0 + theta1 ) > 750 ) just = 0.; else just = 1.; pls.ptex( ( x[j / 2] + dx ), ( y[j / 2] + dy ), 1.0, 0.0, just, text[i] ); theta0 = theta - dthet; } pls.font( 2 ); pls.schr( 0., 1.3 ); pls.ptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" ); pls.end(); } } //-------------------------------------------------------------------------- // End of x13.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x24.java 644 1750 1750 760712033404504 167540ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x24.java 12240 2012-10-04 22:10:12Z andrewross $ // Unicode Pace Flag //-------------------------------------------------------------------------- // // Copyright (C) 2005 Rafael Laboissiere // 2006 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // Packages needed (by Debian name): // // ttf-arphic-bkai00mp // ttf-freefont // ttf-indic-fonts // ttf-unfonts // ttf-bangla-fonts // // For the latest Ubuntu systems lohit_hi.ttf has been moved to the // ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you // will have to use this package instead and update the font path. // package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; class x24 { PLStream pls = new PLStream(); int red[] = { 240, 204, 204, 204, 0, 39, 125 }; int green[] = { 240, 0, 125, 204, 204, 80, 0 }; int blue[] = { 240, 0, 0, 0, 0, 204, 125 }; double px[] = { 0.0, 0.0, 1.0, 1.0 }; double py[] = { 0.0, 0.25, 0.25, 0.0 }; double sx[] = { 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 }; double sy[] = { 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 }; // Taken from http://www.columbia.edu/~fdc/pace/ String peace[] = { // Mandarin "#<0x00>和平", // Hindi "#<0x20>शांति", // English "#<0x10>Peace", // Hebrew "#<0x10>שלום", // Russian "#<0x10>Мир", // German "#<0x10>Friede", // Korean "#<0x30>평화", // French "#<0x10>Paix", // Spanish "#<0x10>Paz", // Arabic "#<0x10>ﺳﻼم", // Turkish "#<0x10>Barış", // Kurdish "#<0x10>Hasîtî", }; public x24( String[] args ) { int i, j; pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); pls.init(); pls.adv( 0 ); pls.vpor( 0.0, 1.0, 0.0, 1.0 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); pls.col0( 0 ); pls.box( "", 1.0, 0, "", 1.0, 0 ); pls.scmap0n( 7 ); pls.scmap0( red, green, blue ); pls.schr( 0, 4.0 ); pls.font( 1 ); for ( i = 0; i < 4; i++ ) { pls.col0( i + 1 ); pls.fill( px, py ); for ( j = 0; j < 4; j++ ) py [j] += 1.0 / 4.0; } pls.col0( 0 ); for ( i = 0; i < 12; i++ ) pls.ptex( sx [i], sy [i], 1.0, 0.0, 0.5, peace [i] ); pls.end(); } public static void main( String[] args ) { new x24( args ); } } //-------------------------------------------------------------------------- // End of x24.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/README.javademos 644 1750 1750 366010072732010 203140ustar andrewandrewThese java examples are designed to mimic the results of the equivalent C, Tcl, and Python examples. Here is the cookbook for compiling and running these examples. (1) Install a Java SDK (Software Development Kit). I use IBMJava2-SDK-14.tgz which is freely downloadable from IBM. (See http://www-106.ibm.com/developerworks/java/jdk/linux/tested.html for product description.) Plplot is also known to work with the Sun JDK, gcj/gij and jikes/sablevm. Ensure that java and javac are in your PATH. (2) If the java include files are not in a default include directory then you need to tell configure where they are. You can either use the --with-java-home option to set the SDK directory e.g. ./configure --with-java-home=/home/software/java/IBMJava2-14/ Previously this was done via the environment variables JAVA_HOME, which still works for backwards compatibility. (3) Run java demos All the plplot java bindings and default examples are contained in the jar file plplot.jar. This needs to be accessible to java either by setting CLASSPATH or by using the -classpath option to java. For example :- # For newer jdk's can use the plplot/examples/x?? notation, but the dot # notation works for all jdk's. # This location will depend on your install prefix: setenv CLASSPATH /usr/local/share/java/plplot.jar java plplot.examples.x01 ..... If you want to see the source code for the examples it can be found in the jar file /usr/local/share/java/plplot.jar and also in /usr/local/share/plplot5.3.1/examples/java/ (4) Changing and recompiling java demos If you want to alter and recompile the examples you can use the version in e.g. /usr/local/share/plplot5.3.1/examples/java. After altering the java file run "make" to rebuild the classes. When you run these examples you need to ensure that the examples/java directory appears _before_ the plplot.jar file in your class path otherwise java will use the default version and not your modified version. plplot-5.10.0+dfsg/examples/java/x28.java 644 1750 1750 3626512033404504 170020ustar andrewandrew// $Id: x28.java 12240 2012-10-04 22:10:12Z andrewross $ // // plmtex3, plptex3 demo. // // Copyright (C) 2007, 2008, 2009 Alan W. Irwin // Copyright (C) 2007 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 28 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x28 { PLStream pls = new PLStream(); static int XPTS = 2; static int YPTS = 2; static int NREVOLUTION = 16; static int NROTATION = 8; static int NSHEAR = 8; x28( String[] args ) { double xmin = 0., xmax = 1.0, xmid = 0.5 * ( xmax + xmin ), xrange = xmax - xmin, ymin = 0., ymax = 1.0, ymid = 0.5 * ( ymax + ymin ), yrange = ymax - ymin, zmin = 0., zmax = 1.0, zmid = 0.5 * ( zmax + zmin ), zrange = zmax - zmin, ysmin = ymin + 0.1 * yrange, ysmax = ymax - 0.1 * yrange, ysrange = ysmax - ysmin, dysrot = ysrange / ( NROTATION - 1 ), dysshear = ysrange / ( NSHEAR - 1 ), zsmin = zmin + 0.1 * zrange, zsmax = zmax - 0.1 * zrange, zsrange = zsmax - zsmin, dzsrot = zsrange / ( NROTATION - 1 ), dzsshear = zsrange / ( NSHEAR - 1 ), ys, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, omega, sin_omega, cos_omega, domega; int i, j; double radius, pitch, xpos, ypos, zpos; // p1string must be exactly one character + the null termination // character. String pstring = "The future of our civilization depends on software freedom."; // Allocate and define the minimal x, y, and z to insure 3D box double[] x = new double[XPTS]; double[] y = new double[YPTS]; double[][] z = new double[XPTS][YPTS]; for ( i = 0; i < XPTS; i++ ) { x[i] = xmin + i * ( xmax - xmin ) / ( XPTS - 1 ); } for ( j = 0; j < YPTS; j++ ) y[j] = ymin + j * ( ymax - ymin ) / ( YPTS - 1 ); for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { z[i][j] = 0.; } } // Parse and process command line arguments pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); pls.init(); // Page 1: Demonstrate inclination and shear capability pattern. pls.adv( 0 ); pls.vpor( -0.15, 1.15, -0.05, 1.05 ); pls.wind( -1.2, 1.2, -0.8, 1.5 ); pls.w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls.col0( 2 ); pls.box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // z = zmin. pls.schr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * Math.PI * ( (double) i / (double) NREVOLUTION ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.5 * yrange * sin_omega; z_inclination = 0.; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.5 * yrange * cos_omega; z_shear = 0.; pls.ptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // x = xmax. pls.schr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * Math.PI * ( (double) i / (double) NREVOLUTION ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); x_inclination = 0.; y_inclination = -0.5 * yrange * cos_omega; z_inclination = 0.5 * zrange * sin_omega; x_shear = 0.; y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; pls.ptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // y = ymax. pls.schr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * Math.PI * ( (double) i / (double) NREVOLUTION ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.; z_inclination = 0.5 * zrange * sin_omega; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.; z_shear = 0.5 * zrange * cos_omega; pls.ptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // Draw minimal 3D grid to finish defining the 3D box. pls.mesh( x, y, z, DRAW_LINEXY ); // Page 2: Demonstrate rotation of string around its axis. pls.adv( 0 ); pls.vpor( -0.15, 1.15, -0.05, 1.05 ); pls.wind( -1.2, 1.2, -0.8, 1.5 ); pls.w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls.col0( 2 ); pls.box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. pls.schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * Math.PI * ( (double) i / (double) NROTATION ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * i; pls.ptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u" ); } // x = xmax. pls.schr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * Math.PI * ( (double) i / (double) NROTATION ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * i; pls.ptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u" ); } // z = zmin. pls.schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * Math.PI * ( (double) i / (double) NROTATION ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); y_shear = 0.5 * yrange * cos_omega; z_shear = 0.5 * zrange * sin_omega; ys = ysmax - dysrot * i; pls.ptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. pls.mesh( x, y, z, DRAW_LINEXY ); // Page 3: Demonstrate shear of string along its axis. // Work around xcairo and pngcairo (but not pscairo) problems for // shear vector too close to axis of string. (N.B. no workaround // would be domega = 0.) domega = 0.05; pls.adv( 0 ); pls.vpor( -0.15, 1.15, -0.05, 1.05 ); pls.wind( -1.2, 1.2, -0.8, 1.5 ); pls.w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls.col0( 2 ); pls.box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. pls.schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * Math.PI * ( (double) i / (double) NSHEAR ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * i; pls.ptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u" ); } // x = xmax. pls.schr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * Math.PI * ( (double) i / (double) NSHEAR ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); y_shear = -0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * i; pls.ptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u" ); } // z = zmin. pls.schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; z_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * Math.PI * ( (double) i / (double) NSHEAR ); sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); y_shear = 0.5 * yrange * cos_omega; x_shear = 0.5 * xrange * sin_omega; ys = ysmax - dysshear * i; pls.ptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. pls.mesh( x, y, z, DRAW_LINEXY ); // Page 4: Demonstrate drawing a string on a 3D path. pls.adv( 0 ); pls.vpor( -0.15, 1.15, -0.05, 1.05 ); pls.wind( -1.2, 1.2, -0.8, 1.5 ); pls.w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30. ); pls.col0( 2 ); pls.box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); pls.schr( 0., 1.2 ); // domega controls the spacing between the various characters of the // string and also the maximum value of omega for the given number // of characters in *pstring. domega = 2. * Math.PI / pstring.length(); omega = 0.; // 3D function is a helix of the given radius and pitch radius = 0.5; pitch = 1. / ( 2. * Math.PI ); for ( i = 0; i < pstring.length(); i++ ) { sin_omega = Math.sin( omega ); cos_omega = Math.cos( omega ); xpos = xmid + radius * sin_omega; ypos = ymid - radius * cos_omega; zpos = zmin + pitch * omega; // In general, the inclination is proportional to the derivative of // the position wrt theta. x_inclination = radius * cos_omega;; y_inclination = radius * sin_omega; z_inclination = pitch; // The shear vector should be perpendicular to the 3D line with Z // component maximized, but for low pitch a good approximation is // a constant vector that is parallel to the Z axis. x_shear = 0.; y_shear = 0.; z_shear = 1.; pls.ptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, pstring.substring( i, i + 1 ) ); omega += domega; } // Draw minimal 3D grid to finish defining the 3D box. pls.mesh( x, y, z, DRAW_LINEXY ); // Page 5: Demonstrate plmtex3 axis labelling capability pls.adv( 0 ); pls.vpor( -0.15, 1.15, -0.05, 1.05 ); pls.wind( -1.2, 1.2, -0.8, 1.5 ); pls.w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls.col0( 2 ); pls.box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); pls.schr( 0., 1.0 ); pls.mtex3( "xp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); pls.mtex3( "xp", 4.5, 0.5, 0.5, "primary X-axis label" ); pls.mtex3( "xs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); pls.mtex3( "xs", -1.0, 0.5, 0.5, "secondary X-axis label" ); pls.mtex3( "yp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); pls.mtex3( "yp", 4.5, 0.5, 0.5, "primary Y-axis label" ); pls.mtex3( "ys", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); pls.mtex3( "ys", -1.0, 0.5, 0.5, "secondary Y-axis label" ); pls.mtex3( "zp", 4.5, 0.5, 0.5, "Arbitrarily displaced" ); pls.mtex3( "zp", 3.0, 0.5, 0.5, "primary Z-axis label" ); pls.mtex3( "zs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); pls.mtex3( "zs", -1.0, 0.5, 0.5, "secondary Z-axis label" ); // Draw minimal 3D grid to finish defining the 3D box. pls.mesh( x, y, z, DRAW_LINEXY ); pls.end(); } public static void main( String[] args ) { new x28( args ); } }; plplot-5.10.0+dfsg/examples/java/x09.java 644 1750 1750 3611112033404504 167670ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x09.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001, 2002 Geoffrey Furnish // Copyright (C) 2002, 2003 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 9 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x09 { static final int XPTS = 35; static final int YPTS = 46; static final double XSPA = 2. / ( XPTS - 1 ); static final double YSPA = 2. / ( YPTS - 1 ); // polar plot data static final int PERIMETERPTS = 100; static final int RPTS = 40; static final int THETAPTS = 40; // potential plot data static final int PPERIMETERPTS = 100; static final int PRPTS = 40; static final int PTHETAPTS = 64; static final int PNLEVEL = 20; final double clevel[] = { -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. }; // Transformation function final double tr[] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; PLStream pls = new PLStream(); // State data used by f2mnmx double fmin, fmax; // Does a large series of unlabelled and labelled contour plots. public static void main( String[] args ) { new x09( args ); } public x09( String[] args ) { int i, j; double[][] xg0 = new double[XPTS][YPTS]; double[][] yg0 = new double[XPTS][YPTS]; double[][] xg1 = new double[XPTS][YPTS]; double[][] yg1 = new double[XPTS][YPTS]; double[][] xg2 = new double[XPTS][YPTS]; double[][] yg2 = new double[XPTS][YPTS]; double[][] z = new double[XPTS][YPTS]; double[][] w = new double[XPTS][YPTS]; double xx, yy, argx, argy, distort; final int[] mark = { 1500 }; final int[] space = { 1500 }; final int[] mark0 = {}; final int[] space0 = {}; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot pls.init(); // Set up function arrays for ( i = 0; i < XPTS; i++ ) { xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } // Set up grids for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { // Replacement for mypltr of x09c.c xx = tr[0] * i + tr[1] * j + tr[2]; yy = tr[3] * i + tr[4] * j + tr[5]; argx = xx * Math.PI / 2; argy = yy * Math.PI / 2; distort = 0.4; // Note these are one-dimensional because of arrangement of // zeros in the final tr definition above. // But I haven't found out yet, how with swig to overload // one- and two-dimensional array arguments so for now make // xg0 --> yg1 two-dimensional. xg0[i][j] = xx; yg0[i][j] = yy; xg1[i][j] = xx + distort * Math.cos( argx ); yg1[i][j] = yy - distort * Math.cos( argy ); xg2[i][j] = xx + distort * Math.cos( argx ) * Math.cos( argy ); yg2[i][j] = yy - distort * Math.cos( argx ) * Math.cos( argy ); } } // Plot using scaled identity transform used to create xg0 and yg0 // pls.setcontlabelparam(0.006, 0.3, 0.1, 0); // pls.env(-1.0, 1.0, -1.0, 1.0, 0, 0); // pls.col0(2); // pls.cont( z, 1, XPTS, 1, YPTS, clevel, xg0, yg0 ); // pls.styl(mark, space); // pls.col0(3); // pls.cont(w, 1, XPTS, 1, YPTS, clevel, xg0, yg0 ); // pls.styl(mark0, space0); // pls.col0(1); // pls.lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pls.setcontlabelformat( 4, 3 ); pls.setcontlabelparam( 0.006, 0.3, 0.1, 1 ); pls.env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls.col0( 2 ); pls.cont( z, 1, XPTS, 1, YPTS, clevel, xg0, yg0 ); pls.styl( mark, space ); pls.col0( 3 ); pls.cont( w, 1, XPTS, 1, YPTS, clevel, xg0, yg0 ); pls.styl( mark0, space0 ); pls.col0( 1 ); pls.lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pls.setcontlabelparam( 0.006, 0.3, 0.1, 0 ); // Plot using 1d coordinate transform pls.env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls.col0( 2 ); pls.cont( z, 1, XPTS, 1, YPTS, clevel, xg1, yg1 ); pls.styl( mark, space ); pls.col0( 3 ); pls.cont( w, 1, XPTS, 1, YPTS, clevel, xg1, yg1 ); pls.styl( mark0, space0 ); pls.col0( 1 ); pls.lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // pls.setcontlabelparam(0.006, 0.3, 0.1, 1); // pls.env(-1.0, 1.0, -1.0, 1.0, 0, 0); // pls.col0(2); // pls.cont(z, 1, XPTS, 1, YPTS, clevel, xg1, yg1 ); // pls.styl(mark, space); // pls.col0(3); // pls.cont(w, 1, XPTS, 1, YPTS, clevel, xg1, yg1 ); // pls.styl(mark0, space0); // pls.col0(1); // pls.lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pls.setcontlabelparam(0.006, 0.3, 0.1, 0); // // Plot using 2d coordinate transform pls.env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls.col0( 2 ); pls.cont( z, 1, XPTS, 1, YPTS, clevel, xg2, yg2 ); pls.styl( mark, space ); pls.col0( 3 ); pls.cont( w, 1, XPTS, 1, YPTS, clevel, xg2, yg2 ); pls.styl( mark0, space0 ); pls.col0( 1 ); pls.lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // pls.setcontlabelparam(0.006, 0.3, 0.1, 1); // pls.env(-1.0, 1.0, -1.0, 1.0, 0, 0); // pls.col0(2); // pls.cont(z, 1, XPTS, 1, YPTS, clevel, xg2, yg2 ); // pls.styl(mark, space); // pls.col0(3); // pls.cont(w, 1, XPTS, 1, YPTS, clevel, xg2, yg2 ); // pls.styl(mark0, space0); // pls.col0(1); // pls.lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pls.setcontlabelparam(0.006, 0.3, 0.1, 0); // polar(); // pls.setcontlabelparam(0.006, 0.3, 0.1, 1); // polar(); // pls.setcontlabelparam(0.006, 0.3, 0.1, 0); // potential(); // pls.setcontlabelparam(0.006, 0.3, 0.1, 1); // potential(); // pls.setcontlabelparam(0.006, 0.3, 0.1, 0); // pls.end(); } void polar() // polar contour plot example. { int i, j; double[] px = new double[PERIMETERPTS]; double[] py = new double[PERIMETERPTS]; double[][] xg = new double[RPTS][THETAPTS]; double[][] yg = new double[RPTS][THETAPTS]; double[][] z = new double[RPTS][THETAPTS]; double t, r, theta; double [] lev = new double[10]; pls.env( -1., 1., -1., 1., 0, -2 ); pls.col0( 1 ); // Perimeter for ( i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * Math.PI / ( PERIMETERPTS - 1 ) ) * i; px[i] = Math.cos( t ); py[i] = Math.sin( t ); } pls.line( px, py ); // Create data to be contoured. for ( i = 0; i < RPTS; i++ ) { r = i / (double) ( RPTS - 1 ); for ( j = 0; j < THETAPTS; j++ ) { theta = ( 2. * Math.PI / ( THETAPTS - 1 ) ) * j; xg[i][j] = r * Math.cos( theta ); yg[i][j] = r * Math.sin( theta ); z[i][j] = r; } } for ( i = 0; i < 10; i++ ) { lev[i] = 0.05 + 0.10 * i; } pls.col0( 2 ); pls.cont( z, 1, RPTS, 1, THETAPTS, lev, xg, yg ); pls.col0( 1 ); pls.lab( "", "", "Polar Contour Plot" ); } // Compute min and max value of a 2-d array. void f2mnmx( double[][] f, int nx, int ny ) { fmax = f[0][0]; fmin = fmax; for ( int i = 0; i < nx; i++ ) for ( int j = 0; j < ny; j++ ) { if ( f[i][j] < fmin ) fmin = f[i][j]; if ( f[i][j] > fmax ) fmax = f[i][j]; } } final void potential() // Shielded potential contour plot example. { int i, j; double rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax; double peps, xpmin, xpmax, ypmin, ypmax; double eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; double div1, div1i, div2, div2i; double [][] xg = new double[PRPTS][PTHETAPTS]; double [][] yg = new double[PRPTS][PTHETAPTS]; double [][] z = new double[PRPTS][PTHETAPTS]; int nlevelneg, nlevelpos; double dz, clev; double [] clevelneg_store = new double[PNLEVEL]; double [] clevelpos_store = new double[PNLEVEL]; int ncollin, ncolbox, ncollab; double [] px = new double[PPERIMETERPTS]; double [] py = new double[PPERIMETERPTS]; double t, r, theta; // Create data to be contoured. //java wants r unambiguously initialized for rmax below. r = 0.; for ( i = 0; i < PRPTS; i++ ) { r = 0.5 + i; for ( j = 0; j < PTHETAPTS; j++ ) { theta = ( 2. * Math.PI / ( PTHETAPTS - 1 ) ) * ( 0.5 + j ); xg[i][j] = r * Math.cos( theta ); yg[i][j] = r * Math.sin( theta ); } } rmax = r; f2mnmx( xg, PRPTS, PTHETAPTS ); xmin = fmin; xmax = fmax; f2mnmx( yg, PRPTS, PTHETAPTS ); ymin = fmin; ymax = fmax; x0 = ( xmin + xmax ) / 2.; y0 = ( ymin + ymax ) / 2.; // Expanded limits peps = 0.05; xpmin = xmin - Math.abs( xmin ) * peps; xpmax = xmax + Math.abs( xmax ) * peps; ypmin = ymin - Math.abs( ymin ) * peps; ypmax = ymax + Math.abs( ymax ) * peps; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. eps = 2.; q1 = 1.; d1 = rmax / 4.; q1i = -q1 * rmax / d1; d1i = Math.pow( rmax, 2 ) / d1; q2 = -1.; d2 = rmax / 4.; q2i = -q2 * rmax / d2; d2i = Math.pow( rmax, 2 ) / d2; for ( i = 0; i < PRPTS; i++ ) { for ( j = 0; j < PTHETAPTS; j++ ) { div1 = Math.sqrt( Math.pow( xg[i][j] - d1, 2 ) + Math.pow( yg[i][j] - d1, 2 ) + Math.pow( eps, 2 ) ); div1i = Math.sqrt( Math.pow( xg[i][j] - d1i, 2 ) + Math.pow( yg[i][j] - d1i, 2 ) + Math.pow( eps, 2 ) ); div2 = Math.sqrt( Math.pow( xg[i][j] - d2, 2 ) + Math.pow( yg[i][j] + d2, 2 ) + Math.pow( eps, 2 ) ); div2i = Math.sqrt( Math.pow( xg[i][j] - d2i, 2 ) + Math.pow( yg[i][j] + d2i, 2 ) + Math.pow( eps, 2 ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; } } f2mnmx( z, PRPTS, PTHETAPTS ); zmin = fmin; zmax = fmax; // printf("%.15g %.15g %.15g %.15g %.15g %.15g %.15g %.15g \n", // q1, d1, q1i, d1i, q2, d2, q2i, d2i); // System.out.println(xmin); // System.out.println(xmax); // System.out.println(ymin); // System.out.println(ymax); // System.out.println(zmin); // System.out.println(zmax); // Positive and negative contour levels. dz = ( zmax - zmin ) / PNLEVEL; nlevelneg = 0; nlevelpos = 0; for ( i = 0; i < PNLEVEL; i++ ) { clev = zmin + ( i + 0.5 ) * dz; if ( clev <= 0. ) clevelneg_store[nlevelneg++] = clev; else clevelpos_store[nlevelpos++] = clev; } // Colours! ncollin = 11; ncolbox = 1; ncollab = 2; // Finally start plotting this page! pls.adv( 0 ); pls.col0( ncolbox ); pls.vpas( 0.1, 0.9, 0.1, 0.9, 1.0 ); pls.wind( xpmin, xpmax, ypmin, ypmax ); pls.box( "", 0., 0, "", 0., 0 ); pls.col0( ncollin ); if ( nlevelneg > 0 ) { // Negative contours pls.lsty( 2 ); // The point here is to copy results into an array of the correct size // which is essential for the java wrapper of plplot to work correctly. double [] clevelneg = new double[nlevelneg]; System.arraycopy( clevelneg_store, 0, clevelneg, 0, nlevelneg ); pls.cont( z, 1, PRPTS, 1, PTHETAPTS, clevelneg, xg, yg ); } if ( nlevelpos > 0 ) { // Positive contours pls.lsty( 1 ); double [] clevelpos = new double[nlevelpos]; // The point here is to copy results into an array of the correct size // which is essential for the java wrapper of plplot to work correctly. System.arraycopy( clevelpos_store, 0, clevelpos, 0, nlevelpos ); pls.cont( z, 1, PRPTS, 1, PTHETAPTS, clevelpos, xg, yg ); } // Draw outer boundary for ( i = 0; i < PPERIMETERPTS; i++ ) { t = ( 2. * Math.PI / ( PPERIMETERPTS - 1 ) ) * i; px[i] = x0 + rmax*Math.cos( t ); py[i] = y0 + rmax*Math.sin( t ); } pls.col0( ncolbox ); pls.line( px, py ); pls.col0( ncollab ); pls.lab( "", "", "Shielded potential of charges in a conducting sphere" ); } } //-------------------------------------------------------------------------- // End of x09.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x11.java 644 1750 1750 1406412033404504 167630ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x11.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002, 2003 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 11 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x11 { PLStream pls = new PLStream(); static final int XPTS = 35; static final int YPTS = 46; static final int LEVELS = 10; static int opt[] = { 3, 3 }; static double alt[] = { 33.0, 17.0 }; static double az[] = { 24.0, 115.0 }; static String[] title = { "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" }; void cmap1_init() { double [] i = new double[2]; double [] h = new double[2]; double [] l = new double[2]; double [] s = new double[2]; boolean [] rev = new boolean[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; rev[0] = false; // interpolate on front side of colour wheel. rev[1] = false; // interpolate on front side of colour wheel. pls.scmap1n( 256 ); pls.scmap1l( false, i, h, l, s, rev ); } // Does a series of mesh plots for a given data set, with different viewing // options in each plot. public static void main( String[] args ) { new x11( args ); } public x11( String[] args ) { int i, j, k; double[] x = new double[ XPTS ]; double[] y = new double[ YPTS ]; double[][] z = new double[XPTS][YPTS]; double zmin = Double.MAX_VALUE, zmax = Double.MIN_VALUE; double xx, yy; int nlevel = LEVELS; double[] clevel = new double[LEVELS]; double step; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); for ( i = 0; i < XPTS; i++ ) x[i] = 3. * ( i - ( XPTS / 2 ) ) / ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) y[j] = 3. * ( j - ( YPTS / 2 ) ) / ( YPTS / 2 ); for ( i = 0; i < XPTS; i++ ) { xx = x[i]; for ( j = 0; j < YPTS; j++ ) { yy = y[j]; z[i][j] = 3. * ( 1. - xx ) * ( 1. - xx ) * Math.exp( -( xx * xx ) - ( yy + 1. ) * ( yy + 1. ) ) - 10. * ( xx / 5. - Math.pow( xx, 3. ) - Math.pow( yy, 5. ) ) * Math.exp( -xx * xx - yy * yy ) - 1. / 3. * Math.exp( -( xx + 1 ) * ( xx + 1 ) - ( yy * yy ) ); //if ( false ) // Jungfraujoch/Interlaken //{ // if ( z[i][j] < -1. ) // z[i][j] = -1.; //} if ( zmin > z[i][j] ) zmin = z[i][j]; if ( zmax < z[i][j] ) zmax = z[i][j]; } } step = ( zmax - zmin ) / ( nlevel + 1 ); for ( i = 0; i < nlevel; i++ ) clevel[i] = zmin + step + step * i; cmap1_init(); for ( k = 0; k < 2; k++ ) { for ( i = 0; i < 4; i++ ) { pls.adv( 0 ); pls.col0( 1 ); pls.vpor( 0.0, 1.0, 0.0, 0.9 ); pls.wind( -1.0, 1.0, -1.0, 1.5 ); pls.w3d( 1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt[k], az[k] ); pls.box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4 ); pls.col0( 2 ); // wireframe plot if ( i == 0 ) pls.mesh( x, y, z, opt[k] ); // magnitude colored wireframe plot else if ( i == 1 ) pls.mesh( x, y, z, opt[k] | MAG_COLOR ); // magnitude colored wireframe plot with sides else if ( i == 2 ) pls.plot3d( x, y, z, opt[k] | MAG_COLOR, true ); // magnitude colored wireframe plot with base contour else if ( i == 3 ) pls.meshc( x, y, z, opt[k] | MAG_COLOR | BASE_CONT, clevel ); pls.col0( 3 ); pls.mtex( "t", 1.0, 0.5, 0.5, title[k] ); } } pls.end(); } } //-------------------------------------------------------------------------- // End of x11.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x04.java 644 1750 1750 1476312140566142 170010ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x04.java 12329 2013-05-02 22:44:50Z airwin $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 4 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class x04 { PLStream pls = new PLStream(); public static void main( String[] args ) { new x04( args ); } public x04( String[] args ) { // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); pls.font( 2 ); // Make log plots using two different styles. plot1( 0 ); plot1( 1 ); pls.end(); } // Log-linear plot. void plot1( int type ) { int i; double[] freql = new double[101]; double[] ampl = new double[101]; double[] phase = new double[101]; double f0, freq; int nlegend; String[] text; String[] symbols; int[] opt_array; int[] text_colors; int[] line_colors; int[] line_styles; double[] line_widths; int[] symbol_numbers; int[] symbol_colors; double[] symbol_scales; double[] legend_width = new double[1]; double[] legend_height = new double[1]; pls.adv( 0 ); // Set up data for log plot. f0 = 1.0; for ( i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = Math.pow( 10.0, freql[i] ); // Unbelievably, Java has no log10() that I can find... ampl[i] = 20.0 * Math.log( 1.0 / Math.sqrt( 1.0 + Math.pow( ( freq / f0 ), 2. ) ) ) / Math.log( 10. ); phase[i] = -( 180.0 / Math.PI ) * Math.atan( freq / f0 ); } pls.vpor( 0.15, 0.85, 0.1, 0.9 ); pls.wind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. pls.col0( 1 ); switch ( type ) { case 0: pls.box( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: pls.box( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; } // Plot ampl vs freq. pls.col0( 2 ); pls.line( freql, ampl ); pls.col0( 2 ); pls.ptex( 1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade" ); // Put labels on. pls.col0( 1 ); pls.mtex( "b", 3.2, 0.5, 0.5, "Frequency" ); pls.mtex( "t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter" ); pls.col0( 2 ); pls.mtex( "l", 5.0, 0.5, 0.5, "Amplitude (dB)" ); nlegend = 1; // For the gridless case, put phase vs freq on same plot. if ( type == 0 ) { pls.col0( 1 ); pls.wind( -2.0, 3.0, -100.0, 0.0 ); pls.box( "", 0.0, 0, "cmstv", 30.0, 3 ); pls.col0( 3 ); pls.line( freql, phase ); pls.string( freql, phase, "*" ); pls.col0( 3 ); pls.mtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); nlegend = 2; } text = new String[nlegend]; symbols = new String[nlegend]; opt_array = new int[nlegend]; text_colors = new int[nlegend]; line_colors = new int[nlegend]; line_styles = new int[nlegend]; line_widths = new double[nlegend]; symbol_numbers = new int[nlegend]; symbol_colors = new int[nlegend]; symbol_scales = new double[nlegend]; // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; text[0] = "Amplitude"; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.; // note from the above opt_array the first symbol (and box) indices // do not have to be specified EXCEPT for symbols. // Although this is unused, it can't be undefined as the String // array is copied as part of the java bindings. symbols[0] = " "; // Second legend entry. if ( nlegend == 2 ) { opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; text[1] = "Phase shift"; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; } // from the above opt_arrays we can completely ignore everything // to do with boxes. pls.scol0a( 15, 32, 32, 32, 0.70 ); pls.legend( legend_width, legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, opt_array, 1.0, 1.0, 2.0, 1., text_colors, text, null, null, null, null, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, symbols ); } } //-------------------------------------------------------------------------- // End of x04.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x07.java 644 1750 1750 1014412033404504 167630ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x07.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2001 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 7 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.text.*; class x07 { static int base[] = { 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900 }; public static void main( String[] args ) { new x07( args ); } public x07( String[] args ) { PLStream pls = new PLStream(); // NumberFormat nf = NumberFormat.getNumberInstance(); // Change to this custom format to get stupid locale commas // separating hundreds and thousands place out of labels. DecimalFormat nf = new DecimalFormat( "####0" ); int i, j, k, l; double x[] = new double[1]; double y[] = new double[1]; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Initialize plplot. pls.init(); pls.fontld( 0 ); for ( l = 0; l < base.length; l++ ) { if ( l == 2 ) pls.fontld( 1 ); pls.adv( 0 ); // Set up viewport and window. pls.col0( 2 ); pls.vpor( 0.15, 0.95, 0.1, 0.9 ); pls.wind( 0.0, 1.0, 0.0, 1.0 ); // Draw the grid using plbox. pls.box( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame. pls.col0( 15 ); for ( i = 0; i <= 9; i++ ) { String text = nf.format( i ); pls.mtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } k = 0; for ( i = 0; i <= 9; i++ ) { // Write the digits to the left of the frame. String text = nf.format( base[l] + 10 * i ); pls.mtex( "lv", 1.0, ( 0.95 - 0.1 * i ), 1.0, text ); for ( j = 0; j <= 9; j++ ) { x[0] = 0.1 * j + 0.05; y[0] = 0.95 - 0.1 * i; // Display the symbols. // N.B. plsym expects arrays so that is what we give it. pls.sym( x, y, base[l] + k ); k = k + 1; } } if ( l < 2 ) pls.mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); else pls.mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } pls.end(); } } //-------------------------------------------------------------------------- // End of x07.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x19.java 644 1750 1750 1577212221050115 167740ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x19.java 12532 2013-09-26 15:18:37Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 19 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; class MapTransform implements PLCallbackCT { public void coordTransform( double x, double y, double[] xt, double[] yt, Object data ) { double radius; radius = 90.0 - y; xt[0] = radius * Math.cos( x * Math.PI / 180.0 ); yt[0] = radius * Math.sin( x * Math.PI / 180.0 ); } } class Mapform19 implements PLCallbackMapform { public void mapform( double[] x, double[] y ) { int i; double xp, yp, radius; for ( i = 0; i < x.length; i++ ) { radius = 90.0 - y[i]; xp = radius * Math.cos( x[i] * Math.PI / 180.0 ); yp = radius * Math.sin( x[i] * Math.PI / 180.0 ); x[i] = xp; y[i] = yp; } } } class LabelFunc19 implements PLCallbackLabel { // A custom axis labeling function for longitudes and latitudes. public String label( int axis, double value ) { String label = ""; String direction_label = ""; double label_val = 0.0; if ( axis == PL_Y_AXIS ) { label_val = value; if ( label_val > 0.0 ) { direction_label = " N"; } else if ( label_val < 0.0 ) { direction_label = " S"; } else { direction_label = "Eq"; } } else if ( axis == PL_X_AXIS ) { label_val = normalize_longitude( value ); if ( label_val > 0.0 ) { direction_label = " E"; } else if ( label_val < 0.0 ) { direction_label = " W"; } else { direction_label = ""; } } if ( axis == PL_Y_AXIS && value == 0.0 ) { // A special case for the equator label = direction_label; } else { label = "" + ( (int) Math.abs( label_val ) ) + direction_label; } return label; } // "Normalize" longitude values so that they always fall between -180.0 // and 180.0 double normalize_longitude( double lon ) { double times; if ( lon >= -180.0 && lon <= 180.0 ) { return ( lon ); } else { times = Math.floor( ( Math.abs( lon ) + 180.0 ) / 360.0 ); if ( lon < 0.0 ) { return ( lon + 360.0 * times ); } else { return ( lon - 360.0 * times ); } } } } class x19 { PLStream pls = new PLStream(); public static void main( String[] args ) { new x19( args ); } public x19 ( String[] args ) { double minx, maxx, miny, maxy; PLCallbackMapform nullCallback = null; PLCallbackLabel nullLabelCallback = null; PLCallbackCT nullCTCallback = null; LabelFunc19 geolocation_labeler = new LabelFunc19(); MapTransform map_transform = new MapTransform(); double[] x = new double[1]; double[] y = new double[1]; // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Longitude (x) and latitude (y) miny = -70; maxy = 80; // Initialize PLplot. pls.init(); // Cartesian plots // Most of world minx = -170; maxx = minx + 360; // Setup a custom latitude and longitude-based scaling function. pls.slabelfunc( geolocation_labeler ); pls.col0( 1 ); pls.env( minx, maxx, miny, maxy, 1, 70 ); pls.map( nullCallback, "usaglobe", minx, maxx, miny, maxy ); // The Americas minx = 190; maxx = 340; pls.col0( 1 ); pls.env( minx, maxx, miny, maxy, 1, 70 ); pls.map( nullCallback, "usaglobe", minx, maxx, miny, maxy ); // Clear the labelling function. pls.slabelfunc( nullLabelCallback ); // Polar, Northern hemisphere // Create callback object containing mapform function Mapform19 mapform19 = new Mapform19(); minx = 0; maxx = 360; pls.env( -75., 75., -75., 75., 1, -1 ); pls.map( mapform19, "globe", minx, maxx, miny, maxy ); pls.lsty( 2 ); pls.meridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0; maxx = 360; pls.stransform( map_transform, null ); pls.lsty( 1 ); pls.env( -75., 75., -75., 75., 1, -1 ); // No need to set the map transform here as the global transform // will be used. pls.map( nullCallback, "globe", minx, maxx, miny, maxy ); pls.lsty( 2 ); pls.meridians( nullCallback, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Show Baltimore, MD on the map pls.col0( 2 ); pls.ssym( 0.0, 2.0 ); x[0] = -76.6125; y[0] = 39.2902778; pls.poin( x, y, 18 ); pls.ssym( 0.0, 1.0 ); pls.ptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); // For Java, this is how the global transform is cleared pls.stransform( nullCTCallback, null ); pls.end(); } } //-------------------------------------------------------------------------- // End of x19.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/java/x03.java 644 1750 1750 1027512033404504 167640ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x03.java 12240 2012-10-04 22:10:12Z andrewross $ //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Copyright (C) 2001 Geoffrey Furnish // Copyright (C) 2001, 2002 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Implementation of PLplot example 3 in Java. //-------------------------------------------------------------------------- package plplot.examples; import plplot.core.*; import static plplot.core.plplotjavacConstants.*; import java.lang.Math; import java.text.*; class x03 { public static void main( String[] args ) { new x03( args ); } public x03( String[] args ) { PLStream pls = new PLStream(); NumberFormat nf = NumberFormat.getNumberInstance(); int i; double dtr, theta, dx, dy, r, offset; double[] x0 = new double[361]; double[] y0 = new double[361]; double[] x = new double[361]; double[] y = new double[361]; dtr = Math.PI / 180.0; for ( i = 0; i <= 360; i++ ) { x0[i] = Math.cos( dtr * i ); y0[i] = Math.sin( dtr * i ); } // Parse and process command line arguments. pls.parseopts( args, PL_PARSE_FULL | PL_PARSE_NOPROGRAM ); // Set orientation to portrait - note not all device drivers // support this, in particular most interactive drivers do not. pls.sori( 1 ); // Initialize plplot. pls.init(); // Set up viewport and window, but do not draw box. pls.env( -1.3, 1.3, -1.3, 1.3, 1, -2 ); for ( i = 1; i <= 10; i++ ) { pls.arc( 0.0, 0.0, 0.1 * i, 0.1 * i, 0.0, 360.0, 0.0, false ); } pls.col0( 2 ); for ( i = 0; i <= 11; i++ ) { theta = 30.0 * i; dx = Math.cos( dtr * theta ); dy = Math.sin( dtr * theta ); // Draw radial spokes for polar grid. pls.join( 0.0, 0.0, dx, dy ); String text = nf.format( theta ); // Write labels for angle. if ( theta < 9.99 ) { offset = 0.45; } else if ( theta < 99.9 ) { offset = 0.30; } else { offset = 0.15; } //Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) pls.ptex( dx, dy, dx, dy, -offset, text ); else pls.ptex( dx, dy, -dx, -dy, 1. + offset, text ); } // Draw the graph. for ( i = 0; i <= 360; i++ ) { r = Math.sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } pls.col0( 3 ); pls.line( x, y ); pls.col0( 4 ); pls.mtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); // Close the plot at end. pls.end(); } } //-------------------------------------------------------------------------- // End of x03.java //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/ 775 1750 1750 012406243570 150435ustar andrewandrewplplot-5.10.0+dfsg/examples/c++/x07.cc 644 1750 1750 723411721772043 160550ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x07.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 07 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif static int base[20] = { 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900 }; class x07 { public: x07( int, const char ** ); private: // Class data plstream *pls; }; x07::x07( int argc, const char ** argv ) { int i, j, k, l; PLFLT x, y; char text[10]; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); pls->fontld( 0 ); for ( l = 0; l < 20; l++ ) { if ( l == 2 ) pls->fontld( 1 ); pls->adv( 0 ); // Set up viewport and window. pls->col0( 2 ); pls->vpor( 0.15, 0.95, 0.1, 0.9 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); // Draw the grid using plbox. pls->box( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame. pls->col0( 15 ); for ( i = 0; i <= 9; i++ ) { sprintf( text, "%d", i ); pls->mtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } k = 0; for ( i = 0; i <= 9; i++ ) { // Write the digits to the left of the frame. sprintf( text, "%d", base[l] + 10 * i ); pls->mtex( "lv", 1.0, ( 0.95 - 0.1 * i ), 1.0, text ); for ( j = 0; j <= 9; j++ ) { x = 0.1 * j + 0.05; y = 0.95 - 0.1 * i; // Display the symbols. // N.B. plsym expects arrays so that is what we give it. pls->sym( 1, &x, &y, base[l] + k ); k = k + 1; } } if ( l < 2 ) pls->mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (compact)" ); else pls->mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 7 - PLSYM symbols (extended)" ); } // pls->end(); delete pls; } int main( int argc, const char ** argv ) { x07 *x = new x07( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x07.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x24.cc 644 1750 1750 647611543675237 160740ustar andrewandrew// // Unicode Pace Flag // // Copyright (C) 2005 Rafael Laboissiere // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // For Debian, the required font packages are the following: // ttf-arphic-bkai00mp // ttf-freefont // ttf-devanagari-fonts // ttf-unfonts // ttf-bengali-fonts // // For the latest Ubuntu systems lohit_hi.ttf has been moved to the // ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you // will have to use this package instead and update the font path. // #include "plc++demos.h" class x24 { public: x24( int, const char ** ); private: plstream *pls; static PLINT red[], green[], blue[]; static PLFLT px[], py[], sx[], sy[]; static const char *peace[]; }; PLINT x24::red[] = { 240, 204, 204, 204, 0, 39, 125 }; PLINT x24::green[] = { 240, 0, 125, 204, 204, 80, 0 }; PLINT x24::blue[] = { 240, 0, 0, 0, 0, 204, 125 }; PLFLT x24::px[] = { 0.0, 0.0, 1.0, 1.0 }; PLFLT x24::py[] = { 0.0, 0.25, 0.25, 0.0 }; PLFLT x24::sx[] = { 0.16374, 0.15844, 0.15255, 0.17332, 0.50436, 0.51721, 0.49520, 0.48713, 0.83976, 0.81688, 0.82231, 0.82647 }; PLFLT x24::sy[] = { 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875, 0.125, 0.375, 0.625, 0.875 }; // Taken from http://www.columbia.edu/~fdc/pace/ const char* x24::peace[] = { // Mandarin "#<0x00>和平", // Hindi "#<0x20>शांति", // English "#<0x10>Peace", // Hebrew "#<0x10>שלום", // Russian "#<0x10>Мир", // German "#<0x10>Friede", // Korean "#<0x30>평화", // French "#<0x10>Paix", // Spanish "#<0x10>Paz", // Arabic "#<0x10>ﺳﻼم", // Turkish "#<0x10>Barış", // Kurdish "#<0x10>Hasîtî", }; x24::x24( int argc, const char *argv[] ) { int i, j; pls = new plstream(); pls->parseopts( &argc, argv, PL_PARSE_FULL ); pls->init(); pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->col0( 0 ); pls->box( "", 1.0, 0, "", 1.0, 0 ); pls->scmap0n( 7 ); pls->scmap0( red, green, blue, 7 ); pls->schr( 0, 4.0 ); pls->font( 1 ); for ( i = 0; i < 4; i++ ) { pls->col0( i + 1 ); pls->fill( 4, px, py ); for ( j = 0; j < 4; j++ ) py [j] += 1.0 / 4.0; } pls->col0( 0 ); for ( i = 0; i < 12; i++ ) pls->ptex( sx [i], sy [i], 1.0, 0.0, 0.5, peace [i] ); delete pls; } int main( int argc, const char **argv ) { x24 *x = new x24( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/x12.cc 644 1750 1750 701411721772043 160450ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x12.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 12 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x12 { public: x12( int, const char** ); void plfbox( PLFLT, PLFLT ); private: plstream *pls; static const PLFLT y0[]; static PLFLT pos[], red[], green[], blue[]; }; const PLFLT x12::y0[10] = { 5., 15., 12., 24., 28., 30., 20., 8., 12., 3. }; PLFLT x12:: pos[] = { 0.0, 0.25, 0.5, 0.75, 1.0 }; PLFLT x12:: red[] = { 0.0, 0.25, 0.5, 1.0, 1.0 }; PLFLT x12:: green[] = { 1.0, 0.5, 0.5, 0.5, 1.0 }; PLFLT x12:: blue[] = { 1.0, 1.0, 0.5, 0.25, 0.0 }; x12::x12( int argc, const char **argv ) { int i; char string[20]; pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot. pls->init(); pls->adv( 0 ); pls->vsta(); pls->wind( 1980.0, 1990.0, 0.0, 35.0 ); pls->box( "bc", 1.0, 0, "bcnv", 10.0, 0 ); pls->col0( 2 ); pls->lab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" ); pls->scmap1l( true, 5, pos, red, green, blue, NULL ); for ( i = 0; i < 10; i++ ) { //pls->col0(i + 1); pls->col1( i / 9.0 ); pls->psty( 0 ); plfbox( ( 1980. + i ), y0[i] ); sprintf( string, "%.0f", y0[i] ); pls->ptex( ( 1980. + i + .5 ), ( y0[i] + 1. ), 1.0, 0.0, .5, string ); sprintf( string, "%d", 1980 + i ); pls->mtex( "b", 1.0, ( ( i + 1 ) * .1 - .05 ), 0.5, string ); } //pls->end(); delete pls; } void x12::plfbox( PLFLT x0, PLFLT y0 ) { PLFLT *x = new PLFLT[4]; PLFLT *y = new PLFLT[4]; x[0] = x0; y[0] = 0.; x[1] = x0; y[1] = y0; x[2] = x0 + 1.; y[2] = y0; x[3] = x0 + 1.; y[3] = 0.; pls->fill( 4, x, y ); pls->col0( 1 ); pls->lsty( 1 ); pls->line( 4, x, y ); delete[] x; delete[] y; } int main( int argc, const char **argv ) { x12 *x = new x12( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x12.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x30.cc 644 1750 1750 1157411663522153 160730ustar andrewandrew// $Id: x30.cc 12037 2011-11-24 20:09:15Z andrewross $ // // Alpha color values demonstration. // // Copyright (C) 2008 Hazen Babcock // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example will only really be interesting when used with devices that // support or alpha (or transparency) values, such as the cairo device family. // #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x30 { public: x30( int, const char ** ); private: plstream *pls; static PLINT red[]; static PLINT green[]; static PLINT blue[]; static PLFLT alpha[]; static PLFLT px[]; static PLFLT py[]; static PLFLT pos[]; static PLFLT rcoord[]; static PLFLT gcoord[]; static PLFLT bcoord[]; static PLFLT acoord[]; static PLBOOL rev[]; }; PLINT x30::red[] = { 0, 255, 0, 0 }; PLINT x30::green[] = { 0, 0, 255, 0 }; PLINT x30::blue[] = { 0, 0, 0, 255 }; PLFLT x30::alpha[] = { 1.0, 1.0, 1.0, 1.0 }; PLFLT x30::px[] = { 0.1, 0.5, 0.5, 0.1 }; PLFLT x30::py[] = { 0.1, 0.1, 0.5, 0.5 }; PLFLT x30::pos[] = { 0.0, 1.0 }; PLFLT x30::rcoord[] = { 1.0, 1.0 }; PLFLT x30::gcoord[] = { 0.0, 0.0 }; PLFLT x30::bcoord[] = { 0.0, 0.0 }; PLFLT x30::acoord[] = { 0.0, 1.0 }; x30::x30( int argc, const char *argv[] ) { int i, j; PLINT icol, r, g, b; PLFLT a; pls = new plstream; pls->parseopts( &argc, argv, PL_PARSE_FULL ); pls->init(); pls->scmap0n( 4 ); pls->scmap0a( red, green, blue, alpha, 4 ); // // Page 1: // // This is a series of red, green and blue rectangles overlaid // on each other with gradually increasing transparency. // // Set up the window pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->col0( 0 ); pls->box( "", 1.0, 0, "", 1.0, 0 ); // Draw the boxes for ( i = 0; i < 9; i++ ) { icol = i % 3 + 1; // Get a color, change its transparency and // set it as the current color. pls->gcol0a( icol, r, g, b, a ); pls->scol0a( icol, r, g, b, 1.0 - (double) i / 9.0 ); pls->col0( icol ); // Draw the rectangle pls->fill( 4, px, py ); // Shift the rectangles coordinates for ( j = 0; j < 4; j++ ) { px[j] += 0.5 / 9.0; py[j] += 0.5 / 9.0; } } // // Page 2: // // This is a bunch of boxes colored red, green or blue with a single // large (red) box of linearly varying transparency overlaid. The // overlaid box is completely transparent at the bottom and completely // opaque at the top. // // Set up the window pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); // Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. for ( i = 0; i < 5; i++ ) { // Set box X position px[0] = 0.05 + 0.2 * i; px[1] = px[0] + 0.1; px[2] = px[1]; px[3] = px[0]; // We don't want the boxes to be transparent, so since we changed // the colors transparencies in the first example we have to change // the transparencies back to completely opaque. icol = i % 3 + 1; pls->gcol0a( icol, r, g, b, a ); pls->scol0a( icol, r, g, b, 1.0 ); pls->col0( icol ); for ( j = 0; j < 5; j++ ) { // Set box y position and draw the box. py[0] = 0.05 + 0.2 * j; py[1] = py[0]; py[2] = py[0] + 0.1; py[3] = py[2]; pls->fill( 4, px, py ); } } // Create the color map with 128 colors and use plscmap1la to initialize // the color values with a linearly varying red transparency (or alpha) pls->scmap1n( 128 ); pls->scmap1la( true, 2, pos, rcoord, gcoord, bcoord, acoord ); // Use that cmap1 to create a transparent red gradient for the whole // window. px[0] = 0.; px[1] = 1.; px[2] = 1.; px[3] = 0.; py[0] = 0.; py[1] = 0.; py[2] = 1.; py[3] = 1.; pls->gradient( 4, px, py, 90. ); delete pls; } int main( int argc, const char **argv ) { x30 *x = new x30( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/x19.cc 644 1750 1750 1431712221050115 160610ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x19.cc 12532 2013-09-26 15:18:37Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 19 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x19 { public: x19( int, const char ** ); private: // Class data plstream *pls; }; void map_transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer /* data */ ) { double radius; radius = 90.0 - y; *xt = radius * cos( x * M_PI / 180.0 ); *yt = radius * sin( x * M_PI / 180.0 ); } //-------------------------------------------------------------------------- // mapform19 // // Defines specific coordinate transformation for example 19. // Not to be confused with mapform in src/plmap.c. // x[], y[] are the coordinates to be plotted. //-------------------------------------------------------------------------- void mapform19( PLINT n, PLFLT *x, PLFLT *y ) { int i; double xp, yp, radius; for ( i = 0; i < n; i++ ) { radius = 90.0 - y[i]; xp = radius * cos( x[i] * M_PI / 180.0 ); yp = radius * sin( x[i] * M_PI / 180.0 ); x[i] = xp; y[i] = yp; } } // "Normalize" longitude values so that they always fall between -180.0 and // 180.0 PLFLT normalize_longitude( PLFLT lon ) { PLFLT times; if ( lon >= -180.0 && lon <= 180.0 ) { return ( lon ); } else { times = floor( ( fabs( lon ) + 180.0 ) / 360.0 ); if ( lon < 0.0 ) { return ( lon + 360.0 * times ); } else { return ( lon - 360.0 * times ); } } } // A custom axis labeling function for longitudes and latitudes. void geolocation_labeler( PLINT axis, PLFLT value, char *label, PLINT length, PLPointer /* data */ ) { const char *direction_label = ""; PLFLT label_val = 0.0; if ( axis == PL_Y_AXIS ) { label_val = value; if ( label_val > 0.0 ) { direction_label = " N"; } else if ( label_val < 0.0 ) { direction_label = " S"; } else { direction_label = "Eq"; } } else if ( axis == PL_X_AXIS ) { label_val = normalize_longitude( value ); if ( label_val > 0.0 ) { direction_label = " E"; } else if ( label_val < 0.0 ) { direction_label = " W"; } else { direction_label = ""; } } if ( axis == PL_Y_AXIS && value == 0.0 ) { // A special case for the equator snprintf( label, length, "%s", direction_label ); } else { snprintf( label, length, "%.0f%s", fabs( label_val ), direction_label ); } } x19::x19( int argc, const char ** argv ) { PLFLT minx, maxx, miny, maxy; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Longitude (x) and latitude (y) miny = -70; maxy = 80; // Initialize PLplot. pls->init(); // Cartesian plots // Most of world minx = -170; maxx = minx + 360; // Setup a custom latitude and longitude-based scaling function. pls->slabelfunc( geolocation_labeler, NULL ); pls->col0( 1 ); pls->env( minx, maxx, miny, maxy, 1, 70 ); pls->map( NULL, "usaglobe", minx, maxx, miny, maxy ); // The Americas minx = 190; maxx = 340; pls->col0( 1 ); pls->env( minx, maxx, miny, maxy, 1, 70 ); pls->map( NULL, "usaglobe", minx, maxx, miny, maxy ); // Clear the labeling function pls->slabelfunc( NULL, NULL ); // Polar, Northern hemisphere minx = 0; maxx = 360; pls->env( -75., 75., -75., 75., 1, -1 ); pls->map( mapform19, "globe", minx, maxx, miny, maxy ); pls->lsty( 2 ); pls->meridians( mapform19, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0; maxx = 360; pls->stransform( map_transform, NULL ); pls->lsty( 1 ); pls->env( -75., 75., -75., 75., 1, -1 ); // No need to set the map transform here as the global transform will be // used. pls->map( NULL, "globe", minx, maxx, miny, maxy ); pls->lsty( 2 ); pls->meridians( NULL, 10.0, 10.0, 0.0, 360.0, -10.0, 80.0 ); // Show Baltimore, MD on the map pls->col0( 2 ); pls->ssym( 0.0, 2.0 ); PLFLT x = -76.6125; PLFLT y = 39.2902778; pls->poin( 1, &x, &y, 18 ); pls->ssym( 0.0, 1.0 ); pls->ptex( -76.6125, 43.0, 0.0, 0.0, 0.0, "Baltimore, MD" ); // For C, this is how the global transform is cleared pls->stransform( NULL, NULL ); delete pls; } int main( int argc, const char ** argv ) { x19 *x = new x19( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x19.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x06.cc 644 1750 1750 761711721772043 160610ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x06.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 6 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x06 { public: x06( int, const char ** ); private: // Class data plstream *pls; }; x06::x06( int argc, const char ** argv ) { int i, j, k, kind_font, font, maxfont; PLFLT x, y; char text[10]; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); for ( kind_font = 0; kind_font < 2; kind_font++ ) { pls->fontld( kind_font ); if ( kind_font == 0 ) maxfont = 1; else maxfont = 4; for ( font = 0; font < maxfont; font++ ) { pls->font( font + 1 ); pls->adv( 0 ); // Set up viewport and window. pls->col0( 2 ); pls->vpor( 0.1, 1.0, 0.1, 0.9 ); pls->wind( 0.0, 1.0, 0.0, 1.3 ); // Draw the grid using plbox. pls->box( "bcg", 0.1, 0, "bcg", 0.1, 0 ); // Write the digits below the frame. pls->col0( 15 ); for ( i = 0; i <= 9; i++ ) { sprintf( text, "%d", i ); pls->mtex( "b", 1.5, ( 0.1 * i + 0.05 ), 0.5, text ); } k = 0; for ( i = 0; i <= 12; i++ ) { // Write the digits to the left of the frame. sprintf( text, "%d", 10 * i ); pls->mtex( "lv", 1.0, ( 1.0 - ( 2 * i + 1 ) / 26.0 ), 1.0, text ); for ( j = 0; j <= 9; j++ ) { x = 0.1 * j + 0.05; y = 1.25 - 0.1 * i; // Display the symbols (plpoin expects that x and y are // arrays so that is what we feed it). if ( k < 128 ) pls->poin( 1, &x, &y, k ); k = k + 1; } } if ( kind_font == 0 ) pls->mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (compact)" ); else pls->mtex( "t", 1.5, 0.5, 0.5, "PLplot Example 6 - plpoin symbols (extended)" ); } } // pls->end(); delete pls; } int main( int argc, const char ** argv ) { x06 *x = new x06( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x06.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x00.cc 644 1750 1750 442411775650221 160460ustar andrewandrew// $Id: x00.cc 12197 2012-07-06 20:54:41Z airwin $ // // Simple demo of a 2D line plot. // // Copyright (C) 2011 Alan W. Irwin // Copyright (C) 2012 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x00 { public: x00( int, const char ** ); private: // Class data plstream *pls; static const int NSIZE; }; const int x00::NSIZE = 101; x00::x00( int argc, const char **argv ) { PLFLT x[NSIZE], y[NSIZE]; PLFLT xmin = 0., xmax = 1., ymin = 0., ymax = 100.; int i; // Prepare data to be plotted. for ( i = 0; i < NSIZE; i++ ) { x[i] = (PLFLT) ( i ) / (PLFLT) ( NSIZE - 1 ); y[i] = ymax * x[i] * x[i]; } pls = new plstream(); // Parse and process command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->init(); // Create a labelled box to hold the plot. pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->lab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ); // Plot the data that was prepared above. pls->line( NSIZE, x, y ); // In C++ we don't call plend() to close PLplot library // this is handled by the destructor delete pls; } int main( int argc, const char ** argv ) { x00 *x = new x00( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x00.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x04.cc 644 1750 1750 1303712143241771 160660ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x04.cc 12336 2013-05-10 19:01:13Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 4 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x04 { public: x04( int, const char ** ); void plot1( int ); private: // Class data plstream *pls; }; x04::x04( int argc, const char ** argv ) { // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); pls->font( 2 ); // Make log plots using two different styles. plot1( 0 ); plot1( 1 ); // pls->end(); delete pls; } // Log-linear plot. void x04::plot1( int type ) { int i; PLFLT *freql = new PLFLT[101]; PLFLT *ampl = new PLFLT[101]; PLFLT *phase = new PLFLT[101]; PLFLT f0, freq; PLINT nlegend; const char *text[2], *symbols[2]; PLINT opt_array[2]; PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; PLFLT legend_width, legend_height; pls->adv( 0 ); // Set up data for log plot. f0 = 1.0; for ( i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, (double) freql[i] ); ampl[i] = 20.0 * log10( 1.0 / sqrt( 1.0 + pow( (double) ( freq / f0 ), 2. ) ) ); phase[i] = -( 180.0 / M_PI ) * atan( (double) ( freq / f0 ) ); } pls->vpor( 0.15, 0.85, 0.1, 0.9 ); pls->wind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. pls->col0( 1 ); switch ( type ) { case 0: pls->box( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: pls->box( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; } // Plot ampl vs freq. pls->col0( 2 ); pls->line( 101, freql, ampl ); pls->col0( 2 ); pls->ptex( 1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade" ); // Put labels on. pls->col0( 1 ); pls->mtex( "b", 3.2, 0.5, 0.5, "Frequency" ); pls->mtex( "t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter" ); pls->col0( 2 ); pls->mtex( "l", 5.0, 0.5, 0.5, "Amplitude (dB)" ); nlegend = 1; // For the gridless case, put phase vs freq on same plot. if ( type == 0 ) { pls->col0( 1 ); pls->wind( -2.0, 3.0, -100.0, 0.0 ); pls->box( "", 0.0, 0, "cmstv", 30.0, 3 ); pls->col0( 3 ); pls->line( 101, freql, phase ); pls->string( 101, freql, phase, "*" ); pls->col0( 3 ); pls->mtex( "r", 5.0, 0.5, 0.5, "Phase shift (degrees)" ); nlegend = 2; } // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; text[0] = "Amplitude"; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.0; // note from the above opt_array the first symbol (and box) indices // do not have to be specified // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; text[1] = "Phase shift"; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.0; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // from the above opt_arrays we can completely ignore everything // to do with boxes. pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); delete[] freql; delete[] ampl; delete[] phase; } int main( int argc, const char ** argv ) { x04 *x = new x04( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x04.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/CMakeLists.txt 644 1750 1750 1437112252030714 177000ustar andrewandrew# examples/c++/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Andrew Ross # Copyright (C) 2006, 2007, 2008, 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(cxx_STRING_INDICES "01cc" "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) if(CORE_BUILD) set(cxx_SRCS plc++demos.h) foreach(STRING_INDEX ${cxx_STRING_INDICES}) set(cxx_SRCS ${cxx_SRCS} x${STRING_INDEX}.cc) endforeach(STRING_INDEX ${cxx_STRING_INDICES}) if(ENABLE_wxwidgets) set(wxPLplotDemo_SRCS wxPLplotDemo.cpp) endif(ENABLE_wxwidgets) if(PLD_extqt) set(qt_INSTALLED_FILES qt_PlotWindow.cpp qt_PlotWindow.h qt_example.cpp README.qt_example) endif(PLD_extqt) install(FILES ${cxx_SRCS} ${wxPLplotDemo_SRCS} ${qt_INSTALLED_FILES} DESTINATION ${DATA_DIR}/examples/c++) set(CXX ${CMAKE_CXX_COMPILER}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/c++ RENAME Makefile ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt DESTINATION ${DATA_DIR}/examples/c++ ) endif(CORE_BUILD) if(BUILD_TEST) if(CORE_BUILD) include_directories( ${CMAKE_SOURCE_DIR}/bindings/c++ ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include ${CMAKE_SOURCE_DIR}/lib/qsastime ) else(CORE_BUILD) include_directories(${INCLUDE_DIR}) endif(CORE_BUILD) endif(BUILD_TEST) if(BUILD_TEST) set_property(GLOBAL PROPERTY TARGETS_examples_cxx) foreach(STRING_INDEX ${cxx_STRING_INDICES}) if(CORE_BUILD AND BUILD_SHARED_LIBS) SET_SOURCE_FILES_PROPERTIES(x${STRING_INDEX}.cc PROPERTIES COMPILE_FLAGS "-DUSINGDLL") endif(CORE_BUILD AND BUILD_SHARED_LIBS) add_executable(x${STRING_INDEX} x${STRING_INDEX}.cc) target_link_libraries(x${STRING_INDEX} plplotcxx${LIB_TAG} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_cxx x${STRING_INDEX}) endforeach(STRING_INDEX ${cxx_STRING_INDICES}) if(ENABLE_wxwidgets) # Build wxwidgets applications with same wxwidgets compile and link flags # as used with the PLplot wxwidgets device driver. if(CORE_BUILD) if(BUILD_SHARED_LIBS) set_source_files_properties(wxPLplotDemo.cpp PROPERTIES COMPILE_FLAGS "-DUSINGDLL ${wxwidgets_COMPILE_FLAGS}") else(BUILD_SHARED_LIBS) set_source_files_properties(wxPLplotDemo.cpp PROPERTIES COMPILE_FLAGS "${wxwidgets_COMPILE_FLAGS}") endif(BUILD_SHARED_LIBS) include_directories( ${CMAKE_SOURCE_DIR}/bindings/wxwidgets ${CMAKE_BINARY_DIR}/bindings/wxwidgets ) else(CORE_BUILD) set_source_files_properties(wxPLplotDemo.cpp PROPERTIES COMPILE_FLAGS "${wxwidgets_COMPILE_FLAGS}") endif(CORE_BUILD) add_executable(wxPLplotDemo WIN32 wxPLplotDemo.cpp) target_link_libraries(wxPLplotDemo plplotwxwidgets${LIB_TAG} plplotcxx${LIB_TAG} ${wxwidgets_LINK_FLAGS} ${MATH_LIB}) endif(ENABLE_wxwidgets) if(ENABLE_qt) if(CORE_BUILD) set(BUILD_qt_example ON) if(NOT QT_LIBRARIES) message(FATAL_ERROR "include(${QT_USE_FILE}) failed in core build examples/c++ subdirectory.") endif(NOT QT_LIBRARIES) else(CORE_BUILD) # Must find Qt4 all over again here rather than simply copying variables # from the core build to this installed examples build so that we can # access the qt4_wrap_cpp macro here. find_package(Qt4 4.8.2 REQUIRED QtCore QtGui QtSvg) # To avoid Qt4 version mismatch make sure the Qt version matches that # used by the core build. if(QT4_FOUND AND QT_VERSION_MAJOR STREQUAL "${CORE_QT_VERSION_MAJOR}" AND QT_VERSION_MINOR STREQUAL "${CORE_QT_VERSION_MINOR}" AND QT_VERSION_PATCH STREQUAL "${CORE_QT_VERSION_PATCH}") include(ndp_UseQt4) if(NOT QT_LIBRARIES) message(FATAL_ERROR "include(${QT_USE_FILE}) failed in installed examples build examples/c++ subdirectory.") endif(NOT QT_LIBRARIES) set(BUILD_qt_example ON) else(QT4_FOUND AND QT_VERSION_MAJOR STREQUAL "${CORE_QT_VERSION_MAJOR}" AND QT_VERSION_MINOR STREQUAL "${CORE_QT_VERSION_MINOR}" AND QT_VERSION_PATCH STREQUAL "${CORE_QT_VERSION_PATCH}") message(STATUS "WARNING: Qt4 not found or wrong version. qt_example not built") set(BUILD_qt_example OFF) endif(QT4_FOUND AND QT_VERSION_MAJOR STREQUAL "${CORE_QT_VERSION_MAJOR}" AND QT_VERSION_MINOR STREQUAL "${CORE_QT_VERSION_MINOR}" AND QT_VERSION_PATCH STREQUAL "${CORE_QT_VERSION_PATCH}") endif(CORE_BUILD) if(BUILD_qt_example) qt4_wrap_cpp( QT_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/qt_PlotWindow.h ) # message("QT_MOC_OUTFILES = ${QT_MOC_OUTFILES}") set_source_files_properties( ${QT_MOC_OUTFILES} PROPERTIES GENERATED "ON" ) add_executable(qt_example qt_example.cpp qt_PlotWindow.cpp ${QT_MOC_OUTFILES}) target_link_libraries(qt_example ${QT_LIBRARIES} plplotqt${LIB_TAG} plplot${LIB_TAG}) # Update the target COMPILE_DEFINITIONS and INCLUDE_DIRECTORIES set_qt_target_properties(qt_example) endif(BUILD_qt_example) endif(ENABLE_qt) endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/c++/x18.cc 644 1750 1750 1327411571511407 160760ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x18.cc 11760 2011-06-01 19:29:11Z airwin $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 18 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x18 { public: x18( int, const char ** ); PLFLT THETA( int ); PLFLT PHI( int ); void test_poly( int ); private: // Class data plstream *pls; static const int NPTS; static const int opt[4]; static const PLFLT alt[4]; static const PLFLT az[4]; }; const int x18:: NPTS = 1000; const int x18:: opt[] = { 1, 0, 1, 0 }; const PLFLT x18::alt[4] = { 20.0, 35.0, 50.0, 65.0 }; const PLFLT x18::az[4] = { 30.0, 40.0, 50.0, 60.0 }; x18::x18( int argc, const char ** argv ) { int i, k; PLFLT r; char title[80]; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); for ( k = 0; k < 4; k++ ) test_poly( k ); PLFLT *x = new PLFLT[NPTS]; PLFLT *y = new PLFLT[NPTS]; PLFLT *z = new PLFLT[NPTS]; // From the mind of a sick and twisted physicist... for ( i = 0; i < NPTS; i++ ) { z[i] = -1. + 2. * i / NPTS; // Pick one ... // r = 1. - ( (PLFLT) i / (PLFLT) NPTS ); r = z[i]; x[i] = r * cos( 2. * M_PI * 6. * i / NPTS ); y[i] = r * sin( 2. * M_PI * 6. * i / NPTS ); } for ( k = 0; k < 4; k++ ) { pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 0.9 ); pls->wind( -1.0, 1.0, -0.9, 1.1 ); pls->col0( 1 ); pls->w3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); pls->box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); pls->col0( 2 ); if ( opt[k] > 0 ) pls->line3( NPTS, x, y, z ); else // U+22C5 DOT OPERATOR. pls->string3( NPTS, x, y, z, "⋅" ); pls->col0( 3 ); sprintf( title, "#frPLplot Example 18 - Alt=%.0f, Az=%.0f", alt[k], az[k] ); pls->mtex( "t", 1.0, 0.5, 0.5, title ); } //pls->end(); delete[] x; delete[] y; delete[] z; delete pls; } PLFLT x18::THETA( int a ) { return 2. * M_PI * (PLFLT) a / 20.; } PLFLT x18::PHI( int a ) { return M_PI * (PLFLT) a / 20.1; } void x18::test_poly( int k ) { int i, j; bool draw[4][4] = { { true, true, true, true }, { true, false, true, false }, { false, true, false, true }, { true, true, false, false } }; PLFLT *x = new PLFLT [5]; PLFLT *y = new PLFLT [5]; PLFLT *z = new PLFLT [5]; pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 0.9 ); pls->wind( -1.0, 1.0, -0.9, 1.1 ); pls->col0( 1 ); pls->w3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, alt[k], az[k] ); pls->box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); pls->col0( 2 ); // x = r sin(phi) cos(theta) // y = r sin(phi) sin(theta) // z = r cos(phi) // r = 1 :=) for ( i = 0; i < 20; i++ ) { for ( j = 0; j < 20; j++ ) { x[0] = sin( PHI( j ) ) * cos( THETA( i ) ); y[0] = sin( PHI( j ) ) * sin( THETA( i ) ); z[0] = cos( PHI( j ) ); x[1] = sin( PHI( j + 1 ) ) * cos( THETA( i ) ); y[1] = sin( PHI( j + 1 ) ) * sin( THETA( i ) ); z[1] = cos( PHI( j + 1 ) ); x[2] = sin( PHI( j + 1 ) ) * cos( THETA( i + 1 ) ); y[2] = sin( PHI( j + 1 ) ) * sin( THETA( i + 1 ) ); z[2] = cos( PHI( j + 1 ) ); x[3] = sin( PHI( j ) ) * cos( THETA( i + 1 ) ); y[3] = sin( PHI( j ) ) * sin( THETA( i + 1 ) ); z[3] = cos( PHI( j ) ); x[4] = sin( PHI( j ) ) * cos( THETA( i ) ); y[4] = sin( PHI( j ) ) * sin( THETA( i ) ); z[4] = cos( PHI( j ) ); pls->poly3( 5, x, y, z, draw[k], true ); } } pls->col0( 3 ); pls->mtex( "t", 1.0, 0.5, 0.5, "unit radius sphere" ); delete[] x; delete[] y; delete[] z; } int main( int argc, const char ** argv ) { x18 *x = new x18( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x18.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/README.c++demos 644 1750 1750 127511721772043 174060ustar andrewandrewThese C++ examples exactly replicate the C examples but using the C++ plstream class. The examples are written to work on a fairly modern C++ compiler. They are known to work with gcc 2.95 and gcc 3.3.3 for example. The examples make use of the std namespace feature. This may cause some difficulties on older compilers. You may need to comment out the line "using namespace std;" near the top of the file in this case. We have had reports of other problems on some versions of the IRIX compilers because they do not include the standard header file cstdlib. In this case you may need to include stdlib.h instead. If you encounter any other problems please report them. Andrew Ross March 2004. plplot-5.10.0+dfsg/examples/c++/README.qt_example 644 1750 1750 115611706352130 201350ustar andrewandrewThe files qt_example.cpp, qt_PlotWindow.cpp, and qt_PlotWindow.h contain source code for a simple example demonstrating how to access the PLplot API from a Qt GUI application. For all our build systems (cmake in the build tree, cmake in the installed examples build tree, and the traditional pkg-config+Makefile build system for the installed examples tree), you build this simple Qt example (with all dependencies taken care of automatically) by running make qt_example For our two CMake-based build systems you can run this example (with all dependencies taken care of automatically) by running make test_qt_example plplot-5.10.0+dfsg/examples/c++/x14.cc 644 1750 1750 2646412251724462 161020ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x14.cc 12840 2013-12-10 23:52:18Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 14 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x14 { public: x14( int, const char ** ); void plot1( plstream * ); void plot2( plstream * ); void plot3( plstream * ); void plot4( plstream * ); void plot5( plstream * ); static void mypltr( PLFLT, PLFLT, PLFLT *, PLFLT *, void * ); private: // Class data plstream *pls1, *pls2; PLFLT x[101], y[101]; PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; static PLINT space0, mark0, space1, mark1; static const int xpts, ypts; static const PLFLT xspa, yspa; static const PLFLT tr[6]; }; PLINT x14::space0 = 0, x14::mark0 = 0, x14::space1 = 1500, x14::mark1 = 1500; const int x14:: xpts = 35; const int x14:: ypts = 46; const PLFLT x14::xspa = 2. / ( x14::xpts - 1 ); const PLFLT x14::yspa = 2. / ( x14::ypts - 1 ); const PLFLT x14::tr[6] = { x14::xspa, 0.0, -1.0, 0.0, x14::yspa, -1.0 }; void x14::mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * /* pltr_data */ ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } static PLFLT clevel[11] = { -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. }; //-------------------------------------------------------------------------- // x14() // // Plots several simple functions from other example programs. // // This version sends the output of the first 4 plots (one page) to two // independent streams. //-------------------------------------------------------------------------- x14::x14( int argc, const char ** argv ) { int digmax; // Select either TK or DP driver and use a small window // Using DP results in a crash at the end due to some odd cleanup problems // The geometry strings MUST be in writable memory char driver[80] = ""; PLINT fam, num, bmax; const char geometry_master[] = "500x410+100+200"; const char geometry_slave[] = "500x410+650+200"; PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; int valid_geometry; // plplot initialization pls1 = new plstream(); // Parse and process command line arguments. pls1->parseopts( &argc, argv, PL_PARSE_FULL ); //If valid geometry specified on command line, use it for both streams. pls1->gpage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); valid_geometry = ( xleng0 > 0 && yleng0 > 0 ); // Set up first stream if ( valid_geometry ) pls1->spage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); else pls1->setopt( "geometry", geometry_master ); pls1->ssub( 2, 2 ); // Initialize PLplot. pls1->init(); pls1->gdev( driver ); pls1->gfam( fam, num, bmax ); cout << "Demo of multiple output streams via the " << driver << " driver." << endl; cout << "Running with the second stream as slave to the first.\n" << endl; pls2 = new plstream(); if ( valid_geometry ) pls2->spage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); else pls2->setopt( "geometry", geometry_slave ); // Turn off pause to make this a slave (must follow master) pls2->spause( false ); pls2->sdev( driver ); pls2->sfam( fam, num, bmax ); // Currently number of digits in format number can only be // set via the command line option pls2->setopt( "fflen", "2" ); pls2->init(); // Set up the data & plot // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; plot1( pls1 ); // Set up the data & plot xscale = 1.; yscale = 1.e+6; plot1( pls1 ); // Set up the data & plot xscale = 1.; yscale = 1.e-6; digmax = 2; pls1->syax( digmax, 0 ); plot1( pls1 ); // Set up the data & plot xscale = 1.; yscale = 0.0014; yoff = 0.0185; digmax = 5; pls1->syax( digmax, 0 ); plot1( pls1 ); // To slave // The eop() ensures the eop indicator gets lit. plot4( pls2 ); pls2->eop(); // Back to master plot2( pls1 ); plot3( pls1 ); // To slave plot5( pls2 ); pls2->eop(); // Back to master to wait for user to advance pls1->eop(); delete pls1; delete pls2; } //-------------------------------------------------------------------------- void x14::plot1( plstream *pls ) { int i; PLFLT xmin, xmax, ymin, ymax; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * pow( (double) x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). pls->col0( 1 ); pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->col0( 6 ); pls->lab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points pls->col0( 9 ); pls->poin( 6, xs, ys, 9 ); // Draw the line through the data pls->col0( 4 ); pls->line( 60, x, y ); pls->flush(); } //-------------------------------------------------------------------------- void x14::plot2( plstream *pls ) { int i; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). pls->col0( 1 ); pls->env( -2.0, 10.0, -0.4, 1.2, 0, 1 ); pls->col0( 2 ); pls->lab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line pls->col0( 3 ); pls->line( 100, x, y ); pls->flush(); } //-------------------------------------------------------------------------- void x14::plot3( plstream *pls ) { int i; // For the final graph we wish to override the default tick intervals, and // so do not use PLENV pls->adv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. pls->vsta(); pls->wind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. pls->col0( 1 ); pls->box( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl // expects a pointer!! pls->styl( 1, &mark1, &space1 ); pls->col0( 2 ); pls->box( "g", 30.0, 0, "g", 0.2, 0 ); pls->styl( 0, &mark0, &space0 ); pls->col0( 3 ); pls->lab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * M_PI / 180.0 ); } pls->col0( 4 ); pls->line( 101, x, y ); pls->flush(); } //-------------------------------------------------------------------------- void x14::plot4( plstream *pls ) { int i, j; PLFLT dtr, theta, dx, dy, r; char text[4]; PLFLT x0[361], y0[361]; PLFLT x[361], y[361]; dtr = M_PI / 180.0; for ( i = 0; i <= 360; i++ ) { x0[i] = cos( dtr * i ); y0[i] = sin( dtr * i ); } // Set up viewport and window, but do not draw box pls->env( -1.3, 1.3, -1.3, 1.3, 1, -2 ); for ( i = 1; i <= 10; i++ ) { for ( j = 0; j <= 360; j++ ) { x[j] = 0.1 * i * x0[j]; y[j] = 0.1 * i * y0[j]; } // Draw circles for polar grid pls->line( 361, x, y ); } pls->col0( 2 ); for ( i = 0; i <= 11; i++ ) { theta = 30.0 * i; dx = cos( dtr * theta ); dy = sin( dtr * theta ); // Draw radial spokes for polar grid pls->join( 0.0, 0.0, dx, dy ); sprintf( text, "%d", (int) ROUND( theta ) ); // Write labels for angle //Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) pls->ptex( dx, dy, dx, dy, -0.15, text ); else pls->ptex( dx, dy, -dx, -dy, 1.15, text ); } // Draw the graph for ( i = 0; i <= 360; i++ ) { r = sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } pls->col0( 3 ); pls->line( 361, x, y ); pls->col0( 4 ); pls->mtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); pls->flush(); } //-------------------------------------------------------------------------- // Demonstration of contour plotting void x14::plot5( plstream *pls ) { int i, j; PLFLT xx, yy; PLFLT **z, **w; static PLINT mark = 1500, space = 1500; // Set up function arrays pls->Alloc2dGrid( &z, xpts, ypts ); pls->Alloc2dGrid( &w, xpts, ypts ); for ( i = 0; i < xpts; i++ ) { xx = (double) ( i - ( xpts / 2 ) ) / (double) ( xpts / 2 ); for ( j = 0; j < ypts; j++ ) { yy = (double) ( j - ( ypts / 2 ) ) / (double) ( ypts / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } pls->env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls->col0( 2 ); pls->cont( z, xpts, ypts, 1, xpts, 1, ypts, clevel, 11, x14::mypltr, NULL ); pls->styl( 1, &mark, &space ); pls->col0( 3 ); pls->cont( w, xpts, ypts, 1, xpts, 1, ypts, clevel, 11, x14::mypltr, NULL ); pls->col0( 1 ); pls->lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pls->flush(); // Clean up pls->Free2dGrid( z, xpts, ypts ); pls->Free2dGrid( w, xpts, ypts ); } int main( int argc, const char ** argv ) { x14 *x = new x14( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x14.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x16.cc 644 1750 1750 3755112232323306 160720ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x16.cc 12626 2013-10-24 23:01:26Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 16 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x16 { public: x16( int, const char ** ); private: // Class data plstream *pls; // number of shade levels, x data points, y data points, // and perimeter points. static int ns; static int nx; static int ny; static int exclude; static int colorbar; const static int PERIMETERPTS; public: static PLFLT tr[]; static PLOptionTable options[]; static const char *notes[]; }; int x16:: ns = 20; int x16:: nx = 35; int x16:: ny = 46; int x16:: exclude = 0; int x16:: colorbar = 1; const int x16::PERIMETERPTS = 100; PLFLT x16:: tr[] = { 2. / ( nx - 1 ), 0.0, -1.0, 0.0, 2. / ( ny - 1 ), -1.0 }; // Options data structure definition. PLOptionTable x16::options[] = { { "exclude", // Turns on page showing exclusion NULL, NULL, &exclude, PL_OPT_BOOL, "-exclude", "Plot the \"exclusion\" page." }, { "ns", // Number of shade levels NULL, NULL, &ns, PL_OPT_INT, "-ns levels", "Sets number of shade levels" }, { "nx", // Number of data points in x NULL, NULL, &nx, PL_OPT_INT, "-nx xpts", "Sets number of data points in x" }, { "ny", // Number of data points in y NULL, NULL, &ny, PL_OPT_INT, "-ny ypts", "Sets number of data points in y" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; const char *x16:: notes[] = { "To get smoother color variation, increase ns, nx, and ny. To get faster", "response (especially on a serial link), decrease them. A decent but quick", "test results from ns around 5 and nx, ny around 25.", NULL }; // Transformation function static void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * /* pltr_data */ ) { *tx = x16::tr[0] * x + x16::tr[1] * y + x16::tr[2]; *ty = x16::tr[3] * x + x16::tr[4] * y + x16::tr[5]; } PLINT zdefined( PLFLT x, PLFLT y ) { PLFLT z = sqrt( x * x + y * y ); return z < 0.4 || z > 0.6; } x16::x16( int argc, const char ** argv ) { int i, j; PLFLT x, y, argx, argy, distort, r, t, zmin, zmax; PLFLT *px = new PLFLT[PERIMETERPTS]; PLFLT *py = new PLFLT[PERIMETERPTS]; PLFLT *xg1 = new PLFLT[nx]; PLFLT *yg1 = new PLFLT[ny]; PLFLT **z; PLFLT **w; PLcGrid cgrid1; PLcGrid2 cgrid2; PLFLT *clevel = new PLFLT[ns]; PLFLT *shedge = new PLFLT[ns + 1]; const int cont_color = 0; const PLFLT fill_width = 2.0, cont_width = 0.0; PLFLT colorbar_width, colorbar_height; #define NUM_AXES 1 PLINT n_axis_opts = NUM_AXES; const char *axis_opts[] = { "bcvtm", }; PLINT num_values[NUM_AXES]; PLFLT *values[NUM_AXES]; PLFLT axis_ticks[NUM_AXES] = { 0.0, }; PLINT axis_subticks[NUM_AXES] = { 0, }; #define NUM_LABELS 1 PLINT n_labels = NUM_LABELS; PLINT label_opts[] = { PL_COLORBAR_LABEL_BOTTOM, }; const char *labels[] = { "Magnitude", }; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->MergeOpts( options, "x16c options", notes ); pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Load colour palettes pls->spal0( "cmap0_black_on_white.pal" ); pls->spal1( "cmap1_gray.pal", true ); // Reduce colors in cmap 0 so that cmap 1 is useful on a //16-color display pls->scmap0n( 3 ); // Initialize PLplot. pls->init(); pls->Alloc2dGrid( &z, nx, ny ); pls->Alloc2dGrid( &w, nx, ny ); // Set up data array for ( i = 0; i < nx; i++ ) { x = (PLFLT) ( i - ( nx / 2 ) ) / (PLFLT) ( nx / 2 ); for ( j = 0; j < ny; j++ ) { y = (PLFLT) ( j - ( ny / 2 ) ) / (PLFLT) ( ny / 2 ) - 1.0; z[i][j] = -sin( 7. * x ) * cos( 7. * y ) + x * x - y * y; w[i][j] = -cos( 7. * x ) * sin( 7. * y ) + 2 * x * y; } } pls->MinMax2dGrid( z, nx, ny, &zmax, &zmin ); for ( i = 0; i < ns; i++ ) clevel[i] = zmin + ( zmax - zmin ) * ( i + 0.5 ) / (PLFLT) ns; for ( i = 0; i < ns + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * (PLFLT) i / (PLFLT) ns; // Set up coordinate grids cgrid1.xg = xg1; cgrid1.yg = yg1; cgrid1.nx = nx; cgrid1.ny = ny; pls->Alloc2dGrid( &cgrid2.xg, nx, ny ); pls->Alloc2dGrid( &cgrid2.yg, nx, ny ); cgrid2.nx = nx; cgrid2.ny = ny; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { mypltr( (PLFLT) i, (PLFLT) j, &x, &y, NULL ); argx = x * M_PI / 2; argy = y * M_PI / 2; distort = 0.4; cgrid1.xg[i] = x + distort * cos( argx ); cgrid1.yg[j] = y - distort * cos( argy ); cgrid2.xg[i][j] = x + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = y - distort * cos( argx ) * cos( argy ); } } // Plot using identity transform pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); pls->psty( 0 ); pls->shades( z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plstream::fill, true, NULL, NULL ); if ( colorbar ) { // Smaller text pls->schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls->smaj( 0.0, 0.5 ); pls->smin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; pls->colorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes pls->schr( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); pls->smin( 0.0, 1.0 ); } pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->col0( 2 ); pls->lab( "distance", "altitude", "Bogon density" ); // Plot using 1d coordinate transform pls->spal0( "cmap0_black_on_white.pal" ); pls->spal1( "cmap1_blue_yellow.pal", true ); pls->scmap0n( 3 ); pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); pls->psty( 0 ); pls->shades( z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plstream::fill, true, plstream::tr1, (void *) &cgrid1 ); if ( colorbar ) { // Smaller text pls->schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls->smaj( 0.0, 0.5 ); pls->smin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; pls->colorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes pls->schr( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); pls->smin( 0.0, 1.0 ); } pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->col0( 2 ); pls->lab( "distance", "altitude", "Bogon density" ); // Plot using 2d coordinate transform pls->spal0( "cmap0_black_on_white.pal" ); pls->spal1( "cmap1_blue_red.pal", true ); pls->scmap0n( 3 ); pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); pls->psty( 0 ); pls->shades( z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); if ( colorbar ) { // Smaller text pls->schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls->smaj( 0.0, 0.5 ); pls->smin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; pls->colorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes pls->schr( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); pls->smin( 0.0, 1.0 ); } pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->col0( 2 ); pls->cont( w, nx, ny, 1, nx, 1, ny, clevel, ns, plstream::tr2, (void *) &cgrid2 ); pls->lab( "distance", "altitude", "Bogon density, with streamlines" ); // Plot using 2d coordinate transform pls->spal0( "" ); pls->spal1( "", true ); pls->scmap0n( 3 ); pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); pls->psty( 0 ); pls->shades( z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, 2, 3.0, plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); if ( colorbar ) { // Smaller text pls->schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls->smaj( 0.0, 0.5 ); pls->smin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; pls->colorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, 2, 3, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes pls->schr( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); pls->smin( 0.0, 1.0 ); } pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->col0( 2 ); pls->lab( "distance", "altitude", "Bogon density" ); // Note this exclusion API will probably change // Plot using 2d coordinate transform and exclusion if ( exclude ) { pls->spal0( "cmap0_black_on_white.pal" ); pls->spal1( "cmap1_gray.pal", true ); pls->scmap0n( 3 ); pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); pls->psty( 0 ); pls->shades( z, nx, ny, zdefined, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->lab( "distance", "altitude", "Bogon density with exclusion" ); } //Example with polar coordinates. pls->spal0( "cmap0_black_on_white.pal" ); pls->spal1( "cmap1_gray.pal", true ); pls->scmap0n( 3 ); pls->adv( 0 ); pls->vpor( .1, .9, .1, .9 ); pls->wind( -1., 1., -1., 1. ); pls->psty( 0 ); // Build new coordinate matrices. for ( i = 0; i < nx; i++ ) { r = ( (PLFLT) i ) / ( nx - 1 ); for ( j = 0; j < ny; j++ ) { t = ( 2. * M_PI / ( ny - 1. ) ) * j; cgrid2.xg[i][j] = r * cos( t ); cgrid2.yg[i][j] = r * sin( t ); z[i][j] = exp( -r * r ) * cos( 5. * M_PI * r ) * cos( 5. * t ); } } //Need a new shedge to go along with the new data set. pls->MinMax2dGrid( z, nx, ny, &zmax, &zmin ); for ( i = 0; i < ns + 1; i++ ) shedge[i] = zmin + ( zmax - zmin ) * (PLFLT) i / (PLFLT) ns; pls->shades( z, nx, ny, NULL, -1., 1., -1., 1., shedge, ns + 1, fill_width, cont_color, cont_width, plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); if ( colorbar ) { // Smaller text pls->schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls->smaj( 0.0, 0.5 ); pls->smin( 0.0, 0.5 ); num_values[0] = ns + 1; values[0] = shedge; pls->colorbar( &colorbar_width, &colorbar_height, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, 0, 0.005, 0.0, 0.0375, 0.875, 0, 1, 1, 0.0, 0.0, cont_color, cont_width, n_labels, label_opts, labels, n_axis_opts, axis_opts, axis_ticks, axis_subticks, num_values, (const PLFLT * const *) values ); // Reset text and tick sizes pls->schr( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); pls->smin( 0.0, 1.0 ); } // Now we can draw the perimeter. (If do before, shade stuff may overlap.) for ( i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * M_PI / ( PERIMETERPTS - 1 ) ) * (PLFLT) i; px[i] = cos( t ); py[i] = sin( t ); } pls->col0( 1 ); pls->line( PERIMETERPTS, px, py ); // And label the plot. pls->col0( 2 ); pls->lab( "", "", "Tokamak Bogon Instability" ); // Clean up // pls->end(); pls->Free2dGrid( z, nx, ny ); pls->Free2dGrid( w, nx, ny ); pls->Free2dGrid( cgrid2.xg, nx, ny ); pls->Free2dGrid( cgrid2.yg, nx, ny ); delete[] px; delete[] py; delete[] xg1; delete[] yg1; delete[] clevel; delete[] shedge; delete pls; } int main( int argc, const char ** argv ) { x16 *x = new x16( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x16.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x08.cc 644 1750 1750 2063411721772043 160750ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x08.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 8 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x08 { public: x08( int, const char** ); void cmap1_init( int ); private: plstream *pls; static const int XPTS; static const int YPTS; static PLFLT alt[]; static PLFLT az[]; static const char *title[]; static int sombrero; static PLOptionTable options[]; }; const int x08:: XPTS = 35; const int x08:: YPTS = 46; PLFLT x08:: alt[] = { 60.0, 20.0 }; PLFLT x08:: az[] = { 30.0, 60.0 }; const char *x08:: title[] = { "#frPLplot Example 8 - Alt=60, Az=30", "#frPLplot Example 8 - Alt=20, Az=60", }; PLOptionTable x08::options[] = { { "sombrero", // Turns on use of Sombrero function NULL, NULL, &x08::sombrero, PL_OPT_BOOL, "-sombrero", "Use the \"sombrero\" function." }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; int x08::sombrero = 0; // cmap1_init1 // Initializes color map 1 in HLS space. // Basic grayscale variation from half-dark (which makes more interesting // looking plot compared to dark) to light. // An interesting variation on this: // s[1] = 1.0 void x08::cmap1_init( int gray ) { PLFLT *i = new PLFLT[2]; PLFLT *h = new PLFLT[2]; PLFLT *l = new PLFLT[2]; PLFLT *s = new PLFLT[2]; bool *rev = new bool[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary if ( gray == 1 ) { h[0] = 0.0; // hue -- low: red (arbitrary if s=0) h[1] = 0.0; // hue -- high: red (arbitrary if s=0) l[0] = 0.5; // lightness -- low: half-dark l[1] = 1.0; // lightness -- high: light s[0] = 0.0; // minimum saturation s[1] = 0.0; // minimum saturation } else { h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; } rev[0] = false; // interpolate on front side of colour wheel. rev[1] = false; // interpolate on front side of colour wheel. pls->scmap1n( 256 ); pls->scmap1l( false, 2, i, h, l, s, rev ); delete[] i; delete[] h; delete[] l; delete[] s; delete[] rev; } // Does a series of 3-d plots for a given data set, with different viewing // options in each plot. x08::x08( int argc, const char **argv ) { int i, j, k; const int LEVELS = 10; PLFLT *x = new PLFLT[ XPTS ]; PLFLT *y = new PLFLT[ YPTS ]; PLFLT **z; PLFLT *clevel = new PLFLT[LEVELS]; bool rosen = true; PLFLT xx, yy, r; PLFLT zmin = 0.0, zmax = 0.0; int ifshade; pls = new plstream(); // Parse and process command line arguments. pls->MergeOpts( options, "x08c options", NULL ); pls->parseopts( &argc, argv, PL_PARSE_FULL ); if ( sombrero ) { rosen = false; } // Initialize plplot. pls->init(); pls->Alloc2dGrid( &z, XPTS, YPTS ); //z = new PLFLT*[XPTS]; // // for (i = 0; i < XPTS; i++) { // z[i] = new PLFLT [YPTS]; // x[i] = ((double) (i - (XPTS / 2)) / (double) (XPTS / 2)); // if (rosen) // x[i] *= 1.5; // } // for ( i = 0; i < XPTS; i++ ) { x[i] = (PLFLT) ( i - ( XPTS / 2 ) ) / (PLFLT) ( XPTS / 2 ); if ( rosen ) x[i] *= 1.5; } for ( j = 0; j < YPTS; j++ ) { y[j] = (PLFLT) ( j - ( YPTS / 2 ) ) / (PLFLT) ( YPTS / 2 ); if ( rosen ) y[j] += 0.5; } for ( i = 0; i < XPTS; i++ ) { xx = x[i]; for ( j = 0; j < YPTS; j++ ) { yy = y[j]; if ( rosen ) { z[i][j] = pow( (double) ( 1. - xx ), 2. ) + 100 * pow( (double) ( yy - pow( (double) xx, 2. ) ), 2. ); // The log argument may be zero for just the right grid. if ( z[i][j] > 0. ) z[i][j] = log( z[i][j] ); else z[i][j] = -5.; // -MAXFLOAT would mess-up up the scale } else { r = sqrt( xx * xx + yy * yy ); z[i][j] = exp( -r * r ) * cos( 2.0 * M_PI * r ); } if ( i == 0 && j == 0 ) { zmin = z[i][j]; zmax = zmin; } if ( zmin > z[i][j] ) zmin = z[i][j]; if ( zmax < z[i][j] ) zmax = z[i][j]; } } PLFLT step = ( zmax - zmin ) / ( LEVELS + 1 ); for ( i = 0; i < LEVELS; i++ ) clevel[i] = zmin + step * ( i + 1 ); pls->lightsource( 1., 1., 1. ); for ( k = 0; k < 2; k++ ) { for ( ifshade = 0; ifshade < 4; ifshade++ ) { pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 0.9 ); pls->wind( -1.0, 1.0, -0.9, 1.1 ); pls->col0( 3 ); pls->mtex( "t", 1.0, 0.5, 0.5, title[k] ); pls->col0( 1 ); if ( rosen ) pls->w3d( 1.0, 1.0, 1.0, -1.5, 1.5, -0.5, 1.5, zmin, zmax, alt[k], az[k] ); else pls->w3d( 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, zmin, zmax, alt[k], az[k] ); pls->box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 0 ); pls->col0( 2 ); if ( ifshade == 0 ) // diffuse light surface plot { cmap1_init( 1 ); pls->surf3d( x, y, z, XPTS, YPTS, 0, NULL, 0 ); } else if ( ifshade == 1 ) // magnitude colored plot { cmap1_init( 0 ); pls->surf3d( x, y, z, XPTS, YPTS, MAG_COLOR, NULL, 0 ); } else if ( ifshade == 2 ) // magnitude colored plot with faceted squares { cmap1_init( 0 ); pls->surf3d( x, y, z, XPTS, YPTS, MAG_COLOR | FACETED, NULL, 0 ); } else // magnitude colored plot with contours { cmap1_init( 0 ); pls->surf3d( x, y, z, XPTS, YPTS, MAG_COLOR | SURF_CONT | BASE_CONT, clevel, LEVELS ); } } } pls->Free2dGrid( z, XPTS, YPTS ); delete[] x; delete[] y; delete[] clevel; delete pls; } int main( int argc, const char **argv ) { x08 *x = new x08( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x08.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/qt_PlotWindow.cpp 644 1750 1750 1170212102122103 204350ustar andrewandrew// // // This software is provided under the LGPL in March 2009 by the // Cluster Science Centre // QSAS team, // Imperial College, London // // Copyright (C) 2009 Imperial College, London // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Lesser Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // To received a copy of the GNU Library General Public License // write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "qt_PlotWindow.h" PlotWindow::PlotWindow( int argc, char** argv, QWidget* parent ) : QMainWindow( parent ) { setAttribute( Qt::WA_DeleteOnClose ); QMenu * plotMenu = menuBar()->addMenu( "Plot" ); plotMenu->addAction( "Curves", this, SLOT( plotCurves() ) ); plotMenu->addAction( "Histogram", this, SLOT( plotHistogram() ) ); plotMenu->addAction( "Interactive Selection", this, SLOT( interactive() ) ); plot = new QtExtWidget( QT_DEFAULT_X, QT_DEFAULT_Y, this ); setCentralWidget( plot ); // One window = One plot widget = one stream plmkstrm( &strm ); plsdev( "extqt" ); // Get all the application arguments as argc, argv if ( argc == 0 || argv == NULL ) { plsetqtdev( plot ); } else { plsetqtdev( plot, argc, argv ); } plinit(); resize( 600, 600 ); pladv( 0 ); } PlotWindow::~PlotWindow() { PLINT cur_strm; plgstrm( &cur_strm ); plsstrm( strm ); plfreeqtdev(); // also deletes the device ("plot" variable) ! plsstrm( cur_strm ); } void PlotWindow::plotCurves() { plot->clearWidget(); PLFLT sine[360]; PLFLT cosine[360]; PLFLT indexes[360]; PLFLT square[360]; PLFLT cubic[360]; // 1st plot for ( int i = 0; i < 360; ++i ) { sine[i] = sin( (PLFLT) i / 180. * M_PI ); cosine[i] = cos( (PLFLT) i / 180. * M_PI ); indexes[i] = (PLFLT) i; } pladv( 0 ); plvpor( 0.05, 0.95, 0.05, 0.45 ); plwind( 0., 360., -1.2, 1.2 ); plcol0( 2 ); plbox( "bcnst", 0., 0, "bcnst", 0., 0 ); plcol0( 1 ); plwidth( 2 ); plline( 360, indexes, sine ); plcol0( 3 ); plwidth( 1 ); pllsty( 2 ); plline( 360, indexes, cosine ); pllsty( 1 ); plcol0( 2 ); plmtex( "t", 1., 0.5, 0.5, "Sines" ); // 2nd plot for ( int i = -180; i < 180; ++i ) { square[i + 180] = ( ( (PLFLT) i ) / 180. * ( (PLFLT) i ) / 180. ); cubic[i + 180] = square[i + 180] * ( (PLFLT) i ) / 180.; indexes[i + 180] = ( (PLFLT) i ) / 180.; } plvpor( 0.05, 0.95, 0.55, 0.95 ); plwind( -1., 1., -1., 1. ); plcol0( 2 ); plbox( "bcnst", 0., 0, "bcnst", 0., 0 ); plcol0( 1 ); plwidth( 2 ); plline( 360, indexes, square ); plcol0( 3 ); plwidth( 1 ); pllsty( 2 ); plline( 360, indexes, cubic ); pllsty( 1 ); plcol0( 2 ); plmtex( "t", 1., 0.5, 0.5, "Square & Cubic" ); } void plfbox( PLFLT x0, PLFLT y0 ) { PLFLT x[4], y[4]; x[0] = x0; y[0] = 0.; x[1] = x0; y[1] = y0; x[2] = x0 + 1.; y[2] = y0; x[3] = x0 + 1.; y[3] = 0.; plfill( 4, x, y ); plcol0( 1 ); pllsty( 1 ); plline( 4, x, y ); } void PlotWindow::plotHistogram() { PLFLT y0[10]; int i; static PLFLT pos[] = { 0.0, 0.25, 0.5, 0.75, 1.0 }; static PLFLT red[] = { 0.0, 0.25, 0.5, 1.0, 1.0 }; static PLFLT green[] = { 1.0, 0.5, 0.5, 0.5, 1.0 }; static PLFLT blue[] = { 1.0, 1.0, 0.5, 0.25, 0.0 }; char string[20]; plot->clearWidget(); pladv( 0 ); plvsta(); plcol0( 2 ); plwind( 1980.0, 1990.0, 0.0, 35.0 ); plbox( "bc", 1.0, 0, "bcnv", 10.0, 0 ); plcol0( 2 ); pllab( "Year", "Widget Sales (millions)", "#frPLplot Example 12" ); y0[0] = 5; y0[1] = 15; y0[2] = 12; y0[3] = 24; y0[4] = 28; y0[5] = 30; y0[6] = 20; y0[7] = 8; y0[8] = 12; y0[9] = 3; plscmap1l( 1, 5, pos, red, green, blue, NULL ); for ( i = 0; i < 10; i++ ) { //plcol0(i + 1); plcol1( i / 9.0 ); plpsty( 0 ); plfbox( ( 1980. + i ), y0[i] ); sprintf( string, "%.0f", y0[i] ); plptex( ( 1980. + i + .5 ), ( y0[i] + 1. ), 1.0, 0.0, .5, string ); sprintf( string, "%d", 1980 + i ); plmtex( "b", 1.0, ( ( i + 1 ) * .1 - .05 ), 0.5, string ); } } void PlotWindow::interactive() { PLFLT x, y; plot->captureMousePlotCoords( &x, &y ); char buf[100]; sprintf( buf, "Selection: (%f, %f)", x, y ); QMessageBox msgBox; msgBox.setText( buf ); msgBox.exec(); } plplot-5.10.0+dfsg/examples/c++/Makefile.examples.in 644 1750 1750 606712136041114 210020ustar andrewandrew# examples/c++/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2002, 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA CXX = @CXX@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ RPATHCMD = @RPATHCMD@ @qt_gui_true@QT_MOC_EXECUTABLE = @QT_MOC_EXECUTABLE@ @qt_gui_true@qt_RPATHCMD = @qt_RPATHCMD@ @wxwidgets_true@PLPLOTWXWIDGETS_EXECUTABLES_list = \ @wxwidgets_true@ wxPLplotDemo$(EXEEXT) @qt_gui_true@qt_gui_EXECUTABLES_list = \ @qt_gui_true@ qt_example$(EXEEXT) EXECUTABLES_list = \ x01cc$(EXEEXT) \ x00$(EXEEXT) \ x01$(EXEEXT) \ x02$(EXEEXT) \ x03$(EXEEXT) \ x04$(EXEEXT) \ x05$(EXEEXT) \ x06$(EXEEXT) \ x07$(EXEEXT) \ x08$(EXEEXT) \ x09$(EXEEXT) \ x10$(EXEEXT) \ x11$(EXEEXT) \ x12$(EXEEXT) \ x13$(EXEEXT) \ x14$(EXEEXT) \ x15$(EXEEXT) \ x16$(EXEEXT) \ x17$(EXEEXT) \ x18$(EXEEXT) \ x19$(EXEEXT) \ x20$(EXEEXT) \ x21$(EXEEXT) \ x22$(EXEEXT) \ x23$(EXEEXT) \ x24$(EXEEXT) \ x25$(EXEEXT) \ x26$(EXEEXT) \ x27$(EXEEXT) \ x28$(EXEEXT) \ x29$(EXEEXT) \ x30$(EXEEXT) \ x31$(EXEEXT) \ x33$(EXEEXT) \ $(PLPLOTWXWIDGETS_EXECUTABLES_list) \ $(qt_gui_EXECUTABLES_list) all: $(EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) @wxwidgets_true@wxPLplotDemo$(EXEEXT): wxPLplotDemo.cpp @wxwidgets_true@ $(CXX) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-wxwidgets` # Note, must filter out -p options which confuse $(QT_MOC_EXECUTABLE). Such # options (e.g., -pthread) tend to appear in the static driver case. @qt_gui_true@moc_qt_PlotWindow.cpp: qt_PlotWindow.h @qt_gui_true@ $(QT_MOC_EXECUTABLE) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags-only-I plplot$(LIB_TAG)-qt` $< -o $@ @qt_gui_true@qt_example$(EXEEXT): qt_example.cpp qt_PlotWindow.cpp moc_qt_PlotWindow.cpp @qt_gui_true@ $(CXX) qt_example.cpp qt_PlotWindow.cpp moc_qt_PlotWindow.cpp -o $@ $(qt_RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-qt` `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot${LIB_TAG}` .cc$(EXEEXT): $(CXX) $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-c++` .SUFFIXES: .cc $(EXEEXT) plplot-5.10.0+dfsg/examples/c++/x23.cc 644 1750 1750 3125211571511407 160660ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x23.cc 11760 2011-06-01 19:29:11Z airwin $ // Displays Greek letters and mathematically interesting Unicode ranges //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2005,2008 Alan Irwin // Copyright (C) 2005,2008 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 23 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x23 { public: x23( int, const char ** ); private: plstream *pls; static const char *Greek[]; static int Type1[]; static const char *title[]; static int lo[]; static int hi[]; static int nxcells[]; static int nycells[]; static int offset[]; static PLUNICODE fci[]; static const char *family[]; static const char *style[]; static const char *weight[]; }; // // Displays Greek letters and mathematically interesting Unicode ranges // const char* x23::Greek[] = { "#gA", "#gB", "#gG", "#gD", "#gE", "#gZ", "#gY", "#gH", "#gI", "#gK", "#gL", "#gM", "#gN", "#gC", "#gO", "#gP", "#gR", "#gS", "#gT", "#gU", "#gF", "#gX", "#gQ", "#gW", "#ga", "#gb", "#gg", "#gd", "#ge", "#gz", "#gy", "#gh", "#gi", "#gk", "#gl", "#gm", "#gn", "#gc", "#go", "#gp", "#gr", "#gs", "#gt", "#gu", "#gf", "#gx", "#gq", "#gw", }; int x23:: Type1[] = { 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0028, 0x0029, 0x002b, 0x002c, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x005b, 0x005d, 0x005f, 0x007b, 0x007c, 0x007d, 0x00a9, 0x00ac, 0x00ae, 0x00b0, 0x00b1, 0x00d7, 0x00f7, 0x0192, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x2022, 0x2026, 0x2032, 0x2033, 0x203e, 0x2044, 0x2111, 0x2118, 0x211c, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, 0x2215, 0x2217, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2320, 0x2321, 0x2329, 0x232a, 0x25ca, 0x2660, 0x2663, 0x2665, 0x2666, }; const char* x23::title[] = { "#<0x10>PLplot Example 23 - Greek Letters", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", "#<0x10>PLplot Example 23 - Number Forms Unicode Block", "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)", }; int x23:: lo[] = { 0x0, 0x0, 0x40, 0x80, 0x2153, 0x2190, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, }; int x23:: hi[] = { 0x30, 0x40, 0x80, 0xA6, 0x2184, 0x21d0, 0x2200, 0x2240, 0x2280, 0x22c0, 0x2300, }; int x23:: nxcells[] = { 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; int x23:: nycells[] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; // non-zero values Must be consistent with nxcells and nycells. int x23::offset[] = { 0, 0, 64, 128, 0, 0, 0, 0, 0, 0, 0, }; // 30 possible FCI values. #define FCI_COMBINATIONS 30 PLUNICODE x23:: fci[] = { 0x80000000, 0x80000001, 0x80000002, 0x80000003, 0x80000004, 0x80000010, 0x80000011, 0x80000012, 0x80000013, 0x80000014, 0x80000020, 0x80000021, 0x80000022, 0x80000023, 0x80000024, 0x80000100, 0x80000101, 0x80000102, 0x80000103, 0x80000104, 0x80000110, 0x80000111, 0x80000112, 0x80000113, 0x80000114, 0x80000120, 0x80000121, 0x80000122, 0x80000123, 0x80000124, }; const char* x23::family[] = { "sans-serif", "serif", "monospace", "script", "symbol", }; const char* x23::style[] = { "upright", "italic", "oblique", }; const char* x23::weight[] = { "medium", "bold", }; x23::x23( int argc, const char *argv[] ) { PLFLT xmin, xmax, ymin, ymax, ycharacter_scale, yoffset; PLFLT chardef, charht, deltax, deltay, x, y; int i, j, page, length, slice; char cmdString[20]; pls = new plstream(); pls->parseopts( &argc, argv, PL_PARSE_FULL ); pls->init(); for ( page = 0; page < 11; page++ ) { pls->adv( 0 ); // Set up viewport and window pls->vpor( 0.02, 0.98, 0.02, 0.90 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->gspa( xmin, xmax, ymin, ymax ); pls->schr( 0., 0.8 ); ycharacter_scale = ( 1.0 - 0.0 ) / ( ymax - ymin ); // Factor should be 0.5, but heuristically it turns out to be larger. pls->gchr( chardef, charht ); yoffset = 1.0 * charht * ycharacter_scale; // Draw the grid using plstream::box pls->col0( 2 ); deltax = 1.0 / ( (PLFLT) nxcells[page] ); deltay = 1.0 / ( (PLFLT) nycells[page] ); pls->box( "bcg", deltax, 0, "bcg", deltay, 0 ); pls->col0( 15 ); length = hi[page] - lo[page]; slice = 0; for ( j = nycells[page] - 1; j >= -1; j-- ) { y = ( 0.5 + j ) * deltay; for ( i = 0; i < nxcells[page]; i++ ) { x = ( 0.5 + i ) * deltax; if ( slice < length ) { if ( page == 0 ) { sprintf( cmdString, "#%s", Greek[slice] ); } else if ( ( page >= 1 ) && ( page <= 3 ) ) { sprintf( cmdString, "##[0x%.4x]", Type1[offset[page] + slice] ); } else if ( page >= 4 ) { sprintf( cmdString, "##[0x%.4x]", lo[page] + slice ); } pls->ptex( x, y + yoffset, 1., 0., 0.5, &cmdString[1] ); pls->ptex( x, y - yoffset, 1., 0., 0.5, cmdString ); } slice += 1; } } pls->schr( 0., 1.0 ); // Page title pls->mtex( "t", 1.5, 0.5, 0.5, title[page] ); } // Demonstrate methods of getting the current fonts PLUNICODE fci_old; PLINT ifamily, istyle, iweight; pls->gfci( fci_old ); pls->gfont( ifamily, istyle, iweight ); cout << "For example 23 prior to page 12 the FCI is 0x" << hex << fci_old << endl; cout << "For example 23 prior to page 12 the font family, style and weight are " << family[ifamily] << " " << style[istyle] << " " << weight[iweight] << endl; for ( page = 11; page < 16; page++ ) { PLFLT dy = 0.030; int family_index, style_index, weight_index; // Must be big enough to contain the prefix strings, the font-changing // commands, and the "The quick brown..." string. char string[200]; pls->adv( 0 ); pls->vpor( 0.02, 0.98, 0.02, 0.90 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->sfci( 0 ); if ( page == 11 ) { pls->mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with plsfci" ); } else if ( page == 12 ) { pls->mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with plsfont" ); } else if ( page == 13 ) { pls->mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with ##<0x8nnnnnnn> construct" ); } else if ( page == 14 ) { pls->mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with ##<0xmn> constructs" ); } else if ( page == 15 ) { pls->mtex( "t", 1.5, 0.5, 0.5, "#<0x10>PLplot Example 23 - " "Set Font with ## constructs" ); } pls->schr( 0., 0.75 ); for ( i = 0; i < FCI_COMBINATIONS; i++ ) { family_index = i % 5; style_index = ( i / 5 ) % 3; weight_index = ( ( i / 5 ) / 3 ) % 2; if ( page == 11 ) { pls->sfci( fci[i] ); sprintf( string, "Page 12, %s, %s, %s: " "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index] ); } else if ( page == 12 ) { pls->sfont( family_index, style_index, weight_index ); sprintf( string, "Page 13, %s, %s, %s: " "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index] ); } else if ( page == 13 ) { sprintf( string, "Page 14, %s, %s, %s: " "#<0x%x>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], fci[i] ); } else if ( page == 14 ) { sprintf( string, "Page 15, %s, %s, %s: " "#<0x%1x0>#<0x%1x1>#<0x%1x2>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family_index, style_index, weight_index ); } else if ( page == 15 ) { sprintf( string, "Page 16, %s, %s, %s: " "#<%s/>#<%s/>#<%s/>" "The quick brown fox jumps over the lazy dog", family[family_index], style[style_index], weight[weight_index], family[family_index], style[style_index], weight[weight_index] ); } pls->ptex( 0., 1. - ( i + 0.5 ) * dy, 1., 0., 0., string ); } pls->schr( 0., 1.0 ); } // Restore defaults pls->col0( 1 ); delete pls; } int main( int argc, const char **argv ) { x23 *x = new x23( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/wxPLplotDemo.cpp 644 1750 1750 2054712102122103 202300ustar andrewandrew// $Id: wxPLplotDemo.cpp 12288 2013-01-30 04:40:35Z airwin $ // // Copyright (C) 2005 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif #ifdef __WXMAC__ #include extern "C" { void CPSEnableForegroundOperation( ProcessSerialNumber* psn ); } #endif #include "wxPLplotwindow.h" #include #define MAX( a, b ) ( ( a ) < ( b ) ? ( b ) : ( a ) ) #define MIN( a, b ) ( ( a ) < ( b ) ? ( a ) : ( b ) ) // Application icon as XPM // This free icon was taken from http://2pt3.com/news/twotone-icons-for-free/ static const char *graph[] = { // columns rows colors chars-per-pixel "16 16 4 2", " c black", ". c #BA1825", "X c gray100", "UX c None", // pixels "UX. . . . . . . . . . . . . . UX", ". . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . ", ". . . . . . . . . . . X X . . . ", ". . . . . . . . . . . X X . . . ", ". . . . . . . . . . . X X . . . ", ". . . . . X X . . . . X X . . . ", ". . . . . X X . . . . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . X X X X X X X X X X . . . ", ". . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . ", "UX. . . . . . . . . . . . . . UX" }; //-------------------------------------------------------------------------- // private classes //-------------------------------------------------------------------------- class MyApp : public wxApp { public: virtual bool OnInit(); }; class MyPlotwindow : public wxPLplotwindow { public: MyPlotwindow( wxFrame* frame, wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, int pl_style = wxPLPLOT_NONE ); void OnChar( wxKeyEvent& event ); private: wxFrame* mframe; }; // Define a new frame type: this is going to be our main frame class MyFrame : public wxFrame { public: MyFrame( const wxString& title ); void Plot(); private: void OnQuit( wxCommandEvent& event ); void OnAbout( wxCommandEvent& event ); void OnBackgroundColor( wxCommandEvent& event ); private: MyPlotwindow* plotwindow; bool bgcolor; int m_backend; DECLARE_EVENT_TABLE() }; //-------------------------------------------------------------------------- // constants //-------------------------------------------------------------------------- enum { wxPLplotDemo_Quit = wxID_EXIT, wxPLplotDemo_About = wxID_ABOUT, wxPLplotDemo_BGColor = 10000 }; //-------------------------------------------------------------------------- // event tables and other macros for wxWidgets //-------------------------------------------------------------------------- BEGIN_EVENT_TABLE( MyFrame, wxFrame ) EVT_MENU( wxPLplotDemo_Quit, MyFrame::OnQuit ) EVT_MENU( wxPLplotDemo_About, MyFrame::OnAbout ) EVT_MENU( wxPLplotDemo_BGColor, MyFrame::OnBackgroundColor ) END_EVENT_TABLE() IMPLEMENT_APP( MyApp ) //-------------------------------------------------------------------------- // implementation //-------------------------------------------------------------------------- //! This method is called right at the beginning and opens a frame for us. // bool MyApp::OnInit() { #ifdef __WXMAC__ // this hack enables to have a GUI on Mac OSX even if the // program was called from the command line (and isn't a bundle) ProcessSerialNumber psn; GetCurrentProcess( &psn ); CPSEnableForegroundOperation( &psn ); SetFrontProcess( &psn ); #endif MyFrame *frame = new MyFrame( _T( "wxPLplot demo" ) ); frame->Show( true ); return true; } MyPlotwindow::MyPlotwindow( wxFrame* frame, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, int pl_style ) : wxPLplotwindow( parent, id, pos, size, style, pl_style ) { mframe = frame; } void MyPlotwindow::OnChar( wxKeyEvent& event ) { int keycode = event.GetKeyCode(); if ( keycode == WXK_RETURN || keycode == WXK_SPACE || keycode == WXK_RIGHT || keycode == WXK_ESCAPE ) mframe->Close( true ); else event.Skip(); } //! Constructor of our custom frame, where the Menu is created and a // a wxPLplotwindow is inserted into the frame. We plot some easy functions // just to show how it works. wxPLplotwindow takes care of all the setup // for the use of PLplot library. // MyFrame::MyFrame( const wxString& title ) : wxFrame( NULL, wxID_ANY, title ) { bgcolor = false; // add menu wxMenu *fileMenu = new wxMenu; fileMenu->Append( wxPLplotDemo_BGColor, _T( "&Change background color...\tAlt-C" ), _T( "Change background color" ) ); fileMenu->Append( wxPLplotDemo_About, _T( "&About...\tF1" ), _T( "Show about dialog" ) ); fileMenu->Append( wxPLplotDemo_Quit, _T( "E&xit\tAlt-X" ), _T( "Quit this program" ) ); wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append( fileMenu, _T( "&File" ) ); SetMenuBar( menuBar ); SetIcon( wxIcon( graph ) ); // add the wxPLplot wxPanel * panel = new wxPanel( this ); wxBoxSizer* box = new wxBoxSizer( wxVERTICAL ); plotwindow = new MyPlotwindow( this, panel, -1, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS, #if wxUSE_GRAPHICS_CONTEXT wxPLPLOT_BACKEND_GC | wxPLPLOT_DRAW_TEXT ); #else wxPLPLOT_BACKEND_AGG | wxPLPLOT_DRAW_TEXT ); #endif plotwindow->Connect( wxEVT_CHAR, wxKeyEventHandler( MyPlotwindow::OnChar ) ); box->Add( plotwindow, 1, wxALL | wxEXPAND, 0 ); panel->SetSizer( box ); SetSize( 640, 500 ); // set frame size SetSizeHints( 220, 150 ); // set minimum frame size wxString m_title = title; switch ( plotwindow->getBackend() ) { case wxPLPLOT_BACKEND_DC: m_title += wxT( " (basic)" ); break; case wxPLPLOT_BACKEND_GC: m_title += wxT( " (wxGC)" ); break; case wxPLPLOT_BACKEND_AGG: m_title += wxT( " (AGG)" ); break; default: break; } SetTitle( m_title ); Plot(); } void MyFrame::Plot() { wxPLplotstream* pls = plotwindow->GetStream(); const size_t np = 500; PLFLT x[np], y[np]; PLFLT xmin, xmax; PLFLT ymin = 1e30, ymax = 1e-30; xmin = -2.0; xmax = 10.0; for ( size_t i = 0; i < np; i++ ) { x[i] = ( xmax - xmin ) * i / np + xmin; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; ymin = MIN( ymin, y[i] ); ymax = MAX( ymax, y[i] ); } pls->adv( 0 ); if ( bgcolor ) { pls->scol0( 0, 255, 255, 255 ); pls->scol0( 15, 0, 0, 0 ); } else { pls->scol0( 15, 255, 255, 255 ); pls->scol0( 0, 0, 0, 0 ); } pls->col0( 1 ); pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->col0( 2 ); pls->lab( "x", "y", "sin(x)/x" ); pls->col0( 3 ); pls->width( 2 ); pls->line( np, x, y ); plotwindow->RenewPlot(); } void MyFrame::OnQuit( wxCommandEvent& WXUNUSED( event ) ) { Close( true ); } void MyFrame::OnBackgroundColor( wxCommandEvent& WXUNUSED( event ) ) { bgcolor = !bgcolor; Plot(); } //! Show information if Menu entry About was choosen. // void MyFrame::OnAbout( wxCommandEvent& WXUNUSED( event ) ) { wxMessageBox( _T( "This is the About dialog of the wxPLplot demo.\n" ), _T( "About wxPLplot" ), wxOK | wxICON_INFORMATION, this ); } plplot-5.10.0+dfsg/examples/c++/x31.cc 644 1750 1750 2256712253724162 161000ustar andrewandrew// $Id: x31.cc 12873 2013-12-17 01:27:14Z airwin $ // // set/get tester // // Copyright (C) 2008 Andrew Ross // Copyright (C) 2008 Alan Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x31 { public: x31( int, const char** ); int status; private: plstream *pls; }; //-------------------------------------------------------------------------- // main // // Demonstrates absolute positioning of graphs on a page. //-------------------------------------------------------------------------- x31::x31( int argc, const char *argv[] ) { PLFLT xmin, xmax, ymin, ymax, zxmin, zxmax, zymin, zymax; PLFLT xmid, ymid, wx, wy; PLFLT mar, aspect, jx, jy, ori; PLINT win, level2, digmax, digits, compression1, compression2; PLFLT xp0, yp0; PLINT xleng0, yleng0, xoff0, yoff0; PLFLT xp1, yp1; PLINT xleng1, yleng1, xoff1, yoff1; PLFLT xp2, yp2; PLINT xleng2, yleng2, xoff2, yoff2; PLINT fam0, num0, bmax0; PLINT fam1, num1, bmax1; PLINT fam2, num2, bmax2; PLINT r, g, b; PLFLT a; PLINT r1[] = { 0, 255 }; PLINT g1[] = { 255, 0 }; PLINT b1[] = { 0, 0 }; PLFLT a1[] = { 1.0, 1.0 }; char fnam[256]; pls = new plstream(); status = 0; // Set floating point precision for cout consistent with C printf. cout.setf( ios::fixed, ios::floatfield ); cout.setf( ios::showpoint ); cout.precision( 6 ); pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Test setting / getting familying parameters before plinit. // Save values set by plparseopts to be restored later. pls->gfam( fam0, num0, bmax0 ); fam1 = 0; num1 = 10; bmax1 = 1000; pls->sfam( fam1, num1, bmax1 ); // Retrieve the same values? pls->gfam( fam2, num2, bmax2 ); cout << "family parameters: fam, num, bmax = " << fam2 << " " << num2 << " " << bmax2 << endl; if ( fam2 != fam1 || num2 != num1 || bmax2 != bmax1 ) { cerr << "plgfam test failed" << endl; status = 1; } // Restore values set initially by plparseopts. pls->sfam( fam0, num0, bmax0 ); // Test setting / getting page parameters before plinit. // Save values set by plparseopts to be restored later. pls->gpage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); xp1 = 200.; yp1 = 200.; xleng1 = 400; yleng1 = 200; xoff1 = 10; yoff1 = 20; pls->spage( xp1, yp1, xleng1, yleng1, xoff1, yoff1 ); // Retrieve the same values? pls->gpage( xp2, yp2, xleng2, yleng2, xoff2, yoff2 ); cout << "page parameters: xp, yp, xleng, yleng, xoff, yoff = " << xp2 << " " << yp2 << " " << xleng2 << " " << yleng2 << " " << xoff2 << " " << yoff2 << endl; if ( xp2 != xp1 || yp2 != yp1 || xleng2 != xleng1 || yleng2 != yleng1 || xoff2 != xoff1 || yoff2 != yoff1 ) { cerr << "plgpage test failed" << endl; status = 1; } // Restore values set initially by plparseopts. pls->spage( xp0, yp0, xleng0, yleng0, xoff0, yoff0 ); // Test setting / getting compression parameter across plinit. compression1 = 95; pls->scompression( compression1 ); // Initialize plplot pls->init(); // Test if device initialization screwed around with the preset // compression parameter. pls->gcompression( compression2 ); cout << "Output various PLplot parameters" << endl; cout << "compression parameter = " << compression2 << endl; if ( compression2 != compression1 ) { cerr << "plgcompression test failed" << endl; status = 1; } // Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure // they work without any obvious error messages. pls->scolor( 1 ); pls->scol0( 1, 255, 0, 0 ); pls->scmap1( r1, g1, b1, 2 ); pls->scmap1a( r1, g1, b1, a1, 2 ); pls->glevel( level2 ); cout << "level parameter = " << level2 << endl; if ( level2 != 1 ) { cerr << "plglevel test failed." << endl; status = 1; } pls->adv( 0 ); pls->vpor( 0.01, 0.99, 0.02, 0.49 ); pls->gvpd( xmin, xmax, ymin, ymax ); cout << "plvpor: xmin, xmax, ymin, ymax = " << xmin << " " << xmax << " " << ymin << " " << ymax << endl; if ( xmin != 0.01 || xmax != 0.99 || ymin != 0.02 || ymax != 0.49 ) { cerr << "plgvpd test failed" << endl; status = 1; } xmid = 0.5 * ( xmin + xmax ); ymid = 0.5 * ( ymin + ymax ); pls->wind( 0.2, 0.3, 0.4, 0.5 ); pls->gvpw( xmin, xmax, ymin, ymax ); cout << "plwind: xmin, xmax, ymin, ymax = " << xmin << " " << xmax << " " << ymin << " " << ymax << endl; if ( xmin != 0.2 || xmax != 0.3 || ymin != 0.4 || ymax != 0.5 ) { cerr << "plgvpw test failed" << endl; status = 1; } // Get world coordinates for middle of viewport pls->calc_world( xmid, ymid, wx, wy, win ); cout << "world parameters: wx, wy, win = " << wx << " " << wy << " " << win << endl; if ( fabs( wx - 0.5 * ( xmin + xmax ) ) > 1.0E-5 || fabs( wy - 0.5 * ( ymin + ymax ) ) > 1.0E-5 ) { cerr << "plcalc_world test failed" << endl; status = 1; } // Retrieve and print the name of the output file (if any). // This goes to stderr not stdout since it will vary between tests and // we want stdout to be identical for compare test. pls->gfnam( fnam ); if ( fnam[0] == '\0' ) { cout << "No output file name is set" << endl; } else { cout << "Output file name read" << endl; } cerr << "Output file name is " << fnam << endl; // Set and get the number of digits used to display axis labels // Note digits is currently ignored in pls[xyz]ax and // therefore it does not make sense to test the returned // value pls->sxax( 3, 0 ); pls->gxax( digmax, digits ); cout << "x axis parameters: digmax, digits = " << digmax << " " << digits << endl; if ( digmax != 3 ) { cerr << "plgxax test failed" << endl; status = 1; } pls->syax( 4, 0 ); pls->gyax( digmax, digits ); cout << "y axis parameters: digmax, digits = " << digmax << " " << digits << endl; if ( digmax != 4 ) { cerr << "plgyax test failed" << endl; status = 1; } pls->szax( 5, 0 ); pls->gzax( digmax, digits ); cout << "z axis parameters: digmax, digits = " << digmax << " " << digits << endl; if ( digmax != 5 ) { cerr << "plgzax test failed" << endl; status = 1; } pls->sdidev( 0.05, PL_NOTSET, 0.1, 0.2 ); pls->gdidev( mar, aspect, jx, jy ); cout << "device-space window parameters: mar, aspect, jx, jy = " << mar << " " << aspect << " " << jx << " " << jy << endl; if ( mar != 0.05 || jx != 0.1 || jy != 0.2 ) { cerr << "plgdidev test failed" << endl; status = 1; } pls->sdiori( 1.0 ); pls->gdiori( ori ); cout << "ori parameter = " << ori << endl; if ( ori != 1.0 ) { cerr << "plgdiori test failed" << endl; status = 1; } pls->sdiplt( 0.1, 0.2, 0.9, 0.8 ); pls->gdiplt( xmin, ymin, xmax, ymax ); cout << "plot-space window parameters: xmin, ymin, xmax, ymax = " << xmin << " " << ymin << " " << xmax << " " << ymax << endl; if ( xmin != 0.1 || xmax != 0.9 || ymin != 0.2 || ymax != 0.8 ) { cerr << "plgdiplt test failed" << endl; status = 1; } pls->sdiplz( 0.1, 0.1, 0.9, 0.9 ); pls->gdiplt( zxmin, zymin, zxmax, zymax ); cout << "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = " << zxmin << " " << zymin << " " << zxmax << " " << zymax << endl; if ( fabs( zxmin - ( xmin + ( xmax - xmin ) * 0.1 ) ) > 1.0E-5 || fabs( zxmax - ( xmin + ( xmax - xmin ) * 0.9 ) ) > 1.0E-5 || fabs( zymin - ( ymin + ( ymax - ymin ) * 0.1 ) ) > 1.0E-5 || fabs( zymax - ( ymin + ( ymax - ymin ) * 0.9 ) ) > 1.0E-5 ) { cerr << "plsdiplz test failed" << endl; status = 1; } pls->scolbg( 10, 20, 30 ); pls->gcolbg( r, g, b ); cout << "background colour parameters: r, g, b = " << r << " " << g << " " << b << endl; if ( r != 10 || g != 20 || b != 30 ) { cerr << "plgcolbg test failed" << endl; status = 1; } pls->scolbga( 20, 30, 40, 0.5 ); pls->gcolbga( r, g, b, a ); cout << "background/transparency colour parameters: r, g, b, a = " << r << " " << g << " " << b << " " << a << endl; if ( r != 20 || g != 30 || b != 40 || a != 0.5 ) { cerr << "plgcolbga test failed" << endl; status = 1; } delete pls; } int main( int argc, const char **argv ) { int status; x31 *x = new x31( argc, argv ); status = x->status; delete x; return status; } plplot-5.10.0+dfsg/examples/c++/x17.cc 644 1750 1750 1332112251353077 160710ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x17.cc 12832 2013-12-09 14:39:59Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 17 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_HAVE_NANOSLEEP # include #endif #ifdef PL_HAVE_UNISTD_H # include #else # ifdef PL_HAVE_POLL # include # endif #endif #ifdef PL_USE_NAMESPACE using namespace std; #endif class x17 { public: x17( int, const char ** ); private: // Class data plstream *pls; public: static PLINT pl_errcode; static char errmsg[160]; }; PLINT x17::pl_errcode = 0; char x17:: errmsg[160] = ""; x17::x17( int argc, const char ** argv ) { PLINT id1, n, nsteps = 1000; bool autoy, acc; PLFLT y1, y2, y3, y4, ymin, ymax, xlab, ylab; PLFLT t, tmin, tmax, tjump, dt, noise; PLINT colbox, collab, colline[4], styline[4]; const char *legline[4]; #ifdef PL_HAVE_NANOSLEEP struct timespec ts; #endif // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // If db is used the plot is much more smooth. However, because of the // async X behaviour, one does not have a real-time scripcharter. //pls->setopt("db", ""); //pls->setopt("np", ""); // Specify some reasonable defaults for ymin and ymax // The plot will grow automatically if needed (but not shrink) ymin = -0.1; ymax = 0.1; // Specify initial tmin and tmax -- this determines length of window. // Also specify maximum jump in t // This can accomodate adaptive timesteps tmin = 0.; tmax = 10.; tjump = 0.3; // percentage of plot to jump // Axes options same as plbox. // Only automatic tick generation and label placement allowed // Eventually I'll make this fancier colbox = 1; collab = 3; styline[0] = colline[0] = 2; // pens color and line style styline[1] = colline[1] = 3; styline[2] = colline[2] = 4; styline[3] = colline[3] = 5; legline[0] = "sum"; // pens legend legline[1] = "sin"; legline[2] = "sin*noi"; legline[3] = "sin+noi"; xlab = 0.; ylab = 0.25; // legend position autoy = true; // autoscale y acc = true; // don't scrip, accumulate // Initialize PLplot. pls->init(); pls->adv( 0 ); pls->vsta(); // Register our error variables with PLplot // From here on, we're handling all errors here pls->sError( &pl_errcode, errmsg ); pls->stripc( &id1, "bcnst", "bcnstv", tmin, tmax, tjump, ymin, ymax, xlab, ylab, autoy, acc, colbox, collab, colline, styline, legline, "t", "", "Strip chart demo" ); if ( pl_errcode ) { cout << errmsg << endl; delete pls; exit( 1 ); } // Let plplot handle errors from here on pls->sError( NULL, NULL ); autoy = false; // autoscale y acc = true; // accumulate/ // This is to represent a loop over time // Let's try a random walk process y1 = y2 = y3 = y4 = 0.0; dt = 0.1; #ifdef PL_HAVE_NANOSLEEP ts.tv_sec = 0; ts.tv_nsec = 10000000; #endif for ( n = 0; n < nsteps; n++ ) { #ifdef PL_HAVE_NANOSLEEP nanosleep( &ts, NULL ); // wait a little (10 ms) to simulate time elapsing #else # ifdef PL_HAVE_POLL poll( 0, 0, 10 ); # else { int i; for ( i = 0; i < 1000000; i++ ) ; } # endif #endif t = (double) n * dt; noise = pls->randd() - 0.5; y1 = y1 + noise; y2 = sin( t * M_PI / 18. ); y3 = y2 * noise; y4 = y2 + noise / 3.; // There is no need for all pens to have the same number of // points or beeing equally time spaced. if ( n % 2 ) pls->stripa( id1, 0, t, y1 ); if ( n % 3 ) pls->stripa( id1, 1, t, y2 ); if ( n % 4 ) pls->stripa( id1, 2, t, y3 ); if ( n % 5 ) pls->stripa( id1, 3, t, y4 ); //pls->eop(); // use double buffer (-db on command line) } // Destroy strip chart and it's memory pls->stripd( id1 ); delete pls; } int main( int argc, const char ** argv ) { x17 *x = new x17( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x17.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x13.cc 644 1750 1750 757411721772043 160610ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x13.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 13 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif static const char* text[] = { "Maurice", "Geoffrey", "Alan", "Rafael", "Vince" }; static int per[] = { 10, 32, 12, 30, 16 }; class x13 { public: x13( int, const char ** ); private: // Class data plstream *pls; }; x13::x13( int argc, const char ** argv ) { int i, j, dthet, theta0, theta1, theta; PLFLT just, dx, dy; PLFLT *x = new PLFLT[ 500 ]; PLFLT *y = new PLFLT[ 500 ]; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); pls->adv( 0 ); // Ensure window has aspect ratio of one so circle is // plotted as a circle. pls->vasp( 1.0 ); pls->wind( 0., 10., 0., 10. ); //pls->env(0., 10., 0., 10., 1, -2); pls->col0( 2 ); // n.b. all theta quantities scaled by 2*pi/500 to be integers to avoid // floating point logic problems. theta0 = 0; dthet = 1; for ( i = 0; i <= 4; i++ ) { j = 0; x[j] = 5.; y[j++] = 5.; // n.b. the theta quantities multiplied by 2*pi/500 afterward so // in fact per is interpreted as a percentage. theta1 = theta0 + 5 * per[i]; if ( i == 4 ) theta1 = 500; for ( theta = theta0; theta <= theta1; theta += dthet ) { x[j] = 5 + 3 * cos( ( 2. * M_PI / 500. ) * theta ); y[j++] = 5 + 3 * sin( ( 2. * M_PI / 500. ) * theta ); } pls->col0( i + 1 ); pls->psty( ( i + 3 ) % 8 + 1 ); pls->fill( j, x, y ); pls->col0( 1 ); pls->line( j, x, y ); just = ( 2. * M_PI / 500. ) * ( theta0 + theta1 ) / 2.; dx = .25 * cos( just ); dy = .25 * sin( just ); if ( ( theta0 + theta1 ) < 250 || ( theta0 + theta1 ) > 750 ) just = 0.; else just = 1.; pls->ptex( ( x[j / 2] + dx ), ( y[j / 2] + dy ), 1.0, 0.0, just, text[i] ); theta0 = theta - dthet; } pls->font( 2 ); pls->schr( 0., 1.3 ); pls->ptex( 5.0, 9.0, 1.0, 0.0, 0.5, "Percentage of Sales" ); // pls->end(); delete[] x; delete[] y; delete pls; } int main( int argc, const char ** argv ) { x13 *x = new x13( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x13.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x01cc.cc 644 1750 1750 2551211463703002 163640ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x01cc.cc 11297 2010-11-02 03:31:14Z airwin $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 1994 Geoffrey Furnish // Copyright (C) 1995, 2000 Maurice LeBrun // Copyright (C) 2002, 2002, 2003, 2004 Alan W. Irwin // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // This example program demonstrates the use of the plstream C++ class, and // some aspects of its improvements over the klunky C API, mostly those // relating to 2-d plotting. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif //-------------------------------------------------------------------------- // In the real world, the user has his own Matrix class, so he just includes // the header for it. Here we conjure up a dopey stand in. class Matrix { int nx, ny; PLFLT *v; public: Matrix( int _nx, int _ny ) : nx( _nx ), ny( _ny ) { v = new PLFLT[nx * ny]; } ~Matrix() { delete[] v; } PLFLT & operator()( int i, int j ) { // Should do bounds checking, pass for now. return v[ j * ny + i ]; } PLFLT operator()( int i, int j ) const { // Should do bounds checking, pass for now. return v[ j * ny + i ]; } void redim( int i, int j ) { delete[] v; nx = i, ny = j; v = new PLFLT[nx * ny]; } }; //-------------------------------------------------------------------------- // To perform contouring, we have to concretize the abstract contouring // interface. Do this by deriving from Contourable_Data, and implementing // the indexing operator. class ContourableMatrix : public Contourable_Data { int nx, ny; Matrix m; int wrapy; // periodic in 2nd coord ? public: ContourableMatrix( int _nx, int _ny, int wy = 0 ) : Contourable_Data( _nx, _ny ), nx( _nx ), ny( _ny ), m( nx, ny ), wrapy( wy ) {} void elements( int& _nx, int& _ny ) const { _nx = nx; if ( wrapy ) _ny = ny + 1; else _ny = ny; } PLFLT & operator()( int i, int j ) { if ( wrapy ) j %= ny; return m( i, j ); } PLFLT operator()( int i, int j ) const { if ( wrapy ) j %= ny; return m( i, j ); } }; //-------------------------------------------------------------------------- // For general mesh plotting, we also need to concretize the abstract // coordinate interface. Do this by deriving from Coord_2d and filling in // the blanks. class CoordinateMatrix : public Coord_2d { int nx, ny; Matrix m; int wrapy; public: CoordinateMatrix( int _nx, int _ny, int wy = 0 ) : nx( _nx ), ny( _ny ), m( nx, ny ), wrapy( wy ) {} PLFLT operator()( int ix, int iy ) const { if ( wrapy ) iy %= ny; return m( ix, iy ); } PLFLT & operator()( int ix, int iy ) { if ( wrapy ) iy %= ny; return m( ix, iy ); } void elements( int& _nx, int& _ny ) { _nx = nx; if ( wrapy ) _ny = ny + 1; else _ny = ny; } void min_max( PLFLT& _min, PLFLT& _max ) { _min = _max = m( 0, 0 ); for ( int i = 0; i < nx; i++ ) for ( int j = 0; j < ny; j++ ) { if ( m( i, j ) < _min ) _min = m( i, j ); if ( m( i, j ) > _max ) _max = m( i, j ); } } }; class x01cc { public: x01cc( int, const char** ); void plot1(); void plot2(); private: plstream *pls; }; //-------------------------------------------------------------------------- // Just a simple little routine to show simple use of the plstream object. //-------------------------------------------------------------------------- void x01cc::plot1() { pls->col( Red ); pls->env( 0., 1., 0., 1., 0, 0 ); pls->col( Yellow ); pls->lab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); PLFLT x[6], y[6]; for ( int i = 0; i < 6; i++ ) { x[i] = .2 * i; y[i] = x[i] * x[i]; } pls->col( Cyan ); pls->poin( 6, x, y, 9 ); pls->col( Green ); pls->line( 6, x, y ); } //-------------------------------------------------------------------------- // Demonstration of contouring using the C++ abstract interface which does // not impose fascist requirements on storage order/format of user data as // the C and Fortran API's do. //-------------------------------------------------------------------------- void x01cc::plot2() { pls->adv( 0 ); // First declare some objects to hold the data and the coordinates. Note, // if you don't want to go to the trouble of making these derived classes so // easy to use (const and non-const indexing operators, etc), such as if you // have existing code using a Matrix class, and all you want to do now is // plot it, then you could just make these derived classes have a // constructor taking a Matrix (previously calculated somewhere else) by // reference through the constructor. That way the calculation engine can // continue to use the normal container class, and only the plotting code // needs the auxiliary class to concretize the C++ abstract contouring // interface. // Since this is a "polar" plot ( :-), see below), we need to enable the // "wrapy" option in our special purpose data and coordinate classes. Note // that this allows "reconnection" of lines, etc, with trivial effort, IFF // done from C++. For C-- and Dogtran, one would have to copy the data to a // new buffer, and pad one side with an image copy of the other side. ContourableMatrix d( 64, 64, 1 ); CoordinateMatrix xg( 64, 64, 1 ), yg( 64, 64, 1 ); int i, j; PLFLT twopi = 2. * 3.1415927; // Set up the data and coordinate matrices. for ( i = 0; i < 64; i++ ) { PLFLT r = i / 64.; for ( j = 0; j < 64; j++ ) { PLFLT theta = twopi * j / 64.; xg( i, j ) = r * cos( theta ); yg( i, j ) = r * sin( theta );; d( i, j ) = exp( -r * r ) * cos( twopi * 2 * r ) * sin( 3 * theta ); } } // Now draw a normal shaded plot. PLFLT zmin = -1., zmax = 1.; int NCONTR = 20; PLFLT shade_min, shade_max, sh_color; int sh_cmap = 1, sh_width; int min_color = 1, min_width = 0, max_color = 0, max_width = 0; pls->vpor( .1, .9, .1, .9 ); pls->wind( 0., 1., 0., twopi ); for ( i = 0; i < NCONTR; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / (PLFLT) NCONTR; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / (PLFLT) NCONTR; sh_color = i / (PLFLT) ( NCONTR - 1 ); sh_width = 2; pls->psty( 0 ); pls->shade( d, 0., 1., 0., twopi, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, true, NULL ); } pls->col( Red ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); // Now do it again, but with the coordinate transformation taken into // account. pls->adv( 0 ); cxx_pltr2 tr( xg, yg ); pls->vpas( .1, .9, .1, .9, 1. ); pls->wind( -1., 1., -1., 1. ); for ( i = 0; i < NCONTR; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / (PLFLT) NCONTR; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / (PLFLT) NCONTR; sh_color = i / (PLFLT) ( NCONTR - 1 ); sh_width = 2; pls->psty( 0 ); pls->shade( d, 0., 1., 0., twopi, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, false, &tr ); } pls->col( Red ); // Now draw the border around the drawing region. PLFLT x[65], y[65]; for ( i = 0; i < 65; i++ ) { x[i] = xg( 63, i ); y[i] = yg( 63, i ); } pls->line( 65, x, y ); // Finally, let's "squoosh" the plot, and draw it all again. PLFLT X1 = 1., X2 = .1, Y1 = 1.2, Y2 = -.2; for ( i = 0; i < 64; i++ ) { PLFLT r = i / 64.; for ( j = 0; j < 64; j++ ) { PLFLT theta = twopi * j / 64.; xg( i, j ) = X1 * r * cos( theta ) + X2 * r*r * cos( 2 * theta ); yg( i, j ) = Y1 * r * sin( theta ) + Y2 * r*r * sin( 2 * theta ); } } PLFLT xmin, xmax, ymin, ymax; xg.min_max( xmin, xmax ), yg.min_max( ymin, ymax ); pls->adv( 0 ); pls->vpas( .1, .9, .1, .9, 1. ); pls->wind( xmin, xmax, ymin, ymax ); for ( i = 0; i < NCONTR; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / (PLFLT) NCONTR; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / (PLFLT) NCONTR; sh_color = i / (PLFLT) ( NCONTR - 1 ); sh_width = 2; pls->psty( 0 ); pls->shade( d, 0., 1., 0., twopi, shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, false, &tr ); } pls->col( Red ); // Now draw the border around the drawing region. for ( i = 0; i < 65; i++ ) { x[i] = xg( 63, i ); y[i] = yg( 63, i ); } pls->line( 65, x, y ); } x01cc::x01cc( int argc, const char **argv ) { pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot. pls->init(); plot1(); plot2(); delete pls; } //-------------------------------------------------------------------------- // Finally! //-------------------------------------------------------------------------- int main( int argc, const char **argv ) { x01cc *x = new x01cc( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x01cc.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/plc++demos.h 644 1750 1750 304211463703002 172160ustar andrewandrew// $Id: plc++demos.h 11297 2010-11-02 03:31:14Z airwin $ // // All the common includes and constants needed by the C++ demo programs. // #ifndef __PLCXXDEMOS_H__ #define __PLCXXDEMOS_H__ // plplot actually includes the C versions of these 2, but // add here for completeness #include #include #include #include #include // common includes #include "plstream.h" // common defines #ifndef M_PI #define M_PI 3.1415926535897932384 #endif // various utility macros #ifndef ROUND #define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - 0.5 ) : ( ( a ) + 0.5 ) ) #endif // Declarations for save string functions #ifdef PL_HAVE_SNPRINTF // In case only _snprintf is declared (as for Visual C++ and // Borland compiler toolset) we redefine the function names #ifdef _PL_HAVE_SNPRINTF #define snprintf _snprintf #define snscanf _snscanf #endif // _PL_HAVE_SNPRINTF #else // !PL_HAVE_SNPRINTF // declare dummy functions which just call the unsafe // functions ignoring the size of the string int plsnprintf( char *buffer, int n, const char *format, ... ); int plsnscanf( const char *buffer, int n, const char *format, ... ); #define snprintf plsnprintf #define snscanf plsnscanf #endif // PL_HAVE_SNPRINTF // Add in missing isnan definition if required #if defined ( PL__HAVE_ISNAN ) # define isnan _isnan # if defined ( _MSC_VER ) # include # endif #endif #if !defined ( PL_HAVE_ISNAN ) # define isnan( x ) ( ( x ) != ( x ) ) #endif #endif // __PLCXXDEMOS_H__ plplot-5.10.0+dfsg/examples/c++/x27.cc 644 1750 1750 1644711650123230 160720ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x27.cc 11992 2011-10-20 22:54:16Z andrewross $ // Drawing "spirograph" curves - epitrochoids, cycolids, roulettes //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2007 Arjen Markus // Copyright (C) 2008 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // Implementation of PLplot example 27 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x27 { public: x27( int, const char ** ); void cycloid( void ); void spiro( PLFLT data[], int fill ); PLINT gcd( PLINT a, PLINT b ); void arcs(); private: // Class data plstream *pls; }; //-------------------------------------------------------------------------- // Generates two kinds of plots: // - construction of a cycloid (animated) // - series of epitrochoids and hypotrochoids //-------------------------------------------------------------------------- x27::x27( int argc, const char ** argv ) { // R, r, p, N // R and r should be integers to give correct termination of the // angle loop using gcd. // N.B. N is just a place holder since it is no longer used // (because we now have proper termination of the angle loop). PLFLT params[9][4] = { { 21.0, 7.0, 7.0, 3.0 }, // Deltoid { 21.0, 7.0, 10.0, 3.0 }, { 21.0, -7.0, 10.0, 3.0 }, { 20.0, 3.0, 7.0, 20.0 }, { 20.0, 3.0, 10.0, 20.0 }, { 20.0, -3.0, 10.0, 20.0 }, { 20.0, 13.0, 7.0, 20.0 }, { 20.0, 13.0, 20.0, 20.0 }, { 20.0, -13.0, 20.0, 20.0 } }; int i; int fill; // plplot initialization pls = new plstream(); // Parse and process command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->init(); // Illustrate the construction of a cycloid cycloid(); // Loop over the various curves // First an overview, then all curves one by one pls->ssub( 3, 3 ); // Three by three window fill = 0; for ( i = 0; i < 9; i++ ) { pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); spiro( ¶ms[i][0], fill ); } pls->adv( 0 ); pls->ssub( 1, 1 ); // One window per curve for ( i = 0; i < 9; i++ ) { pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); spiro( ¶ms[i][0], fill ); } // Fill the curves fill = 1; pls->adv( 0 ); pls->ssub( 1, 1 ); // One window per curve for ( i = 0; i < 9; i++ ) { pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); spiro( ¶ms[i][0], fill ); } // Finally, an example to test out plarc capabilities arcs(); delete pls; } //-------------------------------------------------------------------------- // Calculate greatest common divisor following pseudo-code for the // Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm PLINT x27::gcd( PLINT a, PLINT b ) { PLINT t; a = abs( a ); b = abs( b ); while ( b != 0 ) { t = b; b = a % b; a = t; } return a; } //-------------------------------------------------------------------------- void x27::cycloid( void ) { // TODO } //-------------------------------------------------------------------------- void x27::spiro( PLFLT params[], int fill ) { #define NPNT 2000 static PLFLT xcoord[NPNT + 1]; static PLFLT ycoord[NPNT + 1]; int windings; int steps; int i; PLFLT phi; PLFLT phiw; PLFLT dphi; PLFLT xmin = 0.0; PLFLT xmax = 0.0; PLFLT xrange_adjust; PLFLT ymin = 0.0; PLFLT ymax = 0.0; PLFLT yrange_adjust; // Fill the coordinates // Proper termination of the angle loop very near the beginning // point, see // http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = (PLINT) abs( params[1] ) / gcd( (PLINT) params[0], (PLINT) params[1] ); steps = NPNT / windings; dphi = 2.0 * M_PI / (PLFLT) steps; for ( i = 0; i <= windings * steps; i++ ) { phi = (PLFLT) i * dphi; phiw = ( params[0] - params[1] ) / params[1] * phi; xcoord[i] = ( params[0] - params[1] ) * cos( phi ) + params[2] * cos( phiw ); ycoord[i] = ( params[0] - params[1] ) * sin( phi ) - params[2] * sin( phiw ); if ( i == 0 ) { xmin = xcoord[i]; xmax = xcoord[i]; ymin = ycoord[i]; ymax = ycoord[i]; } if ( xmin > xcoord[i] ) xmin = xcoord[i]; if ( xmax < xcoord[i] ) xmax = xcoord[i]; if ( ymin > ycoord[i] ) ymin = ycoord[i]; if ( ymax < ycoord[i] ) ymax = ycoord[i]; } xrange_adjust = 0.15 * ( xmax - xmin ); xmin -= xrange_adjust; xmax += xrange_adjust; yrange_adjust = 0.15 * ( ymax - ymin ); ymin -= yrange_adjust; ymax += yrange_adjust; pls->wind( xmin, xmax, ymin, ymax ); pls->col0( 1 ); if ( fill ) { pls->fill( 1 + steps * windings, xcoord, ycoord ); } else { pls->line( 1 + steps * windings, xcoord, ycoord ); } } void x27::arcs() { #define NSEG 8 int i; PLFLT theta, dtheta; PLFLT a, b; theta = 0.0; dtheta = 360.0 / NSEG; pls->env( -10.0, 10.0, -10.0, 10.0, 1, 0 ); // Plot segments of circle in different colors for ( i = 0; i < NSEG; i++ ) { pls->col0( i % 2 + 1 ); pls->arc( 0.0, 0.0, 8.0, 8.0, theta, theta + dtheta, 0.0, 0 ); theta = theta + dtheta; } // Draw several filled ellipses inside the circle at different // angles. a = 3.0; b = a * tan( ( dtheta / 180.0 * M_PI ) / 2.0 ); theta = dtheta / 2.0; for ( i = 0; i < NSEG; i++ ) { pls->col0( 2 - i % 2 ); pls->arc( a * cos( theta / 180.0 * M_PI ), a * sin( theta / 180.0 * M_PI ), a, b, 0.0, 360.0, theta, 1 ); theta = theta + dtheta; } } int main( int argc, const char ** argv ) { x27 *x = new x27( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x27.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/qt_example.cpp 644 1750 1750 367711463703002 177720ustar andrewandrew// // // This software is provided under the LGPL in March 2009 by the // Cluster Science Centre // QSAS team, // Imperial College, London // // Copyright (C) 2009 Imperial College, London // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Lesser Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // To received a copy of the GNU Library General Public License // write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "qt_PlotWindow.h" int main( int argc, char** argv ) { int res; // Command-line options are only to be interpreted by PLplot. Thus, // make a deep copy of the arguments for PLplot use before QApplication // has a chance to alter them. int Argc = argc; char** Argv; Argv = new char*[argc]; for ( int i = 0; i < Argc; ++i ) { int len = strlen( argv[i] ) + 1; Argv[i] = new char[len]; strncpy( Argv[i], argv[i], len ); } // Limit QApplication's interpretation of argv to just the first // argument (the application name) so that all command-line // options such as the PLplot -bg command-line option (which would // generate a warning message when misinterpreted by QApplication) // are completely ignored. argc = 1; QApplication a( argc, argv ); PlotWindow * win = new PlotWindow( Argc, Argv ); a.setActiveWindow( win ); win->setVisible( true ); res = a.exec(); for ( int i = 0; i < Argc; ++i ) { delete[] Argv[i]; } delete[] Argv; return res; } plplot-5.10.0+dfsg/examples/c++/x01.cc 644 1750 1750 2414712251353077 160720ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x01.cc 12832 2013-12-09 14:39:59Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 1 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #include "plevent.h" #include #ifdef PL_HAVE_NANOSLEEP #include #endif #ifdef PL_HAVE_UNISTD_H #include #endif #ifdef PL_USE_NAMESPACE using namespace std; #endif static PLGraphicsIn gin; static int locate_mode; static int test_xor; static int fontset; static char *f_name; static const char *notes[] = { "Make sure you get it right!", "" }; // Options data structure definition. static PLOptionTable options[] = { { "locate", // Turns on test of API locate function NULL, NULL, &locate_mode, PL_OPT_BOOL, "-locate", "Turns on test of API locate function" }, { "xor", // Turns on test of xor function NULL, NULL, &test_xor, PL_OPT_BOOL, "-xor", "Turns on test of XOR" }, { "font", // For switching between font set 1 & 2 NULL, NULL, &fontset, PL_OPT_INT, "-font number", "Selects stroke font set (0 or 1, def:1)" }, { "save", // For saving in postscript NULL, NULL, &f_name, PL_OPT_STRING, "-save filename", "Save plot in color postscript `file'" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; class x01 { public: x01( int, const char ** ); void plot1( int ); void plot2(); void plot3(); private: // Class data PLFLT xscale, yscale, xoff, yoff; plstream *pls; }; x01::x01( int argc, const char ** argv ) { char ver[80]; fontset = 1; f_name = NULL; // plplot initialization // Divide page into 2x2 plots unless user overrides. pls = new plstream(); // Parse and process command line arguments. pls->MergeOpts( options, "x01c options", notes ); pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Print out version number, just for kicks. pls->gver( ver ); cout << "PLplot library version: " << ver << endl; // Initialize PLplot. pls->star( 2, 2 ); // Select the multi-stroke font. pls->fontld( 1 ); // Set up the data // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; // Do a plot plot1( 0 ); // Set up the data xscale = 1.; yscale = 0.0014; yoff = 0.0185; // Do a plot int digmax = 5; pls->syax( digmax, 0 ); plot1( 1 ); plot2(); plot3(); // Show how to save a plot: // Open a new device, make it current, copy parameters, // and replay the plot buffer if ( f_name ) // command line option '-save filename' { cout << "The current plot was saved in color Postscript under the name `" << f_name << "'" << endl; plstream *pls2; pls2 = new plstream(); // create a new one pls2->sfnam( f_name ); // file name pls2->sdev( "psc" ); // device type pls2->cpstrm( *pls, false ); // copy old stream parameters to new stream pls2->replot(); // do the save by replaying the plot buffer delete pls2; } // Let's get some user input if ( locate_mode ) { while ( 1 ) { if ( !pls->GetCursor( &gin ) ) break; if ( gin.keysym == PLK_Escape ) break; pls->text(); if ( gin.keysym < 0xFF && isprint( gin.keysym ) ) cout << "wx = " << gin.wX << ", wy = " << gin.wY << ", dx = " << gin.dX << ", dy = " << gin.dY << ", c = '" << gin.keysym << "'" << endl; else cout << "wx = " << gin.wX << ", wy = " << gin.wY << ", dx = " << gin.dX << ", dy = " << gin.dY << ", c = '" << gin.keysym << "'" << endl; // printf("wx = %f, wy = %f, dx = %f, dy = %f, c = 0x%02x\n", // gin.wX, gin.wY, gin.dX, gin.dY, gin.keysym); pls->gra(); } } // In C++ we don't call plend() to finish off // this is handled by the destructor delete pls; } void x01::plot1( int do_test ) { int i; PLFLT xmin, xmax, ymin, ymax; PLFLT *x = new PLFLT[60]; PLFLT *y = new PLFLT[60]; PLFLT *xs = new PLFLT[6]; PLFLT *ys = new PLFLT[6]; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * pow( (double) x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is 0.0 to // 6.0, and the range in Y is 0.0 to 30.0. The axes are scaled separately // (just = 0), and we just draw a labelled box (axis = 0). pls->col0( 1 ); pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->col0( 2 ); pls->lab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points. pls->col0( 4 ); pls->poin( 6, xs, ys, 9 ); // Draw the line through the data. pls->col0( 3 ); pls->line( 60, x, y ); // xor mode enable erasing a line/point/text by replotting it again // it does not work in double buffering mode, however if ( do_test && test_xor ) { #ifdef PL_HAVE_NANOLEEP bool st; struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 50000000; pls->xormod( true, &st ); // enter xor mode if ( st ) { for ( i = 0; i < 60; i++ ) { pls->poin( 1, x + i, y + i, 9 ); // draw a point nanosleep( &ts, NULL ); // wait a little pls->flush(); // force an update of the tk driver pls->poin( 1, x + i, y + i, 9 ); // erase point } pls->xormod( false, &st ); // leave xor mode } #else cout << "The -xor command line option can only be exercised if your system has nanosleep(), which does not seems to happen." << endl; #endif } delete[] x; delete[] y; delete[] xs; delete[] ys; } void x01::plot2() { int i; PLFLT *x = new PLFLT[100]; PLFLT *y = new PLFLT[100]; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled // separately (just = 0), and we draw a box with axes (axis = 1). pls->col0( 1 ); pls->env( -2.0, 10.0, -0.4, 1.2, 0, 1 ); pls->col0( 2 ); pls->lab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays. for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line. pls->col0( 3 ); pls->width( 2 ); pls->line( 100, x, y ); pls->width( 1 ); delete[] x; delete[] y; } void x01::plot3() { int i; PLINT space0 = 0; PLINT mark0 = 0; PLINT space1 = 1500; PLINT mark1 = 1500; PLFLT *x = new PLFLT[101]; PLFLT *y = new PLFLT[101]; // For the final graph we wish to override the default tick intervals, // and so do not use plenv(). pls->adv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y // range from -1.2 to 1.2. pls->vsta(); pls->wind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. pls->col0( 1 ); pls->box( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. // plstyl expects a pointer! pls->styl( 1, &mark1, &space1 ); pls->col0( 2 ); pls->box( "g", 30.0, 0, "g", 0.2, 0 ); pls->styl( 0, &mark0, &space0 ); pls->col0( 3 ); pls->lab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * M_PI / 180.0 ); } pls->col0( 4 ); pls->line( 101, x, y ); delete[] x; delete[] y; } int main( int argc, const char ** argv ) { x01 *x = new x01( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x01.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x03.cc 644 1750 1750 773711721772043 160610ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x03.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 3 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x03 { public: x03( int, const char ** ); private: // Class data plstream *pls; }; x03::x03( int argc, const char ** argv ) { int i; char text[4]; PLFLT dtr, theta, dx, dy, r, offset; PLFLT *x0 = new PLFLT[361]; PLFLT *y0 = new PLFLT[361]; PLFLT *x = new PLFLT[361]; PLFLT *y = new PLFLT[361]; dtr = M_PI / 180.0; for ( i = 0; i <= 360; i++ ) { x0[i] = cos( dtr * i ); y0[i] = sin( dtr * i ); } // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Set orientation to portrait - note not all device drivers // support this, in particular most interactive drivers do not. pls->sori( 1 ); // Initialize PLplot. pls->init(); // Set up viewport and window, but do not draw box. pls->env( -1.3, 1.3, -1.3, 1.3, 1, -2 ); // Draw circles for polar grid for ( i = 1; i <= 10; i++ ) { pls->arc( 0.0, 0.0, 0.1 * i, 0.1 * i, 0.0, 360.0, 0.0, 0 ); } pls->col0( 2 ); for ( i = 0; i <= 11; i++ ) { theta = 30.0 * i; dx = cos( dtr * theta ); dy = sin( dtr * theta ); // Draw radial spokes for polar grid. pls->join( 0.0, 0.0, dx, dy ); sprintf( text, "%d", (int) ROUND( theta ) ); // Write labels for angle. if ( theta < 9.99 ) { offset = 0.45; } else if ( theta < 99.9 ) { offset = 0.30; } else { offset = 0.15; } //Slightly off zero to avoid floating point logic flips at 90 and 270 deg. if ( dx >= -0.00001 ) pls->ptex( dx, dy, dx, dy, -offset, text ); else pls->ptex( dx, dy, -dx, -dy, 1. + offset, text ); } // Draw the graph. for ( i = 0; i <= 360; i++ ) { r = sin( dtr * ( 5 * i ) ); x[i] = x0[i] * r; y[i] = y0[i] * r; } pls->col0( 3 ); pls->line( 361, x, y ); pls->col0( 4 ); pls->mtex( "t", 2.0, 0.5, 0.5, "#frPLplot Example 3 - r(#gh)=sin 5#gh" ); // Close the plot at end. // pls->end(); delete[] x; delete[] y; delete[] x0; delete[] y0; delete pls; } int main( int argc, const char ** argv ) { x03 *x = new x03( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x03.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x28.cc 644 1750 1750 3452611540101655 160760ustar andrewandrew// $Id: x28.cc 11629 2011-03-16 09:32:29Z andrewross $ // // plmtex3, plptex3 demo. // // Copyright (C) 2007, 2008, 2009 Alan W. Irwin // Copyright (C) 2007 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x28 { public: x28( int, const char** ); private: plstream *pls; static const int XPTS; static const int YPTS; static const int NREVOLUTION; static const int NROTATION; static const int NSHEAR; }; // Choose these values to correspond to tick marks. const int x28::XPTS = 2; const int x28::YPTS = 2; const int x28::NREVOLUTION = 16; const int x28::NROTATION = 8; const int x28::NSHEAR = 8; //-------------------------------------------------------------------------- // main // // Demonstrates plotting text in 3D. //-------------------------------------------------------------------------- x28::x28( int argc, const char *argv[] ) { PLFLT *x, *y, **z, xmin = 0., xmax = 1.0, xmid = 0.5 * ( xmax + xmin ), xrange = xmax - xmin, ymin = 0., ymax = 1.0, ymid = 0.5 * ( ymax + ymin ), yrange = ymax - ymin, zmin = 0., zmax = 1.0, zmid = 0.5 * ( zmax + zmin ), zrange = zmax - zmin, ysmin = ymin + 0.1 * yrange, ysmax = ymax - 0.1 * yrange, ysrange = ysmax - ysmin, dysrot = ysrange / (PLFLT) ( NROTATION - 1 ), dysshear = ysrange / (PLFLT) ( NSHEAR - 1 ), zsmin = zmin + 0.1 * zrange, zsmax = zmax - 0.1 * zrange, zsrange = zsmax - zsmin, dzsrot = zsrange / (PLFLT) ( NROTATION - 1 ), dzsshear = zsrange / (PLFLT) ( NSHEAR - 1 ), ys, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, omega, sin_omega, cos_omega, domega; int i, j; PLFLT radius, pitch, xpos, ypos, zpos; // p1string must be exactly one character + the null termination // character. char p1string[] = "O"; const char *pstring = "The future of our civilization depends on software freedom."; pls = new plstream(); // Allocate and define the minimal x, y, and z to insure 3D box x = new PLFLT[ XPTS ]; y = new PLFLT[ YPTS ]; pls->Alloc2dGrid( &z, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { x[i] = xmin + (double) i * ( xmax - xmin ) / (double) ( XPTS - 1 ); } for ( j = 0; j < YPTS; j++ ) y[j] = ymin + (double) j * ( ymax - ymin ) / (double) ( YPTS - 1 ); for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { z[i][j] = 0.; } } // Parse and process command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); pls->init(); // Page 1: Demonstrate inclination and shear capability pattern. pls->adv( 0 ); pls->vpor( -0.15, 1.15, -0.05, 1.05 ); pls->wind( -1.2, 1.2, -0.8, 1.5 ); pls->w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls->col0( 2 ); pls->box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // z = zmin. pls->schr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.5 * yrange * sin_omega; z_inclination = 0.; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.5 * yrange * cos_omega; z_shear = 0.; pls->ptex3( xmid, ymid, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // x = xmax. pls->schr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.; y_inclination = -0.5 * yrange * cos_omega; z_inclination = 0.5 * zrange * sin_omega; x_shear = 0.; y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; pls->ptex3( xmax, ymid, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // y = ymax. pls->schr( 0., 1.0 ); for ( i = 0; i < NREVOLUTION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NREVOLUTION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_inclination = 0.5 * xrange * cos_omega; y_inclination = 0.; z_inclination = 0.5 * zrange * sin_omega; x_shear = -0.5 * xrange * sin_omega; y_shear = 0.; z_shear = 0.5 * zrange * cos_omega; pls->ptex3( xmid, ymax, zmid, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.0, " revolution" ); } // Draw minimal 3D grid to finish defining the 3D box. pls->mesh( x, y, z, XPTS, YPTS, DRAW_LINEXY ); // Page 2: Demonstrate rotation of string around its axis. pls->adv( 0 ); pls->vpor( -0.15, 1.15, -0.05, 1.05 ); pls->wind( -1.2, 1.2, -0.8, 1.5 ); pls->w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls->col0( 2 ); pls->box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. pls->schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * (PLFLT) i; pls->ptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for y = y#dmax#u" ); } // x = xmax. pls->schr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsrot * (PLFLT) i; pls->ptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for x = x#dmax#u" ); } // z = zmin. pls->schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NROTATION; i++ ) { omega = 2. * M_PI * ( (PLFLT) i / (PLFLT) NROTATION ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; z_shear = 0.5 * zrange * sin_omega; ys = ysmax - dysrot * (PLFLT) i; pls->ptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "rotation for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. pls->mesh( x, y, z, XPTS, YPTS, DRAW_LINEXY ); // Page 3: Demonstrate shear of string along its axis. // Work around xcairo and pngcairo (but not pscairo) problems for // shear vector too close to axis of string. (N.B. no workaround // would be domega = 0.) domega = 0.05; pls->adv( 0 ); pls->vpor( -0.15, 1.15, -0.05, 1.05 ); pls->wind( -1.2, 1.2, -0.8, 1.5 ); pls->w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls->col0( 2 ); pls->box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); // y = ymax. pls->schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; y_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); x_shear = 0.5 * xrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * (PLFLT) i; pls->ptex3( xmid, ymax, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for y = y#dmax#u" ); } // x = xmax. pls->schr( 0., 1.0 ); x_inclination = 0.; y_inclination = -1.; z_inclination = 0.; x_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = -0.5 * yrange * sin_omega; z_shear = 0.5 * zrange * cos_omega; zs = zsmax - dzsshear * (PLFLT) i; pls->ptex3( xmax, ymid, zs, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for x = x#dmax#u" ); } // z = zmin. pls->schr( 0., 1.0 ); x_inclination = 1.; y_inclination = 0.; z_inclination = 0.; z_shear = 0.; for ( i = 0; i < NSHEAR; i++ ) { omega = domega + 2. * M_PI * ( (PLFLT) i / (PLFLT) NSHEAR ); sin_omega = sin( omega ); cos_omega = cos( omega ); y_shear = 0.5 * yrange * cos_omega; x_shear = 0.5 * xrange * sin_omega; ys = ysmax - dysshear * (PLFLT) i; pls->ptex3( xmid, ys, zmin, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, "shear for z = z#dmin#u" ); } // Draw minimal 3D grid to finish defining the 3D box. pls->mesh( x, y, z, XPTS, YPTS, DRAW_LINEXY ); // Page 4: Demonstrate drawing a string on a 3D path. pls->adv( 0 ); pls->vpor( -0.15, 1.15, -0.05, 1.05 ); pls->wind( -1.2, 1.2, -0.8, 1.5 ); pls->w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 40., -30. ); pls->col0( 2 ); pls->box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); pls->schr( 0., 1.2 ); // domega controls the spacing between the various characters of the // string and also the maximum value of omega for the given number // of characters in *pstring. domega = 2. * M_PI / strlen( pstring ); omega = 0.; // 3D function is a helix of the given radius and pitch radius = 0.5; pitch = 1. / ( 2. * M_PI ); while ( *pstring ) { sin_omega = sin( omega ); cos_omega = cos( omega ); xpos = xmid + radius * sin_omega; ypos = ymid - radius * cos_omega; zpos = zmin + pitch * omega; // In general, the inclination is proportional to the derivative of // the position wrt theta. x_inclination = radius * cos_omega;; y_inclination = radius * sin_omega; z_inclination = pitch; // The shear vector should be perpendicular to the 3D line with Z // component maximized, but for low pitch a good approximation is // a constant vector that is parallel to the Z axis. x_shear = 0.; y_shear = 0.; z_shear = 1.; *p1string = *pstring; pls->ptex3( xpos, ypos, zpos, x_inclination, y_inclination, z_inclination, x_shear, y_shear, z_shear, 0.5, p1string ); pstring++; omega += domega; } // Draw minimal 3D grid to finish defining the 3D box. pls->mesh( x, y, z, XPTS, YPTS, DRAW_LINEXY ); // Page 5: Demonstrate plmtex3 axis labelling capability pls->adv( 0 ); pls->vpor( -0.15, 1.15, -0.05, 1.05 ); pls->wind( -1.2, 1.2, -0.8, 1.5 ); pls->w3d( 1.0, 1.0, 1.0, xmin, xmax, ymin, ymax, zmin, zmax, 20., 45. ); pls->col0( 2 ); pls->box3( "b", "", xmax - xmin, 0, "b", "", ymax - ymin, 0, "bcd", "", zmax - zmin, 0 ); pls->schr( 0., 1.0 ); pls->mtex3( "xp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); pls->mtex3( "xp", 4.5, 0.5, 0.5, "primary X-axis label" ); pls->mtex3( "xs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); pls->mtex3( "xs", -1.0, 0.5, 0.5, "secondary X-axis label" ); pls->mtex3( "yp", 3.0, 0.5, 0.5, "Arbitrarily displaced" ); pls->mtex3( "yp", 4.5, 0.5, 0.5, "primary Y-axis label" ); pls->mtex3( "ys", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); pls->mtex3( "ys", -1.0, 0.5, 0.5, "secondary Y-axis label" ); pls->mtex3( "zp", 4.5, 0.5, 0.5, "Arbitrarily displaced" ); pls->mtex3( "zp", 3.0, 0.5, 0.5, "primary Z-axis label" ); pls->mtex3( "zs", -2.5, 0.5, 0.5, "Arbitrarily displaced" ); pls->mtex3( "zs", -1.0, 0.5, 0.5, "secondary Z-axis label" ); // Draw minimal 3D grid to finish defining the 3D box. pls->mesh( x, y, z, XPTS, YPTS, DRAW_LINEXY ); // Clean up. delete[] x; delete[] y; pls->Free2dGrid( z, XPTS, YPTS ); delete pls; } int main( int argc, const char **argv ) { x28 *x = new x28( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/x20.cc 644 1750 1750 3561111721772043 160700ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x20.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 20 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #include "plevent.h" #include #ifdef PL_USE_NAMESPACE using namespace std; #endif class x20 { public: x20( int, const char ** ); void save_plot( const char * ); void gray_cmap( PLINT ); int read_img( const char *, PLFLT ***, int *, int *, int * ); int get_clip( PLFLT *, PLFLT *, PLFLT *, PLFLT * ); private: // Class data plstream *pls; static const int XDIM; static const int YDIM; static int dbg; static int nosombrero; static int nointeractive; static char *f_name; static PLOptionTable options[]; }; const int x20::XDIM = 260; const int x20::YDIM = 220; int x20:: dbg = 0; int x20:: nosombrero = 0; int x20:: nointeractive = 0; char *x20:: f_name = NULL; struct stretch_data { PLFLT xmin, xmax, ymin, ymax; PLFLT stretch; }; PLOptionTable x20::options[] = { { "dbg", // extra debugging plot NULL, NULL, &dbg, PL_OPT_BOOL, "-dbg", "Extra debugging plot" }, { "nosombrero", // Turns on test of xor function NULL, NULL, &nosombrero, PL_OPT_BOOL, "-nosombrero", "No sombrero plot" }, { "nointeractive", // Turns on test of xor function NULL, NULL, &nointeractive, PL_OPT_BOOL, "-nointeractive", "No interactive selection" }, { "save", // For saving in postscript NULL, NULL, &f_name, PL_OPT_STRING, "-save filename", "Save sombrero plot in color postscript `filename'" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; // Transformation function static void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ) { struct stretch_data *s = (struct stretch_data *) pltr_data; PLFLT x0, y0, dy; x0 = ( s->xmin + s->xmax ) * 0.5; y0 = ( s->ymin + s->ymax ) * 0.5; dy = ( s->ymax - s->ymin ) * 0.5; *tx = x0 + ( x0 - x ) * ( 1.0 - s->stretch * cos( ( y - y0 ) / dy * M_PI * 0.5 ) ); *ty = y; } x20::x20( int argc, const char ** argv ) { PLFLT *x = new PLFLT[XDIM]; PLFLT *y = new PLFLT[YDIM]; PLFLT **z, **r; PLFLT xi, yi, xe, ye; int i, j, width, height, num_col; PLFLT **img_f; PLFLT img_min; PLFLT img_max; struct stretch_data stretch; PLcGrid2 cgrid2; PLFLT xx, yy; // // Bugs in plimage(): // -at high magnifications, the left and right edge are ragged, try // ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 // // Bugs in x20c.c: // -if the window is resized after a selection is made on "lena", when // making a new selection the old one will re-appear. // // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->MergeOpts( options, "x20c options", NULL ); pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); pls->Alloc2dGrid( &z, XDIM, YDIM ); // view image border pixels if ( dbg ) { pls->env( 1., (PLFLT) XDIM, 1., (PLFLT) YDIM, 1, 1 ); // no plot box // build a one pixel square border, for diagnostics for ( i = 0; i < XDIM; i++ ) z[i][YDIM - 1] = 1.; // right for ( i = 0; i < XDIM; i++ ) z[i][0] = 1.; // left for ( i = 0; i < YDIM; i++ ) z[0][i] = 1.; // top for ( i = 0; i < YDIM; i++ ) z[XDIM - 1][i] = 1.; // botton pls->lab( "...around a blue square.", " ", "A red border should appear..." ); pls->image( z, XDIM, YDIM, 1., (PLFLT) XDIM, 1., (PLFLT) YDIM, 0., 0., 1., (PLFLT) XDIM, 1., (PLFLT) YDIM ); } // sombrero-like demo if ( !nosombrero ) { pls->Alloc2dGrid( &r, XDIM, YDIM ); pls->col0( 2 ); // draw a yellow plot box, useful for diagnostics! :( pls->env( 0., 2. * M_PI, 0, 3. * M_PI, 1, -1 ); for ( i = 0; i < XDIM; i++ ) x[i] = i * 2. * M_PI / ( XDIM - 1 ); for ( i = 0; i < YDIM; i++ ) y[i] = i * 3. * M_PI / ( YDIM - 1 ); for ( i = 0; i < XDIM; i++ ) for ( j = 0; j < YDIM; j++ ) { r[i][j] = sqrt( x[i] * x[i] + y[j] * y[j] ) + 1e-3; z[i][j] = sin( r[i][j] ) / ( r[i][j] ); } pls->lab( "No, an amplitude clipped \"sombrero\"", "", "Saturn?" ); pls->ptex( 2., 2., 3., 4., 0., "Transparent image" ); pls->image( z, XDIM, YDIM, 0., 2. * M_PI, 0, 3. * M_PI, 0.05, 1., 0., 2. * M_PI, 0, 3. * M_PI ); pls->Free2dGrid( r, XDIM, YDIM ); // save the plot if ( f_name ) save_plot( f_name ); } pls->Free2dGrid( z, XDIM, YDIM ); // read Lena image if ( read_img( "lena.pgm", &img_f, &width, &height, &num_col ) ) { if ( read_img( "../lena.pgm", &img_f, &width, &height, &num_col ) ) { cout << "No such file - aborting" << endl; delete pls; exit( 1 ); } } // set gray colormap gray_cmap( num_col ); // display Lena pls->env( 1., width, 1., height, 1, -1 ); if ( !nointeractive ) pls->lab( "Set and drag Button 1 to (re)set selection, Button 2 to finish.", " ", "Lena..." ); else pls->lab( "", " ", "Lena..." ); pls->image( img_f, width, height, 1., width, 1., height, 0., 0., 1., width, 1., height ); // selection/expansion demo if ( !nointeractive ) { xi = 200.; xe = 330.; yi = 280.; ye = 220.; if ( get_clip( &xi, &xe, &yi, &ye ) ) // get selection rectangle { delete pls; exit( 0 ); } // // I'm unable to continue, clearing the plot and advancing to the next // one, without hiting the enter key, or pressing the button... help! // // Forcing the xwin driver to leave locate mode and destroying the // xhairs (in GetCursorCmd()) solves some problems, but I still have // to press the enter key or press Button-2 to go to next plot, even // if a pladv() is not present! Using plbop() solves the problem, but // it shouldn't be needed! // // pls->bop(); // // spause(false), adv(0), spause(true), also works, // but the above question remains. // With this approach, the previous pause state is lost, // as there is no API call to get its current state. // pls->spause( false ); pls->adv( 0 ); // display selection only pls->image( img_f, width, height, 1., width, 1., height, 0., 0., xi, xe, ye, yi ); pls->spause( true ); // zoom in selection pls->env( xi, xe, ye, yi, 1, -1 ); pls->image( img_f, width, height, 1., width, 1., height, 0., 0., xi, xe, ye, yi ); } // Base the dynamic range on the image contents. pls->MinMax2dGrid( img_f, width, height, &img_max, &img_min ); // Draw a saturated version of the original image. Only use the middle 50% // of the image's full dynamic range. pls->col0( 2 ); pls->env( 0, width, 0, height, 1, -1 ); pls->lab( "", "", "Reduced dynamic range image example" ); pls->imagefr( img_f, width, height, 0., width, 0., height, 0., 0., img_min + img_max * 0.25, img_max - img_max * 0.25, NULL, NULL ); // Draw a distorted version of the original image, showing its full dynamic range. pls->env( 0, width, 0, height, 1, -1 ); pls->lab( "", "", "Distorted image example" ); stretch.xmin = 0; stretch.xmax = width; stretch.ymin = 0; stretch.ymax = height; stretch.stretch = 0.5; // In C / C++ the following would work, with plimagefr directly calling // mypltr. For compatibilty with other language bindings the same effect // can be achieved by generating the transformed grid first and then // using pltr2. // // plimagefr(img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, mypltr, (PLPointer) &stretch); pls->Alloc2dGrid( &cgrid2.xg, width + 1, height + 1 ); pls->Alloc2dGrid( &cgrid2.yg, width + 1, height + 1 ); cgrid2.nx = width + 1; cgrid2.ny = height + 1; for ( i = 0; i <= width; i++ ) { for ( j = 0; j <= height; j++ ) { mypltr( i, j, &xx, &yy, ( PLPointer ) & stretch ); cgrid2.xg[i][j] = xx; cgrid2.yg[i][j] = yy; } } pls->imagefr( img_f, width, height, 0., width, 0., height, 0., 0., img_min, img_max, pls->tr2, &cgrid2 ); pls->Free2dGrid( cgrid2.xg, width + 1, height + 1 ); pls->Free2dGrid( cgrid2.yg, width + 1, height + 1 ); pls->Free2dGrid( img_f, width, height ); delete pls; delete[] y; delete[] x; } // read image from file in binary ppm format int x20::read_img( const char *fname, PLFLT ***img_f, int *width, int *height, int *num_col ) { ifstream ifs( fname, ios::out | ios::binary ); unsigned char *img; char ver[80]; char c; int i, j, w, h; PLFLT **imf; // naive grayscale binary ppm reading. If you know how to, improve it if ( !ifs.is_open() ) return 1; ifs.getline( ver, 80 ); //cout << "version: " << ver << endl; if ( strcmp( ver, "P5" ) ) // I only understand this! return 1; ifs.read( &c, 1 ); while ( c == '#' ) { ifs.getline( ver, 80 ); // comments //cout << ver << endl; ifs.read( &c, 1 ); } ifs.putback( c ); ifs >> w >> h >> *num_col; ifs.getline( ver, 80 ); //cout << "width=" << w << " height=" << h << " num_col=" << *num_col << endl; img = new unsigned char[w * h]; pls->Alloc2dGrid( &imf, w, h ); ifs.read( (char *) img, w * h ); ifs.close(); for ( i = 0; i < w; i++ ) for ( j = 0; j < h; j++ ) imf[i][j] = img[( h - 1 - j ) * w + i]; // flip image up-down delete[] img; *width = w; *height = h; *img_f = imf; return 0; } // save plot void x20::save_plot( const char *fname ) { plstream *pls2; pls2 = new plstream(); // create a new one pls2->sdev( "psc" ); // new device type. Use a known existing driver pls2->sfnam( fname ); // file name pls2->cpstrm( *pls, false ); // copy old stream parameters to new stream pls2->replot(); // do the save delete pls2; // close new device } // get selection square interactively int x20::get_clip( PLFLT *xi, PLFLT *xe, PLFLT *yi, PLFLT *ye ) { PLGraphicsIn gin; PLFLT xxi = *xi, yyi = *yi, xxe = *xe, yye = *ye, t; PLINT start = 0; bool st; pls->xormod( true, &st ); // enter xor mode to draw a selection rectangle if ( st ) // driver has xormod capability, continue { while ( 1 ) { PLFLT sx[5], sy[5]; pls->xormod( false, &st ); pls->GetCursor( &gin ); pls->xormod( true, &st ); if ( gin.button == 1 ) { xxi = gin.wX; yyi = gin.wY; if ( start ) pls->line( 5, sx, sy ); // clear previous rectangle start = 0; sx[0] = xxi; sy[0] = yyi; sx[4] = xxi; sy[4] = yyi; } if ( gin.state & 0x100 ) { xxe = gin.wX; yye = gin.wY; if ( start ) pls->line( 5, sx, sy ); // clear previous rectangle start = 1; sx[2] = xxe; sy[2] = yye; sx[1] = xxe; sy[1] = yyi; sx[3] = xxi; sy[3] = yye; pls->line( 5, sx, sy ); // draw new rectangle } if ( gin.button == 3 || gin.keysym == PLK_Return || gin.keysym == 'Q' ) { if ( start ) pls->line( 5, sx, sy ); // clear previous rectangle break; } } pls->xormod( false, &st ); // leave xor mod if ( xxe < xxi ) { t = xxi; xxi = xxe; xxe = t; } if ( yyi < yye ) { t = yyi; yyi = yye; yye = t; } *xe = xxe; *xi = xxi; *ye = yye; *yi = yyi; return ( gin.keysym == 'Q' ); } else // driver has no xormod capability, just do nothing return 0; } // set gray colormap void x20::gray_cmap( PLINT num_col ) { PLFLT r[2], g[2], b[2], pos[2]; r[0] = g[0] = b[0] = 0.0; r[1] = g[1] = b[1] = 1.0; pos[0] = 0.0; pos[1] = 1.0; pls->scmap1n( num_col ); pls->scmap1l( true, 2, pos, r, g, b, NULL ); } int main( int argc, const char ** argv ) { x20 *x = new x20( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x20.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x11.cc 644 1750 1750 1421611721772043 160660ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x11.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 11 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x11 { public: x11( int, const char** ); void cmap1_init(); private: plstream *pls; static const int XPTS; static const int YPTS; static const int LEVELS; static const int opt[]; static const PLFLT alt[]; static const PLFLT az[]; static const char *title[]; }; const int x11:: XPTS = 35; const int x11:: YPTS = 46; const int x11:: LEVELS = 10; const int x11:: opt[] = { 3, 3 }; const PLFLT x11::alt[] = { 33.0, 17.0 }; const PLFLT x11::az[] = { 24.0, 115.0 }; const char *x11::title[] = { "#frPLplot Example 11 - Alt=33, Az=24, Opt=3", "#frPLplot Example 11 - Alt=17, Az=115, Opt=3" }; void x11::cmap1_init() { PLFLT *i = new PLFLT[2]; PLFLT *h = new PLFLT[2]; PLFLT *l = new PLFLT[2]; PLFLT *s = new PLFLT[2]; bool *rev = new bool[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; rev[0] = false; // interpolate on front side of colour wheel. rev[1] = false; // interpolate on front side of colour wheel. pls->scmap1n( 256 ); pls->scmap1l( false, 2, i, h, l, s, rev ); delete[] i; delete[] h; delete[] l; delete[] s; delete[] rev; } x11::x11( int argc, const char **argv ) { int i, j, k; PLFLT *x = new PLFLT[ XPTS ]; PLFLT *y = new PLFLT[ YPTS ]; PLFLT **z; PLFLT zmin = 1E9, zmax = -1E-9; PLFLT xx, yy; int nlevel = LEVELS; PLFLT *clevel = new PLFLT[LEVELS]; PLFLT step; pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot. pls->init(); // pls->Alloc2dGrid(&z, XPTS, YPTS); pls->Alloc2dGrid( &z, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) x[i] = 3. * (PLFLT) ( i - ( XPTS / 2 ) ) / (PLFLT) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) y[j] = 3. * (PLFLT) ( j - ( YPTS / 2 ) ) / (PLFLT) ( YPTS / 2 ); for ( i = 0; i < XPTS; i++ ) { xx = x[i]; for ( j = 0; j < YPTS; j++ ) { yy = y[j]; z[i][j] = 3. * ( 1. - xx ) * ( 1. - xx ) * exp( -( xx * xx ) - ( yy + 1. ) * ( yy + 1. ) ) - 10. * ( xx / 5. - pow( (double) xx, 3. ) - pow( (double) yy, 5. ) ) * exp( -xx * xx - yy * yy ) - 1. / 3. * exp( -( xx + 1 ) * ( xx + 1 ) - ( yy * yy ) ); if ( false ) // Jungfraujoch/Interlaken { if ( z[i][j] < -1. ) z[i][j] = -1.; } if ( zmin > z[i][j] ) zmin = z[i][j]; if ( zmax < z[i][j] ) zmax = z[i][j]; } } step = ( zmax - zmin ) / ( nlevel + 1 ); for ( i = 0; i < nlevel; i++ ) clevel[i] = zmin + step + step * i; cmap1_init(); for ( k = 0; k < 2; k++ ) { for ( i = 0; i < 4; i++ ) { pls->adv( 0 ); pls->col0( 1 ); pls->vpor( 0.0, 1.0, 0.0, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.5 ); pls->w3d( 1.0, 1.0, 1.2, -3.0, 3.0, -3.0, 3.0, zmin, zmax, alt[k], az[k] ); pls->box3( "bnstu", "x axis", 0.0, 0, "bnstu", "y axis", 0.0, 0, "bcdmnstuv", "z axis", 0.0, 4 ); pls->col0( 2 ); // wireframe plot if ( i == 0 ) pls->mesh( x, y, z, XPTS, YPTS, opt[k] ); // magnitude colored wireframe plot else if ( i == 1 ) pls->mesh( x, y, z, XPTS, YPTS, opt[k] | MAG_COLOR ); // magnitude colored wireframe plot with sides else if ( i == 2 ) { pls->plot3d( x, y, z, XPTS, YPTS, opt[k] | MAG_COLOR, true ); } // magnitude colored wireframe plot with base contour else if ( i == 3 ) pls->meshc( x, y, z, XPTS, YPTS, opt[k] | MAG_COLOR | BASE_CONT, clevel, nlevel ); pls->col0( 3 ); pls->mtex( "t", 1.0, 0.5, 0.5, title[k] ); } } //pls->end(); pls->Free2dGrid( z, XPTS, YPTS ); delete[] x; delete[] y; delete[] clevel; delete pls; } // Does a series of mesh plots for a given data set, with different viewing // options in each plot. int main( int argc, const char **argv ) { x11 *x = new x11( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x11.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x10.cc 644 1750 1750 453711721772043 160520ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x10.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 10 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x10 { public: x10( int, const char** ); private: plstream *pls; }; x10::x10( int argc, const char **argv ) { pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot. pls->init(); pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls->svpa( 50.0, 150.0, 50.0, 100.0 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls->ptex( 0.5, 0.5, 1.0, 0.0, 0.5, "BOX at (50,150,50,100)" ); // pls->end(); delete pls; } int main( int argc, const char **argv ) { x10 *x = new x10( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x10.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x05.cc 644 1750 1750 505411721772043 160510ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x05.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 5 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x05 { public: x05( int, const char ** ); private: // Class data plstream *pls; static const int NPTS; }; const int x05::NPTS = 2047; x05::x05( int argc, const char ** argv ) { int i; PLFLT *data = new PLFLT[NPTS]; PLFLT delta; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); // Fill up data points. delta = 2.0 * M_PI / (PLFLT) NPTS; for ( i = 0; i < NPTS; i++ ) data[i] = sin( i * delta ); pls->col0( 1 ); pls->hist( NPTS, data, -1.1, 1.1, 44, 0 ); pls->col0( 2 ); pls->lab( "#frValue", "#frFrequency", "#frPLplot Example 5 - Probability function of Oscillator" ); //pls.plend(); delete[] data; delete pls; } int main( int argc, const char ** argv ) { x05 *x = new x05( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x05.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x21.cc 644 1750 1750 3201612143254272 160630ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x21.cc 12338 2013-05-10 20:29:46Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 21 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" // Need for some Mac OSX systems with broken header #ifdef PL_BROKEN_ISNAN_CXX extern "C" int isnan( double ); #endif #ifdef PL_USE_NAMESPACE using namespace std; #endif class x21 { public: x21( int, const char ** ); private: void create_data( PLFLT **xi, PLFLT **yi, PLFLT **zi, PLINT pts ); void free_data( PLFLT *x, PLFLT *y, PLFLT *z ); void create_grid( PLFLT **xi, PLINT px, PLFLT **yi, PLINT py ); void free_grid( PLFLT *x, PLFLT *y ); void cmap1_init(); PLFLT MIN( PLFLT x, PLFLT y ) { return ( x < y ? x : y ); }; PLFLT MAX( PLFLT x, PLFLT y ) { return ( x > y ? x : y ); }; private: // Class data plstream *pls; PLFLT xm, xM, ym, yM; // Options data structure definition. static PLINT pts; static PLINT xp; static PLINT yp; static PLINT nl; static PLINT knn_order; static PLFLT threshold; static PLFLT wmin; static PLINT randn; static PLINT rosen; static PLOptionTable options[]; }; PLINT x21:: pts = 500; PLINT x21:: xp = 25; PLINT x21:: yp = 20; PLINT x21:: nl = 16; PLINT x21:: knn_order = 20; PLFLT x21:: threshold = 1.001; PLFLT x21:: wmin = -1e3; PLINT x21:: randn = 0; PLINT x21:: rosen = 0; PLOptionTable x21::options[] = { { "npts", NULL, NULL, &pts, PL_OPT_INT, "-npts points", "Specify number of random points to generate [500]" }, { "randn", NULL, NULL, &randn, PL_OPT_BOOL, "-randn", "Normal instead of uniform sampling -- the effective \n\ \t\t\t number of points will be smaller than the specified." }, { "rosen", NULL, NULL, &rosen, PL_OPT_BOOL, "-rosen", "Generate points from the Rosenbrock function." }, { "nx", NULL, NULL, &xp, PL_OPT_INT, "-nx points", "Specify grid x dimension [25]" }, { "ny", NULL, NULL, &yp, PL_OPT_INT, "-ny points", "Specify grid y dimension [20]" }, { "nlevel", NULL, NULL, &nl, PL_OPT_INT, "-nlevel ", "Specify number of contour levels [15]" }, { "knn_order", NULL, NULL, &knn_order, PL_OPT_INT, "-knn_order order", "Specify the number of neighbors [20]" }, { "threshold", NULL, NULL, &threshold, PL_OPT_FLOAT, "-threshold float", "Specify what a thin triangle is [1. < [1.001] < 2.]" }, { NULL, // option NULL, // handler NULL, // client data NULL, // address of variable to set 0, // mode flag NULL, // short syntax NULL } // long syntax }; x21::x21( int argc, const char ** argv ) { PLFLT *x, *y, *z, *clev; PLFLT *xg, *yg, **zg; PLFLT zmin, zmax, lzm, lzM; int i, j, k; PLINT alg; const char *title[] = { "Cubic Spline Approximation", "Delaunay Linear Interpolation", "Natural Neighbors Interpolation", "KNN Inv. Distance Weighted", "3NN Linear Interpolation", "4NN Around Inv. Dist. Weighted" }; PLFLT opt[] = { 0., 0., 0., 0., 0., 0. }; xm = ym = -0.2; xM = yM = 0.6; // plplot initialization pls = new plstream(); cmap1_init(); pls->seed( 5489 ); // Parse and process command line arguments. pls->MergeOpts( options, "x21c options", NULL ); pls->parseopts( &argc, argv, PL_PARSE_FULL ); opt[2] = wmin; opt[3] = (PLFLT) knn_order; opt[4] = threshold; // Initialize PLplot. pls->init(); create_data( &x, &y, &z, pts ); // the sampled data zmin = z[0]; zmax = z[0]; for ( i = 1; i < pts; i++ ) { if ( z[i] > zmax ) zmax = z[i]; if ( z[i] < zmin ) zmin = z[i]; } create_grid( &xg, xp, &yg, yp ); // grid the data at pls->Alloc2dGrid( &zg, xp, yp ); // the output grided data clev = new PLFLT[nl]; pls->col0( 1 ); pls->env( xm, xM, ym, yM, 2, 0 ); pls->col0( 15 ); pls->lab( "X", "Y", "The original data sampling" ); for ( i = 0; i < pts; i++ ) { pls->col1( ( z[i] - zmin ) / ( zmax - zmin ) ); // The following plstring call should be the the equivalent of // plpoin( 1, &x[i], &y[i], 5 ); Use plstring because it is // not deprecated like plpoin and has much more powerful // capabilities. N.B. symbol 141 works for Hershey devices // (e.g., -dev xwin) only if plfontld( 0 ) has been called // while symbol 727 works only if plfontld( 1 ) has been // called. The latter is the default which is why we use 727 // here to represent a centred X (multiplication) symbol. // This dependence on plfontld is one of the limitations of // the Hershey escapes for PLplot, but the upside is you get // reasonable results for both Hershey and Unicode devices. pls->string( 1, &x[i], &y[i], "#(727)" ); } pls->adv( 0 ); pls->ssub( 3, 2 ); for ( k = 0; k < 2; k++ ) { pls->adv( 0 ); for ( alg = 1; alg < 7; alg++ ) { pls->griddata( x, y, z, pts, xg, xp, yg, yp, zg, alg, opt[alg - 1] ); // - CSA can generate NaNs (only interpolates?!). // - DTLI and NNI can generate NaNs for points outside the convex hull // of the data points. // - NNLI can generate NaNs if a sufficiently thick triangle is not found // // PLplot should be NaN/Inf aware, but changing it now is quite a job... // so, instead of not plotting the NaN regions, a weighted average over // the neighbors is done. // if ( alg == GRID_CSA || alg == GRID_DTLI || alg == GRID_NNLI || alg == GRID_NNI ) { int ii, jj; PLFLT dist, d; for ( i = 0; i < xp; i++ ) { for ( j = 0; j < yp; j++ ) { if ( isnan( zg[i][j] ) ) // average (IDW) over the 8 neighbors { zg[i][j] = 0.; dist = 0.; for ( ii = i - 1; ii <= i + 1 && ii < xp; ii++ ) { for ( jj = j - 1; jj <= j + 1 && jj < yp; jj++ ) { if ( ii >= 0 && jj >= 0 && !isnan( zg[ii][jj] ) ) { d = ( abs( ii - i ) + abs( jj - j ) ) == 1 ? 1. : 1.4142; zg[i][j] += zg[ii][jj] / ( d * d ); dist += d; } } } if ( dist != 0. ) zg[i][j] /= dist; else zg[i][j] = zmin; } } } } pls->MinMax2dGrid( zg, xp, yp, &lzM, &lzm ); lzm = MIN( lzm, zmin ); lzM = MAX( lzM, zmax ); lzm = lzm - 0.01; lzM = lzM + 0.01; pls->col0( 1 ); pls->adv( alg ); if ( k == 0 ) { for ( i = 0; i < nl; i++ ) clev[i] = lzm + ( lzM - lzm ) / ( nl - 1 ) * i; pls->env0( xm, xM, ym, yM, 2, 0 ); pls->col0( 15 ); pls->lab( "X", "Y", title[alg - 1] ); pls->shades( zg, xp, yp, NULL, xm, xM, ym, yM, clev, nl, 1.0, 0, 1.0, pls->fill, true, NULL, NULL ); pls->col0( 2 ); } else { for ( i = 0; i < nl; i++ ) clev[i] = lzm + ( lzM - lzm ) / ( nl - 1 ) * i; pls->vpor( 0.0, 1.0, 0.0, 0.9 ); pls->wind( -1.1, 0.75, -0.65, 1.20 ); // // For the comparition to be fair, all plots should have the // same z values, but to get the max/min of the data generated // by all algorithms would imply two passes. Keep it simple. // // plw3d(1., 1., 1., xm, xM, ym, yM, zmin, zmax, 30, -60); // pls->w3d( 1., 1., 1., xm, xM, ym, yM, lzm, lzM, 30., -40. ); pls->box3( "bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0 ); pls->col0( 15 ); pls->lab( "", "", title[alg - 1] ); pls->plot3dc( xg, yg, zg, xp, yp, DRAW_LINEXY | MAG_COLOR | BASE_CONT, clev, nl ); } } } free_data( x, y, z ); free_grid( xg, yg ); delete[] clev; pls->Free2dGrid( zg, xp, yp ); delete pls; } void x21::cmap1_init() { PLFLT i[2], h[2], l[2], s[2]; i[0] = 0.0; // left boundary i[1] = 1.0; // right boundary h[0] = 240; // blue -> green -> yellow -> h[1] = 0; // -> red l[0] = 0.6; l[1] = 0.6; s[0] = 0.8; s[1] = 0.8; pls->scmap1n( 256 ); pls->scmap1l( false, 2, i, h, l, s ); } void x21::create_grid( PLFLT **xi, PLINT px, PLFLT **yi, PLINT py ) { PLFLT *x, *y; int i; x = *xi = new PLFLT[px]; y = *yi = new PLFLT[py]; for ( i = 0; i < px; i++ ) *x++ = xm + ( xM - xm ) * i / ( px - 1. ); for ( i = 0; i < py; i++ ) *y++ = ym + ( yM - ym ) * i / ( py - 1. ); } void x21::free_grid( PLFLT *xi, PLFLT *yi ) { delete[] xi; delete[] yi; } void x21::create_data( PLFLT **xi, PLFLT **yi, PLFLT **zi, PLINT pts ) { int i; PLFLT *x, *y, *z, r; PLFLT xt, yt; *xi = x = new PLFLT[pts]; *yi = y = new PLFLT[pts]; *zi = z = new PLFLT[pts]; for ( i = 0; i < pts; i++ ) { xt = ( xM - xm ) * pls->randd(); yt = ( yM - ym ) * pls->randd(); if ( !randn ) { *x = xt + xm; *y = yt + ym; } else // std=1, meaning that many points are outside the plot range { *x = sqrt( -2. * log( xt ) ) * cos( 2. * M_PI * yt ) + xm; *y = sqrt( -2. * log( xt ) ) * sin( 2. * M_PI * yt ) + ym; } if ( !rosen ) { r = sqrt( ( *x ) * ( *x ) + ( *y ) * ( *y ) ); *z = exp( -r * r ) * cos( 2.0 * M_PI * r ); } else { *z = log( pow( (double) ( 1. - *x ), 2. ) + 100. * pow( (double) ( *y - pow( (double) *x, 2. ) ), 2. ) ); } x++; y++; z++; } } void x21::free_data( PLFLT *x, PLFLT *y, PLFLT *z ) { delete[] x; delete[] y; delete[] z; } int main( int argc, const char ** argv ) { x21 *x = new x21( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x21.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x15.cc 644 1750 1750 1554312154201301 160570ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x15.cc 12372 2013-06-06 21:44:33Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 15 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x15 { public: x15( int, const char ** ); void plot1( PLFLT * *, PLFLT, PLFLT ); void plot2( PLFLT * *, PLFLT, PLFLT ); void plot3(); private: // Class data plstream *pls; const static int XPTS; const static int YPTS; }; const int x15:: XPTS = 35; const int x15:: YPTS = 46; x15::x15( int argc, const char ** argv ) { int i, j; PLFLT xx; PLFLT yy; PLFLT **z; PLFLT zmin, zmax; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); // no need to fiddle with color maps since example uses default cmap0 // and the cmap1 fiddling that x15c.c does is completely irrelevant // (although interesting). pls->Alloc2dGrid( &z, XPTS, YPTS ); for ( i = 0; i < XPTS; i++ ) { xx = (PLFLT) ( i - ( XPTS / 2 ) ) / (PLFLT) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = ( (PLFLT) ( j - ( YPTS / 2 ) ) / (PLFLT) ( YPTS / 2 ) ) - 1.; z[i][j] = xx * xx - yy * yy + ( xx - yy ) / ( xx * xx + yy * yy + 0.1 ); } } pls->MinMax2dGrid( z, XPTS, YPTS, &zmax, &zmin ); plot1( z, zmin, zmax ); plot2( z, zmin, zmax ); plot3(); //pls->end(); // Tidy up allocated grids pls->Free2dGrid( z, XPTS, YPTS ); delete pls; } // Illustrates a single shaded region. void x15::plot1( PLFLT **z, PLFLT zmin, PLFLT zmax ) { PLFLT shade_min, shade_max, sh_color; int sh_cmap = 0; PLFLT sh_width; int min_color = 0, max_color = 0; PLFLT min_width = 0.0, max_width = 0.0; pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); // Plot using identity transform shade_min = zmin + ( zmax - zmin ) * 0.4; shade_max = zmin + ( zmax - zmin ) * 0.6; sh_color = 7; sh_width = 2.0; min_color = 9; max_color = 2; min_width = 2.0; max_width = 2.0; pls->psty( 8 ); pls->shade( z, XPTS, YPTS, NULL, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plstream::fill, true, NULL, NULL ); pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->col0( 2 ); pls->lab( "distance", "altitude", "Bogon flux" ); } // Illustrates multiple adjacent shaded regions, using different fill // patterns for each region. void x15::plot2( PLFLT **z, PLFLT zmin, PLFLT zmax ) { PLFLT shade_min, shade_max, sh_color; int sh_cmap = 0; PLFLT sh_width; int min_color = 0, max_color = 0; PLFLT min_width = 0.0, max_width = 0.0; int i; static PLINT nlin[10] = { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; static PLINT inc[10][2] = { { 450, 0 }, { -450, 0 }, { 0, 0 }, { 900, 0 }, { 300, 0 }, { 450, -450 }, { 0, 900 }, { 0, 450 }, { 450, -450 }, { 0, 900 } }; static PLINT del[10][2] = { { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 2000, 2000 }, { 4000, 4000 }, { 4000, 2000 } }; sh_width = 2.0; pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); // Plot using identity transform for ( i = 0; i < 10; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / 10.0; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / 10.0; sh_color = i + 6; pls->pat( nlin[i], inc[i], del[i] ); pls->shade( z, XPTS, YPTS, NULL, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plstream::fill, true, NULL, NULL ); } pls->col0( 1 ); pls->box( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); pls->col0( 2 ); pls->lab( "distance", "altitude", "Bogon flux" ); } // Illustrates shaded regions in 3d, using a different fill pattern for // each region. void x15::plot3() { static PLFLT xx[2][5] = { { -1.0, 1.0, 1.0, -1.0, -1.0 }, { -1.0, 1.0, 1.0, -1.0, -1.0 } }; static PLFLT yy[2][5] = { { 1.0, 1.0, 0.0, 0.0, 1.0 }, { -1.0, -1.0, 0.0, 0.0, -1.0 } }; static PLFLT zz[2][5] = { { 0.0, 0.0, 1.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0, 1.0, 0.0 } }; pls->adv( 0 ); pls->vpor( 0.1, 0.9, 0.1, 0.9 ); pls->wind( -1.0, 1.0, -1.0, 1.0 ); pls->w3d( 1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40 ); // Plot using identity transform pls->col0( 1 ); pls->box3( "bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0 ); pls->col0( 2 ); pls->lab( "", "", "3-d polygon filling" ); pls->col0( 3 ); pls->psty( 1 ); pls->line3( 5, xx[0], yy[0], zz[0] ); pls->fill3( 4, xx[0], yy[0], zz[0] ); pls->psty( 2 ); pls->line3( 5, xx[1], yy[1], zz[1] ); pls->fill3( 4, xx[1], yy[1], zz[1] ); } int main( int argc, const char ** argv ) { x15 *x = new x15( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x15.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/qt_PlotWindow.h 644 1750 1750 377311463703002 201070ustar andrewandrew// // // This software is provided under the LGPL in March 2009 by the // Cluster Science Centre // QSAS team, // Imperial College, London // // Copyright (C) 2009 Imperial College, London // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Lesser Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // To received a copy of the GNU Library General Public License // write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #ifndef QT01_PLOTWINDOW_H #define QT01_PLOTWINDOW_H #define PLD_qtwidget #include #include #include #include #include #include #include #include #include "qt.h" class PlotWindow : public QMainWindow { Q_OBJECT public: /// Constructor for the window, holding the widget parameters /// \param width Window width (independant of the plot size) /// \param height Window height /// \param saveWidth Plot actual width. Used to compute the aspect ratio on screen and the size in PS and SVG outputs \see resolution /// \param saveHeight Plot actual height. /// \param resolution Print resolution /// \param pageSize Print size /// \param orientation Print orientation /// \param parent Parent widget, if any. PlotWindow( int argc = 0, char** argv = NULL, QWidget* parent = NULL ); ~PlotWindow(); public slots: void plotCurves(); void plotHistogram(); void interactive(); protected: PLINT strm; QtExtWidget * plot; }; #endif plplot-5.10.0+dfsg/examples/c++/x22.cc 644 1750 1750 2726412251724462 161000ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x22.cc 12840 2013-12-10 23:52:18Z andrewross $ // Simple vector plot example //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 22 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif // // Global transform function for a constriction using data passed in // This is the same transformation used in constriction. // void transform( PLFLT x, PLFLT y, PLFLT *xt, PLFLT *yt, PLPointer data ) { PLFLT *trdata; PLFLT xmax; trdata = (PLFLT *) data; xmax = *trdata; *xt = x; *yt = y / 4.0 * ( 3 - cos( M_PI * x / xmax ) ); } class x22 { public: x22( int, const char ** ); private: void circulation(); void constriction( int astyle ); void constriction2(); void potential(); void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax ); PLFLT MIN( PLFLT x, PLFLT y ) { return ( x < y ? x : y ); }; PLFLT MAX( PLFLT x, PLFLT y ) { return ( x > y ? x : y ); }; plstream *pls; PLFLT **u, **v; PLcGrid2 cgrid2; int nx, ny, nc, nseg; }; // Vector plot of the circulation about the origin void x22::circulation() { int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; // Create data - cirulation around the origin. for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { x = ( i - nx / 2 + 0.5 ) * dx; y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; u[i][j] = y; v[i][j] = -x; } } // Plot vectors with default arrows pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->lab( "(x)", "(y)", "#frPLplot Example 22 - circulation" ); pls->col0( 2 ); pls->vect( u, v, nx, ny, 0.0, plstream::tr2, (void *) &cgrid2 ); pls->col0( 1 ); } // Vector plot of flow through a constricted pipe void x22::constriction( int astyle ) { int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; PLFLT Q, b, dbdx; char title[80]; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; Q = 2.0; for ( i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; b = ymax / 4.0 * ( 3.0 - cos( M_PI * x / xmax ) ); if ( fabs( y ) < b ) { dbdx = ymax / 4.0 * sin( M_PI * x / xmax ) * M_PI / xmax * y / b; u[i][j] = Q * ymax / b; v[i][j] = dbdx * u[i][j]; } else { u[i][j] = 0.0; v[i][j] = 0.0; } } } pls->env( xmin, xmax, ymin, ymax, 0, 0 ); sprintf( title, "#frPLplot Example 22 - constriction (arrow style %d)", astyle ); pls->lab( "(x)", "(y)", title ); pls->col0( 2 ); pls->vect( u, v, nx, ny, -1.0, plstream::tr2, (void *) &cgrid2 ); pls->col0( 1 ); } // // Vector plot of flow through a constricted pipe // with a coordinate transform // void x22::constriction2( void ) { int i, j; PLFLT dx, dy, x, y; PLFLT xmin, xmax, ymin, ymax; PLFLT Q, b; #define NC 11 int nc = NC; PLFLT clev[NC]; dx = 1.0; dy = 1.0; xmin = -nx / 2 * dx; xmax = nx / 2 * dx; ymin = -ny / 2 * dy; ymax = ny / 2 * dy; pls->stransform( transform, ( PLPointer ) & xmax ); Q = 2.0; for ( i = 0; i < nx; i++ ) { x = ( i - nx / 2 + 0.5 ) * dx; for ( j = 0; j < ny; j++ ) { y = ( j - ny / 2 + 0.5 ) * dy; cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; b = ymax / 4.0 * ( 3 - cos( M_PI * x / xmax ) ); u[i][j] = Q * ymax / b; v[i][j] = 0.0; } } for ( i = 0; i < nc; i++ ) { clev[i] = Q + i * Q / ( nc - 1 ); } pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->lab( "(x)", "(y)", "#frPLplot Example 22 - constriction with plstransform" ); pls->col0( 2 ); pls->shades( (const PLFLT * const *) u, nx, ny, NULL, xmin + dx / 2, xmax - dx / 2, ymin + dy / 2, ymax - dy / 2, clev, nc, 0, 1, 1.0, plstream::fill, 0, NULL, NULL ); pls->vect( (const PLFLT * const *) u, (const PLFLT * const *) v, nx, ny, -1.0, plstream::tr2, (void *) &cgrid2 ); // Plot edges using plpath (which accounts for coordinate transformation) rather than plline pls->path( nseg, xmin, ymax, xmax, ymax ); pls->path( nseg, xmin, ymin, xmax, ymin ); pls->col0( 1 ); pls->stransform( NULL, NULL ); } // Vector plot of the gradient of a shielded potential (see example 9) void x22::potential() { const int nper = 100; const int nlevel = 10; int i, j, nr, ntheta; PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; PLFLT div1, div1i, div2, div2i; PLFLT **z, r, theta, x, y, dz; PLFLT xmin, xmax, ymin, ymax, rmax, zmax, zmin; PLFLT px[nper], py[nper], clevel[nlevel]; nr = nx; ntheta = ny; // Create data to be plotted pls->Alloc2dGrid( &z, nr, ntheta ); // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. rmax = (double) nr; eps = 2.; q1 = 1.; d1 = rmax / 4.; q1i = -q1 * rmax / d1; d1i = pow( (double) rmax, 2. ) / d1; q2 = -1.; d2 = rmax / 4.; q2i = -q2 * rmax / d2; d2i = pow( (double) rmax, 2. ) / d2; for ( i = 0; i < nr; i++ ) { r = 0.5 + (double) i; for ( j = 0; j < ntheta; j++ ) { theta = 2. * M_PI / ( ntheta - 1 ) * ( 0.5 + (double) j ); x = r * cos( theta ); y = r * sin( theta ); cgrid2.xg[i][j] = x; cgrid2.yg[i][j] = y; div1 = sqrt( pow( (double) ( x - d1 ), 2. ) + pow( (double) ( y - d1 ), 2. ) + pow( (double) eps, 2. ) ); div1i = sqrt( pow( (double) ( x - d1i ), 2. ) + pow( (double) ( y - d1i ), 2. ) + pow( (double) eps, 2. ) ); div2 = sqrt( pow( (double) ( x - d2 ), 2. ) + pow( (double) ( y + d2 ), 2. ) + pow( (double) eps, 2. ) ); div2i = sqrt( pow( (double) ( x - d2i ), 2. ) + pow( (double) ( y + d2i ), 2. ) + pow( (double) eps, 2. ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; u[i][j] = -q1 * ( x - d1 ) / pow( (double) div1, 3. ) - q1i * ( x - d1i ) / pow( (double) div1i, 3.0 ) - q2 * ( x - d2 ) / pow( (double) div2, 3. ) - q2i * ( x - d2i ) / pow( (double) div2i, 3. ); v[i][j] = -q1 * ( y - d1 ) / pow( (double) div1, 3. ) - q1i * ( y - d1i ) / pow( (double) div1i, 3.0 ) - q2 * ( y + d2 ) / pow( (double) div2, 3. ) - q2i * ( y + d2i ) / pow( (double) div2i, 3. ); } } f2mnmx( cgrid2.xg, nr, ntheta, &xmin, &xmax ); f2mnmx( cgrid2.yg, nr, ntheta, &ymin, &ymax ); f2mnmx( z, nr, ntheta, &zmin, &zmax ); pls->env( xmin, xmax, ymin, ymax, 0, 0 ); pls->lab( "(x)", "(y)", "#frPLplot Example 22 - potential gradient vector plot" ); // Plot contours of the potential dz = ( zmax - zmin ) / (double) nlevel; for ( i = 0; i < nlevel; i++ ) { clevel[i] = zmin + ( (double) i + 0.5 ) * dz; } pls->col0( 3 ); pls->lsty( 2 ); pls->cont( z, nr, ntheta, 1, nr, 1, ntheta, clevel, nlevel, plstream::tr2, (void *) &cgrid2 ); pls->lsty( 1 ); pls->col0( 1 ); // Plot the vectors of the gradient of the potential pls->col0( 2 ); pls->vect( u, v, nr, ntheta, 25.0, plstream::tr2, (void *) &cgrid2 ); pls->col0( 1 ); // Plot the perimeter of the cylinder for ( i = 0; i < nper; i++ ) { theta = ( 2. * M_PI / ( nper - 1 ) ) * (double) i; px[i] = rmax * cos( theta ); py[i] = rmax * sin( theta ); } pls->line( nper, px, py ); pls->Free2dGrid( z, nr, ntheta ); } void x22::f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax ) { int i, j; *fmax = f[0][0]; *fmin = *fmax; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { *fmax = MAX( *fmax, f[i][j] ); *fmin = MIN( *fmin, f[i][j] ); } } } x22::x22( int argc, const char ** argv ) { PLINT narr; bool fill; // Set of points making a polygon to use as the arrow PLFLT arrow_x[6] = { -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 }; PLFLT arrow_y[6] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 }; PLFLT arrow2_x[6] = { -0.5, 0.3, 0.3, 0.5, 0.3, 0.3 }; PLFLT arrow2_y[6] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 }; // Create new plstream pls = new plstream(); // Parse and process command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->init(); nx = 20; ny = 20; nc = 11; nseg = 20; // Allocate arrays pls->Alloc2dGrid( &cgrid2.xg, nx, ny ); pls->Alloc2dGrid( &cgrid2.yg, nx, ny ); pls->Alloc2dGrid( &u, nx, ny ); pls->Alloc2dGrid( &v, nx, ny ); cgrid2.nx = nx; cgrid2.ny = ny; circulation(); narr = 6; fill = false; // Set arrow style using arrow_x and arrow_y then // plot using these arrows. pls->svect( arrow_x, arrow_y, narr, fill ); constriction( 1 ); // Set arrow style using arrow2_x and arrow2_y then // plot using these filled arrows. fill = true; pls->svect( arrow2_x, arrow2_y, narr, fill ); constriction( 2 ); constriction2(); // Reset arrow style to the default by passing two // NULL arrays (this are the default arguments) pls->svect( ); potential(); pls->Free2dGrid( cgrid2.xg, nx, ny ); pls->Free2dGrid( cgrid2.yg, nx, ny ); pls->Free2dGrid( u, nx, ny ); pls->Free2dGrid( v, nx, ny ); delete pls; } int main( int argc, const char ** argv ) { x22 *x = new x22( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x22.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x26.cc 644 1750 1750 2076412143241771 160770ustar andrewandrew// -*- coding: utf-8; -*- // //-------------------------------------------------------------------------- // $Id: x26.cc 12336 2013-05-10 19:01:13Z andrewross $ // Multi-lingual version of the first page of example 4. //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2006 Alan W. Irwin // Copyright (C) 2006 Andrew Ross // // Thanks to the following for providing translated strings for this example: // Valery Pipin (Russian) // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // This example designed just for devices (e.g., psttfc and the // cairo-related devices) that use the pango and fontconfig libraries. The // best choice of glyph is selected by fontconfig and automatically rendered // by pango in way that is sensitive to complex text layout (CTL) language // issues for each unicode character in this example. Of course, you must // have the appropriate TrueType fonts installed to have access to all the // required glyphs. // // Translation instructions: The strings to be translated are given by // x_label, y_label, alty_label, title_label, and line_label below. The // encoding used must be UTF-8. // // The following strings to be translated involve some scientific/mathematical // jargon which is now discussed further to help translators. // // (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . // (2) degrees is an angular measure, see // http://en.wikipedia.org/wiki/Degree_(angle) . // (3) low-pass filter is one that transmits (passes) low frequencies. // (4) pole is in the mathematical sense, see // http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" // means a particular mathematical transformation of the filter function has // a single pole, see // http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . // Furthermore, a single-pole filter must have an inverse square decline // (or -20 db/decade). Since the filter plotted here does have that // characteristic, it must by definition be a single-pole filter, see also // http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm // (5) decade represents a factor of 10, see // http://en.wikipedia.org/wiki/Decade_(log_scale) . //-------------------------------------------------------------------------- // Implementation of PLplot example 26 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif static const char *x_label[] = { "Frequency", "Частота", NULL }; static const char *y_label[] = { "Amplitude (dB)", "Амплитуда (dB)", NULL }; static const char *alty_label[] = { "Phase shift (degrees)", "Фазовый сдвиг (градусы)", NULL }; // Short rearranged versions of y_label and alty_label. static const char *legend_text[][2] = { { "Amplitude", "Phase shift" }, { "Амплитуда", "Фазовый сдвиг" } }; static const char *title_label[] = { "Single Pole Low-Pass Filter", "Однополюсный Низко-Частотный Фильтр", NULL }; static const char *line_label[] = { "-20 dB/decade", "-20 dB/десяток", NULL }; class x26 { public: x26( int, const char ** ); void plot1( int, const char*, const char*, const char*, const char**, const char*, const char* ); private: // Class data plstream *pls; }; x26::x26( int argc, const char ** argv ) { int i; // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); pls->font( 2 ); // Make log plots using two different styles. i = 0; while ( x_label[i] != NULL ) { plot1( 0, x_label[i], y_label[i], alty_label[i], legend_text[i], title_label[i], line_label[i] ); i++; } // pls->end(); delete pls; } // Log-linear plot. void x26::plot1( int type, const char *x_label, const char *y_label, const char *alty_label, const char **legend_text, const char *title_label, const char *line_label ) { int i; PLFLT *freql = new PLFLT[101]; PLFLT *ampl = new PLFLT[101]; PLFLT *phase = new PLFLT[101]; PLFLT f0, freq; PLINT nlegend = 2; PLINT opt_array[2]; PLINT text_colors[2]; PLINT line_colors[2]; PLINT line_styles[2]; PLFLT line_widths[2]; PLINT symbol_numbers[2], symbol_colors[2]; PLFLT symbol_scales[2]; const char *symbols[2]; PLFLT legend_width, legend_height; pls->adv( 0 ); // Set up data for log plot. f0 = 1.0; for ( i = 0; i <= 100; i++ ) { freql[i] = -2.0 + i / 20.0; freq = pow( 10.0, (double) freql[i] ); ampl[i] = 20.0 * log10( 1.0 / sqrt( 1.0 + pow( (double) ( freq / f0 ), 2. ) ) ); phase[i] = -( 180.0 / M_PI ) * atan( (double) ( freq / f0 ) ); } pls->vpor( 0.15, 0.85, 0.1, 0.9 ); pls->wind( -2.0, 3.0, -80.0, 0.0 ); // Try different axis and labelling styles. pls->col0( 1 ); switch ( type ) { case 0: pls->box( "bclnst", 0.0, 0, "bnstv", 0.0, 0 ); break; case 1: pls->box( "bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0 ); break; } // Plot ampl vs freq. pls->col0( 2 ); pls->line( 101, freql, ampl ); pls->col0( 2 ); pls->ptex( 1.6, -30.0, 1.0, -20.0, 0.5, line_label ); // Put labels on. pls->col0( 1 ); pls->mtex( "b", 3.2, 0.5, 0.5, x_label ); pls->mtex( "t", 2.0, 0.5, 0.5, title_label ); pls->col0( 2 ); pls->mtex( "l", 5.0, 0.5, 0.5, y_label ); // For the gridless case, put phase vs freq on same plot. if ( type == 0 ) { pls->col0( 1 ); pls->wind( -2.0, 3.0, -100.0, 0.0 ); pls->box( "", 0.0, 0, "cmstv", 30.0, 3 ); pls->col0( 3 ); pls->line( 101, freql, phase ); pls->string( 101, freql, phase, "*" ); pls->col0( 3 ); pls->mtex( "r", 5.0, 0.5, 0.5, alty_label ); } // Draw a legend // First legend entry. opt_array[0] = PL_LEGEND_LINE; text_colors[0] = 2; line_colors[0] = 2; line_styles[0] = 1; line_widths[0] = 1.0; // note from the above opt_array the first symbol (and box) indices // do not have to be specified // Second legend entry. opt_array[1] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; text_colors[1] = 3; line_colors[1] = 3; line_styles[1] = 1; line_widths[1] = 1.0; symbol_colors[1] = 3; symbol_scales[1] = 1.; symbol_numbers[1] = 4; symbols[1] = "*"; // from the above opt_arrays we can completely ignore everything // to do with boxes. pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX, 0, 0.0, 0.0, 0.10, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char * const *) legend_text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); delete[] freql; delete[] ampl; delete[] phase; } int main( int argc, const char ** argv ) { x26 *x = new x26( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x26.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x33.cc 644 1750 1750 7260412252035152 160700ustar andrewandrew// -*- coding: utf-8; -*- // // $Id: x33.cc 12851 2013-12-11 10:11:54Z andrewross $ // // Demonstrate most pllegend capability including unicode symbols. // // Copyright (C) 2010 Alan Irwin // Copyright (C) 2011 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This example designed just for devices (e.g., the cairo-related and // qt-related devices) where the best choice of glyph is automatically // selected by the related libraries (pango/cairo or Qt4) for each // unicode character depending on what system fonts are installed. Of // course, you must have the appropriate TrueType fonts installed to // have access to all the required glyphs. #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif #define COLORBAR_KINDS 4 #define COLORBAR_POSITIONS 4 #define COLORBAR_LABELS 4 #define COLORBAR_CAPS 4 class x33 { public: x33( int, const char ** ); private: // Class data plstream *pls; static const PLINT position_options[16]; static const char *special_symbols[5]; static const PLINT colorbar_option_kinds[COLORBAR_KINDS]; static const char *colorbar_option_kind_labels[COLORBAR_KINDS]; static const PLINT colorbar_position_options[COLORBAR_POSITIONS]; static const char *colorbar_position_option_labels[COLORBAR_POSITIONS]; static const PLINT colorbar_label_options[COLORBAR_LABELS]; static const char *colorbar_label_option_labels[COLORBAR_LABELS]; static const PLINT colorbar_cap_options[COLORBAR_CAPS]; static const char *colorbar_cap_option_labels[COLORBAR_CAPS]; void plcolorbar_example_page( int, int, int, PLINT, PLFLT, PLINT, PLFLT * ); void plcolorbar_example( const char *, int, PLINT, PLFLT, PLINT, PLFLT * ); PLFLT MIN( PLFLT x, PLFLT y ) { return ( x < y ? x : y ); }; PLFLT MAX( PLFLT x, PLFLT y ) { return ( x > y ? x : y ); }; }; const PLINT x33::position_options[16] = { PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_OUTSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_OUTSIDE, PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_INSIDE, PL_POSITION_RIGHT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_BOTTOM | PL_POSITION_INSIDE, PL_POSITION_LEFT | PL_POSITION_INSIDE }; // Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). const char *x33::special_symbols[5] = { "✰", "✴", "✱", "✽", "✦" }; // plcolorbar options // Colorbar type options const PLINT x33::colorbar_option_kinds[COLORBAR_KINDS] = { PL_COLORBAR_SHADE, PL_COLORBAR_SHADE | PL_COLORBAR_SHADE_LABEL, PL_COLORBAR_IMAGE, PL_COLORBAR_GRADIENT }; const char *x33::colorbar_option_kind_labels[COLORBAR_KINDS] = { "Shade colorbars", "Shade colorbars with custom labels", "Image colorbars", "Gradient colorbars" }; // Which side of the page are we positioned relative to? const PLINT x33::colorbar_position_options[COLORBAR_POSITIONS] = { PL_POSITION_LEFT, PL_POSITION_RIGHT, PL_POSITION_TOP, PL_POSITION_BOTTOM }; const char *x33::colorbar_position_option_labels[COLORBAR_POSITIONS] = { "Left", "Right", "Top", "Bottom" }; // Colorbar label positioning options const PLINT x33::colorbar_label_options[COLORBAR_LABELS] = { PL_COLORBAR_LABEL_LEFT, PL_COLORBAR_LABEL_RIGHT, PL_COLORBAR_LABEL_TOP, PL_COLORBAR_LABEL_BOTTOM }; const char *x33::colorbar_label_option_labels[COLORBAR_LABELS] = { "Label left", "Label right", "Label top", "Label bottom" }; // Colorbar cap options const PLINT x33::colorbar_cap_options[COLORBAR_CAPS] = { PL_COLORBAR_CAP_NONE, PL_COLORBAR_CAP_LOW, PL_COLORBAR_CAP_HIGH, PL_COLORBAR_CAP_LOW | PL_COLORBAR_CAP_HIGH }; const char *x33::colorbar_cap_option_labels[COLORBAR_CAPS] = { "No caps", "Low cap", "High cap", "Low and high caps" }; void x33::plcolorbar_example_page( int kind_i, int label_i, int cap_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ) { // Parameters for the colorbars on this page PLINT position_i, position, opt; PLFLT x, y, x_length, y_length; PLFLT ticks[1] = { 0.0 }; PLINT sub_ticks[1] = { 0 }; PLFLT low_cap_color, high_cap_color; PLINT vertical, ifn; PLINT n_axes = 1; const char *axis_opts[1]; PLINT n_labels = 1; PLINT label_opts[1] = { 0 }; char *label; char title[200]; PLFLT colorbar_width, colorbar_height; PLINT n_values_array[1]; PLFLT *values_array[1]; label = new char[200]; n_values_array[0] = n_values; values_array[0] = values; low_cap_color = 0.0; high_cap_color = 1.0; // Start a new page pls->adv( 0 ); // Draw one colorbar relative to each side of the page for ( position_i = 0; position_i < COLORBAR_POSITIONS; position_i++ ) { position = colorbar_position_options[position_i]; opt = colorbar_option_kinds[kind_i] | colorbar_label_options[label_i] | colorbar_cap_options[cap_i]; vertical = position & PL_POSITION_LEFT || position & PL_POSITION_RIGHT; ifn = position & PL_POSITION_LEFT || position & PL_POSITION_BOTTOM; // Set the offset position on the page if ( vertical ) { x = 0.0; y = 0.0; x_length = 0.05; y_length = 0.5; } else { x = 0.0; y = 0.0; x_length = 0.5; y_length = 0.05; } // Set appropriate labelling options. if ( ifn ) { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivn"; //axis_opts[0] = "uwtin"; } else { axis_opts[0] = "uwxvn"; //axis_opts[0] = "uwxn"; } } else { if ( cont_color == 0 || cont_width == 0. ) { axis_opts[0] = "uwtivm"; //axis_opts[0] = "uwtim"; } else { axis_opts[0] = "uwxvm"; //axis_opts[0] = "uwxm"; } } sprintf( label, "%s, %s", colorbar_position_option_labels[position_i], colorbar_label_option_labels[label_i] ); // Smaller text pls->schr( 0.0, 0.75 ); // Small ticks on the vertical axis pls->smaj( 0.0, 0.5 ); pls->smin( 0.0, 0.5 ); pls->vpor( 0.20, 0.80, 0.20, 0.80 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); // Set interesting background colour. pls->scol0a( 15, 0, 0, 0, 0.20 ); pls->colorbar( &colorbar_width, &colorbar_height, opt | PL_COLORBAR_BOUNDING_BOX | PL_COLORBAR_BACKGROUND, position, x, y, x_length, y_length, 15, 1, 1, low_cap_color, high_cap_color, cont_color, cont_width, n_labels, label_opts, (const char **) &label, n_axes, axis_opts, ticks, sub_ticks, n_values_array, (const PLFLT * const *) values_array ); // Reset text and tick sizes pls->schr( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); pls->smin( 0.0, 1.0 ); } // Draw a page title sprintf( title, "%s - %s", colorbar_option_kind_labels[kind_i], colorbar_cap_option_labels[cap_i] ); pls->vpor( 0.0, 1.0, 0.0, 1.0 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->ptex( 0.5, 0.5, 0.0, 0.0, 0.5, title ); delete [] label; } void x33::plcolorbar_example( const char *palette, int kind_i, PLINT cont_color, PLFLT cont_width, PLINT n_values, PLFLT *values ) { int label_i, cap_i; // Load the color palette pls->spal1( palette, 1 ); for ( label_i = 0; label_i < COLORBAR_LABELS; label_i++ ) { for ( cap_i = 0; cap_i < COLORBAR_CAPS; cap_i++ ) { plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ); } } } //-------------------------------------------------------------------------- // x33 // // Demonstrate most pllegend capability including unicode symbols. //-------------------------------------------------------------------------- #define MAX_NLEGEND 7 x33::x33( int argc, const char **argv ) { int i, k; PLINT opt; PLINT nlegend, nturn; PLINT opt_array[MAX_NLEGEND]; PLINT text_colors[MAX_NLEGEND]; PLINT box_colors[MAX_NLEGEND]; PLINT box_patterns[MAX_NLEGEND]; PLFLT box_scales[MAX_NLEGEND]; PLFLT box_line_widths[MAX_NLEGEND]; PLINT line_colors[MAX_NLEGEND]; PLINT line_styles[MAX_NLEGEND]; PLFLT line_widths[MAX_NLEGEND]; PLINT symbol_numbers[MAX_NLEGEND], symbol_colors[MAX_NLEGEND]; PLFLT symbol_scales[MAX_NLEGEND]; char *text[MAX_NLEGEND]; const char *symbols[MAX_NLEGEND]; PLFLT legend_width, legend_height, x, y, xstart, ystart; PLFLT max_height, text_scale; PLINT position, opt_base, nrow, ncolumn; pls = new plstream(); // Create space to contain legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) text[k] = new char[200]; // Parse and process command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->init(); // First page illustrating the 16 standard positions. pls->adv( 0 ); pls->vpor( 0.25, 0.75, 0.25, 0.75 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls->sfont( PL_FCI_SANS, -1, -1 ); pls->mtex( "t", 8.0, 0.5, 0.5, "The 16 standard legend positions with" ); pls->mtex( "t", 6.0, 0.5, 0.5, "the same (0.05) offset in x and y" ); nlegend = 1; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt_array[0] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[0] = 1; line_widths[0] = 1.0; symbol_scales[0] = 1.; symbol_numbers[0] = 4; symbols[0] = "*"; // Use monotype fonts so that all legends are the same size. pls->sfont( PL_FCI_MONO, -1, -1 ); pls->scol0a( 15, 32, 32, 32, 0.70 ); for ( k = 0; k < 16; k++ ) { position = position_options[k]; opt = opt_base; sprintf( text[0], "%2.2d", k ); text_colors[0] = 1 + ( k % 8 ); line_colors[0] = 1 + ( k % 8 ); symbol_colors[0] = 1 + ( k % 8 ); pls->legend( &legend_width, &legend_height, opt, position, 0.05, 0.05, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); } // Second page illustrating effect of nrow, ncolumn for the same legend // data.; pls->adv( 0 ); pls->vpor( 0.25, 0.75, 0.25, 0.75 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->box( "bc", 0.0, 0, "bc", 0.0, 0 ); pls->sfont( PL_FCI_SANS, -1, -1 ); pls->mtex( "t", 8.0, 0.5, 0.5, "The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR," ); pls->mtex( "t", 6.0, 0.5, 0.5, "and position for the same legend data" ); nlegend = 7; // Only specify legend data that are required according to the // value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.0; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; sprintf( text[k], "%2.2d", k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. pls->sfont( PL_FCI_MONO, -1, -1 ); pls->scol0a( 15, 32, 32, 32, 0.70 ); position = PL_POSITION_TOP | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); position = PL_POSITION_BOTTOM | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.; y = 0.1; nrow = 1; ncolumn = nlegend; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); position = PL_POSITION_LEFT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); position = PL_POSITION_RIGHT | PL_POSITION_OUTSIDE; opt = opt_base; x = 0.1; y = 0.; nrow = nlegend; ncolumn = 1; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); position = PL_POSITION_LEFT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); position = PL_POSITION_RIGHT | PL_POSITION_TOP | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 6; ncolumn = 2; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); position = PL_POSITION_BOTTOM | PL_POSITION_INSIDE; opt = opt_base | PL_LEGEND_ROW_MAJOR; x = 0.; y = 0.; nrow = 3; ncolumn = 3; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.05, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 2.0, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); // Third page demonstrating legend alignment pls->adv( 0 ); pls->vpor( 0.0, 1.0, 0.0, 0.9 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->sfont( PL_FCI_SANS, -1, -1 ); pls->mtex( "t", 2.0, 0.5, 0.5, "Demonstrate legend alignment" ); x = 0.1; y = 0.1; nturn = 4; nlegend = 0; position = PL_POSITION_TOP | PL_POSITION_LEFT | PL_POSITION_SUBPAGE; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX; opt = opt_base; for ( i = 0; i < 9; i++ ) { // Set up legend arrays with the correct size, type. if ( i <= nturn ) nlegend += 1; else nlegend -= 1; nlegend = MAX( 1, nlegend ); // nly specify legend data that are required according to the // value of opt_array for that entry. for ( k = 0; k < nlegend; k++ ) { opt_array[k] = PL_LEGEND_LINE | PL_LEGEND_SYMBOL; line_styles[k] = 1; line_widths[k] = 1.0; symbol_scales[k] = 1.; symbol_numbers[k] = 2; symbols[k] = "*"; sprintf( text[k], "%2.2d", k ); text_colors[k] = 1 + ( k % 8 ); line_colors[k] = 1 + ( k % 8 ); symbol_colors[k] = 1 + ( k % 8 ); } // Use monotype fonts so that all legends are the same size. pls->sfont( PL_FCI_MONO, -1, -1 ); pls->scol0a( 15, 32, 32, 32, 0.70 ); nrow = MIN( 3, nlegend ); ncolumn = 0; pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.025, 15, 1, 1, nrow, ncolumn, nlegend, opt_array, 1.0, 1.0, 1.5, 1., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); if ( i == nturn ) { position = PL_POSITION_TOP | PL_POSITION_RIGHT | PL_POSITION_SUBPAGE; opt = opt_base; x = 1. - x; y += legend_height; } else { x += legend_width; y += legend_height; } } // Fourth page illustrating various kinds of legends max_height = 0.; xstart = 0.0; ystart = 0.1; x = xstart; y = ystart; text_scale = 0.90; pls->adv( 0 ); pls->vpor( 0.0, 1., 0.0, 0.90 ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); //plbox("bc", 0.0, 0, "bc", 0.0, 0); pls->sfont( PL_FCI_SANS, -1, -1 ); pls->mtex( "t", 2.0, 0.5, 0.5, "Demonstrate Various Kinds of Legends" ); nlegend = 5; // Only specify legend data that are required according to the // value of opt_array for that entry. position = PL_POSITION_LEFT | PL_POSITION_TOP; opt_base = PL_LEGEND_BACKGROUND | PL_LEGEND_BOUNDING_BOX | PL_LEGEND_TEXT_LEFT; // Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array[0] = PL_LEGEND_NONE; sprintf( text[0], "%s", "None" ); text_colors[0] = 1; opt_array[1] = PL_LEGEND_COLOR_BOX; sprintf( text[1], "%s", "Box" ); text_colors[1] = 2; box_colors[1] = 2; box_patterns[1] = 0; box_scales[1] = 0.8; box_line_widths[1] = 1.0; opt_array[2] = PL_LEGEND_LINE; sprintf( text[2], "%s", "Line" ); text_colors[2] = 3; line_colors[2] = 3; line_styles[2] = 1; line_widths[2] = 1.0; opt_array[3] = PL_LEGEND_SYMBOL; sprintf( text[3], "%s", "Symbol" ); text_colors[3] = 4; symbol_colors[3] = 4; symbol_scales[3] = text_scale; symbol_numbers[3] = 4; symbols[3] = special_symbols[2]; opt_array[4] = PL_LEGEND_SYMBOL | PL_LEGEND_LINE; sprintf( text[4], "%s", "L & S" ); text_colors[4] = 5; line_colors[4] = 5; line_styles[4] = 1; line_widths[4] = 1.0; symbol_colors[4] = 5; symbol_scales[4] = text_scale; symbol_numbers[4] = 4; symbols[4] = special_symbols[2]; opt = opt_base; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, box_colors, box_patterns, box_scales, box_line_widths, line_colors, line_styles, line_widths, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); max_height = MAX( max_height, legend_height ); // Set up symbol legend entries with various symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; sprintf( text[i], "%s%s", "Symbol ", special_symbols[i] ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = 4; symbols[i] = special_symbols[i]; } opt = opt_base; x += legend_width; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, NULL, NULL, NULL, NULL, NULL, NULL, NULL, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); max_height = MAX( max_height, legend_height ); // Set up symbol legend entries with various numbers of symbols. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_SYMBOL; sprintf( text[i], "%s %d", "Symbol Number", i + 2 ); text_colors[i] = i + 1; symbol_colors[i] = i + 1; symbol_scales[i] = text_scale; symbol_numbers[i] = i + 2; symbols[i] = special_symbols[2]; } opt = opt_base; x += legend_width; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, NULL, NULL, NULL, NULL, NULL, NULL, NULL, symbol_colors, symbol_scales, symbol_numbers, (const char **) symbols ); max_height = MAX( max_height, legend_height ); // Set up box legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; sprintf( text[i], "%s %d", "Box Color", i + 1 ); text_colors[i] = i + 1; box_colors[i] = i + 1; box_patterns[i] = 0; box_scales[i] = 0.8; box_line_widths[i] = 1.0; } opt = opt_base; // Use new origin x = xstart; y += max_height; max_height = 0.; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, box_colors, box_patterns, box_scales, box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up box legend entries with various patterns. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; sprintf( text[i], "%s %d", "Box Pattern", i ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = i; box_scales[i] = 0.8; box_line_widths[i] = 1.0; } opt = opt_base; x += legend_width; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, box_colors, box_patterns, box_scales, box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up box legend entries with various box pattern line widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_COLOR_BOX; sprintf( text[i], "%s %d", "Box Line Width", i + 1 ); text_colors[i] = 2; box_colors[i] = 2; box_patterns[i] = 3; box_scales[i] = 0.8; box_line_widths[i] = i + 1.0; } opt = opt_base; x += legend_width; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, box_colors, box_patterns, box_scales, box_line_widths, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up line legend entries with various colours. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; sprintf( text[i], "%s %d", "Line Color", i + 1 ); text_colors[i] = i + 1; line_colors[i] = i + 1; line_styles[i] = 1; line_widths[i] = 1.0; } opt = opt_base; // Use new origin x = xstart; y += max_height; max_height = 0.; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up line legend entries with various styles. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; sprintf( text[i], "%s %d", "Line Style", i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = i + 1; line_widths[i] = 1.0; } opt = opt_base; x += legend_width; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Set up line legend entries with various widths. for ( i = 0; i < nlegend; i++ ) { opt_array[i] = PL_LEGEND_LINE; sprintf( text[i], "%s %d", "Line Width", i + 1 ); text_colors[i] = 2; line_colors[i] = 2; line_styles[i] = 1; line_widths[i] = i + 1.0; } opt = opt_base; x += legend_width; pls->scol0a( 15, 32, 32, 32, 0.70 ); pls->legend( &legend_width, &legend_height, opt, position, x, y, 0.1, 15, 1, 1, 0, 0, nlegend, opt_array, 1.0, text_scale, 2.0, 0., text_colors, (const char **) text, NULL, NULL, NULL, NULL, line_colors, line_styles, line_widths, NULL, NULL, NULL, NULL ); max_height = MAX( max_height, legend_height ); // Free space that contained legend text. for ( k = 0; k < MAX_NLEGEND; k++ ) delete [] text[k]; // Color bar examples PLFLT values_small[2] = { -1.0e-200, 1.0e-200 }; PLFLT values_uneven[9] = { -1.0e-200, 2.0e-200, 2.6e-200, 3.4e-200, 6.0e-200, 7.0e-200, 8.0e-200, 9.0e-200, 10.0e-200 }; PLFLT values_even[9] = { -2.0e-200, -1.0e-200, 0.0e-200, 1.0e-200, 2.0e-200, 3.0e-200, 4.0e-200, 5.0e-200, 6.0e-200 }; // Use unsaturated green background colour to contrast with black caps. pls->scolbg( 70, 185, 70 ); // Cut out the greatest and smallest bits of the color spectrum to // leave colors for the end caps. pls->scmap1_range( 0.01, 0.99 ); // We can only test image and gradient colorbars with two element arrays for ( i = 2; i < COLORBAR_KINDS; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 2, values_small ); } // Test shade colorbars with larger arrays for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2, 9, values_even ); } for ( i = 0; i < 2; i++ ) { plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0, 9, values_uneven ); } //plend(); delete pls; } int main( int argc, const char ** argv ) { x33 *x = new x33( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/x09.cc 644 1750 1750 3551211721772043 160770ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x09.cc 12176 2012-02-24 20:33:39Z andrewross $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 09 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x09 { public: x09( int, const char** ); void polar(); void potential(); private: plstream *pls; static const int XPTS; static const int YPTS; // polar plot data static const int PERIMETERPTS; static const int RPTS; static const int THETAPTS; // potential plot data static const int PPERIMETERPTS; static const int PRPTS; static const int PTHETAPTS; static const int PNLEVEL; static PLFLT clevel[]; // Transformation function // static const PLFLT tr[]; public: static const PLFLT XSPA; static const PLFLT YSPA; }; const int x09:: XPTS = 35; const int x09:: YPTS = 46; const PLFLT x09::XSPA = 2. / ( XPTS - 1 ); const PLFLT x09::YSPA = 2. / ( YPTS - 1 ); // polar plot data const int x09::PERIMETERPTS = 100; const int x09::RPTS = 40; const int x09::THETAPTS = 40; // potential plot data const int x09::PPERIMETERPTS = 100; const int x09::PRPTS = 40; const int x09::PTHETAPTS = 64; const int x09::PNLEVEL = 20; PLFLT x09:: clevel[] = { -1., -.8, -.6, -.4, -.2, 0, .2, .4, .6, .8, 1. }; // Transformation function //const PLFLT x09::tr[] = {XSPA, 0.0, -1.0, 0.0, YSPA, -1.0}; static const PLFLT tr[] = { x09::XSPA, 0.0, -1.0, 0.0, x09::YSPA, -1.0 }; static void mypltr( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void * /* pltr_data */ ) { *tx = tr[0] * x + tr[1] * y + tr[2]; *ty = tr[3] * x + tr[4] * y + tr[5]; } // Does a large series of unlabelled and labelled contour plots. x09::x09( int argc, const char **argv ) { int i, j; PLFLT *xg1 = new PLFLT[XPTS]; PLFLT *yg1 = new PLFLT[YPTS]; PLcGrid cgrid1; PLcGrid2 cgrid2; PLFLT **z; PLFLT **w; PLFLT xx, yy, argx, argy, distort; static PLINT mark = 1500; static PLINT space = 1500; pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->init(); pls->Alloc2dGrid( &z, XPTS, YPTS ); pls->Alloc2dGrid( &w, XPTS, YPTS ); // Set up function arrays for ( i = 0; i < XPTS; i++ ) { xx = (PLFLT) ( i - ( XPTS / 2 ) ) / (PLFLT) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yy = (PLFLT) ( j - ( YPTS / 2 ) ) / (PLFLT) ( YPTS / 2 ) - 1.0; z[i][j] = xx * xx - yy * yy; w[i][j] = 2 * xx * yy; } } // Set up grids cgrid1.xg = xg1; cgrid1.yg = yg1; cgrid1.nx = XPTS; cgrid1.ny = YPTS; pls->Alloc2dGrid( &cgrid2.xg, XPTS, YPTS ); pls->Alloc2dGrid( &cgrid2.yg, XPTS, YPTS ); cgrid2.nx = XPTS; cgrid2.ny = YPTS; for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { mypltr( (PLFLT) i, (PLFLT) j, &xx, &yy, NULL ); argx = xx * M_PI / 2; argy = yy * M_PI / 2; distort = 0.4; cgrid1.xg[i] = xx + distort * cos( argx ); cgrid1.yg[j] = yy - distort * cos( argy ); cgrid2.xg[i][j] = xx + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = yy - distort * cos( argx ) * cos( argy ); } } // Plot using scaled identity transform used to create xg0 and yg0 // pls->_setcontlabelparam(0.006, 0.3, 0.1, 0); // pls->env(-1.0, 1.0, -1.0, 1.0, 0, 0); // pls->col0(2); // pls->cont( z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); // pls->styl(1, &mark, &space); // pls->col0(3); // pls->cont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); // pls->styl(0, &mark, &space); // pls->col0(1); // pls->lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pls->setcontlabelformat( 4, 3 ); pls->setcontlabelparam( 0.006, 0.3, 0.1, 1 ); pls->env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls->col0( 2 ); pls->cont( z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); pls->styl( 1, &mark, &space ); pls->col0( 3 ); pls->cont( w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, mypltr, NULL ); pls->styl( 0, &mark, &space ); pls->col0( 1 ); pls->lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); pls->setcontlabelparam( 0.006, 0.3, 0.1, 0 ); // Plot using 1d coordinate transform pls->env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls->col0( 2 ); pls->cont( z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, plstream::tr1, (void *) &cgrid1 ); pls->styl( 1, &mark, &space ); pls->col0( 3 ); pls->cont( w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, plstream::tr1, (void *) &cgrid1 ); pls->styl( 0, NULL, NULL ); pls->col0( 1 ); pls->lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // pls->_setcontlabelparam(0.006, 0.3, 0.1, 1); // pls->env(-1.0, 1.0, -1.0, 1.0, 0, 0); // pls->col0(2); // pls->cont(z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr1, (void *) &cgrid1 ); // pls->styl(2, &mark, &space); // pls->col0(3); // pls->cont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr1, (void *) &cgrid1 ); // pls->styl(0, &mark, &space); // pls->col0(1); // pls->lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pls->_setcontlabelparam(0.006, 0.3, 0.1, 0); // // Plot using 2d coordinate transform pls->env( -1.0, 1.0, -1.0, 1.0, 0, 0 ); pls->col0( 2 ); pls->cont( z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, plstream::tr2, (void *) &cgrid2 ); pls->styl( 1, &mark, &space ); pls->col0( 3 ); pls->cont( w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, plstream::tr2, (void *) &cgrid2 ); pls->styl( 0, &mark, &space ); pls->col0( 1 ); pls->lab( "X Coordinate", "Y Coordinate", "Streamlines of flow" ); // pls->_setcontlabelparam(0.006, 0.3, 0.1, 1); // pls->env(-1.0, 1.0, -1.0, 1.0, 0, 0); // pls->col0(2); // pls->cont(z, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr2, (void *) &cgrid2 ); // pls->styl(1, &mark, &space); // pls->col0(3); // pls->cont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, 11, // pltr2, (void *) &cgrid2 ); // pls->styl(1, &mark0, &space0); // pls->col0(1); // pls->lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); // pls->setcontlabelparam( 0.006, 0.3, 0.1, 0 ); polar(); // // pls->setcontlabelparam(0.006, 0.3, 0.1, 1); // polar(); // pls->setcontlabelparam( 0.006, 0.3, 0.1, 0 ); potential(); // // pls->setcontlabelparam(0.006, 0.3, 0.1, 1); // potential(); // // pls->end(); pls->Free2dGrid( cgrid2.xg, XPTS, YPTS ); pls->Free2dGrid( cgrid2.yg, XPTS, YPTS ); pls->Free2dGrid( z, XPTS, YPTS ); pls->Free2dGrid( w, XPTS, YPTS ); delete pls; delete[] yg1; delete[] xg1; } void x09::polar() // polar contour plot example. { int i, j; PLFLT *px = new PLFLT[PERIMETERPTS]; PLFLT *py = new PLFLT[PERIMETERPTS]; PLcGrid2 cgrid2; PLFLT **z; PLFLT t, r, theta; PLFLT *lev = new PLFLT[10]; pls->Alloc2dGrid( &cgrid2.xg, RPTS, THETAPTS ); pls->Alloc2dGrid( &cgrid2.yg, RPTS, THETAPTS ); pls->Alloc2dGrid( &z, RPTS, THETAPTS ); cgrid2.nx = RPTS; cgrid2.ny = THETAPTS; pls->env( -1., 1., -1., 1., 0, -2 ); pls->col0( 1 ); // Perimeter for ( i = 0; i < PERIMETERPTS; i++ ) { t = ( 2. * M_PI / ( PERIMETERPTS - 1 ) ) * (PLFLT) i; px[i] = cos( t ); py[i] = sin( t ); } pls->line( PERIMETERPTS, px, py ); // Create data to be contoured. for ( i = 0; i < RPTS; i++ ) { r = i / (PLFLT) ( RPTS - 1 ); for ( j = 0; j < THETAPTS; j++ ) { theta = ( 2. * M_PI / (PLFLT) ( THETAPTS - 1 ) ) * (PLFLT) j; cgrid2.xg[i][j] = r * cos( theta ); cgrid2.yg[i][j] = r * sin( theta ); z[i][j] = r; } } for ( i = 0; i < 10; i++ ) { lev[i] = 0.05 + 0.10 * (PLFLT) i; } pls->col0( 2 ); pls->cont( z, RPTS, THETAPTS, 1, RPTS, 1, THETAPTS, lev, 10, plstream::tr2, (void *) &cgrid2 ); pls->col0( 1 ); pls->lab( "", "", "Polar Contour Plot" ); pls->Free2dGrid( cgrid2.xg, RPTS, THETAPTS ); pls->Free2dGrid( cgrid2.yg, RPTS, THETAPTS ); pls->Free2dGrid( z, RPTS, THETAPTS ); delete[] px; delete[] py; delete[] lev; } void x09::potential() // Shielded potential contour plot example. { int i, j; PLFLT rmax, xmin, xmax, x0, ymin, ymax, y0, zmin, zmax; PLFLT peps, xpmin, xpmax, ypmin, ypmax; PLFLT eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i; PLFLT div1, div1i, div2, div2i; PLcGrid2 cgrid2; PLFLT **z; int nlevelneg, nlevelpos; PLFLT dz, clevel; PLFLT *clevelneg = new PLFLT[PNLEVEL]; PLFLT *clevelpos = new PLFLT[PNLEVEL]; int ncollin, ncolbox, ncollab; PLFLT *px = new PLFLT[PPERIMETERPTS]; PLFLT *py = new PLFLT[PPERIMETERPTS]; PLFLT t, r, theta; // Create data to be contoured. pls->Alloc2dGrid( &cgrid2.xg, PRPTS, PTHETAPTS ); pls->Alloc2dGrid( &cgrid2.yg, PRPTS, PTHETAPTS ); pls->Alloc2dGrid( &z, PRPTS, PTHETAPTS ); cgrid2.nx = PRPTS; cgrid2.ny = PTHETAPTS; // r = 0.; for ( i = 0; i < PRPTS; i++ ) { r = 0.5 + (PLFLT) i; for ( j = 0; j < PTHETAPTS; j++ ) { theta = ( 2. * M_PI / (PLFLT) ( PTHETAPTS - 1 ) ) * ( 0.5 + (PLFLT) j ); cgrid2.xg[i][j] = r * cos( theta ); cgrid2.yg[i][j] = r * sin( theta ); } } rmax = r; pls->MinMax2dGrid( cgrid2.xg, PRPTS, PTHETAPTS, &xmax, &xmin ); pls->MinMax2dGrid( cgrid2.yg, PRPTS, PTHETAPTS, &ymax, &ymin ); x0 = ( xmin + xmax ) / 2.; y0 = ( ymin + ymax ) / 2.; // Expanded limits peps = 0.05; xpmin = xmin - fabs( xmin ) * peps; xpmax = xmax + fabs( xmax ) * peps; ypmin = ymin - fabs( ymin ) * peps; ypmax = ymax + fabs( ymax ) * peps; // Potential inside a conducting cylinder (or sphere) by method of images. // Charge 1 is placed at (d1, d1), with image charge at (d2, d2). // Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). // Also put in smoothing term at small distances. eps = 2.; q1 = 1.; d1 = rmax / 4.; q1i = -q1 * rmax / d1; d1i = pow( rmax, 2 ) / d1; q2 = -1.; d2 = rmax / 4.; q2i = -q2 * rmax / d2; d2i = pow( rmax, 2 ) / d2; for ( i = 0; i < PRPTS; i++ ) { for ( j = 0; j < PTHETAPTS; j++ ) { div1 = sqrt( pow( cgrid2.xg[i][j] - d1, 2 ) + pow( cgrid2.yg[i][j] - d1, 2 ) + pow( eps, 2 ) ); div1i = sqrt( pow( cgrid2.xg[i][j] - d1i, 2 ) + pow( cgrid2.yg[i][j] - d1i, 2 ) + pow( eps, 2 ) ); div2 = sqrt( pow( cgrid2.xg[i][j] - d2, 2 ) + pow( cgrid2.yg[i][j] + d2, 2 ) + pow( eps, 2 ) ); div2i = sqrt( pow( cgrid2.xg[i][j] - d2i, 2 ) + pow( cgrid2.yg[i][j] + d2i, 2 ) + pow( eps, 2 ) ); z[i][j] = q1 / div1 + q1i / div1i + q2 / div2 + q2i / div2i; } } pls->MinMax2dGrid( z, PRPTS, PTHETAPTS, &zmax, &zmin ); // printf("%.15g %.15g %.15g %.15g %.15g %.15g %.15g %.15g \n", // q1, d1, q1i, d1i, q2, d2, q2i, d2i); // printf("%.15g %.15g %.15g %.15g %.15g %.15g\n", // xmin,xmax,ymin,ymax,zmin,zmax); // Positive and negative contour levels. dz = ( zmax - zmin ) / (PLFLT) PNLEVEL; nlevelneg = 0; nlevelpos = 0; for ( i = 0; i < PNLEVEL; i++ ) { clevel = zmin + ( (PLFLT) i + 0.5 ) * dz; if ( clevel <= 0. ) clevelneg[nlevelneg++] = clevel; else clevelpos[nlevelpos++] = clevel; } // Colours! ncollin = 11; ncolbox = 1; ncollab = 2; // Finally start plotting this page! pls->adv( 0 ); pls->col0( ncolbox ); pls->vpas( 0.1, 0.9, 0.1, 0.9, 1.0 ); pls->wind( xpmin, xpmax, ypmin, ypmax ); pls->box( "", 0., 0, "", 0., 0 ); pls->col0( ncollin ); if ( nlevelneg > 0 ) { // Negative contours pls->lsty( 2 ); pls->cont( z, PRPTS, PTHETAPTS, 1, PRPTS, 1, PTHETAPTS, clevelneg, nlevelneg, plstream::tr2, (void *) &cgrid2 ); } if ( nlevelpos > 0 ) { // Positive contours pls->lsty( 1 ); pls->cont( z, PRPTS, PTHETAPTS, 1, PRPTS, 1, PTHETAPTS, clevelpos, nlevelpos, plstream::tr2, (void *) &cgrid2 ); } // Draw outer boundary for ( i = 0; i < PPERIMETERPTS; i++ ) { t = ( 2. * M_PI / ( PPERIMETERPTS - 1 ) ) * (PLFLT) i; px[i] = x0 + rmax*cos( t ); py[i] = y0 + rmax*sin( t ); } pls->col0( ncolbox ); pls->line( PPERIMETERPTS, px, py ); pls->col0( ncollab ); pls->lab( "", "", "Shielded potential of charges in a conducting sphere" ); pls->Free2dGrid( cgrid2.xg, RPTS, THETAPTS ); pls->Free2dGrid( cgrid2.yg, RPTS, THETAPTS ); pls->Free2dGrid( z, RPTS, THETAPTS ); delete[] clevelneg; delete[] clevelpos; delete[] px; delete[] py; } int main( int argc, const char **argv ) { x09 *x = new x09( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x09.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/c++/x25.cc 644 1750 1750 1142011543675237 160760ustar andrewandrew// $Id: x25.cc 11680 2011-03-27 17:57:51Z airwin $ // // Test program for filling polygons and proper clipping // // Copyright (C) 2005 Arjen Markus // (C) 2006 Andrew Ross // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "plc++demos.h" class x25 { public: x25( int, const char ** ); private: plstream *pls; }; x25::x25( int argc, const char *argv[] ) { int i, j, k; int npts = 0; PLFLT xextreme[10][2]; PLFLT yextreme[10][2]; PLFLT x0[10]; PLFLT y0[10]; pls = new plstream(); // Parse and process command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->ssub( 3, 3 ); pls->init(); xextreme[0][0] = -120.0; xextreme[0][1] = 120.0; yextreme[0][0] = -120.0; yextreme[0][1] = 120.0; xextreme[1][0] = -120.0; xextreme[1][1] = 120.0; yextreme[1][0] = 20.0; yextreme[1][1] = 120.0; xextreme[2][0] = -120.0; xextreme[2][1] = 120.0; yextreme[2][0] = -20.0; yextreme[2][1] = 120.0; xextreme[3][0] = -80.0; xextreme[3][1] = 80.0; yextreme[3][0] = -20.0; yextreme[3][1] = 120.0; xextreme[4][0] = -220.0; xextreme[4][1] = -120.0; yextreme[4][0] = -120.0; yextreme[4][1] = 120.0; xextreme[5][0] = -20.0; xextreme[5][1] = 20.0; yextreme[5][0] = -120.0; yextreme[5][1] = 120.0; xextreme[6][0] = -20.0; xextreme[6][1] = 20.0; yextreme[6][0] = -20.0; yextreme[6][1] = 20.0; xextreme[7][0] = -80.0; xextreme[7][1] = 80.0; yextreme[7][0] = -80.0; yextreme[7][1] = 80.0; xextreme[8][0] = 20.0; xextreme[8][1] = 120.0; yextreme[8][0] = -120.0; yextreme[8][1] = 120.0; for ( k = 0; k < 2; k++ ) { for ( j = 0; j < 4; j++ ) { if ( j == 0 ) { // Polygon 1: a diamond x0[0] = 0; y0[0] = -100; x0[1] = -100; y0[1] = 0; x0[2] = 0; y0[2] = 100; x0[3] = 100; y0[3] = 0; npts = 4; } if ( j == 1 ) { // Polygon 1: a diamond - reverse direction x0[3] = 0; y0[3] = -100; x0[2] = -100; y0[2] = 0; x0[1] = 0; y0[1] = 100; x0[0] = 100; y0[0] = 0; npts = 4; } if ( j == 2 ) { // Polygon 2: a square with punctures x0[0] = -100; y0[0] = -100; x0[1] = -100; y0[1] = -80; x0[2] = 80; y0[2] = 0; x0[3] = -100; y0[3] = 80; x0[4] = -100; y0[4] = 100; x0[5] = -80; y0[5] = 100; x0[6] = 0; y0[6] = 80; x0[7] = 80; y0[7] = 100; x0[8] = 100; y0[8] = 100; x0[9] = 100; y0[9] = -100; npts = 10; } if ( j == 3 ) { // Polygon 2: a square with punctures - reversed direction x0[9] = -100; y0[9] = -100; x0[8] = -100; y0[8] = -80; x0[7] = 80; y0[7] = 0; x0[6] = -100; y0[6] = 80; x0[5] = -100; y0[5] = 100; x0[4] = -80; y0[4] = 100; x0[3] = 0; y0[3] = 80; x0[2] = 80; y0[2] = 100; x0[1] = 100; y0[1] = 100; x0[0] = 100; y0[0] = -100; npts = 10; } for ( i = 0; i < 9; i++ ) { pls->adv( 0 ); pls->vsta(); pls->wind( xextreme[i][0], xextreme[i][1], yextreme[i][0], yextreme[i][1] ); pls->col0( 2 ); pls->box( "bc", 1.0, 0, "bcnv", 10.0, 0 ); pls->col0( 1 ); pls->psty( 0 ); if ( k == 0 ) pls->fill( npts, x0, y0 ); else pls->gradient( npts, x0, y0, 45. ); pls->col0( 2 ); pls->lsty( 1 ); pls->line( npts, x0, y0 ); } } } // Don't forget to delete stream to finish off! delete pls; } int main( int argc, const char **argv ) { x25 *x = new x25( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/x29.cc 644 1750 1750 2703212012270727 160730ustar andrewandrew// $Id: x29.cc 12209 2012-08-13 21:29:59Z andrewross $ // // Sample plots using date / time formatting for axes // // Copyright (C) 2007 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif #include class x29 { public: x29( int, const char** ); private: plstream *pls; PLFLT x[365], y[365]; PLFLT xerr1[365], xerr2[365], yerr1[365], yerr2[365]; // Function prototypes void plot1(); void plot2(); void plot3(); void plot4(); PLFLT MIN( PLFLT x, PLFLT y ) { return ( x < y ? x : y ); }; PLFLT MAX( PLFLT x, PLFLT y ) { return ( x > y ? x : y ); }; }; //-------------------------------------------------------------------------- // // main // // Draws several plots which demonstrate the use of date / time formats for // the axis labels. // Time formatting is done using the system strftime routine. See the // documentation of this for full details of the available formats. // // 1) Plotting temperature over a day (using hours / minutes) // 2) Plotting // // Note: Times are stored as seconds since the epoch (usually 1st Jan 1970). // //-------------------------------------------------------------------------- x29::x29( int argc, const char *argv[] ) { pls = new plstream(); // Parse command line arguments pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize plplot pls->init(); pls->sesc( '@' ); plot1(); plot2(); plot3(); plot4(); delete pls; } // Plot a model diurnal cycle of temperature void x29::plot1() { int i, npts; PLFLT xmin, xmax, ymin, ymax; // Data points every 10 minutes for 1 day npts = 73; xmin = 0; xmax = 60.0 * 60.0 * 24.0; // Number of seconds in a day ymin = 10.0; ymax = 20.0; for ( i = 0; i < npts; i++ ) { x[i] = xmax * ( (PLFLT) i / (PLFLT) npts ); y[i] = 15.0 - 5.0 * cos( 2 * M_PI * ( (PLFLT) i / (PLFLT) npts ) ); // Set x error bars to +/- 5 minute xerr1[i] = x[i] - 60 * 5; xerr2[i] = x[i] + 60 * 5; // Set y error bars to +/- 0.1 deg C yerr1[i] = y[i] - 0.1; yerr2[i] = y[i] + 0.1; } pls->adv( 0 ); // Rescale major ticks marks by 0.5 pls->smaj( 0.0, 0.5 ); // Rescale minor ticks and error bar marks by 0.5 pls->smin( 0.0, 0.5 ); pls->vsta(); pls->wind( xmin, xmax, ymin, ymax ); // Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. pls->col0( 1 ); // Set time format to be hours:minutes pls->timefmt( "%H:%M" ); pls->box( "bcnstd", 3.0 * 60 * 60, 3, "bcnstv", 1, 5 ); pls->col0( 3 ); pls->lab( "Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature" ); pls->col0( 4 ); pls->line( npts, x, y ); pls->col0( 2 ); pls->errx( npts, xerr1, xerr2, y ); pls->col0( 3 ); pls->erry( npts, x, yerr1, yerr2 ); // Rescale major / minor tick marks back to default pls->smin( 0.0, 1.0 ); pls->smaj( 0.0, 1.0 ); } // Plot the number of hours of daylight as a function of day for a year void x29::plot2() { int j, npts; PLFLT xmin, xmax, ymin, ymax; PLFLT lat, p, d; // Latitude for London lat = 51.5; npts = 365; xmin = 0; xmax = npts * 60.0 * 60.0 * 24.0; ymin = 0; ymax = 24; // Formula for hours of daylight from // "A Model Comparison for Daylength as a Function of Latitude and // Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. for ( j = 0; j < npts; j++ ) { x[j] = j * 60.0 * 60.0 * 24.0; p = asin( 0.39795 * cos( 0.2163108 + 2 * atan( 0.9671396 * tan( 0.00860 * ( j - 186 ) ) ) ) ); d = 24.0 - ( 24.0 / M_PI ) * acos( ( sin( 0.8333 * M_PI / 180.0 ) + sin( lat * M_PI / 180.0 ) * sin( p ) ) / ( cos( lat * M_PI / 180.0 ) * cos( p ) ) ); y[j] = d; } pls->col0( 1 ); // Set time format to be abbreviated month name followed by day of month pls->timefmt( "%b %d" ); pls->prec( 1, 1 ); pls->env( xmin, xmax, ymin, ymax, 0, 40 ); pls->col0( 3 ); pls->lab( "Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N" ); pls->col0( 4 ); pls->line( npts, x, y ); pls->prec( 0, 0 ); } void x29::plot3() { int i, npts; PLFLT xmin, xmax, ymin, ymax; PLFLT tstart; // Calculate continuous time corresponding to 2005-12-01 UTC. pls->ctime( 2005, 11, 01, 0, 0, 0., tstart ); npts = 62; xmin = tstart; xmax = xmin + npts * 60.0 * 60.0 * 24.0; ymin = 0.0; ymax = 5.0; for ( i = 0; i < npts; i++ ) { x[i] = xmin + i * 60.0 * 60.0 * 24.0; y[i] = 1.0 + sin( 2 * M_PI * ( (PLFLT) i ) / 7.0 ) + exp( ( (PLFLT) MIN( i, npts - i ) ) / 31.0 ); } pls->adv( 0 ); pls->vsta(); pls->wind( xmin, xmax, ymin, ymax ); pls->col0( 1 ); // Set time format to be ISO 8601 standard YYYY-MM-HH. Note that this is // equivalent to %f for C99 compliant implementations of strftime. pls->timefmt( "%Y-%m-%d" ); // Draw a box with ticks spaced every 14 days in X and 1 hour in Y. pls->box( "bcnstd", 14 * 24.0 * 60.0 * 60.0, 14, "bcnstv", 1, 4 ); pls->col0( 3 ); pls->lab( "Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006" ); pls->col0( 4 ); // Rescale symbol size (used by plpoin) by 0.5 pls->ssym( 0.0, 0.5 ); pls->poin( npts, x, y, 2 ); pls->line( npts, x, y ); } void x29::plot4() { // TAI-UTC (seconds) as a function of time. // Use Besselian epochs as the continuous time interval just to prove // this does not introduce any issues. PLFLT scale, offset1, offset2; PLFLT xmin = 0.0, xmax = 0.0, ymin = 0.0, ymax = 0.0, xlabel_step = 0.0; int kind, npts = 0, if_TAI_time_format = 0, i; char time_format[10]; char title_suffix[100]; char xtitle[100]; char title[100]; PLFLT x[1001], y[1001]; PLINT tai_year, tai_month, tai_day, tai_hour, tai_min; PLFLT tai_sec, tai; PLINT utc_year, utc_month, utc_day, utc_hour, utc_min; PLFLT utc_sec, utc; // Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch // B = 1900. + (JD -2415020.31352)/365.242198781 // ==> (as calculated with aid of "bc -l" command) // B = (MJD + 678940.364163900)/365.242198781 // ==> // MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781; offset1 = -678940.; offset2 = -0.3641639; pls->configtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); for ( kind = 0; kind < 7; kind++ ) { if ( kind == 0 ) { pls->ctime( 1950, 0, 2, 0, 0, 0., xmin ); pls->ctime( 2020, 0, 2, 0, 0, 0., xmax ); npts = 70 * 12 + 1; ymin = 0.0; ymax = 36.0; strncpy( time_format, "%Y%", 10 ); if_TAI_time_format = 1; strncpy( title_suffix, "from 1950 to 2020", 100 ); strncpy( xtitle, "Year", 100 ); xlabel_step = 10.; } else if ( kind == 1 || kind == 2 ) { pls->ctime( 1961, 7, 1, 0, 0, 1.64757 - .20, xmin ); pls->ctime( 1961, 7, 1, 0, 0, 1.64757 + .20, xmax ); npts = 1001; ymin = 1.625; ymax = 1.725; strncpy( time_format, "%S%2%", 10 ); strncpy( title_suffix, "near 1961-08-01 (TAI)", 100 ); xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 1 ) { if_TAI_time_format = 1; strncpy( xtitle, "Seconds (TAI)", 100 ); } else { if_TAI_time_format = 0; strncpy( xtitle, "Seconds (TAI) labelled with corresponding UTC", 100 ); } } else if ( kind == 3 || kind == 4 ) { pls->ctime( 1963, 10, 1, 0, 0, 2.6972788 - .20, xmin ); pls->ctime( 1963, 10, 1, 0, 0, 2.6972788 + .20, xmax ); npts = 1001; ymin = 2.55; ymax = 2.75; strncpy( time_format, "%S%2%", 10 ); strncpy( title_suffix, "near 1963-11-01 (TAI)", 100 ); xlabel_step = 0.05 / ( scale * 86400. ); if ( kind == 3 ) { if_TAI_time_format = 1; strncpy( xtitle, "Seconds (TAI)", 100 ); } else { if_TAI_time_format = 0; strncpy( xtitle, "Seconds (TAI) labelled with corresponding UTC", 100 ); } } else if ( kind == 5 || kind == 6 ) { pls->ctime( 2009, 0, 1, 0, 0, 34. - 5., xmin ); pls->ctime( 2009, 0, 1, 0, 0, 34. + 5., xmax ); npts = 1001; ymin = 32.5; ymax = 34.5; strncpy( time_format, "%S%2%", 10 ); strncpy( title_suffix, "near 2009-01-01 (TAI)", 100 ); xlabel_step = 1. / ( scale * 86400. ); if ( kind == 5 ) { if_TAI_time_format = 1; strncpy( xtitle, "Seconds (TAI)", 100 ); } else { if_TAI_time_format = 0; strncpy( xtitle, "Seconds (TAI) labelled with corresponding UTC", 100 ); } } for ( i = 0; i < npts; i++ ) { x[i] = xmin + i * ( xmax - xmin ) / ( (double) ( npts - 1 ) ); pls->configtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); tai = x[i]; pls->btime( tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec, tai ); pls->configtime( scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0. ); pls->btime( utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, tai ); pls->configtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); pls->ctime( utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec, utc ); y[i] = ( tai - utc ) * scale * 86400.; } pls->adv( 0 ); pls->vsta(); pls->wind( xmin, xmax, ymin, ymax ); pls->col0( 1 ); if ( if_TAI_time_format ) pls->configtime( scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0. ); else pls->configtime( scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0. ); pls->timefmt( time_format ); pls->box( "bcnstd", xlabel_step, 0, "bcnstv", 0., 0 ); pls->col0( 3 ); strncpy( title, "@frPLplot Example 29 - TAI-UTC ", 100 ); strncat( title, title_suffix, 100 - strlen( title ) - 1 ); pls->lab( xtitle, "TAI-UTC (sec)", title ); pls->col0( 4 ); pls->line( npts, x, y ); } } int main( int argc, const char **argv ) { x29 *x = new x29( argc, argv ); delete x; } plplot-5.10.0+dfsg/examples/c++/x02.cc 644 1750 1750 1176312102122103 160460ustar andrewandrew//-------------------------------------------------------------------------- // $Id: x02.cc 12288 2013-01-30 04:40:35Z airwin $ //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Copyright (C) 2004,2005 Andrew Ross // Copyright (C) 2004 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published by // the Free Software Foundation; version 2 of the License. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //-------------------------------------------------------------------------- // //-------------------------------------------------------------------------- // Implementation of PLplot example 2 in C++. //-------------------------------------------------------------------------- #include "plc++demos.h" #ifdef PL_USE_NAMESPACE using namespace std; #endif class x02 { public: x02( int, const char ** ); private: void demo1(); void demo2(); void draw_windows( int nw, int cmap0_offset ); // Class data plstream *pls; }; //-------------------------------------------------------------------------- // demo1 // // Demonstrates multiple windows and default color map 0 palette. //-------------------------------------------------------------------------- void x02::demo1() { pls->bop(); // Divide screen into 16 regions. pls->ssub( 4, 4 ); draw_windows( 16, 0 ); pls->eop(); } //-------------------------------------------------------------------------- // demo1 // // Demonstrates multiple windows and default color map 0 palette. //-------------------------------------------------------------------------- void x02::demo2() { // Set up cmap0 // Use 100 custom colors in addition to base 16 PLINT r[116], g[116], b[116]; // Min and max lightness values PLFLT lmin = 0.15, lmax = 0.85; int i; pls->bop(); // Divide screen into 100 regions. pls->ssub( 10, 10 ); for ( i = 0; i <= 99; i++ ) { PLFLT h, l, s; PLFLT r1, g1, b1; // Bounds on HLS, from plhlsrgb() commentary -- // hue [0., 360.] degrees // lightness [0., 1.] magnitude // saturation [0., 1.] magnitude // // Vary hue uniformly from left to right h = ( 360. / 10. ) * ( i % 10 ); // Vary lightness uniformly from top to bottom, between min & max l = lmin + ( lmax - lmin ) * ( i / 10 ) / 9.; // Use max saturation s = 1.0; pls->hlsrgb( h, l, s, &r1, &g1, &b1 ); r[i + 16] = (PLINT) ( r1 * 255.001 ); g[i + 16] = (PLINT) ( g1 * 255.001 ); b[i + 16] = (PLINT) ( b1 * 255.001 ); } // Load default cmap0 colors into our custom set for ( i = 0; i <= 15; i++ ) pls->gcol0( i, r[i], g[i], b[i] ); // Now set cmap0 all at once (faster, since fewer driver calls) pls->scmap0( r, g, b, 116 ); draw_windows( 100, 16 ); pls->eop(); } //-------------------------------------------------------------------------- // draw_windows // // Draws a set of numbered boxes with colors according to cmap0 entry. //-------------------------------------------------------------------------- void x02::draw_windows( int nw, int cmap0_offset ) { int i, j; PLFLT vmin, vmax; char text[3]; pls->schr( 0.0, 3.5 ); pls->font( 4 ); for ( i = 0; i < nw; i++ ) { pls->col0( i + cmap0_offset ); sprintf( text, "%d", i ); pls->adv( 0 ); vmin = 0.1; vmax = 0.9; for ( j = 0; j <= 2; j++ ) { pls->width( j + 1 ); pls->vpor( vmin, vmax, vmin, vmax ); pls->wind( 0.0, 1.0, 0.0, 1.0 ); pls->box( "bc", 0.0, 0, "bc", 0.0, 0 ); vmin = vmin + 0.1; vmax = vmax - 0.1; } pls->width( 1 ); pls->ptex( 0.5, 0.5, 1.0, 0.0, 0.5, text ); } } x02::x02( int argc, const char ** argv ) { // plplot initialization pls = new plstream(); // Parse and process command line arguments. pls->parseopts( &argc, argv, PL_PARSE_FULL ); // Initialize PLplot. pls->init(); demo1(); demo2(); //pls->end(); delete pls; } int main( int argc, const char ** argv ) { x02 *x = new x02( argc, argv ); delete x; } //-------------------------------------------------------------------------- // End of x02.cc //-------------------------------------------------------------------------- plplot-5.10.0+dfsg/examples/tk/ 775 1750 1750 012406243570 151115ustar andrewandrewplplot-5.10.0+dfsg/examples/tk/xtk01.c 644 1750 1750 3112111704406556 163250ustar andrewandrew// $Id: xtk01.c 12129 2012-01-14 23:19:10Z airwin $ // // Copyright (C) 2004 Joao Cardoso // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #include "pltk.h" #include #include static int AppInit( Tcl_Interp *interp ); //-------------------------------------------------------------------------- // main -- // // Just a stub routine to call pltkMain. The latter is nice to have // when building extended wishes, since then you don't have to rely on // sucking the Tk main out of libtk (which doesn't work correctly on all // systems/compilers/linkers/etc). Hopefully in the future Tk will // supply a sufficiently capable tkMain() type function that can be used // instead. //-------------------------------------------------------------------------- int main( int argc, const char **argv ) { exit( pltkMain( argc, argv, NULL, AppInit ) ); } // //-------------------------------------------------------------------------- // // AppInit -- // // This procedure performs application-specific initialization. // Most applications, especially those that incorporate additional // packages, will have their own version of this procedure. // // Results: // Returns a standard Tcl completion code, and leaves an error // message in interp->result if an error occurs. // // Side effects: // Depends on the startup script. // // Taken from tkAppInit.c -- // // Copyright (c) 1993 The Regents of the University of California. // All rights reserved. // // Permission is hereby granted, without written agreement and without // license or royalty fees, to use, copy, modify, and distribute this // software and its documentation for any purpose, provided that the // above copyright notice and the following two paragraphs appear in // all copies of this software. // // IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR // DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT // OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF // CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS // ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. //-------------------------------------------------------------------------- // int myplotCmd( ClientData, Tcl_Interp *, int, char ** ); static int AppInit( Tcl_Interp *interp ) { Tk_Window mainWindow = Tk_MainWindow( interp ); // // Call the init procedures for included packages. Each call should // look like this: // // if (Mod_Init(interp) == TCL_ERROR) { // return TCL_ERROR; // } // // where "Mod" is the name of the module. // if ( Pltk_Init( interp ) == TCL_ERROR ) { return TCL_ERROR; } // // Call Tcl_CreateCommand for application-specific commands, if // they weren't already created by the init procedures called above. // Tcl_CreateCommand( interp, "myplot", (Tcl_CmdProc *) myplotCmd, (ClientData) mainWindow, (Tcl_CmdDeleteProc *) NULL ); return TCL_OK; } //-------------------------------------------------------------------------- // Taken from: // x01c.c // // Simple line plot and multiple windows demo. // static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs1[6], ys1[6]; static PLINT space0 = 0, mark0 = 0, space1 = 1500, mark1 = 1500; void myplot1( void ); void myplot2( void ); void myplot3( void ); void myplot4( void ); void plot1( void ); void plot2( void ); void plot3( void ); void myplot1() { // Set up the data // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; // Do a plot plot1(); } void myplot2() { PLINT digmax; // Set up the data xscale = 1.; yscale = 0.0014; yoff = 0.0185; // Do a plot digmax = 5; plsyax( digmax, 0 ); plot1(); } void myplot3() { plot2(); } void myplot4() { plot3(); } //-------------------------------------------------------------------------- void plot1( void ) { int i; PLFLT xmin, xmax, ymin, ymax; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * pow( x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs1[i] = x[i * 10 + 3]; ys1[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 6 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points plcol0( 9 ); plpoin( 6, xs1, ys1, 9 ); // Draw the line through the data plcol0( 4 ); plline( 60, x, y ); } //-------------------------------------------------------------------------- void plot2( void ) { int i; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). plcol0( 1 ); plenv( (PLFLT) -2.0, (PLFLT) 10.0, (PLFLT) -0.4, (PLFLT) 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line plcol0( 3 ); plline( 100, x, y ); } //-------------------------------------------------------------------------- void plot3( void ) { int i; // For the final graph we wish to override the default tick intervals, and // so do not use PLENV pladv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. plvsta(); plwind( (PLFLT) 0.0, (PLFLT) 360.0, (PLFLT) -1.2, (PLFLT) 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", (PLFLT) 60.0, 2, "bcnstv", (PLFLT) 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl // expects a pointer!! plstyl( 1, &mark1, &space1 ); plcol0( 2 ); plbox( "g", (PLFLT) 30.0, 0, "g", (PLFLT) 0.2, 0 ); plstyl( 0, &mark0, &space0 ); plcol0( 3 ); pllab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * 3.141592654 / 180.0 ); } plcol0( 4 ); plline( 101, x, y ); } //-------------------------------------------------------------------------- // Taken from: // x16c.c // // plshade demo, using color fill. // // Maurice LeBrun // IFS, University of Texas at Austin // 20 Mar 1994 // #define NCONTR 30 // Number of contours #define XPTS 35 // Data points in x #define YPTS 46 // Datat points in y #define XSPA 2. / ( XPTS - 1 ) #define YSPA 2. / ( YPTS - 1 ) static PLFLT clevel[NCONTR]; // Utility macros #ifndef PI #define PI 3.1415926535897932384 #endif #ifndef MAX #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef MIN #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif // Transformation function PLFLT tr[6] = { XSPA, 0.0, -1.0, 0.0, YSPA, -1.0 }; static void mypltr( PLFLT xloc, PLFLT yloc, PLFLT *tx, PLFLT *ty, void * PL_UNUSED( pltr_data ) ) { *tx = tr[0] * xloc + tr[1] * yloc + tr[2]; *ty = tr[3] * xloc + tr[4] * yloc + tr[5]; } // Function prototypes static void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmin, PLFLT *fmax ); void shade( void ); //-------------------------------------------------------------------------- // shade // // Does several shade plots using different coordinate mappings. //-------------------------------------------------------------------------- void shade( void ) { int i, j; PLFLT xloc, yloc, argx, argy, distort; PLFLT **z, **w, zmin, zmax; PLFLT xg1[XPTS], yg1[YPTS]; PLcGrid cgrid1; PLcGrid2 cgrid2; PLFLT shade_min, shade_max, sh_color; PLINT sh_cmap = 1, sh_width; PLINT min_color = 1, min_width = 0, max_color = 0, max_width = 0; // Set up function arrays plAlloc2dGrid( &z, XPTS, YPTS ); plAlloc2dGrid( &w, XPTS, YPTS ); // Set up data array for ( i = 0; i < XPTS; i++ ) { xloc = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 ); for ( j = 0; j < YPTS; j++ ) { yloc = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0; z[i][j] = -sin( 7. * xloc ) * cos( 7. * yloc ) + xloc * xloc - yloc * yloc; w[i][j] = -cos( 7. * xloc ) * sin( 7. * yloc ) + 2 * xloc * yloc; } } f2mnmx( z, XPTS, YPTS, &zmin, &zmax ); for ( i = 0; i < NCONTR; i++ ) clevel[i] = zmin + ( zmax - zmin ) * ( i + 0.5 ) / (PLFLT) NCONTR; // Set up coordinate grids cgrid1.xg = xg1; cgrid1.yg = yg1; cgrid1.nx = XPTS; cgrid1.ny = YPTS; plAlloc2dGrid( &cgrid2.xg, XPTS, YPTS ); plAlloc2dGrid( &cgrid2.yg, XPTS, YPTS ); cgrid2.nx = XPTS; cgrid2.ny = YPTS; for ( i = 0; i < XPTS; i++ ) { for ( j = 0; j < YPTS; j++ ) { mypltr( (PLFLT) i, (PLFLT) j, &xloc, &yloc, NULL ); argx = xloc * PI / 2; argy = yloc * PI / 2; distort = 0.4; cgrid1.xg[i] = xloc + distort * cos( argx ); cgrid1.yg[j] = yloc - distort * cos( argy ); cgrid2.xg[i][j] = xloc + distort * cos( argx ) * cos( argy ); cgrid2.yg[i][j] = yloc - distort * cos( argx ) * cos( argy ); } } // Plot using identity transform pladv( 0 ); plvpor( 0.1, 0.9, 0.1, 0.9 ); plwind( -1.0, 1.0, -1.0, 1.0 ); for ( i = 0; i < NCONTR; i++ ) { shade_min = zmin + ( zmax - zmin ) * i / (PLFLT) NCONTR; shade_max = zmin + ( zmax - zmin ) * ( i + 1 ) / (PLFLT) NCONTR; sh_color = i / (PLFLT) ( NCONTR - 1 ); sh_width = 2; plpsty( 0 ); plshade( (const PLFLT * const *) z, XPTS, YPTS, NULL, -1., 1., -1., 1., shade_min, shade_max, sh_cmap, sh_color, sh_width, min_color, min_width, max_color, max_width, plfill, 1, NULL, NULL ); } plcol0( 1 ); plbox( "bcnst", 0.0, 0, "bcnstv", 0.0, 0 ); plcol0( 2 ); // // plcont(w, XPTS, YPTS, 1, XPTS, 1, YPTS, clevel, NCONTR, mypltr, NULL); // pllab( "distance", "altitude", "Bogon density" ); // Clean up plFree2dGrid( z, XPTS, YPTS ); plFree2dGrid( w, XPTS, YPTS ); plFree2dGrid( cgrid2.xg, XPTS, YPTS ); plFree2dGrid( cgrid2.yg, XPTS, YPTS ); } //-------------------------------------------------------------------------- // f2mnmx // // Returns min & max of input 2d array. //-------------------------------------------------------------------------- static void f2mnmx( PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmn, PLFLT *fmx ) { int i, j; *fmx = f[0][0]; *fmn = *fmx; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { *fmx = MAX( *fmx, f[i][j] ); *fmn = MIN( *fmn, f[i][j] ); } } } //-------------------------------------------------------------------------- int myplotCmd( ClientData PL_UNUSED( cd ), Tcl_Interp *PL_UNUSED( interp ), int PL_UNUSED( argc ), char **argv ) { if ( !strcmp( argv[1], "1" ) ) myplot1(); if ( !strcmp( argv[1], "2" ) ) myplot2(); if ( !strcmp( argv[1], "3" ) ) myplot3(); if ( !strcmp( argv[1], "4" ) ) shade(); plflush(); return TCL_OK; } plplot-5.10.0+dfsg/examples/tk/runAllDemos.tcl 644 1750 1750 735612270221013 201160ustar andrewandrew#---------------------------------------------------------------------------- # Source this file into a working Tk interpreter to run all the Tcl demos # in a nice window with buttons for each demo you'd like to run. # # Vince Darley # vince@santafe.edu # #---------------------------------------------------------------------------- # # Set of disabled examples: # examples 14 and 31 do not work properly # example 32 has deliberately (not yet) been propagated to all languages # set greyedOut {14 31 32} if {[catch {file readlink [info script]} path]} { set path [info script] } lappend auto_path [file join [file dirname $path] .. tcl] # In order to distinguish whether this is a plserver or wish # environment we assume that [info nameofexecutable] has the string # "plserver", "wish" or "tclsh" in it. Some contrived examples can be # figured out where this assumption is not correct, and for those # cases we simply emit an error message and return. But normally this # assumption is correct, and it is certainly correct for our tests. switch -glob -- [info nameofexecutable] { "*plserver*" { # use 'plserver' method plstdwin . plxframe .p set plwin .p.plwin button .bnextpage -text "Page" -command [list event generate $plwin ] } "*wish*" - "*tclsh*" { # use 'wish" method plstdwin . plframe .p -eopcmd waitForReturn set plwin .p button .bnextpage -text "Page" -command [list $plwin nextpage] } default { puts stderr "Error: argv0 = \"$argv0\"\ndoes not contain either the substrings \"plserver\", \"tclsh\", or \"wish\"" puts stderr "Therefore cannot decide how to proceed with runAllDemos.tcl so giving up" return } } bind $plwin stopWaiting proc stopWaiting {} { set ::waitForReturn 1 } proc waitForReturn {} { .l configure -text "Press for the next page or complete the program" vwait ::waitForReturn } grid .p -columnspan 5 -sticky news grid rowconfigure . 0 -weight 1 for {set i 0} {$i < 5} {incr i} { grid columnconfigure . $i -weight 1 } # turn on pauses $plwin cmd plspause 1 button .cexit -text "Quit" -command exit if {$tcl_platform(platform) != "unix"} { button .cshell -text "Shell" -command "console show" } # # The reload button is probably not very useful to most users # as it reloads the set of demos and commands. So disable it # at least the time being # button .creload -text "Reload" -command reload -state disabled set buttons [concat [info commands .c*] .bnextpage] proc reload {} { global demos foreach demo $demos { catch {rename $demo {}} } auto_reset } proc run {demo} { global plwin $plwin configure -eopcmd waitForReturn .l configure -text "Starting $demo" setButtonState disabled update idletasks $plwin cmd plbop if {[catch {$demo $plwin} err]} { puts stderr $err } $plwin configure -eopcmd [list .bnextpage configure -state normal] $plwin cmd pleop .l configure -text "$demo complete" setButtonState normal .bnextpage configure -state disabled } proc setButtonState {state} { global greyedOut foreach b [info commands .b*] { if { [lsearch $greyedOut [string range $b 2 end]] < 0 } { $b configure -state $state } else { $b configure -state disabled } } } for {set i 0} {$i <= 33} {incr i} { set demo x[format "%02d" $i] button .b$i -text "Demo $i" -command [list run $demo] lappend demos $demo lappend buttons .b$i if {[llength $buttons] == 5} { eval grid $buttons -sticky ew set buttons {} } } foreach i $greyedOut { .b$i configure -state disabled } if {[llength $buttons]} { eval grid $buttons -sticky ew } label .l grid .l -sticky ew -columnspan 5 plplot-5.10.0+dfsg/examples/tk/wish_runAllDemos.in 755 1750 1750 57412244026376 207720ustar andrewandrew#!@SH_EXECUTABLE@ # Run standard examples using wish/runAllDemos.tcl # The following exec command reexecutes the script under wish. This # is possible because all comment lines are ignored by wish including # continued ones with a trailing backslash like this one \ exec @TK_WISH@ "$0" "$@" lappend auto_path @pkgIndex_LOCATIONS@ package require Plplotter source runAllDemos.tcl plplot-5.10.0+dfsg/examples/tk/xtk02.c 644 1750 1750 2161711665524172 163400ustar andrewandrew// $Id: xtk02.c 12077 2011-11-30 22:04:42Z andrewross $ // // Copyright (C) 2004 Joao Cardoso // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #include "pltk.h" #include #include static int AppInit( Tcl_Interp *interp ); int stuff( tclMatrix *pm, Tcl_Interp *interp, int argc, const char *argv[] ); //-------------------------------------------------------------------------- // A pithy little proc to show off how to install and use a tclMatrix // extension subcommand. This example is silly--only intended to show // how to do it. What to do with it is your problem. Could implement // subcommands for filling a matrix with special functions, performing // fft's, etc. //-------------------------------------------------------------------------- int stuff( tclMatrix *pm, Tcl_Interp *interp, int PL_UNUSED( argc ), const char * PL_UNUSED( argv [] ) ) { int i; PLFLT x, y; // Should check that matrix is right type, size, etc. for ( i = 0; i < pm->n[0]; i++ ) { x = (PLFLT) i / pm->n[0]; y = sin( 6.28 * 4. * i / pm->n[0] ) * x * ( 1. - x ) * 2 + 2. * x * ( 1. - x ); pm->fdata[i] = y; } Tcl_SetResult( interp, (char *) "Things are cool in gumbyville.", TCL_STATIC ); return TCL_OK; } //-------------------------------------------------------------------------- // main -- // // Just a stub routine to call pltkMain. The latter is nice to have // when building extended wishes, since then you don't have to rely on // sucking the Tk main out of libtk (which doesn't work correctly on all // systems/compilers/linkers/etc). Hopefully in the future Tk will // supply a sufficiently capable tkMain() type function that can be used // instead. //-------------------------------------------------------------------------- int main( int argc, const char **argv ) { exit( pltkMain( argc, argv, NULL, AppInit ) ); } // //-------------------------------------------------------------------------- // // AppInit -- // // This procedure performs application-specific initialization. // Most applications, especially those that incorporate additional // packages, will have their own version of this procedure. // // Results: // Returns a standard Tcl completion code, and leaves an error // message in interp->result if an error occurs. // // Side effects: // Depends on the startup script. // // Taken from tkAppInit.c -- // // Copyright (c) 1993 The Regents of the University of California. // All rights reserved. // // Permission is hereby granted, without written agreement and without // license or royalty fees, to use, copy, modify, and distribute this // software and its documentation for any purpose, provided that the // above copyright notice and the following two paragraphs appear in // all copies of this software. // // IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR // DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT // OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF // CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS // ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. //-------------------------------------------------------------------------- // int myplotCmd( ClientData, Tcl_Interp *, int, char ** ); static int AppInit( Tcl_Interp *interp ) { Tk_Window mainWin; mainWin = Tk_MainWindow( interp ); // // Call the init procedures for included packages. Each call should // look like this: // // if (Mod_Init(interp) == TCL_ERROR) { // return TCL_ERROR; // } // // where "Mod" is the name of the module. // if ( Pltk_Init( interp ) == TCL_ERROR ) { return TCL_ERROR; } // // Call Tcl_CreateCommand for application-specific commands, if // they weren't already created by the init procedures called above. // Tcl_CreateCommand( interp, "myplot", (Tcl_CmdProc *) myplotCmd, (ClientData) mainWin, (Tcl_CmdDeleteProc *) NULL ); Tcl_MatrixInstallXtnsn( "stuff", stuff ); return TCL_OK; } void myplot1( void ); void myplot2( void ); void myplot3( void ); void myplot4( void ); // Plots several simple functions // Note the compiler should automatically convert all non-pointer arguments // to satisfy the prototype, but some have problems with constants. static PLFLT x[101], y[101]; static PLFLT xscale, yscale, xoff, yoff, xs[6], ys[6]; static PLINT space0 = 0, mark0 = 0, space1 = 1500, mark1 = 1500; void plot1( void ); void plot2( void ); void plot3( void ); // This has been superceeded by Tcl code in tk02 void myplot1() { // Set up the data // Original case xscale = 6.; yscale = 1.; xoff = 0.; yoff = 0.; // Do a plot plot1(); } void myplot2() { PLINT digmax; // Set up the data xscale = 1.; yscale = 0.0014; yoff = 0.0185; // Do a plot digmax = 5; plsyax( digmax, 0 ); plot1(); } void myplot3() { plot2(); } void myplot4() { plot3(); } //-------------------------------------------------------------------------- void plot1( void ) { int i; PLFLT xmin, xmax, ymin, ymax; for ( i = 0; i < 60; i++ ) { x[i] = xoff + xscale * ( i + 1 ) / 60.0; y[i] = yoff + yscale * pow( x[i], 2. ); } xmin = x[0]; xmax = x[59]; ymin = y[0]; ymax = y[59]; for ( i = 0; i < 6; i++ ) { xs[i] = x[i * 10 + 3]; ys[i] = y[i * 10 + 3]; } // Set up the viewport and window using PLENV. The range in X is // 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are // scaled separately (just = 0), and we just draw a labelled // box (axis = 0). plcol0( 1 ); plenv( xmin, xmax, ymin, ymax, 0, 0 ); plcol0( 6 ); pllab( "(x)", "(y)", "#frPLplot Example 1 - y=x#u2" ); // Plot the data points plcol0( 9 ); plpoin( 6, xs, ys, 9 ); // Draw the line through the data plcol0( 4 ); plline( 60, x, y ); } //-------------------------------------------------------------------------- void plot2( void ) { int i; // Set up the viewport and window using PLENV. The range in X is -2.0 to // 10.0, and the range in Y is -0.4 to 2.0. The axes are scaled separately // (just = 0), and we draw a box with axes (axis = 1). plcol0( 1 ); plenv( -2.0, 10.0, -0.4, 1.2, 0, 1 ); plcol0( 2 ); pllab( "(x)", "sin(x)/x", "#frPLplot Example 1 - Sinc Function" ); // Fill up the arrays for ( i = 0; i < 100; i++ ) { x[i] = ( i - 19.0 ) / 6.0; y[i] = 1.0; if ( x[i] != 0.0 ) y[i] = sin( x[i] ) / x[i]; } // Draw the line plcol0( 3 ); plline( 100, x, y ); } //-------------------------------------------------------------------------- void plot3( void ) { int i; // For the final graph we wish to override the default tick intervals, and // so do not use PLENV pladv( 0 ); // Use standard viewport, and define X range from 0 to 360 degrees, Y range // from -1.2 to 1.2. plvsta(); plwind( 0.0, 360.0, -1.2, 1.2 ); // Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. plcol0( 1 ); plbox( "bcnst", 60.0, 2, "bcnstv", 0.2, 2 ); // Superimpose a dashed line grid, with 1.5 mm marks and spaces. plstyl // expects a pointer!! plstyl( 1, &mark1, &space1 ); plcol0( 2 ); plbox( "g", 30.0, 0, "g", 0.2, 0 ); plstyl( 0, &mark0, &space0 ); plcol0( 3 ); pllab( "Angle (degrees)", "sine", "#frPLplot Example 1 - Sine function" ); for ( i = 0; i < 101; i++ ) { x[i] = 3.6 * i; y[i] = sin( x[i] * 3.141592654 / 180.0 ); } plcol0( 4 ); plline( 101, x, y ); } int myplotCmd( ClientData PL_UNUSED( cd ), Tcl_Interp *PL_UNUSED( interp ), int PL_UNUSED( argc ), char **argv ) { if ( !strcmp( argv[1], "1" ) ) myplot1(); if ( !strcmp( argv[1], "2" ) ) myplot2(); if ( !strcmp( argv[1], "3" ) ) myplot3(); if ( !strcmp( argv[1], "4" ) ) myplot4(); plflush(); return TCL_OK; } plplot-5.10.0+dfsg/examples/tk/plserver_standard_examples.in 755 1750 1750 147012276771565 231630ustar andrewandrew#!@SH_EXECUTABLE@ # Run plserver example for standard examples. # Drop examples 14 and 31 because querying for devices does not # seem to work in this context. # The following exec command reexecutes the script under wish. This # is possible because all comment lines are ignored by wish including # continued ones with a trailing backslash like this one \ exec @plserver_LOCATION@ -f "$0" "$@" source tkdemos.tcl # # Turn off pausing - Note in the current plserver case, the plxframe # uses a visual clue and bindings to key press events so a different # method must be used to disable pausing than in the wish case. # Note that the widget in question is .plw, not $plwin # plw::set_pause .plw 0 # # Now run the examples one by one # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 33 exit plplot-5.10.0+dfsg/examples/tk/CMakeLists.txt 644 1750 1750 2105712264404031 177450ustar andrewandrew# examples/tk/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006, 2007, 2008, 2009, 2010 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(tk_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) set(tk_SRC_FILES README.tkdemos runAllDemos.tcl runExtendedDemos.tcl tkdemos.tcl ) # Copy files to the binary directory (if different) for generating tclIndex # This ensures no files are created in the source tree. set(tk_FILES) foreach(_file ${tk_SRC_FILES}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ) set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file}) endforeach(_file ${tk_SRC_FILES}) if(CORE_BUILD) set(tcl_EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/examples/tcl) else(CORE_BUILD) set(tcl_EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/tcl) endif(CORE_BUILD) foreach(STRING_INDEX ${tk_STRING_INDICES}) set(_file x${STRING_INDEX}.tcl) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tcl_EXAMPLES_DIR}/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file} DEPENDS ${tcl_EXAMPLES_DIR}/${_file} ) set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file}) endforeach(STRING_INDEX ${tk_STRING_INDICES}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl COMMAND ${CMAKE_COMMAND} -E copy_if_different ${tcl_EXAMPLES_DIR}/plgrid.tcl ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl DEPENDS ${tcl_EXAMPLES_DIR}/plgrid.tcl ) set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS} DEPENDS ${tk_FILES} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) add_custom_target(tclIndex_examples_tk ALL DEPENDS ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex ) set(tk_SRC) if(ENABLE_tkX) list(APPEND tk_SRC xtk01.c) endif(ENABLE_tkX) # The third example is run using a configured shell script which invokes # plserver so there is no source code to be compiled. # The second and fourth Tk examples depend on Itk to work. if(ENABLE_itkX) list(APPEND tk_SRC xtk02.c xtk04.c) endif(ENABLE_itkX) # The first, second, and fourth tk examples depend on configured bang # scripts to work which depends directly on the executables, xtk01, # xtk02, and xtk04. # The third example is run with the configured shell script, tk03, which # invokes plserver. # plgrid is a configured shell script that runs the plgrid.tcl example # (N.B., in the tcl directory) using plserver. # plserver_standard_examples is a configured shell script that runs # all the standard examples under plserver. set(tk_SCRIPTS tk01 tk03 plgrid plserver_standard_examples wish_standard_examples ) # These examples depend on Itk to work. if(ENABLE_itkX) list(APPEND tk_SCRIPTS tk02 tk04 plserver_runAllDemos wish_runAllDemos ) endif(ENABLE_itkX) if(BUILD_TEST) if(CORE_BUILD) include_directories( ${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/bindings/tcl ${CMAKE_SOURCE_DIR}/bindings/tk ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include ) else(CORE_BUILD) include_directories( ${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH} ${INCLUDE_DIR} ) endif(CORE_BUILD) set_property(GLOBAL PROPERTY TARGETS_examples_tk) foreach(TK_SRC_FILE ${tk_SRC}) string(REGEX REPLACE ".c$" "" TK_EXE ${TK_SRC_FILE}) add_executable(${TK_EXE} ${TK_SRC_FILE}) if(BUILD_SHARED_LIBS AND CORE_BUILD) set_source_files_properties(${TK_SRC_FILE} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS AND CORE_BUILD) target_link_libraries(${TK_EXE} plplottcltk_Main${LIB_TAG} plplottcltk${LIB_TAG} tclmatrix${LIB_TAG} plplot${LIB_TAG} ${TK_LIBRARY} ${TCL_LIBRARY} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk ${TK_EXE}) endforeach(TK_SRC_FILE ${tk_SRC}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk tclIndex_examples_tk) # Provide locations for several tk-related targets that will be used # to configure the tk_SCRIPTS. # wish_standard_examples is a configured shell script that runs all # the standard examples under wish using a TEA-based approach. # pkgIndex_LOCATION is the directory where the relevant pkgIndex.tcl # file is located. In the Plplotter package case two build-tree # locations must be given, and we use the pkgIndex_LOCATIONS variable # to configure that case. if(CORE_BUILD) set(pkgIndex_LOCATION ${CMAKE_BINARY_DIR}/bindings/tk) set(pkgIndex_LOCATIONS "${CMAKE_BINARY_DIR}/bindings/tk ${CMAKE_BINARY_DIR}/bindings/tk-x-plat") else(CORE_BUILD) set(pkgIndex_LOCATION ${DATA_DIR}) set(pkgIndex_LOCATIONS ${DATA_DIR}) endif(CORE_BUILD) foreach(tk_related_target xtk01 plserver xtk02 xtk04) if(TARGET ${tk_related_target}) get_target_property(${tk_related_target}_LOCATION ${tk_related_target} LOCATION ) endif(TARGET ${tk_related_target}) endforeach(tk_related_target xtk01 plserver xtk02 xtk04) # Configure the tk_SCRIPTS foreach(tk_SCRIPT ${tk_SCRIPTS}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${tk_SCRIPT}.in ${CMAKE_CURRENT_BINARY_DIR}/${tk_SCRIPT} @ONLY ) endforeach(tk_SCRIPT ${tk_SCRIPTS}) endif(BUILD_TEST) if(CORE_BUILD) # Provide install locations for several tk-related targets that will # be used to configure the tk_SCRIPTS used in the traditional # Makefile+pkg-config build system for the installed examples. foreach(tk_related_target xtk01 plserver xtk02 xtk04) if(tk_related_target STREQUAL "plserver") set(install_dir ${BIN_DIR}) else(tk_related_target STREQUAL "plserver") set(install_dir ${DATA_DIR}/examples/tk) endif(tk_related_target STREQUAL "plserver") set(${tk_related_target}_LOCATION ${install_dir}/${tk_related_target}${EXEEXT} ) endforeach(tk_related_target xtk01 plserver xtk02 xtk04) foreach(tk_SCRIPT ${tk_SCRIPTS}) # Configure and install the tk_SCRIPTS used for the traditional build. configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${tk_SCRIPT}.in ${CMAKE_CURRENT_BINARY_DIR}/install_${tk_SCRIPT} @ONLY ) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/install_${tk_SCRIPT} DESTINATION ${DATA_DIR}/examples/tk RENAME ${tk_SCRIPT} ) # install the template files used to configure tk_SCRIPTS for the # new installed examples build system. install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${tk_SCRIPT}.in DESTINATION ${DATA_DIR}/examples/tk ) endforeach(tk_SCRIPT ${tk_SCRIPTS}) endif(CORE_BUILD) if(CORE_BUILD) install(FILES ${tk_FILES} DESTINATION ${DATA_DIR}/examples/tk) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tclIndex DESTINATION ${DATA_DIR}/examples/tk) install(FILES ${tk_SRC} DESTINATION ${DATA_DIR}/examples/tk) set(CC ${CMAKE_C_COMPILER}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/tk RENAME Makefile ) install(FILES CMakeLists.txt DESTINATION ${DATA_DIR}/examples/tk ) endif(CORE_BUILD) plplot-5.10.0+dfsg/examples/tk/plserver_runAllDemos.in 755 1750 1750 50312244026376 216520ustar andrewandrew#!@SH_EXECUTABLE@ # Run plserver example for standard examples. # The following exec command reexecutes the script under wish. This # is possible because all comment lines are ignored by wish including # continued ones with a trailing backslash like this one \ exec @plserver_LOCATION@ -f "$0" "$@" source runAllDemos.tcl plplot-5.10.0+dfsg/examples/tk/wish_standard_examples.in 755 1750 1750 233412265613053 222540ustar andrewandrew#!@SH_EXECUTABLE@ # Run standard examples using wish TEA-based approach. # Drop examples 14 and 31 because querying for devices does not # seem to work in this context. # We use of the wish -colormap new option since it cannot hurt, # but this does not solve color issues # for both examples 2 ("Couldn't parse color 76") and 24 ("illegal number of colors in cmap0: red") so we comment out those examples for now. # N.B. recently that example 2 and example 24 error message has been # replaced by a segfault. So presumably the issue all along has been # a memory management issue that (as typical with such issues) # manifests in a variety of ways depending on subtle details. # Example 20 enables plspause so comment out for now. # The following exec command reexecutes the script under wish. This # is possible because all comment lines are ignored by wish including # continued ones with a trailing backslash like this one \ exec @TK_WISH@ "$0" "$@" lappend auto_path @pkgIndex_LOCATION@ package require Pltk source tkdemos.tcl # Note wish currently disables pauses so no special method is # required to do that (unlike the plserver case). 0 1 #2 3 4 5 6 7 8 9 10 11 12 13 #14 15 16 17 18 19 #20 21 22 23 #24 25 26 27 28 29 30 #31 33 exit plplot-5.10.0+dfsg/examples/tk/CMakeLists.txt_installed_examples_tk 644 1750 1750 731612264404031 243620ustar andrewandrew# tk/CMakeLists.txt for installed PLplot examples ### Process this file with cmake to produce Makefile ### # Copyright (C) 2009 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA set(tk_FILES) set(tk_SRC_FILES README.tkdemos runAllDemos.tcl runExtendedDemos.tcl tkdemos.tcl tk01 tk02 tk03 tk04 ) set(tk_STRING_INDICES "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" ) # Copy files to the binary directory (if different) for generating tclIndex # This ensures no files are created in the source tree. if(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") foreach(_file ${tk_SRC_FILES}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_file} ) set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file}) endforeach(_file ${tk_SRC_FILES}) endif(NOT CMAKE_CURRENT_BINARY_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") foreach(STRING_INDEX ${tk_STRING_INDICES}) set(_file x${STRING_INDEX}.tcl) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tcl/${_file} ${CMAKE_CURRENT_BINARY_DIR}/${_file} DEPENDS ${CMAKE_SOURCE_DIR}/tcl/${_file} ) set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${_file}) endforeach(STRING_INDEX ${tk_STRING_INDICES}) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/tcl/plgrid.tcl ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl DEPENDS ${CMAKE_SOURCE_DIR}/tcl/plgrid.tcl ) set(tk_FILES ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/plgrid.tcl) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/tclIndex COMMAND ${TCL_TCLSH} ${MKTCLINDEX} ${MKTCLINDEX_ARGS} DEPENDS ${tk_FILES} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) # The second and fourth Tk examples depend on Itk to work. set(tk_SCRIPTS tk01 tk03) set(tk_SRC xtk01.c) if(ENABLE_itkX) list(APPEND tk_SCRIPTS tk02 tk04) list(APPEND tk_SRC xtk02.c xtk04.c) endif(ENABLE_itkX) include_directories( ${TCL_INCLUDE_PATH} ${TK_INCLUDE_PATH} ${INCLUDE_DIR} ) foreach(TK_SRC_FILE ${tk_SRC}) string(REGEX REPLACE ".c$" "" TK_EXE ${TK_SRC_FILE}) add_executable(${TK_EXE} ${TK_SRC_FILE}) if(BUILD_SHARED_LIBS) SET_SOURCE_FILES_PROPERTIES(${TK_SRC_FILE} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(BUILD_SHARED_LIBS) target_link_libraries(${TK_EXE} plplottcltk${LIB_TAG} tclmatrix${LIB_TAG} plplot${LIB_TAG} ${MATH_LIB}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk ${TK_EXE}) endforeach(TK_SRC_FILE ${tk_SRC}) add_custom_target(tclIndex_examples_tk ALL DEPENDS ${tk_FILES} ${CMAKE_CURRENT_BINARY_DIR}/tclIndex ) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_tk tclIndex_examples_tk) plplot-5.10.0+dfsg/examples/tk/runExtendedDemos.tcl 644 1750 1750 3762 7513345203 211370ustar andrewandrew#---------------------------------------------------------------------------- # Source this file into a working Tk interpreter to run all the Tcl demos # in a nice window with buttons for each demo you'd like to run. # # This requires the 'Plplotwin' extended widget. If you don't have that # widget set up (from the 'tk-x-plat' bindings), then use the # 'runAllDemos.tcl' script instead. # # Vince Darley # vince@santafe.edu # #---------------------------------------------------------------------------- if {[catch {file readlink [info script]} path]} { set path [info script] } cd [file join [file dirname $path] .. tcl] lappend auto_path [pwd] catch {package require Plplotter} Plplotwin .p grid .p -columnspan 5 -sticky news grid rowconfigure . 0 -weight 1 for {set i 0} {$i < 5} {incr i} { grid columnconfigure . $i -weight 1 } # turn on pauses .p cmd plspause 1 button .cexit -text "Quit" -command exit button .cshell -text "Shell" -command "console show" button .creload -text "Reload" -command reload button .ctoggle -text "Toggle Menu" -command toggleMenu set buttons [list .cexit .cshell .creload .ctoggle] proc toggleMenu {} { if {[.p cget -menulocation] == "menubar"} { .p configure -menulocation local } else { .p configure -menulocation menubar } } proc reload {} { global demos foreach demo $demos { catch {rename $demo {}} } auto_reset } proc run {demo} { setButtonState disabled .p bop update idletasks if {[catch {$demo .p} err]} { puts stderr $err } .p bop setButtonState normal } proc setButtonState {state} { foreach b [info commands .b*] { $b configure -state $state } } for {set i 1} {$i <= [llength [glob x*.tcl]]} {incr i} { set demo x[format "%02d" $i] button .b$i -text "Demo $i" -command [list run $demo] lappend demos $demo lappend buttons .b$i if {[llength $buttons] == 5} { eval grid $buttons -sticky ew set buttons {} } } if {[llength $buttons]} { eval grid $buttons -sticky ew } plplot-5.10.0+dfsg/examples/tk/README.tkdemos 644 1750 1750 465112241542504 175160ustar andrewandrewRunning the Tk Demos. Note these directions (aside from runAllDemos.tcl) as well as taking proper care of all the dependencies have been incorporated into our CMake-based build systems for the core build and the installed examples build. So with the exception of runAllDemos.tcl the tests below of the Tcl, Tk, Itcl, Itk, and Iwidgets components of PLplot can be done by simply running make test_interactive However, we preserve the directions below for historical reasons and in case you want to do any of these commands by hand. There are two ways to run the examples below, where the alternatives are indicated by "|". The first alternative should only be used if you have changed directories to $prefix/share/plplot$VERSION/examples/tk where $prefix is the PLplot install prefix and $VERSION is the PLplot release version, e.g., 5.9.10. (That is, the first alternative should be used if you have changed directories to the installed tk examples directory.) The second alternative should only be used if you have changed directories to bindings/examples/tk in the build tree. To run the plot.tcl demo follow the directions in that file to run it under plserver using the plframe widget. Build the xtk?? executables using the 'make' command. Once the xtk?? executables are built, then you run the examples in the following way: ./xtk01 -f tk01 ./xtk02 -f tk02 ./tk03 # to run this demo in the build tree, change line 11 # from "plserver" to "../../bindings/plserver" ./xtk04 -f tk04 (1) Run tkdemos.tcl from plserver. This potentially exercises all the x??.tcl examples using the plframe widget: plserver | ../../bindings/tk/plserver source tkdemos.tcl 1 2 .... Note the plserver command has normal PLplot command-line options (run plserver -h to find out what they are). (2) Run tkdemos.tcl from wish. wish -geometry 600x400 lappend auto_path $prefix/share/plplot$VERSION | ../../bindings/tk package require Pltk source tkdemos.tcl 1 2 .... To find out more about the wish command (which comes as part of the Tk package) use man wish. Both the plserver and wish methods execute the various x??.tcl examples corresponding to the numbers specified by the user. (3) Run runAllDemos.tcl from plserver. plserver | ../../bindings/tk/plserver source runAllDemos.tcl (4) Run runAllDemos.tcl from wish. wish lappend auto_path $prefix/share/plplot$VERSION | ../../bindings/tk-x-plat ../../bindings/tk package require Plplotter source runAllDemos.tcl plplot-5.10.0+dfsg/examples/tk/Makefile.examples.in 644 1750 1750 275612253724007 210620ustar andrewandrew# examples/tk/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2002, 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA CC = @CC@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ plplottcltk_Main_RPATHCMD = @plplottcltk_Main_RPATHCMD@ EXECUTABLES_list = xtk01$(EXEEXT) # Second and fourth examples depend on itk. @itk_true@itk_EXECUTABLES_list = xtk02$(EXEEXT) xtk04$(EXEEXT) all: $(EXECUTABLES_list) $(itk_EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) $(itk_EXECUTABLES_list) .c$(EXEEXT): $(CC) $< -o $@ $(plplottcltk_Main_RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-tcl_Main plplot$(LIB_TAG)-tcl plplot$(LIB_TAG)` -lm .SUFFIXES: .c $(EXEEXT) plplot-5.10.0+dfsg/examples/tk/tk04.in 755 1750 1750 536412276771565 163330ustar andrewandrew#!@xtk04_LOCATION@ -f # -*-tcl-*- # $Id: tk04.in 13008 2014-02-12 22:19:33Z airwin $ # Maurice LeBrun # 30 Jun 1994 # # @> A script illustrating use of 2-d tcl api (plframe). ############################################################################### package require Pltk eval package require $pl_itk_package_name wm title . "tk04" plstdwin . ############################################################################### # Set up the menubar and message widgets. frame .menu -relief raised -borderwidth 3 button .menu.comp -text "Compute Function" -command "compute" button .menu.contour -text "Line Contour" -command "contour" button .menu.shade -text "Color Fill Contour" -command "shade" pack .menu.comp .menu.contour .menu.shade -side left button .menu.exit -text "Exit" -command "destroy ." pack .menu.exit -side right message .msg \ -font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \ -width 500 -borderwidth 1 \ -text "TK04: 2-d Tcl API" pack .menu .msg -fill x tk_menuBar .menu .menu.comp .menu.contour .menu.shade .menu.exit PLXWin .plw pack .plw -side bottom -expand 1 -fill both matrix x f 64 64 # This is the front end to the data computation. Initially we just # create the matrix to hold the data, and then vector down to the C # side to set the data. However, one could easily embellish this to # accept specifications from the user (via Tk entries), and act on # them. For instance, choosing the size of the matrix, passing # paramaters to the compiled side, etc. proc compute {} { global x get_data x } # Draw a contour of the data. proc contour {} { global x .plw pladv .plw plvpor 0.1 0.9 0.1 0.9 .plw plwind 1. 64. 1. 64. .plw plcol0 6 .plw pllab "(x)" "(y)" "#frPLplot Example Tk04" # plot the data points .plw plcol0 9 matrix clev f 10 set max [x max] set min [x min] for {set i 0} {$i < 10} {incr i} { clev $i = [expr $min + ($max-$min)*($i+.5)/10 ] } .plw plcont x clev .plw plcol0 1 .plw plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 } proc shade {} { global x .plw pladv .plw plvpor 0.1 0.9 0.1 0.9 .plw plwind 0. 1. 0. 1. .plw plcol0 6 .plw pllab "(x)" "(y)" "Cool shade plot example from Tcl" set max [x max] set min [x min] set xmin 0 set xmax 1 set ymin 0 set ymax 1 for {set i 0} {$i < 20} {incr i} { set sh_min [expr $min + ($max-$min)*$i/20.] set sh_max [expr $min + ($max-$min)*($i+1)/20.] set sh_col [expr $i/20.] .plw plshade x $xmin $xmax $ymin $ymax $sh_min $sh_max 1 $sh_col 0 \ 1 0 0 0 \ 1 "NULL" } .plw plcol0 1 .plw plbox "bcnst" 0.0 0 "bcnstv" 0.0 0 } ############################################################################### plplot-5.10.0+dfsg/examples/tk/tk03.in 755 1750 1750 1416612276771565 163520ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: tk03.in 13008 2014-02-12 22:19:33Z airwin $ # # Maurice LeBrun # 30 Jun 1994 # # @> A script illustrating multiple toplevel plframes. #-----------------------------------------------------------------------------# #\ exec @plserver_LOCATION@ -f "$0" ${1+"$@"} # Note: I defer running "open_main" until later to make sure everything # has been sourced. wm title . "tk03" plstdwin . set child_count 1 # If you just want a bare plframe, set this to 0. set use_plxframe 1 ############################################################################### # Set up the menubar and message widgets for main window. proc open_main {} { global use_plxframe if { $use_plxframe == 1 } then { set plwin .plw.plwin } else { set plwin .plwin } frame .menu -relief raised -borderwidth 3 button .menu.one -text "One" -command "1 $plwin" pack append .menu .menu.one {left expand fill} button .menu.two -text "Two" -command "2 $plwin" pack append .menu .menu.two {left expand fill} button .menu.open -text "Open new" -command "open_child" pack append .menu .menu.open {left expand fill} button .menu.exit -text "Exit" -command "destroy ." #"quit 0" pack append .menu .menu.exit {right expand fill} message .msg \ -font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \ -width 500 -borderwidth 1 \ -text "TK03: Multiple toplevels with plframes" pack append . \ .menu {top fillx} \ .msg {top padx 5 pady 5 fill} tk_menuBar .menu .menu.one .menu.two .menu.exit if { $use_plxframe == 1 } then { plxframe .plw pack append . .plw {left expand fill} } else { plframe .plwin pack append . .plwin {left expand fill} } } ############################################################################### # Set up the second toplevel proc open_child {} { global child_count use_plxframe set w .$child_count toplevel $w plstdwin $w if { $use_plxframe == 1 } then { set plwin $w.plw.plwin } else { set plwin $w.plwin } # Set up the second menubar and message widgets. frame $w.menu -relief raised -borderwidth 3 button $w.menu.three -text "Three" -command "plot2 $plwin" pack append $w.menu $w.menu.three {left expand fill} button $w.menu.four -text "Four" -command "plot3 $plwin" pack append $w.menu $w.menu.four {left expand fill} button $w.menu.exit -text "Dismiss" -command "destroy $w" pack append $w.menu $w.menu.exit {right expand fill} message $w.msg \ -font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \ -width 500 -borderwidth 1 \ -text "TK03: toplevel $child_count" pack append $w \ $w.menu {top fillx} \ $w.msg {top padx 5 pady 5 fill} tk_menuBar $w.menu $w.menu.three $w.menu.four # This creates the plframe "megawidget". If you just want a bare plframe, # change use_plxframe to 0. if { $use_plxframe == 1 } then { plxframe $w.plw pack append $w $w.plw {left expand fill} } else { plframe $w.plwin pack append $w $w.plwin {left expand fill} } incr child_count } ############################################################################### # Utility routines # Punch eject and hold onto your seat !!! proc quit a { exit } # Utility routine. proc dpos w { wm geometry $w +300+300 } ############################################################################### # Plotting routines ############################################################################### proc 1 {w} { global xscale yscale xoff yoff set xscale 6.0 set yscale 1.0 set xoff 0.0 set yoff 0.0 plot1 $w } proc 2 {w} { global xscale yscale xoff yoff set xscale 1.0 set yscale 0.0014 set xoff 0.0 set yoff 0.0185 $w cmd plsyax 5 plot1 $w } # This is supposed to work just like the plot1() in x01c.c proc plot1 {w} { global xscale yscale xoff yoff set npts 60 matrix x f $npts matrix y f $npts for {set i 0} {$i < $npts} {incr i} { x $i = [expr $xoff + $xscale * ($i + 1) / $npts] y $i = [expr $yoff + $yscale * pow([x $i],2)] } set xmax [x [expr $npts-1]] set ymax [y [expr $npts-1]] matrix x1 f 6 matrix y1 f 6 for {set i 0} {$i < 6} {incr i} { set j [expr $i*10+3] x1 $i = [x $j] y1 $i = [y $j] } $w cmd plcol0 1 $w cmd plenv $xoff $xmax $yoff $ymax 0 0 $w cmd plcol0 6 $w cmd pllab "(x)" "(y)" "#frPLplot Example 1 - y=x#u2" # plot the data points $w cmd plcol0 9 $w cmd plpoin 6 x1 y1 9 # draw the line through the data $w cmd plcol0 4 $w cmd plline $npts x y } # This is supposed to work just like the plot2() in x01c.c proc plot2 {w} { $w cmd plcol0 1 $w cmd plenv -2 10 -.4 1.2 0 1 $w cmd plcol0 2 $w cmd pllab "(x)" "sin(x)/x" "#frPLplot Example 1 - Sinc Function" # Fill up the array matrix x1 f 101 matrix y1 f 101 for {set i 0} {$i < 101} {incr i} { set x [expr ($i - 19.)/6.] x1 $i = $x y1 $i = 1 if {$x != 0} { y1 $i = [expr sin($x)/$x] } } $w cmd plcol0 3 $w cmd plline 101 x1 y1 } # This is supposed to work just like the plot3() in x01c.c proc plot3 {w} { $w cmd pladv $w cmd plvsta $w cmd plwind 0.0 360.0 -1.2 1.2 # Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. $w cmd plcol0 1 $w cmd plbox "bcnst" 60.0 2 "bcnstv" 0.2 2 # Superimpose a dashed line grid, with 1.5 mm marks and spaces. # plstyl expects two integer matrices for mark and space! matrix mark i 1 matrix space i 1 mark 0 = 1500 space 0 = 1500 $w cmd plstyl 1 mark space $w cmd plcol0 2 $w cmd plbox "g" 30.0 0 "g" 0.2 0 mark 0 = 0 space 0 = 0 $w cmd plstyl 0 mark space $w cmd plcol0 3 $w cmd pllab "Angle (degrees)" "sine" "#frPLplot Example 1 - Sine function" matrix x f 101 matrix y f 101 for {set i 0} {$i < 101} {incr i} { x $i = [expr 3.6 * $i] y $i = [expr sin([x $i] * 3.141592654 / 180.0)] } $w cmd plcol0 4 $w cmd plline 101 x y } ############################################################################### open_main plplot-5.10.0+dfsg/examples/tk/plgrid.in 755 1750 1750 34712276771565 170060ustar andrewandrew#!/bin/sh # Run plserver example for plgrid.tcl. N.B. must be run in ../tcl directory. @plserver_LOCATION@ < static int AppInit( Tcl_Interp *interp ); int mat_max( tclMatrix *pm, Tcl_Interp *interp, int argc, const char *argv[] ); int mat_min( tclMatrix *pm, Tcl_Interp *interp, int argc, const char *argv[] ); int mat_max( tclMatrix *pm, Tcl_Interp *interp, int PL_UNUSED( argc ), const char *PL_UNUSED( argv[] ) ) { PLFLT max = pm->fdata[0]; char res[30]; int i; for ( i = 1; i < pm->len; i++ ) if ( pm->fdata[i] > max ) max = pm->fdata[i]; sprintf( res, "%f", max ); Tcl_SetResult( interp, res, TCL_VOLATILE ); return TCL_OK; } int mat_min( tclMatrix *pm, Tcl_Interp *interp, int PL_UNUSED( argc ), const char *PL_UNUSED( argv[] ) ) { PLFLT min = pm->fdata[0]; char res[30]; int i; for ( i = 1; i < pm->len; i++ ) if ( pm->fdata[i] < min ) min = pm->fdata[i]; sprintf( res, "%f", min ); Tcl_SetResult( interp, res, TCL_VOLATILE ); return TCL_OK; } //-------------------------------------------------------------------------- // main -- // // Just a stub routine to call pltkMain. The latter is nice to have // when building extended wishes, since then you don't have to rely on // sucking the Tk main out of libtk (which doesn't work correctly on all // systems/compilers/linkers/etc). Hopefully in the future Tk will // supply a sufficiently capable tkMain() type function that can be used // instead. //-------------------------------------------------------------------------- int main( int argc, const char **argv ) { exit( pltkMain( argc, argv, NULL, AppInit ) ); } // //-------------------------------------------------------------------------- // // AppInit -- // // This procedure performs application-specific initialization. // Most applications, especially those that incorporate additional // packages, will have their own version of this procedure. // // Results: // Returns a standard Tcl completion code, and leaves an error // message in interp->result if an error occurs. // // Side effects: // Depends on the startup script. // // Taken from tkAppInit.c -- // // Copyright (c) 1993 The Regents of the University of California. // All rights reserved. // // Permission is hereby granted, without written agreement and without // license or royalty fees, to use, copy, modify, and distribute this // software and its documentation for any purpose, provided that the // above copyright notice and the following two paragraphs appear in // all copies of this software. // // IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR // DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT // OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF // CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS // ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO // PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. //-------------------------------------------------------------------------- // int get_dataCmd( ClientData, Tcl_Interp *, int, char ** ); static int AppInit( Tcl_Interp *interp ) { Tk_Window mainWindow = Tk_MainWindow( interp ); // // Call the init procedures for included packages. Each call should // look like this: // // if (Mod_Init(interp) == TCL_ERROR) { // return TCL_ERROR; // } // // where "Mod" is the name of the module. // if ( Pltk_Init( interp ) == TCL_ERROR ) { return TCL_ERROR; } // // Call Tcl_CreateCommand for application-specific commands, if // they weren't already created by the init procedures called above. // Tcl_CreateCommand( interp, "get_data", (Tcl_CmdProc *) get_dataCmd, (ClientData) mainWindow, (Tcl_CmdDeleteProc *) NULL ); Tcl_MatrixInstallXtnsn( "max", mat_max ); Tcl_MatrixInstallXtnsn( "min", mat_min ); return TCL_OK; } int get_dataCmd( ClientData PL_UNUSED( cd ), Tcl_Interp *interp, int PL_UNUSED( argc ), char **argv ) { tclMatrix *pm, *matPtr; int nx, ny, i, j; PLFLT pi = 3.1415927; int kx = 3, ky = 2; pm = Tcl_GetMatrixPtr( interp, argv[1] ); matPtr = pm; if ( pm->dim != 2 ) { Tcl_SetResult( interp, (char *) "must use 2-d matrix.", TCL_STATIC ); return TCL_ERROR; } nx = pm->n[0], ny = pm->n[1]; for ( i = 0; i < nx; i++ ) { for ( j = 0; j < ny; j++ ) { pm->fdata[I2D( i, j )] = sin( pi * kx * i / 64 ) * sin( pi * ky * j / 64 ); } } return TCL_OK; } plplot-5.10.0+dfsg/examples/tk/tk01.in 755 1750 1750 717312276771565 163300ustar andrewandrew#!@xtk01_LOCATION@ -f # -*-tcl-*- # $Id: tk01.in 13008 2014-02-12 22:19:33Z airwin $ # # Geoffrey Furnish # 11 April 1994 # # @> A script for using Tk to control xtk01 ############################################################################### wm title . "x01c -- TK version" plstdwin . # If you just want a bare plframe, set this to 0. set use_plxframe 1 if { $use_plxframe == 1 } then { set plwin .plw.plwin } else { set plwin .plwin } ############################################################################### # Set up the menubar and message widgets. frame .menu -relief raised -borderwidth 3 button .menu.one -text "One" -command "myplot 1" pack append .menu .menu.one {left expand fill} button .menu.two -text "Two" -command "myplot 2" pack append .menu .menu.two {left expand fill} button .menu.three -text "Three" -command "myplot 3" pack append .menu .menu.three {left expand fill} button .menu.four -text "Four" -command "myplot 4" pack append .menu .menu.four {left expand fill} button .menu.exit -text "Exit" -command "quit 0" pack append .menu .menu.exit {right expand fill} message .msg \ -font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \ -width 500 -borderwidth 1 \ -text "TK01: Control x01c from TK" pack append . \ .menu {top fillx} \ .msg {top padx 5 pady 5 fill} tk_menuBar .menu .menu.one .menu.two .menu.three .menu.four .menu.exit ############################################################################### if { $use_plxframe == 1 } then { plxframe .plw pack append . .plw {left expand fill} } else { plframe .plwin pack append . .plwin {left expand fill} } bind $plwin L locate_on bind $plwin locate_off bind $plwin rband_on bind $plwin rband_off proc rband_on {} { global plwin $plwin configure -rubberband 1 } proc rband_off {} { global plwin $plwin configure -rubberband 0 } ############################################################################### # Definitions of procedures used in this script. # Punch eject and hold onto your seat !!! proc quit a { exit } # Utility routine. proc dpos w { wm geometry $w +300+300 } ############################################################################### # Here is a binding which allows you to obtain the world coordinates of a # point or points through invoking a "Locate" mode. You could instead just # turn it on somewhere in the script and leave it on if you prefer modeless # behavior, although you can sometimes get into trouble if you move the # crosshairs while a graphic draw is being performed (X is not forced to # handle these events serially -- the crosshairs may be updated before the # graphic draw is complete, and if the graphic draw then obscures the # crosshairs it will leave traces of the crosshairs on the plot when you # next move them). Note especially that in the body of this example # "get_coords" proc, you can do anything you can do from Tcl. In # particular, you need not put the data out to stdout (which is pretty # boring). Instead, you can use this to feed the world coords to some more # complicated Tcl proc of your choosing. Use the regexp parser to pull out # the world x and y coordinates, etc. Have fun! proc locate_on {} { global plwin $plwin configure -xhairs 1 bind $plwin { get_coords %x %y } } proc locate_off {} { global plwin $plwin configure -xhairs 0 bind $plwin {} } proc get_coords {x y} { global plwin puts "world coordinates: [$plwin report wc $x $y]" } ############################################################################### plplot-5.10.0+dfsg/examples/tk/tk02.in 755 1750 1750 1020312276771565 163350ustar andrewandrew#!@xtk02_LOCATION@ -f # -*-tcl-*- # $Id: tk02.in 13008 2014-02-12 22:19:33Z airwin $ # # Geoffrey Furnish # 11 April 1994 # # @> A script for using Tk to control xtk01, using the PLplot itcl interface. ############################################################################### package require Pltk eval package require $pl_itk_package_name wm title . "x01c -- TK version" plstdwin . ############################################################################### # Set up the menubar and message widgets. frame .menu -relief raised -borderwidth 3 button .menu.one -text "One" -command "myplot1" pack append .menu .menu.one {left expand fill} button .menu.two -text "Two" -command "myplot 2" pack append .menu .menu.two {left expand fill} button .menu.three -text "Three" -command "plot2" pack append .menu .menu.three {left expand fill} button .menu.four -text "Four" -command "myplot 4" pack append .menu .menu.four {left expand fill} button .menu.five -text "Five" -command "gumbyplot" pack append .menu .menu.five {left expand fill} button .menu.six -text "Six" -command "snoopy" pack .menu.six -side left -expand 1 -fill x button .menu.exit -text "Exit" -command "quit 0" pack append .menu .menu.exit {right expand fill} message .msg \ -font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \ -width 500 -borderwidth 1 \ -text "TK02: Demo \[incr Tcl\] interface to PLplot" #PLXWin .plw Pltkwin .plw pack append . .menu {top fillx} \ .msg {top padx 5 pady 5 fill} \ .plw {bottom expand fill} update tk_menuBar .menu .menu.one .menu.two .menu.three .menu.four .menu.exit ############################################################################### # Definitions of procedures used in this script. proc myplot1 {} { global xscale yscale xoff yoff set xscale 6 set yscale 1 set xoff 0 set yoff 0 plot1 } # This is supposed to work just like the plot1() in x01c.c/xtk02.c proc plot1 {} { global xscale yscale xoff yoff matrix x1 float 10 matrix y1 float 10 for {set i 2; set n1 0} {$i < 60} {incr i 10; incr n1} { set x [expr $xoff + $xscale * ($i + 1) / 60] x1 $n1 = $x y1 $n1 = [expr $yoff + $yscale * pow($x,2)] } set n2 60 matrix x2 float $n2 matrix y2 float $n2 for {set i 0} {$i < $n2} {incr i} { set x [expr $xoff + $xscale * ($i + 1) / $n2] x2 $i = $x y2 $i = [expr $yoff + $yscale * pow($x,2)] } set xmax [x2 [expr $n2-1]] set ymax [y2 [expr $n2-1]] .plw plcol0 1 .plw plenv $xoff $xmax $yoff $ymax 0 0 .plw plcol0 6 .plw pllab "(x)" "(y)" "#frPLPLOT Example 1 - y=x#u2" # plot the data points .plw plcol0 9 .plw plpoin $n1 x1 y1 9 # plot the data points .plw plcol0 4 .plw plline $n2 x2 y2 } # This is supposed to work just like the plot2() in x01c.c/xtk02.c proc plot2 {} { .plw plcol0 1 .plw plenv -2 10 -.4 1.2 0 1 .plw plcol0 2 .plw pllab "(x)" "sin(x)/x" "#frPLPLOT Example 1 - Sinc Function" # Fill up the array matrix x1 float 101 matrix y1 float 101 for {set i 0} {$i < 101} {incr i} { set x [expr ($i - 19.)/6.] x1 $i = $x y1 $i = 1 if {$x != 0} { y1 $i = [expr sin($x)/$x] } } .plw plcol0 3 .plw plline 101 x1 y1 } proc gumbyplot {} { .plw plcol0 1 .plw plenv 0 1 0 1 0 0 .plw plcol0 6 .plw pllab "(x)" "(y)" "#frPLplot Example 1 - y=1-2x+2x#u2" matrix x1 float 101 matrix y1 float 101 for {set i 0} {$i < 101} {incr i} { set x [expr $i * .01] x1 $i = $x y1 $i = [expr 1 - 2 * $x + 2 * $x * $x] } .plw plline 101 x1 y1 } # This proc shows off the use of a matrix extension subcommand. proc snoopy {} { matrix x float 101 matrix y float 101 for {set i 0} {$i < 101} {incr i} { set xx [expr $i * .01] x $i = $xx } y stuff .plw plcol0 1 .plw plenv 0 1 0 1 0 0 .plw plcol0 6 .plw pllab "(x)" "(y)" "#frDemo of Matrix extension subcommand" .plw plline 101 x y } # Punch eject and hold onto your seat !!! proc quit a { exit } # Utility routine. proc dpos w { wm geometry $w +300+300 } ############################################################################### plplot-5.10.0+dfsg/examples/tk/tkdemos.tcl 644 1750 1750 563112244002300 173260ustar andrewandrew#---------------------------------------------------------------------------- # $Id: tkdemos.tcl 12743 2013-11-23 01:28:32Z airwin $ # # PLplot TK demos # # Maurice LeBrun # IFS, University of Texas at Austin # 26-Jan-1995 # # To plot these, start up plserver. Type "source tkdemos.tcl", at which # point a plframe extended widget is created. Then type "1" for the first # demo, "2" for the second, and so on. # # Note: each demo proc is supplied a widget argument if run from a widget, # or "loopback" if being run from pltcl. In the latter case, the # "loopback cmd" does nothing, but is required two make the two styles of # Tcl scripts compatible. #---------------------------------------------------------------------------- proc sourceUtf8 {sourceFile} { if { [encoding system] != "utf-8" } { if { [package vsatisfies [info patch] 8.5] } { source -encoding utf-8 $sourceFile } else { # # Pre-Tcl 8.5 # set infile [open $sourceFile] set contents [read $infile] close $infile eval [encoding convertfrom utf-8 \ [encoding convertto [encoding system] $contents]] } } else { source $sourceFile } } set utf8_examples {4 18 24 26 33} # In order to distinguish whether this is a plserver or wish # environment we assume that [info nameofexecutable] has the string # "plserver", "wish" or "tclsh" in it. Some contrived examples can be # figured out where this assumption is not correct, and for those # cases we simply emit an error message and return. But normally this # assumption is correct, and it is certainly correct for our tests. switch -glob -- [info nameofexecutable] { "*plserver*" { # use 'plserver' method plstdwin . plxframe .plw set plwin .plw.plwin } "*wish*" - "*tclsh*" { # use 'wish" method (size of the window is determined by plstdwin) plstdwin . plframe .plw set plwin .plw } default { puts stderr "Error: argv0 = \"$argv0\"\ndoes not contain either the substrings \"plserver\", \"tclsh\", or \"wish\"" puts stderr "Therefore cannot decide how to proceed with tkdemos.tcl so giving up" return } } puts "append ..." pack append . .plw {left expand fill} for {set i 0} {$i <= 33} {incr i} { puts "$i ..." if {$i != 32} { set demo x[format "%02d" $i] # # If the source code contains UTF-8 characters (beyond the # ASCII-7 encoding), take special measures # if { [lsearch $utf8_examples $i] < 0 } { source $demo.tcl } else { sourceUtf8 $demo.tcl } proc $i {} " global plwin $demo $plwin $plwin cmd plcol0 1 $plwin cmd plsori 0 $plwin cmd plspal0 cmap0_default.pal $plwin cmd plspal1 cmap1_default.pal 1 $plwin cmd plstransform NULL " } } plplot-5.10.0+dfsg/examples/f95/ 775 1750 1750 012406243570 150765ustar andrewandrewplplot-5.10.0+dfsg/examples/f95/x03f.f90 644 1750 1750 551711666357550 162770ustar andrewandrew! $Id: x03f.f90 12094 2011-12-03 08:35:52Z andrewross $ ! Generates polar plot with, 1-1 scaling ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x03f95 use plplot, PI => PL_PI use plf95demolib implicit none character (len=3) :: text real(kind=plflt), dimension(0:360) :: x0, y0, x, y real(kind=plflt) :: dtr, theta, dx, dy, offset integer :: i ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Set orientation to portrait - note not all device drivers ! support this, in particular most interactive drivers do not. call plsori(1) dtr = PI/180.0_plflt x0 = cos(dtr * arange(0,361)) y0 = sin(dtr * arange(0,361)) ! Initialize PLplot call plinit() ! Set up viewport and window, but do not draw box call plenv(-1.3_plflt, 1.3_plflt, -1.3_plflt, 1.3_plflt, 1, -2) ! Draw circles for polar grid do i = 1,10 call plarc(0.0_plflt, 0.0_plflt, 0.1_plflt*i, 0.1_plflt*i, & 0.0_plflt, 360.0_plflt, 0.0_plflt, 0) enddo call plcol0(2) do i = 0,11 theta = 30.0_plflt*i dx = cos(dtr*theta) dy = sin(dtr*theta) ! Draw radial spokes for polar grid call pljoin(0.0_plflt, 0.0_plflt, dx, dy) write (text,'(i3)') nint(theta) ! Write labels for angle text = adjustl(text) if (theta .lt. 9.99) then offset = 0.45 elseif (theta .lt. 99.9) then offset = 0.30 else offset = 0.15 endif ! Slightly off zero to avoid floating point logic flips at ! 90 and 270 deg. if (dx >= -0.00001_plflt) then call plptex(dx, dy, dx, dy, -offset, text) else call plptex(dx, dy, -dx, -dy, 1._plflt+offset, text) end if enddo ! Draw the graph x = x0 * sin(5.0_plflt * dtr * arange(0,361)) y = y0 * sin(5.0_plflt * dtr * arange(0,361)) call plcol0(3) call plline(x,y) call plcol0(4) call plmtex('t', 2.0_plflt, 0.5_plflt, 0.5_plflt, & '#frPLplot Example 3 - r(#gh)=sin 5#gh') ! Close the plot at end call plend end program x03f95 plplot-5.10.0+dfsg/examples/f95/x14f.f90 644 1750 1750 3067411647656237 163260ustar andrewandrew! $Id: x14f.f90 11984 2011-10-19 23:26:23Z andrewross $ ! Demo of multiple stream/window capability ! ! Copyright (C) 2004 Arjen Markus ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! Plots several simple functions from other example programs. ! ! This version sends the output of the first 4 plots (one page) to two ! independent streams. use plplot implicit none integer digmax character(len=80) :: driver character(len=15) :: geometry_master character(len=15) :: geometry_slave integer :: fam, num, bmax real(kind=plflt), dimension(101) :: x, y real(kind=plflt), dimension(6) :: xs, ys real(kind=plflt) :: xscale, yscale, xoff, yoff common /plotdat/ x, y, xs, ys, xscale, yscale, xoff, yoff real(kind=plflt) :: xp0, yp0 integer :: xleng0, yleng0, xoff0, yoff0 logical :: valid_geometry geometry_master = '500x410+100+200' geometry_slave = '500x410+650+200' ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! If valid geometry specified on command line, use it for both streams. call plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) valid_geometry = (xleng0 .gt. 0 .and. yleng0 .gt. 0) ! Set up first stream if(valid_geometry) then call plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) else call plsetopt( 'geometry', geometry_master) endif call plssub(2, 2) call plinit() call plgdev(driver) call plgfam(fam,num,bmax) write(6,'(3A)') 'Demo of multiple output streams via the ', & trim(driver), ' driver.' write(6,'(A)') 'Running with the second stream as slave '// & 'to the first.' write(6,*) ! flush unit 6 so this part of stdout is guaranteed to be written prior ! to stdout generated by second plinit below. call flush(6) ! Start next stream call plsstrm(1) if(valid_geometry) then call plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) else call plsetopt( 'geometry', geometry_slave) endif ! Turn off pause to make this a slave (must follow master) call plspause(.false.) call plsdev(driver) call plsfam(fam,num,bmax) call plsetopt('fflen','2') call plinit() ! Set up the data & plot ! Original case call plsstrm(0) xscale = 6._plflt yscale = 1._plflt xoff = 0._plflt yoff = 0._plflt call plot1() ! Set up the data & plot xscale = 1._plflt yscale = 1.d+6 call plot1() ! Set up the data & plot xscale = 1._plflt yscale = 1.d-6 digmax = 2 call plsyax(digmax, 0) call plot1() ! Set up the data & plot xscale = 1._plflt yscale = 0.0014_plflt yoff = 0.0185_plflt digmax = 5 call plsyax(digmax, 0) call plot1() ! To slave ! The pleop() ensures the eop indicator gets lit. call plsstrm(1) call plot4() call pleop() ! Back to master call plsstrm(0) call plot2() call plot3() ! To slave call plsstrm(1) call plot5() call pleop() ! Back to master to wait for user to advance call plsstrm(0) call pleop() ! Call plend to finish off. call plend() end !====================================================================== subroutine plot1() use plplot implicit none real(kind=plflt), dimension(101) :: x, y real(kind=plflt), dimension(6) :: xs, ys real(kind=plflt) :: xscale, yscale, xoff, yoff, xmin, xmax, ymin, ymax integer :: i common /plotdat/ x, y, xs, ys, xscale, yscale, xoff, yoff do i = 1, 60 x(i) = xoff + xscale * dble(i)/60.0_plflt y(i) = yoff + yscale * x(i)**2 enddo xmin = x(1) xmax = x(60) ymin = y(1) ymax = y(60) do i = 1, 6 xs(i) = x((i-1)*10+4) ys(i) = y((i-1)*10+4) enddo ! Set up the viewport and window using PLENV. The range in X is ! 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are ! scaled separately (just = 0), and we just draw a labelled ! box (axis = 0). call plcol0(1) call plenv( xmin, xmax, ymin, ymax, 0, 0 ) call plcol0(6) call pllab( '(x)', '(y)', '#frPLplot Example 1 - y=x#u2' ) ! Plot the data points call plcol0(9) call plpoin(xs, ys, 9) ! Draw the line through the data call plcol0(4) call plline(x(:60), y(:60)) call plflush end !====================================================================== subroutine plot2() use plplot implicit none real(kind=plflt), dimension(101) :: x, y real(kind=plflt), dimension(6) :: xs, ys real(kind=plflt) :: xscale, yscale, xoff, yoff integer :: i common /plotdat/ x, y, xs, ys, xscale, yscale, xoff, yoff !====================================================================== ! ! Set up the viewport and window using PLENV. The range in X is ! -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are ! scaled separately (just = 0), and we draw a box with axes ! (axis = 1). call plcol0(1) call plenv(-2.0_plflt, 10.0_plflt, -0.4_plflt, 1.2_plflt, 0, 1 ) call plcol0(2) call pllab( '(x)', 'sin(x)/x', & '#frPLplot Example 1 - Sinc Function' ) ! Fill up the arrays do i = 1, 100 x(i) = (i-20.0_plflt)/6.0_plflt y(i) = 1.0_plflt if (x(i) .ne. 0.0_plflt) y(i) = sin(x(i)) / x(i) enddo ! Draw the line call plcol0(3) call plline(x(:100), y(:100)) call plflush end !====================================================================== subroutine plot3() ! ! For the final graph we wish to override the default tick intervals, ! and so do not use_ PLENV use plplot, PI => PL_PI implicit none real(kind=plflt), dimension(101) :: x, y real(kind=plflt), dimension(6) :: xs, ys real(kind=plflt) :: xscale, yscale, xoff, yoff integer :: i common /plotdat/ x, y, xs, ys, xscale, yscale, xoff, yoff call pladv(0) ! Use_ standard viewport, and define X range from 0 to 360 degrees, ! Y range from -1.2 to 1.2. call plvsta() call plwind( 0.0_plflt, 360.0_plflt, -1.2_plflt, 1.2_plflt ) ! Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. call plcol0(1) call plbox( 'bcnst', 60.0_plflt, 2, 'bcnstv', 0.2_plflt, 2 ) ! Superimpose a dashed line grid, with 1.5 mm marks and spaces. With ! only a single mark and space element, we do not need arrays call plstyl( 1, 1500, 1500 ) call plcol0(2) call plbox( 'g', 30.0_plflt, 0, 'g', 0.2_plflt, 0 ) call plstyl( 0, 0, 0 ) call plcol0(3) call pllab( 'Angle (degrees)', 'sine', & '#frPLplot Example 1 - Sine function' ) do i = 1, 101 x(i) = 3.6_plflt * (i-1) y(i) = sin( x(i) * PI/180.0_plflt ) enddo call plcol0(4) call plline(x, y) call plflush end !====================================================================== subroutine plot4() use plplot, PI => PL_PI implicit none character(len=3) :: text real(kind=plflt), dimension(0:360) :: x0, y0, x, y real(kind=plflt) :: dtr, theta, dx, dy, r integer :: i, j, nsp dtr = PI/180.0_plflt do i=0,360 x0(i) = cos(dtr * dble (i)) y0(i) = sin(dtr * dble (i)) enddo ! Set up viewport and window, but do not draw box call plenv(-1.3_plflt, 1.3_plflt, -1.3_plflt, 1.3_plflt, 1, -2) do i = 1,10 do j = 0,360 x(j) = 0.1_plflt*i*x0(j) y(j) = 0.1_plflt*i*y0(j) enddo ! Draw circles for polar grid call plline(x,y) enddo call plcol0(2) do i = 0,11 theta = 30.0_plflt*i dx = cos(dtr*theta) dy = sin(dtr*theta) ! Draw radial spokes for polar grid call pljoin(0.0_plflt, 0.0_plflt, dx, dy) write (text,'(i3)') nint(theta) ! Write labels for angle text = text(nsp(text):) ! Slightly off zero to avoid floating point logic flips at ! 90 and 270 deg. if (dx.ge.-0.00001_plflt) then call plptex(dx, dy, dx, dy, -0.15_plflt, text) else call plptex(dx, dy, -dx, -dy, 1.15_plflt, text) end if enddo ! Draw the graph do i=0,360 r = sin(dtr*dble (5*i)) x(i) = x0(i) * r y(i) = y0(i) * r enddo call plcol0(3) call plline(x,y) call plcol0(4) call plmtex('t', 2.0_plflt, 0.5_plflt, 0.5_plflt, & '#frPLplot Example 3 - r(#gh)=sin 5#gh') ! Flush the plot at end call plflush end !====================================================================== integer function nsp(text) ! ================== ! Find first non-space character use plplot implicit none character*(*) text integer l, len l = len(text) nsp = 1 do while(text(nsp:nsp).eq.' ' .and. nsp.lt.l) nsp = nsp+1 enddo end !====================================================================== subroutine plot5() use plplot, PI => PL_PI implicit none integer :: i, j, nptsx, nptsy, xdim, ydim ! xdim and ydim are the absolute static dimensions. ! nptsx, and nptsy are the (potentially dynamic) defined area of the 2D ! arrays that is actually used. parameter (xdim=99, ydim=100, nptsx=35,nptsy=46) real(kind=plflt), dimension(xdim,ydim) :: z, w, xg2, yg2 real(kind=plflt), dimension(11) :: clevel real(kind=plflt), dimension(xdim) :: xg1 real(kind=plflt), dimension(ydim) :: yg1 real(kind=plflt) :: xx, yy, argx, argy, distort real(kind=plflt), dimension(6) :: tr data clevel /-1._plflt, -0.8_plflt, -0.6_plflt, -0.4_plflt, & -0.2_plflt, & 0._plflt, 0.2_plflt, 0.4_plflt, 0.6_plflt ,0.8_plflt, 1._plflt/ tr(1) = 2._plflt/dble(nptsx-1) tr(2) = 0.0_plflt tr(3) = -1.0_plflt tr(4) = 0.0_plflt tr(5) = 2._plflt/dble(nptsy-1) tr(6) = -1.0_plflt ! Calculate the data matrices. do i=1,nptsx xx = dble(i-1-(nptsx/2))/dble (nptsx/2) do j=1,nptsy yy = dble(j-1-(nptsy/2))/dble (nptsy/2) - 1.0_plflt z(i,j) = xx*xx - yy*yy w(i,j) = 2._plflt*xx*yy enddo enddo ! Build the 1-d coord arrays. distort = 0.4_plflt do i=1,nptsx xx = -1._plflt + dble(i-1)*2._plflt/dble(nptsx-1) xg1(i) = xx + distort*cos(0.5_plflt*PI*xx) enddo do j=1,nptsy yy = -1._plflt + dble(j-1)*2._plflt/dble(nptsy-1) yg1(j) = yy - distort*cos(0.5_plflt*PI*yy) enddo ! Build the 2-d coord arrays. do i=1,nptsx xx = -1._plflt + dble(i-1)*2._plflt/dble(nptsx-1) argx = 0.5_plflt*PI*xx do j=1,nptsy yy = -1._plflt + dble(j-1)*2._plflt/dble(nptsy-1) argy = 0.5_plflt*PI*yy xg2(i,j) = xx + distort*cos(argx)*cos(argy) yg2(i,j) = yy - distort*cos(argx)*cos(argy) enddo enddo ! Plot using identity transform call plenv(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt, 0, 0) call plcol0(2) call plcont(z,1,nptsx,1,nptsy,clevel,tr) call plstyl(1,1500,1500) call plcol0(3) call plcont(w,1,nptsx,1,nptsy,clevel,tr) call plstyl(0,1500,1500) call plcol0(1) call pllab('X Coordinate', 'Y Coordinate', & 'Streamlines of flow') call plflush end plplot-5.10.0+dfsg/examples/f95/test_plf95demolib.f90 644 1750 1750 302311654172466 210350ustar andrewandrew! test_plf95demolib.f90 -- ! Test program for the auxiliary functions ! program test_plf95demolib use plf95demolib real, dimension(10) :: value integer :: i integer, dimension(4) :: start = (/ 0, 0, 1, 2 /), & stop = (/ 10, 10, 11, 22 /), & step = (/ 1, 2, 1, 2 /), & expected_size = & (/ 10, 5, 10, 10 /) integer :: sz ! Function arange: ! - Check the length of the returned array ! - Check the values ! do i = 1,size(start) sz = size( arange( start(i), stop(i), step(i) ) ) if ( sz /= expected_size(i) ) then write(*,*) 'Expected:', expected_size(i), ' - got: ', sz else value(1:sz) = arange( start(i), stop(i), step(i) ) write(*,*) value(1:sz) if ( any( value(1:sz) < start(i) ) ) then write(*,*) 'Minimum value too low: ', minval(value(1:sz)), ' - expected: ', start(i) endif if ( any( value(1:sz) >= stop(i) ) ) then write(*,*) 'Maximum value too high: ', maxval(value(1:sz)), ' - should be below: ', stop(i) endif if ( any( value(2:sz) - value(1:sz-1) /= step(i) ) ) then write(*,*) 'Difference in subsequent values incorrect: ', value(1:sz), ' - expected difference:', step(i) endif endif enddo end program plplot-5.10.0+dfsg/examples/f95/x29f.f90 644 1750 1750 3010511647561016 163070ustar andrewandrew! $Id: x29f.f90 11977 2011-10-19 14:43:26Z andrewross $ ! ! Sample plots using date / time formatting for axes ! ! Copyright (C) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! program x29f95 use plplot implicit none real(kind=plflt), dimension(365) :: x, y, xerr1, xerr2, yerr1, yerr2 common /plotdat/ x, y, xerr1, xerr2, yerr1, yerr2 call plparseopts(PL_PARSE_FULL) call plinit() ! This is the ASCII value for character @ call plsesc(64) call plot1() call plot2() call plot3() call plot4() call plend() end program x29f95 !==================================================================== ! ! Plot a model diurnal cycle of temperature subroutine plot1() use plplot, PI => PL_PI implicit none real(kind=plflt), dimension(365) :: x, y, xerr1, xerr2, yerr1, yerr2 common /plotdat/ x, y, xerr1, xerr2, yerr1, yerr2 integer :: i, npts real(kind=plflt) :: xmin, xmax, ymin, ymax parameter(npts = 73) parameter(xmin = 0.0_plflt) parameter(xmax = 60.0_plflt*60.0_plflt*24.0_plflt) parameter(ymin = 10.0_plflt) parameter(ymax = 20.0_plflt) do i = 1,npts x(i) = xmax*(dble(i-1)/dble(npts)) y(i) = 15.0_plflt - 5.0_plflt*cos(2.0_plflt*PI*dble(i-1)/dble(npts)) ! Set x error bars to +/- 5 minute xerr1(i) = x(i)-60.0_plflt*5.0_plflt xerr2(i) = x(i)+60.0_plflt*5.0_plflt ! Set y error bars to +/- 0.1 deg C yerr1(i) = y(i)-0.1_plflt yerr2(i) = y(i)+0.1_plflt enddo call pladv(0) ! Rescale major ticks marks by 0.5 call plsmaj(0.0_plflt,0.5_plflt) ! Rescale minor ticks and error bar marks by 0.5 call plsmin(0.0_plflt,0.5_plflt) call plvsta() call plwind(xmin, xmax, ymin, ymax) ! Draw a box with ticks spaced every 3 hour in X and 1 degree C in Y. call plcol0(1) ! Set time format to be hours:minutes call pltimefmt("%H:%M") call plbox("bcnstd", 3.0_plflt*60.0_plflt*60.0_plflt, 3, "bcnstv", & 1.0_plflt, 5) call plcol0(3) call pllab("Time (hours:mins)", "Temperature (degC)", & "@frPLplot Example 29 - Daily temperature") call plcol0(4) call plline(x(1:npts), y(1:npts)) call plcol0(2) call plerrx(xerr1(1:npts), xerr2(1:npts), y(1:npts)) call plcol0(3) call plerry(x(1:npts), yerr1(1:npts), yerr2(1:npts)) ! Rescale major / minor tick marks back to default call plsmin(0.0_plflt,1.0_plflt) call plsmaj(0.0_plflt,1.0_plflt) end subroutine plot1 ! ! Plot the number of hours of daylight as a function of day for a year ! subroutine plot2() use plplot, PI => PL_PI implicit none integer :: j, npts real(kind=plflt) :: xmin, xmax, ymin, ymax real(kind=plflt) :: lat, p, d real(kind=plflt), dimension(365) :: x, y, xerr1, xerr2, yerr1, yerr2 common /plotdat/ x, y, xerr1, xerr2, yerr1, yerr2 ! Latitude for London parameter (lat = 51.5_plflt) parameter (npts = 365) parameter(xmin = 0.0_plflt) parameter(xmax = npts*60.0_plflt*60.0_plflt*24.0_plflt) parameter(ymin = 0) parameter(ymax = 24) ! Formula for hours of daylight from ! "A Model Comparison for Daylength as a Function of Latitude and ! Day of the Year", 1995, Ecological Modelling, 80, pp 87-95. do j=1,npts x(j) = (j-1)*60.0_plflt*60.0_plflt*24.0_plflt p = asin(0.39795_plflt*cos(0.2163108_plflt + 2.0_plflt* & atan(0.9671396_plflt*tan(0.00860_plflt*(j-187))))) d = 24.0_plflt - (24.0_plflt/PI)* & acos( (sin(0.8333_plflt*PI/180.0_plflt) + & sin(lat*PI/180.0_plflt)*sin(p)) / (cos(lat*PI/180.0_plflt)* & cos(p)) ) y(j) = d enddo call plcol0(1) ! Set time format to be abbreviated month name followed by day of month call pltimefmt("%b %d") call plprec(1,1) call plenv(xmin, xmax, ymin, ymax, 0, 40) call plcol0(3) call pllab("Date", "Hours of daylight", & "@frPLplot Example 29 - Hours of daylight at 51.5N") call plcol0(4) call plline(x, y) call plprec(0,0) end subroutine plot2 ! ! ! subroutine plot3() use plplot, PI => PL_PI implicit none integer :: i, npts real(kind=plflt) :: xmin, xmax, ymin, ymax integer :: tstart ! real(kind=plflt) :: toff real(kind=plflt), dimension(365) :: x, y, xerr1, xerr2, yerr1, yerr2 common /plotdat/ x, y, xerr1, xerr2, yerr1, yerr2 ! integer tm(9) parameter (npts = 62) ! number of seconds elapsed since the Unix epoch (1970-01-01, UTC) for ! 2005-12-01, UTC. This is the same result as the Python ! calendar.timegm((2005,12,1,0,0,0)) result or the Linux C timegm ! result corresponding to 2005-12-01. tstart = 1133395200 xmin = dble(tstart) xmax = xmin + npts*60.0_plflt*60.0_plflt*24.0_plflt ymin = 0.0_plflt ymax = 5.0_plflt do i=1,npts x(i) = xmin + dble(i-1)*60.0_plflt*60.0_plflt*24.0_plflt y(i) = 1.0_plflt + sin( 2.0_plflt*PI*dble(i-1)/7.0_plflt) + & exp( dble(min(i-1,npts+1-i)) / 31.0_plflt) enddo call pladv(0) call plvsta() call plwind(xmin, xmax, ymin, ymax) call plcol0(1) ! Set time format to be ISO 8601 standard YYYY-MM-DD. Note that this is ! equivalent to %f for C99 compliant implementations of strftime. call pltimefmt("%Y-%m-%d") ! Draw a box with ticks spaced every 14 days in X and 1 hour in Y. call plbox("bcnstd", 14.0_plflt*24.0_plflt*60.0_plflt*60.0_plflt,14, & "bcnstv", 1.0_plflt, 4) call plcol0(3) call pllab("Date", "Hours of television watched", & "@frPLplot Example 29 - Hours of television watched in " // & "Dec 2005 / Jan 2006") call plcol0(4) call plssym(0.0_plflt, 0.5_plflt) call plpoin(x(1:npts), y(1:npts), 2) call plline(x(1:npts), y(1:npts)) end subroutine plot3 ! ! ! subroutine plot4() use plplot, PI => PL_PI implicit none ! TAI-UTC (seconds) as a function of time. ! Use Besselian epochs as the continuous time interval just to prove ! this does not introduce any issues. real(kind=plflt) :: scale, offset1, offset2 real(kind=plflt) :: xmin, xmax, ymin, ymax, xlabel_step integer :: k, npts = 0, i logical :: if_TAI_time_format = .false. character(len=10) :: time_format character(len=100) :: title_suffix character(len=100) :: xtitle character(len=100) :: title real(kind=plflt) :: x(1001), y(1001) integer :: tai_year, tai_month, tai_day, tai_hour, tai_min real(kind=plflt) :: tai_sec, tai integer :: utc_year, utc_month, utc_day, utc_hour, utc_min real(kind=plflt) :: utc_sec, utc ! Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch ! B = 1900. + (JD -2415020.31352)/365.242198781 ! ==> (as calculated with aid of "bc -l" command) ! B = (MJD + 678940.364163900)/365.242198781 ! ==> ! MJD = B*365.24219878 - 678940.364163900 scale = 365.242198781_plflt offset1 = -678940.0_plflt offset2 = -0.3641639_plflt call plconfigtime(scale, offset1, offset2, 0, 0, 0, 0, 0, 0, & 0, 0._plflt) do k = 0,6 if (k .eq. 0) then call plctime(1950,0,2,0,0,0.,xmin) call plctime(2020,0,2,0,0,0.,xmax) npts = 70*12 + 1 ymin = 0.0_plflt ymax = 36.0_plflt time_format="%Y%" if_TAI_time_format = .true. title_suffix = "from 1950 to 2020" xtitle = "Year" xlabel_step = 10.0_plflt elseif ((k .eq. 1) .or. (k .eq. 2)) then call plctime(1961,7,1,0,0,1.64757_plflt-.20_plflt, xmin) call plctime(1961,7,1,0,0,1.64757_plflt+.20_plflt, xmax) npts = 1001 ymin = 1.625_plflt ymax = 1.725_plflt time_format = "%S%2%" title_suffix = "near 1961-08-01 (TAI)" xlabel_step = 0.05_plflt/(scale*86400.0_plflt) if (k .eq. 1) then if_TAI_time_format = .true. xtitle = "Seconds (TAI)" else if_TAI_time_format = .false. xtitle = "Seconds (TAI) labelled with corresponding UTC" endif elseif ((k .eq. 3) .or. (k .eq. 4)) then call plctime(1963,10,1,0,0,2.6972788_plflt-.20_plflt, xmin) call plctime(1963,10,1,0,0,2.6972788_plflt+.20_plflt, xmax) npts = 1001 ymin = 2.55_plflt ymax = 2.75_plflt time_format = "%S%2%" title_suffix = "near 1963-11-01 (TAI)" xlabel_step = 0.05_plflt/(scale*86400.0_plflt) if (k .eq. 3) then if_TAI_time_format = .true. xtitle = "Seconds (TAI)" else if_TAI_time_format = .false. xtitle = "Seconds (TAI) labelled with corresponding UTC" endif elseif ((k .eq. 5) .or. (k .eq. 6)) then call plctime(2009,0,1,0,0,34._plflt-5._plflt,xmin) call plctime(2009,0,1,0,0,34._plflt+5._plflt,xmax) npts = 1001 ymin = 32.5_plflt ymax = 34.5_plflt time_format = "%S%2%" title_suffix = "near 2009-01-01 (TAI)" xlabel_step = 1._plflt/(scale*86400._plflt) if (k .eq. 5) then if_TAI_time_format = .true. xtitle = "Seconds (TAI)" else if_TAI_time_format = .false. xtitle = "Seconds (TAI) labelled with corresponding UTC" endif endif do i=0,npts-1 x(i+1) = xmin + i*(xmax-xmin)/(dble(npts-1)) call plconfigtime(scale, offset1, offset2, 0, 0, 0, 0, 0, & 0, 0, 0._plflt) tai = x(i+1) call plbtime(tai_year, tai_month, tai_day, tai_hour, & tai_min, tai_sec, tai) call plconfigtime(scale, offset1, offset2, 2, 0, 0, 0, & 0, 0, 0, 0._plflt) call plbtime(utc_year, utc_month, utc_day, utc_hour, & utc_min, utc_sec, tai) call plconfigtime(scale, offset1, offset2, 0, 0, 0, 0, & 0, 0, 0, 0._plflt) call plctime(utc_year, utc_month, utc_day, utc_hour, & utc_min, utc_sec, utc) y(i+1)=(tai-utc)*scale*86400._plflt enddo call pladv(0) call plvsta() call plwind(xmin, xmax, ymin, ymax) call plcol0(1) if (if_TAI_time_format) then call plconfigtime(scale, offset1, offset2, 0, 0, 0, 0, & 0, 0, 0, 0._plflt) else call plconfigtime(scale, offset1, offset2, 2, 0, 0, 0, & 0, 0, 0, 0._plflt) endif call pltimefmt(time_format) call plbox("bcnstd", xlabel_step, 0, "bcnstv", 0._plflt, 0) call plcol0(3) title = "@frPLplot Example 29 - TAI-UTC "// & trim(title_suffix) call pllab(xtitle, "TAI-UTC (sec)", title) call plcol0(4) call plline(x(1:npts), y(1:npts)) enddo end subroutine plot4 plplot-5.10.0+dfsg/examples/f95/x31f.f90 644 1750 1750 2132511647656237 163160ustar andrewandrew! $Id: x31f.f90 11984 2011-10-19 23:26:23Z andrewross $ ! set / get tester. ! ! Copyright (C) 2008 Alan W. Irwin ! Copyright (C) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA !-------------------------------------------------------------------------- ! main ! ! Demonstrates absolute positioning of graphs on a page. !-------------------------------------------------------------------------- program x31f95 use plplot implicit none real(kind=plflt) xmin, xmax, ymin, ymax, zxmin, zxmax, zymin, zymax real(kind=plflt) xmid, ymid, wx, wy real(kind=plflt) mar, aspect, jx, jy, ori integer win, level2, digmax, digits, compression1, compression2 real(kind=plflt) xp0, yp0, xp1, yp1, xp2, yp2 integer xleng0, yleng0, xoff0, yoff0, xleng1, yleng1, xoff1, yoff1 integer xleng2, yleng2, xoff2, yoff2 integer fam0, num0, bmax0, fam1, num1, bmax1, fam2, num2, bmax2, r, g, b real(kind=plflt) a integer r1(2), g1(2), b1(2) data r1 /0, 255/ data g1 /255, 0/ data b1 /0, 0/ real(kind=plflt) a1(2) data a1 /1.0_plflt, 1.0_plflt/ character(len=256) fnam integer stderr integer status status = 0 stderr = 0 ! Parse and process command line arguments call plparseopts(PL_PARSE_FULL) ! Test setting / getting familying parameters before plinit call plgfam(fam0, num0, bmax0) fam1 = 0 num1 = 10 bmax1 = 1000 call plsfam(fam1, num1, bmax1) ! Retrieve the same values? call plgfam(fam2, num2, bmax2) write(*,'(A,I1,I3,I5)') 'family parameters: fam, num, bmax = ', & fam2, num2, bmax2 if (fam2 .ne. fam1 .or. num2 .ne. num1 .or. bmax2 .ne. bmax1) then write(stderr,*) 'plgfam test failed\n' status = 1 endif ! Restore values set initially by plparseopts. call plsfam(fam0, num0, bmax0) ! Test setting / getting page parameters before plinit ! Save values set by plparseopts to be restored later. call plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) xp1 = 200._plflt yp1 = 200._plflt xleng1 = 400 yleng1 = 200 xoff1 = 10 yoff1 = 20 call plspage(xp1, yp1, xleng1, yleng1, xoff1, yoff1) ! Retrieve the same values? call plgpage(xp2, yp2, xleng2, yleng2, xoff2, yoff2) write(*,'(A,2F11.6, 2I4, 2I3)') & 'page parameters: xp, yp, xleng, yleng, xoff, yoff =', & xp2, yp2, xleng2, yleng2, xoff2, yoff2 if (xp2 .ne. xp1 .or. yp2 .ne. yp1 .or. xleng2 .ne. xleng1 .or. & yleng2 .ne. yleng1 .or. xoff2 .ne. xoff1 .or. & yoff2 .ne. yoff1 ) then write(stderr,*) 'plgpage test failed' status = 1 endif ! Restore values set initially by plparseopts. call plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0) ! Test setting / getting compression parameter across plinit compression1 = 95 call plscompression(compression1) ! Initialize plplot call plinit() ! Test if device initialization screwed around with the preset ! compression parameter. call plgcompression(compression2) write(*,'(A)') 'Output various PLplot parameters' write(*,'(A,I2)') 'compression parameter = ', compression2 if (compression2 .ne. compression1) then write(stderr,*) 'plgcompression test failed' status = 1 endif ! Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure ! they work without any obvious error messages. call plscolor(1) call plscol0(1, 255, 0, 0) call plscmap1(r1,g1,b1) call plscmap1a(r1,g1,b1,a1) call plglevel(level2) write(*,'(A,I1)') 'level parameter = ', level2 if (level2 .ne. 1) then write(stderr,*) 'plglevel test failed.' status = 1 endif call pladv(0) call plvpor(0.01_plflt, 0.99_plflt, 0.02_plflt, 0.49_plflt) call plgvpd(xmin, xmax, ymin, ymax) write(*,'(A,4F9.6)') 'plvpor: xmin, xmax, ymin, ymax =', & xmin, xmax, ymin, ymax if (xmin .ne. 0.01_plflt .or. xmax .ne. 0.99_plflt .or. & ymin .ne. 0.02_plflt .or. ymax .ne. 0.49_plflt) then write(stderr,*) 'plgvpd test failed' status = 1 endif xmid = 0.5*(xmin+xmax) ymid = 0.5*(ymin+ymax) call plwind(0.2_plflt, 0.3_plflt, 0.4_plflt, 0.5_plflt) call plgvpw(xmin, xmax, ymin, ymax) write(*,'(A,4F9.6)') 'plwind: xmin, xmax, ymin, ymax =', & xmin, xmax, ymin, ymax if (xmin .ne. 0.2_plflt .or. xmax .ne. 0.3_plflt .or. & ymin .ne. 0.4_plflt .or. ymax .ne. 0.5_plflt) then write(stderr,*) 'plgvpw test failed',xmin,xmax,ymin,ymax status = 1 endif ! Get world coordinates for midpoint of viewport call plcalc_world(xmid,ymid,wx,wy,win) write(*,'(A,2F9.6,I2)') 'world parameters: wx, wy, win =', & wx, wy, win if (abs(wx-0.25_plflt).gt.1.0d-5 .or. abs(wy-0.45_plflt).gt.1.0d-5) then write(stderr,*) 'plcalc_world test failed' status = 1 endif ! Retrieve and print the name of the output file (if any) call plgfnam(fnam) if (len(trim(fnam)) .eq. 0) then write(*,'(A)') 'No output file name is set' else write(*,'(A)') 'Output file name read' endif write(stderr,'(A,A)') 'Output file name is ',trim(fnam) ! Set and get the number of digits used to display axis labels ! Note digits is currently ignored in pls[xyz]ax and ! therefore it does not make sense to test the returned ! value call plsxax(3,0) call plgxax(digmax,digits) write(*,'(A,I2,I2)') 'x axis parameters: digmax, digits =', & digmax, digits if (digmax .ne. 3) then write(stderr,*) 'plgxax test failed' status = 1 endif call plsyax(4,0) call plgyax(digmax,digits) write(*,'(A,I2,I2)') 'y axis parameters: digmax, digits =', & digmax, digits if (digmax .ne. 4) then write(stderr,*) 'plgyax test failed' status = 1 endif call plszax(5,0) call plgzax(digmax,digits) write(*,'(A,I2,I2)') 'z axis parameters: digmax, digits =', & digmax, digits if (digmax .ne. 5) then write(stderr,*) 'plgzax test failed' status = 1 endif call plsdidev(0.05_plflt, PL_NOTSET, 0.1_plflt, 0.2_plflt) call plgdidev(mar, aspect, jx, jy) write(*,'(A,4F9.6)') 'device-space window parameters: '// & 'mar, aspect, jx, jy =', mar, aspect, jx, jy if (mar .ne. 0.05_plflt .or. jx .ne. 0.1_plflt .or. jy .ne. 0.2_plflt) then write(stderr,*) 'plgdidev test failed' status = 1 endif call plsdiori(1.0_plflt) call plgdiori(ori) write(*,'(A,F9.6)') 'ori parameter =', ori if (ori .ne. 1.0_plflt) then write(stderr,*) 'plgdiori test failed' status = 1 endif call plsdiplt(0.1_plflt, 0.2_plflt, 0.9_plflt, 0.8_plflt) call plgdiplt(xmin, ymin, xmax, ymax) write(*,'(A,4F9.6)') 'plot-space window parameters: '// & 'xmin, ymin, xmax, ymax =', xmin, ymin, xmax, ymax if (xmin .ne. 0.1_plflt .or. xmax .ne. 0.9_plflt .or. & ymin .ne. 0.2_plflt .or. ymax .ne. 0.8_plflt) then write(stderr,*) 'plgdiplt test failed' status = 1 endif call plsdiplz(0.1_plflt, 0.1_plflt, 0.9_plflt, 0.9_plflt) call plgdiplt(zxmin, zymin, zxmax, zymax) write(*,'(A,4F9.6)') 'zoomed plot-space window parameters: '// & 'xmin, ymin, xmax, ymax =', zxmin, zymin, zxmax, zymax if ( abs(zxmin -(xmin + (xmax-xmin)*0.1_plflt)) .gt. 1.0d-5 .or. & abs(zxmax -(xmin+(xmax-xmin)*0.9_plflt)) .gt. 1.0d-5 .or. & abs(zymin -(ymin+(ymax-ymin)*0.1_plflt)) .gt. 1.0d-5 .or. & abs(zymax -(ymin+(ymax-ymin)*0.9_plflt)) .gt. 1.0d-5 ) then write(stderr,*) 'plsdiplz test failed' status = 1 endif call plscolbg(10,20,30) call plgcolbg(r, g, b) write(*,'(A,3I3)') 'background colour parameters: r, g, b =', r, g, b if (r .ne. 10 .or. g .ne. 20 .or. b .ne. 30) then write(stderr,*) 'plgcolbg test failed' status = 1 endif call plscolbga(20,30,40,0.5_plflt) call plgcolbga(r, g, b, a) write(*,'(A,3I3,F9.6)') 'background/transparency colour '// & 'parameters: r, g, b, a =', r, g, b, a if (r.ne.20 .or. g.ne.30 .or. b.ne.40 .or. a.ne.0.5_plflt) then write(stderr,*) 'plgcolbga test failed' status = 1 endif call plend() if (status.ne.0) then stop 'Error occured' endif stop end program x31f95 plplot-5.10.0+dfsg/examples/f95/x30f.f90 644 1750 1750 1060611647561016 163030ustar andrewandrew! $Id: x30f.f90 11977 2011-10-19 14:43:26Z andrewross $ ! ! Alpha color values demonstration ! ! Copyright (C) 2008 Hazen Babcock ! Copyright (C) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! program x30f95 use plplot implicit none integer, dimension(4) :: red, green, blue real(kind=plflt), dimension (4) :: alpha, px, py real(kind=plflt), dimension (2) :: pos, rcoord, gcoord, bcoord, acoord logical, dimension(2) :: rev data red / 0, 255, 0, 0 / data green / 0, 0, 255, 0 / data blue / 0, 0, 0, 255 / data alpha / 1.0_plflt, 1.0_plflt, 1.0_plflt, 1.0_plflt / data px / 0.1_plflt, 0.5_plflt, 0.5_plflt, 0.1_plflt / data py / 0.1_plflt, 0.1_plflt, 0.5_plflt, 0.5_plflt / data pos / 0.0_plflt, 1.0_plflt / data rcoord / 1.0_plflt, 1.0_plflt / data gcoord / 0.0_plflt, 0.0_plflt / data bcoord / 0.0_plflt, 0.0_plflt / data acoord / 0.0_plflt, 1.0_plflt / data rev / .false. , .false. / integer i, j integer icol, r, g, b real(kind=plflt) :: a call plparseopts(PL_PARSE_FULL) call plinit() call plscmap0n(4) call plscmap0a (red, green, blue, alpha) ! ! Page 1: ! ! This is a series of red, green and blue rectangles overlaid ! on each other with gradually increasing transparency. ! ! Set up the window call pladv (0) call plvpor (0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plwind (0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plcol0 (0) call plbox ("", 1.0_plflt, 0, "", 1.0_plflt, 0) ! Draw the boxes do i = 1,9 icol = mod(i-1,3) + 1 ! Get a color, change its transparency and ! set it as the current color. call plgcol0a (icol, r, g, b, a) call plscol0a (icol, r, g, b, 1.0_plflt - dble(i-1)/9.0_plflt) call plcol0 (icol) ! Draw the rectangle call plfill (px, py) ! Shift the rectangles coordinates do j = 1,4 px(j) = px(j) + 0.5_plflt/9.0_plflt py(j) = py(j) + 0.5_plflt/9.0_plflt enddo enddo ! ! Page 2: ! ! This is a bunch of boxes colored red, green or blue with a single ! large (red) box of linearly varying transparency overlaid. The ! overlaid box is completely transparent at the bottom and completely ! opaque at the top. ! ! Set up the window call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) ! Draw the boxes. There are 25 of them drawn on a 5 x 5 grid. do i = 1,5 ! Set box X position px(1) = 0.05_plflt + 0.2_plflt * dble(i-1) px(2) = px(1) + 0.1_plflt px(3) = px(2) px(4) = px(1) ! We don't want the boxes to be transparent, so since we changed ! the colors transparencies in the first example we have to change ! the transparencies back to completely opaque. icol = mod(i-1,3) + 1 call plgcol0a (icol, r, g, b, a) call plscol0a (icol, r, g, b, 1.0_plflt) call plcol0 (icol) do j = 1, 5 ! Set box y position and draw the box. py(1) = 0.05_plflt + 0.2_plflt * dble(j-1) py(2) = py(1) py(3) = py(1) + 0.1_plflt py(4) = py(3) call plfill(px, py) enddo enddo ! Create the color map with 128 colors and call plscmap1la to initialize ! the color values with a linearly varying red transparency (or alpha) call plscmap1n(128) call plscmap1la(.true., pos, rcoord, gcoord, bcoord, acoord, rev) ! Use that cmap1 to create a transparent red gradient for the whole ! window. px(1) = 0._plflt px(2) = 1._plflt px(3) = 1._plflt px(4) = 0._plflt py(1) = 0._plflt py(2) = 0._plflt py(3) = 1._plflt py(4) = 1._plflt call plgradient( px, py, 90._plflt ) call plend() end program x30f95 plplot-5.10.0+dfsg/examples/f95/x28f.f90 644 1750 1750 3220311712207711 162770ustar andrewandrew! $Id: x28f.f90 12164 2012-02-01 10:11:21Z andrewross $ ! ! Demonstrates plotting text in 3D (plmtex3, plptex3) ! ! Copyright (C) 2007 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! program x28f95 use plplot, PI => PL_PI implicit none integer, parameter :: XPTS = 2 integer, parameter :: YPTS = 2 integer, parameter :: NREVOLUTION = 16 integer, parameter :: NROTATION = 8 integer, parameter :: NSHEAR = 8 real(PLFLT), dimension(:), allocatable :: x, y real(PLFLT), dimension(:,:), allocatable :: z real(PLFLT), parameter :: xmin=0., xmax=1.0, & xmid = 0.5*(xmax + xmin), xrange = xmax - xmin, & ymin=0., ymax=1.0, ymid = 0.5*(ymax + ymin), yrange = ymax - ymin, & zmin=0., zmax=1.0, zmid = 0.5*(zmax + zmin), zrange = zmax - zmin real(PLFLT), parameter :: & ysmin = ymin + 0.1 * yrange, & ysmax = ymax - 0.1 * yrange, & ysrange = ysmax - ysmin, & dysrot = ysrange / ( NROTATION - 1 ), & dysshear = ysrange / ( NSHEAR - 1 ), & zsmin = zmin + 0.1 * zrange, & zsmax = zmax - 0.1 * zrange, & zsrange = zsmax - zsmin, & dzsrot = zsrange / ( NROTATION - 1 ), & dzsshear = zsrange / ( NSHEAR - 1 ) real(PLFLT) :: ys, zs, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & omega, sin_omega, cos_omega, domega integer :: i, j real(PLFLT) :: radius, pitch, xpos, ypos, zpos ! N.B. Need to append PL_END_OF_STRING so spaces get ! properly plotted. character(len=2) :: p1string = "O"//PL_END_OF_STRING character(len=80) :: pstring = & "The future of our civilization depends on software freedom." ! Allocate and define the minimal x, y, and z to insure 3D box allocate( x(XPTS) ) allocate( y(YPTS) ) allocate( z(XPTS,YPTS) ) do i = 1,XPTS x(i) = xmin + (i-1) * (xmax-xmin)/(XPTS-1) enddo do j = 1,YPTS y(j) = ymin + (j-1) * (ymax-ymin)/(YPTS-1) enddo z = 0.0 ! Parse and process command line arguments call plparseopts(PL_PARSE_FULL) call plinit ! Page 1: Demonstrate inclination and shear capability pattern. call pladv(0) call plvpor(-0.15_plflt, 1.15_plflt, -0.05_plflt, 1.05_plflt) call plwind(-1.2_plflt, 1.2_plflt, -0.8_plflt, 1.5_plflt) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, xmin, xmax, ymin, ymax, zmin, zmax, 20._plflt, 45._plflt) call plcol0(2) call plbox3("b", "", xmax-xmin, 0, & "b", "", ymax-ymin, 0, & "bcd", "", zmax-zmin, 0) ! z = zmin. call plschr(0.0_plflt, 1.0_plflt) do i = 1,NREVOLUTION omega = 2.*PI*((i-1)/dble(NREVOLUTION)) sin_omega = sin(omega) cos_omega = cos(omega) x_inclination = 0.5*xrange*cos_omega y_inclination = 0.5*yrange*sin_omega z_inclination = 0. x_shear = -0.5*xrange*sin_omega y_shear = 0.5*yrange*cos_omega z_shear = 0. call plptex3( & xmid, ymid, zmin, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.0_plflt, " revolution") enddo ! x = xmax. call plschr(0._plflt, 1.0_plflt) do i = 1,NREVOLUTION omega = 2.*PI*((i-1)/dble(NREVOLUTION)) sin_omega = sin(omega) cos_omega = cos(omega) x_inclination = 0. y_inclination = -0.5*yrange*cos_omega z_inclination = 0.5*zrange*sin_omega x_shear = 0. y_shear = 0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega call plptex3( & xmax, ymid, zmid, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.0_plflt, " revolution") enddo ! y = ymax. call plschr(0.0_plflt, 1.0_plflt) do i = 1,NREVOLUTION omega = 2.*PI*(i-1)/dble(NREVOLUTION) sin_omega = sin(omega) cos_omega = cos(omega) x_inclination = 0.5*xrange*cos_omega y_inclination = 0. z_inclination = 0.5*zrange*sin_omega x_shear = -0.5*xrange*sin_omega y_shear = 0. z_shear = 0.5*zrange*cos_omega call plptex3( & xmid, ymax, zmid, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.0_plflt, " revolution") enddo ! Draw minimal 3D grid to finish defining the 3D box. call plmesh(x, y, z, DRAW_LINEXY) ! Page 2: Demonstrate rotation of string around its axis. call pladv(0) call plvpor(-0.15_plflt, 1.15_plflt, -0.05_plflt, 1.05_plflt) call plwind(-1.2_plflt, 1.2_plflt, -0.8_plflt, 1.5_plflt) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, xmin, xmax, ymin, ymax, & zmin, zmax, 20._plflt, 45._plflt) call plcol0(2) call plbox3("b", "", xmax-xmin, 0, & "b", "", ymax-ymin, 0, & "bcd", "", zmax-zmin, 0) ! y = ymax. call plschr(0.0_plflt, 1.0_plflt) x_inclination = 1. y_inclination = 0. z_inclination = 0. x_shear = 0. do i = 1,NROTATION omega = 2.*PI*(i-1)/dble(NROTATION) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = 0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsrot * dble(i-1) call plptex3( & xmid, ymax, zs, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, "rotation for y = y#dmax#u") enddo ! x = xmax. call plschr(0.0_plflt, 1.0_plflt) x_inclination = 0.0 y_inclination = -1.0 z_inclination = 0.0 y_shear = 0.0 do i = 1,NROTATION omega = 2.*PI*((i-1)/dble(NROTATION)) sin_omega = sin(omega) cos_omega = cos(omega) x_shear = 0.5*xrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsrot * dble(i-1) call plptex3( & xmax, ymid, zs, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, "rotation for x = x#dmax#u") enddo ! z = zmin. call plschr(0.0_plflt, 1.0_plflt) x_inclination = 1. y_inclination = 0. z_inclination = 0. x_shear = 0. do i = 1,NROTATION omega = 2.*PI*((i-1)/dble(NROTATION)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = 0.5*yrange*cos_omega z_shear = 0.5*zrange*sin_omega ys = ysmax - dysrot * dble(i-1) call plptex3( & xmid, ys, zmin, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, "rotation for z = z#dmin#u") enddo ! Draw minimal 3D grid to finish defining the 3D box. call plmesh(x, y, z, DRAW_LINEXY) ! Page 3: Demonstrate shear of string along its axis. ! Work around xcairo and pngcairo (but not pscairo) problems for ! shear vector too close to axis of string. (N.B. no workaround ! would be domega = 0.) domega = 0.05 call pladv(0) call plvpor(-0.15_plflt, 1.15_plflt, -0.05_plflt, 1.05_plflt) call plwind(-1.2_plflt, 1.2_plflt, -0.8_plflt, 1.5_plflt) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, xmin, xmax, ymin, ymax, & zmin, zmax, 20._plflt, 45._plflt) call plcol0(2) call plbox3("b", "", xmax-xmin, 0, & "b", "", ymax-ymin, 0, & "bcd", "", zmax-zmin, 0) ! y = ymax. call plschr(0.0_plflt, 1.0_plflt) x_inclination = 1. y_inclination = 0. z_inclination = 0. y_shear = 0. do i = 1,NSHEAR omega = domega + 2.*PI*((i-1)/dble(NSHEAR)) sin_omega = sin(omega) cos_omega = cos(omega) x_shear = 0.5*xrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsshear * dble(i-1) call plptex3( & xmid, ymax, zs, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, "shear for y = y#dmax#u") enddo ! x = xmax. call plschr(0.0_plflt, 1.0_plflt) x_inclination = 0. y_inclination = -1. z_inclination = 0. x_shear = 0. do i = 1,NSHEAR omega = domega + 2.*PI*((i-1)/dble(NSHEAR)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = -0.5*yrange*sin_omega z_shear = 0.5*zrange*cos_omega zs = zsmax - dzsshear * dble(i-1) call plptex3( & xmax, ymid, zs, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, "shear for x = x#dmax#u") enddo ! z = zmin. call plschr(0.0_plflt, 1.0_plflt) x_inclination = 1. y_inclination = 0. z_inclination = 0. z_shear = 0. do i = 1,NSHEAR omega = domega + 2.*PI*((i-1)/dble(NSHEAR)) sin_omega = sin(omega) cos_omega = cos(omega) y_shear = 0.5*yrange*cos_omega x_shear = 0.5*xrange*sin_omega ys = ysmax - dysshear * dble(i-1) call plptex3( & xmid, ys, zmin, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, "shear for z = z#dmin#u") enddo ! Draw minimal 3D grid to finish defining the 3D box. call plmesh(x, y, z, DRAW_LINEXY) ! Page 4: Demonstrate drawing a string on a 3D path. call pladv(0) call plvpor(-0.15_plflt, 1.15_plflt, -0.05_plflt, 1.05_plflt) call plwind(-1.2_plflt, 1.2_plflt, -0.8_plflt, 1.5_plflt) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, xmin, xmax, ymin, ymax, zmin, zmax, 40._plflt, -30._plflt) call plcol0(2) call plbox3("b", "", xmax-xmin, 0, & "b", "", ymax-ymin, 0, & "bcd", "", zmax-zmin, 0) call plschr(0.0_plflt, 1.2_plflt) ! domega controls the spacing between the various characters of the ! string and also the maximum value of omega for the given number ! of characters in pstring. domega = 2.*PI/len_trim(pstring) omega = 0. ! 3D function is a helix of the given radius and pitch radius = 0.5 pitch = 1./(2.*PI) do i = 1,len_trim(pstring) sin_omega = sin(omega) cos_omega = cos(omega) xpos = xmid + radius*sin_omega ypos = ymid - radius*cos_omega zpos = zmin + pitch*omega ! In general, the inclination is proportional to the derivative of ! the position wrt theta. x_inclination = radius*cos_omega y_inclination = radius*sin_omega z_inclination = pitch ! The shear vector should be perpendicular to the 3D line with Z ! component maximized, but for low pitch a good approximation is ! a constant vector that is parallel to the Z axis. x_shear = 0. y_shear = 0. z_shear = 1. p1string(1:1) = pstring(i:i) call plptex3( & xpos, ypos, zpos, & x_inclination, y_inclination, z_inclination, & x_shear, y_shear, z_shear, & 0.5_plflt, p1string) omega = omega + domega enddo ! Draw minimal 3D grid to finish defining the 3D box. call plmesh(x, y, z, DRAW_LINEXY) ! Page 5: Demonstrate plmtex3 axis labelling capability call pladv(0) call plvpor(-0.15_plflt, 1.15_plflt, -0.05_plflt, 1.05_plflt) call plwind(-1.2_plflt, 1.2_plflt, -0.8_plflt, 1.5_plflt) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, xmin, xmax, ymin, ymax, zmin, zmax, 20._plflt, 45._plflt) call plcol0(2) call plbox3("b", "", xmax-xmin, 0, & "b", "", ymax-ymin, 0, & "bcd", "", zmax-zmin, 0) call plschr(0.0_plflt, 1.0_plflt) call plmtex3("xp", 3.0_plflt, 0.5_plflt, 0.5_plflt, "Arbitrarily displaced") call plmtex3("xp", 4.5_plflt, 0.5_plflt, 0.5_plflt, "primary X-axis label") call plmtex3("xs", -2.5_plflt, 0.5_plflt, 0.5_plflt, "Arbitrarily displaced") call plmtex3("xs", -1.0_plflt, 0.5_plflt, 0.5_plflt, "secondary X-axis label") call plmtex3("yp", 3.0_plflt, 0.5_plflt, 0.5_plflt, "Arbitrarily displaced") call plmtex3("yp", 4.5_plflt, 0.5_plflt, 0.5_plflt, "primary Y-axis label") call plmtex3("ys", -2.5_plflt, 0.5_plflt, 0.5_plflt, "Arbitrarily displaced") call plmtex3("ys", -1.0_plflt, 0.5_plflt, 0.5_plflt, "secondary Y-axis label") call plmtex3("zp", 4.5_plflt, 0.5_plflt, 0.5_plflt, "Arbitrarily displaced") call plmtex3("zp", 3.0_plflt, 0.5_plflt, 0.5_plflt, "primary Z-axis label") call plmtex3("zs", -2.5_plflt, 0.5_plflt, 0.5_plflt, "Arbitrarily displaced") call plmtex3("zs", -1.0_plflt, 0.5_plflt, 0.5_plflt, "secondary Z-axis label") ! Draw minimal 3D grid to finish defining the 3D box. call plmesh(x, y, z, DRAW_LINEXY) ! Clean up. deallocate( x, y, z ) call plend stop end program plplot-5.10.0+dfsg/examples/f95/x01f.f90 644 1750 1750 1075112102122103 162530ustar andrewandrew! $Id: x01f.f90 12288 2013-01-30 04:40:35Z airwin $ ! Simple line plot and multiple windows demo. ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x01f95 use plplot, PI => PL_PI use plf95demolib implicit none real(plflt) :: xscale, yscale, xoff, yoff character(len=80) :: version integer :: digmax ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Print plplot version call plgver(version) write (*,'(a,a)') 'PLplot library version: ', trim(version) ! Initialize plplot ! Divide page into 2x2 plots call plstar(2,2) ! Set up the data ! Original case xscale = 6._plflt yscale = 1._plflt xoff = 0._plflt yoff = 0._plflt ! Do a plot call plot1() ! Set up the data xscale = 1._plflt yscale = 0.0014_plflt yoff = 0.0185_plflt ! Do a plot digmax = 5 call plsyax(digmax, 0) call plot1() call plot2() call plot3() ! Don't forget to call PLEND to finish off! call plend() contains !====================================================================== subroutine plot1() real(plflt), dimension(1:60) :: x, y real(plflt) :: xmin, xmax, ymin, ymax x = xoff + xscale * arange(1,size(x)+1) / real(size(x),plflt) y = yoff + yscale * x ** 2 xmin = minval(x) xmax = maxval(x) ymin = minval(y) ymax = maxval(y) ! Set up the viewport and window using PLENV. The range in X is ! 0.0 to 6.0, and the range in Y is 0.0 to 30.0. The axes are ! scaled separately (just = 0), and we just draw a labelled ! box (axis = 0). call plcol0(1) call plenv( xmin, xmax, ymin, ymax, 0, 0 ) call plcol0(2) call pllab( '(x)', '(y)', '#frPLplot Example 1 - y=x#u2' ) ! Plot the data points ! Only plot every tenth! call plcol0(4) call plpoin( x(4::10), y(4::10), 9 ) ! Draw the line through the data call plcol0(3) call plline( x, y ) end subroutine plot1 !====================================================================== subroutine plot2() real(plflt), dimension(1:100) :: x, y ! ! Set up the viewport and window using PLENV. The range in X is ! -2.0 to 10.0, and the range in Y is -0.4 to 2.0. The axes are ! scaled separately (just = 0), and we draw a box with axes ! (axis = 1). call plcol0(1) call plenv(-2.0_plflt, 10.0_plflt, -0.4_plflt, 1.2_plflt, 0, 1 ) call plcol0(2) call pllab( '(x)', 'sin(x)/x', '#frPLplot Example 1 - Sinc Function' ) ! Fill up the arrays x = ( arange(size(x)) - 19 ) / 6.0_plflt y = merge( sin(x) / x, 1.0_plflt, x /= 0.0_plflt ) ! Draw the line call plcol0(3) call plwidth(2._plflt) call plline( x, y ) call plwidth(1._plflt) end subroutine plot2 !====================================================================== subroutine plot3() ! ! For the final graph we wish to override the default tick intervals, ! and so do not use_ PLENV real(plflt), dimension(1:101) :: x, y call pladv(0) ! Use_ standard viewport, and define X range from 0 to 360 degrees, ! Y range from -1.2 to 1.2. call plvsta() call plwind( 0.0_plflt, 360.0_plflt, -1.2_plflt, 1.2_plflt ) ! Draw a box with ticks spaced 60 degrees apart in X, and 0.2 in Y. call plcol0(1) call plbox( 'bcnst', 60.0_plflt, 2, 'bcnstv', 0.2_plflt, 2 ) ! Superimpose a dashed line grid, with 1.5 mm marks and spaces. With ! only a single mark and space element, we do not need arrays call plstyl( 1, 1500, 1500 ) call plcol0(2) call plbox( 'g', 30.0_plflt, 0, 'g', 0.2_plflt, 0 ) call plstyl( 0, 0, 0 ) call plcol0(3) call pllab( 'Angle (degrees)', 'sine', '#frPLplot Example 1 - Sine function' ) x = 3.6_plflt * arange(size(x)) y = sin( x * PI/180.0_plflt ) call plcol0(4) call plline( x, y ) end subroutine plot3 end program x01f95 plplot-5.10.0+dfsg/examples/f95/CMakeLists.txt 644 1750 1750 770612243237170 177240ustar andrewandrew# examples/f95/CMakeLists.txt ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006-2012 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # N.B. This file is used for both the core build (which installs the examples # and optionally [depending on BUILD_TEST} builds them) and the installed # examples build. The core build has BUILD_TEST OFF or ON at user option # and CORE_BUILD always ON. The installed examples build always has # BUILD_TEST ON and CORE_BUILD OFF. set(f95_STRING_INDICES "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "16a" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "33" ) if(CORE_BUILD) # For CMake-2.6.0 and above, the module files are created by # default during the library build in the bindings/f95 directory. include_directories(${CMAKE_BINARY_DIR}/bindings/f95) else(CORE_BUILD) include_directories(${INCLUDE_DIR} ${F95_MOD_DIR}) endif(CORE_BUILD) if(CORE_BUILD) set(plf95demolib${LIB_TAG}_LIB_SRCS plf95demolib.f90) add_library(plf95demolib${LIB_TAG} STATIC ${plf95demolib${LIB_TAG}_LIB_SRCS}) target_link_libraries(plf95demolib${LIB_TAG} plplotf95${LIB_TAG}) install(TARGETS plf95demolib${LIB_TAG} EXPORT export_plplot ARCHIVE DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} RUNTIME DESTINATION ${BIN_DIR} ) install(FILES ${CMAKE_BINARY_DIR}/examples/f95/plf95demolib.mod DESTINATION ${F95_MOD_DIR} ) set(f95_SRCS) foreach(STRING_INDEX ${f95_STRING_INDICES}) set(f95_SRCS ${f95_SRCS} x${STRING_INDEX}f.f90) endforeach(STRING_INDEX ${f95_STRING_INDICES}) # Process fortran header file to define isnan if(FORTRAN_HAVE_ISNAN) set(HAVE_F95_ISNAN_FALSE !) else(FORTRAN_HAVE_ISNAN) set(HAVE_F95_ISNAN_TRUE !) endif(FORTRAN_HAVE_ISNAN) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plf95demos.inc.in ${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc ) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc PROPERTIES GENERATED ON) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) install(FILES ${f95_SRCS} DESTINATION ${DATA_DIR}/examples/f95 ) set(FC ${CMAKE_Fortran_COMPILER}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.examples.in ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Makefile.examples DESTINATION ${DATA_DIR}/examples/f95 RENAME Makefile ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc DESTINATION ${DATA_DIR}/examples/f95 ) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt DESTINATION ${DATA_DIR}/examples/f95 ) endif(CORE_BUILD) if(BUILD_TEST) set_property(GLOBAL PROPERTY TARGETS_examples_f95) foreach(STRING_INDEX ${f95_STRING_INDICES}) # Need unique target name add_executable(x${STRING_INDEX}f95 x${STRING_INDEX}f.f90) set_target_properties( x${STRING_INDEX}f95 PROPERTIES OUTPUT_NAME x${STRING_INDEX}f ) target_link_libraries(x${STRING_INDEX}f95 plf95demolib${LIB_TAG} plplotf95${LIB_TAG} plplotf95c${LIB_TAG}) set_property(GLOBAL APPEND PROPERTY TARGETS_examples_f95 x${STRING_INDEX}f95) endforeach(STRING_INDEX ${f95_STRING_INDICES}) endif(BUILD_TEST) plplot-5.10.0+dfsg/examples/f95/x20f.f90 644 1750 1750 4143212243237170 162750ustar andrewandrew! $Id: x20f.f90 12725 2013-11-20 22:58:00Z airwin $ ! ! Copyright (C) 2004 Alan W. Irwin ! Copyright (C) 2008 Andrew Ross ! ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! ! plimage demo ! ! !static PLOptionTable options[] = { !{ ! "dbg", /* extra debugging plot */ ! NULL, ! NULL, ! &dbg, ! PL_OPT_BOOL, ! "-dbg", ! "Extra debugging plot" }, !{ ! "nosombrero", /* Turns on test of xor function */ ! NULL, ! NULL, ! &nosombrero, ! PL_OPT_BOOL, ! "-nosombrero", ! "No sombrero plot" }, !{ ! "nointeractive", /* Turns on test of xor function */ ! NULL, ! NULL, ! &nointeractive, ! PL_OPT_BOOL, ! "-nointeractive", ! "No interactive selection" }, !{ ! "save", /* For saving in postscript */ ! NULL, ! NULL, ! &f_name, ! PL_OPT_STRING, ! "-save filename", ! "Save sombrero plot in color postscript `filename'" }, !{ ! NULL, /* option */ ! NULL, /* handler */ ! NULL, /* client data */ ! NULL, /* address of variable to set */ ! 0, /* mode flag */ ! NULL, /* short syntax */ ! NULL } /* long syntax */ !}; program x20f use plplot, M_PI => PL_PI implicit none integer, parameter :: XDIM = 260, YDIM = 220 real(kind=plflt), parameter :: XDIMR = XDIM, YDIMR = YDIM real(kind=plflt) :: x(XDIM), y(YDIM), z(XDIM,YDIM), r(XDIM,YDIM) real(kind=plflt) :: xi, yi, xe, ye integer i, j real(kind=plflt) width_r, height_r ! ! Dimensions taken from "lena.pgm" ! integer width, height, num_col real(kind=plflt), dimension(:,:), pointer :: img_f real(kind=plflt), dimension(:,:), pointer :: xg, yg real(kind=plflt) :: img_max, img_min real(kind=plflt) :: x0, y0, dy, stretch ! ! Parameters from command-line ! logical dbg logical nosombrero logical nointeractive character(len=80) f_name ! ! Bugs in plimage(): ! -at high magnifications, the left and right edge are ragged, try ! ./x20c -dev xwin -wplt 0.3,0.3,0.6,0.6 -ori 0.5 ! ! Bugs in x20c.c: ! -if the window is resized after a selection is made on 'lena', when ! making a new selection the old one will re-appear. ! ! ! Parse and process command line arguments ! ! call plMergeOpts(options, 'x20c options', NULL) dbg = .false. nosombrero = .false. nointeractive = .false. f_name = ' ' call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit ! View image border pixels if (dbg) then call plenv(1._plflt, XDIMR, 1._plflt, YDIMR, 1, 1) z = 0.0_plflt ! Build a one pixel square border, for diagnostics do i = 1,XDIM ! Right z(i,YDIM) = 1._plflt ! Left z(i,1) = 1._plflt enddo do i = 1,YDIM ! Top z(1,i) = 1._plflt ! Bottom z(XDIM,i) = 1._plflt enddo call pllab('...around a blue square.',' '//PL_END_OF_STRING, & 'A red border should appear...') call plimage(z, 1._plflt, XDIMR, 1._plflt, YDIMR, 0._plflt, 0._plflt, & 1._plflt, XDIMR, 1._plflt, YDIMR) endif ! Sombrero-like demo if (.not. nosombrero) then ! draw a yellow plot box, useful for diagnostics! :( call plcol0(2) call plenv(0._plflt, 2._plflt*M_PI, 0.0_plflt, 3._plflt*M_PI, 1, -1) do i=1,XDIM x(i) = dble(i-1)*2._plflt*M_PI/dble(XDIM-1) enddo do i=1,YDIM y(i) = dble(i-1)*3._plflt*M_PI/dble(YDIM-1) enddo do i=1,XDIM do j=1,YDIM r(i,j) = sqrt(x(i)*x(i)+y(j)*y(j))+0.001_plflt z(i,j) = sin(r(i,j)) / (r(i,j)) enddo enddo call pllab('No, an amplitude clipped "sombrero"', '', & 'Saturn?') call plptex(2._plflt, 2._plflt, 3._plflt, 4._plflt, 0._plflt, 'Transparent image') call plimage(z, 0._plflt, 2._plflt*M_PI, 0.0_plflt, 3._plflt*M_PI, & 0.05_plflt, 1._plflt, 0._plflt, 2._plflt*M_PI, 0._plflt, 3._plflt*M_PI) ! Save the plot if (f_name .ne. ' ') then call save_plot(f_name) endif endif ! ! Read Lena image ! Note we try two different locations to cover the case where this ! examples is being run from the test_c.sh script ! if (.not. read_img('lena.pgm', img_f, width, height, num_col)) then if (.not. read_img('../lena.pgm', img_f, width, height, num_col)) then !C call plabort('No such file') write(*,*) 'Image could not be read' call plend() stop endif endif ! Set gray colormap call gray_cmap(num_col) ! Display Lena width_r = dble(width) height_r = dble(height) call plenv(1._plflt, width_r, 1._plflt, height_r, 1, -1) if (.not. nointeractive) then call pllab('Set and drag Button 1 to (re)set selection, Butto'// & 'n 2 to finish.',' '//PL_END_OF_STRING,'Lena...') else call pllab('',' '//PL_END_OF_STRING,'Lena...') endif call plimage(img_f, 1._plflt, width_r, 1._plflt, & height_r, 0._plflt, 0._plflt, 1._plflt, width_r, 1._plflt, height_r) ! Selection/expansion demo if (.not. nointeractive) then xi = 200.0_plflt xe = 330.0_plflt yi = 280.0_plflt ye = 220.0_plflt if (get_clip(xi, xe, yi, ye)) then call plend() stop endif ! ! I'm unable to continue, clearing the plot and advancing to the next ! one, without hiting the enter key, or pressing the button... help! ! Forcing the xwin driver to leave locate mode and destroying the ! xhairs (in GetCursorCmd()) solves some problems, but I still have ! to press the enter key or press Button-2 to go to next plot, even ! if a pladv() is not present! Using plbop() solves the problem, but ! it shouldn't be needed! ! ! plspause(0), pladv(0), plspause(1), also works, ! but the above question remains. ! With this approach, the previous pause state is lost, ! as there is no API call to get its current state. ! call plspause(.false.) call pladv(0) ! Display selection only call plimage(img_f, 1._plflt, width_r, 1._plflt, & height_r, 0._plflt, 0._plflt, xi, xe, ye, yi) call plspause(.true.) ! Zoom in selection call plenv(xi, xe, ye, yi, 1, -1) call plimage(img_f, 1._plflt, width_r, 1._plflt, & height_r, 0._plflt, 0._plflt, xi, xe, ye, yi) endif ! Base the dynamic range on the image contents. call a2mnmx(img_f,width,height,img_min,img_max,width) call plcol0(2) call plenv(0._plflt, width_r, 0._plflt, height_r, 1, -1) call pllab("", "", "Reduced dynamic range image example") call plimagefr(img_f, 0._plflt, width_r, 0._plflt, & height_r, 0._plflt, 0._plflt, img_min + img_max * 0.25_plflt, & img_max - img_max * 0.25_plflt) ! Draw a distorted version of the original image, showing its ! full dynamic range. call plenv(0._plflt, width_r, 0._plflt, height_r, 1, -1) call pllab("", "", "Distorted image example") ! Populate the 2-d grids used for the distortion ! NB grids must be 1 larger in each dimension than the image ! since the coordinates are for the corner of each pixel. allocate( xg(width+1,height+1) ) allocate( yg(width+1,height+1) ) x0 = 0.5_plflt*width_r y0 = 0.5_plflt*height_r dy = 0.5_plflt*height_r stretch = 0.5_plflt do i=1,width+1 do j=1,height+1 xg(i,j) = x0 + (x0-dble(i-1))*(1.0_plflt - stretch* & cos((dble(j-1)-y0)/dy*M_PI*0.5_plflt)) yg(i,j) = dble(j-1) enddo enddo call plimagefr(img_f, 0._plflt, width_r, 0._plflt, & height_r, 0._plflt, 0._plflt, img_min, img_max, xg, yg) deallocate( img_f, xg, yg ) call plend() stop contains ! Determine the unit of length for direct-access files subroutine bytes_in_rec( bytes ) implicit none integer bytes character(len=8) string integer i integer ierr open( 10, file = '_x20f_.bin', access = 'direct', recl = 1 ) do i = 1,8 write( 10, rec = 1, iostat = ierr ) string(1:i) if ( ierr /= 0 ) exit bytes = i enddo close( 10, status = 'delete' ) end subroutine ! Read image from file in binary ppm format logical function read_img(fname, img_f, width, height, num_col) character(*), intent(in) :: fname integer, intent(out) :: width, height real(kind=plflt), dimension(:,:), pointer :: img_f integer num_col character, dimension(8) :: img character(len=80), dimension(2) :: ver integer :: i, j, w, h, b integer :: ierr integer :: count integer :: record integer :: bytes = 0 integer :: lastlf = 0 integer :: first integer :: last integer :: pixel ! Naive grayscale binary ppm reading. If you know how to, improve it open( 10, file = fname, status = 'old', iostat = ierr ) if (ierr .ne. 0 ) then read_img = .false. return endif ! ! Read the first lines (count them for later re-reading) ! count = 1 read( 10, '(a)', iostat = ierr ) ver(1) ! I only understand "P5"! if (ver(1) .ne. 'P5' .or. ierr .ne. 0) then read_img = .false. return endif do count = count + 1 read( 10, '(a)', iostat = ierr ) ver(1) if (ierr .ne. 0) then read_img = .false. write(*,*) 'Error!' return endif if (ver(1)(1:1) .ne. '#' ) then exit endif enddo ! Found the line with the sizes, copy this one and the next count = count + 1 read( 10, '(a)', iostat = ierr ) ver(2) read( ver, * ) w, h, num_col allocate( img_f(w,h) ) close( 10 ) close( 11, status = 'delete' ) ! ! Read the second part - we need to do it the hard way :( ! ! Note: ! The algorithm works if the unit of record length is a byte or ! if it is a multiple therefore (up to 8 bytes are allowed). ! Background: Some compilers use a word (4 bytes) as the unit of ! length instead, but often provide a compile switch to use bytes, ! we can not rely on this though. ! call bytes_in_rec( bytes ) open( 10, file = fname, access = 'direct', recl = 1 ) record = 0 do while ( count > 0 ) ! ! Look for the end of the line with sizes ! record = record + 1 read( 10, rec = record, iostat = ierr ) (img(i), i = 1,bytes ) if ( ierr .ne. 0 ) then exit endif do i = 1,bytes if ( img(i) == char(10) ) then count = count - 1 lastlf = i endif enddo enddo ! ! We have found the picture bytes! ! The picture needs to be flipped vertically. ! So do that rightaway ! first = lastlf + 1 last = bytes pixel = 0 do do b = first, last pixel = pixel + 1 if ( pixel <= h*w ) then i = 1 + mod(pixel-1,w) j = 1 + (pixel-1)/w img_f(i,h-j+1) = dble(ichar(img(b))) endif enddo if ( pixel < h*w ) then record = record + 1 read( 10, rec = record ) (img(b), b = 1,bytes ) first = 1 else exit endif enddo width = w height = h read_img = .true. end function ! Save plot subroutine save_plot(fname) character*(*) fname integer cur_strm, new_strm ! Get current stream call plgstrm(cur_strm) ! Create a new one call plmkstrm(new_strm) ! New device type. Use a known existing driver call plsdev('psc') call plsfnam(fname) ! Copy old stream parameters to new stream call plcpstrm(cur_strm, .false.) call plreplot() call plend1() ! Return to previous one call plsstrm(cur_strm) end subroutine ! Get selection square interactively logical function get_clip(xi, xe, yi, ye) real(kind=plflt) xi, xe, yi, ye type(PLGraphicsIn) :: gin real(kind=plflt) :: xxi, yyi, xxe, yye, t logical st, start real(kind=plflt) sx(5), sy(5) integer PLK_Return data PLK_Return / Z'0D' / integer hex100 data hex100 / Z'100' / xxi = xi yyi = yi xxe = xe yye = ye start = .false. ! Enter xor mode to draw a selection rectangle call plxormod(.true., st) ! Driver has xormod capability, continue if (st) then do while (.true.) call plxormod(.false., st) call plgetcursor(gin) call plxormod(.true., st) if (gin%button .eq. 1) then xxi = gin%wX yyi = gin%wY if (start) then !C clear previous rectangle call plline(sx, sy) endif start = .false. sx(1) = xxi sy(1) = yyi sx(5) = xxi sy(5) = yyi endif if (iand(gin%state,hex100).ne.0) then xxe = gin%wX yye = gin%wY if (start) then ! Clear previous rectangle call plline(sx, sy) endif start = .true. sx(3) = xxe sy(3) = yye sx(2) = xxe sy(2) = yyi sx(4) = xxi sy(4) = yye ! Draw new rectangle call plline(sx, sy) endif if ((gin%button .eq. 3).or.(gin%keysym .eq. PLK_Return).or.(gin%keysym .eq. ichar('Q'))) then if (start) then ! Clear previous rectangle call plline(sx, sy) goto 110 endif endif enddo 110 continue ! Leave xor mode call plxormod(.false., st) if (xxe .lt. xxi) then t = xxi xxi = xxe xxe = t endif if (yyi .lt. yye) then t = yyi yyi = yye yye = t endif xe = xxe xi = xxi ye = yye yi = yyi get_clip = (gin%keysym .eq. ichar('Q')) ! get_clip = .false. else ! driver has no xormod capability, just do nothing get_clip = .false. return endif end function ! Set gray colormap subroutine gray_cmap(num_col) integer num_col real(kind=plflt) r(2), g(2), b(2), pos(2) logical rev(2) r(1) = 0.0 g(1) = 0.0 b(1) = 0.0 r(2) = 1.0 g(2) = 1.0 b(2) = 1.0 pos(1) = 0.0 pos(2) = 1.0 rev(1) = .false. rev(2) = .false. call plscmap1n(num_col) call plscmap1l(.true., pos, r, g, b, rev) end subroutine end program !---------------------------------------------------------------------------- ! Subroutine a2mmx ! Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) use plplot implicit none integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax fmax = f(1, 1) fmin = fmax do j = 1, ny do i = 1, nx fmax = max(fmax, f(i, j)) fmin = min(fmin, f(i, j)) enddo enddo end plplot-5.10.0+dfsg/examples/f95/plf95demolib.f90 644 1750 1750 423211664655754 200100ustar andrewandrew! $Id: x02f.f90 11984 2011-10-19 23:26:23Z andrewross $ ! Demonstrates multiple windows and color map 0 ! ! Copyright (C) 2011 Arjen Markus ! Copyright (C) 2005 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! Module containing auxiliary routines for the demo programs module plf95demolib use plplot implicit none interface arange module procedure arange_plflt_1 module procedure arange_plflt_2 module procedure arange_plflt_3 end interface contains ! Function to return an arithmetic series (modelled after the Numpy ! function of the same name) ! function arange_plflt_1( start, stop, step ) integer, intent(in) :: start, stop, step real(kind=plflt), dimension((stop-start)/step) :: arange_plflt_1 integer :: i arange_plflt_1 = (/ (real(i, plflt), i = start, stop-step, step) /) end function arange_plflt_1 function arange_plflt_2( start, stop ) integer, intent(in) :: start, stop real(kind=plflt), dimension((stop-start)) :: arange_plflt_2 arange_plflt_2 = arange_plflt_1( start, stop, 1 ) end function arange_plflt_2 function arange_plflt_3( stop ) integer, intent(in) :: stop real(kind=plflt), dimension(stop-1) :: arange_plflt_3 arange_plflt_3 = arange_plflt_1( 0, stop, 1 ) end function arange_plflt_3 end module plf95demolib plplot-5.10.0+dfsg/examples/f95/x10f.f90 644 1750 1750 314111702031245 162410ustar andrewandrew! $Id: x10f.f90 12124 2012-01-07 11:55:17Z arjenmarkus $ ! Demonstration program for PLplot illustrating absolute positioning ! of graphs on a page ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x10f95 use plplot implicit none ! Process command-line arguments call plparseopts(PL_PARSE_FULL) call plinit() call pladv(0) call plvpor(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plbox('bc', 0.0_plflt, 0, 'bc', 0.0_plflt, 0 ) call plsvpa(50.0_plflt, 150.0_plflt, 50.0_plflt, 100.0_plflt ) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plbox('bc', 0.0_plflt, 0, 'bc', 0.0_plflt, 0 ) call plptex(0.5_plflt, 0.5_plflt, 1.0_plflt, 0.0_plflt, & 0.5_plflt, 'BOX at (50,150,50,100)' ) call plend end program x10f95 plplot-5.10.0+dfsg/examples/f95/x04f.f90 644 1750 1750 1217312251724462 163030ustar andrewandrew! $Id: x04f.f90 12840 2013-12-10 23:52:18Z andrewross $ ! Illustration of logarithmic axes, and redefinition of window ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x04f95 use plplot, PI => PL_PI use plf95demolib implicit none real(kind=plflt) :: freql(0:100),ampl(0:100),phase(0:100) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) call plinit call plfont(2) ! Make log plots using two different styles. call plot1(0) call plot1(1) call plend contains subroutine plot1(type) integer :: type integer :: nlegend real(kind=plflt) :: legend_width, legend_height integer :: opt_array(2), text_colors(2), line_colors(2), & line_styles(2), symbol_colors(2), symbol_numbers(2) real(kind=plflt) :: line_widths(2), symbol_scales(2), box_scales(0) integer :: box_colors(0), box_patterns(0) real(kind=plflt) :: box_line_widths(0) character(len=20) :: text(2) character(len=1) :: symbols(2) call pladv(0) ! Set up data for log plot. call setdata call plvpor(0.15_plflt, 0.85_plflt, 0.1_plflt, 0.9_plflt) call plwind(-2.0_plflt, 3.0_plflt, -80.0_plflt, 0.0_plflt) call plcol0(1) ! Try different axis and labelling styles. if (type.eq.0) then call plbox('bclnst', 0.0_plflt, 0, 'bnstv', 0.0_plflt, 0) elseif (type.eq.1) then call plbox('bcfghlnst', 0.0_plflt, 0, 'bcghnstv', 0.0_plflt, 0) else stop 'plot1: invalid type' endif ! Plot ampl vs freq. call plcol0(2) call plline(freql,ampl) call plcol0(2) call plptex(1.6_plflt, -30.0_plflt, 1.0_plflt, -20.0_plflt, 0.5_plflt, & '-20 dB/decade') ! Put labels on. call plcol0(1) call plmtex('b', 3.2_plflt, 0.5_plflt, 0.5_plflt, 'Frequency') call plmtex('t', 2.0_plflt, 0.5_plflt, 0.5_plflt, & 'Single Pole Low-Pass Filter') call plcol0(2) call plmtex('l', 5.0_plflt, 0.5_plflt, 0.5_plflt, 'Amplitude (dB)') nlegend = 1 ! For the gridless case, put phase vs freq on same plot. if(type == 0) then call plcol0(1) call plwind(-2.0_plflt, 3.0_plflt, -100.0_plflt, 0.0_plflt) call plbox(' ', 0.0_plflt, 0, 'cmstv', 30.0_plflt, 3) call plcol0(3) call plline(freql, phase) call plstring(freql, phase, '*') call plcol0(3) call plmtex('r', 5.0_plflt, 0.5_plflt, 0.5_plflt, & 'Phase shift (degrees)') nlegend = 2 endif ! Draw a legend ! First legend entry. opt_array(1) = PL_LEGEND_LINE text_colors(1) = 2 text(1) = 'Amplitude' line_colors(1) = 2 line_styles(1) = 1 line_widths(1) = 1 ! note from the above opt_array the first symbol (and box) indices ! do not have to be specified, at least in C. For Fortran we need ! to set the symbols to be something, since the string is always ! copied as part of the bindings. symbols(1) = '' ! Second legend entry. opt_array(2) = PL_LEGEND_LINE + PL_LEGEND_SYMBOL text_colors(2) = 3 text(2) = 'Phase shift' line_colors(2) = 3 line_styles(2) = 1 line_widths(2) = 1 symbol_colors(2) = 3 symbol_scales(2) = 1.0 symbol_numbers(2) = 4 symbols(2) = '*' ! from the above opt_arrays we can completely ignore everything ! to do with boxes. (Hence the size 0 for the associated arrays) ! (note: use the argument nlegend explicitly) call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, & PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX, 0, & 0.0_plflt, 0.0_plflt, 0.1_plflt, 15, & 1, 1, 0, 0, & nlegend, opt_array, & 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1.0_plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) end subroutine plot1 subroutine setdata real(kind=plflt), dimension(lbound(freql,1):ubound(freql,1)) :: freq real(kind=plflt) :: f0 f0 = 1._plflt freql = -2.0_plflt + arange(lbound(freql,1),ubound(freql,1)+1) / 20.0_plflt freq = 10.0_plflt ** freql ampl = 20.0_plflt * log10(1.0_plflt/sqrt(1.0_plflt+(freq/f0)**2)) phase = -(180.0_plflt/PI)*atan(freq/f0) end subroutine setdata end program x04f95 plplot-5.10.0+dfsg/examples/f95/x15f.f90 644 1750 1750 2466212140337537 163130ustar andrewandrew! $Id: x15f.f90 12320 2013-05-02 01:20:31Z arjenmarkus $ ! Shade plot demo. ! Does a variety of shade plots. ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use plplot implicit none integer xdim, ydim, XPTS, YPTS ! xdim and ydim are the static dimensions of the 2D arrays while ! NX and NY are the defined area. parameter( xdim = 99, XPTS = 35, ydim = 100, YPTS = 46 ) integer i, j real(kind=plflt) xx, yy real(kind=plflt) z(xdim, ydim), zmin, zmax ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Set up color map 1 (but comment out because this makes ! no difference for the current cmap0 plshade calls in plot1 and plot2.) ! call cmap1_init2() ! Initialize plplot call plinit() ! Set up data array do i = 1,XPTS xx = dble(i-1 - (XPTS / 2)) / dble(XPTS / 2) do j = 1,YPTS yy = dble(j-1 - (YPTS / 2)) / dble(YPTS / 2) - 1.0_plflt z(i,j) = xx*xx - yy*yy + (xx - yy)/(xx*xx+yy*yy + 0.1_plflt) enddo enddo call a2mnmx(z, XPTS, YPTS, zmin, zmax, xdim) call plot1(z, XPTS, YPTS, zmin, zmax, xdim) call plot2(z, XPTS, YPTS, zmin, zmax, xdim) call plot3() call plend() end ! ------------------------------------------------------------------------- ! cmap1_init1 ! ! Initializes color map 1 in HLS space. ! ------------------------------------------------------------------------- subroutine cmap1_init1() use plplot implicit none real(kind=plflt) i(4), h(4), l(4), s(4) i(1) = 0.0_plflt ! left boundary i(2) = 0.45_plflt ! just before center i(3) = 0.55_plflt ! just after center i(4) = 1.0_plflt ! right boundary h(1) = 260.0_plflt ! hue -- low: blue-violet h(2) = 260.0_plflt ! only change as we go over vertex h(3) = 20.0_plflt ! hue -- high: red h(4) = 20.0_plflt ! keep fixed l(1) = 0.5_plflt ! lightness -- low l(2) = 0.0_plflt ! lightness -- center l(3) = 0.0_plflt ! lightness -- center l(4) = 0.5_plflt ! lightness -- high ! call plscolbg(255,255,255) ! l(1) = 0.5_plflt ! lightness -- low ! l(2) = 1.0_plflt ! lightness -- center ! l(3) = 1.0_plflt ! lightness -- center ! l(4) = 0.5_plflt ! lightness -- high s(1) = 1.0_plflt ! maximum saturation s(2) = 1.0_plflt ! maximum saturation s(3) = 1.0_plflt ! maximum saturation s(4) = 1.0_plflt ! maximum saturation call plscmap1l(.false., i, h, l, s) end ! ------------------------------------------------------------------------- ! cmap1_init2 ! ! Initializes color map 1 in HLS space. ! ------------------------------------------------------------------------- subroutine cmap1_init2() use plplot implicit none real(kind=plflt) i(4), h(4), l(4), s(4) i(1) = 0.0_plflt ! left boundary i(2) = 0.45_plflt ! just before center i(3) = 0.55_plflt ! just after center i(4) = 1.0_plflt ! right boundary h(1) = 260.0_plflt ! hue -- low: blue-violet h(2) = 260.0_plflt ! only change as we go over vertex h(3) = 20.0_plflt ! hue -- high: red h(4) = 20.0_plflt ! keep fixed l(1) = 0.6_plflt ! lightness -- low l(2) = 0.0_plflt ! lightness -- center l(3) = 0.0_plflt ! lightness -- center l(4) = 0.6_plflt ! lightness -- high ! call plscolbg(255,255,255) ! l(1) = 0.5_plflt ! lightness -- low ! l(2) = 1.0_plflt ! lightness -- center ! l(3) = 1.0_plflt ! lightness -- center ! l(4) = 0.5_plflt ! lightness -- high s(1) = 1.0_plflt ! maximum saturation s(2) = 0.5_plflt ! maximum saturation s(3) = 0.5_plflt ! maximum saturation s(4) = 1.0_plflt ! maximum saturation call plscmap1l(.false., i, h, l, s) end ! ------------------------------------------------------------------------- ! plot1 ! ! Illustrates a single shaded region. ! ------------------------------------------------------------------------- subroutine plot1(z, XPTS, YPTS, zmin, zmax, xdim) use plplot implicit none integer xdim, XPTS, YPTS real(kind=plflt) z(xdim,YPTS), zmin, zmax character(len=1) undefined real(kind=plflt) shade_min, shade_max, sh_color integer sh_cmap integer min_color, max_color real(kind=plflt) sh_width, min_width, max_width sh_cmap = 0 min_color = 0 min_width = 0 max_color = 0 max_width = 0 call pladv(0) call plvpor( 0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) ! Plot using identity transform shade_min = zmin + (zmax-zmin)*0.4_plflt shade_max = zmin + (zmax-zmin)*0.6_plflt sh_color = 7 sh_width = 2 min_color = 9 max_color = 2 min_width = 2 max_width = 2 call plpsty(8) ! Use_ plshade0 instead of plshade1 - identity mapping call plshade(z(:XPTS,:YPTS), undefined, & -1._plflt, 1._plflt, -1._plflt, 1._plflt, & shade_min, shade_max, & sh_cmap, sh_color, sh_width, & min_color, min_width, max_color, max_width ) call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call pllab('distance', 'altitude', 'Bogon flux') end ! ------------------------------------------------------------------------- ! plot2 ! ! Illustrates multiple adjacent shaded regions, using different fill ! patterns for each region. ! ------------------------------------------------------------------------- subroutine plot2(z, XPTS, YPTS, zmin, zmax, xdim) use plplot implicit none integer xdim, XPTS, YPTS real(kind=plflt) z(xdim,YPTS), zmin, zmax character(len=1) undefined real(kind=plflt) shade_min, shade_max, sh_color integer sh_cmap integer min_color, max_color real(kind=plflt) sh_width, min_width, max_width integer i, j integer nlin(10), inc(2,10), del(2,10) data nlin /1, 1, 1, 1, 1, 2, 2, 2, 2, 2/ data ( (inc(i,j), i=1,2), j=1,10) / & 450, 0, -450, 0, 0, 0, 900, 0, & 300, 0, 450,-450, 0, 900, 0, 450, & 450, -450, 0, 900/ data ( (del(i,j), i=1,2), j=1,10) / & 2000, 2000, 2000, 2000, 2000, 2000, & 2000, 2000, 2000, 2000, 2000, 2000, & 2000, 2000, 2000, 2000, 4000, 4000, & 4000, 2000/ sh_cmap = 0 min_color = 0 min_width = 0 max_color = 0 max_width = 0 sh_width = 2 call pladv(0) call plvpor( 0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) ! Plot using identity transform do i = 1,10 shade_min = zmin + (zmax - zmin) * (i-1) / 10.0_plflt shade_max = zmin + (zmax - zmin) * i / 10.0_plflt sh_color = i+5 call plpat(nlin(i),inc(1,i),del(1,i)) ! Use_ plshade0 instead of plshade1 - identity mapping call plshade(z(:XPTS,:YPTS), undefined, & -1._plflt, 1._plflt, -1._plflt, 1._plflt, & shade_min, shade_max, & sh_cmap, sh_color, sh_width, & min_color, min_width, max_color, max_width) enddo call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call pllab('distance', 'altitude', 'Bogon flux') end !-------------------------------------------------------------------------- ! plot3 ! ! Illustrates shaded regions in 3d, using a different fill pattern for ! each region. !-------------------------------------------------------------------------- subroutine plot3 use plplot implicit none real(kind=plflt) xx1(5), xx2(5), yy1(5), yy2(5), zz1(5), zz2(5) data xx1 / -1.0_plflt, 1.0_plflt, 1.0_plflt, -1.0_plflt, -1.0_plflt/ data xx2 / -1.0_plflt, 1.0_plflt, 1.0_plflt, -1.0_plflt, -1.0_plflt/ data yy1 /1.0_plflt, 1.0_plflt, 0.0_plflt, 0.0_plflt, 1.0_plflt/ data yy2 / -1.0_plflt, -1.0_plflt, 0.0_plflt, 0.0_plflt, -1.0_plflt/ data zz1 / 0.0_plflt, 0.0_plflt, 1.0_plflt, 1.0_plflt, 0.0_plflt/ data zz2 / 0.0_plflt, 0.0_plflt, 1.0_plflt, 1.0_plflt, 0.0_plflt/ call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) call plw3d(1._plflt, 1._plflt, 1._plflt, -1.0_plflt, 1.0_plflt, & -1.0_plflt, 1.0_plflt, 0.0_plflt,1.5_plflt, 30._plflt, -40._plflt) ! Plot using identity transform call plcol0(1) call plbox3("bntu", "X", 0.0_plflt, 0, "bntu", "Y", 0.0_plflt, 0, & "bcdfntu", "Z", 0.5_plflt, 0) call plcol0(2) call pllab("","","3-d polygon filling") call plcol0(3) call plpsty(1) call plline3(xx1, yy1, zz1) call plfill3(xx1(1:4), yy1(1:4), zz1(1:4)) call plpsty(2) call plline3(xx2, yy2, zz2) call plfill3(xx2(1:4), yy2(1:4), zz2(1:4)) end !---------------------------------------------------------------------------- ! Subroutine a2mnmx ! Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) use plplot implicit none integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax fmax = f(1, 1) fmin = fmax do j = 1, ny do i = 1, nx fmax = max(fmax, f(i, j)) fmin = min(fmin, f(i, j)) enddo enddo end plplot-5.10.0+dfsg/examples/f95/Makefile.examples.in 644 1750 1750 367311720240175 210430ustar andrewandrew# examples/f95/Makefile.examples.in for PLplot ### ### Process this file with configure to produce Makefile.examples ### # Copyright (C) 2002, 2004 Alan W. Irwin # Copyright (C) 2004 Rafael Laboissiere # Copyright (C) 2004 Andrew Ross # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with the file PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA F95 = @FC@ EXEEXT = @EXEEXT@ LIB_TAG = @LIB_TAG@ PKG_CONFIG_ENV = @PKG_CONFIG_ENV@ RPATHCMD = @RPATHCMD@ EXECUTABLES_list = \ x00f$(EXEEXT) \ x01f$(EXEEXT) \ x02f$(EXEEXT) \ x03f$(EXEEXT) \ x04f$(EXEEXT) \ x05f$(EXEEXT) \ x06f$(EXEEXT) \ x07f$(EXEEXT) \ x08f$(EXEEXT) \ x09f$(EXEEXT) \ x10f$(EXEEXT) \ x11f$(EXEEXT) \ x12f$(EXEEXT) \ x13f$(EXEEXT) \ x14f$(EXEEXT) \ x15f$(EXEEXT) \ x16f$(EXEEXT) \ x16af$(EXEEXT) \ x17f$(EXEEXT) \ x18f$(EXEEXT) \ x19f$(EXEEXT) \ x20f$(EXEEXT) \ x21f$(EXEEXT) \ x22f$(EXEEXT) \ x23f$(EXEEXT) \ x24f$(EXEEXT) \ x25f$(EXEEXT) \ x26f$(EXEEXT) \ x27f$(EXEEXT) \ x28f$(EXEEXT) \ x29f$(EXEEXT) \ x30f$(EXEEXT) \ x31f$(EXEEXT) \ x33f$(EXEEXT) all: $(EXECUTABLES_list) clean: rm -f $(EXECUTABLES_list) .f90$(EXEEXT): $(F95) @MODULESINCCMD@ $< -o $@ $(RPATHCMD) `$(PKG_CONFIG_ENV) pkg-config @PC_STATIC_OPTION@ --cflags --libs plplot$(LIB_TAG)-f95` -lplf95demolib$(LIB_TAG) .SUFFIXES: .f90 $(EXEEXT) plplot-5.10.0+dfsg/examples/f95/x16af.f90 644 1750 1750 2150312140337537 164440ustar andrewandrew! $Id: x16af.f90 12320 2013-05-02 01:20:31Z arjenmarkus $ ! Demonstration of plshade plotting ! Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use plplot implicit none ! Process command-line arguments call plparseopts(PL_PARSE_FULL) call plscmap0n(3) ! Initialize plplot call plinit() ! Rectangular coordinate plot call rect() ! Polar coordinate plot call polar() call plend end ! Plot function using the identity transform subroutine rect() use plplot implicit none integer xdim, ydim, NX, NY, NCONTR ! xdim and ydim are the static dimensions of the 2D arrays while ! NX and NY are the defined area. parameter (xdim = 99, NX = 35, ydim = 100, NY = 46, NCONTR = 14) real(kind=plflt) z(xdim, ydim), w(xdim, ydim), clevel(NCONTR) real(kind=plflt) xmin, xmax, ymin, ymax, zmin, zmax, x, y real(kind=plflt) shade_min, shade_max, sh_color integer i, j, sh_cmap integer min_color, max_color real(kind=plflt) sh_width, min_width, max_width xmin = -1._plflt ymin = -1._plflt xmax = 1._plflt ymax = 1._plflt ! Set up for plshade call sh_cmap = 1 min_color = 1 min_width = 0 max_color = 0 max_width = 0 ! Set up data arrays do i = 1, NX x = (i - 1 - (NX/2)) / dble (NX/2) do j = 1, NY y = (j - 1 - (NY/2)) / dble (NY/2) - 1.0_plflt z(i,j) = x*x - y*y + (x - y) / (x*x + y*y + 0.1_plflt) w(i,j) = 2*x*y enddo enddo call a2mnmx(z, NX, NY, zmin, zmax, xdim) do i = 1, NCONTR clevel(i) = zmin + (zmax - zmin) * (i + 0.5_plflt) / & dble (NCONTR) enddo ! Plot using identity transform call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) do i = 1, NCONTR shade_min = zmin + (zmax - zmin) * dble (i - 1) / & dble (NCONTR) shade_max = zmin + (zmax - zmin) * dble (i) / & dble (NCONTR) sh_color = dble (i - 1) / dble (NCONTR - 1) sh_width = 2 call plpsty(0) call plshade(z(:NX,:NY), ' ', & -1._plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt, & shade_min, shade_max, & sh_cmap, sh_color, sh_width, & min_color, min_width, max_color, max_width ) enddo call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call pllab('distance', 'altitude', 'Bogon flux') end ! Routine for demonstrating use_ of transformation arrays in contour plots. subroutine polar() use plplot, TWOPI => PL_TWOPI implicit none integer xdim, ydim, NX, NY, NCONTR, NBDRY ! xdim and ydim are the static dimensions of the 2D arrays while ! NX and NY are the defined area. parameter (xdim = 99, NX = 40, ydim = 100, NY = 64) parameter (NCONTR = 14, NBDRY=200) real(kind=plflt) z(xdim, ydim), ztmp(xdim, ydim+1) real(kind=plflt) xg(xdim, ydim+1), yg(xdim, ydim+1), & xtm(NBDRY), ytm(NBDRY) real(kind=plflt) clevel(NCONTR) real(kind=plflt) xmin, xmax, ymin, ymax, zmin, zmax real(kind=plflt) xpmin, xpmax, ypmin, ypmax real(kind=plflt) r, theta, rmax, x0, y0 real(kind=plflt) eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i real(kind=plflt) div1, div1i, div2, div2i real(kind=plflt) shade_min, shade_max, sh_color real(kind=plflt) xtick, ytick integer nxsub, nysub integer ncolbox, ncollab integer i, j, kx, lx, ky, ly integer sh_cmap integer min_color, max_color real(kind=plflt) sh_width, min_width, max_width character(len=8) xopt, yopt ! Set up for plshade call sh_cmap = 1 min_color = 1 min_width = 0 max_color = 0 max_width = 0 kx = 1 lx = NX ky = 1 ly = NY ! Set up r-theta grids ! Tack on extra cell in theta to handle periodicity. do i = 1, NX r = i - 0.5_plflt do j = 1, NY theta = TWOPI/dble(NY) * (j-0.5_plflt) xg(i,j) = r * cos(theta) yg(i,j) = r * sin(theta) enddo xg(i, NY+1) = xg(i, 1) yg(i, NY+1) = yg(i, 1) enddo call a2mnmx(xg, NX, NY, xmin, xmax, xdim) call a2mnmx(yg, NX, NY, ymin, ymax, xdim) rmax = r x0 = (xmin + xmax)/2._plflt y0 = (ymin + ymax)/2._plflt ! Potential inside a conducting cylinder (or sphere) by method of images. ! Charge 1 is placed at (d1, d1), with image charge at (d2, d2). ! Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). ! Also put in smoothing term at small distances. eps = 2._plflt q1 = 1._plflt d1 = r/4._plflt q1i = - q1*r/d1 d1i = r**2/d1 q2 = -1._plflt d2 = r/4._plflt q2i = - q2*r/d2 d2i = r**2/d2 do i = 1, NX do j = 1, NY div1 = sqrt((xg(i,j)-d1)**2 + (yg(i,j)-d1)**2 + eps**2) div1i = sqrt((xg(i,j)-d1i)**2 + (yg(i,j)-d1i)**2 + eps**2) div2 = sqrt((xg(i,j)-d2)**2 + (yg(i,j)+d2)**2 + eps**2) div2i = sqrt((xg(i,j)-d2i)**2 + (yg(i,j)+d2i)**2 + eps**2) z(i,j) = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i enddo enddo ! Tack on extra cell in theta to handle periodicity. do i = 1, NX do j = 1, NY ztmp(i,j) = z(i,j) enddo ztmp(i, NY+1) = z(i, 1) enddo call a2mnmx(z, NX, NY, zmin, zmax, xdim) ! Set up contour levels. do i = 1, NCONTR clevel(i) = zmin + (i-0.5_plflt)*abs(zmax - zmin)/dble(NCONTR) enddo ! Advance graphics frame and get ready to plot. ncolbox = 1 ncollab = 2 call pladv(0) call plcol0(ncolbox) ! Scale window to user coordinates. ! Make a bit larger so the boundary does not get clipped. eps = 0.05_plflt xpmin = xmin - abs(xmin)*eps xpmax = xmax + abs(xmax)*eps ypmin = ymin - abs(ymin)*eps ypmax = ymax + abs(ymax)*eps call plvpas(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt, 1.0_plflt) call plwind(xpmin, xpmax, ypmin, ypmax) xopt = ' ' yopt = ' ' xtick = 0._plflt nxsub = 0 ytick = 0._plflt nysub = 0 call plbox(xopt, xtick, nxsub, yopt, ytick, nysub) ! Call plotter once for z < 0 (dashed), once for z > 0 (solid lines). do i = 1, NCONTR shade_min = zmin + (zmax - zmin) * dble (i - 1) / & dble (NCONTR) shade_max = zmin + (zmax - zmin) * dble (i) / & dble (NCONTR) sh_color = dble (i - 1) / dble (NCONTR - 1) sh_width = 2 call plpsty(0) call plshade(z(:NX,:NY), ' ', & -1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt, & shade_min, shade_max, & sh_cmap, sh_color, sh_width, & min_color, min_width, max_color, max_width, & xg(:NX,:NY), yg(:NX,:NY) ) enddo ! Draw boundary. do i = 1, NBDRY theta = (TWOPI)/(NBDRY-1) * dble(i-1) xtm(i) = x0 + rmax * cos(theta) ytm(i) = y0 + rmax * sin(theta) enddo call plcol0(ncolbox) call plline(xtm, ytm) call plcol0(ncollab) call pllab(' ', ' ', & 'Shielded potential of charges in a conducting sphere') end !---------------------------------------------------------------------------- ! Subroutine a2mnmx ! Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) use plplot implicit none integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax fmax = f(1, 1) fmin = fmax do j = 1, ny do i = 1, nx fmax = max(fmax, f(i, j)) fmin = min(fmin, f(i, j)) enddo enddo end plplot-5.10.0+dfsg/examples/f95/x24f.f90 644 1750 1750 765311647656237 163100ustar andrewandrew! $Id: x24f.f90 11984 2011-10-19 23:26:23Z andrewross $ ! ! Unicode Pace Flag ! ! Copyright (C) 2005 Rafael Laboissiere ! Copyright (2) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! ! In Debian, run like this: ! ! ( TTFDIR=/usr/share/fonts/truetype ; \ ! PLPLOT_FREETYPE_SANS_FONT=$TTFDIR/arphic/bkai00mp.ttf \ ! PLPLOT_FREETYPE_SERIF_FONT=$TTFDIR/freefont/FreeSerif.ttf \ ! PLPLOT_FREETYPE_MONO_FONT=$TTFDIR/ttf-devanagari-fonts/lohit_hi.ttf \ ! PLPLOT_FREETYPE_SCRIPT_FONT=$TTFDIR/unfonts/UnBatang.ttf \ ! PLPLOT_FREETYPE_SYMBOL_FONT=$TTFDIR/ttf-bengali-fonts/JamrulNormal.ttf \ ! ./x24f -dev png -o x24f95.png ) ! ! Packages needed: ! ! ttf-arphic-bkai00mp ! ttf-freefont ! ttf-devanagari-fonts ! ttf-unfonts ! ttf-bengali-fonts ! ! For the latest Ubuntu systems lohit_hi.ttf has been moved to the ! ttf-indic-fonts-core package instead of ttf-devanagari-fonts so you ! will have to use this package instead and update the font path. program x24f use plplot implicit none integer i, j integer red(7) integer green(7) integer blue(7) real(kind=plflt) px(4) real(kind=plflt) py(4) real(kind=plflt) sx(12) real(kind=plflt) sy(12) character(len=30) peace(12) data (red(i) ,i=1,7) / 240, 204, 204, 204, 0, 39, 125 / data (green(i) ,i=1,7) / 240, 0, 125, 204, 204, 80, 0 / data (blue(i) ,i=1,7) / 240, 0, 0, 0, 0, 204, 125 / data (px(i) ,i=1,4) / 0.0d0, 0.0d0, 1.0d0, 1.0d0 / data (py(i) ,i=1,4) / 0.0d0, 0.25d0, 0.25d0, 0.0d0 / data (sx(i) ,i=1,12) / & 0.16374, & 0.15844, & 0.15255, & 0.17332, & 0.50436, & 0.51721, & 0.49520, & 0.48713, & 0.83976, & 0.81688, & 0.82231, & 0.82647/ data (sy(i) ,i=1,12) / & 0.125, & 0.375, & 0.625, & 0.875, & 0.125, & 0.375, & 0.625, & 0.875, & 0.125, & 0.375, & 0.625, & 0.875/ ! Taken from http://www.columbia.edu/~fdc/pace/ ! Mandarin peace(1) = '#<0x00>和平' ! Hindi peace(2) = '#<0x20>शांति' ! English peace(3) = '#<0x10>Peace' ! Hebrew peace(4) = '#<0x10>שלום' ! Russian peace(5) = '#<0x10>Мир' ! German peace(6) = '#<0x10>Friede' ! Korean peace(7) = '#<0x30>평화' ! French peace(8) = '#<0x10>Paix' ! Spanish peace(9) = '#<0x10>Paz' ! Arabic peace(10) = '#<0x10>ﺳﻼم' ! Turkish peace(11) = '#<0x10>Barış' ! Kurdish peace(12) = '#<0x10>Hasîtî' call plparseopts(PL_PARSE_FULL) call plinit() call pladv(0) call plvpor (0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plwind (0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plcol0 (0) call plbox ('', 1.0_plflt, 0, '', 1.0_plflt, 0) call plscmap0n (7) call plscmap0 (red, green, blue) call plschr (0.0_plflt, 4.0_plflt) call plfont (1) do i = 1,4 call plcol0 (i) call plfill (px, py) do j = 1,4 py (j) = py (j) + 1.0_plflt / 4.0_plflt enddo enddo call plcol0 (0) do i = 1,12 call plptex (sx (i), sy (i), 1.0_plflt, 0.0_plflt, 0.5_plflt, peace (i)) enddo call plend() end program x24f plplot-5.10.0+dfsg/examples/f95/x05f.f90 644 1750 1750 276311667625102 162710ustar andrewandrew! $Id: x05f.f90 12097 2011-12-07 08:56:34Z arjenmarkus $ ! Draws a histogram from sample data ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x04f95 use plplot, PI => PL_PI use plf95demolib implicit none integer, parameter :: NPTS = 2047 real(kind=plflt) :: data(NPTS), delta ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit() ! Fill up data points delta = 2.0_plflt * PI / dble (NPTS) data = sin(delta*arange(0, NPTS)) call plcol0(1) call plhist(data, -1.1_plflt, 1.1_plflt, 44, 0) call plcol0(2) call pllab('#frValue','#frFrequency', & '#frPLplot Example 5 - Probability function of Oscillator') call plend end program x04f95 plplot-5.10.0+dfsg/examples/f95/x00f.f90 644 1750 1750 347212232323306 162500ustar andrewandrew! $Id: x00f.f90 12626 2013-10-24 23:01:26Z andrewross $ ! ! Simple demo of a 2D line plot. ! ! Copyright (C) 2011 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x00f95 use plf95demolib integer, parameter :: NSIZE = 101 real(kind=plflt), dimension(NSIZE) :: x, y real(kind=plflt) :: xmin = 0._plflt, xmax = 1._plflt, ymin = 0._plflt, ymax = 100._plflt ! integer :: i ! Prepare data to be plotted. x = arange(0, NSIZE) / real(NSIZE-1,plflt) y = ymax * x**2 ! Or alternatively, using a DO-loop !do i = 1,NSIZE ! x(i) = real( i - 1, plflt ) / real( NSIZE - 1, plflt ) ! y(i) = ymax * x(i)**2 !enddo ! Parse and process command line arguments call plparseopts( PL_PARSE_FULL ) ! Initialize plplot call plinit ! Create a labelled box to hold the plot. call plenv( xmin, xmax, ymin, ymax, 0, 0 ) call pllab( "x", "y=100 x#u2#d", "Simple PLplot demo of a 2D line plot" ) ! Plot the data that was prepared above. call plline( x, y ) ! Close PLplot library call plend end program x00f95 plplot-5.10.0+dfsg/examples/f95/x33f.f90 644 1750 1750 10563712232323306 163240ustar andrewandrew! -*- coding: utf-8; -*- ! ! $Id: x33f.f90 12626 2013-10-24 23:01:26Z andrewross $ ! ! Demonstrate most pllegend capability including unicode symbols. ! ! Copyright (C) 2010 Alan Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! ! This example designed just for devices (e.g., the cairo-related and ! qt-related devices) where the best choice of glyph is automatically ! selected by the related libraries (pango/cairo or Qt4) for each ! unicode character depending on what system fonts are installed. Of ! course, you must have the appropriate TrueType fonts installed to ! have access to all the required glyphs. !-------------------------------------------------------------------------- ! main ! ! Demonstrate most pllegend capability including unicode symbols. ! -------------------------------------------------------------------------- use plplot implicit none integer, parameter :: MAX_NLEGEND = 7 integer :: i, k integer :: opt, position integer :: nlegend, nturn integer :: opt_array(MAX_NLEGEND) integer :: text_colors(MAX_NLEGEND) integer :: box_colors(MAX_NLEGEND) integer :: box_patterns(MAX_NLEGEND) real(kind=plflt) :: box_scales(MAX_NLEGEND) real(kind=plflt) :: box_line_widths(MAX_NLEGEND) integer :: line_colors(MAX_NLEGEND) integer :: line_styles(MAX_NLEGEND) real(kind=plflt) :: line_widths(MAX_NLEGEND) integer :: symbol_numbers(MAX_NLEGEND), symbol_colors(MAX_NLEGEND) real(kind=plflt) :: symbol_scales(MAX_NLEGEND) character(len=200) :: text(MAX_NLEGEND) character(len=3) :: symbols(MAX_NLEGEND) real(kind=plflt) :: legend_width, legend_height, x, y, xstart, ystart real(kind=plflt) :: max_height, text_scale integer :: opt_base, nrow, ncolumn integer :: position_options(16) character(len=3) :: special_symbols(5) real(kind=plflt) :: values_small(2) real(kind=plflt) :: values_uneven(9) real(kind=plflt) :: values_even(9) integer, parameter :: COLORBAR_KINDS = 4 integer :: colorbar_option_kinds(COLORBAR_KINDS) character(len=100) :: colorbar_option_kind_labels(COLORBAR_KINDS) integer, parameter :: COLORBAR_POSITIONS = 4 integer :: colorbar_position_options(COLORBAR_POSITIONS) character(len=100) :: colorbar_position_option_labels(COLORBAR_POSITIONS) integer, parameter :: COLORBAR_LABELS = 4 integer :: colorbar_label_options(COLORBAR_LABELS) character(len=100) :: colorbar_label_option_labels(COLORBAR_LABELS) integer, parameter :: COLORBAR_CAPS = 4 integer :: colorbar_cap_options(COLORBAR_CAPS) character(len=100) :: colorbar_cap_option_labels(COLORBAR_CAPS) ! Pick 5 arbitrary UTF-8 symbols useful for plotting points (✠✚✱✪✽✺✰✴✦). data special_symbols / & '✰', & '✴', & '✱', & '✽', & '✦' / data values_small / -1.0e-200_plflt, 1.0e-200_plflt / data values_uneven & / -1.0e-200_plflt, 2.0e-200_plflt, 2.6e-200_plflt, 3.4e-200_plflt, & 6.0e-200_plflt, 7.0e-200_plflt, 8.0e-200_plflt, 9.0e-200_plflt, & 10.0e-200_plflt / data values_even & / -2.0e-200_plflt, -1.0e-200_plflt, 0.0e-200_plflt, 1.0e-200_plflt, & 2.0e-200_plflt, 3.0e-200_plflt, 4.0e-200_plflt, 5.0e-200_plflt, & 6.0e-200_plflt / position_options(1) = PL_POSITION_LEFT + PL_POSITION_TOP + PL_POSITION_OUTSIDE position_options(2) = PL_POSITION_TOP + PL_POSITION_OUTSIDE position_options(3) = PL_POSITION_RIGHT + PL_POSITION_TOP + PL_POSITION_OUTSIDE position_options(4) = PL_POSITION_RIGHT + PL_POSITION_OUTSIDE position_options(5) = PL_POSITION_RIGHT + PL_POSITION_BOTTOM + PL_POSITION_OUTSIDE position_options(6) = PL_POSITION_BOTTOM + PL_POSITION_OUTSIDE position_options(7) = PL_POSITION_LEFT + PL_POSITION_BOTTOM + PL_POSITION_OUTSIDE position_options(8) = PL_POSITION_LEFT + PL_POSITION_OUTSIDE position_options(9) = PL_POSITION_LEFT + PL_POSITION_TOP + PL_POSITION_INSIDE position_options(10) = PL_POSITION_TOP + PL_POSITION_INSIDE position_options(11) = PL_POSITION_RIGHT + PL_POSITION_TOP + PL_POSITION_INSIDE position_options(12) = PL_POSITION_RIGHT + PL_POSITION_INSIDE position_options(13) = PL_POSITION_RIGHT + PL_POSITION_BOTTOM + PL_POSITION_INSIDE position_options(14) = PL_POSITION_BOTTOM + PL_POSITION_INSIDE position_options(15) = PL_POSITION_LEFT + PL_POSITION_BOTTOM + PL_POSITION_INSIDE position_options(16) = PL_POSITION_LEFT + PL_POSITION_INSIDE ! plcolorbar options ! Colorbar type options colorbar_option_kinds(1) = PL_COLORBAR_SHADE colorbar_option_kinds(2) = PL_COLORBAR_SHADE + PL_COLORBAR_SHADE_LABEL colorbar_option_kinds(3) = PL_COLORBAR_IMAGE colorbar_option_kinds(4) = PL_COLORBAR_GRADIENT colorbar_option_kind_labels(1) = "Shade colorbars" colorbar_option_kind_labels(2) = "Shade colorbars with custom labels" colorbar_option_kind_labels(3) = "Image colorbars" colorbar_option_kind_labels(4) = "Gradient colorbars" ! Which side of the page are we positioned relative to? colorbar_position_options(1) = PL_POSITION_LEFT colorbar_position_options(2) = PL_POSITION_RIGHT colorbar_position_options(3) = PL_POSITION_TOP colorbar_position_options(4) = PL_POSITION_BOTTOM colorbar_position_option_labels(1) = "Left" colorbar_position_option_labels(2) = "Right" colorbar_position_option_labels(3) = "Top" colorbar_position_option_labels(4) = "Bottom" ! Colorbar label positioning options colorbar_label_options(1) = PL_COLORBAR_LABEL_LEFT colorbar_label_options(2) = PL_COLORBAR_LABEL_RIGHT colorbar_label_options(3) = PL_COLORBAR_LABEL_TOP colorbar_label_options(4) = PL_COLORBAR_LABEL_BOTTOM colorbar_label_option_labels(1) = "Label left" colorbar_label_option_labels(2) = "Label right" colorbar_label_option_labels(3) = "Label top" colorbar_label_option_labels(4) = "Label bottom" ! Colorbar cap options colorbar_cap_options(1) = PL_COLORBAR_CAP_NONE colorbar_cap_options(2) = PL_COLORBAR_CAP_LOW colorbar_cap_options(3) = PL_COLORBAR_CAP_HIGH colorbar_cap_options(4) = PL_COLORBAR_CAP_LOW + PL_COLORBAR_CAP_HIGH colorbar_cap_option_labels(1) = "No caps" colorbar_cap_option_labels(2) = "Low cap" colorbar_cap_option_labels(3) = "High cap" colorbar_cap_option_labels(4) = "Low and high caps" ! Parse and process command line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit ! First page illustrating the 16 standard positions. call pladv( 0 ) call plvpor( 0.25_plflt, 0.75_plflt, 0.25_plflt, 0.75_plflt ) call plwind( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plbox( 'bc', 0.0_plflt, 0, 'bc', 0.0_plflt, 0 ) call plsfont( PL_FCI_SANS, -1, -1 ) call plmtex( 't', 8.0_plflt, 0.5_plflt, 0.5_plflt, & 'The 16 standard legend positions with' ) call plmtex( 't', 6.0_plflt, 0.5_plflt, 0.5_plflt, & 'the same (0.05) offset in x and y' ) nlegend = 1 ! Only specify legend data that are required according to the ! value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX opt_array(1) = PL_LEGEND_LINE + PL_LEGEND_SYMBOL line_styles(1) = 1 line_widths(1) = 1 symbol_scales(1) = 1._plflt symbol_numbers(1) = 4 symbols(1) = '*' ! Use monotype fonts so that all legends are the same size. call plsfont( PL_FCI_MONO, -1, -1 ) call plscol0a( 15, 32, 32, 32, 0.70_plflt ) do k = 1,16 position = position_options(k) opt = opt_base text_colors(1) = 1 + mod( k-1, 8 ) line_colors(1) = 1 + mod( k-1, 8 ) symbol_colors(1) = 1 + mod( k-1, 8 ) write( text(1), '(i2.2)' ) k-1 call pllegend( legend_width, legend_height, opt, position, & 0.05_plflt, 0.05_plflt, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) enddo ! Second page illustrating effect of nrow, ncolumn for the same legend ! data. call pladv( 0 ) call plvpor( 0.25_plflt, 0.75_plflt, 0.25_plflt, 0.75_plflt ) call plwind( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plbox( 'bc', 0.0_plflt, 0, 'bc', 0.0_plflt, 0 ) call plsfont( PL_FCI_SANS, -1, -1 ) call plmtex( 't', 8.0_plflt, 0.5_plflt, 0.5_plflt, & 'The effect of nrow, ncolumn, PL_LEGEND_ROW_MAJOR,' ) call plmtex( 't', 6.0_plflt, 0.5_plflt, 0.5_plflt, & 'and position for the same legend data' ) nlegend = 7 ! Only specify legend data that are required according to the ! value of opt_array for that entry. opt_base = PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX do 120 k = 1,nlegend opt_array(k) = PL_LEGEND_LINE + PL_LEGEND_SYMBOL line_styles(k) = 1 line_widths(k) = 1 symbol_scales(k) = 1._plflt symbol_numbers(k) = 2 symbols(k) = '*' write( text(k), '(i2.2)' ) k-1 text_colors(k) = 1 + mod( k-1, 8 ) line_colors(k) = 1 + mod( k-1, 8 ) symbol_colors(k) = 1 + mod( k-1, 8 ) 120 continue ! Use monotype fonts so that all legends are the same size. call plsfont( PL_FCI_MONO, -1, -1 ) call plscol0a( 15, 32, 32, 32, 0.70_plflt ) position = PL_POSITION_TOP + PL_POSITION_OUTSIDE opt = opt_base x = 0._plflt y = 0.1_plflt nrow = 1 ncolumn = nlegend call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_BOTTOM + PL_POSITION_OUTSIDE opt = opt_base x = 0._plflt y = 0.1_plflt nrow = 1 ncolumn = nlegend call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_LEFT + PL_POSITION_OUTSIDE opt = opt_base x = 0.1_plflt y = 0._plflt nrow = nlegend ncolumn = 1 call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_RIGHT + PL_POSITION_OUTSIDE opt = opt_base x = 0.1_plflt y = 0._plflt nrow = nlegend ncolumn = 1 call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_LEFT + PL_POSITION_TOP + PL_POSITION_INSIDE opt = opt_base x = 0._plflt y = 0._plflt nrow = 6 ncolumn = 2 call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_RIGHT + PL_POSITION_TOP + PL_POSITION_INSIDE opt = opt_base + PL_LEGEND_ROW_MAJOR x = 0._plflt y = 0._plflt nrow = 6 ncolumn = 2 call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) position = PL_POSITION_BOTTOM + PL_POSITION_INSIDE opt = opt_base + PL_LEGEND_ROW_MAJOR x = 0._plflt y = 0._plflt nrow = 3 ncolumn = 3 call pllegend( legend_width, legend_height, opt, position, x, y, & 0.05_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) ! Third page demonstrating legend alignment call pladv( 0 ) call plvpor( 0.0_plflt, 1.0_plflt, 0.0_plflt, 0.9_plflt ) call plwind( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plsfont( PL_FCI_SANS, -1, -1 ) call plmtex( 't', 2.0_plflt, 0.5_plflt, 0.5_plflt, & 'Demonstrate legend alignment' ) x = 0.1_plflt y = 0.1_plflt nturn = 5 nlegend = 0 position = PL_POSITION_TOP + PL_POSITION_LEFT + PL_POSITION_SUBPAGE opt_base = PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX opt = opt_base do i = 1,9 ! Set up legend arrays with the correct size, type. if ( i .le. nturn ) then nlegend = nlegend + 1 else nlegend = nlegend - 1 endif nlegend = max( 1, nlegend ) ! nly specify legend data that are required according to the ! value of opt_array for that entry. do k = 1,nlegend opt_array(k) = PL_LEGEND_LINE + PL_LEGEND_SYMBOL line_styles(k) = 1 line_widths(k) = 1 symbol_scales(k) = 1._plflt symbol_numbers(k) = 2 symbols(k) = '*' write( text(k), '(i2.2)' ) k-1 text_colors(k) = 1 + mod( k-1, 8 ) line_colors(k) = 1 + mod( k-1, 8 ) symbol_colors(k) = 1 + mod( k-1, 8 ) enddo ! Use monotype fonts so that all legends are the same size. call plsfont( PL_FCI_MONO, -1, -1 ) call plscol0a( 15, 32, 32, 32, 0.70_plflt ) nrow = MIN( 3, nlegend ) ncolumn = 0 call pllegend( legend_width, legend_height, opt, position, & x, y, & 0.025_plflt, 15, 1, 1, nrow, ncolumn, & opt_array(1:nlegend), 1.0_plflt, 1.0_plflt, 1.5_plflt, & 1._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) if ( i .eq. nturn ) then position = PL_POSITION_TOP + PL_POSITION_RIGHT + PL_POSITION_SUBPAGE opt = opt_base x = 1._plflt - x y = y + legend_height else x = x + legend_width y = y + legend_height endif enddo ! Fourth page illustrating various kinds of legends max_height = 0._plflt xstart = 0.0_plflt ystart = 0.1_plflt x = xstart y = ystart text_scale = 0.90_plflt call pladv( 0 ) call plvpor( 0.0_plflt, 1._plflt, 0.0_plflt, 0.90_plflt ) call plwind( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) ! call plbox('bc', 0.0, 0, 'bc', 0.0_plflt, 0) call plsfont( PL_FCI_SANS, -1, -1 ) call plmtex( 't', 2.0_plflt, 0.5_plflt, 0.5_plflt, & 'Demonstrate Various Kinds of Legends' ) nlegend = 5 ! Only specify legend data that are required according to the ! value of opt_array for that entry. position = PL_POSITION_LEFT + PL_POSITION_TOP opt_base = PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX + PL_LEGEND_TEXT_LEFT ! Set up None, Box, Line, Symbol, and Line & Symbol legend entries. opt_array(1) = PL_LEGEND_NONE text(1) = 'None' text_colors(1) = 1 opt_array(2) = PL_LEGEND_COLOR_BOX text(2) = 'Box' text_colors(2) = 2 box_colors(2) = 2 box_patterns(2) = 0 box_scales(2) = 0.8_plflt box_line_widths(2) = 1 opt_array(3) = PL_LEGEND_LINE text(3) = 'Line' text_colors(3) = 3 line_colors(3) = 3 line_styles(3) = 1 line_widths(3) = 1 opt_array(4) = PL_LEGEND_SYMBOL text(4) = 'Symbol' text_colors(4) = 4 symbol_colors(4) = 4 symbol_scales(4) = text_scale symbol_numbers(4) = 4 symbols(4) = special_symbols(3) opt_array(5) = PL_LEGEND_SYMBOL + PL_LEGEND_LINE text(5) = 'L & S' text_colors(5) = 5 line_colors(5) = 5 line_styles(5) = 1 line_widths(5) = 1 symbol_colors(5) = 5 symbol_scales(5) = text_scale symbol_numbers(5) = 4 symbols(5) = special_symbols(3) opt = opt_base call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up symbol legend entries with various symbols. do i = 1,nlegend opt_array(i) = PL_LEGEND_SYMBOL text(i) = 'Symbol ' // special_symbols(i) text_colors(i) = i symbol_colors(i) = i symbol_scales(i) = text_scale symbol_numbers(i) = 4 symbols(i) = special_symbols(i) enddo opt = opt_base x = x + legend_width call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up symbol legend entries with various numbers of symbols. do i = 1,nlegend opt_array(i) = PL_LEGEND_SYMBOL write( text(i), '(a,i0)' ) 'Symbol Number ', i+1 text_colors(i) = i symbol_colors(i) = i symbol_scales(i) = text_scale symbol_numbers(i) = i + 1 symbols(i) = special_symbols(3) enddo opt = opt_base x = x + legend_width call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up box legend entries with various colours. do i = 1,nlegend opt_array(i) = PL_LEGEND_COLOR_BOX write( text(i), '(a,i0)' ) 'Box Color ', i text_colors(i) = i box_colors(i) = i box_patterns(i) = 0 box_scales(i) = 0.8_plflt box_line_widths(i) = 1 enddo opt = opt_base ! Use new origin x = xstart y = y + max_height max_height = 0._plflt call plscol0a( 15, 32, 32, 32, 0.70_plflt) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up box legend entries with various patterns. do i = 1,nlegend opt_array(i) = PL_LEGEND_COLOR_BOX write( text(i), '(a,i0)' ) 'Box Pattern ', i-1 text_colors(i) = 2 box_colors(i) = 2 box_patterns(i) = i - 1 box_scales(i) = 0.8_plflt box_line_widths(i) = 1 enddo opt = opt_base x = x + legend_width call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up box legend entries with various box pattern line widths. do i = 1,nlegend opt_array(i) = PL_LEGEND_COLOR_BOX write( text(i), '(a,i0)' ) 'Box Line Width ', i text_colors(i) = 2 box_colors(i) = 2 box_patterns(i) = 3 box_scales(i) = 0.8_plflt box_line_widths(i) = i enddo opt = opt_base x = x + legend_width call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up line legend entries with various colours. do i =1,nlegend opt_array(i) = PL_LEGEND_LINE write( text(i), '(a,i0)' ) 'Line Color ', i text_colors(i) = i line_colors(i) = i line_styles(i) = 1 line_widths(i) = 1 enddo opt = opt_base ! Use new origin x = xstart y = y + max_height max_height = 0._plflt call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up line legend entries with various styles. do i = 1,nlegend opt_array(i) = PL_LEGEND_LINE write( text(i), '(a,i0)' ) 'Line Style ', i text_colors(i) = 2 line_colors(i) = 2 line_styles(i) = i line_widths(i) = 1 enddo opt = opt_base x = x + legend_width call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Set up line legend entries with various widths. do i =1,nlegend opt_array(i) = PL_LEGEND_LINE write( text(i), '(a,i0)' ) 'Line Width ', i text_colors(i) = 2 line_colors(i) = 2 line_styles(i) = 1 line_widths(i) = i enddo opt = opt_base x = x + legend_width call plscol0a( 15, 32, 32, 32, 0.70_plflt ) call pllegend( legend_width, legend_height, opt, position, x, y, & 0.1_plflt, 15, 1, 1, 0, 0, & opt_array(1:nlegend), 1.0_plflt, text_scale, 2.0_plflt, & 0._plflt, text_colors, text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) max_height = max( max_height, legend_height ) ! Color bar examples ! Use unsaturated green background colour to contrast with black caps. call plscolbg( 70, 185, 70 ) ! Cut out the greatest and smallest bits of the color spectrum to ! leave colors for the end caps. call plscmap1_range( 0.01_plflt, 0.99_plflt ) ! We can only test image and gradient colorbars with two element arrays do i = 2,COLORBAR_KINDS-1 call plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0._plflt, 2, values_small ) enddo ! Test shade colorbars with larger arrays do i = 0,1 call plcolorbar_example( "cmap1_blue_yellow.pal", i, 4, 2._plflt, 9, values_even ) enddo do i = 0,1 call plcolorbar_example( "cmap1_blue_yellow.pal", i, 0, 0._plflt, 9, values_uneven ) enddo call plend() contains subroutine plcolorbar_example_page( kind_i, label_i, cap_i, cont_color, cont_width, n_values, values ) use plplot implicit none integer :: kind_i, label_i, cap_i, cont_color, n_values real(kind=plflt) :: cont_width real(kind=plflt), dimension(:) :: values ! Parameters for the colorbars on this page integer :: position_i, position, opt real(kind=plflt) :: x, y, x_length, y_length; real(kind=plflt) :: ticks(1) integer :: sub_ticks(1) real(kind=plflt) :: low_cap_color, high_cap_color logical :: vertical, ifn character(len=20) :: axis_opts(1) integer :: label_opts(1) character(len=200) :: labels(1) character(len=200) :: title real(kind=plflt) :: colorbar_width, colorbar_height integer :: n_values_array(1); real(kind=plflt), allocatable, dimension(:,:) :: values_array ticks(1) = 0.0_plflt sub_ticks(1) = 0 label_opts(1) = 0 n_values_array(1) = n_values allocate(values_array(1,n_values)) values_array(1,:) = values(:) low_cap_color = 0.0_plflt; high_cap_color = 1.0_plflt; ! Start a new page call pladv( 0 ) ! Draw one colorbar relative to each side of the page do position_i = 0,COLORBAR_POSITIONS-1 position = colorbar_position_options(position_i+1); opt = ior( & colorbar_option_kinds(kind_i+1), & ior(colorbar_label_options(label_i+1), & colorbar_cap_options(cap_i+1) ) ) vertical = (iand(position, PL_POSITION_LEFT) > 0 .or. iand(position, PL_POSITION_RIGHT) > 0 ) ifn = (iand(position, PL_POSITION_LEFT) > 0 .or. iand(position, PL_POSITION_BOTTOM) > 0 ) ! Set the offset position on the page if (vertical .eqv. .true.) then x = 0.0_plflt y = 0.0_plflt x_length = 0.05_plflt y_length = 0.5_plflt else x = 0.0_plflt y = 0.0_plflt x_length = 0.5_plflt y_length = 0.05_plflt endif ! Set appropriate labelling options. if (ifn .eqv. .true.) then if ( cont_color .eq. 0 .or. cont_width .eq. 0._plflt ) then axis_opts(1) = "uwtivn" else axis_opts(1) = "uwxvn" endif else if ( cont_color .eq. 0 .or. cont_width .eq. 0._plflt ) then axis_opts(1) = "uwtivm" else axis_opts(1) = "uwxvm" endif endif write(labels(1), '(3A)') trim(colorbar_position_option_labels(position_i+1)), & ', ', trim(colorbar_label_option_labels(label_i+1)) ! Smaller text call plschr( 0.0_plflt, 0.75_plflt ) ! Small ticks on the vertical axis call plsmaj( 0.0_plflt, 0.5_plflt ) call plsmin( 0.0_plflt, 0.5_plflt ) call plvpor( 0.20_plflt, 0.80_plflt, 0.20_plflt, 0.80_plflt ) call plwind( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) ! Set interesting background colour. call plscol0a( 15, 0, 0, 0, 0.20_plflt ) call plcolorbar( colorbar_width, colorbar_height, & ior(opt, ior(PL_COLORBAR_BOUNDING_BOX, PL_COLORBAR_BACKGROUND)), position, & x, y, x_length, y_length, & 15, 1, 1, & low_cap_color, high_cap_color, & cont_color, cont_width, & label_opts, labels, & axis_opts, ticks, sub_ticks, & n_values_array, values_array ) ! Reset text and tick sizes call plschr( 0.0_plflt, 1.0_plflt ) call plsmaj( 0.0_plflt, 1.0_plflt ) call plsmin( 0.0_plflt, 1.0_plflt ) enddo ! Draw a page title write(title, '(3A)') trim(colorbar_option_kind_labels(kind_i+1)), ' - ', & trim(colorbar_cap_option_labels(cap_i+1)) call plvpor( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plwind( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call plptex( 0.5_plflt, 0.5_plflt, 0.0_plflt, 0.0_plflt, 0.5_plflt, title ) deallocate(values_array) end subroutine plcolorbar_example_page subroutine plcolorbar_example( palette, kind_i, cont_color, cont_width, n_values, values ) character(*) :: palette integer :: kind_i, label_i, cap_i, cont_color, n_values real(kind=plflt) :: cont_width real(kind=plflt), dimension(:) :: values ! Load the color palette call plspal1( palette, 1 ) do label_i = 0,COLORBAR_LABELS-1 do cap_i = 0,COLORBAR_CAPS-1 call plcolorbar_example_page( kind_i, label_i, cap_i, & cont_color, cont_width, & n_values, values ) enddo enddo end subroutine plcolorbar_example end program plplot-5.10.0+dfsg/examples/f95/x26f.f90 644 1750 1750 2133612140337537 163100ustar andrewandrew! -*- coding: utf-8; -*- ! ! $Id: x26f.f90 12320 2013-05-02 01:20:31Z arjenmarkus $ ! ! Multi-lingual version of the first page of example 4. ! ! Copyright (C) 2006 Alan Irwin ! Copyright (C) 2006,2008 Andrew Ross ! ! Thanks to the following for providing translated strings for this example: ! Valery Pipin (Russian) ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! ! ! This example designed just for devices (e.g., psttfc and the ! cairo-related devices) that utilise the pango and fontconfig libraries. The ! best choice of glyph is selected by fontconfig and automatically rendered ! by pango in way that is sensitive to complex text layout (CTL) language ! issues for each unicode character in this example. Of course, you must ! have the appropriate TrueType fonts installed to have access to all the ! required glyphs. ! ! Translation instructions: The strings to be translated are given by ! x_label, y_label, alty_label, title_label, and line_label below. The ! encoding used must be UTF-8. ! ! The following strings to be translated involve some scientific/mathematical ! jargon which is now discussed further to help translators. ! ! (1) dB is a decibel unit, see http://en.wikipedia.org/wiki/Decibel . ! (2) degrees is an angular measure, see ! http://en.wikipedia.org/wiki/Degree_(angle) . ! (3) low-pass filter is one that transmits (passes) low frequencies. ! (4) pole is in the mathematical sense, see ! http://en.wikipedia.org/wiki/Pole_(complex_analysis) . "Single Pole" ! means a particular mathematical transformation of the filter function has ! a single pole, see ! http://ccrma.stanford.edu/~jos/filters/Pole_Zero_Analysis_I.html . ! Furthermore, a single-pole filter must have an inverse square decline ! (or -20 db/decade). Since the filter plotted here does have that ! characteristic, it must by definition be a single-pole filter, see also ! http://www-k.ext.ti.com/SRVS/Data/ti/KnowledgeBases/analog/document/faqs/1p.htm ! (5) decade represents a factor of 10, see ! http://en.wikipedia.org/wiki/Decade_(log_scale) . ! ! ! ! -------------------------------------------------------------------------- ! main ! ! Illustration of logarithmic axes, and redefinition of window. ! -------------------------------------------------------------------------- program x26f use plplot, PI => PL_PI implicit none integer, parameter :: nolangs = 2 integer, parameter :: nlegend = 2 character(len=80) x_label(nolangs) character(len=80) y_label(nolangs) character(len=80) legend_text(2,nolangs) character(len=80) alty_label(nolangs) character(len=80) title_label(nolangs) character(len=80) line_label(nolangs) integer i, j data (x_label(i) ,i=1,nolangs) / & 'Frequency', & 'Частота'/ data (y_label(i) ,i=1,nolangs) / & 'Amplitude (dB)', & 'Амплитуда (dB)'/ data (alty_label(i) ,i=1,nolangs) / & 'Phase shift (degrees)', & 'Фазовый сдвиг (градусы)'/ ! Short rearranged versions of y_label and alty_label. data ((legend_text(j,i), j=1, nlegend), i=1,nolangs) / & 'Amplitude', 'Phase shift' , & 'Амплитуда', 'Фазовый сдвиг' / data (title_label(i) ,i=1,nolangs) / & 'Single Pole Low-Pass Filter', & 'Однополюсный Низко-Частотный Фильтр'/ data (line_label(i) ,i=1,nolangs) / & '-20 dB/decade', & '-20 dB/десяток'/ ! Parse and process command line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit() call plfont(2) ! Make log plots using two different styles. do i = 1,nolangs call plot1(nlegend, 0, x_label(i), y_label(i), alty_label(i), & legend_text(:,i), title_label(i), line_label(i)) end do call plend() end program x26f ! -------------------------------------------------------------------------- ! plot1 ! ! Log-linear plot. ! -------------------------------------------------------------------------- subroutine plot1( nlegend, type, x_label, y_label, alty_label, & legend_text, title_label, line_label ) use plplot, PI => PL_PI implicit none integer type, nlegend character(*) x_label, y_label, alty_label, title_label, line_label integer i real(kind=plflt) freql(101), ampl(101), phase(101) real(kind=plflt) f0, freq character(*) legend_text(nlegend) integer opt_array(nlegend) integer text_colors(nlegend) integer line_colors(nlegend) integer line_styles(nlegend) real(kind=plflt) line_widths(nlegend) integer symbol_numbers(nlegend) integer symbol_colors(nlegend) real(kind=plflt) symbol_scales(nlegend) character(len=20) symbols(nlegend) integer box_colors(0), box_patterns(0) real(kind=plflt) box_scales(0), box_line_widths(0) real(kind=plflt) legend_width, legend_height call pladv(0) ! Set up data for log plot f0 = 1.0 do i = 1,101 freql(i) = -2.0_plflt + (i-1) / 20.0_plflt freq = 10.0_plflt ** freql(i) ampl(i) = 20.0_plflt * log10(1.0_plflt / sqrt(1.0_plflt + (freq/f0)**2)) phase(i) = -(180.0_plflt / PI) * atan(freq / f0) end do call plvpor(0.15_plflt, 0.85_plflt, 0.1_plflt, 0.9_plflt) call plwind(-2.0_plflt, 3.0_plflt, -80.0_plflt, 0.0_plflt) ! Try different axis and labelling styles. call plcol0(1) if ( type .eq. 0 ) then call plbox("bclnst", 0.0_plflt, 0, "bnstv", 0.0_plflt, 0) endif if ( type .eq. 1 ) then call plbox("bcfghlnst", 0.0_plflt, 0, "bcghnstv", 0.0_plflt, 0) endif ! Plot ampl vs freq call plcol0(2) call plline(freql, ampl) call plcol0(2) call plptex(1.6_plflt, -30.0_plflt, 1.0_plflt, -20.0_plflt, 0.5_plflt, line_label) ! Put labels on call plcol0(1) call plmtex("b", 3.2_plflt, 0.5_plflt, 0.5_plflt, x_label) call plmtex("t", 2.0_plflt, 0.5_plflt, 0.5_plflt, title_label) call plcol0(2) call plmtex("l", 5.0_plflt, 0.5_plflt, 0.5_plflt, y_label) ! For the gridless case, put phase vs freq on same plot if (type .eq. 0) then call plcol0(1) call plwind(-2.0_plflt, 3.0_plflt, -100.0_plflt, 0.0_plflt) call plbox("", 0.0_plflt, 0, "cmstv", 30.0_plflt, 3) call plcol0(3) call plline(freql, phase) call plstring(freql, phase, '*') call plcol0(3) call plmtex("r", 5.0_plflt, 0.5_plflt, 0.5_plflt, alty_label) endif ! Draw a legend ! First legend entry. opt_array(1) = PL_LEGEND_LINE text_colors(1) = 2 line_colors(1) = 2 line_styles(1) = 1 line_widths(1) = 1 ! defining this makes the Fortran to C transformation of ! symbols(1) work on defined values which makes valgrind ! happier (even if that transformed string is not used inside the ! C version of pllegend) symbols(1) = "" ! note from the above opt_array the first symbol (and box) indices ! do not have to be specified ! Second legend entry. opt_array(2) = PL_LEGEND_LINE + PL_LEGEND_SYMBOL text_colors(2) = 3 line_colors(2) = 3 line_styles(2) = 1 line_widths(2) = 1 symbol_colors(2) = 3 symbol_scales(2) = 1. symbol_numbers(2) = 4 symbols(2) = "*" ! from the above opt_arrays we can completely ignore everything ! to do with boxes. ! (note: number of legend entries determined from size of ! opt_array) call plscol0a( 15, 32, 32, 32, 0.70d0 ) call pllegend( legend_width, legend_height, & PL_LEGEND_BACKGROUND + PL_LEGEND_BOUNDING_BOX, 0, & 0.0_plflt, 0.0_plflt, 0.10_plflt, 15, & 1, 1, 0, 0, & opt_array, & 1.0_plflt, 1.0_plflt, 2.0_plflt, & 1.0_plflt, text_colors, legend_text, & box_colors, box_patterns, box_scales, box_line_widths, & line_colors, line_styles, line_widths, & symbol_colors, symbol_scales, symbol_numbers, symbols ) end subroutine plot1 plplot-5.10.0+dfsg/examples/f95/x02f.f90 644 1750 1750 767512102122103 162470ustar andrewandrew! $Id: x02f.f90 12288 2013-01-30 04:40:35Z airwin $ ! Demonstrates multiple windows and color map 0 ! ! Copyright (C) 2004 Alan W. Irwin ! Copyright (C) 2005 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x02f95 use plplot implicit none ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit() ! Run demos call demo1 call demo2 call plend contains !-------------------------------------------------------------------------- ! demo1 ! ! Demonstrates multiple windows and default color map 0 palette. !-------------------------------------------------------------------------- subroutine demo1 call plbop ! Divide screen into 16 regions call plssub(4,4) call draw_windows(16, 0) call pleop end subroutine demo1 !-------------------------------------------------------------------------- ! demo2 ! ! Demonstrates multiple windows, user-modified color map 0 palette, ! and HLS -> RGB translation. !-------------------------------------------------------------------------- subroutine demo2 integer, parameter :: tablesize = 116 integer, dimension(tablesize) :: r, g, b integer :: i real(kind=plflt), parameter :: lmin = 0.15_plflt, lmax = 0.85_plflt real(kind=plflt) h, l, s, r1, g1, b1 call plbop ! Divide screen into 100 regions call plssub(10,10) do i=0,99 ! Bounds on HLS, from plhlsrgb() commentary -- ! hue [0., 360.] degrees ! lightness [0., 1.] magnitude ! saturation [0., 1.] magnitude ! Vary hue uniformly from left to right h = (360._plflt/10._plflt)*mod(i,10) ! Vary lightness uniformly from top to bottom, between min and max l = lmin + (lmax - lmin) * (i / 10) / 9._plflt ! Use_ max saturation s = 1._plflt call plhlsrgb(h, l, s, r1, g1, b1) r(i+17) = int(r1*255.001) g(i+17) = int(g1*255.001) b(i+17) = int(b1*255.001) enddo do i=1,16 call plgcol0(i-1,r(i),g(i),b(i)) enddo call plscmap0(r, g, b) call draw_windows(100, 16) call pleop end subroutine demo2 !-------------------------------------------------------------------------- ! draw_windows ! ! Draws a set of numbered boxes with colors according to cmap0 entry. !-------------------------------------------------------------------------- subroutine draw_windows( nw, cmap0_offset ) integer :: nw, cmap0_offset integer :: i,j real(kind=plflt) :: vmin, vmax, xj character (len=3) :: text call plschr(0.0_plflt, 3.5_plflt) call plfont(4) do i=0,nw-1 call plcol0(i+cmap0_offset) write (text,'(i0)') i call pladv(0) vmin = 0.1_plflt vmax = 0.9_plflt do j=1,3 xj = j call plwidth(xj) call plvpor(vmin,vmax,vmin,vmax) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plbox('bc', 0.0_plflt, 0, 'bc', 0.0_plflt, 0) vmin = vmin + 0.1_plflt vmax = vmax - 0.1_plflt enddo call plwidth(1._plflt) call plptex(0.5_plflt, 0.5_plflt, 1.0_plflt, 0.0_plflt, 0.5_plflt, text) enddo end subroutine draw_windows end program x02f95 plplot-5.10.0+dfsg/examples/f95/x13f.f90 644 1750 1750 606511703217235 162620ustar andrewandrew! $Id: x13f.f90 12125 2012-01-11 05:31:09Z arjenmarkus $ ! Pie chart demo. ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x13f95 use plplot, PI => PL_PI implicit none real(kind=plflt) :: just, dx, dy, x(500), y(500) integer :: i, j, dthet, theta0, theta1, theta character(len=20), dimension(5) :: text = & (/ 'Maurice ', 'Geoffrey', 'Alan ', 'Rafael ', 'Vince '/) real(kind=plflt) :: per(5) = & (/ 10._plflt , 32._plflt , 12._plflt , 30._plflt , 16._plflt /) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Ask user to specify the output device. call plinit() call pladv(0) ! Ensure window has aspect ratio of one so circle is ! plotted as a circle. call plvasp(1.0_plflt) call plwind(0._plflt, 10._plflt, 0._plflt, 10._plflt) ! call plenv( 0._plflt, 10._plflt, 0._plflt, 10._plflt, 1, -2 ) call plcol0(2) ! n.b. all theta quantities scaled by 2*pi/500 to be integers to avoid ! floating point logic problems. theta0 = 0 dthet = 1 do i = 0, 4 j = 0 x(j+1) = 5._plflt y(j+1) = 5._plflt j = j + 1 ! n.b. the theta quantities multiplied by 2*pi/500 afterward so ! in fact per is interpreted as a percentage. theta1 = int(theta0 + 5*per(i+1)) if (i .eq. 4) theta1 = 500 do theta = theta0, theta1, dthet x(j+1) = 5 + 3*cos((2._plflt*pi/500._plflt)*theta) y(j+1) = 5 + 3*sin((2._plflt*pi/500._plflt)*theta) j = j + 1 enddo call plcol0(i+1) call plpsty( mod(i+3, 8) + 1 ) call plfill(x(:j), y(:j)) call plcol0(1) call plline(x(:j), y(:j)) just = (2._plflt*pi/500._plflt)*(theta0 + theta1) / 2._plflt dx = 0.25_plflt * cos(just) dy = 0.25_plflt * sin(just) if ((theta0 + theta1) .lt. 250 .or. & (theta0 + theta1) .gt. 750) then just = 0._plflt else just = 1._plflt endif call plptex( x(j/2+1)+dx, y(j/2+1)+dy, 1._plflt, 0._plflt, just, text(i+1) ) theta0 = theta - dthet enddo call plfont(2) call plschr( 0._plflt, 1.3_plflt) call plptex( 5._plflt, 9._plflt, 1._plflt, 0._plflt, 0.5_plflt, 'Percentage of Sales' ) call plend end program x13f95 plplot-5.10.0+dfsg/examples/f95/x27f.f90 644 1750 1750 1512412232323306 162760ustar andrewandrew! $Id: x27f.f90 12626 2013-10-24 23:01:26Z andrewross $ ! ! Drawing "spirograph" curves - epitrochoids, cycolids, roulettes ! ! Copyright (C) 2007 Arjen Markus ! Copyright (C) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! ! -------------------------------------------------------------------------- ! main ! ! Generates two kinds of plots: ! - construction of a cycloid (animated) ! - series of epitrochoids and hypotrochoids ! -------------------------------------------------------------------------- program x27f use plplot implicit none integer i, j, fill real(kind=plflt) params(4,9) ! R, r, p, N ! R and r should be integers to give correct termination of the ! angle loop using gcd. ! N.B. N is just a place holder since it is no longer used ! (because we now have proper termination of the angle loop). data ( ( params(i,j) ,i=1,4) ,j=1,9 ) / & 21.0_plflt, 7.0_plflt, 7.0_plflt, 3.0_plflt, & 21.0_plflt, 7.0_plflt, 10.0_plflt, 3.0_plflt, & 21.0_plflt, -7.0_plflt, 10.0_plflt, 3.0_plflt, & 20.0_plflt, 3.0_plflt, 7.0_plflt, 20.0_plflt, & 20.0_plflt, 3.0_plflt, 10.0_plflt, 20.0_plflt, & 20.0_plflt, -3.0_plflt, 10.0_plflt, 20.0_plflt, & 20.0_plflt, 13.0_plflt, 7.0_plflt, 20.0_plflt, & 20.0_plflt, 13.0_plflt, 20.0_plflt, 20.0_plflt, & 20.0_plflt,-13.0_plflt, 20.0_plflt, 20.0_plflt/ ! plplot initialization ! Parse and process command line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit() ! Illustrate the construction of a cycloid call cycloid() ! Loop over the various curves ! First an overview, then all curves one by one call plssub(3, 3) fill = 0 do i = 1,9 call pladv(0) call plvpor( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call spiro( params(1,i), fill ) end do call pladv(0) call plssub(1, 1) do i = 1,9 call pladv(0) call plvpor( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call spiro( params(1,i), fill ) end do ! fill the curves. fill = 1 call pladv(0) call plssub(1, 1) do i = 1,9 call pladv(0) call plvpor( 0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt ) call spiro( params(1,i), fill ) end do ! Finally, an example to test out plarc capabilities call arcs() call plend() end program x27f ! -------------------------------------------------------------------------- ! Calculate greatest common divisor following pseudo-code for the ! Euclidian algorithm at http://en.wikipedia.org/wiki/Euclidean_algorithm integer function gcd (a, b) implicit none integer a, b, t a = abs(a) b = abs(b) do while ( b .ne. 0 ) t = b b = mod (a, b) a = t enddo gcd = a end function gcd ! =============================================================== subroutine cycloid ! TODO end subroutine cycloid ! =============================================================== subroutine spiro( params, fill ) use plplot implicit none real(kind=plflt) params(*) integer NPNT parameter ( NPNT = 2000 ) integer n real(kind=plflt) xcoord(NPNT+1) real(kind=plflt) ycoord(NPNT+1) integer windings integer steps integer i integer fill real(kind=plflt) phi real(kind=plflt) phiw real(kind=plflt) dphi real(kind=plflt) xmin real(kind=plflt) xmax real(kind=plflt) xrange_adjust real(kind=plflt) ymin real(kind=plflt) ymax real(kind=plflt) yrange_adjust integer gcd ! Fill the coordinates ! Proper termination of the angle loop very near the beginning ! point, see ! http://mathforum.org/mathimages/index.php/Hypotrochoid. windings = int(abs(params(2))/gcd(int(params(1)), int(params(2)))) steps = NPNT/windings dphi = 2.0_plflt*PL_PI/dble(steps) n = windings*steps+1 ! Initialize variables to prevent compiler warnings xmin = 0.0 xmax = 0.0 ymin = 0.0 ymax = 0.0 do i = 1,n phi = dble(i-1) * dphi phiw = (params(1)-params(2))/params(2)*phi xcoord(i) = (params(1)-params(2))*cos(phi)+params(3)*cos(phiw) ycoord(i) = (params(1)-params(2))*sin(phi)-params(3)*sin(phiw) if (i.eq.1) then xmin = xcoord(1) xmax = xcoord(1) ymin = ycoord(1) ymax = ycoord(1) endif if ( xmin > xcoord(i) ) xmin = xcoord(i) if ( xmax < xcoord(i) ) xmax = xcoord(i) if ( ymin > ycoord(i) ) ymin = ycoord(i) if ( ymax < ycoord(i) ) ymax = ycoord(i) end do xrange_adjust = 0.15_plflt * (xmax - xmin) xmin = xmin - xrange_adjust xmax = xmax + xrange_adjust yrange_adjust = 0.15_plflt * (ymax - ymin) ymin = ymin - yrange_adjust ymax = ymax + yrange_adjust call plwind( xmin, xmax, ymin, ymax ) call plcol0(1) if ( fill.eq.1) then call plfill(xcoord(1:n), ycoord(1:n) ) else call plline(xcoord(1:n), ycoord(1:n) ) endif end subroutine spiro ! =============================================================== subroutine arcs( ) use plplot implicit none integer NSEG parameter ( NSEG = 8 ) integer i; real (kind=plflt) theta, dtheta real (kind=plflt) a, b theta = 0.0_plflt dtheta = 360.0_plflt / dble(NSEG) call plenv( -10.0_plflt, 10.0_plflt, -10.0_plflt, 10.0_plflt, 1, 0 ) ! Plot segments of circle in different colors do i = 0, NSEG-1 call plcol0( mod(i,2) + 1 ) call plarc(0.0_plflt, 0.0_plflt, 8.0_plflt, 8.0_plflt, theta, & theta + dtheta, 0.0_plflt, 0) theta = theta + dtheta enddo ! Draw several filled ellipses inside the circle at different ! angles. a = 3.0_plflt b = a * tan( (dtheta/180.0_plflt*PL_PI)/2.0_plflt ) theta = dtheta/2.0_plflt do i = 0, NSEG-1 call plcol0( 2 - mod(i,2) ) call plarc( a*cos(theta/180.0_plflt*PL_PI), & a*sin(theta/180.0_plflt*PL_PI), & a, b, 0.0_plflt, 360.0_plflt, theta, .true.) theta = theta + dtheta; enddo end subroutine arcs plplot-5.10.0+dfsg/examples/f95/x16f.f90 644 1750 1750 3173012156157676 163210ustar andrewandrew! $Id: x16f.f90 12380 2013-06-12 20:53:18Z andrewross $ ! plshades demo, using color fill ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use plplot, PI => PL_PI implicit none real(kind=plflt) xx, yy, argx, argy, distort, r, t integer NLEVEL, NX, NY, PERIMETERPTS, xdim, ydim parameter(NLEVEL = 20) ! xdim and ydim are the static dimensions of the 2D arrays while ! NX and NY are the defined area. parameter(xdim=99, NX = 35) parameter(ydim=100, NY = 46) parameter(PERIMETERPTS = 100) real(kind=plflt) clevel(NLEVEL), shedge(NLEVEL+1), & z(xdim,ydim), w(xdim,ydim), xg1(xdim), yg1(ydim), & xg2(xdim,ydim), yg2(xdim,ydim), zmin, zmax, & px(PERIMETERPTS), py(PERIMETERPTS) integer cont_color real(kind=plflt) fill_width, cont_width real(kind=plflt) colorbar_width, colorbar_height integer NUM_AXES, NUM_LABELS parameter(NUM_AXES=1, NUM_LABELS=1) character(len=20) :: axis_opts(NUM_AXES) integer num_values(NUM_AXES) real(kind=plflt) values(NUM_AXES,NLEVEL+1) real(kind=plflt) axis_ticks(NUM_AXES) integer axis_subticks(NUM_AXES) character(len=100) :: labels(NUM_LABELS) integer label_opts(NUM_LABELS) integer i, j ! dummy to fill argument list with something not currently used. character(len=1) defined real(kind=plflt) tr(6) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Load color palettes call plspal0('cmap0_black_on_white.pal') call plspal1('cmap1_gray.pal',1) ! Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display call plscmap0n(3) ! Initialize plplot call plinit() ! Set up transformation matrix tr(1) = 2._plflt/(NX-1) tr(2) = 0._plflt tr(3) = -1._plflt tr(4) = 0._plflt tr(5) = 2._plflt/(NY-1) tr(6) = -1._plflt ! Calculate the data matrices. do i=1,NX xx = dble(i-1-(NX/2))/dble (NX/2) do j=1,NY yy = dble(j-1-(NY/2))/dble (NY/2) - 1.0_plflt z(i,j) = - sin(7._plflt*xx) * cos(7._plflt*yy) + xx*xx - yy*yy w(i,j) = - cos(7._plflt*xx) * sin(7._plflt*yy) + 2._plflt*xx*yy enddo enddo call a2mnmx(z, NX, NY, zmin, zmax, xdim) do i = 1, NLEVEL clevel(i) = zmin + (zmax - zmin) * (i - 0.5_plflt) / dble(NLEVEL) enddo do i = 1, NLEVEL+1 shedge(i) = zmin + (zmax - zmin) * dble(i-1) / dble(NLEVEL) enddo ! Build the 1-d coord arrays. distort = 0.4_plflt do i=1,NX xx = -1._plflt + dble(i-1)*2._plflt/dble(NX-1) xg1(i) = xx + distort*cos(0.5_plflt*PI*xx) enddo do j=1,NY yy = -1._plflt + dble(j-1)*2._plflt/dble(NY-1) yg1(j) = yy - distort*cos(0.5_plflt*PI*yy) enddo ! Build the 2-d coord arrays. do i=1,NX xx = -1._plflt + dble(i-1)*2._plflt/dble(NX-1) argx = 0.5_plflt*PI*xx do j=1,NY yy = -1._plflt + dble(j-1)*2._plflt/dble(NY-1) argy = 0.5_plflt*PI*yy xg2(i,j) = xx + distort*cos(argx)*cos(argy) yg2(i,j) = yy - distort*cos(argx)*cos(argy) enddo enddo ! Plot using transform of index range to xmin, xmax, ymin, ymax call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) call plpsty(0) fill_width = 2 cont_color = 0 cont_width = 0 axis_opts(1) = 'bcvtm' axis_ticks(1) = 0.0_plflt axis_subticks(1) = 0 label_opts(1) = PL_COLORBAR_LABEL_BOTTOM labels(1) = 'Magnitude' call plshades(z(:NX,:NY), defined, -1._plflt, 1._plflt, -1._plflt, & 1._plflt, & shedge, fill_width, & cont_color, cont_width ) ! Smaller text call plschr( 0.0_plflt, 0.75_plflt ) ! Small ticks on the vertical axis call plsmaj( 0.0_plflt, 0.5_plflt ) call plsmin( 0.0_plflt, 0.5_plflt ) num_values(1) = NLEVEL + 1; values(1,:) = shedge; call plcolorbar( colorbar_width, colorbar_height, & ior(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, & 0.005_plflt, 0.0_plflt, 0.0375_plflt, 0.875_plflt, 0, 1, 1, & 0.0_plflt, 0.0_plflt, & cont_color, cont_width, & label_opts, labels, & axis_opts, & axis_ticks, axis_subticks, & num_values, values ) ! Reset text and tick sizes call plschr( 0.0_plflt, 1.0_plflt ) call plsmaj( 0.0_plflt, 1.0_plflt ) call plsmin( 0.0_plflt, 1.0_plflt ) call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call pllab('distance', 'altitude', 'Bogon density') ! Plot using 1d coordinate transform call plspal0('cmap0_black_on_white.pal') call plspal1('cmap1_blue_yellow.pal',1) call plscmap0n(3) call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) call plpsty(0) fill_width = 2 cont_color = 0 cont_width = 0 call plshades(z(:NX,:NY), defined, -1._plflt, 1._plflt, -1._plflt, & 1._plflt, & shedge, fill_width, & cont_color, cont_width, xg1(:NX), yg1(:NY)) ! Smaller text call plschr( 0.0_plflt, 0.75_plflt ) ! Small ticks on the vertical axis call plsmaj( 0.0_plflt, 0.5_plflt ) call plsmin( 0.0_plflt, 0.5_plflt ) num_values(1) = NLEVEL + 1; values(1,:) = shedge; call plcolorbar( colorbar_width, colorbar_height, & ior(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, & 0.005_plflt, 0.0_plflt, 0.0375_plflt, 0.875_plflt, 0, 1, 1, & 0.0_plflt, 0.0_plflt, & cont_color, cont_width, & label_opts, labels, & axis_opts, & axis_ticks, axis_subticks, & num_values, values ) ! Reset text and tick sizes call plschr( 0.0_plflt, 1.0_plflt ) call plsmaj( 0.0_plflt, 1.0_plflt ) call plsmin( 0.0_plflt, 1.0_plflt ) call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call pllab('distance', 'altitude', 'Bogon density') ! Plot using 2d coordinate transform call plspal0('cmap0_black_on_white.pal') call plspal1('cmap1_blue_red.pal',1) call plscmap0n(3) call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) call plpsty(0) fill_width = 2 cont_color = 0 cont_width = 0 call plshades(z(:NX,:NY), defined, -1._plflt, 1._plflt, -1._plflt, & 1._plflt, & shedge, fill_width, & cont_color, cont_width, xg2(:NX,:NY), yg2(:NX,:NY) ) ! Smaller text call plschr( 0.0_plflt, 0.75_plflt ) ! Small ticks on the vertical axis call plsmaj( 0.0_plflt, 0.5_plflt ) call plsmin( 0.0_plflt, 0.5_plflt ) num_values(1) = NLEVEL + 1; values(1,:) = shedge; call plcolorbar( colorbar_width, colorbar_height, & ior(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, & 0.005_plflt, 0.0_plflt, 0.0375_plflt, 0.875_plflt, 0, 1, 1, & 0.0_plflt, 0.0_plflt, & cont_color, cont_width, & label_opts, labels, & axis_opts, & axis_ticks, axis_subticks, & num_values, values ) ! Reset text and tick sizes call plschr( 0.0_plflt, 1.0_plflt ) call plsmaj( 0.0_plflt, 1.0_plflt ) call plsmin( 0.0_plflt, 1.0_plflt ) call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call plcont(w, 1, nx, 1, ny, clevel, xg2, yg2) call pllab('distance', 'altitude', & 'Bogon density, with streamlines') ! Plot using 2d coordinate transform and plshades contours. call plspal0('') call plspal1('',1) call plscmap0n(3) call pladv(0) call plvpor(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt) call plpsty(0) fill_width = 2 cont_color = 2 cont_width = 3 call plshades(z(:NX,:NY), defined, -1._plflt, 1._plflt, -1._plflt, & 1._plflt, & shedge, fill_width, & cont_color, cont_width, xg2(:NX,:NY), yg2(:NX,:NY) ) ! Smaller text call plschr( 0.0_plflt, 0.75_plflt ) ! Small ticks on the vertical axis call plsmaj( 0.0_plflt, 0.5_plflt ) call plsmin( 0.0_plflt, 0.5_plflt ) num_values(1) = NLEVEL + 1; values(1,:) = shedge; call plcolorbar( colorbar_width, colorbar_height, & ior(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, & 0.005_plflt, 0.0_plflt, 0.0375_plflt, 0.875_plflt, 0, 1, 1, & 0.0_plflt, 0.0_plflt, & 2, 3._plflt, & label_opts, labels, & axis_opts, & axis_ticks, axis_subticks, & num_values, values ) ! Reset text and tick sizes call plschr( 0.0_plflt, 1.0_plflt ) call plsmaj( 0.0_plflt, 1.0_plflt ) call plsmin( 0.0_plflt, 1.0_plflt ) call plcol0(1) call plbox('bcnst', 0.0_plflt, 0, 'bcnstv', 0.0_plflt, 0) call plcol0(2) call pllab('distance', 'altitude', 'Bogon density') ! Example with polar coordinates. call plspal0('cmap0_black_on_white.pal') call plspal1('cmap1_gray.pal',1) call plscmap0n(3) call pladv(0) call plvpor(0.1d0, 0.9d0, 0.1d0, 0.9d0) call plwind(-1.d0, 1.d0, -1.d0, 1.d0) call plpsty(0) ! Build new coordinate matrices. do i = 1, NX r = dble(i-1)/dble(NX-1) do j = 1, NY t = (2._plflt*PI/dble(NY-1))*dble(j-1) xg2(i,j) = r*cos(t) yg2(i,j) = r*sin(t) z(i,j) = exp(-r*r)*cos(5._plflt*PI*r)*cos(5._plflt*t) enddo enddo ! Need a new shedge to go along with the new data set. call a2mnmx(z, NX, NY, zmin, zmax, xdim) do i = 1, NLEVEL+1 shedge(i) = zmin + (zmax - zmin) * dble(i-1) / dble(NLEVEL) enddo ! Now we can shade the interior region. fill_width = 2 cont_color = 0 cont_width = 0 call plshades(z(:NX,:NY), defined, -1._plflt, 1._plflt, -1._plflt, & 1._plflt, & shedge, fill_width, & cont_color, cont_width, xg2(:NX,:NY), yg2(:NX,:NY) ) ! Smaller text call plschr( 0.0_plflt, 0.75_plflt ) ! Small ticks on the vertical axis call plsmaj( 0.0_plflt, 0.5_plflt ) call plsmin( 0.0_plflt, 0.5_plflt ) num_values(1) = NLEVEL + 1; values(1,:) = shedge; call plcolorbar( colorbar_width, colorbar_height, & ior(PL_COLORBAR_SHADE, PL_COLORBAR_SHADE_LABEL), 0, & 0.005_plflt, 0.0_plflt, 0.0375_plflt, 0.875_plflt, 0, 1, 1, & 0.0_plflt, 0.0_plflt, & cont_color, cont_width, & label_opts, labels, & axis_opts, & axis_ticks, axis_subticks, & num_values, values ) ! Reset text and tick sizes call plschr( 0.0_plflt, 1.0_plflt ) call plsmaj( 0.0_plflt, 1.0_plflt ) call plsmin( 0.0_plflt, 1.0_plflt ) ! Now we can draw the perimeter. (If do before, shade stuff may overlap.) do i = 1, PERIMETERPTS t = (2._plflt*PI/dble(PERIMETERPTS-1))*dble(i-1) px(i) = cos(t) py(i) = sin(t) enddo call plcol0(1) call plline(px, py) ! And label the plot. call plcol0(2) call pllab( '', '', 'Tokamak Bogon Instability' ) call plend end !---------------------------------------------------------------------------- ! Subroutine a2mnmx ! Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) use plplot implicit none integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax fmax = f(1, 1) fmin = fmax do j = 1, ny do i = 1, nx fmax = max(fmax, f(i, j)) fmin = min(fmin, f(i, j)) enddo enddo end plplot-5.10.0+dfsg/examples/f95/cmake_workaround.f 644 1750 1750 347310471127306 206630ustar andrewandrewc This is now simply a file configured by CMake into plplot.mod.proxy c in the top-level build tree. It turns out that any file with any c contents with that name is all that is required to work around the c CMake 2.4.3 bug described below. So this file is no longer actually c compiled. Alan W. Irwin 2006-08-17. c This is a dummy fortran file needed to work around a bug in the c current (2.4.2) cmake code when compiling the fortran examples c in the build tree. Once cmake is fixed this file and all c references to it should be removed. c The dependency checking code does not handle external modules c correctly, even though they are correctly found when compiling. c To work round this we need to fool cmake into thinking that there c is a plplot module_ generated by the examples, but we don't c actually want such a module_ or it would clash with the real plplot c module_ generated in bindings/f95. To do this we use_ another c bug in cmake, namely that it doesn't handle fortran fixed form c source code correctly. When scanning for included modules it c checks comments as well as the code. We can use_ this to fool cmake c without affecting compilation at all. This is also why the comments c contain a _ after certain fortran keywords - we don't want them to c be picked up by cmake. c This is ugly - I know. It _only_ affects the building of the c examples in the build tree when testing is enabled. It does not c appear in the installed tree at all. Let's hope we can find a c proper fix for cmake. c Andrew Ross 30/07/2006. c Following two lines are to fool cmake into handling the dependecy c correctly for plplot. c module plplot c end module plplot subroutine dummy end subroutine dummy plplot-5.10.0+dfsg/examples/f95/x21f.f90 644 1750 1750 2234212140337537 163010ustar andrewandrew! $Id: x21f.f90 12320 2013-05-02 01:20:31Z arjenmarkus $ ! Grid data demo. ! ! Copyright (C) 2004 Joao Cardoso ! Copyright (C) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use plplot, PI => PL_PI implicit none external myisnan logical myisnan integer pts, xp, yp, nl, knn_order, randn, rosen real(kind=plflt) threshold, wmin parameter (pts = 500) parameter (xp = 25) parameter (yp = 20) parameter (nl = 16) parameter (knn_order = 20) parameter (threshold = 1.001_plflt) parameter (wmin = -1e3_plflt) parameter (randn = 0) parameter (rosen = 0) real(kind=plflt) xmin, xmax, ymin, ymax real(kind=plflt) x(pts), y(pts), z(pts), clev(nl) real(kind=plflt) xg(xp), yg(yp), zg(xp,yp) real(kind=plflt) zmin, zmax, lzmin, lzmax integer i, j, k integer alg character(len=80) title(6) data title /'Cubic Spline Approximation', & 'Delaunay Linear Interpolation', & 'Natural Neighbors Interpolation', & 'KNN Inv. Distance Weighted', & '3NN Linear Interpolation', & '4NN Around Inv. Dist. Weighted'/ real(kind=plflt) opt(6) data opt /0._plflt, 0._plflt, 0._plflt, 0._plflt, 0._plflt, 0._plflt/ real(kind=plflt) xt, yt real(kind=plflt) r integer ii, jj real(kind=plflt) dist, d character(len=1) defined xmin = -0.2_plflt ymin = -0.2_plflt xmax = 0.6_plflt ymax = 0.6_plflt ! call plMergeOpts(options, "x21c options", NULL); call plparseopts(PL_PARSE_FULL) opt(3) = wmin opt(4) = dble(knn_order) opt(5) = threshold ! Initialize plplot call plinit call cmap1_init call plseed(5489) do i=1,pts xt = (xmax-xmin)*plrandd() yt = (ymax-ymin)*plrandd() if (randn.eq.0) then x(i) = xt + xmin y(i) = yt + ymin else x(i) = sqrt(-2._plflt*log(xt)) * cos(2._plflt*PI*yt) + xmin y(i) = sqrt(-2._plflt*log(xt)) * sin(2._plflt*PI*yt) + ymin endif if (rosen.eq.0) then r = sqrt(x(i)*x(i) + y(i)*y(i)) z(i) = exp(-r*r)*cos(2._plflt*PI*r) else z(i) = log((1._plflt-x(i))**2 + 100._plflt*(y(i)-x(i)**2)**2) endif enddo zmin = z(1) zmax = z(1) do i=2,pts zmax = max(zmax,z(i)) zmin = min(zmin,z(i)) enddo do i=1,xp xg(i) = xmin + (xmax-xmin)*(i-1._plflt)/(xp-1._plflt) enddo do i=1,yp yg(i) = ymin + (ymax-ymin)*(i-1._plflt)/(yp-1._plflt) enddo call plcol0(1) call plenv(xmin, xmax, ymin, ymax, 2, 0) call plcol0(15) call pllab("X", "Y", "The original data sampling") do i=1,pts call plcol1( ( z(i) - zmin ) / ( zmax - zmin ) ) ! The following plstring call should be the the equivalent of ! plpoin( 1, &x[i], &y[i], 5 ); Use plstring because it is ! not deprecated like plpoin and has much more powerful ! capabilities. N.B. symbol 141 works for Hershey devices ! (e.g., -dev xwin) only if plfontld( 0 ) has been called ! while symbol 727 works only if plfontld( 1 ) has been ! called. The latter is the default which is why we use 727 ! here to represent a centred X (multiplication) symbol. ! This dependence on plfontld is one of the limitations of ! the Hershey escapes for PLplot, but the upside is you get ! reasonable results for both Hershey and Unicode devices. call plstring( x(i:i), y(i:i), '#(727)' ); enddo call pladv(0) call plssub(3,2) do k=1,2 call pladv(0) do alg=1,6 call plgriddata(x, y, z, xg, yg, zg, alg, opt(alg)) ! - CSA can generate NaNs (only interpolates? !). ! - DTLI and NNI can generate NaNs for points outside the convex hull ! of the data points. ! - NNLI can generate NaNs if a sufficiently thick triangle is not found ! ! PLplot should be NaN/Inf aware, but changing it now is quite a job... ! so, instead of not plotting the NaN regions, a weighted average over ! the neighbors is done. ! if ((alg.eq.GRID_CSA).or.(alg.eq.GRID_DTLI).or. & (alg.eq.GRID_NNLI).or.(alg.eq.GRID_NNI)) then do i=1,xp do j=1,yp if (myisnan(zg(i,j))) then ! average (IDW) over the 8 neighbors zg(i,j) = 0._plflt dist = 0._plflt ii=i-1 do while ((ii.le.i+1).and.(ii.le.xp)) jj = j-1 do while ((jj.le.j+1).and.(jj.le.yp)) if ((ii.ge.1) .and. (jj.ge.1) .and. & (.not.myisnan(zg(ii,jj))) ) then if (abs(ii-i) + abs(jj-j) .eq. 1) then d = 1._plflt else d = 1.4142_plflt endif zg(i,j) = zg(i,j) + zg(ii,jj)/(d*d) dist = dist + d endif jj = jj+1 enddo ii = ii+1 enddo if (dist.ne.0._plflt) then zg(i,j) = zg(i,j) / dist else zg(i,j) = zmin endif endif enddo enddo endif call a2mnmx(zg, xp, yp, lzmin, lzmax, xp) lzmin = min(lzmin, zmin) lzmax = max(lzmax, zmax) lzmin = lzmin - 0.01_plflt lzmax = lzmax + 0.01_plflt call plcol0(1) call pladv(alg) if (k.eq.1) then do i=1,nl clev(i) = lzmin + (lzmax-lzmin)/(nl-1._plflt)*(i-1._plflt) enddo call plenv0(xmin, xmax, ymin, ymax, 2, 0) call plcol0(15) call pllab("X", "Y", title(alg)) call plshades(zg, defined, xmin, xmax, ymin, & ymax, clev, 1._plflt, 0, 1._plflt) call plcol0(2) else do i = 1,nl clev(i) = lzmin + (lzmax-lzmin)/(nl-1._plflt)*(i-1._plflt) enddo call plvpor(0._plflt, 1._plflt, 0._plflt, 0.9_plflt) call plwind(-1.1_plflt, 0.75_plflt, -0.65_plflt, 1.20_plflt) ! ! For the comparison to be fair, all plots should have the ! same z values, but to get the max/min of the data generated ! by all algorithms would imply two passes. Keep it simple. ! ! plw3d(1., 1., 1., xmin, xmax, ymin, ymax, zmin, zmax, 30, -60); ! call plw3d(1._plflt, 1._plflt, 1._plflt, xmin, xmax, ymin, ymax, & lzmin, lzmax, 30._plflt, -40._plflt) call plbox3("bntu", "X", 0._plflt, 0, & "bntu", "Y", 0._plflt, 0, & "bcdfntu", "Z", 0.5_plflt, 0) call plcol0(15) call pllab("", "", title(alg)) call plot3dc(xg, yg, zg, ior(ior(DRAW_LINEXY, & MAG_COLOR), BASE_CONT), clev) endif enddo enddo call plend end subroutine cmap1_init use plplot implicit none real(kind=plflt) i(2), h(2), l(2), s(2) i(1) = 0._plflt i(2) = 1._plflt h(1) = 240._plflt h(2) = 0._plflt l(1) = 0.6_plflt l(2) = 0.6_plflt s(1) = 0.8_plflt s(2) = 0.8_plflt call plscmap1n(256) call plscmap1l(.false., i, h, l, s) end subroutine cmap1_init !---------------------------------------------------------------------------- ! Subroutine a2mnmx ! Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) use plplot implicit none integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax fmax = f(1, 1) fmin = fmax do j = 1, ny do i = 1, nx fmax = max(fmax, f(i, j)) fmin = min(fmin, f(i, j)) enddo enddo end subroutine a2mnmx include 'plf95demos.inc' plplot-5.10.0+dfsg/examples/f95/x19f.f90 644 1750 1750 1517512221050115 162760ustar andrewandrew! $Id: x19f.f90 12532 2013-09-26 15:18:37Z andrewross $ ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA subroutine map_transform(x, y, xt, yt) use plplot, PI => PL_PI implicit none real(kind=plflt) x, y, xt, yt, radius radius = 90.0_plflt - y xt = radius * cos(x * PI / 180.0_plflt) yt = radius * sin(x * PI / 180.0_plflt) return end subroutine !-------------------------------------------------------------------------- ! mapform19 ! ! Defines specific coordinate transformation for example 19. ! Not to be confused with mapform in src/plmap.c. ! x(), y() are the coordinates to be plotted. !-------------------------------------------------------------------------- subroutine mapform19(n, x, y) use plplot, PI => PL_PI implicit none integer n real(kind=plflt) x(n) real(kind=plflt) y(n) integer i real(kind=plflt) xp, yp, radius do i = 1,n radius = 90.0_plflt - y(i) xp = radius * cos(x(i) * PI / 180.0_plflt) yp = radius * sin(x(i) * PI / 180.0_plflt) x(i) = xp y(i) = yp enddo return end subroutine ! "Normalize" longitude values so that they always fall between ! -180.0 and 180.0 function normalize_longitude(lon) use plplot implicit none real(kind=plflt) :: normalize_longitude real(kind=plflt) :: lon, times if ((lon .ge. -180.0_plflt) .and. (lon .le. 180.0_plflt)) then normalize_longitude = lon else times = floor ((abs(lon) + 180.0_plflt) / 360.0_plflt) if (lon .lt. 0.0_plflt) then normalize_longitude = lon + 360.0_plflt * times else normalize_longitude = lon - 360.0_plflt * times endif endif return end function ! ! A custom axis labeling function for longitudes and latitudes. ! subroutine geolocation_labeler(axis, value, label, length) use plplot implicit none integer :: axis, length real(kind=plflt) :: value character(len=length) label character(len=5) direction_label real(kind=plflt) :: label_val = 0.0_plflt real(kind=plflt) :: normalize_longitude if (axis .eq. 2) then label_val = value if (label_val .gt. 0.0_plflt) then direction_label = ' N' else if (label_val .lt. 0.0_plflt) then direction_label = ' S' else direction_label = 'Eq' endif else if (axis .eq. 1) then label_val = normalize_longitude(value) if (label_val .gt. 0.0_plflt) then direction_label = ' E' else if (label_val .lt. 0.0_plflt) then direction_label = ' W' else direction_label = '' endif endif if (axis .eq. 2 .and. value .eq. 0.0_plflt) then ! A special case for the equator label = direction_label else if (abs(label_val) .lt. 10.0_plflt) then write(label,'(I1.1,A2)') iabs(int(label_val)),direction_label else if (abs(label_val) .lt. 100.0_plflt) then write(label,'(I2.1,A2)') iabs(int(label_val)),direction_label else write(label,'(I3.1,A2)') iabs(int(label_val)),direction_label endif end subroutine !-------------------------------------------------------------------------- ! main ! ! Shows two views of the world map. !-------------------------------------------------------------------------- program x19f use plplot implicit none real(kind=plflt) minx, maxx, miny, maxy real(kind=plflt), dimension(1:1) :: x, y external map_transform external mapform19 external geolocation_labeler ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Longitude (x) and latitude (y) miny = -70._plflt maxy = 80._plflt call plinit() ! Cartesian plots ! Most of world minx = -170._plflt maxx = minx+360._plflt ! Setup a custom latitude and longitude-based scaling function. call plslabelfunc(geolocation_labeler) call plcol0(1) call plenv(minx, maxx, miny, maxy, 1, 70) call plmap('usaglobe', minx, maxx, miny, maxy) ! The Americas minx = 190._plflt maxx = 340._plflt call plcol0(1) call plenv(minx, maxx, miny, maxy, 1, 70) call plmap('usaglobe', minx, maxx, miny, maxy) ! Clear the labeling function call plslabelfunc(0) ! Polar, Northern hemisphere minx = 0._plflt maxx = 360._plflt call plenv(-75._plflt, 75._plflt, -75._plflt, & 75._plflt, 1, -1) call plmap(mapform19,'globe', minx, maxx, miny, maxy) call pllsty(2) call plmeridians(mapform19,10.0_plflt, 10.0_plflt, & 0.0_plflt, 360.0_plflt, -10.0_plflt, & 80.0_plflt) ! Polar, Northern hemisphere, this time with a PLplot-wide transform minx = 0._plflt maxx = 360._plflt call plstransform( map_transform ) call pllsty( 1 ) call plenv( -75._plflt, 75._plflt, -75._plflt, & 75._plflt, 1, -1 ) ! No need to set the map transform here as the global ! transform will be used. call plmap('globe', minx, maxx, miny, maxy ) call pllsty( 2 ) call plmeridians(10.0_plflt, 10.0_plflt, & 0.0_plflt, 360.0_plflt, -10.0_plflt, & 80.0_plflt ) ! Show Baltimore, MD on the map call plcol0( 2 ) call plssym( 0.0_plflt, 2.0_plflt ) x=-76.6125_plflt y=39.2902778_plflt call plpoin( x, y, 18 ) call plssym( 0.0_plflt, 1.0_plflt ) call plptex( -76.6125_plflt, 43.0_plflt, 0.0_plflt, & 0.0_plflt, 0.0_plflt, 'Baltimore, MD' ) ! For f95, this is how the global transform is cleared call plstransform( 0 ) call plend() end program x19f plplot-5.10.0+dfsg/examples/f95/x23f.f90 644 1750 1750 3412511647656237 163210ustar andrewandrew! $Id: x23f.f90 11984 2011-10-19 23:26:23Z andrewross $ ! ! Displays Greek letters and mathematically interesting Unicode ranges ! ! Copyright (C) 2005 Alan Irwin ! Copyright (C) 2005 Andrew Ross ! ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! program x23f use plplot implicit none real(kind=plflt) xmin, xmax, ymin, ymax, ycharacter_scale, yoffset real(kind=plflt) chardef, charht, deltax, deltay, x, y integer i, j, page, length, slice character(len=20) cmdString integer(kind=plunicode) fci_old integer ifamily, istyle, iweight real(kind=plflt) dy integer family_index, style_index, weight_index ! Must be big enough to contain the prefix strings, the font-changing ! commands, and the "The quick brown..." string. character(len=200) string ! ! Displays Greek letters and mathematically interesting Unicode ranges ! integer fci_combinations parameter(fci_combinations = 30) character(len=5) greek(48) integer type1(166) character(len=80) title(11) integer lo(11) integer hi(11) integer nxcells(11) integer nycells(11) integer offset(11) integer(kind=plunicode) :: fci(fci_combinations) character(len=11) family(5) character(len=8) style(3) character(len=7) weight(2) data (greek(i) ,i=1,48) / & '#gA','#gB','#gG','#gD','#gE','#gZ', & '#gY','#gH','#gI','#gK','#gL','#gM', & '#gN','#gC','#gO','#gP','#gR','#gS', & '#gT','#gU','#gF','#gX','#gQ','#gW', & '#ga','#gb','#gg','#gd','#ge','#gz', & '#gy','#gh','#gi','#gk','#gl','#gm', & '#gn','#gc','#go','#gp','#gr','#gs', & '#gt','#gu','#gf','#gx','#gq','#gw' / data (type1(i) ,i=1,75) / & z'0020',z'0021',z'0023',z'0025',z'0026', & z'0028',z'0029',z'002b',z'002c',z'002e', & z'002f',z'0030',z'0031',z'0032',z'0033', & z'0034',z'0035',z'0036',z'0037',z'0038', & z'0039',z'003a',z'003b',z'003c',z'003d', & z'003e',z'003f',z'005b',z'005d',z'005f', & z'007b',z'007c',z'007d',z'00a9',z'00ac', & z'00ae',z'00b0',z'00b1',z'00d7',z'00f7', & z'0192',z'0391',z'0392',z'0393',z'0394', & z'0395',z'0396',z'0397',z'0398',z'0399', & z'039a',z'039b',z'039c',z'039d',z'039e', & z'039f',z'03a0',z'03a1',z'03a3',z'03a4', & z'03a5',z'03a6',z'03a7',z'03a8',z'03a9', & z'03b1',z'03b2',z'03b3',z'03b4',z'03b5', & z'03b6',z'03b7',z'03b8',z'03b9',z'03ba' / data (type1(i) ,i=76,166) / & z'03bb',z'03bc',z'03bd',z'03be',z'03bf', & z'03c0',z'03c1',z'03c2',z'03c3',z'03c4', & z'03c5',z'03c6',z'03c7',z'03c8',z'03c9', & z'03d1',z'03d2',z'03d5',z'03d6',z'2022', & z'2026',z'2032',z'2033',z'203e',z'2044', & z'2111',z'2118',z'211c',z'2122',z'2126', & z'2135',z'2190',z'2191',z'2192',z'2193', & z'2194',z'21b5',z'21d0',z'21d1',z'21d2', & z'21d3',z'21d4',z'2200',z'2202',z'2203', & z'2205',z'2206',z'2207',z'2208',z'2209', & z'220b',z'220f',z'2211',z'2212',z'2215', & z'2217',z'221a',z'221d',z'221e',z'2220', & z'2227',z'2228',z'2229',z'222a',z'222b', & z'2234',z'223c',z'2245',z'2248',z'2260', & z'2261',z'2264',z'2265',z'2282',z'2283', & z'2284',z'2286',z'2287',z'2295',z'2297', & z'22a5',z'22c5',z'2320',z'2321',z'2329', & z'232a',z'25ca',z'2660',z'2663',z'2665', & z'2666' / data (title(i) ,i=1,11 )/ & "#<0x10>PLplot Example 23 - Greek Letters", & "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (a)", & "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (b)", & "#<0x10>PLplot Example 23 - Type 1 Symbol Font Glyphs by Unicode (c)", & "#<0x10>PLplot Example 23 - Number Forms Unicode Block", & "#<0x10>PLplot Example 23 - Arrows Unicode Block (a)", & "#<0x10>PLplot Example 23 - Arrows Unicode Block (b)", & "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (a)", & "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (b)", & "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (c)", & "#<0x10>PLplot Example 23 - Mathematical Operators Unicode Block (d)" / data (lo(i) ,i=1,11) / & z'0', & z'0', & z'40', & z'80', & z'2153', & z'2190', & z'21d0', & z'2200', & z'2240', & z'2280', & z'22c0' / data (hi(i) ,i=1,11) / & z'30', & z'40', & z'80', & z'A6', & z'2184', & z'21d0', & z'2200', & z'2240', & z'2280', & z'22c0', & z'2300' / data (nxcells(i) ,i=1,11) / & 12, & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8 / data (nycells(i) ,i=1,11) / & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8, & 8 / ! non-zero values Must be consistent with nxcells and nycells. */ data (offset(i) ,i=1,11) / & 0, & 0, & 64, & 128, & 0, & 0, & 0, & 0, & 0, & 0, & 0 / ! drop the leading '8' marker for FCI because some compilers (gfortran) ! have an implementation error (integer overflow error) for that case, and ! the marker is not needed, in any case, for calls to plsfci. data (fci(i), i=1,fci_combinations) / & z'00000000', & z'00000001', & z'00000002', & z'00000003', & z'00000004', & z'00000010', & z'00000011', & z'00000012', & z'00000013', & z'00000014', & z'00000020', & z'00000021', & z'00000022', & z'00000023', & z'00000024', & z'00000100', & z'00000101', & z'00000102', & z'00000103', & z'00000104', & z'00000110', & z'00000111', & z'00000112', & z'00000113', & z'00000114', & z'00000120', & z'00000121', & z'00000122', & z'00000123', & z'00000124' / data (family(i), i=1,5) / & "sans-serif", & "serif", & "monospace", & "script", & "symbol" / data (style(i), i=1,3) / & "upright", & "italic", & "oblique" / data (weight(i), i=1,2) / & "medium", & "bold" / call plparseopts(PL_PARSE_FULL) call plinit() do page = 1,11 call pladv(0) ! Set up viewport and window call plvpor(0.02_plflt, 0.98_plflt, 0.02_plflt, 0.90_plflt) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plgspa(xmin, xmax, ymin, ymax) call plschr(0._plflt, 0.8_plflt) ycharacter_scale = (1.0_plflt - 0.0_plflt)/(ymax-ymin) ! Factor should be 0.5, but heuristically it turns out to be larger. call plgchr(chardef, charht) yoffset = 1.0_plflt*charht*ycharacter_scale ! Draw the grid using plbox call plcol0(2) deltax = 1.0_plflt/nxcells(page) deltay = 1.0_plflt/nycells(page) call plbox("bcg", deltax, 0, "bcg", deltay, 0) call plcol0(15) length=hi(page)-lo(page) slice = 1 do j=nycells(page),0,-1 y = (j-0.5_plflt)*deltay do i=1,nxcells(page) x = (i-0.5_plflt)*deltax if (slice .le. length) then if (page .eq. 1) then write(cmdString, '("#",a)') Greek(slice) elseif (page .ge. 1 .and. page .le. 4) then write(cmdString, '("##[0x",z4.4,"]")') & type1(offset(page)+slice) ! Not required for command which is case insensitive, ! but lowercase the command simply to get same ! lowercase display of command as corresponding C example. call lowercase23(cmdString) elseif (page .ge. 5) then write(cmdString, '("##[0x",z4.4,"]")') & lo(page)+slice-1 ! Not required for command which is case insensitive, ! but lowercase the command simply to get same ! lowercase display of command as corresponding C example. call lowercase23(cmdString) endif call plptex(x,y+yoffset,1._plflt,0._plflt,0.5_plflt, & cmdString(2:20)) call plptex(x,y-yoffset,1._plflt,0._plflt,0.5_plflt, & cmdString) endif slice = slice + 1 enddo enddo call plschr(0._plflt, 1.0_plflt) call plmtex("t", 1.5_plflt, 0.5_plflt, 0.5_plflt, title(page)) enddo ! Demonstrate methods of getting the current fonts call plgfci(fci_old) call plgfont(ifamily, istyle, iweight) write (*,'(a,z8)') 'For example 23 prior to page 12 the FCI is 0x',fci_old write (*,'(a)') 'For example 23 prior to page 12 the font family, style and weight are '// & trim(family(ifamily+1))//' '//trim(style(istyle+1))//' '//trim(weight(iweight+1)) do page=11,15 dy = 0.030_plflt call pladv(0) call plvpor(0.02_plflt, 0.98_plflt, 0.02_plflt, 0.90_plflt) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) call plsfci(0_plunicode) if (page == 11) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & '#<0x10>PLplot Example 23 - '// & 'Set Font with plsfci') elseif (page == 12) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & '#<0x10>PLplot Example 23 - '// & 'Set Font with plsfont') elseif(page == 13) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & '#<0x10>PLplot Example 23 - '// & 'Set Font with ##<0x8nnnnnnn> construct') elseif(page == 14) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & '#<0x10>PLplot Example 23 - '// & 'Set Font with ##<0xmn> constructs') elseif(page == 15) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & '#<0x10>PLplot Example 23 - '// & 'Set Font with ## constructs') endif call plschr(0._plflt, 0.75_plflt) do i=0,fci_combinations-1 family_index = mod(i,5) style_index = mod(i/5,3) weight_index = mod((i/5)/3,2) if(page == 11) then call plsfci(fci(i+1)) write(string,'(a)') & 'Page 12, '// & trim(family(family_index+1))//', '// & trim(style(style_index+1))//', '// & trim(weight(weight_index+1))//': '// & 'The quick brown fox jumps over the lazy dog' elseif(page == 12) then call plsfont(family_index, style_index, weight_index) write(string,'(a)') & 'Page 13, '// & trim(family(family_index+1))//', '// & trim(style(style_index+1))//', '// & trim(weight(weight_index+1))//': '// & 'The quick brown fox jumps over the lazy dog' elseif(page == 13) then ! Note, must put in missing FCI marker for this particular case. write(string,'(a,"#<0x8",z7.7,">",a)') & 'Page 14, '//trim(family(family_index+1))//', '// & trim(style(style_index+1))//', '// & trim(weight(weight_index+1))//': ', & fci(i+1), & 'The quick brown fox jumps over the lazy dog' elseif(page == 14) then write(string,'(a,"#<0x",z1,"0>#<0x",z1,"1>#<0x",z1,"2>",a)') & 'Page 15, '// & trim(family(family_index+1))//', '// & trim(style(style_index+1))//', '// & trim(weight(weight_index+1))//': ', & family_index, & style_index, & weight_index, & 'The quick brown fox jumps over the lazy dog' elseif(page == 15) then write(string,'(a)') & 'Page 16, '// & trim(family(family_index+1))//', '// & trim(style(style_index+1))//', '// & trim(weight(weight_index+1))//': '// & '#<'//trim(family(family_index+1))//'/>#<'// & trim(style(style_index+1))//'/>#<'// & trim(weight(weight_index+1))//'/>'// & 'The quick brown fox jumps over the lazy dog' endif call plptex (0._plflt, 1._plflt - (i+0.5_plflt)*dy, 1._plflt, & 0._plflt, 0._plflt, string) enddo call plschr(0._plflt, 1.0_plflt) enddo ! Restore defaults call plcol0(1) call plend() end program x23f subroutine lowercase23(string) implicit none character*(*) string integer i, len, iascii do i = 1, len(string) iascii = iachar(string(i:i)) if(65.le.iascii.and.iascii.le.90) then ! convert uppercase to lowercase. string(i:i) = achar(iascii+32) endif enddo end plplot-5.10.0+dfsg/examples/f95/plf95demos.inc.in 644 1750 1750 37212243237170 202230ustar andrewandrew function myisnan(x) use plplot_flt implicit none logical :: myisnan real (kind=plflt) :: x @HAVE_F95_ISNAN_FALSE@ myisnan = (x.ne.x) @HAVE_F95_ISNAN_TRUE@ myisnan = isnan(x) return end function plplot-5.10.0+dfsg/examples/f95/x22f.f90 644 1750 1750 2341512251341601 162720ustar andrewandrew! $Id: x22f.f90 12827 2013-12-09 13:20:01Z andrewross $ ! Vector plot demo. ! ! Copyright (C) 2004 Alan W. Irwin ! Copyright (C) 2004 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! Does several contour plots using different coordinate mappings. use plplot implicit none integer narr logical fill parameter (narr=6) real(kind=plflt) arrow_x(narr),arrow_y(narr), & arrow2_x(narr),arrow2_y(narr) data arrow_x/-0.5_plflt, 0.5_plflt, 0.3_plflt, 0.5_plflt, 0.3_plflt, 0.5_plflt/ data arrow_y/0._plflt, 0._plflt, 0.2_plflt, 0._plflt, -0.2_plflt, 0._plflt/ data arrow2_x/-0.5_plflt, 0.3_plflt, 0.3_plflt, 0.5_plflt, 0.3_plflt, 0.3_plflt/ data arrow2_y/0._plflt, 0._plflt, 0.2_plflt, 0._plflt, -0.2_plflt, 0._plflt/ ! Process command-line arguments call plparseopts(PL_PARSE_FULL) call plinit call circulation fill = .false. ! Set arrow style using arrow_x and arrow_y the ! plot using these arrows call plsvect(arrow_x, arrow_y, fill) call constriction( 1 ) ! Set arrow style using arrow_x and arrow_y the ! plot using these arrows fill = .true. call plsvect(arrow2_x, arrow2_y, fill) call constriction( 2 ) call constriction2 call plsvect call potential call plend end ! vector plot of the circulation around the origin subroutine circulation() use plplot implicit none integer i, j, nx, ny parameter (nx=20, ny=20) real(kind=plflt) u(nx, ny), v(nx, ny), xg(nx,ny), yg(nx,ny) real(kind=plflt) dx, dy, xmin, xmax, ymin, ymax real(kind=plflt) xx, yy, scaling dx = 1.0_plflt dy = 1.0_plflt xmin = -dble(nx)/2.0_plflt*dx xmax = dble(nx)/2.0_plflt*dx ymin = -dble(ny)/2.0_plflt*dy ymax = dble(ny)/2.0_plflt*dy do i=1,nx xx = (dble(i)-nx/2.0_plflt-0.5_plflt)*dx do j=1,ny yy = (dble(j)-ny/2.0_plflt-0.5_plflt)*dy xg(i,j) = xx yg(i,j) = yy u(i,j) = yy v(i,j) = -xx enddo enddo call plenv(xmin, xmax, ymin, ymax, 0, 0) call pllab('(x)', '(y)', & '#frPLplot Example 22 - circulation') call plcol0(2) scaling = 0.0_plflt call plvect(u,v,scaling,xg,yg) call plcol0(1) end ! vector plot of the flow through a constricted pipe subroutine constriction( astyle ) use plplot, PI => PL_PI implicit none integer i, j, nx, ny, astyle parameter (nx=20, ny=20) character(len=80) :: title real(kind=plflt) u(nx, ny), v(nx, ny), xg(nx,ny), yg(nx,ny) real(kind=plflt) dx, dy, xmin, xmax, ymin, ymax real(kind=plflt) xx, yy, Q, b, dbdx, scaling dx = 1.0_plflt dy = 1.0_plflt xmin = -dble(nx)/2.0_plflt*dx xmax = dble(nx)/2.0_plflt*dx ymin = -dble(ny)/2.0_plflt*dy ymax = dble(ny)/2.0_plflt*dy Q = 2.0_plflt do i=1,nx xx = (dble(i)-dble(nx)/2.0_plflt-0.5_plflt)*dx do j=1,ny yy = (dble(j)-dble(ny)/2.0_plflt-0.5_plflt)*dy xg(i,j) = xx yg(i,j) = yy b = ymax/4.0_plflt*(3.0_plflt-cos(PI*xx/xmax)) if (abs(yy).lt.b) then dbdx = ymax/4.0_plflt*sin(PI*xx/xmax)*PI/xmax*yy/b u(i,j) = Q*ymax/b v(i,j) = u(i,j)*dbdx else u(i,j) = 0.0_plflt v(i,j) = 0.0_plflt endif enddo enddo call plenv(xmin, xmax, ymin, ymax, 0, 0) write(title,'(A,I0,A)') '#frPLplot Example 22 - constriction (arrow style ', astyle,')' call pllab('(x)', '(y)', title) call plcol0(2) scaling = -1.0_plflt call plvect(u,v,scaling,xg,yg) call plcol0(1) end ! Global transform function for a constriction using data passed in ! This is the same transformation used in constriction. subroutine transform( x, y, xt, yt ) use plplot, PI => PL_PI implicit none real(kind=plflt) x, y, xt, yt real(kind=plflt) xmax common /transform_data/ xmax xt = x yt = y / 4.0_plflt * ( 3.0_plflt - cos( PI * x / xmax ) ) end subroutine transform ! Vector plot of flow through a constricted pipe ! with a coordinate transform subroutine constriction2() use plplot, PI => PL_PI implicit none integer i, j, nx, ny, nc, nseg parameter (nx=20, ny=20, nc=11, nseg=20) real(kind=plflt) dx, dy, xx, yy real(kind=plflt) xmin, xmax, ymin, ymax real(kind=plflt) Q, b, scaling real(kind=plflt) u(nx, ny), v(nx, ny), xg(nx,ny), yg(nx,ny) real(kind=plflt) clev(nc); common /transform_data/ ymax character(len=1) defined external transform dx = 1.0_plflt dy = 1.0_plflt xmin = -dble(nx)/2.0_plflt*dx xmax = dble(nx)/2.0_plflt*dx ymin = -dble(ny)/2.0_plflt*dy ymax = dble(ny)/2.0_plflt*dy call plstransform( transform ) Q = 2.0_plflt do i=1,nx xx = (dble(i)-dble(nx)/2.0_plflt-0.5_plflt)*dx do j=1,ny yy = (dble(j)-dble(ny)/2.0_plflt-0.5_plflt)*dy xg(i,j) = xx yg(i,j) = yy b = ymax/4.0_plflt*(3.0_plflt-cos(PI*xx/xmax)) u(i,j) = Q*ymax/b v(i,j) = 0.0_plflt enddo enddo do i=1,nc clev(i) = Q + dble(i-1) * Q / ( dble(nc) - 1.0_plflt ) enddo call plenv(xmin, xmax, ymin, ymax, 0, 0) call pllab('(x)', '(y)', & '#frPLplot Example 22 - constriction with plstransform') call plcol0(2) call plshades(u, defined, xmin + dx / 2.0_plflt, & xmax - dx / 2.0_plflt, & ymin + dy / 2.0_plflt, ymax - dy / 2.0_plflt, & clev, 0.0_plflt, 1, 1.0_plflt, .false. ) scaling = -1.0_plflt call plvect(u,v,scaling,xg,yg) call plpath(nseg, xmin, ymax, xmax, ymax) call plpath(nseg, xmin, ymin, xmax, ymin) call plcol0(1) call plstransform end subroutine constriction2 subroutine potential() use plplot, PI => PL_PI implicit none integer i, j, nr, ntheta, nper, nlevel parameter (nr=20, ntheta=20, nper=100, nlevel=10) real(kind=plflt) u(nr, ntheta), v(nr, ntheta), z(nr, ntheta) real(kind=plflt) xg(nr,ntheta), yg(nr,ntheta) real(kind=plflt) clevel(nlevel), px(nper), py(nper) real(kind=plflt) xmin, xmax, ymin, ymax, zmin, zmax, rmax real(kind=plflt) xx, yy, r, theta, scaling, dz real(kind=plflt) eps, q1, d1, q1i, d1i, q2, d2, q2i, d2i real(kind=plflt) div1, div1i, div2, div2i rmax = dble(nr) eps = 2.0_plflt q1 = 1.0_plflt d1 = rmax/4.0_plflt q1i = - q1*rmax/d1 d1i = rmax**2.0_plflt/d1 q2 = -1.0_plflt d2 = rmax/4.0_plflt q2i = - q2*rmax/d2 d2i = rmax**2.0_plflt/d2 do i = 1, nr r = 0.5 + dble(i-1) do j = 1, ntheta theta = 2.*PI/dble(ntheta-1)*(dble(j)-0.5) xx = r*cos(theta) yy = r*sin(theta) xg(i,j) = xx yg(i,j) = yy div1 = sqrt((xg(i,j)-d1)**2 + (yg(i,j)-d1)**2 + eps**2) div1i = sqrt((xg(i,j)-d1i)**2 + (yg(i,j)-d1i)**2 + eps**2) div2 = sqrt((xg(i,j)-d2)**2 + (yg(i,j)+d2)**2 + eps**2) div2i = sqrt((xg(i,j)-d2i)**2 + (yg(i,j)+d2i)**2 + eps**2) z(i,j) = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i u(i,j) = -q1*(xx-d1)/div1**3 - q1i*(xx-d1i)/div1i**3 - & q2*(xx-d2)/div2**3 - q2i*(xx-d2i)/div2i**3 v(i,j) = -q1*(yy-d1)/div1**3 - q1i*(yy-d1i)/div1i**3 - & q2*(yy+d2)/div2**3 - q2i*(yy+d2i)/div2i**3 enddo enddo call a2mnmx(xg, nr, ntheta, xmin, xmax, nr) call a2mnmx(yg, nr, ntheta, ymin, ymax, nr) call a2mnmx(z, nr, ntheta, zmin, zmax, nr) call plenv(xmin, xmax, ymin, ymax, 0, 0) call pllab('(x)', '(y)', & '#frPLplot Example 22 - potential gradient vector plot') ! plot contours of the potential dz = abs(zmax - zmin)/dble (nlevel) do i = 1, nlevel clevel(i) = zmin + (i-0.5_plflt)*dz enddo call plcol0(3) call pllsty(2) call plcont(z,1,nr,1,ntheta,clevel,xg,yg) call pllsty(1) call plcol0(1) call plcol0(2) scaling = 25.0_plflt call plvect(u,v,scaling,xg,yg) call plcol0(1) do i=1,nper theta = 2.0_plflt*PI/dble(nper-1)*dble(i) px(i) = rmax*cos(theta) py(i) = rmax*sin(theta) enddo call plline(px,py) end !---------------------------------------------------------------------------- ! Subroutine a2mnmx ! Minimum and the maximum elements of a 2-d array. subroutine a2mnmx(f, nx, ny, fmin, fmax, xdim) use plplot implicit none integer i, j, nx, ny, xdim real(kind=plflt) f(xdim, ny), fmin, fmax fmax = f(1, 1) fmin = fmax do j = 1, ny do i = 1, nx fmax = max(fmax, f(i, j)) fmin = min(fmin, f(i, j)) enddo enddo end plplot-5.10.0+dfsg/examples/f95/x17f.f90 644 1750 1750 1153512243237170 163040ustar andrewandrew! $Id: x17f.f90 12725 2013-11-20 22:58:00Z airwin $ ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA !-------------------------------------------------------------------------- ! main program !-------------------------------------------------------------------------- program x17f95 use plplot, PI => PL_PI implicit none integer :: id1, n integer, parameter :: nsteps = 1000 logical :: autoy, acc real(kind=plflt) :: y1, y2, y3, y4, ymin, ymax, xlab, ylab real(kind=plflt) :: t, tmin, tmax, tjump, dt, noise integer :: colbox, collab, colline(4), styline(4) character(len=20) :: legline(4) logical :: pl_errcode character(len=80) :: errmsg ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! plplot initialization ! If db is used the plot is much more smooth. However, because of the ! async X behaviour, one does not have a real-time scripcharter. ! ! call plsetopt('db', '') ! call plsetopt('np', '') ! User sets up plot completely except for window and data ! Eventually settings in place when strip chart is created will be ! remembered so that multiple strip charts can be used simultaneously. ! Specify some reasonable defaults for ymin and ymax ! The plot will grow automatically if needed (but not shrink) ymin = -0.1_plflt ymax = 0.1_plflt ! Specify initial tmin and tmax -- this determines length of window. ! Also specify maximum jump in t ! This can accomodate adaptive timesteps tmin = 0._plflt tmax = 10._plflt ! percentage of plot to jump tjump = 0.3_plflt ! Axes options same as plbox. ! Only automatic tick generation and label placement allowed ! Eventually I'll make this fancier colbox = 1 collab = 3 ! pens color and line style styline = (/ 2, 3, 4, 5 /) colline = (/ 2, 3, 4, 5 /) ! pens legend legline = (/ 'sum ', 'sin ', 'sin*noi', 'sin+noi' /) ! legend position xlab = 0._plflt ylab = 0.25_plflt ! autoscale y autoy = .true. ! don't scrip, accumulate acc = .true. ! Initialize plplot call plinit() call pladv(0) call plvsta() ! Register our error variables with PLplot ! From here on, we're handling all errors here ! TODO: call plsError(&pl_errcode, errmsg) call plstripc(id1, 'bcnst', 'bcnstv', & tmin, tmax, tjump, ymin, ymax, & xlab, ylab, & autoy, acc, & colbox, collab, & colline, styline, legline, & 't', '', 'Strip chart demo') pl_errcode = .false. if ( pl_errcode ) then write(*,*) errmsg stop endif ! Let plplot handle errors from here on ! TODO: call plsError(NULL, NULL) ! autoscale y autoy = .false. ! accumulate acc = .true. ! This is to represent a loop over time ! Let's try a random walk process y1 = 0.0_plflt y2 = 0.0_plflt y3 = 0.0_plflt y4 = 0.0_plflt dt = 0.1_plflt do n = 0,nsteps-1 ! wait a little (10 ms) to simulate time elapsing. gfortran ! sleep has resolution of 1 sec so the call below is commented ! out because it is like watching paint dry. In any case, I ! like the resulting speedier output when you drop sleep ! altogether from this loop. ! call sleep(1) t = dble(n) * dt noise = plrandd() - 0.5_plflt y1 = y1 + noise y2 = sin(t*PI/18._plflt) y3 = y2 * noise y4 = y2 + noise/3._plflt ! There is no need for all pens to have the same number of ! points or beeing equally time spaced. if ( mod(n,2) .ne. 0 ) then call plstripa(id1, 0, t, y1) endif if ( mod(n,3) .ne. 0 ) then call plstripa(id1, 1, t, y2) endif if ( mod(n,4) .ne. 0 ) then call plstripa(id1, 2, t, y3) endif if ( mod(n,5) .ne. 0 ) then call plstripa(id1, 3, t, y4) endif ! use_ double buffer (-db on command line) ! call pleop() enddo ! Destroy strip chart and it's memory call plstripd(id1) call plend() end program x17f95 plplot-5.10.0+dfsg/examples/f95/x12f.f90 644 1750 1750 522511703217235 162560ustar andrewandrew! $Id: x12f.f90 12125 2012-01-11 05:31:09Z arjenmarkus $ ! Demonstration program for PLplot: Bar chart example. ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x12f95 use plplot implicit none character(len=20) :: string integer :: i real(kind=plflt) :: y0(10) real(kind=plflt) :: pos(5) = (/0.0_plflt, 0.25_plflt, 0.5_plflt, 0.75_plflt, 1.0_plflt/) real(kind=plflt) :: red(5) = (/0.0_plflt, 0.25_plflt, 0.5_plflt, 1.0_plflt, 1.0_plflt/) real(kind=plflt) :: green(5) = (/1.0_plflt, 0.5_plflt, 0.5_plflt, 0.5_plflt, 1.0_plflt/) real(kind=plflt) :: blue(5) = (/1.0_plflt, 1.0_plflt, 0.5_plflt, 0.25_plflt, 0.0_plflt/) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) call plinit() call pladv(0) call plvsta call plwind( 1980._plflt, 1990._plflt, 0._plflt, 35._plflt ) call plbox( 'bc', 1._plflt, 0, 'bcnv', 10._plflt, 0 ) call plcol0(2) call pllab( 'Year', 'Widget Sales (millions)', '#frPLplot Example 12' ) y0 = (/ 5, 15, 12, 24, 28, 30, 20, 8, 12, 3 /) call plscmap1l(.true.,pos,red,green,blue) do i = 0, 9 ! call plcol0(i + 1) call plcol1(dble(i)/9.0_plflt) call plpsty(0) call plfbox( 1980._plflt+i, y0(i+1) ) write (string, '(i0)') int(y0(i+1)) call plptex( 1980._plflt+i+0.5_plflt, y0(i+1)+1._plflt, 1._plflt, 0._plflt, 0.5_plflt, string ) write (string, '(i0)')1980+i call plmtex( 'b', 1._plflt, (i+1)*0.1_plflt-0.05_plflt, 0.5_plflt, string ) enddo ! Don't forget to call PLEND to finish off! call plend contains subroutine plfbox(x0, y0) real(kind=plflt) x0, y0, x(4), y(4) x(1) = x0 y(1) = 0._plflt x(2) = x0 y(2) = y0 x(3) = x0+1._plflt y(3) = y0 x(4) = x0+1._plflt y(4) = 0._plflt call plfill(x, y) call plcol0(1) call pllsty(1) call plline(x, y) end subroutine plfbox end program x12f95 plplot-5.10.0+dfsg/examples/f95/x06f.f90 644 1750 1750 547211667625102 162720ustar andrewandrew! $Id: x06f.f90 12097 2011-12-07 08:56:34Z arjenmarkus $ ! Displays the plotter symbols for PLPOIN ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x06f95 use plplot implicit none integer :: i, j, k, font, kind_font, maxfont real(kind=plflt), dimension(1:1) :: x, y character (len=3) :: text ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Full sized page for display call plinit() do kind_font = 1,2 call plfontld(kind_font-1) maxfont = merge( 1, 4, kind_font==1 ) do font=1,maxfont call plfont(font) call pladv(0) call plcol0(2) ! Set up viewport and window call plvpor(0.1_plflt, 1.0_plflt, 0.1_plflt, 0.9_plflt) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.3_plflt) ! Draw the grid using plbox call plbox('bcg', 0.1_plflt, 0, 'bcg', 0.1_plflt, 0) call plcol0(15) ! Write the digits below the frame do i=0,9 write (text,'(i1)') i call plmtex('b', 1.5_plflt, (0.1_plflt*i+0.05_plflt), 0.5_plflt, text) enddo k=0 do i=0,12 ! Write the digits to the left of the frame write (text,'(i0)') 10*i call plmtex('lv', 1.0_plflt, (1.0_plflt-(2*i+1)/26.0_plflt), & 1.0_plflt, text) do j=0,9 x=0.1_plflt*j+0.05_plflt y=1.25_plflt-0.1_plflt*i ! Display the symbols if (k < 128) call plpoin(x,y,k) k=k+1 enddo enddo if (kind_font==1) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & 'PLplot Example 6 - plpoin symbols (compact)') else call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & 'PLplot Example 6 - plpoin symbols (extended)') endif enddo enddo call plend end program x06f95 plplot-5.10.0+dfsg/examples/f95/x18f.f90 644 1750 1750 1225111707442055 163050ustar andrewandrew! $Id: x18f.f90 12149 2012-01-24 05:39:57Z arjenmarkus $ ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA !-------------------------------------------------------------------------- ! main ! ! Does a series of 3-d plots for a given data set, with different ! viewing options in each plot. !-------------------------------------------------------------------------- program x18f95 use plplot, PI => PL_PI, TWOPI => PL_TWOPI implicit none integer, parameter :: NPTS = 1000 integer :: i, k real(kind=plflt), dimension(NPTS) :: x, y, z, r character(len=80) :: title integer :: opt(4) = (/ 1, 0, 1, 0 /) real(kind=plflt) :: alt(4) = (/ 20.0_plflt, 35.0_plflt, 50.0_plflt, 65.0_plflt /) real(kind=plflt) :: az(4) = (/ 30.0_plflt, 40.0_plflt, 50.0_plflt, 60.0_plflt /) integer, dimension(NPTS) :: ia = (/(i,i=1,NPTS)/) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plinit() do k = 1, 4 call test_poly(k, alt(k), az(k)) enddo ! From the mind of a sick and twisted physicist... z = -1._plflt + 2._plflt * dble (ia-1) / dble (NPTS) ! Pick one ... ! r = 1. - dble (ia-1) / dble (NPTS) r = z x = r * cos( 2._plflt * PI * 6._plflt * dble (ia-1) / dble (NPTS) ) y = r * sin( 2._plflt * PI * 6._plflt * dble (ia-1) / dble (NPTS) ) do k = 1, 4 call pladv(0) call plvpor(0.0_plflt, 1.0_plflt, 0.0_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -0.9_plflt, 1.1_plflt) call plcol0(1) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, & -1.0_plflt, 1.0_plflt, -1.0_plflt, & 1.0_plflt, -1.0_plflt, 1.0_plflt, & alt(k), az(k)) call plbox3('bnstu', 'x axis', 0.0_plflt, 0, & 'bnstu', 'y axis', 0.0_plflt, 0, & 'bcdmnstuv', 'z axis', 0.0_plflt, 0) call plcol0(2) if ( opt(k).gt. 0 ) then call plline3(x, y, z) else !U+22C5 DOT OPERATOR. call plstring3( x, y, z, "⋅" ) endif call plcol0(3) write( title, '(a,i2,a,i2)') '#frPLplot Example 18 - Alt=', nint(alt(k)), ', Az=', nint(az(k)) call plmtex('t', 1.0_plflt, 0.5_plflt, 0.5_plflt, title) enddo call plend() contains subroutine test_poly(k, alt, az) integer :: k real(kind=plflt) :: alt, az real(kind=plflt) :: x(5), y(5), z(5) integer :: i, j logical :: draw(4,4) = & reshape( & (/ .true., .true., .true., .true., & .true., .false., .true., .false., & .false., .true., .false., .true., & .true., .true., .false., .false. /), (/4,4/) ) integer, dimension(0:20) :: ia = (/(j,j=0,20)/) real(kind=plflt), dimension(0:20) :: theta, phi theta = TWOPI * ia /20._plflt phi = PI * ia / 20.1_plflt call pladv(0) call plvpor(0.0_plflt, 1.0_plflt, 0.0_plflt, 0.9_plflt) call plwind(-1.0_plflt, 1.0_plflt, -0.9_plflt, 1.1_plflt) call plcol0(1) call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, & -1.0_plflt, 1.0_plflt, -1.0_plflt, & 1.0_plflt, -1.0_plflt, 1.0_plflt, & alt, az) call plbox3('bnstu', 'x axis', 0.0_plflt, 0, & 'bnstu', 'y axis', 0.0_plflt, 0, & 'bcdmnstuv', 'z axis', 0.0_plflt, 0) call plcol0(2) ! x = r sin(phi) cos(theta) ! y = r sin(phi) sin(theta) ! z = r cos(phi) ! r = 1 :=) do i=0,19 do j=0,19 x(1) = sin( phi(j) ) * cos( theta(i) ) y(1) = sin( phi(j) ) * sin( theta(i) ) z(1) = cos( phi(j) ) x(2) = sin( phi(j+1) ) * cos( theta(i) ) y(2) = sin( phi(j+1) ) * sin( theta(i) ) z(2) = cos( phi(j+1) ) x(3) = sin( phi(j+1) ) * cos( theta(i+1) ) y(3) = sin( phi(j+1) ) * sin( theta(i+1) ) z(3) = cos( phi(j+1) ) x(4) = sin( phi(j) ) * cos( theta(i+1) ) y(4) = sin( phi(j) ) * sin( theta(i+1) ) z(4) = cos( phi(j) ) x(5) = sin( phi(j) ) * cos( theta(i) ) y(5) = sin( phi(j) ) * sin( theta(i) ) z(5) = cos( phi(j) ) call plpoly3(x, y, z, draw(:,k), .true.) enddo enddo call plcol0(3) call plmtex('t', 1.0_plflt, 0.5_plflt, 0.5_plflt, 'unit radius sphere' ) end subroutine test_poly end program x18f95 plplot-5.10.0+dfsg/examples/f95/x25f.f90 644 1750 1750 1364611703217235 163100ustar andrewandrew! $Id: x25f.f90 12125 2012-01-11 05:31:09Z arjenmarkus $ ! ! Filling and clipping polygons. ! ! Copyright (C) 2005 Arjen Markus ! Copyright (C) 2008 Andrew Ross ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as published ! by the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public License ! along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! ! ! -------------------------------------------------------------------------- ! main ! ! Test program for filling polygons and proper clipping ! -------------------------------------------------------------------------- program x25f use plplot implicit none integer :: i, j, k integer :: npts real(kind=plflt) :: xextreme(2,10) real(kind=plflt) :: yextreme(2,10) real(kind=plflt) :: x0(10) real(kind=plflt) :: y0(10) data ( xextreme(1,i), xextreme(2,i), yextreme(1,i), yextreme(2,i), i=1,9) / & -120.0_plflt, 120.0_plflt, -120.0_plflt, 120.0_plflt, & -120.0_plflt, 120.0_plflt, 20.0_plflt, 120.0_plflt, & -120.0_plflt, 120.0_plflt, -20.0_plflt, 120.0_plflt, & -80.0_plflt, 80.0_plflt, -20.0_plflt, 120.0_plflt, & -220.0_plflt, -120.0_plflt, -120.0_plflt, 120.0_plflt, & -20.0_plflt, 20.0_plflt, -120.0_plflt, 120.0_plflt, & -20.0_plflt, 20.0_plflt, -20.0_plflt, 20.0_plflt, & -80.0_plflt, 80.0_plflt, -80.0_plflt, 80.0_plflt, & 20.0_plflt, 120.0_plflt, -120.0_plflt, 120.0_plflt/ npts = 0 ! Parse and process command line arguments call plparseopts(PL_PARSE_FULL) ! Initialize plplot call plssub(3,3) call plinit() do k = 1,2 do j = 1,4 select case ( j ) case ( 1 ) ! Polygon 1: a diamond x0(1) = 0.0_plflt y0(1) = -100.0_plflt x0(2) = -100.0_plflt y0(2) = 0.0_plflt x0(3) = 0.0_plflt y0(3) = 100.0_plflt x0(4) = 100.0_plflt y0(4) = 0.0_plflt npts = 4 case( 2 ) ! Polygon 1: a diamond - reverse direction x0(4) = 0.0_plflt y0(4) = -100.0_plflt x0(3) = -100.0_plflt y0(3) = 0.0_plflt x0(2) = 0.0_plflt y0(2) = 100.0_plflt x0(1) = 100.0_plflt y0(1) = 0.0_plflt npts = 4 case( 3 ) ! Polygon 2: a square with punctures x0(1) = -100.0_plflt y0(1) = -100.0_plflt x0(2) = -100.0_plflt y0(2) = -80.0_plflt x0(3) = 80.0_plflt y0(3) = 0.0_plflt x0(4) = -100.0_plflt y0(4) = 80.0_plflt x0(5) = -100.0_plflt y0(5) = 100.0_plflt x0(6) = -80.0_plflt y0(6) = 100.0_plflt x0(7) = 0.0_plflt y0(7) = 80.0_plflt x0(8) = 80.0_plflt y0(8) = 100.0_plflt x0(9) = 100.0_plflt y0(9) = 100.0_plflt x0(10) = 100.0_plflt y0(10) = -100.0_plflt npts = 10 case( 4 ) ! Polygon 2: a square with punctures - reversed direction x0(10) = -100.0_plflt y0(10) = -100.0_plflt x0(9) = -100.0_plflt y0(9) = -80.0_plflt x0(8) = 80.0_plflt y0(8) = 0.0_plflt x0(7) = -100.0_plflt y0(7) = 80.0_plflt x0(6) = -100.0_plflt y0(6) = 100.0_plflt x0(5) = -80.0_plflt y0(5) = 100.0_plflt x0(4) = 0.0_plflt y0(4) = 80.0_plflt x0(3) = 80.0_plflt y0(3) = 100.0_plflt x0(2) = 100.0_plflt y0(2) = 100.0_plflt x0(1) = 100.0_plflt y0(1) = -100.0_plflt npts = 10 end select do i = 1,9 call pladv(0) call plvsta() call plwind(xextreme(1,i), xextreme(2,i), yextreme(1,i), yextreme(2,i)) call plcol0(2) call plbox('bc', 1.0d0, 0, 'bcnv', 10.0d0, 0) call plcol0(1) call plpsty(0) if(k.eq.1) then call plfill(x0(1:npts),y0(1:npts)) else call plgradient(x0(1:npts),y0(1:npts),45.d0) endif call plcol0(2) call pllsty(1) call plline(x0(1:npts),y0(1:npts)) end do end do end do ! Don't forget to call plend() to finish off! call plend end program x25f plplot-5.10.0+dfsg/examples/f95/x08f.f90 644 1750 1750 1430611670047643 163120ustar andrewandrew! $Id: x08f.f90 12098 2011-12-08 05:48:19Z arjenmarkus $ ! 3-d plot demo ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x08f95 use plplot, PI => PL_PI use plf95demolib implicit none integer :: i, j, k, ifshade ! xdim is the leading dimension of z, xpts <= xdim is the leading ! dimension of z that is defined. integer, parameter :: xdim=99, ydim=100, xpts=35, ypts=46 real(kind=plflt) :: x(xdim), y(ydim), z(xdim,ypts), xx, yy, r character (len=80) :: title(2) = & (/'#frPLplot Example 8 - Alt=60, Az=30', & '#frPLplot Example 8 - Alt=20, Az=60'/) real(kind=plflt) :: alt(2) = (/60.0_plflt, 20.0_plflt/) real(kind=plflt) :: az(2) = (/30.0_plflt, 60.0_plflt/) integer :: rosen integer, parameter :: nlevel = 10 real(kind=plflt) :: zmin, zmax, step, clevel(nlevel) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) rosen = 1 x = (arange(0,xpts) - xpts/2) / dble(xpts/2) y = (arange(0,ypts) - ypts/2) / dble(ypts/2) if ( rosen == 1 ) then x = 1.5_plflt * x y = y + 0.5_plflt endif do i=1,xpts xx = x(i) do j=1,ypts yy = y(j) if (rosen == 1) then z(i,j) = (1._plflt - xx)**2 + 100._plflt*(yy - xx**2)**2 ! The log argument may be zero for just the right grid. if (z(i,j) > 0._plflt) then z(i,j) = log(z(i,j)) else z(i,j) = -5._plflt endif else ! Sombrero function r = sqrt(xx**2 + yy**2) z(i,j) = exp(-r**2) * cos(2.0_plflt*PI*r) endif enddo enddo zmin = minval( z(1:xpts,:) ) zmax = maxval( z(1:xpts,:) ) step = (zmax-zmin)/(nlevel+1) clevel = zmin + step * arange(1,nlevel+1) call plinit() call pllightsource(1._plflt, 1._plflt, 1._plflt) do k=1,2 do ifshade = 0, 3 call pladv(0) call plvpor(0.0_plflt, 1.0_plflt, 0.0_plflt, 0.9_plflt ) call plwind(-1.0_plflt, 1.0_plflt, -0.9_plflt, 1.1_plflt ) call plcol0(3) call plmtex('t', 1.0_plflt, 0.5_plflt, 0.5_plflt, title(k)) call plcol0(1) if (rosen ==1) then call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, -1.5_plflt, & 1.5_plflt, -0.5_plflt, 1.5_plflt, zmin, zmax, alt(k),az(k)) else call plw3d(1.0_plflt, 1.0_plflt, 1.0_plflt, -1.0_plflt, & 1.0_plflt, -1.0_plflt, 1.0_plflt, zmin, zmax, alt(k),az(k)) endif call plbox3('bnstu','x axis', 0.0_plflt, 0, & 'bnstu', 'y axis', 0.0_plflt, 0, & 'bcdmnstuv','z axis', 0.0_plflt, 0) call plcol0(2) select case (ifshade) case( 0 ) ! diffuse light surface plot call cmap1_init(1) call plsurf3d(x(:xpts), y(:ypts), z(:xpts,:ypts), & 0, clevel(nlevel:1)) case( 1 ) ! magnitude colored plot call cmap1_init(0) call plsurf3d(x(:xpts), y(:ypts), z(:xpts,:ypts), & MAG_COLOR, clevel(nlevel:1)) case( 2 ) ! magnitude colored plot with faceted squares call cmap1_init(0) call plsurf3d(x(:xpts), y(:ypts), z(:xpts,:ypts), & ior(MAG_COLOR, FACETED), clevel(nlevel:1)) case( 3 ) ! magnitude colored plot with contours call cmap1_init(0) call plsurf3d(x(:xpts), y(:ypts), z(:xpts,:ypts), & ior(MAG_COLOR, ior(SURF_CONT, BASE_CONT)), clevel) case default stop 'x08f: bad logic' end select enddo enddo call plend contains !---------------------------------------------------------------------------- subroutine cmap1_init(gray) ! For gray.eq.1, basic grayscale variation from half-dark ! to light. Otherwise, hue variations around the front of the ! colour wheel from blue to green to red with constant lightness ! and saturation. integer :: gray real(kind=plflt) :: i(0:1), h(0:1), l(0:1), s(0:1) ! left boundary i(0) = 0._plflt ! right boundary i(1) = 1._plflt if (gray == 1) then ! hue -- low: red (arbitrary if s=0) h(0) = 0.0_plflt ! hue -- high: red (arbitrary if s=0) h(1) = 0.0_plflt ! lightness -- low: half-dark l(0) = 0.5_plflt ! lightness -- high: light l(1) = 1.0_plflt ! minimum saturation s(0) = 0.0_plflt ! minimum saturation s(1) = 0.0_plflt else ! This combination of hues ranges from blue to cyan to green to yellow ! to red (front of colour wheel) with constant lightness = 0.6 ! and saturation = 0.8. ! hue -- low: blue h(0) = 240._plflt ! hue -- high: red h(1) = 0.0_plflt ! lightness -- low: l(0) = 0.6_plflt ! lightness -- high: l(1) = 0.6_plflt ! saturation s(0) = 0.8_plflt ! minimum saturation s(1) = 0.8_plflt endif call plscmap1n(256) call plscmap1l(.false., i, h, l, s) end subroutine cmap1_init end program x08f95 plplot-5.10.0+dfsg/examples/f95/x09f.f90 644 1750 1750 2577412251742312 163150ustar andrewandrew! $Id: x09f.f90 12843 2013-12-11 01:50:02Z andrewross $ ! Contour plot demo. ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ! Does several contour plots using different coordinate mappings. program x09f95 use plplot, PI => PL_PI, TWOPI => PL_TWOPI use plf95demolib implicit none integer i, j ! xdim and ydim are the absolute static dimensions. ! nptsx, and nptsy are the (potentially dynamic) defined area of the 2D ! arrays that is actually used. integer, parameter :: xdim=99, ydim=100, nptsx=35, nptsy=46 real(kind=plflt) :: z(xdim, ydim), w(xdim, ydim), & xg1(xdim), yg1(ydim), & xg2(xdim, ydim), yg2(xdim, ydim) real(kind=plflt) :: xc(nptsx), yc(nptsy) real(kind=plflt) :: xx, yy, argx, argy, distort real(kind=plflt) :: tr(6) real(kind=plflt) :: clevel(11) = & (/ -1._plflt, -0.8_plflt, -0.6_plflt, -0.4_plflt, -0.2_plflt, & 0._plflt, 0.2_plflt, 0.4_plflt, 0.6_plflt, 0.8_plflt, 1._plflt /) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) tr = (/ 2._plflt/dble(nptsx-1), 0.0_plflt, -1.0_plflt, & 0.0_plflt, 2._plflt/dble(nptsy-1), -1.0_plflt /) ! Calculate the data matrices. xc = (arange(0,nptsx) - (nptsx/2)) / dble(nptsx/2) yc = (arange(0,nptsy) - (nptsy/2)) / dble(nptsy/2) - 1.0_plflt do i=1,nptsx do j=1,nptsy z(i,j) = xc(i)**2 - yc(j)**2 w(i,j) = 2._plflt*xc(i)*yc(j) enddo enddo ! Build the 1-d coord arrays. distort = 0.4_plflt xg1(1:nptsx) = coord_function( arange(0,nptsx) / dble(nptsx-1), distort ) yg1(1:nptsy) = coord_function( arange(0,nptsy) / dble(nptsy-1), -distort ) ! Build the 2-d coord arrays. do i=1,nptsx xx = -1._plflt + dble(i-1)*2._plflt/dble(nptsx-1) argx = 0.5_plflt*PI*xx do j=1,nptsy yy = -1._plflt + dble(j-1)*2._plflt/dble(nptsy-1) argy = 0.5_plflt*PI*yy xg2(i,j) = xx + distort*cos(argx)*cos(argy) yg2(i,j) = yy - distort*cos(argx)*cos(argy) enddo enddo call plinit ! Plot using identity transform call pl_setcontlabelformat(4, 3) call pl_setcontlabelparam(0.006_plflt, 0.3_plflt, 0.1_plflt, 1) call plenv(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt, 0, 0) call plcol0(2) call plcont(z(1:nptsx,1:nptsy), 1, nptsx, 1, nptsy, clevel, tr) call plstyl(1, 1500, 1500) call plcol0(3) call plcont(w(1:nptsx,1:nptsy), 1, nptsx, 1, nptsy, clevel, tr) call plstyl(0, 1500, 1500) call plcol0(1) call pllab('X Coordinate', 'Y Coordinate', 'Streamlines of flow') call pl_setcontlabelparam(0.006_plflt, 0.3_plflt, 0.1_plflt, 0) ! Plot using 1d coordinate transform call plenv(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt, 0, 0) call plcol0(2) call plcont(z(1:nptsx,1:nptsy), 1, nptsx, 1, nptsy, clevel, xg1(1:nptsx), yg1(1:nptsy)) call plstyl(1, 1500, 1500) call plcol0(3) call plcont(w(1:nptsx,1:nptsy), 1, nptsx, 1, nptsy, clevel, xg1(1:nptsx), yg1(1:nptsy)) call plstyl(0, 1500, 1500) call plcol0(1) call pllab('X Coordinate', 'Y Coordinate', 'Streamlines of flow') ! Plot using 2d coordinate transform call plenv(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.0_plflt, 0, 0) call plcol0(2) call plcont(z(1:nptsx,1:nptsy), 1, nptsx, 1, nptsy, clevel, xg2(1:nptsx,1:nptsy), yg2(1:nptsx,1:nptsy)) call plstyl(1, 1500, 1500) call plcol0(3) call plcont(w(1:nptsx,1:nptsy), 1, nptsx, 1, nptsy, clevel, xg2(1:nptsx,1:nptsy), yg2(1:nptsx,1:nptsy)) call plstyl(0, 1500, 1500) call plcol0(1) call pllab('X Coordinate', 'Y Coordinate', 'Streamlines of flow') call polar() call potential() call plend contains !---------------------------------------------------------------------------- ! Auxiliary function to compute the coordinates elemental real(kind=plflt) function coord_function( coord, factor ) real(kind=plflt), intent(in) :: coord real(kind=plflt), intent(in) :: factor real(kind=plflt) :: tcoord tcoord = -1.0_plflt + coord * 2.0_plflt coord_function = tcoord + factor*cos(0.5_plflt*PI*tcoord) end function coord_function !---------------------------------------------------------------------------- ! polar contour plot example. subroutine polar() integer, parameter :: PERIMETERPTS = 100 ! xdim and ydim are the absolute static size of the 2D arrays. ! RPTS and THETAPTS are associated with the part of the ! 2D arrays that are defined. integer, parameter :: xdim=99, RPTS = 40 integer, parameter :: ydim=100, THETAPTS = 40 integer, parameter :: NLEVEL=10 integer :: i,j real(kind=plflt) :: xg(xdim, ydim), yg(xdim, ydim), & z(xdim, ydim), px(PERIMETERPTS), py(PERIMETERPTS), & lev(NLEVEL), r, theta, delta call plenv(-1._plflt, 1._plflt, -1._plflt, 1._plflt, 0, -2) call plcol0(1) ! perimeter. delta = 2._plflt*PI/(PERIMETERPTS-1) px = cos(delta*arange(0, PERIMETERPTS)) py = sin(delta*arange(0, PERIMETERPTS)) call plline(px, py) ! create data to be contoured. do j = 1, THETAPTS theta = (2._plflt*PI/dble(THETAPTS-1))*dble(j-1) do i = 1, RPTS r = (i-1)/dble(RPTS-1) xg(i,j) = r*cos(theta) yg(i,j) = r*sin(theta) z(i,j) = r enddo enddo ! create contour values. lev = 0.05_plflt + 0.10_plflt * arange(0,nlevel) ! plot the (polar) contours. call plcol0(2) call plcont(z, 1, RPTS, 1, THETAPTS, lev, xg, yg) call plcol0(1) call pllab('', '', 'Polar Contour Plot') end subroutine polar !---------------------------------------------------------------------------- ! shielded potential contour plot example subroutine potential() integer :: i, j, nx, ny, kx, lx, ky, ly, & nlevel, ilevgt, ilevlt, nlevlt, nlevgt, & ncollin, ncolbox, ncollab, & nxsub, nysub real(kind=plflt) :: r, theta, rmax, x0, & y0, xmin, xmax, eps, q1, d1, & ymin, ymax, & q1i, d1i, q2, d2, q2i, d2i, div1, div1i, div2, div2i, & zmin, zmax, dz, xpmin, xpmax, ypmin, ypmax, & xtick, ytick, delta ! xdim and ydim are the absolute static size of the 2D arrays. ! NCX and NCY are associated with the part of the ! 2D arrays that are defined. integer, parameter :: xdim=99, NCX=40, ydim=100, NCY=64, NPLT=100 real(kind=plflt) :: z(xdim, ydim), ztmp(xdim, ydim+1) real(kind=plflt) :: xg(xdim, ydim+1), yg(xdim, ydim+1), xtm(NPLT), ytm(NPLT) real(kind=plflt) :: clevel(20) character(len=8) :: xopt, yopt nx = NCX ny = NCY kx = 1 lx = nx ky = 1 ly = ny ! Set up r-theta grids ! Tack on extra cell in theta to handle periodicity. do i = 1, nx r = i - 0.5_plflt do j = 1, ny theta = TWOPI/dble(ny-1) * (j-0.5_plflt) xg(i,j) = r * cos(theta) yg(i,j) = r * sin(theta) enddo xg(i, ny+1) = xg(i, 1) yg(i, ny+1) = yg(i, 1) enddo xmax = maxval( xg(1:nx,1:ny) ) xmin = minval( xg(1:nx,1:ny) ) ymax = maxval( yg(1:nx,1:ny) ) ymin = minval( yg(1:nx,1:ny) ) rmax = r x0 = (xmin + xmax)/2._plflt y0 = (ymin + ymax)/2._plflt ! Potential inside a conducting cylinder (or sphere) by method of images. ! Charge 1 is placed at (d1, d1), with image charge at (d2, d2). ! Charge 2 is placed at (d1, -d1), with image charge at (d2, -d2). ! Also put in smoothing term at small distances. eps = 2._plflt q1 = 1._plflt d1 = r/4._plflt q1i = - q1*r/d1 d1i = r**2/d1 q2 = -1._plflt d2 = r/4._plflt q2i = - q2*r/d2 d2i = r**2/d2 do i = 1, nx do j = 1, ny div1 = sqrt((xg(i,j)-d1)**2 + (yg(i,j)-d1)**2 + eps**2) div1i = sqrt((xg(i,j)-d1i)**2 + (yg(i,j)-d1i)**2 + eps**2) div2 = sqrt((xg(i,j)-d2)**2 + (yg(i,j)+d2)**2 + eps**2) div2i = sqrt((xg(i,j)-d2i)**2 + (yg(i,j)+d2i)**2 + eps**2) z(i,j) = q1/div1 + q1i/div1i + q2/div2 + q2i/div2i enddo enddo ! Tack on extra cell in theta to handle periodicity. ztmp(:,1:ny) = z ztmp(:,ny+1:ny+1) = z(:,1:1) zmax = maxval( z(1:nx,1:ny) ) zmin = minval( z(1:nx,1:ny) ) ! Set up contour levels. nlevel = 20 dz = abs(zmax - zmin)/dble (nlevel) clevel(1:nlevel) = zmin + (arange(1,nlevel+1) - 0.5_plflt) * dz ! Split contours into two parts, z > 0, and z < 0. ! Dashed contours will be at levels 'ilevlt' through 'ilevlt+nlevlt'. ! Solid contours will be at levels 'ilevgt' through 'ilevgt+nlevgt'. ! ! Since the array clevel is ordered, we can find the level ! where the values become positive by counting the non-positive ! elements ilevlt = 1 nlevlt = count( clevel(1:nlevel) <= 0.0_plflt ) ilevgt = ilevlt + nlevlt nlevgt = nlevel - nlevlt ! Advance graphics frame and get ready to plot. ncollin = 11 ncolbox = 1 ncollab = 2 call pladv(0) call plcol0(ncolbox) ! Scale window to user coordinates. ! Make a bit larger so the boundary doesn't get clipped. eps = 0.05_plflt xpmin = xmin - abs(xmin)*eps xpmax = xmax + abs(xmax)*eps ypmin = ymin - abs(ymin)*eps ypmax = ymax + abs(ymax)*eps call plvpas(0.1_plflt, 0.9_plflt, 0.1_plflt, 0.9_plflt, 1.0_plflt ) call plwind(xpmin, xpmax, ypmin, ypmax) xopt = ' ' yopt = ' ' xtick = 0._plflt nxsub = 0 ytick = 0._plflt nysub = 0 call plbox(xopt, xtick, nxsub, yopt, ytick, nysub) ! Call plotter once for z < 0 (dashed), once for z > 0 (solid lines). call plcol0(ncollin) if (nlevlt > 0) then call pllsty(2) call plcont(ztmp, kx, lx, ky, ly+1, & clevel(ilevlt:nlevlt), xg, yg) endif if (nlevgt > 0) then call pllsty(1) call plcont(ztmp, kx, lx, ky, ly+1, & clevel(ilevgt:ilevgt-1+nlevgt), xg, yg) endif ! Draw boundary. delta = TWOPI/(NPLT-1) xtm = x0 + rmax * cos(delta*arange(0,NPLT)) ytm = y0 + rmax * sin(delta*arange(0,NPLT)) call plcol0(ncolbox) call plline(xtm, ytm) call plcol0(ncollab) call pllab('', '', 'Shielded potential of charges in a conducting sphere') end subroutine potential end program x09f95 plplot-5.10.0+dfsg/examples/f95/x07f.f90 644 1750 1750 542411670047643 162720ustar andrewandrew! $Id: x07f.f90 12098 2011-12-08 05:48:19Z arjenmarkus $ ! Displays the plotter symbols for PLSYM ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x07f95 use plplot implicit none character (len=4) :: text integer :: i, j, k, l integer, dimension(20) :: base = & (/ 0, 100, 0, 100, 200, 500, 600, 700, 800, 900, & 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900 /) real(kind=plflt), dimension(1:1) :: x, y ! Process command-line arguments call plparseopts(PL_PARSE_FULL) ! Full sized page for display call plinit() call plfontld(0) do l=1,20 if (l==3) call plfontld(1) call pladv(0) call plcol0(2) ! Set up viewport and window call plvpor(0.15_plflt, 0.95_plflt, 0.1_plflt, 0.9_plflt) call plwind(0.0_plflt, 1.0_plflt, 0.0_plflt, 1.0_plflt) ! Draw the grid using plbox call plbox('bcg', 0.1_plflt, 0,'bcg', 0.1_plflt, 0) call plcol0(15) ! Write the digits below the frame do i=0,9 write (text,'(i1)') i call plmtex('b', 1.5_plflt, (0.1_plflt*i+0.05_plflt), & 0.5_plflt, text) enddo k=0 do i=0,9 ! Write the digits to the left of the frame write (text,'(i0)') base(l)+10*i call plmtex('lv', 1.0_plflt, (0.95_plflt-0.1_plflt*i), & 1.0_plflt, text) do j=0,9 x=0.1_plflt*j+0.05_plflt y=0.95_plflt-0.1_plflt*i ! Display the symbols call plsym(x,y,base(l)+k) k=k+1 enddo enddo if (l<=2) then call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & 'PLplot Example 7 - PLSYM symbols (compact)') else call plmtex('t', 1.5_plflt, 0.5_plflt, 0.5_plflt, & 'PLplot Example 7 - PLSYM symbols (extended)') endif enddo call plend end program x07f95 plplot-5.10.0+dfsg/examples/f95/x11f.f90 644 1750 1750 1254011702031245 162650ustar andrewandrew! $Id: x11f.f90 12124 2012-01-07 11:55:17Z arjenmarkus $ ! Mesh plot demo ! ! Copyright (C) 2004 Alan W. Irwin ! ! This file is part of PLplot. ! ! PLplot is free software; you can redistribute it and/or modify ! it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! PLplot is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Library General Public License for more details. ! ! You should have received a copy of the GNU Library General Public ! License along with PLplot; if not, write to the Free Software ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA program x11f95 use plplot, PI => PL_PI use plf95demolib implicit none integer, parameter :: xpts=35, ypts=46 integer :: i, j, k, ifshade real(kind=plflt) :: x(xpts), y(ypts), z(xpts,ypts), xx, yy character(len=80) :: title(2) = & (/ '#frPLplot Example 11 - Alt=33, Az=24, Opt=3 ', & '#frPLplot Example 11 - Alt=17, Az=115, Opt=3' /) real(kind=plflt) :: alt(2) = (/ 33.0_plflt, 17.0_plflt/) real(kind=plflt) :: az(2) = (/ 24.0_plflt, 115.0_plflt/) integer :: opt(2) = (/ 3, 3 /) integer, parameter :: nlevel = 10 real(kind=plflt) :: zmin, zmax, step, clevel(nlevel) ! Process command-line arguments call plparseopts(PL_PARSE_FULL) x = 3._plflt * (arange(0,xpts) - (xpts/2)) / dble(xpts/2) y = 3._plflt * (arange(0,ypts) - (ypts/2)) / dble(ypts/2) do i=1,xpts xx = x(i) do j=1,ypts yy = y(j) z(i,j) = 3._plflt * (1._plflt-xx)*(1._plflt-xx) * & exp(-(xx**2) - (yy+1._plflt)*(yy+1._plflt)) - & 10._plflt * (xx/5._plflt - xx**3 - yy**5) * exp(-xx**2-yy**2) - & 1._plflt/3._plflt * exp(-(xx+1._plflt)*(xx+1._plflt) - (yy**2)) enddo enddo if (.false.) then ! Jungfraujoch/Interlaken z = max(z, -1._plflt) endif zmin = minval(z) zmax = maxval(z) step = (zmax-zmin)/(nlevel+1) clevel = zmin + step * arange(1,nlevel+1) call plinit() call cmap1_init(0) do k=1,2 do ifshade = 0, 3 call pladv(0) call plcol0(1) call plvpor(0.0_plflt, 1.0_plflt, 0.0_plflt, 0.9_plflt ) call plwind(-1.0_plflt, 1.0_plflt, -1.0_plflt, 1.5_plflt ) call plw3d(1.0_plflt, 1.0_plflt, 1.2_plflt, -3.0_plflt, & 3.0_plflt, -3.0_plflt, 3.0_plflt, zmin, zmax, alt(k),az(k)) call plbox3('bnstu', 'x axis', 0.0_plflt, 0, & 'bnstu', 'y axis', 0.0_plflt, 0, & 'bcdmnstuv', 'z axis', 0.0_plflt, 0) call plcol0(2) select case (ifshade) case (0) ! wireframe plot call plmesh(x(:xpts), y(:ypts), z(:xpts,:ypts), opt(k)) case (1) ! magnitude colored wireframe plot call plmesh(x(:xpts), y(:ypts), z(:xpts,:ypts), ior(opt(k), MAG_COLOR)) case (2) ! magnitude colored wireframe plot with sides call plot3d(x(:xpts), y(:ypts), z(:xpts,:ypts), & ior(opt(k), MAG_COLOR), .true.) case (3) ! magnitude colored wireframe plot with base contour call plmeshc(x(:xpts), y(:ypts), z(:xpts,:ypts), & ior(opt(k), ior(MAG_COLOR, BASE_CONT)), clevel) case default stop 'x11f: bad logic' end select call plcol0(3) call plmtex('t', 1.0_plflt, 0.5_plflt, 0.5_plflt, title(k)) enddo enddo call plend contains !---------------------------------------------------------------------------- subroutine cmap1_init(gray) ! For gray.eq.1, basic grayscale variation from half-dark ! to light. Otherwise, hue variations around the front of the ! colour wheel from blue to green to red with constant lightness ! and saturation. integer gray real(kind=plflt) i(0:1), h(0:1), l(0:1), s(0:1) ! left boundary i(0) = 0._plflt ! right boundary i(1) = 1._plflt if (gray == 1) then ! hue -- low: red (arbitrary if s=0) h(0) = 0.0_plflt ! hue -- high: red (arbitrary if s=0) h(1) = 0.0_plflt ! lightness -- low: half-dark l(0) = 0.5_plflt ! lightness -- high: light l(1) = 1.0_plflt ! minimum saturation s(0) = 0.0_plflt ! minimum saturation s(1) = 0.0_plflt else ! This combination of hues ranges from blue to cyan to green to yellow ! to red (front of colour wheel) with constant lightness = 0.6 ! and saturation = 0.8. ! hue -- low: blue h(0) = 240._plflt ! hue -- high: red h(1) = 0.0_plflt ! lightness -- low: l(0) = 0.6_plflt ! lightness -- high: l(1) = 0.6_plflt ! saturation s(0) = 0.8_plflt ! minimum saturation s(1) = 0.8_plflt endif call plscmap1n(256) call plscmap1l(.false., i, h, l, s) end subroutine cmap1_init end program x11f95 plplot-5.10.0+dfsg/data/ 775 1750 1750 012406243570 135665ustar andrewandrewplplot-5.10.0+dfsg/data/cglobe.shx 644 1750 1750 721412041320047 156150ustar andrewandrew' FfQeUf@T@28n88 8 "8^H^h@`fX@`j8888Z8!8$8(8+J8.818488:8;v8>8A8E*xEFGHpHIJJ8KZM>HMNFNXONhOQ~RXRvXR8SSXSUXW.`WPW8X"hXHXXY6@Yz0Y(Y(Z0Z:(Zf0Z(Z0Z`[^p[p\FP\H\`]JH]_J`X`j8cd2pdPdefh8i iPj:Hjk*8kfl"Xl~@lXmHmjno"pq(q@q0r.8rj0rHrPs>XsXsxtrtu8x{@}(}28}n888"8^8888N8888&8b8888R888Xbx> ϦК.8HZ@ԞPv0ժ(H"Hn"׶RٲFpݺ8("0VX޲@("Pv@ߺ@8@Pf@XpXHjhj8*P~@0("HnH`HjPH @NRnhvJH@^0(((HbH`@V88X.PV80pH  8 6@ zh  @ P *p @ @ &x6P>(8*@n@8V`FpZ&(RxX *0 ^( 8 8!X!^@!P!8"2"@# `#nX#`$.@$r8$H$@%>(%jX%&Z8)P+,-:.0/J012487N@78^P8p9&;2(<^= ??AvBDE0FHjHI`J>JHKhKL.N8NNO O P8PQ0Q(RS TVW8YYZ[\.0]bH]8`haVc"pdfghBijkhk@l6lm0n(nPo:q.0qb8tHu8y&Xyz|~rHJj&8xfxJhX`vX8p Z8X8PnXbF H&:Vjvx~@^`   8Fh²8z60jʂ`̮ͪ^(Ί&8bPҶx2֪ rHZ@ܞpޮ߲nPfb(BP(plplot-5.10.0+dfsg/data/cmap1_lowfreq.pal 644 1750 1750 15111571523062 170560ustar andrewandrewv2 hls 4 0. 240. 0.5 1.0 1. 0 0.499 240. 0.5 0.0 1. 0 0.501 60. 0.5 0.0 1. 0 1. 60. 0.5 1.0 1. 0 plplot-5.10.0+dfsg/data/globe.shp 644 1750 1750 44117412041320047 155110ustar andrewandrew' !>fQeUf@T@8fQeUXPRdfQT@fQUe U@eQ+UdQ;U`dQ[UcQ[UcQeU@bQUU`bQ5Ub U0cU cT@cT@cT@cTPc`T cQKTb@TPbQ;T0bQ+TbQTbTcQS`cScQScSQcQSPcSPcQSQcQScQuSRc`SQcQKSc@S@cQKS cQeSbQuSbQkS@bPS@b0SRIbQSQVbQRbQRaQRQaRaQRRIaRQaR`R`R`RRY`QRQ6`R`S_Sp= ׳_QRp= ד_QR`_QR _QRp= ^QuR= ףp^PRp= ד^PRp= S^pR^R^QeRp= ד]QkR= ףp-]QkRp= ]QuR= ףpm]QR= ףpm]QRp= ]QR= ףpm\Rp= \R \R= ףp-\R\QkR[R[Rp= ד[R= ףp-[QR [QR`[R`[Rp= [R[QR [QRZQRZQR ZQR ZQR= ףpYQRp= SYRYRXRp= SYQR= ףp-YR`YpR`Y`RYQeR8YpRףp= WLOdYQeRXQ[RYQERp= SYPRY0Rp= SYQ+R`Y@RQXQ;RXQURXQER`XQ[R`XpRQXpRXQ[RXQER`XQ;RX RQXQ R@YQQQXQQXR@XQQQWQRQWQRWQ%RW0RVQ;R0VQ;RUQ;R`UQERQUQ;RTQ5RPTQ;RS@RSPRQSQ5RSQR SQ%RRQ5RR@RR`R@RQ[RQQURQQKR QQERPQ5RPQRPQQPQPQQQQQ QQ QQ[QQPQ[QQPQEQQPQ5QQP QQPQQPPPQP QPPQPQUQQPQ+QQPQPQPQPQPPPQPQPQPQP`PQPQuPP@PQ{PP`PPQEPOQKPףp= WO0Pףp= NQ+PNPNPףp= MQOQkMQOMQOףp= LOףp= WLQOQLQOףp= MQOLQOQLQPףp= MQPףp= WMPM Pףp= MQP@NQ+PQN@POQ[Pףp= OpPQ+OQPףp= WOPOPPP8QPQSRQ)@PdPPףp= OQPQ+PQPQUPQP`PQPQ5PQQQUPQQQ5P0Qףp= O0Qףp= WOQEQQ+OQkQOQQNQQףp= NQQNQQQkNQQףp= NRQkNQRNQ+RQM@Rףp= NQURNQ[RNpRףp= WNQRףp= NQRףp= NQROQROQRףp= OQS`P SQP@S@PQKS@OQESNQESףp= LPSLQeSףp= JQ{Sףp= ISQHSףp= GSFQSDQS@CSQ+BQSAQuSQ@`SGz?QKS>Q5Sףp= W< S;QS:QR8QRGz7Rףp= W6QRGz4QRףp= W3pRGz1Q[Rףp= W0QERףp= W-Q;R+Q5RGz(Q%RGz&Rףp= W&QQ(QQףp= W(QQ'Q&QQ%Q#Q"QQףp= W!QQ!QQ\(\QQGzQQ\(\QQGzQQ\(\Q\(\Q\(\QQQQQQQQQ QQQzGQQQQQ(\QQHzG?Q\(\@QQ @QQp= ף@QQRQ@QQRQ@QQRQ!@QQ$@QQ)\&@QQRQ)@QQ8RQ)@QQY@QuPdRQ)@QQ)\,@QQRQ/@QQ1@QQGzT2@QQ4@QQ5@QQ7@QQQ8@QQGzT9@QQ;@QQGzT<@Q{Q>@QuQGzT?@QeQ@@`Q@@`Q ףp=@@@Q@@Q+Q ףp=*A@Q%QA@Q;QB@QUQB@`Q ףp=*C@QeQ(\UC@QQ ףp=C@QkQ ףp=C@`Q ףp=C@QKQD@Q5Q ףp=D@ QE@Q Q ףp=E@QP@F@PG@PG@QP(\H@QP@H@QP ףp=H@QP ףp=H@QP@I@QP(\I@P@I@PI@P(\J@Q{P(\J@QuP(\•K@Q{PL@P(\•L@QP(\•L@QP ףp=*L@PL@QPM@PM@QP ףp=M@P(\UN@QP(\N@QP(\UO@QP(\O@P@P@QPGzP@P{GP@QP{G*Q@QP`Q@QP`Q@Q QQ@Q%QQ@@Q`Q@QKQGztQ@QeQGztQ@QQ{GQ@Q{GQ@QQQ@QQGzR@pQ`R@QeQR@QkQR@QuQ{G S@`Q{GJS@QKQS@QEQGzS@ QS@Q T@Q{GjT@QPT@QP{GT@QP@U@PGzU@QP{GU@QP V@P{GjV@PV@QPW@P@W@QPW@QPW@PX@QP@X@P{GjX@QPX@PGzX@QPY@QP8Y@QUS`e@pPdY@QP,Y@QP`Y@QP̬Y@QuPZ@Q{P@Z@QPZ@PZ@P[@QP@[@QP`[@QP33333[@QP̬[@QP̬[@QP[@Q{P,\@QuPl\@pP\@P\@QP ]@Pl]@P]@QP33333^@QP`^@QP^@QP33333^@P33333_@P333333_@P33333s_@QP_@P_@P_@P `@QP `@P0`@QP@`@QP@`@QPY`@QP`@QP`@QP`@QP`@QP a@QP)a@QPIa@Pia@QPa@QPa@Pa@Pa@QP b@P b@P b@QP@b@PYb@QP`b@Qb@QQb@Qb@ Qb@QQb@Q+Qfffffc@Q%QIc@Q%Q`c@QEQc@QUQc@@Qc@QEQfffffc@PQd@`Q d@QkQ d@QQfffff&d@Qfffff6d@QQfffffFd@QQId@QQid@QQffffffd@QQfffffd@QQd@Qd@QQfffffe@QQ@e@QfffffFe@QQ`e@QfffffFe@RPe@ Rfffff6e@Q5Re@QKRd@PRd@QkRfffffd@QRd@QRd@Rd@QR`d@QRfffffVd@QRfffffVd@QS`d@ Sid@Q;Sfffffvd@QUSd@QTf@QUSfffffvd@QUSfffffvd@pSfffffd@Sd@QSd@S0d@Sd@QSd@QSd@T d@ T d@@T d@`TId@Q{Td@QTd@QTe@Tpe@Tf@Tf@QTHd@QkSfffff6e@QESd@QeSfffffe@QkSfffff6e@Q[Sfffffe@QUSfffffd@QESd@QeShdTdS dS`dQSQvdQSQvdQSQ6dTdQSdSQdQSQ6dSdS @Qb0SQfbQ SQbQ%Sb0SQfbQSQbQ SQbQ%S  SQ+RQQQ5QQ SQQ SQQSQQRQQQRQ RQURR@RQ%RQQ+RQQ%RQ5QQR QQQQQQ QQQ5QQQUQQQkQQ[QQQQ5QQQQ;QQQQEQQQeQQQQQQQQQQQQQQQ@RQQRQQQ SQQ `Q SQQQkRpQ Q SQQRQQRQpRQQkRQ{QRpQRQQRQQ SQQ XQPQ5POPQPQ+POQ5POQ%POQP@OPOQ%POPQPQ+P @@LOKO@LOLOKףp= OQKO@LO`N`Oףp= LO Nףp= WOQ+N`OQMQ+Oףp= WM Oףp= LOQkMOQMQ+OQ+N@ONףp= WO8Q+G{GZNFQ+NQ+GRQNF{GZNGQ+NQ+GRQN8QUTףp= DQQdQT T(\տ TzGQ;T0TzG0Tq= ףpQ;TQQ%TQ TQTQSQSQTQ QT Q5TQQUTQUTGzQKTGzQ5TGzQKTQ5TQTT\(\QSS\(\Sףp= W QSףp= W!Sףp= W"QSףp= W#QSףp= W$QkSGz%`SGz&QKSGz'@Sףp= W(Q+S) S*Q Sףp= W+Sףp= W,QRףp= W-R.QRGz.R/RGz/`R@0Q5Rףp= 0 RGz0R1Q@1QQGz1QQףp= 1QQ@2QQ2Qףp= W3QQ4QQ4QQ5QQ5QQ6Q6Q7Q7Q8QQ8Q9QGzn9Q9QQףp= W:QQ;QQ;QQ<Q<Q=QQףp= W=Q>QQ@>QQ>QQףp= W?Qףp= ?Qףp= @QQ@@QQףp= @QQףp= @QQAQQ@AQ RA RAQ+RBQ5R@BQERףp= WBQERףp= B`Rףp= BQkRBQ[Rףp= CQ[RQKCQURCPRCQkRDQkRQKDQuRDpRףp= D8QRQJQkPףp= DdpRףp= DQeRDQKRQD@RD Rףp= D0RE Rףp= E0RQ+E0RE@Rףp= EQ5REQKRףp= F@Rףp= 7FQ[Rףp= WFQURFQeRFQkRףp= FQuRFQeRףp= WFQkRףp= 7F`Rףp= FQuRQERףp= FRQKFQRFRFQRQFRQFRףp= FRףp= GRQKGRףp= wGRףp= WGRQkGRQkGQRףp= GRQGRQ+HQRGQRQGQRףp= HQRQKHQRףp= HQRףp= HRQHRףp= HQRףp= IQR`IRIQRףp= 7IR`IQRףp= WIRףp= IQRQIRQIQRIQRIQRQIRIR JRףp= 7JQRףp= JRQKJ`Rףp= WJ`Rףp= wJQKRףp= J Rףp= JRףp= JQ`JQQQkJQQףp= JRףp= JRףp= JQQJQQJQQJQ`JQ@JQeQ@J`Q J@Q JQQQ+JQ5QQI@Qףp= IQKQI@Q@I Qףp= IQPIQPHPHPףp= WHQPQ+HQuPHQkPGpPףp= GPףp= GPQkGQP@GPGQPF8QPFףp= D4dQPFQPFQPFQePFQePףp= WFQKP@FQKPFPPףp= E@PQEQPE@PQkE P@EQ PQkEףp= OQkEQOQKEOQ E PQ+E@PQ E@PDQKPDQ5P`DQPDQOףp= DOףp= DQ+Oףp= wD OQKDףp= 7OQ+Dףp= OQCOCQ+Oףp= C O`COCNC@Nףp= wCNQkCQM`Cףp= WMQKCףp= Mףp= 7CQLףp= Cףp= LBLQBףp= WLQkB`LQ+Bףp= L Bףp= LQAףp= LQALAQ+Mףp= WA@MQ+AQ+MAQLףp= 7Aףp= Lףp= 7AQkLףp= WA LQkAףp= K`AKQkA@K`AK@AQJףp= AJQ@J@QKJ@ףp= 7J@@Jףp= @Iףp= ?I?ףp= WI?Q+I>ףp= I>QH=ףp= H=HGz<`H@dUR/@U/@URQ/@QU)\/@Q V)\(/@Q%V)\/@@V0@ VGzT0@V1@V1@Q VGzT2@QUQ1@QUQk2@QU3@U3@QU4@U4@QUQ4@QUGzT5@QU5@QU5@VGz5@ V5@@VGzT5@`V@5@VQ+5@QV5@QVQk4@V4@QVQ3@QV@3@VGz3@QVGz2@VGz2@QVQk2@QVGz2@QWQ2@@WQk2@QeWGzT2@QWQ+2@WQ+2@QW2@QWQ2@QWGz2@Q X@3@QXQ3@Q+XQ+4@@X4@PXGz4@Q[X@5@PXGz5@pXQ5@Q{XQk6@pXGz6@pXGzT7@pXGz7@pXGzT8@QeXGz8@Q[XGzT9@QKX9@PXQ+:@PXQ:@Q[XQ+;@QUXQ;@@X<@ XGzT<@XQ<@W<@QW=@QW@=@QWQ=@WGz=@WQk=@WQ=@QuW=@PWGz=@0WQ=@WGz=@QVGz=@QV=@VQ+=@VGz=@QVQ+=@QuVGzT=@`V@=@PV=@QEVQ+=@QeV=@QeVQ=@QUVGz=@PVGz>@QkVGz>@QV>@QVGz>@QV>@QkV@>@QKV>@0V>@VQk>@VQ>@8VGz9@Q(\µD@dVQ>@QUGzT>@QUGzT>@QUQk>@QU>@U@>@`UGz>@QUUQ=@Q5U=@QU>@QTGz>@T=@QTQ+=@QTGz=@QTGz<@TQ+<@TGz;@QTQ;@QTQk;@TGz;@QT:@Q{TGzT:@QkTGz9@PT9@QETGz9@Q+TQ+9@QTGzT9@Q TGz9@QTQk:@QT;@QTGz;@Q%TQ+<@Q%T<@Q;T=@QET=@QUT>@Q[T>@`T?@PT?@@T@@ T(\5@@T(\U@@S@@QS ףp=@@QS(\@@QS(\@@SA@QeS ףp=*A@QKS(\UA@Q%S`A@QSA@Q5SA@QS ףp=A@S ףp=A@QR ףp=A@QR(\A@S(\A@0S(\A@QS ףp= B@S(\B@R ףp= B@RA@R ףp= B@QR@B@S ףp=jB@QS(\•B@QSB@QS(\B@Q;S C@QS(\C@ S@C@Q%SC@QS ףp=C@SC@Q S(\•C@Q S ףp=jC@QS(\5C@QR C@SC@QRC@QR(\B@S(\•B@RB@QRB@R(\C@R(\5C@QRC@QRC@R ףp=C@RC@R ףp=C@QR ףp=C@R ףp=*D@QR@D@R ףp=jD@`R ףp=D@@RD@ RD@RD@Q(\µD@8Q(\µD@ףp= WM(\•I@dQ(\µD@QQD@QQD@QQ(\D@QQD@Q(\D@QE@QD@QD@QQ(\E@Q ףp=*E@Q ףp=JE@QQ ףp=jE@QQ(\•E@QE@Q(\E@pQ ףp=E@QKQF@Q5Q(\5F@Q%Q F@Q(\5F@P ףp=JF@P ףp=jF@P(\•F@P(\•F@QeP ףp=F@Q5P(\F@Q;P ףp=F@P(\µF@Q;P ףp=F@QUP(\uF@Q{P ףp=JF@QP(\F@PE@`PE@@P ףp=E@ P(\F@Q P@F@ףp= O@F@O`F@OF@ףp= N(\•F@NF@ףp= 7N(\F@QMG@@N ףp=*G@ףp= 7N ףp=jG@ףp= WNG@N ףp=JG@N(\G@NF@O ףp=F@QKO(\F@OF@P ףp= G@Q%P G@Q;P`G@@P ףp=G@Q5PG@QkP ףp=G@QP ףp= H@QUP ףp= H@Q5P H@P@H@P ףp=jH@Q%P ףp=H@PPH@P(\•H@P ףp=H@QP ףp=jH@Q(\UH@Q+Q(\5H@PQ ףp= H@QkQ(\G@QQ ףp=G@QG@QQ ףp=jG@Q(\•G@QQG@Q ףp=G@QkQ(\H@PQ ףp=JH@Q+Q(\uH@Q ףp=H@QP ףp=H@QPH@P ףp= I@P I@Q[P I@0P I@P ףp=*I@ףp= O I@QkO I@ףp= O I@ףp= N ףp= I@ףp= wN(\I@N(\I@M@I@QM ףp=jI@ףp= WM(\•I@8@VI@ףp= K@O@dףp= WM(\•I@QL(\µI@QkLI@ףp= L ףp=I@ףp= K ףp= J@L`J@QK(\•J@@L(\J@L(\J@QL ףp= K@Q+M(\K@L@K@M`K@ףp= wM ףp=jK@M(\•K@Q+NK@@N(\K@QN(\K@N L@N`L@QN ףp=L@QN ףp=L@QN(\L@Q+OM@QkO@M@OM@QOM@QPN@Q+P ףp=*N@QKPN@QePM@PP(\µM@QkPM@QP`M@P(\5M@P(\M@QQ`M@@Q ףp=jM@`QM@`Q ףp=M@Q[Q ףp= N@QkQ@N@`Q(\uN@QN@QN@QN@Q ףp=N@R ףp=N@Q;R(\O@QkR(\5O@QR O@R O@QS(\5O@Q[S@O@QS O@QS ףp=N@`S ףp=N@pS(\•N@QS`N@QeS@N@Q[SN@Q[S ףp=M@Q{S(\•M@QS ףp=M@QS`M@QS(\5M@`S M@QKS(\L@@SL@0S(\UL@0SL@PS ףp=K@S(\•K@S ףp=jK@S ףp=JK@QS(\K@QSJ@QS(\•J@QS(\UJ@QS(\J@S(\I@QS ףp=I@SI@QT ףp=I@0TI@PT ףp= J@QkT@J@QT(\uJ@QT(\µJ@QT ףp=J@QT K@QTK@TK@UK@@UK@U(\K@QU ףp=K@UL@QV(\5L@@V`L@8p= sY`L@QKT{GR@d@V`L@V(\uL@VL@V ףp=L@QW(\uL@QWL@Q+W(\L@Q+W ףp= M@QEW(\UM@pW`M@QW(\UM@W ףp=M@W ףp=M@QW(\N@QW ףp=JN@QWN@QkWN@QKW(\N@ W ףp= O@ W ףp=JO@QV`O@QV(\uO@QV(\µO@VP@ VP@U P@U@P@U`P@U{GP@UP@`UGzP@QEUGzP@T{GP@QTGzP@Q[TP@QKTGzP@QTGzP@QTGzQ@QUTGz$Q@QUTLQ@TGzTQ@QT{GjQ@UGztQ@`UGztQ@`UGzTQ@Q[U0Q@Q[U{G Q@UGzP@U{GP@UP@Q VGzP@VGzQ@V0Q@Q;VPQ@Q{VGz$Q@QVGzDQ@QV`Q@QWpQ@QV{GQ@QV{GQ@Q+WQ@`W{GQ@QW{GQ@`WR@WGz$R@QEW0R@QV0R@QV{GJR@QVGzdR@QVGztR@QVzGR@QKW{GR@QWR@QWGzdR@W{GJR@W{G*R@WR@WQ@QWQ@X= ףpQ@0X{GQ@QWGztQ@W{GZQ@QW@Q@W Q@QWQ@WQP@QWP@Q5XGzP@Q;XQQ@QW0Q@QXGzTQ@Q{XGztQ@QXGzTQ@QX@Q@XGz$Q@QXQ@X{GP@YGzP@p= sYP@8Rd ףp=N@p= sYGzQ@dp= sYP@YRQ@ףp= 'ZfffffQ@= ףpmZ9Q@ ףp=Z0Q@p= [Gz$Q@@[Q@p= ZQ@= ףp [GzP@p= S[P@p= ד[Q@ףp= [GzP@@\{GP@= ףp\GzP@p= \GzP@ףp= \{G Q@ףp= \33333Q@= ףp\= ףp-Q@]= ףp=Q@`]@Q@p= ׳]= ףpMQ@p= ^= ףp]Q@p= S^GztQ@^GztQ@^HzWQ@p= _{GZQ@ ףp=_Q@p= S_{GZQ@= ףp_GzdQ@= ףp_GzQ@`GzQ@`Q@Q-`GztQ@R9`Q@Qf`Q~Q@Q`{GjQ@R`QXQ@Q`GzdQ@Q``Q@Q`{GJQ@a0Q@R)a@Q@RIaGzTQ@paGzdQ@aHzgQ@RaGztQ@RaGzQ@bGzQ@Q#bQ@QFb= ףpQ@pb= ףpQ@b= ףpQ@RbQQ@bQQ@cHzQ@RIcHzQ@RYcQQ@RcGzQ@QcHzQ@cGzQ@Q d{GQ@Q3dGzQ@QVd{GzQ@`d\Q@pdGzDQ@Rd{G:Q@dGz4Q@QdGzQ@RdQP@d{GP@pd{GP@PdGzP@Q6d{GP@QFdGzP@QvdGzP@RydP@QdP@QdP@RdP@RdGzdP@Rd{GZP@RdGzTP@Qd@P@Rd{G*P@Qd P@QvdGz$P@QVd{GP@Q=d{G*P@ dGz4P@R)d{GP@QdP@ dO@RId(\µO@`dO@Q}dO@QdO@Rd(\UO@d(\O@dN@Rd ףp=N@8Rd ףp=*K@`N@dRd ףp=N@Qd ףp=JN@Rd ףp= N@Ryd(\M@`d(\M@QFd ףp= N@Q6dM@Q=d(\•M@Q3d`M@ d(\uM@Qc(\uM@Qc(\5M@Qc`M@c(\UM@Qc`M@c(\M@Qc ףp=L@RcL@c ףp=jL@Qc@L@dL@Q-d(\K@RId(\K@Q]dK@Q}dK@Qd ףp=JK@Qd ףp=*K@Qvd(\UK@RYdK@@d(\•K@Q-d(\µK@d ףp=K@Qc ףp=K@QcL@Qc(\5L@Qc(\UL@QcL@Qc(\µL@Qfc ףp=L@RIc(\M@R9c@M@R)c(\uM@QCc ףp=M@R9c(\µM@Q#c(\M@c ףp= N@Qc ףp=JN@Qb(\uN@QbN@QbN@Qb(\uN@Rb`N@Qb(\N@Qb(\M@QbM@Qb(\•M@QbM@Qb ףp=M@b(\M@Qb(\M@Qb(\5N@RbN@pb ףp=jN@QVb ףp=jN@@b ףp=JN@ b N@bN@aN@aN@QaM@Ra(\M@Qva(\M@pa(\µM@QVa(\•M@Q=a`M@R)a(\5M@a(\M@Qa(\L@`L@Q``L@Q`(\L@Q` ףp=jL@`(\µL@`(\L@Q` M@Q` M@`(\UM@Q` M@Q`(\L@`(\µL@`L@`L@Q` ףp=L@Q`L@`(\uL@R` ףp=L@R``L@Q` L@Q` ףp=*L@Q`(\K@8Q`?@p= ] L@dQ`(\K@Q` ףp=K@Q` ףp=K@` ףp=K@Q`(\UK@Q`K@Q` ףp=K@` L@` ףp= L@` ףp= L@Q`K@Qv` ףp=K@Ri`K@RY``K@QC`(\uK@QM`(\5K@QF`(\K@RY`(\J@RI`(\µJ@R9`(\•J@Q&` ףp=JJ@Q ` ףp=*J@Q` ףp=I@p= _I@p= _(\•I@_ ףp=jI@= ףp_(\UI@`_(\5I@ ףp=:_ ףp= I@p= _H@p= ^H@= ףp^H@= ףp^H@p= ׳^H@ ףp=^ ףp=JH@ףp= ^(\5H@= ףp^H@^G@ףp= ^(\G@^G@ףp= ^(\G@= ףp^(\H@p= ^(\H@= ףp-_(\5H@p= 3_(\H@ףp= '_(\G@p= _G@ףp= _G@_(\UG@ ףp=^ ףp=*G@= ףp^(\G@ ףp=^(\G@ ףp=^ ףp=F@p= ^(\µF@_F@_@F@ףp= _F@p= _(\µE@ _ ףp=jE@ ףp=_ ףp=*E@= ףp _E@_D@ףp= _D@p= _@D@p= _ D@_D@p= ^(\C@p= ^ ףp=C@= ףp^(\uC@p= ^ ףp=JC@ ףp=^ ףp=*C@^C@^(\B@^(\C@= ףp^ ףp= C@p= ד^(\B@ףp= ^B@^B@ ףp=^ ףp=B@= ףp^B@p= s^B@p= s^ ףp=JB@ ףp=z^ ףp=*B@ ףp=Z^B@ףp= G^ ףp=A@ףp= '^ ףp=A@ףp= '^ ףp=JA@p= ](\5A@p= ] A@p= ׳] ףp= A@ ףp=] ףp= A@p= ד]@@]@@`](\µ@@= ףpM]@@ףp= G]@@@= ףp-]@@ףp= ']Gz?@p= ]@?@p= ]?@8p= ]Gz0@X?@dp= ]?@]>@]GzT>@= ףp\@>@= ףp\Q=@= ףp\=@= ףp\Gz=@p= ד\<@\Qk<@\<@ ףp=\;@\Gz;@\;@p= ד\Q+;@\;@ףp= g\:@= ףpM\:@p= 3\Qk:@p= \Q+:@ףp= \Q9@ףp= \Q+9@p= \Gz8@= ףp[Gz8@p= [@8@p= ׳[Gz7@p= ד[7@[Gz6@ ףp=Z[GzT7@= ףpm[7@= ףp[@8@ףp= [@8@p= ׳[Q8@= ףp[Gz8@[Q+9@[9@p= [:@[:@\;@p= \;@= ףp-\Gz;@ ףp=:\GzT<@= ףpM\<@= ףpm\Q+=@\Gz=@ ףp=\Gz=@= ףp\Q+>@ףp= \Gz>@= ףp\?@p= ׳\Qk?@= ףp\?@= ףp\?@p= s\Gz?@`\GzT?@ףp= G\Q+?@ףp= G\>@p= 3\@>@= ףp-\Q=@ ףp=\=@= ףp \=@= ףp[<@= ףp[<@ףp= [Q;@ףp= [Qk;@[;@= ףpm[Q:@`[Q:@p= S[GzT:@ ףp=Z[:@ ףp=Z[9@@[9@p= [@9@[Q8@ףp= ZGzT8@= ףpZ8@p= ׳Z7@ ףp=ZQ+7@Z6@= ףpmZQk6@`Z5@= ףpMZ5@= ףpMZQ+5@`ZGz4@p= SZGz4@= ףpmZGzT4@p= SZGz3@ ףp=:ZGzT3@p= ZGz3@p= Y2@YGzT2@p= ׳YGz2@= ףpY2@Y2@ףp= gYQ1@@Y@1@ YGz1@YQ0@XQ0@XGz0@XGzT0@XGz0@XQKSQ+0@PXGz0@Q[X0@Q5X)\/@XRQ/@QWR/@QWQ+0@QWQ+0@WGz0@QuWR/@Q[WRQ/@QKWR.@0W.@QWRQ-@W)\,@V)\(,@VR+@VR+@VRQ+@pVR*@QUVR*@Q5VRQ*@QVRQ*@QURQ*@QUR*@QU*@QU*@QU)\()@U(@QU)\'@QU'@pURQ&@pU%@QuU)\$@QkUR#@QUU)\#@QKURQ#@Q5U$@Q%URQ#@U)\"@QT"@T!@TR @TRQ @T)\ @T @pT)\( @`T@@T@Q;Tp= ף@ T@T@QTRQ@ TRQ @QT)\ @S)\(!@S"@QS"@S!@S)\ @QS)\ @QS @QSp= ף@pS@Q[SRQ@`Sp= ף@Q[S@Q[S@QUS@`S@QKS\(\ @`S @pS\(\@QS\(\@QS\(\@QS?SQ?QS?QS?Tq= ףp?QTףp= G_Gz4P@= ףpm]GzP@ףp= G_GzP@ףp= ^QP@^P@@^P@^pP@p= ׳^GzdP@= ףp^@P@p= s^@P@ףp= g^GzTP@= ףp-^{GjP@ ^GzTP@@^Gz4P@p= ]HzWP@^GztP@ ףp=]{GjP@ףp= ]GzP@= ףpm]{GP@ףp= ]GzP@ ^{GP@p= ]{GP@ ףp=]{GP@^GzP@p= S^P@= ףp^GzP@p= ^HzP@ףp= G_GzP@ @] ףp=jN@@[ ףp=jO@@](\•N@] ףp=jN@p= \ ףp=jN@ ףp=\N@ ףp=z\(\uN@= ףpm\N@ ףp=:\(\µN@= ףp \ ףp=N@p= [ ףp= O@ ףp=[ ףp=*O@p= s[(\5O@= ףp[(\UO@@[(\UO@[ ףp=jO@= ףp[ ףp=jO@ףp= [(\UO@ ףp=[(\5O@ ףp=\ ףp= O@ףp= G\O@p= s\(\O@= ףp\(\5O@p= \(\5O@ףp= \(\O@\ ףp=N@p= \N@p= \(\µN@p= \(\•N@@](\•N@!p= [ ףp=JM@ ףp=Z(\M@ p= [(\UM@p= ד[ ףp=JM@[(\uM@p= S[ ףp=M@p= [ ףp=M@ ףp=ZM@[(\µM@ףp= '[(\µM@= ףpM[(\M@= ףpm[(\M@= ףp[M@= ףp[M@p= [(\UM@"pףp= Y ףp=*L@ףp= gY(\M@ ףp= Y ףp=*L@= ףpY ףp=JL@= ףpYL@= ףpY(\µL@ףp= gY(\L@ףp= Y(\M@YL@p= ׳Y(\µL@YL@p= ׳Y(\UL@ףp= Y ףp=*L@#X ףp=*I@Q XJ@X ףp=J@QXJ@QX@J@QX J@QX(\I@Q[X(\I@QUX(\µI@Q5X ףp=I@Q;X(\•I@@X`I@@X ףp=*I@QX@I@Q X(\•I@Q%X ףp=I@@X(\J@PX(\UJ@QeX(\•J@QuX(\J@QXJ@XJ@X ףp=J@$= ףpMY(\I@X ףp=J@= ףpMY ףp=J@p= 3Y ףp=JJ@ ףp=Y ףp=jJ@Y ףp=JJ@= ףp Y ףp=*J@= ףp Y ףp=I@QX ףp=I@X(\•I@X ףp=jI@QX@I@X(\I@X I@X(\UI@QX(\uI@QXI@QX(\I@QXI@QX ףp=I@QX(\J@QX(\5J@QX`J@= ףp Y ףp=J@= ףpMY ףp=J@%(QW(\5G@ UH@"QW(\UG@QV(\UG@QV(\uG@V@G@pV`G@@VG@V(\µG@U(\µG@QV ףp=G@QV`G@U ףp=jG@QU(\5G@QU(\5G@QuU(\UG@@U`G@@U@G@ U@G@0U(\uG@Q+U ףp=G@@U ףp=G@@U(\G@pU(\G@QU H@U`H@QU`H@QVH@QV(\UH@QEV(\5H@Q[V ףp= H@QuV ףp=G@V(\G@V ףp=G@QVG@QW(\UG@&V(\D@S G@7V ףp=JF@U(\uF@U@F@QU(\F@U ףp=E@QU(\•E@QU`E@QU(\E@U(\D@QU(\D@QU ףp=D@QU(\E@U`E@QUE@U(\E@U ףp= F@U@F@QU(\uF@QUU(\•F@@U(\F@ U(\F@QUF@QT ףp=F@QTF@QT(\5F@QT(\E@QT ףp=E@QT(\E@QT ףp= F@QT ףp=E@QT ףp=E@pT ףp=E@pT(\E@`T(\5F@QUT ףp=jF@`T(\•F@Q;T`F@QT@F@S ףp=jF@T(\µF@0T(\F@QkT ףp= G@QT(\G@T(\G@QT G@Q U G@U(\F@Q5U(\F@PUG@pU(\F@UF@UF@QU(\µF@QUF@V ףp=JF@'HQTF@pT(\F@QT ףp=F@QT(\F@Q{TF@pT(\F@QT ףp=F@QT ףp=F@(TD@QS ףp=jE@TD@QTD@TD@QkT ףp=D@QET ףp=D@ TE@QS E@S@E@QS ףp=jE@S ףp=jE@Q T ףp=jE@ T ףp=JE@Q;T(\UE@`T ףp=JE@QuT E@TE@QTE@TD@)S(\•E@QS ףp=*F@SE@S(\•E@QS ףp=E@S ףp=E@Q[SE@Q5S ףp=E@Q SE@SF@QS ףp=*F@Q+S(\F@@S(\E@QkSF@QS(\E@QS ףp=E@QS(\E@SE@*XVq= ףpQV{Gz?QV{Gz?VQۿQV(\V(\QVq= ףpQV迅QV(\տQV{Gz?+hQRףp= EQURQD RQDQRQ+EQRףp= WEQRQEpRףp= E`REQkRףp= WEQURQ+EQ[RERQD,QRףp= KQKPQKJ30QQKJQKQףp= WJ`QQKJpQQkJQQkJQQQJQQJQ[QQJQUQJQQJQ KQQףp= KQףp= JQףp= KQQKQRQJ RQJQURJRJQR`JRJRJ`RQJQuRQJQURQJQURQ KQ+RQ K Rףp= 7KRףp= 7KRףp= WKQQKQףp= KQKQuQQKQUQKQ+Qףp= KQףp= KQ QKQPKPKQkPKPPףp= wKQKPףp= WKQuPףp= WKQP@KP KQPKQףp= JQ QQJQJ0QQKJ-ףp= NQ+JLQIףp= NQI@N JNJףp= MQ JMQ+JQkM J@MJLQILIQ+MQIMIףp= MQI@Nףp= Iףp= NI@NJףp= NQI.XCףp= wKQAKCKB KQKB@KBףp= wKQAQKK BQ+KBQ KCK/XQN$@N%@QN$@N$@N$@N%@ףp= NRQ%@N)\(%@NRQ$@QN$@08)\HQp= #(@p= 3Q33333(@)\HQ33333(@p= 3Qp= #(@ ףp=:Qffffff(@)\HQ33333(@1QS1@S2@ QSQ+2@SQ+2@QkSGz1@PS1@Q;SQ1@Q%SGz1@SGz1@QSQ+2@Q5SGzT2@QUSQk2@QuS2@SGzT2@QSQ+2@2XQTQk5@T{G5@QT(\5@= ףpT5@p= TQx5@QTQk5@THz5@ ףp=TR5@QT{G5@QT(\5@3Q5UGz3@QRQ+7@9Q5UGz5@Q UGz5@UQ+6@QTQ+6@QTQk6@TQ6@TGz6@QeT6@QTGzT6@pTGz6@PT6@ T6@Q T5@SQ5@S5@SGz5@QSQk5@S5@SQ4@PSQ4@QESGzT4@Q[SGz4@QkSGz3@@SGz3@ SQ3@SQ3@RGz3@RGz3@QR4@QRGz4@R@4@R@4@QRGz4@QRQ4@QRGz4@QR5@SGz5@ SQ+5@@S5@Q[SQ5@QuSQ5@QSQ+6@QSGzT6@QSGzT6@QSQ6@QTGz6@ T7@@T7@`TQ+7@TQ+7@T7@TQ6@TGz6@UGz6@QUGzT6@QU6@Q5UGz5@4HRGz1@QQQ3@&RGzT2@QuR2@QkRQ+2@QKRQ+2@0RGz2@QRQ+2@QQGz2@QQGz1@QQ2@QQ@2@QQQk2@QQQ+2@QQ@2@`QQk2@@QQk2@Q+QGz2@QQ2@0QQ2@QeQGz3@QKQGzT3@pQGzT3@Q{QQ3@Q3@QGz3@QQGz3@RQ3@Q%RQ3@QKRQ3@`RQ3@@RQ3@0RGzT3@0R3@QRGz2@0RGzT2@PRGzT2@QkR2@QRGz2@RGzT2@5`QPQ1@QkP2@ QP2@PQ1@QP2@Q{P2@QkP@2@P2@QP2@QP2@QP2@6PQNR/@QNQk0@QN@0@NR/@QNQ+0@QNQ+0@NQk0@QNQ+0@QN@0@78ףp= N(\,@QkN)\-@ףp= N)\-@QkN(\,@GztNL-@ףp= N)\-@8hQSQ7@`SQ+9@ SQ+9@QSGz8@QSGz8@Q{SQ+8@QkSQ7@`S8@pSGzT8@pSQ8@SQ+9@SQ+9@9HQkRQ4@@RGzT5@QkRQ4@QKRQ4@@RGzT5@QKRGz5@`RQ+5@QkRQ4@:XSffffff:@p= sS33333:@S33333:@= ףpS:@(\SQ:@\(|SQ:@p= sSQx:@S:@Sffffff:@S33333:@;@QeSQ9@ףp= GSQ:@QeSQ:@ףp= GSQx:@p= SSQ9@PSQx:@QeSQ:@<0(\/SQ8@)\S9@(\/S9@)\SzG!9@)\SQ8@=(QRQ+8@p= RQ8@QRQ8@p= RQ+8@>(p= RQ6@QRQ7@p= RQ7@QRQ6@?0QR3333336@QuRGz6@QRGz6@QuRR6@= ףpR3333336@@()\HRGzT6@(\/RQk6@)\HRQk6@(\/RGzT6@A0GzRQ5@GzQfffff5@GzRQ5@ףp= Rfffff5@GzQQ5@B(QuŤ8@p= STQ8@QuŤ8@p= STQ8@C0S ףp=A@QR ףp=A@S ףp=A@QRA@QR ףp=A@D`R ףp=JD@R(\•D@ R ףp=JD@QUR(\UD@Q+R`D@RD@QR(\•D@Q5RD@QUR(\uD@Q{R ףp=jD@R ףp=JD@EpQP ףp=H@ףp= N ףp=H@ QP ףp=H@O ףp=H@O ףp=H@ףp= wO(\•H@ O ףp=H@ףp= N ףp=H@O(\µH@@O ףp=H@QOH@O ףp=H@QP ףp=H@FpP(\F@O(\uG@ P(\UG@ףp= O(\5G@QO(\G@@O(\F@@O G@O@G@`O(\5G@QO(\5G@ףp= O ףp=JG@P(\uG@P(\UG@GPQT(\O@Q{T`O@QT(\O@QT O@Q{T(\UO@Q{T`O@QT`O@QT ףp=JO@QT(\O@HHQ TN@S ףp=*O@QT ףp=*O@Q TN@SN@QS(\N@S ףp=*O@QT ףp=*O@I`QTK@QS ףp=JL@ T L@QS ףp=*L@QT(\K@S(\K@QS(\L@QSK@QS ףp=*L@QS ףp=JL@T L@JHT(\UJ@0T(\•J@TJ@Q[T ףp=jJ@0T(\UJ@@T ףp=J@Q[T(\•J@TJ@KQM(\UG@`J ףp=I@3QM(\G@ףp= MG@ףp= 7M(\G@QL ףp=G@QkL ףp=G@Q L ףp=G@ףp= KG@ףp= K(\•G@ףp= K(\uG@QK ףp=jG@QkK ףp=G@ףp= 7K(\µG@ףp= J ףp=G@ףp= K ףp=jG@ףp= J ףp=G@ףp= J(\UG@QJ(\UG@ףp= wJ(\•G@`J(\G@J ףp=G@J ףp= H@QJH@ףp= J ףp=G@ףp= JG@J ףp= H@J ףp=JH@J@H@K ףp=jH@JH@K(\µH@ףp= WK(\µH@QK ףp=H@ףp= K(\H@K(\H@Q L ףp= I@QkLH@@L I@ףp= L ףp=JI@K ףp=I@K ףp=I@L ףp=I@ףp= WL ףp=I@LI@L ףp=JI@ףp= L ףp= I@ףp= LH@ףp= 7MH@`M ףp=JH@ףp= 7M@H@ףp= wM(\H@QM(\G@LQU(\•O@TGzP@QU(\O@QuU(\O@pU(\•O@Q5UO@Q U(\O@QTP@QTP@TO@QKT(\µO@T ףp=O@PTGzP@pT P@TGz4P@QT{GJP@Q+UGzdP@@UGzP@U{GjP@UPP@QU{G*P@QUGzP@QU(\O@MXPS{GP@QRQ@PS{GP@Q5S{GP@QRP@RP@QR{GP@QRQ@ SQ@PS{GP@N8V(\N@ףp= NGztR@dVQ@@VGzQ@VGzQ@QU{GQ@pUGzQ@QUGzQ@QT{GzQ@QUTQ@QSGzdQ@SpQ@QSQ@`SGztQ@QRGzTQ@Q S{G*Q@R@Q@R Q@@R{G Q@Q+R{GP@QRP@@R{GP@pRP@QR{GP@QkR{GjP@QRGzTP@SGzTP@`S`P@QkS{GJP@SGzDP@QS{G*P@SP@ SP@R P@QR{GP@QkR{G P@0RP@QQO@QQ ףp=O@QQO@QQ ףp=jO@QUQ(\UO@@Q(\5O@QQ(\O@QPO@QP(\N@QP ףp=*O@QP(\UO@P ףp=O@ Q(\µO@Q;Q ףp=O@P ףp=O@QPO@pP(\uO@ P(\uO@P ףp=O@@PP@QEP P@pPGz4P@QPPP@QPpP@QP{GP@`P{GzP@@PGzTP@QO@P@O`P@Q+O{GjP@Q OGzP@ףp= N{GP@ףp= OP@ףp= OGzP@P{GP@QKPGzQ@PGzQ@QQ Q@QQ@Q@P{GJQ@QPGzdQ@PQ@QQQ@pQGzQ@Q{GQ@QR{GQ@RQ@RR@QRGz$R@R R@Q5S,R@QuS333333R@S= ףpR@Q T= ףpR@QKT{G R@Q5T{G*R@`TQHR@QKTGzdR@QkTGztR@QTpR@QU{GZR@`U@R@QeU R@QkUGzR@QUU{GQ@OV{GQ@UGztR@QUU{GQ@QUR@QU{GR@UGz4R@QUPR@`URaR@U33333sR@Q[UGztR@UGztR@VGzdR@QEV{GJR@QeV0R@VGzR@VQ@PpQ5TGz4R@QSGztR@ TpR@Q5T{GZR@ TQ>R@QSGz4R@QSQ>R@Q%SHz7R@QS{GJR@0SGzdR@QuSRqR@SGztR@ TpR@QPQ%X{GR@pW33333R@Q%XR@QWGzR@pW{GR@pWR@W33333R@QW33333R@Q%XR@RX{GR@QSRAS@Q XRAS@X{G*S@QWS@PWGzS@Q WGzS@QV{GR@Q WR@WR@VRR@Q V= ףpR@U{GR@0U{GR@QTR@QTR@QT{GR@QSGzR@QS= ףpR@QeT= ףpR@QT= ףpR@Q5UGzR@UGzR@0VR@QVQR@QkV{G S@VHzS@V)S@@W)S@QW{G:S@Q XRAS@SW{GS@Q{UPT@WT@QuW= ףpS@QKWGzS@QkWQS@QUWRS@W{GS@PV{GS@QVRS@US@Q{US@Q{UQS@QUS@QU{G T@V{GT@V T@QV333333T@WPT@QeWPT@pW333333T@WT@WT@TV{G S@ףp= NGzT@>V`T@V@T@V{G*T@`U{G*T@T333333T@Q+T333333T@QkS{G:T@QSQ(T@T= ףpT@QTT@QuU{GT@QUHzS@QKUS@QKUS@Q%UHzS@US@QU{GS@QeU{GzS@VGztS@V{GZS@UPS@Q VQHS@`VGz4S@`V{GS@UGzS@QKUS@U{GS@QTGzS@QeT S@@T{G S@S{GS@pSGz4S@SPS@QkSGzdS@S{GzS@QRS@RS@RS@RS@Q= ףpS@Q T@Q5QGz$T@PR@= ףp-_ R@= ףpM_GzR@d(d@(\UK@fffffd@K@d@K@fffffd@(\UK@e@e@`J@e@J@e@(\uJ@̜e@`J@e@ ףp=jJ@e@J@e@(\uJ@f0QFf ףp=I@R9f(\I@QFf(\I@R9fp= I@QCf ףp=I@g8Qf(\I@R f(\I@Qf(\I@R fI@Rf(\I@Qf(\I@h0Re ףp= J@Qe(\5J@Re ףp= J@Re(\J@Qe(\5J@iHQ&e`J@e ףp=J@Q&e`J@R e(\•J@e ףp=J@e ףp=J@eJ@Q&e`J@jPQd ףp=J@QdK@Qd ףp=J@dJ@QdJ@QdK@QdK@Qd(\J@Qd ףp=J@kXRye ףp=O@Re(\O@Rye(\O@Rye ףp=O@RYe(\µO@R9e ףp=O@Re ףp=O@R9e(\µO@Pe(\O@Rye(\O@lXQd ףp=M@d ףp=*N@Qd(\N@Rd(\M@Qd ףp=M@dN@d N@Qd ףp=*N@Qd N@Qd(\N@mxRYc`L@Qc(\5M@ RYcL@QCc`L@Q-cL@Q#c ףp=L@QcL@c ףp=L@ c(\L@Qc(\M@c(\5M@Q&c ףp= M@Q=cL@RYcL@nQ`J@``(\K@ Q`(\K@` ףp=J@` ףp=J@R` ףp=jJ@Ry`(\5J@``J@Ri`@J@Ry``J@Qv` ףp=J@` ףp=J@Qv` ףp= K@R` ףp= K@Q`(\K@oR ` ףp=*H@= ףp^ ףp=jI@R `(\UI@p= _(\I@ףp= _(\H@ ףp=_(\H@_(\µH@ ףp=z_H@`_H@@_H@@_`H@p= _@H@= ףp^ ףp=*H@= ףp^@H@= ףp^(\uH@ ףp=_ ףp=H@@_H@`_ I@= ףp_(\5I@= ףp_ ףp=JI@ ףp=_ ףp=jI@R `(\UI@p8@R ףp=M@6{GS@d@R{GS@QQHzwS@QQ{GzS@QGzdS@QQfffffVS@QPS@QQzGAS@Q333333S@0Qfffff&S@`QQS@ QQS@QP{GR@QUPQS@ףp= O{G S@ףp= N{G S@NGzR@Q+M{GR@Q+MGzR@L= ףpR@@LR@@LR@ףp= KGzdR@K{GJR@QKGz$R@QK{G R@KQQ@K{GQ@K{GQ@QJQ@`J{GQ@QIQ@IQ@QkJ33333Q@ KGzQ@QKKQ@QkK{GjQ@ףp= J33333SQ@ףp= J= ףp]Q@I{GzQ@`IGzTQ@IGz$Q@QKJGz$Q@QJ{G Q@ףp= JGzP@JP@JP@JP@ףp= 7J`P@J{G:P@JGzP@QIP@I ףp=O@Q+I ףp=jO@Q I@O@H(\N@H(\µN@H ףp=jN@ףp= WG`N@F ףp=JN@ףp= F(\N@ףp= E ףp=M@EN@QkE@N@`EN@@EN@EO@ףp= 7E(\UO@DO@`DO@@DP@ףp= 7D P@D{GJP@DGzDP@ףp= C`P@@C{GjP@B{GjP@ףp= AP@`AGzP@ףp= @{GP@ףp= @GzP@@P@ףp= @{GP@ףp= W?{G Q@>{G Q@<{GQ@;Gz$Q@@:Gz4Q@@9GzDQ@@8{GZQ@Gz.7pQ@6GzQ@7{GQ@ףp= 9{GQ@ףp= W:{GQ@ףp= W:{GQ@@9{GQ@9{GQ@8GzQ@@8Q@8GzQ@q@R{GQ@ףp= W'T@W8GzQ@ףp= 7{GQ@ףp= 5Q@5Q@5{GQ@ףp= 6GzQ@Gz7{G R@ףp= 8 R@ףp= W733333R@6GzR@5{GR@6{G:R@733333CR@Gz.6PR@ףp= 5{GZR@ףp= W4= ףp]R@ףp= W4GztR@5R@@3R@ףp= 2{GR@ףp= 4{GR@Gzn3R@Gzn3R@4 S@533333S@Gzn5{G*S@ףp= W4{G:S@Gzn20S@Gz.2GzDS@ףp= 2GzdS@Gz3{GzS@Gz.3{GS@3GzS@2QS@ףp= 2RS@Gz.1= ףpS@Gz/{GT@Gz,0T@ףp= W'GzTT@*QkT@Gzn033333sT@Gz.2Q^T@3GzdT@4GzTT@6GzDT@ףp= 8{G:T@Gz7HzWT@6QhT@ףp= W533333sT@Gz5GzT@Gz7RT@Gz7pT@ףp= W9QkT@ףp= W9GzT@ףp= =GzT@@<T@ףp= 9= ףpT@Gz.6GzT@4GzT@Gz5fffffT@8QT@ףp= 8T@ףp= W;33333T@?GzT@BT@C{GT@FT@@GGzT@QG{GT@@I= ףpT@IT@@KGzT@QMGzT@OpT@N{GZT@QNQHT@OQKT@@P{G:T@PR!T@QPGzT@@PGzT@ PS@QkPS@Q+QzGS@QQS@QRGzS@@R{GS@r@ףp= W8(\µO@ףp= W+P@%ףp= W8`P@ףp= 7{GZP@6GzdP@ףp= 6{GZP@ףp= 6GzDP@80P@ףp= 60P@6P@6 ףp=O@5 ףp=O@4 ףp=O@2(\µO@Gz1O@0 ףp=O@Gz/{G P@-{GP@ףp= W+{G:P@ףp= W+`P@ףp= W-pP@-GzP@ףp= W/P@@0P@ףp= 0{GP@ףp= 1P@@2{GP@@3GzP@Gz3GztP@@4GzP@ףp= W4GzdP@Gzn5{GZP@5P@@6GzP@7{GP@7{GP@Gz7{GP@7GztP@ףp= W8`P@s("GzQ@ {GQ@"GzQ@ {GQ@t8ףp= 2R@Gz1R@ףp= 2R@ףp= 2R@Gz133333R@ףp= 2R@u8!@`AGz<@d)\"@"@!@zG"@q= ףpRQ"@q= ףp#@)\#@)\$@QRQ%@q= ףp &@)\&@\(\)\('@R'@GzRQ(@\(\RQ(@)\(@R(@GzRQ)@R)@*@*@ףp= W R*@ףp= W!*@ףp= W"RQ*@ףp= ")\*@ףp= #)\(+@Gz$)\+@ףp= W%R+@&)\+@Gz'RQ+@(R*@ףp= W)*@ףp= )RQ)@Gz*)@ףp= +)\(@-RQ(@.)\((@/)\'@0)\'@0'@1'@Gzn1)\'@Gz1)\((@2R(@ףp= 2RQ)@@3R)@3*@@4R*@ףp= 4+@@5R+@Gz5)\,@ףp= 6-@6R,@Gz6-@7-@8)\(-@Gzn8)\-@9)\-@9R-@Gz9)\(.@Gzn:.@;)\.@;RQ/@ףp= ;R/@@GzT1@ףp= >Gz1@?Q1@Gzn?@2@@GzT2@QK@Gz2@Qk@Gz1@Qk@@2@ףp= @Qk2@Q@Qk2@ A2@Q AQ+3@ףp= 7AGz3@`AQ+4@`A4@@AGz5@ףp= 7A5@ףp= 7AGz6@ףp= AQ6@Q A@7@ףp= AQ7@A@8@ףp= A8@ AGz9@A9@A:@@Gz:@@Gz;@ףp= @;@Q@Gz<@@<@`@Gz<@ףp= 7@v8Gz<@ףp= 7@(\H@RQ @dGz<@ףp= 7@@=@@Gz=@Gz?>@ףp= W?Qk>@Gz>Q>@>Q>@>@?@ףp= =?@Gz.=@@ףp= <(\5@@ףp= < ףp=J@@ףp= <`@@;(\u@@;(\u@@ףp= :(\u@@@: ףp=J@@ףp= :(\u@@9(\µ@@ףp= W9@@Gz.9(\5A@Gz8(\uA@8A@8A@8(\µA@7A@ףp= 7A@6 ףp=A@ףp= 6(\•A@Gzn5A@ףp= 4(\UA@4`A@4(\•A@Gz3A@Gzn3 ףp=A@3 B@ףp= 2(\UB@ףp= W2B@Gz1 ףp=B@1 ףp=B@ףp= W1 C@Gz.1(\uC@ףp= 1C@0C@ףp= W0 ףp= D@0(\5D@Gz./(\UD@ףp= W.`D@ףp= W- ףp=JD@Gz., ףp=JD@Gz.+(\5D@*@D@ףp= (@D@((\5D@'@D@&@D@%(\D@ףp= W$ ףp=C@ףp= #(\C@ףp= "(\µC@Gz! ףp=C@ףp= W ףp=C@\(\ ףp=C@\(\(\•C@\(\`C@\(\(\uC@\(\ ףp=C@\(\ ףp=C@\(\ ףp=C@Gz(\C@Q D@ D@q= ףp(\UD@ ףp=D@QD@D@ ףp= E@(\(\5E@Qۿ(\uE@(\•E@zG? ףp=E@?F@?(\5F@Q? ףp=jF@? ףp=F@Q?F@@(\G@p= ף@@G@@(\uG@\(\ @G@@(\G@p= ף@(\G@RQ@(\H@RQ@@H@p= ף@(\uH@@ ףp=H@RQ@H@@H@@H@p= ף@(\H@RQ @w8 ףp=*@@RQ @(\•I@>@d(\H@RQ @(\I@!@(\5I@R!@`I@R"@`I@$@I@R$@ ףp=I@&@(\•I@'@ ףp=JI@R'@(\I@'@ ףp=H@)\&@H@RQ&@@H@&@H@)\(&@(\µG@)\(&@ ףp=jG@%@ ףp=*G@RQ%@F@%@F@%@`F@)\$@ F@R$@(\E@RQ%@ ףp=E@)\(&@E@R&@(\uE@RQ'@(\µE@R'@E@R(@ ףp=jE@)\)@(\5E@*@ ףp= E@RQ+@ ףp=D@)\(,@(\•D@)\(-@(\UD@-@ ףp= D@.@ ףp=C@/@C@)\(/@C@0@(\•C@0@ ףp=C@Gz1@ ףp=jC@Gz1@ ףp=JC@2@ ףp= C@Qk2@ ףp=B@Q2@ ףp=B@@3@B@Q3@(\•B@@4@B@4@B@Gz5@(\uB@5@(\uB@Gz6@ ףp=JB@@6@(\B@6@ ףp=A@6@ ףp=A@@7@A@Gz7@ ףp=A@8@A@GzT8@A@Gz8@`A@@9@@A@9@ ףp=*A@Q+:@A@Q:@(\@@Gz;@(\@@Qk;@ ףp=@@Gz;@@@Q+<@(\u@@Gz<@(\U@@=@ ףp=J@@Qk=@ ףp=*@@Gz=@ ףp=J@@>@`@@Gz=@@@Gz=@@@<@(\µ@@Qk<@@@Gz<@(\A@;@(\5A@Q;@(\5A@GzT<@(\UA@Q<@A@=@A@=@ ףp=jA@<@(\UA@<@(\•A@<@A@Gz;@A@Q+;@ ףp= B@Q:@(\5B@Q+:@`B@Gz9@ ףp=B@GzT9@B@Gz8@B@GzT8@C@Gz8@(\5C@7@`C@@7@C@6@ ףp=C@@6@C@Q5@ ףp=C@5@x8 ףp=C@RQ)@ ףp=M@@:@d ףp=C@5@(\•C@Q4@C@Gz4@(\C@@4@ ףp=*D@Gz4@`D@Q3@D@Q+3@D@Q2@D@Q+2@D@1@ ףp= E@1@(\5E@1@(\UE@0@`E@Gz0@(\UE@RQ/@`E@RQ.@(\uE@)\(-@ ףp=E@,@E@+@(\•E@*@E@)@(\E@RQ)@(\5F@)@(\uF@)\)@(\µF@*@(\F@)\*@ ףp= G@)\*@ ףp=JG@*@ ףp=G@)\*@(\µG@)\(+@ ףp=G@R+@ ףp=*H@R+@ ףp=jH@)\(,@(\•H@-@(\H@-@ I@R-@`I@)\(.@I@.@I@R.@ J@)\(/@ J@R/@(\5J@@0@(\uJ@0@(\µJ@Q0@(\J@Q0@(\5K@1@ ףp=jK@Q0@K@Q+1@(\µK@Q1@(\K@Gz1@ ףp=*L@Q1@ ףp=JL@Gz2@`L@Gz2@ ףp=L@Gz2@L@Q2@(\L@Gz3@L@3@ ףp=L@4@ ףp= M@Qk4@@M@Qk4@`M@Gz4@M@Q+5@ ףp=M@Qk5@ ףp=M@Q5@ ףp=M@Qk6@(\µM@Q6@ ףp=M@Gz7@ ףp=jM@7@ M@Q7@L@7@L@8@ ףp=jL@GzT8@(\5L@8@(\5L@GzT9@(\5L@Gz9@@L@Gz:@ L@Q+:@ ףp= L@Gz9@(\K@Gz9@ ףp=K@@9@K@Q8@@K@Gz8@ K@Q+8@ ףp=J@Gz8@J@Q+8@`J@Q+8@(\5J@Q7@ ףp=I@8@(\I@@8@I@@8@ ףp=I@8@(\I@@9@ ףp=I@9@ ףp=I@Gz:@ ףp=I@:@I@Gz9@(\UI@Q+9@@I@Qk9@(\I@Gz9@ I@@:@y8G@RQ$@{G S@>@d I@@:@ ףp= I@Q:@(\H@;@H@Qk;@ ףp=jH@Gz;@ ףp=JH@@<@ ףp=*H@<@(\H@@=@G@Qk=@ ףp=*H@Gz=@ ףp=JH@>@(\uH@>@H@@>@ ףp=H@>@I@Q+>@ ףp=*I@Gz=@(\UI@@=@ ףp=I@<@I@@<@I@Gz;@(\J@Q;@ ףp=JJ@Qk;@J@;@J@Q:@ ףp=J@Gz:@ ףp=*K@Q:@`K@Qk:@ ףp=K@Q:@K@Gz:@ L@;@`L@;@ ףp=L@Q:@(\•L@@:@ ףp=L@9@M@Q9@ ףp=JM@Gz9@(\•M@Qk9@(\M@GzT9@(\N@GzT9@`N@@9@(\•N@Q+9@ ףp=N@Gz9@(\5O@Q+9@(\uO@@9@O@@9@ ףp=O@Qk9@P@@9@{G*P@Q+9@{GJP@@9@GzdP@GzT9@GzP@Qk9@GzP@GzT9@GzP@9@{GP@8@GzP@GzT8@{GP@Q7@{GP@7@GzQ@7@{G*Q@Gz7@{GJQ@6@pQ@6@GzQ@Q6@{GQ@Qk6@{GjQ@@6@GzDQ@@6@GzTQ@5@{GjQ@Qk5@GzQ@5@GzQ@4@{GQ@4@{GQ@Q4@GzR@@5@{G R@Gz5@GzR@@6@Gz$R@Q+6@ R@Q5@Gz$R@@5@Gz4R@Gz4@0R@@4@{G*R@3@Gz4R@@3@@R@3@Gz4R@Q2@@R@Gz2@{GJR@1@PR@1@GzTR@Qk0@`R@0@pR@/@GzR@.@{GR@-@R@,@{GR@+@GzR@*@R@R(@R@(@GzR@)\('@GzR@RQ&@S@RQ%@{G S@RQ$@z8{G S@RQ@GzX@6@d{G S@RQ$@GzS@)\(#@ S@"@Gz4S@)\(!@{GJS@ @GzdS@)\( @S@)\ @{GS@R!@GzS@RQ"@S@"@S@#@GzS@$@GzS@$@GzS@)\%@S@&@S@'@T@RQ(@T@RQ)@GzT@*@T@)\+@{G T@R,@GzT@.@{G T@R.@{GT@)\/@@T@/@{GJT@Q+0@`T@@0@T@GzT0@T@Gz0@GzT@1@GzT@Q+1@T@Qk1@GzT@Gz1@{GT@Gz2@GzU@@2@ U@Gz2@Gz4U@3@GzDU@GzT3@`U@Q3@{GzU@3@{GU@Q3@U@GzT4@U@4@{GU@Gz5@GzU@Qk5@GzU@Gz5@V@5@{G V@Gz6@GzV@5@0V@Gz5@PV@Q5@pV@5@V@Gz5@GzV@Q+6@{GV@Qk6@{GV@6@V@GzT6@{GV@Q5@W@5@{G W@Gz5@ W@Q4@{G:W@@4@{GJW@Q3@`W@Q3@pW@3@GzdW@@3@GztW@Gz2@{GW@Gz2@GzW@GzT2@W@1@GzW@Q+1@{GW@Gz0@W@Gz0@W@)\/@GzW@/@W@/@GzW@Gz0@X@GzT0@0X@Gz0@{G:X@Q0@PX@0@GzdX@GzT0@pX@)\/@GztX@)\.@{GzX@-@GzX@,@X@RQ+@GzX@)\(*@X@)@X@R'@X@R&@X@&@X@RQ%@X@RQ$@X@)\(#@X@"@X@!@{GX@)\( @{GX@ @GzX@RQ@{8GzX@Q?l[@Q5@dGzX@RQ@{GX@RQ@X@@fffffY@p= ף@33333Y@RQ@33333Y@p= ף@Y@RQ@,Y@@fffff&Y@@9Y@@33333SY@p= ף @YY@p= ף@yY@@̌Y@\(\@33333Y@Q?Y@Q?Y@Q? Z@Q?fffffZ@@33333Y@p= ף@Y@\(\@Y@\(\ @Y@\(\@Y@p= ף@Y@p= ף@fffffY@p= ף@̬Y@@̌Y@RQ@33333sY@p= ף@`Y@RQ@9Y@p= ף@fffff&Y@p= ף@Y@@ Y@ @{GX@)\(!@GzX@"@GzX@RQ"@{GX@RQ#@{GX@$@GzX@)\%@GzX@RQ&@X@RQ'@{GX@)\((@{GX@)@Y@)\*@Y@+@9Y@)\*@9Y@)@YY@RQ)@33333sY@RQ)@̌Y@(@fffffY@)\((@33333Y@'@Y@)\&@Y@R%@Y@)\(%@ Z@)\(%@ Z@$@@Z@)\($@333333Z@)\(#@333333Z@)\("@@Z@RQ!@YZ@"@33333sZ@)\"@33333Z@R"@̬Z@)\#@̬Z@R$@33333Z@R$@Z@RQ%@fffff[@R%@ [@RQ&@@[@R&@L[@'@L[@RQ(@33333S[@)\)@33333S[@*@33333S[@+@L[@,@@[@-@333333[@)\.@[@/@fffff[@Q+0@Z@0@Z@Q0@33333Z@GzT1@Z@1@33333Z@Gz2@yZ@Qk2@ffffffZ@3@lZ@3@yZ@Q3@Z@@4@̬Z@Q4@fffffZ@5@fffffZ@@5@[@5@ [@Q5@@[@Q5@Y[@Qk5@l[@Qk5@|8l[@GzT4@fffff^@(\uD@dl[@Qk5@l[@5@l[@4@y[@GzT4@33333[@GzT4@[@4@33333[@Q4@[@@5@[@Qk5@[@5@\@5@ \@Gz5@@\@6@fffffF\@6@`\@Q+6@l\@Q6@̌\@@6@\@Q6@\@Q6@\@6@]@Gz6@ ]@Gz7@@]@Qk7@Y]@Q7@33333s]@8@̌]@@8@̌]@Gz8@̬]@Gz8@33333]@9@]@@9@]@Gz9@]@:@33333]@GzT:@]@:@^@Q:@33333^@;@fffff&^@Qk;@333333^@Gz;@fffffF^@Q+<@Y^@Q+<@ffffff^@Qk<@`^@Q<@l^@Q+=@y^@Q+=@^@=@fffff^@>@l^@Gz>@33333S^@@>@333333^@Q+>@^@GzT>@9^@Qk>@L^@Q>@`^@Gz>@y^@Q>@33333s^@@?@L^@Q?@33333s^@Q?@l^@ ףp= @@L^@(\5@@9^@ ףp=J@@333333^@@@,^@(\µ@@ ^@ ףp=@@33333^@ ףp=*A@33333]@ ףp=JA@]@ ףp=jA@]@A@]@ ףp=A@ ^@(\A@,^@(\B@333333^@ ףp=JB@`^@`B@^@B@33333^@ ףp=jB@fffff^@ ףp=B@fffff^@(\µB@ffffff^@(\µB@L^@B@333333^@B@33333^@ ףp=B@^@ ףp=B@33333]@ ףp=B@33333]@ ףp=B@]@ ףp=B@33333]@B@33333]@C@y]@ C@ffffff]@ ףp=JC@l]@(\uC@]@C@]@ ףp=C@]@(\•C@33333]@(\µC@]@C@]@D@^@(\D@333333^@ ףp=JD@L^@(\uD@y^@ ףp=jD@̌^@(\5D@}8L^@ ףp=*A@a@(\UK@ď^@(\5D@y^@D@`^@C@33333S^@C@l^@(\•C@L^@`C@ffffff^@ ףp=jC@fffff^@ ףp=C@^@(\µC@^@ ףp=C@^@C@fffff_@ ףp=C@,_@(\C@fffffF_@ ףp=C@Y_@(\µC@L_@(\uC@@_@@C@333333_@ ףp= C@33333S_@(\B@fffff_@B@fffff_@(\µB@33333_@B@̌_@(\uB@_@ ףp=*B@33333_@A@33333_@ ףp=A@33333_@ ףp=jA@fffff_@ ףp=*A@_@(\UA@33333_@ ףp=jA@`@(\uA@33333#`@(\•A@)`@ ףp=A@,`@B@,`@@B@)`@B@fffff&`@B@`@(\B@`@ C@fffff`@(\UC@33333_@C@33333_@C@_@ ףp=C@33333_@ ףp=C@33333_@(\C@fffff`@ ףp= D@`@ ףp=*D@fffff&`@(\UD@fffff6`@ ףp=jD@fffff6`@ ףp=D@333333`@ ףp=D@33333C`@ ףp= E@fffffV`@ E@Y`@ ףp=JE@ffffff`@ ףp=JE@p`@E@fffffv`@E@`@E@`@(\uE@33333`@(\UE@fffff`@ ףp=jE@`@(\•E@`@(\µE@`@(\E@fffff`@ ףp=*F@ a@`F@a@F@0a@(\F@@GztQ@<@{GQ@>@GzQ@Q+?@{GQ@Q+>@{GQ@Gz=@{GQ@;@GzQ@Gz:@Q@Gz:@{GQ@Gz9@GzQ@Q9@{GQ@Gz8@Q@@8@{GQ@GzT7@{GQ@GzT6@{GQ@5@Q@Q+4@GzQ@Q2@GzQ@Gz2@GzdQ@1@{GZQ@1@GzDQ@Gz1@@Q@Q0@{G*Q@Gz0@@Q@R/@0Q@Q+0@PQ@)\.@{G:Q@R,@{G*Q@.@{GQ@RQ+@Q@R)@GzP@,@{G Q@.@Q@Q+0@GzQ@.@GzP@RQ-@{GP@)\+@P@)\*@GzP@*@{GP@)\()@pP@RQ(@PP@)\&@{G:P@RQ%@GzP@)\($@(\O@#@O@R!@O@!@ ףp=O@ @O@@(\uO@RQ@@O@p= ף@(\O@p= ף@ ףp=N@@N@RQ@(\•N@@`N@RQ@ ףp=*N@RQ@(\M@@ ףp=M@p= ף@M@p= ף@ ףp=M@p= ף@M@RQ@ ףp=JM@@ ףp=*M@RQ@ ףp= M@p= ף@M@!@ M@"@ ףp=JM@#@M@$@M@)\(%@ ףp=M@)\(&@ ףp=M@)\&@@M@RQ'@M@(@(\µL@)\(@(\uL@R)@@L@RQ)@(\L@*@K@*@(\µK@RQ+@(\µK@,@(\µK@RQ,@K@RQ-@(\L@)\.@(\L@R/@(\L@GzT0@`L@0@ ףp=L@Q0@L@Q0@ M@Gz0@ ףp=JM@Gz1@(\uM@GzT2@(\•M@2@ ףp=M@Gz2@ ףp=M@Gz2@ ףp=M@Gz2@(\N@Q1@@N@8RQ!@(\J@Q+>@GztP@dQ1@@N@@1@ ףp=jN@Q+1@N@GzT1@N@Qk1@ O@1@@O@Qk2@O@Q+3@ ףp=O@Gz3@ ףp=O@Q4@ ףp=O@5@{G P@Q5@ P@5@0P@5@GzDP@Qk5@GzTP@6@`P@Qk6@GztP@Q+7@pP@Gz7@pP@8@GztP@GzT9@`P@GzT9@@P@Q8@Gz4P@Gz8@GzP@@7@(\O@Qk6@(\µO@Gz5@O@Q+5@@O@@5@O@Q5@N@GzT5@N@GzT5@(\UN@Gz6@(\5N@Gz6@(\N@7@N@Qk8@ ףp= N@GzT9@ N@@:@(\5N@Q+;@ ףp=JN@GzT<@ ףp=JN@Gz=@(\N@=@ N@Q+>@ ףp=M@Q+=@N@GzT<@(\M@Q;@(\µM@Gz:@(\µM@Q9@ ףp=M@9@M@Q+8@(\µM@7@(\•M@7@`M@7@ ףp=*M@GzT8@ M@GzT8@L@GzT8@L@Gz7@L@@7@ ףp=L@Q6@(\µL@Qk6@(\L@Q5@ ףp=L@GzT5@ ףp=L@5@`L@5@(\L@Gz5@(\K@4@(\•K@4@(\uK@3@@K@@3@ ףp=*K@Q2@ ףp=*K@GzT2@ ףp=jK@1@`K@Q0@ ףp=JK@0@ K@RQ.@(\K@)\,@(\J@)\+@K@*@(\K@RQ+@ ףp=*K@)\*@(\UK@R)@(\5K@(@ ףp=*K@)\'@(\K@)\&@(\J@%@(\J@R%@ K@$@@K@$@`K@R"@K@#@K@RQ$@L@)\%@(\L@)\%@@L@$@@L@$@ ףp=jL@%@L@%@ ףp=L@)\#@L@R"@(\•L@RQ!@ ףp=L@8Gz" ףp= B@"@ ףp=L@dRQ!@ ףp=L@ @ ףp=jL@)\( @@L@)\( @L@RQ @ ףp=K@RQ!@ ףp=K@RQ!@ ףp=jK@"@@K@RQ!@ ףp=*K@"@ ףp= K@)\(!@ ףp=J@!@J@ @(\J@RQ@(\J@@(\µJ@RQ@(\µJ@@J@@ ףp=jJ@p= ף@`J@p= ף@@J@@ J@RQ@(\5J@RQ@(\uJ@@ ףp=jJ@RQ@(\5J@RQ@ ףp= J@@I@p= ף @(\µI@@I@p= ף@I@? ףp=jI@HzG?@I@? ףp= I@HzG?(\H@(\? ףp=H@(\?(\H@H@zG ףp=H@q= ףpH@q= ףp(\H@zG(\H@q= ףp(\•H@zG ףp=JH@ ףp=JH@q= ףp@H@ ףp=jH@q= ףp `H@Gz ףp=JH@@H@GzH@ ףp=G@ ףp=G@q= ףp ףp=G@G@Q ףp=G@zGG@`G@@G@ G@ ףp=F@q= ףpF@zG(\UF@ F@zG(\E@zG(\µE@q= ףp ףp=E@(\µE@Q E@Gz ףp=E@\(\E@\(\ ףp=E@\(\E@E@ E@Gz ףp=E@ףp= !E@ףp= W"E@!(\5E@Gz!E@!(\D@Gz.!(\•D@ףp= W!`D@Gz! D@ףp= !(\C@" ףp=C@Gz" ףp=jC@Gz."@C@ףp= W!@C@!C@!B@ףp= ! ףp=B@Gz (\•B@\(\ ףp=B@GzB@B@B@\(\`B@ B@ ףp= B@@B@8@B@Qk2@F@d@B@(\UB@q= ףp`B@Q `B@`B@q= ףp`B@q= ףp(\•B@q= ףp(\B@zG(\B@(\ ףp= C@(\տ(\5C@?`C@п ףp=C@(\տC@(\C@?(\5D@?D@?(\•D@p= ף@ ףp=D@\(\@(\D@\(\ @(\D@p= ף@@E@@E@p= ף @E@@E@RQ@ ףp=E@@E@RQ@E@p= ף@ ףp=E@RQ@(\µE@p= ף@(\E@ @ ףp=E@ @(\F@RQ!@ ףp=*F@RQ"@ F@#@ ףp= F@)\($@F@RQ$@E@R$@ ףp=E@R%@(\UE@&@ ףp=*E@'@ ףp=*E@(@(\D@R(@D@R)@D@)\(+@D@,@(\uD@R,@(\UD@-@ ףp=JD@.@(\D@RQ/@D@/@(\C@0@C@Gz0@ ףp=jC@)\/@ ףp=JC@RQ/@(\C@RQ/@(\B@0@(\B@Q+0@(\C@0@(\5C@0@ ףp=jC@1@C@1@(\µC@0@(\C@Q0@(\D@Q0@@D@GzT1@ ףp=*D@Gz1@ D@Q1@(\C@@2@ ףp=C@Qk2@(\D@Q1@ ףp=JD@Qk1@ ףp=jD@Q0@ ףp=D@GzT0@ ףp=D@)\/@D@Gz0@ ףp=D@.@ ףp=D@RQ-@ ףp= E@RQ,@ ףp=*E@R+@ ףp=JE@)\+@E@)\(+@(\µE@)\(*@(\E@RQ)@(\E@(@ F@RQ(@ ףp=JF@)\(@(\uF@)\((@(\•F@RQ(@F@)\()@F@)\(*@F@)\(+@(\F@R*@(\µF@+@ ףp=F@+@ ףp=jF@)\(,@F@RQ,@ ףp=F@)\-@F@R-@ ףp=JF@8R-@@@ ףp= B@ ףp=JF@dR-@ ףp=JF@RQ.@ ףp=*F@RQ.@F@/@E@0@E@Gz0@(\µE@GzT1@E@Q1@ ףp=JE@2@ ףp=*E@3@E@3@D@Qk3@ ףp=D@GzT3@`D@GzT3@ D@3@D@Gz4@ ףp=C@GzT4@C@Q4@`C@Gz5@ ףp=*C@Gz5@ C@Gz6@ ףp=*C@Q6@C@7@(\B@8@ ףp=B@8@(\C@Gz8@C@Q+8@(\C@Gz8@@C@Q7@(\UC@GzT7@(\uC@Q+7@C@Gz6@ ףp=C@6@D@Gz6@ ףp=JD@Gz7@(\D@Gz7@(\D@7@(\5D@7@(\UD@8@(\UD@@8@(\uD@8@ ףp=jD@Q+9@(\uD@9@ ףp=jD@Gz:@@D@Gz:@ ףp=JD@Q+:@ D@Q+:@D@Gz:@ ףp=*D@Gz;@(\UD@Qk;@(\uD@Q+<@D@Gz<@D@Qk=@(\UD@Q<@ ףp=JD@=@ ףp=*D@Qk<@ ףp=*D@;@ ףp=*D@Q+;@ ףp=*D@Gz:@ ףp=*D@Q+:@D@:@(\µC@Gz:@C@Q:@C@:@(\UC@Q:@(\5C@Q:@ ףp=*C@GzT:@ ףp=JC@@:@ C@:@ ףp= C@Q+;@(\B@Gz;@ ףp=B@;@ ףp=B@Q+;@B@Q;@B@Q+<@B@<@`B@Gz<@`B@@=@ ףp=*B@=@(\B@>@(\5B@Q>@ ףp=jB@@?@`B@@@@B@ @@(\B@`@@B@(\•@@(\B@ ףp=@@(\B@ ףp= A@@B@@A@ ףp=jB@(\•A@ ףp=JB@A@ ףp=JB@B@(\uB@ ףp= B@(\UB@A@ ףp=*B@(\A@B@A@(\A@A@A@ ףp=A@@A@A@ ףp= A@A@@@8Gz@>@A@B@dA@@@A@@@ ףp=jA@@@@(\UA@@@ ףp=*A@?@A@Q+?@@@Gz?@(\U@@?@ ףp=*@@@?@(\@@Q>@?@Gz?@Gz?@Qk?@Q+?@?@Gz>@Qk?@>@Q+?@=@Q>@=@Gz>@Qk<@Gz?@Gz;@Gz?@GzT;@@?@Q:@Qk?@GzT:@?@9@Gz?@Q+9@?@Q8@Q?@GzT8@Q?@7@ ףp= @@Q+7@(\@@Gz7@ ףp=J@@6@`@@Gz5@ ףp=j@@@5@`@@Q4@ ףp=J@@Gz4@(\@@Gz3@Gz?@4@?@Gz4@Gz?@Q3@Q>@Gz3@Qk>@Q+3@@>@Q2@GzT>@Q+2@Q>@1@?@Q0@Q+?@Gz0@@?@)\(/@?@)\.@?@)\.@ @@-@(\5@@RQ,@(\U@@)\(+@`@@)\)@ ףp=j@@RQ(@ ףp=j@@RQ'@@@)\(&@@@R%@(\@@%@ ףp=@@)\($@@@$@(\A@)\$@(\5A@%@`A@&@(\•A@R%@ ףp=A@)\(%@A@R$@ ףp=*B@%@@B@&@(\uB@)\$@(\UB@)\($@(\•B@)\(#@B@)\("@(\•B@RQ!@(\uB@RQ @ ףp=jB@p= ף@B@@ ףp=jB@@B@RQ@`B@RQ@(\UB@@ ףp=jB@p= ף@(\uB@p= ף@(\uB@\(\ @ ףp=jB@\(\@ ףp=jB@\(\@(\UB@? ףp=JB@?@B@? B@(\A@ ףp=A@A@(\µA@zG(\•A@q= ףp ףp=A@ ףp=A@q= ףp A@\(\A@(\•A@GzA@Gz ףp=A@GzA@8Gzn1@p= ף@A@dGzA@GzA@\(\ ףp=jA@\(\(\5A@\(\A@Gz(\@@ @@!@@Gz! ףp=j@@"@@@"(\@@#?@Gz#?@Gz#Q>@Gz.#GzT>@Gz#=@ףp= W$GzT=@Gz.%Q<@ףp= W&Q<@'@<@ףp= W(<@ףp= )Q;@*;@ףp= *;@ףp= W+Q:@ףp= W,Qk:@ףp= ,Q+:@Gz.-Q9@-@9@.Q8@ףp= .@8@/Gz7@0Qk7@@06@0GzT6@ףp= 0Gz6@Gz0Gz5@1Gz5@ףp= 04@Gz.0GzT4@Gz.0Gz3@03@Gz.03@02@02@ףp= 01@@01@Gzn00@Gzn0)\/@0R.@1.@Gzn1-@1-@0,@Gz0R*@0R)@0)\(@ףp= W0)\((@ףp= /)\'@/R'@ףp= .&@.)\(&@ףp= W-RQ%@ףp= ,$@,$@Gz.+)\(#@*RQ"@ףp= W*RQ!@Gz.* @ףp= )RQ@ףp= (RQ@ףp= 'RQ@ףp= &RQ@&p= ף@Gz$RQ@Gz#RQ@ףp= "@ףp= !p= ף@Gz @\(\RQ@Gz@GzRQ@\(\p= ף@Gz@\(\RQ@p= ף@\(\@Q@QRQ@Q@@q= ףp@q= ףpp= ף@(\@п@Q?RQ@?RQ@?p= ף@HzG?RQ@p= ף@p= ף@p= ף@R#@@p= ף@p= ף@p= ף@p= ף@\(\ @@@@@RQ@@p= ף@@@p= ף@RQ@@@@@@RQ@@p= ף@ @p= ף@R @@)\!@@R!@@)\"@\(\@)\(#@ @R#@p= ף@#@@RQ#@Q?#@?"@HzG?)\(#@q= ףp?)\"@?)\"@)\(*@)@.@,@)\(*@)\(,@)\*@+@+@)\*@)\+@)\(*@R+@)@RQ,@)@)\(-@)@)\(.@R)@.@R*@-@R*@RQ,@+@RQ,@)\+@R+@RQ,@R*@,@)\(*@)\(,@Q?@ A@?Q?@QGz?@ @@Q`@@(\µ@@ ףp=@@q= ףp@@Q ףp=@@(\@@q= ףp ףp= A@ A@QۿA@{Gz?@@?@@?(\5@@(\?Gz?@ ףp= ǿQ?@Gz?@zG?@q= ףpQ?@QGz=@!Gz?@Q @=@=@Gz=@GzT>@GzGz>@Gz. >@Gz.!Gz?@!?@ >@>@GzGz>@\(\Q+>@=@Gz>@Gz=@GzQ=@\(\Qk=@GzT=@Q Gz=@@=@Gz=@GzT=@\(\@=@A@- ףp=A@Gz.# ףp= A@ףp= W((\A@Gz.) ףp=*A@* ףp=*A@ףp= *(\UA@+`A@ףp= W, ףp=A@Gz., ףp=A@-A@Gz+(\uA@ףp= * ףp=jA@Gz) ףp=jA@(A@ףp= W'(\UA@Gz.& ףp=JA@Gz.%@A@ףp= # ףp= A@Gz.#A@Gz# A@Gz% A@&(\5A@' ףp= A@ףp= W(X;@(\uD@(\D@ ףp=JG@H;@@E@Q;@ ףp= E@Gz<@(\D@Gz<@ ףp=D@Q+=@(\•D@Gz=@ ףp=D@>@(\•D@Gz?@ ףp=D@Gz?@ ףp=D@ ףp= @@ ףp=D@ ףp=J@@ ףp=D@@@E@ ףp=@@(\D@@A@(\D@A@E@ ףp=A@(\D@B@(\D@ ףp=*B@D@`B@D@B@D@(\B@ ףp=D@(\C@(\uD@`C@D@ ףp=C@ ףp=D@(\C@D@@D@ ףp=D@ ףp=D@(\µD@ ףp=D@(\D@(\D@E@(\µD@ ףp=*E@D@`E@D@(\uE@ ףp=*D@(\•E@ ףp=C@(\µE@C@(\E@C@ ףp= F@@C@ ףp=*F@C@(\5F@(\B@ ףp=JF@B@`F@B@ ףp=F@(\UB@ ףp=F@ ףp= B@F@ ףp=A@ ףp=F@ ףp=A@ ףp=jF@ ףp=JA@`F@ A@@F@@@ ףp=*F@(\µ@@ ףp=JF@ ףp=@@F@@@(\•F@(\U@@ ףp=F@ ףp=@@F@@@(\F@(\•@@(\G@ ףp=J@@G@Gz?@ G@ ףp= @@ ףp=JG@Qk?@ ףp=JG@Gz>@ ףp=JG@Gz>@(\G@Q+>@ ףp=F@Gz=@(\F@Q=@(\•F@=@ ףp=jF@=@(\UF@Q<@ ףp=*F@Q<@(\E@Gz<@(\µE@<@ ףp=E@Q;@ ףp=jE@;@@E@(\5A@F@ ףp=C@G@(\5A@(\F@`A@F@A@(\µF@A@F@ ףp= B@(\µF@(\UB@(\µF@ ףp=B@ ףp=F@B@ ףp=F@ C@ G@(\B@(\5G@(\B@(\UG@(\C@(\UG@`C@G@ ףp=C@ ףp=G@C@G@(\5C@(\•G@ ףp=B@ ףp=G@ ףp=jB@`G@ ףp= B@(\UG@(\µA@(\5G@A@ ףp= G@(\5A@(\F@(\UG@ ףp=JB@`K@G@T(\UG@`F@(\UG@(\5F@ ףp=G@ F@(\µG@E@(\µG@(\µE@(\µG@E@ ףp=G@@E@ H@ ףp= E@(\UH@ ףp=D@H@(\µD@(\•H@D@(\H@ ףp=JD@ I@(\5D@H@ ףp=*D@(\µH@D@H@C@(\•H@(\•C@`H@(\•C@ ףp=jH@ ףp=JC@(\uH@ ףp= C@H@ ףp=B@H@(\µB@(\I@ ףp=B@ ףp=*I@ ףp=B@I@`B@ ףp=I@ ףp=JB@(\5J@`B@(\•J@(\uB@(\J@ ףp=jB@K@(\•B@J@ ףp=B@J@@C@K@ ףp=C@ ףp=J@(\•C@(\µJ@ ףp=C@J@D@`J@D@(\UJ@ ףp=*D@(\uJ@ ףp=jD@J@(\UD@(\K@(\UD@`K@D@ ףp=*K@ ףp=D@(\J@(\D@(\J@ ףp= E@J@E@(\UJ@(\D@`J@D@(\5J@D@ ףp=*J@(\E@(\UJ@ ףp=JE@@J@ ףp=jE@ ףp=I@ ףp=jE@ ףp=I@(\•E@(\•I@(\E@`I@(\F@(\I@ ףp=*F@ I@ ףp=JF@(\uI@ ףp=JF@(\µI@@F@(\•I@F@I@ ףp=F@@J@(\µF@ ףp=J@(\•F@(\J@F@ K@F@(\J@F@ ףp=J@(\F@(\J@(\5G@(\•J@ ףp=jG@ ףp=JJ@(\•G@ ףp= J@(\•G@(\µI@(\•G@(\uI@G@(\I@ ףp=jG@H@`G@(\uH@ ףp=JG@H@ ףp=*G@@H@ G@ H@(\F@ ףp=G@ ףp= G@ ףp=G@(\F@G@(\•F@(\UG@`F@(\M@E@ ףp=N@`G@(\M@F@(\M@@F@ ףp=*M@ F@ ףp=*M@(\E@M@(\E@(\M@(\E@ ףp=M@E@@N@(\E@ ףp=N@(\F@ ףp=N@(\UF@N@`F@ ףp=N@F@N@ ףp=F@N@F@N@G@ ףp=N@(\5G@(\N@`G@N@@G@`N@(\UG@ ףp= N@@G@ ףp= N@(\G@M@ ףp=*G@M@(\F@M@(\F@(\UM@ ףp=F@ ףp=JM@(\µF@(\M@F@{GZR@(\uF@S@`G@{GZR@ ףp=F@GztR@F@GzR@(\uF@R@(\F@{GR@G@R@(\G@{GR@(\5G@S@ ףp=JG@Gz4S@(\5G@GzTS@ ףp=JG@S@ ףp=*G@S@(\5G@S@`G@S@`G@GzS@ ףp=JG@GztS@(\UG@GzTS@ ףp=JG@Gz4S@(\UG@GzS@`G@R@(\UG@R@`G@{GR@(\5G@{GjR@(\G@{GZR@ ףp=F@fffffY@ ףp=I@y[@K@fffffY@ ףp=I@ Z@ ףp=I@LZ@I@yZ@(\I@33333Z@(\J@Z@@J@33333Z@(\UJ@33333[@J@@[@J@Y[@K@`[@@K@l[@ ףp=K@y[@ ףp=K@`[@K@33333S[@K@L[@(\•K@333333[@`K@ [@ ףp=*K@ [@(\J@fffffZ@J@Z@ ףp=J@fffffZ@`J@fffffZ@@J@lZ@(\J@LZ@ ףp=I@ Z@I@fffffY@ ףp=I@>@(\M@ ףp=j@@ ףp=N@>@ ףp=N@Gz>@`N@Q>@ ףp=*N@Gz?@(\M@?@(\M@?@(\N@@@@(\N@ ףp=j@@@N@ ףp=j@@ ףp=jN@@@@(\•N@Gz?@ ףp=N@Qk?@ ףp=N@>@ ףp=N@Q+>@ ףp=N@>@ ףp=N@@A@(\uN@(\5B@ ףp=jO@@A@N@ ףp=jA@N@A@ ףp=N@A@(\uN@B@(\uN@(\5B@ ףp=N@(\5B@(\µN@B@(\N@A@O@ ףp=A@(\5O@A@(\UO@@A@ ףp=jO@ ףp=jA@ ףp=JO@ ףp=A@@O@ ףp=A@(\O@(\UA@(\O@@A@N@8E@ףp= 9(\5I@(DE@Gz5E@ףp= W6 ףp=E@ףp= 6 ףp=E@@7(\E@Gz7E@8(\F@9 ףp=JF@ףp= W9F@ףp= 9F@9(\F@@9(\5G@ףp= 9 ףp=jG@Gz.9(\•G@Gz8 ףp=G@@8G@7(\G@Gzn7G@7 ףp=G@ףp= 6(\G@Gz.6 ףp= H@5 H@ףp= W5(\5H@Gz4@H@4(\UH@ףp= 4 ףp=jH@ףp= 3H@ףp= 3H@2 ףp=H@2(\µH@Gzn1(\µH@1(\H@0H@ףp= W0(\H@/ ףp= I@ףp= /(\5I@ףp= . ףp=*I@ףp= -(\I@ףp= W,(\H@Gz.+ ףp=H@* ףp=H@)H@( ףp=jH@ףp= ( ףp=jH@ףp= )`H@Gz* ףp=*H@+ ףp=G@Gz.+(\G@Gz., ףp=G@Gz,(\G@-G@- ףp=jG@.(\5G@/(\F@/(\µF@ףp= /(\uF@Gz.0@F@Gz.0 F@Gz0(\E@Gzn1F@2 F@ףp= 2 F@3@F@ףp= 3(\5F@4 ףp= F@4(\E@Gz4 ףp=E@ףp= W5E@Gz5H(\•K@ףp= W5 ףp=K@Gz4(\•K@5 ףp=K@ףp= W5K@ףp= W5 ףp=K@Gz.5 ףp=K@Gz4(\•K@5@ ףp=L@4L@4 ףp=L@4L@4L@Gz.4L@4 ףp=L@4P ףp=J@(@ ףp=JK@RQ)@ ףp=J@R(@(\J@(@ ףp= K@(@ ףp=JK@)@(\K@)\()@(\J@RQ)@ ףp=J@R(@Gz4Q@ףp= HGzQ@ףp= WH Gz4Q@QkH{GJQ@H{G:Q@ףp= H`Q@HGztQ@ףp= HQ@ףp= H{GQ@ףp= HGzQ@QHQ@ףp= H{GjQ@HGzTQ@H@Q@ףp= WHGz4Q@QkH0{G*W@)\'@{G:W@)\*@{G:W@)\*@Gz4W@)\()@{G*W@)\'@({GW@\(\@ X@@{GW@@ X@\(\@HPX@(\?X@?PX@HzG?GzdX@?X@(\?X@?`X@?PX@HzG?HX@{GX@(\X@GzX@GzX@{GX@zGX@(\X@S@@GztT@)\#@S@)\( @S@@GzS@RQ@T@p= ף@T@@{G*T@@PT@p= ף@{GjT@@GztT@@GztT@RQ@`T@ @PT@!@{G:T@"@Gz$T@#@T@)\#@{G T@R"@{GS@"@GzS@!@S@)\( @,[@@2@[@4@,[@GzT3@,[@Q2@,[@2@33333S[@@2@l[@@2@̌[@2@[@Gz2@̬[@GzT3@[@Q3@[@4@[@4@[@4@ffffff[@Q3@fffffF[@Gz3@,[@GzT3@ ^@6@y^@@9@ ^@Q7@ ^@Q+7@33333^@Gz6@,^@Qk6@333333^@6@@^@Gz6@33333S^@7@`^@7@l^@Gz8@y^@Gz8@y^@Gz9@ffffff^@@9@fffffF^@9@333333^@Gz8@ ^@Q+8@ ^@Q7@0`@Gz?@|`@(\@@0`@@@9`@`@@fffffF`@`@@fffffF`@ ףp=@@P`@`@@P`@ ףp=*@@fffffF`@ ףp= @@fffffF`@Q?@fffffF`@@?@Y`@Gz?@i`@Qk?@l`@Q?@fffffv`@(\5@@|`@ ףp=j@@fffffv`@@@33333s`@(\@@33333c`@(\@@\`@(\@@L`@ ףp=@@@`@@@0`@@@`@`@@fffff`@ ףp=*A@`@(\µ@@̌`@(\u@@̜`@`@@33333`@ ףp=@@`@ ףp=@@fffff`@@@33333`@@@`@ ףp=@@fffff`@ ףp=@@33333`@(\A@33333`@ ףp=*A@33333`@ A@`@(\@@`@A@fffff`@(\@@`@(\µ@@\`@(\µ@@̼a@D@O\`@ ףp=*A@\`@(\@@p`@A@`@(\@@`@ A@̜`@ ףp=*A@`@@A@̼`@ ףp=JA@`@ ףp=jA@`@`A@`@`A@fffff`@ ףp=*A@fffff`@(\@@`@@@fffff`@(\µ@@fffffa@(\@@fffffa@ ףp=*A@a@(\UA@fffffa@A@)a@ ףp=JA@33333Ca@ ףp=JA@fffffVa@ ףp=A@Ya@ ףp=JA@33333ca@A@33333sa@A@ya@A@fffffva@(\uA@a@(\•A@̌a@A@fffffa@A@33333a@(\B@fffffa@`B@̜a@B@a@ ףp=B@̜a@ ףp= C@33333a@ ףp=*C@a@ ףp=*C@a@`C@a@ ףp=C@̼a@(\C@fffffa@(\D@̬a@ ףp=JD@a@D@̬a@ ףp=D@a@D@fffffa@(\•D@33333a@(\•D@33333a@(\uD@fffffa@(\uD@a@(\•D@a@(\UD@a@ ףp=*D@a@(\C@a@(\µC@ya@C@pa@ ףp=JC@ia@ ףp= C@Ya@ ףp=B@33333Sa@(\µB@fffffFa@(\•B@333333a@B@ a@`B@ a@ ףp=B@fffff&a@B@fffffa@B@fffffa@ ףp=jB@ a@(\5B@a@ ףp= B@a@(\A@fffff`@A@`@A@fffff`@(\A@`@ ףp=A@`@A@fffff`@A@`@ ףp=A@y`@`A@l`@@A@\`@ ףp=*A@pfffffva@(\µD@9b@F@+ya@ ףp=JE@fffffva@ E@a@E@a@(\µD@a@(\D@33333a@ ףp=D@fffffa@ ףp= E@a@ E@a@@E@fffffa@@E@̜a@ ףp=*E@a@@E@a@ ףp=JE@a@ E@a@E@a@ ףp=*E@fffffa@(\UE@fffffb@E@b@(\uE@)b@(\•E@9b@(\µE@fffff&b@ ףp=E@fffff&b@ ףp=E@ b@E@)b@ F@fffffb@(\E@fffffb@F@33333a@(\F@a@@F@fffffa@`F@a@(\•F@̼a@F@a@F@fffffa@`F@fffffa@ ףp=*F@33333a@F@a@E@a@(\µE@a@(\•E@fffffa@(\•E@a@E@̌a@(\uE@ya@ ףp=JE@833333_@Gz:@fffff`@Gz:@33333_@Gz:@33333_@Qk:@fffff`@Gz:@fffff`@Gz:@()`@Q+<@fffff6`@Qk<@)`@Q+<@fffff6`@Qk<@00b@ ףp=E@fffffFb@ ףp=*F@0b@ ףp=E@9b@ ףp= F@fffffFb@ ףp=*F@X\b@(\5F@b@F@\b@(\5F@pb@`F@fffffb@ ףp=F@b@F@b@F@|b@ ףp=F@lb@F@\b@(\5F@@b@(\F@b@ G@b@(\F@b@F@b@ G@b@ ףp= G@b@(\F@(b@ ףp=jG@fffffc@(\•G@b@ ףp=jG@fffffc@(\•G@Pffffffc@I@33333c@`I@ffffffc@(\"I@ffffffc@I@yc@I@33333c@@I@33333c@`I@fffffvc@(\5I@ffffffc@(\"I@@)a@ ףp=JK@33333Ca@(\•K@)a@ ףp=jK@333333a@ ףp=JK@33333Ca@K@0a@(\•K@)a@ ףp=jK@@id@@M@̌d@(\•M@id@@M@̌d@(\uM@d@(\•M@fffffvd@M@id@@M@fffffa@(\F@ b@ ףp=*K@/fffffa@ ףp=J@a@`J@fffffa@ J@fffffa@I@a@(\µI@33333a@I@a@@I@33333a@I@33333a@H@a@ ףp=H@a@`H@a@@H@fffffa@H@a@ ףp=G@a@G@fffffa@ ףp=JG@a@(\F@a@(\5G@33333a@(\UG@a@ ףp=JG@a@ G@a@`G@33333a@(\uG@a@G@fffffa@G@a@ ףp=G@33333a@ ףp=*H@a@`H@a@ ףp=H@a@ ףp=H@a@ ףp=H@ b@ ףp=H@fffffb@H@a@I@fffffa@@I@a@I@a@I@33333a@J@fffffa@@J@fffffa@J@a@J@a@K@fffffa@ ףp=*K@a@ K@a@ ףp=J@a@ ףp=J@fffffa@ ףp=J@8fffffVf@GzQ@f@RQ@f@RQ@fffffVf@HzQ@Yf@GzQ@f@Q@@fQ@Q-fRQ@fQ@QffQ@Q-f{GQ@QFfRQ@fRQ@P33333a@{GJR@a@{GzR@33333a@`R@33333a@PR@a@{GJR@a@`R@a@{GzR@a@GztR@33333a@`R@@fffffa@{GzR@a@R@fffffa@R@a@{GzR@a@R@a@R@fffffa@R@XPb@R@b@GzR@Pb@GzR@ffffffb@GzR@fffffb@R@b@R@b@{GR@fffffb@GzR@ib@{GR@Pb@GzR@fffff&a@{GR@ b@{G S@fffff&a@R@33333Ca@R@ia@{GR@a@GzR@a@R@a@GzR@b@GzR@ b@{GR@ b@{GR@b@GzR@a@GzR@a@{G S@a@R@`a@{G S@0a@{GR@fffff&a@R@pGzX@{GzS@@Z@{GS@ GzX@{GzS@@Y@{GS@Y@{GS@@Z@GzS@@Z@GzS@Y@{GS@33333Y@{GS@LY@S@fffff&Y@GzS@GzX@GzS@GzX@{GzS@{GV@S@ Y@PT@{GV@GzT@GzV@{GS@GztW@S@{GW@GzS@0X@{GS@GzX@S@GzX@GzS@X@S@ Y@{GS@X@T@GzdX@{G T@@X@ T@`X@0T@{GX@@T@GzW@PT@{GJW@{G:T@{G*W@ T@{GV@GzT@X(\I@GzQ@GzDQ@@S@((\I@GzQ@ ףp=jJ@{GQ@ ףp=J@GzQ@ ףp=K@{GQ@(\uL@GzQ@(\L@Q@ ףp=*L@GzQ@K@Q@K@R@ ףp=K@ R@(\L@{G:R@L@GzTR@ ףp=L@pR@(\UM@{GR@ ףp=M@GzR@`N@R@ O@GzR@ ףp=O@{GR@`P@GzR@P@GzS@Gz4Q@GzS@GzDQ@Gz4S@P@@S@P@0S@{GJP@{GS@(\•O@S@(\•N@S@M@{GR@(\M@GzR@L@GzR@K@GzR@K@R@(\uK@{GR@ ףp=J@pR@ ףp=*K@{GZR@J@{GJR@@J@{G*R@`J@GzR@(\I@GzR@(\I@GzQ@H@H@0Q@ ףp=*I@GzdQ@`H@0Q@I@{G:Q@ ףp=*I@PQ@(\•H@GzdQ@@H@PQ@`H@0Q@L@HzT@PP@{GZT@L@HzT@L@HzT@M@{GT@N@GzT@ ףp=*O@= ףpT@ ףp=*O@{G:T@ ףp=O@Gz4T@PP@@T@Gz$P@{GZT@ ףp=jO@{GJT@ ףp=*O@{G:T@(\M@R1T@M@{GT@ ףp=L@T@L@HzT@h K@Q(T@ ףp=jM@pT@ K@333333T@ ףp=*L@Q(T@@M@333333T@(\L@@T@ ףp=jM@GzTT@@M@pT@@L@{GZT@@L@RAT@ ףp=jK@RAT@ K@333333T@8(\•J@T@K@ T@(\•J@T@K@RT@K@ T@(\•J@T@@F@33333T@(\•I@9T@ @F@33333#T@(\F@{GT@G@{GT@G@{G T@(\5H@33333T@I@HzT@I@T@(\•I@{G*T@ ףp=*I@R1T@H@33333#T@H@0T@G@9T@@F@33333#T@P&@ S@;@ T@'&@S@&@GzS@RQ'@̬S@RQ*@= ףpS@)\(.@= ףpS@RQ+@|S@,@`S@RQ.@zGAS@1@ S@GzT1@@S@Gz2@`S@Q2@RS@3@{GS@@4@QS@Q4@QS@Q5@{GzS@Gz4@{GZS@Q6@PS@Gz8@pS@Q+7@GzS@Q+6@{GS@5@GzS@3@{GS@2@S@Q4@GzS@Gz7@{GS@Q9@{GS@;@HzS@;@{G T@Gz8@T@7@{GT@5@{G T@4@ T@2@T@2@{GS@GzT0@RT@/@{GS@)\+@GzS@&@S@@GzO@\(\(\/O@Gz ףp= O@GzO@\(\(\/O@fffff&O@Gz ףp= O@0(\N@(\5N@(\= ףpN@(\5N@N@( (\uM@(\•M@ (\•M@(\uM@H ףp=L@Gz@M@ ףp=L@GzM@Gz@M@(\M@ ףp=L@ ףp=L@H#@fffffK@%@ ףp=K@#@\(K@)\($@fffffK@ffffff%@fffffK@%@(\K@(\$@ ףp=K@#@\(K@`)\(&@q= ףK@)\()@ L@ )\(&@K@&@K@)\'@q= ףK@R(@p= ףK@RQ(@\(K@)\()@K@R(@ L@'@33333K@)\(&@K@H&@ ףp=JK@)\((@(\uK@&@ ףp=jK@)\&@ ףp=JK@)\'@(\UK@)\((@ ףp=jK@)\('@(\uK@&@ ףp=jK@PGz2@ ףp=L@Q+3@(\L@Gz2@L@@2@ ףp=L@2@p= ףL@2@L@Q+3@(\L@Qk2@p= L@Gz2@L@HGz5@ M@Q+7@(\OM@Gz5@ ףp=*M@Q+6@ M@Q6@fffff&M@Q+7@@M@GzT6@(\OM@Gz5@ ףp=*M@@GzT6@\(\M@7@ ףp=M@GzT6@q= ףpM@Qk6@\(\M@7@ ףp=jM@6@ ףp=M@GzT6@q= ףpM@GzI@HzG? ףp=JM@Y\(\ ףp= I@\(\I@ ףp=*I@q= ףp (\I@ ףp=JI@Q(\UI@Q@I@zG`I@(\(\UI@{Gz?(\UI@q= ףp? ףp=jI@Q?I@(\? ףp=I@?I@HzG?J@HzG?(\5J@HzG?`J@?(\uJ@(\?(\uJ@?(\UJ@ ףp=jJ@Q? ףp=J@(\?(\µJ@{Gz(\J@пK@(\5K@zG ףp=JK@K@zGK@ ףp=K@q= ףpL@Q L@Q L@q= ףp ףp=JL@QL@q= ףp ףp=L@zG(\L@(\L@q= ףp (\L@Gz ףp=L@QM@ ףp=*M@q= ףp ףp=JM@\(\@M@@M@\(\ ףp= M@L@\(\(\µL@\(\ ףp=L@Gz(\µL@(\•L@\(\(\•L@(\UL@ ףp=*L@Gz@L@ ףp= L@GzK@\(\K@\(\(\µK@\(\ ףp=K@GzK@\(\(\uK@ ףp=JK@`K@ (\uK@Q @K@q= ףp (\K@q= ףp(\K@J@ ףp=J@Q J@ ףp=J@\(\ ףp=J@Gz`J@\(\`J@\(\ J@\(\ ףp= J@Gz ףp=I@ ףp=I@\(\(\I@Q ףp=I@Q ףp=I@q= ףp ףp=I@(\•I@ (\•I@\(\(\•I@`I@(\5I@\(\ ףp= I@Gz$I@\(\K@Gz$(\J@Gz.$I@Gz.#I@! ףp=I@ I@ ףp= J@\(\(\J@Gz ףp=JJ@J@\(\J@(\J@\(\ K@`K@\(\ ףp=K@(\•K@K@ ףp=K@ףp= W!(\UK@ףp= W @K@! K@Gz." K@# K@$(\J@#J@$J@#(\•J@"(\•J@#(\UJ@#(\J@Gz$(\J@h)\(!@ ףp=D@#@E@ RQ!@@E@)\(!@ ףp= E@RQ!@D@RQ"@ ףp=D@)\"@ ףp=D@#@(\E@R"@@E@R"@E@RQ"@(\UE@RQ!@@E@RQ @ ףp=jC@#@D@RQ @(\uD@RQ @ ףp=JD@R @(\D@R @(\C@)\ @(\•C@!@ ףp=jC@)\("@(\•C@#@(\•C@RQ#@ ףp=C@#@D@#@(\5D@RQ#@ ףp=jD@"@D@!@(\uD@R @ ףp=jD@RQ @(\uD@)\(@(\UB@RQ/@ C@)\(@(\B@RQ)@B@*@B@RQ+@(\•B@RQ,@ ףp=B@-@`B@RQ.@(\UB@)\.@B@RQ.@ ףp=B@)\.@ ףp=B@RQ/@ C@.@ ףp= C@,@C@RQ+@C@*@(\C@)@(\C@)\(@(\B@Gz5@(\5B@Q+7@ C@Gz5@B@Gz5@(\µB@5@B@Q5@`B@Gz6@`B@GzT6@(\5B@Q6@`B@Gz7@(\5B@Gz6@B@Q6@(\µB@Q+7@ ףp=B@Gz6@ ףp=B@GzT6@ ףp= C@Gz5@ C@GzT5@ ףp= C@Gz5@B@7@33333sA@@:@ ףp=A@7@(\•A@8@(\•A@8@ ףp=A@Gz8@33333sA@9@(\uA@Q+:@\(|A@@:@A@9@ ףp=A@9@ ףp=A@Q+9@fffffA@8@(\µA@@8@ ףp=A@Q+8@A@Gz7@ ףp=A@7@(\•A@ @@ ףp=JA@@A@ ףp=A@ @@A@(\5@@(\UA@@@ ףp=JA@@@YA@(\@@(\uA@ ףp= A@(\uA@(\@@(\•A@@A@ ףp=A@(\@@(\µA@(\µ@@ ףp=A@@@A@`@@ ףp=A@ @@A@H@(\C@\(\ @(\C@@ ףp=C@(\@C@p= ף@(\C@\(\ @(\C@\(\@(\C@@ ףp=C@@Q;@q= ףA@@<@9B@Q;@(\B@;@q= ףA@Gz<@ ףp= B@@<@9B@Q;@(\B@0:@fffffC@@:@fffffC@:@\(C@@:@fffffC@@:@fffffC@(:@ C@:@@C@:@@C@:@ C@(Gz<333333C@Gz.<)\HC@Gz<)\HC@Gz.<333333C@(ףp= 9fffffB@Gz.9fffffB@ףp= 9fffffB@Gz.9fffffB@Hףp= 0<@Gz.0Gz<@ףp= 0GzT<@ףp= 0<@ףp= W0Q+<@Gz.0Gz<@0zGa<@ףp= 0GzT<@HQ/;@Gz.Q+<@Q/<@ףp= W/;@Gz.Gz;@(\.Gz<@ףp= W/Q+<@Q/<@`,Gz<@ףp= *Q+=@ ,Gz<@Gz+@<@Gz+Gz<@+Q<@ףp= *Q+=@ףp= W+Gz=@Gz+Gz<@,GzT<@,Gz<@@!@ @R!@@!@p= ף @!@ @R!@p= ף @RQ!@@!@p= ף @8\@ףp= C33333b@ףp= ?d\@ףp= A\@Q+Afffff]@QkA,]@AL]@Al]@A33333]@Afffff]@`A]@ףp= 7A]@ףp= 7A33333]@Afffff^@ףp= @333333^@Q@33333S^@Q@y^@Q@fffff^@Q@fffff^@Q@fffff^@Q@_@@fffff_@@333333_@Qk@L_@ףp= W@33333s_@Q+@̌_@ףp= @_@ @_@ףp= @`@Q @33333`@ףp= ?33333#`@Gz?fffff6`@ףp= ?I`@ףp= ?Y`@ףp= ?i`@ףp= ?y`@?`@@`@@̬`@ףp= @̼`@Q+@`@QK@fffff`@@`@@`@@`@ףp= A`@QKAfffff`@A`@QKA a@ Afffffa@ףp= @)a@ףp= @0a@ףp= @9a@Qk@)c@>,c@=0c@=fffff6c@Gz<0c@Gz.<)c@ףp= ;fffff&c@ףp= ;33333#c@:33333#c@ףp= :c@933333c@ףp= 9fffffc@ףp= 8b@ףp= 8b@Gz7b@ףp= 7b@Gz.7b@Gz6b@Gzn6b@ףp= 6b@Gzn6b@Gz5b@Gzn5fffffb@ףp= 5b@ףp= 4b@Gzn4b@Gz.4yb@ףp= 3pb@Gzn3`b@ףp= W3Lb@3Ib@Gz233333Cb@ףp= W2fffffFb@ףp= 133333Cb@ףp= W19b@10b@ףp= 00b@0)b@/)b@.b@ףp= W-33333b@Gz,33333b@-a@Gz,33333a@+33333a@*a@ףp= W)33333a@ףp= W(a@ףp= W'a@Gz.&a@Gz%33333a@&33333a@Gz'fffffa@ףp= W(fffffa@ףp= W)fffffa@*fffffa@Gz.+33333a@Gz.,33333a@Gz.-fffffa@Gz..33333a@Gz./a@ףp= 0a@ףp= 0a@1a@1a@1a@ףp= 1la@Gzn1ffffffa@1fffffVa@ףp= 033333Ca@ףp= 0fffff6a@ףp= W0)a@033333a@0 a@/a@Gz.33333`@.fffff`@Gz.-a@,a@Gz+a@Gz*33333a@Gz*fffffa@Gz) a@ףp= (a@Gz.(33333a@Gz.)`@ףp= W(`@Gz(fffff`@ףp= W(33333S\@ףp= Afffff`@ףp= &]fffff`@ףp= W(33333`@(`@ףp= '`@Gz.'`@ףp= &fffff`@Gz'̌`@Gz(fffffv`@Gz(33333c`@Gz(P`@)fffffF`@ףp= W*L`@Gz.+<`@ףp= W+9`@Gz.,)`@-9`@Gz-fffff6`@.33333#`@ףp= -fffff`@ףp= -fffff`@.fffff`@-33333_@ףp= ,_@,33333_@ףp= +fffff_@,fffff_@Gz,y_@ףp= W-L_@ףp= W-L_@Gz..,_@/fffff&_@033333_@Gzn033333^@Gz.0fffff^@Gz0^@1^@1^@ףp= 1^@0fffff^@1̌^@Gzn1̌^@ףp= 133333^@Gz.2y^@ףp= 2l^@ףp= 333333S^@Gzn39^@333333^@ףp= 333333]@4]@433333]@ףp= W4̌]@ףp= W4l]@Gz4L]@Gz4,]@Gz433333]@ףp= 433333\@ףp= 5\@5fffff\@Gz5fffff\@Gz533333\@ףp= W6fffff\@ףp= 533333s\@@6l\@Gz633333s\@ףp= 733333s\@7Y\@Gz7`\@Gzn8l\@9y\@Gzn9̌\@ףp= 9̌\@Gzn:l\@ףp= :`\@Gz933333s\@ףp= :33333S\@Gz.:`\@Gz:y\@;̌\@Gz;̌\@ףp= \@>\@?fffff\@Gzn?33333\@?33333\@Q+@\@ףp= w@33333\@@fffff\@@\@Q@\@ףp= AX33333C`@(p`@Gz&33333C`@Gz'fffffV`@Gz'``@(p`@Gz.'i`@Gz&Y`@'I`@Gz&33333C`@Gz'P33333a@ףp= B33333Ca@ףp= A33333a@ףp= Aa@ףp= B333333a@ףp= B33333Ca@ףp= A,a@ףp= Aa@A33333a@ףp= Ab@QEb@ףp= WDb@ףp= WDb@ףp= D b@Dfffff&b@ףp= E)b@@E0b@ףp= wE9b@EfffffFb@EYb@QEffffffb@ףp= Epb@QkE|b@QEb@QKEfffffb@ףp= Eb@Eb@Db@Db@QkDib@DYb@ףp= DfffffFb@ףp= D0b@QkDb@ףp= WDe@QDPf@@A5e@QCfffffe@ףp= Cfffffe@QC33333e@Dfffffe@Q+D33333e@ףp= wDe@QDfffffe@QDe@ףp= Dffffff@D f@ףp= WDf@ D f@Cf@C33333#f@C0f@QCQ5Sףp= W< S;QS:QR8QRGz7Rףp= W6QRGz4QRףp= W3pRGz1Q[Rףp= W0QERףp= W-Q;R+Q5RGz(Q%RGz&Rףp= W&QQ(QQףp= W(QQ'Q&QQ%Q#Q"QQףp= W!QQ!QQ\(\QQGzQQ\(\QQGzQQ\(\Q\(\Q\(\QQQQQQQQQ QQQzGQQQQQ(\QQHzG?Q\(\@QQ @QQp= ף@QQRQ@QQRQ@QQRQ!@QQ$@QQ)\&@QQRQ)@QQ8RQ)@QQY@QuPdRQ)@QQ)\,@QQRQ/@QQ1@QQGzT2@QQ4@QQ5@QQ7@QQQ8@QQGzT9@QQ;@QQGzT<@Q{Q>@QuQGzT?@QeQ@@`Q@@`Q ףp=@@@Q@@Q+Q ףp=*A@Q%QA@Q;QB@QUQB@`Q ףp=*C@QeQ(\UC@QQ ףp=C@QkQ ףp=C@`Q ףp=C@QKQD@Q5Q ףp=D@ QE@Q Q ףp=E@QP@F@PG@PG@QP(\H@QP@H@QP ףp=H@QP ףp=H@QP@I@QP(\I@P@I@PI@P(\J@Q{P(\J@QuP(\•K@Q{PL@P(\•L@QP(\•L@QP ףp=*L@PL@QPM@PM@QP ףp=M@P(\UN@QP(\N@QP(\UO@QP(\O@P@P@QPGzP@P{GP@QP{G*Q@QP`Q@QP`Q@Q QQ@Q%QQ@@Q`Q@QKQGztQ@QeQGztQ@QQ{GQ@Q{GQ@QQQ@QQGzR@pQ`R@QeQR@QkQR@QuQ{G S@`Q{GJS@QKQS@QEQGzS@ QS@Q T@Q{GjT@QPT@QP{GT@QP@U@PGzU@QP{GU@QP V@P{GjV@PV@QPW@P@W@QPW@QPW@PX@QP@X@P{GjX@QPX@PGzX@QPY@QP8Y@QUS`e@pPdY@QP,Y@QP`Y@QP̬Y@QuPZ@Q{P@Z@QPZ@PZ@P[@QP@[@QP`[@QP33333[@QP̬[@QP̬[@QP[@Q{P,\@QuPl\@pP\@P\@QP ]@Pl]@P]@QP33333^@QP`^@QP^@QP33333^@P33333_@P333333_@P33333s_@QP_@P_@P_@P `@QP `@P0`@QP@`@QP@`@QPY`@QP`@QP`@QP`@QP`@QP a@QP)a@QPIa@Pia@QPa@QPa@Pa@Pa@QP b@P b@P b@QP@b@PYb@QP`b@Qb@QQb@Qb@ Qb@QQb@Q+Qfffffc@Q%QIc@Q%Q`c@QEQc@QUQc@@Qc@QEQfffffc@PQd@`Q d@QkQ d@QQfffff&d@Qfffff6d@QQfffffFd@QQId@QQid@QQffffffd@QQfffffd@QQd@Qd@QQfffffe@QQ@e@QfffffFe@QQ`e@QfffffFe@RPe@ Rfffff6e@Q5Re@QKRd@PRd@QkRfffffd@QRd@QRd@Rd@QR`d@QRfffffVd@QRfffffVd@QS`d@ Sid@Q;Sfffffvd@QUSd@QTf@QUSfffffvd@QUSfffffvd@pSfffffd@Sd@QSd@S0d@Sd@QSd@QSd@T d@ T d@@T d@`TId@Q{Td@QTd@QTe@Tpe@Tf@Tf@QTHd@QkSfffff6e@QESd@QeSfffffe@QkSfffff6e@Q[Sfffffe@QUSfffffd@QESd@QeShdTdS dS`dQSQvdQSQvdQSQ6dTdQSdSQdQSQ6dSdS @Qb0SQfbQ SQbQ%Sb0SQfbQSQbQ SQbQ%S  SQ+RQQQ5QQ SQQ SQQSQQRQQQRQ RQURR@RQ%RQQ+RQQ%RQ5QQR QQQQQQ QQQ5QQQUQQQkQQ[QQQQ5QQQQ;QQQQEQQQeQQQQQQQQQQQQQQQ@RQQRQQQ SQQ `Q SQQQkRpQ Q SQQRQQRQpRQQkRQ{QRpQRQQRQQ SQQ XQPQ5POPQPQ+POQ5POQ%POQP@OPOQ%POPQPQ+P @@LOKO@LOLOKףp= OQKO@LO`N`Oףp= LO Nףp= WOQ+N`OQMQ+Oףp= WM Oףp= LOQkMOQMQ+OQ+N@ONףp= WO8Q+G{GZNFQ+NQ+GRQNF{GZNGQ+NQ+GRQN8QUTQKDQQdQT T(\տ TzGQ;T0TzG0Tq= ףpQ;TQQ%TQ TQTQSQSQTQ QT fffffTGz Q5TQQUTQUTGzQKTGzQ5TGzQKTQ5TQTT\(\QSS\(\Sףp= W QSףp= W!Sףp= W"QSףp= W#QSףp= W$QkSGz%`SGz&QKSGz'@Sףp= W(Q+S) S*Q Sףp= W+Sףp= W,QRףp= W-R.QRGz.R/RGz/`R@0Q5Rףp= 0 RGz0R1Q@1QQGz1QQףp= 1QQ@2QQ\(2QQ2Qףp= W3QQ4QQ4QQ5QQ5QQ6Q6Q7Q7Q8QQ8Q9QGzn9Q9QQףp= W:QQ;QQ;QQ<Q<Q=QQףp= W=Q>QQ@>QQ>QQףp= W?Qףp= ?Qףp= @QQ@@QQףp= @QQףp= @QQAQQ@AQ RA RAQ+RBQ5R@BQERףp= WBQERףp= B`Rףp= BQkRBQ[Rףp= CQ[RQKCQURCPRCQkRDQkRQKD8QRQJQkPQKDdQkRQKDQuRDpRףp= DQeRDQKRQD@RD Rףp= D0RE Rףp= E0RQ+E0RE@Rףp= EQ5REQKRףp= F@Rףp= 7FQ[Rףp= WFQURFQeRFQkRףp= FQuRFQeRףp= WFQkRףp= 7F`Rףp= FQuRQERףp= FRQKFQRFRFQRQFRQFRףp= FRףp= GRQKGRףp= wGRףp= WGRQkGRQkGQRףp= GRQGRQ+HQRGQRQGQRףp= HQRQKHQRףp= HQRףp= HRQHRףp= HQRףp= IQR`IRIQRףp= 7IR`IQRףp= WIRףp= IQRQIRQIQRIQRIQRQIRIR JRףp= 7JQRףp= JRQKJ`Rףp= WJ`Rףp= wJQKRףp= J Rףp= JRףp= JQ`JQQQkJQQףp= JRףp= JRףp= JQQJQQJQQJQ`JQ@JQeQ@J`Q J@Q JR!Q)\(JQQQ+JQ5QQI@Qףp= IQKQI@Q@I Qףp= IQPIQPHPHPףp= WHQPQ+HQuPHQkPGpPףp= GPףp= GPQkG8PQkGD@6dPQkGQP@GPGQPFQPFQPFQePFQePףp= WFQKP@FQKPFPPףp= E@PQEQPE@PQkE P@EQ PQkEףp= OQkEQOQKEOQ E PQ+E@PQ E@PDQKPDQ5P`DQPDQOףp= DOףp= DQ+Oףp= wD OQKDףp= 7OQ+Dףp= OQCOCQ+Oףp= C O`COCNC@Nףp= wCNQkCQM`Cףp= WMQKCףp= Mףp= 7CQLףp= Cףp= LBLQBףp= WLQkB`LQ+Bףp= L Bףp= LQAףp= LQALAQ+Mףp= WA@MQ+AQ+MA)\(Mp= AQLףp= 7Aףp= Lףp= 7AQkLףp= WA LQkAףp= K`AKQkA@K`AK@AQJףp= AJQ@GzJp= @J@QKJ@ףp= 7J@@Jףp= @Iףp= ?I?ףp= WI?Q+I>ףp= I>QH=ףp= H=HGz<`H@QkVGz>@QV>@QVGz>@QV>@QkV@>@QKV>@0V>@VQk>@VQ>@QUGzT>@QUGzT>@QUQk>@QU>@U@>@`UGz>@QUUQ=@Q5U=@QU>@QTGz>@T=@QTQ+=@QTGz=@QTGz<@TQ+<@TGz;@QTQ;@QTQk;@TGz;@QT:@Q{TGzT:@QkTGz9@PT9@QETGz9@Q+TQ+9@QTGzT9@Q TGz9@QTQk:@QT;@QTGz;@Q%TQ+<@Q%T<@Q;T=@QET=@QUT>@Q[T>@`T?@PT?@@T@@ T(\5@@T(\U@@S@@QS ףp=@@QS(\@@QS(\@@SA@QeS ףp=*A@QKS(\UA@Q%S`A@QSA@Q5SA@QS ףp=A@S ףp=A@QR ףp=A@QR(\A@S(\A@0S(\A@QS ףp= B@S(\B@R ףp= B@RA@R ףp= B@QR@B@S ףp=jB@QS(\•B@QSB@QS(\B@Q;S C@QS(\C@ S@C@Q%SC@QS ףp=C@SC@Q S(\•C@Q S ףp=jC@QS(\5C@QR C@SC@QRC@QR(\B@S(\•B@8S(\•B@QMH@dS(\•B@RB@QRB@R(\C@R(\5C@QRC@QRC@R ףp=C@RC@R ףp=C@QR ףp=C@R ףp=*D@QR@D@R ףp=jD@`R ףp=D@@RD@ RD@RD@Q(\µD@QQD@QQD@QQ(\D@QQD@Q(\D@QE@QD@QD@QQ(\E@Q ףp=*E@Q ףp=JE@QQ ףp=jE@QQ(\•E@QE@Q(\E@pQ ףp=E@QKQF@Q5Q(\5F@Q%Q F@Q(\5F@P ףp=JF@P ףp=jF@P(\uF@P(\•F@P(\•F@QeP ףp=F@Q5P(\F@Q;P ףp=F@P(\µF@Q;P ףp=F@QUP(\uF@Q{P ףp=JF@QP(\F@PE@`PE@@P ףp=E@ P(\F@Q P@F@ףp= O@F@O`F@OF@ףp= N(\•F@NF@ףp= 7N(\F@QMG@@N ףp=*G@ףp= 7N ףp=jG@ףp= WNG@N ףp=JG@N(\G@NF@O ףp=F@QKO(\F@OF@P ףp= G@Q%P G@Q;P`G@@P ףp=G@Q5PG@QkP ףp=G@QP ףp= H@QUP ףp= H@Q5P H@P@H@P ףp=jH@Q%P ףp=H@PPH@P(\•H@P ףp=H@QP ףp=jH@Q(\UH@Q+Q(\5H@PQ ףp= H@QkQ(\G@QQ ףp=G@QG@QQ ףp=jG@Q(\•G@QQG@Q ףp=G@QkQ(\H@8S(\H@ףp= K@O@dQkQ(\H@PQ ףp=JH@Q+Q(\uH@Q ףp=H@QP ףp=H@QPH@P ףp= I@P I@Q[P I@0P I@P ףp=*I@ףp= O I@QkO I@ףp= O I@ףp= N ףp= I@ףp= wN(\I@N(\I@M@I@QM ףp=jI@ףp= WM(\•I@QL(\µI@QkLI@ףp= L ףp=I@ףp= K ףp= J@L`J@QK(\•J@@L(\J@L(\J@QL ףp= K@Q+M(\K@L@K@M`K@ףp= wM ףp=jK@M(\•K@Q+NK@@N(\K@QN(\K@N L@N`L@QN ףp=L@QN ףp=L@QN(\L@Q+OM@QkO@M@OM@QOM@QPN@Q+P ףp=*N@QKPN@QePM@PP(\µM@QkPM@QP`M@P(\5M@P(\M@QQ`M@@Q ףp=jM@`QM@`Q ףp=M@Q[Q ףp= N@QkQ@N@`Q(\uN@QN@QN@QN@Q ףp=N@R ףp=N@Q;R(\O@QkR(\5O@QR O@R O@QS(\5O@Q[S@O@QS O@QS ףp=N@`S ףp=N@pS(\•N@QS`N@QeS@N@Q[SN@Q[S ףp=M@Q{S(\•M@QS ףp=M@QS`M@QS(\5M@`S M@QKS(\L@@SL@0S(\UL@0SL@PS ףp=K@S(\•K@S ףp=jK@S ףp=JK@QS(\K@QSJ@QS(\•J@QS(\UJ@QS(\J@S(\I@80XI@S{GR@dS(\I@QS ףp=I@SI@QT ףp=I@0TI@PT ףp= J@QkT@J@QT(\uJ@QT(\µJ@QT ףp=J@QT K@QTK@TK@UK@@UK@U(\K@QU ףp=K@UL@QV(\5L@@V`L@V(\uL@VL@V ףp=L@QW(\uL@QWL@Q+W(\L@Q+W ףp= M@QEW(\UM@pW`M@QW(\UM@W ףp=M@W ףp=M@QW(\N@QW ףp=JN@QWN@QkWN@QKW(\N@ W ףp= O@ W ףp=JO@QV`O@QV(\uO@QV(\µO@VP@ VP@U P@U@P@U`P@U{GP@UP@`UGzP@QEUGzP@T{GP@QTGzP@Q[TP@QKTGzP@QTGzP@QTGzQ@QUTGz$Q@QUTLQ@TGzTQ@QT{GjQ@UGztQ@`UGztQ@`UGzTQ@Q[U0Q@Q[U{G Q@UGzP@U{GP@UP@Q VGzP@VGzQ@V0Q@Q;VPQ@Q{VGz$Q@QVGzDQ@QV`Q@QWpQ@QV{GQ@QV{GQ@Q+WQ@`W{GQ@QW{GQ@`WR@WGz$R@QEW0R@QV0R@QV{GJR@QVGzdR@QVGztR@QVzGR@QKW{GR@QWR@QWGzdR@W{GJR@W{G*R@WR@WQ@QWQ@X= ףpQ@0X{GQ@8RdGzdP@WGzQ@d0X{GQ@QWGztQ@W{GZQ@QW@Q@W Q@QWQ@WQP@QWP@Q5XGzP@Q;XQQ@QW0Q@QXGzTQ@Q{XGztQ@QXGzTQ@QX@Q@XGz$Q@QXQ@X{GP@YGzP@p= sYP@YRQ@ףp= 'ZfffffQ@= ףpmZ9Q@ ףp=Z0Q@p= [Gz$Q@@[Q@p= ZQ@= ףp [GzP@p= S[P@p= ד[Q@ףp= [GzP@@\{GP@= ףp\GzP@p= \GzP@ףp= \{G Q@ףp= \33333Q@= ףp\= ףp-Q@]= ףp=Q@`]@Q@p= ׳]= ףpMQ@p= ^= ףp]Q@p= S^GztQ@^GztQ@^HzWQ@p= _{GZQ@ ףp=_Q@p= S_{GZQ@= ףp_GzdQ@= ףp_GzQ@`GzQ@`Q@Q-`GztQ@R9`Q@Qf`Q~Q@Q`{GjQ@R`QXQ@Q`GzdQ@Q``Q@Q`{GJQ@a0Q@R)a@Q@RIaGzTQ@paGzdQ@aHzgQ@aQhQ@RaGztQ@RaGzQ@bGzQ@Q#bQ@QFb= ףpQ@pb= ףpQ@b= ףpQ@RbQQ@bQQ@cHzQ@RIcHzQ@RYcQQ@RcGzQ@QcHzQ@cGzQ@Q d{GQ@Q3dGzQ@QVd{GzQ@`d\Q@pdGzDQ@Rd{G:Q@dGz4Q@QdGzQ@RdQP@d{GP@pd{GP@PdGzP@Q6d{GP@QFdGzP@QvdGzP@RydP@QdP@QdP@RdP@RdGzdP@8Rd ףp=*K@Q`GzdP@dRdGzdP@Rd{GZP@RdGzTP@Qd@P@Rd{G*P@Qd P@QvdGz$P@QVd{GP@Q=d{G*P@ dGz4P@R)d{GP@QdP@ dO@RId(\µO@`dO@Q}dO@QdO@Rd(\UO@d(\O@dN@Rd ףp=N@Qd ףp=JN@Rd ףp= N@Ryd(\M@`d(\M@QFd ףp= N@Q6dM@Q=d(\•M@Q3d`M@ d(\uM@Qc(\uM@Qc(\5M@Qc`M@c(\UM@Qc`M@c(\M@Qc ףp=L@RcL@c ףp=jL@Qc@L@dL@Q-d(\K@RId(\K@Q]dK@Q}dK@Qd ףp=JK@Qd ףp=*K@Qvd(\UK@RYdK@@d(\•K@Q-d(\µK@d ףp=K@Qc ףp=K@QcL@Qc(\5L@Qc(\UL@QcL@Qc(\µL@Qfc ףp=L@RIc(\M@R9c@M@R)c(\uM@QCc ףp=M@R9c(\µM@Q#c(\M@c ףp= N@Qc ףp=JN@Qb(\uN@QbN@QbN@Qb(\uN@Rb`N@Qb(\N@Qb(\M@QbM@Qb(\•M@QbM@Qb ףp=M@b(\M@Qb(\M@Qb(\5N@RbN@pb ףp=jN@QVb ףp=jN@@b ףp=JN@ b N@bN@aN@aN@QaM@Ra(\M@Qva(\M@pa(\µM@QVa(\•M@Q=a`M@R)a(\5M@a(\M@Qa(\L@`L@Q``L@8Q`B@ףp= ^(\UM@dQ``L@Q`(\L@Q` ףp=jL@`(\µL@`(\L@Q` M@Q` M@`(\UM@Q` M@Q`(\L@`(\µL@`L@`L@Q` ףp=L@Q`L@`(\uL@R` ףp=L@R``L@Q` L@Q` ףp=*L@Q`(\K@Q` ףp=K@Q` ףp=K@` ףp=K@Q`(\UK@Q`K@Q` ףp=K@` L@` ףp= L@` ףp= L@Q`K@Qv` ףp=K@Ri`K@RY``K@QC`(\uK@QC`(\uK@QM`(\5K@QF`(\K@RY`(\J@RI`(\µJ@R9`(\•J@Q&` ףp=JJ@Q ` ףp=*J@Q` ףp=I@p= _I@p= _(\•I@_ ףp=jI@= ףp_(\UI@`_(\5I@ ףp=:_ ףp= I@p= _H@p= ^H@= ףp^H@= ףp^H@p= ׳^H@= ףp^{GzH@ ףp=^ ףp=JH@ףp= ^(\5H@= ףp^H@^G@ףp= ^(\G@^G@ףp= ^(\G@= ףp^(\H@p= ^(\H@= ףp-_(\5H@p= 3_(\H@ףp= '_(\G@p= _G@ףp= _G@_(\UG@ ףp=^ ףp=*G@= ףp^(\G@ ףp=^(\G@ ףp=^ ףp=F@p= ^(\µF@_F@_@F@ףp= _F@p= _(\µE@ _ ףp=jE@ ףp=_ ףp=*E@= ףp _E@_D@ףp= _D@p= _@D@p= _ D@_D@p= ^(\C@p= ^ ףp=C@= ףp^(\uC@p= ^ ףp=JC@ ףp=^ ףp=*C@^C@^(\B@^(\C@= ףp^ ףp= C@p= ד^(\B@ףp= ^B@^B@8^6@ZB@d^B@ ףp=^ ףp=B@= ףp^B@p= s^B@p= s^ ףp=JB@ ףp=z^ ףp=*B@ ףp=Z^B@ףp= G^ ףp=A@ףp= '^ ףp=A@ףp= '^ ףp=JA@p= ](\5A@p= ] A@p= ׳] ףp= A@ ףp=] ףp= A@p= ד]@@]@@`](\µ@@= ףpM]@@ףp= G]@@@ףp= G]\(<@@= ףp-]@@ףp= ']Gz?@p= ]@?@p= ]?@]>@]GzT>@= ףp\@>@= ףp\Q=@= ףp\=@= ףp\Gz=@p= ד\<@\Qk<@\<@ ףp=\;@\Gz;@\;@p= ד\Q+;@\;@ףp= g\:@= ףpM\:@p= 3\Qk:@p= \Q+:@ףp= \Q9@ףp= \Q+9@p= \Gz8@= ףp[Gz8@p= [@8@p= ׳[Gz7@p= ד[7@[Gz6@ ףp=Z[GzT7@= ףpm[7@= ףp[@8@ףp= [@8@p= ׳[Q8@= ףp[Gz8@[Q+9@[9@p= [:@[:@\;@p= \;@= ףp-\Gz;@ ףp=:\GzT<@= ףpM\<@= ףpm\Q+=@\Gz=@ ףp=\Gz=@= ףp\Q+>@ףp= \Gz>@= ףp\?@p= ׳\Qk?@= ףp\?@= ףp\?@p= s\Gz?@`\GzT?@ףp= G\Q+?@ףp= G\>@p= 3\@>@= ףp-\Q=@ ףp=\=@= ףp \=@= ףp[<@= ףp[<@ףp= [Q;@ףp= [Qk;@[;@= ףpm[Q:@`[Q:@p= S[GzT:@ ףp=Z[:@ ףp=Z[9@@[9@p= [@9@[Q8@ףp= ZGzT8@= ףpZ8@p= ׳Z7@ ףp=ZQ+7@Z6@8Z\(\ @QKS6@dZ6@= ףpmZQk6@`Z5@= ףpMZ5@= ףpMZQ+5@`ZGz4@p= SZGz4@= ףpmZGzT4@p= SZGz3@ ףp=:ZGzT3@p= ZGz3@p= Y2@YGzT2@p= ׳YGz2@= ףpY2@Y2@ףp= gYQ1@@Y@1@ YGz1@YQ0@XQ0@XGz0@XGzT0@XGz0@Q[X0@Q5X)\/@XRQ/@QWR/@QWQ+0@QWQ+0@WGz0@QuWR/@Q[WRQ/@QKWR.@0W.@QWRQ-@\( W-@W)\,@V)\(,@VR+@VR+@\(V+@VRQ+@pVR*@QUVR*@Q5VRQ*@QVRQ*@QURQ*@\(UR*@QUR*@QU*@ףp= U*@QU*@QU)\()@U(@QU)\'@QU'@pURQ&@pUQ8&@pU%@QuU)\$@QkUR#@QUU)\#@QKURQ#@Q5U$@Q%URQ#@U)\"@QT"@T!@TR @Tףp= W @TRQ @T)\ @T @pT)\( @`T@@T@Q;Tp= ף@ T@T@QTRQ@ TRQ @QT)\ @S)\(!@S"@QS"@S!@S)\ @QS)\ @QS @QSp= ף@33333SQ@pS@Q[SRQ@`Sp= ף@Q[S@Q[S@QUS@`S@QKS\(\ @xQTQKS\(\ @ QKS\(\ @`S @pS\(\@QS\(\@QS\(\@QS?SQ?QS?fffffSףp= ?QS?Tq= ףp?QT ףp= G_Gz4P@= ףpm]GzP@ףp= G_GzP@ףp= ^QP@^P@@^P@^pP@p= ׳^GzdP@= ףp^@P@p= s^@P@ףp= g^GzTP@= ףp-^{GjP@ ^GzTP@@^Gz4P@p= ]HzWP@^GztP@ ףp=]{GjP@ףp= ]GzP@= ףpm]{GP@ףp= ]GzP@ ^{GP@p= ]{GP@ ףp=]{GP@^GzP@p= S^P@= ףp^GzP@p= ^HzP@ףp= G_GzP@!@] ףp=jN@@[ ףp=jO@@](\•N@] ףp=jN@p= \ ףp=jN@ ףp=\N@ ףp=z\(\uN@= ףpm\N@ ףp=:\(\µN@= ףp \ ףp=N@p= [ ףp= O@ ףp=[ ףp=*O@p= s[(\5O@= ףp[(\UO@@[(\UO@[ ףp=jO@= ףp[ ףp=jO@ףp= [(\UO@ ףp=[(\5O@ ףp=\ ףp= O@ףp= G\O@p= s\(\O@= ףp\(\5O@p= \(\5O@ףp= \(\O@\ ףp=N@p= \N@p= \(\µN@p= \(\•N@@](\•N@"p= [ ףp=JM@ ףp=Z(\M@ p= [(\UM@p= ד[ ףp=JM@[(\uM@p= S[ ףp=M@p= [ ףp=M@ ףp=ZM@[(\µM@ףp= '[(\µM@= ףpM[(\M@= ףpm[(\M@= ףp[M@= ףp[M@p= [(\UM@#pףp= Y ףp=*L@ףp= gY(\M@ ףp= Y ףp=*L@= ףpY ףp=JL@= ףpYL@= ףpY(\µL@ףp= gY(\L@ףp= Y(\M@YL@p= ׳Y(\µL@YL@p= ׳Y(\UL@ףp= Y ףp=*L@$X ףp=*I@Q XJ@X ףp=J@QXJ@QX@J@QX J@QX(\I@Q[X(\I@QUX(\µI@Q5X ףp=I@Q;X(\•I@@X`I@@X ףp=*I@QX@I@Q X(\•I@Q%X ףp=I@@X(\J@PX(\UJ@QeX(\•J@QuX(\J@QXJ@XJ@X ףp=J@%= ףpMY(\I@X ףp=J@= ףpMY ףp=J@p= 3Y ףp=JJ@ ףp=Y ףp=jJ@Y ףp=JJ@= ףp Y ףp=*J@= ףp Y ףp=I@QX ףp=I@X(\•I@X ףp=jI@QX@I@X(\I@X I@X(\UI@QX(\uI@QXI@QX(\I@QXI@QX ףp=I@QX(\J@QX(\5J@QX`J@= ףp Y ףp=J@= ףpMY ףp=J@&8QW(\5G@ UH@$QW(\UG@QV(\UG@QV(\uG@V@G@pV`G@@VG@V(\µG@U(\µG@QV ףp=G@QV`G@U ףp=jG@QU(\5G@QU(\5G@QuU(\UG@@U`G@@U@G@ U@G@ U@G@0U(\uG@Q+U ףp=G@@U ףp=G@@U(\G@pU(\G@QU H@U`H@QU`H@QVH@QV(\UH@QEV(\5H@ףp= WVRH@Q[V ףp= H@QuV ףp=G@V(\G@V ףp=G@QVG@QW(\UG@'V(\D@S G@9V ףp=JF@U(\uF@U@F@QU(\F@U ףp=E@QU(\•E@QU`E@QU(\E@U(\D@QU(\D@QU ףp=D@QU(\E@U`E@QUE@U(\E@U ףp= F@U@F@QU(\uF@QUU(\•F@@U(\F@ U(\F@QUF@QT ףp=F@QTF@QT(\5F@QT(\E@QT ףp=E@QT(\E@QT ףp= F@QT ףp=E@QT ףp=E@QT ףp=E@pT ףp=E@pT(\E@`T(\5F@QUT ףp=jF@`T(\•F@Q;T`F@QT@F@S ףp=jF@T(\µF@0T(\F@QkT ףp= G@QT(\G@T(\G@QT G@Q U G@QU ףp= G@U(\F@Q5U(\F@PUG@pU(\F@UF@UF@QU(\µF@QUF@V ףp=JF@(HQTF@pT(\F@QT ףp=F@QT(\F@Q{TF@pT(\F@QT ףp=F@QT ףp=F@)TD@QS ףp=jE@TD@QTD@TD@QkT ףp=D@QET ףp=D@ TE@QS E@S@E@QS ףp=jE@GzS ףp=jE@S ףp=jE@Q T ףp=jE@ T ףp=JE@Q;T(\UE@`T ףp=JE@QuT E@TE@QTE@ףp= T= ףpD@TD@*S(\•E@QS ףp=*F@SE@S(\•E@33333S\(E@QS ףp=E@S ףp=E@Q[SE@Q5S ףp=E@Q SE@SF@fffffSfffff&F@QS ףp=*F@Q+S(\F@@S(\E@QkSF@QS(\E@QS ףp=E@QS(\E@SE@+XVq= ףpQV{Gz?QV{Gz?VQۿQV(\V(\QVq= ףpQV迅QV(\տQV{Gz?,hQRףp= EQURQD RQDQRQ+EQRףp= WEQRQEpRףp= E`REQkRףp= WEQURQ+EQ[RERQD-QRףp= KQKPQKJ50QQKJzG1QQKJQKQףp= WJ`QQKJpQQkJQQkJQQQJQQJQ[QQJQUQJQQJQ KQQףp= KQףp= JQףp= KQQKQRQJ RQJQURJRJQR`JRJRJ`RQJQuRQJQURQJQURQ KQ+RQ K Rףp= 7KRףp= 7KRףp= WKQQKQףp= KQKQuQQKQUQKQ+Qףp= KQףp= KQ QKQ QKQPKPKQkPKPPףp= wKQKPףp= WKQuPףp= WKQP@KP KQPKQףp= JQ QQJQJ0QQKJ.ףp= NQ+JLQIףp= NQI@N JNJףp= MQ JMQ+JQkM J@MJLQILIQ+MQIMIףp= MQI@Nףp= Iףp= NI@NJףp= NQI/XCףp= wKQAKCKB KQKB@KBףp= wKQAQKK BQ+KBQ KCK0XQN$@N%@QN$@N$@N$@N%@ףp= NRQ%@N)\(%@NRQ$@QN$@18)\HQp= #(@p= 3Q33333(@)\HQ33333(@p= 3Qp= #(@ ףp=:Qffffff(@)\HQ33333(@2QS1@S2@ QSQ+2@SQ+2@QkSGz1@PS1@Q;SQ1@Q%SGz1@SGz1@QSQ+2@Q5SGzT2@QUSQk2@QuS2@SGzT2@QSQ+2@3XQTQk5@T{G5@QT(\5@= ףpT5@p= TQx5@QTQk5@THz5@ ףp=TR5@QT{G5@QT(\5@4Q5UGz3@QRQ+7@9Q5UGz5@Q UGz5@UQ+6@QTQ+6@QTQk6@TQ6@TGz6@QeT6@QTGzT6@pTGz6@PT6@ T6@Q T5@SQ5@S5@SGz5@QSQk5@S5@SQ4@PSQ4@QESGzT4@Q[SGz4@QkSGz3@@SGz3@ SQ3@SQ3@RGz3@RGz3@QR4@QRGz4@R@4@R@4@QRGz4@QRQ4@QRGz4@QR5@SGz5@ SQ+5@@S5@Q[SQ5@QuSQ5@QSQ+6@QSGzT6@QSGzT6@QSQ6@QTGz6@ T7@@T7@`TQ+7@TQ+7@T7@TQ6@TGz6@UGz6@QUGzT6@QU6@Q5UGz5@5XRGz1@QQQ3@(RGzT2@QuR2@QkRQ+2@QKRQ+2@0RGz2@QRQ+2@QQGz2@p= Q 2@QQGz1@QQ2@QQ@2@QQQk2@QQQ+2@QQ@2@`QQk2@@QQk2@Q+QGz2@QQ2@0QQ2@QeQGz3@QKQGzT3@pQGzT3@Q{QQ3@Q3@QGz3@QQGz3@p= Q(\3@RQ3@Q%RQ3@QKRQ3@`RQ3@@RQ3@0RGzT3@0R3@QRGz2@0RGzT2@PRGzT2@QkR2@QRGz2@RGzT2@6`QPQ1@QkP2@ QP2@PQ1@QP2@Q{P2@QkP@2@P2@QP2@QP2@QP2@7PQNR/@QNQk0@QN@0@NR/@QNQ+0@QNQ+0@NQk0@QNQ+0@QN@0@88ףp= N(\,@QkN)\-@ףp= N)\-@QkN(\,@GztNL-@ףp= N)\-@9hQSQ7@`SQ+9@ SQ+9@QSGz8@QSGz8@Q{SQ+8@QkSQ7@`S8@pSGzT8@pSQ8@SQ+9@SQ+9@:HQkRQ4@@RGzT5@QkRQ4@QKRQ4@@RGzT5@QKRGz5@`RQ+5@QkRQ4@;XSffffff:@p= sS33333:@S33333:@= ףpS:@(\SQ:@\(|SQ:@p= sSQx:@S:@Sffffff:@S33333:@<@QeSQ9@ףp= GSQ:@QeSQ:@ףp= GSQx:@p= SSQ9@PSQx:@QeSQ:@=0(\/SQ8@)\S9@(\/S9@)\SzG!9@)\SQ8@>(QRQ+8@p= RQ8@QRQ8@p= RQ+8@?(p= RQ6@QRQ7@p= RQ7@QRQ6@@0QR3333336@QuRGz6@QRGz6@QuRR6@= ףpR3333336@A()\HRGzT6@(\/RQk6@)\HRQk6@(\/RGzT6@B0GzRQ5@GzQfffff5@GzRQ5@ףp= Rfffff5@GzQQ5@C(QuŤ8@p= STQ8@QuŤ8@p= STQ8@D0S ףp=A@QR ףp=A@S ףp=A@QRA@QR ףp=A@E`R ףp=JD@R(\•D@ R ףp=JD@QUR(\UD@Q+R`D@RD@QR(\•D@Q5RD@QUR(\uD@Q{R ףp=jD@R ףp=JD@FpQP ףp=H@ףp= N ףp=H@ QP ףp=H@O ףp=H@O ףp=H@ףp= wO(\•H@ O ףp=H@ףp= N ףp=H@O(\µH@@O ףp=H@QOH@O ףp=H@QP ףp=H@GpP(\F@O(\uG@ P(\UG@ףp= O(\5G@QO(\G@@O(\F@@O G@O@G@`O(\5G@QO(\5G@ףp= O ףp=JG@P(\uG@P(\UG@HPQT(\O@Q{T`O@QT(\O@QT O@Q{T(\UO@Q{T`O@QT`O@QT ףp=JO@QT(\O@IHQ TN@S ףp=*O@QT ףp=*O@Q TN@SN@QS(\N@S ףp=*O@QT ףp=*O@J`QTK@QS ףp=JL@ T L@QS ףp=*L@QT(\K@S(\K@QS(\L@QSK@QS ףp=*L@QS ףp=JL@T L@KHT(\UJ@0T(\•J@TJ@Q[T ףp=jJ@0T(\UJ@@T ףp=J@Q[T(\•J@TJ@LQM(\UG@`J ףp=I@3QM(\G@ףp= MG@ףp= 7M(\G@QL ףp=G@QkL ףp=G@Q L ףp=G@ףp= KG@ףp= K(\•G@ףp= K(\uG@QK ףp=jG@QkK ףp=G@ףp= 7K(\µG@ףp= J ףp=G@ףp= K ףp=jG@ףp= J ףp=G@ףp= J(\UG@QJ(\UG@ףp= wJ(\•G@`J(\G@J ףp=G@J ףp= H@QJH@ףp= J ףp=G@ףp= JG@J ףp= H@J ףp=JH@J@H@K ףp=jH@JH@K(\µH@ףp= WK(\µH@QK ףp=H@ףp= K(\H@K(\H@Q L ףp= I@QkLH@@L I@ףp= L ףp=JI@K ףp=I@K ףp=I@L ףp=I@ףp= WL ףp=I@LI@L ףp=JI@ףp= L ףp= I@ףp= LH@ףp= 7MH@`M ףp=JH@ףp= 7M@H@ףp= wM(\H@QM(\G@MQU(\•O@TGzP@QU(\O@QuU(\O@pU(\•O@Q5UO@Q U(\O@QTP@QTP@TO@QKT(\µO@T ףp=O@PTGzP@pT P@TGz4P@QT{GJP@Q+UGzdP@@UGzP@U{GjP@UPP@QU{G*P@QUGzP@QU(\O@NXPS{GP@QRQ@PS{GP@Q5S{GP@QRP@RP@QR{GP@QRQ@ SQ@PS{GP@O8V(\N@ףp= NGztR@dVQ@@VGzQ@VGzQ@QU{GQ@pUGzQ@QUGzQ@QT{GzQ@QUTQ@QSGzdQ@SpQ@QSQ@`SGztQ@QRGzTQ@Q S{G*Q@R@Q@R Q@@R{G Q@Q+R{GP@QRP@@R{GP@pRP@QR{GP@QkR{GjP@QRGzTP@SGzTP@`S`P@QkS{GJP@SGzDP@QS{G*P@SP@ SP@R P@QR{GP@QkR{G P@0RP@QQO@QQ ףp=O@QQO@QQ ףp=jO@QUQ(\UO@@Q(\5O@QQ(\O@QPO@QP(\N@QP ףp=*O@QP(\UO@P ףp=O@ Q(\µO@Q;Q ףp=O@P ףp=O@QPO@pP(\uO@ P(\uO@P ףp=O@@PP@QEP P@pPGz4P@QPPP@QPpP@QP{GP@`P{GzP@@PGzTP@QO@P@O`P@Q+O{GjP@Q OGzP@ףp= N{GP@ףp= OP@ףp= OGzP@P{GP@QKPGzQ@PGzQ@QQ Q@QQ@Q@P{GJQ@QPGzdQ@PQ@QQQ@pQGzQ@Q{GQ@QR{GQ@RQ@RR@QRGz$R@R R@Q5S,R@QuS333333R@S= ףpR@Q T= ףpR@QKT{G R@Q5T{G*R@`TQHR@QKTGzdR@QkTGztR@QTpR@QU{GZR@`U@R@QeU R@QkUGzR@QUU{GQ@PV{GQ@UGztR@QUU{GQ@QUR@QU{GR@UGz4R@QUPR@`URaR@U33333sR@Q[UGztR@UGztR@VGzdR@QEV{GJR@QeV0R@VGzR@VQ@QpQ5TGz4R@QSGztR@ TpR@Q5T{GZR@ TQ>R@QSGz4R@QSQ>R@Q%SHz7R@QS{GJR@0SGzdR@QuSRqR@SGztR@ TpR@RPQ%X{GR@pW33333R@Q%XR@QWGzR@pW{GR@pWR@W33333R@QW33333R@Q%XR@SX{GR@QSRAS@Q XRAS@X{G*S@QWS@PWGzS@Q WGzS@QV{GR@Q WR@WR@VRR@Q V= ףpR@U{GR@0U{GR@QTR@QTR@QT{GR@QSGzR@QS= ףpR@QeT= ףpR@QT= ףpR@Q5UGzR@UGzR@0VR@QVQR@QkV{G S@VHzS@V)S@@W)S@QW{G:S@Q XRAS@TW{GS@Q{UPT@WT@QuW= ףpS@QKWGzS@QkWQS@QUWRS@W{GS@PV{GS@QVRS@US@Q{US@Q{UQS@QUS@QU{G T@V{GT@V T@QV333333T@WPT@QeWPT@pW333333T@WT@WT@UV{G S@ףp= NGzT@>V`T@V@T@V{G*T@`U{G*T@T333333T@Q+T333333T@QkS{G:T@QSQ(T@T= ףpT@QTT@QuU{GT@QUHzS@QKUS@QKUS@Q%UHzS@US@QU{GS@QeU{GzS@VGztS@V{GZS@UPS@Q VQHS@`VGz4S@`V{GS@UGzS@QKUS@U{GS@QTGzS@QeT S@@T{G S@S{GS@pSGz4S@SPS@QkSGzdS@S{GzS@QRS@RS@RS@RS@Q= ףpS@Q T@Q5QGz$T@PR@= ףp-_ R@= ףpM_GzR@e(d@(\UK@fffffd@K@d@K@fffffd@(\UK@f@e@`J@e@J@e@(\uJ@̜e@`J@e@ ףp=jJ@e@J@e@(\uJ@g0QFf ףp=I@R9f(\I@QFf(\I@R9fp= I@QCf ףp=I@h8Qf(\I@R f(\I@Qf(\I@R fI@Rf(\I@Qf(\I@i0Re ףp= J@Qe(\5J@Re ףp= J@Re(\J@Qe(\5J@jHQ&e`J@e ףp=J@Q&e`J@R e(\•J@e ףp=J@e ףp=J@eJ@Q&e`J@kPQd ףp=J@QdK@Qd ףp=J@dJ@QdJ@QdK@QdK@Qd(\J@Qd ףp=J@lXRye ףp=O@Re(\O@Rye(\O@Rye ףp=O@RYe(\µO@R9e ףp=O@Re ףp=O@R9e(\µO@Pe(\O@Rye(\O@mXQd ףp=M@d ףp=*N@Qd(\N@Rd(\M@Qd ףp=M@dN@d N@Qd ףp=*N@Qd N@Qd(\N@nxRYc`L@Qc(\5M@ RYcL@QCc`L@Q-cL@Q#c ףp=L@QcL@c ףp=L@ c(\L@Qc(\M@c(\5M@Q&c ףp= M@Q=cL@RYcL@oQ`J@``(\K@ Q`(\K@` ףp=J@` ףp=J@R` ףp=jJ@Ry`(\5J@``J@Ri`@J@Ry``J@Qv` ףp=J@` ףp=J@Qv` ףp= K@R` ףp= K@Q`(\K@pR ` ףp=*H@= ףp^ ףp=jI@R `(\UI@p= _(\I@ףp= _(\H@ ףp=_(\H@_(\µH@ ףp=z_H@`_H@@_H@@_`H@p= _@H@= ףp^ ףp=*H@= ףp^@H@= ףp^(\uH@ ףp=_ ףp=H@@_H@`_ I@= ףp_(\5I@= ףp_ ףp=JI@ ףp=_ ףp=jI@R `(\UI@q8@R ףp=M@6{GS@d@R{GS@QQHzwS@QQ{GzS@QGzdS@QQfffffVS@QPS@QQzGAS@Q333333S@0Qfffff&S@`QQS@ QQS@QP{GR@QUPQS@ףp= O{G S@ףp= N{G S@NGzR@Q+M{GR@Q+MGzR@L= ףpR@@LR@@LR@ףp= KGzdR@K{GJR@QKGz$R@QK{G R@KQQ@K{GQ@K{GQ@QJQ@`J{GQ@QIQ@IQ@QkJ33333Q@ KGzQ@QKKQ@QkK{GjQ@ףp= J33333SQ@ףp= J= ףp]Q@I{GzQ@`IGzTQ@IGz$Q@QKJGz$Q@QJ{G Q@ףp= JGzP@JP@JP@JP@ףp= 7J`P@J{G:P@JGzP@QIP@I ףp=O@Q+I ףp=jO@Q I@O@H(\N@H(\µN@H ףp=jN@ףp= WG`N@F ףp=JN@ףp= F(\N@ףp= E ףp=M@EN@QkE@N@`EN@@EN@EO@ףp= 7E(\UO@DO@`DO@@DP@ףp= 7D P@D{GJP@DGzDP@ףp= C`P@@C{GjP@B{GjP@ףp= AP@`AGzP@ףp= @{GP@ףp= @GzP@@P@ףp= @{GP@ףp= W?{G Q@>{G Q@<{GQ@;Gz$Q@@:Gz4Q@@9GzDQ@@8{GZQ@Gz.7pQ@6GzQ@7{GQ@ףp= 9{GQ@ףp= W:{GQ@ףp= W:{GQ@@9{GQ@9{GQ@8GzQ@@8Q@8GzQ@r@R{GQ@ףp= W'T@W8GzQ@ףp= 7{GQ@ףp= 5Q@5Q@5{GQ@ףp= 6GzQ@Gz7{G R@ףp= 8 R@ףp= W733333R@6GzR@5{GR@6{G:R@733333CR@Gz.6PR@ףp= 5{GZR@ףp= W4= ףp]R@ףp= W4GztR@5R@@3R@ףp= 2{GR@ףp= 4{GR@Gzn3R@Gzn3R@4 S@533333S@Gzn5{G*S@ףp= W4{G:S@Gzn20S@Gz.2GzDS@ףp= 2GzdS@Gz3{GzS@Gz.3{GS@3GzS@2QS@ףp= 2RS@Gz.1= ףpS@Gz/{GT@Gz,0T@ףp= W'GzTT@*QkT@Gzn033333sT@Gz.2Q^T@3GzdT@4GzTT@6GzDT@ףp= 8{G:T@Gz7HzWT@6QhT@ףp= W533333sT@Gz5GzT@Gz7RT@Gz7pT@ףp= W9QkT@ףp= W9GzT@ףp= =GzT@@<T@ףp= 9= ףpT@Gz.6GzT@4GzT@Gz5fffffT@8QT@ףp= 8T@ףp= W;33333T@?GzT@BT@C{GT@FT@@GGzT@QG{GT@@I= ףpT@IT@@KGzT@QMGzT@OpT@N{GZT@QNQHT@OQKT@@P{G:T@PR!T@QPGzT@@PGzT@ PS@QkPS@Q+QzGS@QQS@QRGzS@@R{GS@s@ףp= W8(\µO@ףp= W+P@%ףp= W8`P@ףp= 7{GZP@6GzdP@ףp= 6{GZP@ףp= 6GzDP@80P@ףp= 60P@6P@6 ףp=O@5 ףp=O@4 ףp=O@2(\µO@Gz1O@0 ףp=O@Gz/{G P@-{GP@ףp= W+{G:P@ףp= W+`P@ףp= W-pP@-GzP@ףp= W/P@@0P@ףp= 0{GP@ףp= 1P@@2{GP@@3GzP@Gz3GztP@@4GzP@ףp= W4GzdP@Gzn5{GZP@5P@@6GzP@7{GP@7{GP@Gz7{GP@7GztP@ףp= W8`P@t("GzQ@ {GQ@"GzQ@ {GQ@u8ףp= 2R@Gz1R@ףp= 2R@ףp= 2R@Gz133333R@ףp= 2R@v8!@`A:@d)\"@"@!@zG"@q= ףpRQ"@q= ףp#@)\#@)\$@QRQ%@q= ףp &@Qk&@Gz)\&@\(\)\('@R'@Gz ףp= (@RQRQ(@\(\RQ(@Qk(@HzG)\(@= ףp(@QR(@GzRQ)@R)@*@*@ףp= W R*@ףp= W!*@ףp= W"RQ*@ףp= ")\*@ףp= #)\(+@Gz$)\+@ףp= W%R+@&)\+@Gz'RQ+@(R*@ףp= W)*@ףp= )RQ)@Gz*)@ףp= +)\(@-RQ(@.)\((@/)\'@0)\'@0'@1'@Gz.1'@Gzn1)\'@Gz1)\((@2R(@ףp= 2RQ)@@3R)@3*@@4R*@ףp= 4+@@5R+@Gz5)\,@ףp= 6-@6R,@Gz6-@7-@8)\(-@Gzn8)\-@9)\-@9R-@Gz9)\(.@Gzn:.@;)\.@;RQ/@ףp= ;R/@@GzT1@ףp= >Gz1@?Q1@Gzn?@2@@GzT2@QK@Gz2@Qk@Gz1@Qk@@2@ףp= @Qk2@Q@Qk2@ A2@Q AQ+3@ףp= 7AGz3@`AQ+4@`A4@@AGz5@ףp= 7A5@ףp= 7AGz6@ףp= AQ6@Q A@7@ףp= AQ7@A@8@ףp= A8@ AGz9@A9@A:@@w8:@@G@@d:@@Gz:@@Gz;@ףp= @;@Q@Gz<@@<@`@Gz<@ףp= 7@@=@@Gz=@Gz?>@ףp= W?Qk>@Gz>Q>@>Q>@>@?@ףp= =?@Gz.=@@ףp= <(\5@@ףp= < ףp=J@@ףp= <`@@;(\u@@;(\u@@ ףp=:(\u@@ףp= :(\u@@@: ףp=J@@ףp= :(\u@@9(\µ@@ףp= W9@@Gz.9(\5A@Gz8(\uA@8A@8A@8(\µA@7A@ףp= 7A@6 ףp=A@ףp= 6(\•A@Gzn5A@ףp= 4(\UA@4`A@4(\•A@Gz3A@Gzn3 ףp=A@3 B@ףp= 2(\UB@ףp= W2B@Gz1 ףp=B@1 ףp=B@ףp= W1 C@Gz.1(\uC@ףp= 1C@0C@ףp= W0 ףp= D@0(\5D@Gz./(\UD@ףp= W.`D@ףp= W- ףp=JD@Gz., ףp=JD@Gz.+(\5D@*@D@ףp= (@D@((\5D@'@D@&@D@%@D@%(\D@ףp= W$ ףp=C@ףp= #(\C@ףp= "(\µC@Gz! ףp=C@ףp= W ףp=C@\(\ ףp=C@\(\(\•C@\(\`C@\(\(\uC@\(\ ףp=C@\(\zGC@Q ףp=C@\(\ ףp=C@Gz(\C@Q D@ D@q= ףp(\UD@ ףp=D@QD@HzD@= ףp=D@ ףp= E@(\(\5E@Qۿ(\uE@(\•E@zG? ףp=E@?F@?(\5F@Q? ףp=jF@? ףp=F@Q?F@@(\G@p= ף@@G@@(\uG@\(\ @G@@x8 ףp=*@@@(\•I@>@dG@@(\G@p= ף@(\G@RQ@(\H@RQ@@H@p= ף@(\uH@@ ףp=H@RQ@H@@H@@H@p= ף@(\H@RQ @(\I@!@(\5I@R!@`I@R"@`I@$@I@R$@ ףp=I@&@(\•I@'@ ףp=JI@R'@(\I@'@ ףp=H@)\&@H@RQ&@@H@&@H@)\(&@(\µG@)\(&@ ףp=jG@%@ ףp=*G@RQ%@F@%@F@%@`F@)\$@ F@R$@(\E@RQ%@ ףp=E@)\(&@E@R&@(\•E@(\&@(\uE@RQ'@(\µE@R'@E@R(@33333sE@)@ ףp=jE@)\)@(\5E@*@ ףp= E@RQ+@ ףp=D@)\(,@(\•D@)\(-@(\UD@-@ ףp= D@.@ ףp=C@/@C@)\(/@C@0@(\•C@0@ ףp=C@Gz1@ ףp=jC@Gz1@ ףp=JC@2@(\BC@ 2@ ףp= C@Qk2@ ףp=B@Q2@ ףp=B@@3@B@Q3@(\•B@@4@B@4@B@Gz5@(\uB@5@(\uB@(\5@(\uB@Gz6@ ףp=JB@@6@(\B@6@ ףp=A@6@ ףp=A@@7@A@Gz7@ ףp=A@8@A@GzT8@A@Gz8@`A@@9@@A@9@ ףp=*A@Q+:@A@Q:@(\@@Gz;@(\@@Qk;@ ףp=@@Gz;@@@Q+<@(\u@@Gz<@(\U@@=@ ףp=J@@Qk=@ ףp=*@@Gz=@ ףp=J@@>@`@@Gz=@@@Gz=@@@<@(\µ@@Qk<@@@Gz<@(\A@;@(\5A@Q;@(\5A@GzT<@(\UA@Q<@A@=@A@=@ ףp=jA@<@(\UA@<@(\•A@<@A@Gz;@y8A@RQ)@ ףp=M@Gz;@dA@Gz;@A@Q+;@ ףp= B@Q:@(\5B@Q+:@`B@Gz9@ ףp=B@GzT9@B@Gz8@B@GzT8@C@Gz8@(\5C@7@`C@@7@C@6@ ףp=C@@6@C@Q5@ ףp=C@5@(\•C@Q4@C@Gz4@(\C@@4@ ףp=*D@Gz4@`D@Q3@D@Q+3@D@Q2@D@Q+2@D@1@ ףp= E@1@(\5E@1@(\UE@0@YE@\(\0@`E@Gz0@(\UE@RQ/@`E@RQ.@(\uE@)\(-@ ףp=E@,@E@+@(\•E@*@E@)@(\E@)@(\E@RQ)@(\5F@)@(\uF@)\)@(\µF@*@(\F@)\*@ ףp= G@)\*@ ףp=JG@*@ ףp=G@)\*@(\µG@)\(+@ ףp=G@R+@ ףp=*H@R+@ ףp=jH@)\(,@(\•H@-@(\H@-@ I@R-@`I@)\(.@I@.@I@R.@ J@)\(/@ J@R/@(\5J@@0@(\uJ@0@(\µJ@Q0@p= J@Q0@(\J@Q0@(\5K@1@ ףp=jK@Q0@K@Q+1@(\µK@Q1@(\K@Gz1@ ףp=*L@Q1@ ףp=JL@Gz2@`L@Gz2@ ףp=L@Gz2@L@Q2@(\L@Gz3@L@3@ ףp=L@4@ ףp= M@Qk4@@M@Qk4@`M@Gz4@M@Q+5@ ףp=M@Qk5@ ףp=M@Q5@ ףp=M@Qk6@(\µM@Q6@ ףp=M@Gz7@ ףp=jM@7@ M@Q7@L@7@L@8@ ףp=jL@GzT8@(\5L@8@(\5L@GzT9@(\5L@Gz9@(\5L@Gz9@@L@Gz:@ L@Q+:@q= ףL@Q9@ ףp= L@Gz9@(\K@Gz9@ ףp=K@@9@K@Q8@z8G@4@{G R@>@dK@Q8@@K@Gz8@ K@Q+8@ ףp=J@Gz8@J@Q+8@`J@Q+8@(\5J@Q7@(\I@= ףp7@ ףp=I@8@(\I@@8@I@@8@p= ףI@RQ8@33333I@{Gz8@ ףp=I@8@(\I@@9@ ףp=I@9@ ףp=I@Gz:@ ףp=I@:@I@Gz9@= ףp]I@@9@(\UI@Q+9@@I@Qk9@(\I@Gz9@ I@= ףp=:@ I@@:@ ףp= I@Q:@(\H@;@H@Qk;@ ףp=jH@Gz;@ ףp=JH@@<@Q+H@= ףp<@ ףp=*H@<@(\H@@=@G@Qk=@ ףp=*H@Gz=@ ףp=JH@>@(\uH@>@H@@>@ ףp=H@>@I@Q+>@ ףp=*I@Gz=@(\UI@@=@ ףp=I@<@I@@<@I@Gz;@(\J@Q;@ ףp=JJ@Qk;@J@;@J@Q:@ ףp=J@Gz:@ ףp=*K@Q:@`K@Qk:@ ףp=K@Q:@K@Gz:@ L@;@`L@;@ ףp=L@Q:@(\•L@@:@ ףp=L@9@M@Q9@ ףp=JM@Gz9@(\•M@Qk9@(\M@GzT9@(\N@GzT9@`N@@9@(\•N@Q+9@(\N@p= #9@ ףp=N@Gz9@(\5O@Q+9@(\uO@@9@O@@9@ ףp=O@Qk9@P@@9@{G*P@Q+9@{GJP@@9@GzdP@GzT9@GzP@Qk9@GzP@GzT9@GzP@9@{GP@8@GzP@GzT8@{GP@Q7@{GP@7@RQ@Q7@GzQ@7@{G*Q@Gz7@{GJQ@6@pQ@6@GzQ@Q6@{GQ@Qk6@{GjQ@@6@GzDQ@@6@GzTQ@5@{GjQ@Qk5@GzQ@5@GzQ@4@{GQ@4@{GQ@Q4@GzR@@5@{G R@Gz5@{8{G R@)\( @GzW@6@d{G R@Gz5@GzR@@6@Gz$R@Q+6@ R@Q5@Gz$R@@5@Gz4R@Gz4@0R@@4@{G*R@3@Gz4R@@3@@R@3@Gz4R@Q2@@R@Gz2@{GJR@1@PR@1@GzTR@Qk0@`R@0@pR@/@GzR@.@{GR@-@R@,@{GR@+@GzR@*@R@R(@R@(@GzR@)\('@GzR@RQ&@S@RQ%@{G S@RQ$@GzS@)\(#@ S@"@Gz4S@)\(!@{GJS@ @GzdS@)\( @S@)\ @{GS@R!@GzS@RQ"@S@"@S@#@GzS@$@GzS@$@GzS@)\%@S@&@S@'@T@RQ(@T@RQ)@GzT@*@T@)\+@{G T@R,@GzT@.@{G T@R.@{GT@)\/@@T@/@{GJT@Q+0@`T@@0@T@GzT0@T@Gz0@GzT@1@GzT@Q+1@T@Qk1@GzT@Gz1@{GT@Gz2@GzU@@2@ U@Gz2@Gz4U@3@GzDU@GzT3@`U@Q3@{GzU@3@{GU@Q3@U@GzT4@U@4@{GU@Gz5@GzU@Qk5@GzU@Gz5@V@5@{G V@Gz6@GzV@5@0V@Gz5@ ףp=JV@fffff5@PV@Q5@pV@5@V@Gz5@GzV@Q+6@{GV@Qk6@{GV@6@V@GzT6@{GV@Q5@W@5@{G W@Gz5@W@ ףp=4@ W@Q4@{G:W@@4@{GJW@Q3@`W@Q3@pW@3@GzdW@@3@GztW@Gz2@{GW@Gz2@GzW@GzT2@W@1@GzW@Q+1@|8W@Q?33333Z@Q+1@dGzW@Q+1@{GW@Gz0@W@Gz0@W@)\/@GzW@/@W@/@GzW@Gz0@X@GzT0@0X@Gz0@{G:X@Q0@PX@0@GzdX@GzT0@pX@)\/@GztX@)\.@{GzX@-@GzX@,@X@RQ+@GzX@)\(*@X@)@X@R'@X@R&@X@&@X@RQ%@X@RQ$@X@)\($@X@)\(#@X@"@X@!@{GX@)\( @{GX@ @GzX@RQ@{GX@RQ@X@@fffffY@p= ף@33333Y@RQ@33333Y@p= ף@Y@RQ@,Y@@fffff&Y@@9Y@@33333SY@p= ף @YY@p= ף@yY@@̌Y@\(\@33333Y@Q?Y@Q?Y@Q? Z@Q?fffffZ@@33333Y@p= ף@Y@\(\@Y@\(\ @Y@\(\@Y@p= ף@Y@p= ף@fffffY@p= ף@̬Y@@̌Y@RQ@33333sY@p= ף@`Y@RQ@9Y@p= ף@fffff&Y@p= ף@Y@@ Y@ @{GX@)\(!@GzX@"@GzX@RQ"@{GX@RQ#@{GX@$@GzX@)\%@GzX@RQ&@X@RQ'@{GX@)\((@{GX@)@Y@)\*@Y@+@9Y@)\*@9Y@)@YY@RQ)@33333sY@RQ)@̌Y@(@fffffY@)\((@33333Y@Gz'@33333Y@'@Y@)\&@Y@R%@Y@)\(%@ Z@)\(%@33333Z@%@ Z@$@@Z@)\($@333333Z@)\(#@333333Z@)\("@@Z@RQ!@YZ@"@33333sZ@)\"@33333Z@R"@̬Z@)\#@̬Z@R$@33333Z@R$@}8ffffffZ@R$@fffff^@A@d33333Z@R$@Z@RQ%@fffff[@R%@ [@RQ&@@[@R&@L[@'@L[@RQ(@33333S[@)\)@33333S[@*@33333S[@+@L[@,@@[@-@333333[@)\.@[@/@fffff[@Q+0@Z@0@Z@Q0@33333Z@GzT1@Z@1@33333Z@Gz2@yZ@Qk2@ffffffZ@3@lZ@3@yZ@Q3@Z@@4@̬Z@Q4@fffffZ@5@fffffZ@@5@[@5@[@5@ [@Q5@@[@Q5@Y[@Qk5@l[@Qk5@l[@5@l[@4@y[@GzT4@33333[@GzT4@[@4@33333[@Q4@[@@5@[@Qk5@[@5@\@5@ \@Gz5@@\@6@fffffF\@6@`\@Q+6@l\@Q6@̌\@@6@\@Q6@\@Q6@\@6@]@Gz6@ ]@Gz7@@]@Qk7@Y]@Q7@33333s]@8@̌]@@8@̌]@Gz8@̬]@Gz8@33333]@9@]@@9@]@Gz9@]@:@33333]@GzT:@]@:@^@Q:@33333^@;@fffff&^@Qk;@333333^@Gz;@fffffF^@Q+<@Y^@Q+<@ffffff^@Qk<@`^@Q<@l^@Q+=@y^@Q+=@^@=@fffff^@>@l^@Gz>@33333S^@@>@333333^@Q+>@^@GzT>@9^@Qk>@L^@Q>@`^@Gz>@y^@Q>@33333s^@@?@L^@Q?@33333s^@Q?@l^@ ףp= @@L^@(\5@@9^@ ףp=J@@333333^@@@,^@(\µ@@ ^@ ףp=@@33333^@ ףp=*A@33333]@ ףp=JA@]@ ףp=jA@]@A@~8ffffff]@ ףp=*A@`@E@d]@A@]@ ףp=A@ ^@(\A@,^@(\B@333333^@ ףp=JB@`^@`B@^@B@33333^@ ףp=jB@fffff^@ ףp=B@fffff^@(\µB@ffffff^@(\µB@L^@B@333333^@B@33333^@ ףp=B@^@ ףp=B@33333]@ ףp=B@33333]@ ףp=B@]@ ףp=B@33333]@B@33333]@C@y]@ C@ffffff]@ ףp=JC@l]@(\uC@]@C@]@ ףp=C@]@(\•C@33333]@(\µC@]@C@]@D@^@(\D@333333^@ ףp=JD@L^@(\uD@y^@ ףp=jD@̌^@(\5D@y^@D@`^@C@33333S^@C@l^@(\•C@L^@`C@ffffff^@ ףp=jC@fffff^@ ףp=C@^@(\µC@^@ ףp=C@^@C@fffff_@ ףp=C@ _@fffffC@,_@(\C@fffffF_@ ףp=C@Y_@(\µC@L_@(\uC@@_@@C@333333_@ ףp= C@33333S_@(\B@fffff_@B@_@HzB@fffff_@(\µB@33333_@B@̌_@(\uB@_@ ףp=*B@33333_@A@33333_@ ףp=A@33333_@ ףp=jA@fffff_@ ףp=*A@_@(\UA@33333_@ ףp=jA@`@(\uA@33333#`@(\•A@)`@ ףp=A@,`@B@,`@@B@)`@B@fffff&`@B@`@(\B@`@ C@ `@(\/C@fffff`@(\UC@33333_@C@33333_@C@_@ ףp=C@33333_@ ףp=C@33333_@(\C@fffff`@ ףp= D@`@ ףp=*D@fffff&`@(\UD@fffff6`@ ףp=jD@fffff6`@ ףp=D@333333`@ ףp=D@33333C`@ ףp= E@P`@E@33333S`@\(E@fffffV`@ E@Y`@ ףp=JE@ffffff`@ ףp=JE@p`@E@fffffv`@E@`@E@`@(\uE@33333`@(\UE@fffff`@ ףp=jE@`@(\•E@8`@(\•E@fffffd@(\UO@d`@(\•E@`@(\µE@`@(\E@fffff`@ ףp=*F@ a@`F@a@F@0a@(\F@@zGqQ@>@GztQ@<@{GQ@>@GzQ@Q+?@{GQ@Q+>@{GQ@Gz=@{GQ@;@GzQ@Gz:@Q@Gz:@{GQ@Gz9@GzQ@Q9@{GQ@Gz8@Q@@8@{GQ@GzT7@{GQ@GzT6@{GQ@5@Q@Q+4@GzQ@Q2@GzQ@Gz2@GzdQ@1@{GZQ@1@GzDQ@Gz1@@Q@Q0@{G*Q@Gz0@@Q@R/@0Q@Q+0@PQ@)\.@{G:Q@R,@{G*Q@.@{GQ@RQ+@Q@R)@GzP@,@{G Q@.@Q@Q+0@GzQ@.@GzP@RQ-@{GP@)\+@P@)\*@GzP@*@{GP@)\()@pP@RQ(@PP@)\&@{G:P@RQ%@GzP@)\($@(\O@#@O@R!@O@!@ ףp=O@ @O@@(\uO@RQ@@O@p= ף@(\O@p= ף@ ףp=N@@N@RQ@(\•N@@`N@RQ@ ףp=*N@RQ@(\M@@ ףp=M@p= ף@M@p= ף@ ףp=M@p= ף@M@RQ@ ףp=JM@@ ףp=*M@RQ@ ףp= M@p= ף@M@!@ M@"@ ףp=JM@#@M@$@M@)\(%@ ףp=M@(\%@q= ףM@)\(&@ ףp=M@)\&@@M@RQ'@M@(@(\µL@)\(@(\uL@R)@@L@RQ)@(\L@*@K@*@(\µK@RQ+@(\µK@,@(\µK@RQ,@K@RQ-@(\L@)\.@(\L@R/@(\L@GzT0@`L@0@ ףp=L@Q0@L@Q0@ M@Gz0@ ףp=JM@Gz1@(\uM@GzT2@(\•M@2@ ףp=M@Gz2@ ףp=M@Gz2@ ףp=M@8R"@(\J@Q+>@GztP@dGz2@ ףp=M@Gz2@(\N@Q1@@N@@1@ ףp=jN@Q+1@N@GzT1@N@Qk1@ O@1@@O@Qk2@O@Q+3@ ףp=O@Gz3@ ףp=O@Q4@ ףp=O@5@{G P@Q5@ P@5@0P@5@GzDP@Qk5@GzTP@6@`P@Qk6@GztP@Q+7@pP@Gz7@pP@\(8@RqP@8@GztP@GzT9@`P@GzT9@@P@Q8@Gz4P@Gz8@GzP@@7@(\O@Qk6@(\µO@Gz5@O@Q+5@@O@@5@O@Q5@N@GzT5@N@GzT5@(\UN@Gz6@(\5N@Gz6@(\N@7@N@Qk8@ ףp= N@GzT9@ N@@:@(\5N@Q+;@ ףp=JN@R;@ ףp=JN@GzT<@ ףp=JN@Gz=@(\N@=@ N@Q+>@ ףp=M@Q+=@N@GzT<@(\M@Q;@(\µM@Gz:@(\µM@Q9@ ףp=M@9@M@Q+8@(\µM@7@(\•M@7@`M@7@ ףp=*M@GzT8@ M@GzT8@L@GzT8@L@Gz7@L@@7@ ףp=L@Q6@(\µL@Qk6@(\L@Q5@ ףp=L@GzT5@ ףp=L@5@`L@5@(\L@Gz5@(\K@4@(\•K@4@(\uK@3@@K@{G3@Q>K@@3@ ףp=*K@Q2@ ףp=*K@GzT2@ ףp=jK@1@`K@Q0@ ףp=JK@0@ K@RQ.@(\K@)\,@(\J@\(\,@QJ@)\+@K@*@(\K@RQ+@ ףp=*K@)\*@(\UK@R)@(\5K@(@ ףp=*K@)\'@(\K@)\&@(\J@%@(\J@%@(\J@R%@ K@$@@K@$@`K@\("@Q~K@R"@K@#@K@RQ$@L@)\%@(\L@8Gz" ףp=jC@)\%@ ףp=L@d)\%@(\L@)\%@@L@$@@L@$@ ףp=jL@%@L@%@ ףp=L@)\#@L@R"@(\•L@RQ!@ ףp=L@ @ ףp=jL@)\( @@L@)\( @L@RQ @ ףp=K@RQ!@ ףp=K@RQ!@q= ףpK@RQ!@ ףp=jK@"@@K@RQ!@ ףp=*K@"@ ףp= K@)\(!@ ףp=J@!@J@ @(\J@RQ@(\J@@(\µJ@@(\µJ@RQ@(\µJ@@J@@ ףp=jJ@p= ף@`J@p= ף@@J@@ J@RQ@(\5J@RQ@(\uJ@@ ףp=jJ@RQ@(\5J@RQ@ ףp= J@@I@p= ף @(\µI@ ףp= @̬I@@I@@RI@p= ף@I@? ףp=jI@HzG?@I@? ףp= I@HzG?(\H@(\? ףp=H@(\?(\H@H@zG ףp=H@q= ףpH@q= ףp(\H@zG(\H@q= ףp(\•H@zG ףp=JH@ ףp=JH@q= ףp@H@ ףp=jH@q= ףp `H@Gz ףp=JH@@H@GzH@ ףp=G@ ףp=G@q= ףp ףp=G@G@Q ףp=G@zGG@`G@@G@ G@ ףp=F@q= ףpF@zG(\UF@ F@zG(\E@ffffffE@zG(\µE@q= ףp ףp=E@(\µE@Q E@Gz ףp=E@\(\E@\(\ ףp=E@\(\E@E@ E@Gz ףp=E@ףp= !E@ףp= W"E@!(\5E@Gz!E@!D@!(\D@Gz.!(\•D@ףp= W!`D@Gz! D@ףp= !(\C@" ףp=C@Gz" ףp=jC@8Gz" ףp= B@Qk2@ ףp=*F@dGz" ףp=jC@Gz."@C@ףp= W!@C@!C@!B@ףp= ! ףp=B@Gz (\•B@\(\ ףp=B@GzB@)\(B@B@B@\(\`B@ B@ ףp= B@@B@(\UB@q= ףp`B@Q `B@`B@q= ףp`B@q= ףp(\•B@q= ףp(\B@zG(\B@(\ ףp= C@(\տ(\5C@?`C@п ףp=C@(\տC@(\C@?(\5D@?D@?(\•D@p= ף@ ףp=D@\(\@(\D@\(\ @(\D@p= ף@@E@(\@fffffFE@@E@p= ף @E@@E@RQ@ ףp=E@@E@RQ@E@p= ף@ ףp=E@RQ@(\µE@p= ף@(\E@zG@)\E@ @ ףp=E@ @(\F@RQ!@ ףp=*F@RQ"@ F@#@ ףp= F@)\($@F@RQ$@E@R$@ ףp=E@R%@(\UE@&@ ףp=*E@'@ ףp=*E@(@(\D@R(@D@R)@D@)\(+@D@,@(\uD@R,@(\UD@-@ ףp=JD@.@(\D@RQ/@D@/@(\C@0@C@Gz0@ ףp=jC@)\/@ ףp=JC@RQ/@(\C@RQ/@(\B@0@(\B@Q+0@(\C@0@(\5C@0@ ףp=jC@1@C@1@(\µC@0@(\C@Q0@(\D@Q0@@D@GzT1@ ףp=*D@Gz1@ D@Q1@(\C@@2@ ףp=C@Qk2@(\D@Q1@ ףp=JD@Qk1@ ףp=jD@Q0@ ףp=D@GzT0@ ףp=D@)\/@D@Gz0@ ףp=D@.@ ףp=D@RQ-@ ףp= E@RQ,@ ףp=*E@R+@ ףp=JE@)\+@E@)\(+@(\µE@8)\((@(\B@=@F@d)\(+@(\µE@)\(*@(\E@RQ)@(\E@(@ F@RQ(@ ףp=JF@)\(@(\uF@)\((@(\•F@RQ(@F@)\()@F@)\(*@F@)\(+@(\F@(\+@F@R*@(\µF@+@ ףp=F@+@ ףp=jF@)\(,@F@RQ,@ ףp=F@)\-@F@R-@ ףp=JF@RQ.@ ףp=*F@RQ.@F@/@E@0@E@Gz0@(\µE@GzT1@E@Q1@ ףp=JE@2@ ףp=*E@3@E@33333s3@p= D@3@D@Qk3@ ףp=D@GzT3@`D@GzT3@ D@3@D@q= ף3@zGC@Gz4@ ףp=C@GzT4@C@Q4@`C@Gz5@ ףp=*C@Gz5@ C@Gz6@ ףp=*C@Q6@C@7@(\B@8@ ףp=B@8@(\C@Gz8@C@Q+8@(\C@Gz8@@C@Q7@(\UC@GzT7@(\uC@Q+7@C@Gz6@ ףp=C@6@D@Gz6@ ףp=JD@Gz7@(\D@Gz7@(\D@7@(\5D@7@(\UD@8@(\UD@@8@(\uD@8@ ףp=jD@Q+9@(\uD@9@ ףp=jD@zG9@YD@Gz:@@D@Gz:@ ףp=JD@Q+:@ D@Q+:@D@Gz:@ ףp=*D@Gz;@(\UD@Qk;@(\uD@Q+<@D@Gz<@D@Qk=@(\UD@Q<@ ףp=JD@=@ ףp=*D@Qk<@ ףp=*D@;@ ףp=*D@Q+;@ ףp=*D@Gz:@ ףp=*D@Q+:@D@:@(\µC@Gz:@C@Q:@C@:@(\UC@Q:@(\5C@Q:@ ףp=*C@GzT:@ ףp=JC@@:@ C@:@ ףp= C@Q+;@(\B@Gz;@ ףp=B@;@ ףp=B@Q+;@B@Q;@B@Q+<@B@<@`B@Gz<@`B@@=@ ףp=*B@=@(\B@8L!@@>@ ףp= B@B@d=@(\B@>@(\5B@Q>@ ףp=jB@@?@`B@@@@B@ @@(\B@`@@B@(\•@@(\B@ ףp=@@(\B@ ףp= A@@B@@A@ ףp=jB@(\•A@ ףp=JB@A@ ףp=JB@B@(\uB@ ףp= B@(\UB@A@ ףp=*B@(\A@B@q= ףA@(\A@A@(\A@A@A@HzA@LA@ ףp=A@@A@A@ ףp= A@A@@@{GA@(\µ@@A@@@ ףp=jA@@@@(\UA@@@ ףp=*A@?@zG!A@Qk?@A@Q+?@@@Gz?@(\U@@?@ ףp=*@@@?@(\@@Q>@?@Gz?@Gz?@Qk?@Q+?@?@Gz>@Qk?@>@Q+?@=@Q>@=@Gz>@Qk<@Gz?@Gz;@Gz?@GzT;@@?@Q:@Qk?@GzT:@?@9@Gz?@Q+9@?@Gz9@fffff?@Q8@Q?@GzT8@Q?@7@ ףp= @@Q+7@(\@@Gz7@ ףp=J@@6@`@@Gz5@ ףp=j@@@5@`@@Q4@ ףp=J@@Gz4@(\@@Gz3@Gz?@4@?@Gz4@Gz?@Q3@Q>@Gz3@Qk>@Q+3@@>@Q2@GzT>@Q+2@Q>@1@?@Q0@Q+?@Gz0@@?@)\(/@?@)\.@?@)\.@ @@-@(\5@@RQ,@(\U@@)\(+@`@@)\)@ ףp=j@@RQ(@ ףp=j@@RQ'@@@'@)\@@)\(&@@@R%@(\@@%@ ףp=@@)\($@@@$@(\A@)\$@(\5A@%@`A@&@(\•A@R%@ ףp=A@)\(%@A@R$@ ףp=*B@%@@B@&@(\uB@)\$@(\UB@)\($@(\•B@)\(#@B@)\("@(\•B@RQ!@(\uB@L!@(\uB@8Gzn1$@L!@B@dL!@(\uB@RQ @ ףp=jB@p= ף@B@@ ףp=jB@@B@RQ@`B@RQ@(\UB@@ ףp=jB@p= ף@(\uB@p= ף@(\uB@\(\ @ ףp=jB@\(\@ ףp=jB@\(\@(\UB@? ףp=JB@?@B@? B@(\A@ ףp=A@A@(\µA@zG(\•A@ffffff33333A@q= ףp ףp=A@ ףp=A@q= ףp A@\(\A@(\•A@GzA@Gz ףp=A@GzA@GzA@\(\ ףp=jA@\(\(\5A@\(\A@Gz(\@@ @@!@@Gz! ףp=j@@"@@@"(\@@#?@Gz#?@Gz#Q>@Gz.#GzT>@Gz#=@ףp= W$GzT=@Gz.%Q<@ףp= W&Q<@'@<@ףp= W(<@ףp= )Q;@Gz.*(\µ;@*;@ףp= *;@ףp= W+Q:@ףp= W,Qk:@ףp= ,Q+:@Gz.-Q9@-@9@.Q8@ףp= .@8@/Gz7@0Qk7@@06@0GzT6@ףp= 0Gz6@Gz0Gz5@1Gz5@1R5@ףp= 04@Gz.0GzT4@Gz.0Gz3@03@Gz.03@02@02@ףp= 01@@01@Gzn00@Gzn0(\0@Gzn0)\/@0R.@1.@Gzn1-@1-@0,@(\µ0RQ+@Gz0R*@(\µ0(\u*@0R)@0= ףp(@0)\(@ףp= W0)\((@ףp= /)\'@/R'@ףp= .&@Q.)\(&@.)\(&@ףp= W-RQ%@ףp= ,$@Xףp= ,R#@$@Hףp= ,$@,$@Gz.+)\(#@*RQ"@*= ףp="@ףp= W*RQ!@Gz.* @ףp= )RQ@ףp= (RQ@ףp= 'RQ@Q&\(\@ףp= &RQ@&p= ף@Gz$RQ@Gz#RQ@ףp= "@ףp= !p= ף@Gz @\(\RQ@333333Gz@Gz@GzRQ@\(\p= ף@Gz@\(\RQ@p= ף@\(\@Q@QRQ@ffffffHzG@Q@@q= ףp@q= ףpp= ף@(\@п@Q?RQ@?RQ@Q?= ףp=@?p= ף@HzG?RQ@Q?RQ@p= ף@p= ף@p= ף@p= ף@@Gz@\(\ @@@@@RQ@@p= ף@@@p= ף@RQ@@@@@@RQ@@p= ף@ @p= ף@Gz @zG@R @@)\!@@R!@@)\"@\(\@)\(#@ @R#@p= ף@#@@ffffff#@Q@RQ#@Q?#@?"@HzG?)\(#@q= ףp?Q#@)\(?)\"@?)\"@)\(*@)@.@,@)\(*@)\(,@p= ף*@+@)\*@+@+@)\*@)\+@)\(*@R+@)@RQ,@)@zGa,@)@-@Qk)@)\(-@)@)\(.@R)@.@R*@-@R*@RQ,@+@RQ,@)\+@R+@RQ,@+@(\u,@R*@,@)\(*@)\(,@Q?@ A@?Q?@QGz?@ @@Q`@@(\µ@@ ףp=@@q= ףp@@Q ףp=@@(\@@q= ףpQ@@(\ ףp= A@ A@QۿA@{Gz?q= ף@@Q?@@?@@?(\5@@(\?Gz?@ ףp= ǿQ?@ ףp=?@HzGGz?@zG?@q= ףpQ?@QGz=@!Gz?@Q @=@=@Gz=@GzT>@GzGz>@Gz. ̌>@(\ >@Gz.!Gz?@!R?@\(\!?@ >@>@GzGz>@\(\Q+>@=@Gz>@Gz=@GzQ=@ffffffQ=@\(\Qk=@GzT=@Q GzT=@Q Gz=@@=@Gz=@GzT=@\(\@=@A@- ףp=A@Gz.# ףp= A@ףp= W((\A@Gz.) ףp=*A@* ףp=*A@ףp= *(\UA@+`A@ףp= W, ףp=A@Gz., ףp=A@-(\A@{G+A@Gz+(\uA@ףp= * ףp=jA@Gz) ףp=jA@(A@ףp= W'RqA@{G&(\UA@Gz.& ףp=JA@Gz.%@A@ףp= # ףp= A@Gz.#zGA@Gz#A@Gz# A@Gz% A@&(\5A@' ףp= A@ףp= W(x;@(\uD@(\D@ ףp=JG@L;@@E@Q;@ ףp= E@q= ף;@(\E@Gz<@(\D@Gz<@ ףp=D@Q+=@(\•D@Gz=@ ףp=D@>@(\•D@Gz?@ ףp=D@Gz?@ ףp=D@ ףp= @@ ףp=D@ ףp=J@@ ףp=D@@@E@ ףp=@@(\D@@A@(\D@A@E@ ףp=A@(\D@B@(\D@ ףp=*B@D@`B@D@B@D@(\B@ ףp=D@(\C@(\uD@`C@D@ ףp=C@ ףp=D@(\C@D@@D@ ףp=D@ ףp=D@(\µD@ ףp=D@(\D@D@zGD@(\D@E@(\µD@ ףp=*E@D@`E@D@(\uE@ ףp=*D@(\•E@ ףp=C@(\µE@C@(\E@C@ ףp= F@@C@ ףp=*F@C@(\5F@(\B@ ףp=JF@B@`F@B@ ףp=F@(\UB@ ףp=F@ ףp= B@F@ ףp=A@ ףp=F@ ףp=A@ ףp=jF@ ףp=JA@`F@ A@@F@@@ ףp=*F@(\µ@@ ףp=JF@ ףp=@@F@@@(\•F@(\U@@ ףp=F@ ףp=@@F@@@(\F@(\•@@(\G@ ףp=J@@G@Gz?@ G@ ףp= @@ ףp=JG@Qk?@ ףp=JG@Gz>@ ףp=JG@Gz>@(\G@Q+>@ ףp=F@Gz=@(\F@zG=@GzF@Q=@(\•F@=@ ףp=jF@=@(\UF@Q<@ ףp=*F@Q<@(\E@)\<@(\E@Gz<@(\µE@<@ ףp=E@Q;@ ףp=jE@;@@E@(\5A@F@ ףp=C@G@(\5A@(\F@`A@F@A@(\µF@A@F@ ףp= B@(\µF@(\UB@(\µF@ ףp=B@ ףp=F@B@ ףp=F@ C@ G@(\B@(\5G@(\B@(\UG@(\C@(\UG@`C@G@ ףp=C@ ףp=G@C@G@(\5C@(\•G@ ףp=B@ ףp=G@ ףp=jB@`G@ ףp= B@(\UG@(\µA@(\5G@A@ ףp= G@(\5A@(\F@(\UG@ ףp=JB@`K@G@V(\UG@`F@(\UG@(\5F@ ףp=G@ F@(\µG@E@(\µG@(\µE@(\µG@E@ ףp=G@@E@ H@ ףp= E@(\UH@ ףp=D@H@(\µD@(\•H@D@(\H@ ףp=JD@ I@(\5D@H@ ףp=*D@(\µH@D@H@C@(\•H@(\•C@`H@(\•C@ ףp=jH@QKC@ ףp=jH@ ףp=JC@(\uH@ ףp= C@H@ ףp=B@H@(\µB@(\I@ ףp=B@ ףp=*I@ ףp=B@I@`B@ ףp=I@ ףp=JB@(\5J@`B@(\•J@(\uB@(\J@ ףp=jB@K@(\•B@RJ@\(B@J@ ףp=B@J@@C@K@ ףp=C@ ףp=J@(\•C@(\µJ@ ףp=C@J@D@`J@D@(\UJ@ ףp=*D@(\uJ@ ףp=jD@J@(\UD@(\K@(\UD@`K@D@ ףp=*K@ ףp=D@(\J@(\D@(\J@ ףp= E@J@E@(\UJ@(\D@`J@D@(\5J@D@ ףp=*J@(\E@(\UJ@ ףp=JE@@J@ ףp=jE@ ףp=I@ ףp=jE@ ףp=I@(\•E@(\•I@(\E@`I@(\F@(\I@ ףp=*F@ I@ ףp=JF@(\uI@ ףp=JF@(\µI@@F@(\•I@F@I@ ףp=F@@J@(\µF@ ףp=J@(\•F@(\J@F@ K@F@(\J@F@ ףp=J@(\F@(\J@(\5G@(\•J@ ףp=jG@ ףp=JJ@(\•G@ ףp= J@(\•G@(\µI@(\•G@(\uI@G@(\I@ ףp=jG@H@`G@(\uH@ ףp=JG@H@ ףp=*G@@H@ G@ H@(\F@ ףp=G@ ףp= G@ ףp=G@(\F@G@(\•F@(\UG@`F@(\M@E@ ףp=N@`G@(\M@F@(\M@@F@ ףp=*M@ F@ ףp=*M@(\E@M@(\E@(\M@(\E@ ףp=M@E@@N@(\E@ ףp=N@(\F@ ףp=N@(\UF@N@`F@ ףp=N@F@N@ ףp=F@N@F@N@G@ ףp=N@(\5G@(\N@`G@N@@G@`N@(\UG@ ףp= N@@G@ ףp= N@(\G@M@ ףp=*G@M@(\F@M@(\F@(\UM@ ףp=F@ ףp=JM@(\µF@(\M@F@{GZR@(\uF@S@`G@{GZR@ ףp=F@GztR@F@GzR@(\uF@R@(\F@{GR@G@R@(\G@{GR@(\5G@S@ ףp=JG@Gz4S@(\5G@GzTS@ ףp=JG@S@ ףp=*G@S@(\5G@S@`G@S@`G@GzS@ ףp=JG@GztS@(\UG@GzTS@ ףp=JG@Gz4S@(\UG@GzS@`G@R@(\UG@R@`G@{GR@(\5G@{GjR@(\G@{GZR@ ףp=F@fffffY@ ףp=I@y[@K@fffffY@ ףp=I@ Z@ ףp=I@LZ@I@yZ@(\I@33333Z@(\J@Z@@J@33333Z@(\UJ@33333[@J@@[@J@Y[@K@`[@@K@l[@ ףp=K@y[@ ףp=K@`[@K@33333S[@K@L[@(\•K@333333[@`K@ [@ ףp=*K@ [@(\J@fffffZ@J@Z@ ףp=J@fffffZ@`J@fffffZ@@J@lZ@(\J@LZ@ ףp=I@ Z@I@fffffY@ ףp=I@>@(\M@ ףp=j@@ ףp=N@>@ ףp=N@Gz>@`N@Q>@ ףp=*N@Gz?@(\M@?@(\M@?@(\N@@@@(\N@ ףp=j@@@N@ ףp=j@@ ףp=jN@@@@(\•N@Gz?@ ףp=N@Qk?@ ףp=N@>@ ףp=N@Q+>@ ףp=N@>@ ףp=N@@A@(\uN@(\5B@ ףp=jO@@A@N@ ףp=jA@N@A@ ףp=N@A@(\uN@B@(\uN@(\5B@ ףp=N@(\5B@(\µN@B@(\N@A@O@ ףp=A@(\5O@A@(\UO@@A@ ףp=jO@ ףp=jA@ ףp=JO@ ףp=A@@O@ ףp=A@(\O@(\UA@(\O@@A@N@8E@ףp= 9(\5I@(DE@Gz5E@ףp= W6 ףp=E@ףp= 6 ףp=E@@7(\E@Gz7E@8(\F@9 ףp=JF@ףp= W9F@ףp= 9F@9(\F@@9(\5G@ףp= 9 ףp=jG@Gz.9(\•G@Gz8 ףp=G@@8G@7(\G@Gzn7G@7 ףp=G@ףp= 6(\G@Gz.6 ףp= H@5 H@ףp= W5(\5H@Gz4@H@4(\UH@ףp= 4 ףp=jH@ףp= 3H@ףp= 3H@2 ףp=H@2(\µH@Gzn1(\µH@1(\H@0H@ףp= W0(\H@/ ףp= I@ףp= /(\5I@ףp= . ףp=*I@ףp= -(\I@ףp= W,(\H@Gz.+ ףp=H@* ףp=H@)H@( ףp=jH@ףp= ( ףp=jH@ףp= )`H@Gz* ףp=*H@+ ףp=G@Gz.+(\G@Gz., ףp=G@Gz,(\G@-G@- ףp=jG@.(\5G@/(\F@/(\µF@ףp= /(\uF@Gz.0@F@Gz.0 F@Gz0(\E@Gzn1F@2 F@ףp= 2 F@3@F@ףp= 3(\5F@4 ףp= F@4(\E@Gz4 ףp=E@ףp= W5E@Gz5H(\•K@ףp= W5 ףp=K@Gz4(\•K@5 ףp=K@ףp= W5K@ףp= W5 ףp=K@Gz.5 ףp=K@Gz4(\•K@5@ ףp=L@4L@4 ףp=L@4L@4L@Gz.4L@4 ףp=L@4P ףp=J@(@ ףp=JK@RQ)@ ףp=J@R(@(\J@(@ ףp= K@(@ ףp=JK@)@(\K@)\()@(\J@RQ)@ ףp=J@R(@Gz4Q@ףp= HGzQ@ףp= WH Gz4Q@QkH{GJQ@H{G:Q@ףp= H`Q@HGztQ@ףp= HQ@ףp= H{GQ@ףp= HGzQ@QHQ@ףp= H{GjQ@HGzTQ@H@Q@ףp= WHGz4Q@QkH0{G*W@)\'@{G:W@)\*@{G:W@)\*@Gz4W@)\()@{G*W@)\'@({GW@\(\@ X@@{GW@@ X@\(\@HPX@(\?X@?PX@HzG?GzdX@?X@(\?X@?`X@?PX@HzG?HX@{GX@(\X@GzX@GzX@{GX@zGX@(\X@S@@GztT@)\#@S@)\( @S@@GzS@RQ@T@p= ף@T@@{G*T@@PT@p= ף@{GjT@@GztT@@GztT@RQ@`T@ @PT@!@{G:T@"@Gz$T@#@T@)\#@{G T@R"@{GS@"@GzS@!@S@)\( @,[@@2@[@4@,[@GzT3@,[@Q2@,[@2@33333S[@@2@l[@@2@̌[@2@[@Gz2@̬[@GzT3@[@Q3@[@4@[@4@[@4@ffffff[@Q3@fffffF[@Gz3@,[@GzT3@ ^@6@y^@@9@ ^@Q7@ ^@Q+7@33333^@Gz6@,^@Qk6@333333^@6@@^@Gz6@33333S^@7@`^@7@l^@Gz8@y^@Gz8@y^@Gz9@ffffff^@@9@fffffF^@9@333333^@Gz8@ ^@Q+8@ ^@Q7@0`@Gz?@|`@(\@@0`@@@9`@`@@fffffF`@`@@fffffF`@ ףp=@@P`@`@@P`@ ףp=*@@fffffF`@ ףp= @@fffffF`@Q?@fffffF`@@?@Y`@Gz?@i`@Qk?@l`@Q?@fffffv`@(\5@@|`@ ףp=j@@fffffv`@@@33333s`@(\@@33333c`@(\@@\`@(\@@L`@ ףp=@@@`@@@0`@@@`@`@@fffff`@ ףp=*A@`@(\µ@@̌`@(\u@@̜`@`@@33333`@ ףp=@@`@ ףp=@@fffff`@@@33333`@@@`@ ףp=@@fffff`@ ףp=@@33333`@(\A@33333`@ ףp=*A@33333`@ A@`@(\@@`@A@fffff`@(\@@`@(\µ@@\`@(\µ@@̼a@D@O\`@ ףp=*A@\`@(\@@p`@A@`@(\@@`@ A@̜`@ ףp=*A@`@@A@̼`@ ףp=JA@`@ ףp=jA@`@`A@`@`A@fffff`@ ףp=*A@fffff`@(\@@`@@@fffff`@(\µ@@fffffa@(\@@fffffa@ ףp=*A@a@(\UA@fffffa@A@)a@ ףp=JA@33333Ca@ ףp=JA@fffffVa@ ףp=A@Ya@ ףp=JA@33333ca@A@33333sa@A@ya@A@fffffva@(\uA@a@(\•A@̌a@A@fffffa@A@33333a@(\B@fffffa@`B@̜a@B@a@ ףp=B@̜a@ ףp= C@33333a@ ףp=*C@a@ ףp=*C@a@`C@a@ ףp=C@̼a@(\C@fffffa@(\D@̬a@ ףp=JD@a@D@̬a@ ףp=D@a@D@fffffa@(\•D@33333a@(\•D@33333a@(\uD@fffffa@(\uD@a@(\•D@a@(\UD@a@ ףp=*D@a@(\C@a@(\µC@ya@C@pa@ ףp=JC@ia@ ףp= C@Ya@ ףp=B@33333Sa@(\µB@fffffFa@(\•B@333333a@B@ a@`B@ a@ ףp=B@fffff&a@B@fffffa@B@fffffa@ ףp=jB@ a@(\5B@a@ ףp= B@a@(\A@fffff`@A@`@A@fffff`@(\A@`@ ףp=A@`@A@fffff`@A@`@ ףp=A@y`@`A@l`@@A@\`@ ףp=*A@pfffffva@(\µD@9b@F@+ya@ ףp=JE@fffffva@ E@a@E@a@(\µD@a@(\D@33333a@ ףp=D@fffffa@ ףp= E@a@ E@a@@E@fffffa@@E@̜a@ ףp=*E@a@@E@a@ ףp=JE@a@ E@a@E@a@ ףp=*E@fffffa@(\UE@fffffb@E@b@(\uE@)b@(\•E@9b@(\µE@fffff&b@ ףp=E@fffff&b@ ףp=E@ b@E@)b@ F@fffffb@(\E@fffffb@F@33333a@(\F@a@@F@fffffa@`F@a@(\•F@̼a@F@a@F@fffffa@`F@fffffa@ ףp=*F@33333a@F@a@E@a@(\µE@a@(\•E@fffffa@(\•E@a@E@̌a@(\uE@ya@ ףp=JE@833333_@Gz:@fffff`@Gz:@33333_@Gz:@33333_@Qk:@fffff`@Gz:@fffff`@Gz:@()`@Q+<@fffff6`@Qk<@)`@Q+<@fffff6`@Qk<@00b@ ףp=E@fffffFb@ ףp=*F@0b@ ףp=E@9b@ ףp= F@fffffFb@ ףp=*F@X\b@(\5F@b@F@\b@(\5F@pb@`F@fffffb@ ףp=F@b@F@b@F@|b@ ףp=F@lb@F@\b@(\5F@@b@(\F@b@ G@b@(\F@b@F@b@ G@b@ ףp= G@b@(\F@(b@ ףp=jG@fffffc@(\•G@b@ ףp=jG@fffffc@(\•G@Pffffffc@I@33333c@`I@ffffffc@(\"I@ffffffc@I@yc@I@33333c@@I@33333c@`I@fffffvc@(\5I@ffffffc@(\"I@@)a@ ףp=JK@33333Ca@(\•K@)a@ ףp=jK@333333a@ ףp=JK@33333Ca@K@0a@(\•K@)a@ ףp=jK@@id@@M@̌d@(\•M@id@@M@̌d@(\uM@d@(\•M@fffffvd@M@id@@M@fffffa@(\F@ b@ ףp=*K@/fffffa@ ףp=J@a@`J@fffffa@ J@fffffa@I@a@(\µI@33333a@I@a@@I@33333a@I@33333a@H@a@ ףp=H@a@`H@a@@H@fffffa@H@a@ ףp=G@a@G@fffffa@ ףp=JG@a@(\F@a@(\5G@33333a@(\UG@a@ ףp=JG@a@ G@a@`G@33333a@(\uG@a@G@fffffa@G@a@ ףp=G@33333a@ ףp=*H@a@`H@a@ ףp=H@a@ ףp=H@a@ ףp=H@ b@ ףp=H@fffffb@H@a@I@fffffa@@I@a@I@a@I@33333a@J@fffffa@@J@fffffa@J@a@J@a@K@fffffa@ ףp=*K@a@ K@a@ ףp=J@a@ ףp=J@fffffa@ ףp=J@8fffffVf@GzQ@f@RQ@f@RQ@fffffVf@HzQ@Yf@GzQ@f@Q@@fQ@Q-fRQ@fQ@QffQ@Q-f{GQ@QFfRQ@fRQ@P33333a@{GJR@a@{GzR@33333a@`R@33333a@PR@a@{GJR@a@`R@a@{GzR@a@GztR@33333a@`R@@fffffa@{GzR@a@R@fffffa@R@a@{GzR@a@R@a@R@fffffa@R@XPb@R@b@GzR@Pb@GzR@ffffffb@GzR@fffffb@R@b@R@b@{GR@fffffb@GzR@ib@{GR@Pb@GzR@fffff&a@{GR@ b@{G S@fffff&a@R@33333Ca@R@ia@{GR@a@GzR@a@R@a@GzR@b@GzR@ b@{GR@ b@{GR@b@GzR@a@GzR@a@{G S@a@R@`a@{G S@0a@{GR@fffff&a@R@pGzX@{GzS@@Z@{GS@ GzX@{GzS@@Y@{GS@Y@{GS@@Z@GzS@@Z@GzS@Y@{GS@33333Y@{GS@LY@S@fffff&Y@GzS@GzX@GzS@GzX@{GzS@{GV@S@ Y@PT@{GV@GzT@GzV@{GS@GztW@S@{GW@GzS@0X@{GS@GzX@S@GzX@GzS@X@S@ Y@{GS@X@T@GzdX@{G T@@X@ T@`X@0T@{GX@@T@GzW@PT@{GJW@{G:T@{G*W@ T@{GV@GzT@X(\I@GzQ@GzDQ@@S@((\I@GzQ@ ףp=jJ@{GQ@ ףp=J@GzQ@ ףp=K@{GQ@(\uL@GzQ@(\L@Q@ ףp=*L@GzQ@K@Q@K@R@ ףp=K@ R@(\L@{G:R@L@GzTR@ ףp=L@pR@(\UM@{GR@ ףp=M@GzR@`N@R@ O@GzR@ ףp=O@{GR@`P@GzR@P@GzS@Gz4Q@GzS@GzDQ@Gz4S@P@@S@P@0S@{GJP@{GS@(\•O@S@(\•N@S@M@{GR@(\M@GzR@L@GzR@K@GzR@K@R@(\uK@{GR@ ףp=J@pR@ ףp=*K@{GZR@J@{GJR@@J@{G*R@`J@GzR@(\I@GzR@(\I@GzQ@H@H@0Q@ ףp=*I@GzdQ@`H@0Q@I@{G:Q@ ףp=*I@PQ@(\•H@GzdQ@@H@PQ@`H@0Q@L@HzT@PP@{GZT@L@HzT@L@HzT@M@{GT@N@GzT@ ףp=*O@= ףpT@ ףp=*O@{G:T@ ףp=O@Gz4T@PP@@T@Gz$P@{GZT@ ףp=jO@{GJT@ ףp=*O@{G:T@(\M@R1T@M@{GT@ ףp=L@T@L@HzT@h K@Q(T@ ףp=jM@pT@ K@333333T@ ףp=*L@Q(T@@M@333333T@(\L@@T@ ףp=jM@GzTT@@M@pT@@L@{GZT@@L@RAT@ ףp=jK@RAT@ K@333333T@8(\•J@T@K@ T@(\•J@T@K@RT@K@ T@(\•J@T@@F@33333T@(\•I@9T@ @F@33333#T@(\F@{GT@G@{GT@G@{G T@(\5H@33333T@I@HzT@I@T@(\•I@{G*T@ ףp=*I@R1T@H@33333#T@H@0T@G@9T@@F@33333#T@P&@ S@;@ T@'&@S@&@GzS@RQ'@̬S@RQ*@= ףpS@)\(.@= ףpS@RQ+@|S@,@`S@RQ.@zGAS@1@ S@GzT1@@S@Gz2@`S@Q2@RS@3@{GS@@4@QS@Q4@QS@Q5@{GzS@Gz4@{GZS@Q6@PS@Gz8@pS@Q+7@GzS@Q+6@{GS@5@GzS@3@{GS@2@S@Q4@GzS@Gz7@{GS@Q9@{GS@;@HzS@;@{G T@Gz8@T@7@{GT@5@{G T@4@ T@2@T@2@{GS@GzT0@RT@/@{GS@)\+@GzS@&@S@@GzO@\(\(\/O@Gz ףp= O@GzO@\(\(\/O@fffff&O@Gz ףp= O@0(\N@(\5N@(\= ףpN@(\5N@N@( (\uM@(\•M@ (\•M@(\uM@H ףp=L@Gz@M@ ףp=L@GzM@Gz@M@(\M@ ףp=L@ ףp=L@H#@fffffK@%@ ףp=K@#@\(K@)\($@fffffK@ffffff%@fffffK@%@(\K@(\$@ ףp=K@#@\(K@`)\(&@q= ףK@)\()@ L@ )\(&@K@&@K@)\'@q= ףK@R(@p= ףK@RQ(@\(K@)\()@K@R(@ L@'@33333K@)\(&@K@H&@ ףp=JK@)\((@(\uK@&@ ףp=jK@)\&@ ףp=JK@)\'@(\UK@)\((@ ףp=jK@)\('@(\uK@&@ ףp=jK@PGz2@ ףp=L@Q+3@(\L@Gz2@L@@2@ ףp=L@2@p= ףL@2@L@Q+3@(\L@Qk2@p= L@Gz2@L@HGz5@ M@Q+7@(\OM@Gz5@ ףp=*M@Q+6@ M@Q6@fffff&M@Q+7@@M@GzT6@(\OM@Gz5@ ףp=*M@@GzT6@\(\M@7@ ףp=M@GzT6@q= ףpM@Qk6@\(\M@7@ ףp=jM@6@ ףp=M@GzT6@q= ףpM@GzI@HzG? ףp=JM@]\(\ ףp= I@\(\I@ ףp=*I@q= ףp (\I@ ףp=JI@Q(\UI@Q@I@zG`I@(\(\UI@{Gz?(\UI@q= ףp? ףp=jI@Q?I@(\? ףp=I@?I@HzG?J@HzG?(\5J@HzG?`J@?(\uJ@(\?(\uJ@?(\UJ@ ףp=jJ@Q? ףp=J@(\?(\µJ@{Gz(\J@пK@(\5K@zG ףp=JK@K@zGK@ףp= HzK@ ףp=K@q= ףpL@Q L@Q L@q= ףp ףp=JL@QL@q= ףp ףp=L@zG(\L@(\L@q= ףp (\L@Gz ףp=L@QM@ ףp=*M@q= ףp ףp=JM@\(\@M@@M@\(\ ףp= M@L@\(\(\µL@\(\ ףp=L@Gz(\µL@(\•L@\(\(\•L@(\UL@ ףp=*L@Gz@L@ ףp= L@GzK@\(\K@\(\(\µK@\(\ ףp=K@GzK@\(\(\uK@ ףp=JK@`K@ (\uK@Gz (\uK@Q @K@q= ףp (\K@q= ףp(\K@J@ ףp=J@= ףp= ףp=J@Q J@ ףp=J@\(\ ףp=J@Gz`J@\(\`J@\(\ J@\(\ ףp= J@Gz ףp=I@ ףp=I@\(\(\I@Q ףp=I@Q ףp=I@= ףpI@q= ףp ףp=I@(\•I@ (\•I@\(\(\•I@`I@(\5I@\(\ ףp= I@Gz$I@\(\K@ Gz$(\J@Gz.$I@Gz.#I@! ףp=I@ I@ ףp= J@\(\(\J@Gz ףp=JJ@J@\(\J@(\J@(\K@\(\ K@`K@\(\ ףp=K@(\•K@(\•K@K@ ףp=K@ףp= W!(\UK@ףp= W @K@! K@Gz." K@# K@$(\J@#J@$J@#(\•J@"(\•J@#(\UJ@#(\J@Gz$(\J@h)\(!@ ףp=D@#@E@ RQ!@@E@)\(!@ ףp= E@RQ!@D@RQ"@ ףp=D@)\"@ ףp=D@#@(\E@R"@@E@R"@E@RQ"@(\UE@RQ!@@E@RQ @ ףp=jC@#@D@RQ @(\uD@RQ @ ףp=JD@R @(\D@R @(\C@)\ @(\•C@!@ ףp=jC@)\("@(\•C@#@(\•C@RQ#@ ףp=C@#@D@#@(\5D@RQ#@ ףp=jD@"@D@!@(\uD@R @ ףp=jD@RQ @(\uD@)\(@(\UB@RQ/@ C@)\(@(\B@RQ)@B@*@B@RQ+@(\•B@RQ,@ ףp=B@-@`B@RQ.@(\UB@)\.@B@RQ.@ ףp=B@)\.@ ףp=B@RQ/@ C@.@ ףp= C@,@C@RQ+@C@*@(\C@)@(\C@)\(@(\B@Gz5@(\5B@Q+7@ C@Gz5@B@Gz5@(\µB@5@B@Q5@`B@Gz6@`B@GzT6@(\5B@Q6@`B@Gz7@(\5B@Gz6@B@Q6@(\µB@Q+7@ ףp=B@Gz6@ ףp=B@GzT6@ ףp= C@Gz5@ C@GzT5@ ףp= C@Gz5@B@7@33333sA@@:@ ףp=A@7@(\•A@8@(\•A@8@ ףp=A@Gz8@33333sA@9@(\uA@Q+:@\(|A@@:@A@9@ ףp=A@9@ ףp=A@Q+9@fffffA@8@(\µA@@8@ ףp=A@Q+8@A@Gz7@ ףp=A@7@(\•A@ @@ ףp=JA@@A@ ףp=A@ @@A@(\5@@(\UA@@@ ףp=JA@@@YA@(\@@(\uA@ ףp= A@(\uA@(\@@(\•A@@A@ ףp=A@(\@@(\µA@(\µ@@ ףp=A@@@A@`@@ ףp=A@ @@A@H@(\C@\(\ @(\C@@ ףp=C@(\@C@p= ף@(\C@\(\ @(\C@\(\@(\C@@ ףp=C@@Q;@q= ףA@@<@9B@Q;@(\B@;@q= ףA@Gz<@ ףp= B@@<@9B@Q;@(\B@0:@fffffC@@:@fffffC@:@\(C@@:@fffffC@@:@fffffC@(:@ C@:@@C@:@@C@:@ C@(Gz<333333C@Gz.<)\HC@Gz<)\HC@Gz.<333333C@(ףp= 9fffffB@Gz.9fffffB@ףp= 9fffffB@Gz.9fffffB@Hףp= 0<@Gz.0Gz<@ףp= 0GzT<@ףp= 0<@ףp= W0Q+<@Gz.0Gz<@0zGa<@ףp= 0GzT<@HQ/;@Gz.Q+<@Q/<@ףp= W/;@Gz.Gz;@(\.Gz<@ףp= W/Q+<@Q/<@`,Gz<@ףp= *Q+=@ ,Gz<@Gz+@<@Gz+Gz<@+Q<@ףp= *Q+=@ףp= W+Gz=@Gz+Gz<@,GzT<@,Gz<@@!@ @R!@@!@p= ף @!@ @R!@p= ף @RQ!@@!@p= ף @8\@ףp= C33333b@ףp= ?d\@ףp= A\@Q+Afffff]@QkA,]@AL]@Al]@A33333]@Afffff]@`A]@ףp= 7A]@ףp= 7A33333]@Afffff^@ףp= @333333^@Q@33333S^@Q@y^@Q@fffff^@Q@fffff^@Q@fffff^@Q@_@@fffff_@@333333_@Qk@L_@ףp= W@33333s_@Q+@̌_@ףp= @_@ @_@ףp= @`@Q @33333`@ףp= ?33333#`@Gz?fffff6`@ףp= ?I`@ףp= ?Y`@ףp= ?i`@ףp= ?y`@?`@@`@@̬`@ףp= @̼`@Q+@`@QK@fffff`@@`@@`@@`@ףp= A`@QKAfffff`@A`@QKA a@ Afffffa@ףp= @)a@ףp= @0a@ףp= @9a@Qk@)c@>,c@=0c@=fffff6c@Gz<0c@Gz.<)c@ףp= ;fffff&c@ףp= ;33333#c@:33333#c@ףp= :c@933333c@ףp= 9fffffc@ףp= 8b@ףp= 8b@Gz7b@ףp= 7b@Gz.7b@Gz6b@Gzn6b@ףp= 6b@Gzn6b@Gz5b@Gzn5fffffb@ףp= 5b@ףp= 4b@Gzn4b@Gz.4yb@ףp= 3pb@Gzn3`b@ףp= W3Lb@3Ib@Gz233333Cb@ףp= W2fffffFb@ףp= 133333Cb@ףp= W19b@10b@ףp= 00b@0)b@/)b@.b@ףp= W-33333b@Gz,33333b@-a@Gz,33333a@+33333a@*a@ףp= W)33333a@ףp= W(a@ףp= W'a@Gz.&a@Gz%33333a@&33333a@Gz'fffffa@ףp= W(fffffa@ףp= W)fffffa@*fffffa@Gz.+33333a@Gz.,33333a@Gz.-fffffa@Gz..33333a@Gz./a@ףp= 0a@ףp= 0a@1a@1a@1a@ףp= 1la@Gzn1ffffffa@1fffffVa@ףp= 033333Ca@ףp= 0fffff6a@ףp= W0)a@033333a@0 a@/a@Gz.33333`@.fffff`@Gz.-a@,a@Gz+a@Gz*33333a@Gz*fffffa@Gz) a@ףp= (a@Gz.(33333a@Gz.)`@ףp= W(`@Gz(fffff`@ףp= W(33333S\@ףp= Afffff`@ףp= &]fffff`@ףp= W(33333`@(`@ףp= '`@Gz.'`@ףp= &fffff`@Gz'̌`@Gz(fffffv`@Gz(33333c`@Gz(P`@)fffffF`@ףp= W*L`@Gz.+<`@ףp= W+9`@Gz.,)`@-9`@Gz-fffff6`@.33333#`@ףp= -fffff`@ףp= -fffff`@.fffff`@-33333_@ףp= ,_@,33333_@ףp= +fffff_@,fffff_@Gz,y_@ףp= W-L_@ףp= W-L_@Gz..,_@/fffff&_@033333_@Gzn033333^@Gz.0fffff^@Gz0^@1^@1^@ףp= 1^@0fffff^@1̌^@Gzn1̌^@ףp= 133333^@Gz.2y^@ףp= 2l^@ףp= 333333S^@Gzn39^@333333^@ףp= 333333]@4]@433333]@ףp= W4̌]@ףp= W4l]@Gz4L]@Gz4,]@Gz433333]@ףp= 433333\@ףp= 5\@5fffff\@Gz5fffff\@Gz533333\@ףp= W6fffff\@ףp= 533333s\@@6l\@Gz633333s\@ףp= 733333s\@7Y\@Gz7`\@Gzn8l\@9y\@Gzn9̌\@ףp= 9̌\@Gzn:l\@ףp= :`\@Gz933333s\@ףp= :33333S\@Gz.:`\@Gz:y\@;̌\@Gz;̌\@ףp= \@>\@?fffff\@Gzn?33333\@?33333\@Q+@\@ףp= w@33333\@@fffff\@@\@Q@\@ףp= AX33333C`@(p`@Gz&33333C`@Gz'fffffV`@Gz'``@(p`@Gz.'i`@Gz&Y`@'I`@Gz&33333C`@Gz'P33333a@ףp= B33333Ca@ףp= A33333a@ףp= Aa@ףp= B333333a@ףp= B33333Ca@ףp= A,a@ףp= Aa@A33333a@ףp= Ab@QEb@ףp= WDb@ףp= WDb@ףp= D b@Dfffff&b@ףp= E)b@@E0b@ףp= wE9b@EfffffFb@EYb@QEffffffb@ףp= Epb@QkE|b@QEb@QKEfffffb@ףp= Eb@Eb@Db@Db@QkDib@DYb@ףp= DfffffFb@ףp= D0b@QkDb@ףp= WDe@QDPf@@A5e@QCfffffe@ףp= Cfffffe@QC33333e@Dfffffe@Q+D33333e@ףp= wDe@QDfffffe@QDe@ףp= Dffffff@D f@ףp= WDf@ D f@Cf@C33333#f@C0f@QCaQhQ@azGQQ@a@Q@a= ףpQ@aQ@aP@a(\P@a(\P@a(\P@a= ףp]P@a(\?P@aQP@aQO@a{GO@a= ףp}O@aQ>O@aO@aq= ףN@aQ~N@a9N@Qa,N@Qa(\/N@RyaHz'N@pa333333N@`ap= #N@Q]a{GN@Q]ap= N@PaQM@QCaQM@0aHzM@Q-aq= ףM@R)a(\uM@RaRM@aGzM@R a= ףpM@R aHzM@R a33333M@Qa(\µM@aHzM@Q`(\M@Q`M@`QM@Q`M@Q`RM@Q`̬M@`QM@Q`Q~M@R`ffffffM@R`Q>M@R`\(@Q>@333333>@QzGa>@Gz{G=@ףp= = ףp=@Gzp= ף=@Gzp= ף=@Gzq= ףp=@Q(\u=@)\(HzG=@zG33333<@HzG!<@HzG!(\<@HzG!= ףp;@(\"Q;@{G#Q;@%{G;@Q&Q;@Gz'33333;@(\'(\µ;@q= ף((\µ;@Gz.*(\µ;@/ 1R5@= ףp=!= ףp;@!HzG!= ףp;@= ףp=!\(\;@(\B!(\:@= ףp=!q= ףp:@HzG!{G9@(\!Q9@Q#333339@{G#q= ף9@p= #%Q9@&Q9@{G&fffff9@')\9@')\h9@R'Q8@R')\h8@ףp= 'Q7@ףp= '= ףp}7@)Qk7@p= ף)Y7@*)\(7@Gz.*Gz6@)\(*\(\6@Q*Q5@zG)p= c5@p= #+zGa5@Q+p= c5@Gz-zGa5@(\.zGa5@)\(/zGa5@{G/Q^5@0Q^5@(\0\(\5@1R5@0Gzn0{G-@(\)Gz0@Gzn0(\0@Gz.033333s0@ףp= /(\u0@zGa/q= ףp0@Gz/0@RQ.(\0@Q.Gz0@Gz.-0@zGa,33333s0@(\+q= ף00@)\+(\0@{G*Hz0@+Hz0@*Q/@)\(*{G.@*Hz.@ףp= ))\.@ףp= )Qk.@(\){G-@1RQ'.@= ףp=\(\;@4= ףp=!\(\;@Q(\;@ףp= )\:@Q^:@QHz:@(\9@Qk9@Q+9@= ףp== ףp8@(\Q8@Q8@333333{G8@ ףp= Qk8@ףp= (\7@Q= ףp}7@RQQ6@GzQk6@333335@{Gz)\h5@= ףp=333334@ ףp= q= ףp4@333333@Qq= ףp3@\(\{G2@QQk2@zG{G1@Gzq= ףp1@ffffffq= ף0@333333Qk0@{G:0@333333{G.@RQq= ף.@Qq= ף.@HzGfffff.@Q.@(\zG.@zGzG.@)\(!fffff.@q= ף!zG.@q= ף!Q/@ףp= W"Q/@zGa".@333333#Hz.@Q#R.@Q$\(.@(\$)\.@Qk%333333.@)\%(\B.@Gz%.@q= ףp&q= ף.@'R.@RQ'.@2= ףp= ףp= .@333333@= ףp8@-= ףp== ףp8@RQQ8@Qq= ףp8@ףp= Q8@)\(7@GzQx7@)\(7@333333Hz6@Gz(\6@Q޿zG!6@{GzQ5@= ףp=?Qx5@Gz?(\55@Q?R5@ףp= ?(\5@Q?(\4@ףp= ?zG4@{Gz?Qx4@(\@GzT4@= ףp=@p= c4@@{G:4@= ףp=@= ףp3@ @p= 3@Q @(\3@Q @Q+3@ffffff @Gz3@ @ 3@Gz@Q+3@Gz@= ףp=3@)\(@(\µ2@333333@Q2@)\(@ ףp=1@)\(@(\1@q= ףp@333330@Q@)\h0@(\@ ףp= 0@= ףp=@/@Q @Q/@{Gz @Q.@(\@Gz.@@\(\.@?(\B.@Q?Q8.@)\(?333333.@= ףp=? ףp= .@3Gz@= ףp=3@(@(\uB@;L!@(\uB@{Gz @q= ףPB@33333 @Q>B@ ףp= @{GA@p= ף @A@R @̬A@)\ @(\uA@ffffff @(\UA@ @= ףp=A@Q@(\A@= ףp=@{G@@= ףp=@(\@@Q@= ףp@@Qk @Q@@ @L@@(\"@p= #@@Qk"@Q?@ףp= "@33333>@Gz.#@p= c>@= ףp"@zGa>@Q"@fffff&>@RQ#@Q=@#@Qx=@ףp= #@{G<@33333#@(\<@ ףp=#@L<@q= ף#@Q;@#@(\O;@= ףp#@fffff:@(\#@Qk:@R"@(\O:@fffff"@fffff&:@Q#@9@)\($@= ףp}9@(\B$@(\8@p= ף$@ ףp=8@= ףp$@(\8@%@)\h8@%@p= ף8@L&@Qk8@'@= ףp=8@p= ף'@Q7@(@7@'@(\O7@ ףp= &@Q6@fffff$@)\6@{G#@zGa6@zG"@R6@Q!@R5@q= ף @(\5@ @@5@Q@p= 4@Q@̌4@zG@Q+4@ ףp= @Gz3@{Gz@R3@Q@Qk3@\(\@GzT3@Gz@= ףp=3@4Gz.#@p= c>@)\('@)\@@'@)\@@q= ף&@\(|@@)\('@q= ףP@@'@p= C@@&@Q@@333333%@(\?@(\%@p= ?@$@?@Gz$@(\?@ffffff$@p= ף?@$@Q^?@)\$@fffff&?@{Gz$@ ףp=>@(\$@Hz>@ ףp=#@ffffff>@Gz.#@p= c>@50(@.@(\0@7@#(@7@p= #(@ ףp=7@)@(\7@{G)@ ףp=7@(\+@(\7@,@{Gz7@ffffff,@q= ףp7@p= #-@(\57@\(-@ 7@.@p= #7@)\.@Gz6@(\u.@{G5@zGa.@)\5@Q.@@5@/@\(5@p= #/@fffff&5@L/@Hz5@(\.@q= ף4@= ףp=/@333334@{Gz/@(\4@(\0@= ףp}4@/@(\3@L/@33333s3@)\(/@(\2@Q/@(\u2@/@{G1@)\(/@Qk1@)\(/@(\1@Gz/@= ףp0@.@(\u0@{G-@\(0@)\(-@/@{Gz,@Hz.@(\+@HzG.@q= ף+@.@6.@ ףp=3@Gz9@fffff?@2Gz9@fffff?@Q8@(\?@R8@@?@333338@= ףp>@= ףp8@>@Q8@{Gz>@Q8@Q+>@p= 8@(\µ=@Q8@(\=@{G8@zG!=@9@33333s<@= ףp8@Q;@9@q= ףp;@{G8@{G:@{G8@Qk:@= ףp8@:@(\8@q= ףp9@Q8@{G8@(\8@Qx8@(\8@8@333338@Qk7@333338@= ףp6@333338@33333s6@(\8@Q5@333338@Hz5@333338@(\5@(\8@Gz4@{G8@Q+4@(\u8@fffff&4@{G7@Q4@Q7@ ףp=3@Qk7@(\3@Hz7@(\4@33333s6@Y4@(\6@ ףp=4@p= c5@Q4@(\5@(\5@{Gz4@ ףp=J5@(\4@(\5@(\u3@5@Hz3@(\6@p= c2@GzT6@{G1@ ףp=6@{Gz1@(\6@1@= ףp6@Hz0@= ףp=7@Hz0@{Gz7@333333/@RQ7@333333/@RQ7@.@p= #7@7Q6@.@= ףp7@ ףp=3@ Q7@ ףp=3@{G7@= ףp2@{G7@(\u2@{G7@= ףp1@{G7@= ףp}1@{G7@1@Q7@{Gz0@= ףp7@/@Q7@/@\(\7@p= ף/@7@p= ף/@= ףp6@Hz.@Q6@.@8(\8@q= ף5@(\uB@Hz6@(\8@Q5@R9@= ףp5@:@(\5@ ףp=:@(\5@(\;@(\5@Gz;@(\5@<@{G5@ ףp=<@{G5@Q<@{G5@(\=@(\5@{G=@Q5@(\>@q= ף5@?@Q5@)\h?@Hz6@Q?@(\5@= ףp?@q= ף5@HzG@@333335@{Gz@@(\5@Hz@@333335@zGA@(\5@zGAA@Q5@A@Q5@p= A@333335@B@(\5@Q>B@{G5@(\uB@(\5@9`zGAB@.@(\BC@ 2@ (\BC@ 2@ ףp=*C@(\1@B@\(1@33333B@Q+1@HzB@Q+1@QxB@zG0@ ףp=jB@ 0@fffffFB@Gz/@zGAB@.@:zG(\K@(\•K@(\•K@ffffff(\oK@ףp= `K@ףp= (\OK@QQKK@zG\(@)\E@p= ף @RI@9@RI@)\(@lI@(\@zGaI@@`I@q= ףp @)\hI@(\ @ ףp=jI@Q @QKI@ @p= CI@ @fffffFI@@p= CI@{Gz@Q+I@Q@GzI@Gz@fffffI@{Gz@p= I@HzG@HzI@(\@I@= ףp=@QH@Q@zGH@(\@H@q= ףp@QH@ffffff@QH@ףp= @zGH@Gz@̬H@@(\H@@{GH@p= ף @q= ףH@ףp= W @\(|H@)\(@q= ףPH@@QH@)\(@(\G@RQ@q= ףG@@p= G@\(\@(\G@{Gz@RG@ ףp= @33333G@HzG@(\uG@\(\@ffffffG@Q@(\5G@@QG@333333@Q+G@(\@(\BG@@p= CG@ףp= @Q8G@Q@G@ףp= @= ףpF@= ףp=@HzF@(\@ ףp=F@@̬F@Gz@(\•F@q= ףp@HzF@(\@lF@Gz@33333SF@= ףp=@9F@Q@(\"F@(\@)\(F@\(\@ F@zG@)\E@?8333333?)\HE@HzG?`E@HzG?)\HE@RQ?{GZE@(\?`E@333333?= ףp]E@@ ףp= @QH@ףp= @\(I@ ףp= @̬I@(\@= ףpI@Q@)\I@HzG@(\µI@333333@\(I@HzG@33333I@(\@RI@ffffff@p= ףI@{Gz@RI@ףp= @(\uI@Gz@lI@{Gz@lI@q= ףp@{GZI@ףp= @ ףp=JI@@333333I@RQ@I@RQ@(\I@zG@QH@(\@HzH@q= ףp@QH@AHzG@lI@HzG@(\µJ@@(\µJ@HzG@p= ףJ@Gz@fffffJ@@lJ@zG@QKJ@= ףp=@fffff&J@333333@p= J@@J@Gz@QI@{Gz@GzI@{Gz@QI@(\@p= I@@(\I@HzG@QxI@{Gz@lI@B ףp= @F@(\B%@(\G@!RQ@q= ףG@Q@q= ףG@= ףp @q= ףG@HzG!@G@fffff!@(\G@zGa"@HzG@zG"@GzG@#@(\G@333333#@p= ףG@(\#@)\G@ ףp=#@̌G@\(#@̌G@)\($@RqG@zG$@QG@p= #%@(\uG@%@(\oG@(\B%@`G@Q%@q= ףPG@Gz$@Q>G@Qk$@,G@fffff#@R1G@#@q= ף0G@333333"@333333G@RQ"@)\G@(\"@F@33333!@(\G@L!@R1G@zG @(\BG@Qk @,G@Qk @G@Q@ G@ffffff@HzG@ףp= @= ףpF@C8RQ@zGH@333333@I@RQ@I@(\@HzI@333333@q= ףH@ףp= @zGH@Dp= #%@F@Q+@RG@(\+@F@ ףp=+@F@Q+@(\F@ffffff+@p= F@ffffff+@(\G@+@HzG@HzG+@ G@Q*@Q+G@RQ+@q= ףPG@*@= ףp]G@333333)@zGaG@p= ף(@yG@(\u(@RG@R'@ ףp=G@R&@p= ׃G@ ףp= &@GztG@p= #%@(\uG@E0RQ!@q= ףpK@\("@Q~K@RQ!@q= ףpK@Q"@GztK@\("@Q~K@F(333333#@̌G@ ףp=#@p= ףG@333333#@p= ףG@ ףp=#@̌G@G#@33333G@)\(.@QJ@5\(\,@QJ@p= #-@\(J@RQ,@= ףp}J@p= #-@(\OJ@ ףp=-@(\J@ffffff-@q= ףI@-@RI@)\(.@(\I@\(-@{GzI@ ףp=-@GztI@-@QI@{Gz,@̌I@Gz,@GztI@Q+@HzgI@333333+@QXI@{Gz*@ ףp=JI@p= #*@@I@ffffff)@{G:I@fffff(@(\/I@(@9I@Qk(@(\5I@(\(@)\(I@(@I@{G(@)\I@{G(@q= ףH@zGa)@ ףp=H@fffff)@GzH@Q*@\(H@RQ+@= ףp}H@)\+@(\oH@q= ףp+@{GZH@ ףp= +@33333SH@\(*@Gz4H@Gz*@= ףpH@(\)@q= ףH@(\*@GzG@p= #*@p= G@)\(*@33333G@ ףp= *@(\G@zG)@QG@q= ף(@zGG@= ףp'@\(G@= ףp'@\(G@Q&@zGG@Q8&@QG@33333%@G@Q%@RG@%@G@)\$@33333G@RQ$@\(G@{G#@33333G@#@(\G@#@(\G@H RQ+@@G@Q1@ ףp=H@!)\+@(\oH@(\B,@QXH@Gz,@LH@RQ-@q= ףPH@-@p= cH@Q.@lH@Gz.@ ףp=H@zG.@H@(\u/@(\H@R0@(\uH@ ףp=0@GztH@\(0@RqH@333330@p= cH@333330@= ףp=H@Q0@ ףp=*H@Q1@(\H@{G0@{GG@(\0@RG@0@QG@Gz0@{GG@p= c0@G@p= #0@zGG@{G/@33333sG@p= #0@p= cG@ 0@\(\G@)\(/@p= cG@.@(\bG@ ףp= .@`G@-@ ףp=JG@p= #-@@G@(\u,@p= CG@R+@LG@RQ+@q= ףPG@I\(-@HzG@\(\6@(\I@<\(-@{GzI@{G-@zGI@RQ.@ ףp=I@.@(\I@)\.@I@Hz.@(\bI@HzG/@zGaI@)\/@p= cI@Q/@GzTI@33333s0@GzTI@GzT0@\(H@(\5@fffffFH@Hz5@LH@Q+5@QKH@Q4@RQH@Q4@RQH@ffffff4@9H@Q+4@p= #H@Q3@Hz'H@Q83@H@Q2@p= H@= ףp2@(\G@GzT2@HzG@R1@)\G@Qk1@33333G@Q1@(\H@Jp= #0@RF@Q6@)\HH@3333336@)\HH@(\B6@p= CH@\(\6@fffff&H@Q6@QH@(\µ6@)\G@(\B6@(\G@Q5@33333G@Gz5@\(|G@GzT5@p= CG@fffff&5@q= ף0G@(\4@ ףp=*G@Y4@\(G@Q3@(\"G@ ףp=3@p= #G@GzT3@(\G@Hz3@fffffG@Q2@G@p= ף2@F@GzT2@RF@ ףp= 2@33333F@Gz1@= ףpF@Q1@fffffG@p= c1@ G@Q+1@fffff&G@(\0@= ףp=G@= ףp}0@QXG@p= #0@p= cG@K8Y4@GztD@zG!7@\(G@$Y4@\(G@Gz4@= ףpF@p= 4@q= ףF@q= ף4@{GF@)\(5@̬F@q= ףp5@fffffF@(\5@)\F@ffffff5@(\uF@{G5@lF@Q5@p= cF@Q6@33333SF@(\6@p= cF@)\6@Q^F@= ףp6@(\OF@zG6@{G:F@{G6@ ףp=*F@̌6@ ףp= F@Qx6@\(E@(\6@QE@Q6@E@Q6@̬E@(\6@{GE@(\6@p= ׃E@Gz6@yE@Gz6@(\OE@R6@Hz'E@6@ E@(\7@(\D@zG!7@(\D@(\7@\(D@(\6@p= ףD@q= ףp6@D@R6@(\•D@= ףp5@Q~D@HzG5@D@= ףp4@GztD@L{G6@E@)\<@ ףp=*F@{G6@ ףp=*F@q= ף6@(\F@p= 6@QE@(\6@GzE@\(\7@QE@(\7@q= ףE@zG7@E@Q+8@(\E@Qx8@ ףp=E@{G8@zGE@q= ףp9@E@9@QE@Q+:@(\F@fffff:@RF@= ףp:@\(F@33333s;@(\F@;@(\F@)\;@QF@Q+<@QE@)\<@(\E@M(\µ6@ ףp=F@zG=@333333H@(\µ6@)\G@Q6@p= H@)\(7@RH@ ףp=7@Q H@Gz7@QG@Q8@H@RQ8@HzH@333338@33333G@Q8@(\G@L9@p= H@(\9@(\H@Gz:@= ףpH@Qx:@333333H@ ףp=:@(\/H@= ףp:@p= #H@\(;@p= H@\(\;@p= G@̌;@ ףp=G@)\;@GzG@\(<@RG@q= ף0<@{GzG@(\B<@\(\G@fffff&<@Hz'G@Q+<@(\F@fffff&<@F@(\<@ ףp=F@33333<@{GF@Y=@HzF@(\=@33333F@zG=@GzF@N33333s3@zGC@(\5@(\bE@33333s3@p= D@Qx3@p= #E@3@YE@333333@(\bE@q= ף3@RQE@q= ף04@q= ףPE@zG4@zG!E@fffff4@{GD@\(4@QD@333334@(\•D@(\4@zGD@= ףp4@GztD@(\5@zGaD@zG4@333333D@(\µ4@D@̌4@Q D@(\4@C@q= ף3@zGC@O(\6@YD@(\µ:@(\D@(\6@p= ףD@Y7@QD@{Gz7@(\D@{G7@(\D@ ףp=J8@(\D@Q8@QD@(\9@33333D@Q9@QD@)\(:@zGD@@:@33333D@p= #:@ ףp=D@Q:@(\D@(\µ:@D@33333:@zGD@ ףp=:@̬D@= ףp}:@̌D@zG9@YD@P0{G3@HzH@Q+8@HzGK@#{G3@Q>K@ffffff4@HzGK@q= ף4@p= CK@Qx5@= ףp=K@q= ף5@(\5K@ ףp=6@q= ף0K@)\6@q= ף0K@fffff6@\(@Q@6 ףp=4@QHQ@= ףp4@)\HQ@ 5@(\EQ@Q+5@HzGQ@ ףp= 5@= ףpMQ@Q+5@(\UQ@)\h5@fffffVQ@Q5@(\RQ@(\6@GzDQ@{G:6@(\5Q@Qk6@q= ף0Q@q= ף6@\(,Q@RQ7@)Q@Gz7@ ףp=*Q@Q7@,Q@7@fffff6Q@8@fffff6Q@Q+8@(\/Q@ ףp=8@= ףp-Q@Q8@Hz'Q@ ףp=8@fffff&Q@9@)Q@Q89@p= 3Q@Gz9@Q>Q@Hz9@IQ@(\9@GzTQ@\(9@Q[Q@\(9@zGaQ@(\:@(\oQ@Hz:@Q@(\:@Q@Gz;@RQ@(\;@GzQ@)\;@Q@(\B<@Q~Q@)\h<@ ףp=zQ@(\<@(\uQ@fffff&=@(\oQ@Gz=@(\eQ@(\<@)\XQ@q= ף<@PQ@Gz<@HzGQ@q= ף<@(\EQ@\(<@fffffFQ@ =@{GJQ@q= ף0=@(\RQ@ffffff=@YQ@33333=@Q^Q@Hz>@p= cQ@fffff&>@\(lQ@Qk>@(\eQ@fffff>@(\eQ@>@{GjQ@zG>@zGqQ@UpR;@ ףp=JN@{Gz?@HzGQ@+R;@ ףp=JN@Q;@Q~N@(\<@{GN@q= ף<@(\N@\(\=@{GN@33333=@= ףpN@= ףp}>@zG!O@q= ף>@zGAO@(\B?@p= cO@{Gz?@fffffO@333333?@(\•O@(\?@33333O@(\u>@(\O@= ףp=@p= O@Q^>@\(O@Qk>@fffffP@(\O>@fffffP@ ףp= >@\(P@= ףp=@333333P@Gz=@{G:P@̌=@33333CP@(\=@\(LP@Hz=@fffffVP@ ףp==@HzgP@\(=@(\oP@Gz>@p= sP@ ףp==@(\…P@Y=@(\P@{G<@P@)\<@GzP@p= #=@QP@=@RP@(\>@(\P@(\u=@= ףpP@(\B=@ Q@33333<@fffffQ@Q8<@Gz$Q@\(<@{G*Q@GzT<@fffff6Q@q= ף0<@ ףp=:Q@Q+<@= ףp=Q@L<@q= ף@Q@Gz<@HzGQ@Vq= ףA@(\A@GzTF@GzD@;D@zGD@QD@D@,E@p= D@fffffFE@GzD@(\UE@33333D@{GZE@33333D@= ףp}E@QD@QE@(\D@q= ףE@= ףpD@p= E@p= ףD@QE@Q~D@E@(\OD@(\E@q= ף0D@(\E@(\D@,F@D@(\BF@(\D@(\OF@{GC@zG!F@{GC@p= #F@HzC@33333F@{GC@p= #F@QkC@\(B@RQB@,B@,B@(\"B@Hz'B@(\B@RB@(\B@(\B@(\A@q= ףA@(\A@WHzA@)\(@@Q8E@(\•B@Q8E@(\•B@zGE@(\uB@D@q= ףPB@q= ףD@q= ף0B@QD@\(A@= ףpD@(\A@̬D@(\•A@zGD@RqA@Q~D@(\BA@(\BD@(\/A@p= D@p= A@QC@p= @@p= ׃C@(\@@lC@(\µ@@p= CC@= ףp@@{GB@Q~@@= ףpB@{GZ@@B@9@@GzTB@)\(@@,B@,@@)\B@(\O@@A@p= c@@HzA@ ףp=j@@A@(\@@(\A@= ףp@@p= B@q= ף@@(\B@Hz@@333333B@\(A@q= ף0B@QKA@HzA@LA@XLF@HzGC@ ףp=jH@zGD@LF@zGD@{GzF@\(C@(\F@̌C@p= F@= ףp}C@QF@QxC@QG@yC@QXG@(\•C@G@QC@(\G@zGC@G@33333C@(\H@)\C@ H@p= C@(\H@C@(\H@ ףp=C@{GG@QxC@QH@QXC@p= CH@HzGC@ ףp=jH@QKC@YzG!A@R=@QC@(\µ@@lC@(\µ@@(\C@(\u@@GzC@= ףp=@@\(C@{G@@QC@ ףp= @@LC@fffff?@HzC@?@q= ףB@zG?@p= ףB@?@(\B@Y?@(\µB@ ?@B@(\µ>@ C@p= c>@GzB@Gz=@\(|B@\(=@{G:B@R=@)\A@)\(=@p= ׃A@(\O=@GztA@33333=@GzTA@(\O>@{G:A@fffff>@zG!A@Qk?@Z\(C@333333=@(\H@fffffB@4GzTF@fffffB@HzgF@QB@p= ׃F@p= ׃B@ ףp=F@LB@ ףp=F@QB@p= F@QB@QF@p= B@33333G@ B@F@HzA@zG!G@fffffA@33333G@fffffA@QF@̌A@{GF@`A@p= F@GzTA@HzF@Hz'A@33333F@{G@@\(F@ ףp=@@(\G@zG@@33333sG@(\o@@QG@@@@(\G@Q@@QG@zG?@p= G@\(?@QG@Q8?@\(G@Q+?@zGH@(\>@(\H@(\u>@(\H@Gz>@Q H@>@GzG@Gz>@HzG@>@p= ׃G@Q=@\(\G@{Gz=@(\5G@333333=@\(F@p= c=@F@̌=@QF@ffffff=@ffffffF@{G:=@p= #F@Qk=@QE@q= ף=@QE@Gz>@(\E@Qx>@(\E@33333s>@)\E@R>@@E@= ףp>@= ףpD@Q?@ ףp=D@\(\?@(\•D@)\?@33333SD@)\?@= ףpC@Gz@@̬C@= ףp@@\(C@{G@@[RqA@(\O=@HzA@ ףp=j@@p= ׃A@(\O=@ ףp=A@(\=@zGA@Q=@(\•A@{G:>@A@(\>@(\A@Q>@ ףp=A@= ףp=?@HzA@(\?@A@?@RqA@\(?@{GzA@?@p= ׃A@p= ?@(\uA@ ףp= @@QxA@p= #@@zGA@(\5@@HzA@)\H@@(\•A@L@@GzA@Q>@@QA@q= ףP@@HzA@ ףp=j@@\hffffffF@Q<@Q+H@{G:=@ Q+H@= ףp<@H@33333<@GzG@Q<@)\G@Q+=@ ףp=jG@Q+=@(\5G@333333=@(\G@(\=@\(F@Q<@̌F@Hz=@ffffffF@{G:=@]@{GA@Hz@@(\A@= ףp@@(\A@= ףp@@\(A@Q@@QA@Hz@@QA@Hz@@{GA@(\µ@@^YE@.@33333F@Gz1@YE@\(\0@RE@p= ף0@(\E@ ףp= 1@(\•E@GzT1@(\µE@Gz1@q= ףE@Qk1@Q F@zGa1@LF@Hz1@Q^F@(\1@(\oF@0@33333sF@(\B0@{GzF@ 0@zGF@)\(/@(\•F@R.@QF@R.@33333F@\(.@RF@q= ףp.@F@.@_33333F@\(.@p= J@1@p= J@Q0@(\•J@3333331@p= cJ@(\1@\(J@1@(\µI@)\1@QXI@(\u1@GzI@L1@GzH@)\(1@(\•H@1@= ףp=H@Hz0@\(G@0@(\µG@Qk0@\(|G@Q+0@= ףp=G@(\/@)\G@333333/@F@q= ף.@33333F@\(.@`0(\I@= ףp1@YM@(\9@#p= cJ@(\1@J@= ףp1@J@Gz1@zG!K@333331@YK@2@̌K@)\h2@GzK@Q2@HzK@p= #3@ ףp= L@= ףp}3@{G:L@3@)\hL@(\54@{GL@4@fffffL@R4@L@)\(5@{GM@R5@p= CM@(\6@YM@33333s6@Q+M@6@33333L@R7@QL@GzT7@ ףp=L@fffff7@(\UL@fffff7@Q+L@q= ף08@fffffL@p= ף8@= ףpK@(\9@)\K@fffff8@zGK@(\8@HzK@q= ף08@HzgK@{G7@(\/K@(\7@(\J@p= c7@(\J@p= c7@QkJ@\(\7@R1J@(\7@(\I@= ףp7@a(q= ףL@Gz9@(\5L@Q9@q= ףL@Q9@(\5L@Gz9@bPH@RQ8@p= ףI@= ףp=:@ I@= ףp=:@H@:@RH@Hz9@ I@)\h9@LI@(\9@(\uI@Q8@p= ףI@RQ8@cRJ@p= #9@\(O@,C@;(\N@p= #9@QN@Hz:@N@ffffff:@zGO@Hz:@(\BO@:@\(|O@)\:@\(O@(\;@(\•O@)\h;@RQO@Qk;@LO@(\<@HzGO@ffffff<@= ףpN@Gz<@q= ףN@(\<@N@Gz=@fffffN@fffff=@33333sN@p= =@N@\(\>@RN@Hz>@(\N@p= c?@{GN@?@ ףp=jN@)\?@`N@fffff@@= ףp]N@HzG@@(\BN@)\@@Q^N@(\µ@@HzgN@\(@@p= CN@\(@@Gz4N@ A@YN@zGAA@(\UN@YA@yN@{GzA@HzN@(\µA@̌N@p= A@zGN@QB@Q~N@YB@QxN@)\hB@zGAN@lB@QN@(\uB@QM@(\•B@p= M@̬B@HzM@33333B@M@zGB@\(\M@B@Q+M@{GB@(\M@GzB@{GL@zGC@QL@ ףp= C@GzL@,C@p= cL@,C@Gz4L@,C@33333L@{GC@zGK@= ףpC@(\µK@{GC@ ףp=K@ C@p= cK@QB@LK@QB@Q>K@p= B@= ףpK@zGB@RJ@\(B@d0= ףp]I@{Gz8@33333I@@9@= ףp]I@@9@)\I@Gz8@33333I@{Gz8@e8̌N@@@{GR@Q>C@ďN@p= A@fffffN@A@QN@HzA@(\O@zGA@(\O@p= ףA@QO@\(A@,O@fffffA@p= CO@HzA@ ףp=jO@q= ףA@= ףp}O@HzA@̌O@33333A@HzO@B@= ףpO@ B@ ףp=P@Q8B@Gz$P@)\HB@fffff&P@HzgB@\(,P@QxB@R1P@(\•B@)\8P@HzB@33333SP@QB@Q^P@̬B@(\eP@B@q= ףP@QB@fffffP@(\µB@fffffP@q= ףB@HzP@B@q= ףP@HzB@(\P@fffffB@P@q= ףB@ ףp= Q@q= ףB@= ףpQ@{GB@\(,Q@HzB@)\HQ@QB@33333SQ@= ףpB@HzWQ@(\µB@\Q@QB@RqQ@(\B@GzQ@33333B@(\Q@C@̜Q@Hz'C@QQ@Q>C@{GQ@Q>C@fffffQ@(\5C@= ףpQ@p= #C@Q@q= ףC@= ףpQ@{GB@QQ@\(B@Q@zGB@(\Q@\(B@QQ@= ףpB@= ףpQ@yB@HzQ@zGaB@QQ@p= cB@QR@zGB@fffff6R@= ףpB@PR@̬B@GzdR@zGB@ ףp=jR@̬B@fffffR@\(B@R@(\B@QR@QB@{GR@(\µB@QR@̬B@p= ףR@p= ףB@RR@\(B@QR@(\•B@RR@)\B@= ףp}R@B@(\rR@{GzB@QkR@(\B@fffffVR@Q~B@@R@{GzB@,R@(\uB@HzR@p= cB@ ףp=Q@QKB@Q@q= ף0B@GzQ@RB@= ףpQ@(\A@RQ@\(A@GzQ@)\A@33333Q@p= ׃A@QQ@lA@GzQ@ffffffA@GzQ@{GZA@= ףpQ@LA@(\Q@Q>A@p= Q@q= ף0A@33333Q@A@(\Q@)\A@(\µQ@A@GzQ@zGA@33333Q@HzA@GztQ@p= A@HzwQ@@@)\Q@p= @@ ףp=Q@Q@@)\Q@p= ף@@33333sQ@@@`Q@33333@@GzTQ@@@fH33333sN@Y=@GzTQ@@@&GzTQ@@@(\RQ@ ףp=j@@p= SQ@\(\@@LQ@HzG@@= ףpMQ@zG!@@QNQ@ @@q= ף@Q@Q?@Hz7Q@(\?@\(,Q@Gz?@p= #Q@(\?@Q@Q?@QQ@p= ?@(\P@q= ף?@\(P@Q?@ ףp=P@Qk?@fffffP@GzT?@zGP@GzT?@QP@(\B?@\(P@?@GzP@Gz>@GzP@Gz>@GzP@(\u>@QP@p= #>@(\P@33333=@QP@zG=@= ףpmP@(\=@GzTP@fffff=@Q8P@ ףp==@(\P@=@33333P@Y=@\(O@Qx=@zGO@(\=@q= ףPO@p= c=@ ףp=*O@p= c=@33333N@(\=@{GN@fffff=@̌N@(\=@33333sN@p= =@g8QR@{Gz:@Gz4V@B@dQR@(\•B@QR@B@(\R@(\•B@R@zGB@q= ףR@(\oB@ ףp=R@Q^B@)\R@Q8B@\(R@zG!B@ ףp= S@fffffB@(\"S@{GA@= ףp=S@(\A@Q[S@)\A@HzwS@QA@= ףpS@A@= ףpS@\(A@S@HzB@q= ףS@ B@HzS@(\B@(\S@B@GzS@p= A@HzT@QA@QT@= ףpA@T@(\•A@p= S@HzgA@33333S@Q>A@fffffS@\(A@(\S@QA@33333S@GzA@zGS@(\A@HzS@= ףp@@fffffS@Q@@)\S@)\@@zGS@(\@@S@\(@@(\S@= ףp}@@S@= ףp]@@\(S@HzG@@33333S@Q8@@fffffS@\(<@@S@HzG@@33333S@HzG@@QS@fffff&@@= ףpS@33333@@̬S@@@fffffS@q= ף@@RS@p= ?@S@Q?@(\S@(\?@S@(\B?@QS@Gz?@\(S@= ףp=?@(\S@ ףp=J?@S@= ףp=?@zGS@?@(\T@>@HzT@zG>@Hz'T@ ףp=>@{G:T@ffffff>@)\(T@q= ף=@GzT@{Gz=@GzT@)\(=@(\T@{G<@fffffT@Gz<@= ףp-T@Q<@fffffFT@(\<@)\XT@ffffff<@ffffffT@Q+<@\(lT@Gz<@|T@Hz<@\(T@p= ;@\(T@;@GzT@)\;@= ףpT@\(;@{GT@\(;@T@Gz;@p= #U@Qk;@Q.U@(\5;@fffffFU@ ףp= ;@fffffVU@q= ף:@ffffffU@33333:@zGqU@(\µ:@QU@Q:@zGU@p= ף:@zGU@̌:@QU@Gz:@U@:@GzU@{Gz:@QU@{Gz:@zGV@(\:@33333V@(\;@= ףpU@RQ;@= ףpU@Gz;@GzV@;@GzV@(\<@QV@zG!<@fffff&V@Q+<@Q.V@\(<@Gz4V@q= ף;@(\2V@;@p= 3V@zG;@hXp= 3V@(\:@RV@zG;@p= 3V@zG;@Q;V@(\;@ ףp=:V@333333;@{GJV@Hz;@)\XV@;@GzdV@zG:@(\rV@(\:@RV@R:@ifffffS@\(@@S@A@= ףpS@A@fffffS@)\A@= ףpS@p= ףA@= ףpS@zGA@= ףpS@lA@fffffS@Q^A@GzS@(\UA@fffffS@q= ףPA@QS@(\/A@S@(\A@= ףpS@R@@q= ףS@q= ף@@(\µS@q= ף@@S@\(@@jRQ@Q7@HzwS@QA@OHzwS@QA@Q[S@{GA@= ףp=S@QA@{GS@{GzA@fffffR@= ףp]A@\(R@RQA@q= ףR@(\UA@q= ףR@HzgA@{GR@ ףp=jA@HzwR@QXA@GztR@= ףp=A@QxR@zG!A@GztR@p= A@{GzR@Q@@q= ףR@@@RR@Hz@@HzR@̌@@QR@(\u@@= ףpR@Gzt@@ ףp=R@q= ףP@@(\R@HzG@@QR@Gz4@@R@(\@@RR@p= @@QR@{G?@q= ףR@?@(\R@33333?@(\¥R@(\?@p= ףR@L?@GzR@(\5?@R@(\?@)\xR@ ףp=>@{GzR@̌>@{GzR@\(\>@QkR@333333>@= ףp]R@zG!>@(\RR@Q=@{GJR@(\=@9R@q= ף0=@(\"R@(\=@q= ףR@\(<@HzR@ ףp=<@\(Q@ffffff<@HzQ@Q<@ ףp=Q@(\<@(\Q@(\;@= ףpQ@\(;@)\Q@)\;@= ףpQ@Q<@fffffQ@= ףp=<@HzQ@(\<@p= sQ@fffff;@q= ף`Q@GzT;@)\XQ@;@= ףp]Q@Q:@zGqQ@:@= ףp}Q@\(:@Q{Q@GzT:@Q@(\9@QQ@(\9@q= ףQ@(\9@̬Q@zGa9@QQ@ 9@Q@Q8@GzQ@(\8@Q@33333s8@QQ@GzT8@)\Q@(\B8@)\Q@)\h8@(\…Q@RQ8@QnQ@GzT8@p= SQ@Q^8@GzDQ@p= c8@= ףp=Q@HzG8@(\/Q@GzT8@= ףp-Q@8@QQ@8@ Q@(\7@RQ@Q7@kGzdR@(\µB@RV@{GI@X{GR@(\µB@̼R@QB@{GR@QB@(\R@,C@(\¥R@(\UC@RR@zGaC@(\R@LC@(\oR@YC@= ףpmR@C@QkR@QC@GzdR@q= ףC@fffffvR@(\C@GzR@p= D@ ףp=R@QD@{GR@Q+D@HzR@p= CD@ ףp=R@fffffFD@(\R@(\OD@R@(\/D@HzS@Gz4D@QS@@D@(\%S@HzgD@(\2S@fffffD@ ףp=ZS@̌D@Q{S@̌D@QS@(\D@(\S@33333D@(\¥S@ ףp=D@zGS@{GD@QS@(\D@QS@ ףp=D@QS@p= E@= ףp T@E@= ףp T@33333SE@fffffT@Q~E@p= T@̌E@)\(T@QE@fffff&T@zGE@{GT@)\F@GzT@(\5F@)\T@(\OF@QT@ ףp=jF@ T@yF@QS@p= ׃F@QT@q= ףF@= ףp-T@\(F@(\RT@ ףp=F@p= sT@33333F@|T@zGF@(\T@fffffF@RT@zGF@fffffT@33333F@fffffT@F@QT@(\F@QT@(\F@)\T@(\5G@{GT@(\uG@T@(\G@QT@\(G@Gz$U@G@Hz7U@̌G@fffffVU@zGG@lU@33333G@pU@(\G@\(lU@p= G@33333cU@p= H@ffffffU@R1H@)\hU@RQH@U@\(\H@(\•U@Q^H@= ףpU@33333sH@(\µU@̌H@GzU@p= ףH@= ףpU@33333H@U@(\µH@33333U@(\µH@zGU@QH@(\V@(\H@q= ףV@{GH@QV@fffffH@0V@HzH@@GzV@(\<@RU@Q;@QU@{G;@33333U@ <@QU@@<@fffffU@(\<@Q~U@Gz<@pU@(\<@\U@{Gz<@)\HU@33333<@33333CU@R=@\(@p= ׃T@GzT>@(\bT@Qx>@q= ףPT@\(\>@IT@(\O>@{G:T@ffffff>@mzGU@ H@V@QH@zGU@QH@ ףp=U@)\H@GzU@RH@QU@p= ׃H@V@Q~H@= ףpU@QkH@RV@= ףp]H@(\V@zGAH@Gz4V@fffff&H@Q;V@ H@QXV@{GH@RaV@{GH@ffffffV@(\H@V@q= ףH@nHQ;V@(\;@RV@GzT<@Q;V@(\;@QHV@Gz;@zGQV@<@Q^V@Q8<@QnV@GzT<@RV@GzT<@oGzV@fffff5@q= ףV@Q:@- ףp=JV@fffff5@(\?V@(\6@\(RQQQQ>GzQRQ>zGQ{G:>fffffvQGz.>\(|Q>)\xQ=QQ== ףp}Q@=RqQףp= =zGqQ{G33333LQE>QL33333=)\L(\µ=Q^L33333s=Gz.Lףp= =GzL{G<(\K(\OGzJp= @(\µJ̬@GzJGz@ףp= J ףp=j@(\•J{GZ@(\J)\H@QJR1@RJ= ףp@QJQ@p= #KR?`K33333s?QKQ8? ףp=K?{GKGz>ףp= KQ> ףp=K?ףp= KQ?L)\(?Q LR?q= ףL>R1LR>q= ףPLp= c>GztLGz.>QL)\(>33333LQE> MQ9ףp= K@4HzGKQ9QEKp= c99K{G8R1K(\u8ףp= K8R1KGz7GzNK7QeKQ733333Kp= 7QK= ףp}7QK(\6QK ףp=633333K ףp=J6p= KGz.6L3333336ףp= LzG!6(\5LGz.6= ףp}LGz.6p= L)\(6)\Lfffff&6QL6\(LQ5 ףp=Lףp= W5QL5GzLףp= 4(\M)\h4 M@4QPffffff?= ףpMR @?QPq= ףp?ףp= Pףp= ?QPffffff?Gz~P\(\?iPQ?RaP\(\?QUPHzG?(\?P(\?Q+Pp= ף?GzP ףp= ?\(P(\? Pףp= ? P{Gz?QPGz?ףp= O)\(@O\(\?q= ףO(\@GzO(\@QO(\@ORQ@p= Pffffff@Pq= ףp@Pp= ף@PRQ@)\PzG @ףp= PQ @GzP ףp= @(\PQ@ ףp=*PHzG@Gz.P@)\(P= ףp=@ ףp=P\(\@QP)\(@ ףp=O(\@GzO)\(@ROGz@ףp= OHzG @HzgOQ@)\HO333333@(\O\(\@33333Np= ף@(\N(\@QN@\(|Nq= ףp@\(\N= ףp=@GztNRQ@ףp= NQ@QNq= ףp@QNffffff@GzNGz@QN@(\•N@q= ףpN(\@RQN@Gz.NGz@ N)\(@Q%N@RQN@p= cNQ@QKNQ@ Nffffff@N)\( @= ףpMR @GztNHzG?GzNLQ@2GztNRQ@Gz.N@33333N@p= NQ@QNGz@q= ףN@(\M ףp= @QM@QM(\@q= ףM(\ @ףp= M ףp= @(\N= ףp=@= ףpMףp= @QMffffff@GzM@\(M(\?\(Mq= ףp?M?QMzG?(\uMHzG?RQMGz?@Mףp= ?QEMffffff?= ףpMp= ף?GzMףp= ? ףp=Lq= ףp?33333L= ףp=?L= ףp=?33333Lq= ףp?(\L?GzLQ?HzL333333?)\hL333333?GzNL\(\?GzNLHzG?Q^LzG?\(|Lffffff@LQ@33333Lq= ףp@L@HzLRQ @L @L= ףp= @(\M@q= ףLQ@QL(\@GzL ףp= @GzLQ@ףp= L@̌LQ@GzNL333333?QKQ@GzNL\(\?Q%LQ?QL333333?{GKHzG? LQ@GzL@LQ@K= ףp=@p= KRQ@KQ@q= ףKGz@p= ׃KQ@GznK ףp= @YKQ@@Kףp= @R1KGz@Gz.K@{GKQ @\(K(\ @= ףp=KGz@q= ףPK ףp= @GzNK(\@333333KHzG@Q K@QKQ@YK)\(?QI= ףp=@YKQ@ ףp=JKGz?)\(K?QK)\(?GzJzG?QJ@QJffffff@GznJQ@YJ{Gz@RQJQ@Gz.J(\ @HzJRQ@GzI@I\(\@QI= ףp=@(\µ0Qk*@ףp= +)\+@(\µ0(\u*@QE0Qk*@p= ף/(\u*@q= ףp/ ףp=*@Qk/Q*@Q.Hz*@HzG.Gz+@p= ף-*@-Q*@Gz, ףp=*@Gz.,Q*@fffff+= ףp*@ףp= +(\*@(\,p= #+@zGa,+@Q,+@RQ-= ףp=+@p= ף-\(\+@Q-)\+@Gz.Q+@(\/(\B+@Q/HzG+@ףp= W0RQ+@(\µ0RQ+@ 033333(@&{G-@!(\){G-@)\()-@= ףp(HzG-@= ףp=()\(-@(,@Q'(\,@R'(\u+@Q'+@Gz.' ףp= +@ףp= &*@&(\)@&)@(\'(\)@Q'q= ף(@(\({G(@ffffff(q= ף(@Gz(33333(@(\)\((@L)R(@Gz)p= #)@(\)Q)@RQ*RQ)@Q*\(\)@Gz*\(\)@+RQ)@(\,\(\)@-\(\)@Q8.ffffff)@Gz./q= ף(@ףp= 0q= ף(@Q^0q= ף(@(\0fffff(@0= ףp(@HHzG()\(-@RQ'.@RQ'.@'= ףp-@Q'Q-@(Gz-@HzG(q= ףp-@= ףp=()\(-@Q.)\(&@ffffff+RQ)@Q.)\(&@Q-(\&@q= ףp-Q'@(\,333333'@ףp= W,'@,'@R+'@(\+)\'@Q+RQ(@zG+zGa(@q= ף+(@+Hz(@ffffff+)@+RQ)@*\(\@$= ףp=$@ Q&\(\@&Q@fffff%(\@Q%@HzG%Q@Q8%L @)\$)\ @$Q!@$Q!@Gz%zG @= ףp=% @Qk%fffff @(\u%Gz!@Q8%ffffff!@Gz.%= ףp!@RQ%"@Gz%(\B"@%)\"@R%= ףp=#@&{G#@Q&333333$@Q&= ףp=$@Q'333333$@zG'q= ף#@= ףp=(zG#@Gz(Q#@Q)Gz#@(\B)(\"@Q)= ףp"@ףp= )Gz"@ףp= )ףp= W"@*= ףp="@$Gz@Gz333333!@333333Gz@333333q= ףp@= ףp=(\@Gz333333@@(\@Gz@QGz@p= ף )\(@)\(!(\@ףp= zG@p= ף ףp= @ @\( q= ףp@(\!= ףp=@\(\!@Gz!Q@Hz!@R!\(\@RQ")\(@(\"(\@zG" ףp= @"Q@fffff"Gz @ ףp= #Hz @Q8#\( @ףp= W#Gz.!@p= #$(\ @L$333333!@$Q!@fffff& ףp=$@= ףp=?Q8.@S= ףp=? ףp= .@Q?(\-@(\?.@?p= #.@(\ҿ{G-@HzGῤp= #.@Gz翸Q8.@ffffffR-@Q(\B-@RQ)\(-@ףp= (\,@{Gz)\(,@R+@{GzL+@(\)\(+@Gz Gz+@ffffff R*@)\( *@ ףp= Q*@ ףp= +@q= ףpRQ*@)\({G)@RQp= ף)@{Gz)@)@RQQ(@Gz(\B(@RQp= #(@RQzG'@ffffffHzG'@RQ33333&@ףp= L&@{G%@ףp= ffffff%@(\R$@Hz$@QQ$@zG ףp=$@)\()\$@\(\HzG%@Q)\%@(\%@GzzGa%@p= ף(\%@(\(\u%@ףp= %@ ףp=  ףp=$@)\(Q$@ ףp= q= ף$@{G$@(\B%@\(\ RQ%@(\ %@Q &@33333 Q&@zG (\&@!)\%@(\B!)\%@RQ!fffff%@HzG!HzG&@(\ '@ ףp=!zGa'@Q!Q'@Q!(@(\!RQ(@Q"(@333333")@")@Q")@ ףp= #(\(@zGa#{G(@Q#(\B(@Q8$(\'@= ףp$fffff'@zGa%Gz(@(\%Q'@Q%RQ(@Q&{Gz(@RQ&ffffff(@&333333(@= ףp&= ףp=(@fffff&(@&)@\( q= ףp@Gz{G$@{G$@Q{Gz$@L p= #$@333333 zGa#@p= ף"@\(\ ףp="@(\Q!@GzHz!@GzQ!@ףp= {G @= ףp=Gz!@QQ!@QQ @p= ףzGa @(\Q @p= # zG@333333 Gz@\( q= ףp@(\HzG@ףp= R$@ ffffffHzG@@{Gz{Gz@Q@Q@Qq= ףp@)\(@Q Q@ q= ףp@ ףp= (\@Q@zGp= ף@Q ףp= @ ףp= @ףp= Gz.!@q= ףp!@ףp= Gz"@(\Gz"@GzQ#@{Gz{Gz#@(\ Q#@ (\#@Gz(\#@QQ#@= ףp=q= ףp#@#@{Gz(\#@Q$@333333333333$@ffffff(\$@Q(\$@(\R$@q= ףp{Gz#@q= ףp@p= #.@.?p= #.@)\(?)\-@Q?)\(-@Q?33333,@?{G+@ffffff?q= ףp+@Q?Gz+@ ףp= ?Q+@(\?+@Gz?*@?(\*@HzG?\(\*@\(\?(\)@Q?p= ף)@ףp= ?{Gz)@zG?{Gz)@p= ף@Gz)@Q@Q8)@\(\@R(@(\@q= ףp(@q= ףp@Q8(@333333@zG'@Gz@\(\'@RQ@ ףp= '@Q?\(&@p= ף?{G&@Q?)\&@\(\?Gz&@ ףp= ?)\(&@ףp= ?333333&@(\?Q8&@p= ף?HzG&@Q?RQ&@zGʿq= ףp&@ ףp= ׿RQ&@Gz޿Q8&@q= ףp)\(&@)\(&@(\&@{Gz)\(&@Gz)\(&@333333Q&@q= ףp%@(\R$@(\p= #$@{Gz{Gz#@Q= ףp=@Q?RQ&@Q?= ףp=@{Gz?ffffff@{Gz?ffffff@RQ?)\(@Q?Gz@ףp= ?q= ףp@HzG?= ףp=@333333?(\@333333?RQ @Gz?(\ @(\?q= ףp!@Q?)\!@\(\?"@Gz?Qk"@(\?q= ף"@RQ?Gz.#@zG?HzG#@ףp= ?= ףp=#@Q?fffff#@ffffff?(\$@Q?%@{Gz?RQ%@Q)\%@Q?RQ&@HzG?RQ@Q?)\(&@Q?RQ@ףp= ?HzG@ffffff?(\@(\?\(\@Q?(\@zG?Gz@zG?Q @Q?Gz.!@Gz?(\!@(\?zGa"@Gz?= ףp"@= ףp=?q= ףp#@HzG?{G#@(\?(\u$@= ףp=?\($@HzG?RQ%@Q?Hz%@ ףp= ?)\(&@q= ףp@Gz@p= ף@\((@@Gz@@Q@@(\@)\(@HzG@(\@Q@Q@Q @Q@Q!@Gz@(\!@= ףp=@(\B"@Q@"@HzG @"@RQ @HzG#@(\ @\(#@Q @)\($@333333 @R$@q= ףp @(\%@p= ף@Gz%@p= ף@Q%@)\(@R%@Q @HzG&@333333 @(\&@ffffff @&@RQ @\(\'@)\( @R'@@L(@ffffff@)\(@@\((@{Gz@= ףp(@@{Gz(@q= ףp@Q8(@Gz @zG@\(\-@)@.Gz @zG@ @Q@q= ףp!@(\@(\!@Gz@= ףp!@ףp= @!@HzG@Qk"@@fffff"@(\@Q8#@= ףp=@(\#@ffffff@ ףp=#@Gz@(\#@= ףp=@\(\$@{Gz@$@HzG@ffffff%@Q@R%@ffffff@)\(&@Q@&@q= ףp@Q&@Q@'@333333@Q'@Gz@'@q= ףp@q= ף'@HzG@= ףp=(@ ףp= @Gz(@)\ @R(@Q @(\(@= ףp=!@= ףp=)@{Gz!@Q)@Q!@)@Q8"@(\)@\("@Q8*@HzG#@ ףp=*@Q#@*@ ףp= $@*@RQ$@(\*@)\$@Gz+@Gz%@(\B+@R%@= ףp+@&@RQ,@)\&@zG,@q= ף&@)\(-@Q'@(\-@(\'@\(\-@)\((@fffff,@(\(@zGa,@)@xRQ @\(\'@p= ף*@(\+@,p= ף*@+@Q)@)\(+@Q)@ ףp=*@)\(@L*@(\B(@Qk*@Qk'@*@q= ף&@zG*@p= ף%@Hz*@\($@Q*@ffffff$@*@fffff#@ ףp= *@Gz#@Q)@zG"@(\)@Gz"@)\)@ ףp=!@R)@Hz @= ףp=*@Q @Q*@HzG@(\*@p= ף@Q*@(\@{Gz*@333333@RQ*@{Gz@\(\*@@)\(*@HzG@L*@Gz@)\*@)\(@Gz+@@HzG+@Q@q= ףp+@@Q+@ףp= @(\+@Q@(\+@@Gz+@HzG@{Gz+@(\@zGa+@)\(@333333+@@+@q= ףp@+@HzG@RQ*@(\@R)@{Gz@q= ףp)@Q @p= #)@ ףp= @HzG(@zG @zG'@RQ @\(\'@@+@(\u,@q= ף+@.@q= ף+@.@33333+@q= ףp-@(\+@(\B-@L+@Q-@+@(\u,@ffffff#@ ףp= ?p= #0@Qk)@Pffffff#@Q@(\$@@Qk%@Q@RQ&@HzG@Q&@HzG@(\&@@'@Gz@(@(\@\((@Q@HzG)@Q@333333*@RQ@*@zG@fffff+@ ףp= @33333,@\(\@(\-@\(\@)\-@(\@ ףp= .@333333?L.@Q?33333.@zG?)\(/@\(\?ffffff/@q= ףp? 0@ ףp= ? 0@(\? 0@Q@p= #0@@(\0@(\@ 0@RQ@fffff/@Gz@Gz/@333333 @p= #/@ @Q.@)\( @)\(.@333333@p= #.@@Q-@ffffff@Q-@Gz@ffffff-@@RQ-@(\@(\B-@(\@p= #-@HzG@(\B-@@)\(-@\(\@q= ף,@ףp= @Q,@333333@Q,@Gz@-@@zGa-@Q@Gz-@q= ףp@= ףp-@ffffff@)\(.@)\(@Gz.@)\(@zG.@Gz@/@Gz@.@@.@(\ @Q8.@zGa!@(\.@ ףp=!@-@\(!@ ףp= -@= ףp="@= ףp,@Q"@(\u,@q= ף"@ ףp= ,@HzG#@(\+@{Gz#@{G+@Gz#@= ףp=,@Gz$@-@Q$@-@ ףp= $@.@p= #$@q= ףp.@(\$@= ףp.@ ףp= $@(\.@$@(\u.@Q$@Gz.@HzG%@.@)\%@\(-@)\&@{G-@'@zG-@R'@)\-@Q(@-@(\(@RQ-@Q)@-@Qk)@`Q#@(\?Q&@HzG@ Q#@)\(? ףp=#@Q?Q#@(\?q= ףp$@Gz?Q%@(\?33333&@(\?33333&@Gz?)\&@ףp= ?Q&@HzG@ zG.@Q@Q6@.@AQ6@.@Q6@)\-@6@\(\-@q= ףp6@{G,@Hz6@)\,@Y6@)\(,@fffff&6@fffff+@Gz6@RQ+@Q86@(\+@(\B6@R*@p= #6@*@{G5@= ףp=*@fffff5@fffff)@q= ף5@Gz)@(\6@)@HzG6@(\)@Qk6@)@{Gz6@p= #)@= ףp}6@Gz(@(\6@HzG(@Q6@333333(@6@Hz'@6@zGa'@{G6@'@fffff6@fffff&@Q6@&@Q6@&@Gz6@p= #&@ ףp=J6@Gz&@(\6@\(%@5@{Gz%@5@(\%@)\5@Q$@Qx5@HzG$@@5@Q8$@Q+5@Gz$@fffff&5@Gz#@(\5@Q"@fffff4@L"@L4@ ףp= "@(\3@ ףp= "@Qk3@)\("@{G2@Gz"@Q2@fffff!@p= 2@Gz!@Hz3@zGa!@Gz3@)\(!@2@(\ @Q2@(\ @Q2@Gz. @2@ ףp= @)\(2@(\ @1@RQ@(\O1@ffffff@q= ף0@Q@(\0@p= ף@Q0@(\@)\0@(\@0@ ףp= @= ףp}0@(\@ffffff0@(\@= ףp=0@Q@{G/@Q@/@(\@zG.@Gz@ p= #0@@{Gz;@&@ap= #0@@L0@HzG@ffffff0@Gz@(\0@333333 @)\0@@Hz1@(\ @Hz1@Q @(\1@333333 @)\(2@= ףp= @R2@Q @Gz2@@\(2@Q@(\2@)\(@(\3@RQ@Q+3@@= ףp}3@HzG@{G3@Gz@Q3@Q@HzG4@@4@Gz@\(4@(\@Q4@(\@ ףp= 5@ffffff@3333335@ffffff@{Gz5@(\@(\5@ ףp= @{G:6@ffffff@Qk6@Q@(\6@Q@Gz6@(\@R7@{Gz@3333337@RQ@Qx7@{Gz@(\7@zG@8@ffffff@L8@Q@q= ףp8@= ףp=@Hz8@Q@Gz8@{Gz@(\8@q= ףp@9@Gz@Q89@@(\B9@Gz@GzT9@ ףp= @Qx9@ ףp= @zG9@Q@ ףp=9@\(\@{G9@HzG@:@ffffff@@:@ ףp= @Qk:@@Gz:@zG@Q:@Gz@(\:@zG@zG:@HzG@Q;@HzG@{Gz;@RQ@33333s;@{Gz@q= ףp;@(\@= ףp=;@(\@Q:@{Gz@= ףp:@Q@:@(\@)\h:@Q@= ףp}:@{Gz@= ףp=:@)\(@ :@(\@Gz9@p= ף@= ףp}9@RQ@(\O9@Gz@Q89@ ףp= @3333339@q= ףp@@9@@(\B9@Q@zG!9@(\@ 9@ @q= ף8@Qk @\(8@ @ffffff8@Q @HzG8@)\ @(\58@Q @Q+8@Q!@(\7@)\!@zG7@p= ף!@ ףp=7@{G!@7@RQ"@Gz7@Q"@p= ף7@#@\(7@= ףp=#@Q7@= ףp#@p= ף7@(\$@Qx7@Gz$@(\B7@{G$@Q7@= ףp=%@ ףp= 7@Qk%@= ףp6@Q%@Q6@&@8{Gz;@HzG @(\A@Qk)@d{Gz;@RQ@;@ףp= @ ףp=;@(\@q= ף;@(\@;@ffffff@ <@HzG@Q8<@{Gz@\(\<@HzG@(\<@HzG@<@(\@ ףp=<@Q@(\=@@fffff&=@ffffff@(\5=@RQ@Y=@q= ףp@Qk=@@(\=@333333@q= ף=@Q@=@@Q=@\(\@Gz>@{Gz@\(>@\(\@fffff&>@zG@GzT>@Q@33333s>@= ףp=@(\>@ @(\>@p= ף @Gz>@{Gz @{G>@(\ @>@RQ @Gz>@Q @Q>@Q @zG!?@(\ @ffffff?@\(\ @?@zG @Hz?@ ףp= @Q?@)\( @ @@q= ףp @\(@@HzG @R1@@ @(\U@@zG @y@@ @̬@@p= ף @(\@@ @Q@@Q@p= A@ffffff@QA@)\(@zGAA@Gz@Q~A@Q@(\µA@Q@{GA@Gz@(\A@ ףp= @(\A@p= ף@(\A@Q@QA@(\@(\A@Gz@(\µA@Gz@fffffA@@ ףp=A@333333@zGA@333333@yA@RQ@HzgA@p= ף@{GZA@= ףp=@(\BA@Q@(\/A@HzG@\(A@@)\A@RQ@Q@@p= ף@p= @@= ףp=@Hz@@@̬@@@q= ף@@(\@(\@@(\@@@q= ףp@Hz@@Gz. @̌@@ ףp= @R@@ @Q@@(\ @Q@@(\ @fffff@@(\ @@@Q!@(\A@Gz!@p= A@)\("@fffffA@(\"@Q A@Gz#@ A@(\#@ A@Qk$@zG!A@ ףp= %@p= #A@ffffff%@,A@Q%@)\HA@Hz%@(\bA@p= ף%@33333sA@{G%@(\uA@ ףp=&@= ףp}A@Q'@(\uA@{Gz'@GzA@'@p= ףA@(@(\µA@(@A@Qk)@hA@Qk)@zGAB@.@ A@Qk)@(\B@Q)@QB@p= #*@(\"B@)\*@(\/B@(\B+@{G:B@= ףp+@Q8B@,@zGAB@q= ףp,@= ףp=B@(\B-@zGAB@.@8(\A@= ףp=(\D@ ףp= @$(\A@ ףp= @HzB@(\@= ףp=B@Q@lB@Gz@(\B@(\@fffffB@Gz@33333C@= ףp= @{G:C@ףp= @(\oC@q= ףp @(\C@Q @QC@zG @(\C@HzG @C@ @)\C@@(\C@Q@D@Q@zGAD@Q@ ףp=jD@HzG@QxD@ffffff@GzD@q= ףp@(\µD@zG@D@RQ@(\D@= ףp=@ ףp=D@(\ @D@ ףp= @fffffD@@Q~D@(\@= ףp}D@(\?Q~D@ ףp= ?D@q= ףp?Q~D@zGD@(\࿤p= ׃D@ףp= \(D@QQD@QHzD@= ףp=(\D@= ףp=@GzG@(\&@.(\D@= ףp=@33333D@Q@zGE@@(\E@(\@Q8E@(\@q= ףPE@(\@HzgE@333333@(\uE@Q@HzE@= ףp=@= ףpE@zG@\(E@RQ@33333E@Q@ ףp=E@@ F@p= ף@LF@Gz@lF@(\@(\•F@(\@QF@ףp= @F@Gz@p= G@RQ@ ףp=*G@{Gz@GzTG@zG@= ףp}G@@)\G@\(\@ ףp=G@(\@GzG@zG@GzG@Q@ ףp=G@ףp= @q= ףPG@RQ @\(F@ @zGF@!@{GzF@zGa!@p= CF@Gz!@ F@(\"@33333E@ףp= W"@p= E@"@)\E@R"@(\µE@L#@= ףpE@q= ף#@p= ׃E@)\($@q= ףpE@(\u$@\(\E@(\u%@)\hE@%@QxE@Gz&@p= ׃E@{Gz&@(\•E@(\&@(\E@)@= ףpF@.@F@.@QF@R-@zGF@Q-@(\F@Qk-@(\F@RQ-@= ףpF@-@QF@zG,@p= F@Q,@33333F@(\B,@(\F@ ףp= ,@{GzF@Gz,@p= cF@{G+@33333SF@= ףp+@(\5F@Q8+@R1F@Q*@333333F@ ףp=*@fffff&F@= ףp=*@(\F@*@p= E@*@(\E@)@0Qk&@GzQ-@zG@CQk&@Gz&@= ףp='@p= ף (\B'@= ףp= q= ףp'@Q ףp='@= ףp='@p= ף ףp= (@GzzG'@ ףp= (\(@Q (\'@p= ף= ףp'@\(\zGa'@\(\= ףp='@\(\= ףp='@= ףp=L'@HzGQ8'@QzGa'@333333(\'@(\(@333333p= ף(@Q\((@Q)@(\Q)@q= ףp)@{G(@Q333333)@Q= ףp)@{Gz(\)@QQ*@QL*@\(\(\*@333333+@zGq= ףp+@p= ף)\+@ffffff(\+@Q= ףp=,@RQffffff,@ףp= Qk,@R,@Q,@HzG\(,@zG ףp= -@Gz-@(\Q-@ffffff(\,@RQffffff,@Qۿ,@RQؿQ+@п,@{GzĿ)\(,@{Gz ףp= ,@(\?Q8,@?)\,@Q?\(,@Q?fffff,@Q?\(,@p= ף?q= ףp,@HzG?,@?Q+@q= ףp?+@Gz?33333*@(\?*@(\?q= ףp*@HzG?RQ*@(\?RQ*@333333?*@zG@ ףp=D@Q%@QxE@)@33333sE@)@`E@)@zGAE@)@(\"E@33333(@fffffE@(@(\D@\(\'@ ףp=D@fffff&@ ףp=D@ffffff&@RD@(\&@p= E@Q%@RE@p= #&@ ףp=*E@)\(&@LE@(\B&@zGaE@p= #&@QxE@Gz&@ ףp= (@RQGz2@Q @- ףp= (@RQRQ(@(\(@= ףp=q= ף(@L)@HzG)@zG\()@333333Q*@Q(\*@RQQ*@(\= ףp=+@ffffffQk+@zGQ+@Qq= ף+@= ףp=(\,@(\RQ,@GzGz,@Q\(,@(\zG,@Gz-@Gz-@Qq= ף-@GzR.@Q/@(\33333/@(\0@= ףp=\(0@Gz \(0@Gz0@zGp= #0@QQk0@Q0@q= ףpHz1@(\GzT1@(\1@RQ\(1@333333Q1@{Gz?zG1@\(\?Q1@?(\2@ףp= ? 2@ףp= ?@2@{Gz@Hz2@@Gz2@\(\ @R2@Q @`Qk(@\(\Q*@Q Qk(@HzG(\(@= ףp=)@\(\)\()@)\()\()@)@(\(\)@Qq= ף)@ffffffQ*@QGz=@Q ףp=?@Q @Gz>@Q @>@q= ףp @= ףp>@ףp= @= ףp>@Q@>@(\@Q>@@p= #?@@(\B?@\(\@zG!?@(\?= ףp>@Q?{G>@?Q>@?Y>@Q?Q>@ffffff?Q=@?Q=@q= ףp?p= =@zG?= ףp=@)\(?Q=@Gz׿fffff=@\(\Gz=@ffffffGz=@zG)\=@Q\(>@QQ8>@p= ףQx>@Q{G>@q= ףpq= ף0?@q= ףp ףp=?@HzGq= ף@@Q?A@ffffff@q= ף@@Q? ףp= A@ףp= ? A@\(\? ףp=*A@p= ף?(\OA@= ףp=?ffffffA@?QxA@q= ףp?A@Q?QxA@(\@ ףp=jA@p= ף@(\bA@(\@(\OA@= ףp=@9A@(\@(\5A@Q @Q8A@Gz @333333A@Q @QA@(\ @{GA@= ףp=@(\A@@RA@Q@p= A@ffffff@<@zG>@QGz=@zGGz=@HzGGzT=@= ףp=333333=@ ףp= p= #=@ffffff ףp= =@)\(<@HzG(\=@Qp= #=@zGq= ף0=@Gz ףp=J=@ ףp= q= ףp=@HzG(\u=@)\(Gz=@)\(Q=@Gzq= ף=@ףp= R>@RQ333333>@Q(\O>@Qx>@ףp= ̌>@ffffffGz>@Q>@Gz(\>@p= ף(\>@)\(Q>@̌>@GzQx>@QQ@@QzGC@(\zGC@Qq= ףpC@Hz'C@ffffffB@p= ףq= ףB@(\ (\B@zG (\B@= ףp= q= ףB@zG fffffB@HzG HzB@ףp= ̌B@ ףp=JB@(\B@Qp= A@Gzp= ףA@ ףp= `A@q= ףpQ>A@GzQA@Q@@(\(p= #=@Q GzT=@zGp= #=@zGGzT=@Q Q=@ffffffGz>@ffffffQ=@ffffffQ=@Q\(>@RQQ8>@RQGzT>@p= ף\(\>@(\ R>@Q (\µ>@(\ Gz>@ffffff Gz>@HzG 33333>@{Gz(\>@Qk>@Qp= c>@33333333333s>@Q̌>@ffffff8= ףp(@(\*=@d= ףp(@Q{G(@Gz\(\)@{GzQ)@333333*@ ףp= R*@Q+@Q8+@\(\+@Q+@Qq= ףp,@Q ףp=-@{Gz.@(\p= ף/@GzGzT0@ ףp=0@zG0@p= ף(\0@ ףp= Gz0@ףp= )\(1@333333Q^1@= ףp}1@ Gz1@Gz @2@(\ Q2@(\ (\O3@Q8 Qx3@GzR3@Q(\3@zGGz3@q= ףp(\4@q= ףp(\O4@{GzzGa4@Gz4@Gz(\4@ףp= (\4@Qfffff4@Q)\h5@Q(\µ5@QGz5@Q= ףp5@ 5@fffff p= 5@Gz!Gz5@{G!(\5@zGa"Hz5@HzG#Hz6@$6@Gz.$@6@ףp= W%3333336@Q%GzT6@(\B&= ףp6@Gz&(\7@Gz.&p= c7@(\&= ףp7@Q&RQ8@&GzT8@Gz&8@Hz&Q8@ףp= W&L9@p= #&RQ9@fffff&R9@ףp= W'q= ף0:@Gz'33333:@= ףp'fffff:@(\'Gz;@'Gz;@HzG'Q^;@)\'Hz;@Qk(Q;@(\(zG;@Q()\h<@fffff((\<@)(\<@{G)p= <@*p= #=@(\*GzT=@ffffff*33333s=@Gz.*Gz=@Q8*R=@*)\=@(\*(\=@* ףp==@(\)=@(\)(\=@Gz.()\=@ףp= W((\=@RQ(Q^=@(\(Gz<@(\u(Qx<@(\'RQ<@HzG'\(\<@Gz&Qx<@Q%R<@Gz%(\<@(\$\(<@p= ף$R<@Q8$\(<@$ ףp=<@Q#(\<@(\"P(\<@(\"̌>@(\ (\<@(\"Hz<@p= #"Q<@ףp= !Q<@Gz.!Hz=@!(\>@(\ ̌>@(\ xR?@Gz#zGA@\(\! R?@\(\!?@ ףp=!)\?@q= ף!Q?@(\"Q?@\(\" @@{Gz"p= #@@Qk"QX@@= ףp"Hz@@Q#)\@@)\(#q= ף@@HzG#zGA@Gz#'@= ףp1= ףp7@Q&5'@Gz.1Q(@ףp= 1{Gz(@Gz.1)@Gz.1*@= ףp0Gz*@1Q8+@= ףp=1q= ף+@Qk1zGa,@Qk1R,@@1zG-@QE1/@QE1(\0@QE1Gz0@QE1 ףp= 1@QE1zG1@L1 2@L1= ףp=2@L133333s2@Q1{G2@Q1(\3@ףp= 1q= ףp3@\(1(\4@)\1(\4@)\1Gz4@= ףp1(\55@(\1 ףp=5@fffff1(\6@(\16@zG1Hz7@13333337@33333s1Gz6@)\(1zG6@Q0Y6@zG0(\6@ףp= W0(\6@= ףp=/(\6@(\-6@zG,= ףp5@q= ף+= ףp5@fffff*{G5@= ףp)Hz6@Q)(\7@)\) ףp=7@p= ף)q= ף7@Q)7@(\B)Gz7@Q){G7@)\(Q7@fffff')\7@q= ףp'333337@{G&= ףp7@&= ףp7@Q&(\B9@Q2p= @@Q#3(\B9@1Qk9@1p= ף9@ ףp=1Gz9@(\1fffff&:@Q1)\h:@p= 1Q:@Q2Q:@Q1fffff&;@Q133333s;@)\h1Q;@\(1Q;@Q0\(<@(\µ0(\<@\(0q= ף<@{Gz0 ףp=<@(\O0 ףp=<@fffff&0p= <@Q/(\B=@ףp= W/Q=@p= #/GzT>@q= ף.Q8>@zGa.zG!>@R-(\>@zGa-(\u?@fffff,= ףp?@,fffffF@@Gz.,)\@@ףp= +33333s@@Q+{GZ@@Gz* ףp=j@@*(\u@@Gz.*q= ףp@@= ףp)Gzt@@= ףp=)(\@@Q)p= ף@@zG(̬@@Gz(fffff@@(\B(zG@@Q'@@Gz.')\@@{Gz&Q@@fffff%p= @@Qk%p= @@Q8%)\@@ףp= $)\@@$= ףp@@ףp= W$q= ף@@$)\@@#(\@@L#Hz@@Q# )\@@= ףp033333A@ףp= +!)\@@ףp= +zG@@p= #,(\µ@@ףp= W,\(@@ףp= ,Hz@@Gz-(\@@q= ף,Q@@{G,HzA@Hz,Hz'A@p= ף,HzGA@ףp= W-(\OA@L.333333A@(\.Gz4A@)\(/p= #A@zGa/Q+A@/\(\A@)\h0̌A@333330 ףp=A@fffff033333A@= ףp0(\A@)\0p= ףA@Gz0{GA@{Gz0A@L0(\A@ ףp= 0p= A@fffff/QA@ףp= /QA@Gz/QA@Gz./A@p= #.33333A@ףp= W-q= ףA@Q8- ףp=A@q= ףp,(\A@{G+RqA@ףp= W'@D@%RqA@{G&q= ףA@{G&zGA@= ףp&B@R&(\"B@ףp= W'(\OB@ףp= W'lB@Q' ףp=B@'(\B@{G&p= C@Q8&(\5C@Gz&33333SC@Gz.&̌C@Q&C@Q8&{GC@p= #&(\"D@= ףp%@D@%= ףp}0@{G<)\3@{G:<= ףp}0@Gz<0@zGa@3333336GzT>@ףp= W6R>@ףp= W6(\>@QE6 ףp= ?@(\O6(\B?@zGa6R?@Gz6Q?@= ףp5 @@p= c59@@Gz.5q= ף0@@ףp= 5HzG@@ףp= 4zGA@@ףp= 4{GZ@@{Gz4Hzg@@p= c4q= ףp@@zG!4@@Gz3 ףp=@@{G3l@@fffff3p= c@@ףp= W3Gzt@@{G2{GZ@@)\2(\U@@2l@@p= ף2Gzt@@RQ2p= ׃@@fffff&2Q~@@Q1@@Q1= ףp}@@Q1l@@(\0Rq@@Q0{GZ@@Q0QK@@Qk0Q?@RQ0)\?@p= #0Qk?@ ףp= 0Gz?@Q/\(>@zG/(\>@ףp= /\(\>@p= ף/GzT>@q= ף.(\B?@\(:(\u@@zGa6(\B?@zGa6(\?@(\6(\?@(\u7(\?@fffff7zG?@Gz7\(?@ףp= 8@@ףp= W8p= @@{G8zG@@Qx9@@Q9 @@ ףp= :)\@@{G::Gz@@R:(\@@Q:Q>@@\(:(\u@@ ףp=:(\;@Q>Qx=@\(<(\;@Q=)\h;@ףp= W== ףp;@=<@Gz<GzT<@33333<Gz<@\(<\(<@)\(\µ<@ףp= >Qx<@fffff&>= ףp=<@(\O>fffff&<@Q>(\<@fffff>R;@Q>p= ף;@Q>R;@Gzn>\(\;@)\h>zGa;@Q8>(\B;@>(\;@Q== ףp>@@;(\@@Gz9(\@@Q:p= @@zG:zG@@(\;p= @@Gz.;Q?@@;p= ף?@@;zGa?@Q8;333333?@zG!;(\?@ ;Q>@ףp= :(\>@(\:= ףp>@(\:>@QE:?@(\:)\(?@(\9(\B?@Gz9Qx?@Gz9Q?@ףp= 9?@p= 9@@Q9P(\u$@(\5I@Qk(@(\J@'%@(\J@RQ%@RJ@(\%@fffffJ@Hz%@= ףpJ@p= ף%@(\J@Q%@GzJ@(\&@)\J@zGa&@(\J@Q&@QJ@)\&@QJ@Gz&@(\J@Gz&@fffffJ@\(%@Q~J@)\%@(\uJ@Q%@QkJ@%@YJ@{G%@QKJ@&@p= CJ@fffff%@333333J@33333%@QJ@%@q= ףJ@(\%@p= J@{Gz%@= ףpI@)\(%@(\I@Hz$@q= ףI@Gz$@ ףp=I@(\u$@zGI@$@I@(\$@GzI@(\$@QI@HzG%@zGI@%@lI@)\%@p= cI@333333&@Q^I@&@{GZI@333333'@(\UI@(\u'@q= ףPI@(\'@fffffFI@Qk(@(\5I@_@HzB@ `@(\/C@_@HzB@fffff_@(\B@̬_@p= B@33333_@B@33333_@(\B@_@zGC@fffff_@Q C@_@33333C@_@QC@_@QC@fffff_@C@33333_@C@`@QC@33333`@QC@fffff`@p= #C@ `@ ףp=*C@ `@(\/C@ףp= G](\9@\(LX(\U@@<ףp= G]\(<@@ףp= ']zGA@@]HzG@@\L@@ףp= \33333S@@p= ׳\(\U@@p= ׳\= ףp=@@ ףp=\,@@p= s\{G@@= ףpM\(\@@= ףp-\?@= ףp \Q?@= ףp[Hz?@= ףp[p= c?@[L?@[L?@ףp= [(\O?@`[GzT?@@[GzT?@ [GzT?@= ףp [Y?@= ףp [?@Z?@Z?@Z?@ ףp=ZR?@= ףpZ(\?@ ףp=zZGzT?@ףp= gZ(\?@= ףpMZ>@p= 3Z(\>@ףp= 'Zfffff&>@ Z(\=@= ףp ZQx=@ ףp=YHzG=@ ףp=Yfffff&=@ףp= Y(\<@YQ<@p= ׳YQ<@ףp= Y(\B=@Y{Gz=@p= דYzG=@Y(\=@p= sY{G=@`Y33333=@= ףpMY=@ ףp=:Y)\h=@= ףp-YQ+=@ ףp=YQ<@ףp= YQk<@GzX <@QX{G;@)\XQk;@(\X ףp= ;@QX ףp=:@(\XGzT:@(\XQ:@ ףp=zXq= ף9@Gz^X(\9@\(LX(\9@= ףp^RH@ףp= WV(\µH@S= ףp^{GzH@= ףp^{GzH@ףp= g^{GzH@ףp= G^{GzH@ ^{GzH@^{GzH@]{GzH@ ףp=]{GzH@= ףp]{GzH@= ףpm]{GzH@ףp= G]\(|H@ףp= ']\(|H@]\(|H@\{GzH@\\(|H@\{GzH@\\(|H@`\{GzH@ףp= G\\(|H@ \\(|H@\{GzH@ ףp=[\(|H@[\(|H@[\(|H@ףp= [\(|H@`[\(|H@ףp= G[{GzH@ [\(|H@[{GzH@Z\(|H@Z\(|H@ ףp=Z{GzH@Z= ףp}H@`Z\(|H@@Z= ףp}H@ Z\(|H@Z\(|H@Y\(|H@Y\(|H@ ףp=Y{GzH@Y{GzH@ףp= gY\(|H@@Y= ףp}H@ Y\(|H@Y\(|H@zGX\(|H@33333X\(|H@zGX\(|H@(\X\(|H@zGaX{GzH@p= CX\(|H@zG!X\(|H@zGX\(|H@RW\(|H@ףp= W{GzH@QW(\•H@ ףp=W(\µH@GzW(\µH@fffffWq= ףH@QWp= ףH@zGWq= ףH@GzWQ~H@ףp= W)\hH@W\(\H@QW33333SH@= ףp}WLH@(\oWfffffFH@YW ףp=JH@IW(\OH@)\8WLH@Gz.W= ףp=H@ WR1H@(\W(\/H@GzW,H@QVQH@QV33333H@33333V33333H@zGVQH@GzV= ףpH@QVH@(\V(\H@ffffffVRH@ףp= WVRH@( U ףp= G@QU@G@ U@G@QU ףp= G@Pףp= T= ףpD@QT ףp=E@QT ףp=E@GzTQ^E@RTLE@THzGE@GzTfffff&E@ףp= T(\E@ףp= T= ףpD@(33333S ףp=jE@GzS\(E@GzS ףp=jE@33333S\(E@fffffSfffff&F@P(\µG@3fffffSfffff&F@R ףp=JF@p= RHzgF@̼RyF@{GRQ~F@{GR\(|F@(\bR= ףp}F@33333CRQ~F@= ףpRQ~F@RQ~F@QF@ףp= Q̌F@{GQF@QQF@RQ(\F@̬QQF@Q\(F@QQHzF@\(Q(\F@fffffQHzF@RQfffffG@Q33333G@fffffQR1G@zGQLG@ףp= wQ(\bG@QkQyG@33333cQ̌G@ ףp=ZQ(\G@fffffVQ(\G@GzNQq= ףG@)\HQ̬G@)\HQ= ףpG@ףp= 7Q)\G@)Q(\G@QQ(\µG@(\Q(\G@RQ(\G@GzPQG@RP33333sG@(\P33333SG@(\Pq= ף0G@33333Pp= G@33333PzGF@33333P)\F@GzPp= F@33333PQF@\(PRF@= ףpP{GF@ ףp=PHzF@(\PQ~F@P(\uF@plplot-5.10.0+dfsg/data/cmap0_black_on_white.pal 644 1750 1750 30311571523062 203450ustar andrewandrew16 #ffffff 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 #000000 1.0 plplot-5.10.0+dfsg/data/cmap0_alternate.pal 644 1750 1750 20311571523062 173530ustar andrewandrew16 #ffffff #000000 #0000ff #ff0000 #a52a2a #fa8072 #ffc0cb #7fffd4 #f5deb3 #40e0d0 #bebebe #00ffff #00ff00 #ffff00 #ff00ff #8a2be2 plplot-5.10.0+dfsg/data/README.shapefiles 644 1750 1750 44312041320753 166210ustar andrewandrewThe shapefiles (.shx and .shp files) supplied with PLplot are in the public domain. The data is downloaded from the free resource Natural Earth (www.naturalearthdata.com). This site may also be of use for users looking for higher resolution / additional data for specific applications. plplot-5.10.0+dfsg/data/plstnd5.fnt 755 1750 1750 1441611360254254 157760ustar andrewandrewetwxvz{~q}pyfghijklmnorsu 3456789:;<=>?@ABCDEFGHIJKL|e !"#$%&'()*+,-./012MNOPbQRcSTUVWXYZ[\]^d_`a &;M[f 5=JR`hq| $/GRbnv 2=Vcn| !)7?KVp .>]q/FJ^ev "3>UZb&:BIQ_goz  ( < T x  $ * 0 J S ` m z ( @ @@@ @    @@@    @@ @   @@ @  @@@@  @  @@@    @@@ @ @@@  @@  @@ @ @@@  @@@ @ @ @ @@ @ @ @@    @@ @    @@    @@@ @    @@@    @@  @  @@  @@ @ @@ @ @ @ @@ @ @@ @ @@  @  @@@ @ @@@ @    @@@  @  @@ @ @@@ @  @@@@  @  @@@ @ @@@    @@@  @@ @ @@@ @ @@ @ @ @ @@ @ @ @@  @@@@    @@ @ @  @@ @    @@ @  @@@  @  @@  @      @@ @@@ @ @@ @ @@     @@ @@@ @@@ @@  @@@ @@    @@@ @@@ @@@   @@@     @@@  @@@@  @@ @@   @@ @@@ @@ @@@ @@@ @@@ @@  @@@ @@@ @@@ @@@@@ @@@ @@@ @@@@ @@@   @   @@@ @@@     @@  @@@ @@@ @@ @@@@  @@@ @@ @@ @@@  @@@@ @@ @@ @@ @@ @@ @@@ @@ @@@  @ @@ @@@ @@@      @@@  @@@ @@@   @@   @@     @@  @@  @ @@  @@    @@  @  @@    @@    @@ @@ @@ @@@ @@@  @@@     @@@  @@  @ @@ @@   @@ @@  @@  @@ @@ @@ @ @@  @ @@ @@@@ @@@@@     @@ @  @  @ @@ @@  @@ @@@ @@ @@ @@   @@   @@ @@@ @@@ @@@@ @@@@@@@@@ @@@@@@@@@ @@@@@@@ @@ @@@ @@ @@ @@ @@ @@     @@    @@     @@ ))('%"  "%'())( ' %""% ' ())@@ @@@@@ @@@@@  @ @@@   @ @@@  @@ @@  @  @@  @ @@  @@@@  @@@@ @@ @@ @@ @@ @     @ @@ @@       @@@       @@@@       @ @ @@plplot-5.10.0+dfsg/data/CMakeLists.txt 644 1750 1750 305412041332606 164000ustar andrewandrew# data/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA set(data_DATAFILES plstnd5.fnt plxtnd5.fnt cmap0_default.pal cmap0_alternate.pal cmap0_white_bg.pal cmap0_black_on_white.pal cmap1_default.pal cmap1_blue_yellow.pal cmap1_blue_red.pal cmap1_gray.pal cmap1_radar.pal cmap1_highfreq.pal cmap1_lowfreq.pal ) if(HAVE_SHAPELIB) set(data_DATAFILES ${data_DATAFILES} cglobe.shx cglobe.shp globe.shx globe.shp usa.shx usa.shp usaglobe.shx usaglobe.shp ) set(data_DOCFILES README.shapefiles ) else(HAVE_SHAPELIB) set(data_DATAFILES ${data_DATAFILES} cglobe.map globe.map usa.map usaglobe.map ) endif(HAVE_SHAPELIB) install(FILES ${data_DATAFILES} DESTINATION ${DATA_DIR}) if(HAVE_SHAPELIB) install(FILES ${data_DOCFILES} DESTINATION ${DOC_DIR}) endif(HAVE_SHAPELIB) plplot-5.10.0+dfsg/data/usa.map 755 1750 1750 126762 7633337504 152030ustar andrewandrewdWaWWWWaaaaaakkakvvvvvkvvvkkkaaaaaaakaaaaaWaakkkkvkvvvvvvkkkaaakkvkkkkvvvvvvvYtYoYqYlYlYhYcY`Y^YYYYYSYOYVYXY^Y]Y[YXYQYLYGYIYDY=Y?YBYBYGYJYIYLYIYEYIYDYDYBY=Y:Y5Y.Y&Y!YYYYYYY YY YYY YYYYYYYYY!Y&Y&Y'Y,Y.Y,Y.Y3Y:Y=Y8Y5Y0Y0Y+Y)Y+Y)Y!YYYYYY$Y$Y'Y&Y!YYYYY Y dvvkkaaWWMMMMMDDMMDDDMMWMMWWWWaaaaaWakakkkvvvvvkkvvvvkkkkakaaakkkkkvvvvkkaWWMD9Y YYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYYXXXXXXd999DMWMD9/99DMWMWWWWWWaaakaaaaaaaaWWWWMMWWMMMDDDD99/9//%XXXXXXXXXXXXXXXXXXXXXXXXYYYY YYYYYYYYYYYYYYYYYYYYYYYYY!Y!YYYYYYYYYYY!Y&Y)Y,Y0Y5Y6Y6Y3Y1Y,Y'Y!YYYY YXXXXXXXXXXXXXXXXXXd%XXXXXXXXXXXXXXXXXXX}XwXzXuXrXmXnXmXxXXXXwXnXhXcXdXcXfXhXfXaX_XcXdXhXcXaXcX^XWXWX\X_XYXYX\XYXWXWX\X^XUXOXFXCX>X7X1X,X%XXXXXXXXXXWWWWWWWWWWWWWWWWWWW{WsWjd%//999DDMDMDDDDMWWjW_WXWPWFWAW>>Qepy#--8AAKUU_js}}}}}}TtToThTbT`TXTTTOTITBT?T;T1T+T)T)T&TTTT T T TTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS}S}SzS}SSS|SuSpSnSkScSaSZSTSKSCS9S/S'S#S SSSSSSSDDDDMMMMWWWWWWWWWWMMDDYLYLYIYEYLYQYSYOYJYIYEYBY@YEYGYJYNYSYVYVYOYLMWWMMMMMY?Y:Y=YBYEYGYEY? ////9DDD9//YJYJYEYBY=Y=Y@YGYNYNYJGGQQQGGSSSSSSSQ[[eeppppppeee[[[QSSSSSSSSSSSSSSSSSSyyyyyySSSSSSSSSSSSSSSSSSSOSKSJSJSKSMSPSOScS^S^SWSTSTSRSRSWSZS\S^ScScS7S6S4S1S,S,S%S S"S"S,S4S7S75%//9DMWWWWWWakv)33>GQ[epyXWXWXYXYXUXPXHXCX;X6X/X'X X XXXXXX"X%X'X*X'X,X,X'X*X'X X X%X%X'X*X-X-X'X*X,X1X2X6X7X9X9X@X>X@X@X@XEXHRwwwwwSSSSSSSSSSS S#S,S1S7S7S9S7S>SESKSOSRSWS\S^S^ScShSkSnSsSwSzSSSSSSSSSSSSSSSSSSSSSSSSSSSSSTTT TTTT&T&T+T0T8T=TETLTQTSTXT`Tc-mwwwwmTmTjTeTbTcTgTmTmTjTeTmThTcT`TbTjTqToTjTcTbTjTqTtT{TTTTTTTTTTTT~TwTtTqTqTmTmTlTmAWoWsWsWxW}W~WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXX XXXX X%X*X-X2X2X7X6X;X@XFXOXPXRXYX\X_XdXiXkXp[eeeepppyyyyppeee[UUUUUUUUUUUUUUUUUUQ!!,,,,,,555???IIIISSSSS^^^gg{{{q{q{{{{{{qqqqqgggggggg^^^SSSSI?II?555,,,!VVV~V~VyVrVpVoVmVoVmVhV`VTVQVOVLVJVCVBV=VCVHVLVEV@V9V3V8V@VCVHVLVOVVVWVYVWVRVLVJVGVJVLVRVVVWVaVeVkVpVwVyV~VV~VzVwVoVmVjVhVjVoVuVwV~VV~VVVVVVVVVVVVd###--7777777AALLLUUU___iiiiiiisss~~   RRRRRRRRRRRRRRRRRRRRRR}R}RyRxRvRvRsRlRiRdR`R]R]RZRZRXRXRVRXRTRVRSRSRNRKRKRFRDR:R0R-R)R&R"RRRR RRQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd'''''111111;;;FOYYcccmmxx!!!!!+++55@AFFIKLLQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ~QzQwQsQrQpQjQhQ`Q\QWQWQTQOQHQGQ>Q>Q;Q6Q3Q/Q,cLNQSSVZ`bdgjlonsrsolsrvxxvx}{~         % * - 2 2 4 6 > = @ E F E H O M S V W Y \Q,Q,Q(Q*Q%Q%QQQQQQQQQQQQPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP}PPP{P{PPP}P}PP}P}P{P{PyPsPsPpPpPlPlPiPgPgPkPnPpPpPsPpPsPpPsPsJ@FKQU\]gjsx}}     $ ' / 2 : > > A H H K K S V Y Z W W \ _ d d f d d h l mSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS|S|SSSSSSSSQ !!!!!!!!!!!"!'!'!,!,!,!.!4!5!8!8!;!=!B!E!I!N!Q!V!V!Y!^!^!`!^!f!l!j!m!q!o!t!t!w!{!{!!!!!!!SSSSSzSzSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS}SS}S}SwSwSwSwSwSuSwSsSuSrSpSmSnSkSkSnSkSnSkSnSkSnSnSmSmSk m r u u z   x x r mSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!QQQQQQQQRRRQQQQ8!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!RR R R RRRR$R(R)R0R2R8R=RBRBRIRKRSRZR`RdRdRlRoRsRvRxR{R}R}RRRRRRRRRRRRRRRRRRRRRRRRRd![!^![!V!V!S!N!I!E!E!=!=!@!?!:!7!0!.!)!)!.!.!1!7!7!:!?!B!@!@!;!:!;!4!.!)!$!!!!!! ! ! !!! UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVV V VVVV V"V$V%V*V1V9V>VCVHVOVTV\VcVeVeVjVoVpVtVtVwVzVVVVVVVVVVVVVVVVVVVVVVVV'  } z w o o d \ V T H : / %   VVVVVVVVVVVVVVVVVVWWWWWW W WW W W W W WWW W WWWW VVVVVWWW WWWWWW!W#W(W-W2W2W8W8WBWFWKWN= } x }   } } } } } x z x u p m i i f d _ \ ^ ^ \ ^ \ ^ \ ^ a \ Z Y T VXX X X XXXX X%X*X-X6X A @ > = = 7 2 4 7 ; : 4 4 ; = = : > > @ = 6 2 * * % * ' $ ( - 4 : : ; ; : 4 7 ; A F H K M O P H C E = : 6 : ; A H F H M S S Y Z _ d h h f f a ^ Y V Z Z ^ i h m pPsP}PyPyP}PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQPPPQQ QQPPPPPQQ QQQQQ$Q*Q1Q.Q/Q3Q4Q3Q4Q4Q1Q/Q4Q4Q/Q.Q3Q8Q>QEQLQLQJQHQCQGQHQMQQQOQTQOQMQT6 p o r x }   } x } QTQMQMQQQWQ^QaQeQfQjQjQhQjQjQaQcQfQjQmQsQwQzQzQQQQQQ~QQ|QyQ~QQQQQQQQQQQ~QzQ~QQQQ|QwQrQmQhd !! !!!!&!$!"!!!!!"!$!)!.!5!=!=!:!;!4!1!5!1!5!1!,!.!4!8!:!?!E!N!P!Q!P!T!S!S!Q!N!I!P!X!^!b!g!f!^![!Y!T!P!J!I!N!Q!X!`!i!r!{!!!!!!!!!!!!"" """&"7"A"H"N"ZQQQQ|Q|Q|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd"Z"c"k"n"v"u"}"u"q"n"f"d"`"Z"X"\"Z"S"R"U"M"J"M"N"R"P"X"a"a"f"i"q"q"n"k"l"k"l"y"|""""""""""""""""""""""""""""""""""""""""""""""""""""""""""##QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ#### # # # # # ## ###### #$#,QQQQQQQQQQQQQQQQQQQd#$# ######### #$#%#$# #"#$# #"#$#"#(#%#)#.#.#/#1#3#1#4#9#9#9#6#9#9#=#;#9#6#9#9#>#G#M#[#`#c#a#c#h#m#k#h#k#f#c#a#c#f#k#o#p#p#s#v#z#y############################~#~#w#mQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd#m#o#k#h#e#e#h#c#]#V#W#T#V#T#R#L#J#H#G#E#H#D#D#A#A#>#=#>#B#D#H#L#R#L#H#J#G#J#M#R#Z#V#W#V#T#T#M#M#J#J#L#M#R#R#V#Z#Z#[#]#[#^#`#^#Z#]#[#^#^#`#`#^#Z#]#`#c#e#h#k#o#m#o#k#h#e#a#`#]#`#a#c#a#f#f#h#h#k#k#m#o#oQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd#o#t#k#k#h#h#f#e#c#a#`#`#^#a#c#e#c#`#^#[#^#`#]#^#`#e#e#`#Z#Z#R#R#O#J#D#A#A#D#;#6#6#9#9#=#B#D#B#D#G#G#L#R#V#Z#]#]#^#`#h#k#k#e#k#p#m#m#y#################################QQQQQRQRRQQRRRRRRRRRRRRR R R R R RR RRQQQRRRRRRR R R R R R RRRRRRRRRRR!R&R(R)R+R.R+R)R&R)R-R0R0R2R2R2R2R0R.R+R+R-R-R.R+R(R)R-R+R.R0R0R.R.R-R-R)R)R.R:R=RARB#############$$$######$ $$$$#$&$+$+$-$0$)$)$&$RBRKRKRKRIRKRIRDRAR8R2R.R)R&R"R!R!R"RRRR!R!R$R)R+R0R2R5R7R2R0R+R&R$$&$0$3$8$8$A$D$A$B$F$I$I$L$P$T$Q$Z$T$G$AR&R(R+R+R.R2R:R=RBR=R;R5R5R?RBR:R7R0R.R-K$T$_$e$q${${$~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$R0R0R2R2R2R7R2R5R7R:R:R5R8R8R7R5R2R2R.R0R2R2R.R2R.R0R2R0R.R.R-R+R(R$RRRRRRR!R!RR"R$R&R$RR"R"RRRRRRRRRRR R R R RRRRRRRR RRR $$$$$$$RRQQQQQ$$$$$%% % %%%%%%/%8%9QQQQQQQQQQQQQQQ%%%%%%%%"%(%'%#%'%-%8%A%K%R%Z%Z%UQQQQQQQQQQQQQQQRRRQQ>%Z%_%_%T%T%Z%Y%Z%Z%_%c%d%j%k%m%x%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&&%%%%%%%QRRRRRR R RRR RRRRRRR RRRQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQuQmQhQcQ`QWQQQLQ@Q8Q3%%%%%%%&Q@Q8Q3Q/Q'QQQ0%%%&&&&& & &%&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&& &&&&%Q/Q,Q'Q%Q"Q"Q%Q,Q1Q6Q8Q=Q=Q>Q@QCQ@QCQ>Q=Q=Q8Q3Q1Q.Q.Q3Q8Q8Q8Q;Q8Q3Q.Q(Q%Q$Q"QQQQQQQQ QQ&&&&&&&&&&&&&&&$&)&,&/&2&3&3&:&@&E&@&;&6&3PQQQ QQPPPPPPPPPPPPPPPPPPPPPPd&)&0&5&8&6&5&0&5&6&:&=&@&H&@&@&B&B&@&B&=&;&:&6&6&:&;&=&@&B&@&@&B&D&B&D&H&H&L&S&V&Y&[&^&b&g&j&o&w&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPyPpPiPnPnPkPfP`P\PWPRPNPKPKPFPAP:P7P5P0P+P(P%P#P P!P!P#P%P%P%P#P%P!P#P#P%P%P(P(P*P(P*P+P-P.P5P5P9PQGQQQZQeQoQyQQQ &&&&&&&&&&QOQWQ^QhQpQuQ|Q~QQ &&&&&&&&&&&&Q`QeQ`QhQoQuQzQ~Q|QsQoQe&&&&&&&&QQQQQQQQd&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&~&&}&}&&&&~&}&w&~&}&z&z&{&}&&&&~&v&~&&&&&&&&&&&&&&&&&&&&&&&&&&&&&PPPQ QQQQQ(Q1Q8Q@QEQOQZQeQjQjQmQrQ|QQQQQQQQQQQQQQQQQQQRRR!R)R0R2R8R;R;RBRNRQRTR[RdRiRdRiRiRmRoRmRsRqRsRmRtRxRtRyRxR}RyRyRRRRRRRRRRRRRRRRRRRRRRRRRRd&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'''' ''''''''''''''!'&'*'-'5':':'7'5':'?'C'K'N'S'N'M'WRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRSSSRRRRRRRRRRRRRRRRRSSSSSSSSRSRSSS S S SSSSSSSSS%S#S%S SSSS S S%S*S,S,S,S/S4S7S4S6S4S;S7S;S@d'W'\'_'_'^'X'U'W'['X'['_'_'a'a'b'f'i'p'u'{''''''''''''''''''''''''''''(( (((((((((((((((((( ('(.(*(/(,(/(1(4(1(4(<(@(G(M(Y(X(X(R(V([(^(\(a(`(a(a(f(f(j(h(nS@SASESKSMSOSRSYSZSTSRSTSOSJSOSTS\ScSiSpSwSzSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSd(n(n(o(r(u(w(y((|(((((y(y(u(r(q(t(u(t(t(q(q(o(n(o(j(f(`(\(\(Y(V(R(O(G(B(?(<(6(4(8(=(@(B(G(M(Q(U(X(Y(c(c(a(f(h(f(c(^(Y(\(a(f(j(k(f(n(k(q(n(n(c(a(a([(U(Y(O(M(E(B(?(=(8(8(6(9(<(C(M(O([(f(c(c(^(f(h(oSSSSSSSSSSSSSSSSSSSSSTTSTSSSSSSSSSSSSSSTT T T TTSSSSSSSTTTTT T T T T T T TT TTTTTTTTTTTTT!T"T&T&T)T&T+T.T0T1T0T.T+T)T&T&T"T)T,T0T3T1T1d(o(q(r(o(f(h(h(k(j(q(q(r(t(u(u(y(y(z(u(|(|(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((|(y(y(w(k(a(Y(V(VT1T5T3T.T.T+T&T&T$T!T$T&T$T&T)T&T"T!T!TT$TT!TTTTT!T$T&T&T+T.T0T1T5T;T6T8T5T5T8T:T;T=T?TBT?TBTITNTST[T]T[TXTXT[T]T[TXTVTXTVTOTNTJTGT=T?T?TDTGTITITLTQTSTSTXTXTXTXTXT]T[T^T`T^T[TXTXTXT]T^T[TXTXTVTX](V(X([(Y(V(V(U(U(Y(X([(\(X(X([(`(a(f(n(q(w((|(y(r(r(w(z(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((TXT]T^TcTgTjToTvT|TT~T{TvToTeTcTeTbTbTcThTjTlTlTqTtTqTmTmTjTjTlTqTmTmToTtTvT{T{T~T|TwTwTqTqTtT|TwTtTqTmTjThTlTqTvTyT|T|TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT|d((((((((((((((((((((((((((((((((((((z(|(r(j(o(n(o(f(c(^(\(\([(X(U(O(E(@(=(<(<(?(B(G(M(U(U(`(c(a(f(f(j(k(o(u(y(|((((((|(|(y(((|(z(w(t(y(u(o(h(a(\(U(R(O(O(Q(Q(VTqTeTgTbTbT^TXTSTNTLTXT`TlTqT|TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTd(V(Y(a(f(k(n(q(y(y(w(r(r(q(u(w(u(q(q(t(u(u(w(y(|(((((((((((((z(w(|((((t(t(j(f(c(`([([(V(O(G(G(B(C(C(B(G(H(M(Q(X(^(`(a(f(j(j(n(o(k(o(t(q(r(q(u(z(((((|((((((((((((((((TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUUUU UUUUUU#U%U&U(U+U/U&U&U U UUUUUU UUUU U U U UUUUUUUUUUUU UU UUUUUUUUUUUd(((|(u(r(q(q(n(q(k(j(j(h(f(h(j(j(c(a(`(`(\(Y(X(V(Q(H(B(<(@(?(<(8(9(9(6(4(,(*( (((((((((#(#($('(&('(.(*(.(/(/(,()('()($( ( (#(&('(.(/(1(1(6(6(<(=(C(C(J(J(G(H(C(J(M(O(R(V(X(X(Y(`(^([(f(h(j(n(qUU U#U%U&U%U&U&U(U+U*U&U*U+U+U-U/U2U7U7U4U7U9U2U5U9U9UU9U5U5U2d(q(o(q(q(r(q(t(t(u(t(t(y(z(((z(((y(w(y(w(r(k(n(f(^([([(Y([([(^(\(`(f(h(k(q(o(r(t(y(t(n(k(k(j(j(h(f(n(n(h(j(h(j(n(k(f(h(k(q(r(n(h(f(f(c(h(k(o(q(r(t(w(r(j(r(t(t(o(k(n(j(j(f(f(f(a(f(c(n(n(r(r(t(w(t(rU2U5U5U9U9U>UUCUFUHUDUKUMUPUUUXU\U_U_UaU_UZUWURURURUKUIUIUHUNURUXU]UfUkUqUqUuUzU}U{UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUd(r(r(n(r(t(u(y(t(w(y(z((z(|(|(z((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((z(z(((((((((((((((((UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU}UUUUUUUUUUUUUU}U}UzUud((((((((((|((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((UuUvUsUvUxU}UU{UuUkUkUpUuUpUpUqUsUvUuUuUsUqUqUpUkUpUnUpUkUkUgUgUfUfUbUdUgUiUbUaUaUbUdUdUfUdUfUfUbUaU]U]UaU_UaU]U\U]U\U\UZUZUXURUNUKUPUMUMUIUHUHUDUFUCUAUAU?U>UAUDUHUIUMUMUIUHUHU?UFUKUMUFUCU?UAUAU?U?U<S(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((UUAUDUIUKUMUPUPUUURUUURUNUIU((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())) ))) ))) )))) )!)&)+)0)))))&)&))).).)3)2UNUUUZUiUdUbUaUbUbUaUbUfUfUgUkUnUkUiUvUvUzUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU*)3)=):)7):)<)?)?)=)A)=)=)B)G)G)I)I)G)G)O)R)R)U)V)U)U)X)[)X)[)[)X)[)`)b)`)`)])Z)U)P)KUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU )=)G)G)G)D)B)B)A)=)<)=UUUUUUUUUUU)b)d)e)h)i)i)hUUVVVVV$)i)Z)U)S)L)I)P)Z)`)b)`)`)])`)`)d)d)e)i)e)e)i)k)i)e)h)d)h)e)q)o)s)t)y)~)yVVVVVV"V"V%V)V,V.V1V3V3V3V6V9V=V@V;V6V8V;V6V3V3V.V*V)V*V,V.V1V1V.V*)))))V*V*V,V/V1")n)y))))))))))))))))))))))))))))))**V'V*V,V,V.V,V.V.V/V/V1V1V3V6V8V6V8V9V;V9V;V9V=V>V>V@V@VBVBVEVEVHVHVE.)))))))** ***(*;*>*7*4*4*1*-***%******** ***)))))))****** * V.V/V1V3V9V=VBVEVHVLVOVRVYV[V\V[VYVYVVVVVRVYVWVWVTVTVWVTVRVOVOVJVJVLVJVLVLVRVRVTVRVWVWVYV\Va* * ***** V[VYVYVWV\V^V[d** **)))))))))))))))))))))))))))))))))))~))})y)t)q)n)q)t)v)v)y)y)))))))))))))))))))))))))))))*** * * *******#*%*%*(*0*3*;*<*;VcVaV\V\VYVWVTVRVQVQVQVOVOVQVQVLVJVLVLVOVLVLVJVJVLVLVLVHVHVJVLVJVGVBVEVGVEVBVCV=V>V@V=V>V>V@V@VBVCVBVGVLVOVTVWVTVWVVVYVYV\V^VaV`VcVeVcVeVjVhVoVrVmVoVmVoVoVmVoVmVpVpVoVoVrVpVpVrVpVuVrVrVtVwVtVtVuVuVtVrN*;*L*Z*b*f*f*h*i*i*f*i*k*i*f*f*h*k*n*n*k*m*k*n*n*s*u*u*w*x*{*x*|*~***~*x*w*s*s*n*n*s*u*{*|*|*~*~*****************************VrVuVyVyV~VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV***********************V~VVVVVVVVVVVVVVVVVVVVVV *********VVVVVVVVV******************VVVVVVVVVVVVVVVVVV**************************VVVVVVVVVVVVVVVVVVVVVVVVVV*******VVVVVVV **********VVVVVVVVVV ***********VVVVVVVVVVVd****************************************************************++++++++ + +++++++++++++"+$+'+'+*+-+.+3+5+8+6+6+;+=+@VVVVVVVVVVVVVVVVVVVVVWWWWW!W!W$W$W#W$W)W-W2W5W=W?WDWDWFWIWIWKWNWSWQWSWSWZW]W_W_W_WeWiWlWnWsWoWqWgWlWeWjWiWqWnWoWjWeWbWgWjWgWjWtWsWtWoWnWjWqWoWqWnWqWtWtWsWoWtW}WWWWW}W~W}W~d+@+?+F+I+N+Q+V+Q+Q+T+T+T+V+\+`+`+\+`+g+j+h+m+m+o+o+r+q+q+m+m+o+m+m+o+r+x+{+v+x+{+y+v+x+x+{++|++{+++++++++++++++++++++++++++++++++++++++++++++++++++W~WxWxWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWA++++++++++++++++++++++++++++++++++++++++++,,,,,, , ,,, ,',$,!,,,,,,,,!,%,%WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW@ Z Z Y W T O K K H F E E F H K M S V Y \ a f i m s } } } } w r p m m i d _ _ ^ Z Y W T T S P K K F F E EPPPPPPPPPPPPPPPQQQQQ"Q(Q/Q4Q8QAQHQMQQQWQ\Q`QcQjQcQaQ^QWQTQQQMQLQMQJQEQ@Q=Q8Q1Q/Q*Q'Q$QQQQQQQ QPPPP !'!1!:!B!M!E!E!?!:!8!1QQQQQQQQQQQ""QQ""""""""QQQQQQQQ""""""QQQQQQ#.#4#3#1#1QQQQQ#L#M#R#T#R#LQQQQQQ#k#p#t#t#p#o#kQRRRRRQ#k#o#o#kRRRR#p#s#v#pRRRR#p#s#s#pRRRR#h#k#m#o#p#t#t#v#w#y#v#v#t#w#s#m#k#hRR RR RR R R R RRRRRRRRR#######QQQQRR R #####|RRRRR###RRR#####RR!RRR###RRR####RRR"R" $5$8$A$I$T$_$m$x$R)R(R)R+R-R.R0R0R0&[&^&d&g&h&o&w&z&}&}&~&&~&{&{&w&w&t&v&r&t&o&o&j&e&d&b&^&[&[OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO&&&&&&&&&&&&&&~&~&&&&OOOOOOOOOOOOOOOOOOO&&&OOO&&&OOO &&&&&&&&&&&&&PPPP PPP#P(P.P7P>PDPK&&&&&&&&PP PPP P#P(P*&&&P#P#P% &&&&&&&&&P+P(P%P*P-P0P0P7P>''''''SSSSSS(4(9(C(M(U(`(jSSSSSSS(j(o(t(|(((SSSSSST((((((T TTTT T ((((((((((((((((TTTTTTTTTTT&T,T3T:TBTI((((((((TXTXTTTOTNTSTXTX((((UKUHUCU?(((UCUFUH(((((US@S@SCSMSPSTSWSZSaSfSiSmSnSsSwSzS|SSSSSSSSSSSSSSSSSSSSSSd"""""""## ### ##### # # ## #(#(#%#)#1#1#/#4#.#/#9#B#D#A#B#H#H#D#H#O#R#O#G#E#J#O#T#O#R#W#W#T#W#T#R#W#[#]#[#]#a#e#f#k#p#t#w#w#|#z##|####y#w#p#m#k#p#p#m#e#e#^#]#]#W#W#[#`#`#[#W#Z#W#O#HSSSSSSSSSSSSSTTT TT TTT!T&T+T.T0T0T3T6T;T?TDTGTLTOTSTVTTTXT^TgTlToTqTvTyTyTwT{TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUU U Ud#H#G#B#6#/#(#"#### #### # ##########"""""""""""""""""""""""""""""""""""""""""""""""""""""""""### ###### #"""""""UUUUU%U%U(U+U/U0U7U>UFUMURUZU_UbUgUnUuUvU}UUUUUUUUUUUUUUUUUUUUUUUUUUUUUVV VVVVV$V'V*V/V1V3V;VCVHVLVTV\VeVeVmVuV~V~V~VVVVVVVVVVVVVVVVVVVVVVV'""""""""""""""""""""""""""v"l"i"d"X"K"A"?"2"("#""" VVVVWW WWWW$W-W5W#9#9#6#9#9#=#=#>#B#ARRRR"R&R)R-R0R5R;RBRGRKRQRVRZR]RbRjRl$+$($&$)$+$+$($#$$$$$$R5R8R=RARFRIRKRNRSRXR]R`RiRl&2&0&3&3&5&B&B&E&E&B&B&E&D&I&L&Q&V&Y&]&]&b&h&r&~RAR=R8R0R-R-R2R:RBRIRQRTRXRVR[RZRVRVRTRVRSRSRPRP6% % %*%*%2%8%1%2%-%#% %%%%%%%%%%%%%%%%%%%%%%%%%"%%% %%%%%%%%%% %% % % % %RbRTRNRSRTRVRVR]RXRVRbRiRmRtR{R}RRRRRRRRRRRRRRRRRRRRRRRRRRRSS SSSSS S%S'S,S4.&&&&&&&&&&&&&&&&&&&&&&~&~&{&z&z&v&m&d&^&a&^&[&V&Y&T&Q&N&N&L&I&E&@&:&5&3RRRRRRRRRRRRSSS SSSSSS#S%S(S(S,S4S7SU?UAUHUMURK'C'K'P'U'['_'f'i'n'w'z'''''''''''''''''''''''''''''''''''''''''''((( ( ((( ( (((#(#(&(,(/(4(8(8(6(4(/UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUqUnUnUkN((((((())))))))))) )))(((((((((((((((((((())))) )))))!)!)))))) ))((((((((((((((((((UUUUUUUUUUUUUVVV VVVVVVV"V'V)V)V*V1V3V3V9V;V=V=VBVEVEVHVOVRVVVYV^V\V`VaVeVkVpVuVwVzV|V~V~V~V~VVVVVVVVVVVVVVVVVVVVV )L)O)O)R)S)U)X)Z)`V"V$V'V)V/V1V/V1V1)U)V)[)])ZV1V3V8V8V1)i)k)o)qV@VCVLVT)i)k)nV8V;V>&&&&&&&&&&&&&&&&&&&&&&&&&PPPPPPPPPPPPPPPPPPPPPPPPPd!'!,!5!:!:!8!'!$!!!!!!!!!&!.!7!=!B!I!S!X!^!i!j!r!w!w!!!!!!!!!!!!!!!{!|!|!w!o!j!f!j!f!l!b!Y!^!c!b!f!`!^!X!Y!T!Q!J!N!V!Y!^!b!f!f!c!`!X!Y!^!^!Y!V!Q!P!M!I!E!I!J!Q!T!N!S!V!`!c!m!i!q!wYYYYYYYYYYYwYwYtYtYlYhYjYqYrYlYgYeYeYhYoYqYtYwY|YYY~Y|YY~YYYYYYYYYYYYYYYYYYYYY~Y~YY~Y{YvYyYyY~YY|YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY`!w!!!{!!!!!!!!!!!!!!!!!w!w!q!o!w!r!w!|!r!t!i!g!`!^!c![!T!Y!^!P!@!E!@!:!=!;!B!E!B!I!E!:!4!5!8!8!4!,!'!)!$!!$!!!&!)!$!$!,!0!8!:!B!?!E!J!N!V!Y!X!Q!V!N!G!E!E!@!;!8!=!:!=!7!4!,!'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY!S!S!^!j!o!t!{!!!!!!!!!!!YeY^YXYVYXYVYVYSYQYOYJYEYDYDYEYGYLYN,"/"1"/"5":"D"A"A"D"P"Z"`"a"i"q"|"}"}"""""""""""""""""### #%#)#3#>#J#RY:Y:Y5Y.Y'Y)Y,Y1Y3Y5Y5Y0Y+Y'Y&Y$Y!YYYYYYYY!Y&Y'Y!Y!YYYYYYYYYYYYYYYc!!!!!!!!!!!"!" "" """"" "!!!!!!""""""""""#"&"("/"2"2"&"!"#""""" "!"&"#""""" "" """!""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!YNYNYLYLYIYGYIYLYLYJYLYLYIYEYEYBYBY@Y?Y=Y?Y?YEYDY@Y=Y=Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y=Y?Y?Y@Y?Y?Y@Y@YBYBYEYGYIYIYJYIYLYLYNYOYQYSYSYSYVYVYSYSYSYSYYY[Y^YbYbYeYlYoYlYlYjYhYgYeYcYbY`Y]Y[YXYSYXYSYQYSYQYQYNd"U"Z"a"g"k"q"|""""""""""""""""""""""""""""""""""""## ###"#(#/#4#=#E#J#M#T#a#k#v#z#######################$$ $ $ $############XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXd############################$$ $ $$$$$$$%$%$($-$-$.$+$.$8$A$G$Q$W$Z$]$`$e$g$j$n$q$v$v$~$$$$$$$$$$%% %%% %%%%%%"%%%*%-%1%;%@%F%C%H%N%Q%R%K%H%C%F%O%UXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}XzXxXzXzX}X|XwXwXrXrXwXxXwXrXrXpXxXXXXXXXXXXXXXXXXXX}XzXxXxXwXwXuXuXxXxXrXrXrXrXrXwXwX|X}XXXd%U%R%T%R%O%H%F%F%H%H%J%H%N%O%T%W%\%Y%R%O%K%N%T%O%J%H%K%H%F%C%A%>%>%9%8%1%1%8%6%9%9%>%C%C%@%9%9%1%#% % %%%%%% %%% % %#%*%*%'%%%#%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$x$y$q$pXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYYYY YY Y Y YYYYYY YYYYYYY'Y+Y5Y6Y:Y?YGYJYNYQYQYXY[Y]Y[YYYYY^Y`Ybd$p$m$g$e$`$W$X$T$T$P$L$D$B$?$5$5$+$)$&$$$$$$$####################$$ $ $$$ $ $ $ $$$##########################################YbY^Y^Y[Y[Y`YbY`Y^Y`Y^Y]Y^Y]Y]Y`YbYcYeYcYhYeYjYjYlYlYlYlYrYvYrYtYqYqYtYoYlYjYhYcY`Y]YbYeYgYeYeYcYeY`Y[YYY[Y^Y`Y]Y`Y[Y[Y]Y[YYYVYVYYYVYQYJYLYQYQYJYIYGYIYEYEYIYDYBY?Y?Y:Y8Y?Y@YEYOYSY[Y^Y`YbYeYbY]YYYVYSYOE####################|#v#v#t#p#m#k#f#h#e#^#a#]#^#Z#R#V#O#L#L#H#G#B#9#3#+### """""""""""""""""}"s"k"c"UYOYNYNYDY@YBY?Y8Y3Y0Y.Y5Y5Y8Y?YGYIYGYDY@Y:Y0Y.Y'Y!YYYYYYYYYYYY YY Y Y YYYXXXXXXXXXXXXXXXXXXXXXXXXX """""""""""XXXXXXXXXXX""""""XXXXXX""""""""XXXXXXXX""""""XXXXXX#v#|##################~#v#vYXYYYYYYYYYY!YYYYYYYY YY#y#~####~#yY&Y&Y$Y'Y+Y+Y& $q$s$s$v$x${$x$x$t$q$qX|XzXuXwXuXxXxXXXX| $$$$$$$$$$$$XXXXXXXXXXXX%R%Y%_%c%g%j%s%p%p%n%m%r%u%s%uXwXzXzXxXzX}X|XzXwXwXrXmXhXdXa%r%s%x%x%sXmXpXwXzX|%_%Y%O%RXzX|XxXw^%9%2%/%-%-%%%"%%% %$$$$$$$$$$$$$$$$$$$$$$$$$$~$~$x$y$y$s$q$v$x$~$~$$$~$v$p$m$i$i$e$b$Z$W$U$U$T$X$X$W$T$T$N$L$N$I$B$<$7$3$3$+$#$$$$$$$ $$$######X9X9X;X;X>X@XCXHXKXMXMXPXOXRXPXRXPXKXEXCXFXEXEX@XCXEXCXEXCXCX>X2X2X/X/X*X,X'X'X#X X#X'X,X1X1X6X9XX7X7X;X9X4X1X,X*X'X*X2X6XX@X;X9X6X1X-X'X'XXXXXWWWWWWWWWWWWWWWWWd######$$$ $ $$$$$#$($-$-$+$0$3$3$7$8$<$<$B$B$G$G$I$L$L$N$P$T$W$U$W$U$P$P$L$N$L$I$L$G$F$A$B$>$?$8$7$3$3$0$.$+$($%$"$$$$$"$$$$$$ $ $ $ $ $ $ $ $$$$###########$$$ $WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXXXXWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW}WxWsWjWiW_W]WVWSWLWIWDW?WX@X@XCX@X@X@XCX@XCX@X@XFXHXFXFXCXEXCXEXEXFXFXCXJXCX@X@X@XHXHXJXKXKd&m&t&m&j&d&a&d&^&[&V&O&Q&O&T&Y&Y&Y&Y&[&^&]&]&b&d&h&j&j&d&d&l&o&r&r&h&j&e&e&a&]&Y&Q&N&L&H&@&@&;&=&:&3&2&0&)&'&"&&&&&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&& &XKXMXMXOXOXJXEXFXEXHXFX@XXX;X7X7X9X9X6X7X6d&&&&&&&&&&& & &&&&&&&&!&'&+&+&,&0&6&6&:&:&;&:&B&K&O&N&L&L&Y&]&]&b&d&[&D&5&2&)&"&'&&&&&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%z%u%p%k%d%h%kX6X7X9X;X>XX>XCX@XCXEXEXFX@X>X@X;X9X7X;XXCXFXFXHXHXMXOXKXOXPXTXRXRXTXUXUXYXYXYXYX\XYXYX\XYXYXYXYX\XYX^X_XaXdXcXcXfXdXfXiXiXfXaXcX_X_X^X_X^X\XYXYXUXUXYXWXRXOXOXRXUXYXYXaX_XaX\XYXYI%k%m%p%r%s%u%z%|%x%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|%u%s%m%h%c%c%_%Y%U%T%U%T%W%R%Q%O%N%K%J%F%A%<%;%;%8%6%8%6%9XYXYXYXYXYXWXWXUXRXMXJXKXJXFXJXFXFXKXKXOXPXRXRXPXMXJXFX@X@X@XCX@X@XCX@XCXCXEXEXFXEXEXCXEXEXFXEXFXFXEXCX@XCXCXEXFXHXHXEXHXHXEXJXKXKXMXJXEXEXCX@X>X9 $X$[$Z$`$e$`$[$Z$X$XXXXXX XX XX X$$$$$$$WWWWWWW $$$$$$$$$$$$XXX"X'X,X-X/X/X,X'X"X %F%J%N%W%\%W%U%T%N%FX6X2X-X,X1X2X6X2X6X6 %%%%%%%%%%%%%X>XX9X&Y&[&d&e&a&]&Y&YXXXXXXXX &&&&'&&&&WWWWWWWWW &&&&&&&&&&&&WWWWW W WVVVVV<%%%& &&&&&&&&&&&&&& & && &&&&&&& &&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV,%%%%%%%%%%%%%%%%%%%%%%&&%%%%%%%%%%%%%%%%%&&&VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV~VV~VVVVVVVVd&&&&&&$&,&5&@&H&K&O&V&[&a&o&t&{&&&&&&&&&'''''&'2'?'F'I'N'W'['d'g'l'l'p'w'x'}'''}'z'l'l'g'_'['W'S'P'N'F'C'>'<':'4'-','!''' '&&&&&&&&&&&&&'' '&&&&&&&&&&&VVV|VzVzV~V~VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWWWWW WWWW WWWWWW WWW W W WW WW W W WWWWWVVVVVVVVVVVVVVVVVVVVVVVVV&&&&&&}&w&o&e&Y&Y&Y&V&H&@&;&2&&&&&&&&%%%%%%VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV '}'{'x'q'q't'q'l'l'p'n'n'lWWWWWW!W#W$W(W+W-W5W7d'#'%')'0'5'>'K'P'S'\'^'a'f'l'{'''''''''(((((4(8(?(G(O(V([(a(j(n(u((((((((((((((((((((((z(((((((((((((((((((((|(r(h(Y(C(?(4(9(B(G(M(J(G(E(?(=(8(8('7'7'0','#W~WWWWWWW~WWW~W}W}W{W{WvWvWsWsWqWqWnWlWiWeW_WZW[W[WXWVWQWNWFWBW< (O(Q(Y([(a(a(Y(Q(OWWWWWWWWW(n(r(r(o(r(r(y(|(y(((((((u(n(nWWWWWWWWWWWWWWWWWW((((((WWWWWW ((((()) ))WWWWWWWWW*******X_XcXfXkXmXpXr+D+J+Q+V+V+c+h+x+++++++++++++++XXXXXXXXXXXXXXXXXXXXXXX+++++++++++++++++++,,,,,,,%XCX@XP>PAP>PAPDPCPCPDPFPGPFPKPMPNPMPKPFP>6(f(f(o(u(z(((((((((((((((((((((((((((((((((((((((((((|(u(r(o(j(h(fP>PP>+(((((((((((((((((((((((((((((((((((((((((((OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOdSSSS w,X   SRRRRRRRRRRRRW p8d,X -Y! K !!YtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYt!$!$!'YYY))h)*0*cWWWWW**k*i*m*n*u*{************************************WWWWXWWXXXXWWXX XX X XXXXXX%X'X,X/X2X9X;X@XEXEXHXJXMXOXPXRXWXYX_**+DXrXX++XXCD p8d,VVVVVVVVVVVVVVVV8XHXHXHd8pSTThTTUFUppppUUVTVTqTU(UUVTVVWWoXpXYYt,X Lx@  l !4!YTTTTTTTTTTTTTTTTTTTTT X LmVTVTVTVTVTVTVTVTVTVTd{{qqgg^II????5,,,!!!!  WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXX XXXXXX"X"X%X*X*X%X#X XXXXXXXX X#X'X,X1X;X;X>X@XEXHXMXRXUXYXYX_XdXdXiXpXu0wwwmmdYYYYOEEE;2'' XuXzXzXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYY YYt X LVTVWWWWWWWWWW RRS4SST`TU(UUVTL   x@@@@RRRRRS4SST`TTTTT`SSTTxmmmmTU(UUVTVTVWWWWWXHXYYtm@  l !UUUUUUUUx@WWWWWWW x@  l X@X@X@X@X@X@X@X@X@!!!RS6Sk !f!g!j!l!`!Y!Y!Y![SuSST$T`TTU(U WNWWX!!"`"S6S6S4S4!Y!!"`"#TTTTTT##ET`T` !4!!"zV*V*V*V*V, !4!!"`"WNWNWNWNWNWNWN""#(#ARlRlRlRl$$T$$%RlRlRlRjRl%*%%&2RNRKRFRA########R.RlRS4SSSS%$$S4SS# ####$T$%%%%%&&&&&"&)&&&&&&&'/'SSSSSSSSSSTTTT T TT TT TTSTSSSS#b#####${$$$$%%%<%%%&N&O&j&h&''t'(<((TTTTTTTTTTTTTTTTTTTTTTTTTTTT1%_%a%j%m%x%}%|%%%%%%%%%%%%%%%%%%%%&& & & &&&&)&/&3&8&:&@&E&O&T&[&e&b&e&e&jSTTTTTTT)T,T0T0T5T5T8T;T?T=TDTETITJTITOTXT[TXT`TgTcT`T]T[T^ThTmTmTqToTlTlTmT~TTTTTTTc%%%%%%%%%%%%%%%&&& &&$&K&N&H&N&N&S&Y&^&g&t&z&&&&&&&&&&&&&&&&&&&&&&&'''''''!'%'!'&',','/'-'2'<'?'E'S'\'^'b'f'i'l'u'''''''''''''''''''TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUUU UUU(U2U5U7U9UAUCUFUKUMUPURUXUdUaU]UWURUWU\UaUiUkUsU}UuUUUUUUUUUUUUUUUUUU'C'CUU(((U#U(U+&''t'(<(((((((((((UUUUUUUUUUUUUUUU((((UUUUUU)q)!VTVw"C"C"K"M"XXPXXXX"#(##$VVVVV###XKXWXk$$$UV V$e$%%-VVVV%-%-%-%-UUVTV%-%%VVV&&&&UUVTV'''t'(<((VVVVVVV )))))))))VTV^VjVpVVWW WN)))))*C*m*m*p*p*x***VVVVVVVVVVVVVV )*0*u*{*******WWVWWWW WW WW*<*>*<*C*CVtVuV|V~V****WVWWXdXx H T Z ( ( (  z   yQ ( H H ) YIb\7PJ%ppUUq^I9 R~~1@r@%%_%N%<%#$$$$%-%N%%%&&H&z&&&&&''0'['''''''( (*(<(*(''(#(U((((((())))(((((()$)G)y))))h))))y)V)$(())6)h))h)6)()$)6)h)h)G)$(() ).).))))G)h)))plplot-5.10.0+dfsg/data/cmap1_gray.pal 644 1750 1750 10511571523062 163400ustar andrewandrewv2 rgb 2 0.0 0.0 0.0 0.0 1.0 0 1.0 1.0 1.0 1.0 1.0 0 plplot-5.10.0+dfsg/data/plxtnd5.fnt 755 1750 1750 16270211360254254 160250ustar andrewandrewIMOHNIJKLIbdSRXI     $@YZ[\]^_`abcdefghijklmnopqr !"#$%&stuvxy{|}~IMOHNIJKLIbdSRXI$@56789:;<=>?@ABCDEFGHIJKLMNOPQRTUWXYZ[\]^_`abdefIMOHNIJKLIbdSRXI          $@ghijklmnopqrstuvwxyz{|}~OPQRTUWXYZ[\]^_`abdefIMOHNIJKLIbdSRXI                 $@[ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t OPQRTUWXYZ[\]^_`abdef  +9GRcns|&/:EW_jx />FTcgko}#1DIQ]ot}(6X]e!Wz!k&Vdx % 7 E P i t y   ' 4 < J R [ f q    1 < L X ` u  ; Y w  < k 5Ps(3G[l$8LWkv 5Nc)=GYp 7Ut(B_p7Se~(0Pjr} !)19DLV`ky %;m.JZfs9>CHMRW\afkpuz &?Xo&1Vs$;HXzLv 1U 4 V v !,! >.>`>>>>>>>-?M????@.@Q@t@@@@@A(ANArAAAAAAB,BBB CC/CCCeCCCCCCDD@D\DDEfE}EEEEEEFBFdFFFFFG=G_G|GGGGGGH!H=HSH}HHHHI.IHIXItIIIIIJJJwJJJKJKmKKKK+LSLwLLLMDMlMMMMNHNvNNNN O0OJO|OOOOOOP4PZPPPPPQQ.QJQ\QoQQQQQQR2RZRzRRRRR S.SMSmSSSSSST6TbTTTTTTTTUHU\UUUU'VgVyVVVVV5WOWiWWWW X%XNXXXjX|XXXXXXXX Y6YjYvYYYY0Z`ZhZrZZZZZZZ[>[C[Y[o[z[[[[[[[[[\)\J\b\\\\]K]f]]]]]^)^;^U^^^^^^_@_k____`H`z`````'aSapaaaaab:bQbwbbbbb c%cCcccccccd=dfd@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@ @@@@@ @@ @@  @ @ @ @@  @ @ @ @@   @ @@  @@ @@@@@@@ @@ @ @@  @@@@@@@@@  @@@@@@@@@  @@@@@@@@  @@@@@@@@@@@     @   @@@@@@@@@     @   @  @ @@@@@@@@@  @@@   @  @@@@@@@@@  @ @ @  @   @@@@@@@@@  @@@   @  @@@@@@  @@@@@@@@@     @   @  @ @@@@@@@         @@@       @@@@@@@@@       @@@@  @ @ @ @@ @@  @@ @@@ @@@  @@@@@@ @ @@ @ @@ @@@ @@@@ @ @@@ @    @@@    @@ @   @@ @  @@@@  @  @@@    @@@ @ @@@  @@  @@ @ @@@  @@@ @ @ @ @@ @ @ @@    @@ @    @@    @@@ @    @@@    @@  @  @@  @@ @ @@ @ @ @ @@ @ @@ @ @@  @  @@@ @ @@@ @    @@@  @  @@ @ @@@ @  @@@@  @  @@@ @ @@@    @@@  @@ @ @@@ @ @@ @ @ @ @@ @ @ @@  @@@@    @@ @ @  @@ @    @@ @  @@@  @  @@  @      @@ @@@ @ @@ @ @@     @@  @@       @@@     @@         @@    @@    @ @@@  @@  @     @@      @@    @@  @   @ @@       @@  @  @      @@  @      @@       @@         @@       @@          @@   @@    @ @@   @ @@         @@  @ @ @ @@   @    @@  @  @@      @@ @ @  @@ @@@ @@@ @@  @@@ @@    @@@ @@@ @@@   @@@     @@@  @@@@  @@ @@   @@ @@@ @@ @@@ @@@ @@@ @@  @@@ @@@ @@@ @@@@@ @@@ @@@ @@@@ @@@   @   @@@ @@@     @@ @@@  @@@ @@@    @@ @@ @@@@  @@@ @@ @@ @@@  @@@@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@  @ @@ @@@  @@     @@ @@  @ @@ @@      @@ @ @@    @ @@ @@@ @@@    @@ @@     @@ @@ @@ @ @@ @@ @@@@ @ @@ @@ @@@ @ @@@ @ @@ @ @@ @@ @@ @@@ @ @@ @@     @@    @@ @@@      @@@  @@@ @@ @@@ @@@ @@@   @@   @@     @@  @@  @ @@  @@    @@  @  @@    @@    @@ @@ @@ @@@ @@@  @@@     @@@  @@  @ @@     @@ @@   @@ @@  @@  @@ @@ @@ @ @@  @ @@ @@@ @@@@ @@  @@    @@  @ @@ @@@@@     @@ @  @  @ @@ @@@ @ @@  @@  @@  @@ @ @@@@@  @    @@ @  @@ @@  @  @@@@@@ @@ @    @@  @@ @@ @@ @  @ @ @@@ @@@ @@@ @@@@ @@@@@@@@@ @@@@@@@ @ @@@@ @@@ @@    @@ @@ @@ @@ @@ @@    @@    @@    @@ @  @ @@@ @@  @@@ @@ @@ @@ @@ @@ @@ @@  @@ @@  @@  @@ @@ @@ @@ @@ @@ @@  @@    @@  @@  @@  @@  @@ @@ @@ @@ @@  @@     @@      @@  @@  @@ @@ @@@@ @@ @@@@ @@ @@@ @@@@ @@@@ @@ @@ @@   @@   @@ @@@ @@@ @@@@ @@@@@@@@@ @@@@@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@@ @@@@ @@@@ @@@@ @@@@@ @ @ @@  @@@ @@@@ @ @@@ @@ @@ @@ @@@ @@@    @   @ @@@ @@@@ @ @  @ @@@@@@@@@@  @@@@@@ @  @ @@@@@@@@@@@ @@@  @@ @@@    @@ @@ @@ @@ @@ @@ @@ @@ @@     @@    @@     @@ ))('%"  "%'())( ' %""% ' ())@@  @    @@  @    @  @@ @@ @@ @ @ @@@ @@ @ @    @   @@@@      @ @@ @ @    @   @@ @ @@   @@@@ @ @@   @@@@      @ @@@ @@ @ @ @ @ @ @@@ @@  @ @  @@@  @ @  @@ @ @ @@@ @ @@ @@ @ @ @@@ @ @ @ @ @ @ @ @@ @@ @ @ @ @ @ @@@    @ @   @@ @ @    @   @@@    @ @   @@@@ @ @    @   @@ @ @@      @@@ @ @    @@@  @ @ @ @@ @ @ @ @ @@ @ @ @ @ @ @ @ @@ @ @ @ @ @@ @@ @ @ @ @ @@@  @ @   @@@ @ @ @@@ @@ @ @    @   @@@@ @ @   @@@ @ @ @@@@ @ @@   @@@@  @ @   @@@ @ @ @ @ @ @@@ @@    @ @   @@@@@@  @ @  @@@ @ @ @@@ @ @@ @@ @ @ @@ @@ @ @ @ @ @ @ @ @@ @@ @ @ @ @ @ @@@ @ @@@@@  @  @@@@@@    @ @   @@ @ @ @ @ @@ @@ @ @    @   @@@ @ @   @@@@ @ @    @@@  @ @      @    @@@ @ @@@@  @@@ @ @ @ @ @@ @@ @ @@ @  @  @@@     @ @   @@@@  @ @ @@@@@ @ @   @   @@@@       @ @@ @ @    @   @@ @ @@  @@@@ @ @@  @@@@       @ @@ @@ @ @ @ @ @ @@@@@  @ @  @@@  @ @ @@ @ @ @@@  @ @@@@ @ @  @@@  @ @ @ @ @ @ @  @@@@ @ @ @ @ @ @@@      @ @  @@ @ @   @  @@@      @ @  @@@@ @ @   @   @@@@@      @@@  @ @   @@@  @ @ @ @@ @ @ @ @ @@ @ @ @ @ @ @ @  @@ @ @ @ @ @@@@ @ @ @ @ @@@ @ @  @@@ @@ @@@@@  @ @@ @ @@@@ @ @@@ @@ @@@  @ @@@  @ @@ @@@@        @ @@@@ @@@@@@@ @ @@@ @@ @@   @@@@@@     @@@@@ @ @@@@ @@@@@  @ @  @@@ @@@@   @   @@@@@@ @@@@@@ @@ @@@@ @@@@@@@ @@@@ @@ @@@@@@ @@@  @ @@@ @@@@@@ @@ @@@@@@ @@@@@@@ @@ @@@@@@@@ @@@@@@ @@@@@ @@@ @@  @ @    @  @@@@ @@@@@      @@     @@ @@@@@  @@@ @@@@@ @    @   @@ @@@ @@@@@@ @ @@@@ @@@ @@@ @@@@@@  @@@@@@ @@@@ @@@@ @ @@ @@@@ @@@ @@ @@@@@ @@@@ @@@@ @@@@  @ @@ @@ @@@@@  @@@@@ @ @@@ @@ @@@   @ @@@ @@ @@@        @  @@@ @@@@@ @ @@ @ @@      @@@@      @@@@ @ @@@@ @@  @ @  @@ @@@@    @   @@ @@@ @@ @@@@ @@@@@@ @@@@@@ @@@@ @@@  @ @@@ @@ @@@ @@@ @@   @@@ @@@@@ @@@@@ @@@@@@       @ @    @   @ @@ @@       @ @@@@@ @@       @ @ @ @ @@@ @@   @ @    @   @  @  @ @@@@@   @ @ @    @   @ @ @ @@@@@ @@@@@ @@@@      @ @   @@@  @ @@@@@ @@@ @@@@        @ @    @ @ @@    @  @ @@@@       @  @  @  @ @@@      @ @       @   @  @  @ @@      @ @ @    @   @ @ @ @@ @@@ @@@ @@@ @@@   @ @   @@   @ @@@     @   @@@@     @   @@@@  @ @ @@@ @@@  @  @@     @ @@@ @     @  @  @@@    @ @   @@@@@     @ @   @@ @@ @@ @@@ @@@   @ @@@     @   @@@  @ @@  @ @ @ @@     @@  @ @ @@ @@  @ @@  @ @@ @@@@@ @@@@@  @ @@@   @ @@@ @@ @@ @@ @@@ @@ @ @@ @@@@ @@@@ @@@ @@  @ @@@  @ @@  @ @ @@  @ @ @@  @@ @@  @@@@ @@@@  @@  @  @@ @@@  @  @@  @ @@   @   @@    @@  @@   @@   @@ @@ @@ @@ @@ @@ @@ @@@  @@@@  @@@@ @@ @@ @@ @@    @@  @@ @ @ @  @  @@ @@@@      @ @@      @ @@@    @@ @     @ @@       @@@@ @@       @@@ @@    @@@  @ @@@@     @@@@@   @ @@@@@@   @ @@@@@@@@@@@  @  @@@@       @@@@ @ @   @   @@@@@@    @@@@@       @ @ @@ @  @  @ @@ @ @ @ @@@ @ @@@ @@ @  @  @@@@ @  @ @ @  @  @@@ @ @    @   @@@   @  @@ @ @@ @@ @@@@@     @   @@       @@@ @@@@ @@@@ @@@@ @@@@  @ @        @    @@  @  @@@@@ @@@@  @ @@  @@ @ @ @@@    @ @  @@  @ @ @ @ @ @    @   @@     @ @   @@@@  @@ @@  @ @@  @ @@ @@@@@@@ @      @  @@ @@@ @@@@ @@ @ @@  @@ @ @ @@ @@@@ @@@@ @@   @@ @@@@@@@@ @@@@@@@@ @@@@@@@@  @ @@@@@@  @@@@@@@ @@@@@ @ @ @ @ @ @@ @@@@@@@ @@@@@@@@@@@@ @@@@@@@ #%&&%#    @@ @  @@      @ @@@@@@@@@@@@@@@ @@@  @@@@@@@@ @@@@ @@@@ @@   @@ @@@@ @@@@@@@@ @@@@@@@@  @ @@@@@@  @@@@@@@ @@@@@ @ @ @ @ @ @@ @@@@@@@ @@ @@@@@ @@@@@@@ #%&&%#    @@ @  @@     @    @@@@@@@@@@@@@@@ @@@    @@@  @@ @@@@ @@  @  @@@@@ @@@  @ @ @@ '! @! @@ '! @! @@ '@'@''@@@ '@'@''@@@ '!@$  @@@ '!@$  @@@ $! @! @@ $! @! @@ @@@0@@  $ $ # " ! ! " $ & ''&$"@ # " " # #@@$!@@@ @ @ @ @@@@ @ @    @   @@@@    @   @@ @ @    @    @@ @ @  @   @@@@@@ @ @  @   @@@@    @   @@ @ @  @ @@@@  @  @@  @  @@ @ @  @ @@@@  @ @@@@ @@@ @ @@@ @@ @ @ @ @ @  @@    @   @@ @ @    @   @@    @   @@@@ @ @    @   @@@@    @    @@ @ @   @  @@  @   @@ @ @  @ @@ @ @ @ @ @ @ @ @@ @ @  @ @@ @ @  @ @@  @ @  @  @@@@   @ @ @@@   @ @   @   @@@@      @  @@   @    @@      @ @@@@  @   @   @@@      @   @@@@  @ @     @  @@  @    @@   @    @@  @ @ @  @@ @@      @ @@  @ @ @ @  @ @@ @ @ @     @@      @ @@   @ @     @   @@      @   @@   @ @   @   @@ @@      @@@  @    @   @@  @ @  @ @@  @         @@  @@  @  @@ @@    @  @   @@  @ @ @ @@  @   @  @@ @@@@@ @ @@@@ @@@  @  @@@@ @@@    @    @ @@@@ @@@@@ @ @@@@      @   @@@@      @   @@@@ @ @@@@@@  @  @@ @@@@    @   @@ @@@@@ @@@ @@@@@ @@@@@ @@@@@ @@@@@@@@@  @  @@@@ @@@@@ @@@@@ @@@@@@ @ @@ @@@@@ @@@@@ @@@@@@@ @@ @@@ @ @ @@ @@@ @@  @ @@ @@@      @ @@ @@@ @@ @ @ @@ @@ @@@@ @@@@ @ @ @@@@@ @ @ @@ @@@@@ @@ @@@ @@ @@@ @@@@ @@ @@ @@@ @@@@@ @@@@ @ @ @@@ @@ @@@ @@@@ @@@@ @@ @@@@@@@ @@@ @@ @@@@@ @@@ @@@ @@@   @ @@ @  @@   @ @@     @   @@@@  @  @ @@@@@@@  @ @ @ @@@ @ @   @  @@@@@@@      @  @ @@@@@@  @  @ @@    @   @  @@@@    @@@ @  @  @@@ @@@ @@@@@ @@@@@ @@@@@@@  @  @@@@     @   @ @  @@@@@@  @@ @ @@     @   @ @ @@    @  @ @ @  @@ @@    @   @@@ @  @@  @ @@  @ @@  @ @  @ @ @ @  @ @ @@   @ @@ @  @  @ @@   @ @ @ @@  @ @  @@ @ @ @  @ @  @@     @  @   @@ @@@ @@@ @@@      @ @  @@ @ @  @ @@      @   @@@@      @   @@@@  @ @ @@ @ @  @@@@      @ @@@ @  @@  @    @@      @ @   @@@@@      @  @  @@ @@ @@ @@@ @@@   @ @  @@@     @   @@@   @@      @@         @@@@ @@     @@@ @@   @  @@  @ @@  @ @ @@ @@ @ @@  @ @@  @ @@ @ @ @ @@      @@ @ @ @@@ @@ @ @   @@@@ @ @    @   @@@@ @ @   @@@ @ @ @ @ @@@ @ @@ @ @@   @@@@  @ @  @  @@@ @ @@@     @   @@@@ @ @ @ @ @ @ @@ @@ @ @ @ @ @ @ @@ @@@ @ @ @       @@ @@@ @ @ @ @ @@ @ @ @ @ @ @ @ @@ @@ @ @ @ @ @ @@@ @@    @ @   @@ @ @ @ @ @@ @@ @ @    @   @@@      @ @@ @ @    @@@ @ @ @ @ @@ @ @  @    @ @  @@@ @ @ @ @ @@ @@ @ @ @ @ @ @ @ @ @@ @ @ @ @ @ @ @@  @ @ @ @ @ @ @  @  @@@  @ @ @ @ @ @ @  @  @@@@@  @ @   @  @ @@  @ @ @@@ @ @ @ @@ @ @ @@@@     @   @@@  @ @ @@       @  @     @@@  @ @ @ @@@ @@ @ @@@@   @   @@@@ @@@@@@@ @@@@@ @@@ @ @@ @@@@ @@@     @@@ @ @@@ @@@@@ @@@@@ @@ @@@ @@@@@ @@ @@   @@ @@@@@@@@ @@@ @ @@ @@@@@@@ @@ @@ @@@@@ @@@ @@ @@@@ @@@@ @@ @@ @@@@@@@ @@@ @@@@@ @@@@@@ @ @  @@@@@@@ @@@@@@@@ @@@@@ @ @@ @@@@@ @ @@ @@@@  @  @@@@@@ @@@@  @  @@@@ @@ @@@@@@ @@@@@@@ @ @@ @@@@@@ @@@@ @@@@  @@ @@@ @@@@@@@@plplot-5.10.0+dfsg/data/cmap1_radar.pal 644 1750 1750 65211571523062 164760ustar andrewandrewv2 rgb 16 0.00 0.00 0.00 0.00 0.0 1 0.07 0.00 0.93 0.93 1.0 0 0.13 0.00 0.63 0.96 1.0 0 0.20 0.00 0.00 0.93 1.0 0 0.27 0.00 1.00 0.00 1.0 0 0.33 0.00 0.78 0.00 1.0 0 0.40 0.00 0.56 0.00 1.0 0 0.47 1.00 1.00 0.00 1.0 0 0.53 0.91 0.75 0.00 1.0 0 0.60 1.00 0.56 0.00 1.0 0 0.67 1.00 0.00 0.00 1.0 0 0.73 0.84 0.00 0.00 1.0 0 0.80 0.75 0.00 0.00 1.0 1 0.87 1.00 0.00 1.00 1.0 0 0.93 0.60 0.33 0.79 1.0 1 1.00 1.00 1.00 1.00 1.0 0 plplot-5.10.0+dfsg/data/cmap0_default.pal 644 1750 1750 20311571523062 170200ustar andrewandrew16 #000000 #ff0000 #ffff00 #00ff00 #7fffd4 #ffc0cb #f5deb3 #bebebe #a52a2a #0000ff #8a2be2 #00ffff #40e0d0 #ff00ff #fa8072 #ffffff plplot-5.10.0+dfsg/data/cglobe.map 755 1750 1750 157550 7633337504 156450ustar andrewandrewdXx H T Z ( ( (  z   yQ ( H H ) YIb\7PJ%ppUUq^I9 R~~1@r@%%_%N%<%#$$$$%-%N%%%&&H&z&&&&&''0'['''''''( (*(<(*(''(#(U((((((())))(((((()$)G)y))))h))))y)V)$(())6)h))h)6)()$)6)h)h)G)$(() ).).))))G)h)))d@@F`  : : :`Q l !"G"#$T$%_%&'B'''(n))h)6)*b*++,$,$+++++,,D,,5,5++++C+;+|++,$,g,g,,,-P-P--.8.J.|//T//0,//////d/D/..Z..----P)))))))))))))))))**7*I*0*A*(*))))))))))))*)))))))))**A*b***+1+1+T+m++++++,,+,D,,$,,5,N,o,,,,-- -7-P-`-y---y-y-`-`-%-/-P--/- ,,,,,V,o,Vd-P-p- ,,,,,-p--..J.8.|..8..|...J.|..8.8---p,,,-./0p1X2 3 35 6L7F889J9:;>;<(<==><>?h?@A A~AAAAABB6BBBBCrCQCrCQCDDCDE$E$EEVEEEF FPFG[GH"HI-IJ8JKB,V,+,+,++++u+u+T+*****Z*0*))))))G)$(((((n(<(*(4(4(#('''''''''( (*(M(n((())=)`))))))**7*P*s*{*Z*{***i*A*P*i******s*s*{*******{*b*{*********dKBKLnLMyN NOLOP5PQaRRRSfSUSfSST`TUIUkUUUUVuVW=WXHXY!YBYYZ YZ ZnZ[G[\0\\\Q\\]\]}^^g^_/_`8`a#avavaaavaaabOb bccjcddudde,ef7ffghhhiWij@jkklkl4lwlmm`************+ +"+*+*+\+|++c+;+*+"*++*+J+m+++++++++++,$,V,o,,,,o,],D,=,+,$,+,+++++++++++\+J+"****++"++ +*+J+T++++,,,$,5,D,=,=,D,V,N,N,V,D,V,D,V,N,]dm`mmnnnoTopppqqfqqqrVrs snstJtuNuv*vzvwwtwwx2xnxxyyyhyzbz{*{{|V|}2}}~J~~~X>L~܃@rքNЅ44Hz(6̉̈ꈚ"n~ޅޅB,],],,,,,o,V,N,5,N,D,],,,,,,g,V,=,5,5,D,],=,=,V,N,o,o,V,+,$,,+,g,,v,,v,,g,g,V,N,D,=,$,5,$++++++++++|+++T+;+\+T+C+*+************b**I*0))))))`)V)6)((((n(C(BB(`fЄЄЄ4`("N(''''''b'0'&&&z&O&%%%%%FnF('(((4( @]]%%@''l'S'!&''B'l'' N k (f(U(u((f((n())G))*b*+m++++m+;+***P*b****A))$(**s*P*A**)))**7*b***+1+m+c+T+"******* ())h)))6(((*****+***-/--.----/- ,--/-P--7- 0>0p000>----- .|./"/d//T/"..|----..---4644X46....d'&&&&&&&&''0'!'&&&&&&&&&&''0'B't'''''( (*(<(\(n((((()6)h)))*0*b************************{*b*s*{*Z*P*Z*b*b*s*P*Z*A*7*)))))))))))))FPF.EEEEvEfEVE$EVEVE4EDDDDD}DKDCCCCC{C@CBBBBWBAAAAnA<@@@@t@R@)@ ??????h?X?/? >>>>N>====T="<<<-p-y-i-,,,,-/-`----..--..c../"/d///0 0,0%//////v////00W001181a1j1s1112222d222233,3E3U3^3U3U3U3~334464q44445 5R5555644&4X4444445 5@5b55555555566L6e6L6:6:6S6u66677-7777$7-7=7M7f77788'8P888899888888888999:9l999::4:f:::;;.;`;;<<8>N>>>??H?h??@@B@t@@AABhBBBCCbCCDDCDSDKDSDuDDDDEE4E4E$E$E=E=EVE]EDE4EfEEEEEEF F EEEEF.F>F7F>F%EEEEF F>FaFFFGGJGGGGHH3HTHmH~HHHHHHd0p0>00////m/v/d/2/...|..|.A.---.---P-,,,,v,N,$+++++m+;+******i*i***P*I*0*I*b*P*7*i*w**s*P*0*))))V)=)(((((((U(U(*( '''''l':'!&&&&a&6&'&%%%%%%%HHHHHHHHIIFIgIIIIIJJJ'JJHJjJzJzJzJzJQJ@JHJYJrJrJjJjJaJJJJJKJJJJJJYJIIIJJQJrJJJJKK!K)KJJJJJJJJJjJ8JIIII_IIIIIIJJIIIIIIIJJJ8JaJJJJd%%%%%%%%%%%g%<%$$$$T$###########$$$"$)$;$e$e$L$####Z#(#""""""""q"q"5!!!!f!E! l S A S !  ! ! ! ! 2 A Z Y S S A K l !!"!E!,!M!M!!!""G"q"""JKKKK}KKL'L,L-p-..j.|......|.J.J.---P-,,,,,g,,-7-7-,,,=+++|+C+******+TTUU9URUUUUUUVV"VCV\VmVmVmV~VVVVVVVVVVVW W-WNW_WoWWWWWWWWWXX'XXWWWWWgWNWoWWWWWWXX'XHXiXXXXYX/X7X'X/XPXaXXXXYYY)YBYcY|YYY|YcYSY:YXXXXXXXY!d++C+|+,,,=,,--P--..8..//;/d/00^00p00>//////K/+...Z.1.1.Z.(.(----`-/- ,,,,,],=+++\+*+*+1++****I*b*)))((u(''( ''(((''''( (*(<(U(U(#'''B'b'{''''tY!YJYlYYYYYYYYYYYYYYZ Z+ZMZfZnZZZ[[G[G[p[y[[[[[\\(\I\{\\\\]*]\]]]]]]]\]C]"] ]C]K]u]]]^^$^$^=^^^w^^^^^^^^w^^^5^ ]]]]m]d]C]"]\\\s\0\[[[[y[O[ZZZd't'!')&&&&h&'&6&6&&6%%%$$e$"###(""y"?"?""!!!m!M!M!T!m!!!"."."""#(#$ $T$T$$m$%%&&&&&&&%%%g$$$$$$$;#####/"""5""g"!!!!!"g""#"!!" !!4!4!4 ZZ]Zbad !!T!!"! } s j @s3 9,EYjQD]P=90I<< 3  " A4/rxc@r%]S'aaanaDa````aa+adaadaDa`````aa:a+a```````````a'a@aDaYaraaaianaana}aaaaaaaaja}avaUa+aDada}aaaaaaaaaaaaabb,aaaaaaqaKaI_IIIIIIIIIpI5I(I HHHvHDHGG (*( '''''t'''S''GGG[G[G)FFFFFFFPq W/)> p-U>paq``%`1`_________`_``B`8`B`[`t``c`Q`=`E5{kCXg!EYEE^5^^^$^^=^N^^^^^^^^^^^^^^^^^^w^o^N^5^5 9X[ uC];]2]T]d]d]u]]]]]u]\];  cccmF'F' \Q\j\\\] \\\\s\Q A K } s l l l S 2 [%[ZZZZZfZvZMZ#YZ ZMZvZZ[[G[O[O[%@++` `Qjj+[ ZZZZZZvZMZ+Z YYZZ4ZUZZZvZZZ[ [ $"X"""#A##$ ##$ $3$t$%%%N%N%5%<%%$$$$3####h#a#9""""XXXXXzXXXXXXXXrXrXXXzXzXzXXXYYY)Y[Y[YtYSY:YYXXXXX9#$;$"$$ #$$$"$L$t$$$$$$$$%%N%x%%%%%%%&&&&a&a&z&&z&'')&&&h&'%%%n%x%%-%$$m$T$3$#WWWWWVW-WVVVVVWW5W_WWWWX'X'XXWWWxWVWxWWVW$W$W=WxWWWWWWXX@XPXYXYXaXaXPX@X@XHX@X/X/XWW%&&O&a&'%X7X'XX@X7X7%%&/&h&&'!'[''w'B&&&&z&Y&%%%VVVVVVVVW W W W VVVVVVVV')'['o''((M(((((\(<''''I')W5W-W2W=W=W5W=WNWWWWWxWWxWoW_W5""""""""FXF%F EEFF.FX )h)V)V)G))))))h5555b5Y555555+u+s+J+*+***+1+;******s*()))h)$)6)h))y))))*0*0***+ +;+|+++,,V,,,,,g,=+++++u1111111z1j1z1j1Q11&1X1&181H1a111111z1a1H1/1/1 1 000000000000000011181X1z11.j..///T/v////D/....j21211122222B222B292227x788@8P8'77x18110011/18.(.c.|.|.8.J.J.(J8J8JQJJzJrJHJ8+N+o+e+NK#KKK# '''(#(C(f((u(M('''MiMiMGM?MPMGMGMiMyMMMyMi%%%%&&%%NNNNNNNN9%-%n%%%%&/&r&@&a&&&')'[''''(#(4('(<(n(())$)V)O)6)(((((n(<(''''S'0'&&&z&H&%%%%_%_%-NNNNOO+O"OO NNNNNNNNNNcNcNAN(NNNNNNN N(N9N9NZNcNZNNNNNNNO O O+O;OLOLO]O]OLODO;O"O NN()6)y)))**A*C*i*****+*+\+|++u+"+J+****P*C*0))))))*))))V)6MyMXMiMiM`MiM`M]M.MXMqMMiMqMMM`MMMMMMNNNNMNNMMMMMMyMyMMMy ,,=,g,,,,N,,MXMPMXMXMqMMMMX.(.1.A.Z.J.A.(LLLLLLL.j...jLKL L '''''( ''''P%POOOOOOP%P%))))))N|N|NNNN|'t'''''''tPPPPPPPP((1((#(PPPuPP(V((PFP!O((OO()OO?)G)y)SO;O!N))OO **%*eNNN&Y&OO(((TTT6 )h))*0*)))o)hV*V3V;VTVeVTVLVCV* -%-i---.8.---i-%YYYYY|Y|YYYYY -7-W---.---W-P-7XXrXYX@XaXzXrXrXXX%%&O&O&%%^^^^^^^'&')'S'['^^o^V^^^ ''I''B'b'b'{'b'\I\Q\(\(\A\\Q\j\I&H&&&&&H[ZZ[ [[3/"/2/}/00g000w001 1?1&1X1X111111z1X1?1Q11Q181j18000w00g00>0^000p0,0 ////}/]/}/K/"YXXXXXXXXXXXXXXXXXXXYYXXYYJYBYcYYYYYYYYYZZDZvZvZ]Z"#(#$%&'':&%$$t% % %F$$$##$T##Z#Z$ % %&&r&'t''[''()))h*b*+m,=-/-7-.j.j--%,+))6(M&&%$t$t#"f&eeeeeeeeeeeereEeeddddd}dqdRd*d dd*d d2dd*dRd}dddde,e^eseeeff7fSflfffffffffffxfefPfPf&r (reeweeLc@ Z ! j@@e@e,edddddddddde"dddde e@e@eReRe@ l!"!"?".!4 lddddddd-siddvdkdddL   rxLd9dccccccdd&dCdFd*dd%d?d9iiccccYxG  d !+xbbbbb^b,bOb^bbbccEc0c8c&cbbb,dddddedd2w2dddddCXqdddddddd-Ucccd cc93j2U>Wdcccdd2ddGdkdddddsdXd2dUEI[XkMIUcccccccjcbcmccccccdd dPd9dd ccccdd*d.d cc2U-;I2O!XyA;xYis7iL[ w88bHb1baaaaaaaava]a]aa!a+aDaUavaSa7aDabaaaaabbKbbbbccbbbbbbbbbbbbbsbHg93KY_agbwbObb,b6bhbbbcc&cQcQcjcQc?cbbbwn[[ڊЉZZZ[ZZZZv5q?5ZZZZ9CZZZ7~7Z[[%[>[6ZOO[%[6[J[h[h[G[%33_3_/_ _^_ __/_/'cm1]]]]]]]]  c w 1 \\{\\\\\] ]"]\\ Q\$Q[y[>[%ZZZZZ[ [>[p[p[y1c!J||/|JY1ZYYYYYYtYtY[YBY1YBYlYYYZZZ+Zd)*P**+***+u+*+,N,-.8.///0>0>000000181z12)2K11001X12K2}2d11z1X1Q1j1j1222B2K2223,344q45'5k5555566e6~66L667F78`899A9l9::;;<^>^=>>>w>>>==>^??6>>>>????@ @AA#??6>>5=<=======<<;:8@65 4&322K1/"..c.(-i,,=+,-,+|**)aaab b6b^bbbbwbbbbbcc&c8cQc{c{ccdddCd\dKdkdddee9eaeeeff8fDf$f-feeff3fDf_f[f?f8f_f_fqfmfxfffffffffffffXfxf_f?fffeeeeewe@e.eed%<==m==d<=}==m>>>?h?@ @@@@@@1???q?/>>>g>^====T=T== <________i_?_?_&__7_?_a_z___`8`1`J`)``)```__``8`B`)`)`_BC0ab>>?O>ccccdIIIIIJJ'JYJzJJJJJKKKKK!K%K)KBK[KdK}KKdKtKKKKKKKKdKBK2K!KKJJJJJJKK)KBK[K}KKKKKKKKLLLL#L4LELMLnLLLLLMMM.MPMqMyM`MGMqMMMMMN1NRNNNO+OeOOOPP_PxFPFEEEEoE=EDDDDDDdDTD:DD CCCCC{CICBBBBpBFB%AAAA]ADA@@@t@B@?????O?>>>>g>,>====[="<<<P-P%P-P5P>P5POOOOOO~OTO3O3ODOOONNNNkNkN|NNdbbbbbbbbbbbbbbbccc?cbcjc{cccccddd d2dRdudddee,e,eLe~e~eweweeeeeeeeeff&fXfqfxffffg'gRgrggghh3hLhDhShhhhhi$i-i_iiijj'j8j@jQjhjrjjjjjjkk(k:kANONNNNsN9NMMMM`M&LLLL^L,KKKKdK)KJJJzJHJIIIIxIIIIJJQJQJJJKKBK}KKL,LULLwLLLLLMMMGM`MqMMMMNNNANkNNNNNNNNNNNNOO3O NNNNoNcN9NNMMMMMyM?MdkAk2k!kSkskkkll,lMlmllllllllllllllllllmm&mGmjm~m~mmmmmmnnqfqzqfqpqqrrBrtr~rrrs s{R{{||.|V|j||}}}2}2}(}2}F}n}}n}n}}F}}|||V{||{{{{{f{*{ {f{{|.|j||}}<}d}}~~r~0N4pz8jVj 2xȂ܃,^XƄ4zjVBW-WFWxWWWX'XPXzXXYYBYtYYZ Z[p[[[[[\\8\I\0\A\s\\\\\] ]2]\]]]]]]]]]]]]]]^^$^E^g^o^^^^^^^__P_p_p____O dw,X  y=&5Y___``8`_______z_i____```J`t`````a a+aKd$rh|҇ `ЄXփ@F؁؁.ԀR~|}}F}x|||}|t{{\{ zzvzyyyy6xxxyxwwv\vHvzuu0tttss(rr`rrqr`rtrqq\qq\ppXop0pq*qrBrraKaUana}aaaaaavaKa2a+aKa]a}a}aaaana}aa}a}aaabb bbbabb6b6bObbbbbbbbbbbhb>bEb>bObEb,b>bhb>babb,b^bbbbccbbbbbc c cccc?cbcjcXc?ccc&c8ccbbbc ccIcjcccdrrr8qq pplopNooonnZmmlm&ll4kSjjQihh~h!hhLggfXeeefiff-ee^ddddddd\dd9ddd\cccccjcIccc{cbc&cXc&cc0ccqcjcc8cbbEab^bbbc bbbbbb^bbbb,bObaavab%b bb,b^bbbbbbbpb^b,b aaaaKaDa+````j`J`1`[`|```aaDavaabb>bhbbbbcbbbbpbEb%ad`j``t`t`aaKa```__W^^o]]d]2]m]]^,]]]]d]d] \\A[[[h[`[ZZIpIIIIIJJ/JJJJIJJ IIJQJ8JIIIII_I-IHHHHH~H]H;HHGGHH"HDHLHTH]H]HLHKHDH+HDHTH]HvHHHHHHHHHHHHHH]HGGHH H HHHGGGGGJG+GFFFFFFPKlKKKKKKKKLL4LELKKKKKKlKKKKKlKKK2K2KGKKK[KKKKKKKKRRRSS^SSMSnSSSSSSSfS4RRRRRRREE=EfEVEVEvEEEEFF%FXF\FiFiFaF>FEEEEQQQR)RBR?R:RtRsRlRSR:RBRQRQQQQQQQQQQQCCCCjC'CBBBCCICCCCDDKDDDEEDDD\D!CSSSSSSTTTTSSSSSSSSSSSSSSSAAeA[.[6ZZZ[6[y[[[`[G[ZZZZZZZZ]ZMZ#YYZ4ZfZMZZ[ [G[[`[W[G[ZZZfZ4YYYlYtYBY)XXXXWWWWgWFWVVVV~VTV*VVUUUUUcUbU0TTTTTTTTTTTUUZUUUUUVVCV3V3VTVuVVVVVmVVVW W W-W_WWWWWWXXWWWXX@XrXXXXXXXXXiXaX@XPX'WW] ] ]]]\]]]^,^,^V^w^V^$^$^E^g^$^ ]]]]]\];]2] WWWW_W_W_WNW_WWWWXX/XHXrXXzXXzXYXiX@X@X7XWbc&c?cQcIccddRddeeEeddddRdcccIcbXWWX'XHXYXrXXrXXiXrXXXXXXXXXXrXYXno"ohoopplppq qq*q>qqpppppXpooooho"nZvZ]ZnZZZZ[[6[h[[\\[[[[[`[6[ ZZZZZZvRRBRdRtRRSS#S#SRRRSRR^,^ ]]]]]]^^5^E^^^^^E^,SST.T.T`TTT`TGTOTSSTTSS^o^V^E^^^,^N^g^^^^^^^^^oDW5W5W=WVW_WgWWWXX@XrXXXXXXXYYY)Y:YBYSYcYtYYYYYYYYZYYYYYYYcYcY[Y1XYXXXXXrX@XWWWWxWWWWWWWxWVW5===d=;<<<#>N>w>>??H????@B@@J@|@AA>>>N>#==[[\\\[>==> >#>\\\\\>N>N>n>>N[%[G[p[[y[G[%K)KKK2K:KBK) a2aUaIHHHHHI IFIpIIJJ'IIIIxpppqq*q\qzqqqqzqHq ppMMMMqMqMMMMN N N NMMuDuDuNuvuuuuuuuuuuubuDOO]O"ONO"OLO~OOPP-POOOxyy,y,yJyJy,y,y,yhyyyyyyyyry@yxSMSSS{ { {4{R{{{{{|B|~|||||}}(}F}<}F}Z}d}Z}n}}}}}}}}}P}F}n}n}F}}}}}|||||t|L|{{{{{{{p{p{R{*zzzbz&yyyyrSSSSSSSSSSSSSSfS^SSSSSSTSTTT.ST T.TGTqTTTU0UIUIUsUUVV*VTVuVVeVeVLVLVeV3VUUUUbU0UTTTTTTTTTThT?T.TGT?T6T.T.TSSS+||}}}2}n}F}}}F}Z}}}~J~J~r~~D~~~~h~,~}}}}}}}}}}F}}(|VVVV~VVVVVVVVVVVVVWWW-WFW=WVWgWWxWWWWWXWWWWWgWFW-W-W5WVxWWWXWXWWԁ耶X'X/XaXPX'XX,JJ"YYYZ Z#ZY{||B|{[[[[[~B]*]T]m]\]*/}}}}}}}}}}}}}}}}}}~~,~T~T~6~,~}~~~"~J~|~~~~r~^~J~6~@~@~,~"~}}}}[%ZZZZfZ[%(bAbab Ob bbbAbA}<}~^~^}}d}bpbbbccIcqccccdd dRdddKd*ddccccccIcbbbbbwbEY[YYYYBY[a+a vblbD&&~~~~|~h~h~J~6~"~}}}}}}}}}}}}}}d}d}2}|||~|B|{{{{p{H{R{p{p{p{{{{{z{\{*z88899A9l999::4:]:::;;N;;;<>,>U>n>>>>??&?X???@@B@t@@@@@A#A]AAABAAAA]A>>>>>>^>^><><><>,>=======t=K="<<<>> l&~6l6:65555k5R5I5r55{55566L6\6L6:6:6\6l54\$8`tj~΋؋ ċVԊފfHЉ4\pR4666666S6*66!6L6l66667 7 7-7=7f7777x777787778878Y8y888888`87877777x7M77 6.Znȇ܈T̈&0DЉЉ Hff>4N:&ꈸ@ȇxZ4_4F4?4F4-4&44&4?4_4444559595R5r55556*636S6:6*6S6l6S6*655555b5@5 544444_Ȉ3343Ckkkkl l,lMlwllllmmmNm`mmmmmnnvpvpvHv*vv v uuvv*vRvvpv4vuuuvulu:u:uNuvuuuv*v\vvvw$w8w$wvvvzvRv*uuuuvu0u&uutttttE4DDDDDKD!D!D*D\DDDE$EDEDE$DDDD}DlDD:DD:DuDDDEE=E]EEEEEFFEEEEEF FHFzFFzFFFFFqFzFFFFFFFFFFFFFFFFzFHFEEEE]E4x x(x2x(xFxxxPxFxPxxdxxxZxFEF%FPFFFFFFFG)GFFwwwxwwwE DDDEEE xFxxxy,yhyhy@yxxxdxFEDEDDDDE$E$E=E4E4Evw8EEx xdx(x EEEEy6yhyyhy6F>F%F7FPF>{*{\{{f{*F EEF F dyhyyyyz&zbzzzNz&yyyz&z&z0zbzzz{ {H{{{|$|L|`|t|~|V|8||V||}}}<}d}d}}~~@~J~@~h~|~~~0Xl*fԀ$8Ԁ\44 lDD~~~~^~,}}}}d}d}(}EEEEEoEoEvEEVEVE=EDE4E+E DDDDDDDDDDlD\DCD!CCC{CrCICCC'C'C0CBBBBBBBBCCC8CbCbCQC8C0BBBBBhB_BWBOBFB%B-BWB_BpBBBBBBC0CIC{CCCCDDD!D*DdDDDDDEEE+E=EMENEfEf}|||`|.{{{{z{\{H{ zzzzzzzbz0yyyyhEfEvEEEEEEvEME+EEE$EVEfEEF F F.F.F EE.uu&u0u:uluvuuvuvuuv v>v>v4vfvvvvvvvzvRv4v uuuuuvv*v v vuuuuvubuNubuNuNuLLnLELKLKKKKKKKlKKKKdKSK[KKKKKKKKLLELwLLLMMPMMqMyMMMXM.MLLLtt^t|tttuttttt^t6tIIIIJ/J@JjJJjJ8JIII uXuuuuuuuuXKKdK2KK2KdKKKvvw$wvvwww8w$w$wjwVwVw8wvK2KJJJJJJHJQJzJJJKK2K)K2uv*vHvHv v>v\vzvpvvvvvvvvvvvvfvpv4v*uvuuJjJrJaJ8JIIIJJJ/JJJ@JHJrJJzJaJJJJJJJJJj+uvv v*vHvRvpvvvvvvww.wLwjw`wBwVwjwwwwwwwwwLwVw8wwvvvvvfvHvvuIHI%INIWI-I5IWIFI-I HHHHH~HHHI I-IHHI%INIIIJIIIIIIxIIIIIpIWI4>pʀ.`؁ā~`8耬p4D*DDCCCCCD!D!D\D}DDDdDdD*D*D*D!D!D*EE 8t΁ (΁t8EME$DDDDlDDDE E-EMȂ@悾D2CCCCCD*D2^CCC{ƒC0B:XCbCIC'C >fCBBBڅ BBBxBxBpBBBRzRBWB%BBFBWnxxn@@[@1@B@t@[@懪@??@~Ć g>,>========> >5>N>g?^S{?565)55356 ċċ?H?6?6?H?q???q?H(ZP???????? )e= A@@@@@@A A  ?|?b?X?v?|NNNN NNNNNNyyNNNNN NN  . 7 K ` A . NNnNYN^NiNNzN i i U i i iN:NNMMMMMMMMNN%N/N:di{iiijj3jQjjjjjk k;k>kskkkl:lTl{llllllllllmmm8mjmmnnn(n[C[;[+[[&[[[ZZZZZZZZfZdZ9ZYYYYYYY~YsYnYLYLY6Y*XYYYYYY&Y,Y0Y9Y XXXXXXkXDXWWXWWWWW{WEW WVVvvww$wVwwwwx x2xnxdxnxxxyyy"y6yJUUVV%V=VSVVVVVVVVVVVWWWVV i{iij j jjJjEjJjiii{QaQYQOQKQ6QQ PPPPPPjhjij]jejjjujnjljQjkokkkkkll7lilGl9lkkkvkpkTkKk3kjjjjjjjjQ6Q-Q;Q`QQQQQQQQQqQnQjQlQ=PQPPPPtPGPOOOOOOOROON2lilllllllllllpl~lolllllmmm*mmmCmXmjmmmmmmtm?mlllllhl{llllmllllQlQXQ?Q2Q QPPPwPEPOOOOOOOOOOmO_OGOONNNNNNNN\NRN6NNNMMMMuMGMLLLLkLUL.mmnnnn nnN*NNNNMMMMM~MJM"LLLLLLL^L+dtsssssssssstt"t@thttttu&tttttJt6t"ssssxsmlllml6kkkkkkkqk?k kjjjujFj,j iiiiiiiiiYYYlYEY:Y'Y!Y Y XY YXYYYYXXXXXXXXXXjXkXQX1XX X WWWWWWWWWWzWhWQW>WWVVVVVVVVVVVVVVVVVVVWWVVWW WW WW&WEWoWWWWWWWWWWWWWX XX=XWXxXXXiiiiixXXYYY"M"N"N"f"~"""""""""#(#[#~#####KL,LGLlLLLLLLMM MDMEMFMFMFMSMVM}MMt###x#y#y#}#~LLLLLM!MF *C*N*G*L*D*N*O*A*L*I*CNMMMMMMMM~MnM]><<<<<<<<<<<<<<<<<<<<c  6]%0W ==eAs}aa_aDa```{`I`___{_O_^^^^J^#]]]]]]]]]]]{]i]T]j]l]s]{]]]]]]]]]]t][]H])]'\\\\x\h\]\P\?\1\[["BC C$C0C)CUCrCCCCCCCCCCCCCCCC{CyCCCCCCCCtCrCwVVVVVVVVVVVVVV~VsV\V3VV UUUUUUUU{UfUVU@d@s@@@@A A A#A4AD\DWD"CCCCcC3BBBBBBBlB:B8B!BBAAAQPPPP{P`P>P%PPPPOOO}ODONNNNLNMMMMVM LLLL]L[L[LYLZLXLXLYLXLdLdLTLSLULWLML6L9LJL[LUL,-DoDDDE"EZEEEF FNFFFFFFGGG4GEGGGGGGGGGGGGGGGGGGGjG;G FFFPOOOOO{O\O6ONNNNNNNqN_NONANGN7NNMMMMMMMMdM*LLLLLwLdLPLIL>L9L7L6L.;IIIIIIIIIpIKIDIDIdIIIIIJIIJJ$J0J)J!J5JJ+J IJJ J@JEJXJ]JjJJJJKJJJeJ7JIIIpIW0W(WW WWW WVVVVVVV9G^GeGjGwGGGGGGGGH HH2H>HJH`HuHHHHIIkIII[IMIBIFI9IIHHHHHHHHIII!III%IHIIIIXFXMXRXfXxXX$NCNZNyN~NNNNNNNOO*O2O'O1OOO O0ODOHO4O"O"O!O=OROYOMO9ONNNNX^XFX#XXXWWWWWWWWWWWW}WfWNW?W1WWVVVVVVVpVhVeVSVTVKO1OFOAOHOpOOOOPP@PdPPPQ QQ7QQQWWWWwWzWtWqWiWoWhWbWpWWWWWWWWsO/ODO\OOOOOPP2P`PPPPPQQQQKQSQZQOQQQOQsQQQQXYYYYYYYYYYY'Y8Y5Y,YXXXXXXXgX@X XXXX X MMMNNN3N_NaN]NfNNNNxNgNWNSNVVVWVVVVVVeVUVKVaFaKaNaQaDa8a'a$aaaa````````` OO~OOOOOOOO````u`g`W`C`-``6NVNjNNNNNNNNOOFOlOOOOOOOOPP*PNPbP`PjPjPyPPPQQ7QZQiQQQQQQzQQQQQQR RR2RIR]R`aQaRaMaPaYafagaaaKa4a,a%a!a"a&a5a5a*a'aaa!a1aBaSadaoaxaaaaaaaaaaaaka]aPaMaNaUaaalata|aaaaa+QQ8QsQQRR9RfRRRRmR6RR-R2R'R RQQQQQQRQQQQQQRQQQQVQKQaQSQQQ^Qz]^#^9^I^k^^^^^^__ _:_M_Z_s_|_______``!`N`r``````aaa#a5a;a@aEaP;VVVVVVWW4WBWQWfWbW_WxWWWWWWWWWWWWWWWWWWVW8WVVVVVkV;VUUUU_U6U TTTTTTTTTTnTbTTVVVVVVVVyVkVpVSV.VVVUUUUUU|UvUHUUU TTTTTTTTTTTTTTTTTTTTTTTTTTTTT{TbTbTXTXVVVVzVVVwVnVSV$UUUU}U]U$TTTTTgTQT4T8T?TcTbTTTMTTTTT]T?T SSSSSShS^SKS3SRRRSSS#S@SdSsSSSSWWX XXBX`XXXY YY)Y!Y!Y Y(YEYcUUUUUUUUUUUUUUUUmU`UcU}UUUUUdU.UTTTUU2UTTTNSSSSSS^S,SRRRRRRRRqROR/QQQQQQR'RbR4WWWWXXX.XWXCXbXWX8X+XXX%XEXYXXXXXXY YYY!YXXXXXrXEX WWWWaWaW_W(W#VVVVeV1UUUTTTTTsTsTcTjTMT3TTSSSSSnS5S'SRRRRR}RYR6RRRRQQQQQQQQQRR7R5RZRkRxRRRRRRSTST TTTTSSSSSSSTT T%T(T4QQQRR;RdRRRRRRRRRS S SSS# Y2YXXXXrXJXWWQQQQQQQQQQT?T+T(TTSdS`SSSSS^VW*W(W-WFWtWWWWWWWWXX%X$XLLLMM.MMM)LLLLLfLULULWLBL,[9[ZZZfZYYYY@Y XXXxXOX9X%LMM@MDM6M"MMLLLLLLLhL[LW#Z[[O[[[[\\8\^\\\\] ]-]>]\\\\s\R\5\.\[[[[[[[)ZZZM@M>MGMSMbMMMMNN5NRNrNNNOO8OSOmOOOOPP OOOOOsOsOpOO\=\ZPpPgYYYYZZ4ZXPPxPbP=POO;^I^_^j^^^_^^^^^^c^Q^)^^=^d^g^R^^ ^ ]^ ^]]^^^^*^.^%^#^]]]]]{]\]@]\\\\\~\Y\?\[[[[[[[]P"P{PPPPPQQQAQhQzQQQQR,RVRRRRSS;S^S|S|SSSST&TJTsTTTTTTUUUU UU)U0UKUKUKU=U?U=U2U'U TTTZ!ZCZdP-POd^.^[^^^^^^^^^_ _N_y________``;`T`o````aa%aRabaiaqaaaaabbb!b b!b2b4b.b2b:bJbibbbc ccBc`c|cccpcmcwcTc4c#cbbbbbgb>b,b:bAbEb*bbbbb bbb aaaaaaaaaavadTJT8T4T/TTTTT"T4TVT`TyTTTTTTTTTTTTTTTTTTTTTTTUUU(UGUYUYURUDU5U$U%UTTTTTTTTTTTTTTTTTTTTTTTTTTTTTnTXTDTSSSSSSSSSSSSSSSiSVSPSHSCS4&adaaacaXaYa[aEa7a%aa ``````~`\`D`8`8`8`/`0`%____h_U_4_^^^~^R^.^S4S#SSRRRRRRRRRRRRRRRvR[RBR6RRQQQQQQQQQQQQQQdcwcccccccdd6d`ddddee-e8e]e~eeee}eceOeDe1e.eee!e.e;eDeEe?e1ee dddeeeeee,e>eXegeweyeeeeeeeeeeeff0f9fSfkffffggXgiggggghh5hJh[hhhhhhhhhhhihiTTTTTTTTzTeT\TXTNTFTQT]TfTjTlT`TJT7T,T SSSSSSSS~SmSYSJS2SSRRSSRRRRRRRRRtRRRRvRXRGR>R0RQQQQQQxQhQQQHQCQ5Q1QQQQQPPPPPPPPPPPPPPPQQ,QAQMQQQKQ:Q'Qii i i%i;iMici{QQPPPPPPddddddeee eeeee;TQT5TSSSSSSSSSsSZSJOddd`d*cccckcIc+c&c,c&c0c9c;cDcJcfczcccccckcicscpcXcGc-c0c0ccbbbbbb|bjbcbNb)baaaaaawakaraaaaaaabb ab baaaaacaKa@a*a'a ``TFT*TSSSSSSSSSSSSpSSS>S,S+SSRRRRRRRRRRmRWR?R,RRQQQQQQvQhQLQAQQEQYQsQzQsQpQQQQQQQQQQQQRR)R7R,R'R0hhhhhhhhii i:iIiPixYYYYwYsYdYYYCY.YY%Y%YYi i!i/iDi]i{QQ/Q@QVQaQa-i$iii i hhhhhhhhiihhhhhhhhhhhhhiii ii$i.i:i@i@iHiZibieififiiiyNNO'OOOmOOOOOPPP+P0PGPPPRPgP{PPPPPPPPPPPPPPPPPPPPPPePTPIPFPGlllm mmmmq*q qqGHHHHGGGG~GcGXGGFFFFFFFFFFFFFFFFFFFFFG G rrrssss2s2sI(d'''((A(Z(y(((() ).);)G)X)[)~)))))))**-*I*h************++ +++%+2+;+9+"++***+++C+L+A+'++ + ++J+r+++++++++,, ,,,,$,0,$,,+++++,+++++++++FFFFmFaFYF`FlF_FLF6F-F#FEEEEEEEEzE^EUESEOE\E]EWE]E[E6EEDDDDDDDDDDEEFE~EEEEFF!FPFwFFFFFFFFFFFFFG G FFFG GG FFFFFFFGG4GLGZGvGGGGGGGHH>H]H{H+++++++s+T+*++*****e*7** *** )))))))))))))))*** *(*>*Z*wHHHHHHHHHHI I II IIII"I2ITIIIIIIIIIIIIJJ7J\JyJJJJJJJ!&&&&&''')'8'L'l''''''''(,(M(y(((((((((((DDDDDDD}DvD\DLDJDUD|DDDDE EE%EAEZE~EEEEEEFFF%F6S**++ +%+.+F+W+\+A+4+*+?+6+8+F+`+g+e+\+]+h+k+x+x+d+J+8+*************s*S*0** ))))))))))))q)p)b)f)v)v){)))))))))))*(*U*~******? ??+?Q?h?????@@1@W@m@~@@@@@AA0AJA^AAAABBBBBBPBjBlBBBmB`BQBFBABABFBhBwB~B}BBBBBBBCC"C7CHCHCbCqCCCCCCCDD&D@DUDhDzD|DDDDDDd+%+<+?+Q+U+`+++x+x+m+s++y+++++++,,!,@,E,V,g,,,,,,-- - --1-E-R---------. .).<.V.z..../(/R/o/////////////////////Z/............~.R.&.---?h?@?0? >>>>>>>p>N><>>===={=k=e=i===============u==========>>A>e>>>>>>>>>>>>>~>g>n>w>>>>>? ?1?O?m?z?{?????????@@1@]@f@@@AAAAA;ALAe---x-P-/-,,,,,,,m,V,3, ++++++++_+@+*AeAbAvAvAAAABB&BQBTBTBTB@B;B9B5B/BAAABBB++++}+z+x+u+s001 141b111d++\+*+***_*>*3*+*** *****)))))))))))))))** *))**0*5*4*L*L*<*C*>*S*[*m*L*3*+*,*,*7*0*G***(*8*>*9*I*6*8*3*8*D*9*P*J*Z*[*i*****|*x*x*t*|**********++ +***11111111222222B2M2[2f2y22222~22222233$333A3b3l3{333333444;4K4_4z44444455<5C5R5k55555566I6s6666667 77%7?7[7u77778838:888G8888889/9P9Z9\99'********+*+**++++++U+d+n+{++++++|+++++++, ,,,,999::5:d:x::::::::;;S;y;;;;;;<<-<;0 ////r/z////////b/=/!/ .......x.X.?.-..----99"9K9o999::A:}::::;;A;e;|;;;;;<<>E>W>g?,0,K,],,,,,- -!-$-<-A-H-p----y-U-J-7-7-7-B-E-:-----'-H-a-r----..;.H.F....j._._.l._.k...........FFFFFFFFFFFFGG GGGG.G8G5G6GCGkGGGGGGGGGGGGGGGGGGGH HH1HLHjHHHHHHHHII II2IZIaIxI2.......//....././/+/@/L/h/v/r////////0003030&00 ///////////0HLHSHSHGH-H GGGGGGfGHG6G1GFFFFFFFFFFFFGG G FFFGGGG:G\G|GGGGHH9HEHtHH030S0l0t0f0e0p00000001111#1"10011/14FFFGG!G,G:G4G5G?GFG:G>G0GHGdG|GGGHHCHdHvH001141Z1111111222)G0GGGGGGG:GPGqGGGGG??@"@,@-@Z@f@@@@@@@@@@@@x@R@?@??K{KyK{KKKKKKKKKKKKKKKKKKKKK!ARAfA{AAAAAAAAAAAAAA~AkA_ALA>A,A"A@@@@i@9@???L+LLLKKKKKK}KbK2K5K/K1K/K#K+K)K9K8KBKDKDKBKDKDKFK/K/K/K-K%AAAAAAL,LLLLL@s@@@@@@@@@@@@@JJJJJJJJKKKK'K2KB AAB BB(B+BGBJB@B2B*B!BB+B-B&BBB BAAAAAA~AmAaATADADA#HII=IWInIIIIIIIIIIIIIJJ7JBJDJBJ5J2J4J#JIIIIC]C]C\CjCgChCQC7CBCCCCBBBBBBBBBBBBBBaBYBJGHHCHbHvHHHHHHI I IIIDIRIAI>I.I)I=I?IZItIIIIIISFFFmFZF3FFEEEEEiEBE7EEEDDDDDDDDDD}DTD;D9D;D.D*D.D0DDCCCCCCCCCCCwCaCIC:CCCC CBBBBCBBBBBBBBBBBvB]BCB#BBAAAAAAL.L*L1L3L+L3L7L#LLKKKKKKKKKKKtKcKRKJK7K$K KJJJJJJ~JaJ_JWJSJYJxJJJ}JJJjJSJWJgJiJwJzJJJJJJJJJJJKKKK2K2K7K0K1K JJKJKKKK K KK2CIC7C!C&C9C@C;CGCQCMCCC7C2C9C6C)C&CJiJPJ?JIIIIIIIIIIIvImIYII EE$E7EBE=E/E"EEEE$E2ECEVEXEDE?E@EKQKZKXKoKK}KKKKKKKLKL KKHH)HCH_HHHHHHHHIIIHHHHHIIIEIrIIIIIIIJJ J:JHJYJnJJJJJJKK&K2,KK`K8K!K JJJJcJLJ3J#JIIIIqI^INI=I*II HHHHHHHrH`HXH2HGGGGGGGGGGKKKKsKyKKKKKKfKVKXKSK[KpKKKK|KtKvKlKsKKKKKKKKKKKKKKtK[KHK9KJJKKKKKL,LLLKPJJ;JJJJJKK+K@KnKKKKLL.L;LOLfLrLLLLLLLL{LeLPL4L3L(LLL LLLLKKKKL LLL4LILXL^LTLEL7L/LKKKKKKKKLL,LBLQL\LCL0L,L%L+L&LLL KG+G"G&G(G(G1G-G.G0G+G5G#G%G)G)GGGGGGFGG&G;GGGgGxGGGGGHHH&HCHWHdHHHHHHHHHII)I@IYIkIIIIIIJJJJ(JJ:J?J;J:J=J\JxJJJJKKK8KG J J!J4JNJJJJJFFFFFFFFG(AO+O+OOOO NNNONNNNNOOOOOO&O$O$O1OBOIOIO"ONNNNNNNNNNaN>NMMMMMMMMMMMhM?MLLLLLLLLLLwLXL,LL KKKKKKKK}KpK_KOKKKNKKK9KKK JJJJJJJJJJJmJWJFJCJSBSVSoSSSSSSSSSSSSSSSSST TT&T8HLH@H9H>H5HHHHHH HHHHH HHHHGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHH;HQH\H_H_HlH{HHHHHHIII5IDIRIRIQIVIbIyIIIIIIIIJJ#J6JMJlJ~JJJJJJJJKKKG T8TqTxT{TTTTTTKGKQKkKKKKKLL,$TXTfTTTUU7UVUUUUUUUVV#VCVNVdV~VVVVmVYVSVRVSVTVSVUVWVjVVHH H H GGGGGGGGGGGGGHGGGGGGGGwGGGFF~FPFEEEE.VVVVVVW WW"W3WKW]WoWWWWXX/XKXiXXXXYXXXXEXWWWWvWjWUWFW3WWWW WWW-GGGGGGGH HH(H3H8H:H;HHWHrHHHHI I.ILImInIlIIIIIIIIIJJ5J@JOJJJJJXXWX X"X-X)XX WWWWWWWWWWjWPL,L#LLL KKKKKKKKKKKKpKiKdKKCJJJJJJJKJKJJJJJJJJJKK K+K7K8K2K1KEQdK%K1KDKQK}KKKKKKLLDL~LLLLLMMM%MGMqMMMMMMN!N?NFNZNSNSNzNNNNNNNNNNNONO O2OROsOOOOPP2P4PMPPPPPQQQ$Q4QiQxQQQQQQQQQQQQQQQQQoQ`QdQoQyQxQ}QyQ}QvQxCCCCCDDDDCCCCDDDCCCC]C:C0C,C-C-C%CGCiC~CCCCCCCnCnCnCnC_C0CBBBBBhB_B%BABABBBAAAAAAAAAAAAAAAAsAUA=A#A A(A3A1A#A A#A>AkAAAAzAAAABBB8BHB]BhBBQxQQQQR R?BBBBBC C RsRRRRRRSS:STSsSBBBBBBBBBBBB}5JKKK7KdKKKKKL&L^LLLM3M]MpMMMMN!NSNsNNNO$OOO`O;O'O NNNNNNNOOMOOOOOOOOOO???????????????????x?d?X?V?Q?Q?I?L?R?[?m?z?????@6@v@@AAIAJAMANAOAaAmAAAAAB3P.P>PTPgPPPPPQ QQ8QKQsQQQQQQR)RRRYRRSS;S*SS#S,S(S+S@SPSWSRSNSMSTSeSSSmSmSdSZSTS@S:?a?\?]?L?U?S?F?P?_???????@@@1@;@E@a@}@@@@@@AA#A3AIAbAmAtA~AAAAB B!B+B>BJBWBhB|BB!S;SNS^ScSlSwS~SSSSSSSSSTTT TTTTT!T1TFTPTPTQTVTTT6T@@@@@@@@@@@e@N@:@/@????????@ @@@%@9@m@@@@ST"THT`T{TTTUU+URUiUUUV V"AAAAAAAAAAAABAABBLLLMMM,MNMiM}MMMMMMN;;:;I;@;);;;;;;; :;;;,&P.POOOOOOOvOfODONNNNNNNNNNNNSN!N!N N!N!N!N!N!N!N!N!N!N N!?a?b?F?M?=?/?*??4?M?I???3?/?/? >>>>I>======V=$<<<>,>L>^>[>>>>>??"?7?A?a+QQR R)RARTRpRRRRRRSSSS!S(S4S >>,>E>P>Y>s>>>>>>>??(?9?P?n??????@@ @@@@"@ERRRRRRRRRRRRRRSS,==X=&<<<<<<]<5<$<;;;;PQQ&Q@QaQzQQQQQQQQQQQQQoQXQOQAQ.QQQQPP:::;;;#;; ;:::::::::::y:d:W:U:d:m:o:::RRRRRRRRRmRiRTRRRXRlR|RRRRR;;;;;;;;;;;;< <"<;p#U2d!^&M RL~Ox@p  8 f !)!'!$!7!C!E!K!P![!p!!!!!"""."H"Y"q"""""#$#P#hYpYpYpYpYpYpYpYpYpYpYqYqYqYpYqYpYqYpYqYqYpYqYqYqYqYqYpYqYpYqYqYpYrYqYrYqYqYqYqYpYpYqYrYqYqYqYqYqYqYpYqYqYqYqYpYYYYYYYsYbYXYQYLYGYJYNYLY@Y7Y5Y3Y(YYY(Y'Y$Y!YY%N%xXzXP&&&&%%%W$WVVVVV'w'oW W23((() )%)W))**0*b*p************+++%+3+9+F+N+N+j++++++++++++++++,,$WWWWWWWWWWWWWWWXXXX'X5XMXWXoXXXXXXXXXXXXXXXXXXnXKX0XXXX WWWWplplot-5.10.0+dfsg/data/usaglobe.map 755 1750 1750 225660 7633337504 162110ustar andrewandrewdXx H T Z ( ( (  z   yQ ( H H ) YIb\7PJ%ppUUq^I9 R~~1@r@%%_%N%<%#$$$$%-%N%%%&&H&z&&&&&''0'['''''''( (*(<(*(''(#(U((((((())))(((((()$)G)y))))h))))y)V)$(())6)h))h)6)()$)6)h)h)G)$(() ).).))))G)h)))d@@F`  : : :`Q l !"G"#$T$%_%&'B'''(n))h)6)*b*++,$,$+++++,,D,,5,5++++C+;+|++,$,g,g,,,-P-P--.8.J.|//T//0,//////d/D/..Z..----P)))))))))))))))))**7*I*0*A*(*))))))))))))*)))))))))**A*b***+1+1+T+m++++++,,+,D,,$,,5,N,o,,,,-- -7-P-`-y---y-y-`-`-%-/-P--/- ,,,,,V,o,Vd-P-p- ,,,,,-p--..J.8.|..8..|...J.|..8.8---p,,,-./0p1X2 3 35 6L7F889J9:;>;<(<==><>?h?@A A~AAAAABB6BBBBCrCQCrCQCDDCDE$E$EEVEEEF FPFG[GH"HI-IJ8JKB,V,+,+,++++u+u+T+*****Z*0*))))))G)$(((((n(<(*(4(4(#('''''''''( (*(M(n((())=)`))))))**7*P*s*{*Z*{***i*A*P*i******s*s*{*******{*b*{*********dKBKLnLMyN NOLOP5PQaRRRSfSUSfSST`TUIUkUUUUVuVW=WXHXY!YBYYZ YZ ZnZ[G[\0\\\Q\\]\]}^^g^_/_`8`a#avavaaavaaabOb bccjcddudde,ef7ffghhhiWij@jkklkl4lwlmm`************+ +"+*+*+\+|++c+;+*+"*++*+J+m+++++++++++,$,V,o,,,,o,],D,=,+,$,+,+++++++++++\+J+"****++"++ +*+J+T++++,,,$,5,D,=,=,D,V,N,N,V,D,V,D,V,N,]dm`mmnnnoTopppqqfqqqrVrs snstJtuNuv*vzvwwtwwx2xnxxyyyhyzbz{*{{|V|}2}}~J~~~X>L~܃@rքNЅ44Hz(6̉̈ꈚ"n~ޅޅB,],],,,,,o,V,N,5,N,D,],,,,,,g,V,=,5,5,D,],=,=,V,N,o,o,V,+,$,,+,g,,v,,v,,g,g,V,N,D,=,$,5,$++++++++++|+++T+;+\+T+C+*+************b**I*0))))))`)V)6)((((n(C(BB(`fЄЄЄ4`("N(''''''b'0'&&&z&O&%%%%%FnF('(((4( @]]%%@''l'S'!&''B'l'' N k (f(U(u((f((n())G))*b*+m++++m+;+***P*b****A))$(**s*P*A**)))**7*b***+1+m+c+T+"******* ())h)))6(((*****+***-/--.----/- ,--/-P--7- 0>0p000>----- .|./"/d//T/"..|----..---4644X46....d'&&&&&&&&''0'!'&&&&&&&&&&''0'B't'''''( (*(<(\(n((((()6)h)))*0*b************************{*b*s*{*Z*P*Z*b*b*s*P*Z*A*7*)))))))))))))FPF.EEEEvEfEVE$EVEVE4EDDDDD}DKDCCCCC{C@CBBBBWBAAAAnA<@@@@t@R@)@ ??????h?X?/? >>>>N>====T="<<<-p-y-i-,,,,-/-`----..--..c../"/d///0 0,0%//////v////00W001181a1j1s1112222d222233,3E3U3^3U3U3U3~334464q44445 5R5555644&4X4444445 5@5b55555555566L6e6L6:6:6S6u66677-7777$7-7=7M7f77788'8P888899888888888999:9l999::4:f:::;;.;`;;<<8>N>>>??H?h??@@B@t@@AABhBBBCCbCCDDCDSDKDSDuDDDDEE4E4E$E$E=E=EVE]EDE4EfEEEEEEF F EEEEF.F>F7F>F%EEEEF F>FaFFFGGJGGGGHH3HTHmH~HHHHHHd0p0>00////m/v/d/2/...|..|.A.---.---P-,,,,v,N,$+++++m+;+******i*i***P*I*0*I*b*P*7*i*w**s*P*0*))))V)=)(((((((U(U(*( '''''l':'!&&&&a&6&'&%%%%%%%HHHHHHHHIIFIgIIIIIJJJ'JJHJjJzJzJzJzJQJ@JHJYJrJrJjJjJaJJJJJKJJJJJJYJIIIJJQJrJJJJKK!K)KJJJJJJJJJjJ8JIIII_IIIIIIJJIIIIIIIJJJ8JaJJJJN%%%%%%%%%%%g%<%$$$$T$###########$$$"$)$;$e$e$L$####Z#(#""""""""q"q"5!!!!f!E! l S A S !  ! ! ! ! 2 A Z \JKKKK}KKL'L,L-p-..j.|......|.J.J.---P-,,,,,g,,-7-7-,,,=+++|+C+******++C+|+,,,=,,--P--..8..//;/d/00^00p00>//////K/+...Z.1.1.ZWWWWWXX'XXWWWWWgWNWoWWWWWWXX'XHXiXXXXYX/X7X'X/XPXaXXXXYYY)YBYcY|YYY|YcYSY:YXXXXXXXY!YJYlYYYYYYYYYYYYYYZ Z+ZMZfZnZZZ[[G[G[p[y[[[[[\\(\I\{\d.Z.(.(----`-/- ,,,,,],=+++\+*+*+1++****I*b*)))((u(''( ''(((''''( (*(<(U(U(#'''B'b'{''''t'!')&&&&h&'&6&6&&6%%%$$e$"###(""y"?"?""!!!m!M!M!T!m!!!"."."\\\\]*]\]]]]]]]\]C]"] ]C]K]u]]]^^$^$^=^^^w^^^^^^^^w^^^5^ ]]]]m]d]C]"]\\\s\0\[[[[y[O[ZZZZ]ZbaaanaDa````aa+adaadaDa`````aa:a+a```````````a'a@aDaYdQD]P=90I<< 3  " A4/rxc@r%]S'Y1Y]lMlIx!S%/l=Qy4aYaraaaianaana}aaaaaaaaja}avaUa+aDada}aaaaaaaaaaaaabb,aaaaaaqaKaI_IIIIIIIIIpI5I(I HHHvHDHGGGG[G[G)FFFFFFFPq W/)> p-U>paq``%`1`_________`_``B`8`B`[`t``c`Q`=`E5{kCXg!EYEE^5^^^$^^=^N^^^^^^^^^^^^^^^^^^w^o^N^5^5 9X[ uC];]2]T]d]d]u]]]]]u]\];  cccmF'F' \Q\j\\\] \\\\s\Q A K } s l l l S 2 [%[ZZZZZfZvZMZ#YZ ZMZvZZ[[G[O[O[%@++` `Qjj+[ ZZZZZZvZMZ+Z YYZZ4ZUZZZvZZZ[ [ """"""""FXF%F EEFF.FX )h)V)V)G))))))h5555b5Y555555+u+s+J+*+***+1+;******s*()))h)$)6)h))y))))*0*0***+ +;+|+++,,V,,,,,g,=+++++u1111111z1j1z1j1Q11&1X1&181H1a111111z1a1H1/1/1 1 000000000000000011181X1z11.j..///T/v////D/....j21211122222B222B292227x788@8P8'77x18110011/18.(.c.|.|.8.J.J.(J8J8JQJJzJrJHJ8+N+o+e+NK#KKK# '''(#(C(f((u(M('''MiMiMGM?MPMGMGMiMyMMMyMi%%%%&&%%NNNNNNNN9%-%n%%%%&/&r&@&a&&&')'[''''(#(4('(<(n(())$)V)O)6)(((((n(<(''''S'0'&&&z&H&%%%%_%_%-NNNNOO+O"OO NNNNNNNNNNcNcNAN(NNNNNNN N(N9N9NZNcNZNNNNNNNO O O+O;OLOLO]O]OLODO;O"O NN()6)y)))**A*C*i*****+*+\+|++u+"+J+****P*C*0))))))*))))V)6MyMXMiMiM`MiM`M]M.MXMqMMiMqMMM`MMMMMMNNNNMNNMMMMMMyMyMMMy ,,=,g,,,,N,,MXMPMXMXMqMMMMX.(.1.A.Z.J.A.(LLLLLLL.j...jLKL L))))))N|N|NNNN|()OO?)G)y)SO;O!N))OO **%*eNNN -%-i---.8.---i-%YYYYY|Y|YYYYY -7-W---.---W-P-7XXrXYX@XaXzXrXrXXX%%&O&O&%%^^^^^^^'&')'S'['^^o^V^^^ ''I''B'b'b'{'b'\I\Q\(\(\A\\Q\j\I&H&&&&&H[ZZ[ [[3/"/2/}/00g000w001 1?1&1X1X111111z1X1?1Q11Q181j18000w00g00>0^000p0,0 ////}/]/}/K/"YXXXXXXXXXXXXXXXXXXXYYXXYYJYBYcYYYYYYYYYZZDZvZvZ]Z"#(#$%&'':&%$$t% % %F$$$##$T##Z#Z$ % %&&r&'t''[''()))h*b*+m,=-/-7-.j.j--%,+))6(M&&%$t$t#"f&eeeeeeeeeeeereEeeddddd}dqdRd*d dd*d d2dd*dRd}dddde,e^eseeeff7fSflfffffffffffxfefPfPf&r (reeweeLc@ Z ! j@@e@e,edddddddddde"dddde e@e@eReRe@ l!"!"?".!4 lddddddd-siddvdkdddL   rxLd9dccccccdd&dCdFd*dd%d?d9iiccccYxG  d !+xbbbbb^b,bOb^bbbccEc0c8c&cbbb,dddddedd2w2dddddCXqdddddddd-Ucccd cc93j2U>Wdcccdd2ddGdkdddddsdXd2dUEI[XkMIUcccccccjcbcmccccccdd dPd9dd ccccdd*d.d cc2U-;I2O!XyA;xYis7iL[ w88bHb1baaaaaaaava]a]aa!a+aDaUavaSa7aDabaaaaabbKbbbbccbbbbbbbbbbbbbsbHg93KY_agbwbObb,b6bhbbbcc&cQcQcjcQc?cbbbwn[[ڊЉZZZ[ZZZZv5q?5ZZZZ9CZZZ7~7Z[[%[>[6ZOO[%[6[J[h[h[G[%33_3_/_ _^_ __/_/'cm1]]]]]]]]  c w 1 \\{\\\\\] ]"]\\ Q\$Q[y[>[%ZZZZZ[ [>[p[p[y1c!J||/|JY1ZYYYYYYtYtY[YBY1YBYlYYYZZZ+Zd)*P**+***+u+*+,N,-.8.///0>0>000000181z12)2K11001X12K2}2d11z1X1Q1j1j1222B2K2223,344q45'5k5555566e6~66L667F78`899A9l9::;;<^>^=>>>w>>>==>^??6>>>>????@ @AA#??6>>5=<=======<<;:8@65 4&322K1/"..c.(-i,,=+,-,+|**)aaab b6b^bbbbwbbbbbcc&c8cQc{c{ccdddCd\dKdkdddee9eaeeeff8fDf$f-feeff3fDf_f[f?f8f_f_fqfmfxfffffffffffffXfxf_f?fffeeeeewe@e.eed%<==m==d<=}==m>>>?h?@ @@@@@@1???q?/>>>g>^====T=T== <________i_?_?_&__7_?_a_z___`8`1`J`)``)```__``8`B`)`)`_BC0ab>>?O>ccccdIIIIIJJ'JYJzJJJJJKKKKK!K%K)KBK[KdK}KKdKtKKKKKKKKdKBK2K!KKJJJJJJKK)KBK[K}KKKKKKKKLLLL#L4LELMLnLLLLLMMM.MPMqMyM`MGMqMMMMMN1NRNNNO+OeOOOPP_PxFPFEEEEoE=EDDDDDDdDTD:DD CCCCC{CICBBBBpBFB%AAAA]ADA@@@t@B@?????O?>>>>g>,>====[="<<<P-P%P-P5P>P5POOOOOO~OTO3O3ODOOONNNNkNkN|NNdbbbbbbbbbbbbbbbccc?cbcjc{cccccddd d2dRdudddee,e,eLe~e~eweweeeeeeeeeff&fXfqfxffffg'gRgrggghh3hLhDhShhhhhi$i-i_iiijj'j8j@jQjhjrjjjjjjkk(k:kANONNNNsN9NMMMM`M&LLLL^L,KKKKdK)KJJJzJHJIIIIxIIIIJJQJQJJJKKBK}KKL,LULLwLLLLLMMMGM`MqMMMMNNNANkNNNNNNNNNNNNOO3O NNNNoNcN9NNMMMMMyM?MdkAk2k!kSkskkkll,lMlmllllllllllllllllllmm&mGmjm~m~mmmmmmnnqfqzqfqpqqrrBrtr~rrrs s{R{{||.|V|j||}}}2}2}(}2}F}n}}n}n}}F}}|||V{||{{{{{f{*{ {f{{|.|j||}}<}d}}~~r~0N4pz8jVj 2xȂ܃,^XƄ4zjVBW-WFWxWWWX'XPXzXXYYBYtYYZ Z[p[[[[[\\8\I\0\A\s\\\\\] ]2]\]]]]]]]]]]]]]]^^$^E^g^o^^^^^^^__P_p_p____O dw,X  y=&5Y___``8`_______z_i____```J`t`````a a+aKd$rh|҇ `ЄXփ@F؁؁.ԀR~|}}F}x|||}|t{{\{ zzvzyyyy6xxxyxwwv\vHvzuu0tttss(rr`rrqr`rtrqq\qq\ppXop0pq*qrBrraKaUana}aaaaaavaKa2a+aKa]a}a}aaaana}aa}a}aaabb bbbabb6b6bObbbbbbbbbbbhb>bEb>bObEb,b>bhb>babb,b^bbbbccbbbbbc c cccc?cbcjcXc?ccc&c8ccbbbc ccIcjcccdrrr8qq pplopNooonnZmmlm&ll4kSjjQihh~h!hhLggfXeeefiff-ee^ddddddd\dd9ddd\cccccjcIccc{cbc&cXc&cc0ccqcjcc8cbbEab^bbbc bbbbbb^bbbb,bObaavab%b bb,b^bbbbbbbpb^b,b aaaaKaDa+````j`J`1`[`|```aaDavaabb>bhbbbbcbbbbpbEb%ad`j``t`t`aaKa```__W^^o]]d]2]m]]^,]]]]d]d] \\A[[[h[`[ZZIpIIIIIJJ/JJJJIJJ IIJQJ8JIIIII_I-IHHHHH~H]H;HHGGHH"HDHLHTH]H]HLHKHDH+HDHTH]HvHHHHHHHHHHHHHH]HGGHH H HHHGGGGGJG+GFFFFFFPKlKKKKKKKKLL4LELKKKKKKlKKKKKlKKK2K2KGKKK[KKKKKKKKRRRSS^SSMSnSSSSSSSfS4RRRRRRREE=EfEVEVEvEEEEFF%FXF\FiFiFaF>FEEEEQQQR)RBR?R:RtRsRlRSR:RBRQRQQQQQQQQQQQCCCCjC'CBBBCCICCCCDDKDDDEEDDD\D!CSSSSSSTTTTSSSSSSSSSSSSSSSAAeA[.[6ZZZ[6[y[[[`[G[ZZZZZZZZ]ZMZ#YYZ4ZfZMZZ[ [G[[`[W[G[ZZZfZ4YYYlYtYBY)XXXXWWWWgWFWVVVV~VTV*VVUUUUUcUbU0TTTTTTTTTTTUUZUUUUUVVCV3V3VTVuVVVVVmVVVW W W-W_WWWWWWXXWWWXX@XrXXXXXXXXXiXaX@XPX'WW] ] ]]]\]]]^,^,^V^w^V^$^$^E^g^$^ ]]]]]\];]2] WWWW_W_W_WNW_WWWWXX/XHXrXXzXXzXYXiX@X@X7XWbc&c?cQcIccddRddeeEeddddRdcccIcbXWWX'XHXYXrXXrXXiXrXXXXXXXXXXrXYXno"ohoopplppq qq*q>qqpppppXpooooho"nZvZ]ZnZZZZ[[6[h[[\\[[[[[`[6[ ZZZZZZvRRBRdRtRRSS#S#SRRRSRR^,^ ]]]]]]^^5^E^^^^^E^,SST.T.T`TTT`TGTOTSSTTSS^o^V^E^^^,^N^g^^^^^^^^^oDW5W5W=WVW_WgWWWXX@XrXXXXXXXYYY)Y:YBYSYcYtYYYYYYYYZYYYYYYYcYcY[Y1XYXXXXXrX@XWWWWxWWWWWWWxWVW5===d=;<<<#>N>w>>??H????@B@@J@|@AA>>>N>#==[[\\\[>==> >#>\\\\\>N>N>n>>N[%[G[p[[y[G[%K)KKK2K:KBK) a2aUaIHHHHHI IFIpIIJJ'IIIIxpppqq*q\qzqqqqzqHq ppMMMMqMqMMMMN N N NMMuDuDuNuvuuuuuuuuuuubuDOO]O"ONO"OLO~OOPP-POOOxyy,y,yJyJy,y,y,yhyyyyyyyyry@yxSMSSS{ { {4{R{{{{{|B|~|||||}}(}F}<}F}Z}d}Z}n}}}}}}}}}P}F}n}n}F}}}}}|||||t|L|{{{{{{{p{p{R{*zzzbz&yyyyrSSSSSSSSSSSSSSfS^SSSSSSTSTTT.ST T.TGTqTTTU0UIUIUsUUVV*VTVuVVeVeVLVLVeV3VUUUUbU0UTTTTTTTTTThT?T.TGT?T6T.T.TSSS+||}}}2}n}F}}}F}Z}}}~J~J~r~~D~~~~h~,~}}}}}}}}}}F}}(|VVVV~VVVVVVVVVVVVVWWW-WFW=WVWgWWxWWWWWXWWWWWgWFW-W-W5WVxWWWXWXWWԁ耶X'X/XaXPX'XX,JJ"YYYZ Z#ZY{||B|{[[[[[~B]*]T]m]\]*/}}}}}}}}}}}}}}}}}}~~,~T~T~6~,~}~~~"~J~|~~~~r~^~J~6~@~@~,~"~}}}}[%ZZZZfZ[%(bAbab Ob bbbAbA}<}~^~^}}d}bpbbbccIcqccccdd dRdddKd*ddccccccIcbbbbbwbEY[YYYYBY[a+a vblbD&&~~~~|~h~h~J~6~"~}}}}}}}}}}}}}}d}d}2}|||~|B|{{{{p{H{R{p{p{p{{{{{z{\{*z88899A9l999::4:]:::;;N;;;<>,>U>n>>>>??&?X???@@B@t@@@@@A#A]AAABAAAA]A>>>>>>^>^><><><>,>=======t=K="<<<>> l&~6l6:65555k5R5I5r55{55566L6\6L6:6:6\6l54\$8`tj~΋؋ ċVԊފfHЉ4\pR4666666S6*66!6L6l66667 7 7-7=7f7777x777787778878Y8y888888`87877777x7M77 6.Znȇ܈T̈&0DЉЉ Hff>4N:&ꈸ@ȇxZ4_4F4?4F4-4&44&4?4_4444559595R5r55556*636S6:6*6S6l6S6*655555b5@5 544444_Ȉ3343Ckkkkl l,lMlwllllmmmNm`mmmmmnnvpvpvHv*vv v uuvv*vRvvpv4vuuuvulu:u:uNuvuuuv*v\vvvw$w8w$wvvvzvRv*uuuuvu0u&uutttttE4DDDDDKD!D!D*D\DDDE$EDEDE$DDDD}DlDD:DD:DuDDDEE=E]EEEEEFFEEEEEF FHFzFFzFFFFFqFzFFFFFFFFFFFFFFFFzFHFEEEE]E4x x(x2x(xFxxxPxFxPxxdxxxZxFEF%FPFFFFFFFG)GFFwwwxwwwE DDDEEE xFxxxy,yhyhy@yxxxdxFEDEDDDDE$E$E=E4E4Evw8EEx xdx(x EEEEy6yhyyhy6F>F%F7FPF>{*{\{{f{*F EEF F dyhyyyyz&zbzzzNz&yyyz&z&z0zbzzz{ {H{{{|$|L|`|t|~|V|8||V||}}}<}d}d}}~~@~J~@~h~|~~~0Xl*fԀ$8Ԁ\44 lDD~~~~^~,}}}}d}d}(}EEEEEoEoEvEEVEVE=EDE4E+E DDDDDDDDDDlD\DCD!CCC{CrCICCC'C'C0CBBBBBBBBCCC8CbCbCQC8C0BBBBBhB_BWBOBFB%B-BWB_BpBBBBBBC0CIC{CCCCDDD!D*DdDDDDDEEE+E=EMENEfEf}|||`|.{{{{z{\{H{ zzzzzzzbz0yyyyhEfEvEEEEEEvEME+EEE$EVEfEEF F F.F.F EE.uu&u0u:uluvuuvuvuuv v>v>v4vfvvvvvvvzvRv4v uuuuuvv*v v vuuuuvubuNubuNuNuLLnLELKLKKKKKKKlKKKKdKSK[KKKKKKKKLLELwLLLMMPMMqMyMMMXM.MLLLtt^t|tttuttttt^t6tIIIIJ/J@JjJJjJ8JIII uXuuuuuuuuXKKdK2KK2KdKKKvvw$wvvwww8w$w$wjwVwVw8wvK2KJJJJJJHJQJzJJJKK2K)K2uv*vHvHv v>v\vzvpvvvvvvvvvvvvfvpv4v*uvuuJjJrJaJ8JIIIJJJ/JJJ@JHJrJJzJaJJJJJJJJJj+uvv v*vHvRvpvvvvvvww.wLwjw`wBwVwjwwwwwwwwwLwVw8wwvvvvvfvHvvuIHI%INIWI-I5IWIFI-I HHHHH~HHHI I-IHHI%INIIIJIIIIIIxIIIIIpIWI4>pʀ.`؁ā~`8耬p4D*DDCCCCCD!D!D\D}DDDdDdD*D*D*D!D!D*EE 8t΁ (΁t8EME$DDDDlDDDE E-EMȂ@悾D2CCCCCD*D2^CCC{ƒC0B:XCbCIC'C >fCBBBڅ BBBxBxBpBBBRzRBWB%BBFBWnxxn@@[@1@B@t@[@懪@??@~Ć g>,>========> >5>N>g?^S{?565)55356 ċċ?H?6?6?H?q???q?H(ZP???????? )e= A@@@@@@A A  ?|?b?X?v?|NNNN NNNNNNyyNNNNN NN  . 7 K ` A . NNnNYN^NiNNzN i i U i i iN:NNMMMMMMMMNN%N/N:dWaWWWWaaaaaakkakvvvvvkvvvkkkaaaaaaakaaaaaWaakkkkvkvvvvvvkkkaaakkvkkkkvvvvvvvYtYoYqYlYlYhYcY`Y^YYYYYSYOYVYXY^Y]Y[YXYQYLYGYIYDY=Y?YBYBYGYJYIYLYIYEYIYDYDYBY=Y:Y5Y.Y&Y!YYYYYYY YY YYY YYYYYYYYY!Y&Y&Y'Y,Y.Y,Y.Y3Y:Y=Y8Y5Y0Y0Y+Y)Y+Y)Y!YYYYYY$Y$Y'Y&Y!YYYYY Y dvvkkaaWWMMMMMDDMMDDDMMWMMWWWWaaaaaWakakkkvvvvvkkvvvvkkkkakaaakkkkkvvvvkkaWWMD9Y YYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYYXXXXXXd999DMWMD9/99DMWMWWWWWWaaakaaaaaaaaWWWWMMWWMMMDDDD99/9//%XXXXXXXXXXXXXXXXXXXXXXXXYYYY YYYYYYYYYYYYYYYYYYYYYYYYY!Y!YYYYYYYYYYY!Y&Y)Y,Y0Y5Y6Y6Y3Y1Y,Y'Y!YYYY YXXXXXXXXXXXXXXXXXXd%XXXXXXXXXXXXXXXXXXX}XwXzXuXrXmXnXmXxXXXXwXnXhXcXdXcXfXhXfXaX_XcXdXhXcXaXcX^XWXWX\X_XYXYX\XYXWXWX\X^XUXOXFXCX>X7X1X,X%XXXXXXXXXXWWWWWWWWWWWWWWWWWWW{WsWjd%//999DDMDMDDDDMWWjW_WXWPWFWAW>>Qepy#--8AAKUU_js}}}}}}TtToThTbT`TXTTTOTITBT?T;T1T+T)T)T&TTTT T T TTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS}S}SzS}SSS|SuSpSnSkScSaSZSTSKSCS9S/S'S#S SSSSSSSDDDDMMMMWWWWWWWWWWMMDDYLYLYIYEYLYQYSYOYJYIYEYBY@YEYGYJYNYSYVYVYOYLMWWMMMMMY?Y:Y=YBYEYGYEY? ////9DDD9//YJYJYEYBY=Y=Y@YGYNYNYJGGQQQGGSSSSSSSQ[[eeppppppeee[[[QSSSSSSSSSSSSSSSSSSyyyyyySSSSSSSSSSSSSSSSSSSOSKSJSJSKSMSPSOScS^S^SWSTSTSRSRSWSZS\S^ScScS7S6S4S1S,S,S%S S"S"S,S4S7S75%//9DMWWWWWWakv)33>GQ[epyXWXWXYXYXUXPXHXCX;X6X/X'X X XXXXXX"X%X'X*X'X,X,X'X*X'X X X%X%X'X*X-X-X'X*X,X1X2X6X7X9X9X@X>X@X@X@XEXHRwwwwwSSSSSSSSSSS S#S,S1S7S7S9S7S>SESKSOSRSWS\S^S^ScShSkSnSsSwSzSSSSSSSSSSSSSSSSSSSSSSSSSSSSSTTT TTTT&T&T+T0T8T=TETLTQTSTXT`Tc-mwwwwmTmTjTeTbTcTgTmTmTjTeTmThTcT`TbTjTqToTjTcTbTjTqTtT{TTTTTTTTTTTT~TwTtTqTqTmTmTlTmAWoWsWsWxW}W~WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXX XXXX X%X*X-X2X2X7X6X;X@XFXOXPXRXYX\X_XdXiXkXp[eeeepppyyyyppeee[UUUUUUUUUUUUUUUUUUQ!!,,,,,,555???IIIISSSSS^^^gg{{{q{q{{{{{{qqqqqgggggggg^^^SSSSI?II?555,,,!VVV~V~VyVrVpVoVmVoVmVhV`VTVQVOVLVJVCVBV=VCVHVLVEV@V9V3V8V@VCVHVLVOVVVWVYVWVRVLVJVGVJVLVRVVVWVaVeVkVpVwVyV~VV~VzVwVoVmVjVhVjVoVuVwV~VV~VVVVVVVVVVVVd###--7777777AALLLUUU___iiiiiiisss~~   RRRRRRRRRRRRRRRRRRRRRR}R}RyRxRvRvRsRlRiRdR`R]R]RZRZRXRXRVRXRTRVRSRSRNRKRKRFRDR:R0R-R)R&R"RRRR RRQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd'''''111111;;;FOYYcccmmxx!!!!!+++55@AFFIKLLQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ~QzQwQsQrQpQjQhQ`Q\QWQWQTQOQHQGQ>Q>Q;Q6Q3Q/Q,cLNQSSVZ`bdgjlonsrsolsrvxxvx}{~         % * - 2 2 4 6 > = @ E F E H O M S V W Y \Q,Q,Q(Q*Q%Q%QQQQQQQQQQQQPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP}PPP{P{PPP}P}PP}P}P{P{PyPsPsPpPpPlPlPiPgPgPkPnPpPpPsPpPsPpPsPsJ@FKQU\]gjsx}}     $ ' / 2 : > > A H H K K S V Y Z W W \ _ d d f d d h l mSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS|S|SSSSSSSSQ !!!!!!!!!!!"!'!'!,!,!,!.!4!5!8!8!;!=!B!E!I!N!Q!V!V!Y!^!^!`!^!f!l!j!m!q!o!t!t!w!{!{!!!!!!!SSSSSzSzSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS}SS}S}SwSwSwSwSwSuSwSsSuSrSpSmSnSkSkSnSkSnSkSnSkSnSnSmSmSk m r u u z   x x r mSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!QQQQQQQQRRRQQQQ8!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!RR R R RRRR$R(R)R0R2R8R=RBRBRIRKRSRZR`RdRdRlRoRsRvRxR{R}R}RRRRRRRRRRRRRRRRRRRRRRRRRd![!^![!V!V!S!N!I!E!E!=!=!@!?!:!7!0!.!)!)!.!.!1!7!7!:!?!B!@!@!;!:!;!4!.!)!$!!!!!! ! ! !!! UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVV V VVVV V"V$V%V*V1V9V>VCVHVOVTV\VcVeVeVjVoVpVtVtVwVzVVVVVVVVVVVVVVVVVVVVVVVV'  } z w o o d \ V T H : / %   VVVVVVVVVVVVVVVVVVWWWWWW W WW W W W W WWW W WWWW VVVVVWWW WWWWWW!W#W(W-W2W2W8W8WBWFWKWN= } x }   } } } } } x z x u p m i i f d _ \ ^ ^ \ ^ \ ^ \ ^ a \ Z Y T VXX X X XXXX X%X*X-X6X A @ > = = 7 2 4 7 ; : 4 4 ; = = : > > @ = 6 2 * * % * ' $ ( - 4 : : ; ; : 4 7 ; A F H K M O P H C E = : 6 : ; A H F H M S S Y Z _ d h h f f a ^ Y V Z Z ^ i h m pPsP}PyPyP}PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPQPPPQQ QQPPPPPQQ QQQQQ$Q*Q1Q.Q/Q3Q4Q3Q4Q4Q1Q/Q4Q4Q/Q.Q3Q8Q>QEQLQLQJQHQCQGQHQMQQQOQTQOQMQT6 p o r x }   } x } QTQMQMQQQWQ^QaQeQfQjQjQhQjQjQaQcQfQjQmQsQwQzQzQQQQQQ~QQ|QyQ~QQQQQQQQQQQ~QzQ~QQQQ|QwQrQmQhd !! !!!!&!$!"!!!!!"!$!)!.!5!=!=!:!;!4!1!5!1!5!1!,!.!4!8!:!?!E!N!P!Q!P!T!S!S!Q!N!I!P!X!^!b!g!f!^![!Y!T!P!J!I!N!Q!X!`!i!r!{!!!!!!!!!!!!"" """&"7"A"H"N"ZQQQQ|Q|Q|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd"Z"c"k"n"v"u"}"u"q"n"f"d"`"Z"X"\"Z"S"R"U"M"J"M"N"R"P"X"a"a"f"i"q"q"n"k"l"k"l"y"|""""""""""""""""""""""""""""""""""""""""""""""""""""""""""##QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ#### # # # # # ## ###### #$#,QQQQQQQQQQQQQQQQQQQd#$# ######### #$#%#$# #"#$# #"#$#"#(#%#)#.#.#/#1#3#1#4#9#9#9#6#9#9#=#;#9#6#9#9#>#G#M#[#`#c#a#c#h#m#k#h#k#f#c#a#c#f#k#o#p#p#s#v#z#y############################~#~#w#mQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd#m#o#k#h#e#e#h#c#]#V#W#T#V#T#R#L#J#H#G#E#H#D#D#A#A#>#=#>#B#D#H#L#R#L#H#J#G#J#M#R#Z#V#W#V#T#T#M#M#J#J#L#M#R#R#V#Z#Z#[#]#[#^#`#^#Z#]#[#^#^#`#`#^#Z#]#`#c#e#h#k#o#m#o#k#h#e#a#`#]#`#a#c#a#f#f#h#h#k#k#m#o#oQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQd#o#t#k#k#h#h#f#e#c#a#`#`#^#a#c#e#c#`#^#[#^#`#]#^#`#e#e#`#Z#Z#R#R#O#J#D#A#A#D#;#6#6#9#9#=#B#D#B#D#G#G#L#R#V#Z#]#]#^#`#h#k#k#e#k#p#m#m#y#################################QQQQQRQRRQQRRRRRRRRRRRRR R R R R RR RRQQQRRRRRRR R R R R R RRRRRRRRRRR!R&R(R)R+R.R+R)R&R)R-R0R0R2R2R2R2R0R.R+R+R-R-R.R+R(R)R-R+R.R0R0R.R.R-R-R)R)R.R:R=RARB#############$$$######$ $$$$#$&$+$+$-$0$)$)$&$RBRKRKRKRIRKRIRDRAR8R2R.R)R&R"R!R!R"RRRR!R!R$R)R+R0R2R5R7R2R0R+R&R$$&$0$3$8$8$A$D$A$B$F$I$I$L$P$T$Q$Z$T$G$AR&R(R+R+R.R2R:R=RBR=R;R5R5R?RBR:R7R0R.R-K$T$_$e$q${${$~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$R0R0R2R2R2R7R2R5R7R:R:R5R8R8R7R5R2R2R.R0R2R2R.R2R.R0R2R0R.R.R-R+R(R$RRRRRRR!R!RR"R$R&R$RR"R"RRRRRRRRRRR R R R RRRRRRRR RRR $$$$$$$RRQQQQQ$$$$$%% % %%%%%%/%8%9QQQQQQQQQQQQQQQ%%%%%%%%"%(%'%#%'%-%8%A%K%R%Z%Z%UQQQQQQQQQQQQQQQRRRQQ>%Z%_%_%T%T%Z%Y%Z%Z%_%c%d%j%k%m%x%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&&&&&&&&&&%%%%%%%QRRRRRR R RRR RRRRRRR RRRQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQuQmQhQcQ`QWQQQLQ@Q8Q3%%%%%%%&Q@Q8Q3Q/Q'QQQ0%%%&&&&& & &%&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&& &&&&%Q/Q,Q'Q%Q"Q"Q%Q,Q1Q6Q8Q=Q=Q>Q@QCQ@QCQ>Q=Q=Q8Q3Q1Q.Q.Q3Q8Q8Q8Q;Q8Q3Q.Q(Q%Q$Q"QQQQQQQQ QQ&&&&&&&&&&&&&&&$&)&,&/&2&3&3&:&@&E&@&;&6&3PQQQ QQPPPPPPPPPPPPPPPPPPPPPPd&)&0&5&8&6&5&0&5&6&:&=&@&H&@&@&B&B&@&B&=&;&:&6&6&:&;&=&@&B&@&@&B&D&B&D&H&H&L&S&V&Y&[&^&b&g&j&o&w&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPyPpPiPnPnPkPfP`P\PWPRPNPKPKPFPAP:P7P5P0P+P(P%P#P P!P!P#P%P%P%P#P%P!P#P#P%P%P(P(P*P(P*P+P-P.P5P5P9PQGQQQZQeQoQyQQQ &&&&&&&&&&QOQWQ^QhQpQuQ|Q~QQ &&&&&&&&&&&&Q`QeQ`QhQoQuQzQ~Q|QsQoQe&&&&&&&&QQQQQQQQd&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&~&&}&}&&&&~&}&w&~&}&z&z&{&}&&&&~&v&~&&&&&&&&&&&&&&&&&&&&&&&&&&&&&PPPQ QQQQQ(Q1Q8Q@QEQOQZQeQjQjQmQrQ|QQQQQQQQQQQQQQQQQQQRRR!R)R0R2R8R;R;RBRNRQRTR[RdRiRdRiRiRmRoRmRsRqRsRmRtRxRtRyRxR}RyRyRRRRRRRRRRRRRRRRRRRRRRRRRRd&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&'''' ''''''''''''''!'&'*'-'5':':'7'5':'?'C'K'N'S'N'M'WRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRSSSRRRRRRRRRRRRRRRRRSSSSSSSSRSRSSS S S SSSSSSSSS%S#S%S SSSS S S%S*S,S,S,S/S4S7S4S6S4S;S7S;S@d'W'\'_'_'^'X'U'W'['X'['_'_'a'a'b'f'i'p'u'{''''''''''''''''''''''''''''(( (((((((((((((((((( ('(.(*(/(,(/(1(4(1(4(<(@(G(M(Y(X(X(R(V([(^(\(a(`(a(a(f(f(j(h(nS@SASESKSMSOSRSYSZSTSRSTSOSJSOSTS\ScSiSpSwSzSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSd(n(n(o(r(u(w(y((|(((((y(y(u(r(q(t(u(t(t(q(q(o(n(o(j(f(`(\(\(Y(V(R(O(G(B(?(<(6(4(8(=(@(B(G(M(Q(U(X(Y(c(c(a(f(h(f(c(^(Y(\(a(f(j(k(f(n(k(q(n(n(c(a(a([(U(Y(O(M(E(B(?(=(8(8(6(9(<(C(M(O([(f(c(c(^(f(h(oSSSSSSSSSSSSSSSSSSSSSTTSTSSSSSSSSSSSSSSTT T T TTSSSSSSSTTTTT T T T T T T TT TTTTTTTTTTTTT!T"T&T&T)T&T+T.T0T1T0T.T+T)T&T&T"T)T,T0T3T1T1d(o(q(r(o(f(h(h(k(j(q(q(r(t(u(u(y(y(z(u(|(|(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((|(y(y(w(k(a(Y(V(VT1T5T3T.T.T+T&T&T$T!T$T&T$T&T)T&T"T!T!TT$TT!TTTTT!T$T&T&T+T.T0T1T5T;T6T8T5T5T8T:T;T=T?TBT?TBTITNTST[T]T[TXTXT[T]T[TXTVTXTVTOTNTJTGT=T?T?TDTGTITITLTQTSTSTXTXTXTXTXT]T[T^T`T^T[TXTXTXT]T^T[TXTXTVTX](V(X([(Y(V(V(U(U(Y(X([(\(X(X([(`(a(f(n(q(w((|(y(r(r(w(z(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((TXT]T^TcTgTjToTvT|TT~T{TvToTeTcTeTbTbTcThTjTlTlTqTtTqTmTmTjTjTlTqTmTmToTtTvT{T{T~T|TwTwTqTqTtT|TwTtTqTmTjThTlTqTvTyT|T|TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT|d((((((((((((((((((((((((((((((((((((z(|(r(j(o(n(o(f(c(^(\(\([(X(U(O(E(@(=(<(<(?(B(G(M(U(U(`(c(a(f(f(j(k(o(u(y(|((((((|(|(y(((|(z(w(t(y(u(o(h(a(\(U(R(O(O(Q(Q(VTqTeTgTbTbT^TXTSTNTLTXT`TlTqT|TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTd(V(Y(a(f(k(n(q(y(y(w(r(r(q(u(w(u(q(q(t(u(u(w(y(|(((((((((((((z(w(|((((t(t(j(f(c(`([([(V(O(G(G(B(C(C(B(G(H(M(Q(X(^(`(a(f(j(j(n(o(k(o(t(q(r(q(u(z(((((|((((((((((((((((TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUUUU UUUUUU#U%U&U(U+U/U&U&U U UUUUUU UUUU U U U UUUUUUUUUUUU UU UUUUUUUUUUUd(((|(u(r(q(q(n(q(k(j(j(h(f(h(j(j(c(a(`(`(\(Y(X(V(Q(H(B(<(@(?(<(8(9(9(6(4(,(*( (((((((((#(#($('(&('(.(*(.(/(/(,()('()($( ( (#(&('(.(/(1(1(6(6(<(=(C(C(J(J(G(H(C(J(M(O(R(V(X(X(Y(`(^([(f(h(j(n(qUU U#U%U&U%U&U&U(U+U*U&U*U+U+U-U/U2U7U7U4U7U9U2U5U9U9UU9U5U5U2d(q(o(q(q(r(q(t(t(u(t(t(y(z(((z(((y(w(y(w(r(k(n(f(^([([(Y([([(^(\(`(f(h(k(q(o(r(t(y(t(n(k(k(j(j(h(f(n(n(h(j(h(j(n(k(f(h(k(q(r(n(h(f(f(c(h(k(o(q(r(t(w(r(j(r(t(t(o(k(n(j(j(f(f(f(a(f(c(n(n(r(r(t(w(t(rU2U5U5U9U9U>UUCUFUHUDUKUMUPUUUXU\U_U_UaU_UZUWURURURUKUIUIUHUNURUXU]UfUkUqUqUuUzU}U{UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUd(r(r(n(r(t(u(y(t(w(y(z((z(|(|(z((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((z(z(((((((((((((((((UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU}UUUUUUUUUUUUUU}U}UzUud((((((((((|((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((UuUvUsUvUxU}UU{UuUkUkUpUuUpUpUqUsUvUuUuUsUqUqUpUkUpUnUpUkUkUgUgUfUfUbUdUgUiUbUaUaUbUdUdUfUdUfUfUbUaU]U]UaU_UaU]U\U]U\U\UZUZUXURUNUKUPUMUMUIUHUHUDUFUCUAUAU?U>UAUDUHUIUMUMUIUHUHU?UFUKUMUFUCU?UAUAU?U?U<S(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((UUAUDUIUKUMUPUPUUURUUURUNUIU((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())) ))) ))) )))) )!)&)+)0)))))&)&))).).)3)2UNUUUZUiUdUbUaUbUbUaUbUfUfUgUkUnUkUiUvUvUzUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU*)3)=):)7):)<)?)?)=)A)=)=)B)G)G)I)I)G)G)O)R)R)U)V)U)U)X)[)X)[)[)X)[)`)b)`)`)])Z)U)P)KUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU )=)G)G)G)D)B)B)A)=)<)=UUUUUUUUUUU)b)d)e)h)i)i)hUUVVVVV$)i)Z)U)S)L)I)P)Z)`)b)`)`)])`)`)d)d)e)i)e)e)i)k)i)e)h)d)h)e)q)o)s)t)y)~)yVVVVVV"V"V%V)V,V.V1V3V3V3V6V9V=V@V;V6V8V;V6V3V3V.V*V)V*V,V.V1V1V.V*)))))V*V*V,V/V1")n)y))))))))))))))))))))))))))))))**V'V*V,V,V.V,V.V.V/V/V1V1V3V6V8V6V8V9V;V9V;V9V=V>V>V@V@VBVBVEVEVHVHVE.)))))))** ***(*;*>*7*4*4*1*-***%******** ***)))))))****** * V.V/V1V3V9V=VBVEVHVLVOVRVYV[V\V[VYVYVVVVVRVYVWVWVTVTVWVTVRVOVOVJVJVLVJVLVLVRVRVTVRVWVWVYV\Va* * ***** V[VYVYVWV\V^V[d** **)))))))))))))))))))))))))))))))))))~))})y)t)q)n)q)t)v)v)y)y)))))))))))))))))))))))))))))*** * * *******#*%*%*(*0*3*;*<*;VcVaV\V\VYVWVTVRVQVQVQVOVOVQVQVLVJVLVLVOVLVLVJVJVLVLVLVHVHVJVLVJVGVBVEVGVEVBVCV=V>V@V=V>V>V@V@VBVCVBVGVLVOVTVWVTVWVVVYVYV\V^VaV`VcVeVcVeVjVhVoVrVmVoVmVoVoVmVoVmVpVpVoVoVrVpVpVrVpVuVrVrVtVwVtVtVuVuVtVrN*;*L*Z*b*f*f*h*i*i*f*i*k*i*f*f*h*k*n*n*k*m*k*n*n*s*u*u*w*x*{*x*|*~***~*x*w*s*s*n*n*s*u*{*|*|*~*~*****************************VrVuVyVyV~VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV***********************V~VVVVVVVVVVVVVVVVVVVVVV *********VVVVVVVVV******************VVVVVVVVVVVVVVVVVV**************************VVVVVVVVVVVVVVVVVVVVVVVVVV*******VVVVVVV **********VVVVVVVVVV ***********VVVVVVVVVVVd****************************************************************++++++++ + +++++++++++++"+$+'+'+*+-+.+3+5+8+6+6+;+=+@VVVVVVVVVVVVVVVVVVVVVWWWWW!W!W$W$W#W$W)W-W2W5W=W?WDWDWFWIWIWKWNWSWQWSWSWZW]W_W_W_WeWiWlWnWsWoWqWgWlWeWjWiWqWnWoWjWeWbWgWjWgWjWtWsWtWoWnWjWqWoWqWnWqWtWtWsWoWtW}WWWWW}W~W}W~d+@+?+F+I+N+Q+V+Q+Q+T+T+T+V+\+`+`+\+`+g+j+h+m+m+o+o+r+q+q+m+m+o+m+m+o+r+x+{+v+x+{+y+v+x+x+{++|++{+++++++++++++++++++++++++++++++++++++++++++++++++++W~WxWxWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWA++++++++++++++++++++++++++++++++++++++++++,,,,,, , ,,, ,',$,!,,,,,,,,!,%,%WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW@ Z Z Y W T O K K H F E E F H K M S V Y \ a f i m s } } } } w r p m m i d _ _ ^ Z Y W T T S P K K F F E EPPPPPPPPPPPPPPPQQQQQ"Q(Q/Q4Q8QAQHQMQQQWQ\Q`QcQjQcQaQ^QWQTQQQMQLQMQJQEQ@Q=Q8Q1Q/Q*Q'Q$QQQQQQQ QPPPP !'!1!:!B!M!E!E!?!:!8!1QQQQQQQQQQQ""QQ""""""""QQQQQQQQ""""""QQQQQQ#.#4#3#1#1QQQQQ#L#M#R#T#R#LQQQQQQ#k#p#t#t#p#o#kQRRRRRQ#k#o#o#kRRRR#p#s#v#pRRRR#p#s#s#pRRRR#h#k#m#o#p#t#t#v#w#y#v#v#t#w#s#m#k#hRR RR RR R R R RRRRRRRRR#######QQQQRR R #####|RRRRR###RRR#####RR!RRR###RRR####RRR"R" $5$8$A$I$T$_$m$x$R)R(R)R+R-R.R0R0R0&[&^&d&g&h&o&w&z&}&}&~&&~&{&{&w&w&t&v&r&t&o&o&j&e&d&b&^&[&[OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO&&&&&&&&&&&&&&~&~&&&&OOOOOOOOOOOOOOOOOOO&&&OOO&&&OOO &&&&&&&&&&&&&PPPP PPP#P(P.P7P>PDPK&&&&&&&&PP PPP P#P(P*&&&P#P#P% &&&&&&&&&P+P(P%P*P-P0P0P7P>''''''SSSSSS(4(9(C(M(U(`(jSSSSSSS(j(o(t(|(((SSSSSST((((((T TTTT T ((((((((((((((((TTTTTTTTTTT&T,T3T:TBTI((((((((TXTXTTTOTNTSTXTX((((UKUHUCU?(((UCUFUH(((((US@S@SCSMSPSTSWSZSaSfSiSmSnSsSwSzS|SSSSSSSSSSSSSSSSSSSSSSd"""""""## ### ##### # # ## #(#(#%#)#1#1#/#4#.#/#9#B#D#A#B#H#H#D#H#O#R#O#G#E#J#O#T#O#R#W#W#T#W#T#R#W#[#]#[#]#a#e#f#k#p#t#w#w#|#z##|####y#w#p#m#k#p#p#m#e#e#^#]#]#W#W#[#`#`#[#W#Z#W#O#HSSSSSSSSSSSSSTTT TT TTT!T&T+T.T0T0T3T6T;T?TDTGTLTOTSTVTTTXT^TgTlToTqTvTyTyTwT{TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUU U Ud#H#G#B#6#/#(#"#### #### # ##########"""""""""""""""""""""""""""""""""""""""""""""""""""""""""### ###### #"""""""UUUUU%U%U(U+U/U0U7U>UFUMURUZU_UbUgUnUuUvU}UUUUUUUUUUUUUUUUUUUUUUUUUUUUUVV VVVVV$V'V*V/V1V3V;VCVHVLVTV\VeVeVmVuV~V~V~VVVVVVVVVVVVVVVVVVVVVVV'""""""""""""""""""""""""""v"l"i"d"X"K"A"?"2"("#""" VVVVWW WWWW$W-W5W#9#9#6#9#9#=#=#>#B#ARRRR"R&R)R-R0R5R;RBRGRKRQRVRZR]RbRjRl$+$($&$)$+$+$($#$$$$$$R5R8R=RARFRIRKRNRSRXR]R`RiRl&2&0&3&3&5&B&B&E&E&B&B&E&D&I&L&Q&V&Y&]&]&b&h&r&~RAR=R8R0R-R-R2R:RBRIRQRTRXRVR[RZRVRVRTRVRSRSRPRP6% % %*%*%2%8%1%2%-%#% %%%%%%%%%%%%%%%%%%%%%%%%%"%%% %%%%%%%%%% %% % % % %RbRTRNRSRTRVRVR]RXRVRbRiRmRtR{R}RRRRRRRRRRRRRRRRRRRRRRRRRRRSS SSSSS S%S'S,S4.&&&&&&&&&&&&&&&&&&&&&&~&~&{&z&z&v&m&d&^&a&^&[&V&Y&T&Q&N&N&L&I&E&@&:&5&3RRRRRRRRRRRRSSS SSSSSS#S%S(S(S,S4S7SU?UAUHUMURK'C'K'P'U'['_'f'i'n'w'z'''''''''''''''''''''''''''''''''''''''''''((( ( ((( ( (((#(#(&(,(/(4(8(8(6(4(/UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUqUnUnUkN((((((())))))))))) )))(((((((((((((((((((())))) )))))!)!)))))) ))((((((((((((((((((UUUUUUUUUUUUUVVV VVVVVVV"V'V)V)V*V1V3V3V9V;V=V=VBVEVEVHVOVRVVVYV^V\V`VaVeVkVpVuVwVzV|V~V~V~V~VVVVVVVVVVVVVVVVVVVVV )L)O)O)R)S)U)X)Z)`V"V$V'V)V/V1V/V1V1)U)V)[)])ZV1V3V8V8V1)i)k)o)qV@VCVLVT)i)k)nV8V;V>&&&&&&&&&&&&&&&&&&&&&&&&&PPPPPPPPPPPPPPPPPPPPPPPPPd!'!,!5!:!:!8!'!$!!!!!!!!!&!.!7!=!B!I!S!X!^!i!j!r!w!w!!!!!!!!!!!!!!!{!|!|!w!o!j!f!j!f!l!b!Y!^!c!b!f!`!^!X!Y!T!Q!J!N!V!Y!^!b!f!f!c!`!X!Y!^!^!Y!V!Q!P!M!I!E!I!J!Q!T!N!S!V!`!c!m!i!q!wYYYYYYYYYYYwYwYtYtYlYhYjYqYrYlYgYeYeYhYoYqYtYwY|YYY~Y|YY~YYYYYYYYYYYYYYYYYYYYY~Y~YY~Y{YvYyYyY~YY|YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY`!w!!!{!!!!!!!!!!!!!!!!!w!w!q!o!w!r!w!|!r!t!i!g!`!^!c![!T!Y!^!P!@!E!@!:!=!;!B!E!B!I!E!:!4!5!8!8!4!,!'!)!$!!$!!!&!)!$!$!,!0!8!:!B!?!E!J!N!V!Y!X!Q!V!N!G!E!E!@!;!8!=!:!=!7!4!,!'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY!S!S!^!j!o!t!{!!!!!!!!!!!YeY^YXYVYXYVYVYSYQYOYJYEYDYDYEYGYLYN,"/"1"/"5":"D"A"A"D"P"Z"`"a"i"q"|"}"}"""""""""""""""""### #%#)#3#>#J#RY:Y:Y5Y.Y'Y)Y,Y1Y3Y5Y5Y0Y+Y'Y&Y$Y!YYYYYYYY!Y&Y'Y!Y!YYYYYYYYYYYYYYYc!!!!!!!!!!!"!" "" """"" "!!!!!!""""""""""#"&"("/"2"2"&"!"#""""" "!"&"#""""" "" """!""!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!YNYNYLYLYIYGYIYLYLYJYLYLYIYEYEYBYBY@Y?Y=Y?Y?YEYDY@Y=Y=Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y:Y=Y?Y?Y@Y?Y?Y@Y@YBYBYEYGYIYIYJYIYLYLYNYOYQYSYSYSYVYVYSYSYSYSYYY[Y^YbYbYeYlYoYlYlYjYhYgYeYcYbY`Y]Y[YXYSYXYSYQYSYQYQYNd"U"Z"a"g"k"q"|""""""""""""""""""""""""""""""""""""## ###"#(#/#4#=#E#J#M#T#a#k#v#z#######################$$ $ $ $############XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXd############################$$ $ $$$$$$$%$%$($-$-$.$+$.$8$A$G$Q$W$Z$]$`$e$g$j$n$q$v$v$~$$$$$$$$$$%% %%% %%%%%%"%%%*%-%1%;%@%F%C%H%N%Q%R%K%H%C%F%O%UXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}XzXxXzXzX}X|XwXwXrXrXwXxXwXrXrXpXxXXXXXXXXXXXXXXXXXX}XzXxXxXwXwXuXuXxXxXrXrXrXrXrXwXwX|X}XXXd%U%R%T%R%O%H%F%F%H%H%J%H%N%O%T%W%\%Y%R%O%K%N%T%O%J%H%K%H%F%C%A%>%>%9%8%1%1%8%6%9%9%>%C%C%@%9%9%1%#% % %%%%%% %%% % %#%*%*%'%%%#%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$x$y$q$pXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYYYYY YY Y Y YYYYYY YYYYYYY'Y+Y5Y6Y:Y?YGYJYNYQYQYXY[Y]Y[YYYYY^Y`Ybd$p$m$g$e$`$W$X$T$T$P$L$D$B$?$5$5$+$)$&$$$$$$$####################$$ $ $$$ $ $ $ $$$##########################################YbY^Y^Y[Y[Y`YbY`Y^Y`Y^Y]Y^Y]Y]Y`YbYcYeYcYhYeYjYjYlYlYlYlYrYvYrYtYqYqYtYoYlYjYhYcY`Y]YbYeYgYeYeYcYeY`Y[YYY[Y^Y`Y]Y`Y[Y[Y]Y[YYYVYVYYYVYQYJYLYQYQYJYIYGYIYEYEYIYDYBY?Y?Y:Y8Y?Y@YEYOYSY[Y^Y`YbYeYbY]YYYVYSYOE####################|#v#v#t#p#m#k#f#h#e#^#a#]#^#Z#R#V#O#L#L#H#G#B#9#3#+### """""""""""""""""}"s"k"c"UYOYNYNYDY@YBY?Y8Y3Y0Y.Y5Y5Y8Y?YGYIYGYDY@Y:Y0Y.Y'Y!YYYYYYYYYYYY YY Y Y YYYXXXXXXXXXXXXXXXXXXXXXXXXX """""""""""XXXXXXXXXXX""""""XXXXXX""""""""XXXXXXXX""""""XXXXXX#v#|##################~#v#vYXYYYYYYYYYY!YYYYYYYY YY#y#~####~#yY&Y&Y$Y'Y+Y+Y& $q$s$s$v$x${$x$x$t$q$qX|XzXuXwXuXxXxXXXX| $$$$$$$$$$$$XXXXXXXXXXXX%R%Y%_%c%g%j%s%p%p%n%m%r%u%s%uXwXzXzXxXzX}X|XzXwXwXrXmXhXdXa%r%s%x%x%sXmXpXwXzX|%_%Y%O%RXzX|XxXw^%9%2%/%-%-%%%"%%% %$$$$$$$$$$$$$$$$$$$$$$$$$$~$~$x$y$y$s$q$v$x$~$~$$$~$v$p$m$i$i$e$b$Z$W$U$U$T$X$X$W$T$T$N$L$N$I$B$<$7$3$3$+$#$$$$$$$ $$$######X9X9X;X;X>X@XCXHXKXMXMXPXOXRXPXRXPXKXEXCXFXEXEX@XCXEXCXEXCXCX>X2X2X/X/X*X,X'X'X#X X#X'X,X1X1X6X9XX7X7X;X9X4X1X,X*X'X*X2X6XX@X;X9X6X1X-X'X'XXXXXWWWWWWWWWWWWWWWWWd######$$$ $ $$$$$#$($-$-$+$0$3$3$7$8$<$<$B$B$G$G$I$L$L$N$P$T$W$U$W$U$P$P$L$N$L$I$L$G$F$A$B$>$?$8$7$3$3$0$.$+$($%$"$$$$$"$$$$$$ $ $ $ $ $ $ $ $$$$###########$$$ $WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXXXXXWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW}WxWsWjWiW_W]WVWSWLWIWDW?WX@X@XCX@X@X@XCX@XCX@X@XFXHXFXFXCXEXCXEXEXFXFXCXJXCX@X@X@XHXHXJXKXKd&m&t&m&j&d&a&d&^&[&V&O&Q&O&T&Y&Y&Y&Y&[&^&]&]&b&d&h&j&j&d&d&l&o&r&r&h&j&e&e&a&]&Y&Q&N&L&H&@&@&;&=&:&3&2&0&)&'&"&&&&&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&&&& &XKXMXMXOXOXJXEXFXEXHXFX@XXX;X7X7X9X9X6X7X6d&&&&&&&&&&& & &&&&&&&&!&'&+&+&,&0&6&6&:&:&;&:&B&K&O&N&L&L&Y&]&]&b&d&[&D&5&2&)&"&'&&&&&&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%z%u%p%k%d%h%kX6X7X9X;X>XX>XCX@XCXEXEXFX@X>X@X;X9X7X;XXCXFXFXHXHXMXOXKXOXPXTXRXRXTXUXUXYXYXYXYX\XYXYX\XYXYXYXYX\XYX^X_XaXdXcXcXfXdXfXiXiXfXaXcX_X_X^X_X^X\XYXYXUXUXYXWXRXOXOXRXUXYXYXaX_XaX\XYXYI%k%m%p%r%s%u%z%|%x%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|%u%s%m%h%c%c%_%Y%U%T%U%T%W%R%Q%O%N%K%J%F%A%<%;%;%8%6%8%6%9XYXYXYXYXYXWXWXUXRXMXJXKXJXFXJXFXFXKXKXOXPXRXRXPXMXJXFX@X@X@XCX@X@XCX@XCXCXEXEXFXEXEXCXEXEXFXEXFXFXEXCX@XCXCXEXFXHXHXEXHXHXEXJXKXKXMXJXEXEXCX@X>X9 $X$[$Z$`$e$`$[$Z$X$XXXXXX XX XX X$$$$$$$WWWWWWW $$$$$$$$$$$$XXX"X'X,X-X/X/X,X'X"X %F%J%N%W%\%W%U%T%N%FX6X2X-X,X1X2X6X2X6X6 %%%%%%%%%%%%%X>XX9X&Y&[&d&e&a&]&Y&YXXXXXXXX &&&&'&&&&WWWWWWWWW &&&&&&&&&&&&WWWWW W WVVVVV<%%%& &&&&&&&&&&&&&& & && &&&&&&& &&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV,%%%%%%%%%%%%%%%%%%%%%%&&%%%%%%%%%%%%%%%%%&&&VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV~VV~VVVVVVVVd&&&&&&$&,&5&@&H&K&O&V&[&a&o&t&{&&&&&&&&&'''''&'2'?'F'I'N'W'['d'g'l'l'p'w'x'}'''}'z'l'l'g'_'['W'S'P'N'F'C'>'<':'4'-','!''' '&&&&&&&&&&&&&'' '&&&&&&&&&&&VVV|VzVzV~V~VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVWWWWW WWWW WWWWWW WWW W W WW WW W W WWWWWVVVVVVVVVVVVVVVVVVVVVVVVV&&&&&&}&w&o&e&Y&Y&Y&V&H&@&;&2&&&&&&&&%%%%%%VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV '}'{'x'q'q't'q'l'l'p'n'n'lWWWWWW!W#W$W(W+W-W5W7d'#'%')'0'5'>'K'P'S'\'^'a'f'l'{'''''''''(((((4(8(?(G(O(V([(a(j(n(u((((((((((((((((((((((z(((((((((((((((((((((|(r(h(Y(C(?(4(9(B(G(M(J(G(E(?(=(8(8('7'7'0','#W~WWWWWWW~WWW~W}W}W{W{WvWvWsWsWqWqWnWlWiWeW_WZW[W[WXWVWQWNWFWBW< (O(Q(Y([(a(a(Y(Q(OWWWWWWWWW(n(r(r(o(r(r(y(|(y(((((((u(n(nWWWWWWWWWWWWWWWWWW((((((WWWWWW ((((()) ))WWWWWWWWW*******X_XcXfXkXmXpXr+D+J+Q+V+V+c+h+x+++++++++++++++XXXXXXXXXXXXXXXXXXXXXXX+++++++++++++++++++,,,,,,,%XCX@XP>PAP>PAPDPCPCPDPFPGPFPKPMPNPMPKPFP>6(f(f(o(u(z(((((((((((((((((((((((((((((((((((((((((((|(u(r(o(j(h(fP>PP>+(((((((((((((((((((((((((((((((((((((((((((OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOdSSSS w,X   SRRRRRRRRRRRRW p8d,X -Y! K !!YtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYtYt!$!$!'YYY))h)*0*cWWWWW**k*i*m*n*u*{************************************WWWWXWWXXXXWWXX XX X XXXXXX%X'X,X/X2X9X;X@XEXEXHXJXMXOXPXRXWXYX_**+DXrXX++XXCD p8d,VVVVVVVVVVVVVVVV8XHXHXHd8pSTThTTUFUppppUUVTVTqTU(UUVTVVWWoXpXYYt,X Lx@  l !4!YTTTTTTTTTTTTTTTTTTTTT X LmVTVTVTVTVTVTVTVTVTVTd{{qqgg^II????5,,,!!!!  WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWXX XXXXXX"X"X%X*X*X%X#X XXXXXXXX X#X'X,X1X;X;X>X@XEXHXMXRXUXYXYX_XdXdXiXpXu0wwwmmdYYYYOEEE;2'' XuXzXzXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXYY YYt X LVTVWWWWWWWWWW RRS4SST`TU(UUVTL   x@@@@RRRRRS4SST`TTTTT`SSTTxmmmmTU(UUVTVTVWWWWWXHXYYtm@  l !UUUUUUUUx@WWWWWWW x@  l X@X@X@X@X@X@X@X@X@!!!RS6Sk !f!g!j!l!`!Y!Y!Y![SuSST$T`TTU(U WNWWX!!"`"S6S6S4S4!Y!!"`"#TTTTTT##ET`T` !4!!"zV*V*V*V*V, !4!!"`"WNWNWNWNWNWNWN""#(#ARlRlRlRl$$T$$%RlRlRlRjRl%*%%&2RNRKRFRA########R.RlRS4SSSS%$$S4SS# ####$T$%%%%%&&&&&"&)&&&&&&&'/'SSSSSSSSSSTTTT T TT TT TTSTSSSS#b#####${$$$$%%%<%%%&N&O&j&h&''t'(<((TTTTTTTTTTTTTTTTTTTTTTTTTTTT1%_%a%j%m%x%}%|%%%%%%%%%%%%%%%%%%%%&& & & &&&&)&/&3&8&:&@&E&O&T&[&e&b&e&e&jSTTTTTTT)T,T0T0T5T5T8T;T?T=TDTETITJTITOTXT[TXT`TgTcT`T]T[T^ThTmTmTqToTlTlTmT~TTTTTTTc%%%%%%%%%%%%%%%&&& &&$&K&N&H&N&N&S&Y&^&g&t&z&&&&&&&&&&&&&&&&&&&&&&&'''''''!'%'!'&',','/'-'2'<'?'E'S'\'^'b'f'i'l'u'''''''''''''''''''TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTUUU UUU(U2U5U7U9UAUCUFUKUMUPURUXUdUaU]UWURUWU\UaUiUkUsU}UuUUUUUUUUUUUUUUUUUU'C'CUU(((U#U(U+&''t'(<(((((((((((UUUUUUUUUUUUUUUU((((UUUUUU)q)!VTVw"C"C"K"M"XXPXXXX"#(##$VVVVV###XKXWXk$$$UV V$e$%%-VVVV%-%-%-%-UUVTV%-%%VVV&&&&UUVTV'''t'(<((VVVVVVV )))))))))VTV^VjVpVVWW WN)))))*C*m*m*p*p*x***VVVVVVVVVVVVVV )*0*u*{*******WWVWWWW WW WW*<*>*<*C*CVtVuV|V~V****WVWWXplplot-5.10.0+dfsg/data/globe.map 755 1750 1750 101502 7633337504 154640ustar andrewandrewdXx H T Z ( ( (  z   yQ ( H H ) YIb\7PJ%ppUUq^I9 R~~1@r@%%_%N%<%#$$$$%-%N%%%&&H&z&&&&&''0'['''''''( (*(<(*(''(#(U((((((())))(((((()$)G)y))))h))))y)V)$(())6)h))h)6)()$)6)h)h)G)$(() ).).))))G)h)))d@@F`  : : :`Q l !"G"#$T$%_%&'B'''(n))h)6)*b*++,$,$+++++,,D,,5,5++++C+;+|++,$,g,g,,,-P-P--.8.J.|//T//0,//////d/D/..Z..----P)))))))))))))))))**7*I*0*A*(*))))))))))))*)))))))))**A*b***+1+1+T+m++++++,,+,D,,$,,5,N,o,,,,-- -7-P-`-y---y-y-`-`-%-/-P--/- ,,,,,V,o,Vd-P-p- ,,,,,-p--..J.8.|..8..|...J.|..8.8---p,,,-./0p1X2 3 35 6L7F889J9:;>;<(<==><>?h?@A A~AAAAABB6BBBBCrCQCrCQCDDCDE$E$EEVEEEF FPFG[GH"HI-IJ8JKB,V,+,+,++++u+u+T+*****Z*0*))))))G)$(((((n(<(*(4(4(#('''''''''( (*(M(n((())=)`))))))**7*P*s*{*Z*{***i*A*P*i******s*s*{*******{*b*{*********dKBKLnLMyN NOLOP5PQaRRRSfSUSfSST`TUIUkUUUUVuVW=WXHXY!YBYYZ YZ ZnZ[G[\0\\\Q\\]\]}^^g^_/_`8`a#avavaaavaaabOb bccjcddudde,ef7ffghhhiWij@jkklkl4lwlmm`************+ +"+*+*+\+|++c+;+*+"*++*+J+m+++++++++++,$,V,o,,,,o,],D,=,+,$,+,+++++++++++\+J+"****++"++ +*+J+T++++,,,$,5,D,=,=,D,V,N,N,V,D,V,D,V,N,]dm`mmnnnoTopppqqfqqqrVrs snstJtuNuv*vzvwwtwwx2xnxxyyyhyzbz{*{{|V|}2}}~J~~~X>L~܃@rքNЅ44Hz(6̉̈ꈚ"n~ޅޅB,],],,,,,o,V,N,5,N,D,],,,,,,g,V,=,5,5,D,],=,=,V,N,o,o,V,+,$,,+,g,,v,,v,,g,g,V,N,D,=,$,5,$++++++++++|+++T+;+\+T+C+*+************b**I*0))))))`)V)6)((((n(C(BB(`fЄЄЄ4`("N(''''''b'0'&&&z&O&%%%%%FnF('(((4( @]]%%@''l'S'!&''B'l'' N k (f(U(u((f((n())G))*b*+m++++m+;+***P*b****A))$(**s*P*A**)))**7*b***+1+m+c+T+"******* ())h)))6(((*****+***-/--.----/- ,--/-P--7- 0>0p000>----- .|./"/d//T/"..|----..---4644X46....d'&&&&&&&&''0'!'&&&&&&&&&''0'B't'''''( (*(<(\(n((((()6)h)))*0*b***********************{*b*s*{*Z*P*Z*b*b*s*P*Z*A*7*))))))))))))))y)FPF.EEEEvEfEVE$EVEVE4EDDDD}DKDCCCCC{C@CBBBBWBAAAAnA<@@@@t@R@)@ ??????h?X?/>>>>N>====T="<<<-p-y-i-,,,,-/-`----..--..c../"/d///0 0,0%//////v///00W001181a1j1112222d222233,3E3U3^3U3U3U3~334464q44445 5R555566L6L6\664444445 5@5b55555555566L6e6L6:6:6S6u66677-7777$7-7=7M7f77788'8P8888988888888899:9l999::4:f:::;;.;`;;<<8>N>d66666777 7777 777M7x77778'8@8i88888888y8@87777f7F7666~6L65555R5 4444444F4333~3^3E3U3e3,222222t292B2R2}222222d2d2221111X181000p0>0////m/v>>>??H?h??@@B@t@@AABhBBBCCbCCDDCDSDKDSDuDDDDEE4E4E$E$E=E=EVE]EDE4EfEEEEEEF F EEEEF.F>F7F>F%EEEEF F>FaFFFGGJGGGHH3HTHmH~HHHHHHHHHHHId/v/d/2/..|..|.A.---.---P-,,,,v,N,$+++++m+;+******i*i***P*I*0*I*b*P*7*i**s*P*0*))))V)=)(((((((U(U(*( ''''l':'!&&&&a&6&'%%%%%%%%%%%%%%%g%<%$$IIFIgIIIIJJJ'JJHJjJzJzJzJzJQJ@JHJYJrJrJjJjJaJJJJJKJJJJJJYJIIIJJQJrJJJKK!K)KJJJJJJJJJjJ8JIIII_IIIIIJJIIIIIIIJJ8JaJJJKKKK}KKL,L-p-..j.|......|.J.J.---P-,,,,,g,,-7-7-,,,=+++|+C+******++C+|+,,,=,,--P--..8..//;/dV~VVVVVVVVVVVW W-WNW_WoWWWWWWWWXX'XXWWWWWgWNWoWWWWWWXX'XHXiXXXXYX/X7X'X/XPXaXXXXYYY)YBYcY|YYY|YcYSY:YXXXXXXXY!YJYlYYYYYYYYYYYYYYZ Z+ZMd/d/00^00p00>//////K/+...Z.1.1.Z.(.(----`-/- ,,,,,],=+++\+*+*+1++****I*b*)))((u(''( ''(((''''( (*(<(U(U(#'''B'b'{''''t'!')&&&&h&'&6&6&&6%%%$$e$"##ZMZfZnZZZ[[G[G[p[y[[[[[\\(\I\{\\\\]*]\]]]]]]]\]C]"] ]C]K]u]]]^^$^$^=^^^w^^^^^^^^w^^^5^ ]]]]m]d]C]"]\\\s\0\[[[[y[O[ZZZZ]ZbaaanaDa````aa+adaadaDa````ds3 9,EYjQD]P=90I< 3  " A4/rxc@r%]S'Y1Y]lMlIx``aa:a+a```````````a'a@aDaYaraaaianaana}aaaaaaaaja}avaUa+aDada}aaaaaaaaaaaabb,aaaaaaqaKaI_IIIIIIIIIpI5I HHHvHDHGGGG[G[G)FFFFFFPq W/)> p-U>paq``%`1`_________`_``B`8`B`[`t``c`Q`=`E5{kCXg!EYEE^5^^^$^^=^N^^^^^^^^^^^^^^^^^^w^o^N^5^5 9X[ uC];]2]T]d]d]u]]]]]u]\];  cccmF'F' \Q\j\\\] \\\\s\Q A K } s l l l S 2 [%[ZZZZZfZvZMZ#YZ ZMZvZZ[[G[O[O[%@++` `Qjj+[ ZZZZZZvZMZ+Z YYZZ4ZUZZZvZZZ[ [ ""X"""#A##$ ##$ $3$t$%%%N%5%<%%$$$$3####a#9""""XXXXXzXXXXXXXXrXrXXXzXzXXXYYY)Y[Y[YtYSY:YXXXXX7#$;$"$$ #$$$"$L$t$$$$$$$$%%N%x%%%%%%%&&&a&a&z&&z&'')&&&h&'%%%n%%-%$$m$T$3$#WWWWWVW-WVVVVVWW5W_WWWWX'X'XXWWWxWVWxWWVW$W=WxWWWWWWXX@XPXYXYXaXaX@X@XHX@X/X/XWW%&&O&a&'%X7X'XX@X7X7%%&/&h&&'!'[''B&&&&z&Y&%%VVVVVVVVW W W VVVVVVV')'[''((M((((\(<''''I')W5W-W=W=W5W=WNWWWWxWWxWoW_W5""""""""FXF%F EEFF.FX )h)V)V)G))))))h5555b5Y555553+u+J+*+***+1+;******s*()))h)$)6)h))y))))*0*0***+ +;+|++,,V,,,,,g,=+++++u111111z1j1z1j1Q11&1X1&181H1a111111z1a1H1/1/1 1 00000000000000011181X1z11.j..///T/v////D/....j21211122222B222B292227x788@8P8'77x18110011/18.(.c.|.|.8.J.J.(J8J8JQJJzJrJHJ8+N+o+e+NK#KKK# '''(#(C(f((u(M('''MiMiMGM?MPMGMGMiMyMMMyMi%%%%&&%%NNNNNNNN9%-%n%%%%&/&r&@&a&&&')'[''''(#(4('(<(n(())$)V)O)6)(((((n(<(''''S'0'&&&z&H&%%%%_%_%-NNNNOO+O"OO NNNNNNNNNNcNcNAN(NNNNNNN N(N9N9NZNcNZNNNNNNNO O O+O;OLOLO]O]OLODO;O"O NN&)6)y)))**A*i*****+*+\+|++u+"+J+****P*0))))))*))))V)6MyMXMiMiM`MiM`M.MXMqMMiMqMMM`MMMMMMNNNMNNMMMMMMyMyMMMy ,,=,g,,,,N,,MXMPMXMXMqMMMMX.(.1.A.Z.J.A.(LLLLLLL.j...jLKL L '''''( ''''P%POOOOOOP%P%))))))N|N|NNNN|'t'''''''tPPPPPPPP((1((#(PPPuPP(V((PFP!O((OO()OO?)G)y)SO;O!N))OO **%*eNNN&Y&OO(((TTT6 )h))*0*)))o)hV*V3V;VTVeVTVLVCV* -%-i---.8.---i-%YYYYY|Y|YYYYY -7-W---.---W-P-7XXrXYX@XaXzXrXrXXX%%&O&O&%%^^^^^^^'&')'S'['^^o^V^^^ ''I''B'b'b'{'b'\I\Q\(\(\A\\Q\j\I&H&&&&&H[ZZ[ [[3/"/2/}/00g000w001 1?1&1X1X111111z1X1?1Q11Q181j18000w00g00>0^000p0,0 ////}/]/}/K/"YXXXXXXXXXXXXXXXXXXXYYXXYYJYBYcYYYYYYYYYZZDZvZvZ]Z"#(#$%&'':&%$$t% % %F$$$##$T##Z#Z$ % %&&r&'t''[''()))h*b*+m,=-/-7-.j.j--%,+))6(M&&%$t$t#"f&eeeeeeeeeeeereEeeddddd}dqdRd*d dd*d d2dd*dRd}dddde,e^eseeeff7fSflfffffffffffxfefPfPf&r (reeweeLc@ Z ! j@@e@e,edddddddddde"dddde e@e@eReRe@ l!"!"?".!4 lddddddd-siddvdkdddL   rxLd9dccccccdd&dCdFd*dd%d?d9iiccccYxG  d !+xbbbbb^b,bOb^bbbccEc0c8c&cbbb,dddddedd2w2dddddCXqdddddddd-Ucccd cc93j2U>Wdcccdd2ddGdkdddddsdXd2dUEI[XkMIUcccccccjcbcmccccccdd dPd9dd ccccdd*d.d cc2U-;I2O!XyA;xYis7iL[ w88bHb1baaaaaaaava]a]aa!a+aDaUavaSa7aDabaaaaabbKbbbbccbbbbbbbbbbbbbsbHg93KY_agbwbObb,b6bhbbbcc&cQcQcjcQc?cbbbwn[[ڊЉZZZ[ZZZZv5q?5ZZZZ9CZZZ7~7Z[[%[>[6ZOO[%[6[J[h[h[G[%33_3_/_ _^_ __/_/'cm1]]]]]]]]  c w 1 \\{\\\\\] ]"]\\ Q\$Q[y[>[%ZZZZZ[ [>[p[p[y1c!J||/|JY1ZYYYYYYtYtY[YBY1YBYlYYYZZZ+Zd)*P**+***+u+*+,N,-.8.///0>0>000000181z12)2K11001X12K2}2d11z1X1Q1j1j1222B2K2223,344q45'5k5555566e6~66L667F78`899A9l9::;;<^>^=>>>w>>>==>^??6>>>>????@ @AA#??6>>5=<=======<<;:8@65 4&322K1/"..c.(-i,,=+,-,+|**)aaab b6b^bbbbwbbbbbcc&c8cQc{c{ccdddCd\dKdkdddee9eaeeeff8fDf$f-feeff3fDf_f[f?f8f_f_fqfmfxfffffffffffffXfxf_f?fffeeeeewe@e.eed%<==m==d<=}==m>>>?h?@ @@@@@@1???q?/>>>g>^====T=T== <________i_?_?_&__7_?_a_z___`8`1`J`)``)```__``8`B`)`)`_BC0ab>>?O>ccccdIIIIIJJ'JYJzJJJJKKK!K)KBK[KdK}KKdKtKKKKKKKKdKBK2K!KKJJJJJKK)KBK[K}KKKKKKKKLLLL#L4LELMLnLLLLMMM.MPMqMyM`MGMqMMMMMN1NRNNNO+OeOOOPP_PxPPQQHQrQFPFEEEEoE=EDDDDDdD:DCCCC{CICBBBBpBFB%AAAA]ADA@@@t@B@????O?>>>>g>,>====[="<<<qfqzqfqpqqrrBrtr~rrrs s{R{{||.|V|j||}}}2}2}(}2}F}n}}n}n}}F}}|||V{||{{{{{f{*VUUUUUsU{UUUUUUUUUUZU0UUTTTTTGTSSSSST T6T`TTTU UAUkUUUUUUVV3VCVuVVVVVWW5W5WVW W-WFWxWWWX'XPXzXXYYBYtYYZ Z[p[[[[2zpޅކԅt<bEb>bObEb,b>bhb>babb,b^bbbbccbbbbbc c cccc?cbcjcXc?ccc&c8ccbbbc ccIcjcccdrrr8qq pplopNooonnZmmlm&ll4kSjjQihh~h!hhLggfXeeefiff-ee^ddddddd\dd9ddd\cccccjcIccc{cbc&cXc&cc0ccqcjcc8cbbEab^bbbc bbbbbb^bbbb,bObaavab%b bb,b^bbbbbbbpb^b,b aaaaKaDa+````j`J`1`[`|```aaDavaabb>bhbbbbcbbbbpbEb%ad`j``t`t`aaKa```__W^^o]]d]2]m]]^,]]]]d]d] \\A[[[h[`[ZZIpIIIIJJ/JJJIJIIHHHHHHH]HGGHH H HHGGGGGJGFFFFFPKlKKKKKLL4LELKKKKKlKKKKlKKK2KKK[KKKKKKKRRRSS^SSMSnSSSSSfS4RRRRRREE=EfEVEVEvEEEFF%FXFiFiFaF>FEEEQQQR)RBR:RtRlRSR:RBRQRQQQQQQQQQCCCCjC'BBCCICCCCDDKDDEDDD\D!CSSSSSSTTTSSSSSSSSSSSSSAAeA[.[6ZZZ[6[y[[[`[G[ZZZZZZZZ]ZMZ#YYZ4ZfZMZZ[ [G[[`[W[G[ZZZfZ4YYYlYtYBY)XXXXWWWWgWFWVVVV~VTV*VVUUUUUbU0TTTTTTTTTTUUZUUUUUVVCV3V3VTVuVVVVVmVVVW W W-W_WWWWWWXXWWWXX@XrXXXXXXXXXiXaX@XPX'WW] ] ]]]\]]]^,^,^V^w^V^$^$^E^g^$^ ]]]]]\];]2] WWWW_W_W_WNW_WWWWXX/XHXrXXzXXzXYXiX@X@X7XWbc&c?cQcIccddRddeeEeddddRdcccIcbXWWX'XHXYXrXXrXXiXrXXXXXXXXXXrXYXno"ohoopplppq qq*q>qqpppppXpooooho"nZvZ]ZnZZZZ[[6[h[[\\[[[[[`[6[ ZZZZZZvRRBRdRtRRSS#S#SRRRSRR^,^ ]]]]]]^^5^E^^^^^E^,SST.T.T`TTT`TGTOTSSTTSS^o^V^E^^^,^N^g^^^^^^^^^oDW5W5W=WVW_WgWWWXX@XrXXXXXXXYYY)Y:YBYSYcYtYYYYYYYYZYYYYYYYcYcY[Y1XYXXXXXrX@XWWWWxWWWWWWWxWVW5===d=;<<<#>N>w>>??H????@B@@J@|@AA>>>N>#==[[\\\[>==> >#>\\\\\>N>N>n>>N[%[G[p[[y[G[%K)KKK2K:KBK) a2aUaIHHHHHI IFIpIIJJ'IIIIxpppqq*q\qzqqqqzqHq ppMMMMqMqMMMMN N N NMMuDuDuNuvuuuuuuuuuuubuDOO]O"ONO"OLO~OOPP-POOOxyy,y,yJyJy,y,y,yhyyyyyyyyry@yxSMSSS{ { {4{R{{{{{|B|~|||||}}(}F}<}F}Z}d}Z}n}}}}}}}}}P}F}n}n}F}}}}}|||||t|L|{{{{{{{p{p{R{*zzzbz&yyyyrSSSSSSSSSSSSSSfS^SSSSSSTSTTT.ST T.TGTqTTTU0UIUIUsUUVV*VTVuVVeVeVLVLVeV3VUUUUbU0UTTTTTTTTTThT?T.TGT?T6T.T.TSSS+||}}}2}n}F}}}F}Z}}}~J~J~r~~D~~~~h~,~}}}}}}}}}}F}}(|VVVV~VVVVVVVVVVVVVWWW-WFW=WVWgWWxWWWWWXWWWWWgWFW-W-W5WVxWWWXWXWWԁ耶X'X/XaXPX'XX,JJ"YYYZ Z#ZY{||B|{[[[[[~B]*]T]m]\]*/}}}}}}}}}}}}}}}}}}~~,~T~T~6~,~}~~~"~J~|~~~~r~^~J~6~@~@~,~"~}}}}[%ZZZZfZ[%(bAbab Ob bbbAbA}<}~^~^}}d}bpbbbccIcqccccdd dRdddKd*ddccccccIcbbbbbwbEY[YYYYBY[a+a vblbD&&~~~~|~h~h~J~6~"~}}}}}}}}}}}}}}d}d}2}|||~|B|{{{{p{H{R{p{p{p{{{{{z{\{*z88899A9l999::4:]:::;;N;;;<>,>U>n>>>>??&?X???@@B@t@@@@@A#A]AAABAAAA]A>>>>>>^>^><><><>,>=======t=K="<<<>> l&~6l6:65555k5R5I5r55{55566L6\6L6:6:6\6l54\$8`tj~΋؋ ċVԊފfHЉ4\pR4666666S6*66!6L6l66667 7 7-7=7f7777x777787778878Y8y888888`87877777x7M77 6.Znȇ܈T̈&0DЉЉ Hff>4N:&ꈸ@ȇxZ4_4F4?4F4-4&44&4?4_4444559595R5r55556*636S6:6*6S6l6S6*655555b5@5 544444_Ȉ3343Ckkkkl l,lMlwllllmmmNm`mmmmmnnvpvpvHv*vv v uuvv*vRvvpv4vuuuvulu:u:uNuvuuuv*v\vvvw$w8w$wvvvzvRv*uuuuvu0u&uutttttE4DDDDDKD!D!D*D\DDDE$EDEDE$DDDD}DlDD:DD:DuDDDEE=E]EEEEEFFEEEEEF FHFzFFzFFFFFqFzFFFFFFFFFFFFFFFFzFHFEEEE]E4x x(x2x(xFxxxPxFxPxxdxxxZxFEF%FPFFFFFFFG)GFFwwwxwwwE DDDEEE xFxxxy,yhyhy@yxxxdxFEDEDDDDE$E$E=E4E4Evw8EEx xdx(x EEEEy6yhyyhy6F>F%F7FPF>{*{\{{f{*F EEF F dyhyyyyz&zbzzzNz&yyyz&z&z0zbzzz{ {H{{{|$|L|`|t|~|V|8||V||}}}<}d}}~~@~J~@~h~|~~~0Xl*fԀ$8Ԁ\44 lDD~~~~^~,}}}}d}(}||EEEEEoEoEvEEVEVE=EDE4E+E DDDDDDDDDDlD\DCD!CCC{CrCICCC'C'C0CBBBBBBBCCC8CbCbCQC8C0BBBBBhB_BWBOBFB%B-BWB_BpBBBBBBC0CIC{CCCCDDD!D*DdDDDDDEEE+E=EMEfEfEvE||`|.{{{{z{\{H{ zzzzzzzbz0yyyyhEEEEEEvEME+EEE$EVEfEEF F F.F.F EE.uu&u0u:uluvuuvuvuuv v>v>v4vfvvvvvvvzvRv4v uuuuuvv*v v vuuuuvubuNubuNuNuLLnLELKLKKKKKKKlKKKKdKSK[KKKKKKKKLLELwLLLMMPMMqMyMMMXM.MLLLtt^t|tttuttttt^t6tIIIIJ/J@JjJJjJ8JIII uXuuuuuuuuXKKdK2KK2KdKKKvvw$wvvwww8w$w$wjwVwVw8wvK2KJJJJJJHJQJzJJJKK2K)K2uv*vHvHv v>v\vzvpvvvvvvvvvvvvfvpv4v*uvuuJjJrJaJ8JIIIJJJ/JJJ@JHJrJJzJaJJJJJJJJJj+uvv v*vHvRvpvvvvvvww.wLwjw`wBwVwjwwwwwwwwwLwVw8wwvvvvvfvHvvuIHI%INIWI-I5IWIFI-I HHHHH~HHHI I-IHHI%INIIIJIIIIIIxIIIIIpIWI4>pʀ.`؁ā~`8耬p4D*DDCCCCCD!D!D\D}DDDdDdD*D*D*D!D!D*EE 8t΁ (΁t8EME$DDDDlDDDE E-EMȂ@悾D2CCCCCD*D2^CCC{ƒC0B:XCbCIC'C >fCBBBڅ BBBxBxBpBBBRzRBWB%BBFBWnxxn@@[@1@B@t@[@懪@??@~Ć g>,>========> >5>N>g?^S{?565)55356 ċċ?H?6?6?H?q???q?H(ZP???????? )e= A@@@@@@A A  ?|?b?X?v?|NNNN NNNNNNyyNNNNN NN  . 7 K ` A . NNnNYN^NiNNzN i i U i i iN:NNMMMMMMMMNN%N/N:plplot-5.10.0+dfsg/data/usaglobe.shx 644 1750 1750 1130412041320047 161760ustar andrewandrew' bfQeUf@T@28n88 8 "8^H^h@`fX@`j8888Z8!8$'^8*8-8184N878&8;b>^?J@F@pA>BBXC2hCEbEXFZXF8FGvXGIXK`KvPK8LHLR(L~0L(L0MpMpMPNNHN`NHOJPQXR8UZUpVZPVWXvZ8Z[P[H\:\8]]X^2@^vX^H__`bc>(cj@c0c8d0dRHdPdXeNXexf&fgf8jmv@n(n8o"8r^8u8x8|8N8888>8zVb8888R8888B8~8Xvx~ZNÆ8H@RPƦ*0^(NJHH"jfpn8Ϫ(0 Xf@Ъ(P*@n@ѲF8ӂ@P@^XԺVpvXHزh8ZP2@v0۪(H"Hn`HPrHݾ@"h*jH@0F(r((HHb`@ 8F8XP6 Z80p>H 8@.hF@PpR@@xVPv(8@"@f8  ~  `  p(xX0(>8z8X@VP8z@`"X~`@&8bH@(Xz8J88!8$8(:8+v ./fX/p06P0161X2>23V579J ;n<>8A8E60HjhJMzNO"P8T:PUVrXvxX`YVYZ[R[] 8`Fb8eN8hi>8lz8o8r0t&tpwVPwx>x{X{b|}86@z0hxX8.8j888"8^8888N8>8zPPhpP8@^(Pj82`jPVhp68r8ɮ pb(ΎXH6@zHP8V8В8zP@0F@Ҋ0Ҿ8`^j0R0Ն Xf0֚`HJPמPH>X68r0٦@P>pڲp&hے@X2P܆@V`ݺVhXXz@߾8868r8PJ&~0~88zp^`N@808" > x f0888N8@pBHXH 6!P!Vp!x"F"@#8#Z&f8)8,8083V86898= 8@F`BhCPCjxChDRDXE2`ExFHxI8LMN^8QRN8S`STHT`UJPUVrW^XbHYXZ 8]FP]@]_x`PbbhbxcJPce"egHg8hPhfk:kmpo.8ojop0q.@qrhr0s(s>s0tPtb8tPt0u&8ubv&hv8y{jx{p|Z|(}"@}f@}H}X~RP~` 0>`88Hf(@P*8f@8XB0vjf 0>(j0:8v(@@*0^088 0>8zP`2p2@v8plplot-5.10.0+dfsg/data/usa.shx 644 1750 1750 513412041320047 151510ustar andrewandrew' .= ףp-_Q7@GzP(\H@28n88 8 "8^8 XpZPZXbz>!n #$>&8*8-Z00h2567F9"8<^P=>@xA`AzBBCvD"E.8HjJ68Mr8PQb8T8W8[0\J]p_zP_`bac*Xce"f8iZ@i0jhk>xkXl8oR8r8u8y8|BF888868r8b8PP h:pP8>@(:P8V*`:&PzhpZ88 p(XHZ@HP>8z88P@60j@08`B0v0.X0`"HnPPHbXZ80@PbppJhö@XVPĪ@z`zhXBXǞ@88Z8Ζ8P&nJآ0ڢ88:p`r@80& 8Fbx08868r8@pfHXHZ &P zp x j @ B8 ~888>8z88!8%.8(j`*h+:P+x, h,v,X-V`-x.602x1845689:r8;`<<H= `=nP=>?@HAXB.8EjPE@FGxH2PJhJxKnPKMFMOHO8P6PPS^TUpWR8WXY0YR@Yh[0[6([b[0\2P\8\P]0]J8]^Jh^8acxd pd~e(eF@e@eHfXfvPf`g.0gb`g8h8h>Hh(h@hPiN8i@i8j Xjf0jkln.0qb(q0qr^8r(r@s @sN0s0s8s8t.0tb8tPt`uVupvV@v8plplot-5.10.0+dfsg/data/cmap1_default.pal 644 1750 1750 12011571523062 170170ustar andrewandrew6 #5500ff 0 0 #110033 44 0 #010005 50 0 #050000 50 0 #330000 56 0 #ff0000 100 0 plplot-5.10.0+dfsg/data/globe.shx 644 1750 1750 447412041320047 154570ustar andrewandrew' fQeUf@T@28n88 8 "8^H^h@`fX@`j8888Z8!8$8(8+J8.818488:8;v8>8ADEvFrFpGjH.I(J.LHLNLMXMhN^PPXQ XQf8QR&XRTfHU`VPVj8VhWHW^XW@W0X2(X^(X0X(X0Y(YJ0Y~`YpZVpZP[H[j`[H\]^X^8b*bpc*Pc~deFgR8ghjPhHi i8ijXk@kFXkHklmoRp(p:@p~0p8p0q"HqnPqXrXrzxrszt68wrzF@{({8{8.8j8888Z8888J8>8z888.8j8888ZFj6XŒ^r8RHϞ@P6к0(HfHѲfӖZ׊p8:(f0ٚX@:(fPں@@B8@VPݪ@XJpZXbHBh8nP@0:(fHH`bHPHN@vh.^H.@r0(((*HvH`&@j88XBPj.80*pH 8J@h@P>p@@:X  * P2(8@b@8:`*p> (6xX0B(n88XB@P8@`RX`@V8H@ "( NX plplot-5.10.0+dfsg/data/cmap1_blue_red.pal 644 1750 1750 6311571523062 171420ustar andrewandrewv2 hls 2 0. 240. 0.5 1.0 1. 0 1. 0. 0.5 1.0 1. 0 plplot-5.10.0+dfsg/data/cmap1_highfreq.pal 644 1750 1750 6311571523062 171560ustar andrewandrewv2 hls 2 0. 240. 0.3 0.5 1. 0 1. 240. 1.0 0.5 1. 0 plplot-5.10.0+dfsg/data/.dummy 644 1750 1750 0 7630203074 146640ustar andrewandrewplplot-5.10.0+dfsg/data/cmap0_white_bg.pal 644 1750 1750 30311571523062 171650ustar andrewandrew16 #ffffff 1.0 #ff0000 1.0 #ffff00 1.0 #00ff00 1.0 #7fffd4 1.0 #ffc0cb 1.0 #f5deb3 1.0 #bebebe 1.0 #a52a2a 1.0 #0000ff 1.0 #8a2be2 1.0 #00ffff 1.0 #40e0d0 1.0 #ff00ff 1.0 #fa8072 1.0 #000000 1.0 plplot-5.10.0+dfsg/data/usaglobe.shp 644 1750 1750 121654412041320047 162440ustar andrewandrew' fQeUf@T@8fQeUXPRdfQT@fQUe U@eQ+UdQ;U`dQ[UcQ[UcQeU@bQUU`bQ5Ub U0cU cT@cT@cT@cTPc`T cQKTb@TPbQ;T0bQ+TbQTbTcQS`cScQScSQcQSPcSPcQSQcQScQuSRc`SQcQKSc@S@cQKS cQeSbQuSbQkS@bPS@b0SRIbQSQVbQRbQRaQRQaRaQRRIaRQaR`R`R`RRY`QRQ6`R`S_Sp= ׳_QRp= ד_QR`_QR _QRp= ^QuR= ףp^PRp= ד^PRp= S^pR^R^QeRp= ד]QkR= ףp-]QkRp= ]QuR= ףpm]QR= ףpm]QRp= ]QR= ףpm\Rp= \R \R= ףp-\R\QkR[R[Rp= ד[R= ףp-[QR [QR`[R`[Rp= [R[QR [QRZQRZQR ZQR ZQR= ףpYQRp= SYRYRXRp= SYQR= ףp-YR`YpR`Y`RYQeR8YpRףp= WLOdYQeRXQ[RYQERp= SYPRY0Rp= SYQ+R`Y@RQXQ;RXQURXQER`XQ[R`XpRQXpRXQ[RXQER`XQ;RX RQXQ R@YQQQXQQXR@XQQQWQRQWQRWQ%RW0RVQ;R0VQ;RUQ;R`UQERQUQ;RTQ5RPTQ;RS@RSPRQSQ5RSQR SQ%RRQ5RR@RR`R@RQ[RQQURQQKR QQERPQ5RPQRPQQPQPQQQQQ QQ QQ[QQPQ[QQPQEQQPQ5QQP QQPQQPPPQP QPPQPQUQQPQ+QQPQPQPQPQPPPQPQPQPQP`PQPQuPP@PQ{PP`PPQEPOQKPףp= WO0Pףp= NQ+PNPNPףp= MQOQkMQOMQOףp= LOףp= WLQOQLQOףp= MQOLQOQLQPףp= MQPףp= WMPM Pףp= MQP@NQ+PQN@POQ[Pףp= OpPQ+OQPףp= WOPOPPP8QPQSRQ)@PdPPףp= OQPQ+PQPQUPQP`PQPQ5PQQQUPQQQ5P0Qףp= O0Qףp= WOQEQQ+OQkQOQQNQQףp= NQQNQQQkNQQףp= NRQkNQRNQ+RQM@Rףp= NQURNQ[RNpRףp= WNQRףp= NQRףp= NQROQROQRףp= OQS`P SQP@S@PQKS@OQESNQESףp= LPSLQeSףp= JQ{Sףp= ISQHSףp= GSFQSDQS@CSQ+BQSAQuSQ@`SGz?QKS>Q5Sףp= W< S;QS:QR8QRGz7Rףp= W6QRGz4QRףp= W3pRGz1Q[Rףp= W0QERףp= W-Q;R+Q5RGz(Q%RGz&Rףp= W&QQ(QQףp= W(QQ'Q&QQ%Q#Q"QQףp= W!QQ!QQ\(\QQGzQQ\(\QQGzQQ\(\Q\(\Q\(\QQQQQQQQQ QQQzGQQQQQ(\QQHzG?Q\(\@QQ @QQp= ף@QQRQ@QQRQ@QQRQ!@QQ$@QQ)\&@QQRQ)@QQ8RQ)@QQY@QuPdRQ)@QQ)\,@QQRQ/@QQ1@QQGzT2@QQ4@QQ5@QQ7@QQQ8@QQGzT9@QQ;@QQGzT<@Q{Q>@QuQGzT?@QeQ@@`Q@@`Q ףp=@@@Q@@Q+Q ףp=*A@Q%QA@Q;QB@QUQB@`Q ףp=*C@QeQ(\UC@QQ ףp=C@QkQ ףp=C@`Q ףp=C@QKQD@Q5Q ףp=D@ QE@Q Q ףp=E@QP@F@PG@PG@QP(\H@QP@H@QP ףp=H@QP ףp=H@QP@I@QP(\I@P@I@PI@P(\J@Q{P(\J@QuP(\•K@Q{PL@P(\•L@QP(\•L@QP ףp=*L@PL@QPM@PM@QP ףp=M@P(\UN@QP(\N@QP(\UO@QP(\O@P@P@QPGzP@P{GP@QP{G*Q@QP`Q@QP`Q@Q QQ@Q%QQ@@Q`Q@QKQGztQ@QeQGztQ@QQ{GQ@Q{GQ@QQQ@QQGzR@pQ`R@QeQR@QkQR@QuQ{G S@`Q{GJS@QKQS@QEQGzS@ QS@Q T@Q{GjT@QPT@QP{GT@QP@U@PGzU@QP{GU@QP V@P{GjV@PV@QPW@P@W@QPW@QPW@PX@QP@X@P{GjX@QPX@PGzX@QPY@QP8Y@QUS`e@pPdY@QP,Y@QP`Y@QP̬Y@QuPZ@Q{P@Z@QPZ@PZ@P[@QP@[@QP`[@QP33333[@QP̬[@QP̬[@QP[@Q{P,\@QuPl\@pP\@P\@QP ]@Pl]@P]@QP33333^@QP`^@QP^@QP33333^@P33333_@P333333_@P33333s_@QP_@P_@P_@P `@QP `@P0`@QP@`@QP@`@QPY`@QP`@QP`@QP`@QP`@QP a@QP)a@QPIa@Pia@QPa@QPa@Pa@Pa@QP b@P b@P b@QP@b@PYb@QP`b@Qb@QQb@Qb@ Qb@QQb@Q+Qfffffc@Q%QIc@Q%Q`c@QEQc@QUQc@@Qc@QEQfffffc@PQd@`Q d@QkQ d@QQfffff&d@Qfffff6d@QQfffffFd@QQId@QQid@QQffffffd@QQfffffd@QQd@Qd@QQfffffe@QQ@e@QfffffFe@QQ`e@QfffffFe@RPe@ Rfffff6e@Q5Re@QKRd@PRd@QkRfffffd@QRd@QRd@Rd@QR`d@QRfffffVd@QRfffffVd@QS`d@ Sid@Q;Sfffffvd@QUSd@QTf@QUSfffffvd@QUSfffffvd@pSfffffd@Sd@QSd@S0d@Sd@QSd@QSd@T d@ T d@@T d@`TId@Q{Td@QTd@QTe@Tpe@Tf@Tf@QTHd@QkSfffff6e@QESd@QeSfffffe@QkSfffff6e@Q[Sfffffe@QUSfffffd@QESd@QeShdTdS dS`dQSQvdQSQvdQSQ6dTdQSdSQdQSQ6dSdS @Qb0SQfbQ SQbQ%Sb0SQfbQSQbQ SQbQ%S  SQ+RQQQ5QQ SQQ SQQSQQRQQQRQ RQURR@RQ%RQQ+RQQ%RQ5QQR QQQQQQ QQQ5QQQUQQQkQQ[QQQQ5QQQQ;QQQQEQQQeQQQQQQQQQQQQQQQ@RQQRQQQ SQQ `Q SQQQkRpQ Q SQQRQQRQpRQQkRQ{QRpQRQQRQQ SQQ XQPQ5POPQPQ+POQ5POQ%POQP@OPOQ%POPQPQ+P @@LOKO@LOLOKףp= OQKO@LO`N`Oףp= LO Nףp= WOQ+N`OQMQ+Oףp= WM Oףp= LOQkMOQMQ+OQ+N@ONףp= WO8Q+G{GZNFQ+NQ+GRQNF{GZNGQ+NQ+GRQN8QUTQKDQQdQT T(\տ TzGQ;T0TzG0Tq= ףpQ;TQQ%TQ TQTQSQSQTQ QT fffffTGz Q5TQQUTQUTGzQKTGzQ5TGzQKTQ5TQTT\(\QSS\(\Sףp= W QSףp= W!Sףp= W"QSףp= W#QSףp= W$QkSGz%`SGz&QKSGz'@Sףp= W(Q+S) S*Q Sףp= W+Sףp= W,QRףp= W-R.QRGz.R/RGz/`R@0Q5Rףp= 0 RGz0R1Q@1QQGz1QQףp= 1QQ@2QQ\(2QQ2Qףp= W3QQ4QQ4QQ5QQ5QQ6Q6Q7Q7Q8QQ8Q9QGzn9Q9QQףp= W:QQ;QQ;QQ<Q<Q=QQףp= W=Q>QQ@>QQ>QQףp= W?Qףp= ?Qףp= @QQ@@QQףp= @QQףp= @QQAQQ@AQ RA RAQ+RBQ5R@BQERףp= WBQERףp= B`Rףp= BQkRBQ[Rףp= CQ[RQKCQURCPRCQkRDQkRQKD8QRQJQkPQKDdQkRQKDQuRDpRףp= DQeRDQKRQD@RD Rףp= D0RE Rףp= E0RQ+E0RE@Rףp= EQ5REQKRףp= F@Rףp= 7FQ[Rףp= WFQURFQeRFQkRףp= FQuRFQeRףp= WFQkRףp= 7F`Rףp= FQuRQERףp= FRQKFQRFRFQRQFRQFRףp= FRףp= GRQKGRףp= wGRףp= WGRQkGRQkGQRףp= GRQGRQ+HQRGQRQGQRףp= HQRQKHQRףp= HQRףp= HRQHRףp= HQRףp= IQR`IRIQRףp= 7IR`IQRףp= WIRףp= IQRQIRQIQRIQRIQRQIRIR JRףp= 7JQRףp= JRQKJ`Rףp= WJ`Rףp= wJQKRףp= J Rףp= JRףp= JQ`JQQQkJQQףp= JRףp= JRףp= JQQJQQJQQJQ`JQ@JQeQ@J`Q J@Q JR!Q)\(JQQQ+JQ5QQI@Qףp= IQKQI@Q@I Qףp= IQPIQPHPHPףp= WHQPQ+HQuPHQkPGpPףp= GPףp= GPQkG8PQkGD@6dPQkGQP@GPGQPFQPFQPFQePFQePףp= WFQKP@FQKPFPPףp= E@PQEQPE@PQkE P@EQ PQkEףp= OQkEQOQKEOQ E PQ+E@PQ E@PDQKPDQ5P`DQPDQOףp= DOףp= DQ+Oףp= wD OQKDףp= 7OQ+Dףp= OQCOCQ+Oףp= C O`COCNC@Nףp= wCNQkCQM`Cףp= WMQKCףp= Mףp= 7CQLףp= Cףp= LBLQBףp= WLQkB`LQ+Bףp= L Bףp= LQAףp= LQALAQ+Mףp= WA@MQ+AQ+MA)\(Mp= AQLףp= 7Aףp= Lףp= 7AQkLףp= WA LQkAףp= K`AKQkA@K`AK@AQJףp= AJQ@GzJp= @J@QKJ@ףp= 7J@@Jףp= @Iףp= ?I?ףp= WI?Q+I>ףp= I>QH=ףp= H=HGz<`H@]GzT>@= ףp\@>@= ףp\Q=@= ףp\=@= ףp\Gz=@p= ד\<@\Qk<@\<@ ףp=\;@\Gz;@\;@p= ד\Q+;@\;@ףp= g\:@= ףpM\:@p= 3\Qk:@p= \Q+:@ףp= \Q9@ףp= \Q+9@p= \Gz8@= ףp[Gz8@p= [@8@p= ׳[Gz7@p= ד[7@[Gz6@ ףp=Z[GzT7@= ףpm[7@= ףp[@8@ףp= [@8@p= ׳[Q8@= ףp[Gz8@[Q+9@[9@p= [:@[:@\;@p= \;@= ףp-\Gz;@ ףp=:\GzT<@= ףpM\<@= ףpm\Q+=@\Gz=@ ףp=\Gz=@= ףp\Q+>@ףp= \Gz>@= ףp\?@p= ׳\Qk?@= ףp\?@= ףp\?@p= s\Gz?@`\GzT?@ףp= G\Q+?@ףp= G\>@p= 3\@>@= ףp-\Q=@ ףp=\=@= ףp \=@= ףp[<@= ףp[<@ףp= [Q;@ףp= [Qk;@[;@= ףpm[Q:@`[Q:@p= S[GzT:@ ףp=Z[:@ ףp=Z[9@@[9@p= [@9@[Q8@ףp= ZGzT8@= ףpZ8@p= ׳Z7@ ףp=ZQ+7@Z6@= ףpmZQk6@`Z5@= ףpMZ5@= ףpMZQ+5@`ZGz4@p= SZGz4@= ףpmZGzT4@p= SZGz3@ ףp=:ZGzT3@p= ZGz3@p= Y2@YGzT2@p= ׳YGz2@= ףpY2@Y2@ףp= gYQ1@@Y@1@ YGz1@YQ0@YQKSQ0@\YQ0@XQ0@XGz0@XGzT0@XGz0@Q[X0@Q5X)\/@XRQ/@QWR/@QWQ+0@QWQ+0@WGz0@QuWR/@Q[WRQ/@QKWR.@0W.@QWRQ-@\( W-@W)\,@V)\(,@VR+@VR+@\(V+@VRQ+@pVR*@QUVR*@Q5VRQ*@QVRQ*@QURQ*@\(UR*@QUR*@QU*@ףp= U*@QU*@QU)\()@U(@QU)\'@QU'@pURQ&@pUQ8&@pU%@QuU)\$@QkUR#@QUU)\#@QKURQ#@Q5U$@Q%URQ#@U)\"@QT"@T!@TR @Tףp= W @TRQ @T)\ @T @pT)\( @`T@@T@Q;Tp= ף@ T@T@QTRQ@ TRQ @QT)\ @S)\(!@S"@QS"@S!@S)\ @QS)\ @QS @QSp= ף@33333SQ@pS@Q[SRQ@`Sp= ף@Q[S@Q[S@QUS@`S@QKS\(\ @`S @pS\(\@QS\(\@QS\(\@QS?SQ?QS?fffffSףp= ?QS?Tq= ףp?QTףp= G_Gz4P@= ףpm]GzP@ףp= G_GzP@ףp= ^QP@^P@@^P@^pP@p= ׳^GzdP@= ףp^@P@p= s^@P@ףp= g^GzTP@= ףp-^{GjP@ ^GzTP@@^Gz4P@p= ]HzWP@^GztP@ ףp=]{GjP@ףp= ]GzP@= ףpm]{GP@ףp= ]GzP@ ^{GP@p= ]{GP@ ףp=]{GP@^GzP@p= S^P@= ףp^GzP@p= ^HzP@ףp= G_GzP@@] ףp=jN@@[ ףp=jO@@](\•N@] ףp=jN@p= \ ףp=jN@ ףp=\N@ ףp=z\(\uN@= ףpm\N@ ףp=:\(\µN@= ףp \ ףp=N@p= [ ףp= O@ ףp=[ ףp=*O@p= s[(\5O@= ףp[(\UO@@[(\UO@[ ףp=jO@= ףp[ ףp=jO@ףp= [(\UO@ ףp=[(\5O@ ףp=\ ףp= O@ףp= G\O@p= s\(\O@= ףp\(\5O@p= \(\5O@ףp= \(\O@\ ףp=N@p= \N@p= \(\µN@p= \(\•N@@](\•N@ p= [ ףp=JM@ ףp=Z(\M@ p= [(\UM@p= ד[ ףp=JM@[(\uM@p= S[ ףp=M@p= [ ףp=M@ ףp=ZM@[(\µM@ףp= '[(\µM@= ףpM[(\M@= ףpm[(\M@= ףp[M@= ףp[M@p= [(\UM@!pףp= Y ףp=*L@ףp= gY(\M@ ףp= Y ףp=*L@= ףpY ףp=JL@= ףpYL@= ףpY(\µL@ףp= gY(\L@ףp= Y(\M@YL@p= ׳Y(\µL@YL@p= ׳Y(\UL@ףp= Y ףp=*L@"X ףp=*I@Q XJ@X ףp=J@QXJ@QX@J@QX J@QX(\I@Q[X(\I@QUX(\µI@Q5X ףp=I@Q;X(\•I@@X`I@@X ףp=*I@QX@I@Q X(\•I@Q%X ףp=I@@X(\J@PX(\UJ@QeX(\•J@QuX(\J@QXJ@XJ@X ףp=J@#= ףpMY(\I@X ףp=J@= ףpMY ףp=J@p= 3Y ףp=JJ@ ףp=Y ףp=jJ@Y ףp=JJ@= ףp Y ףp=*J@= ףp Y ףp=I@QX ףp=I@X(\•I@X ףp=jI@QX@I@X(\I@X I@X(\UI@QX(\uI@QXI@QX(\I@QXI@QX ףp=I@QX(\J@QX(\5J@QX`J@= ףp Y ףp=J@= ףpMY ףp=J@$XVq= ףpQV{Gz?QV{Gz?VQۿQV(\V(\QVq= ףpQV迅QV(\տQV{Gz?%hQRףp= EQURQD RQDQRQ+EQRףp= WEQRQEpRףp= E`REQkRףp= WEQURQ+EQ[RERQD&QRףp= KQKPQKJ50QQKJzG1QQKJQKQףp= WJ`QQKJpQQkJQQkJQQQJQQJQ[QQJQUQJQQJQ KQQףp= KQףp= JQףp= KQQKQRQJ RQJQURJRJQR`JRJRJ`RQJQuRQJQURQJQURQ KQ+RQ K Rףp= 7KRףp= 7KRףp= WKQQKQףp= KQKQuQQKQUQKQ+Qףp= KQףp= KQ QKQ QKQPKPKQkPKPPףp= wKQKPףp= WKQuPףp= WKQP@KP KQPKQףp= JQ QQJQJ0QQKJ'ףp= NQ+JLQIףp= NQI@N JNJףp= MQ JMQ+JQkM J@MJLQILIQ+MQIMIףp= MQI@Nףp= Iףp= NI@NJףp= NQI(XCףp= wKQAKCKB KQKB@KBףp= wKQAQKK BQ+KBQ KCK)XQN$@N%@QN$@N$@N$@N%@ףp= NRQ%@N)\(%@NRQ$@QN$@*8)\HQp= #(@p= 3Q33333(@)\HQ33333(@p= 3Qp= #(@ ףp=:Qffffff(@)\HQ33333(@+QS1@S2@ QSQ+2@SQ+2@QkSGz1@PS1@Q;SQ1@Q%SGz1@SGz1@QSQ+2@Q5SGzT2@QUSQk2@QuS2@SGzT2@QSQ+2@,XQTQk5@T{G5@QT(\5@= ףpT5@p= TQx5@QTQk5@THz5@ ףp=TR5@QT{G5@QT(\5@-Q5UGz3@QRQ+7@9Q5UGz5@Q UGz5@UQ+6@QTQ+6@QTQk6@TQ6@TGz6@QeT6@QTGzT6@pTGz6@PT6@ T6@Q T5@SQ5@S5@SGz5@QSQk5@S5@SQ4@PSQ4@QESGzT4@Q[SGz4@QkSGz3@@SGz3@ SQ3@SQ3@RGz3@RGz3@QR4@QRGz4@R@4@R@4@QRGz4@QRQ4@QRGz4@QR5@SGz5@ SQ+5@@S5@Q[SQ5@QuSQ5@QSQ+6@QSGzT6@QSGzT6@QSQ6@QTGz6@ T7@@T7@`TQ+7@TQ+7@T7@TQ6@TGz6@UGz6@QUGzT6@QU6@Q5UGz5@.XRGz1@QQQ3@(RGzT2@QuR2@QkRQ+2@QKRQ+2@0RGz2@QRQ+2@QQGz2@p= Q 2@QQGz1@QQ2@QQ@2@QQQk2@QQQ+2@QQ@2@`QQk2@@QQk2@Q+QGz2@QQ2@0QQ2@QeQGz3@QKQGzT3@pQGzT3@Q{QQ3@Q3@QGz3@QQGz3@p= Q(\3@RQ3@Q%RQ3@QKRQ3@`RQ3@@RQ3@0RGzT3@0R3@QRGz2@0RGzT2@PRGzT2@QkR2@QRGz2@RGzT2@/`QPQ1@QkP2@ QP2@PQ1@QP2@Q{P2@QkP@2@P2@QP2@QP2@QP2@0PQNR/@QNQk0@QN@0@NR/@QNQ+0@QNQ+0@NQk0@QNQ+0@QN@0@18ףp= N(\,@QkN)\-@ףp= N)\-@QkN(\,@GztNL-@ףp= N)\-@2HQkRQ4@@RGzT5@QkRQ4@QKRQ4@@RGzT5@QKRGz5@`RQ+5@QkRQ4@3(p= RQ6@QRQ7@p= RQ7@QRQ6@40QR3333336@QuRGz6@QRGz6@QuRR6@= ףpR3333336@5()\HRGzT6@(\/RQk6@)\HRQk6@(\/RGzT6@60GzRQ5@GzQfffff5@GzRQ5@ףp= Rfffff5@GzQQ5@7pQP ףp=H@ףp= N ףp=H@ QP ףp=H@O ףp=H@O ףp=H@ףp= wO(\•H@ O ףp=H@ףp= N ףp=H@O(\µH@@O ףp=H@QOH@O ףp=H@QP ףp=H@8pP(\F@O(\uG@ P(\UG@ףp= O(\5G@QO(\G@@O(\F@@O G@O@G@`O(\5G@QO(\5G@ףp= O ףp=JG@P(\uG@P(\UG@9PQT(\O@Q{T`O@QT(\O@QT O@Q{T(\UO@Q{T`O@QT`O@QT ףp=JO@QT(\O@:HQ TN@S ףp=*O@QT ףp=*O@Q TN@SN@QS(\N@S ףp=*O@QT ףp=*O@;`QTK@QS ףp=JL@ T L@QS ףp=*L@QT(\K@S(\K@QS(\L@QSK@QS ףp=*L@QS ףp=JL@T L@<HT(\UJ@0T(\•J@TJ@Q[T ףp=jJ@0T(\UJ@@T ףp=J@Q[T(\•J@TJ@=QM(\UG@`J ףp=I@3QM(\G@ףp= MG@ףp= 7M(\G@QL ףp=G@QkL ףp=G@Q L ףp=G@ףp= KG@ףp= K(\•G@ףp= K(\uG@QK ףp=jG@QkK ףp=G@ףp= 7K(\µG@ףp= J ףp=G@ףp= K ףp=jG@ףp= J ףp=G@ףp= J(\UG@QJ(\UG@ףp= wJ(\•G@`J(\G@J ףp=G@J ףp= H@QJH@ףp= J ףp=G@ףp= JG@J ףp= H@J ףp=JH@J@H@K ףp=jH@JH@K(\µH@ףp= WK(\µH@QK ףp=H@ףp= K(\H@K(\H@Q L ףp= I@QkLH@@L I@ףp= L ףp=JI@K ףp=I@K ףp=I@L ףp=I@ףp= WL ףp=I@LI@L ףp=JI@ףp= L ףp= I@ףp= LH@ףp= 7MH@`M ףp=JH@ףp= 7M@H@ףp= wM(\H@QM(\G@>QU(\•O@TGzP@QU(\O@QuU(\O@pU(\•O@Q5UO@Q U(\O@QTP@QTP@TO@QKT(\µO@T ףp=O@PTGzP@pT P@TGz4P@QT{GJP@Q+UGzdP@@UGzP@U{GjP@UPP@QU{G*P@QUGzP@QU(\O@?XPS{GP@QRQ@PS{GP@Q5S{GP@QRP@RP@QR{GP@QRQ@ SQ@PS{GP@@8V(\N@ףp= NGztR@dVQ@@VGzQ@VGzQ@QU{GQ@pUGzQ@QUGzQ@QT{GzQ@QUTQ@QSGzdQ@SpQ@QSQ@`SGztQ@QRGzTQ@Q S{G*Q@R@Q@R Q@@R{G Q@Q+R{GP@QRP@@R{GP@pRP@QR{GP@QkR{GjP@QRGzTP@SGzTP@`S`P@QkS{GJP@SGzDP@QS{G*P@SP@ SP@R P@QR{GP@QkR{G P@0RP@QQO@QQ ףp=O@QQO@QQ ףp=jO@QUQ(\UO@@Q(\5O@QQ(\O@QPO@QP(\N@QP ףp=*O@QP(\UO@P ףp=O@ Q(\µO@Q;Q ףp=O@P ףp=O@QPO@pP(\uO@ P(\uO@P ףp=O@@PP@QEP P@pPGz4P@QPPP@QPpP@QP{GP@`P{GzP@@PGzTP@QO@P@O`P@Q+O{GjP@Q OGzP@ףp= N{GP@ףp= OP@ףp= OGzP@P{GP@QKPGzQ@PGzQ@QQ Q@QQ@Q@P{GJQ@QPGzdQ@PQ@QQQ@pQGzQ@Q{GQ@QR{GQ@RQ@RR@QRGz$R@R R@Q5S,R@QuS333333R@S= ףpR@Q T= ףpR@QKT{G R@Q5T{G*R@`TQHR@QKTGzdR@QkTGztR@QTpR@QU{GZR@`U@R@QeU R@QkUGzR@QUU{GQ@AV{GQ@UGztR@QUU{GQ@QUR@QU{GR@UGz4R@QUPR@`URaR@U33333sR@Q[UGztR@UGztR@VGzdR@QEV{GJR@QeV0R@VGzR@VQ@BpQ5TGz4R@QSGztR@ TpR@Q5T{GZR@ TQ>R@QSGz4R@QSQ>R@Q%SHz7R@QS{GJR@0SGzdR@QuSRqR@SGztR@ TpR@CPQ%X{GR@pW33333R@Q%XR@QWGzR@pW{GR@pWR@W33333R@QW33333R@Q%XR@DX{GR@QSRAS@Q XRAS@X{G*S@QWS@PWGzS@Q WGzS@QV{GR@Q WR@WR@VRR@Q V= ףpR@U{GR@0U{GR@QTR@QTR@QT{GR@QSGzR@QS= ףpR@QeT= ףpR@QT= ףpR@Q5UGzR@UGzR@0VR@QVQR@QkV{G S@VHzS@V)S@@W)S@QW{G:S@Q XRAS@EW{GS@Q{UPT@WT@QuW= ףpS@QKWGzS@QkWQS@QUWRS@W{GS@PV{GS@QVRS@US@Q{US@Q{UQS@QUS@QU{G T@V{GT@V T@QV333333T@WPT@QeWPT@pW333333T@WT@WT@FV{G S@ףp= NGzT@>V`T@V@T@V{G*T@`U{G*T@T333333T@Q+T333333T@QkS{G:T@QSQ(T@T= ףpT@QTT@QuU{GT@QUHzS@QKUS@QKUS@Q%UHzS@US@QU{GS@QeU{GzS@VGztS@V{GZS@UPS@Q VQHS@`VGz4S@`V{GS@UGzS@QKUS@U{GS@QTGzS@QeT S@@T{G S@S{GS@pSGz4S@SPS@QkSGzdS@S{GzS@QRS@RS@RS@RS@Q= ףpS@Q T@Q5QGz$T@PR@= ףp-_ R@= ףpM_GzR@V(d@(\UK@fffffd@K@d@K@fffffd@(\UK@W@e@`J@e@J@e@(\uJ@̜e@`J@e@ ףp=jJ@e@J@e@(\uJ@X0QFf ףp=I@R9f(\I@QFf(\I@R9fp= I@QCf ףp=I@Y8Qf(\I@R f(\I@Qf(\I@R fI@Rf(\I@Qf(\I@Z0Re ףp= J@Qe(\5J@Re ףp= J@Re(\J@Qe(\5J@[HQ&e`J@e ףp=J@Q&e`J@R e(\•J@e ףp=J@e ףp=J@eJ@Q&e`J@\PQd ףp=J@QdK@Qd ףp=J@dJ@QdJ@QdK@QdK@Qd(\J@Qd ףp=J@]XRye ףp=O@Re(\O@Rye(\O@Rye ףp=O@RYe(\µO@R9e ףp=O@Re ףp=O@R9e(\µO@Pe(\O@Rye(\O@^XQd ףp=M@d ףp=*N@Qd(\N@Rd(\M@Qd ףp=M@dN@d N@Qd ףp=*N@Qd N@Qd(\N@_xRYc`L@Qc(\5M@ RYcL@QCc`L@Q-cL@Q#c ףp=L@QcL@c ףp=L@ c(\L@Qc(\M@c(\5M@Q&c ףp= M@Q=cL@RYcL@`Q`J@``(\K@ Q`(\K@` ףp=J@` ףp=J@R` ףp=jJ@Ry`(\5J@``J@Ri`@J@Ry``J@Qv` ףp=J@` ףp=J@Qv` ףp= K@R` ףp= K@Q`(\K@aR ` ףp=*H@= ףp^ ףp=jI@R `(\UI@p= _(\I@ףp= _(\H@ ףp=_(\H@_(\µH@ ףp=z_H@`_H@@_H@@_`H@p= _@H@= ףp^ ףp=*H@= ףp^@H@= ףp^(\uH@ ףp=_ ףp=H@@_H@`_ I@= ףp_(\5I@= ףp_ ףp=JI@ ףp=_ ףp=jI@R `(\UI@b8@R ףp=M@6{GS@d@R{GS@QQHzwS@QQ{GzS@QGzdS@QQfffffVS@QPS@QQzGAS@Q333333S@0Qfffff&S@`QQS@ QQS@QP{GR@QUPQS@ףp= O{G S@ףp= N{G S@NGzR@Q+M{GR@Q+MGzR@L= ףpR@@LR@@LR@ףp= KGzdR@K{GJR@QKGz$R@QK{G R@KQQ@K{GQ@K{GQ@QJQ@`J{GQ@QIQ@IQ@QkJ33333Q@ KGzQ@QKKQ@QkK{GjQ@ףp= J33333SQ@ףp= J= ףp]Q@I{GzQ@`IGzTQ@IGz$Q@QKJGz$Q@QJ{G Q@ףp= JGzP@JP@JP@JP@ףp= 7J`P@J{G:P@JGzP@QIP@I ףp=O@Q+I ףp=jO@Q I@O@H(\N@H(\µN@H ףp=jN@ףp= WG`N@F ףp=JN@ףp= F(\N@ףp= E ףp=M@EN@QkE@N@`EN@@EN@EO@ףp= 7E(\UO@DO@`DO@@DP@ףp= 7D P@D{GJP@DGzDP@ףp= C`P@@C{GjP@B{GjP@ףp= AP@`AGzP@ףp= @{GP@ףp= @GzP@@P@ףp= @{GP@ףp= W?{G Q@>{G Q@<{GQ@;Gz$Q@@:Gz4Q@@9GzDQ@@8{GZQ@Gz.7pQ@6GzQ@7{GQ@ףp= 9{GQ@ףp= W:{GQ@ףp= W:{GQ@@9{GQ@9{GQ@8GzQ@@8Q@8GzQ@c@R{GQ@ףp= W'T@W8GzQ@ףp= 7{GQ@ףp= 5Q@5Q@5{GQ@ףp= 6GzQ@Gz7{G R@ףp= 8 R@ףp= W733333R@6GzR@5{GR@6{G:R@733333CR@Gz.6PR@ףp= 5{GZR@ףp= W4= ףp]R@ףp= W4GztR@5R@@3R@ףp= 2{GR@ףp= 4{GR@Gzn3R@Gzn3R@4 S@533333S@Gzn5{G*S@ףp= W4{G:S@Gzn20S@Gz.2GzDS@ףp= 2GzdS@Gz3{GzS@Gz.3{GS@3GzS@2QS@ףp= 2RS@Gz.1= ףpS@Gz/{GT@Gz,0T@ףp= W'GzTT@*QkT@Gzn033333sT@Gz.2Q^T@3GzdT@4GzTT@6GzDT@ףp= 8{G:T@Gz7HzWT@6QhT@ףp= W533333sT@Gz5GzT@Gz7RT@Gz7pT@ףp= W9QkT@ףp= W9GzT@ףp= =GzT@@<T@ףp= 9= ףpT@Gz.6GzT@4GzT@Gz5fffffT@8QT@ףp= 8T@ףp= W;33333T@?GzT@BT@C{GT@FT@@GGzT@QG{GT@@I= ףpT@IT@@KGzT@QMGzT@OpT@N{GZT@QNQHT@OQKT@@P{G:T@PR!T@QPGzT@@PGzT@ PS@QkPS@Q+QzGS@QQS@QRGzS@@R{GS@d@ףp= W8(\µO@ףp= W+P@%ףp= W8`P@ףp= 7{GZP@6GzdP@ףp= 6{GZP@ףp= 6GzDP@80P@ףp= 60P@6P@6 ףp=O@5 ףp=O@4 ףp=O@2(\µO@Gz1O@0 ףp=O@Gz/{G P@-{GP@ףp= W+{G:P@ףp= W+`P@ףp= W-pP@-GzP@ףp= W/P@@0P@ףp= 0{GP@ףp= 1P@@2{GP@@3GzP@Gz3GztP@@4GzP@ףp= W4GzdP@Gzn5{GZP@5P@@6GzP@7{GP@7{GP@Gz7{GP@7GztP@ףp= W8`P@e("GzQ@ {GQ@"GzQ@ {GQ@f8ףp= 2R@Gz1R@ףp= 2R@ףp= 2R@Gz133333R@ףp= 2R@g8!@`A:@d)\"@"@!@zG"@q= ףpRQ"@q= ףp#@)\#@)\$@QRQ%@q= ףp &@Qk&@Gz)\&@\(\)\('@R'@Gz ףp= (@RQRQ(@\(\RQ(@Qk(@HzG)\(@= ףp(@QR(@GzRQ)@R)@*@*@ףp= W R*@ףp= W!*@ףp= W"RQ*@ףp= ")\*@ףp= #)\(+@Gz$)\+@ףp= W%R+@&)\+@Gz'RQ+@(R*@ףp= W)*@ףp= )RQ)@Gz*)@ףp= +)\(@-RQ(@.)\((@/)\'@0)\'@0'@1'@Gz.1'@Gzn1)\'@Gz1)\((@2R(@ףp= 2RQ)@@3R)@3*@@4R*@ףp= 4+@@5R+@Gz5)\,@ףp= 6-@6R,@Gz6-@7-@8)\(-@Gzn8)\-@9)\-@9R-@Gz9)\(.@Gzn:.@;)\.@;RQ/@ףp= ;R/@@GzT1@ףp= >Gz1@?Q1@Gzn?@2@@GzT2@QK@Gz2@Qk@Gz1@Qk@@2@ףp= @Qk2@Q@Qk2@ A2@Q AQ+3@ףp= 7AGz3@`AQ+4@`A4@@AGz5@ףp= 7A5@ףp= 7AGz6@ףp= AQ6@Q A@7@ףp= AQ7@A@8@ףp= A8@ AGz9@A9@A:@@h8:@@G@@d:@@Gz:@@Gz;@ףp= @;@Q@Gz<@@<@`@Gz<@ףp= 7@@=@@Gz=@Gz?>@ףp= W?Qk>@Gz>Q>@>Q>@>@?@ףp= =?@Gz.=@@ףp= <(\5@@ףp= < ףp=J@@ףp= <`@@;(\u@@;(\u@@ ףp=:(\u@@ףp= :(\u@@@: ףp=J@@ףp= :(\u@@9(\µ@@ףp= W9@@Gz.9(\5A@Gz8(\uA@8A@8A@8(\µA@7A@ףp= 7A@6 ףp=A@ףp= 6(\•A@Gzn5A@ףp= 4(\UA@4`A@4(\•A@Gz3A@Gzn3 ףp=A@3 B@ףp= 2(\UB@ףp= W2B@Gz1 ףp=B@1 ףp=B@ףp= W1 C@Gz.1(\uC@ףp= 1C@0C@ףp= W0 ףp= D@0(\5D@Gz./(\UD@ףp= W.`D@ףp= W- ףp=JD@Gz., ףp=JD@Gz.+(\5D@*@D@ףp= (@D@((\5D@'@D@&@D@%@D@%(\D@ףp= W$ ףp=C@ףp= #(\C@ףp= "(\µC@Gz! ףp=C@ףp= W ףp=C@\(\ ףp=C@\(\(\•C@\(\`C@\(\(\uC@\(\ ףp=C@\(\zGC@Q ףp=C@\(\ ףp=C@Gz(\C@Q D@ D@q= ףp(\UD@ ףp=D@QD@HzD@= ףp=D@ ףp= E@(\(\5E@Qۿ(\uE@(\•E@zG? ףp=E@?F@?(\5F@Q? ףp=jF@? ףp=F@Q?F@@(\G@p= ף@@G@@(\uG@\(\ @G@@i8 ףp=*@@@(\•I@>@dG@@(\G@p= ף@(\G@RQ@(\H@RQ@@H@p= ף@(\uH@@ ףp=H@RQ@H@@H@@H@p= ף@(\H@RQ @(\I@!@(\5I@R!@`I@R"@`I@$@I@R$@ ףp=I@&@(\•I@'@ ףp=JI@R'@(\I@'@ ףp=H@)\&@H@RQ&@@H@&@H@)\(&@(\µG@)\(&@ ףp=jG@%@ ףp=*G@RQ%@F@%@F@%@`F@)\$@ F@R$@(\E@RQ%@ ףp=E@)\(&@E@R&@(\•E@(\&@(\uE@RQ'@(\µE@R'@E@R(@33333sE@)@ ףp=jE@)\)@(\5E@*@ ףp= E@RQ+@ ףp=D@)\(,@(\•D@)\(-@(\UD@-@ ףp= D@.@ ףp=C@/@C@)\(/@C@0@(\•C@0@ ףp=C@Gz1@ ףp=jC@Gz1@ ףp=JC@2@(\BC@ 2@ ףp= C@Qk2@ ףp=B@Q2@ ףp=B@@3@B@Q3@(\•B@@4@B@4@B@Gz5@(\uB@5@(\uB@(\5@(\uB@Gz6@ ףp=JB@@6@(\B@6@ ףp=A@6@ ףp=A@@7@A@Gz7@ ףp=A@8@A@GzT8@A@Gz8@`A@@9@@A@9@ ףp=*A@Q+:@A@Q:@(\@@Gz;@(\@@Qk;@ ףp=@@Gz;@@@Q+<@(\u@@Gz<@(\U@@=@ ףp=J@@Qk=@ ףp=*@@Gz=@ ףp=J@@>@`@@Gz=@@@Gz=@@@<@(\µ@@Qk<@@@Gz<@(\A@;@(\5A@Q;@(\5A@GzT<@(\UA@Q<@A@=@A@=@ ףp=jA@<@(\UA@<@(\•A@<@A@Gz;@j8A@RQ)@ ףp=M@Gz;@dA@Gz;@A@Q+;@ ףp= B@Q:@(\5B@Q+:@`B@Gz9@ ףp=B@GzT9@B@Gz8@B@GzT8@C@Gz8@(\5C@7@`C@@7@C@6@ ףp=C@@6@C@Q5@ ףp=C@5@(\•C@Q4@C@Gz4@(\C@@4@ ףp=*D@Gz4@`D@Q3@D@Q+3@D@Q2@D@Q+2@D@1@ ףp= E@1@(\5E@1@(\UE@0@YE@\(\0@`E@Gz0@(\UE@RQ/@`E@RQ.@(\uE@)\(-@ ףp=E@,@E@+@(\•E@*@E@)@(\E@)@(\E@RQ)@(\5F@)@(\uF@)\)@(\µF@*@(\F@)\*@ ףp= G@)\*@ ףp=JG@*@ ףp=G@)\*@(\µG@)\(+@ ףp=G@R+@ ףp=*H@R+@ ףp=jH@)\(,@(\•H@-@(\H@-@ I@R-@`I@)\(.@I@.@I@R.@ J@)\(/@ J@R/@(\5J@@0@(\uJ@0@(\µJ@Q0@p= J@Q0@(\J@Q0@(\5K@1@ ףp=jK@Q0@K@Q+1@(\µK@Q1@(\K@Gz1@ ףp=*L@Q1@ ףp=JL@Gz2@`L@Gz2@ ףp=L@Gz2@L@Q2@(\L@Gz3@L@3@ ףp=L@4@ ףp= M@Qk4@@M@Qk4@`M@Gz4@M@Q+5@ ףp=M@Qk5@ ףp=M@Q5@ ףp=M@Qk6@(\µM@Q6@ ףp=M@Gz7@ ףp=jM@7@ M@Q7@L@7@L@8@ ףp=jL@GzT8@(\5L@8@(\5L@GzT9@(\5L@Gz9@(\5L@Gz9@@L@Gz:@ L@Q+:@q= ףL@Q9@ ףp= L@Gz9@(\K@Gz9@ ףp=K@@9@K@Q8@k8G@4@{G R@>@dK@Q8@@K@Gz8@ K@Q+8@ ףp=J@Gz8@J@Q+8@`J@Q+8@(\5J@Q7@(\I@= ףp7@ ףp=I@8@(\I@@8@I@@8@p= ףI@RQ8@33333I@{Gz8@ ףp=I@8@(\I@@9@ ףp=I@9@ ףp=I@Gz:@ ףp=I@:@I@Gz9@= ףp]I@@9@(\UI@Q+9@@I@Qk9@(\I@Gz9@ I@= ףp=:@ I@@:@ ףp= I@Q:@(\H@;@H@Qk;@ ףp=jH@Gz;@ ףp=JH@@<@Q+H@= ףp<@ ףp=*H@<@(\H@@=@G@Qk=@ ףp=*H@Gz=@ ףp=JH@>@(\uH@>@H@@>@ ףp=H@>@I@Q+>@ ףp=*I@Gz=@(\UI@@=@ ףp=I@<@I@@<@I@Gz;@(\J@Q;@ ףp=JJ@Qk;@J@;@J@Q:@ ףp=J@Gz:@ ףp=*K@Q:@`K@Qk:@ ףp=K@Q:@K@Gz:@ L@;@`L@;@ ףp=L@Q:@(\•L@@:@ ףp=L@9@M@Q9@ ףp=JM@Gz9@(\•M@Qk9@(\M@GzT9@(\N@GzT9@`N@@9@(\•N@Q+9@(\N@p= #9@ ףp=N@Gz9@(\5O@Q+9@(\uO@@9@O@@9@ ףp=O@Qk9@P@@9@{G*P@Q+9@{GJP@@9@GzdP@GzT9@GzP@Qk9@GzP@GzT9@GzP@9@{GP@8@GzP@GzT8@{GP@Q7@{GP@7@RQ@Q7@GzQ@7@{G*Q@Gz7@{GJQ@6@pQ@6@GzQ@Q6@{GQ@Qk6@{GjQ@@6@GzDQ@@6@GzTQ@5@{GjQ@Qk5@GzQ@5@GzQ@4@{GQ@4@{GQ@Q4@GzR@@5@{G R@Gz5@l8{G R@)\( @GzW@6@d{G R@Gz5@GzR@@6@Gz$R@Q+6@ R@Q5@Gz$R@@5@Gz4R@Gz4@0R@@4@{G*R@3@Gz4R@@3@@R@3@Gz4R@Q2@@R@Gz2@{GJR@1@PR@1@GzTR@Qk0@`R@0@pR@/@GzR@.@{GR@-@R@,@{GR@+@GzR@*@R@R(@R@(@GzR@)\('@GzR@RQ&@S@RQ%@{G S@RQ$@GzS@)\(#@ S@"@Gz4S@)\(!@{GJS@ @GzdS@)\( @S@)\ @{GS@R!@GzS@RQ"@S@"@S@#@GzS@$@GzS@$@GzS@)\%@S@&@S@'@T@RQ(@T@RQ)@GzT@*@T@)\+@{G T@R,@GzT@.@{G T@R.@{GT@)\/@@T@/@{GJT@Q+0@`T@@0@T@GzT0@T@Gz0@GzT@1@GzT@Q+1@T@Qk1@GzT@Gz1@{GT@Gz2@GzU@@2@ U@Gz2@Gz4U@3@GzDU@GzT3@`U@Q3@{GzU@3@{GU@Q3@U@GzT4@U@4@{GU@Gz5@GzU@Qk5@GzU@Gz5@V@5@{G V@Gz6@GzV@5@0V@Gz5@ ףp=JV@fffff5@PV@Q5@pV@5@V@Gz5@GzV@Q+6@{GV@Qk6@{GV@6@V@GzT6@{GV@Q5@W@5@{G W@Gz5@W@ ףp=4@ W@Q4@{G:W@@4@{GJW@Q3@`W@Q3@pW@3@GzdW@@3@GztW@Gz2@{GW@Gz2@GzW@GzT2@W@1@GzW@Q+1@m8W@Q?33333Z@Q+1@dGzW@Q+1@{GW@Gz0@W@Gz0@W@)\/@GzW@/@W@/@GzW@Gz0@X@GzT0@0X@Gz0@{G:X@Q0@PX@0@GzdX@GzT0@pX@)\/@GztX@)\.@{GzX@-@GzX@,@X@RQ+@GzX@)\(*@X@)@X@R'@X@R&@X@&@X@RQ%@X@RQ$@X@)\($@X@)\(#@X@"@X@!@{GX@)\( @{GX@ @GzX@RQ@{GX@RQ@X@@fffffY@p= ף@33333Y@RQ@33333Y@p= ף@Y@RQ@,Y@@fffff&Y@@9Y@@33333SY@p= ף @YY@p= ף@yY@@̌Y@\(\@33333Y@Q?Y@Q?Y@Q? Z@Q?fffffZ@@33333Y@p= ף@Y@\(\@Y@\(\ @Y@\(\@Y@p= ף@Y@p= ף@fffffY@p= ף@̬Y@@̌Y@RQ@33333sY@p= ף@`Y@RQ@9Y@p= ף@fffff&Y@p= ף@Y@@ Y@ @{GX@)\(!@GzX@"@GzX@RQ"@{GX@RQ#@{GX@$@GzX@)\%@GzX@RQ&@X@RQ'@{GX@)\((@{GX@)@Y@)\*@Y@+@9Y@)\*@9Y@)@YY@RQ)@33333sY@RQ)@̌Y@(@fffffY@)\((@33333Y@Gz'@33333Y@'@Y@)\&@Y@R%@Y@)\(%@ Z@)\(%@33333Z@%@ Z@$@@Z@)\($@333333Z@)\(#@333333Z@)\("@@Z@RQ!@YZ@"@33333sZ@)\"@33333Z@R"@̬Z@)\#@̬Z@R$@33333Z@R$@n8ffffffZ@R$@fffff^@A@d33333Z@R$@Z@RQ%@fffff[@R%@ [@RQ&@@[@R&@L[@'@L[@RQ(@33333S[@)\)@33333S[@*@33333S[@+@L[@,@@[@-@333333[@)\.@[@/@fffff[@Q+0@Z@0@Z@Q0@33333Z@GzT1@Z@1@33333Z@Gz2@yZ@Qk2@ffffffZ@3@lZ@3@yZ@Q3@Z@@4@̬Z@Q4@fffffZ@5@fffffZ@@5@[@5@[@5@ [@Q5@@[@Q5@Y[@Qk5@l[@Qk5@l[@5@l[@4@y[@GzT4@33333[@GzT4@[@4@33333[@Q4@[@@5@[@Qk5@[@5@\@5@ \@Gz5@@\@6@fffffF\@6@`\@Q+6@l\@Q6@̌\@@6@\@Q6@\@Q6@\@6@]@Gz6@ ]@Gz7@@]@Qk7@Y]@Q7@33333s]@8@̌]@@8@̌]@Gz8@̬]@Gz8@33333]@9@]@@9@]@Gz9@]@:@33333]@GzT:@]@:@^@Q:@33333^@;@fffff&^@Qk;@333333^@Gz;@fffffF^@Q+<@Y^@Q+<@ffffff^@Qk<@`^@Q<@l^@Q+=@y^@Q+=@^@=@fffff^@>@l^@Gz>@33333S^@@>@333333^@Q+>@^@GzT>@9^@Qk>@L^@Q>@`^@Gz>@y^@Q>@33333s^@@?@L^@Q?@33333s^@Q?@l^@ ףp= @@L^@(\5@@9^@ ףp=J@@333333^@@@,^@(\µ@@ ^@ ףp=@@33333^@ ףp=*A@33333]@ ףp=JA@]@ ףp=jA@]@A@o8ffffff]@ ףp=*A@`@E@d]@A@]@ ףp=A@ ^@(\A@,^@(\B@333333^@ ףp=JB@`^@`B@^@B@33333^@ ףp=jB@fffff^@ ףp=B@fffff^@(\µB@ffffff^@(\µB@L^@B@333333^@B@33333^@ ףp=B@^@ ףp=B@33333]@ ףp=B@33333]@ ףp=B@]@ ףp=B@33333]@B@33333]@C@y]@ C@ffffff]@ ףp=JC@l]@(\uC@]@C@]@ ףp=C@]@(\•C@33333]@(\µC@]@C@]@D@^@(\D@333333^@ ףp=JD@L^@(\uD@y^@ ףp=jD@̌^@(\5D@y^@D@`^@C@33333S^@C@l^@(\•C@L^@`C@ffffff^@ ףp=jC@fffff^@ ףp=C@^@(\µC@^@ ףp=C@^@C@fffff_@ ףp=C@ _@fffffC@,_@(\C@fffffF_@ ףp=C@Y_@(\µC@L_@(\uC@@_@@C@333333_@ ףp= C@33333S_@(\B@fffff_@B@_@HzB@fffff_@(\µB@33333_@B@̌_@(\uB@_@ ףp=*B@33333_@A@33333_@ ףp=A@33333_@ ףp=jA@fffff_@ ףp=*A@_@(\UA@33333_@ ףp=jA@`@(\uA@33333#`@(\•A@)`@ ףp=A@,`@B@,`@@B@)`@B@fffff&`@B@`@(\B@`@ C@ `@(\/C@fffff`@(\UC@33333_@C@33333_@C@_@ ףp=C@33333_@ ףp=C@33333_@(\C@fffff`@ ףp= D@`@ ףp=*D@fffff&`@(\UD@fffff6`@ ףp=jD@fffff6`@ ףp=D@333333`@ ףp=D@33333C`@ ףp= E@P`@E@33333S`@\(E@fffffV`@ E@Y`@ ףp=JE@ffffff`@ ףp=JE@p`@E@fffffv`@E@`@E@`@(\uE@33333`@(\UE@fffff`@ ףp=jE@`@(\•E@p8`@(\•E@fffffd@(\UO@d`@(\•E@`@(\µE@`@(\E@fffff`@ ףp=*F@ a@`F@a@F@0a@(\F@@zGqQ@>@GztQ@<@{GQ@>@GzQ@Q+?@{GQ@Q+>@{GQ@Gz=@{GQ@;@GzQ@Gz:@Q@Gz:@{GQ@Gz9@GzQ@Q9@{GQ@Gz8@Q@@8@{GQ@GzT7@{GQ@GzT6@{GQ@5@Q@Q+4@GzQ@Q2@GzQ@Gz2@GzdQ@1@{GZQ@1@GzDQ@Gz1@@Q@Q0@{G*Q@Gz0@@Q@R/@0Q@Q+0@PQ@)\.@{G:Q@R,@{G*Q@.@{GQ@RQ+@Q@R)@GzP@,@{G Q@.@Q@Q+0@GzQ@.@GzP@RQ-@{GP@)\+@P@)\*@GzP@*@{GP@)\()@pP@RQ(@PP@)\&@{G:P@RQ%@GzP@)\($@(\O@#@O@R!@O@!@ ףp=O@ @O@@(\uO@RQ@@O@p= ף@(\O@p= ף@ ףp=N@@N@RQ@(\•N@@`N@RQ@ ףp=*N@RQ@(\M@@ ףp=M@p= ף@M@p= ף@ ףp=M@p= ף@M@RQ@ ףp=JM@@ ףp=*M@RQ@ ףp= M@p= ף@M@!@ M@"@ ףp=JM@#@M@$@M@)\(%@ ףp=M@(\%@q= ףM@)\(&@ ףp=M@)\&@@M@RQ'@M@(@(\µL@)\(@(\uL@R)@@L@RQ)@(\L@*@K@*@(\µK@RQ+@(\µK@,@(\µK@RQ,@K@RQ-@(\L@)\.@(\L@R/@(\L@GzT0@`L@0@ ףp=L@Q0@L@Q0@ M@Gz0@ ףp=JM@Gz1@(\uM@GzT2@(\•M@2@ ףp=M@Gz2@ ףp=M@Gz2@ ףp=M@w8R"@(\J@Q+>@GztP@dGz2@ ףp=M@Gz2@(\N@Q1@@N@@1@ ףp=jN@Q+1@N@GzT1@N@Qk1@ O@1@@O@Qk2@O@Q+3@ ףp=O@Gz3@ ףp=O@Q4@ ףp=O@5@{G P@Q5@ P@5@0P@5@GzDP@Qk5@GzTP@6@`P@Qk6@GztP@Q+7@pP@Gz7@pP@\(8@RqP@8@GztP@GzT9@`P@GzT9@@P@Q8@Gz4P@Gz8@GzP@@7@(\O@Qk6@(\µO@Gz5@O@Q+5@@O@@5@O@Q5@N@GzT5@N@GzT5@(\UN@Gz6@(\5N@Gz6@(\N@7@N@Qk8@ ףp= N@GzT9@ N@@:@(\5N@Q+;@ ףp=JN@R;@ ףp=JN@GzT<@ ףp=JN@Gz=@(\N@=@ N@Q+>@ ףp=M@Q+=@N@GzT<@(\M@Q;@(\µM@Gz:@(\µM@Q9@ ףp=M@9@M@Q+8@(\µM@7@(\•M@7@`M@7@ ףp=*M@GzT8@ M@GzT8@L@GzT8@L@Gz7@L@@7@ ףp=L@Q6@(\µL@Qk6@(\L@Q5@ ףp=L@GzT5@ ףp=L@5@`L@5@(\L@Gz5@(\K@4@(\•K@4@(\uK@3@@K@{G3@Q>K@@3@ ףp=*K@Q2@ ףp=*K@GzT2@ ףp=jK@1@`K@Q0@ ףp=JK@0@ K@RQ.@(\K@)\,@(\J@\(\,@QJ@)\+@K@*@(\K@RQ+@ ףp=*K@)\*@(\UK@R)@(\5K@(@ ףp=*K@)\'@(\K@)\&@(\J@%@(\J@%@(\J@R%@ K@$@@K@$@`K@\("@Q~K@R"@K@#@K@RQ$@L@)\%@(\L@x8Gz" ףp=jC@)\%@ ףp=L@d)\%@(\L@)\%@@L@$@@L@$@ ףp=jL@%@L@%@ ףp=L@)\#@L@R"@(\•L@RQ!@ ףp=L@ @ ףp=jL@)\( @@L@)\( @L@RQ @ ףp=K@RQ!@ ףp=K@RQ!@q= ףpK@RQ!@ ףp=jK@"@@K@RQ!@ ףp=*K@"@ ףp= K@)\(!@ ףp=J@!@J@ @(\J@RQ@(\J@@(\µJ@@(\µJ@RQ@(\µJ@@J@@ ףp=jJ@p= ף@`J@p= ף@@J@@ J@RQ@(\5J@RQ@(\uJ@@ ףp=jJ@RQ@(\5J@RQ@ ףp= J@@I@p= ף @(\µI@ ףp= @̬I@@I@@RI@p= ף@I@? ףp=jI@HzG?@I@? ףp= I@HzG?(\H@(\? ףp=H@(\?(\H@H@zG ףp=H@q= ףpH@q= ףp(\H@zG(\H@q= ףp(\•H@zG ףp=JH@ ףp=JH@q= ףp@H@ ףp=jH@q= ףp `H@Gz ףp=JH@@H@GzH@ ףp=G@ ףp=G@q= ףp ףp=G@G@Q ףp=G@zGG@`G@@G@ G@ ףp=F@q= ףpF@zG(\UF@ F@zG(\E@ffffffE@zG(\µE@q= ףp ףp=E@(\µE@Q E@Gz ףp=E@\(\E@\(\ ףp=E@\(\E@E@ E@Gz ףp=E@ףp= !E@ףp= W"E@!(\5E@Gz!E@!D@!(\D@Gz.!(\•D@ףp= W!`D@Gz! D@ףp= !(\C@" ףp=C@Gz" ףp=jC@y8Gz" ףp= B@Qk2@ ףp=*F@dGz" ףp=jC@Gz."@C@ףp= W!@C@!C@!B@ףp= ! ףp=B@Gz (\•B@\(\ ףp=B@GzB@)\(B@B@B@\(\`B@ B@ ףp= B@@B@(\UB@q= ףp`B@Q `B@`B@q= ףp`B@q= ףp(\•B@q= ףp(\B@zG(\B@(\ ףp= C@(\տ(\5C@?`C@п ףp=C@(\տC@(\C@?(\5D@?D@?(\•D@p= ף@ ףp=D@\(\@(\D@\(\ @(\D@p= ף@@E@(\@fffffFE@@E@p= ף @E@@E@RQ@ ףp=E@@E@RQ@E@p= ף@ ףp=E@RQ@(\µE@p= ף@(\E@zG@)\E@ @ ףp=E@ @(\F@RQ!@ ףp=*F@RQ"@ F@#@ ףp= F@)\($@F@RQ$@E@R$@ ףp=E@R%@(\UE@&@ ףp=*E@'@ ףp=*E@(@(\D@R(@D@R)@D@)\(+@D@,@(\uD@R,@(\UD@-@ ףp=JD@.@(\D@RQ/@D@/@(\C@0@C@Gz0@ ףp=jC@)\/@ ףp=JC@RQ/@(\C@RQ/@(\B@0@(\B@Q+0@(\C@0@(\5C@0@ ףp=jC@1@C@1@(\µC@0@(\C@Q0@(\D@Q0@@D@GzT1@ ףp=*D@Gz1@ D@Q1@(\C@@2@ ףp=C@Qk2@(\D@Q1@ ףp=JD@Qk1@ ףp=jD@Q0@ ףp=D@GzT0@ ףp=D@)\/@D@Gz0@ ףp=D@.@ ףp=D@RQ-@ ףp= E@RQ,@ ףp=*E@R+@ ףp=JE@)\+@E@)\(+@(\µE@z8)\((@(\B@=@F@d)\(+@(\µE@)\(*@(\E@RQ)@(\E@(@ F@RQ(@ ףp=JF@)\(@(\uF@)\((@(\•F@RQ(@F@)\()@F@)\(*@F@)\(+@(\F@(\+@F@R*@(\µF@+@ ףp=F@+@ ףp=jF@)\(,@F@RQ,@ ףp=F@)\-@F@R-@ ףp=JF@RQ.@ ףp=*F@RQ.@F@/@E@0@E@Gz0@(\µE@GzT1@E@Q1@ ףp=JE@2@ ףp=*E@3@E@33333s3@p= D@3@D@Qk3@ ףp=D@GzT3@`D@GzT3@ D@3@D@q= ף3@zGC@Gz4@ ףp=C@GzT4@C@Q4@`C@Gz5@ ףp=*C@Gz5@ C@Gz6@ ףp=*C@Q6@C@7@(\B@8@ ףp=B@8@(\C@Gz8@C@Q+8@(\C@Gz8@@C@Q7@(\UC@GzT7@(\uC@Q+7@C@Gz6@ ףp=C@6@D@Gz6@ ףp=JD@Gz7@(\D@Gz7@(\D@7@(\5D@7@(\UD@8@(\UD@@8@(\uD@8@ ףp=jD@Q+9@(\uD@9@ ףp=jD@zG9@YD@Gz:@@D@Gz:@ ףp=JD@Q+:@ D@Q+:@D@Gz:@ ףp=*D@Gz;@(\UD@Qk;@(\uD@Q+<@D@Gz<@D@Qk=@(\UD@Q<@ ףp=JD@=@ ףp=*D@Qk<@ ףp=*D@;@ ףp=*D@Q+;@ ףp=*D@Gz:@ ףp=*D@Q+:@D@:@(\µC@Gz:@C@Q:@C@:@(\UC@Q:@(\5C@Q:@ ףp=*C@GzT:@ ףp=JC@@:@ C@:@ ףp= C@Q+;@(\B@Gz;@ ףp=B@;@ ףp=B@Q+;@B@Q;@B@Q+<@B@<@`B@Gz<@`B@@=@ ףp=*B@=@(\B@{8L!@@>@ ףp= B@B@d=@(\B@>@(\5B@Q>@ ףp=jB@@?@`B@@@@B@ @@(\B@`@@B@(\•@@(\B@ ףp=@@(\B@ ףp= A@@B@@A@ ףp=jB@(\•A@ ףp=JB@A@ ףp=JB@B@(\uB@ ףp= B@(\UB@A@ ףp=*B@(\A@B@q= ףA@(\A@A@(\A@A@A@HzA@LA@ ףp=A@@A@A@ ףp= A@A@@@{GA@(\µ@@A@@@ ףp=jA@@@@(\UA@@@ ףp=*A@?@zG!A@Qk?@A@Q+?@@@Gz?@(\U@@?@ ףp=*@@@?@(\@@Q>@?@Gz?@Gz?@Qk?@Q+?@?@Gz>@Qk?@>@Q+?@=@Q>@=@Gz>@Qk<@Gz?@Gz;@Gz?@GzT;@@?@Q:@Qk?@GzT:@?@9@Gz?@Q+9@?@Gz9@fffff?@Q8@Q?@GzT8@Q?@7@ ףp= @@Q+7@(\@@Gz7@ ףp=J@@6@`@@Gz5@ ףp=j@@@5@`@@Q4@ ףp=J@@Gz4@(\@@Gz3@Gz?@4@?@Gz4@Gz?@Q3@Q>@Gz3@Qk>@Q+3@@>@Q2@GzT>@Q+2@Q>@1@?@Q0@Q+?@Gz0@@?@)\(/@?@)\.@?@)\.@ @@-@(\5@@RQ,@(\U@@)\(+@`@@)\)@ ףp=j@@RQ(@ ףp=j@@RQ'@@@'@)\@@)\(&@@@R%@(\@@%@ ףp=@@)\($@@@$@(\A@)\$@(\5A@%@`A@&@(\•A@R%@ ףp=A@)\(%@A@R$@ ףp=*B@%@@B@&@(\uB@)\$@(\UB@)\($@(\•B@)\(#@B@)\("@(\•B@RQ!@(\uB@L!@(\uB@|8Gzn1$@L!@B@dL!@(\uB@RQ @ ףp=jB@p= ף@B@@ ףp=jB@@B@RQ@`B@RQ@(\UB@@ ףp=jB@p= ף@(\uB@p= ף@(\uB@\(\ @ ףp=jB@\(\@ ףp=jB@\(\@(\UB@? ףp=JB@?@B@? B@(\A@ ףp=A@A@(\µA@zG(\•A@ffffff33333A@q= ףp ףp=A@ ףp=A@q= ףp A@\(\A@(\•A@GzA@Gz ףp=A@GzA@GzA@\(\ ףp=jA@\(\(\5A@\(\A@Gz(\@@ @@!@@Gz! ףp=j@@"@@@"(\@@#?@Gz#?@Gz#Q>@Gz.#GzT>@Gz#=@ףp= W$GzT=@Gz.%Q<@ףp= W&Q<@'@<@ףp= W(<@ףp= )Q;@Gz.*(\µ;@*;@ףp= *;@ףp= W+Q:@ףp= W,Qk:@ףp= ,Q+:@Gz.-Q9@-@9@.Q8@ףp= .@8@/Gz7@0Qk7@@06@0GzT6@ףp= 0Gz6@Gz0Gz5@1Gz5@1R5@ףp= 04@Gz.0GzT4@Gz.0Gz3@03@Gz.03@02@02@ףp= 01@@01@Gzn00@Gzn0(\0@Gzn0)\/@0R.@1.@Gzn1-@1-@0,@(\µ0RQ+@Gz0R*@(\µ0(\u*@0R)@0= ףp(@0)\(@ףp= W0)\((@ףp= /)\'@/R'@ףp= .&@Q.)\(&@.)\(&@ףp= W-RQ%@ףp= ,$@}Xףp= ,R#@$@Hףp= ,$@,$@Gz.+)\(#@*RQ"@*= ףp="@ףp= W*RQ!@Gz.* @ףp= )RQ@ףp= (RQ@ףp= 'RQ@Q&\(\@ףp= &RQ@&p= ף@Gz$RQ@Gz#RQ@ףp= "@ףp= !p= ף@Gz @\(\RQ@333333Gz@Gz@GzRQ@\(\p= ף@Gz@\(\RQ@p= ף@\(\@Q@QRQ@ffffffHzG@Q@@q= ףp@q= ףpp= ף@(\@п@Q?RQ@?RQ@Q?= ףp=@?p= ף@HzG?RQ@Q?RQ@p= ף@p= ף@p= ף@p= ף@@Gz@\(\ @@@@@RQ@@p= ף@@@p= ף@RQ@@@@@@RQ@@p= ף@ @p= ף@Gz @zG@R @@)\!@@R!@@)\"@\(\@)\(#@ @R#@p= ף@#@@ffffff#@Q@RQ#@Q?#@?"@HzG?)\(#@q= ףp?Q#@)\(?)\"@?)\"@~)\(*@)@.@,@)\(*@)\(,@p= ף*@+@)\*@+@+@)\*@)\+@)\(*@R+@)@RQ,@)@zGa,@)@-@Qk)@)\(-@)@)\(.@R)@.@R*@-@R*@RQ,@+@RQ,@)\+@R+@RQ,@+@(\u,@R*@,@)\(*@)\(,@Q?@ A@?Q?@QGz?@ @@Q`@@(\µ@@ ףp=@@q= ףp@@Q ףp=@@(\@@q= ףpQ@@(\ ףp= A@ A@QۿA@{Gz?q= ף@@Q?@@?@@?(\5@@(\?Gz?@ ףp= ǿQ?@ ףp=?@HzGGz?@zG?@q= ףpQ?@QGz=@!Gz?@Q @=@=@Gz=@GzT>@GzGz>@Gz. ̌>@(\ >@Gz.!Gz?@!R?@\(\!?@ >@>@GzGz>@\(\Q+>@=@Gz>@Gz=@GzQ=@ffffffQ=@\(\Qk=@GzT=@Q GzT=@Q Gz=@@=@Gz=@GzT=@\(\@=@A@- ףp=A@Gz.# ףp= A@ףp= W((\A@Gz.) ףp=*A@* ףp=*A@ףp= *(\UA@+`A@ףp= W, ףp=A@Gz., ףp=A@-(\A@{G+A@Gz+(\uA@ףp= * ףp=jA@Gz) ףp=jA@(A@ףp= W'RqA@{G&(\UA@Gz.& ףp=JA@Gz.%@A@ףp= # ףp= A@Gz.#zGA@Gz#A@Gz# A@Gz% A@&(\5A@' ףp= A@ףp= W(x;@(\uD@(\D@ ףp=JG@L;@@E@Q;@ ףp= E@q= ף;@(\E@Gz<@(\D@Gz<@ ףp=D@Q+=@(\•D@Gz=@ ףp=D@>@(\•D@Gz?@ ףp=D@Gz?@ ףp=D@ ףp= @@ ףp=D@ ףp=J@@ ףp=D@@@E@ ףp=@@(\D@@A@(\D@A@E@ ףp=A@(\D@B@(\D@ ףp=*B@D@`B@D@B@D@(\B@ ףp=D@(\C@(\uD@`C@D@ ףp=C@ ףp=D@(\C@D@@D@ ףp=D@ ףp=D@(\µD@ ףp=D@(\D@D@zGD@(\D@E@(\µD@ ףp=*E@D@`E@D@(\uE@ ףp=*D@(\•E@ ףp=C@(\µE@C@(\E@C@ ףp= F@@C@ ףp=*F@C@(\5F@(\B@ ףp=JF@B@`F@B@ ףp=F@(\UB@ ףp=F@ ףp= B@F@ ףp=A@ ףp=F@ ףp=A@ ףp=jF@ ףp=JA@`F@ A@@F@@@ ףp=*F@(\µ@@ ףp=JF@ ףp=@@F@@@(\•F@(\U@@ ףp=F@ ףp=@@F@@@(\F@(\•@@(\G@ ףp=J@@G@Gz?@ G@ ףp= @@ ףp=JG@Qk?@ ףp=JG@Gz>@ ףp=JG@Gz>@(\G@Q+>@ ףp=F@Gz=@(\F@zG=@GzF@Q=@(\•F@=@ ףp=jF@=@(\UF@Q<@ ףp=*F@Q<@(\E@)\<@(\E@Gz<@(\µE@<@ ףp=E@Q;@ ףp=jE@;@@E@(\5A@F@ ףp=C@G@(\5A@(\F@`A@F@A@(\µF@A@F@ ףp= B@(\µF@(\UB@(\µF@ ףp=B@ ףp=F@B@ ףp=F@ C@ G@(\B@(\5G@(\B@(\UG@(\C@(\UG@`C@G@ ףp=C@ ףp=G@C@G@(\5C@(\•G@ ףp=B@ ףp=G@ ףp=jB@`G@ ףp= B@(\UG@(\µA@(\5G@A@ ףp= G@(\5A@(\F@(\UG@ ףp=JB@`K@G@V(\UG@`F@(\UG@(\5F@ ףp=G@ F@(\µG@E@(\µG@(\µE@(\µG@E@ ףp=G@@E@ H@ ףp= E@(\UH@ ףp=D@H@(\µD@(\•H@D@(\H@ ףp=JD@ I@(\5D@H@ ףp=*D@(\µH@D@H@C@(\•H@(\•C@`H@(\•C@ ףp=jH@QKC@ ףp=jH@ ףp=JC@(\uH@ ףp= C@H@ ףp=B@H@(\µB@(\I@ ףp=B@ ףp=*I@ ףp=B@I@`B@ ףp=I@ ףp=JB@(\5J@`B@(\•J@(\uB@(\J@ ףp=jB@K@(\•B@RJ@\(B@J@ ףp=B@J@@C@K@ ףp=C@ ףp=J@(\•C@(\µJ@ ףp=C@J@D@`J@D@(\UJ@ ףp=*D@(\uJ@ ףp=jD@J@(\UD@(\K@(\UD@`K@D@ ףp=*K@ ףp=D@(\J@(\D@(\J@ ףp= E@J@E@(\UJ@(\D@`J@D@(\5J@D@ ףp=*J@(\E@(\UJ@ ףp=JE@@J@ ףp=jE@ ףp=I@ ףp=jE@ ףp=I@(\•E@(\•I@(\E@`I@(\F@(\I@ ףp=*F@ I@ ףp=JF@(\uI@ ףp=JF@(\µI@@F@(\•I@F@I@ ףp=F@@J@(\µF@ ףp=J@(\•F@(\J@F@ K@F@(\J@F@ ףp=J@(\F@(\J@(\5G@(\•J@ ףp=jG@ ףp=JJ@(\•G@ ףp= J@(\•G@(\µI@(\•G@(\uI@G@(\I@ ףp=jG@H@`G@(\uH@ ףp=JG@H@ ףp=*G@@H@ G@ H@(\F@ ףp=G@ ףp= G@ ףp=G@(\F@G@(\•F@(\UG@`F@(\M@E@ ףp=N@`G@(\M@F@(\M@@F@ ףp=*M@ F@ ףp=*M@(\E@M@(\E@(\M@(\E@ ףp=M@E@@N@(\E@ ףp=N@(\F@ ףp=N@(\UF@N@`F@ ףp=N@F@N@ ףp=F@N@F@N@G@ ףp=N@(\5G@(\N@`G@N@@G@`N@(\UG@ ףp= N@@G@ ףp= N@(\G@M@ ףp=*G@M@(\F@M@(\F@(\UM@ ףp=F@ ףp=JM@(\µF@(\M@F@{GZR@(\uF@S@`G@{GZR@ ףp=F@GztR@F@GzR@(\uF@R@(\F@{GR@G@R@(\G@{GR@(\5G@S@ ףp=JG@Gz4S@(\5G@GzTS@ ףp=JG@S@ ףp=*G@S@(\5G@S@`G@S@`G@GzS@ ףp=JG@GztS@(\UG@GzTS@ ףp=JG@Gz4S@(\UG@GzS@`G@R@(\UG@R@`G@{GR@(\5G@{GjR@(\G@{GZR@ ףp=F@fffffY@ ףp=I@y[@K@fffffY@ ףp=I@ Z@ ףp=I@LZ@I@yZ@(\I@33333Z@(\J@Z@@J@33333Z@(\UJ@33333[@J@@[@J@Y[@K@`[@@K@l[@ ףp=K@y[@ ףp=K@`[@K@33333S[@K@L[@(\•K@333333[@`K@ [@ ףp=*K@ [@(\J@fffffZ@J@Z@ ףp=J@fffffZ@`J@fffffZ@@J@lZ@(\J@LZ@ ףp=I@ Z@I@fffffY@ ףp=I@>@(\M@ ףp=j@@ ףp=N@>@ ףp=N@Gz>@`N@Q>@ ףp=*N@Gz?@(\M@?@(\M@?@(\N@@@@(\N@ ףp=j@@@N@ ףp=j@@ ףp=jN@@@@(\•N@Gz?@ ףp=N@Qk?@ ףp=N@>@ ףp=N@Q+>@ ףp=N@>@ ףp=N@@A@(\uN@(\5B@ ףp=jO@@A@N@ ףp=jA@N@A@ ףp=N@A@(\uN@B@(\uN@(\5B@ ףp=N@(\5B@(\µN@B@(\N@A@O@ ףp=A@(\5O@A@(\UO@@A@ ףp=jO@ ףp=jA@ ףp=JO@ ףp=A@@O@ ףp=A@(\O@(\UA@(\O@@A@N@8E@ףp= 9(\5I@(DE@Gz5E@ףp= W6 ףp=E@ףp= 6 ףp=E@@7(\E@Gz7E@8(\F@9 ףp=JF@ףp= W9F@ףp= 9F@9(\F@@9(\5G@ףp= 9 ףp=jG@Gz.9(\•G@Gz8 ףp=G@@8G@7(\G@Gzn7G@7 ףp=G@ףp= 6(\G@Gz.6 ףp= H@5 H@ףp= W5(\5H@Gz4@H@4(\UH@ףp= 4 ףp=jH@ףp= 3H@ףp= 3H@2 ףp=H@2(\µH@Gzn1(\µH@1(\H@0H@ףp= W0(\H@/ ףp= I@ףp= /(\5I@ףp= . ףp=*I@ףp= -(\I@ףp= W,(\H@Gz.+ ףp=H@* ףp=H@)H@( ףp=jH@ףp= ( ףp=jH@ףp= )`H@Gz* ףp=*H@+ ףp=G@Gz.+(\G@Gz., ףp=G@Gz,(\G@-G@- ףp=jG@.(\5G@/(\F@/(\µF@ףp= /(\uF@Gz.0@F@Gz.0 F@Gz0(\E@Gzn1F@2 F@ףp= 2 F@3@F@ףp= 3(\5F@4 ףp= F@4(\E@Gz4 ףp=E@ףp= W5E@Gz5H(\•K@ףp= W5 ףp=K@Gz4(\•K@5 ףp=K@ףp= W5K@ףp= W5 ףp=K@Gz.5 ףp=K@Gz4(\•K@5@ ףp=L@4L@4 ףp=L@4L@4L@Gz.4L@4 ףp=L@4P ףp=J@(@ ףp=JK@RQ)@ ףp=J@R(@(\J@(@ ףp= K@(@ ףp=JK@)@(\K@)\()@(\J@RQ)@ ףp=J@R(@Gz4Q@ףp= HGzQ@ףp= WH Gz4Q@QkH{GJQ@H{G:Q@ףp= H`Q@HGztQ@ףp= HQ@ףp= H{GQ@ףp= HGzQ@QHQ@ףp= H{GjQ@HGzTQ@H@Q@ףp= WHGz4Q@QkH0{G*W@)\'@{G:W@)\*@{G:W@)\*@Gz4W@)\()@{G*W@)\'@({GW@\(\@ X@@{GW@@ X@\(\@HPX@(\?X@?PX@HzG?GzdX@?X@(\?X@?`X@?PX@HzG?HX@{GX@(\X@GzX@GzX@{GX@zGX@(\X@S@@GztT@)\#@S@)\( @S@@GzS@RQ@T@p= ף@T@@{G*T@@PT@p= ף@{GjT@@GztT@@GztT@RQ@`T@ @PT@!@{G:T@"@Gz$T@#@T@)\#@{G T@R"@{GS@"@GzS@!@S@)\( @,[@@2@[@4@,[@GzT3@,[@Q2@,[@2@33333S[@@2@l[@@2@̌[@2@[@Gz2@̬[@GzT3@[@Q3@[@4@[@4@[@4@ffffff[@Q3@fffffF[@Gz3@,[@GzT3@ ^@6@y^@@9@ ^@Q7@ ^@Q+7@33333^@Gz6@,^@Qk6@333333^@6@@^@Gz6@33333S^@7@`^@7@l^@Gz8@y^@Gz8@y^@Gz9@ffffff^@@9@fffffF^@9@333333^@Gz8@ ^@Q+8@ ^@Q7@0`@Gz?@|`@(\@@0`@@@9`@`@@fffffF`@`@@fffffF`@ ףp=@@P`@`@@P`@ ףp=*@@fffffF`@ ףp= @@fffffF`@Q?@fffffF`@@?@Y`@Gz?@i`@Qk?@l`@Q?@fffffv`@(\5@@|`@ ףp=j@@fffffv`@@@33333s`@(\@@33333c`@(\@@\`@(\@@L`@ ףp=@@@`@@@0`@@@`@`@@fffff`@ ףp=*A@`@(\µ@@̌`@(\u@@̜`@`@@33333`@ ףp=@@`@ ףp=@@fffff`@@@33333`@@@`@ ףp=@@fffff`@ ףp=@@33333`@(\A@33333`@ ףp=*A@33333`@ A@`@(\@@`@A@fffff`@(\@@`@(\µ@@\`@(\µ@@̼a@D@O\`@ ףp=*A@\`@(\@@p`@A@`@(\@@`@ A@̜`@ ףp=*A@`@@A@̼`@ ףp=JA@`@ ףp=jA@`@`A@`@`A@fffff`@ ףp=*A@fffff`@(\@@`@@@fffff`@(\µ@@fffffa@(\@@fffffa@ ףp=*A@a@(\UA@fffffa@A@)a@ ףp=JA@33333Ca@ ףp=JA@fffffVa@ ףp=A@Ya@ ףp=JA@33333ca@A@33333sa@A@ya@A@fffffva@(\uA@a@(\•A@̌a@A@fffffa@A@33333a@(\B@fffffa@`B@̜a@B@a@ ףp=B@̜a@ ףp= C@33333a@ ףp=*C@a@ ףp=*C@a@`C@a@ ףp=C@̼a@(\C@fffffa@(\D@̬a@ ףp=JD@a@D@̬a@ ףp=D@a@D@fffffa@(\•D@33333a@(\•D@33333a@(\uD@fffffa@(\uD@a@(\•D@a@(\UD@a@ ףp=*D@a@(\C@a@(\µC@ya@C@pa@ ףp=JC@ia@ ףp= C@Ya@ ףp=B@33333Sa@(\µB@fffffFa@(\•B@333333a@B@ a@`B@ a@ ףp=B@fffff&a@B@fffffa@B@fffffa@ ףp=jB@ a@(\5B@a@ ףp= B@a@(\A@fffff`@A@`@A@fffff`@(\A@`@ ףp=A@`@A@fffff`@A@`@ ףp=A@y`@`A@l`@@A@\`@ ףp=*A@pfffffva@(\µD@9b@F@+ya@ ףp=JE@fffffva@ E@a@E@a@(\µD@a@(\D@33333a@ ףp=D@fffffa@ ףp= E@a@ E@a@@E@fffffa@@E@̜a@ ףp=*E@a@@E@a@ ףp=JE@a@ E@a@E@a@ ףp=*E@fffffa@(\UE@fffffb@E@b@(\uE@)b@(\•E@9b@(\µE@fffff&b@ ףp=E@fffff&b@ ףp=E@ b@E@)b@ F@fffffb@(\E@fffffb@F@33333a@(\F@a@@F@fffffa@`F@a@(\•F@̼a@F@a@F@fffffa@`F@fffffa@ ףp=*F@33333a@F@a@E@a@(\µE@a@(\•E@fffffa@(\•E@a@E@̌a@(\uE@ya@ ףp=JE@833333_@Gz:@fffff`@Gz:@33333_@Gz:@33333_@Qk:@fffff`@Gz:@fffff`@Gz:@()`@Q+<@fffff6`@Qk<@)`@Q+<@fffff6`@Qk<@00b@ ףp=E@fffffFb@ ףp=*F@0b@ ףp=E@9b@ ףp= F@fffffFb@ ףp=*F@X\b@(\5F@b@F@\b@(\5F@pb@`F@fffffb@ ףp=F@b@F@b@F@|b@ ףp=F@lb@F@\b@(\5F@@b@(\F@b@ G@b@(\F@b@F@b@ G@b@ ףp= G@b@(\F@(b@ ףp=jG@fffffc@(\•G@b@ ףp=jG@fffffc@(\•G@Pffffffc@I@33333c@`I@ffffffc@(\"I@ffffffc@I@yc@I@33333c@@I@33333c@`I@fffffvc@(\5I@ffffffc@(\"I@@)a@ ףp=JK@33333Ca@(\•K@)a@ ףp=jK@333333a@ ףp=JK@33333Ca@K@0a@(\•K@)a@ ףp=jK@@id@@M@̌d@(\•M@id@@M@̌d@(\uM@d@(\•M@fffffvd@M@id@@M@fffffa@(\F@ b@ ףp=*K@/fffffa@ ףp=J@a@`J@fffffa@ J@fffffa@I@a@(\µI@33333a@I@a@@I@33333a@I@33333a@H@a@ ףp=H@a@`H@a@@H@fffffa@H@a@ ףp=G@a@G@fffffa@ ףp=JG@a@(\F@a@(\5G@33333a@(\UG@a@ ףp=JG@a@ G@a@`G@33333a@(\uG@a@G@fffffa@G@a@ ףp=G@33333a@ ףp=*H@a@`H@a@ ףp=H@a@ ףp=H@a@ ףp=H@ b@ ףp=H@fffffb@H@a@I@fffffa@@I@a@I@a@I@33333a@J@fffffa@@J@fffffa@J@a@J@a@K@fffffa@ ףp=*K@a@ K@a@ ףp=J@a@ ףp=J@fffffa@ ףp=J@8fffffVf@GzQ@f@RQ@f@RQ@fffffVf@HzQ@Yf@GzQ@f@Q@@fQ@Q-fRQ@fQ@QffQ@Q-f{GQ@QFfRQ@fRQ@P33333a@{GJR@a@{GzR@33333a@`R@33333a@PR@a@{GJR@a@`R@a@{GzR@a@GztR@33333a@`R@@fffffa@{GzR@a@R@fffffa@R@a@{GzR@a@R@a@R@fffffa@R@XPb@R@b@GzR@Pb@GzR@ffffffb@GzR@fffffb@R@b@R@b@{GR@fffffb@GzR@ib@{GR@Pb@GzR@fffff&a@{GR@ b@{G S@fffff&a@R@33333Ca@R@ia@{GR@a@GzR@a@R@a@GzR@b@GzR@ b@{GR@ b@{GR@b@GzR@a@GzR@a@{G S@a@R@`a@{G S@0a@{GR@fffff&a@R@pGzX@{GzS@@Z@{GS@ GzX@{GzS@@Y@{GS@Y@{GS@@Z@GzS@@Z@GzS@Y@{GS@33333Y@{GS@LY@S@fffff&Y@GzS@GzX@GzS@GzX@{GzS@{GV@S@ Y@PT@{GV@GzT@GzV@{GS@GztW@S@{GW@GzS@0X@{GS@GzX@S@GzX@GzS@X@S@ Y@{GS@X@T@GzdX@{G T@@X@ T@`X@0T@{GX@@T@GzW@PT@{GJW@{G:T@{G*W@ T@{GV@GzT@X(\I@GzQ@GzDQ@@S@((\I@GzQ@ ףp=jJ@{GQ@ ףp=J@GzQ@ ףp=K@{GQ@(\uL@GzQ@(\L@Q@ ףp=*L@GzQ@K@Q@K@R@ ףp=K@ R@(\L@{G:R@L@GzTR@ ףp=L@pR@(\UM@{GR@ ףp=M@GzR@`N@R@ O@GzR@ ףp=O@{GR@`P@GzR@P@GzS@Gz4Q@GzS@GzDQ@Gz4S@P@@S@P@0S@{GJP@{GS@(\•O@S@(\•N@S@M@{GR@(\M@GzR@L@GzR@K@GzR@K@R@(\uK@{GR@ ףp=J@pR@ ףp=*K@{GZR@J@{GJR@@J@{G*R@`J@GzR@(\I@GzR@(\I@GzQ@H@H@0Q@ ףp=*I@GzdQ@`H@0Q@I@{G:Q@ ףp=*I@PQ@(\•H@GzdQ@@H@PQ@`H@0Q@L@HzT@PP@{GZT@L@HzT@L@HzT@M@{GT@N@GzT@ ףp=*O@= ףpT@ ףp=*O@{G:T@ ףp=O@Gz4T@PP@@T@Gz$P@{GZT@ ףp=jO@{GJT@ ףp=*O@{G:T@(\M@R1T@M@{GT@ ףp=L@T@L@HzT@h K@Q(T@ ףp=jM@pT@ K@333333T@ ףp=*L@Q(T@@M@333333T@(\L@@T@ ףp=jM@GzTT@@M@pT@@L@{GZT@@L@RAT@ ףp=jK@RAT@ K@333333T@8(\•J@T@K@ T@(\•J@T@K@RT@K@ T@(\•J@T@@F@33333T@(\•I@9T@ @F@33333#T@(\F@{GT@G@{GT@G@{G T@(\5H@33333T@I@HzT@I@T@(\•I@{G*T@ ףp=*I@R1T@H@33333#T@H@0T@G@9T@@F@33333#T@P&@ S@;@ T@'&@S@&@GzS@RQ'@̬S@RQ*@= ףpS@)\(.@= ףpS@RQ+@|S@,@`S@RQ.@zGAS@1@ S@GzT1@@S@Gz2@`S@Q2@RS@3@{GS@@4@QS@Q4@QS@Q5@{GzS@Gz4@{GZS@Q6@PS@Gz8@pS@Q+7@GzS@Q+6@{GS@5@GzS@3@{GS@2@S@Q4@GzS@Gz7@{GS@Q9@{GS@;@HzS@;@{G T@Gz8@T@7@{GT@5@{G T@4@ T@2@T@2@{GS@GzT0@RT@/@{GS@)\+@GzS@&@S@@GzO@\(\(\/O@Gz ףp= O@GzO@\(\(\/O@fffff&O@Gz ףp= O@0(\N@(\5N@(\= ףpN@(\5N@N@( (\uM@(\•M@ (\•M@(\uM@H ףp=L@Gz@M@ ףp=L@GzM@Gz@M@(\M@ ףp=L@ ףp=L@H#@fffffK@%@ ףp=K@#@\(K@)\($@fffffK@ffffff%@fffffK@%@(\K@(\$@ ףp=K@#@\(K@`)\(&@q= ףK@)\()@ L@ )\(&@K@&@K@)\'@q= ףK@R(@p= ףK@RQ(@\(K@)\()@K@R(@ L@'@33333K@)\(&@K@H&@ ףp=JK@)\((@(\uK@&@ ףp=jK@)\&@ ףp=JK@)\'@(\UK@)\((@ ףp=jK@)\('@(\uK@&@ ףp=jK@PGz2@ ףp=L@Q+3@(\L@Gz2@L@@2@ ףp=L@2@p= ףL@2@L@Q+3@(\L@Qk2@p= L@Gz2@L@HGz5@ M@Q+7@(\OM@Gz5@ ףp=*M@Q+6@ M@Q6@fffff&M@Q+7@@M@GzT6@(\OM@Gz5@ ףp=*M@@GzT6@\(\M@7@ ףp=M@GzT6@q= ףpM@Qk6@\(\M@7@ ףp=jM@6@ ףp=M@GzT6@q= ףpM@GzI@HzG? ףp=JM@]\(\ ףp= I@\(\I@ ףp=*I@q= ףp (\I@ ףp=JI@Q(\UI@Q@I@zG`I@(\(\UI@{Gz?(\UI@q= ףp? ףp=jI@Q?I@(\? ףp=I@?I@HzG?J@HzG?(\5J@HzG?`J@?(\uJ@(\?(\uJ@?(\UJ@ ףp=jJ@Q? ףp=J@(\?(\µJ@{Gz(\J@пK@(\5K@zG ףp=JK@K@zGK@ףp= HzK@ ףp=K@q= ףpL@Q L@Q L@q= ףp ףp=JL@QL@q= ףp ףp=L@zG(\L@(\L@q= ףp (\L@Gz ףp=L@QM@ ףp=*M@q= ףp ףp=JM@\(\@M@@M@\(\ ףp= M@L@\(\(\µL@\(\ ףp=L@Gz(\µL@(\•L@\(\(\•L@(\UL@ ףp=*L@Gz@L@ ףp= L@GzK@\(\K@\(\(\µK@\(\ ףp=K@GzK@\(\(\uK@ ףp=JK@`K@ (\uK@Gz (\uK@Q @K@q= ףp (\K@q= ףp(\K@J@ ףp=J@= ףp= ףp=J@Q J@ ףp=J@\(\ ףp=J@Gz`J@\(\`J@\(\ J@\(\ ףp= J@Gz ףp=I@ ףp=I@\(\(\I@Q ףp=I@Q ףp=I@= ףpI@q= ףp ףp=I@(\•I@ (\•I@\(\(\•I@`I@(\5I@\(\ ףp= I@Gz$I@\(\K@ Gz$(\J@Gz.$I@Gz.#I@! ףp=I@ I@ ףp= J@\(\(\J@Gz ףp=JJ@J@\(\J@(\J@(\K@\(\ K@`K@\(\ ףp=K@(\•K@(\•K@K@ ףp=K@ףp= W!(\UK@ףp= W @K@! K@Gz." K@# K@$(\J@#J@$J@#(\•J@"(\•J@#(\UJ@#(\J@Gz$(\J@h)\(!@ ףp=D@#@E@ RQ!@@E@)\(!@ ףp= E@RQ!@D@RQ"@ ףp=D@)\"@ ףp=D@#@(\E@R"@@E@R"@E@RQ"@(\UE@RQ!@@E@RQ @ ףp=jC@#@D@RQ @(\uD@RQ @ ףp=JD@R @(\D@R @(\C@)\ @(\•C@!@ ףp=jC@)\("@(\•C@#@(\•C@RQ#@ ףp=C@#@D@#@(\5D@RQ#@ ףp=jD@"@D@!@(\uD@R @ ףp=jD@RQ @(\uD@)\(@(\UB@RQ/@ C@)\(@(\B@RQ)@B@*@B@RQ+@(\•B@RQ,@ ףp=B@-@`B@RQ.@(\UB@)\.@B@RQ.@ ףp=B@)\.@ ףp=B@RQ/@ C@.@ ףp= C@,@C@RQ+@C@*@(\C@)@(\C@)\(@(\B@Gz5@(\5B@Q+7@ C@Gz5@B@Gz5@(\µB@5@B@Q5@`B@Gz6@`B@GzT6@(\5B@Q6@`B@Gz7@(\5B@Gz6@B@Q6@(\µB@Q+7@ ףp=B@Gz6@ ףp=B@GzT6@ ףp= C@Gz5@ C@GzT5@ ףp= C@Gz5@B@7@33333sA@@:@ ףp=A@7@(\•A@8@(\•A@8@ ףp=A@Gz8@33333sA@9@(\uA@Q+:@\(|A@@:@A@9@ ףp=A@9@ ףp=A@Q+9@fffffA@8@(\µA@@8@ ףp=A@Q+8@A@Gz7@ ףp=A@7@(\•A@ @@ ףp=JA@@A@ ףp=A@ @@A@(\5@@(\UA@@@ ףp=JA@@@YA@(\@@(\uA@ ףp= A@(\uA@(\@@(\•A@@A@ ףp=A@(\@@(\µA@(\µ@@ ףp=A@@@A@`@@ ףp=A@ @@A@H@(\C@\(\ @(\C@@ ףp=C@(\@C@p= ף@(\C@\(\ @(\C@\(\@(\C@@ ףp=C@@Q;@q= ףA@@<@9B@Q;@(\B@;@q= ףA@Gz<@ ףp= B@@<@9B@Q;@(\B@0:@fffffC@@:@fffffC@:@\(C@@:@fffffC@@:@fffffC@(:@ C@:@@C@:@@C@:@ C@(Gz<333333C@Gz.<)\HC@Gz<)\HC@Gz.<333333C@(ףp= 9fffffB@Gz.9fffffB@ףp= 9fffffB@Gz.9fffffB@Hףp= 0<@Gz.0Gz<@ףp= 0GzT<@ףp= 0<@ףp= W0Q+<@Gz.0Gz<@0zGa<@ףp= 0GzT<@HQ/;@Gz.Q+<@Q/<@ףp= W/;@Gz.Gz;@(\.Gz<@ףp= W/Q+<@Q/<@`,Gz<@ףp= *Q+=@ ,Gz<@Gz+@<@Gz+Gz<@+Q<@ףp= *Q+=@ףp= W+Gz=@Gz+Gz<@,GzT<@,Gz<@@!@ @R!@@!@p= ף @!@ @R!@p= ף @RQ!@@!@p= ף @8\@ףp= C33333b@ףp= ?d\@ףp= A\@Q+Afffff]@QkA,]@AL]@Al]@A33333]@Afffff]@`A]@ףp= 7A]@ףp= 7A33333]@Afffff^@ףp= @333333^@Q@33333S^@Q@y^@Q@fffff^@Q@fffff^@Q@fffff^@Q@_@@fffff_@@333333_@Qk@L_@ףp= W@33333s_@Q+@̌_@ףp= @_@ @_@ףp= @`@Q @33333`@ףp= ?33333#`@Gz?fffff6`@ףp= ?I`@ףp= ?Y`@ףp= ?i`@ףp= ?y`@?`@@`@@̬`@ףp= @̼`@Q+@`@QK@fffff`@@`@@`@@`@ףp= A`@QKAfffff`@A`@QKA a@ Afffffa@ףp= @)a@ףp= @0a@ףp= @9a@Qk@)c@>,c@=0c@=fffff6c@Gz<0c@Gz.<)c@ףp= ;fffff&c@ףp= ;33333#c@:33333#c@ףp= :c@933333c@ףp= 9fffffc@ףp= 8b@ףp= 8b@Gz7b@ףp= 7b@Gz.7b@Gz6b@Gzn6b@ףp= 6b@Gzn6b@Gz5b@Gzn5fffffb@ףp= 5b@ףp= 4b@Gzn4b@Gz.4yb@ףp= 3pb@Gzn3`b@ףp= W3Lb@3Ib@Gz233333Cb@ףp= W2fffffFb@ףp= 133333Cb@ףp= W19b@10b@ףp= 00b@0)b@/)b@.b@ףp= W-33333b@Gz,33333b@-a@Gz,33333a@+33333a@*a@ףp= W)33333a@ףp= W(a@ףp= W'a@Gz.&a@Gz%33333a@&33333a@Gz'fffffa@ףp= W(fffffa@ףp= W)fffffa@*fffffa@Gz.+33333a@Gz.,33333a@Gz.-fffffa@Gz..33333a@Gz./a@ףp= 0a@ףp= 0a@1a@1a@1a@ףp= 1la@Gzn1ffffffa@1fffffVa@ףp= 033333Ca@ףp= 0fffff6a@ףp= W0)a@033333a@0 a@/a@Gz.33333`@.fffff`@Gz.-a@,a@Gz+a@Gz*33333a@Gz*fffffa@Gz) a@ףp= (a@Gz.(33333a@Gz.)`@ףp= W(`@Gz(fffff`@ףp= W(33333S\@ףp= Afffff`@ףp= &]fffff`@ףp= W(33333`@(`@ףp= '`@Gz.'`@ףp= &fffff`@Gz'̌`@Gz(fffffv`@Gz(33333c`@Gz(P`@)fffffF`@ףp= W*L`@Gz.+<`@ףp= W+9`@Gz.,)`@-9`@Gz-fffff6`@.33333#`@ףp= -fffff`@ףp= -fffff`@.fffff`@-33333_@ףp= ,_@,33333_@ףp= +fffff_@,fffff_@Gz,y_@ףp= W-L_@ףp= W-L_@Gz..,_@/fffff&_@033333_@Gzn033333^@Gz.0fffff^@Gz0^@1^@1^@ףp= 1^@0fffff^@1̌^@Gzn1̌^@ףp= 133333^@Gz.2y^@ףp= 2l^@ףp= 333333S^@Gzn39^@333333^@ףp= 333333]@4]@433333]@ףp= W4̌]@ףp= W4l]@Gz4L]@Gz4,]@Gz433333]@ףp= 433333\@ףp= 5\@5fffff\@Gz5fffff\@Gz533333\@ףp= W6fffff\@ףp= 533333s\@@6l\@Gz633333s\@ףp= 733333s\@7Y\@Gz7`\@Gzn8l\@9y\@Gzn9̌\@ףp= 9̌\@Gzn:l\@ףp= :`\@Gz933333s\@ףp= :33333S\@Gz.:`\@Gz:y\@;̌\@Gz;̌\@ףp= \@>\@?fffff\@Gzn?33333\@?33333\@Q+@\@ףp= w@33333\@@fffff\@@\@Q@\@ףp= AX33333C`@(p`@Gz&33333C`@Gz'fffffV`@Gz'``@(p`@Gz.'i`@Gz&Y`@'I`@Gz&33333C`@Gz'P33333a@ףp= B33333Ca@ףp= A33333a@ףp= Aa@ףp= B333333a@ףp= B33333Ca@ףp= A,a@ףp= Aa@A33333a@ףp= Ab@QEb@ףp= WDb@ףp= WDb@ףp= D b@Dfffff&b@ףp= E)b@@E0b@ףp= wE9b@EfffffFb@EYb@QEffffffb@ףp= Epb@QkE|b@QEb@QKEfffffb@ףp= Eb@Eb@Db@Db@QkDib@DYb@ףp= DfffffFb@ףp= D0b@QkDb@ףp= WDe@QDPf@@A5e@QCfffffe@ףp= Cfffffe@QC33333e@Dfffffe@Q+D33333e@ףp= wDe@QDfffffe@QDe@ףp= Dffffff@D f@ףp= WDf@ D f@Cf@C33333#f@C0f@QCX\(\E@Gz>X(\bE@QEX(\bE@ ףp=JXp= cE@GzNX)\hE@(\OXlE@ףp= WX(\oE@`XlE@ףp= gXlE@= ףpmX ףp=jE@ףp= wXlE@ ףp=zX)\hE@= ףp}X(\bE@(\X(\bE@)\X ףp=jE@GzXlE@p= דXq= ףpE@)\X(\uE@= ףpX(\uE@XE@.)\(X\(@= ףp]WQ=@)\XWGz=@QUW=@(\RWGz=@PW=@(\OWQ=@(\OWQ=@(\RWQ=@(\RWHz>@p= SWR>@QUWR>@QUW>@ףp= WWQ=@QUWQ=@QXWzG=@Q[WzG=@= ףp]WQ=@3ףp= 7WGz=@ ףp=*WQ=@ףp= 7W33333=@Q5WQ=@(\2WQ=@(\2WQ=@ףp= 7WQ=@ףp= 7W=@Q5WGz=@Q5W=@(\/WGz=@\(,WGz=@Q+WzG=@Gz.WzG=@= ףp-Wfffff=@(\/Wfffff=@Gz.WQ=@\(,WQ=@ ףp=*Wfffff=@Q+WQ=@0WQ=@(\2W33333=@Q5WQ=@ףp= 7W33333=@4Q(WQ=@ ףp=WR=@Q(WHz=@ףp= 'WQ=@(\"W33333=@ WQ=@GzWQ=@QWQ=@ ףp=WQ=@ ףp=W(\=@QWHz=@= ףpWHz=@ W(\=@R!W=@p= #WR=@Q(WHz=@5ףp= VQ+>@ ףp=VY>@ףp= V333333>@QVQ+>@RVQ+>@GzVQ+>@\(V{G:>@\(V(\B>@ ףp=VL>@\(VL>@\(VRQ>@(\VY>@VY>@(\VGzT>@p= ףVL>@QVL>@QVHzG>@QV{G:>@QVQ8>@ףp= V333333>@6\(VHz>@pVzGa>@\(VzG!>@QVGz>@ףp= V >@RV >@= ףpVHz>@QVHz>@V >@= ףp}VGz>@)\xVfffff&>@ףp= wVfffff&>@ףp= wVQ>@QuV>@(\rVQ>@pVfffff&>@pVQ+>@p= sVQ8>@QuVQ8>@)\xV@>@\(|V@>@(\V(\B>@VRQ>@p= ׃VGzT>@QVQ^>@QVzGa>@GzVzGa>@(\VY>@ףp= V@>@QV333333>@\(VQ+>@\(VzG!>@78GznX333339@= ףp=X333333<@d ףp=JX333339@QKX :@\(LX(\:@GzNX(\:@= ףpMX :@GzNXGz:@RQXGz:@QUXfffff&:@p= SX333333:@QUX{G::@p= SX(\B:@ףp= WX(\B:@QXXY:@ ףp=ZXY:@)\XXzGa:@ ףp=ZXQk:@\(\XQk:@Q[XQk:@= ףp]XQx:@Q[X{Gz:@\(\XR:@= ףp]XzG:@Gz^X33333:@Gz^X:@RaXR:@QeX:@p= cXfffff:@RaXQ:@(\_XQ:@`XzG:@p= cXfffff:@p= cX;@(\_X;@Gz^X{G:@Gz^XR;@`X;@= ףp]XQ;@= ףp]XQ+;@\(\X(\B;@Gz^X(\B;@(\bX{G:;@QeX@;@ ףp=jX@;@ ףp=jX(\B;@= ףpmX(\B;@ ףp=jXL;@\(lXRQ;@GznXffffff;@QkXY;@QhXHzG;@p= cXGzT;@`XzGa;@`X33333s;@(\_XQk;@(\_XQ^;@`XRQ;@p= cXHzG;@RaX(\B;@(\_XL;@Q[XRQ;@QXXQk;@ףp= WX{Gz;@QUX̌;@p= SX;@(\RXfffff;@RQXQ;@ףp= WXQ;@ ףp=ZXHz;@)\XX;@Gz^XR;@`XGz;@(\bXQ;@`XzG;@(\_XQ;@Q[XzG;@ףp= WXzG;@QXX;@ףp= WXGz;@p= SXzG;@PXzG;@PXGz;@\(LXR;@QKXQ;@QHXQ;@QEX{G;@(\BX <@(\BXQ<@p= CXQ<@p= CX<@ףp= GXGz<@)\HXHz<@\(LXR<@GzNXGz<@QKXzG!<@QKXQ+<@)\HXfffff&<@RAX333333<@(\BXfffff&<@(\?XzG!<@= ףp=X333333<@8Gz>XzG!<@(\W<@6= ףp=X333333<@Gz>XzG!<@\(8ףp= wVQ=@QVGz>@d(\RVQ=@(\OVzG=@QUVzG=@QUVQ=@ףp= WVzG=@ףp= WVQ=@QXVfffff=@)\XVQ=@ ףp=ZVQ=@Q[VzG=@\(\VzG=@\(\VQ=@= ףp]VQ=@Q[V33333=@ ףp=ZVQ=@)\XVQ=@ ףp=ZVQ=@\(\VQ=@= ףp]V33333=@(\_V>@= ףp]V{G=@\(\V>@Gz^V>@= ףp]VHz>@\(\V(\>@)\XVHz>@)\XV >@\(\V >@`VGz>@`VHz>@QeV>@QeVQ=@ףp= gVzG=@ ףp=jVQ=@GznVzG=@pVQ=@pVQ=@GznV33333=@p= sVQ=@ףp= wV33333=@ףp= wV>@QuVHz>@QuV >@(\rV >@(\oV(\>@GznV(\>@(\oV >@GznVR>@\(lVR>@\(lV>@)\hVfffff&>@QeVfffff&>@(\bVQ+>@`VQ+>@Gz^V333333>@Gz^VQ+>@= ףp]VQ+>@\(\V@>@ףp= WVL>@QUVRQ>@QUVGzT>@)\XVY>@QUVzGa>@RQVY>@p= SVGzT>@p= SVL>@\(LVGzT>@QEVQ^>@= ףp=Vffffff>@Q8Vffffff>@Q8VQk>@ ףp=:VQk>@ףp= 7VQk>@Q5VQk>@(\2Vffffff>@p= 3VzGa>@(\/VY>@= ףp-VY>@Q+VQ^>@)\(VQ^>@ףp= 'VzGa>@p= #VY>@(\VRQ>@= ףpVGzT>@= ףpVQ^>@ ףp=VY>@QVzGa>@QVffffff>@QVffffff>@QVzGa>@VzGa>@GzVQ^>@\( VQ^>@= ףp VGzT>@)\VGzT>@ףp= VzGa>@ףp= V>@QVHz>@QVR>@QVGz>@?0QV{G:>@ףp= UQ>@#QVGz>@p= VQ>@(\VQ>@GzUQ>@= ףpUfffff>@\(UQ>@QUfffff>@QU>@ ףp=UR>@\(U{Gz>@QUQk>@ףp= UzGa>@QUGzT>@RUL>@(\U(\B>@ףp= U@>@ ףp=U@>@\(U(\B>@(\V{G:>@\(U{G:>@ףp= U{G:>@U@>@QU@>@QUHzG>@(\UGzT>@(\UY>@= ףpUffffff>@ ףp=UQk>@ ףp=U33333s>@)\UQx>@ףp= UQk>@QUffffff>@QUY>@= ףpUL>@(\UHzG>@@= ףpUL>@\(UGz>@= ףpUL>@ףp= URQ>@QUY>@RUY>@RUzGa>@\(UQk>@ ףp=U>@\(UHz>@QUGz>@)\UHz>@ףp= U(\>@ףp= U33333s>@QU33333s>@(\Ǔ>@UGz>@RU>@\(UQx>@Uffffff>@QUzGa>@\(UQ^>@ApU{G=@= ףp]U>@KUffffff>@)\Uffffff>@QUQk>@= ףpUQk>@ףp= UQk>@ףp= UQx>@QUQk>@p= ףU33333s>@UQx>@(\U>@GzU>@QU33333s>@QU{Gz>@= ףpU{Gz>@= ףpUQx>@QU33333s>@QUQk>@ ףp=UQk>@QUzGa>@= ףpUffffff>@(\UQk>@RUQk>@(\UzGa>@QUQk>@ףp= UzGa>@ ףp=Uffffff>@(\UQk>@RUffffff>@GzUzGa>@QUzGa>@QUQ^>@(\UY>@)\URQ>@RUHzG>@Q{U{G:>@QuUQ+>@(\oUzG!>@GznUfffff&>@pUQ+>@pUQ8>@(\rU@>@QuU@>@ףp= wU{G:>@QxU(\B>@ףp= wUHzG>@RqUL>@(\oUHzG>@GznU{G:>@= ףpmU(\B>@ ףp=jU(\B>@\(lU{G:>@GznUQ+>@)\hUzG!>@)\hUfffff&>@ףp= gUQ>@QhU>@QeUQ>@(\bUQ>@RaU>@`U>@(\_UHz>@= ףp]U(\>@(\_U(\>@RaU >@p= cUGz>@QhU>@QhUQ>@ ףp=jUQ>@QkUzG!>@\(lUQ>@)\hUGz>@p= cUHz>@`U{G=@(\bU{G=@QeU(\>@BP(\bUQ=@p= SU{G=@(\bU{G=@\(\U33333=@QXUfffff=@ףp= WU=@p= SU=@QUU{G=@QUUQ=@CQ[U=@= ףp-UzG=@ ףp=ZUzG=@Q[UGz=@ ףp=ZU{G=@QXUQ=@QUUQ=@(\OUQ=@\(LUQ=@ ףp=JUzG=@ףp= GUzG=@p= CU=@Gz>UQ=@ ףp=:Ufffff=@p= 3UQ=@Gz.U{G=@= ףp-U(\=@D(\OUzG=@QUQ=@ףp= GUzG=@QEUQ=@QHUQ=@(\OUQ=@QHUQ=@@UQ=@Gz>U(\=@\(@>QUfffff=@QUQ=@QU33333=@\(UQ=@\(U>@QU{G=@)\U(\>@QUHz>@QUR>@QUGz>@(\U >@RU>@GzUGz>@= ףp U>@\( UR>@QU>@U>@\(T >@ףp= T>@TQ=@QTQ=@)\TQ=@QTR=@QT(\=@(\TQ=@GzTQ=@ ףp=TQ=@ ףp=T(\=@QT{Gz=@(\TQk=@GzTQk=@= ףpTzGa=@ ףp=TGzT=@ ףp=TL=@QT(\B=@QTQ8=@(\TQ+=@(\TQ+=@ ףp=TQ+=@p= ׳Tfffff&=@p= ׳TGz=@T =@(\T{G<@\(TQ<@)\Tfffff<@)\T<@= ףpTQ<@GzTGz<@ ףp=T<@ ףp=TQ<@QTzG<@ ףp=THz<@QT33333s<@= ףpTffffff<@GzTY<@(\TRQ<@T{G:<@p= ׳TQ+<@(\TQ<@p= ׳T<@QTQ;@ףp= TQ;@FXףp= TQ;@= ףpT<@QT<@ףp= TQ;@ףp= TQ;@QTGz;@RT;@(\TQ;@(\TQ;@= ףpTzG;@GQTQx;@ ףp=THz<@0QTGz;@RT;@(\T;@= ףpT{G;@\(T33333;@)\T33333;@ ףp=T{G;@ףp= T;@ףp= T;@ ףp=Tfffff;@(\TQ;@= ףpTQ;@ ףp=TQ;@= ףpT{G;@\(T<@\(THz<@QT<@ ףp=THz<@QT{G;@)\TQ;@QTQ;@(\TQ;@(\TQ;@p= ףT;@TR;@GzTR;@(\TQ;@(\TQ;@GzTQ;@GzTQ;@QT33333;@QTQ;@ ףp=TQ;@ ףp=TR;@QT(\;@(\T{G;@GzTQ;@RT33333;@TQ;@(\TQ;@p= ףTfffff;@p= ףT;@ףp= TGz;@ ףp=T(\;@\(T(\;@= ףpTQx;@GzT;@(\THz;@H= ףpTQk:@RTQx;@QTL;@)\TzGa;@\(TQk;@= ףpTQx;@)\TQk;@QTffffff;@(\TRQ;@(\T(\B;@p= ףTL;@p= ףT(\B;@RT{G:;@(\Tfffff&;@= ףpTR;@ ףp=T{G:@ףp= TQ:@p= דT:@RT(\:@TQ:@GzT:@= ףpŤ:@= ףpT{Gz:@)\TQk:@QTQk:@RT33333s:@QTQx:@QT33333s:@QT{Gz:@= ףpŤ:@I8p= דTQ9@\( TQ:@dp= דT:@(\TR:@\(TR:@ ףp=THz:@QTzG:@\(TQ:@(\TQ:@\(TQ:@QTQ:@)\TQ:@ףp= TQ:@QT33333:@TQ:@QTQ:@QTzG:@p= ׃TzG:@p= ׃T:@QTQ:@p= ׃TzG:@ףp= Tfffff:@QT33333:@)\TQ:@QTQ:@QTQ:@)\TzG:@QTR:@ףp= T:@QT{Gz:@p= ׃T:@QTGz:@QTGz:@p= ׃TzG:@(\T:@p= ׃TR:@(\THz:@THz:@T{Gz:@= ףp}T33333s:@)\xTffffff:@ףp= wTGzT:@QuT@:@p= sTGz:@RqT(\:@(\oTQ9@\(lT9@ ףp=jTfffff9@ףp= gTfffff9@RaTQ9@\(\TR9@QXT(\9@QUTQ9@(\RTQ9@PTQ9@(\OTGz9@(\OŤ9@= ףpMŤ9@GzNT9@QKT33333s9@ ףp=JTzGa9@QHTY9@ ףp=JTGzT9@QKTHzG9@\(LT{G:9@ ףp=JT3333339@ ףp=JTQ+9@QHTfffff&9@QETQ9@(\BTzG!9@(\?TzG!9@ ףp=:Tfffff&9@Q8TQ+9@Q5TQ+9@p= 3TQ+9@p= 3Tfffff&9@(\2TQ+9@R1TzG!9@0Tfffff&9@Gz.Tfffff&9@= ףp-TQ+9@Q+TQ+9@ ףp=*T3333339@ףp= 'T3333339@(\"TQ89@ T3333339@GzTQ89@\(T{G:9@\(T@9@ ףp=T(\B9@QTGzT9@ףp= TGzT9@QTQ^9@QTffffff9@QT33333s9@ףp= T{Gz9@QŤ9@QT9@(\TzG9@T{G9@= ףp T9@\( T9@J@\( TQ9@)\TQ9@\( T9@)\TQ9@)\TR9@Q T{G9@Q TQ9@K0ףp= 7TQ9@(\T<@#)\TQ9@QTR:@ףp= TQ+:@QT@:@QTQ^:@p= T(\:@(\TGz:@(\T33333:@(\TR:@p= TzG:@QTQ:@ףp= THz;@)\T;@Q TQ+;@= ףp TQ+;@= ףp T333333;@(\T(\B;@RTY;@QTQx;@ףp= Ť;@QT;@)\TQ;@QT{G;@GzTR;@ Tfffff;@p= #T{G;@ףp= 'TR<@ ףp=*TQ+<@\(,T(\B<@(\/TQ^<@R1TQx<@p= 3TR<@Q5T33333<@ףp= 7T<@R1T<@Lh(\2Tfffff&<@ףp= 'TQ<@ ףp= 'Tfffff&<@ ףp=*T{G:<@\(,TL<@Gz.Tffffff<@(\/T{Gz<@(\/THz<@Gz.T<@(\2TQ<@(\2TQ<@(\/TQ<@Mx\(,TRQ<@Q%TQ<@ \(,TRQ<@\(,TQ^<@ ףp=*TRQ<@Q+Tffffff<@ ףp=*TQx<@Q(THz<@Q(TGz<@)\(TQ<@Q%T<@Q%T(\<@ףp= 'TQx<@ףp= 'TQ^<@NX)\8TzG<@Q(T{G<@Q(TzG<@\(,TQ<@(\/TQ<@R1T<@Q5TGz<@ףp= 7Tfffff<@)\8T{G<@Q5T33333<@O8(\bTQ+;@Q T?@dQ TQ+;@= ףp T(\B;@(\TY;@(\TQx;@QŤ;@QT;@ףp= TzG;@ףp= TQ;@ ףp=T(\;@\(T;@(\TQ;@R!T<@p= #T <@Q%Tfffff&<@ףp= 'T(\B<@ףp= 'TQ^<@Q%TQk<@Q%TQk<@R!T33333s<@p= #T<@Q%T<@Q(TzG<@= ףp-T{G<@0TR<@p= 3Tfffff<@Q5T33333<@)\8T(\=@\(@ףp= WTQ>@)\XT@>@ ףp=ZTGzT>@ ףp=ZTffffff>@Q[TQk>@Q[T{Gz>@Gz^T(\>@\(\T(\>@= ףp]TGz>@\(\T33333>@Gz^T{G>@Gz^T(\>@\(\TGz>@ ףp=ZTQ>@Q[TQ>@= ףp]TQ>@Gz^TQ>@RaTQ>@= ףp]T(\?@Gz^THz?@`T(\?@`TR?@(\_T ?@Gz^TR?@Q[T(\?@ ףp=ZTGz?@Q[TQ?@= ףp]TGz?@(\bTzG!?@= ףp]TQ?@\(\TQ+?@Q[TzG!?@)\XTzG!?@QUT333333?@(\RT{G:?@(\RTHzG?@QUTRQ?@QUTGzT?@(\RTRQ?@(\RTQ^?@QUTffffff?@QUTQk?@RQTzGa?@PTQk?@= ףpMT{Gz?@\(LTHz?@(\OTHz?@(\RT?@RQTHz?@p= STHz?@(\RŤ?@GzNTR?@= ףpMT?@\(LTR?@)\HTzG?@ ףp=JT33333?@= ףpMTQ?@= ףpMT33333?@PT?@P8PT{G?@(\S(\@@dPT?@QKT{G?@QKT(\?@)\HT{G?@QET(\?@p= CTR?@ףp= GT?@ ףp=JT?@ףp= GTQ?@QET?@ףp= GTfffff?@QETzG?@@TQ?@= ףp=Tfffff?@@TQ?@= ףp=TQ?@\(SA@@SfffffA@p= CSq= ףA@QES33333A@(\BSq= ףA@(\?S)\A@= ףp=S)\A@\(S(\B@\(S(\"C@@Sp= #C@(\BS)\(C@RAS ףp=*C@RASq= ף0C@p= CS333333C@QES(\/C@ ףp=JS(\/C@QKS,C@RQS ףp=*C@QUS,C@(\RS,C@QXS(\5C@QUS(\5C@QUS= ףp=C@(\RS(\BC@p= SSfffffFC@(\RSp= CC@PSLC@PSq= ףPC@(\OS33333SC@= ףpMS33333SC@GzNSq= ףPC@= ףpMS(\OC@)\HSq= ףPC@QKS(\UC@)\HS(\UC@QHS(\UC@QHSq= ףPC@ ףp=JSLC@\(LSLC@= ףpMS)\HC@\(LS)\HC@(\OSfffffFC@RQS@C@RQS(\5C@PSq= ף0C@GzNS(\/C@= ףpMS(\/C@)\HS333333C@QHS9C@ףp= GS9C@ףp= GS(\5C@p= CS9C@p= CS= ףp=C@@S(\5C@(\?S,C@Q;S)\(C@Q;Sfffff&C@ףp= 7S(\"C@ףp= 7Sfffff&C@)\8S ףp=*C@Q8S(\/C@Q;S333333C@ףp= 7Sq= ף0C@Q5S,C@p= 3S(\"C@R1S= ףpC@(\/S C@Gz.Sfffff&C@Gz.S= ףpC@= ףp-S(\"C@)\(S(\"C@ ףp=*S C@\(,S= ףpC@Q%S\(C@p= #S(\C@(\"Sq= ףC@ Sq= ףC@GzS C@X8= ףp-SfffffC@QSp= ףC@dGzS C@(\Sq= ףC@GzSq= ףC@GzS(\C@= ףpS(\C@GzS\(C@\(SC@\(S(\C@QS(\C@\(S33333C@\(S(\C@)\S C@QS)\C@QSfffffC@QS C@QSq= ףC@QSq= ףC@QS33333C@)\S\(C@ ףp=S(\"C@)\Sfffff&C@ ףp=S)\(C@= ףpSp= #C@R!S,C@ S(\/C@Q%S333333C@ ףp=*S9C@\(,S= ףp=C@\(,S(\BC@= ףp-SfffffFC@\(,SfffffFC@\(,S)\HC@ ףp=*SfffffFC@Q+S@C@)\(S\(@(\"VQ8>@0 V333333>@ ףp=VQ8>@ VQ8>@= ףpV333333>@ ףp=V333333>@8QV{G:>@QV(\B>@QV{G:>@RV{G:>@ ףp= V(\B>@QV(\B>@`p= URQ>@(\Uffffff>@ p= UGzT>@RURQ>@\(UGzT>@ףp= UY>@UQ^>@)\UzGa>@Uffffff>@)\Uffffff>@(\Uffffff>@p= sTHz8@\(\T333338@p= sTHz8@RqŤ8@GznTR8@\(lŤ8@QkTR8@ףp= gTGz8@RaTQ8@`Tfffff8@Gz^TzG8@Gz^Tfffff8@= ףp]Tfffff8@\(\TzG8@= ףp]TQ8@(\_T333338@(\_TQ8@RaT333338@RaTQ8@p= cTQ8@(\bTzG8@QeTfffff8@p= cTQ8@ףp= gTQ8@ףp= gTfffff8@ ףp=jT8@= ףpmT8@GznTGz8@(\oTGz8@RqŤ8@p= sTR8@p= sTHz8@= ףp]TzG8@p= ST{G8@Q[TzG8@)\XTfffff8@)\XTQ8@QXTfffff8@ףp= WTfffff8@QUTzG8@QUTQ8@p= STQ8@QUT333338@QXT333338@ ףp=ZT{G8@)\XTQ8@Q[T333338@= ףp]T{G8@= ףp]TQ8@Q[T333338@ ףp=ZTQ8@Q[Tfffff8@Q[TzG8@0 ףp=ZTQ8@(\OTQ8@ ףp=ZTQ8@QUTzG8@(\OTQ8@0QHT333338@ ףp=:THz8@QHT333338@@T{G8@ ףp=:THz8@ףp= 7TR8@Q Ť9@ ףp= 7TR8@(\2T8@= ףp-TzG8@Q(TQ8@(\"T9@= ףpTR9@QTfffff&9@ףp= T3333339@p= T(\B9@TY9@GzTQk9@\( T{Gz9@Q Ť9@X= ףp-TzG8@= ףpTQ89@= ףp-TzG8@)\(TQ8@Q%T{G8@ T 9@= ףpTQ9@GzTfffff&9@= ףpT3333339@GzTQ89@0GzTfffff&9@)\TQ+9@GzTfffff&9@QTfffff&9@)\TQ+9@`\(TQ+9@GzTQk9@ \(T{G:9@QT3333339@)\TQ+9@ףp= TQ89@QT@9@QTHzG9@QTHzG9@RTY9@GzTQk9@HRS@@Gz~S33333@@RS(\@@Gz~S@@Gz~S33333@@(\Sq= ף@@Sq= ף@@RS(\@@PQESq= ףPA@(\"SYA@QES33333SA@RAS(\UA@Q;S(\UA@Q5SYA@0SYA@)\(S(\UA@(\"Sq= ףPA@P(\"SLA@p= SfffffA@(\"SLA@(\S(\UA@\(S= ףp]A@ףp= S)\hA@(\S(\uA@)\SA@p= SfffffA@HS)\A@(\R(\•A@ ףp=Rq= ףA@(\R(\A@S)\A@GzŘA@ ףp=Rq= ףA@(\R(\•A@(\RA@GzR(\A@RR(\A@ףp= RA@ ףp=R\(A@\(R= ףpA@(\RA@ ףp=R\(A@QR= ףpA@(\R\(A@RR(\A@R ףp=A@(\R(\µA@(\R= ףpA@GzRfffffA@GzR(\A@(\RA@RR(\A@XGzR)\A@QR(\A@GzR(\A@GzR(\A@QRq= ףA@QR ףp=A@QR)\A@QR(\A@QR(\A@GzR(\A@8(\S= ףpC@)\S,C@(\S,C@GzS)\(C@\( S(\"C@)\S= ףpC@0GzS(\"C@\( S)\(C@\( S(\"C@\( Sfffff&C@GzS)\(C@@QS33333C@(\SC@QSC@p= S33333C@(\S(\C@p= SC@QSC@Pp= S ףp= C@Sq= ףC@p= S ףp= C@S ףp= C@RS(\C@Sq= ףC@(\S(\C@(\S C@p= S ףp= C@pp= S(\B@(\Rp= C@ p= S= ףpB@RS(\B@SB@S= ףpB@(\SC@RSC@(\R= ףpB@(\R(\C@RSp= C@p= Sp= C@p= S= ףpB@pQRq= ףB@ ףp=RC@ ףp= Rq= ףB@QR33333B@QR\(B@p= R\(B@p= R= ףpB@Rp= C@R)\C@GzR ףp= C@= ףpR(\C@\(R(\C@ ףp=RC@h ףp=R(\B@QR ףp=*C@ ףp=R(\B@QR(\B@ףp= Rq= ףB@p= RB@(\Rp= C@= ףpR ףp= C@QR33333C@ ףp=RC@)\R(\"C@QR ףp=*C@@(\RD@\(Qp= ףD@(\RD@RD@\(Qp= ףD@RR(\D@(\RD@XQQ33333D@p= Q= ףpD@QQ33333D@p= Q33333D@QQ(\•D@p= Q\(D@QQ= ףpD@QQD@ףp= Q(\•D@QQ33333D@P ףp=QD@QQ)\D@ ףp=QD@QQ= ףpD@QQ)\D@)\Qp= D@)\QD@ ףp=Q= ףpD@ ףp=QD@@ףp= Q ףp=D@p= Q33333D@QQ ףp=D@p= Q(\D@ףp= Q33333D@QQ(\D@QQ ףp=D@QQfffffD@= ףpQ= ףpD@QQ̬D@(\QfffffD@GzQ ףp=D@QQ̬D@= ףpQ̬D@= ףpQ(\µD@Qq= ףD@p= ףQ(\µD@QQ\(D@ףp= QD@ףp= Q= ףpD@= ףpQ(\µD@RQ̬D@QQ̬D@`Q= ףpD@Gz~Q(\D@ Qp= ףD@QQD@QQ= ףpD@Q= ףpD@Gz~Q(\D@(\Q(\D@(\Q ףp=D@ףp= Qp= ףD@Qp= ףD@\(@(\bV?@(\bVQ+>@QeVQ+>@QhVQ8>@)\hV(\B>@ ףp=jVL>@)\hVGzT>@QkVQ^>@\(lVffffff>@\(lV33333s>@RqV(\>@QuVGz>@QuVzG>@ףp= wVQ>@QuV{G>@QuVHz>@(\rVR>@(\rV>@RqVfffff>@(\oV{G>@pV?@)\U33333s>@ ףp=U?@ ףp=U33333s>@\(U{Gz>@= ףpUHz>@QUR>@ ףp=UQ>@ ףp=Ufffff>@\(UQ>@(\U33333>@(\U>@p= U>@QU>@)\UzG>@QUQ>@ףp= U?@(\TQ^>@= ףp]TGz>@GzTR>@(\THz>@= ףpT{Gz>@= ףpTffffff>@\(TQ^>@p= ׃TQ^>@p= ׃TQk>@RT>@RTGz>@p= ׃Tfffff>@p= ׃T{G>@RT(\>@(\T>@(\THz>@= ףp}TGz>@ ףp=zTR>@ףp= wTHz>@QuTHz>@(\rT(\>@(\rTHz>@(\oT>@QkT>@QeTQ>@= ףp]TQ>@= ףpMU33333>@Gz.U@@6= ףp=Ufffff>@= ףp=U(\>@ףp= 7U33333>@ףp= 7U>@R1U(\>@Gz.UHz>@(\2UHz>@R1U>@Q5U>@Q;UHz>@= ףp=Ufffff>@@UQ>@@U(\?@(\BUGz?@QEUfffff&?@ףp= GUQ+?@ףp= GU{G:?@QHUHzG?@QEURQ?@QEUzGa?@QEUQk?@QEU{Gz?@p= CUHz?@QEUQ?@QHUQ?@)\HUHz?@)\HUQ?@QHUQ?@QEU33333?@p= CU(\@@p= CU ףp= @@QEUq= ף@@(\BU(\@@Gz>U(\@@(\?U\(@@\(U333333@@Gz>U(\5@@@U9@@@U(\B@@QEU ףp=J@@ףp= GUq= ףP@@QHU= ףp]@@ ףp=JU(\b@@QHUp= c@@QKUffffff@@QKUl@@\(LU(\o@@\(LU(\u@@= ףpMU@@= ףpT(\@@)\8T(\@@.)\8T(\@@\(U(\G@@UG@= ףp=U= ףpG@ ףp=:Up= G@= ףp=U)\G@= ףp=UG@Q;UG@ףp= 7U33333G@ףp= 7U(\G@)\8UG@ ףp=:U(\G@Q;UG@QEUG@PUG@ףp= WU(\G@)\XU(\G@`U(\G@)\hU(\G@RqU(\G@ףp= wU\(G@ ףp=zU(\H@\(|Up= H@|Up= H@Gz~UfffffH@U ףp= H@(\U(\H@)\U= ףpH@)\U(\"H@= ףpU(\/H@\(Uq= ף0H@(\U(\5H@(\U\(V(\BH@ ףp=JV= ףp=H@GzNV(\5H@GzNV)\(H@(\OVfffff&H@RQV= ףpH@p= SV(\H@QUVq= ףH@QXV(\H@ףp= WV H@)\XV ףp= H@= ףp]V ףp= H@Q[V)\H@Gz^VfffffH@= ףp]Vp= H@`Vp= H@QeVH@(\bVH@ףp= gV\(G@)\hV= ףpG@)\hVG@QkV\(G@\(lVG@(\oV(\G@QuVq= ףG@)\xV(\G@Gz~V ףp=G@ףp= VfffffG@= ףpVp= G@p= דVG@ ףp=V= ףpG@= ףpV\(G@(\VG@ ףp=V33333G@GzVq= ףG@p= ׳V ףp=G@ ףp=Vp= G@(\V= ףpG@p= VG@)\Vq= ףG@GzV)\G@(\V(\G@QVG@GzVq= ףG@QV ףp=G@ ףp=Vp= ׃G@= ףpVG@p= V(\uG@)\V33333sG@GzVlG@ףp= Wp= cG@pp= ׳V`G@QVq= ףpG@ p= ׳V`G@RV`G@GzVp= cG@ ףp=VffffffG@\(V)\hG@QVlG@QVq= ףpG@ ףp=VlG@(\V)\hG@p= ׳Vp= cG@p= ׳V`G@HRV(\uG@= ףpV\(|G@V(\uG@= ףpV(\uG@GzV\(|G@V\(|G@RVyG@V(\uG@XQV(\uG@RV= ףp}G@QV(\uG@ףp= V(\uG@QV(\uG@p= ףV(\uG@RV\(|G@(\V= ףp}G@ ףp=VyG@QV(\uG@H(\VG@QV ףp=G@(\VG@= ףpVG@QVp= ׃G@QV ףp=G@GzV ףp=G@(\VG@GzNV)\G@= ףpV(\H@GzNVG@ ףp=JV)\G@(\?V(\G@ ףp=:V33333G@@Vq= ףG@@V33333G@Q;V(\G@p= 3V= ףpG@(\/V= ףpG@Q%VfffffH@Q%V ףp= H@= ףpV(\H@Q%Vq= ףH@)\(V33333H@\(,V(\H@R1V ףp= H@p= 3VfffffH@ףp= 7VfffffH@@VH@)\HVG@GzNV33333G@GzNVG@P\(LVH@(\BV(\"H@\(LV\(H@)\HV\(H@QHVH@(\BV= ףpH@p= CV(\"H@)\HV(\"H@\(LV\(H@p= ףpU9G@ףp= U)\HG@ = ףpU(\BG@\(U@G@\(U9G@ ףp=U\(TyF@(\BT33333sF@@Tq= ףpF@(\BT ףp=jF@QHTp= cF@QHT(\bF@QETp= cF@(\?T)\hF@= ףp=TffffffF@ ףp=:TffffffF@)\8T(\bF@\(S(\E@)\8SfffffE@p= 3SfffffE@(\/S ףp=E@\(,S̬E@Q(S(\µE@(\"S\(E@ S\(E@QS(\E@(\S(\E@(\Sp= E@GzSfffffE@= ףp SE@= ףp S(\E@(\S)\E@p= S ףp=E@(\S(\E@(\Sq= ףE@(\S(\E@= ףp S(\E@)\S33333E@)\S(\E@QS\(E@= ףp S\(E@GzSF@RS\(E@RSF@p= S(\F@(\S)\F@QS)\F@QS(\F@RS(\F@S(\F@\( S\(F@QS F@RS(\"F@QR ףp=*F@)\R(\/F@ףp= R(\/F@ףp= Rq= ף0F@QR333333F@p= R333333F@RR9F@(\R\(S)\F@QESfffffF@RASp= F@\(S(\F@(\?S= ףpE@(\BSE@(\BS(\E@@S(\E@ףp= gSE@Q8SF@@S(\E@= ףp=S(\E@Q8SE@Q8S(\E@Gz>S33333E@p= CSq= ףE@QHSE@ ףp=JSE@QKS(\E@GzNSE@(\OS(\E@GzNSq= ףE@(\OS33333E@(\RS33333E@QUSE@Q[S(\E@(\_S(\E@QeS= ףpE@ףp= gSF@8p= S)\E@RaSp= F@$QeS= ףpE@RaSF@ףp= gSp= F@QkS(\F@= ףpmSp= F@(\oS(\F@QkSF@GznS= ףpE@pS(\F@p= sSF@QxS= ףpE@(\S\(E@p= ׃S\(E@\(SE@RSE@GzS33333E@)\S33333E@= ףpS(\E@p= ׳S(\E@QSE@\(SE@RS)\E@QSfffffE@)\S(\E@= ףpS= ףpE@(\S(\E@)\S(\E@ ףp=Sq= ףE@GzSq= ףE@(\SE@(\S ףp=E@ףp= Sp= E@ףp= SE@QS(\µE@GzSq= ףE@p= S)\E@`p= 3S(\F@Q(SF@ p= 3Sq= ףF@(\2S(\F@= ףp-S(\F@\(,S33333F@Q(S(\F@Q(SF@= ףp-S(\F@(\2S33333F@p= 3Sq= ףF@ S F@= ףp S= ףpF@ Sq= ףF@= ףpS33333F@= ףpSq= ףF@(\S(\F@= ףpS(\F@= ףpS F@)\Sq= ףF@ףp= S(\F@)\SF@(\S\(F@= ףp S= ףpF@S= ףpF@(\S\(F@(\S= ףpF@QS= ףpF@QS\(F@ S(\F@ Sq= ףF@H ףp= S F@QSfffff&F@)\S F@ףp= S(\"F@QSfffff&F@ ףp= Sp= #F@ ףp= S(\"F@)\S F@`(\RfffffFF@(\R(\F@ (\RfffffFF@RRYF@)\Rp= cF@(\RlF@\(Rq= ףpF@(\RyF@QRF@QR(\F@(\RF@PRQ= ףpG@p= ׃Q(\5G@RQ= ףpG@Q(\"G@= ףpQfffff&G@= ףpQ,G@ ףp=Q(\/G@ףp= Q333333G@p= ׃Q(\5G@(\OQ)\G@(\PG@(\OQG@QKQG@ףp= GQ(\µG@p= CQ(\µG@p= CQG@Q;Q(\•G@Q8Q(\•G@Gz.Q= ףpG@Q(Q= ףpG@Q%Qp= ףG@(\QfffffG@\(Qp= ףG@)\Qp= ףG@)\Q ףp=G@ףp= Q(\G@(\Q(\G@\( Q ףp=G@QQp= ףG@RQ= ףpG@= ףpP(\•G@ ףp=Pq= ףG@QP ףp=G@(\P)\G@p= P(\uF@(\PF@(\PF@P(\F@p= Pq= ףF@RP ףp=F@p= Pp= F@p= PF@RP(\F@(\PF@\(P(\F@P ףp=F@GzPF@\(P ףp=F@\(PF@P= ףpF@(\P(\µF@QPq= ףF@(\Pp= ףF@\(PF@QPq= ףF@QP33333F@(\P(\•F@ ףp=P33333F@ףp= P ףp=F@ףp= PfffffF@p= PyF@(\P(\uF@)\8W`F@(\W ףp= G@Q5W`F@(\2W)\hF@R1W33333sF@R1W\(|F@(\2Wp= ׃F@Q5W)\F@R1W̌F@R1WF@R1Wp= ףF@Gz.W̬F@Q+W33333F@Q+W(\µF@(\/WF@R1W)\F@Q5WfffffF@)\8W)\F@)\8W33333F@Q8W\(F@p= 3WF@R1W)\F@(\/Wq= ףF@ ףp=*W(\F@p= #WF@R!W= ףpF@GzW\(F@QWp= G@QW(\G@QW)\G@(\W ףp= G@HQ5V̌F@ףp= Up= G@&ףp= ǓF@ ףp=ǓF@\(Uq= ףF@(\U(\•F@= ףpUp= ףF@ ףp=U̬F@\(Uq= ףF@U̬F@QU̬F@ףp= U33333F@QU(\µF@(\U= ףpF@p= Up= F@QU)\F@(\U)\F@RUF@QU33333F@(\U(\F@ףp= U\(F@QUF@= ףpUF@(\Up= F@p= V(\F@)\V)\F@QV(\F@ףp= Vq= ףF@ףp= V(\F@Q V(\F@VF@QVF@QV= ףpF@QV\(F@(\"V(\G@ףp= 'V(\G@Q(V= ףpF@ ףp=*V= ףpF@\(,V(\G@Q5Vp= G@XQV,G@QV)\HG@QV,G@QV9G@V9G@(\V(\BG@QV(\BG@QVfffffFG@)\Vp= CG@QV)\HG@8= ףp]RE@QER ףp=F@dPRE@RQR)\E@p= SR ףp=E@QURq= ףE@QXRq= ףE@ ףp=ZR)\E@\(\R ףp=E@\(\Rq= ףE@ ףp=ZRE@QXR= ףpE@QXRp= E@ ףp=ZR)\E@)\XRE@Q[R(\E@Q[RF@\(\Rp= F@Q[R ףp= F@)\XR(\F@ףp= WR(\F@QXRF@RQR(\"F@p= SR(\"F@p= SRfffff&F@RQR,F@(\RRq= ף0F@PR(\5F@(\OR333333F@GzNR(\5F@GzNR= ףp=F@RQR@F@(\RRfffffFF@= ףpMRfffffFF@\(LR ףp=JF@(\ORLF@(\ORq= ףPF@GzNR33333SF@GzNR= ףp]F@ ףp=JRp= cF@ ףp=JR)\hF@\(LRp= cF@\(LR(\oF@QKR(\uF@\(LR(\uF@(\OR(\uF@GzNR\(|F@)\HR(\F@ ףp=JR= ףp}F@QHR\(|F@QER(\F@QER)\F@ ףp=JR ףp=F@\(LRp= ׃F@GzNR(\F@PRyF@RQR33333sF@(\OR(\uF@(\OR33333sF@(\RR)\hF@(\RRp= cF@PR= ףp]F@(\RR= ףp]F@(\RRYF@QUR(\UF@(\RR(\UF@RQRq= ףPF@p= SRLF@ףp= WRq= ףPF@ףp= WRYF@QUR`F@p= SR(\bF@QURp= cF@p= SRlF@QUR(\uF@QUR= ףp}F@QXRF@ףp= WRyF@ ףp=ZR(\uF@)\XR33333sF@Q[R)\hF@QXR)\hF@)\XR(\bF@Q[R(\bF@Q[R`F@)\XR= ףp]F@)\XRYF@Q[R\(\F@= ףp]R\(\F@\(\Rq= ףPF@= ףp]R ףp=JF@ ףp=ZR(\BF@Q[R= ףp=F@ ףp=ZR9F@Q[R(\5F@ ףp=ZR333333F@)\XR(\5F@)\XR333333F@ףp= WR)\(F@ףp= WR F@)\XRF@Q[RF@PGz^RF@Q[RF@Q[RF@\(\R(\F@Q[R33333F@= ףp]R F@Gz^Rp= F@= ףp]RF@\(\Rp= F@@QXR ףp=jF@QUR33333sF@QXRlF@ףp= WR ףp=jF@QUR33333sF@ףp= WR33333sF@QXRlF@Q%R= ףp]E@ ףp=QF@3GzR= ףp]E@p= #RffffffE@Q%R(\oE@(\"R33333sE@(\"RyE@GzR\(|E@= ףpRE@GzRfffffE@\(R ףp=E@\(R(\E@= ףpR33333E@\(RE@ ףp=R)\E@QRq= ףE@)\R= ףpE@ ףp=R(\E@)\R)\E@QRE@QRq= ףE@p= R(\E@RR\(E@GzRE@\( R)\E@\( R(\E@)\R(\E@ףp= RF@(\R ףp= F@p= R(\F@QRF@p= R= ףpF@QR(\"F@(\R)\(F@ ףp=Q,F@QQ,F@p= Qq= ף0F@\(Q(\5F@)\Q= ףp=F@QQ@F@QQfffffFF@(\Q ףp=JF@QQ33333SF@)\Q`F@QQp= cF@p= Q(\oF@Q33333sF@(\QF@(\Q(\F@QfffffF@\(Q̌F@QQ(\•F@ ףp=QF@xQ ףp=E@RQ ףp=E@ RQ ףp=E@QQ(\E@QQ33333E@QQ= ףpE@)\Qp= ףE@QQ)\E@GzQ ףp=E@Q33333E@GzQ(\µE@GzQ= ףpE@= ףpQfffffE@GzQ ףp=E@P= ףpS(\B8@GznS3333339@G= ףpS8@ףp= SHz8@(\SQx8@\(S33333s8@)\S{Gz8@ףp= S8@QSHz8@QS{Gz8@)\SQx8@ ףp=SQk8@)\SzGa8@ףp= SQ^8@p= ׃SGzT8@RS(\B8@Gz~SRQ8@\(|SRQ8@)\xSQ^8@(\rSQk8@(\rSQk8@GznSQx8@GznS(\8@(\oSHz8@pSQ8@(\oSQ8@RqS{G8@p= sSQ8@(\rS8@QuS(\8@ ףp=zSQ8@Q{SQ8@\(|S333338@\(|S{G8@= ףp}S9@Gz~S{G8@Gz~S 9@= ףp}SR9@Gz~SGz9@SGz9@(\SQ9@SQ+9@(\SQ+9@QSfffff&9@QSfffff&9@ ףp=S3333339@= ףpS3333339@\(SQ+9@= ףpSQ+9@= ףpSzG!9@QS9@ ףp=S 9@ ףp=SQ8@QS333338@QSQ8@\(SQ8@GzS8@(\SR8@RS8@(\S8@RS(\8@p= דS(\8@p= דS8@(\SQ8@QS{G8@QS333338@QSQ8@ףp= S333338@)\SQ8@ףp= SQ8@)\SQ8@ ףp=SzG8@= ףpS8@hS3333338@ ףp=zSHzG8@ S{G:8@= ףp}S3333338@\(|SQ88@Q{SQ88@\(|S{G:8@ ףp=zS@8@Q{SHzG8@Gz~S{G:8@(\S@8@S{G:8@xGz~SQ+8@QuS{G:8@ Gz~SQ+8@= ףp}SQ+8@Q{SQ+8@ףp= wSQ+8@ףp= wSQ88@QuS{G:8@QxS{G:8@ ףp=zS3333338@Q{S3333338@\(|SQ+8@= ףp}S3333338@Gz~SQ+8@Pp= sSRQ8@QkSQk8@p= sSGzT8@RqSRQ8@(\oSRQ8@= ףpmSGzT8@QkSGzT8@= ףpmSQk8@p= sSGzT8@Q{SQ7@`SL8@- ףp=zSfffff&8@ ףp=zSzG!8@)\xS8@Q{S8@Q{SGz8@)\xSR8@ףp= wSR8@QxS 8@QuSHz8@QuS(\8@QuSQ7@QuSQ7@QuSQ7@p= sSQ7@p= sSzG7@QuSzG7@p= sS7@p= sSR7@(\oS7@\(lS{G7@QkSQ7@)\hSQ7@QeS{G7@QeS{G7@p= cS7@RaS7@`S7@RaSQ7@RaSQ7@(\bS8@RaS(\8@(\bSQ8@QeSQ+8@QeSQ88@QhS3333338@)\hSzG!8@)\hSQ+8@ ףp=jS3333338@QhS@8@)\hS@8@QkSL8@(\rS@8@ףp= wSQ+8@)\xSfffff&8@ ףp=zSfffff&8@QeS{G8@RQSGz9@QeS(\9@p= cS9@`S9@(\_S{G8@\(\S9@ ףp=ZS{G8@QXS9@QUS(\9@(\RS(\9@RQSHz9@RQS 9@QUSGz9@= ףp]SGz9@Gz^SR9@RaSR9@RaS 9@QeS(\9@S{Gz:@QxSQ:@5S33333:@SQ:@GzSQ:@ ףp=SQ:@p= ׳S(\:@(\S{Gz:@ ףp=S{Gz:@QS(\:@(\SHz:@= ףpŠ:@ ףp=SR:@GzS:@ףp= SzG:@Sfffff:@= ףp}Sfffff:@ ףp=zSzG:@QxSzG:@)\xSQ:@Q{SQ:@\(|S33333:@= ףp}SQ:@Gz~SQ:@p= ׃S33333:@ףp= SQ:@ ףp=SQ:@= ףpSQ:@SQ:@(\Sfffff:@QSfffff:@ףp= SQ:@)\SQ:@ ףp=SQ:@QSQ:@= ףpSQ:@RSQ:@(\SzG:@QSQ:@QSGz:@QSR:@ ףp=Š:@\(SHz:@(\SHz:@SR:@(\SR:@(\SHz:@p= ׳Š:@QSGz:@QSzG:@)\SzG:@)\Sfffff:@= ףpSQ:@GzS33333:@S33333:@H)\xSR:@QuSQ:@)\xS:@)\xSGz:@QxSR:@QuS:@ףp= wSQ:@)\xS:@8QuŠ:@QuSGz:@QuSR:@QuŠ:@QuSGz:@QuSR:@Pףp= gS(\B:@p= cSGzT:@ףp= gSGzT:@QeSL:@QeS(\B:@p= cSL:@p= cSRQ:@QeSGzT:@ףp= gSGzT:@= ףp}SGz9@(\?SQ:@W= ףp}SzG:@QuSfffff:@pSfffff:@pSzG:@GznSfffff:@ ףp=jSQ:@QeSQ:@p= cSzG:@QeSzG:@p= cSfffff:@(\_S:@= ףp]S:@= ףp]S{G:@Q[SQ:@)\XS33333:@QXSQ:@ףp= WSQ:@QUS33333:@QUSQ:@QUSzG:@QUS:@(\RSQ:@(\RSGz:@PSR:@PS:@QKSR:@)\HSR:@QHSHz:@QESHz:@QHS:@ ףp=JSQk:@ ףp=JSffffff:@QHSY:@QHSL:@ ףp=JSL:@\(LSRQ:@QKSHzG:@GzNS@:@(\OS333333:@= ףpMSQ+:@= ףpMSfffff&:@QUSGz:@ ףp=ZS:@Q[S(\:@Q[S:@)\XS{G9@p= SS{G9@RQSQ9@p= SSQ9@PSfffff9@= ףpMSGz9@\(LS9@QKSQ9@= ףpMS :@\(LSGz:@\(LSQ+:@ ףp=JS{G::@ףp= GSHzG:@(\BSL:@p= CS(\B:@@SHzG:@(\?SGzT:@RASRQ:@(\BSGzT:@(\BSY:@@SQ^:@(\BSzGa:@p= CSffffff:@p= CS(\:@(\BŠ:@QEŠ:@ ףp=JSGz:@GzNS:@(\RSzG:@p= SSQ:@(\RSQ:@p= SS33333:@)\XS:@= ףp]SGz:@p= cSQ:@QeSQ:@QeSfffff:@QkSfffff:@RqSQ:@QuSQ:@ ףp=zSfffff:@= ףp}SzG:@ R1SQk9@ףp= 'SGz9@R1SQk9@(\/SQk9@\(,S33333s9@)\(SQk9@ףp= 'S33333s9@Q(S{Gz9@Q(SQx9@)\(SQx9@ ףp=*S{Gz9@ ףp=*S9@Q+S(\9@\(,S9@= ףp-Š9@Q+SR9@= ףp-SGz9@Gz.SR9@= ףp-Š9@(\/S9@R1SQk9@ Q%SzG8@QSQk9@6Q%SQk9@Q%Sffffff9@(\SY9@QSGzT9@QSRQ9@QSL9@p= S(\B9@(\S{G:9@S3333339@(\S3333339@= ףp SQ+9@Q SzG!9@ ףp= S9@Q S(\9@GzS{G8@GzSQ8@= ףp Sfffff8@\( SQ8@Q SzG8@\( SQ8@= ףp SQ8@= ףp S8@GzSGz8@SGz8@RS8@p= S8@QSQ8@QSQ8@QS8@QSR8@RS8@= ףp S{G8@\( SQ8@ ףp= Sfffff8@QSzG8@QSfffff8@ ףp= S{G8@ ףp= SHz8@)\SQ8@ ףp= SQ8@QS{G8@QSHz9@)\SQ9@QSfffff&9@)\SQ+9@\( S3333339@GzSQ89@ףp= SY9@QSY9@= ףpSQ^9@(\SzGa9@(\"Sffffff9@p= #SQk9@Q%SQk9@ pR8@R333338@+RQ8@(\Rfffff8@\(RzG8@ ףp=RQ8@)\RGz8@)\RHz8@QRHz8@QR8@(\R{Gz8@(\RQx8@Rffffff8@GzRQ^8@= ףpRRQ8@\(RHzG8@ ףp=RHzG8@)\R(\B8@QR{G:8@QR3333338@)\RQ+8@\(RQ+8@(\Rfffff&8@RRzG!8@RQ8@= ףpR8@ ףp=RzG!8@QRzG!8@p= Rfffff&8@p= RzG!8@RRzG!8@RQ8@RRfffff&8@(\RQ88@QRHzG8@\(Rffffff8@(\RQx8@(\Ř8@QRGz8@QRzG8@)\RQ8@\(RQ8@GzR333338@(\RQ8@RQ8@ 8ףp= G]p= C@@= ףp\\(\@@ףp= G]p= C@@]q= ףP@@\Y@@= ףp\\(\@@ p= ׳\GzT?@ףp= Z@@@ p= ׳\@@@\ @@@\Q?@\Q?@ףp= [GzT?@[GzT?@[GzT?@@[GzT?@= ףp [GzT?@= ףp [Hz?@[Hz?@ZHz?@ףp= ZHz?@p= ׳^H@QWH@p= ׳^H@^H@@^H@^H@]H@]H@@]H@]H@\H@\H@@\H@\H@[H@[H@@[H@[H@ZH@ZH@p= SZH@p= ZH@p= YH@p= דYH@p= SYH@p= YH@QXH@QXH@QUXH@QXH@QWH@QWH@0 ףp=W(\•H@QW33333H@ ףp=W(\•H@ ףp=W33333H@QW(\H@@(\RF@(\Q(\F@(\RF@RF@@R(\F@RF@(\Q(\F@hQQF@Q= ףpG@* ףp=QF@QQ= ףpF@)\Q= ףpF@QQ(\F@p= QfffffF@Q(\F@ ףp=Q= ףpF@ףp= Q)\F@RQ)\F@Q ףp=F@\(Q)\F@QQF@ףp= Q= ףpF@QQ)\F@QQ33333F@(\Q(\µF@(\Q33333F@)\Qq= ףF@)\Q(\µF@= ףpQ\(F@GzQ(\F@\(QfffffF@QQ ףp=F@QQ33333F@Q(\F@QQ\(F@ ףp=QF@QQp= F@ףp= QF@(\Q(\F@Q(\F@RQ\(F@QQ\(F@p= דQG@QQ(\G@(\QfffffG@QQ)\G@p= דQ ףp= G@RQ G@Q33333G@p= דQ(\G@RQ= ףpG@0p= ׃Q(\5G@(\OQG@p= ׃Q(\5G@Q(\UG@(\OQG@((\PF@(\P)\G@(\P)\G@(\PF@= ףp _E@[E@= ףp _E@_E@^E@^E@@^E@^E@]E@]E@@]E@]E@\E@\E@@\E@\E@[E@[E@0]G@@]G@]G@]G@@]G@P^(\A@= ףp\\(|C@= ףp\(\A@\fffffA@] ףp= B@@]lB@] ףp=B@]fffff&C@^\(|C@8^= ףpC@^E@^= ףpC@^D@^D@^E@Pףp= \(\B@ףp= \= ףpD@ףp= \(\B@ףp= \B@ףp= \C@ףp= \C@ףp= \D@ףp= \D@ףp= \= ףpD@0@]E@@] ףp=E@@]E@@]E@@] ףp=E@8@]333333G@@]H@@]333333G@@]G@@]H@@]H@ףp= \= ףp}B@QWB@ףp= \B@@\B@\B@[B@[B@@[B@[B@ZB@ZB@@ZB@ZB@YB@Y= ףp}B@@YB@YB@XB@XB@@XB@XB@WB@QWB@hףp= [D@ףp= YD@ ףp= [D@[D@@[D@[D@ZD@ZD@@ZD@ZD@YD@ףp= YD@8ףp= \(\/F@ףp= [9G@dףp= [= ףp=F@ףp= [@F@ףp= [p= CF@= ףp[)\HF@= ףp[(\OF@= ףp[q= ףPF@p= [YF@ ףp=[(\bF@ ףp=[\(\F@[YF@[33333SF@[LF@[fffffFF@[p= CF@ףp= [fffffFF@= ףp[fffffFF@p= [(\BF@ ףp=[)\HF@ ףp=[fffffFF@\p= CF@\p= CF@ףp= \(\BF@= ףp \fffffFF@= ףp \)\HF@p= \)\HF@p= \p= CF@ ףp=\9F@ ףp=\9F@ \= ףp=F@= ףp-\= ףp=F@= ףp-\@F@p= 3\= ףp=F@p= 3\(\5F@p= 3\q= ף0F@p= 3\(\/F@ ףp=:\333333F@@\9F@@\@F@@\p= CF@ףp= G\fffffFF@ףp= G\LF@ףp= G\q= ףPF@ףp= G\YF@= ףpM\p= cF@= ףpM\)\hF@p= S\p= cF@p= S\)\hF@ ףp=Z\(\oF@`\yF@ ףp=Z\yF@ ףp=Z\fffffF@`\ ףp=F@`\(\F@ףp= g\(\F@ףp= g\(\•F@= ףpm\F@= ףpm\ ףp=F@= ףpm\33333F@p= s\F@p= s\= ףpF@p= s\(\F@p= s\(\F@p= s\)\F@p= s\(\F@ ףp=z\(\F@ ףp=z\33333F@ ףp=z\F@\F@\33333F@ףp= \q= ףF@ףp= \F@= ףp\p= F@p= ד\fffffF@p= ד\= ףpF@p= ד\\(F@ ףp=\F@\)\F@ףp= \)\F@\F@ףp= \q= ףF@\(\F@\\(F@ףp= \(\F@\(\F@ ףp=\(\F@ ףp=\33333F@ ףp=\(\F@ ףp=\\(F@\G@\fffffG@ ףp=\ G@\q= ףG@\(\G@ ףp=\(\G@ ףp=\= ףpG@\p= #G@ ףp=\p= #G@ ףp=\ ףp=*G@ ףp=\333333G@ ףp=\9G@ףp= ]9G@p= ד\H@0 ףp=\9G@ ףp=\@G@p= ד\@G@p= ד\LG@p= ד\33333SG@p= ד\(\UG@ ףp=\(\UG@\q= ףPG@ףp= \q= ףPG@ףp= \(\UG@ףp= \YG@= ףp\= ףp]G@= ףp\YG@p= ׳\\(\G@p= ׳\(\bG@p= ׳\p= cG@ ףp=\(\oG@ ףp=\(\uG@\\(|G@ףp= \\(|G@ףp= \p= ׃G@ףp= \)\G@ףp= \̌G@= ףp\33333G@p= \(\•G@p= \= ףpG@p= \(\G@ ףp=\p= ףG@\fffffG@ףp= \(\G@= ףp\(\µG@p= \(\µG@ףp= \\(G@= ףp\= ףpG@= ףp\p= G@= ףp\fffffG@= ףp\G@= ףp\q= ףG@= ףp\33333G@= ףp\G@p= \\(G@p= \(\G@p= \(\G@p= \ ףp=G@ ףp=\q= ףG@]\(G@ףp= ]= ףpG@ףp= ]H@xףp= [D@ףp= ZF@ ףp= [D@ףp= [E@ףp= [E@ףp= [F@ףp= [F@[F@@[F@[F@ZF@ZF@@ZF@ףp= ZF@ pףp= G[GzT?@ףp= G[D@ ףp= G[GzT?@ףp= G[@@ףp= G[@@ףp= G[A@ףp= G[A@ףp= G[B@ףp= G[B@ףp= G[C@ףp= G[C@ףp= G[D@ףp= G[D@!= ףpZ@@Y@B@= ףpZ@@Z@@@Z@@Z@@ףp= Y@@ףp= Y@@ףp= YA@YA@YB@Y@B@Y@B@@Y@B@Y@B@YB@YA@Y)\HA@"(Y@B@YB@Y@B@YB@#@ףp= Y= ףp}B@YD@Y= ףp}B@ףp= YC@ףp= YC@ףp= YD@ףp= YD@$@ףp= ZD@ףp= ZF@ףp= ZD@ףp= ZE@ףp= ZE@ףp= ZF@ףp= ZF@%Hףp= ZF@ZH@ףp= ZF@ZF@ZG@ZG@ZH@ZH@&Xףp= YD@QWD@ףp= YD@@YD@YD@XD@XD@@XD@XD@QWD@'Pףp= ZE@XE@ףp= ZE@YE@YE@@YE@YE@XE@XE@(`Z(\F@Q%X(\F@ Z(\F@Y(\F@Y(\F@@Y(\F@Y(\F@X(\F@X(\F@@X(\F@Q%X(\F@)0p= ׃W@@p= ׃Wfffff@@p= ׃W@@p= ׃W(\@@p= ׃Wfffff@@*`QW33333@@\(W(\C@ W33333@@(\WA@= ףpWA@\(W33333A@p= ףWB@QW@B@QWB@QWC@ףp= W(\C@+8= ףpXE@= ףpXfffffF@= ףpXE@= ףpXF@= ףpXF@= ףpXfffffF@,8p= ׃W@@QV(\@@p= ׃W(\@@@W(\@@W@@QV@@-HQW@B@ ףp=V@B@QW@B@W@B@@W@B@W@B@V@B@ ףp=V@B@.()\VB@= ףpmVB@)\VB@= ףpmVB@/@W ףp=JD@(\VLD@W ףp=JD@W ףp=JD@W ףp=JD@@W ףp=JD@(\VLD@0Pףp= 'XE@GzVE@ףp= 'XE@XE@WE@WE@@WE@WE@GzVE@18)\V?@pV?@)\V?@V?@V?@pV?@2@ףp= U{G>@@U?@ףp= U?@U?@QU?@(\U{G>@@U?@38ףp= 7UR>@GzT33333>@ףp= 7U33333>@UQ>@TQ>@GzTR>@4XGzVzGa>@ףp= VA@ ףp=VzGa>@\(V?@GzVzG?@QV@@GzVA@ףp= V33333sA@ ףp= V(\uA@= ףp VA@50QhU@@= ףpMU= ףp}A@= ףpMU@@ ףp=ZUA@QhU= ףp}A@6p= דV@@GzS\(A@p= דVA@@VA@= ףp VA@GzV(\A@= ףp V(\A@UA@U= ףp}A@@U= ףp}A@U= ףp}A@ףp= TA@(\T ףp=A@RT)\A@\(T(\A@p= ףT33333A@\(T(\•A@ ףp=T\(A@QT(\•A@p= דTA@p= CT33333A@(\BŤA@QET)\A@p= CTp= ׃A@\((= ףpRD@ ףp=zR̬D@ ףp=zRD@= ףpR̬D@?@(\W ףp= G@QWzGaG@(\W ףp= G@(\W(\UG@= ףp W33333SG@\( WYG@QWzGaG@@@ ףp=V@E@p= U@E@ ףp=V@E@V@E@@V@E@V@E@p= U@E@A0QVp= G@Q5V,G@Q5Vp= G@QHV33333G@QV,G@B0(\Uq= ףC@RUD@(\Uq= ףC@(\U D@RUD@C8QU(\D@Q5U(\D@QU(\D@U(\D@@U(\D@Q5U(\D@D8Q5ǓC@Q5U(\D@Q5ǓC@Q5UD@Q5UD@Q5U(\D@E0Q5UD@(\T= ףpD@Q5UD@U\(D@(\T= ףpD@F8R!T\(C@R!T= ףpD@R!T\(C@R!TD@R!TD@R!T= ףpD@GP\(SE@ ףp=R{GE@\(S{GE@\(SE@SE@SE@@SE@SE@ ףp=RE@H`(\oRD@PRE@ ףp=jRD@(\oŘD@(\_R\(D@p= cRp= ףD@(\_RfffffE@`R E@RQR`E@(\RR)\hE@PRE@I`RQD@QQfffffE@`RfffffE@Q5Rp= E@Q5RE@R1RE@0Rp= E@p= Q(\E@)\Q(\E@)\Q33333D@ףp= Qq= ףD@ףp= Qp= D@RQD@= ףpQ(\D@)\Q(\D@QQQD@JpRQRYE@QQq= ףpE@ RQR`E@R\(\E@p= QYE@Q`E@\(Q`E@\(QffffffE@)\Q)\hE@QQffffffE@(\QlE@ ףp=Qq= ףpE@QQ(\oE@K@QQ)\D@p= Q(\E@QQ)\D@ףp= Q ףp=D@QQ33333D@p= Q(\µD@p= Q(\E@L8QQ ףp=E@GzQ)\F@GzQ ףp=E@QF@QQF@QQ)\F@plplot-5.10.0+dfsg/data/usa.shp 644 1750 1750 56665412041320047 152240ustar andrewandrew' v= ףp-_Q7@GzP(\H@8p= ׳^33333G@= ףp^H@dp= ׳^H@= ףp^yH@p= ׳^\(|H@p= ׳^(\uH@p= ׳^(\uH@p= ׳^q= ףpH@= ףp^ ףp=jH@= ףp^ffffffH@= ףp^p= cH@= ףp^= ףp]H@= ףp^= ףp]H@= ףp^(\UH@ףp= ^q= ףPH@ףp= ^YH@= ףp^\(\H@ףp= ^p= cH@^(\bH@^`H@^\(\H@^33333SH@ ףp=^LH@^fffffFH@ףp= ^)\HH@^(\BH@^9H@^\(X\(\E@Gz>X(\bE@QEX(\bE@ ףp=JXp= cE@GzNX)\hE@(\OXlE@ףp= WX(\oE@`XlE@ףp= gXlE@= ףpmX ףp=jE@ףp= wXlE@ ףp=zX)\hE@= ףp}X(\bE@(\X(\bE@)\X ףp=jE@GzXlE@p= דXq= ףpE@)\X(\uE@= ףpX(\uE@XE@!)\(X\(@= ףp]WQ=@)\XWGz=@QUW=@(\RWGz=@PW=@(\OWQ=@(\OWQ=@(\RWQ=@(\RWHz>@p= SWR>@QUWR>@QUW>@ףp= WWQ=@QUWQ=@QXWzG=@Q[WzG=@= ףp]WQ=@&ףp= 7WGz=@ ףp=*WQ=@ףp= 7W33333=@Q5WQ=@(\2WQ=@(\2WQ=@ףp= 7WQ=@ףp= 7W=@Q5WGz=@Q5W=@(\/WGz=@\(,WGz=@Q+WzG=@Gz.WzG=@= ףp-Wfffff=@(\/Wfffff=@Gz.WQ=@\(,WQ=@ ףp=*Wfffff=@Q+WQ=@0WQ=@(\2W33333=@Q5WQ=@ףp= 7W33333=@'Q(WQ=@ ףp=WR=@Q(WHz=@ףp= 'WQ=@(\"W33333=@ WQ=@GzWQ=@QWQ=@ ףp=WQ=@ ףp=W(\=@QWHz=@= ףpWHz=@ W(\=@R!W=@p= #WR=@Q(WHz=@(ףp= VQ+>@ ףp=VY>@ףp= V333333>@QVQ+>@RVQ+>@GzVQ+>@\(V{G:>@\(V(\B>@ ףp=VL>@\(VL>@\(VRQ>@(\VY>@VY>@(\VGzT>@p= ףVL>@QVL>@QVHzG>@QV{G:>@QVQ8>@ףp= V333333>@)\(VHz>@pVzGa>@\(VzG!>@QVGz>@ףp= V >@RV >@= ףpVHz>@QVHz>@V >@= ףp}VGz>@)\xVfffff&>@ףp= wVfffff&>@ףp= wVQ>@QuV>@(\rVQ>@pVfffff&>@pVQ+>@p= sVQ8>@QuVQ8>@)\xV@>@\(|V@>@(\V(\B>@VRQ>@p= ׃VGzT>@QVQ^>@QVzGa>@GzVzGa>@(\VY>@ףp= V@>@QV333333>@\(VQ+>@\(VzG!>@*8GznX333339@= ףp=X333333<@d ףp=JX333339@QKX :@\(LX(\:@GzNX(\:@= ףpMX :@GzNXGz:@RQXGz:@QUXfffff&:@p= SX333333:@QUX{G::@p= SX(\B:@ףp= WX(\B:@QXXY:@ ףp=ZXY:@)\XXzGa:@ ףp=ZXQk:@\(\XQk:@Q[XQk:@= ףp]XQx:@Q[X{Gz:@\(\XR:@= ףp]XzG:@Gz^X33333:@Gz^X:@RaXR:@QeX:@p= cXfffff:@RaXQ:@(\_XQ:@`XzG:@p= cXfffff:@p= cX;@(\_X;@Gz^X{G:@Gz^XR;@`X;@= ףp]XQ;@= ףp]XQ+;@\(\X(\B;@Gz^X(\B;@(\bX{G:;@QeX@;@ ףp=jX@;@ ףp=jX(\B;@= ףpmX(\B;@ ףp=jXL;@\(lXRQ;@GznXffffff;@QkXY;@QhXHzG;@p= cXGzT;@`XzGa;@`X33333s;@(\_XQk;@(\_XQ^;@`XRQ;@p= cXHzG;@RaX(\B;@(\_XL;@Q[XRQ;@QXXQk;@ףp= WX{Gz;@QUX̌;@p= SX;@(\RXfffff;@RQXQ;@ףp= WXQ;@ ףp=ZXHz;@)\XX;@Gz^XR;@`XGz;@(\bXQ;@`XzG;@(\_XQ;@Q[XzG;@ףp= WXzG;@QXX;@ףp= WXGz;@p= SXzG;@PXzG;@PXGz;@\(LXR;@QKXQ;@QHXQ;@QEX{G;@(\BX <@(\BXQ<@p= CXQ<@p= CX<@ףp= GXGz<@)\HXHz<@\(LXR<@GzNXGz<@QKXzG!<@QKXQ+<@)\HXfffff&<@RAX333333<@(\BXfffff&<@(\?XzG!<@= ףp=X333333<@+Gz>XzG!<@(\W<@6= ףp=X333333<@Gz>XzG!<@\(@d(\RVQ=@(\OVzG=@QUVzG=@QUVQ=@ףp= WVzG=@ףp= WVQ=@QXVfffff=@)\XVQ=@ ףp=ZVQ=@Q[VzG=@\(\VzG=@\(\VQ=@= ףp]VQ=@Q[V33333=@ ףp=ZVQ=@)\XVQ=@ ףp=ZVQ=@\(\VQ=@= ףp]V33333=@(\_V>@= ףp]V{G=@\(\V>@Gz^V>@= ףp]VHz>@\(\V(\>@)\XVHz>@)\XV >@\(\V >@`VGz>@`VHz>@QeV>@QeVQ=@ףp= gVzG=@ ףp=jVQ=@GznVzG=@pVQ=@pVQ=@GznV33333=@p= sVQ=@ףp= wV33333=@ףp= wV>@QuVHz>@QuV >@(\rV >@(\oV(\>@GznV(\>@(\oV >@GznVR>@\(lVR>@\(lV>@)\hVfffff&>@QeVfffff&>@(\bVQ+>@`VQ+>@Gz^V333333>@Gz^VQ+>@= ףp]VQ+>@\(\V@>@ףp= WVL>@QUVRQ>@QUVGzT>@)\XVY>@QUVzGa>@RQVY>@p= SVGzT>@p= SVL>@\(LVGzT>@QEVQ^>@= ףp=Vffffff>@Q8Vffffff>@Q8VQk>@ ףp=:VQk>@ףp= 7VQk>@Q5VQk>@(\2Vffffff>@p= 3VzGa>@(\/VY>@= ףp-VY>@Q+VQ^>@)\(VQ^>@ףp= 'VzGa>@p= #VY>@(\VRQ>@= ףpVGzT>@= ףpVQ^>@ ףp=VY>@QVzGa>@QVffffff>@QVffffff>@QVzGa>@VzGa>@GzVQ^>@\( VQ^>@= ףp VGzT>@)\VGzT>@ףp= VzGa>@ףp= V>@QVHz>@QVR>@QVGz>@20QV{G:>@ףp= UQ>@#QVGz>@p= VQ>@(\VQ>@GzUQ>@= ףpUfffff>@\(UQ>@QUfffff>@QU>@ ףp=UR>@\(U{Gz>@QUQk>@ףp= UzGa>@QUGzT>@RUL>@(\U(\B>@ףp= U@>@ ףp=U@>@\(U(\B>@(\V{G:>@\(U{G:>@ףp= U{G:>@U@>@QU@>@QUHzG>@(\UGzT>@(\UY>@= ףpUffffff>@ ףp=UQk>@ ףp=U33333s>@)\UQx>@ףp= UQk>@QUffffff>@QUY>@= ףpUL>@(\UHzG>@3= ףpUL>@\(UGz>@= ףpUL>@ףp= URQ>@QUY>@RUY>@RUzGa>@\(UQk>@ ףp=U>@\(UHz>@QUGz>@)\UHz>@ףp= U(\>@ףp= U33333s>@QU33333s>@(\Ǔ>@UGz>@RU>@\(UQx>@Uffffff>@QUzGa>@\(UQ^>@4pU{G=@= ףp]U>@KUffffff>@)\Uffffff>@QUQk>@= ףpUQk>@ףp= UQk>@ףp= UQx>@QUQk>@p= ףU33333s>@UQx>@(\U>@GzU>@QU33333s>@QU{Gz>@= ףpU{Gz>@= ףpUQx>@QU33333s>@QUQk>@ ףp=UQk>@QUzGa>@= ףpUffffff>@(\UQk>@RUQk>@(\UzGa>@QUQk>@ףp= UzGa>@ ףp=Uffffff>@(\UQk>@RUffffff>@GzUzGa>@QUzGa>@QUQ^>@(\UY>@)\URQ>@RUHzG>@Q{U{G:>@QuUQ+>@(\oUzG!>@GznUfffff&>@pUQ+>@pUQ8>@(\rU@>@QuU@>@ףp= wU{G:>@QxU(\B>@ףp= wUHzG>@RqUL>@(\oUHzG>@GznU{G:>@= ףpmU(\B>@ ףp=jU(\B>@\(lU{G:>@GznUQ+>@)\hUzG!>@)\hUfffff&>@ףp= gUQ>@QhU>@QeUQ>@(\bUQ>@RaU>@`U>@(\_UHz>@= ףp]U(\>@(\_U(\>@RaU >@p= cUGz>@QhU>@QhUQ>@ ףp=jUQ>@QkUzG!>@\(lUQ>@)\hUGz>@p= cUHz>@`U{G=@(\bU{G=@QeU(\>@5P(\bUQ=@p= SU{G=@(\bU{G=@\(\U33333=@QXUfffff=@ףp= WU=@p= SU=@QUU{G=@QUUQ=@6Q[U=@= ףp-UzG=@ ףp=ZUzG=@Q[UGz=@ ףp=ZU{G=@QXUQ=@QUUQ=@(\OUQ=@\(LUQ=@ ףp=JUzG=@ףp= GUzG=@p= CU=@Gz>UQ=@ ףp=:Ufffff=@p= 3UQ=@Gz.U{G=@= ףp-U(\=@7(\OUzG=@QUQ=@ףp= GUzG=@QEUQ=@QHUQ=@(\OUQ=@QHUQ=@@UQ=@Gz>U(\=@\(@>QUfffff=@QUQ=@QU33333=@\(UQ=@\(U>@QU{G=@)\U(\>@QUHz>@QUR>@QUGz>@(\U >@RU>@GzUGz>@= ףp U>@\( UR>@QU>@U>@\(T >@ףp= T>@TQ=@QTQ=@)\TQ=@QTR=@QT(\=@(\TQ=@GzTQ=@ ףp=TQ=@ ףp=T(\=@QT{Gz=@(\TQk=@GzTQk=@= ףpTzGa=@ ףp=TGzT=@ ףp=TL=@QT(\B=@QTQ8=@(\TQ+=@(\TQ+=@ ףp=TQ+=@p= ׳Tfffff&=@p= ׳TGz=@T =@(\T{G<@\(TQ<@)\Tfffff<@)\T<@= ףpTQ<@GzTGz<@ ףp=T<@ ףp=TQ<@QTzG<@ ףp=THz<@QT33333s<@= ףpTffffff<@GzTY<@(\TRQ<@T{G:<@p= ׳TQ+<@(\TQ<@p= ׳T<@QTQ;@ףp= TQ;@9Xףp= TQ;@= ףpT<@QT<@ףp= TQ;@ףp= TQ;@QTGz;@RT;@(\TQ;@(\TQ;@= ףpTzG;@:QTQx;@ ףp=THz<@0QTGz;@RT;@(\T;@= ףpT{G;@\(T33333;@)\T33333;@ ףp=T{G;@ףp= T;@ףp= T;@ ףp=Tfffff;@(\TQ;@= ףpTQ;@ ףp=TQ;@= ףpT{G;@\(T<@\(THz<@QT<@ ףp=THz<@QT{G;@)\TQ;@QTQ;@(\TQ;@(\TQ;@p= ףT;@TR;@GzTR;@(\TQ;@(\TQ;@GzTQ;@GzTQ;@QT33333;@QTQ;@ ףp=TQ;@ ףp=TR;@QT(\;@(\T{G;@GzTQ;@RT33333;@TQ;@(\TQ;@p= ףTfffff;@p= ףT;@ףp= TGz;@ ףp=T(\;@\(T(\;@= ףpTQx;@GzT;@(\THz;@;= ףpTQk:@RTQx;@QTL;@)\TzGa;@\(TQk;@= ףpTQx;@)\TQk;@QTffffff;@(\TRQ;@(\T(\B;@p= ףTL;@p= ףT(\B;@RT{G:;@(\Tfffff&;@= ףpTR;@ ףp=T{G:@ףp= TQ:@p= דT:@RT(\:@TQ:@GzT:@= ףpŤ:@= ףpT{Gz:@)\TQk:@QTQk:@RT33333s:@QTQx:@QT33333s:@QT{Gz:@= ףpŤ:@<8p= דTQ9@\( TQ:@dp= דT:@(\TR:@\(TR:@ ףp=THz:@QTzG:@\(TQ:@(\TQ:@\(TQ:@QTQ:@)\TQ:@ףp= TQ:@QT33333:@TQ:@QTQ:@QTzG:@p= ׃TzG:@p= ׃T:@QTQ:@p= ׃TzG:@ףp= Tfffff:@QT33333:@)\TQ:@QTQ:@QTQ:@)\TzG:@QTR:@ףp= T:@QT{Gz:@p= ׃T:@QTGz:@QTGz:@p= ׃TzG:@(\T:@p= ׃TR:@(\THz:@THz:@T{Gz:@= ףp}T33333s:@)\xTffffff:@ףp= wTGzT:@QuT@:@p= sTGz:@RqT(\:@(\oTQ9@\(lT9@ ףp=jTfffff9@ףp= gTfffff9@RaTQ9@\(\TR9@QXT(\9@QUTQ9@(\RTQ9@PTQ9@(\OTGz9@(\OŤ9@= ףpMŤ9@GzNT9@QKT33333s9@ ףp=JTzGa9@QHTY9@ ףp=JTGzT9@QKTHzG9@\(LT{G:9@ ףp=JT3333339@ ףp=JTQ+9@QHTfffff&9@QETQ9@(\BTzG!9@(\?TzG!9@ ףp=:Tfffff&9@Q8TQ+9@Q5TQ+9@p= 3TQ+9@p= 3Tfffff&9@(\2TQ+9@R1TzG!9@0Tfffff&9@Gz.Tfffff&9@= ףp-TQ+9@Q+TQ+9@ ףp=*T3333339@ףp= 'T3333339@(\"TQ89@ T3333339@GzTQ89@\(T{G:9@\(T@9@ ףp=T(\B9@QTGzT9@ףp= TGzT9@QTQ^9@QTffffff9@QT33333s9@ףp= T{Gz9@QŤ9@QT9@(\TzG9@T{G9@= ףp T9@\( T9@=@\( TQ9@)\TQ9@\( T9@)\TQ9@)\TR9@Q T{G9@Q TQ9@>0ףp= 7TQ9@(\T<@#)\TQ9@QTR:@ףp= TQ+:@QT@:@QTQ^:@p= T(\:@(\TGz:@(\T33333:@(\TR:@p= TzG:@QTQ:@ףp= THz;@)\T;@Q TQ+;@= ףp TQ+;@= ףp T333333;@(\T(\B;@RTY;@QTQx;@ףp= Ť;@QT;@)\TQ;@QT{G;@GzTR;@ Tfffff;@p= #T{G;@ףp= 'TR<@ ףp=*TQ+<@\(,T(\B<@(\/TQ^<@R1TQx<@p= 3TR<@Q5T33333<@ףp= 7T<@R1T<@?h(\2Tfffff&<@ףp= 'TQ<@ ףp= 'Tfffff&<@ ףp=*T{G:<@\(,TL<@Gz.Tffffff<@(\/T{Gz<@(\/THz<@Gz.T<@(\2TQ<@(\2TQ<@(\/TQ<@@x\(,TRQ<@Q%TQ<@ \(,TRQ<@\(,TQ^<@ ףp=*TRQ<@Q+Tffffff<@ ףp=*TQx<@Q(THz<@Q(TGz<@)\(TQ<@Q%T<@Q%T(\<@ףp= 'TQx<@ףp= 'TQ^<@AX)\8TzG<@Q(T{G<@Q(TzG<@\(,TQ<@(\/TQ<@R1T<@Q5TGz<@ףp= 7Tfffff<@)\8T{G<@Q5T33333<@B8(\bTQ+;@Q T?@dQ TQ+;@= ףp T(\B;@(\TY;@(\TQx;@QŤ;@QT;@ףp= TzG;@ףp= TQ;@ ףp=T(\;@\(T;@(\TQ;@R!T<@p= #T <@Q%Tfffff&<@ףp= 'T(\B<@ףp= 'TQ^<@Q%TQk<@Q%TQk<@R!T33333s<@p= #T<@Q%T<@Q(TzG<@= ףp-T{G<@0TR<@p= 3Tfffff<@Q5T33333<@)\8T(\=@\(@ףp= WTQ>@)\XT@>@ ףp=ZTGzT>@ ףp=ZTffffff>@Q[TQk>@Q[T{Gz>@Gz^T(\>@\(\T(\>@= ףp]TGz>@\(\T33333>@Gz^T{G>@Gz^T(\>@\(\TGz>@ ףp=ZTQ>@Q[TQ>@= ףp]TQ>@Gz^TQ>@RaTQ>@= ףp]T(\?@Gz^THz?@`T(\?@`TR?@(\_T ?@Gz^TR?@Q[T(\?@ ףp=ZTGz?@Q[TQ?@= ףp]TGz?@(\bTzG!?@= ףp]TQ?@\(\TQ+?@Q[TzG!?@)\XTzG!?@QUT333333?@(\RT{G:?@(\RTHzG?@QUTRQ?@QUTGzT?@(\RTRQ?@(\RTQ^?@QUTffffff?@QUTQk?@RQTzGa?@PTQk?@= ףpMT{Gz?@\(LTHz?@(\OTHz?@(\RT?@RQTHz?@p= STHz?@(\RŤ?@GzNTR?@= ףpMT?@\(LTR?@)\HTzG?@ ףp=JT33333?@= ףpMTQ?@= ףpMT33333?@PT?@C8PT{G?@(\S(\@@dPT?@QKT{G?@QKT(\?@)\HT{G?@QET(\?@p= CTR?@ףp= GT?@ ףp=JT?@ףp= GTQ?@QET?@ףp= GTfffff?@QETzG?@@TQ?@= ףp=Tfffff?@@TQ?@= ףp=TQ?@\(SA@@SfffffA@p= CSq= ףA@QES33333A@(\BSq= ףA@(\?S)\A@= ףp=S)\A@\(S(\B@\(S(\"C@@Sp= #C@(\BS)\(C@RAS ףp=*C@RASq= ף0C@p= CS333333C@QES(\/C@ ףp=JS(\/C@QKS,C@RQS ףp=*C@QUS,C@(\RS,C@QXS(\5C@QUS(\5C@QUS= ףp=C@(\RS(\BC@p= SSfffffFC@(\RSp= CC@PSLC@PSq= ףPC@(\OS33333SC@= ףpMS33333SC@GzNSq= ףPC@= ףpMS(\OC@)\HSq= ףPC@QKS(\UC@)\HS(\UC@QHS(\UC@QHSq= ףPC@ ףp=JSLC@\(LSLC@= ףpMS)\HC@\(LS)\HC@(\OSfffffFC@RQS@C@RQS(\5C@PSq= ף0C@GzNS(\/C@= ףpMS(\/C@)\HS333333C@QHS9C@ףp= GS9C@ףp= GS(\5C@p= CS9C@p= CS= ףp=C@@S(\5C@(\?S,C@Q;S)\(C@Q;Sfffff&C@ףp= 7S(\"C@ףp= 7Sfffff&C@)\8S ףp=*C@Q8S(\/C@Q;S333333C@ףp= 7Sq= ף0C@Q5S,C@p= 3S(\"C@R1S= ףpC@(\/S C@Gz.Sfffff&C@Gz.S= ףpC@= ףp-S(\"C@)\(S(\"C@ ףp=*S C@\(,S= ףpC@Q%S\(C@p= #S(\C@(\"Sq= ףC@ Sq= ףC@GzS C@K8= ףp-SfffffC@QSp= ףC@dGzS C@(\Sq= ףC@GzSq= ףC@GzS(\C@= ףpS(\C@GzS\(C@\(SC@\(S(\C@QS(\C@\(S33333C@\(S(\C@)\S C@QS)\C@QSfffffC@QS C@QSq= ףC@QSq= ףC@QS33333C@)\S\(C@ ףp=S(\"C@)\Sfffff&C@ ףp=S)\(C@= ףpSp= #C@R!S,C@ S(\/C@Q%S333333C@ ףp=*S9C@\(,S= ףp=C@\(,S(\BC@= ףp-SfffffFC@\(,SfffffFC@\(,S)\HC@ ףp=*SfffffFC@Q+S@C@)\(S\(@(\"VQ8>@x0 V333333>@ ףp=VQ8>@ VQ8>@= ףpV333333>@ ףp=V333333>@y8QV{G:>@QV(\B>@QV{G:>@RV{G:>@ ףp= V(\B>@QV(\B>@z`p= URQ>@(\Uffffff>@ p= UGzT>@RURQ>@\(UGzT>@ףp= UY>@UQ^>@)\UzGa>@Uffffff>@)\Uffffff>@(\Uffffff>@{p= sTHz8@\(\T333338@p= sTHz8@RqŤ8@GznTR8@\(lŤ8@QkTR8@ףp= gTGz8@RaTQ8@`Tfffff8@Gz^TzG8@Gz^Tfffff8@= ףp]Tfffff8@\(\TzG8@= ףp]TQ8@(\_T333338@(\_TQ8@RaT333338@RaTQ8@p= cTQ8@(\bTzG8@QeTfffff8@p= cTQ8@ףp= gTQ8@ףp= gTfffff8@ ףp=jT8@= ףpmT8@GznTGz8@(\oTGz8@RqŤ8@p= sTR8@p= sTHz8@|= ףp]TzG8@p= ST{G8@Q[TzG8@)\XTfffff8@)\XTQ8@QXTfffff8@ףp= WTfffff8@QUTzG8@QUTQ8@p= STQ8@QUT333338@QXT333338@ ףp=ZT{G8@)\XTQ8@Q[T333338@= ףp]T{G8@= ףp]TQ8@Q[T333338@ ףp=ZTQ8@Q[Tfffff8@Q[TzG8@}0 ףp=ZTQ8@(\OTQ8@ ףp=ZTQ8@QUTzG8@(\OTQ8@~0QHT333338@ ףp=:THz8@QHT333338@@T{G8@ ףp=:THz8@ףp= 7TR8@Q Ť9@ ףp= 7TR8@(\2T8@= ףp-TzG8@Q(TQ8@(\"T9@= ףpTR9@QTfffff&9@ףp= T3333339@p= T(\B9@TY9@GzTQk9@\( T{Gz9@Q Ť9@X= ףp-TzG8@= ףpTQ89@= ףp-TzG8@)\(TQ8@Q%T{G8@ T 9@= ףpTQ9@GzTfffff&9@= ףpT3333339@GzTQ89@0GzTfffff&9@)\TQ+9@GzTfffff&9@QTfffff&9@)\TQ+9@`\(TQ+9@GzTQk9@ \(T{G:9@QT3333339@)\TQ+9@ףp= TQ89@QT@9@QTHzG9@QTHzG9@RTY9@GzTQk9@HRS@@Gz~S33333@@RS(\@@Gz~S@@Gz~S33333@@(\Sq= ף@@Sq= ף@@RS(\@@PQESq= ףPA@(\"SYA@QES33333SA@RAS(\UA@Q;S(\UA@Q5SYA@0SYA@)\(S(\UA@(\"Sq= ףPA@P(\"SLA@p= SfffffA@(\"SLA@(\S(\UA@\(S= ףp]A@ףp= S)\hA@(\S(\uA@)\SA@p= SfffffA@HS)\A@(\R(\•A@ ףp=Rq= ףA@(\R(\A@S)\A@GzŘA@ ףp=Rq= ףA@(\R(\•A@(\RA@GzR(\A@RR(\A@ףp= RA@ ףp=R\(A@\(R= ףpA@(\RA@ ףp=R\(A@QR= ףpA@(\R\(A@RR(\A@R ףp=A@(\R(\µA@(\R= ףpA@GzRfffffA@GzR(\A@(\RA@RR(\A@XGzR)\A@QR(\A@GzR(\A@GzR(\A@QRq= ףA@QR ףp=A@QR)\A@QR(\A@QR(\A@GzR(\A@8(\S= ףpC@)\S,C@(\S,C@GzS)\(C@\( S(\"C@)\S= ףpC@0GzS(\"C@\( S)\(C@\( S(\"C@\( Sfffff&C@GzS)\(C@@QS33333C@(\SC@QSC@p= S33333C@(\S(\C@p= SC@QSC@Pp= S ףp= C@Sq= ףC@p= S ףp= C@S ףp= C@RS(\C@Sq= ףC@(\S(\C@(\S C@p= S ףp= C@pp= S(\B@(\Rp= C@ p= S= ףpB@RS(\B@SB@S= ףpB@(\SC@RSC@(\R= ףpB@(\R(\C@RSp= C@p= Sp= C@p= S= ףpB@pQRq= ףB@ ףp=RC@ ףp= Rq= ףB@QR33333B@QR\(B@p= R\(B@p= R= ףpB@Rp= C@R)\C@GzR ףp= C@= ףpR(\C@\(R(\C@ ףp=RC@h ףp=R(\B@QR ףp=*C@ ףp=R(\B@QR(\B@ףp= Rq= ףB@p= RB@(\Rp= C@= ףpR ףp= C@QR33333C@ ףp=RC@)\R(\"C@QR ףp=*C@@(\RD@\(Qp= ףD@(\RD@RD@\(Qp= ףD@RR(\D@(\RD@XQQ33333D@p= Q= ףpD@QQ33333D@p= Q33333D@QQ(\•D@p= Q\(D@QQ= ףpD@QQD@ףp= Q(\•D@QQ33333D@P ףp=QD@QQ)\D@ ףp=QD@QQ= ףpD@QQ)\D@)\Qp= D@)\QD@ ףp=Q= ףpD@ ףp=QD@@ףp= Q ףp=D@p= Q33333D@QQ ףp=D@p= Q(\D@ףp= Q33333D@QQ(\D@QQ ףp=D@QQfffffD@= ףpQ= ףpD@QQ̬D@(\QfffffD@GzQ ףp=D@QQ̬D@= ףpQ̬D@= ףpQ(\µD@Qq= ףD@p= ףQ(\µD@QQ\(D@ףp= QD@ףp= Q= ףpD@= ףpQ(\µD@RQ̬D@QQ̬D@`Q= ףpD@Gz~Q(\D@ Qp= ףD@QQD@QQ= ףpD@Q= ףpD@Gz~Q(\D@(\Q(\D@(\Q ףp=D@ףp= Qp= ףD@Qp= ףD@\(@(\bV?@(\bVQ+>@QeVQ+>@QhVQ8>@)\hV(\B>@ ףp=jVL>@)\hVGzT>@QkVQ^>@\(lVffffff>@\(lV33333s>@RqV(\>@QuVGz>@QuVzG>@ףp= wVQ>@QuV{G>@QuVHz>@(\rVR>@(\rV>@RqVfffff>@(\oV{G>@pV?@)\U33333s>@ ףp=U?@ ףp=U33333s>@\(U{Gz>@= ףpUHz>@QUR>@ ףp=UQ>@ ףp=Ufffff>@\(UQ>@(\U33333>@(\U>@p= U>@QU>@)\UzG>@QUQ>@ףp= U?@(\TQ^>@= ףp]TGz>@GzTR>@(\THz>@= ףpT{Gz>@= ףpTffffff>@\(TQ^>@p= ׃TQ^>@p= ׃TQk>@RT>@RTGz>@p= ׃Tfffff>@p= ׃T{G>@RT(\>@(\T>@(\THz>@= ףp}TGz>@ ףp=zTR>@ףp= wTHz>@QuTHz>@(\rT(\>@(\rTHz>@(\oT>@QkT>@QeTQ>@= ףp]TQ>@= ףpMU33333>@Gz.U@@6= ףp=Ufffff>@= ףp=U(\>@ףp= 7U33333>@ףp= 7U>@R1U(\>@Gz.UHz>@(\2UHz>@R1U>@Q5U>@Q;UHz>@= ףp=Ufffff>@@UQ>@@U(\?@(\BUGz?@QEUfffff&?@ףp= GUQ+?@ףp= GU{G:?@QHUHzG?@QEURQ?@QEUzGa?@QEUQk?@QEU{Gz?@p= CUHz?@QEUQ?@QHUQ?@)\HUHz?@)\HUQ?@QHUQ?@QEU33333?@p= CU(\@@p= CU ףp= @@QEUq= ף@@(\BU(\@@Gz>U(\@@(\?U\(@@\(U333333@@Gz>U(\5@@@U9@@@U(\B@@QEU ףp=J@@ףp= GUq= ףP@@QHU= ףp]@@ ףp=JU(\b@@QHUp= c@@QKUffffff@@QKUl@@\(LU(\o@@\(LU(\u@@= ףpMU@@= ףpT(\@@)\8T(\@@.)\8T(\@@\(U(\G@@UG@= ףp=U= ףpG@ ףp=:Up= G@= ףp=U)\G@= ףp=UG@Q;UG@ףp= 7U33333G@ףp= 7U(\G@)\8UG@ ףp=:U(\G@Q;UG@QEUG@PUG@ףp= WU(\G@)\XU(\G@`U(\G@)\hU(\G@RqU(\G@ףp= wU\(G@ ףp=zU(\H@\(|Up= H@|Up= H@Gz~UfffffH@U ףp= H@(\U(\H@)\U= ףpH@)\U(\"H@= ףpU(\/H@\(Uq= ף0H@(\U(\5H@(\U\(V(\BH@ ףp=JV= ףp=H@GzNV(\5H@GzNV)\(H@(\OVfffff&H@RQV= ףpH@p= SV(\H@QUVq= ףH@QXV(\H@ףp= WV H@)\XV ףp= H@= ףp]V ףp= H@Q[V)\H@Gz^VfffffH@= ףp]Vp= H@`Vp= H@QeVH@(\bVH@ףp= gV\(G@)\hV= ףpG@)\hVG@QkV\(G@\(lVG@(\oV(\G@QuVq= ףG@)\xV(\G@Gz~V ףp=G@ףp= VfffffG@= ףpVp= G@p= דVG@ ףp=V= ףpG@= ףpV\(G@(\VG@ ףp=V33333G@GzVq= ףG@p= ׳V ףp=G@ ףp=Vp= G@(\V= ףpG@p= VG@)\Vq= ףG@GzV)\G@(\V(\G@QVG@GzVq= ףG@QV ףp=G@ ףp=Vp= ׃G@= ףpVG@p= V(\uG@)\V33333sG@GzVlG@ףp= Wp= cG@pp= ׳V`G@QVq= ףpG@ p= ׳V`G@RV`G@GzVp= cG@ ףp=VffffffG@\(V)\hG@QVlG@QVq= ףpG@ ףp=VlG@(\V)\hG@p= ׳Vp= cG@p= ׳V`G@HRV(\uG@= ףpV\(|G@V(\uG@= ףpV(\uG@GzV\(|G@V\(|G@RVyG@V(\uG@XQV(\uG@RV= ףp}G@QV(\uG@ףp= V(\uG@QV(\uG@p= ףV(\uG@RV\(|G@(\V= ףp}G@ ףp=VyG@QV(\uG@H(\VG@QV ףp=G@(\VG@= ףpVG@QVp= ׃G@QV ףp=G@GzV ףp=G@(\VG@GzNV)\G@= ףpV(\H@GzNVG@ ףp=JV)\G@(\?V(\G@ ףp=:V33333G@@Vq= ףG@@V33333G@Q;V(\G@p= 3V= ףpG@(\/V= ףpG@Q%VfffffH@Q%V ףp= H@= ףpV(\H@Q%Vq= ףH@)\(V33333H@\(,V(\H@R1V ףp= H@p= 3VfffffH@ףp= 7VfffffH@@VH@)\HVG@GzNV33333G@GzNVG@P\(LVH@(\BV(\"H@\(LV\(H@)\HV\(H@QHVH@(\BV= ףpH@p= CV(\"H@)\HV(\"H@\(LV\(H@p= ףpU9G@ףp= U)\HG@ = ףpU(\BG@\(U@G@\(U9G@ ףp=U\(TyF@(\BT33333sF@@Tq= ףpF@(\BT ףp=jF@QHTp= cF@QHT(\bF@QETp= cF@(\?T)\hF@= ףp=TffffffF@ ףp=:TffffffF@)\8T(\bF@\(S(\E@)\8SfffffE@p= 3SfffffE@(\/S ףp=E@\(,S̬E@Q(S(\µE@(\"S\(E@ S\(E@QS(\E@(\S(\E@(\Sp= E@GzSfffffE@= ףp SE@= ףp S(\E@(\S)\E@p= S ףp=E@(\S(\E@(\Sq= ףE@(\S(\E@= ףp S(\E@)\S33333E@)\S(\E@QS\(E@= ףp S\(E@GzSF@RS\(E@RSF@p= S(\F@(\S)\F@QS)\F@QS(\F@RS(\F@S(\F@\( S\(F@QS F@RS(\"F@QR ףp=*F@)\R(\/F@ףp= R(\/F@ףp= Rq= ף0F@QR333333F@p= R333333F@RR9F@(\R\(S)\F@QESfffffF@RASp= F@\(S(\F@(\?S= ףpE@(\BSE@(\BS(\E@@S(\E@ףp= gSE@Q8SF@@S(\E@= ףp=S(\E@Q8SE@Q8S(\E@Gz>S33333E@p= CSq= ףE@QHSE@ ףp=JSE@QKS(\E@GzNSE@(\OS(\E@GzNSq= ףE@(\OS33333E@(\RS33333E@QUSE@Q[S(\E@(\_S(\E@QeS= ףpE@ףp= gSF@8p= S)\E@RaSp= F@$QeS= ףpE@RaSF@ףp= gSp= F@QkS(\F@= ףpmSp= F@(\oS(\F@QkSF@GznS= ףpE@pS(\F@p= sSF@QxS= ףpE@(\S\(E@p= ׃S\(E@\(SE@RSE@GzS33333E@)\S33333E@= ףpS(\E@p= ׳S(\E@QSE@\(SE@RS)\E@QSfffffE@)\S(\E@= ףpS= ףpE@(\S(\E@)\S(\E@ ףp=Sq= ףE@GzSq= ףE@(\SE@(\S ףp=E@ףp= Sp= E@ףp= SE@QS(\µE@GzSq= ףE@p= S)\E@`p= 3S(\F@Q(SF@ p= 3Sq= ףF@(\2S(\F@= ףp-S(\F@\(,S33333F@Q(S(\F@Q(SF@= ףp-S(\F@(\2S33333F@p= 3Sq= ףF@ S F@= ףp S= ףpF@ Sq= ףF@= ףpS33333F@= ףpSq= ףF@(\S(\F@= ףpS(\F@= ףpS F@)\Sq= ףF@ףp= S(\F@)\SF@(\S\(F@= ףp S= ףpF@S= ףpF@(\S\(F@(\S= ףpF@QS= ףpF@QS\(F@ S(\F@ Sq= ףF@H ףp= S F@QSfffff&F@)\S F@ףp= S(\"F@QSfffff&F@ ףp= Sp= #F@ ףp= S(\"F@)\S F@`(\RfffffFF@(\R(\F@ (\RfffffFF@RRYF@)\Rp= cF@(\RlF@\(Rq= ףpF@(\RyF@QRF@QR(\F@(\RF@PRQ= ףpG@p= ׃Q(\5G@RQ= ףpG@Q(\"G@= ףpQfffff&G@= ףpQ,G@ ףp=Q(\/G@ףp= Q333333G@p= ׃Q(\5G@(\OQ)\G@(\PG@(\OQG@QKQG@ףp= GQ(\µG@p= CQ(\µG@p= CQG@Q;Q(\•G@Q8Q(\•G@Gz.Q= ףpG@Q(Q= ףpG@Q%Qp= ףG@(\QfffffG@\(Qp= ףG@)\Qp= ףG@)\Q ףp=G@ףp= Q(\G@(\Q(\G@\( Q ףp=G@QQp= ףG@RQ= ףpG@= ףpP(\•G@ ףp=Pq= ףG@QP ףp=G@(\P)\G@p= P(\uF@(\PF@(\PF@P(\F@p= Pq= ףF@RP ףp=F@p= Pp= F@p= PF@RP(\F@(\PF@\(P(\F@P ףp=F@GzPF@\(P ףp=F@\(PF@P= ףpF@(\P(\µF@QPq= ףF@(\Pp= ףF@\(PF@QPq= ףF@QP33333F@(\P(\•F@ ףp=P33333F@ףp= P ףp=F@ףp= PfffffF@p= PyF@(\P(\uF@)\8W`F@(\W ףp= G@Q5W`F@(\2W)\hF@R1W33333sF@R1W\(|F@(\2Wp= ׃F@Q5W)\F@R1W̌F@R1WF@R1Wp= ףF@Gz.W̬F@Q+W33333F@Q+W(\µF@(\/WF@R1W)\F@Q5WfffffF@)\8W)\F@)\8W33333F@Q8W\(F@p= 3WF@R1W)\F@(\/Wq= ףF@ ףp=*W(\F@p= #WF@R!W= ףpF@GzW\(F@QWp= G@QW(\G@QW)\G@(\W ףp= G@HQ5V̌F@ףp= Up= G@&ףp= ǓF@ ףp=ǓF@\(Uq= ףF@(\U(\•F@= ףpUp= ףF@ ףp=U̬F@\(Uq= ףF@U̬F@QU̬F@ףp= U33333F@QU(\µF@(\U= ףpF@p= Up= F@QU)\F@(\U)\F@RUF@QU33333F@(\U(\F@ףp= U\(F@QUF@= ףpUF@(\Up= F@p= V(\F@)\V)\F@QV(\F@ףp= Vq= ףF@ףp= V(\F@Q V(\F@VF@QVF@QV= ףpF@QV\(F@(\"V(\G@ףp= 'V(\G@Q(V= ףpF@ ףp=*V= ףpF@\(,V(\G@Q5Vp= G@XQV,G@QV)\HG@QV,G@QV9G@V9G@(\V(\BG@QV(\BG@QVfffffFG@)\Vp= CG@QV)\HG@8= ףp]RE@QER ףp=F@dPRE@RQR)\E@p= SR ףp=E@QURq= ףE@QXRq= ףE@ ףp=ZR)\E@\(\R ףp=E@\(\Rq= ףE@ ףp=ZRE@QXR= ףpE@QXRp= E@ ףp=ZR)\E@)\XRE@Q[R(\E@Q[RF@\(\Rp= F@Q[R ףp= F@)\XR(\F@ףp= WR(\F@QXRF@RQR(\"F@p= SR(\"F@p= SRfffff&F@RQR,F@(\RRq= ף0F@PR(\5F@(\OR333333F@GzNR(\5F@GzNR= ףp=F@RQR@F@(\RRfffffFF@= ףpMRfffffFF@\(LR ףp=JF@(\ORLF@(\ORq= ףPF@GzNR33333SF@GzNR= ףp]F@ ףp=JRp= cF@ ףp=JR)\hF@\(LRp= cF@\(LR(\oF@QKR(\uF@\(LR(\uF@(\OR(\uF@GzNR\(|F@)\HR(\F@ ףp=JR= ףp}F@QHR\(|F@QER(\F@QER)\F@ ףp=JR ףp=F@\(LRp= ׃F@GzNR(\F@PRyF@RQR33333sF@(\OR(\uF@(\OR33333sF@(\RR)\hF@(\RRp= cF@PR= ףp]F@(\RR= ףp]F@(\RRYF@QUR(\UF@(\RR(\UF@RQRq= ףPF@p= SRLF@ףp= WRq= ףPF@ףp= WRYF@QUR`F@p= SR(\bF@QURp= cF@p= SRlF@QUR(\uF@QUR= ףp}F@QXRF@ףp= WRyF@ ףp=ZR(\uF@)\XR33333sF@Q[R)\hF@QXR)\hF@)\XR(\bF@Q[R(\bF@Q[R`F@)\XR= ףp]F@)\XRYF@Q[R\(\F@= ףp]R\(\F@\(\Rq= ףPF@= ףp]R ףp=JF@ ףp=ZR(\BF@Q[R= ףp=F@ ףp=ZR9F@Q[R(\5F@ ףp=ZR333333F@)\XR(\5F@)\XR333333F@ףp= WR)\(F@ףp= WR F@)\XRF@Q[RF@PGz^RF@Q[RF@Q[RF@\(\R(\F@Q[R33333F@= ףp]R F@Gz^Rp= F@= ףp]RF@\(\Rp= F@@QXR ףp=jF@QUR33333sF@QXRlF@ףp= WR ףp=jF@QUR33333sF@ףp= WR33333sF@QXRlF@Q%R= ףp]E@ ףp=QF@3GzR= ףp]E@p= #RffffffE@Q%R(\oE@(\"R33333sE@(\"RyE@GzR\(|E@= ףpRE@GzRfffffE@\(R ףp=E@\(R(\E@= ףpR33333E@\(RE@ ףp=R)\E@QRq= ףE@)\R= ףpE@ ףp=R(\E@)\R)\E@QRE@QRq= ףE@p= R(\E@RR\(E@GzRE@\( R)\E@\( R(\E@)\R(\E@ףp= RF@(\R ףp= F@p= R(\F@QRF@p= R= ףpF@QR(\"F@(\R)\(F@ ףp=Q,F@QQ,F@p= Qq= ף0F@\(Q(\5F@)\Q= ףp=F@QQ@F@QQfffffFF@(\Q ףp=JF@QQ33333SF@)\Q`F@QQp= cF@p= Q(\oF@Q33333sF@(\QF@(\Q(\F@QfffffF@\(Q̌F@QQ(\•F@ ףp=QF@xQ ףp=E@RQ ףp=E@ RQ ףp=E@QQ(\E@QQ33333E@QQ= ףpE@)\Qp= ףE@QQ)\E@GzQ ףp=E@Q33333E@GzQ(\µE@GzQ= ףpE@= ףpQfffffE@GzQ ףp=E@P= ףpS(\B8@GznS3333339@G= ףpS8@ףp= SHz8@(\SQx8@\(S33333s8@)\S{Gz8@ףp= S8@QSHz8@QS{Gz8@)\SQx8@ ףp=SQk8@)\SzGa8@ףp= SQ^8@p= ׃SGzT8@RS(\B8@Gz~SRQ8@\(|SRQ8@)\xSQ^8@(\rSQk8@(\rSQk8@GznSQx8@GznS(\8@(\oSHz8@pSQ8@(\oSQ8@RqS{G8@p= sSQ8@(\rS8@QuS(\8@ ףp=zSQ8@Q{SQ8@\(|S333338@\(|S{G8@= ףp}S9@Gz~S{G8@Gz~S 9@= ףp}SR9@Gz~SGz9@SGz9@(\SQ9@SQ+9@(\SQ+9@QSfffff&9@QSfffff&9@ ףp=S3333339@= ףpS3333339@\(SQ+9@= ףpSQ+9@= ףpSzG!9@QS9@ ףp=S 9@ ףp=SQ8@QS333338@QSQ8@\(SQ8@GzS8@(\SR8@RS8@(\S8@RS(\8@p= דS(\8@p= דS8@(\SQ8@QS{G8@QS333338@QSQ8@ףp= S333338@)\SQ8@ףp= SQ8@)\SQ8@ ףp=SzG8@= ףpS8@hS3333338@ ףp=zSHzG8@ S{G:8@= ףp}S3333338@\(|SQ88@Q{SQ88@\(|S{G:8@ ףp=zS@8@Q{SHzG8@Gz~S{G:8@(\S@8@S{G:8@xGz~SQ+8@QuS{G:8@ Gz~SQ+8@= ףp}SQ+8@Q{SQ+8@ףp= wSQ+8@ףp= wSQ88@QuS{G:8@QxS{G:8@ ףp=zS3333338@Q{S3333338@\(|SQ+8@= ףp}S3333338@Gz~SQ+8@Pp= sSRQ8@QkSQk8@p= sSGzT8@RqSRQ8@(\oSRQ8@= ףpmSGzT8@QkSGzT8@= ףpmSQk8@p= sSGzT8@Q{SQ7@`SL8@- ףp=zSfffff&8@ ףp=zSzG!8@)\xS8@Q{S8@Q{SGz8@)\xSR8@ףp= wSR8@QxS 8@QuSHz8@QuS(\8@QuSQ7@QuSQ7@QuSQ7@p= sSQ7@p= sSzG7@QuSzG7@p= sS7@p= sSR7@(\oS7@\(lS{G7@QkSQ7@)\hSQ7@QeS{G7@QeS{G7@p= cS7@RaS7@`S7@RaSQ7@RaSQ7@(\bS8@RaS(\8@(\bSQ8@QeSQ+8@QeSQ88@QhS3333338@)\hSzG!8@)\hSQ+8@ ףp=jS3333338@QhS@8@)\hS@8@QkSL8@(\rS@8@ףp= wSQ+8@)\xSfffff&8@ ףp=zSfffff&8@QeS{G8@RQSGz9@QeS(\9@p= cS9@`S9@(\_S{G8@\(\S9@ ףp=ZS{G8@QXS9@QUS(\9@(\RS(\9@RQSHz9@RQS 9@QUSGz9@= ףp]SGz9@Gz^SR9@RaSR9@RaS 9@QeS(\9@S{Gz:@QxSQ:@5S33333:@SQ:@GzSQ:@ ףp=SQ:@p= ׳S(\:@(\S{Gz:@ ףp=S{Gz:@QS(\:@(\SHz:@= ףpŠ:@ ףp=SR:@GzS:@ףp= SzG:@Sfffff:@= ףp}Sfffff:@ ףp=zSzG:@QxSzG:@)\xSQ:@Q{SQ:@\(|S33333:@= ףp}SQ:@Gz~SQ:@p= ׃S33333:@ףp= SQ:@ ףp=SQ:@= ףpSQ:@SQ:@(\Sfffff:@QSfffff:@ףp= SQ:@)\SQ:@ ףp=SQ:@QSQ:@= ףpSQ:@RSQ:@(\SzG:@QSQ:@QSGz:@QSR:@ ףp=Š:@\(SHz:@(\SHz:@SR:@(\SR:@(\SHz:@p= ׳Š:@QSGz:@QSzG:@)\SzG:@)\Sfffff:@= ףpSQ:@GzS33333:@S33333:@H)\xSR:@QuSQ:@)\xS:@)\xSGz:@QxSR:@QuS:@ףp= wSQ:@)\xS:@8QuŠ:@QuSGz:@QuSR:@QuŠ:@QuSGz:@QuSR:@Pףp= gS(\B:@p= cSGzT:@ףp= gSGzT:@QeSL:@QeS(\B:@p= cSL:@p= cSRQ:@QeSGzT:@ףp= gSGzT:@= ףp}SGz9@(\?SQ:@W= ףp}SzG:@QuSfffff:@pSfffff:@pSzG:@GznSfffff:@ ףp=jSQ:@QeSQ:@p= cSzG:@QeSzG:@p= cSfffff:@(\_S:@= ףp]S:@= ףp]S{G:@Q[SQ:@)\XS33333:@QXSQ:@ףp= WSQ:@QUS33333:@QUSQ:@QUSzG:@QUS:@(\RSQ:@(\RSGz:@PSR:@PS:@QKSR:@)\HSR:@QHSHz:@QESHz:@QHS:@ ףp=JSQk:@ ףp=JSffffff:@QHSY:@QHSL:@ ףp=JSL:@\(LSRQ:@QKSHzG:@GzNS@:@(\OS333333:@= ףpMSQ+:@= ףpMSfffff&:@QUSGz:@ ףp=ZS:@Q[S(\:@Q[S:@)\XS{G9@p= SS{G9@RQSQ9@p= SSQ9@PSfffff9@= ףpMSGz9@\(LS9@QKSQ9@= ףpMS :@\(LSGz:@\(LSQ+:@ ףp=JS{G::@ףp= GSHzG:@(\BSL:@p= CS(\B:@@SHzG:@(\?SGzT:@RASRQ:@(\BSGzT:@(\BSY:@@SQ^:@(\BSzGa:@p= CSffffff:@p= CS(\:@(\BŠ:@QEŠ:@ ףp=JSGz:@GzNS:@(\RSzG:@p= SSQ:@(\RSQ:@p= SS33333:@)\XS:@= ףp]SGz:@p= cSQ:@QeSQ:@QeSfffff:@QkSfffff:@RqSQ:@QuSQ:@ ףp=zSfffff:@= ףp}SzG:@R1SQk9@ףp= 'SGz9@R1SQk9@(\/SQk9@\(,S33333s9@)\(SQk9@ףp= 'S33333s9@Q(S{Gz9@Q(SQx9@)\(SQx9@ ףp=*S{Gz9@ ףp=*S9@Q+S(\9@\(,S9@= ףp-Š9@Q+SR9@= ףp-SGz9@Gz.SR9@= ףp-Š9@(\/S9@R1SQk9@Q%SzG8@QSQk9@6Q%SQk9@Q%Sffffff9@(\SY9@QSGzT9@QSRQ9@QSL9@p= S(\B9@(\S{G:9@S3333339@(\S3333339@= ףp SQ+9@Q SzG!9@ ףp= S9@Q S(\9@GzS{G8@GzSQ8@= ףp Sfffff8@\( SQ8@Q SzG8@\( SQ8@= ףp SQ8@= ףp S8@GzSGz8@SGz8@RS8@p= S8@QSQ8@QSQ8@QS8@QSR8@RS8@= ףp S{G8@\( SQ8@ ףp= Sfffff8@QSzG8@QSfffff8@ ףp= S{G8@ ףp= SHz8@)\SQ8@ ףp= SQ8@QS{G8@QSHz9@)\SQ9@QSfffff&9@)\SQ+9@\( S3333339@GzSQ89@ףp= SY9@QSY9@= ףpSQ^9@(\SzGa9@(\"Sffffff9@p= #SQk9@Q%SQk9@pR8@R333338@+RQ8@(\Rfffff8@\(RzG8@ ףp=RQ8@)\RGz8@)\RHz8@QRHz8@QR8@(\R{Gz8@(\RQx8@Rffffff8@GzRQ^8@= ףpRRQ8@\(RHzG8@ ףp=RHzG8@)\R(\B8@QR{G:8@QR3333338@)\RQ+8@\(RQ+8@(\Rfffff&8@RRzG!8@RQ8@= ףpR8@ ףp=RzG!8@QRzG!8@p= Rfffff&8@p= RzG!8@RRzG!8@RQ8@RRfffff&8@(\RQ88@QRHzG8@\(Rffffff8@(\RQx8@(\Ř8@QRGz8@QRzG8@)\RQ8@\(RQ8@GzR333338@(\RQ8@RQ8@8ףp= G]p= C@@= ףp\\(\@@ףp= G]p= C@@]q= ףP@@\Y@@= ףp\\(\@@p= ׳\GzT?@ףp= Z@@@ p= ׳\@@@\ @@@\Q?@\Q?@ףp= [GzT?@[GzT?@[GzT?@@[GzT?@= ףp [GzT?@= ףp [Hz?@[Hz?@ZHz?@ףp= ZHz?@p= ׳^H@QWH@p= ׳^H@^H@@^H@^H@]H@]H@@]H@]H@\H@\H@@\H@\H@[H@[H@@[H@[H@ZH@ZH@p= SZH@p= ZH@p= YH@p= דYH@p= SYH@p= YH@QXH@QXH@QUXH@QXH@QWH@QWH@0 ףp=W(\•H@QW33333H@ ףp=W(\•H@ ףp=W33333H@QW(\H@@(\RF@(\Q(\F@(\RF@RF@@R(\F@RF@(\Q(\F@hQQF@Q= ףpG@* ףp=QF@QQ= ףpF@)\Q= ףpF@QQ(\F@p= QfffffF@Q(\F@ ףp=Q= ףpF@ףp= Q)\F@RQ)\F@Q ףp=F@\(Q)\F@QQF@ףp= Q= ףpF@QQ)\F@QQ33333F@(\Q(\µF@(\Q33333F@)\Qq= ףF@)\Q(\µF@= ףpQ\(F@GzQ(\F@\(QfffffF@QQ ףp=F@QQ33333F@Q(\F@QQ\(F@ ףp=QF@QQp= F@ףp= QF@(\Q(\F@Q(\F@RQ\(F@QQ\(F@p= דQG@QQ(\G@(\QfffffG@QQ)\G@p= דQ ףp= G@RQ G@Q33333G@p= דQ(\G@RQ= ףpG@0p= ׃Q(\5G@(\OQG@p= ׃Q(\5G@Q(\UG@(\OQG@((\PF@(\P)\G@(\P)\G@(\PF@= ףp _E@[E@= ףp _E@_E@^E@^E@@^E@^E@]E@]E@@]E@]E@\E@\E@@\E@\E@[E@[E@0]G@@]G@]G@]G@@]G@ P^(\A@= ףp\\(|C@= ףp\(\A@\fffffA@] ףp= B@@]lB@] ףp=B@]fffff&C@^\(|C@ 8^= ףpC@^E@^= ףpC@^D@^D@^E@ Pףp= \(\B@ףp= \= ףpD@ףp= \(\B@ףp= \B@ףp= \C@ףp= \C@ףp= \D@ףp= \D@ףp= \= ףpD@ 0@]E@@] ףp=E@@]E@@]E@@] ףp=E@ 8@]333333G@@]H@@]333333G@@]G@@]H@@]H@ףp= \= ףp}B@QWB@ףp= \B@@\B@\B@[B@[B@@[B@[B@ZB@ZB@@ZB@ZB@YB@Y= ףp}B@@YB@YB@XB@XB@@XB@XB@WB@QWB@hףp= [D@ףp= YD@ ףp= [D@[D@@[D@[D@ZD@ZD@@ZD@ZD@YD@ףp= YD@8ףp= \(\/F@ףp= [9G@dףp= [= ףp=F@ףp= [@F@ףp= [p= CF@= ףp[)\HF@= ףp[(\OF@= ףp[q= ףPF@p= [YF@ ףp=[(\bF@ ףp=[\(\F@[YF@[33333SF@[LF@[fffffFF@[p= CF@ףp= [fffffFF@= ףp[fffffFF@p= [(\BF@ ףp=[)\HF@ ףp=[fffffFF@\p= CF@\p= CF@ףp= \(\BF@= ףp \fffffFF@= ףp \)\HF@p= \)\HF@p= \p= CF@ ףp=\9F@ ףp=\9F@ \= ףp=F@= ףp-\= ףp=F@= ףp-\@F@p= 3\= ףp=F@p= 3\(\5F@p= 3\q= ף0F@p= 3\(\/F@ ףp=:\333333F@@\9F@@\@F@@\p= CF@ףp= G\fffffFF@ףp= G\LF@ףp= G\q= ףPF@ףp= G\YF@= ףpM\p= cF@= ףpM\)\hF@p= S\p= cF@p= S\)\hF@ ףp=Z\(\oF@`\yF@ ףp=Z\yF@ ףp=Z\fffffF@`\ ףp=F@`\(\F@ףp= g\(\F@ףp= g\(\•F@= ףpm\F@= ףpm\ ףp=F@= ףpm\33333F@p= s\F@p= s\= ףpF@p= s\(\F@p= s\(\F@p= s\)\F@p= s\(\F@ ףp=z\(\F@ ףp=z\33333F@ ףp=z\F@\F@\33333F@ףp= \q= ףF@ףp= \F@= ףp\p= F@p= ד\fffffF@p= ד\= ףpF@p= ד\\(F@ ףp=\F@\)\F@ףp= \)\F@\F@ףp= \q= ףF@\(\F@\\(F@ףp= \(\F@\(\F@ ףp=\(\F@ ףp=\33333F@ ףp=\(\F@ ףp=\\(F@\G@\fffffG@ ףp=\ G@\q= ףG@\(\G@ ףp=\(\G@ ףp=\= ףpG@\p= #G@ ףp=\p= #G@ ףp=\ ףp=*G@ ףp=\333333G@ ףp=\9G@ףp= ]9G@p= ד\H@0 ףp=\9G@ ףp=\@G@p= ד\@G@p= ד\LG@p= ד\33333SG@p= ד\(\UG@ ףp=\(\UG@\q= ףPG@ףp= \q= ףPG@ףp= \(\UG@ףp= \YG@= ףp\= ףp]G@= ףp\YG@p= ׳\\(\G@p= ׳\(\bG@p= ׳\p= cG@ ףp=\(\oG@ ףp=\(\uG@\\(|G@ףp= \\(|G@ףp= \p= ׃G@ףp= \)\G@ףp= \̌G@= ףp\33333G@p= \(\•G@p= \= ףpG@p= \(\G@ ףp=\p= ףG@\fffffG@ףp= \(\G@= ףp\(\µG@p= \(\µG@ףp= \\(G@= ףp\= ףpG@= ףp\p= G@= ףp\fffffG@= ףp\G@= ףp\q= ףG@= ףp\33333G@= ףp\G@p= \\(G@p= \(\G@p= \(\G@p= \ ףp=G@ ףp=\q= ףG@]\(G@ףp= ]= ףpG@ףp= ]H@xףp= [D@ףp= ZF@ ףp= [D@ףp= [E@ףp= [E@ףp= [F@ףp= [F@[F@@[F@[F@ZF@ZF@@ZF@ףp= ZF@pףp= G[GzT?@ףp= G[D@ ףp= G[GzT?@ףp= G[@@ףp= G[@@ףp= G[A@ףp= G[A@ףp= G[B@ףp= G[B@ףp= G[C@ףp= G[C@ףp= G[D@ףp= G[D@= ףpZ@@Y@B@= ףpZ@@Z@@@Z@@Z@@ףp= Y@@ףp= Y@@ףp= YA@YA@YB@Y@B@Y@B@@Y@B@Y@B@YB@YA@Y)\HA@(Y@B@YB@Y@B@YB@@ףp= Y= ףp}B@YD@Y= ףp}B@ףp= YC@ףp= YC@ףp= YD@ףp= YD@@ףp= ZD@ףp= ZF@ףp= ZD@ףp= ZE@ףp= ZE@ףp= ZF@ףp= ZF@Hףp= ZF@ZH@ףp= ZF@ZF@ZG@ZG@ZH@ZH@Xףp= YD@QWD@ףp= YD@@YD@YD@XD@XD@@XD@XD@QWD@Pףp= ZE@XE@ףp= ZE@YE@YE@@YE@YE@XE@XE@`Z(\F@Q%X(\F@ Z(\F@Y(\F@Y(\F@@Y(\F@Y(\F@X(\F@X(\F@@X(\F@Q%X(\F@0p= ׃W@@p= ׃Wfffff@@p= ׃W@@p= ׃W(\@@p= ׃Wfffff@@`QW33333@@\(W(\C@ W33333@@(\WA@= ףpWA@\(W33333A@p= ףWB@QW@B@QWB@QWC@ףp= W(\C@8= ףpXE@= ףpXfffffF@= ףpXE@= ףpXF@= ףpXF@= ףpXfffffF@8p= ׃W@@QV(\@@p= ׃W(\@@@W(\@@W@@QV@@ HQW@B@ ףp=V@B@QW@B@W@B@@W@B@W@B@V@B@ ףp=V@B@!()\VB@= ףpmVB@)\VB@= ףpmVB@"@W ףp=JD@(\VLD@W ףp=JD@W ףp=JD@W ףp=JD@@W ףp=JD@(\VLD@#Pףp= 'XE@GzVE@ףp= 'XE@XE@WE@WE@@WE@WE@GzVE@$8)\V?@pV?@)\V?@V?@V?@pV?@%@ףp= U{G>@@U?@ףp= U?@U?@QU?@(\U{G>@@U?@&8ףp= 7UR>@GzT33333>@ףp= 7U33333>@UQ>@TQ>@GzTR>@'XGzVzGa>@ףp= VA@ ףp=VzGa>@\(V?@GzVzG?@QV@@GzVA@ףp= V33333sA@ ףp= V(\uA@= ףp VA@(0QhU@@= ףpMU= ףp}A@= ףpMU@@ ףp=ZUA@QhU= ףp}A@)p= דV@@GzS\(A@p= דVA@@VA@= ףp VA@GzV(\A@= ףp V(\A@UA@U= ףp}A@@U= ףp}A@U= ףp}A@ףp= TA@(\T ףp=A@RT)\A@\(T(\A@p= ףT33333A@\(T(\•A@ ףp=T\(A@QT(\•A@p= דTA@p= CT33333A@(\BŤA@QET)\A@p= CTp= ׃A@\(@QQ)\D@p= Q(\E@QQ)\D@ףp= Q ףp=D@QQ33333D@p= Q(\µD@p= Q(\E@?8QQ ףp=E@GzQ)\F@GzQ ףp=E@QF@QQF@QQ)\F@plplot-5.10.0+dfsg/OLDER-NEWS 644 1750 1750 17424412243272525 143520ustar andrewandrewThis file is a concatanation of Major PLplot announcements (mostly about releases) in reverse chronological order. ************************************************************************** Version 5.0.2: Release announcement ************************************************************************** From irwin@uvastro.phys.uvic.ca Thu Feb 15 09:40:02 2001 Date: Sat, 10 Feb 2001 14:22:30 -0800 (PST) From: Alan W. Irwin To: plplot_general Subject: [Plplot-general] plplot-5.0.2 has been released It has been a month since PLplot-5.0.1, and we thought another stable release was appropriate at this time. Get this new PLplot-5.0.2 as a tarball file release at http://sourceforge.net/projects/plplot. It was created from the current CVS head which has benefited quite a lot from steady bug fixing over the last month (for example, file familying now works, and the plmeta now properly outputs to pipes). Version 5.0.2 supersedes all previous versions. Please note that for improved stability you should use the tarball release and not the CVS HEAD. (We try things on the HEAD which might momentarily break plplot from time to time.) Note we also have some innovation in the new release as well as bug fixing. (1) The python xw??.py examples should now work right out of the box without fooling around with PYTHONPATH. (2) Install file locations now conform to the FHS. So, for example, you will find the examples installed at $prefix/share/doc/plplot/examples. (3) The content of the documentation source has been greatly improved from 5.0.1. We have now completely finished going through the doc directory for several generations of notes on various topics and incorporated all this material (with substantial updates and expansions) into our docbook source. The result is new docbook sections/chapters on devices, driver functions, plrender and metafiles, familying, interactive output devices, color, and C and fortran bindings. We have added API sections that are specialized to C and fortran. We have also added a bibliography and reorganized the material so that all the reference material (bibliography and API sections) appear at the back of the document. We have now removed virtually all the old files in doc so there is no longer the potential of getting confused with these older generations of documentation. We don't anticipate the addition of too many more chapters or sections to the documentation, but some refinement of the existing chapters/sections still needs to be done. If you are interested in helping with this effort, please contact yours truly (irwin@beluga.phys.uvic.ca). (4) Our DocBook source can be built into PLplot documentation in a variety of formats (currently html, dvi, postscript, pdf, info, and man). Our CVS does not have these files because they are generated rather than source files. However, you can always get the latest forms of these results from http://www.plplot.org/resources/docbook-manual/, and for your convenience we have also bundled these results into the doc directory of the 5.0.2 tarball. Tests: Release version 5.0.2 has been extensively tested on Debian potato with double precision configured. The cdemos, cxxdemos (c++), fdemos (fortran), tcldemos, tkdemos, and the new standalone xw??.py python demos all now work well on potato. Similar tests show good results on RedHat 6.2 except for Tcl/Tk whose 8.0 version on RH 6.2 is too old for us to support. We have not yet upgraded our test box to RedHat 7.0 (which does include a Tcl/Tk/iTcl version that we support), and until we do this upgrade, we would appreciate any RedHat 7.0 reports our users could give us. Similar tests (excluding Tcl/Tk and python because we would have had to download configure, build, and install these packages ourselves) show good results on solaris (SunOS 5.6 Generic_105181-23 sun4u sparc SUNW,Ultra-2 = solaris 2.6). Putting on my yplot (http://sourceforge.net/projects/yplot) hat momentarily, I have also rebuilt yplot, the convenient yorick front end to plplot. The new yplot version (to be released soon) is based on plplot-5.0.2 libraries, and I have just confirmed it gives excellent results for a wide variety of 36 different scientific plots from my present research. Please send bug reports, comments, and questions to this list, and have fun (and profit) with the new 5.0.2 release of plplot! Alan W. Irwin email: irwin@beluga.phys.uvic.ca phone: 250-727-2902 FAX: 250-721-7715 snail-mail: Dr. Alan W. Irwin Department of Physics and Astronomy, University of Victoria, P.O. Box 3055, Victoria, British Columbia, Canada, V8W 3P6 __________________________ Linux-powered astrophysics __________________________ ************************************************************************** Version 5.0.1: Release announcement ************************************************************************** From: "Alan W. Irwin" To: plplot_general Subject: [Plplot-general] plplot-5.0.1 has been released. Date: Sat, 13 Jan 2001 08:59:42 -0800 (PST) Get this new stable version as a tarball file release at http://sourceforge.net/projects/plplot. It was created from the current CVS head which has benefited quite a lot from steady bug fixing over the last few months. Version 5.0.1 supersedes all previous versions. (Please note that for stability you should use the tarball release and not the CVS HEAD. We ordinarily make no guarantees about the stability of the HEAD since we want to be free to try things on the HEAD which might break plplot from time to time.) Note we also have some innovation in the new release as well as bug fixing. (1) The documentation building process has been changed completely over to DocBook 4.1 XML. To see the nice html, postscript, pdf, dvi, info, and man results of this effort, please look at http://www.plplot.org/resources/docbook-manual/ (2) The content of the documentation source has been greatly improved from previous versions. However, more work is always needed on documentation content, and if you have an interest in helping out with this aspect of plplot, please contact yours truly (Alan W. Irwin). (3) The header file style has been changed to be similar to that of X. That is every header file reference in source should have the prefix plplot, e.g., #include "plplot/plConfig.h" This gives much less potential for nameclashes, if the headers are stored in, e.g., /usr/include/plplot. It also means that the -I parameter stays the same as it was before on the compile line. (4) The library names have been changed so they are in a more consistent style now that gives more protection against nameclashes. All library tags (suffixes to the core name of libplplot, libplmatrix, etc.) are now gone except for d for double precision and nothing for single precision or the libplmatrix library (which is always single precision even if you have configured double precision). To indicate what the library names that were used to build plrender, execute the installed $prefix/bin/plplot_linkage. On my current system this emits the following line: -L/usr/local/plplot/lib -lplplotd -lplmatrix -litk3.1 -ltk8.2 -litcl3.1 -ltcl8.2 -L/usr/X11R6/lib -lX11 -lvga -ldl -lm -lg2c -Wl,-rpath -Wl,/usr/local/plplot/lib Your system (if it isn't Debian potato) will have a different link line emitted by $prefix/bin/plplot_linkage. That is the one to use! (5) Python now works! (at least in widgetless mode). Configure python (which happens by default), and try out the new widgetless examples, xw??.py. You will like them! These examples all require double precision. Eventually, we plan to add Tk widget capabilities to these examples. Any help would be appreciated. (6) Fortran now works with double precision and Linux! (It always worked well with single precision before, but it is nice to have this generality.) Tests: Release version 5.0.1 has been extensively tested on Debian potato with double precision configured. The cdemos, cxxdemos (c++), fdemos (fortran), tcldemos, tkdemos, and the new standalone xw??.py python demos all now work well on potato. Similar tests show good results on RedHat 6.2 except for Tcl/Tk whose 8.0 version on RH 6.2 is too old for us to support. We have not yet upgraded our test box to RedHat 7.0, and until we do, we would appreciate any RedHat 7.0 reports our users could give us. We have also been able to configure, build, and install the software on a solaris system, but so far only minimalist testing has been done on that system. Putting on my yplot (http://sourceforge.net/projects/yplot) hat momentarily, I have recently rebuilt yplot, the convenient yorick front end to plplot. The new yplot version (to be released soon) is based on plplot-5.0.1 libraries, and I have just confirmed it gives excellent results for a wide variety of 36 different scientific plots from my present research. Please send bug reports, comments, and questions to this list, and have fun (and profit) with the new 5.0.1 release of plplot! Alan email: irwin@beluga.phys.uvic.ca phone: 250-727-2902 FAX: 250-721-7715 snail-mail: Dr. Alan W. Irwin Department of Physics and Astronomy, University of Victoria, P.O. Box 3055, Victoria, British Columbia, Canada, V8W 3P6 __________________________ Linux-powered astrophysics __________________________ ************************************************************************** Version 5.0.0: Release announcement ************************************************************************** From: Geoffrey Furnish Date: Fri, 12 May 2000 12:27:34 -0700 (PDT) To: plplot-general@plplot.org Subject: [Plplot-general] PLplot 5.0.0 is released Greetings to all, And you thought it would /NEVER/ happen. :-). I am pleased to announce that PLplot version 5.0.0 has been released. The rest of this email will attempt to explain exactly what this means in more detail. First off, thanks to all the core team members who have helped with various tasks that I could not attend to. Not the least of which, is the simple issue of deciding to do it, right now. Now for a little background. We are done with the 4.99 x, x=abc... business, as well as the dated snapshots. Dated snapshots are being replaced by providing anonymous cvs access through plplot.org. So anyone who wants to track day-to-day development, or follow progress on their patch submissions, etc, will be able to do that by using cvs. In addition to that, we will provide real releases which are supposed to be stable, or at least to get stable over a short time. The releasing naming conventions will follow the Linux tradition. Even releases are supposed to be stable, and only bug fixes and stabilization patches will be applied to these. Thus, 5.0.0 is the first in this strain. If people find minor little nits that need fixing, this will result in 5.0.1, 5.0.2, etc. We hope it doesn't get too far... Ongoing feature development will proceed in the 5.1 strain. The release and versioning business is coordinated with cvs in the following manner. Stable releases go on a branch. Ongoing development continues on the cvs head. To be really cvs technical, we provide a branch point tag, a branch tag, and release tags. So, to be totally explicit, I did the following operations today when preparing the 5.0.0 release: 1) cvs tag bp_v5_0 2) cvs rtag -b -r bp_v5_0 v5_0 plplot 3) cvs tag v5_0_0 4) cvs export -r v5_0_0 plplot 5) mv plplot/ plplot-5.0.0 6) tar cvzf plplot-5.0.0.tar.gz plplot-5.0.0/ Step 1 labels the state of the repository at the point in time when we fork the 5.0 release branch. The name of the branch point for the 5.0 release, is bp_v5_0. Step 2 creates a cvs "branch tag" for referring to the head of this branch. The name of this tag is v5_0. Step 3 creates a tag for the specific release 5.0.0, with tag name v5_0_0. In the current case, there were no changes made between any of these steps, so steps 1, 2, and 3 all refer to the same versions of the files. But as we move on from here, people who wish to participate in stabilizing the 5.0 branch will need to check out the head of this branch via: cvs co -r v5_0 plplot Then they can do stabilization oriented development, submit context diffs, and the core team will apply these patches, and eventually at various points along the way, we will tag v5_0_1, v5_0_2, etc. So, the thing to understand here is that "v5_0" is the branch tag. It is a floating reference, which alwasy points to the head of this branch. Non branch tags just refer to static file versions, labelling a single specific collection of file versions for all of time. Henceforth, the main line of deveopment, which we will call 5.1, proceeds on the cvs head. There is no branch tag for this. To see the ongoing develoment work on the 5.1 branch, just do: cvs co plplot Use update to track ongoing work, etc. We may possibly tag a few interesting points along the way as v5_1_0, v5_1_1, etc, but there will not be a branch tag for this. Eventually, when 5.1 development seems to have run its course, we will fork another branch for 5.2, making a new branch point tag bp_v5_2, a branch tag v5_2 to refer to the head of the branch holding the 5.2 release strain, and occasional tags for specific 5.2.x releases. Hopefully that is comprehensible to people with a cvs background. See the CVS faq for more background. We'll try to put this kind of info on the web site somewhere as we get better organized. Anyway, in addition to the cvs access mechanisms described above, we also are providing the 5.0.0 release as a .tar.gz file. Steps 4, 5, and 6 show exactly how this was created, guaranteeing that the plplot-5.0.0.tar.gz file contains exactly the file versions that were tagged as v5_0_0 in step 3, but omitting the CVS control information. This tarball release is appropriate for people who just want the code in a packaged form, and aren't interested in tracking the cvs development specifically, or even in using cvs to fetch identified versions. This file has been uploaded to the plplot.org ftp site. You can get it via: /anonymous@ftp.plplot.org:/pub/plplot/plplot-5.0.0.tar.gz Eventually we will get the www.plplot.org web site updated to reflect this, and also figure out how to identify this file release on the sourceforge.net project page for plplot. Someone will post messages about that as we progress in these other areas. Anyway, the bottom line is, right now you can get PLplot 5.0.0, either by anonymous ftp, or by anonymous cvs. Now for a word about the contents of 5.0.0. The main thing that has happened over the past three years since I escaped graduate school, is that we've been trying to fix bugs in the autoconf support, and in the Tcl/Tk driver, and in color handling of the X driver. There have been a great many bugs rooted out of the system over this period of time, and I would encourage all PLplot users worldwide, to upgrade to 5.0.0 at this time. This release is known to work with 8.x strain Tcl/Tk releases, Itcl 3 releases, Python 1.5, etc. The problems with X color management are believed to be resolved in a manner that is generally satisfactory (there's always room for improvement in this area, but the current state is a big leg up over where it was before in the 4.99j or in the early snapshots). And numerous patch submissions from users worldwide have been integrated (although admittedly there are more outstanding, pending core team review). There is also a new Mac driver by Rob Managan. Currently just the necessary source and doc files, but we will get his Mac CW project support goods uploaded to ftp.plplot.org at some point too. So, there's been lots of improvement since the last release, and I hope people will endeavor to upgrade to this new version. If things go wrong, please submit patches to sourceforge.net, and we'll work on getting it stabilized. In the midst of such endeavors, please note the distinction between bug fixes to 5.0.x, and feature development for ongoing 5.1. The new stuff is going to go into 5.1. 5.0.x is really there just to have an up to date stable and official release for those who don't want to track ongoing development. As such, don't expect major new features to appear in 5.0.x releases, just fixes that relate to platform support, minor bugs, etc. So, what lays ahead for 5.1? Well, like I said before, that depends a lot on what people contribute. My personal actions will focus in the short term on better Tcl package participation and improved Python module interaction. But there are more drivers in the works, web integration opportunities, more plot types, variations, and viewing overhauls, etc, that various people have expressed interest in. More news as it happens. Remember that you can track it all by subscribing to plplot-cvs@plplot.org, or by reviewing the lists chronology in geocrawler. Or, you can use the cvs history command (also easily accessible in Emacs fromt he version control pane), to see what people are doing, track your patch submissions to see when they get in, etc. Cheers to all, -- Geoffrey Furnish Actel Corporation furnish@actel.com Senior Staff Engineer 955 East Arques Ave voice: 408-522-7528 Placement & Routing Sunnyvale, CA 94086-4533 fax: 408-522-8041 "... because only those who write the code truly control the project." -- Jamie Zawinski _______________________________________________ ************************************************************************** Historic PLplot reorganization (at sourceforge) message ************************************************************************** From: Geoffrey Furnish Date: Wed, 12 Apr 2000 11:57:44 -0700 (PDT) To: plplot-general@plplot.org Subject: [Plplot-general] Welcome to the new era of PLplot! Hello Everyone, Welcome to the new era of PLplot! With many apologies to all for the extreme delays that have been incurred over the past months, it gives me great pleasure to be able at this time, to finally provide details of the reorganization of the PLplot project. As most of you know, PLplot was hosted at dino.ph.utexas.edu during the time that Maurice and I were employed at the Institute for Fusion Studies, at the University of Texas at Austin. dino continued as the host for PLplot after we each moved on, but we were searching for a suitable place to relocate the project. As I am sure you all know, the open source software movement has gained a lot of steam in recent times, and there were a number of organizations willing to host PLplot. Of course we deeply appreciate the offers of sponsorship tendered by all of these organizations. However, it turned out that the technical challenges of hosting a project like this, were not fully appreciated by all such sponsoring agencies. Curiously, we were a little hobbled in a sense, by being just a hair ahead of the curve, and wound up sinking significant amounts of effort into rehosting PLplot at two sites that ultimately simply didn't have the sophistication to quite bring the task to closure. The final resting place, is sourceforge.net, operated by VA Linux. PLplot now has its own domain, plplot.org, and a variety of services accessible through this domain. The domain is hosted by sourceforge.net. I will explain the current services available through this domain below. If anyone in the user base wants to thank VA Linux for their sponsorship of the PLplot project, you could send email to Chris DiBona to express your appreciation. Our web site will also contain attribution to this effect, once we get it put together. Now, on to the list of services provided through plplot.org. First, the new official web site for PLplot is www.plplot.org. Randy is the web master, and will be bringing this up as time permits. For starters, he has imported the prior PLplot web site by Noel Gorelick, and will be expanding from here. Second, we now export the PLplot CVS repository via anonymous CVS at cvs.plplot.org. From now on, anyone will be able to obtain the latest version of PLplot using anonymous CVS. CVS has become the darling source control system of the open source movement, and deservedly so. I won't take the time in this message to attempt to explain this in detail. There are other resources on the net, and at sourceforge.net in particular, which do this job. The very short story is that you can do this: setenv CVSROOT :pserver:anonymous@cvs.plplot.org:/cvsroot/plplot cvs login cvs co plplot Once you have done this, you will be able to track ongoing development (if you wish) by doing a "cvs update" from time to time. Third, there will be anonymous ftp as well. We don't have anything up there yet, so information will be forthcoming on this once we finally put some files up there. Probably we will put up the same files that were on dino, providing the historical "releases", and in the future we may make pacakged tarballs of future releases. Anyway, more info on that once there is something concrete to report. Fourth, there is a new mailing list, "plplot-general@plplot.org". All subscribers to the old list (plplot@dino.ph.utexas.edu) have been transfered to the new list. Also, a few people who've sent me email over the last fewmonths have been added as well (that is, the requests I could still locate in my inbox :-). You should've just received a message from the list manager explaining to you how you can interact with it. Sourceforge.net uses "mailman", which is a bit different from what we used before (majordomo), but there is plenty to like about mailman if you haven't encountered it before. Primarily it interacts with subscribers through a web interface, so you have much greater personal control over how it interacts with you. In particular, I hope that this will finally put an end to the desperation "get me off this list" problem we were having before. Please, if you want off, just go the mailman management page, and do the job! But you can also use it to control numerous delivery options including digesting, etc. One thing that we were not able to do, is to get the old majordomo mailing list archives, directly imported into the new list manager. We'll probably put those historic list archives up on the anon ftp site somewhere so you can still get them if you want. Anyway, mailing list traffic from this point forward /is/ being archived, just not combined with the old stuff. Oh well. Anyway, "plplot-general@plplot.org" supercedes the old list. The old one is down anyway as everyone probably knows. The story on that is that dino actually suffered a cataclysmic hardware failure last fall, just as we were about to move off to sourceforge. This resulted in lost time as we scurried to restore the filesystems, recover the PLplot cvs repository, etc. If anybody wants to thank the IFS staffer who exerted heroic effort to help us recover from this disaster, you could send email to Jim Dibble , to express your gratitude. He worked really hard to help dig us out of that ditch. Besides "plplot-general@plplot.org", there is also "plplot-cvs@plplot.org", to which cvs commit messages will be sent when developers with write access to the repository commit changes. If you haven't used cvs before, let me just say that these commit messages are an extremely valuable way to keep abreast of what is going on in a software development project. It results in a certain amount of email, so if that bothers you, you won't want to be on that list (or you should make sure you have a filtering agent so you can control the inbound flux to your liking). But if you just want to have a very low-overhead way to keep tabs on what is going on, who's done what when, who's patches have been applied to the repository, etc, subscribing to plplot-cvs@plplot.org is an excellent idea. If you are one of the people who makes occasional patch submissions, you might want to subscribe at least long enough to watch for when your changes go in, for example. Fifth, there is a "project page" at sourceforge.net: http://sourceforge.net/project/?group_id=2915 We will probably have a link to this somewhere on the www.plplot.org home page. Anyway, people who are tapped into how sourceforge works, may find this useful. Frankly, none of the current developers have a clue what to do with all this stuff, so we're all learning here, and will all have to collectively help educate ourselves about how to get the most value out of this. Anyway, one thing that is fairly easy to access from here, is a browsable portal onto the CVS repository, orchestrated through "CVS Web", modified by sourceforge.net. There is lots to explore at sourceforge.net, far more than I am even remotely aware of or could convey in this message. We will all have to learn together how to best exploit this resource for the open source community. Finally, a word about people. As long time participants on this mailing list will remember, there has long been a lot of frustration over the difficulty of getting patches into PLplot. This has primarily been a function of the fact that Maurice and I are both out of the university scene now, holding down real day jobs with real professional commitments, and simply haven't been able to provide the bandwidth to support the pace of development of an open source project like PLplot. We (and here "we" means the entire PLplot community) certainly appreciate and have benefited from the valuable contributions offered by many over the years, but my personal failure to rapidly incorporate everyone's work, has been a key liability for the project. Correcting this critical problem, was one of the primary goals in seeking a rehosting arrangement for PLplot. This vision has now FINALLY! been realized. At this time, there are a total of five people with write access to the repository: myself Maurice Alan W. Irwin James Phillips (randy) Rafael Laboissiere Alan and Rafael have been overhauling the documentation of late, and that will be showing up for public consumption before long. And Randy is picking up the webmaster role. Exactly how we will deal with inbound patch submissions has not been fully worked out, but my point here is, at least /I/ am no longer the bottleneck. We have a publicly accessible host, we are exporting the CVS repo through anoncvs, and we have multiple people who can act to get patches applied. These are the reasons for regarding this as the dawn of the new era of PLplot. I would like to take this chance to publicly thank Alan, Randy and Rafael for joining Maurice and I in this capacity, and for both the work they have already done, and will be doing as we move forward. it has been a long time in coming (too long), but I hope that all PLplot users everywhere will share my enthusiasm as we enter the new millenium with a revitalized PLplot project. I suppose in closing, it would be good to say some words about what is really going on with the software itself. Curiously, this is the part I am least able to address. And in a strange but real sense, that is the best part of this message. I have no idea what is ahead of us. It really just depends on what the world wide open source developer community pulls out of their hats (keyboards). Onward Ho! -- Geoffrey Furnish Actel Corporation furnish@actel.com Senior Staff Engineer 955 East Arques Ave voice: 408-522-7528 Placement & Routing Sunnyvale, CA 94086-4533 fax: 408-522-8041 "... because only those who write the code truly control the project." -- Jamie Zawinski _______________________________________________ ************************************************************************** Version 4.99i: Summary of major changes ************************************************************************** Primarily a bug-fix release. Major changes: - Changed distribution status to GPL/LGPL. See "Copyright". Other administrative file name changes. - Various small bugs in configure & build fixed. - Bug in code to keep track of window world coordinates fixed (symptoms: core dump would occur after the 65th page if pleop() was used to end the page rather than pladv()). Thanks to Ian Searle for providing a demonstration of the bug. - Bugs fixed in core routines + TK driver handling of colormap when saturation = 0; i.e. grayscale plots. Thanks to Radey Shouman for his help. - Fixed a bug that was preventing the exponential label from showing up under certain circumstances (3-D plots). - Conex device (tek emulator under DOS) driver support added in tek.c; contributed by Mark Olesen. - Bug fixed in X driver that was causing a "Bad Match" error upon startup on some systems. - Postscript driver: Fixed bug in current point update after state change. Fix to allow cmap1 color selections to appear in grayscale; contributed by Radey Shouman. - Tk driver: Fix to allow a TK main window to be associated with each PLStream (so x14c now can use either the TK or DP driver), also fix to properly update plserver's X-driver when cmap state is changed. Contributed by Radey Shouman. - pltek: Now checks for the terminal type and provides some rudimentary decisions based on the TERM setting. The xterm is unaffected, but with a terminal type of "tekterm", the 'Page >' prompt is printed on the graphics screen so that the plot can be seen without having pltek flash back to the text screen immediately. Contributed by Mark Olesen. - Updated DOS/EMX driver provided by Mark Olesen; see sys/dos/emx for more detail. - Amiga driver: Updated to work with new version. Now has configure script for SKsh users -- is now trivial to configure and build. A fall-back Makefile is also provided. Several bugs fixed, notably one in changing the screen mode. A compiled version of the PLplot library (SAS/C 6.2, IEEE single precision floats, optimized) and plrender are now available in the ~ftp/plplot/amiga directory on dino.ph.utexas.edu. - The "plpr" script (used when choosing "Print" from Tk driver) now defaults to using color postscript as output. ************************************************************************** Version 4.99h: Summary of major changes ************************************************************************** This was to be a quick bug fix update, but I got going on several major changes plus addition of user contributions. So there are some important new capabilities as well as a lot of bug fixes. Note: as a result of a lack of time, most of the DOS drivers and the Amiga driver have not been upgraded to work with the new configure/build files. The DOS DJGPP port is one exception. So these are essentially useless until these are done. I will issue another beta as soon as these are done, hopefully within a week or two. ------------------------------------------------------------------------ Configuration, building, and installation: Completely new configuration script! The new configure script is built using GNU autoconf, and great care was taken in its construction. Highlights: 1) It is capable of doing basically everything it did before. Packages are included by typing e.g. --enable-tk or --disable-tk, etc. Major options are set by typing e.g. --with-gcc or --without-opt, etc. There is a startup file so you can customize on a per-site basis like before. Although now, shell variables are used to store settings rather than m4 variables, and only are substituted in the various files at the end of the configure script. 2) The Makefile components are usable on non-Unix systems. Notably the dependencies -- the Makefile is constructed by concatenating several text files together. The setting of configuration defaults on a non-Unix system is similarly easier than before. Just keep around custom copies of plConfig.h and plDevs.h. It's better to have 'configure' build these for you, of course. 3) The configure script is fully automatic. It should find all the major capabilities needed by PLplot if your system supports them, with no user intervention required. 4) The object file dependency list is now constructed using "gcc -MM" (like "makedepend", only better), making it much more robust. 5) Much better support for shared libraries. Works under HPUX and SunOS now, with Solaris, Irix, OSF-1 probably not far behind if someone wants to fill in the details. AIX probably I will get to, and Geoff has started on the Linux shared library build. 6) The new header file plConfig.h makes it much easier to get portable code, by concentrating all the hacks in one place and using configure to set them accordingly. See the cf/README file for more info. It works pretty much without user intervention now, though. ------------------------------------------------------------------------ The second major addition: a Tcl PLplot API and interpreter. This means you can now make PLplot calls from Tcl. An interpreter -- pltcl (an extended tclsh) is provided. Be sure to check out the demo programs as follows: foobar% pltcl % source demos.tcl % 1 % 2 etc, up through 7. Not all PLplot C API calls are supported by the Tcl API yet. As part of this development a Tcl extension was created to handle matrices (arrays). Right now it supports 1-d, 2-d, and 3-d arrays. Eventually it will be improved a bit more and better documented and released to the Tcl/TK community. For now, read doc/tclMatrix.doc and check out the Tcl demos. ------------------------------------------------------------------------ Other changes: - Another major cleanup of the core source files. - Ability to make point, line, and polygon plots in 3-d added. (Contributed by Geoff Furnish.) - Changes to support returning the cursor location in world coordinates given a mouse click, if supported by the driver (only used by windows driver so far -- a lot of work remains for the rest of the package to use it). Supports multiple windows per page, and gets the correct set of world coordinates for the plot selected. Contributed by Paul Casteels. - Function to plot map backgrounds added, where the map data is read from the specified map data file (examples provided). Contributed by Wesley Ebisuzaki. - Fast point plot ability added. Call plpoin with code=-1 for a 4X or so speed increase in point plots. - Search path for needed files improved and made more consistent. (Contributed by Mark Olesen). - Can now save a plot from the Tk/DP driver and have the colors turn out correctly. - Previous problems re: mono X displays fixed. - Multiple sequential bop or eop's are now munged together, making it easier to avoid blank pages. - Can now change the number of subpages at any time. - Fixed problems in tek drivers caused by entering cbreak mode -- this was fouling up user input (tty) requests. Now it goes into cbreak mode when switching to the graphics screen, and back to canonical mode when switching to the text screen. Also, this is all usable now on systems without an ANSI libc. - Added new driver -- HP Laserjet III in HPGL emulation mode (lj_hpgl). Contributed by Conrad Steenberg. - Greatly improved support for embedded plframe use (directly from plserver or a plframe-extended wish). See tk01, tk02, tk03 for more info. Many minor improvements and a few bugs squashed in the Tk driver. ************************************************************************** Version 4.99g: Summary of major changes (gigantic update) ************************************************************************** This was a very big update, sorry for the delay. The changes may cause some inconvenience, and while we can't promise an end to that :-), will try to hold them to a minimum before the "big" 5.0 release. As we get closer, there are some changes we will make in the "now or never" frame of mind, meant to positively affect future versions without causing too much difficulty now. - Document: We have made substantial progress towards converting the (previously LaTeX) document into LaTeXinfo. This gives us the capability to have both a high quality (yes, if you work at it hard enough) printed manual as well as a hypertext-like online document, using info. There are many info readers around but the most famous is the one built into Emacs. Both documents are now available but still need considerable work, and unfortunately are still largely based on information as of the beta plplot4.0 series. Based on the number and importance of the changes since then, we an updated manual is desperately needed! And it is coming...the contents of the doc directory represents work in progress. - configuration, building, and installation: configure has been improved so that it runs more like GNU configure. You can run it from the root directory (although I don't necessarily advise doing so) and use the GNU configure --prefix option for setting the location to install PLplot (more useful). THE DEFAULT INSTALL DIRECTORY PROCEDURE HAS BEEN CHANGED!!!!! Now PLplot by default installs into: prefix-dir/ bin/ lib/ include/ doc/ tcl/ It had to be done before it was too late. Makefile overrides default value of INSTALL_DIR if m4 macro PREFIX is defined. Also check out the script "mklinks". - Tcl-DP driver added! Yes, finally finished, and it works great everywhere but on Crays (sigh -- and I thought I fixed that in the Tcl-DP 3.1 distribution). By using the DP driver you bypass all the difficulties with using Xauth (or the security problems of doing without it) in the TK driver. The Tcl-DP driver is much more usable. It's even distributable -- tested between an HP and a Sun (as server), and between an IBM RS-6000 and HP (as server). Just specify -server_host (and -user if necessary), and it will try to start up a plserver under your user account (need to have .rhost info set appropriately). Great at increasing responsiveness of the GUI, and screen dumps always save to the local machine. - TK interface improvements. The TK interface (using either the TK or DP drivers) has been greatly enhanced. "plserver" can be used exactly like an extended "wish" now (the TK windowing shell). It has been extended to know about "plframe" widgets and how to interact with the PLplot/TK/DP drivers. There are documented interfaces and demos now for building your own extended wish using the plframe widget, as well as an illustration of direct plotting using PLplot from Tcl (through the plframe widget). Color map manipulation tools added for cmap0 and cmap1. Support for user-modifiable keystroke invocation of menu items added. The following are the defaults keymappings as set in pldefaults.tcl, their meaning is clear: global key_zoom_select; set key_zoom_select "z" global key_zoom_reset; set key_zoom_reset "r" global key_print; set key_print "p" global key_save_again; set key_save_again "s" global key_scroll_right; set key_scroll_right "Right" global key_scroll_left; set key_scroll_left "Left" global key_scroll_up; set key_scroll_up "Up" global key_scroll_down; set key_scroll_down "Down" global key_scroll_slow; set key_scroll_slow "3" global key_scroll_fast; set key_scroll_fast "15" global key_scroll_faster; set key_scroll_faster "75" The last three indicate the number of pixels to scroll each time one keystroke is processed. To get the "fast" setting, press Shift-cursor. You get the "faster" setting by using shift-ctrl-cursor. - Area fill support added. Now you can do color (hardware) fills. Only recognized on certain drivers (postscript, all X-based drivers, all Tek4107 devices, and Amiga). Tektronix devices even recognize hardware pattern fills (obtained by a negative fill index). Devices that don't know about hardware fills automatically get a software pattern fill. - Color map usage improved. I have finally implemented the dual cmap0/cmap1 color scheme I have long talked about. cmap0 is typically for fixed colors, like axes, labels, lines, etc. Color 0 of cmap0 should now be the background! It may not always be enforced now but it eventually will be, as well as possible. cmap1 is envisioned as a continuous tone color palette. cmap0 contains the "normal" colors that you set by plcol() (now plcol0() is preferred). cmap1 contains colors set indirectly, by specifying "position in cmap1 space" -- a floating point number from 0 to 1 (previous to that a mapping between position and color must have been specified). This scheme has the advantage that you can take advantage of as many or few colors as the output device supports. For example, with postscript which supports arbitrarily many colors (the printer itself is another story), you can get 256 different colors, because that's as many as I currently provide storage for. On X-windows with 8 plane displays I get a lot less with a shared colormap (custom colormap support is almost done), maybe around 50-100, depending on window manager. And this scheme is even useful on as few as 16 colors, as is commonly available (Tek 4107 emulation is fairly common on the PC, Mac, and Amiga). You do so by limiting the number of colors in cmap0, leaving most for use in cmap1. plshade() function enhanced to work with either color map -- see example program x16c for a demonstration. If at all possible, try to play with x16c using the TK or DP driver -- modifying the color map interactively is simply wonderful. Especially try modifying cmap1, and then loading in the alternate palettes cmap1b.pal and cmap1c.pal (cmap1a.pal is the default), and play with it; you will get a much better idea how it works while I get around to documenting it! - Revamped Tek drivers, added explicit support for: Versaterm (Mac), and VLT (Amiga). [explicit mskermit(DOS) support was added in the last release] Tek4107 driver improved to actually work on a real tek 4107 (thanks to Paul Kirschner). Commands to set color palette now are sent from PLplot. - Postscript output behaves better with ghostview -- it actually backspaces correctly (hey hey, finally). - X driver: lots of changes to support color map1 and custom color maps. Right now does NOT use a custom color map by default since I didn't think it was quite ready for the big time, especially as part of the TK/DP driver. There are some internal settings the adventurous can play with. Function added for capturing mouse events added (thanks to Radey Shouman); this soon should lead to a way of returning world coordinates at the mouse position. - Improved DOS driver support (see Changes.log and the drivers) - All source files handling API: replaced call to plexit() on simple (recoverable) errors with simply printing the error message (via plabort()) and returning. Should help avoid loss of computer time in some critical circumstances (during a long batch run, for example). - behavior of exit handler changed to be more useful for users who want greater control of execution. - plus lots of bug fixes, memory leaks plugged, compilation warnings eliminated, etc. ************************************************************************** Version 4.99g notes distributed by e-mail: ************************************************************************** From: Maurice LeBrun Subject: Some comments on 4.99g To: plplot-list@dino.ph.utexas.edu Date: Fri, 27 May 94 4:32:26 CDT Just some varied comments about this last release. This release (PLplot 4.99g) was very long awaited, and very draining. There have been several new capabilities that I thought were too crucial to wait any longer before adding them, as well as many minor improvements, bug fixes, and user-contributions. There are a lot of energetic users-of and contributers-to PLplot. A bit to my surprise, I might say. (But then, recently when I talked to Sze Tan, the original author, he said the same thing..) No doubt there will be some difficulties encountered with this release. There may have to be a bug fix release before long to fix problems, so please let me know of difficulties. It might help to post them to the mailing list so that other people don't have to experience the same. This is the last big release before 5.0, the rest I hope are relatively minor updates. With 5.0, we aim for (a) most known bugs to be killed, (b) all capabilities we've been working on to be finished, (c) all significant capabilities be documented, and (d) the package tested on all platforms listed as "supported". We are approaching this goal, but are a little ways from it yet. However you may still get your chance to help out :-). More on that later. Some comments on the new capabilities: A big newbie is the Tcl-DP driver. Fixes some of the inherent problems in the TK driver send mechanism, and is distributable across a network. It really works, I've tried it (for some configurations at least). Nothing like zooming in on a plot at workstation speeds when the renderer front-end is running on a machine half the world away (yes, I've even done it between Texas and Japan). Lots of cool improvements to the TK interface. Check out the color palette manipulation tools. Certain menus have keystroke equivalents now (e.g. hit 'z'), making simple operations much nicer (thanks, Dave, for the suggestion). Support for direct usage of the plframe widget as a Tcl/TK extension. This is very important since Tcl/TK, especially when taking all the cool extensions into account, is *THE* way to program X-based applications (IMO). Sophisticated user interfaces to scientific codes under X, using the PLplot widget (among others) are just waiting to be built... Color map 1 support -- this is designed to enable the type of continous color plots you can get in other graphics packages (e.g. I'm thinking of NCSA Ximage) but in a more flexible way, allowing intuitive modification, and display on a number of devices. This capability comes in through the new color palette -- cmap1, and you take a look at x16c to see the effect. Preferably using multiple color (supported) devices, and for the best effect using the TK or DP driver, playing with the color palette using the new menu options. Thanks again to Wesley Ebisuzaki for contributing "plshade()", the function doing the shading here. Note: plshade is the best way for limited number of colors, but for a larger number of colors (and grid points) a different algorithm would be optimal, something that is more discrete. At 0th approximation, you might try a function that just fills each grid cell with a constant color. Suggestions appreciated. Also, the TK driver right now does not proper clip polygons (on zooms), because the algorithm to do so hasn't been implemented. Any interested parties? Work on the updated manual is underway and so far it's looking pretty good... -- Maurice LeBrun mjl@dino.ph.utexas.edu Institute for Fusion Studies, University of Texas at Austin Faire de la bonne cuisine demande un certain temps. Si on vous fait attendre, c'est pour mieux vous servir, et vous plaire. [menu of restaurant Antoine, New Orleans] ************************************************************************** Version 4.99d additional notes ************************************************************************** From: Maurice LeBrun Subject: Some comments about plplot 4.99d. To: plplot-list@dino.ph.utexas.edu Date: Wed, 27 Oct 93 17:08:53 CDT I thought I'd mention a few other things in association with this latest release. There may be a smaller release before long, to address those (hopefully minor) problems that arise. Then I will take a break from plplot development for a short while, and after that my major push will be to update the document, a few more enhancements, and slow down a bit. The TK driver was a tremendous push, but I expect it to be worth it. It has the basic functionality that I've always wanted, along with a huge potential for customization. It is my intention that people can build arbitrary Tcl/TK applications that just happen to use plplot widgets to plot into. I plan to construct at least one demo of how to do such a thing, and it will be interesting to see what kinds of variations people come up with. Tcl/TK programming is so easy that there should be lots (I can't believe I was actually considering doing a Motif-based driver). Writing a widget, on the other hand, is hard work, but now that's more or less history. Also, as I constructed the Tcl/TK driver I tried to add the required increases in functionality to plplot in a rather generic way. The stuff you would ordinarily use a GUI for can typically be handled from the command line in fact -- like page layout, zooms, and orientation (independent of the output driver). This is because of the new driver interface functions that sit between the library proper and the driver. They are located in plcore.c if you are interested, and do 4 transformations so far -- orientation (you can even rotate by a fractional amount, but I never bothered making it come out perfect! :-), altering the window into plot space (zoom), altering the window into device space (page layout, good for adding margins), and global device coordinate transformation (good for making page dumps to an arbitrary device). Other windowing drivers should be able to use these facilities without too much trouble. Eventually I hope to intercept other commands at the interface layer, and decide what to do based on the intelligence of the driver. This might be used to handle device dependent fonts, hardware color fill, and so forth. At this point, I'm feeling the need to release the package in a more "official" way than I have in the past. So my main priority will be to bring the documentation up to sync with the rest of the package. I would also like to accomplish the first 4 or so things on my 'ToDo' list, and as it should involve about 1/10 of the effort of the original TK driver (I hope :-) expect it to happen in a much shorter time frame than the 8 months or so this release has taken. I'll probably introduce some compatibility problems at that time in an effort to consolidate, but after 5.0 will be very careful about breaking old software. In another change, I would like to ask for volunteers to maintain versions of plplot for specific platforms. These people could get prerelease versions in order to make whatever fixes are needed ahead of time. We are most likely to have the package be up-to-date on the following systems: HP-UX, Linux; less likely on the following: SunOS, AIX, Unicos, Super-UX, Amiga, and maybe not at all on any others. It would be good for someone to put in shared library support for any system that supports them (so far I've only done it under HP-UX). I am gradually moving away from supporting the Amiga driver so could use some help here. Geoff has abandoned the DOS drivers and is leaning away from supporting the OS/2 driver, so here again target platform developers are needed. -- Maurice LeBrun mjl@dino.ph.utexas.edu Institute for Fusion Studies, University of Texas at Austin Faire de la bonne cuisine demande un certain temps. Si on vous fait attendre, c'est pour mieux vous servir, et vous plaire. [menu of restaurant Antoine, New Orleans] ************************************************************************** Version 4.99d pre-announcement plus assorted e-mail notes leading up to 4.99d ************************************************************************** Pre-announcement ---------------- As I mentioned in the previous plplot beta update, I have been working on a plplot TCL/TK driver under Unix/X (if you're not running Unix/X you might as well skip this message). Well, I am now far enough along that I can confidently say it will see the light of day before too long, on the order of weeks I hope. It should be really nice, too, and am letting everybody know ahead of time so that you can go get the TCL/TK distribution (if you don't have it already) and start playing with it. TCL is an embeddable interpreter in the spirit of Perl, and TK a Motif-like toolkit. They are free and very high quality; furthermore, constructing the script language & interpreter together with a toolkit appears to be an outrageously useful thing to do. You have to try it to see why. For more info, consult the substantial documentation (and demos) for TCL/TK. I have appended the FAQ to the end of this message. To quickly find the section on how to get TCL/TK and assorted other stuff, search on the string "Tcl/Tk Package Catalog". Moving on, the basic code is done and I am finally getting simple plots out. What I have is the following: User-code | plplot tk driver plserver TCL interpreter <------ tk send ------> interpreter | | data writer ---- named pipe -----> data reader | child X window The user-code and the renderer (tentatively called plserver, I may change this) form a client/server relationship, and are separate processes. Under typical usage, where the user-code starts first, it forks (vfork on systems that support it) and execs the renderer. TCL/TK communication (via X properties) is used between their embedded interpreters to send commands back and forth (note: an extended version of TCL called TCL-DP allows sockets to be used for this, and I will eventually try to extend the model to allow distribution across a network). The existence of an interpreter in each process (actually each plplot stream that uses tk too) allows for a very easy & robust method of sending commands between processes. The data goes through via an alternate channel (fifo for now, maybe socket later) for maximum speed. Also I will support an alternate configuration where the server launches applications, telling them what plplot widget to plot to. Lots of nice possibilities there. By offloading the GUI-building code into a simple script language, it becomes easy to build menus, buttons, scrollbars, etc. All of these will be configurable by the user, as well as the ability to map events (such as button presses) to functions calls in your own program. But you will need to learn TCL/TK to get maximum benefit. Even without additional effort, however, you will be able to use the new driver's menus to do zooming, dump to file, etc. More later.. -- Maurice LeBrun mjl@dino.ph.utexas.edu Institute for Fusion Studies, University of Texas at Austin Faire de la bonne cuisine demande un certain temps. Si on vous fait attendre, c'est pour mieux vous servir, et vous plaire. [menu of restaurant Antoine, New Orleans] From: Maurice J. LeBrun Subject: slowness of the TK driver over the net To: wdn@ctrss2.lanl.gov Date: Thu, 19 Aug 93 11:24:46 CDT Cc: furnish@dino.ph.utexas.edu, gray@dino.ph.utexas.edu, mjl@dino.ph.utexas.edu > Also, I used plrender to render a meta file on dino and display on > ctrss2. One thing that I noticed is that it seems to take much longer for > the plots to be displayed running the tk driver than just the standard X > driver. Do you notice that locally on dino? Also, do you have a good demo > meta file lying around that I could grab and try? I could not get plrender > to go backwards with my meta file using the tk driver and wonder if it is > because the meta file was generated by an ancient version of plplot. > > Dave The current incarnation of the TK driver is going to run a bit slow over a network because of the way messages are passed between the user code and the renderer. In this case plrender is the user code and it forks the actual renderer. The TK send command does IPC by storing messages in an X property of the display. This means that when running over a network, messages must travel from the X client to the X server and then back again. Kind of sick, I know. So for the time being I recommend using the TK driver primarily locally. Eventually I will switch to a scheme where the renderer runs on the display server. I don't think there will be many changes required for this to work. The FIFO becomes a socket, and the TK send is replaced by Tcl-DP's send (which uses sockets). I have to work out how to start the remote renderer. Probably it could try doing a remsh (or rsh on systems that don't have remsh), and if it fails for security or other reasons, tell the user to start the renderer manually using some specified socket for communication. I don't feel like getting into all this now but that's sort of how it will look. -- Maurice LeBrun mjl@dino.ph.utexas.edu Institute for Fusion Studies, University of Texas at Austin Faire de la bonne cuisine demande un certain temps. Si on vous fait attendre, c'est pour mieux vous servir, et vous plaire. [menu of restaurant Antoine, New Orleans] Date: Tue, 7 Sep 93 23:55:50 -0500 From: Maurice J. LeBrun To: furnish@dino.ph.utexas.edu, gray@dino.ph.utexas.edu, mjl@dino.ph.utexas.edu, wdn@dino.ph.utexas.edu Subject: CVS update notice Update of /u/tpc/cvs/plplot/sys/unix In directory dino:/u/mjl/devel/plplot4p99d/sys/unix Modified Files: makefile.m4 Log Message: Now passes in INSTALL_DIR as a string containing the installation directory, typically /usr/local/plplot. Files that get this information include plfont.c (for use in the font search path), plserver.c (for use in the autoload search path), and tk.c (to search for plserver befor the fork/exec). The environmental ${PLPLOT_DIR} is ALWAYS placed before INSTALL_DIR in the search path in each case, so there is ready escape from the tyranny of a hardwired location. From: Maurice J. LeBrun Subject: plplot libraries To: furnish@dino.ph.utexas.edu, gray@dino.ph.utexas.edu, wdn@dino.ph.utexas.edu Date: Fri, 16 Jul 93 23:54:30 CDT Cc: mjl@dino.ph.utexas.edu I finally got around to making a test that I was curious about. I compiled plplot's x01c under a variety of configurations to see the effect on executable size (on disk, stripped). This is all under HP/UX. Xlib (shared) Xlib (archive) TK (archive) size ----------------------------------------------------- no no no 233 KB yes no no 246 KB no yes no 406 KB yes no yes 754 KB no yes yes 918 KB <- getting up there, but still smaller than with Motif :-) As can be seen, the penalty was almost zero when the shared X library was used, and probably the same would occur if the TK library were made shareable. Although this doesn't mean there is no penalty for hooking up with these libraries, it does amount to a big savings in disk space (obviously), and I think even of run-time image if more than one app using these libraries is running (since only one copy needs to be in memory at a time). Unfortunately it's still far from clear what libraries to retain in general. For workstations, I'd say *usually* go with the full Xlib & TK version, although it may be useful to provide libraries that have no X dependence. For Crays it becomes more difficult. Partly because UNICOS has no shared libraries, and the libraries are bigger to boot. But also it isn't clear that the TK driver will even run with acceptable speed, never mind whether running a GUI is appropriate use for a Cray (eventually the TK driver will become distributed and this point will become moot). So on the Cray, it's tempting to provide libraries for use with the Xlib driver only, except that plrender be built with the TK driver as well. Probably I won't decide this until I actually get TCL/TK up on the Crays and get to play with the TK driver out there. If one were to allow for the possibility of building all three libraries it might look like the following: libplplotf.a no Xlib or TK libplplotfX.a Xlib only libplplotftk.a Xlib and TK This would be nice from the user perspective if all sites followed this convention. You would have no problems getting the right one from your makefile regardless of the system. Or you could make a soft-link from whichever one of these you really want to ~/lib/libplplotf.a if you really want to simplify things. But including the double precision versions you get 6 libraries. Double it again for shared library versions. Yes, that's 12 -- and getting ridiculous. Time to backtrack. The system administrator is ultimately the arbiter of what goes on. He supposedly knows what libraries are the best match for his system and user base, and is also ultimately responsible when things go wrong. So, I think the best compromise both gives some consistency to the user across multiple platforms while letting the sysadm tailor the choice of libraries. As I envision it there will always exist at least two libraries -- libplplotf.a and libplplotd.a (actually one of these may be a softlink to the other, such as on Crays where float==double). These are then linked to the libraries that are the best default for the system. This is then: (a) consistent -- the user can use libplplotf.a everywhere he goes with reasonable results. The one minor pain here is that the linkage may be different from site to site, (-lX11 for the X driver, and -ltk -ltcl for the TK driver). So probably a file called libplplotf.doc should exist with libplplotf.a that explains the linkage. (b) flexible -- the system administrator can add as many custom libraries as desired. The users can either link against them explicitly or put a soft-link from the desired library to ~/lib/libplplotf.a. And you can change the system default (say, if you change your mind or many people request it) simply by changing a soft-link (and possibly building a new library version). The makefile will make the system administrator's job easier by adopting the naming scheme mentioned above (something like libplplotfn.a for the library without Xlib or TK, if I bother to support it). The exact name doesn't matter much since you'll be relying on softlinks to set the system defaults, but it's good to be consistent. Probably for now I'll just add the two new libraries libplplotftk.a and libplplotdtk.a on workstations as I had previously planned. The system default libplplotf.a could be made to point to these eventually (on dino, soonest, although I still have to check out the TK driver on Mark's X-terminal). On the Cray, I'll leave the system default as-is until I can check out the TK driver on it. Does this scheme sound reasonable to everyone? -- Maurice LeBrun mjl@dino.ph.utexas.edu Institute for Fusion Studies, University of Texas at Austin Faire de la bonne cuisine demande un certain temps. Si on vous fait attendre, c'est pour mieux vous servir, et vous plaire. [menu of restaurant Antoine, New Orleans] plplot-5.10.0+dfsg/FAQ 644 1750 1750 235616 7430613755 133310ustar andrewandrew This is a rather old FAQ, but start looking for your questions here, anyway. PLplot FAQ (Frequently Asked Questions) --------------------------------------- This note contains answers to some Frequently Asked Questions (FAQ) regarding PLplot. Disclaimer: The questions & answers that follow typically have been posed (and answered) in email, and seem to me to be worthy of inclusion in a FAQ. They may be out of date with respect to the current revision, or be otherwise suspect (misleading, incomplete, etc.), and the original authors of both the question and answer have not been retained (most of the answers come from Maurice, some from Geoff, and the rest from various people on the mailing list). Personal opinions may be contained within: this document is not to be considered the official opinion of the IFS or University of Texas or any other funding agency supporting this work. Feel free to send comments or corrections to mjl@dino.ph.utexas.edu (Maurice LeBrun) or furnish@dino.ph.utexas.edu (Geoff Furnish). The conventions of the CVS FAQ are adopted here. Each question in the table of contents will be given a change marker (for non-trivial changes) in the first column: '-' for a Question that has changed. '=' for an Answer that has changed. '#' for an entry with changes to both Question and Answer. '+' for a newly added Question and Answer. ============================================================================== Contents -------- 1. Building/installing PLplot 2. Philosophy, future directions, broad capabilities, etc. 3. Specific features/capabilities 4. X-based drivers (includes Tcl/TK, Tcl-DP) 5. All other drivers & supported platforms ============================================================================== Section 1: Building/installing PLplot 1.1 How do I build & install PLplot? 1.2 Where do I install PLplot? 1.3 (moved) 1.4 I don't have an ANSI compiliant C compiler. How do I compile PLplot? 1.5 I don't have a fortran compiler; how do I compile PLplot? 1.6 The linker complains of unresolved functions atexit(), fsetpos(), fgetpos(), and so on. 1.7 The compiler complains about the use of "malloc" or "size_t". =1.8 The compiler complains about "caddr_t" in one of the X support files. 1.9 configure script doesn't run correctly 1.10 (removed) 1.11 The linker complains that it can't resolve Tcl_AppInit. +1.12 Can the library place be changed *after* compilation, say, by an environment variable ? +1.13 tcpip.c won't compile. ============================================================================== Section 2: Philosophy, future directions, broad capabilities, etc. 2.1 Why should I use PLplot? +2.2 Could you comment on the pros and cons of plplot and gnuplot? +2.3 How do I use PLplot to do interactive plotting? +2.4 What is RLaB? +2.5 Why should I use Tcl? +2.6 What are some of the planned enhancements to the PLplot interactive capabilities? +2.7 Is there a PLplot newsgroup? ============================================================================== Section 3: Specific features/capabilities 3.1 The manual doesn't mention capability... =3.2 How do I change the default background color? 3.3 I'm getting core dumps when calling a contour function from C. 3.4 Changing the default line width doesn't have any affect. 3.5 How can I generate more than 16 line colors? 3.6 What 2-d array organization am I supposed to use from C? 3.7 On stretched windows, the string characters look bad.. 3.8 I would like to capture key sequences.. -3.9 How to get more information about a function or capability. +3.10 What are the keyboard controls in the graphics window? +3.11 How do I get the value of a PLplot internal variable? +3.12 I'm getting "Unable to delete command .dx.gq1" when I use a matrix. +3.13 My matrix'es are being deleted while in use from itcl. +3.14 I'm getting a "already exists" message when creating a tclMatrix. ============================================================================== Section 4: X-based drivers (includes Tcl/TK, Tcl-DP) =4.1 Where do I get Tcl/TK or Tcl-DP? 4.2 How do I use "xauth"? 4.3 How do I use the Tcl/TK driver? 4.4 I've been having trouble getting the TK/TCL and PLplot working on... 4.5 I would like to issue a plot command, have the window appear,... 4.6 The X driver seems to run slower than on older versions of PLplot. 4.7 How do I change the title on the TK window menu bar, i.e... -4.8 How do I run plserver as a daemon? 4.9 Problems printing from the Tk driver.. 4.10 Problems compiling xwin.c... 4.11 Problems saving files from the Tk driver. +4.12 Why does the Tcl/TK driver use a separate process for rendering but not the X driver? +4.13 How do I create an interactive, widget-based application using PLplot? +4.14 How do I shade between a 4 color range with the Tk driver? ============================================================================== Section 5: All other drivers & supported platforms 5.1 What about support for platform.. =5.2 What about PLplot support for VMS? 5.3 PLplot is aborting with: Error opening plot data storage file. 5.4 Is there a Windows port of PLplot? +5.5 I'd like to develop a windowed interface to PLplot for.. +5.6 What about PLplot support for the Mac? +5.7 What about PLplot support for OS/2? ============================================================================== Section 1: Installing PLplot ============================================================================== 1.1 How do I build & install PLplot? For a Unix-based system, it is usually as easy as typing 'configure', then 'make', then 'make install'. However I strongly recommend that you first read the file INSTALL in the distribution directory. For non-Unix systems, look at the system-dependent notes under sys/. 1.2 Where should I install PLplot? The configure script and Makefile are set up so that you can put the various components of PLplot virtually anywhere. By default, it installs into a directory with the following subdirectories: bin doc examples include info lib tcl On Unix systems I recommend using a directory just for PLplot. Somewhere under /usr/local is a good place. For one, it's not too difficult to get a system administrator to give you ownership of a directory somewhere in the public hierarchy. On a smaller system, giving the package its own directory helps maintain system integrity. The practice of dropping everything into /usr/local/bin, /usr/local/lib and so on (or even worse, /usr/bin, /usr/lib, etc) makes everything simple to install initially but leads to a system that's difficult to organize and maintain. There's the possibility for file name collisions -- stuff that isn't in your search path but needed anyway (readme, doc, and config files). There's no way to cleanly & robustly back out the revision. There's no way to tell where each file in /usr/local/bin (lib, etc) came from. Any sufficiently large/complicated package has this problem. Dedicating a directory tree is a good way to preserve the package's integrity. The only good reason I've heard so far for NOT doing this (apart from laziness when installing) is that people then have to modify their search paths and other settings to use the new package. Therefore, I've written a script that takes care of that. Run doc/mklinks from the install directory, to create softlinks from the install directory into ../bin, ../lib, ../include, and ../man as appropriate. Just as important, you can run it again TO COMPLETELY REMOVE THEM. Thus it becomes trivial to install and back down a revision. All software should work this way. Note, I've written a similar script for Tcl/TK and extensions, called "installtk". A copy is on harbor, but the current version of "mklinks" distributed with PLplot works with BOTH. With this I've brought up and backed out a TK rev on several occasions, and found it immensely useful at the time, which is why I wrote it :-). I think it is the most handy in two cases: 1) when developing using new betas, or 2) in a production environment, where you want to bring up a new package but still have the old one available in case programs break. In the latter case, the only sensible scheme is to have the package in its own directory. Now, if after all that you STILL want to break the package up, just set the appropriate shell variables for the install directories before running configure, in ~/config/cf_plplot.in (see configure notes). That way you can put the docs, examples, and tcl files under e.g. $prefix/plplot, and everything else under $prefix/bin, $prefix/lib, $prefix/include, $prefix/man (imagine $prefix=/usr or $prefix=/usr/local and this will make perfect sense). OK, there are no man pages yet, but there will be one of these days. 1.3 (moved) 1.4 I don't have an ANSI compiliant C compiler. How do I compile PLplot? Get an ANSI C compiler. The cheap solution is to get gcc up if it has been ported to your machine. This is not unreasonable IMHO -- the C standard was approved in 1989. Isn't it about time you upgraded? 1.5 I don't have a fortran compiler; how do I compile PLplot? The Fortran files are only part of the interface layer for Fortran codes that use PLplot. If you don't need this capability the layer can be omitted by running configure with the --disable-f77 flag under Unix. Alternately, you can use 'f2c' (freeware fortran-to-C translator) to compile the layer, assuming it (f2c) has been ported to your system. 1.6 The linker complains of unresolved functions atexit(), fsetpos(), fgetpos(), and so on. This is caused by a non-ANSI libc. It /is/ possible to run PLplot on such a system, but at slightly reduced functionality -- I rely on ANSI libc functions both for seeking (fsetpos, fgetpos) and for cleanup (atexit), but neither is absolutely essential. Currently the configure script should detect this condition automatically and make the necessary defines to avoid any problem. If not, let me know and I will fix it. 1.7 The compiler complains about the use of "malloc" or "size_t". Once upon a time, the source code went to some lengths to make sure these were properly prototyped/typedef'ed even on systems that weren't completely ANSI-compliant. Now the code assumes they are in the usual places: malloc should be declared in stdlib.h size_t should be typedef'ed in stdio.h (sometimes is in stdlib.h also, and sometimes only in stdlib.h. The latter is a violation of the standard but I look for it there too.) Since most of the PLplot source files need something from either stdio.h or stdlib.h, I include them both. If this does not work on your system, there are two things to try. First: fix the headers. You can leave the current definition in place as long as you "wrap" it, e.g.: # ifndef _SIZE_T # define _SIZE_T typedef unsigned int size_t; # endif /* _SIZE_T */ Then add an identical declaration where it is *supposed* to be. The second way is to hack plplot.h to explicitly prototype/typedef it. =1.8 The compiler complains about "caddr_t" in one of the X support files. This is sometimes seen on systems that have X11R4 and claim POSIX conformance but that don't quite have their act together. Typically on old versions of Unicos, Ultrix, and DGUX for example. Currently the configure script determines whether caddr_t is typedef'ed, and if not, typedefs caddr_t appropriately. Note that under POSIX.1, caddr_t is NOT supposed to be set. But because of the various broken headers out there I compensate by typedef'ing it except when it is (illegally) already typedef'ed (note: at least some versions of gcc perform the same "fix"). In any case, it should always work, and if not let me know. 1.9 configure script doesn't run correctly The current configure script should work under even some very old versions of "sh". But in the event of problems, look around for a different shell to run it under (posix shell, ksh, /bin/sh5, etc). Be sure to check that the system name is being set correctly. Your system must have the "uname" program. If not, you can roll your own easily enough -- here's one for HPUX: --cut-here--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here- #!/bin/sh # # File: uname # Usage: uname # # Minimal implementation of the uname command -- no arguments # supported. # echo "HP-UX" --cut-here--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here- Alternately, you can explicitly set "system" either as a shell variable or in the defaults file. 1.10 (removed) 1.11 The linker complains that it can't resolve Tcl_AppInit. The Tcl7.0/TK3.3 and later libraries contain a function called "main". As a result, when linking you don't always get the correct main program. This was done to make it easier to build custom versions of wish, so all you had to do is to create your own version of Tcl_AppInit, link with the library, and POOF! there is your modified wish. Unfortunately it sometimes sends the fortran compiler / linker into spasms, because it gets the wrong main! I have had exactly this problem under a 2-year old version of SunOS (but not under a more recent one), and couldn't get it to work despite varied link invocations. BTW, I hear a similar problem exists under Linux from a C++ main. My solution on these platforms was to recompile the tcl and tk libraries without the file including the main program (I think it was tclMain.o and tkMain.o). I installed the new libraries as well as the separately compiled *Main.o's in case someone needed them. No more problem with the Fortran compiler. Another case where this may come up is using f2c to compile a Fortran main, in which case the true main is in libf2c.a. In this case, putting -lf2c BEFORE -ltk -ltcl on the link line will usually do the trick. +1.12 Can the library place be changed *after* compilation, say, by an environment variable ? The environment variable "PLPLOT_HOME" may be used to override the default installation place such that ${PLPLOT_HOME}/bin is the binaries' location ${PLPLOT_HOME}/lib is the library/fonts location if you only need to override a single value, the environment variables "PLPLOT_BIN" and "PLPLOT_LIB" may be used to individually specify the locations of the binaries and of the library/fonts, respectively. So that in your case, setting PLPLPOT_LIB might be enough. Below is a "cutting" from plctrl.c /*----------------------------------------------------------------------*\ * char *plFindCommand * * Looks for the specified executable file. Search path: * current directory * PLPLOT_HOME_ENV/bin = $(PLPLOT_HOME)/bin * BIN_DIR * * The caller must free the returned pointer (points to malloc'ed memory) * when finished with it. \*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*\ * FILE *plLibOpen(fn) * * Return file pointer to lib file. * Locations checked: * PLPLOT_LIB_ENV = $(PLPLOT_LIB) * current directory * PLPLOT_HOME_ENV/lib = $(PLPLOT_HOME)/lib * LIB_DIR * PLLIBDEV \*----------------------------------------------------------------------*/ +1.13 tcpip.c won't compile. Probably a header file problem. For example, under some versions of Linux, the compile fails with optimization on. The header file stdlib.h is busted. Either fix the header file, turn off optimization, or put -U__OPTIMIZE__ on the compile line (best). ============================================================================== Section 2: Philosophy, future directions, broad capabilities, etc. ============================================================================== 2.1 Why should I use PLplot? This is probably the first question I was ever asked, and it continues to come up often enough to dwell on it a bit. First off, my involvement with PLplot came from a very simple need: a portable, free, reasonable quality scientific graphics package. At the time I had a 1 year fellowship in Japan, to continue my work on numerical simulation of plasmas. Previous to this, I and my colleagues had laboriously translated the simulation code graphics to use two other libraries (one quasi-commercial and one PD), only to find both packages lacking in some important respects (most notably the PD one) and unable to easily (or cheaply) obtain the commercial one where I was working in Japan. This was an extremely frustrating situation, which had always been apparent to me but only then came to a head. Scientific graphics is an utter necessity to anyone doing numerical modelling, and I decided that being at the mercy of vendors and computer centers on this issue was unacceptable. I have no objection to commercial software, but let's face it.. sometimes commercial solutions suck. This is one of those times. You don't have access to the source code, so you can't improve it to suit your needs better, and you certainly can't freely carry it to different machines. Software environments on high-performance Unix systems, especially as regards commercial software, are VERY variable from machine to machine. Regardless of why this situation exists, I decided I could no longer depend on commercial software to provide a basic graphics capability. I was somewhat familiar with PLplot for the Amiga, and seeing that it was fairly capable and portable I decided this would be the "last" graphics package I would use and support (for a long while at least). It turned out that PLplot required some substantial investment of my time before it satisfied all of my (then) needs, but has nonetheless performed quite well. In the interim I took over development for it from Tony Richardson. The package has become almost trivially portable -- we can now get our codes running on a new machine in record time. We can fix bugs in record time, although it doesn't always happen that way :-). Still, it takes less than a month or two for me to get around to fixing most bugs, which is better turnaround time than you typically get from vendors. New features can be added with astonishing speed if the need (ours) is great enough. So those are some of the reasons /I/ got involved, which may differ from those of the casual user. Most people won't be digging into the source code to fix bugs, although it's very reassuring to know that you can if you need to. I can't promise quick bug fixes or specific enhancements as my responsibilities (i.e. funding) lie elsewhere. But I am always interested to hear what people want, since if it's a good idea I will benefit too. User-contributed code is always welcomed (there has been quite a bit). And backward incompatibilities will be introduced into the package sparingly if at all. The features supported by PLplot are necessarily fewer in number than a big commercial package. PLplot has a fairly complete set of basic graphical capabilities, and a few very strong capabilities (e.g. the Tcl/TK "plframe" plotting widget, and the GUI drivers built around it). This has its good and bad points. The good part is that the library is relatively small, and can be modified without too much difficulty. The disk space required is reasonable (especially if shared libraries are used), and the learning curve mild. The effort I might expend adhering to some large set of capabilities (many of which may be only rarely used; e.g. look at the GKS standard) can be focused instead on portability, user interface, and certain select capabilities that I and my colleagues find important. On the other hand, there are many nice capabilities missing from PLplot at present, such as support for solid 3d modelling or postscript fonts, just to name two. New features are continually being added, but the fact remains that other more special purpose (and/or high priced) products will always have things that PLplot lacks (or do them better). One way I see to fit PLplot in the overall software environment is to add more output drivers, both for generic file formats (e.g. GIF, CGM) as well as for specific high-end graphics packages (e.g. AVS). That way you could produce your graphics and view them using PLplot, dumping to disk those pages or plots you want to process using a separate package. This can already be done using the XFig driver, for example. For maximum effectiveness of this scheme, PLplot should have internal knowlege of more varied objects than "line" (currently the fundamental unit), and I have some plans in this area. I'm always interested in gaining new collaborators and contributors for PLplot, so feel free to send me email (mjl@dino.ph.utexas.edu) so we can discuss additions you'd like to make. Want to help support PLplot but need suggestions? I hesitate to recommend anything that will require broad changes to the package, but any of the following would be great: volunteers for target platform support (I have HPUX covered) output drivers: GIF, CGM, others? PLplot demos? (especially using Tcl/TK) an improved contour plotter any interesting ideas/code for TK widgets for use with PLplot anything from the ToDo list you'd like to tackle? help rewriting the manual? (OK, so I'm really reaching here) +2.2 Could you comment on the pros and cons of plplot and gnuplot? They came from a different set of objectives initially. PLplot started out primarily as a library and gnuplot as an interactive tool. At one time gnuplot acquired some library-like capabilities but these were never merged back into the master sources, and are quite out of date by now (I hear). PLplot is becoming more interactive. Eventually I think PLplot will surpass gnuplot even for interactive plots for the following reasons: (a) it will have full access to the underlying plot library, which is more varied than gnuplot (with good support for contour, surface, 3d plots, etc). (b) the scripting language I use for it is Tcl (note: there are others too, see questions 2.3, 2.4). Tcl has a large following and is fairly well thought out, rather than a home-grown language. (c) the most advanced driver is based on Tk, an X-windows tool kit, and both (Tk and the PLplot capabilities based on it) are very powerful. Unfortunately as it stands, (a) is not true yet, and the documentation that describes all the current features is not done either. This will be rectified by the time I release 5.0. +2.3 How do I use PLplot to do interactive plotting? > I am planning to use PLPLOT to plot some 2D pictures about software bug > generation rate, bug correction rate, and etc. Using gnuplot I could put > the X-Y data pairs in a file then use the 'plot' function. Is there a > similar idiom in PLPLOT? Such a thing is easily constructed in Tcl. I never bothered cooking up a demo because it was too easy :-). But now I have one (~30 minutes of work, modelled after elements of x01.tcl) -- it is included in the distribution as examples/tcl/plot.tcl. To test it, type: % pltcl pltcl> source plot.tcl pltcl> plot foo.dat from the examples/tcl directory. As you can see, it is quite easy to use Tcl for things like this and it's almost not worth it to construct huge mega-commands like GNUPLOT's "plot" command, since the user can now write Tcl procs to do exactly what is needed (i.e. without inventing a new API). Therefore, I doubt I'll improve plot.tcl to be more like the GNUPLOT call, although if someone does write such a beast and wants to share it, that's great. The main disadvantage of using pltcl for such things is that I don't often use it, and am therefore slow to improve it. It needs more work on the 2-d API (for contour, surface, and shade plots), better access to internal variables, and so on. Also, there are alternatives. Currently Ian Searle's RLaB and my pltcl are the two best supported interpreter front-ends to PLplot. Radey Shouman wrote a Scheme (SCM) interface which may appear publicly before long. John Interrante wrote a python interface which I am integrating with the main sources. And at one time there was a PLplot-based interpreter on the Amiga that used Rexx as its script language (maybe OS/2 users would be interested in this too, but unfortunately it's way out of date now). +2.4 What is RLaB? RLaB is an interpreted/interactive matrix programming language which uses Plplot. RLaB has implemented most of the Plplot API so that users can interactively visualize data. Additionally there is a higher level abstraction of the Plplot capabilities that allows users to do things like: x = readm("mydata"); plot(x); or x = readm("mydata"); X = fft(x); plaxis("log", "log"); plot(abs(X)); RLaB is geared towards scientific/engineering usage, but could also be quite useful for other types of data. RLaB is a "High Level Language" with matrices (2-d arrays) as a fundamental object. Thus: b = A*x; where b is (Mx1), A is (MxN), x is (Nx1) works as expected. RLaB includes a host of builtin linear-algebra, an spectral functions, taking advantage of LAPACK, BLAS, and FFTPACK. Although RLaB may be more than the original poster wants, I think it is at least worth a mention. +2.5 Why should I use Tcl? > I've recently seen an article on the net (comp.lang.tcl:19017) > > Title: Why you should not use Tcl > Author: Richard Stallman, GNU Project. > > In which a case was made to avoid a "scripting language" such as Tcl in > favour of a language that is more easily extended. > ... > If indeed Richard Stallman knows what he is talking about, then is Tcl > really the best way to extend PLplot? (here I break from my usual convention and attribute responses) Geoff's response: Since you saw this post by RMS on c.l.t, I'm sure you also saw the extremely severe flame fest which ensued. I think it would be good to avoid repeating that on this channel, so let me refer interested parties to the newsgroup for all the gory details. But since you are clearly trying to probe what our thinking on these issues is, I will provide at least a restrained response. Perhaps Maurice can do the same: I have to say first that I have a great deal of personal respect for the FSF and it's accomplishments, though I am less impressed by it's stated aims. Nevertheless, I use GNU tools daily, especially but not limited to GCC, and have even hacked GCC some myself. PLplot is now distributed under the LGPL. etc. However, in this case, the informed mind has to conclude, that Richard Stallman spoke out of turn. It is most unfortunate that he used his position of influence in the free software community to cast such a spectre of FUD and inanity on Tcl/Tk. Certainly on technical merit, his post was vacuous. > Opinions on how PLplot should proceed? I think Maurice and I are both squarely in the camp of: "Let each man choose his own tools" and we have chosen ours :-). If others want to go with Scheme (or Python, or WINTERP, or whatever), that's fine by us, and we are willing to help integrate and incorporate such user-contributed modifications into the distribution. In point of fact, there already is a Scheme port of PLplot, done by another fellow in Austin, and we are working with him to increase the visibility of his work. As for PLplot and Tcl/Tk. I do think there is an issue with Tcl regarding the construction of large script systems. Tcl provides very poor support for "large" software, whatever that means to a given person. That is precisely why I recommend ALWAYS using the [incr Tcl] extension, which provides to Tcl exactly the same sorts of things that C++ provides to C. Not everyone is sold on object oriented programming of course. Maurice, for instance, is still basically comfortable with developing the PLplot library in C and writing the Tcl parts of the Tcl/Tk and DP drivers in plain Tcl. I on the other hand, write new code in C++ if at all possible rather than C, and in [incr Tcl] rather than plain Tcl. Although it is not so easy for all C users to switch to C++ (cost and availability of compilers being the main issue here), it is clearly no big deal for people who use Tcl to also use [incr Tcl] (since it is free, and just as portable as Tcl itself). Maurice and I have been having a long standing dialogue about whether to make [incr Tcl] a required addition to Tcl for PLplot. Many parts of the PLplot Tk interaction could be provided in a more robust, more customizeable, and most importantly more extensible fashion if they were done in [incr Tcl]. Certainly all the contributions I am making are being done in itcl, Maurice is still making up his mind on that one. In any event, there is certainly no reason why PLplot cannot be bound to other scripting environments, and Maurice and I do not wish to in any way discourage others from doing exactly that. The PLplot Tcl bindings can serve as a point of reference for interested parties, and so can the Scheme port. The motto in our office is: "Go wild!" So if you've got an idea that involves something radically different from Tcl/Tk/[incr Tcl], we say, "great, go wild!" Send us the diffs. Maurice's response: This post of RMS's inspired a truly awesome flamefest on the newsgroups specified on the Followup-to: line, which were comp.lang.tcl, gnu.misc.discuss, and comp.lang.scheme. This whole thing would have been avoided if RMS had more net experience. Those of us who have spent considerable time on the net know better than to get on some language group and essentially say "your language sucks", or to get on a computer group and say "your computer sucks". Usually, there are many fine points involved which the poster, no matter how well educated, simply doesn't have a clue. This is one of those cases. Tcl is not the perfect extension language. I'm not sure that Scheme is either. Does it matter? And Tcl *can* be improved further. E.g. Geoff mentioned [incr tcl], an OO Tcl extension. I am currently flirting with the idea of requiring it for the PLplot Tcl-TK part in some future revision, after some reasonable period of supporting the old code. Since [incr tcl] supports vanilla Tcl as well, the only real drawback is that yet another package is required to be present, but this isn't that big a deal. Tcl is very popular and getting more so. It's easy to use and easily embeddable in a C or C++ application. There is one book out on Tcl/TK programming (JO's) and at least one more in the works. Plus it has copious online documentation. Finally, Tcl *has* been ported to non-Unix systems. Although it would help if JO directly supported this effort. Looking at the new contrib site (ftp.aud.alcatel.com) I see ports to MSDOS, the Mac, and VMS, and I know of an old port to the Amiga as well. This note just scratches the surface. Basically, I predict a bright future for Tcl, and plan to use/support it with PLplot for a long time to come. +2.6 What are some of the planned enhancements to the PLplot interactive capabilities? By mirroring the C api in Tcl, it is becoming possible to rapidly prototype data interaction programs, coded entirely as Tcl scripts, generating PLplot output through Tcl commands. There are some demos of this, but much much more can be done. It would be really nice to have someone contribute Tcl code which went farther in this direction. With a small amount of Tcl programming, it is easy to imagine very powerful interactive data analysis capabilities. Especially if these were provided as itcl classes, it would then be possible to provide data analysis modules in Tcl/Plplot which could then be "popped" into a code as easily as using the Tcl autoload on demand mechanism. Example itcl classes could be things like: 1-d histogram utility reads data from specified file, puts up some buttons to allow generation of histograms with various different options Financial analyst reads data from a file, produces various sorts of bar and pie charts. Linear regression analyzer reads data from a file, performs least square and other forms of regression, calls histogram utility (above) to generate graphs. FFT analysis package reaads 1 or 2 d data from a file, performs transforms, plots spectral data in 1 or 2 d. Volumetric data slicer reads 2 or 3 d data from file, presents plshaded contours with scale widgets for selection of cut planes, isosurfaces, etc. Functional calculator/explorer provides entries for a mathematical expression, min and max domain values, and plots the equation. Provides buttons for performing integration, (numerical) differentiation, fourier analysis (coupled to the above mentioned package), spline fitting, root finding, etc. Some of these ideas will require the 2-d Tcl api, which is still being worked on, but which is definitely coming. We (Maurice and I) cannot hope to address all these issues ourselves, as we have other work to do. We would very much like to see user contributed code in these areas. I can provide direction to anyone who is interested enough to seriously explore these issues. Basically I would recommend getting itcl, and working through the "tkdemos", making sure you understand the "embedded plframe" concept (discussed in the new chapter of the manual), etc, as a great start. From there, the plan would be to construct families of itcl classes embodying packages of widgets (megawidgets in Tk parlance) which perform the above sorts of tasks, or any others of your invention. The potential is great, and the current demos only hint at what is possible. We long to make PLplot the premiere scientific plotting and data analysis package, but there is only so much work we can do in so much time. There are tremendous opportunites for enterprising souls to make great contributions in these areas. This would be fabulous material for undergraduate semester projects in CS/math/engineering computer-lab type classes, if there are any professors on this list :-). Anyone who is interested in working in this sort of area is welcome to contact me for further elaboration. +2.7 Is there a PLplot newsgroup? > I think one way to achieve better support/development of the PLPlot > package would be to create a newsgroup to give such requests as the above > a wider audience. Maybe something like comp.grahpics.PLPLOT? > > This could also be the place to ask questions like "How do I do this..." > or "I have a problem doing this, can anyone help me?". > Apart from that it could alleviate the pressure of supporting PLPlot by > the primary developers (GF & MJL) so that they can spend more time > actually doing new development. A newsgroup comp.graphics.plplot would be fine with me. In fact, I've long expected that one day it would happen. Unfortunately I know nothing about starting a newsgroup, and also I'd want to relay it with the mailing list, which again I know nothing about. I sort of wanted to get the 5.0 release off before that step, with the implied finishing of the documentation :-). But sooner would be OK. If anyone wants to start the ball rolling on this, let me know. A positive note: as of May 1995 the mailing list has been converted to use Majordomo, which is a significant enhancement. Users can now subscribe or unsubscribe themselves (leaving me with more time for real work), see who else is on the list, and retrieve the README, FAQ, and mailing list archive by email. Just send the message 'help' (in the body of the message, not the subject) to plplot-request@dino.ph.utexas.edu for a full list of the things you can do. ============================================================================== Section 3: Specific features/capabilities ============================================================================== 3.1 The manual doesn't mention capability.. The manual is waaay out of date. Consult the last few update files to keep tabs of what's going on. Take a look if there are are any substantial new capabilities in the example programs. We went wild on the manual a while back, rewriting it in LaTeXinfo so that we could publish it in info file form. That info file is available in the doc directory, but unfortunately (a) it still needs some polish and (b) it is still waaay out of date. The next big push will see the end of it. =3.2 How do I change the default background color? Use the -bg option, or set by the plscolbg() API call. In general it is safest to make all settings that may affect the driver (pen width, color, etc) directly before the driver is initialized, i.e. before calling plinit. It turns out that the Xwin driver has a firm concept of the background color, and changing it on the fly isn't hard. Postscript (level 1), however, does not have the concept of background color. So to get a specific background color, a rectangle covering the background must be drawn and then filled using the appropriate color. Anything previously drawn is obliterated. So clearly, changing the background color should at least have no effect until the next bop, and in the 4.99i (and before) ps driver, only the initial setting is honored. From 4.99j and later, the driver can get the background color right on the next bop. Still, to get the correct color starting from page 1 you need to set it before calling plinit, because plinit does a bop. Note that in 4.99i and before, the background color fill in the ps driver was always done, independent of the color. This is unnecessary and even bad in some cases, if the background is just white. E.g. when generating color ps output as EPSF input to a document, a background fill causes the figure to overwrite parts of the page that you probably want to keep. 3.3 I'm getting core dumps when calling a contour function from C. Aha. Did you specify the minimum index as 1, not 0? This is a leftover from when the package was written in Fortran, sigh. I'm not sure why this isn't explained in the manual -- I just looked and there is no mention of it. When I first got involved I mainly learned how to use the package from the demo programs and so didn't really notice the inconsistency. I've added some more explanatory error messages and will improve the document in this area. Unfortunately it may be too late I think to change the minimum index to 0, since by now many people are used to this way. Maybe add some new function calls to fix up the API.. 3.4 Changing the default line width doesn't have any effect. Not all drivers support multiple line widths, in particular, pixel-oriented ones such as all the Tek drivers. Further, it may not even mean the same thing from driver to driver. If this ever becomes a serious enough inconvenience I may take a harder look at it. One problem is that display devices typically don't have the resolution for resolving the difference between different line widths. For example, you can output a plot using different line widths to a postscript file, and the lines don't appear any visibly thicker until you hit 5 or so (so 1-4 look the same, same for 5-8, and 9-10, or something like that). The only real way to see the difference is to print it. Another problem is that there may be no device support for multiple line widths. In this case you can mock it up by drawing lines multiple times (very close together), but this is a real pain. The driver does initialize the width to something reasonable, but only if the user hasn't already set it (i.e. it is zero). The postscript driver uses a line width of 3 as a default, since this produces pretty good results. =3.5 How can I generate more than 16 line colors? Two ways. 1. You can increase the number of colors in cmap0 with the -ncol0 option. 2. You can use cmap1 to do it, via plcol1(). Each color will be interpolated along a piecewise linear curve in HLS space. This gives an arbitrarily smooth color variation (for some drivers) with cmap1 index (in range 0. to 1.). 3.6 What 2-d array organization am I supposed to use from C? The 2d array organization has an interesting history. Back in plplot 2.6b all the C API functions that took 2d arrays used column dominant contiguous storage, while the corresponding Fortran API functions used row dominant contiguous storage (naturally). The latter allocated temporary arrays and performed a transpose before calling the C API. With plplot 3.0 Tony Richardson changed the C API to use arrays-of-arrays of pointers to increase performance on some platforms. Unfortunately on high end platforms (vector machines or superscalar RISC workstations) performance can actually be worse as a result -- slowdowns due to memory access can be much worse than doing extra computation. As a result the situation re: 2d array organization in C became somewhat confusing -- now there was a /third/ type of array organization, or /four/ if you want to count "normal" C array-of-pointers organization. So I decided, years ago, that I wanted to have a general way of specifying array organization to be used by the 2d function API, with front-end routines used for converting from popular techniques. But as it isn't so glamorous a pursuit, I've been slow to get it finished. :-\ The key idea is that for each major capability, there should exist a core function that takes the array in a totally arbitrary way -- as a function evaluator and its data. This can be used directly if desired -- for example by a C++ user with his own matrix class. However I also will provide front-end C API calls to handle the various popular 2d array organizations. These front-ends merely pass in the appropriate function evaluator to the core routine, passing the user's array as data. This results in calls like plfcont(), which is the core routine, and plcont1(), plcont2(), etc, which are the front-end routines. The core routine can do one of two things: it can either use function evaluations in place of the 2d array lookups in its computations, or create a temporary array in some standard internal format for its computations. Both have their merits. On low-end machines, the function evaluator approach is better (since there is little loss of pipelining and no temporary memory hit), while on high-end machines the reverse is true. On the other hand, on high-end machines the odds are better that you are spending most of the CPU time on things other than graphics, and efficiency is less important. So I tend toward using the function evaluator where it is convenient. In the contour plotter the function acceses are clear and it was easy to substitute a function evaluator. In plshade, however, the code is a bit too involved for this to be done easily so instead I've gone the temporary array route. Either way, as long as the API is put in place and documented, I can always go back and change things around internally later on. My intentions right now is to give this a good look very soon, so that if I need to break the C API to make it more consistent, it happens before I release 5.0. 3.7 On stretched windows, the string characters look bad.. > - If I make a window of say y=100 and x=1000 the character are rather > stretched. Is there a way to avoid this. I haven't had the need for it and am barely familiar with how to do it. The best way to fix it won't happen until I support actual text by the driver, which is a long ways off yet. But I think you can specify physical dimensions of your output device using plspage(). In fact, plspage() is called by the argument parser for the -geometry flag, but the options specifying physical dimensions -- xpmm and ypmm -- aren't filled in. I can put changing this on my todo list. But if it works, it will only work as long as the window isn't resized. Eventually, the driver and internal page representation will be intelligent enough to support page resizing without changing the aspect ratios of certain objects such as characters, strings, fixed aspect viewports, etc. But like I said, it's a way off. =3.8 I would like to capture key sequences.. > Also, I would like to be able to capture the PF2 and PF4 keys. My > application consistently uses these keys for particular responses. If > I can catch them, the application can take appropriate action. You can catch these now from C by installing a keyboard event handler, via the function: /* Set the function pointer for the keyboard event handler */ void plsKeyEH(void (*KeyEH) (PLGraphicsIn *, void *, int *), void *KeyEH_data); You can look at the code in plrender as an example. It uses a keyboard event handler in order to detect & act on page seeking commands. It would be possible to mock something up for Fortran too if needed. There is no problem with doing this from X since only a single key code is transmitted, but an xterm sends an escape sequence. Your event handler would be called for each key code which makes recognition a bit harder but still doable (if in an xterm). -3.9 How to get more information about a function or capability. > I would like to be able to take advantage of the new routines that came > with 4.99g, but to do this I need to know the argument list that is > supplied to each one - the additional docs that came with 4.99g are very > sketchy on this. > > I would particularly like to use plscmap1l, which I have had trouble > with, also the following which are not explained: > > * plwarn plexit plcol0 plcol1 plrgb plrgb1 plscolbg plscol0 plgcol0 > * plscmap1 plscmap1f1 plscolor > > Any details would be gratefully received. Well for me to really explain would be basically the same as finishing the docs, which I don't have time for right now. I suggest looking at the example programs and especially the source. Now, I know that might not sound like fun, but some of the source code is a fairly easy read. Look in "plplot.h" -- each function has a prototype that lists arguments and has a one-line description. The description is usually an abbreviated version of the comments written with the function itself. If you are an emacs user, browsing the source code is very easy with 'tags'. From the tmp directory, type 'etags *.c'. Then edit plplot.h, move the cursor to the name of the function you are interested in, and type ESC-. , you are there. Happy hunting. p.s. Some of the new capabilities are illustrated in C example programs but not Fortran, e.g. see x15c and x16c. x17c isn't working yet. +3.10 What are the keyboard controls in the graphics window? > Can you give me a pointer as to the other keyboard controls that are > in effect in such a window? Is it in the docs/sources? > I've noticed that Q quits the window(?) It depends on the driver to some extent. Here are the recognized keys for the xwin and tk/dp drivers (tek is similar): case PLK_Return: case PLK_Linefeed: case PLK_Next: /* Advance to next page (i.e. terminate event loop) on a */ /* Check for both and for portability, also a */ case 'Q': /* Terminate on a 'Q' (not 'q', since it's too easy to hit by mistake) */ case 'L': /* Begin locate mode */ You can intercept these by writing a keyboard event handler, if you want to do various user-related things with it. Using plfill() to do erasures, one could even imagine writing an editing capability. A graphical vi clone, anyone? :-) "plrender" installs its own keyboard event handler to add some more keystrokes: * Keyboard event handler. For mapping keyboard sequences to commands * not usually supported by PLplot, such as seeking around in the * metafile. Recognized commands: * * | * | Back page * | * * + Seek forward pages. * - Seek backward pages. * * Seek to page . * -- Seek to pages before EOF. * * Both and are recognized for a back-page since the target * system may use either as its erase key. is present on some * keyboards (different from keypad key). * * No user data is passed in this case, although a test case is * illustrated. * * Illegal input is ignored. > How do you make your user aware of this? Does anyone have an example > of a userinterface that tells the user about this? I've thought about having the driver spit out a list of recognized keystrokes to stdout if the user types "?" but never felt strongly enough about doing so. The Tk driver has a help entry that mentions most of the recognized keystrokes. And you can always look at the source. Eventually this stuff will be covered in the manual. Also note, the Tk driver has some more sophisticated keyboard controls, some of which are activated depending on mode. In normal operation, 'z' causes a zoom, 'r' causes a zoom reset, 'P' causes a print, and 's' causes a 'save again'. These are set in pldefaults.tcl and can be customized on a per user basis (read the instructions in pldefaults.tcl on how to do it). When in locate mode, the cursor keys move the graphics cursor. When in zoom mode (and not locate), the cursor keys cause the view to scroll. Adding modifier keys (CTRL, ALT, SHIFT, etc) causes a 5x speedup for each modifier added. +3.11 How do I get the value of a PLplot internal variable? > Can anyone tell me if there is a yet-to-be-documented PLPLOT > function which returns the name or code of the output device associated > with the current output stream (for PLPLOT-generated graphics)? If there's no API call to do it, it's still easy to do from C or C++. You just include plstrm.h and get the stream pointer using either: extern PLStream *plsc; or PLStream *plsc; plgpls(&plsc); Then the device name is accessed by plsc->DevName. If you are using fortran or Tcl or whatever then you are stuck. Consider writing a small C function to do the job. Note: an API call is always safest. If you feel strongly that it's something that should be in the API, let me know. +3.12 I'm getting "Unable to delete command .dx.gq1" when I use a tclMatrix. > Whenever I use the tcl matrix facility you wrote from itcl, I always > get these annoying > > Unable to delete command .dx.gq1 Yeah. I continued to look into this after you left. > Seems you set a local variable when the matrix is created. Then > when the local variable goes out of scope, it is unset, which trigger > a trace, so you try to delete the command, but can't, so the message > is printed. Right. It turns out that a /different/ interpreter is trying to do the unset. Really strange, eh? I don't know what magic itcl is doing here, and don't really care to dig any further, because I can fix it so that the variable and matrix is deleted according to the original plan by just storing the original interpreter pointer in the tcl Matrix struct. (done in 4.99j) +3.13 My tclMatrix'es are being deleted while in use from itcl. There's a lot of places in Tcl/Tk where a proc puts up some combination of widgets with action bindings and then returns. The parent may then return or wait for the window to be deleted. My 'Form2d' proc for example does this, but I wait for it to be destroyed before proceeding so I can be sure the input is available and act on it. I.e.: Form2d .e "Enter window coordinates for zoom. Each coordinate should range from 0 to 1, with (0,0) corresponding to the lower left hand corner." tkwait window .e I communicate with the Form2d using global variables, which may be the only way, since the proc goes out of scope before any user input is made! Not to mention that the parent may go out of scope as well. So in 4.99j I added a way to make global, i.e. persistent tcl Matrices. Just add the -persist flag on its creation, remembering to explicitly delete the tclMatrix (using " delete") when you're done. I may add 'use' and 'free' matrix commands to handle reference counting and deletion in the next rev. +3.14 I'm getting a "already exists" message when creating a tclMatrix. A "matrix" declaration creates a command that processes all matrix commands. Commands are always at global scope, unfortunately. The local variable that is set is only for GC purposes. So there is no local scope for a Tcl Matrix, just automatic GC (unless you use -persist). ============================================================================== Section 4: X-based drivers (includes Tcl/TK, Tcl-DP) ============================================================================== =4.1 Where do I get Tcl/TK or Tcl-DP? The best way is by anonymous ftp. The main distribution site for Tcl/TK is ftp.cs.berkeley.edu in /ucb/tcl, and the main archive site (home of all user-contributed extensions as well as a mirror of the main site) is ftp.aud.alcatel.com in /tcl. Also consult with the comp.lang.tcl newsgroup on Usenet. Tcl-DP can be obtained by anonymous ftp from mm-ftp.cs.berkeley.edu in pub/multimedia/Tcl-DP, and is highly recommended. At the time of this writing, the versions that are fairly certain to work with PLplot are: tcl7.3 tk3.6 tcl-dp3.1 tcl-dp3.2 Earlier versions may be iffy. PLplot does NOT yet work with tk4.0 (in beta as I write this). Note: the Tcl/TK, Tcl-DP header files should be found automatically by the configure script if they are in a relatively predictable location. Many locations are checked; see cf/sysloc.in for more info. If they aren't found on your system, consider: (a) moving them, (b) making softlinks to one of the searched-for locations, (c) if you REALLY think your location should be searched for automatically, feel free to ask me to change it. 4.2 How do I use "xauth"? The 7.0/3.3 and later releases of Tcl/TK require xauth security in order to accept send requests. The only problem is that you have to *completely* eliminate use of the older xhost method. So typing "xhost -" isn't good enough -- you must also explicitly delete all the names from the xhost access list (type just "xhost" to see them). That should do it for your local node. To grant remote nodes access, just ftp your ~/.Xauthority file (server machine) to your remote home directory. There are some notes on setting this up in the file Xauthority in the doc directory. I know from experience that setting up and using xauth security can be a major pain in the neck. For example, a site that's basically secure can be configured by the system manager to enable xhost access to all local nodes automatically through the /etc/X0.hosts file. At such sites the users are unaccustomed to explicitly granting permission and on a secure group of machines there's no real security risk. HOWEVER, a user may need to occasionally access an "outside" machine, and since you can't mix xhost and xauth, you are hosed. And compiling TK without xauth security is a gargantuan, tremendous security hazard. A sickeningly vile, disgusting mess. Therefore I recommend that if you have any concerns about security or problems with TK send, and ESPECIALLY if you are running from some remote host, just forget about the TK driver altogether and use the DP driver instead. The DP driver uses a much superior method of communication (sockets rather than X properties) and is distributable to boot. It does have a slightly longer startup time. If you are running on a machine off the network (where maybe you don't have a full TCP/IP implementation) the TK driver is fine. The DP driver only allows open connects between the time it takes to launch the server and they do their initial handshaking, a hole that I view as impossible to take advantage of. 4.3 How do I use the Tcl/TK driver? Get it going with the example programs, and play with it. Read the online docs. 4.4 I've been having trouble getting the TK/TCL and PLplot working on my Indigo running IRIX 4.0.5. I got TCL7.0 and TK3.3 as advised and built the libraries and moved them to "/usr/lib" directory and then went about (re)building PLplot. I then compiled the c-demos and ran them. The tk driver would pop up a window and disappear with the following complaints... ... >>Starting up ./plserver >>Server command "[list $plw_init $plwindow $client]" failed: >> remote interpreter did not respond >>Program aborted I think what is happening is that plserver is dumping core for some reason. So why don't you get a "core dumped" message? It has something to do with it being created through fork/exec from the TK driver. Never quite knew what, but now that I am thinking about it once again I bet I know what the deal is. It takes a little bit of time for it to dump core, and in that time the sending interpreter in the TK driver times out, and aborts. Since the application is the parent process, once it exits you don't see any pending messages that the plserver (child) has. In this circumstance I'm not sure if one should always get a core file or not. So, the key is to find out why plserver is dumping core. There are a few things you can do. When you built Tcl/TK, did you run the tests? You need to type "make test" in either the tk3.3 or tcl7.0 directory, and it will merrily go on its way. After you have done that, try cd'ing to the tk3.3/tests directory and running the tests using your installed version of wish. Some of the tests will fail because "make test" actually compiles a custom version of wish with some extra functionality just for the test suite. But most of the tests will do ok. If not, you hosed the installation and that would explain the observed behavior. If not we need to do some more hunting. Here are some more things to try: define DEBUG at the head of the files: plserver.c (will give you information at startup) tk.c (this does the launching of plserver) This should tell you at the very least if plserver is getting started correctly. In addition, to get a whole LOT of output about the current state of the code, you can define also DEBUG_ENTER in: plserver.c tk.c and even: plframe.c (also define DEBUG here, but be ready for lots of output) The resulting messages often prove useful. 4.5 I would like to issue a plot command, have the window appear, or be re-painted, and allow the user to continue with command line operation of RLaB. I would like the user to be able to resize the window at any time or cover/un-cover it at any time and have it re-paint itself. The way I can get it to work is: the user issues plot command, window appears and is resizable, etc... the user must use the 3rd mouse button to "release" the window, after that control returns to the command line, but the window will no longer resize/repaint. This is a feature, not a bug :-). When the plotting package is waiting for the user to advance the page, it is actually waiting for any X event. So events like refresh and resize get intercepted and processed. Also during the normal course of plotting, the X server is periodically polled to find out if there are any events that need processing, and handles them if so. I don't do this on every graphics instruction because otherwise the overhead is too large -- currently on every 20 line draws, every 10 polyline draws, and on every other call. But once the user signals for the page advance, and control is returned to the user program, there is no way for the X driver to process any events simply because the control is in your program, not in the X driver. The single-headedness of your process becomes the culprit here. You can either sit in an event loop, or be doing user code specific things, but not both. If you want to periodically tell the driver to handle pending events, there is an escape function call for that, but it's really just a bandaid solution. The best solution is to fork off the rendering into a separate process, and this is just what I did with the Tcl/TK driver. So, if you select the tk driver, your code can go about its merry way while the graphics window can be refreshed, resized, zoomed, printed, dumped, or whatever. It'd also be a worthwhile project to split the X driver similarly, and there has been some interest in doing that (but I don't plan to work on it). 4.6 The X driver seems to run slower than on older versions of PLplot. This may be caused by writing into the pixmap. Each instruction is essentially done twice -- once to the screen and once to the offscreen pixmap. I'm not happy about the tradeoff but there's not much that can be done. With the pixmap, you get fast refreshes but slow draws, and the other way around without it. What made me decide on using a pixmap as the default is the smooth scrolling that you can get (try a zoom followed by a scroll in the TK driver -- without writing into a pixmap the scrolling really sucks). One way would be to write only to the pixmap and occasionally blit it to the screen, but that would be jerky and you'd have to worry about incomplete pages. Try plotting with the -nopixmap option to see if that's any better. I do almost all my PLplot X development on an HP 720 color console and graphics speed is usually not a problem :-). 4.7 How do I change the title on the TK window menu bar, i.e., > Plot >> plclient_#2 > > ^^^^ > I'd like this to read SuperCode It uses the name of the main window if nothing else is set. You can set it two ways. One, use plParseOpts to parse your command line, then it will use argv[0] out of that list. Two, just glom pls->program directly, via: #include PLStream *pls; ... plgpls(&pls); pls->program = "myprogram"; Yes, by this method you have access to the complete internal state of the current PLplot stream. So be careful what you change :-). There is one catch, though. The way it is set up now it must be a unique name when using the Tk driver (but not the DP driver) since it corresponds to your main window name (to which X property messages are sent). If there is a previous Tcl interpreter of that name hanging around (say, as a result of some sort of abnormal exit like a core dump) you will get the mysterious _#2 appended (and _#3, and so on; note there are utilities [zapinterps or delinterp] that will delete these zombie interpreters). -4.8 How do I run plserver as a daemon? > What would be really desirable, would be to make plserver into an > actual daemon, as described in Stevens UNP. Very cool idea, how > daemons work. The plan would be to have a guy sitting there > monitoring a port/pipe/whatever, and when a connection request comes > in, he forks, and calls back to the app with directives to use a new, > previously unused (or reclaimed) port. Then the daemon goes back to > listening. That way, you could run multiple apps simultaneously, each > getting a new plserver if a spare one isn't already available... > > I think the default action would be that when you punch >> on the last > plot, the client goes ahead and terminates, but plserver stays up, for > future invocations. But when the user wants to get rid of it, if he > doesn't plan to plot for a while, then there's a kill/off button > somewhere on the pannel. Actually it is possible now to start up a plserver and connect to it, using the DP driver. But one of the problems with this is the security issue. I get around the problem now by only allowing connects during the brief time between the fork/exec and when the connection succeeds. If it was open for longer we run into the same old possibility for nasty interpreter commands being sent. Dunno if there's a good way around this. 4.9 Problems printing from the Tk driver.. > We're having some big problems with the latest release of PLPLOT. > Basically, we can't print and we can't save Postscript files. When we > try to print we get > > *** PLPLOT ERROR *** > process_next: Unrecognized command > Program aborted > lpr: standard input: empty input file Interesting. Sounds like maybe an incompatibility with the plplot library output and plrender [note: turns out it was indeed a previous version of plrender in the user's search path]. The 'print' command saves the page as a plplot metafile, and then invokes plrender to turn it into postscript. Either it was installed incorrectly, or (more likely), it is a bug. I have printed plots by this method without problem since the 4.99g release, but probably I didn't exercise everything. Maybe try "Save As.." with a variety of file types and see if anything turns out. > I have my PRINTER environment variable set. Am I supposed to do > something else? As for saving Postscript files, it seems to write part > of the file and then just stop in the middle. It appears that some > buffer is not getting flushed. Any ideas? Take a look at the plpr script, it is braindead, but I never had much time to embellish it. It doesn't allow you to set a particular printer, which I guess is what you want. You can always edit the file, for site-wise customization. Of course, this sucks, but is the best I have for now. Isn't "lpr" supposed to obey the setting of PRINTER? Even if so/not, there's the question of how to render the saved metafile. I use mono ps, since that's usually what people want. But sometimes I've wanted to print grayscale output, and hit print without thinking, and got a nice, completely black, plot. :-) So not only do I have to provide for a way to select this in the GUI but also a way to read customized settings automatically at startup. Which brings up init file issues.. (see the ToDo file). So for now just modify plpr to your tastes and stick it in your path :-). It should be located BEFORE the installed copy of plpr, which should just be the site-wise default. I usually have ~/bin before most significant directories in my path anyway. The exec() call used to invoke it does use your path I believe. And if you embellish it significantly, feel free to send me a copy. 4.10 Problems compiling xwin.c... > I am trying to install PLPLOT on a DECstation 5000/240 running Ultrix > 4.2a and an earlier version of X11R4. I am using gcc with the -ansi > option. Running make gives me the following errors: > > In file included from xwin.c:50: > /usr/local/lib/gcc-lib/decstation-ultrix4.2a/2.4.5/include/X11/Xlib.h:3958: parse error before `XSizeHints' After poking around some on this system I found out that the header files were hosed. This is the kind of thing that crops up only when using an ANSI compiler or C++ since it's in the function prototypes. In particular, Xlib.h uses XSizeHints before it's defined (in Xutil.h). In the X11R5 header files from HP-UX, all of the functions needing to reference a variable of type XSizeHints* are prototyped in Xutil.h, after the declaration of XSizeHints. I don't know how many systems I've seen with broken X11R4 header files -- a lot. Seems the X11R4 distribution was partly to blame, but you'd think the vendor would have at least checked to see whether an ANSI C compiler would work with them. In any case, there /should/ be an upgrade to fix problems like this. At worst, you can pull over a later X11 distribution (as I write this X11R6 just came out) and build it yourself. I do know that some PLplot runs OK on some Ultrix systems so there should be an upgrade available. 4.11 Problems saving files from the Tk driver. > When I tried to save > the .ps files (both color and mono) using "Save as.." in plrender, > it doesn't seem to terminate the file properly. I had to add a > "showpage" statement at the end before I send it to the printer > in order for my printer to print it properly. On the other hand, if > I select the drivers (ps or psc) at the command line or upon start > of the program, the output files looked fine. You either need to quit the program or pick "save close" before displaying the saved file. This is because "save as" leaves the file open so that you can use "save" on multiple plots, each going to the same file. +4.12 Why does the Tcl/TK driver use a separate process for rendering but not the X driver? > The pgplot xwin driver forks a separate process to handle expose and other > events, and this works fine under SunOS 4.3.1 but fails under AIX 3.2.5 (and > I hear under other similar systems like Solaris 2). In your own code, you > seem to keep event handling inside the other routines, and periodically you > deal with the queue. Is that correct? Can you tell me a bit about the > philosophy behind the routines, and why such careful housekeeping is > necessary? Forking it off as a separate process is much better, in principle. The xwin driver was contributed; I took it and improved it greatly and learned a lot about X by experimenting with it. I eventually wrote the Tk/Tcl-DP driver(s), in which the rendering /is/ split off into a separate process. The PLplot OS/2 driver written by Geoff Furnish works by similar principles, but uses threads (something that more Unix systems should support). And, the Tk/DP drivers /do/ work under AIX, SunOS-4x, Solaris, HPUX, Linux, Unicos, IRIX, OSF/1, etc. I have become a bit of a portability expert and what I don't have experience on, the users of PLplot contribute (plus I've been working really hard on getting the package as portable as is reasonable). Nevertheless, the existing xwin driver with its simpler paradigm (polling, rather than communication with an external event-driven process) serves as a useful base level X driver. There are definitely MANY more software and portability issues involved in the separate process route. +4.13 How do I create an interactive, widget-based application using PLplot? > I would like to make an interactive widget so that the plot can be > interactively changed by clicking and dragging on the plot. Direct control of the plframe widget, or even better, the plxframe "megawidget", is the way to go. One problem: plxframe is not a true megawidget. At the time of this writing, there are few good ways to do this in straight Tcl, and I haven't yet committed to rewriting the code in [incr Tcl]. I probably will eventually, though, to make the plxframe truly controllable and robust. Right now it's just a collection of Tcl procs that work together to control a plframe. Another problem: you have to do practically all the plot control from a high level. Graphical objects in the PLplot/tk interface are not objectized so there are few low-level operations the user has access to. The graphics representation in the plframe widget is just a bitmap. I plan to gradually raise the abstraction level up in order to make the package more useful. E.g. instead of a bunch of vector strokes, a character string will be represented as a data structure, which only becomes vector strokes when it gets to the driver. That way the user can change its attributes; most notably, the postscript font that is used to print it when sending the plot through the ps driver. Also something similar could be done with color. But these capabilities are a long way off and will be added very conservatively. BTW, a Tk canvas has good support for manipulating its components (at a price). Now back to the high level way of doing it. You can intercept keystrokes or mouse clicks in Tk very easily using the "bind" command (Tcl API). You can set up an event handler that interprets the appropriate actions by the user as commands to the plot library. There are ways to return the world coordinates of the cursor as well (a plframe widget command and API call), which is important in controlling what gets done. Each time the plot must be changed it would have to be redrawn. This is not unreasonable on today's killer micros or fast workstations. In fact, the scrolling you can do after a zoom is accomplished not by scrolling around in some super bitmap but by redrawing the visible area of the plot each time (it is buffered so that it appears smooth). How well this works is a function of the speed of your machine. On my HP 720, scrolling simple line plots (e.g. x01c) in zoom mode is quite fast. Shaded plots are much slower. And any routine that needs to do significant calculation (such as the contour plotters) will be kind of slow to redraw. +4.14 How do I shade between a 4 color range with the Tk driver? The easiest way to experiment is to use the load palette option. The last distribution came with some alternate choices -- cmap1a.pal is the default, so try cmap1b.pal and cmap1c.pal. And since they are ASCII, it's trivial to create new ones. Here's cmap1c.pal: -----------cut----------- 6 #ff00ff 00 #0080ff 20 #00ffff 44 #00ff90 54 #fffb00 67 #ff0000 100 -----------cut----------- The first number is the number of control points, and each control point is set subsequently. The first line after the '6' above is for the first control point, and so on to the 6th. The first number is the color in hex, and the second number is the location in cmap1-space the control point resides. There is an optional third number, a boolean (0 or 1), that results in the interpolation going "around the back" of the hue wheel if set. There is also an API function for setting control points. ============================================================================== Section 5: All other drivers & supported platforms ============================================================================== 5.1 What about support for platform.. Right now the package is most likely to be up-to-date under HP-UX and Linux, since those are the two systems used most extensively by Maurice and Geoff. However we also use SunOS, AIX, UNICOS, and SUPER-UX enough that probably there will be no problems on those systems also. The DOS and OS/2 support is being done mostly by other parties at this point (see the README). Any other systems are suspect. Other Unix variants (IRIX, OSF/1) are reasonably safe since the PLplot configure script is fairly sophisticated and portable -- system dependencies tend to drop out without notice. I can't make any promises as to the Amiga support since I rarely compile PLplot there these days. Also no one is currently supporting the NeXT. As always, I'm looking for volunteers to help pick up the slack on these systems (really, any other than say HPUX and Linux). At the minimum this means getting pre-beta releases and testing them, submitting any fixes that need to be made, that's it! If you have more ambitious plans for supporting a particular platform, that'd be great -- let me know. =5.2 What about PLplot support for VMS? PLplot under VMS is now supported, thanks to the efforts of Hiromi Kimura (hiromi@tac.tsukuba.ac.jp). See the files in sys/vms. 5.3 PLplot is aborting with: Error opening plot data storage file. The most common reason I've seen for this is that the temporary file area is set up incorrectly (wrong permissions). Note: this directory is where tmpfile() opens its temporaries, which may NOT be /tmp. You can find the true location typically by looking in stdio.h. For example, on my HP in stdio.h there is: # define _P_tmpdir "/usr/tmp/" look for something similar on your machine, and make sure the directory has the appropriate permissions (it should have global write set). 5.4 Is there a Windows port of PLplot? Look under sys/dos/bcc, there you'll see a file win3.c, which is a Windows port by Paul Casteels. I don't know much about it having never tried it, but have heard some good comments about it. One nice enhancement is the ability to print the current plot. +5.5 I'd like to develop a windowed interface to PLplot for.. For the systems that I've used, developing windowed interfaces is a fair amount of work. Most of my experience developing graphical interfaces is under Unix (and a little on the Amiga). Unix/X/Tcl/Tk on a fast workstation makes for an excellent starting point -- it is powerful, and the final product is fairly portable. Virtually all my professional work is on Unix machines, which also drives my effort -- the Tk driver is where most of my attention has been going. But it's still a /lot/ of work. Of course there are still many reasons for using or developing on a microcomputer -- if I used my Amiga more I'd be more inclined to spend more time improving the interface there. As it was, the Amiga had the first PLplot windowed interface, and it gave me many ideas about how to proceed with the Tk one. Unfortunately, too many of these features were built into the Amiga screen driver instead of the core, and didn't help directly when I was doing the Tk driver. So when I improved the package in order to support the Tk driver I tried to make changes where they could potentially benefit other windowing drivers. This should help developers of other windowed drivers some. I originally started developing a Motif-based driver (in C), but abandoned the effort when I saw how much easier Tk-based ones (in Tcl and C) are to construct. Tk is free to boot. So at this point I'm very happy with Tcl/TK and am probably finished with Motif. There are still some reasons for going with Motif -- such as needing a specific Motif widget or to satisfy company policy, market demand, or whatever. Also the recent development of interpretive Motif environments that rival Tcl/TK in their ease of use and prototyping speed (or so I've heard) makes Motif-based GUI construction more palatable. If you just want Motif widgets inside your app, you can do this in Tk (see the comp.lang.tcl FAQ for more info). Right now there is no way to do the reverse as far as I know -- include Tk widgets inside a Motif app, but maybe eventually there will be a way (I mention this because the development of the plframe widget was the most time-consuming single thing I've done as regards PLplot). Under Windows, try the driver by Paul Casteels (see FAQ 5.4). At the time of this writing it is still somewhat sparse, but as per the comments above it may not be unreasonable to extend it in the same directions as the Tk driver. Another alternative is to actually use Tk -- there are several ports of Tk to Windows in various stages of completion. I'd like to hear about people's experiences with these, especially with PLplot. +5.6 What about PLplot support for the Mac? I've been asked several times about a Mac interface. There is now a Mac driver! It needs someone to "adopt" it, i.e. keep it up to date, answer questions about it, etc. Email mjl@dino.ph.utexas.edu if you want the job. Otherwise it probably will end up broken sooner or later. (Ian Searle writes:) Tzong-Shuoh Yang (tsyang@ce.berkeley.edu) has been doing the RLaB Macintosh port for at least a year now (RLaB uses Plplot for graphics). Plplot works quite nicely on the Mac. +5.7 What about PLplot support for OS/2? >The stuff in sys/os2 worked under OS/2 1.3. There is a port of that >code to OS/2 2.x underway by another person, but I'm not sure of the >current status of that port. Presumably eventually PLplot will once >again have OS/2 PM support, but there is no ETA. You should be able >to build PLplot to use file oriented drivers without difficulty. Emx >should be fine for that. (John C. Peterson, KD6EKQ, {smart-host}!octagon!jcp, jcp%octagon.UUCP@ucsd.edu writes:) That person would be me! And, your statement is correct, the only real "hitch" is the Presentation Manager driver, a very desirable one to have of course. I've made pretty good progress on the OS/2 port of the PM stuff using GCC/EMX. I've got all the Presentation Manager and other APIs converted over to their 32 bit equivalents. It compiles cleanly under EMX without any "quibbling". At the moment, there *are* a few bugs that need to be hunted down, about 1/2 of the C examples fail to run correctly (or at all!) Most of this is because of subtle changes to the design of the PLplot driver interface that have occurred during the last couple years, during which time the driver was not been updated. Unfortunately, I haven't had any time to work on it over the last several months. I've been very busy at my regular job for the last 4-5 months, working out of town for about 2 of those months. I tried to recruit some help for this effort through the Usenet OS/2 groups, but came up empty. There is hope though, the big crunch at work is finally behind me, and as soon as I get caught up with personal things, I hope to get back to working on the port. ============================================================================== plplot-5.10.0+dfsg/README.Release_Manager_Cookbook 644 1750 1750 7605512276771565 205260ustar andrewandrewINDEX ** Prepare a (preliminary) version of the ChangeLog file for this release ** Prepare the README.release file and/or press those who have made changes in this release cycle to update that file ** Prepare and test the documentation ** Check and potentially fix internal consistency ** Update website-related files ** Install and test a (preliminary) local copy of the PLplot website ** Update Release date and versions ** Update this file (README.Release_Manager_CookBook) ** Create (a preliminary version of) the release tarball and check the result for errors ** Do comprehensive test of PLplot ** Install and test a local copy of the PLplot website ** Create ChangeLog.release ** Create the PLplot Release ++ Preliminaries ++ Install and test a local copy of the PLplot website ++ Upload the local website to SourceForge ++ Create a final release tarball and check the result for errors ++ Sign the release with your plplot Release Manager gpg key ++ Verify the release tarball signing ++ Make a SourceForge file release ** Publicize the release announcement ** Prepare immediately for the next release cycle INDEX for Appendix ** GNU Privacy Guard (gpg) ** Creating a test tarball from trunk ** Correct computer time N.B. the order of steps below is important because of the dependencies between the steps which are noted (except for the generation of the final release tarball and ChangeLog which depend on virtually all prior steps). _________________________________________________________________________ ** Prepare a (preliminary) version of the ChangeLog file for this release This step does not depend on other steps. # This makes the BASE used below correct. svn update svn log --revision :BASE --verbose >| ChangeLog.release_preliminary where stands for the last revision number of the previous release which can be determined e.g., by viewing the ChangeLog.release file from the previous release. Note the "_preliminary" suffix to distinguish this from the final result below which will contain (if all goes well in the steps below) a record of all but the last commit (of the ChangeLog itself) for this release. Note the order of the --revision components puts this preliminary version in chronological order. But it is traditional for the final version to have the result in reverse chronological order (see below). _________________________________________________________________________ ** Prepare the README.release file and/or press those who have made changes in this release cycle to update that file This step depends on the step above entitled "Prepare a (preliminary) version of the ChangeLog file for this release". To double-check that file is complete with regards to all major developments during this release cycle, skim all the commit messages in ChangeLog.release_preliminary determined above. _________________________________________________________________________ ** Prepare and test the documentation This step does not depend on other steps. The steps below entitled "Check and potentially fix internal consistency" and "Install and test a (preliminary) local copy of the PLplot website" "Install and test a local copy of the PLplot website" depend on this step. Update the doxygen documentation (in our source code) and DocBook documentation (in doc/docbook/src) to reflect any changes (new drivers or new PLplot functionality) in the current release cycle. Or alternatively, press those who made the changes to update the documentation. Generate and test our doxygen form of documentation following the instructions in doc/README.doxygen. Update, generate and test our Docbook documentation following the instructions in doc/docbook/README.developers. _________________________________________________________________________ ** Check and potentially fix internal consistency This step depends on the step above entitled "Prepare and test the documentation". This step potentially affects the swig-generated bindings and the f95, tcl, and ocaml bindings. Thus, the step below entitled "Comprehensive test of PLplot" may depend on this step. Some of the files in the source tree are generated from other files in the source tree using build-system targets. All targets that have "check" in the name prefix are these kind of targets. So to get a complete list of such targets, execute make help |grep '... check' in the build tree. The current such list of targets is ... check_plplotcapi_defines ... check_swig_documentation ... check_f95_parameters ... check_tcl_parameters ... check_plplot_h.inc Note, one of these targets (check_plplot_h.inc) only exists if the -DGENERATE_PLPLOT_H_INC=ON cmake option is used which in turn requires that at least the OCaml version of the Perl regular expression library be installed. (On debian the associated package name is libpcre-ocaml-dev.) Normally, GENERATE_PLPLOT_H_INC is OFF by default to reduce build dependencies, but to make the complete list of such targets available you should run the cmake command with the -DGENERATE_PLPLOT_H_INC=ON option and make sure there are no OCaml-related warnings in the results. To actually do the internal consistency checks, run each of the above targets which typically generate a file in the build tree which is then compared (using the Unix cmp command) with the file that is being checked in the source tree. If the two files are inconsistent (which can be caused by documentation updates, for example), the cmp command complains, and you should follow up by doing a diff between the two files to confirm that the changes are reasonable followed by copying the build-tree version of the file on top of the source-tree version and committing the source-tree version. When this process is completed, all the above targets should run with no cmp or other errors/warnings at all, e.g., software@raven> make check_swig_documentation check_f95_parameters check_tcl_parameters check_plplot_h.inc Check that swig_documentation.i is consistent with doc/docbook/src/api.xml Built target check_swig_documentation Check that plplot_parameters.h is consistent with the #defines in bindings/swig-support/plplotcapi.i Built target check_f95_parameters Check that plplot_parameters.h is consistent with the #defines in bindings/swig-support/plplotcapi.i Built target check_tcl_parameters Check that plplot_h.inc is consistent with touchup.ml and plplot_h Built target check_plplot_h.inc _________________________________________________________________________ ** Update website-related files This step does not depend on other steps. The steps below entitled "Install and test a (preliminary) local copy of the PLplot website" "Install and test a local copy of the PLplot website" "Create (a preliminary version of) the release tarball and check the result" "Create the release tarball and check the result" depends on this step. If necessary, update the examples list in scripts/htdocs-gen_plot-examples.sh. That list is used to generate the website example-related files and copy the results to the website. The list automatically controls what example source code is configured (for source code that needs that), as well as what example plots and example thumbnails are generated. The list also automatically controls what examples-related files are copied to the website. Update the project web page, including the examples: edit www/examples.php to reflect any changes to the examples themselves (i.e. pages added or removed from an existing example or entirely new examples). Note, the xmlto package that must be installed in order to generate the DocBook documentation (see doc/docbook/README.developers referred to above) is also used to generate some of our older release announcements for the website, and could also be used to generate present release announcements for the website if desired. See www/announce/README for just how easy this step would be. _________________________________________________________________________ ** Install and test a (preliminary) local copy of the PLplot website This step depends on the steps above entitled "Prepare and test the documentation" and "Update website-related files" but does not depend on any steps below. To build the local form of the website (including both the doxygen and DocBook forms of our documentation) run (on a Linux host that is capable of building the documentation for the source tree that has all local changes) scripts/generate_website.sh with no arguments. The script asks you four questions, gives you a chance to verify your answers, then does all the rest of it (downloading a throwaway copy of the PLplot source code, building the doxygen and DocBook documentation, generating the announcements that are part of the base website, uploading the base website, uploading the documentation, building the examples, running the examples, uploading the example source code and example results) automatically. I (AWI) tested this script using the four answers Summary: USERNAME = irwin GROUPNAME = irwin HOSTNAME = raven WEBSITE_PREFIX = /home/irwin/public_html/plplot (raven is my local computer name, and /home/irwin/public_html is a location where I can put various websites). You can check for errors (e.g., due to missing commands that need to be installed) by running find /tmp/plplotdoc -name '*.out' |xargs grep -i error You should install both apache and PHP on your computer. For Debian stable (a.k.a. wheezy) that is done (as root) by installing libapache2-mod-php5 and enabling user directories using the command a2enmod userdir and editing /etc/apache2/mods-available/php5.conf as indicated in that file to allow user directories for php. I am not sure, but I believe from some google results I found that editing of that file is also necessary on modern versions of Ubuntu in order to allow php-based websites like that of PLplot to work when installed in local user directories. After the above changes, you must restart the apache server. On Debian this is done with service apache2 restart (When user directories are enabled this way, for the above case /home/irwin/public_html/plplot/htdocs, browses as http://raven/~irwin/plplot/htdocs/.) I test http://raven/~irwin/plplot/htdocs/ by clicking on most links, checking the documentation looks good, checking the examples are complete and look good and the source code for each language for examples is accessible, etc. Some iterations with the steps above entitled "Prepare and test the documentation" and "Update website-related files" will likely be required. N.B. scripts/generate_website.sh uses the local source tree where that script resides (including all local changes) as the source tree for generating the local website. So there is no need to commit every documentation, example, and version change until you are completely satisfied with the local website. But after you _are_ satisfied with the local website you should commit all your changes so they are available for generating the tarball and ChangeLog (see below) for this release. N.B. The iterated result should be identical to the final result (see below) except that the release date (configured as RELEASE_DATE) and the PLplot version in www/example.php will be wrong. Those issues are addressed in "Update release date and versions" below. _________________________________________________________________________ ** Update Release date and versions This step depends on no others. The following steps entitled "Create (a preliminary version of) the release tarball and check the result for errors." "Install and test a local copy of the PLplot website" "Comprehensive test of PLplot" depend on this step. Update PLplot version in www/examples.php. In addition, update cmake/modules/plplot_version.cmake to reflect the current RELEASE_DATE (which affects the documentation build) and version. Also, follow the instructions in that file for updating the SOVERSION, the minor number and the patch number for each versioned library created by the PLplot build. _________________________________________________________________________ ** Update this file (README.Release_Manager_CookBook) Edit this file to reflect latest practices by the release manager and also to update the many version numbers in it to the latest version value. _________________________________________________________________________ ** Create (a preliminary version of) the release tarball and check the result for errors This step depends on the steps above entitled "Prepare and test documentation" "Check and potentially fix internal consistency" The -c option runs ctest on the directory tree unpacked from the release tarball, and the -i option installs a build from that directory tree scripts/make_tarball.sh -c -i /tmp/plplot_install find /tmp/plplot-dist-prep -name "*.out" |xargs grep -i error If the above find command discovers any errors, then those errors need to be fixed and this step needs to be repeated. Browse the following install locations that were generated from the tarball: /tmp/plplot_install/share/doc/plplot/html/index.html /tmp/plplot_install/share/doc/plplot/plplot-5.10.0.pdf /tmp/plplot-dist-prep/plplot-5.10.0.tar.gz In the latter, look carefully for any files that should not be part of the source tarball. Look at a few man pages that were generated from the tarball, e.g., nroff -man /tmp/plplot_install/share/man/man3/pllegend.3plplot |less Look at the info pages that were generated from the tarball using info /tmp/plplot_install/share/info/plplotdoc.info _________________________________________________________________________ ** Do comprehensive test of PLplot This step depends on the steps above entitled "Check and potentially fix internal consistency" "Update date/versions" Do a comprehensive test of the interactive and noninteractive results. scripts/comprehensive_test.sh --do_ctest no --do_test_noninteractive no find ../comprehensive_test_disposeable -name "*.out" |grep -v a.out |xargs grep -i error scripts/comprehensive_test.sh --do_test_interactive no find ../comprehensive_test_disposeable -name "*.out" |grep -v a.out |xargs grep -i error Enter results of these and all other tests of this release into README.release. _________________________________________________________________________ ** Create ChangeLog.release N.B. commit all local changes to the repository so they will be reflected in the ChangeLog, tagged version of the release, and the release tarball. And if there are committed changes after this one repeat this step so the ChangeLog.release commit is the last trunk commit for this release cycle (with the possible exception of the current file, README.Release_Manager_Cookbook). Prepare the ChangeLog.release file to keep track of all changes made for the release. Use the following commands: # This makes the BASE used below correct. svn update svn log --revision BASE: --verbose >| ChangeLog.release (This destroys the ChangeLog.release file from the previous release.) LAST_REVISION should be the same as in the generation of the preliminary version of this file above. Check that ChangeLog.release is in the appropriate date range (i.e. only the changes that were made since the last release should be included) then (IMPORTANT) commit it so it will also be available for the tagged release version, the release tarball, etc. This should be the last commit for the trunk version of PLplot (see remarks above about when it is necessary to repeat this step). Note the order of the --revision components which puts this file in the traditional reverse chronological order (unlike the preliminary version above which is in chronological order). Commit the result which ideally should be the last commit of this release. svn commit ChangeLog.release _________________________________________________________________________ ** Create the PLplot Release ++ Preliminaries Based on suggestions in the svn manual, the PLplot svn archive is configured as follows: /trunk /tags/older_plplot_versions /branches/?? For the release, you will be using svn to copy the /trunk version to /tags/vX_Y_Z (v5_10_0 for example to follow the previous naming conventions). To do this strictly on the server side with no local files involved at all use the following commands: # Check that you have committed everything and there are no other updates you # are unaware of. svn update svn status # Complete server side copy using new SourceForge Allura version of repository. # This is _much_ faster than copying from the local version. svn copy https://svn.code.sf.net/p/plplot/code/trunk https://svn.code.sf.net/p/plplot/code/tags/v5_10_0 # Check out this release tag svn checkout https://svn.code.sf.net/p/plplot/code/tags/v5_10_0 plplot_tags_5.10.0 In the event that problems are found in the release tarball generated from the release tag, then trunk should be fixed, the trunk ChangeLog.release file recreated and committed (see instructions above). Then merge the trunk version into the tags/vX_Y_Z branch as follows: cd tags/vX_Y_Z svn merge -r A:B /path/to/trunk Where A and B specify the range of revisions in trunk to be applied to tags/vX_Y_Z in the merge process. These can be determined by commit messages. # IMPORTANT: use this tagged version to create the website and tarball cd plplot_tags_5.10.0 ++ Install and test a local copy of the PLplot website This step depends on the steps above entitled "Prepare and test the documentation" "Update website-related files" "Update release date and versions" The step below entitled "Upload the local website to SourceForge" depends on this one. Follow the exact steps given above in "Install and test a (preliminary) local copy of the PLplot website" but this time with the correct RELEASE_DATE and VERSION and also do this using the files from the tagged release directory, e.g., plplot_tags_5.10.0 ++ Upload the local website to SourceForge Once you are satisfied with the local website, you should upload it to SourceForge with rsync. For the above WEBSITE_PREFIX, here is what worked for me from my computer with the hostname of raven where that WEBSITE_PREFIX directory was created. rsync -av --delete \ /home/irwin/public_html/plplot/htdocs/ \ airwin,plplot@web.sourceforge.net:htdocs Adjust for your username and WEBSITE_PREFIX. The ",plplot" part of the username makes sure you have the right group permissions and default website directory location for PLplot. N.B. the trailing slash on the source directory is essential and means rsync the contents of this directory with the contents of the destination htdocs directory. Without the trailing slash you would rsync the the contents of the source directory with the contents of the htdocs/htdocs destination directory which is not what you want to do. N.B. the --dry-run option for rsync is a god-send and tells you exactly what will happen without actually doing it. Note that when changing release managers, the SF permissions are not set up correctly to delete files belonging to the old release manager using rsync. (Or else we need to learn more about how to change ownership using rsync.) So you need to use sftp to do that, e.g., sftp airwin,plplot@web.sourceforge.net Then use the ls -l command to figure out who owns what and the rm * command on the _file_ contents of each subdirectory of htdocs, and use the rmdir command on empty directories. Note, sftp has no recursive feature so you have to figure out the directory structure and cd to the correct directory levels to remove the files in each directory, ugh. I did try the sftp chown command, but that did not work so the only possibility I could find was the above commands to remove htdocs and everything below it in a piece-meal fashion. Once you have a proper upload of the local website to SourceForge, test it as before. Also, click the xhtml and css validate buttons on each of index.php, download.php, examples.php, documentation.php, and credits.php to validate those pages. ++ Create a final release tarball and check the result for errors Follow the above step entitled "Create (a preliminary version of) the release tarball and check the result for errors" but this time for the tagged release to make sure the tarball is exactly consistent with the release tag. ++ Sign the release with your plplot Release Manager gpg key gpg --default-key YYYYYYYY --detach-sign --armor /tmp/plplot-dist-prep/plplot-X.Y.Z.tar.gz A list of your GPG keys can be obtained using the command "gpg --list-keys ". ++ Verify the release tarball signing gpg --verify /tmp/plplot-dist-prep/plplot-X.Y.Z.tar.gz.asc ++ Make a SourceForge file release #IMPORTANT cd /tmp/plplot-dist-prep/ sftp airwin,plplot@frs.sourceforge.net cd /home/frs/project/p/pl/plplot/plplot mkdir 5.10.0\ Source cd 5.10.0\ Source put plplot-5.10.0.tar.gz.asc put plplot-5.10.0.tar.gz exit Make, e.g., plplot-5.10.0.tar.gz, the "latest" version. login to SF website files ==> plplot ==> 5.10.0 Source ==> view details (the "i" icon) for plplot-5.10.0.tar.gz ==> select "all" for the default The above used to spin indefinitely with iceweasel. Now it finishes with a "properties updated" message, but it doesn't appear to "take" immediately so check it later. # Save a local copy of the release tarball for future reference and # also check it. cd /home/software/plplot_svn/HEAD/export #(or wherever) cp -a /tmp/plplot-dist-prep/plplot-5.10.0.tar.gz* . gpg --verify plplot-5.10.0.tar.gz.asc Prepare concatanated release notes + Changelog. cd plplot_tags_5.10.0 echo " DETAILED CHANGELOG FOR THIS RELEASE " | cat README.release - ChangeLog.release >| /tmp/README.release cd /tmp sftp airwin,plplot@frs.sourceforge.net cd /home/frs/project/p/pl/plplot/plplot/5.10.0\ Source put /tmp/README.release exit Create a news item for this release largely following previous news items (or even identical to them but with a changed title). Point your browser to http://sf.net/projects/plplot and login. A news item will then be available on the menu bar. Click that, then "new post". Enter the title (e.g., PLplot Release 5.10.0) and the text. Surround the URL's in the text with angle brackets, e.g. . For now I simply make all paragraphs one giant line which seems to give reasonable default results. (15) Publicize the release announcement Jerry: macresearch.org Barbara Irwin: linuxtoday.com, lwn.net, lxer.com (16) Prepare immediately for the next release cycle a. Preserve the historical record of the significant changes between versions of PLplot in one file by prepending README.release for 5.10.0 to OLD-README.release cat README.release OLD-README.release > OLD-README.release_new mv OLD-README.release_new OLD-README.release b. Update README.release file to reflect the start of a new release cycle. --- Appendix --- _________________________________________________________________________ ** GNU Privacy Guard (gpg) A brief summary of developer relevant gpg commands, see also: http://dewinter.com/gnupg_howto/english/GPGMiniHowto.html, man gpg, and http://www.gnupg.org/faq/GnuPG-FAQ.html. ++ Configure key-server (if you haven't done that already) by editing $HOME/.gnupg/gpg.conf. Also specify the auto-key-retrieve option for convenience. ++ List keys on your keyring that have been retrieved or generated so far: gpg --list-keys irwin ++Search for any previously published keys that you might want to revoke. (Note the search phrase is case insensitive but the search is done on the Boolean AND of the terms so the following search would miss any key generated in the past by Alan Irwin because of the middle initial "W." that is specified for the search). OTOH, I always use my middle initial for publications to reduce name clashes. gpg --search-keys Alan W. Irwin ++ Create a new key: gpg --gen-key With gnupg 1.4.10, I chose the following options when creating a new key: Please select what kind of key you want: (1) RSA and RSA (default) What keysize do you want? 2048 (default) 5-year expiration date. .... Real name: Alan W. Irwin Email address: airwin@users.sourceforge.net Comment: Time Ephemerides key You selected this USER-ID: "Alan W. Irwin (Time Ephemerides key) " N.B. nameofkey below is the name of the key, usually specified by the second number after the slash for the first pub line given by "gpg --list-keys". For example, the above key gives the following result: software@raven> gpg --list-keys irwin pub 2048R/BB159E92 2011-08-19 [expires: 2016-08-17] uid Alan W. Irwin (Time Ephemerides key) sub 2048R/C5ECCF77 2011-08-19 [expires: 2016-08-17] So the name could be BB159E92. Other possibilities exist as well such as "irwin", but that might not be unique. Here is a complete recording of the gpg --edit-keys commands where I added an additional user ID with the different comment "PLplot key" to my existing key. Note this technique could be used to add an additional user ID with a different Real name or Email address as well. gpg --edit-key irwin gpg> adduid Real name: Alan W. Irwin Email address: airwin@users.sourceforge.net Comment: PLplot key Okay # to accept this added subkey ... need to enter passphrase gpg> uid 5 # to select the new user ID for additional changes gpg> trust # select ultimate since you ultimately trust yourself. :-) Your decision? 5 Do you really want to set this key to ultimate trust? (y/N) y # Do to a gpg bug, the trust value looks like it is not updated, but # it is so if you gpg > save # To save your changes, the trust value listed by gpg --list-keys irwin is correct. If you make a mistake in adding a new user id.... (which happened to me when I put down a wrong e-mail address). gpg --edit-key irwin adduid (fill in correct e-mail address this time) uid number (to select uid to work on for further commands revuid (revoke bad e-mail one) primary (to make the new one the primary one, I am not sure that is necessary) trust (to make the new one ultimately trusted, again, not sure that is necessary. N.B. didn't seem to change trust value, but that was just bad output) save (to get out again) When edited the next time showed ultimate trust value for correct id, but I don't know whether that was the above primary/trust subcommands or whether those were necessary at all. It turned out those were not necessary at all as I later used the above sequence to generate a libLASi key and a FreeEOS uid key. ++ Generate a revocation certificate. Note this requires the pass phrase specified at the time of key generation so keep that pass phrase in a safe place or else generate the revocation certificate right after generating the key, and keep that certificate in a safe place. I chose the former course (keep the pass phrase safe). N.B. the options should appear below in the order given! gpg --armor -o nameofkey-revocation.asc --gen-revoke nameofkey ++ Publicly revoke old key (from FAQ): gpg --import old-revocation.asc gpg --send-keys nameofkey ++ Upload your (public) key to GPG key server so that others can obtain it to verify your signature on the release tarball. gpg --send-keys nameofkey gpg --refresh-keys (to update from the server all keys including your own). This verified that the bad irwin address was revoked even though gpg --search-keys Alan W. Irwin still shows revoked uid as the #1 uid. _________________________________________________________________________ ** (Optional) Creating a test tarball from trunk This step is only required if you have some concerns about how recent changes may have affected the generated source tarball, and you want to generate that tarball and test it _before_ you create a tag for the release. (The release process for the tag below also generates a tarball from the tag directory and tests it which is why this trunk version of the same is optional.) cd /tmp /path-to-trunk-source/scripts/make_tarball.sh \ -w https://plplot.svn.sourceforge.net/svnroot/plplot -c -i /tmp/trunk_install -t trunk 2>&1 | tee build.log The above exports the current trunk and uses /tmp/plplot-dist-prep/build_dir to build the distribution source tarball and uses /tmp/plplot-dist-prep/ctest_build_dir to configure and build PLplot from the unpacked tarball, ctest the build tree, and install the built PLplot in /tmp/trunk_install Here are the *.out files generated by this process which should be checked. /tmp/plplot-dist-prep/build_dir/cmake.out /tmp/plplot-dist-prep/build_dir/make_prebuild_dist.out /tmp/plplot-dist-prep/build_dir/make_package_source.out /tmp/plplot-dist-prep/ctest_build_dir/cmake.out /tmp/plplot-dist-prep/ctest_build_dir/make.out /tmp/plplot-dist-prep/ctest_build_dir/ctest.out /tmp/plplot-dist-prep/ctest_build_dir/make_install.out Here is how the install location should be checked: cd /tmp/trunk_install/share/plplotX.Y.Z/examples make >& make_examples.out ./plplot-test.sh --help #to see what kinds of tests can be run ./plplot-test.sh --device=psc ./plplot-test.sh --device=pscairo ./plplot-test.sh --device=pngcairo ./plplot-test.sh --device=png etc. Check the results with, e.g., display x01c.pngcairo.01 display x08c.pscairo where "display" is the general image viewer from the imagemagick suite of programmes. _________________________________________________________________________ ** Correct computer time (While it is useful to have the correct time on your computer, this is no longer strictly necessary). Verify that your computer has the right date and time using the command date. The easiest way to make sure the time and date are correct is to do the following: 1. Install the debian ntpdate package. 2. Execute the command "/usr/sbin/ntpdate pool.ntp.org", which you will have to do as root. This will immediately change your system clock. It is not recommended if you have other apps running on your system that expect time to increase in a smooth and linear fashion. If you would like your computer to always have the correct time and date, you can install the debian ntp package. The default configuration appears to give good results. You can check those results by the ntpq -pe command, e.g., software@raven> ntpq -dp 1 packets reassembled into response remote refid st t when poll reach delay offset jitter ============================================================================== 2 packets reassembled into response one.tariox.com 24.150.241.178 2 u 7d 1024 0 79.179 -6.028 0.000 2 packets reassembled into response tor-web-02.surr 97.107.129.217 3 u 33d 1024 0 79.696 -4.199 0.000 2 packets reassembled into response *helliana.com 128.9.176.30 2 u 580 1024 177 82.416 0.120 0.518 2 packets reassembled into response chelsea.ii1.net 216.218.254.202 2 u 16d 1024 0 33.252 5.646 0.000 The delay column is the round-trip travel time (in ms) to the indicated server. The offset column is the "combined time offset" (in ms) for the indicated server. I assume this is the offset of that server clock from the weighted mean of all the clocks. The jitter column is the "exponentially-weighted rms average" for the indicated server. I assume it is in ms so the above jitters of 0.000 show a very small rms for those servers, i.e., a clock of extremely high quality. plplot-5.10.0+dfsg/AUTHORS 644 1750 1750 100010415317303 137640ustar andrewandrewJoao Cardoso Vince Darley Geoffrey Furnish Alan W. Irwin Rafael Laboissiere Maurice LeBrun Arjen Markus Andrew Roach David Schleef Andrew Ross Thomas J. Duck plplot-5.10.0+dfsg/scripts/ 775 1750 1750 012406243566 143515ustar andrewandrewplplot-5.10.0+dfsg/scripts/mklinks 755 1750 1750 1557410013370660 160450ustar andrewandrew#!/bin/sh #************************************************************************* # # $Id: mklinks 5349 2004-02-14 10:00:16Z rlaboiss $ # # mklinks - makes (or removes) soft-links from distribution directory to # more appropriate places (typically under /usr/local). # # Maurice LeBrun (mjl@dino.ph.utexas.edu) # IFS, University of Texas at Austin # May 17, 1994 # # Arguments: # -a Add soft links # -n Print commands without executing # -r Remove soft links # # Anything else results in a short help message being printed. # # I wrote this script to simplify the business of installing software # distributions. With a lot of packages continuing to evolve at a pretty # good clip, it helps to be able to update without too much hassle. Also, # it is best to provide a fairly consistent organization of the files on # disk, one that fits into just about anyone's system management scheme. # The method I use works whether you are system manager or just some poor # slob user :-). # # The idea is to type "make install" in the build directory, with the # install target set to some empty directory. A good choice is # /usr/local/, where is the software package name and # is the version. This way you can have multiple versions of the # package installed, with only one of them easily accessible. Or you can # leave out the version number. # # By softlinking the package distribution files into the usual /usr/local # areas you (a) avoid requiring a change in PATH to get at the binaries, # (b) avoid requiring changes to makefiles to get include and lib # settings, (c) avoid requiring changes to MANPATH settings to allow # access to the man pages, and (d) have an easy way to do upgrades or # degrades. # # The main difficulty as I see it with using softlinks from /usr/local # areas into /usr/local/bin, /usr/local/lib, /usr/local/include, and # /usr/local/man, is that once created, the softlinks are hard to get rid # of. If you decide to delete the package, you must manually delete the # softlinks as well. Switching between versions is an onerous task, # especially if you want to back down to a previous revision. Therefore, # a fundamental capability of this script is to allow easy removal of all # created softlinks (-r option). # # Note: the default is to only link librarys under lib into the target # dir, since some packages store lots of data files under lib/. # #************************************************************************* # Miscellaneous settings NAME=$0 # Name of script CWD=`pwd` # Current directory LINK_MAN=1 # Install man pages (set to null to disable) LINK_LIB_ALL=0 # Link lib/* rather than just lib/lib* # Infer package name from directory name # Not all systems have "basename" so use sed for this. PKG=`echo $CWD | sed 's%/.*/%%'` # Get base target directory -- the links will go into $INSTALL_DIR/bin, # $INSTALL_DIR/lib, etc. Since the package is typically in # /usr/local/, INSTALL_DIR is just one directory up. Use an absolute # path name rather than relative (..) since it's less confusing. INSTALL_DIR=`echo $CWD | sed 's%/[^/][^/]*$%%'` # Per-package defaults: # PKG_NAME Name of package, for help/error messages # REFERENCE_FILE Name of an installed file to assist internal logic case "$PKG" in perl* ) PKG_NAME="perl" REFERENCE_FILE="$INSTALL_DIR/bin/perl" ;; plplot* ) PKG_NAME="PLplot" REFERENCE_FILE="$INSTALL_DIR/bin/plrender" ;; python* ) PKG_NAME="Python" REFERENCE_FILE="$INSTALL_DIR/bin/python" LINK_LIB_ALL=1 ;; tcl*|tk* ) PKG_NAME="Tcl/TK/etc" REFERENCE_FILE="$INSTALL_DIR/bin/tclsh" LINK_LIB_ALL=1 ;; * ) echo "Unrecognized package; aborting" exit ;; esac # Account for differences in /bin/sh semantics wrt soft links. IF_SOFT="-h" if test `uname` = "AIX"; then IF_SOFT="-L" fi # Define a symbol for echo to save a little bit of space. e=echo #************************************************************************* # Spits out help message, then exits help () { $e "Usage: $NAME [-n] [-a | -r]" $e " Creates (-a) or removes (-r) soft links to $PKG_NAME files." $e " Currently configured to put soft links under $INSTALL_DIR." $e "" $e " If -n is specified, commands are printed with no action taken." $e " The -n flag must come first, if specified." exit 1 } #************************************************************************* # Adds one or many soft-links. Creates directory if necessary. # $1 - subdir name # $2 - file spec add_link () { if test -d "$CWD/$1"; then if test ! -d "$INSTALL_DIR/$1"; then if test "$DO_NOTHING"; then echo "mkdir -p $INSTALL_DIR/$1" else mkdir -p $INSTALL_DIR/$1 fi fi # Do filename globbing here so we can catch cases where no # filenames match. for file in $CWD/$1/$2; do if test -r $file; then if test "$DO_NOTHING"; then echo "ln -s $file $INSTALL_DIR/$1" else ln -s $file $INSTALL_DIR/$1 fi fi done fi } #************************************************************************* # Removes a single soft-link # $1 - link name (relative to $INSTALL_DIR) rm_link () { if test $IF_SOFT "$INSTALL_DIR/$1"; then if test "$DO_NOTHING"; then echo "rm $INSTALL_DIR/$1" else rm $INSTALL_DIR/$1 fi fi } #************************************************************************* # Removes multiple soft-links # $1 through $# - link specs (relative to $INSTALL_DIR) rm_links () { for file in $*; do rm_link $file done } #************************************************************************* # Add links Add () { # Bomb out if we're not starting clean if test $IF_SOFT "$REFERENCE_FILE"; then echo "Must remove old links first -- use \"$NAME -r\"." exit 1 fi # Set up links echo "Adding links from $CWD to $INSTALL_DIR" add_link "bin" "*" add_link "include" "*.h" if test "$LINK_LIB_ALL" = 1; then add_link "lib" "*" else add_link "lib" "lib*" fi if test "$LINK_MAN"; then add_link "man/man1" "*.1" add_link "man/man3" "*.3" add_link "man/mann" "*.n" fi } #************************************************************************* # Remove links Remove () { # Bomb out if links already removed. if test ! $IF_SOFT "$REFERENCE_FILE"; then echo 'Soft links already removed.' exit 1 fi # Delete links # Here we reglob to determine what links need deleting. Note that in each # case, we check to make sure it really is a soft link. echo "Removing links from $CWD to $INSTALL_DIR" rm_links bin/* lib/* include/*.h if test "$LINK_MAN"; then rm_links man/man1/*.1 man/man3/*.3 man/mann/*.n fi } #************************************************************************* # Call the necessary function to do the job. if test "$1" = "-n"; then DO_NOTHING=1 shift fi if test "$1" = '-a'; then Add elif test "$1" = '-r'; then Remove else help fi exit 0 plplot-5.10.0+dfsg/scripts/check_api_completeness.sh 755 1750 1750 1177712243237170 215030ustar andrewandrew#!/bin/bash # This Linux-only script creates a sorted list of our API from several # independent locations within our source tree and finds all the # inconsistencies between them. # This script should be run from the top-level source tree. # Prepare API list from include/plplot.h to be compared with all others. # Be sure to remove officially deprecated functions. grep '^#define.*pl.*c_pl' include/plplot.h |\ grep -v plParseInternalOpts |\ tr '\t' " " |\ tr -s " " |\ cut --delimiter=" " --fields=2 |\ grep -v 'plclr$' |\ grep -v 'plcol$' |\ grep -v 'plhls$' |\ grep -v 'plpage$' |\ grep -v 'plrgb$' |\ grep -v 'plrgb1$' |\ sort \ >| /tmp/plplot_api.txt case $1 in docbook) # Prepare API list from doc/docbook/src/api.xml # and compare with previous echo "documentation API differences (if any)" grep '$' doc/docbook/src/api.xml |\ cut --delimiter='"' --fields=2 |\ sort |\ diff -au /tmp/plplot_api.txt - ;; swig) # Prepare API list from bindings/swig-support/plplotcapi.i # and compare with previous echo "swig API differences (if any)" # The grep -v '[A-Z]' stanza gets rid of some of the non-public API that # is exposed for the swig-generated bindings, and similarly for the list # of commands that are excluded. The grep -v stanzas also get rid of # deprecated API that is mentioned but excluded with #if 0 ... #endif grep '^pl.*(' bindings/swig-support/plplotcapi.i |\ cut --delimiter='(' --fields=1 |\ grep -v '[A-Z]' |\ grep -v pl_cmd |\ grep -v pldid2pc |\ grep -v pldip2dc |\ grep -v plf2eval |\ grep -v plf2eval2 |\ grep -v plf2evalr |\ grep -v plfcont |\ grep -v plfshade |\ grep -v plgesc |\ grep -v plgfile |\ grep -v plsexit |\ grep -v plsfile |\ grep -v plsxwin |\ grep -v pltr0f |\ grep -v pltr2f |\ grep -v pltr2p |\ grep -v 'plhls$' |\ grep -v 'plrgb$' |\ grep -v 'plrgb1$' |\ sort |\ diff -au /tmp/plplot_api.txt - ;; java) # Prepare API list from bindings/java/PLStream.java # and compare with previous. echo "java API differences (if any)" # The grep -v '[A-Z]' stanza gets rid of some of the non-public API that # is exposed. # Also get rid of the deprecated plhls from the comparison. grep 'plplotjavac.pl.*(' bindings/java/PLStream.java |\ cut --delimiter='(' --fields=1 |\ cut --delimiter='.' --fields=2 |\ sort -u |\ grep -v '[A-Z]' |\ grep -v 'plhls$' |\ diff -au /tmp/plplot_api.txt - ;; octave) # Prepare API list from bindings/octave/plplot_octave.h.in # and compare with previous. echo "octave API differences (if any)" grep '^#define.*pl.*c_pl' bindings/octave/plplot_octave.h.in |\ grep -v plParseInternalOpts |\ tr '\t' " " |\ tr -s " " |\ cut --delimiter=" " --fields=2 |\ sort |\ diff -au /tmp/plplot_api.txt - ;; f95) # Prepare API list from bindings/f95/plstubs.h # and compare with previous echo "f95 API differences (if any)" # After obtaining the basic name with paranthesis appended, we get rid of # that paranthesis and any trailing "_", and "7". We then do a unique # sort to get rid of duplicates, and specifically exclude some added special # fortran functions (whose original form may have had a "7" appended). # We also remove the plhls, plrgb, and plrgb1 deprecated functions. grep 'FNAME.*,pl.*)' bindings/f95/plstubs.h |\ cut --delimiter="," --fields=2 |\ sed -e 's?)??' -e 's?_$??' -e 's?7$??' |\ sort -u |\ grep -v plclr |\ grep -v 'plcol$' |\ grep -v plcon0 |\ grep -v plcon1 |\ grep -v plcon2 |\ grep -v plscmap1l2 |\ grep -v plscmap1la2 |\ grep -v plshade0 |\ grep -v plshade2 |\ grep -v plshades0 |\ grep -v plshades1 |\ grep -v plshades2 |\ grep -v plvec0 |\ grep -v plvec1 |\ grep -v plvec2 |\ grep -v 'plhls$' |\ grep -v 'plrgb$' |\ grep -v 'plrgb1$' |\ diff -au /tmp/plplot_api.txt - ;; c++) # Prepare API list from bindings/c++/plstream.h # and compare with previous. echo "c++ API differences (if any)" grep 'plstream::' bindings/c++/plstream.cc |\ grep -v '//' |\ grep '(' |\ cut --delimiter='(' --fields=1 |\ cut --delimiter=':' --fields=3 |\ sed 's/[^ ]*/pl&/' |\ sort -u |\ grep -v '[A-Z]' |\ diff -au /tmp/plplot_api.txt - ;; tcl) # Prepare API list from bindings/tcl/plapi.tpl echo "tcl API differences (if any)" ( grep '^pltclcmd' bindings/tcl/plapi.tpl |\ cut --delimiter=' ' --fields=2 && \ grep '{"pl' bindings/tcl/tclAPI.c | \ cut --delimiter='"' --fields=2 \ ) | \ sort -u | \ diff -au /tmp/plplot_api.txt - ;; all) $0 docbook $0 swig $0 java $0 octave $0 f95 $0 c++ $0 tcl ;; *) echo "First argument was $1" echo "Instead, it must be one of the following:" echo "docbook, swig, java, octave, f95, c++, tcl or all" ;; esac #rm /tmp/plplot_api.txt plplot-5.10.0+dfsg/scripts/CMakeLists.txt 644 1750 1750 252711701072003 171540ustar andrewandrew# scripts/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if(HAVE_BASH) set(scripts_SCRIPTS "") if(PLD_plmeta) set(scripts_SCRIPTS ${scripts_SCRIPTS} plm2gif plpr ) endif(PLD_plmeta) if(PLD_pstex) set(scripts_SCRIPTS ${scripts_SCRIPTS} pstex2eps) endif(PLD_pstex) if (NOT "${scripts_SCRIPTS}" STREQUAL "") install(PROGRAMS ${scripts_SCRIPTS} DESTINATION ${BIN_DIR}) endif (NOT "${scripts_SCRIPTS}" STREQUAL "") endif(HAVE_BASH) if(ENABLE_tcl OR ENABLE_tk) install(PROGRAMS mktclIndex DESTINATION ${DATA_DIR}/examples/tcl) endif(ENABLE_tcl OR ENABLE_tk) plplot-5.10.0+dfsg/scripts/parity_bit_check.sh 755 1750 1750 441211543675237 202770ustar andrewandrew#!/bin/bash # $Id: parity_bit_check.sh 11680 2011-03-27 17:57:51Z airwin $ # This script will run parity_bit_check on all files in the PLplot # source tree (except those listed below) to discover which of those # files have any character with the eighth (parity) bit set. # Copyright (C) 2010 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA which parity_bit_check >/dev/null parity_bit_check_rc=$? if [ "$parity_bit_check_rc" != 0 ] ; then echo " This script only works when parity_bit_check is on the PATH. To make this so please run make parity_bit_check in the build tree and put the utils subdirectory of that build tree where parity_bit_check will be built by the above command on your PATH." exit 1 fi # Find absolute PATH of script without using readlink (since readlink is # not available on all platforms). Followed advice at # http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/ ORIGINAL_PATH="$(pwd)" cd "$(dirname $0)" # Absolute Path of the script SCRIPT_PATH="$(pwd)" # Assumption: top-level source tree is parent directory of where script # is located. SOURCE_TREE="$(dirname ${SCRIPT_PATH})" cd "${SOURCE_TREE}" #List of all files in source tree other than .svn ones.... find -type f >| /tmp/temporary_source_tree_list for FILE in $(grep -v -f "$SOURCE_TREE"/scripts/parity_bit_check.exclude /tmp/temporary_source_tree_list); do parity_bit_check <$FILE parity_bit_check_rc=$? if [ "$parity_bit_check_rc" -ne 0 ]; then printf "%s %x\n" $FILE $parity_bit_check_rc fi done rm -f /tmp/temporary_source_tree_listplplot-5.10.0+dfsg/scripts/htdocs-gen_plot-examples.sh 755 1750 1750 1437512276771565 217370ustar andrewandrew#!/bin/bash # This script generates a tarball of source code and screenshots, # 'htdocs_plot_examples.tgz', that will be part of the 'examples' web page, # # The original intention was to upload the generated tarball directly to the # PLplot SourceForge website filesystem and unpack it there using ssh # commands, but now that SF is no longer ssh accessible, the script # has been generalized for any ssh-accessible site, which in turn can # be used to update the SF website using rsync. # This script must be run in the top plplot source directory as: # # WWW_USER=$USERNAME \ # WWW_GROUP=$GROUPNAME \ # WWW_HOST=$HOSTNAME \ # WWW_DIR=$WEBSITE_PREFIX \ # scripts/htdocs-gen_plot-examples.sh # # where $USERNAME, $GROUPNAME, $HOSTNAME, and $WEBSITE_PREFIX are the # appropriate username, groupname, hostname, and website prefix directory # of the ssh-accessible site. # To avoid rebuild launch it like this: # WWW_USER=$USERNAME \ # WWW_GROUP=$GROUPNAME \ # WWW_HOST=$HOSTNAME \ # WWW_DIR=$WEBSITE_PREFIX \ # build=false scripts/htdocs-gen_plot-examples.sh # Sanity checks. if [ -z "$WWW_USER" ] ; then echo "must specify non-empty WWW_USER environment variable" exit 1 fi if [ -z "$WWW_GROUP" ] ; then echo "must specify non-empty WWW_GROUP environment variable" exit 1 fi if [ -z "$WWW_HOST" ] ; then echo "must specify non-empty WWW_HOST environment variable" exit 1 fi if [ -z "$WWW_DIR" ] ; then echo "must specify non-empty WWW_DIR environment variable" exit 1 fi WWW_USER_AT_HOST=${WWW_USER}@$WWW_HOST # cp should preserve time stamps to make rsync more efficient for # website uploading to SourceForge. CP='cp -p' # a fresh make, with minimum bindings build=${build:-true} if [ "$build" = "true" ] ; then rm -rf htdocsgen/build_dir htdocsgen/install mkdir -p htdocsgen/build_dir htdocsgen/install cd htdocsgen/build_dir cmake -DCMAKE_INSTALL_PREFIX=`pwd`/../install \ -DDEFAULT_NO_BINDINGS=ON \ -DDEFAULT_NO_DEVICES=ON -DPLD_pngcairo=ON \ ../../ make -j3 make -j3 install cd ../.. fi EXDIR=htdocs/examples-data pushd htdocsgen/install/share/plplot*/examples/c export cexamples_dir=`pwd` make popd # hack, x20c needs lena in the current directory $CP examples/c/lena.pgm . for exe in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 \ 23 24 25 26 27 28 29 30 31 32 33; do if [ $exe = "08" -o $exe = "16" -o $exe = "20" -o $exe = "30" ] ; then # The default cairo graphics AA looks good for these examples now # since Werner's filled_polygon change to the cairo driver so no need # to explicitly turn graphics AA off any more with # DRIVEROPT='-drvopt graphics_anti_aliasing=1' DRIVEROPT= elif [ $exe = "09" -o $exe = "21" ] ; then # Text clipping. DRIVEROPT='-drvopt text_clipping=1' elif [ $exe = "27" ] ; then # even-odd fill rule (a general option rather than a driver option) # generates more interesting results. DRIVEROPT='-eofill' else # Otherwise use default graphics AA which is full AA DRIVEROPT= fi echo Working on example ${exe} using DRIVEROPT of $DRIVEROPT # generate standard and preview size images if [ $exe = "14" ] ; then echo x14a.%n.png | \ $cexamples_dir/x${exe}c -dev pngcairo -o x${exe}.%n.png \ -fam -fflen 2 $DRIVEROPT -geometry 800x600 echo prev-x14a.%n.png | \ $cexamples_dir/x${exe}c -dev pngcairo -o prev-x${exe}.%n.png \ -fam -fflen 2 $DRIVEROPT -geometry 200x150 # First and second pages of master stream are already stored as first # and second pages of overall example. # Move first and second pages of slave stream to third and fourth # pages of overall example for easy web viewing. mv x14a.01.png x14.03.png mv x14a.02.png x14.04.png mv prev-x14a.01.png prev-x14.03.png mv prev-x14a.02.png prev-x14.04.png else $cexamples_dir/x${exe}c -dev pngcairo -o x${exe}.%n.png \ -fam -fflen 2 $DRIVEROPT -geometry 800x600 $cexamples_dir/x${exe}c -dev pngcairo -o prev-x${exe}.%n.png \ -fam -fflen 2 $DRIVEROPT -geometry 200x150 fi # move to www directory. echo populating www directory demo${exe} rm -rf $EXDIR/demo${exe} mkdir -p $EXDIR/demo${exe} # page number is two digits or more. mv *${exe}.*[0-9][0-9].png $EXDIR/demo${exe} for f in \ examples/ada/x${exe}a.adb \ examples/ada/xthick${exe}a.adb \ examples/c/x${exe}c.c \ examples/c++/x${exe}.cc \ examples/f95/x${exe}f.f90 \ examples/java/x${exe}.java \ examples/ocaml/x${exe}.ml \ examples/octave/x${exe}c.m \ examples/python/xw${exe}.py \ examples/tcl/x${exe}.tcl \ ; do if [ -f $f ] ; then $CP $f $EXDIR/demo${exe} else echo Example `basename $f` is not yet available \ > $EXDIR/demo${exe}/`basename $f` fi done # rename executables, to avoid browsers trying to execute files # instead of showing them. (cd $EXDIR/demo${exe}; for j in \ *.adb \ *.c \ *.cc \ *.f90 \ *.java \ *.ml \ *.m \ *.py \ *.tcl \ ; do mv $j $j.txt done ) done # remove hack rm -f lena.pgm # create the tarball TARBALL=htdocs-plot-demos.tgz find htdocs -size 0 -exec rm {} \; tar cvzf $TARBALL htdocs rm -rf htdocs # Transfer the tarball to $WWW_HOST and unpack it, such that the files will # appear in the PLplot web site echo "ssh $WWW_USER_AT_HOST mkdir -p $WWW_DIR" ssh $WWW_USER_AT_HOST mkdir -p $WWW_DIR echo "ssh $WWW_USER_AT_HOST rm -rf $WWW_DIR/$EXDIR" ssh $WWW_USER_AT_HOST rm -rf $WWW_DIR/$EXDIR echo "scp $TARBALL $WWW_USER_AT_HOST:$WWW_DIR" scp $TARBALL $WWW_USER_AT_HOST:$WWW_DIR echo "ssh $WWW_USER_AT_HOST chmod g=u $WWW_DIR/$TARBALL" ssh $WWW_USER_AT_HOST chmod g=u $WWW_DIR/$TARBALL echo "ssh $WWW_USER_AT_HOST tar -x -z -C $WWW_DIR -f $WWW_DIR/$TARBALL" ssh $WWW_USER_AT_HOST tar -x -z -C $WWW_DIR -f $WWW_DIR/$TARBALL echo "ssh $WWW_USER_AT_HOST chgrp -R $WWW_GROUP $WWW_DIR/$EXDIR" ssh $WWW_USER_AT_HOST chgrp -R $WWW_GROUP $WWW_DIR/$EXDIR echo "ssh $WWW_USER_AT_HOST chmod -R g=u $WWW_DIR/$EXDIR" ssh $WWW_USER_AT_HOST chmod -R g=u $WWW_DIR/$EXDIR echo "ssh $WWW_USER_AT_HOST rm -f $WWW_DIR/$TARBALL" ssh $WWW_USER_AT_HOST rm -f $WWW_DIR/$TARBALL plplot-5.10.0+dfsg/scripts/compare_svn_repos 755 1750 1750 1220412120433352 201030ustar andrewandrew#!/bin/bash # Compare results from an old svn repo named _pre_Allura # in the current directory with a new svn repo named in # the current directory. # This script should be run without arguments. It first compares the # complete log file for the two repos. If that is identical, it then # checks out a sample of approximately $nsample (defined below) # revisions starting at revision 1 and ending at the latest revision # for each repo and checks that the corresponding checked-out trees # are identical for each of those revisions. ## Find oldrepo. oldrepo=$(\ls --directory *_pre_Allura) oldrepo_rc=$? if [ "$oldrepo_rc" -ne 0 ] ; then echo "Error: could not find old svn repo with name of *_pre_Allura" exit $oldrepo_rc else echo "Found old svn repo called $oldrepo" fi ## Find newrepo. newrepo_name=$(echo $oldrepo|sed -e "s?_pre_Allura??") newrepo=$(\ls --directory $newrepo_name) newrepo_rc=$? if [ "$newrepo_rc" -ne 0 ] ; then echo "Error: could not find new svn repo with name of $newrepo_name" exit $newrepo_rc else echo "Found new svn repo called $newrepo" fi ## Check that old and new repo have the same number of revisions. old_number_of_revisions=$(svnlook youngest $oldrepo) new_number_of_revisions=$(svnlook youngest $newrepo) if [ "$old_number_of_revisions" -ne "$new_number_of_revisions" ] ; then echo "Error: Old and new svn repo have different number of revisions" exit 1 else number_of_revisions=$new_number_of_revisions echo "Number of revisions = $number_of_revisions" ## Rough number of different revisions that are compared in detail. ## Actual number could be from nsample to 2*nsample ## depending on how nsample divides into number_of_revisions nsample=100 ((revision_increment = number_of_revisions/nsample)) ((revision_increment = revision_increment <=0 ? 1 : revision_increment)) echo "Revision increment used for detailed comparisons = $revision_increment" fi ## Checkout latest revision of old repo and new repo into /tmp rm -rf /tmp/old_source_tree rm -rf /tmp/new_source_tree svn checkout --quiet file://localhost/$(pwd)/$oldrepo /tmp/old_source_tree svn checkout --quiet file://localhost/$(pwd)/$newrepo /tmp/new_source_tree ## Compare detailed log file for each local directory tree created above. old_dir=$(pwd) cd /tmp svn log --verbose old_source_tree >| old_detailed_log svn log --verbose new_source_tree >| new_detailed_log cmp old_detailed_log new_detailed_log cmp_rc=$? if [ "$cmp_rc" -ne 0 ] ; then echo "Error: old and new repos have detailed logs that are different" exit $cmp_rc else echo "Old and new repos have identical detailed logs" fi ## Compare local directory trees for substantial sample of revisions ## including both first and last revision. for revision in $(seq 1 $revision_increment $number_of_revisions) $number_of_revisions ; do svn update --quiet --revision=$revision old_source_tree svn update --quiet --revision=$revision new_source_tree ## Find and eliminate identical broken links from the diff ## because otherwise such broken links cause a non-zero ## diff return code. The code below does not deal with ## cyclical links, but I don't think any of the repos to be ## checked with this script have those. ## The find -L option makes find follow symlinks if possible, and ## the subsequent -type l ordinarily should find no symlinks at ## all, except for the case of broken links which point to ## non-existent files. Those remain as symlinks (despite the -L) ## because it is impossible to follow them. Thus, the following ## combination of options and flags always finds just the broken ## symlinks. cd old_source_tree; find -L . -type l >| ../old_broken_symlinks; cd .. cd new_source_tree; find -L . -type l >| ../new_broken_symlinks; cd .. ## Check that both directories have identical sets of broken symlinks. diff --brief old_broken_symlinks new_broken_symlinks diff_rc=$? if [ "$diff_rc" -ne 0 ] ; then echo "Error: old and new repos have different sets of broken symlinks for revision = $revision" exit $diff_rc fi ## Convert list of broken symlinks to the basename form. This ## form is an unfortunate choice because basename collisions can ## occur causing additional good files that are not broken ## symlinks to be ignored by the diff check. However, the ## basename form is the only form that is acceptable to exclude ## files from the diff so we are stuck with this problematic logic. rm -f basename_broken_symlinks; touch basename_broken_symlinks for BROKEN_LINK in $(cat new_broken_symlinks); do basename $BROKEN_LINK >> basename_broken_symlinks done diff -Naur --exclude=".svn" --exclude-from=basename_broken_symlinks --brief old_source_tree new_source_tree diff_rc=$? if [ "$diff_rc" -ne 0 ] ; then echo "Error: old and new repos have different (aside from .svn) checked-out directory trees for revision = $revision" exit $diff_rc else echo "Old and new repos have identical (aside from .svn) checked-out directory trees for revision = $revision" fi done # Return to starting directory cd $old_dirplplot-5.10.0+dfsg/scripts/MinGW_MSYS_comprehensive_test.sh 755 1750 1750 1360611520241016 226160ustar andrewandrew# Setup and run comprehensive_test.sh for MinGW/MSYS from # bash. This script is designed with the limitations of the current # wine version of Windows platform in mind but could easily be # generalized for MinGW/MSYS on the Microsoft version of Windows. # This file is designed to be sourced (with the bash "." command) # rather than run as a bash subshell so save some attributes that # need to be restored at the end. ORIGINAL_DIR=$(pwd) ORIGINAL_PATH=$PATH # Establish prefixes for all relevant locations for the PLplot build # and test. . set_plplot_build_prefixes.wine_sh # Establish PATH to MinGW/MSYS. Order apparently matters here. MinGW # should be higher on the PATH then MSYS. PATH=$MINGW_PREFIX/bin:$MSYS_PREFIX/bin:$PATH # Use downloaded binary version of cmake to build PLplot. PATH=$CMAKE_283_PREFIX/bin:$PATH # Make GTK+ stack of libraries and pkg-config accessible to PLplot # build. PATH=$GTKPLUS_PREFIX/bin:$PATH export PKG_CONFIG_PATH=$GTKPLUS_PREFIX/lib/pkgconfig # Make qmake application and therefore Qt4 libraries accessible to # PLplot build. Lower in the PATH in this case because this Qt4 bin # directory contains a library name (libgcc_s_dw2-1.dll) that is # identical with a MinGW library name and probably taken from an older # version of MinGW. # However, comment this out because qt (even the latest version below) # is unreliable. qt.driver_info was produced perfectly by # test-drv-info.exe on wine but there was still an exit(3) that # occurred in __mingw_CRTStartup according to gdb. That exit code of # 3 generates a make error and everything grinds to a halt. However, # if you ignore it and continue, then many examples work with # qt-related devices, but some do not. It is quite possible the # problem with 2010.05 (and prior versions) is they were compiled # according to http://doc.qt.nokia.com/4.7/compiler-notes.html to # be compatible with MinGW-4.4, but I cannot get that compiler # to work with cmake, so forget Qt. # PATH=$PATH:$QT4_PREFIX/bin # Make built qhull library accessible to PLplot build. PATH=$QHULL_PREFIX/bin:$PATH export CMAKE_INCLUDE_PATH=$QHULL_PREFIX/include export CMAKE_LIBRARY_PATH=$QHULL_PREFIX/lib # Give access to swig. (Swig installation has no separate bin directory). PATH=$SWIG_PREFIX:$PATH # Give access to Python. (Python installation has no separate bin directory). PATH=$PYTHON_PREFIX:$PATH CMAKE_INCLUDE_PATH=$PYTHON_PREFIX/Lib/site-packages/numpy/core/include/numpy:$CMAKE_INCLUDE_PATH CMAKE_INCLUDE_PATH=$PYTHON_PREFIX/include:$CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH=$PYTHON_PREFIX/libs:$CMAKE_LIBRARY_PATH # Give access to Windows version of Tcl. N.B. the windows installer for # Tcl appears to put $TCL_PREFIX/bin permanently on the PATH so no # need to place it on the PATH again. #PATH=$TCL_PREFIX/bin:$PATH CMAKE_INCLUDE_PATH=$TCL_PREFIX/include:$CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH=$TCL_PREFIX/lib:$CMAKE_LIBRARY_PATH # Give access to the Windows version of Lua which was built under MinGW/MSYS # using the ordinary Makefile Lua build system. PATH=$LUA_PREFIX/bin:$PATH # Because of CMake misfeature that superpath does not have # precedence, must set values explicitly rather than using # CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH. #CMAKE_INCLUDE_PATH=$LUA_PREFIX/include:$CMAKE_INCLUDE_PATH #CMAKE_LIBRARY_PATH=$LUA_PREFIX/lib:$CMAKE_LIBRARY_PATH # # Where lua.h occurs. cmake_extra_options="-DLUA_INCLUDE_DIR:PATH=$LUA_PREFIX/include" # Full path to liblua.a cmake_extra_options="-DLUA_LIBRARY:FILEPATH=$LUA_PREFIX/lib/liblua.a $cmake_extra_options" # Give access to the Windows version of Octave. N.B. the Windows Octave # installer puts lots of dependent dll's in the PATH so might get into dll hell # here if actually using extensive Octave facilities to test PLplot, but # we are not. So to avoid interference with PLplot dll dependencies, put # octave lowest on the PATH. #Location of octave.exe and liboctave.dll PATH=$PATH:$OCTAVE_PREFIX/bin #Location of octave.h (with PATH_SUFFIX of octave-3.2.4/octave) and hdf5.h # (the external header apparently required by the octave headers). CMAKE_INCLUDE_PATH=$OCTAVE_PREFIX/include:$CMAKE_INCLUDE_PATH #Location of liboctave.dll.a (with PATH_SUFFIX of octave-3.2.4). CMAKE_LIBRARY_PATH=$OCTAVE_PREFIX/lib:$CMAKE_LIBRARY_PATH # swig-based build of octave bindings is required on Windows. cmake_extra_options="-DENABLE_swig_octave=ON $cmake_extra_options" # Set MinGW compiler flags for the PLplot build. export CFLAGS='-O3' export CXXFLAGS=$CFLAGS export FFLAGS=$CFLAGS # Notes on invocation of comprehensive_test.sh below. # Must disable Tcl because cmake under wine somehow finds Linux # versions of Tcl. WTF? (1.3.8 last wine version checked). # Now no longer disable Tcl because you force it to find the # Windows version (see above). # Must disable f95 because of some gfortran module parsing problem # under wine. (1.3.8 last wine version checked). # Set DEBUG_COMPREHENSIVE_TEST_RESULT to some value before sourcing # this script if you want to set up all environment variables as # they are for a normal run of comprehensive_test.sh without # actually running that script. # --cmake_added_options "-DENABLE_f95=OFF -DDEFAULT_NO_BINDINGS=ON -DENABLE_tcl=ON -DDEFAULT_NO_DEVICES=ON -DPLD_ps=ON" \ # --cmake_added_options "-DENABLE_f95=OFF"\ if [ -z "$DEBUG_COMPREHENSIVE_TEST_RESULT" ] ; then bash $PLPLOT_SOURCE_PREFIX/scripts/comprehensive_test.sh \ --prefix $TEST_RESULTS_PREFIX \ --generator_string "MSYS Makefiles" --build_command "make -j4" \ --cmake_added_options "-DENABLE_f95=OFF -DDEFAULT_NO_BINDINGS=ON -DENABLE_octave=ON -DDEFAULT_NO_DEVICES=ON -DPLD_ps=ON $cmake_extra_options" \ --do_shared yes --do_nondynamic no --do_static no \ --do_ctest no --do_test_noninteractive yes --do_test_interactive no --do_test_build_tree yes --do_test_install_tree no --do_test_traditional_install_tree no # This file is sourced so restore original directory location and PATH. cd $ORIGINAL_DIR PATH=$ORIGINAL_PATH fi plplot-5.10.0+dfsg/scripts/style_source.sh 755 1750 1750 2606212260100733 175160ustar andrewandrew#!/bin/bash # $Id: style_source.sh 12914 2013-12-29 20:11:07Z airwin $ # This script will run uncrustify on all source files registered in # the lists below (and scripts/convert_comment.py on all C source # files registered below) and summarize which uncrustified or # comment-converted files would be different. (convert_comment.py # converts /* ... */ style comments to the c99-acceptable // form of # comments because uncrustify does not (yet) have that configuration # choice.) Also there are options to view the differences in detail # and/or apply them. This script must be run from the top-level # directory of the PLplot source tree. # Copyright (C) 2009-2010 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA usage() { echo ' Usage: ./style_source.sh [OPTIONS] Options: [--diff [diff options]] Show detailed style differences in source code with optional concatenated diff options headed by a single hyphen. If no diff options are specified, then -auw is used by default. [--nodiff] Summarize style differences in source code (default). [--apply] Apply style differences to source code (POWERFUL). [--noapply] Do not apply style differences to source code (default). [--help] Show this message. ' exit $1 } transform_source() { # $1 is a list of source files of a particular language. # $2 is the language identification string for those source files in # the form needed by uncrustify. From the uncrustify man page those # language id forms are C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+ u_command="uncrustify -c uncrustify.cfg -q -l $2" # $3 is either "comments" to indicate comments will be transformed # using scripts/convert_comment.py or any other string (or # nothing) to indicate comment style processing will not be used. if [ "$3" = "comments" ] ; then c_command="scripts/convert_comment.py" # Check all files for run-time errors with the python script. # These run-time errors signal that there is some comment # style which the script cannot handle. The reason we do this # complete independent check here is that run-time errors can # be lost in the noise if a large conversion is being done. # Also, run-time errors will not occur for the usual case # below where cmp finds an early difference. for language_source in $1 ; do $c_command < $language_source >/dev/null c_command_rc=$? if [ $c_command_rc -ne 0 ] ; then echo "ERROR: $c_command failed for file $language_source" exit 1 fi done else c_command="cat -" fi # Swig-language *.i files are approximately the same as C or C++ # other than the %whatever swig directives. $4 is either "swig" # to indicate a sed script should be applied to get rid of issues # imposed by uncrustify and which is not acceptable in swig # directives or any other string (or nothing) to indicate that # this swig correction should not be applied. if [ "$4" = "swig" ] ; then # Splitting s_command into multiple invocations of sed is # required (for reasons I have not figured out) in order for # the changes to be done as designed. # The first two stanzas are to deal with uncrustify # splitting both %} and %{ by newline characters and # also getting rid of any surrounding blanks. # The next two stanzas are to take care of blanks inserted by # uncrustify after % and to get rid of any # uncrustify-generated indentation for all % swig directives. # The next two stanzas are to place %} and %{ on individually # separate lines. # The next two stanzas are to deal with $ variables. s_command='sed -e "/%$/ N" -e "s? *%\n *\([{}]\)?%\1?" |sed -e "s?% ?%?g" -e "s? *%?%?g" | sed -e "s?\(%[{}]\)\(..*\)?\1\n\2?" -e "s?\(..*\)\(%[{}]\)?\1\n\2?" | sed -e "s?\$ \* ?\$\*?g" -e "s?\$ & ?\$\&?g"' else s_command="cat -" fi # Process $c_command after $u_command so that comments will be rendered # in standard form by uncrustify before scripts/convert_comment.py # is run. Process the $s_command (with eval because of the # quotes) after the $c_command to correct introduced swig styling # errors (if in fact you are styling swig source). # N.B. for the --apply option, transform_source is called twice; # once with apply=OFF and once with it on. For the first call # with apply=OFF the logic below lists all files (and diffs all # files if that option is used) that will be changed. For the # second call with apply=ON, the logic below changes the source # files and then lists (and diffs if that option is set) any # remaining changes that still have to be done. (On rare # occasions, uncrustify has to be applied iteratively.) for language_source in $1 ; do if [ "$apply" = "ON" ] ; then $u_command < $language_source | $c_command | eval $s_command | \ cmp --quiet $language_source - if [ "$?" -ne 0 ] ; then $u_command < $language_source | $c_command | eval $s_command >| /tmp/temporary.file mv -f /tmp/temporary.file $language_source fi fi $u_command < $language_source | $c_command | eval $s_command | \ cmp --quiet $language_source - if [ "$?" -ne 0 ] ; then ls $language_source if [ "$diff" = "ON" ] ; then $u_command < $language_source | $c_command | eval $s_command | \ diff $diff_options $language_source - fi fi done } # Figure out what script options were specified by the user. # Defaults export diff=OFF export apply=OFF export diff_options="-auw" while test $# -gt 0; do case $1 in --diff) diff=ON case $2 in -[^-]*) diff_options=$2 shift ;; esac ;; --nodiff) diff=OFF ;; --apply) apply=ON ;; --noapply) apply=OFF ;; --help) usage 0 1>&2 ;; *) usage 1 1>&2 ;; esac shift done allowed_version=0.58 version=$(uncrustify --version) if [ "$version" != "uncrustify $allowed_version" ] ; then echo " Detected uncrustify version = '$version'. This script only works with uncrustify $allowed_version." exit 1 fi if [ ! -f src/plcore.c ] ; then echo "This script can only be run from PLplot top-level source tree." exit 1 fi export csource_LIST # Top level directory. csource_LIST="plplot_config.h.in" # src directory csource_LIST="$csource_LIST src/*.[ch]" # All C source (i.e., exclude qt.h) in include directory. csource_LIST="$csource_LIST $(ls include/*.h include/*.h.in |grep -v qt.h)" # Every subdirectory of lib. csource_LIST="$csource_LIST lib/*/*.[ch] lib/qsastime/qsastimeP.h.in" # C part of drivers. csource_LIST="$csource_LIST drivers/*.c" # C part of examples. csource_LIST="$csource_LIST examples/c/*.[ch] examples/tk/*.c" # C source in fonts. csource_LIST="$csource_LIST fonts/*.c" # C source in utils. csource_LIST="$csource_LIST utils/*.c" csource_LIST="$csource_LIST bindings/tcl/*.[ch] bindings/f95/*.c bindings/f95/plstubs.h bindings/gnome2/*/*.c bindings/ocaml/plplot_impl.c bindings/ocaml/plcairo/plcairo_impl.c bindings/python/plplot_widgetmodule.c bindings/tk/*.[ch] bindings/tk-x-plat/*.[ch] bindings/octave/plplot_octave.h.in bindings/octave/plplot_octave_rej.h bindings/octave/massage.c" export cppsource_LIST # C++ part of bindings/c++ cppsource_LIST="bindings/c++/plstream.cc bindings/c++/plstream.h" # C++ part of include. cppsource_LIST="$cppsource_LIST include/qt.h" # C++ part of drivers. cppsource_LIST="$cppsource_LIST drivers/wxwidgets.h drivers/*.cpp drivers/*.cc" # C++ part of examples. cppsource_LIST="$cppsource_LIST examples/c++/*.cc examples/c++/*.cpp examples/c++/*.h" # C++ source in bindings. cppsource_LIST="$cppsource_LIST bindings/qt_gui/plqt.cpp bindings/wxwidgets/wxPLplotstream.cpp bindings/wxwidgets/wxPLplotwindow.cpp bindings/wxwidgets/wxPLplotwindow.h bindings/wxwidgets/wxPLplotstream.h.in" export javasource_LIST # Java part of bindings/java javasource_LIST="bindings/java/*.java bindings/java/*.java.in" # Java part of examples/java javasource_LIST="$javasource_LIST examples/java/*.java" export dsource_LIST # D part of bindings/d dsource_LIST="bindings/d/*.d" # D part of examples/d dsource_LIST="$dsource_LIST examples/d/*.d" export swig_csource_LIST # API description for Swig being sure to ignore the generated file, # bindings/swig-support/swig_documentation.i swig_csource_LIST=bindings/swig-support/plplotcapi.i # Use specific names here for each C-like file controlling specific # language bindings since some files (e.g., bindings/python/fragments.i) # are copied from swig itself so don't mess with them. Also, ignore octave # since that C++-like file goes under swig_cppsource_LIST. swig_csource_LIST="$swig_csource_LIST bindings/java/plplotjavac.i" swig_csource_LIST="$swig_csource_LIST bindings/lua/plplotluac.i" swig_csource_LIST="$swig_csource_LIST bindings/python/plplotcmodule.i" export swig_cppsource_LIST swig_cppsource_LIST=bindings/octave/plplot_octave.i # Check that source file lists actually refer to files. for source in $csource_LIST $cppsource_LIST $javasource_LIST $dsource_LIST $swig_csource_LIST $swig_cppsource_LIST; do if [ ! -f $source ] ; then echo $source is not a regular file so this script will not work without further editing. exit 1 fi done if [ "$apply" = "ON" ] ; then apply=OFF # Should be the exact same transform_source commands as below. transform_source "$csource_LIST" C "comments" transform_source "$cppsource_LIST" CPP "comments" transform_source "$javasource_LIST" JAVA "comments" transform_source "$dsource_LIST" D "comments" transform_source "$swig_csource_LIST" C "comments" "swig" transform_source "$swig_cppsource_LIST" CPP "comments" "swig" apply=ON echo ' The --apply option is POWERFUL and will replace _all_ files mentioned above (if any) with their styled versions. ' ANSWER= while [ "$ANSWER" != "yes" -a "$ANSWER" != "no" ] ; do echo -n "Continue (yes/no)? " read ANSWER done if [ "$ANSWER" = "no" ] ; then echo "Immediate exit specified!" exit fi fi transform_source "$csource_LIST" C "comments" transform_source "$cppsource_LIST" CPP "comments" transform_source "$javasource_LIST" JAVA "comments" transform_source "$dsource_LIST" D "comments" transform_source "$swig_csource_LIST" C "comments" "swig" transform_source "$swig_cppsource_LIST" CPP "comments" "swig" plplot-5.10.0+dfsg/scripts/mktclIndex 755 1750 1750 216612171511451 164520ustar andrewandrew#!/bin/sh #--------------------------------*- Tcl -*------------------------------------# # $Id: mktclIndex 12427 2013-07-17 12:50:49Z arjenmarkus $ # Maurice LeBrun # Dec 21 2000 #-----------------------------------------------------------------------------# # @> Tcl script to create a TclIndex file. Imports Itcl so it will pick up # @> incr tcl class definitions, but only if they are fully qualified (i.e. # @> itcl::class), due to a bug in the incr tcl autoloading extension. #-----------------------------------------------------------------------------# #\ exec tclsh "$0" ${1+"$@"} # If itcl is configured in, -itcl flag will be present. set HAVE_ITCL 0 if {$argc > 0} { foreach arg $argv { if {$arg == "-itcl"} {set HAVE_ITCL 1} } } # Catch errors in case there are no tcl files, although this shouldn't happen if { [catch { if { $HAVE_ITCL && ![catch {package require Itcl}] } { # Include all itcl, itk files. auto_mkindex . *.tcl *.itcl *.itk *.ith *.itm } else { # Just include tcl files auto_mkindex . *.tcl } } msg] } { puts "An error occurred, generating the tclIndex file: $msg" } exit plplot-5.10.0+dfsg/scripts/generate_website.sh 755 1750 1750 1047011472337260 203210ustar andrewandrew#!/bin/bash # Find absolute PATH of script without using readlink (since readlink is # not available on all platforms). Followed advice at # http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/ ORIGINAL_PATH="$(pwd)" cd "$(dirname $0)" # Absolute Path of the script SCRIPT_PATH="$(pwd)" cd "${ORIGINAL_PATH}" # Assumption: top-level source tree is parent directory of where script # is located. SOURCE_TREE="$(dirname ${SCRIPT_PATH})" echo "Generate and upload all PLplot website components to a computer host that is accessible with ssh." echo -n "Valid login name on ssh-accessible host? " read USERNAME echo -n "Valid group name on ssh-accessible host? " read GROUPNAME echo -n "ssh-accessible hostname? " read HOSTNAME echo "The following directory prefix on '$HOSTNAME' will be removed and then replaced by the complete PLplot website so be careful with what you specify" echo -n "Expendable directory prefix on '$HOSTNAME'? " read WEBSITE_PREFIX echo "" echo "Summary:" echo "USERNAME = $USERNAME" echo "GROUPNAME = $GROUPNAME" echo "HOSTNAME = $HOSTNAME" echo "WEBSITE_PREFIX = $WEBSITE_PREFIX" echo "" echo "Last warning: if you specify 'yes' below, then the '$WEBSITE_PREFIX' directory on the remote host, '$HOSTNAME', will be removed and then replaced." ANSWER= while [ "$ANSWER" != "yes" -a "$ANSWER" != "no" ] ; do echo -n "Continue (yes/no)? " read ANSWER done if [ "$ANSWER" = "no" ] ; then echo "Immediate exit specified!" exit fi # Remove $WEBSITE_PREFIX to insure absolutely clean result. echo "" echo "Completely remove old website files." ssh $USERNAME@$HOSTNAME "rm -rf $WEBSITE_PREFIX; mkdir -p $WEBSITE_PREFIX; chmod u=rwx,g=rwxs $WEBSITE_PREFIX" # Get down to the work of generating the components of the PLplot website # and uploading them to the $WEBSITE_PREFIX directory on $HOSTNAME. # Build a local version of the documentation. # N.B. this build puts some documentation results into the source tree so # we use a throwaway source tree for this. rm -rf /tmp/plplotdoc mkdir -p /tmp/plplotdoc/build cd /tmp/plplotdoc echo "" echo "svn export working copy (with local changes) from" echo "$SOURCE_TREE to /tmp/plplotdoc/plplot_source" svn --quiet export $SOURCE_TREE plplot_source echo "" echo "Configure and build PLplot documentation. This may take a while depending on your cpu speed...." cd /tmp/plplotdoc/build cmake \ -DWWW_USER=$USERNAME \ -DWWW_GROUP=$GROUPNAME \ -DWWW_HOST=$HOSTNAME \ -DWWW_DIR=$WEBSITE_PREFIX \ -DDEFAULT_NO_BINDINGS=ON -DDEFAULT_NO_DEVICES=ON \ -DPREBUILD_DIST=ON \ -DBUILD_DOC=ON \ -DBUILD_DOX_DOC=ON \ ../plplot_source \ >& cmake.out make VERBOSE=1 -j4 prebuild_dist >& make_prebuild.out echo "" echo "Install the configured base part of the website to $WEBSITE_PREFIX on $HOSTNAME." cd /tmp/plplotdoc/build make VERBOSE=1 www-install-base >& make_www-install-base.out echo "" echo "Install the just-generated documentation to $WEBSITE_PREFIX/htdocs/docbook-manual on $HOSTNAME." # This command completely removes WWW_DIR/htdocs/docbook-manual on $HOSTNAME # so be careful how you specify the above -DWWW_DIR option. cd /tmp/plplotdoc/build make VERBOSE=1 www-install >& make_www-install.out make VERBOSE=1 www-install-doxygen >& make_www-install-doxygen.out echo "" echo "Build PLplot, PLplot examples, and screenshots of those examples. This may take a while depending on your cpu speed...." # N.B. this command completely removes WWW_DIR/htdocs/examples-data # on $HOSTNAME so be careful how you specify WWW_DIR! cd /tmp/plplotdoc/plplot_source WWW_USER=$USERNAME \ WWW_GROUP=$GROUPNAME \ WWW_HOST=$HOSTNAME \ WWW_DIR=$WEBSITE_PREFIX \ scripts/htdocs-gen_plot-examples.sh >& htdocs_gen.out # If all the above works like it should, and $HOSTNAME has apache and PHP # installed properly, you should be able to browse the # resulting complete website. AWI verified this by specifying # irwin, irwin, raven (his local machine), and /home/irwin/public_html/plplot # for USERNAME, GROUPNAME, HOSTNAME, and WEBSITE_PREFIX for this script # and browsing http://raven/~irwin/plplot/htdocs/ afterward. # Once you are satisfied with the local version of the website, then upload # it to the official PLplot SourceForge site using the new (as of # 2008-09-19) rsync procedure documented in README.Release_Manager_Cookbook. plplot-5.10.0+dfsg/scripts/README 644 1750 1750 63 5434511161 152160ustar andrewandrewThis directory holds various useful shell scripts. plplot-5.10.0+dfsg/scripts/check_backwards_incompatible_api.sh 755 1750 1750 1063211444453451 234620ustar andrewandrew#!/bin/bash # Script to check all our C/C++ API for backwards-incompatible changes # using abi-compliance-checker. # Check that you have abi-compliance-checker.pl on your PATH. if [ ! -x "$(which abi-compliance-checker.pl)" ] ; then echo "You must put abi-compliance-checker.pl on your PATH" exit 1 fi allowed_version=1.21.4 acc_version=$(abi-compliance-checker.pl -dumpversion) if [ "$acc_version" != "$allowed_version" ] ; then echo " Detected abi-compliance-checker.pl version = '$acc_version'. This script only works with abi-compliance_checker.pl $allowed_version." exit 1 fi # Boiler plate to obtain SOURCE_TREE ORIGINAL_PATH="$(pwd)" cd "$(dirname $0)" # Absolute Path of the script SCRIPT_PATH="$(pwd)" # Assumption: top-level source tree is parent directory of where script # is located. SOURCE_TREE="$(dirname ${SCRIPT_PATH})" cd $SOURCE_TREE WC_VERSION=$(svnversion) echo "WC_VERSION = $WC_VERSION" svnversion | grep --silent '[^0-9]' NON_NUMERIC_SVNVERSION_rc=$? if [ $NON_NUMERIC_SVNVERSION_rc -eq 0 ] ; then echo "Warning: svnversion produces a $WC_VERSION result with non-numeric" echo "characters corresponding to a working copy that is different from the" echo "PLplot repository." fi # Build C/C++ library components of working copy. rm -rf /tmp/plplot_wc mkdir -p /tmp/plplot_wc/build /tmp/plplot_wc/install cd /tmp/plplot_wc/build echo "Configuring, building and installing the working copy of PLplot." echo "This may take a while...." cmake "-DCMAKE_INSTALL_PREFIX=/tmp/plplot_wc/install" -DDEFAULT_NO_BINDINGS=ON -DENABLE_cxx=ON -DENABLE_qt=ON -DENABLE_tcl=ON -DENABLE_tk=ON -DENABLE_wxwidgets=ON -DDEFAULT_NO_DEVICES=ON -DPLD_extqt=ON -DPLD_wxwidgets=ON $SOURCE_TREE >& cmake.out make -j4 VERBOSE=1 install >& make_install.out # Configure abi-complicance-checker configuration file for working copy install. sed -e 's?${VERSION}?'"r${WC_VERSION}?" -e 's?${PREFIX}?'"/tmp/plplot_wc/install?" -e 's?;/?\n/?g' < abi-compliance-checker.xml.template > plplot_wc.xml # Obtain tarball version number for reference. echo -n "Reference version number (5.9.6)? " read REFERENCE_VERSION if [ -z "$REFERENCE_VERSION" ] ; then REFERENCE_VERSION=5.9.6 fi echo "REFERENCE_VERSION = $REFERENCE_VERSION" # Download and gpg --verify and unpack that tarball in the /tmp directory. cd /tmp if [ ! -f plplot-$REFERENCE_VERSION.tar.gz ] ; then echo "Downloading the reference version of PLplot." echo "This may take a while...." wget -O plplot-$REFERENCE_VERSION.tar.gz "http://downloads.sourceforge.net/project/plplot/plplot/$REFERENCE_VERSION Source/plplot-$REFERENCE_VERSION.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fplplot%2Ffiles%2F&ts=1283877998&use_mirror=superb-sea2" fi if [ ! -f plplot-$REFERENCE_VERSION.tar.gz.asc ] ; then wget -O plplot-$REFERENCE_VERSION.tar.gz.asc "http://downloads.sourceforge.net/project/plplot/plplot/$REFERENCE_VERSION Source/plplot-$REFERENCE_VERSION.tar.gz.asc?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fplplot%2Ffiles%2F&ts=1283877998&use_mirror=superb-sea2" fi gpg --verify plplot-$REFERENCE_VERSION.tar.gz.asc REFERENCE_SOURCE_TREE=/tmp/plplot-$REFERENCE_VERSION rm -rf $REFERENCE_SOURCE_TREE tar zxf plplot-$REFERENCE_VERSION.tar.gz # Build C/C++ library components of reference version. rm -rf /tmp/plplot_reference mkdir -p /tmp/plplot_reference/build /tmp/plplot_reference/install cd /tmp/plplot_reference/build echo "Configuring, building and installing the reference version of PLplot." echo "This may take a while...." cmake "-DCMAKE_INSTALL_PREFIX=/tmp/plplot_reference/install" -DDEFAULT_NO_BINDINGS=ON -DENABLE_cxx=ON -DENABLE_qt=ON -DENABLE_tcl=ON -DENABLE_tk=ON -DENABLE_wxwidgets=ON -DDEFAULT_NO_DEVICES=ON -DPLD_extqt=ON -DPLD_wxwidgets=ON $REFERENCE_SOURCE_TREE >& cmake.out make -j4 VERBOSE=1 install >& make_install.out # Configure abi-complicance-checker configuration file for reference install. sed -e 's?${VERSION}?'"r${REFERENCE_VERSION}?" -e 's?${PREFIX}?'"/tmp/plplot_reference/install?" -e 's?;/?\n/?g' < /tmp/plplot_wc/build/abi-compliance-checker.xml.template > plplot_reference.xml echo "Running abi-compliance-checker.pl." echo "This may take a while...." rm -rf /tmp/abi-compliance-checker mkdir -p /tmp/abi-compliance-checker cd /tmp/abi-compliance-checker abi-compliance-checker.pl -l plplotd \ -d1 /tmp/plplot_reference/build/plplot_reference.xml \ -d2 /tmp/plplot_wc/build/plplot_wc.xml echo "N.B. the above report file(s) are in the directory $PWD" plplot-5.10.0+dfsg/scripts/make_win_package.bat 644 1750 1750 720710561466661 203750ustar andrewandrew@rem ************************************************************** @rem * This batch file create binary packages for plplot (windows) @rem * @rem * Before you run this file modify the configuration part @rem * @rem * It is assumed, that before running this batch file, that @rem * you have already passed the cmake configuration step, @rem * and have run "make" and "make install" or equivalent @rem * Usage: make_win_package VISUALC: VisualC, release build @rem * make_win_package VISUALC DEBUG : VisualC, debug build @rem * make_win_package MINGW : MinGW, release build @rem * make_win_package MINGW DEBUG : MinGW, debug build @rem ************************************************************** @rem ************************************************************** @rem * Configuration @rem ************************************************************** setlocal if "%1"=="MINGW" ( set MINGW=1 shift /1 ) if "%1"=="VISUALC" ( set MINGW=0 shift /1 ) if "%1"=="DEBUG" ( set DEBUG=d ) set VERSION=5.7.2 if "%MINGW%"=="1" ( @rem *** MINGW SETTINGS *** @rem * INSTALLDIR is the absolute path to the installed plplot directory (make install) set INSTALLDIR=Z:\DevZone\PLDev\plplot\buildmingw\local @rem * GDDLLDIR is the absolute path to bgd.dll set GDDLLDIR=Z:\DevZone\MinGW\3p_plplot\lib @rem * HPDFDLLDIR is the absolute path to libhpdf.dll set HPDFDLLDIR=Z:\DevZone\MinGW\3p_plplot\lib @rem * WXDLLDIR is the absolute path to wxwidgets dlls set WXDLLDIR=%WXWIN%\lib\gcc_dll @rem * Name of the package set PACKAGE_NAME=plplot-%VERSION%-mingw-binary ) else ( @rem *** VISUALC SETTINGS *** @rem * INSTALLDIR is the absolute path to the installed plplot directory (make install) set INSTALLDIR=Z:\DevZone\PLDev\plplot\buildnmake\local @rem * GDDLLDIR is the absolute path to bgd.dll set GDDLLDIR=Z:\DevZone\VisualC\3p_plplot\lib @rem * HPDFDLLDIR is the absolute path to libhpdf.dll set HPDFDLLDIR=Z:\DevZone\VisualC\3p_plplot\lib @rem * WXDLLDIR is the absolute path to wxwidgets dlls set WXDLLDIR=%WXWIN%\lib\vc_dll @rem * Name of the package set PACKAGE_NAME=plplot-%VERSION%-visualc-binary ) @rem ************************************************************** @rem * Create Zip package @rem * You need the zip tool for this step (gnuwin32.sf.net) @rem ************************************************************** echo Creating package %PACKAGE_NAME%.zip @rem * delete package if it already exists if exist %PACKAGE_NAME%.zip (del %PACKAGE_NAME%.zip) @rem * cd into the install directory pushd %INSTALLDIR% @rem * copy 3rd party dlls if they exist if exist %GDDLLDIR%\bgd.dll (copy %GDDLLDIR%\bgd.dll bin) if exist %HPDFDLLDIR%\libhpdf.dll (copy %HPDFDLLDIR%\libhpdf.dll bin) if %MINGW%==1 ( if exist %WXDLLDIR%\wxbase26%DEBUG%_gcc_custom.dll (copy %WXDLLDIR%\wxbase26%DEBUG%_gcc_custom.dll bin) if exist %WXDLLDIR%\wxmsw26%DEBUG%_core_gcc_custom.dll (copy %WXDLLDIR%\wxmsw26%DEBUG%_core_gcc_custom.dll bin) ) else ( if exist %WXDLLDIR%\wxbase26u%DEBUG%_vc_custom.dll (copy %WXDLLDIR%\wxbase26u%DEBUG%_vc_custom.dll bin) if exist %WXDLLDIR%\wxmsw26u%DEBUG%_core_vc_custom.dll (copy %WXDLLDIR%\wxmsw26u%DEBUG%_core_vc_custom.dll bin) ) @rem strip debug information from libraries if NOT "%DEBUG%"=="d" ( if %MINGW%==1 (strip bin\*.dll) ) @rem * create base package zip -r9 %PACKAGE_NAME%.zip *.* @rem * get back to old directory popd @rem * move package into current folder if exist %INSTALLDIR%\%PACKAGE_NAME%.zip (move %INSTALLDIR%\%PACKAGE_NAME%.zip %PACKAGE_NAME%.zip) goto end :error echo There was an error! goto :eof :end echo. echo The package %PACKAGE_NAME%.zip was created! echo. dir %PACKAGE_NAME%.zip plplot-5.10.0+dfsg/scripts/pstex2eps 755 1750 1750 2546 7544204622 162760ustar andrewandrew#!/bin/sh # Generate an Encapsulated Postscript file (eps) from the # PLplot pstex driver generated files. if test $# = "0"; then echo -e "\n\ Usage: pstex2eps \n\ \n\ Where is the name of the output file you specified\n\ with the -o option in PLplot.\n\ There must exist two files, the postscript file without text,\n\ , and the latex file with the text, .\n\ The output file will be named .\n\ \n\ The Computer Modern Type 1 fonts will be included in the output\n\ eps file. If you intent to use the plot figure in LaTeX, just\n\ use a plain \include{} in your latex file.\n" exit 1 fi if test ! -e $1 -o ! -e $1_t; then echo "$1 or $1_t don't exist. Exiting." exit 1 fi ifile=$1 ofile=`mktemp pstex2eps.XXXXXX` cat > ${ofile}.tex < /dev/null \ && dvips -Pcmz -o ${ifile}.eps $ofile 2> /dev/null rm ${ofile}* plplot-5.10.0+dfsg/scripts/test_bisect.sh 755 1750 1750 262411400771155 172730ustar andrewandrew#!/bin/sh # test script to generate an error for bisection purposes. # Expect substantial updates to this script for each new error to be # bisected. # # This particular case is used to generate the example 15 python rendering # error in the build tree. rm -rf \ /tmp/bisect_test_build_dir \ /tmp/bisect_test_install \ /tmp/bisect_test_install_build_dir mkdir \ /tmp/bisect_test_build_dir \ /tmp/bisect_test_install_build_dir SOURCE_DIR=`pwd` cd /tmp/bisect_test_build_dir cmake -DCMAKE_INSTALL_PREFIX=/tmp/bisect_test_install \ -DDEFAULT_NO_BINDINGS=ON -DDEFAULT_NO_DEVICES=ON -DBUILD_TEST=ON \ -DENABLE_tcl=ON -DENABLE_tk=ON -DPLD_xwin=ON -DPLD_tk=ON \ $SOURCE_DIR >& cmake.out #make -j4 install >& make_install.out #cd /tmp/bisect_test_install_build_dir #cmake /tmp/bisect_test_install/share/plplot5.9.5/examples >& cmake.out #make -j4 test_extXdrawable ####### #make -j4 x17c #make -j4 cairo #examples/c/x17c -dev xcairo -np ####### #make -j4 _plplotcmodule #make python_examples xwin #examples/python/x15 -dev xwin ####### # Reduce number of examples run by test_tk_standard_examples to speed everything # up. cd examples/tk patch < /tmp/speedup_patch cd ../.. make -j4 test_tk_standard_examples result= while [ "$result" != "before" -a "$result" != "after" ]; do echo -n "before/after? " read result if [ "$result" = "before" ]; then exit 0 fi if [ "$result" = "after" ]; then exit 1 fi done plplot-5.10.0+dfsg/scripts/plplot_wiki_backup.sh 755 1750 1750 205710507004110 206300ustar andrewandrew#!/bin/sh # backup http://www.miscdebris.net/plplot_wiki to a tarball. # Directory where results are temporarily stored. This directory is # destroyed both at the start and at the end. Also the tarball # $DIR.tar.gz is overwritten. So be careful what you # specify here. DIR=plplot_wiki rm -rf $DIR # Need to create the directory first if logging to a file in it. mkdir $DIR # Recurse up to 5 levels deep, don't get any html above # plplot_wiki, get the files necessary to display all pages, # convert links to the locally downloaded version, windows==> escape a long # list of characters (including question mark) from file names, # start local hierarchy at $DIR, and keep a log of the transaction in # $DIR/plplot_wiki_backup.log wget --recursive --level=5 --no-parent \ --page-requisites --convert-links \ --restrict-file-names=windows \ --no-host-directories --cut-dirs=1 \ --directory-prefix=$DIR \ -o $DIR/plplot_wiki_backup.log \ http://www.miscdebris.net/plplot_wiki # Create tarball and remove directory tree result tar zcf $DIR.tar.gz $DIR rm -rf $DIR plplot-5.10.0+dfsg/scripts/plpr 755 1750 1750 702 5640504501 152600ustar andrewandrew#!/bin/sh # # File: plpr # Usage: plpr file # # Takes the named metafile and converts it to something your # printer will understand. This will be improved later to handle # multiple printers and printer settings. Only intended for use # from the plplot/TK driver! It deletes the named metafile after # converting to the proper type so this is not suitable for # general use. # plrender -i $1 -dev ps -width 3 -o - | lpr rm $1 exit 0 plplot-5.10.0+dfsg/scripts/plm2gif 755 1750 1750 4124 5705032371 156700ustar andrewandrew#!/bin/sh ############################################################################ # # $Id: plm2gif 1443 1995-01-11 19:43:53Z mjl $ # # File: plm2gif # Usage: plm2gif [files] # # Maurice J. LeBrun (mjl@dino.ph.utexas.edu) # Institute for Fusion Studies, University of Texas # 10-Jan-95 # # Converts specified PLplot metafiles to GIF format files. This is a # two-step process: # 1. process into postscript (with custom flags) # 2. convert to GIF using ghostscript (more custom flags) # # Each input file must end with ".plm", and a corresponding family of GIF # files ending with ".gif" (one for each page) is created. # # The PLplot and ghostscript flags are chosen so that the output GIF file # plots have the correct aspect ratio. This is complicated by the need to # swap the postscript orientation into landscape mode. The GIF files # created are by default of resolution 640x480 or less. To change, modify # $res accordingly (note: Y-res must be exactly 9/16 of X-res in order for # the plots to have the correct aspect ratio). # ############################################################################ # Settings gs="gs" res="75.3x42.36" # 640 x 466 #res="94.1x52.93" # 800 x 582 # First find plrender and check version. # Have to be a bit clever here since old versions of plrender returned an # error code of 1 when passed the -v flag. plversion=`plrender -v 2>&1 | awk 'NR == 2 {print $NF}'` || { echo "How odd, don't you have awk? Aborting." exit 1 } if test -z "$plversion"; then echo "plrender not found, aborting" exit 1 fi if test `expr "$plversion" \< "4.99j"` -eq 1; then echo "Must be running PLplot version 4.99j or later" exit fi # Now find ghostscript gs_out=`$gs -v 2>&1` || { echo "ghostscript ($gs) not found, aborting" exit 1 } # Finally, process files. for arg in $* do if test -f $arg; then echo "Processing $arg.." name=`basename $arg .plm` plrender -dev psc -o $name.ps -ori 3 -freeaspect $arg >/dev/null 2>&1 $gs -sDEVICE=gif8 -r$res -sOutputFile=$name%d.gif $name.ps \ /dev/null 2>&1 fi done exit 0 plplot-5.10.0+dfsg/scripts/parity_bit_check.exclude 644 1750 1750 43411461711115 212540ustar andrewandrew\.svn ~$ \.jpg$ \.gif$ \.cgm$ \.map$ \.fnt$ x2[46] xw2[46] xthick2[46] lena README.release test_hebrew_diacritic.py test_plplot_encodings.py NEWS ChangeLog simplepie.inc qsastime.html qsastime.txt qsastime.xml README.deltaT.dat api2man.pl.in api2text.pl docbook/AUTHORS __pl_pltext.m plplot-5.10.0+dfsg/scripts/convert_comment.py 755 1750 1750 2115611464043412 202220ustar andrewandrew#!/usr/bin/env python # Programme to convert all single-line or multi-line "/* ... */" # comments to "//" form in C or C++ code. Input source code file is # stdin, output file is stdout. import sys import re # Restore default signal handling for SIGPIPE as suggested by # http://www.velocityreviews.com/forums/t332662-ioerror-errno-32-broken-pipe.html # so that stdout can be sent (unix-only) to a pipelined process that terminates # early such as cmp. import signal signal.signal(signal.SIGPIPE, signal.SIG_DFL) ifsingleline = True previous_continue = False for line in sys.stdin.readlines(): start_comment = line.find("/*") # FIXME?: the simple rules below to ignore all special strings # in a line where the first instance is quoted obviously # need generalization. However, second instances # of special strings are unlikely in practice so we will go with # this simple rule until it is proved something more is required. # Ignore all "/*" instances on a line where the first one is # quoted. if start_comment >=0 and re.search(r'^[^"]*("[^"]*"[^"]*)*"[^"]*/\*[^"]*"', line): start_comment = -1 start_special = line.find("//*") # FIXME? # Ignore all "//*" instances on a line where the first one is # quoted. if start_special >= 0 and re.search(r'^[^"]*("[^"]*"[^"]*)*"[^"]*//\*[^"]*"', line): start_special = -1 # if start_special corresponds to start_comment, then ignore start_comment # to deal with issue of recursive changes to an original line of the # form "/******..." if start_special >= 0 and start_special == start_comment -1: start_comment = -1 end_comment = line.find("*/") # FIXME? # Ignore all "*/" instances on a line where the first one is # quoted. if end_comment >= 0 and re.search(r'^[^"]*("[^"]*"[^"]*)*"[^"]*\*/[^"]*"', line): end_comment = -1 start_special = line.find("//") # FIXME? # Ignore all "//" instances on a line where the first one is # quoted. if start_special >= 0 and re.search(r'^[^"]*("[^"]*"[^"]*)*"[^"]*//[^"]*"', line): start_special = -1 # If unquoted // before /* and not in the middle of a comment block, # then ignore both /* and */ beyond //. if ifsingleline and start_special >= 0 and start_special <= start_comment -1: start_comment = -1 end_comment = -1 # Note trailing "\n" has not (yet) been removed from line so # that the next to last character is at position len(line) - 3. if end_comment >=0 and end_comment != len(line) - 3: if ifsingleline and start_comment >=0: # Skip most further processing for a line with embedded # comments outside of multiline blocks of comments. start_comment = -1 end_comment = -1 else: sys.stderr.write(line) raise RuntimeError, "Cannot interpret trailing character(s) after */ for this line" # Note trailing "\n" has not (yet) been removed from line so # that the next to last character is at position len(line) - 3. # print "start_comment = ", start_comment # print "end_comment = ", end_comment # print "start_special = ", start_special if ifsingleline: if start_comment >=0 and start_comment < end_comment and end_comment == len(line) - 3: # Single-line comment case. # Strip trailing "\n" (Unix line endings, only) since that might # cause trouble with stripping trailing white space below. # This trailing "\n" will be added back at the end of this block. line = re.sub(r'^(.*)\n$', "\\1", line) # Convert single-line comment. # \1 corresponds to zero or more leading characters before "/*". # \3 corresponds to zero or more characters between "/*" and # "*/". # N.B. preserves indentation. line = re.sub(r'^(.*)(/\*)(.*)\*/$', "\\1//\\3", line) # strip trailing white space (if any). line = line.rstrip() # Add back (Unix-only) line ending. line = line + "\n" elif end_comment >=0: sys.stderr.write(line) raise RuntimeError, "Trailing */ for a line which is not a comment" elif start_comment >=0: # Convert first line of multiline comment. # N.B. preserves indentation. line = line.replace("/*", "//", 1) ifsingleline = False else: # Case where dealing with multi-line comment. if start_comment >=0: sys.stderr.write(line) raise RuntimeError, "/* in the middle of a comment block" # strip trailing "\n" (Unix line endings, only) since that might # cause trouble with stripping trailing white space below. # This trailing "\n" will be added back at the end of this block. line = re.sub(r'^(.*)\n$', "\\1", line) if end_comment < 0: # Convert multiline comment line that is not start line # or end line of that comment. # Replace " *" after zero or more blanks (the standard form # produced by uncrustify) if it is there by "//". # N.B. preserves indentation. if re.search(r'^( *) \*', line): line = re.sub(r'^( *) \*', "\\1//", line) else: # If standard indented form not found.... line = "//" + line else: # Convert last line of multiline comment. # Try converting vacuous form (initial blanks + " */") # to initial blanks (if any) + "//". # This consumes the blank in " */" that is customary as # the last line of a multi-line block. # N.B. preserves indentation. # \1 contains the initial blanks if re.search(r'^( *) \*/$', line): line = re.sub(r'^( *) \*/$', "\\1//", line) # Try converting non-vacuous standard form produced by # uncrustify (initial blanks + " *" + any string + "*/") # to initial blanks + "//" + any string. # N.B. preserves indentation. # \1 contains the initial blanks # \2 contains the "any" string preceding "*/". elif re.search(r'^( *) \*(.*)\*/$', line): line = re.sub(r'^( *) \*(.*)\*/$', "\\1//\\2", line) # If all previous conversion attempts failed.... # N.B. Does not preserve indentation. else: line = re.sub(r'^(.*)\*/$', "//\\1", line) # strip trailing white space (if any). line = line.rstrip() ifsingleline = True # Add back (Unix-only) line ending. line = line + "\n" # If previous comment continuation exists, check whether it is # valid, i.e., whether it is followed by another line consisting # zero or more blanks followed by a comment. if previous_continue: if re.search(r'^ *//', line): previous_continue = False else: sys.stderr.write(line_old) sys.stderr.write(line) raise RuntimeError, "Comment continuation not allowed unless next line is a comment" # End with some special processing for all lines which previously # or now include "//". start_special = line.find("//") if start_special >= 0: # Special transforms to get rid of left-over "\*" and "*\" # forms which have historically been used to frame # multi-block comments by some PLplot developers. # Replace leading "// \*" ==> "//" line = re.sub(r'^// \\\*(.*)$', "//\\1", line) # Remove "*\" from end of comment lines line = re.sub(r'^//(.*)\*\\$', "//\\1", line) # Convert long "horizontal line" comment forms to standard form. line = re.sub(r'^// *[-*=/+_\\# ]{50,200}$', "//--------------------------------------------------------------------------", line) # Look for trailing continuation after comment lines and # complain if you find any. start_special = line.rfind("\\") # Note line has trailing "\n" so that the last character # is at position len(line) - 2. if start_special >=0 and start_special == len(line) -2: # Strings are immutable so this is a copy not a reference. line_old = line previous_continue = True sys.stdout.write(line) if not ifsingleline: sys.stderr.write(line) raise RuntimeError, "Last line of file leaves unterminated comment block." if previous_continue: sys.stderr.write(line_old) raise RuntimeError, "Last line of file is a continued comment." sys.exit() plplot-5.10.0+dfsg/scripts/make_tarball.sh 755 1750 1750 1112312222220673 174100ustar andrewandrew#!/bin/bash # This will prepare a distribution tarball directly from the svn sources of # the PLplot project. # CAVEAT: this script silently and completely deletes a directory called # /tmp/plplot-dist-prep # Copyright (C) 2003, 2004 Rafael Laboissiere # Copyright (C) 2006, 2013 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # $Id: make_tarball.sh 12554 2013-09-30 07:01:15Z airwin $ usage () { local prog=`basename $0` echo "Usage: $prog [-n] \\" echo " [-c [-i prefix] [-o cmake options]] \\" echo " $prog -d" echo " $prog -h" echo echo "Option -n prevents pre-building anything including the DocBook manual." echo "When option -c is given, the generated tarball is" echo " unpacked, configured with cmake and built with make, and" echo " the ctest (build-tree tests) is run afterward." echo " If the -i prefix option is specified in addition to -c," echo " the configuration is done with the specified install prefix" echo " and make install is run after ctest." echo " WARNING: the prefix directory is completely removed before the" echo " install so be careful what you specify for the -i option." echo " If the -o cmake options option is specified in addition to -c," echo " those options are used for the configuration of the unpacked" echo " tarball." echo "Option -d prints the default values." echo "Option -h prints this usage information." exit $1 } DOC_ARG=${DOC_ARG:--DBUILD_DOC=ON} # Just easier to always keep this temporary directory in the same location SVNTMPDIR=/tmp/plplot-dist-prep # Put here extra cmake options that should always be used when # generating a tarball config_opt="" # Put here extra make options # Parallel builds for extra speed on multiprocessing boxes make_opt="-j3" print_defaults () { local v for v in DOC_ARG SVN_URL ; do eval "echo $v=\\\"\$$v\\\"" done exit 0 } do_check=no prefix="" PREBUILD_ARG="-DPREBUILD_DIST=ON" PREBUILT_DOC_ARG="-DPREBUILT_DOC=ON" do_prebuild_dist=yes while getopts "cdhi:no:u:" option do case $option in c) do_check=yes ;; d) print_defaults ;; h) usage 0 ;; i) test -n "$OPTARG" || usage 1 ; prefix=$OPTARG ;; n) DOC_ARG=;PREBUILD_ARG=;PREBUILT_DOC_ARG=;do_prebuild_dist=no ;; o) config_opt="$config_opt $OPTARG" ;; *) usage 1 ;; esac done cleanup ( ) { rm -rf $SVNTMPDIR } # Find absolute PATH of script without using readlink (since readlink is # not available on all platforms). Followed advice at # http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/ ORIGINAL_PATH="$(pwd)" cd "$(dirname $0)" # Absolute Path of the script SCRIPT_PATH="$(pwd)" cd "${ORIGINAL_PATH}" # Assumption: top-level source tree is parent directory of where script # is located. SOURCE_TREE="$(dirname ${SCRIPT_PATH})" cleanup mkdir $SVNTMPDIR cd $SVNTMPDIR svn export $SOURCE_TREE plplot \ && mkdir build_dir \ && cd build_dir \ && cmake -DCMAKE_VERBOSE_MAKEFILE=ON \ ${PREBUILD_ARG} ${DOC_ARG} -DBUILD_DOX_DOC=ON \ ../plplot >& cmake.out \ && echo "Making distribution." \ && (if [ "$do_prebuild_dist" = "yes" ] ; then make ${make_opt} prebuild_dist >& make_prebuild_dist.out fi) \ && make ${make_opt} package_source >& make_package_source.out \ && TARBALL=`ls plplot-*.tar.gz` \ && DISTDIR=`echo $TARBALL | sed s/.tar.gz//` \ && mv $TARBALL .. \ && cd .. \ && echo "distribution tarball: $TARBALL" \ && test "$do_check" = "yes" \ && tar xfz $TARBALL \ && mkdir ctest_build_dir \ && ( cd ctest_build_dir \ && cmake ${config_opt} -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ -DCMAKE_VERBOSE_MAKEFILE=ON ${PREBUILT_DOC_ARG} -DBUILD_DOX_DOC=ON \ -DBUILD_TEST=ON \ ../plplot >& cmake.out \ && make ${make_opt} >& make.out \ && ctest >& ctest.out \ && test -n "$prefix" \ && rm -rf ${prefix} \ && make ${make_opt} install >& make_install.out ) plplot-5.10.0+dfsg/scripts/comprehensive_test.sh 755 1750 1750 4320412276240556 207200ustar andrewandrew#!/bin/bash # Complete tests of PLplot for the three generic build types which # consist of shared+dynamic, shared+nondynanic, and # static+nondynamic. These complete tests that are run for each build # type are (I) ctest, test_noninteractive, and test_interactive in # build tree; (II) traditional [Makefile+pkg-config] # test_noninteractive and test_interactive of installed examples; and # (III) CMake-based test_noninteractive and test_interactive of # installed examples. comprehensive_test () { CMAKE_BUILD_TYPE_OPTION=$1 echo " Running comprehensive_test function with the following variables set: The variables below are key CMake options which determine the entire kind of build that will be tested. CMAKE_BUILD_TYPE_OPTION = $CMAKE_BUILD_TYPE_OPTION The location below is where all the important *.out files will be found. OUTPUT_TREE = $OUTPUT_TREE The location below is the top-level build-tree directory. BUILD_TREE = $BUILD_TREE The location below is the top-level install-tree directory. INSTALL_TREE = $INSTALL_TREE The location below is the top-level directory of the build tree used for the CMake-based build and test of the installed examples. INSTALL_BUILD_TREE = $INSTALL_BUILD_TREE Each of the steps in this comprehensive test may take a while...." PATH_SAVE=$PATH if [ "$generator_string" = "MinGW Makefiles" -o "$generator_string" = "MSYS Makefiles" ] ; then MINGW_OR_MSYS="true" else MINGW_OR_MSYS="false" fi mkdir -p "$OUTPUT_TREE" rm -rf "$BUILD_TREE" mkdir -p "$BUILD_TREE" cd "$BUILD_TREE" if [ "$do_ctest" = "yes" -o "$do_test_build_tree" = "yes" ] ; then BUILD_TEST_OPTION="-DBUILD_TEST=ON" else BUILD_TEST_OPTION="" fi output="$OUTPUT_TREE"/cmake.out rm -f "$output" if [ "$CMAKE_BUILD_TYPE_OPTION" != "-DBUILD_SHARED_LIBS=OFF" -a "$MINGW_OR_MSYS" = "true" ] ; then echo "Prepend $BUILD_TREE/dll to the original PATH" PATH=$BUILD_TREE/dll:$PATH_SAVE fi # Process $cmake_added_options into $* to be used on the cmake command # line below. set -- $cmake_added_options echo "cmake in the build tree" cmake "-DCMAKE_INSTALL_PREFIX=$INSTALL_TREE" $BUILD_TEST_OPTION \ $* $CMAKE_BUILD_TYPE_OPTION -G "$generator_string" \ "$SOURCE_TREE" >& "$output" cmake_rc=$? if [ "$cmake_rc" -ne 0 ] ; then echo "ERROR: cmake in the build tree failed" exit 1 fi if [ "$do_ctest" = "yes" ] ; then output="$OUTPUT_TREE"/make.out rm -f "$output" echo "$build_command VERBOSE=1 in the build tree" $build_command VERBOSE=1 >& "$output" make_rc=$? if [ "$make_rc" -eq 0 ] ; then output="$OUTPUT_TREE"/ctest.out rm -f "$output" echo "$ctest_command in the build tree" $ctest_command --extra-verbose >& "$output" ctest_rc=$? if [ "$ctest_rc" -eq 0 ] ; then if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/clean_ctest_plot_files.out rm -f "$output" echo "$build_command clean_ctest_plot_files in the build tree (since we are done with ctest)" $build_command clean_ctest_plot_files >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command clean_ctest_plot_files failed in the build tree" exit 1 fi fi else echo "ERROR: $ctest_command failed in the build tree" exit 1 fi else echo "ERROR: $build_command failed in the build tree" exit 1 fi fi if [ "$do_test_build_tree" = "yes" -a "$do_test_noninteractive" = "yes" ] ; then output="$OUTPUT_TREE"/make_noninteractive.out rm -f "$output" echo "$build_command VERBOSE=1 test_noninteractive in the build tree" $build_command VERBOSE=1 test_noninteractive >& "$output" make_test_noninteractive_rc=$? if [ "$make_test_noninteractive_rc" -ne 0 ] ; then echo "ERROR: $build_command test_noninteractive failed in the build tree" exit 1 fi fi if [ "$do_test_install_tree" = "yes" -o \ "$do_test_traditional_install_tree" = "yes" ] ; then rm -rf "$INSTALL_TREE" output="$OUTPUT_TREE"/make_install.out rm -f "$output" echo "$build_command VERBOSE=1 install in the build tree" $build_command VERBOSE=1 install >& "$output" make_install_rc=$? if [ "$make_install_rc" -ne 0 ] ; then echo "ERROR: $build_command install failed in the build tree" exit 1 fi fi if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/clean.out rm -f "$output" echo "$build_command clean in the build tree (since we are done with it at least for the non-interactive test case)" $build_command clean >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command clean failed in the build tree" exit 1 fi fi if [ "$do_test_install_tree" = "yes" -o \ "$do_test_traditional_install_tree" = "yes" ] ; then echo "Prepend $INSTALL_TREE/bin to the original PATH" PATH="$INSTALL_TREE/bin":$PATH_SAVE if [ "$CMAKE_BUILD_TYPE_OPTION" = "-DBUILD_SHARED_LIBS=ON" -a "$MINGW_OR_MSYS" = "true" ] ; then # Use this logic to be as version-independent as possible. current_dir=$(pwd) # Wild cards must not be inside quotes. cd "$INSTALL_TREE"/lib/plplot[0-9].[0-9]*.[0-9]*/drivers* echo "Prepend $(pwd) to the current PATH" PATH="$(pwd):$PATH" cd $current_dir fi if [ "$do_test_install_tree" = "yes" ] ; then rm -rf "$INSTALL_BUILD_TREE" mkdir -p "$INSTALL_BUILD_TREE" cd "$INSTALL_BUILD_TREE" output="$OUTPUT_TREE"/installed_cmake.out rm -f "$output" echo "cmake in the installed examples build tree" cmake -G "$generator_string" "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples >& "$output" if [ "$do_test_noninteractive" = "yes" ] ; then output="$OUTPUT_TREE"/installed_make_noninteractive.out rm -f "$output" echo "$build_command VERBOSE=1 test_noninteractive in the installed examples build tree" $build_command VERBOSE=1 test_noninteractive >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command test_noninteractive failed in the installed examples build tree" exit 1 fi if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/installed_clean.out rm -f "$output" echo "$build_command clean in the installed examples build tree (since we are done with it at least for the non-interactive test case)" $build_command clean >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command clean failed in the installed examples build tree" exit 1 fi fi fi fi if [ "$do_test_traditional_install_tree" = "yes" -a "$do_test_noninteractive" = "yes" ] ; then cd "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples output="$OUTPUT_TREE"/traditional_make_noninteractive.out rm -f "$output" echo "Traditional $build_command test_noninteractive in the installed examples tree" $build_command test_noninteractive >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: Traditional $build_command test_noninteractive failed in the installed examples tree" exit 1 fi if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/traditional_clean.out rm -f "$output" echo "Traditional $build_command clean in the installed examples tree (since we are done with it at least for the non-interactive test case)" $build_command clean >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: Traditional $build_command clean failed in the installed examples tree" exit 1 fi fi fi fi if [ "$do_test_interactive" = "yes" ] ; then if [ "$do_test_build_tree" = "yes" ] ; then if [ "$CMAKE_BUILD_TYPE_OPTION" != "-DBUILD_SHARED_LIBS=OFF" -a "$MINGW_OR_MSYS" = "true" ] ; then echo "Prepend $BUILD_TREE/dll to the original PATH" PATH=$BUILD_TREE/dll:$PATH_SAVE fi cd "$BUILD_TREE" output="$OUTPUT_TREE"/make_interactive.out rm -f "$output" echo "$build_command VERBOSE=1 test_interactive in the build tree" $build_command VERBOSE=1 test_interactive >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command test_interactive failed in the build tree" exit 1 fi fi if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/clean.out rm -f "$output" echo "$build_command clean in the build tree (since we are done with it)" $build_command clean >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command clean failed in the build tree" exit 1 fi fi echo "Prepend $INSTALL_TREE/bin to the original PATH" PATH="$INSTALL_TREE/bin":$PATH_SAVE if [ "$CMAKE_BUILD_TYPE_OPTION" = "-DBUILD_SHARED_LIBS=ON" -a "$MINGW_OR_MSYS" = "true" ] ; then # Use this logic to be as version-independent as possible. current_dir=$(pwd) # Wild cards must not be inside quotes. cd "$INSTALL_TREE"/lib/plplot[0-9].[0-9]*.[0-9]*/drivers* echo "Prepend $(pwd) to the current PATH" PATH="$(pwd):$PATH" cd $current_dir fi if [ "$do_test_install_tree" = "yes" ] ; then cd "$INSTALL_BUILD_TREE" output="$OUTPUT_TREE"/installed_make_interactive.out rm -f "$output" echo "$build_command VERBOSE=1 test_interactive in the installed examples build tree" $build_command VERBOSE=1 test_interactive >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command test_interactive failed in the installed examples build tree" exit 1 fi if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/installed_clean.out rm -f "$output" echo "$build_command clean in the installed examples build tree (since we are done with it)" $build_command clean >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: $build_command clean failed in the installed examples build tree" exit 1 fi fi fi if [ "$do_test_traditional_install_tree" = "yes" ] ; then cd "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples output="$OUTPUT_TREE"/traditional_make_interactive.out rm -f "$output" echo "Traditional $build_command test_interactive in the installed examples tree" $build_command test_interactive >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: Traditional $build_command test_interactive failed in the installed exaples tree" exit 1 fi if [ "$do_clean_as_you_go" = "yes" ] ; then output="$OUTPUT_TREE"/traditional_clean.out rm -f "$output" echo "Traditional $build_command clean in the installed examples tree (since we are done with it)" $build_command clean >& "$output" make_rc=$? if [ "$make_rc" -ne 0 ] ; then echo "ERROR: Traditional $build_command clean failed in the installed examples tree" exit 1 fi fi fi fi echo "Restore PATH to the original PATH" PATH=$PATH_SAVE } usage () { local prog=`basename $0` echo "Usage: $prog [OPTIONS] OPTIONS: The next option specifies the directory prefix which controls where all files produced by this script are located. [--prefix (defaults to the 'comprehensive_test_disposeable' subdirectory of the top-level source-tree directory)] The next option controls whether the script runs clean to get rid of file results and save disk space after the tests are completed. This option is highly recommended to greatly reduce the the disk usage (which can be as large as 40GB [!] without this option). [--do_clean_as_you_go (yes/no, defaults to yes)] The next four control how the builds and tests are done. [--generator_string (defaults to 'Unix Makefiles')] [--ctest_command (defaults to 'ctest -j8')] [--build_command (defaults to 'make -j8')] The next four control what kind of builds and tests are done. [--cmake_added_options (defaults to none, but can be used to specify any combination of white-space-separated cmake options to, e.g., refine what parts of the PLplot software are built and tested)] [--do_shared (yes/no, defaults to yes)] [--do_nondynamic (yes/no, defaults to yes)] [--do_static (yes/no, defaults to yes)] The next six control which of seven kinds of tests are done for each kind of build. [--do_ctest (yes/no, defaults to yes)] [--do_test_noninteractive (yes/no, defaults to yes)] [--do_test_interactive (yes/no, defaults to yes)] [--do_test_build_tree (yes/no, defaults to yes)] [--do_test_install_tree (yes/no, defaults to yes)] [--do_test_traditional_install_tree (yes/no, defaults to yes)] [--help] Show this message. " if [ $1 -ne 0 ]; then exit $1 fi } # Find absolute PATH of script without using readlink (since readlink is # not available on all platforms). Followed advice at # http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/ ORIGINAL_PATH="$(pwd)" cd "$(dirname $0)" # Absolute Path of the script SCRIPT_PATH="$(pwd)" cd "${ORIGINAL_PATH}" # Assumption: top-level source tree is parent directory of where script # is located. SOURCE_TREE="$(dirname ${SCRIPT_PATH})" # This is the parent tree for the BUILD_TREE, INSTALL_TREE, # INSTALL_BUILD_TREE, and OUTPUT_TREE. It is disposable. # Default values for options prefix="${SOURCE_TREE}/../comprehensive_test_disposeable" do_clean_as_you_go=yes generator_string="Unix Makefiles" ctest_command="ctest -j8" build_command="make -j8" cmake_added_options= do_shared=yes do_nondynamic=yes do_static=yes do_ctest=yes do_test_noninteractive=yes do_test_interactive=yes do_test_build_tree=yes do_test_install_tree=yes do_test_traditional_install_tree=yes usage_reported=0 while test $# -gt 0; do case $1 in --prefix) prefix=$2 shift ;; --do_clean_as_you_go) case $2 in yes|no) do_clean_as_you_go=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --generator_string) generator_string=$2 shift ;; --ctest_command) ctest_command=$2 shift ;; --build_command) build_command=$2 shift ;; --cmake_added_options) cmake_added_options=$2 shift ;; --do_shared) case $2 in yes|no) do_shared=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_nondynamic) case $2 in yes|no) do_nondynamic=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_static) case $2 in yes|no) do_static=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_ctest) case $2 in yes|no) do_ctest=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_test_noninteractive) case $2 in yes|no) do_test_noninteractive=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_test_interactive) case $2 in yes|no) do_test_interactive=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_test_build_tree) case $2 in yes|no) do_test_build_tree=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_test_install_tree) case $2 in yes|no) do_test_install_tree=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --do_test_traditional_install_tree) case $2 in yes|no) do_test_traditional_install_tree=$2 shift ;; *) usage 1 1>&2 ;; esac ;; --help) usage 0 1>&2 exit 0; ;; *) if [ $usage_reported -eq 0 ]; then usage_reported=1 usage 0 1>&2 echo " " fi echo "Unknown option: $1" ;; esac shift done if [ $usage_reported -eq 1 ]; then exit 1 fi echo "Summary of options used for these tests prefix=$prefix do_clean_as_you_go=$do_clean_as_you_go generator_string=$generator_string" echo " ctest_command=$ctest_command build_command=$build_command cmake_added_options=$cmake_added_options do_shared=$do_shared do_nondynamic=$do_nondynamic do_static=$do_static do_ctest=$do_ctest do_test_noninteractive=$do_test_noninteractive do_test_interactive=$do_test_interactive do_test_build_tree=$do_test_build_tree do_test_install_tree=$do_test_install_tree do_test_traditional_install_tree=$do_test_traditional_install_tree N.B. do_clean_as_you_go above should be yes unless you don't mind an accumulation of ~40GB of plot files! Even with this option set to yes the high-water mark of disk usage can still be as high as 4GB so be sure you have enough free disk space to run this test! " ANSWER= while [ "$ANSWER" != "yes" -a "$ANSWER" != "no" ] ; do echo -n "Continue (yes/no)? " read ANSWER done if [ "$ANSWER" = "no" ] ; then echo "Immediate exit specified!" exit fi # Shared + dynamic if [ "$do_shared" = "yes" ] ; then OUTPUT_TREE="$prefix/shared/output_tree" BUILD_TREE="$prefix/shared/build_tree" INSTALL_TREE="$prefix/shared/install_tree" INSTALL_BUILD_TREE="$prefix/shared/install_build_tree" comprehensive_test "-DBUILD_SHARED_LIBS=ON" fi # Shared + nondynamic if [ "$do_nondynamic" = "yes" ] ; then OUTPUT_TREE="$prefix/nondynamic/output_tree" BUILD_TREE="$prefix/nondynamic/build_tree" INSTALL_TREE="$prefix/nondynamic/install_tree" INSTALL_BUILD_TREE="$prefix/nondynamic/install_build_tree" comprehensive_test "-DBUILD_SHARED_LIBS=ON -DENABLE_DYNDRIVERS=OFF" fi if [ "$do_static" = "yes" ] ; then # Static + nondynamic OUTPUT_TREE="$prefix/static/output_tree" BUILD_TREE="$prefix/static/build_tree" INSTALL_TREE="$prefix/static/install_tree" INSTALL_BUILD_TREE="$prefix/static/install_build_tree" comprehensive_test "-DBUILD_SHARED_LIBS=OFF" fi plplot-5.10.0+dfsg/rpm/ 775 1750 1750 012406243570 134535ustar andrewandrewplplot-5.10.0+dfsg/rpm/plplot_mandrake8.0.spec 644 1750 1750 15112 7320613574 200130ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/plplot # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. Summary: PLPlot 2D/3D plotting library Packager: Conrad Steenberg Name: plplot Version: 5.0.4 Release: 3mdk Source0: http://prdownloads.sourceforge.net/plplot/plplot-5.0.4.tar.gz URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Applications/Math requires: python >= 1.5.2, python-numeric >= 15.3 %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. Notes on the plplot configuration underlying this package for the Mandrake build environment: (i) We use --with-double=yes to give double precision. (ii) A large number of drivers are configured by default including tk, ps, psc, png, jpeg, and we also explicitly configure --enable-gnome to include the experimental gnome driver. (iii) We explicitly configure --disable-octave, because octave is not part of the default distribution. (iv) Languages supported are c, c++, fortran 77, python, and tcl. All these packages are standard on Mandrake 8.0. The full configure output is as follows: with_shlib: yes with_double: yes with_debug: no with_opt: yes with_warn: no with_profile: no with_gcc: yes with_rpath: yes enable_xwin: yes enable_tcl: yes enable_tk: yes enable_itcl: no enable_cxx: yes enable_python: yes enable_f77: yes enable_gnome: yes enable_octave: no %prep %setup make configure PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'` export PYTHON_INC_DIR=/usr/include/python${PY_VERSION}/ echo PYTHON_INC_DIR=${PYTHON_INC_DIR} export PYTHON_MOD_DIR=/usr/lib/python${PY_VERSION}/ export PYTHON_CFG_DIR=${PYTHON_MOD_DIR}/config export PYTHON_NUM_DIR=${PYTHON_INC_DIR}/Numeric/ export PYTHON_MACH_DIR=${PYTHON_MOD_DIR}/site-packages export PYTHON_DIR=${PYTHON_MACH_DIR} ./configure --prefix=/usr --with-double --disable-octave --enable-gnome --enable-python --enable-tcl --disable-itcl %build make %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/plplot # The PREFIX value makes this package relocatable. So all compilation was # done with --prefix=/usr, but the install occurs to PREFIX (temporarily) # until the binary rpm is put together. make install PREFIX=$RPM_BUILD_ROOT/usr # hack to get rid of these non-working examples (that screw things up in any # case because they start with #!/usr/local/bin/python which adds a wrong # dependency) rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/tutor.py rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/x??.py # install extra documentation cd doc gzip plplotdoc*.dvi cp plplotdoc*gz index.html $RPM_BUILD_ROOT/usr/share/doc/plplot gunzip plplotdoc*.dvi.gz pushd $RPM_BUILD_ROOT/usr/share/doc/plplot # * stands for version number of plplotdoc. tar zxf plplotdoc-html-*.tar.gz rm $RPM_BUILD_ROOT/usr/share/doc/plplot/plplotdoc-html-*.tar.gz popd # install info stuff. This is the correct place for RH 6.2, but may not # be the preferred location for modern distributions. install -m 755 -d $RPM_BUILD_ROOT/usr/share/info # * stands for version number of plplotdoc. tar zxf plplotdoc-info-*.tar.gz rm $RPM_BUILD_ROOT/usr/share/doc/plplot/plplotdoc-info-*.tar.gz bzip2 plplotdoc-info-*/* cp plplotdoc-info-*/* $RPM_BUILD_ROOT/usr/share/info # make sure can redo this script in case of --short-circuit rm -f plplotdoc-info-*/* # install man pages install -m 755 -d $RPM_BUILD_ROOT/usr/man/man1 cp plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 $RPM_BUILD_ROOT/usr/man/man1 pushd $RPM_BUILD_ROOT/usr/man/man1 bzip2 plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 popd tar zxf plplotdoc-man-*.tar.gz rm $RPM_BUILD_ROOT/usr/share/doc/plplot/plplotdoc-man-*.tar.gz bzip2 plplotdoc-man-*/* install -m 755 -d $RPM_BUILD_ROOT/usr/man/man3 cp plplotdoc-man-*/*.bz2 $RPM_BUILD_ROOT/usr/man/man3 # make sure can redo this script in case of --short-circuit rm -f plplotdoc-man-*/* cd .. %post /sbin/ldconfig /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." /usr/share/info/plplotdoc.info.bz2 /usr/share/info/dir %preun if [ $1 = 0 ]; then /sbin/install-info --delete /usr/share/info/plplotdoc.info.bz2 /usr/share/info/dir fi %postun /sbin/ldconfig %files # doc plus examples (for now) %attr(-, root, root) %doc /usr/share/doc/plplot %attr(-, root, root) %doc /usr/man/man1/plm2gif.1.bz2 %attr(-, root, root) %doc /usr/man/man1/plpr.1.bz2 %attr(-, root, root) %doc /usr/man/man1/plrender.1.bz2 %attr(-, root, root) %doc /usr/man/man1/plserver.1.bz2 %attr(-, root, root) %doc /usr/man/man1/pltcl.1.bz2 %attr(-, root, root) %doc /usr/man/man1/pltek.1.bz2 %attr(-, root, root) %doc /usr/man/man3/*.3plplot.bz2 # octave support files for Plplot. #N.A. on Mdk8.0%attr(-, root, root) /usr/share/plplot-octave # python module %attr(-, root, root) /usr/lib/python*/site-packages/plmodule.so # fonts and maps %attr(-, root, root) /usr/lib/plplot5.0.4 # info files %attr(-, root, root) /usr/share/info/plplotdoc.info*.bz2 # headers %attr(-, root, root) /usr/include/plplot # executables %attr(-, root, root) /usr/bin/plm2gif %attr(-, root, root) /usr/bin/plplot-config %attr(-, root, root) /usr/bin/plpr %attr(-, root, root) /usr/bin/plrender %attr(-, root, root) /usr/bin/plserver %attr(-, root, root) /usr/bin/pltcl %attr(-, root, root) /usr/bin/pltek %attr(-, root, root) /usr/bin/pstex2eps # libraries %attr(-, root, root) /usr/lib/libplcxxd.* %attr(-, root, root) /usr/lib/libplplotd.* %attr(-, root, root) /usr/lib/libtclmatrixd.* plplot-5.10.0+dfsg/rpm/plplot_redhat7.2.spec 644 1750 1750 16763 7461073173 175170ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/plplot # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. %define version 5.1.0 %define rpmversion 1rh7.2 Summary: PLPlot 2D/3D plotting library Packager: Alan W. Irwin Name: plplot Version: %{version} Release: %{rpmversion} Source0: http://prdownloads.sourceforge.net/plplot/plplot-%{version}.tar.gz URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Applications/Math requires: python >= 1.5.2-30, python-numpy >= 15.3, octave >= 2.1.34, matwrap >= 0.57 %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. Notes on the plplot configuration underlying this package for the RH 7.2 build environment: (i) We use --with-double --enable-dyndrivers --enable-gnome --enable-ntk --disable-linuxvga to give double precision, dynamic drivers, and the experimental gnome and ntp drivers. We exclude the linuxvga driver because the contributed RedHat svgalib rpm is so outdated (1999), and it is not clear it will even work for RH 7.2. We do not enable java. (ii) In addition, a large number of drivers are configured by default including tk, ps, psc, png and jpeg. (iii) The supported front ends are c, c++, fortran 77, python (with numpy), tcl/tk, and octave. The octave front end requires installation of the matwrap rpm (available at http://prdownloads.sourceforge.net/plplot/) The configuration summary is as follows: CC: gcc -c -O LDC: gcc CXX: g++ -c -O LDCXX: g++ F77: f77 -c -O LDF: f77 INCS: -I. -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -I/usr/include -I/usr/lib/gnome-libs/include LIBS: -litk -ltk8.3 -litcl -ltcl8.3 -L/usr/X11R6/lib -lX11 -ldl -lm -lg2c LIB_TAG: d devices: plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit conex vlt versaterm dg300 png jpeg ps psc xfig ljii hp7470 hp7580 lj_hpgl ljiip imp xwin tk pbm gnome pstex ntk Available device drivers static: xwin tk dynamic: plmeta null tek dg300 gd ps xfig ljii hpgl ljiip impress pbm gnome pstex ntk with_shlib: yes with_double: yes with_debug: no with_opt: yes with_warn: no with_profile: no with_gcc: yes with_rpath: yes enable_xwin: yes enable_tcl: yes enable_tk: yes enable_itcl: yes enable_cxx: yes enable_python: yes enable_f77: yes enable_java: no enable_octave: yes enable_gnome: yes %prep %setup make configure PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'` export PYTHON_INC_DIR=/usr/include/python${PY_VERSION}/ echo PYTHON_INC_DIR=${PYTHON_INC_DIR} export PYTHON_MOD_DIR=/usr/lib/python${PY_VERSION}/ export PYTHON_CFG_DIR=${PYTHON_MOD_DIR}/config export PYTHON_NUM_DIR=${PYTHON_INC_DIR}/Numeric/ export PYTHON_MACH_DIR=${PYTHON_MOD_DIR}/site-packages export PYTHON_DIR=${PYTHON_MACH_DIR} ./configure --prefix=/usr --with-double --enable-dyndrivers --enable-gnome --enable-ntk --disable-linuxvga %build make %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/plplot # The PREFIX value makes this package relocatable. So all compilation was # done with --prefix=/usr, but the install occurs to PREFIX (temporarily) # until the binary rpm is put together. make install PREFIX=$RPM_BUILD_ROOT/usr # hack to get rid of these non-working examples (that screw things up in any # case because they start with #!/usr/local/bin/python which adds a wrong # dependency) rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/tutor.py rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/x??.py # install extra documentation cd doc cp plplotdoc*.gz plplotdoc*.dvi index.html $RPM_BUILD_ROOT/usr/share/doc/plplot pushd $RPM_BUILD_ROOT/usr/share/doc/plplot # * stands for version number of plplotdoc. tar zxf plplotdoc-html-*.tar.gz popd # install info stuff. install -m 755 -d $RPM_BUILD_ROOT/usr/share/info # * stands for version number of plplotdoc. tar zxf plplotdoc-info-*.tar.gz gzip plplotdoc-info-*/* cp plplotdoc-info-*/* $RPM_BUILD_ROOT/usr/share/info # make sure can redo this script in case of --short-circuit rm -f plplotdoc-info-*/* # install man pages install -m 755 -d $RPM_BUILD_ROOT/usr/share/man/man1 cp plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 $RPM_BUILD_ROOT/usr/share/man/man1 pushd $RPM_BUILD_ROOT/usr/share/man/man1 gzip plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 popd tar zxf plplotdoc-man-*.tar.gz gzip plplotdoc-man-*/* install -m 755 -d $RPM_BUILD_ROOT/usr/share/man/man3 cp plplotdoc-man-*/*.gz $RPM_BUILD_ROOT/usr/share/man/man3 # make sure can redo this script in case of --short-circuit rm -f plplotdoc-man-*/* cd .. %post /sbin/ldconfig /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." /usr/share/info/plplotdoc.info.gz /usr/share/info/dir %preun if [ $1 = 0 ]; then /sbin/install-info --delete /usr/share/info/plplotdoc.info.gz /usr/share/info/dir fi %postun /sbin/ldconfig %files # doc %attr(-, root, root) %doc /usr/share/doc/plplot %attr(-, root, root) %doc /usr/share/man/man1/plm2gif.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plpr.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plrender.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plserver.1.gz %attr(-, root, root) %doc /usr/share/man/man1/pltcl.1.gz %attr(-, root, root) %doc /usr/share/man/man1/pltek.1.gz %attr(-, root, root) %doc /usr/share/man/man3/*.3plplot.gz # octave support files for Plplot. %attr(-, root, root) /usr/share/plplot_octave # python modules %attr(-, root, root) /usr/lib/python*/site-packages/plmodule.so %attr(-, root, root) /usr/lib/python*/site-packages/pyqt_plmodule.so # fonts, maps, tcl data, dyndrivers, and examples %attr(-, root, root) /usr/lib/plplot%{version} # info files %attr(-, root, root) /usr/share/info/plplotdoc.info*.gz # headers %attr(-, root, root) /usr/include/plplot # executables %attr(-, root, root) /usr/bin/plm2gif %attr(-, root, root) /usr/bin/plplot-config %attr(-, root, root) /usr/bin/plpr %attr(-, root, root) /usr/bin/plrender %attr(-, root, root) /usr/bin/plserver %attr(-, root, root) /usr/bin/pltcl %attr(-, root, root) /usr/bin/pltek %attr(-, root, root) /usr/bin/pstex2eps # libraries %attr(-, root, root) /usr/lib/libplcxxd.* %attr(-, root, root) /usr/lib/libplplotd.* %attr(-, root, root) /usr/lib/libtclmatrixd.* plplot-5.10.0+dfsg/rpm/plplot_mandrake8.1.spec 644 1750 1750 15526 7426352413 200240ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/plplot # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. %define version 5.1.0 %define rpmversion 1mdk Summary: PLPlot 2D/3D plotting library Packager: Conrad Steenberg Name: plplot Version: %{version} Release: %{rpmversion} Source0: http://prdownloads.sourceforge.net/plplot/plplot-%{version}.tar.gz URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Applications/Math requires: python >= 2.1.1, python-numeric >= 20.1.0 %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. Notes on the plplot configuration underlying this package for the Mandrake build environment: (i) We use --with-double --enable-dyndrivers --enable-gnome --enable-ntk to give double precision, dynamic drivers, and the experimental gnome and ntp drivers. We do not enable java. (ii) A large number of drivers are configured by default including tk, ps, psc, png, and jpeg. (iii) We explicitly configure --disable-octave, because octave is not part of the default distribution. (iv) Languages supported are c, c++, fortran 77, python, and tcl. All these packages are standard on Mandrake 8.1. The full configure output is as follows: Available device drivers static: xwin tk dynamic: plmeta null tek linuxvga dg300 gd ps xfig ljii hpgl ljiip impress pbm gnome pstex ntk with_shlib: yes with_double: yes with_debug: no with_opt: yes with_warn: no with_profile: no with_gcc: yes with_rpath: yes enable_xwin: yes enable_tcl: yes enable_tk: yes enable_itcl: no enable_cxx: yes enable_python: yes enable_f77: yes enable_java: no enable_octave: no enable_gnome: yes %prep %setup make configure PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'` export PYTHON_INC_DIR=/usr/include/python${PY_VERSION}/ echo PYTHON_INC_DIR=${PYTHON_INC_DIR} export PYTHON_MOD_DIR=/usr/lib/python${PY_VERSION}/ export PYTHON_CFG_DIR=${PYTHON_MOD_DIR}/config export PYTHON_NUM_DIR=${PYTHON_INC_DIR}/Numeric/ export PYTHON_MACH_DIR=${PYTHON_MOD_DIR}/site-packages export PYTHON_DIR=${PYTHON_MACH_DIR} ./configure --prefix=/usr --with-double --enable-dyndrivers --disable-octave --enable-gnome --enable-python --enable-tcl --disable-itcl --enable-ntk #./configure --prefix=/usr --with-double --enable-dyndrivers --enable-gnome --enable-ntk %build make %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/plplot # The PREFIX value makes this package relocatable. So all compilation was # done with --prefix=/usr, but the install occurs to PREFIX (temporarily) # until the binary rpm is put together. make install PREFIX=$RPM_BUILD_ROOT/usr # hack to get rid of these non-working examples (that screw things up in any # case because they start with #!/usr/local/bin/python which adds a wrong # dependency) rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/tutor.py rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/x??.py # install extra documentation cd doc gzip plplotdoc*.dvi cp plplotdoc*gz index.html $RPM_BUILD_ROOT/usr/share/doc/plplot gunzip plplotdoc*.dvi.gz pushd $RPM_BUILD_ROOT/usr/share/doc/plplot # * stands for version number of plplotdoc. tar zxf plplotdoc-html-*.tar.gz rm $RPM_BUILD_ROOT/usr/share/doc/plplot/plplotdoc-html-*.tar.gz popd # install info stuff. This is the correct place for RH 6.2, but may not # be the preferred location for modern distributions. install -m 755 -d $RPM_BUILD_ROOT/usr/share/info # * stands for version number of plplotdoc. tar zxf plplotdoc-info-*.tar.gz rm $RPM_BUILD_ROOT/usr/share/doc/plplot/plplotdoc-info-*.tar.gz bzip2 plplotdoc-info-*/* cp plplotdoc-info-*/* $RPM_BUILD_ROOT/usr/share/info # make sure can redo this script in case of --short-circuit rm -f plplotdoc-info-*/* # install man pages install -m 755 -d $RPM_BUILD_ROOT/usr/man/man1 cp plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 $RPM_BUILD_ROOT/usr/man/man1 pushd $RPM_BUILD_ROOT/usr/man/man1 bzip2 plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 popd tar zxf plplotdoc-man-*.tar.gz rm $RPM_BUILD_ROOT/usr/share/doc/plplot/plplotdoc-man-*.tar.gz bzip2 plplotdoc-man-*/* install -m 755 -d $RPM_BUILD_ROOT/usr/man/man3 cp plplotdoc-man-*/*.bz2 $RPM_BUILD_ROOT/usr/man/man3 # make sure can redo this script in case of --short-circuit rm -f plplotdoc-man-*/* cd .. %post /sbin/ldconfig /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." /usr/share/info/plplotdoc.info.bz2 /usr/share/info/dir %preun if [ $1 = 0 ]; then /sbin/install-info --delete /usr/share/info/plplotdoc.info.bz2 /usr/share/info/dir fi %postun /sbin/ldconfig %files # doc plus examples (for now) %attr(-, root, root) %doc /usr/share/doc/plplot %attr(-, root, root) %doc /usr/man/man1/plm2gif.1.bz2 %attr(-, root, root) %doc /usr/man/man1/plpr.1.bz2 %attr(-, root, root) %doc /usr/man/man1/plrender.1.bz2 %attr(-, root, root) %doc /usr/man/man1/plserver.1.bz2 %attr(-, root, root) %doc /usr/man/man1/pltcl.1.bz2 %attr(-, root, root) %doc /usr/man/man1/pltek.1.bz2 %attr(-, root, root) %doc /usr/man/man3/*.3plplot.bz2 # octave support files for Plplot. #N.A. on Mdk8.0%attr(-, root, root) /usr/share/plplot-octave # python module %attr(-, root, root) /usr/lib/python*/site-packages/plmodule.so # fonts and maps %attr(-, root, root) /usr/lib/plplot%{version} # info files %attr(-, root, root) /usr/share/info/plplotdoc.info*.bz2 # headers %attr(-, root, root) /usr/include/plplot # executables %attr(-, root, root) /usr/bin/plm2gif %attr(-, root, root) /usr/bin/plplot-config %attr(-, root, root) /usr/bin/plpr %attr(-, root, root) /usr/bin/plrender %attr(-, root, root) /usr/bin/plserver %attr(-, root, root) /usr/bin/pltcl %attr(-, root, root) /usr/bin/pltek %attr(-, root, root) /usr/bin/pstex2eps # libraries %attr(-, root, root) /usr/lib/libplcxxd.* %attr(-, root, root) /usr/lib/libplplotd.* %attr(-, root, root) /usr/lib/libtclmatrixd.* plplot-5.10.0+dfsg/rpm/plplot_redhat7.1.spec 644 1750 1750 13423 7425655531 175100ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/plplot # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. Summary: PLPlot 2D/3D plotting library Packager: Alan W. Irwin Name: plplot Version: 5.1.0 Release: 1 Source0: http://prdownloads.sourceforge.net/plplot/plplot-5.1.0.tar.gz URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Applications/Math requires: python >= 1.5.2-30, python-numpy >= 15.3 %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. Notes on the plplot configuration underlying this package for the RH 7.1 build environment: (i) We use --with-double --enable-dyndrivers --enable-gnome --enable-ntk to give double precision, dynamic drivers, and the experimental gnome and ntp drivers. We do not enable java. (ii) A large number of drivers are also configured by default including tk, ps, psc, png and jpeg. (iii) --enable-octave is configured by default, but octave is not supported on RedHat 7.1 because of a missing matwrap package. Thus, the configure script automatically disables it, and to be consistent with that result we must comment out the octave files from the file list. To get around this problem we will some day make a matwrap rpm (which should be easy to do since no compilation is involved). But not today! %prep %setup make configure ./configure --prefix=/usr --with-double --enable-dyndrivers --enable-gnome --enable-ntk %build make %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/plplot # The PREFIX value makes this package relocatable. So all compilation was # done with --prefix=/usr, but the install occurs to PREFIX (temporarily) # until the binary rpm is put together. make install PREFIX=$RPM_BUILD_ROOT/usr # hack to get rid of these non-working examples (that screw things up in any # case because they start with #!/usr/local/bin/python which adds a wrong # dependency) rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/tutor.py rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/x??.py # install extra documentation cd doc cp plplotdoc*.gz plplotdoc*.dvi index.html $RPM_BUILD_ROOT/usr/share/doc/plplot pushd $RPM_BUILD_ROOT/usr/share/doc/plplot # * stands for version number of plplotdoc. tar zxf plplotdoc-html-*.tar.gz popd # install info stuff. install -m 755 -d $RPM_BUILD_ROOT/usr/share/info # * stands for version number of plplotdoc. tar zxf plplotdoc-info-*.tar.gz gzip plplotdoc-info-*/* cp plplotdoc-info-*/* $RPM_BUILD_ROOT/usr/share/info # make sure can redo this script in case of --short-circuit rm -f plplotdoc-info-*/* # install man pages install -m 755 -d $RPM_BUILD_ROOT/usr/share/man/man1 cp plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 $RPM_BUILD_ROOT/usr/share/man/man1 pushd $RPM_BUILD_ROOT/usr/share/man/man1 gzip plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 popd tar zxf plplotdoc-man-*.tar.gz gzip plplotdoc-man-*/* install -m 755 -d $RPM_BUILD_ROOT/usr/share/man/man3 cp plplotdoc-man-*/*.gz $RPM_BUILD_ROOT/usr/share/man/man3 # make sure can redo this script in case of --short-circuit rm -f plplotdoc-man-*/* cd .. %post /sbin/ldconfig /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." /usr/share/info/plplotdoc.info.gz /usr/share/info/dir %preun if [ $1 = 0 ]; then /sbin/install-info --delete /usr/share/info/plplotdoc.info.gz /usr/share/info/dir fi %postun /sbin/ldconfig %files # doc %attr(-, root, root) %doc /usr/share/doc/plplot %attr(-, root, root) %doc /usr/share/man/man1/plm2gif.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plpr.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plrender.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plserver.1.gz %attr(-, root, root) %doc /usr/share/man/man1/pltcl.1.gz %attr(-, root, root) %doc /usr/share/man/man1/pltek.1.gz %attr(-, root, root) %doc /usr/share/man/man3/*.3plplot.gz # octave support files for Plplot. # Not available because of matwrap%attr(-, root, root) /usr/share/plplot-octave # python modules %attr(-, root, root) /usr/lib/python1.5/site-packages/plmodule.so %attr(-, root, root) /usr/lib/python1.5/site-packages/pyqt_plmodule.so # fonts, maps, tcl data, dyndrivers, and examples %attr(-, root, root) /usr/lib/plplot5.1.0 # info files %attr(-, root, root) /usr/share/info/plplotdoc.info*.gz # headers %attr(-, root, root) /usr/include/plplot # executables %attr(-, root, root) /usr/bin/plm2gif %attr(-, root, root) /usr/bin/plplot-config %attr(-, root, root) /usr/bin/plpr %attr(-, root, root) /usr/bin/plrender %attr(-, root, root) /usr/bin/plserver %attr(-, root, root) /usr/bin/pltcl %attr(-, root, root) /usr/bin/pltek %attr(-, root, root) /usr/bin/pstex2eps # libraries %attr(-, root, root) /usr/lib/libplcxxd.* %attr(-, root, root) /usr/lib/libplplotd.* %attr(-, root, root) /usr/lib/libtclmatrixd.* plplot-5.10.0+dfsg/rpm/matwrap_redhat7.2.spec 644 1750 1750 5167 7456205655 176420ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/matwrap # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. %define version 0.57 %define rpmversion 1rh7.2 Summary: matwrap is a wrapper generator for matrix languages Packager: Alan W. Irwin Name: matwrap Version: %{version} Release: %{rpmversion} Source0: http://lnc.usc.edu/~holt/matwrap/matwrap-%{version}.tar.gz URL: http://lnc.usc.edu/~holt/matwrap/ Copyright: Perl Artistic License Group: Applications/Math requires: perl >= 5.004 %description Matwrap is a tool for interfacing C++ code into matrix-oriented scripting languages such as Matlab 5, Octave, and tela. It generates all the code to convert from the scripting language's internal types into the types that your C++ code understands (e.g., double, char *, float *, struct abc *). You do not need to understand any of the API details of the language to use your C++ code; just give matwrap a .h file describing your functions. Brief list of features: + Functions are automatically vectorized. + Arguments containing dimensions of other vector and matrix arguments can be computed automatically and need not be specified. + Pointers to structures and classes are supported. Public member functions of classes may be called, and public data members may be evaluated or set. Inheritance is supported. %prep %setup -n matwrap %build %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/matwrap # Must create top level prefix directory because of bug in install.pl mkdir -p $RPM_BUILD_ROOT/usr # The PREFIX value makes this package relocatable. make install PREFIX=$RPM_BUILD_ROOT/usr # Install puts things in the wrong place (or not at all) so move things # around to compensate. mkdir -p $RPM_BUILD_ROOT/usr/share/doc/matwrap mv README TODO $RPM_BUILD_ROOT/usr/share/doc/matwrap mv $RPM_BUILD_ROOT/usr/share/matwrap/Examples $RPM_BUILD_ROOT/usr/share/doc/matwrap/examples %files # doc %attr(-, root, root) %doc /usr/share/doc/matwrap # shared language modules %attr(-, root, root) %doc /usr/share/matwrap # executables %attr(-, root, root) /usr/bin/matwrap plplot-5.10.0+dfsg/rpm/plplot_mandrake9.2.spec 644 1750 1750 4154410007425500 200300ustar andrewandrew%define name plplot %define version 5.3.0 %define release 1mdk %define lib_name_orig libplplot %define lib_major 9 %define lib_name libplplot9 %define lib_name_devel libplplot9-devel %define lib_name_static_devel libplplot9-static-devel # These are unnecessary %define libname %mklibname plplot %{lib_major} %define libnamedevel %mklibname plplot %{lib_major} -d %define libnamestaticdevel %mklibname plplot %{lib_major} -s -d Summary: Scientific 2D/3D plotting library Packager: Brian D. Wright Name: %{name} Version: %{version} Release: %{release} Source0: http://prdownloads.sourceforge.net/plplot/%{name}-%{version}.tar.bz2 # This patch needed if --enable-linuxvga Patch0: plplot-5.2.1.cvs.20031030_vga.patch.bz2 BuildRoot: %{_tmppath}/%{name}-root URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Sciences/Mathematics BuildRequires: libqhull-devel tcl tk itcl python-devel >= 2.1.1, python-numeric >= 20.1.0 java-devel freetype2-devel octave >= 2.1 glib-devel gtk-devel >= 1.2.7 libgnome-devel >= 1.4 libcd-devel swig >= 1.3 #BuildRequires: svgalib-devel Requires: %{lib_name} = %{version} %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. The PLplot library is written in C, enabling it to run on many platforms practically without modification. Fortran programs may use it transparently; stub routines are provided to handle the C<->Fortran interface without any modification of the user program. C programs are required to include the header file "plplot.h"; see the documentation for more details. Programmes written in many other languages can also use the PLplot library. The C++, Tcl, Python, Octave, and Yorick (this front end is maintained independently, see yplot.sf.net) front ends to PLplot are mature, the Java front end is almost there (most examples work), and the Perl front end is still quite incomplete. The PLplot package is distributable under the terms of the GNU Library General Public License (LGPL) with some exceptions -- see the file "Copyright" for full information. Notes on the plplot configuration underlying this package for the Mandrake build environment: (i) We configure with --enable-shared --enable-static --enable-drivers --enable-dyndrivers --enable-java --enable-python --enable-itcl --enable-gnome --disable-linuxvga --enable-builddoc --with-pthreads --with-freetype --with-double --with-pkg-config -with-xml-declaration=/usr/share/sgml/xml.dcl --with-sgml-catalogs=/etc/sgml/catalog JAVA_HOME must be set properly to build the java package. (ii) A large number of drivers are configured by default including tk, ps, psc, png, and jpeg. (iii) Base languages supported are c, c++, fortran 77, and tcl. All these packages are standard on Mandrake. (iv) Support for gd, gnome, java, octave, python, tcltk drivers and/or bindings are available as separate subpackages. The full configure output is as follows: devices: cgm dg300 png jpeg gnome hp7470 hp7580 lj_hpgl imp ljii ljiip mem ntk null pbm plmeta ps psc pstex xterm tek4010 tek4107 mskermit versaterm vlt conex tek4010f tek4107f tk tkwin xfig xwin Available device drivers: static dynamic cgm.la dg300.la gd.la gnome.la hpgl.la impress.la ljii.la ljiip.la mem.la ntk.la null.la pbm.la plmeta.la ps.la pstex.la tek.la tk.la tkwin.la xfig.la xwin.la Compilation options: with_debug: no with_opt: yes with_warn: no with_profile: no Library options: enable_shared: yes enable_static: yes with_rpath: yes with_double: yes Optional libraries: with_qhull: yes with_csa: yes with_freetype: yes with_pthreads: yes Language Bindings: enable_tcl: yes enable_itcl: yes enable_cxx: yes enable_f77: yes enable_java: yes enable_python: yes enable_octave: yes %package -n %{lib_name} Summary: Main libraries for PLplot Group: System/Libraries Provides: %{lib_name_orig} = %{version}-%{release} %description -n %{lib_name} This package contains the libraries needed to run programs dynamically linked with PLplot, a scientific plotting library. %package -n %{lib_name}-drivers Summary: Main drivers for PLplot Group: System/Libraries Requires: %{lib_name} = %{version} Provides: %{name}-drivers = %{version}-%{release} %description -n %{lib_name}-drivers This package contains the base output drivers for PLplot, a scientific plotting library. Many different output device drivers are available, including postscript, tektronix, HP laserjet, HP pen plotters, XFig, xterm, X-windows, and a portable metafile format, among others. %package -n %{lib_name_devel} Summary: Headers and libraries for developing programs that will use PLplot Group: Development/C Requires: %{lib_name} = %{version} Provides: %{lib_name_orig}-devel = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} %description -n %{lib_name_devel} This package contains the headers, libraries, documentation and examples needed to develop applications using PLplot, a scientific plotting library. %package -n %{lib_name_static_devel} Summary: Static libraries for PLplot Group: Development/C Requires: %{lib_name_devel} = %{version} Provides: %{lib_name_orig}-static-devel = %{version}-%{release} Provides: %{name}-static-devel = %{version}-%{release} %description -n %{lib_name_static_devel} This package contains the static libraries for developing programs which use plplot. Install this package if you need to statically link your program or library. %package -n %{lib_name}-driver-gd Summary: GD graphics driver for PLplot Group: System/Libraries Requires: %{lib_name} = %{version} Provides: %{name}-gd = %{version}-%{release} Provides: %{lib_name}-gd = %{version}-%{release} %description -n %{lib_name}-driver-gd This package contains the GD graphics driver/plugin for PLplot, which allows direct generation of PNG and JPEG files %package -n %{lib_name}-driver-gnome Summary: Gnome/Gtk based driver for PLplot Group: System/Libraries Requires: %{lib_name} = %{version} Provides: %{name}-gnome = %{version}-%{release} Provides: %{lib_name}-gnome = %{version}-%{release} %description -n %{lib_name}-driver-gnome This package contains the Gnome/Gtk based driver/plugin for PLplot. %package -n %{lib_name_orig}-python Summary: Python bindings for PLplot Group: Development/Python Requires: python >= 2.1 python-numeric >= 20.1 Requires: %{lib_name} = %{version} Provides: %{name}-python = %{version}-%{release} %description -n %{lib_name_orig}-python This package contains python wrappers for PLplot. %package -n %{lib_name_orig}-octave Summary: Octave bindings for PLplot Group: Sciences/Mathematics Requires: octave >= 2.0 %{lib_name} = %{version} Provides: %{name}-octave = %{version}-%{release} %description -n %{lib_name_orig}-octave This package contains octave wrappers for PLplot. Octave is a language for linear algebra and much more. In order to use this package, issue the command "use_plplot" at the Octave prompt. This will have the effect of replacing the traditional Gnuplot interface by a PLplot based one. %package -n %{name}-tcltk Summary: TclTk applications for PLplot Group: Science/Mathematics Requires: tcl >= 8.1 tk >= 8.1 Requires: %{lib_name} = %{version} Requires: %{lib_name}-tcltk = %{version} %description -n %{name}-tcltk This package contains Tcl/Tk applications pltcl, plserver for PLplot. The pltcl program allows interactive plotting using the Tcl script language with plotting extensions. %package -n %{lib_name}-tcltk Summary: TclTk bindings and drivers for PLplot Group: System/Libraries Requires: tcl >= 8.1 tk >= 8.1 Requires: %{lib_name} = %{version} Provides: %{lib_name_orig}-tcltk = %{version}-%{release} %description -n %{lib_name}-tcltk This package contains Tcl/Tk drivers and wrappers for PLplot. %package -n %{lib_name}-tcltk-devel Summary: TclTk development libraries for PLplot Group: System/Libraries Requires: %{lib_name}-devel = %{version} %{lib_name}-tcltk = %{version} Provides: %{lib_name_orig}-tcltk-devel = %{version}-%{release} Provides: %{name}-tcltk-devel = %{version}-%{release} %description -n %{lib_name}-tcltk-devel This package contains headers and libraries for making Tcl/Tk applications with PLplot. This includes a Tk-based plotting widget, called a plframe. This widget is based on the Tk frame widget, and supports a variety of user options such as zoom, scrolls, save to a variety of devices, print, resize, page layout, orientation change, and palette manipulation. Direct plotting to the widget may be done by calls to the underlying library using either C or Fortran bindings, and a large number of operations can be interpreted directly (in Tcl) by the widget %package -n %{lib_name}-tcltk-static-devel Summary: Static TclTk libraries for PLplot Group: Development/Other Requires: %{lib_name}-tcltk-devel = %{version} Provides: %{lib_name_orig}-tcltk-static-devel = %{version}-%{release} Provides: %{name}-tcltk-static-devel = %{version}-%{release} %description -n %{lib_name}-tcltk-static-devel This package contains the static libraries for developing Tcl/Tk programs which use plplot. Install this package if you need to statically link your program or library. %package -n %{lib_name}-java Summary: Java bindings for PLplot Group: Development/Java Requires: java Requires: %{lib_name} = %{version} Provides: %{name}-java = %{version}-%{release} %description -n %{lib_name}-java This package contains Java wrappers for PLplot. %prep %setup -q # Only if --enable-linuxvga #%%patch0 -p1 %build # make sure JAVA_HOME environment var is set if you want java bindings. %configure --enable-shared --enable-static --enable-drivers --enable-dyndrivers --enable-java --enable-python --enable-itcl --enable-gnome --disable-linuxvga --enable-builddoc --with-pthreads --with-pkg-config -with-xml-declaration=/usr/share/sgml/xml.dcl --with-sgml-catalogs=/etc/sgml/catalog # Don't do a multithreaded make here make %install [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT %makeinstall_std # This macro is the same as: #make DESTDIR=$RPM_BUILD_ROOT install # Some doc fixups since %doc removes the existing doc install area! mkdir -p doc/html cp -a doc/docbook/src/*html doc/html cp -a %{buildroot}/%{_datadir}/doc/plplot/README.pkg-config . cp -a %{buildroot}/%{_datadir}/doc/plplot/*.csa . cp -a %{buildroot}/%{_datadir}/doc/plplot/*.nn . rm -rf %{buildroot}/%{_datadir}/doc/plplot %clean [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT %post -n %{lib_name} /sbin/ldconfig %postun -n %{lib_name} /sbin/ldconfig %post -n %{lib_name}-tcltk /sbin/ldconfig %postun -n %{lib_name}-tcltk /sbin/ldconfig %post -n %{lib_name_devel} /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." /usr/share/info/plplotdoc.info.bz2 /usr/share/info/dir %preun -n %{lib_name_devel} %_remove_install_info plplotdoc.info #if [ $1 = 0 ]; then # /sbin/install-info --delete /usr/share/info/plplotdoc.info.bz2 /usr/share/info/dir #fi %files %defattr(-,root,root) # base docs %doc AUTHORS ChangeLog COPYING.LIB Copyright FAQ NEWS PROBLEMS README SERVICE ToDo TODO.AM-LT README.1st.csa README.1st.nn README.csa drivers/README.drivers README.nn %{_mandir}/man1/plm2gif.1.bz2 %{_mandir}/man1/plpr.1.bz2 %{_mandir}/man1/plrender.1.bz2 %{_mandir}/man1/pltek.1.bz2 %{_mandir}/man1/pstex2eps.1.bz2 # executables %{_bindir}/plm2gif %{_bindir}/plpr %{_bindir}/plrender %{_bindir}/pltek %{_bindir}/pstex2eps # fonts and maps %dir %{_datadir}/plplot%{version} %{_datadir}/plplot%{version}/*.fnt %{_datadir}/plplot%{version}/*.map %files -n %{lib_name} %defattr(-,root,root) # libraries %{_libdir}/*plplotf77*.so.* %{_libdir}/*plplotcxx*.so.* %{_libdir}/*plplotd.so.* %{_libdir}/*nn*.so.* %{_libdir}/*csa*.so.* # driver area %dir %{_libdir}/plplot%{version} %dir %{_libdir}/plplot%{version}/driversd # Base drivers package %files -n %{lib_name}-drivers %defattr(-,root,root) # drivers %{_libdir}/plplot%{version}/driversd/cgm* %{_libdir}/plplot%{version}/driversd/dg300* %{_libdir}/plplot%{version}/driversd/hpgl* %{_libdir}/plplot%{version}/driversd/impress* #%%{_libdir}/plplot%{version}/driversd/linuxvga* %{_libdir}/plplot%{version}/driversd/ljii* %{_libdir}/plplot%{version}/driversd/mem* %{_libdir}/plplot%{version}/driversd/null* %{_libdir}/plplot%{version}/driversd/pbm* %{_libdir}/plplot%{version}/driversd/plmeta* %{_libdir}/plplot%{version}/driversd/ps.* %{_libdir}/plplot%{version}/driversd/pstex* %{_libdir}/plplot%{version}/driversd/tek* %{_libdir}/plplot%{version}/driversd/xfig* %{_libdir}/plplot%{version}/driversd/xwin* # Devel package %files -n %{lib_name_devel} %defattr(-,root,root) # More extensive documentation %{_mandir}/man3/*.3plplot.bz2 %doc doc/docbook/src/plplot-%{version}.dvi doc/docbook/src/plplot-%{version}.pdf doc/docbook/src/plplot-%{version}.ps.gz doc/html README.pkg-config # info files %{_datadir}/info/plplotdoc.info*.bz2 %{_bindir}/plplot-config* %{_mandir}/man1/plplot_libtool.1.bz2 %{_bindir}/plplot_libtool # headers %dir %{_includedir}/plplot %{_includedir}/plplot/disptab.h %{_includedir}/plplot/drivers.h %{_includedir}/plplot/pdf.h %{_includedir}/plplot/plConfig.h %{_includedir}/plplot/pldebug.h %{_includedir}/plplot/plDevs.h %{_includedir}/plplot/plevent.h %{_includedir}/plplot/plplot.h %{_includedir}/plplot/plplotP.h %{_includedir}/plplot/plstream.h %{_includedir}/plplot/plstrm.h %{_includedir}/plplot/plxwd.h # libs %{_libdir}/*plplotf77*.so %{_libdir}/*plplotcxx*.so %{_libdir}/*plplotd.so %{_libdir}/*nn*.so %{_libdir}/*csa*.so %{_libdir}/*plplotf77*.la %{_libdir}/*plplotcxx*.la %{_libdir}/*plplotd.la %{_libdir}/*nn*.la %{_libdir}/*csa*.la %{_libdir}/pkgconfig %dir %{_datadir}/plplot%{version}/examples %{_datadir}/plplot%{version}/examples/Makefile %{_datadir}/plplot%{version}/examples/c %{_datadir}/plplot%{version}/examples/c++ %{_datadir}/plplot%{version}/examples/f77 %{_datadir}/plplot%{version}/examples/perl %{_datadir}/plplot%{version}/examples/plplot-test.sh %{_datadir}/plplot%{version}/examples/test_c.sh %{_datadir}/plplot%{version}/examples/test_cxx.sh %{_datadir}/plplot%{version}/examples/test_f77.sh %files -n %{lib_name_static_devel} %defattr(-,root,root) %{_libdir}/*plplotf77*.a %{_libdir}/*plplotcxx*.a %{_libdir}/*plplotd.a %{_libdir}/*nn*.a %{_libdir}/*csa*.a # for gd %files -n %{lib_name}-driver-gd %defattr(-,root,root) %{_libdir}/plplot%{version}/driversd/gd* # for gnome %files -n %{lib_name}-driver-gnome %defattr(-,root,root) %{_libdir}/plplot%{version}/driversd/gnome* # for python %files -n %{lib_name_orig}-python %defattr(-,root,root) %{_libdir}/python* %{_datadir}/plplot%{version}/examples/test_python.sh %{_datadir}/plplot%{version}/examples/python # for octave %files -n %{lib_name_orig}-octave %defattr(-,root,root) %{_libdir}/octave %{_datadir}/plplot%{version}/examples/test_octave.sh %{_datadir}/plplot%{version}/examples/octave %{_datadir}/octave %{_datadir}/plplot_octave %doc bindings/octave/BUGS bindings/octave/INSTALL bindings/octave/README bindings/octave/USAGE bindings/octave/ToDo bindings/octave/FGA # for java %files -n %{lib_name}-java %defattr(-,root,root) %{_libdir}/java %{_datadir}/plplot%{version}/examples/test_java.sh # for tcltk apps %files -n %{name}-tcltk %defattr(-,root,root) %{_mandir}/man1/plserver.1.bz2 %{_mandir}/man1/pltcl.1.bz2 %{_bindir}/plserver %{_bindir}/pltcl # for tcltk %files -n %{lib_name}-tcltk %defattr(-,root,root) %{_libdir}/*tcl*.so.* %{_datadir}/plplot%{version}/pkgIndex.tcl %{_datadir}/plplot%{version}/tcl %{_libdir}/plplot%{version}/driversd/*tk* # for tcltk-devel %files -n %{lib_name}-tcltk-devel %defattr(-,root,root) %{_libdir}/*tcl*.so %{_libdir}/*tcl*.la %{_includedir}/plplot/pltcl.h %{_includedir}/plplot/pltk.h %{_includedir}/plplot/tclMatrix.h %{_datadir}/plplot%{version}/examples/tk %{_datadir}/plplot%{version}/examples/test_tcl.sh %{_datadir}/plplot%{version}/examples/tcl # for tcltk-static-devel %files -n %{lib_name}-tcltk-static-devel %defattr(-,root,root) %{_libdir}/*tcl*.a %changelog * Tue Jan 27 2004 Brian D. Wright 5.2.1.rc2.5.3.0-2mdk - Added explicit directories for proper cleanup on uninstall. - Added missing defattrs. * Tue Jan 27 2004 Brian D. Wright 5.2.1.rc2.5.3.0-1mdk - Update for new release candidate. * Tue Jan 20 2004 Brian D. Wright 5.2.1.rc1.5.3.0-1mdk - Update for new release candidate. - Set --with-pkg-config option in configure. - Moved data and examples to datadir install locations. plplot-5.10.0+dfsg/rpm/README.rpm 644 1750 1750 2566 7314470534 152030ustar andrewandrewSpec files such as plplot_redhat6.2.spec and a tarball (e.g., plplot-5.0.4.tar.gz) and optional patch files are all that are required to build source and binary rpm's. For details of how to do this, please look at the Maximum RPM book by Ed Bailey (see http://redhat.com/support/books/). Every different rpm-based distribution (or version of RedHat) requires its own spec file which will differ in some small details from plplot_redhat6.2.spec. So the plan is to build up a suite of these spec files in this directory as we get access to various distributions. plplot_redhat7.1.spec is the second example of this plan. plplot_redhat6.2.spec is the prototype of such spec files and must be considered experimental. It has been used to build source and binary rpms successfully on *one* RedHat 6.2 system. (Similar remarks also apply to plplot_redhat7.1.spec) It uses the built-in package relocatibility of PLplot to safely allow non-root users to build the rpm's. Nevertheless, because of the scarcity of testing, you are advised to take the ordinary precautions (check the file lists and scripts) before installing the binary rpm created by this package. Note that like all spec files, these spec files are package-version specific. They are only consistent with plplot-5.0.4 and will require some modification for every subsequent version change of plplot that we want to turn into an rpm. plplot-5.10.0+dfsg/rpm/plplot_redhat6.2.spec 644 1750 1750 13665 7312736415 175140ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/plplot # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. Summary: PLPlot 2D/3D plotting library Packager: Alan W. Irwin Name: plplot Version: 5.0.4 Release: 1 Source0: http://prdownloads.sourceforge.net/plplot/plplot-5.0.4.tar.gz URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Applications/Math requires: python >= 1.5.2, python-numpy >= 15.3 %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. Notes on the plplot configuration underlying this package for the RH 6.2 build environment: (i) We use --with-double=yes to give double precision. (ii) A large number of drivers are configured by default including tk, png and jpeg, and we also explicitly configure --enable-gnome to include the gnome driver. But on RH 6.2, libtcl, libgd, and libgtk+ are too old so these mentioned drivers are automatically eliminated from the drivers list by the configure script. On RH 7.x it will be a different story. (iii) We explicitly configure --enable-octave, but octave is not supported on RedHat 6.2 (7.x may be different, we don't know) so the configure script automatically disables it. (iv) On RedHat 6.2 (but not 7.x) tcl is too old for PLplot to support it so the configuration automatically disables it. Note that when crippled/ancient RH 6.2 is replaced by a more modern distribution for the build there are going to be lots of additional dependency issues to deal with. You have been warned. %prep %setup make configure ./configure --prefix=/usr --with-double --enable-octave --enable-gnome %build make %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/plplot # The PREFIX value makes this package relocatable. So all compilation was # done with --prefix=/usr, but the install occurs to PREFIX (temporarily) # until the binary rpm is put together. make install PREFIX=$RPM_BUILD_ROOT/usr # hack to get rid of these non-working examples (that screw things up in any # case because they start with #!/usr/local/bin/python which adds a wrong # dependency) rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/tutor.py rm -f $RPM_BUILD_ROOT/usr/share/doc/plplot/examples/python/x??.py # install extra documentation cd doc cp plplotdoc*.gz plplotdoc*.dvi index.html $RPM_BUILD_ROOT/usr/share/doc/plplot pushd $RPM_BUILD_ROOT/usr/share/doc/plplot # * stands for version number of plplotdoc. tar zxf plplotdoc-html-*.tar.gz popd # install info stuff. This is the correct place for RH 6.2, but may not # be the preferred location for modern distributions. install -m 755 -d $RPM_BUILD_ROOT/usr/info # * stands for version number of plplotdoc. tar zxf plplotdoc-info-*.tar.gz gzip plplotdoc-info-*/* cp plplotdoc-info-*/* $RPM_BUILD_ROOT/usr/info # make sure can redo this script in case of --short-circuit rm -f plplotdoc-info-*/* # install man pages install -m 755 -d $RPM_BUILD_ROOT/usr/man/man1 cp plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 $RPM_BUILD_ROOT/usr/man/man1 pushd $RPM_BUILD_ROOT/usr/man/man1 gzip plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 popd tar zxf plplotdoc-man-*.tar.gz gzip plplotdoc-man-*/* install -m 755 -d $RPM_BUILD_ROOT/usr/man/man3 cp plplotdoc-man-*/*.gz $RPM_BUILD_ROOT/usr/man/man3 # make sure can redo this script in case of --short-circuit rm -f plplotdoc-man-*/* cd .. %post /sbin/ldconfig /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." /usr/info/plplotdoc.info.gz /usr/info/dir %preun if [ $1 = 0 ]; then /sbin/install-info --delete /usr/info/plplotdoc.info.gz /usr/info/dir fi %postun /sbin/ldconfig %files # doc plus examples (for now) %attr(-, root, root) %doc /usr/share/doc/plplot %attr(-, root, root) %doc /usr/man/man1/plm2gif.1.gz %attr(-, root, root) %doc /usr/man/man1/plpr.1.gz %attr(-, root, root) %doc /usr/man/man1/plrender.1.gz %attr(-, root, root) %doc /usr/man/man1/plserver.1.gz %attr(-, root, root) %doc /usr/man/man1/pltcl.1.gz %attr(-, root, root) %doc /usr/man/man1/pltek.1.gz %attr(-, root, root) %doc /usr/man/man3/*.3plplot.gz # octave support files for Plplot. #N.A. on RH 6.2%attr(-, root, root) /usr/share/plplot-octave # python module %attr(-, root, root) /usr/lib/python1.5/site-packages/plmodule.so # fonts and maps (and tcl data once we move away from RH 6.2) %attr(-, root, root) /usr/lib/plplot5.0.4 # info files %attr(-, root, root) /usr/info/plplotdoc.info*.gz # headers %attr(-, root, root) /usr/include/plplot # executables %attr(-, root, root) /usr/bin/plm2gif %attr(-, root, root) /usr/bin/plplot-config %attr(-, root, root) /usr/bin/plpr %attr(-, root, root) /usr/bin/plrender #N.A. on RH 6.2%attr(-, root, root) /usr/bin/plserver #N.A. on RH 6.2%attr(-, root, root) /usr/bin/pltcl %attr(-, root, root) /usr/bin/pltek %attr(-, root, root) /usr/bin/pstex2eps # libraries %attr(-, root, root) /usr/lib/libplcxxd.* %attr(-, root, root) /usr/lib/libplplotd.* #N.A. on RH 6.2%attr(-, root, root) /usr/lib/libtclmatrixd.* plplot-5.10.0+dfsg/rpm/plplot_redhat7.3.spec 644 1750 1750 16704 7731542144 175120ustar andrewandrew# Create rpm binary and source packages with ordinary user account using # safe temporary install location with eventual root ownership of files that # are actually installed in the final system location by the binary rpm. BuildRoot: /tmp/software/redhat_install_area/plplot # N.B. note use of $RPM_BUILD_ROOT (which points to this location) in the # %prep and %install areas, and explicit removal of this location in # %install area before actual install to this location occurs. %define version 5.2.1.cvs.20030915 %define rpmversion 1rh7.3 Summary: PLPlot 2D/3D plotting library Packager: Alan W. Irwin Name: plplot Version: %{version} Release: %{rpmversion} Source0: http://prdownloads.sourceforge.net/plplot/plplot-%{version}.tar.gz #Patch0: plplot-%{version}.patch URL: http://plplot.sourceforge.net Copyright: LGPL with some exceptions, see file "Copyright" Group: Applications/Math # N.B. specific version of octave required because of versioned install # location. Better way to handle this is to determine the octave versioned # install location automatically (under rpm), but I don't know how to do # that. requires: python >= 1.5.2-30, python-numpy >= 15.3, octave = 2.1.35 %description This is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. Notes on the plplot configuration underlying this package for the RH 7.3 build environment: (i) We use --with-double --enable-dyndrivers --enable-octave --enable-gnome --enable-ntk --disable-linuxvga to give double precision, dynamic drivers, and the experimental octave, gnome and ntk drivers. We exclude the linuxvga driver because the contributed RedHat svgalib rpm is so outdated (1999), and it is not clear it will even work for RH 7.3. We do not enable java since that demands having system java installed and apparently that is not possible on RedHat because of the Sun licensing issue. Eventually, we will get around this with a gcc-libgcj approach. (ii) In addition, a large number of drivers are configured by default including tk, ps, psc, png and jpeg. (iii) The supported front ends are c, c++, fortran 77, python (with numpy), tcl/tk, and octave. Configure results: command: ./configure --prefix=/usr --with-double --enable-dyndrivers --enable-octave --enable-gnome --enable-ntk --disable-linuxvga system: i686-pc-linux-gnu prefix: /usr CC: gcc CXX: g++ F77: g77 LIB_TAG: d devices: dg300 png jpeg gnome hp7470 hp7580 lj_hpgl imp ljii ljiip ntk null pbm plmeta ps psc pstex xterm tek4010 tek4107 mskermit versaterm vlt conex tek4010f tek4107f tk xfig xwin Available device drivers static: dynamic: dg300d_drv.la gdd_drv.la gnomed_drv.la hpgld_drv.la impressd_drv.la ljiid_drv.la ljiipd_drv.la ntkd_drv.la nulld_drv.la pbmd_drv.la plmetad_drv.la psd_drv.la pstexd_drv.la tekd_drv.la tkd_drv.la xfigd_drv.la xwind_drv.la with_shlib: yes with_double: yes with_debug: no with_opt: yes with_warn: no with_profile: no with_gcc: yes with_rpath: yes with_freetype: no enable_xwin: yes enable_tcl: yes enable_tk: yes enable_itcl: no enable_cxx: yes enable_python: yes enable_f77: yes enable_java: no enable_octave: yes enable_gnome: yes enable_tkwin: no %prep %setup -q #%patch -p1 # This workaround won't be needed for the next version! PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'` export PYTHON_INC_DIR=/usr/include/python${PY_VERSION}/ echo PYTHON_INC_DIR=${PYTHON_INC_DIR} ./configure --prefix=/usr --disable-linuxvga %build make %install # remove safe install area before installing to it, but be explicit # because $RPM_BUILD_ROOT (which is set to this area within this script) # can be overridden in error from outside rm -rf /tmp/software/redhat_install_area/plplot # We use the automake DESTDIR here so the pre-install occurs in # $RPM_BUILD_ROOT/usr until the binary rpm is put together to actually # install in /usr. make DESTDIR=$RPM_BUILD_ROOT install # install extra documentation cd doc/docbook/src cp plplot*.gz plplot*.dvi index.html $RPM_BUILD_ROOT/usr/share/doc/plplot # install html stuff. install -m 755 -d $RPM_BUILD_ROOT/usr/share/doc/plplot/html cp `cat HTML-MANIFEST` stylesheet.css \ $RPM_BUILD_ROOT/usr/share/doc/plplot/html # install info stuff. install -m 755 -d $RPM_BUILD_ROOT/usr/share/info # * stands for version number of plplot. cp plplot*.info* $RPM_BUILD_ROOT/usr/share/info pushd $RPM_BUILD_ROOT/usr/share/info gzip plplot*.info* popd # install man pages install -m 755 -d $RPM_BUILD_ROOT/usr/share/man/man1 pushd ../.. cp plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 $RPM_BUILD_ROOT/usr/share/man/man1 popd pushd $RPM_BUILD_ROOT/usr/share/man/man1 gzip plm2gif.1 plpr.1 plrender.1 plserver.1 pltcl.1 pltek.1 popd install -m 755 -d $RPM_BUILD_ROOT/usr/share/man/man3 cp *.3plplot $RPM_BUILD_ROOT/usr/share/man/man3 pushd $RPM_BUILD_ROOT/usr/share/man/man3 gzip *.3plplot popd cd ../../.. %post /sbin/ldconfig /sbin/install-info --entry="* PLplot: (plplotdoc). PLplot plotting suite." \ /usr/share/info/plplotdoc.info.gz /usr/share/info/dir %preun if [ $1 = 0 ]; then /sbin/install-info --delete /usr/share/info/plplotdoc.info.gz \ /usr/share/info/dir fi %postun /sbin/ldconfig %files # doc %attr(-, root, root) %doc /usr/share/doc/plplot %attr(-, root, root) %doc /usr/share/man/man1/plm2gif.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plpr.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plrender.1.gz %attr(-, root, root) %doc /usr/share/man/man1/plserver.1.gz %attr(-, root, root) %doc /usr/share/man/man1/pltcl.1.gz %attr(-, root, root) %doc /usr/share/man/man1/pltek.1.gz %attr(-, root, root) %doc /usr/share/man/man3/*.3plplot.gz # octave support files for Plplot. %attr(-, root, root) /usr/share/plplot_octave %attr(-, root, root) /usr/libexec/octave/2.1.35/oct/i386-redhat-linux-gnu/plplot_octave.oct # python modules %attr(-, root, root) /usr/lib/python*/site-packages/_plplotcmodule.so %attr(-, root, root) /usr/lib/python*/site-packages/plplot.py %attr(-, root, root) /usr/lib/python*/site-packages/plplot_widgetmodule.so %attr(-, root, root) /usr/lib/python*/site-packages/plplotc.py # fonts, maps, tcl data, dyndrivers, and examples %attr(-, root, root) /usr/lib/plplot%{version} # info files %attr(-, root, root) /usr/share/info/plplot*.info*.gz # headers %attr(-, root, root) /usr/include/plplot # executables %attr(-, root, root) /usr/bin/plm2gif %attr(-, root, root) /usr/bin/plplot-config %attr(-, root, root) /usr/bin/plplot_libtool %attr(-, root, root) /usr/bin/plpr %attr(-, root, root) /usr/bin/plrender %attr(-, root, root) /usr/bin/plserver %attr(-, root, root) /usr/bin/pltcl %attr(-, root, root) /usr/bin/pltek %attr(-, root, root) /usr/bin/pstex2eps # libraries %attr(-, root, root) /usr/lib/libcsa.* # Only if system has libqhull # %attr(-, root, root) /usr/lib/libnn.* %attr(-, root, root) /usr/lib/libplplotcxxd.* %attr(-, root, root) /usr/lib/libplplotd.* %attr(-, root, root) /usr/lib/libplplotf77d.* %attr(-, root, root) /usr/lib/libplplottcltkd.* %attr(-, root, root) /usr/lib/libtclmatrixd.* # pkgconfig directory %attr(-, root, root) /usr/lib/pkgconfig/plplot.pc plplot-5.10.0+dfsg/SERVICE 644 1750 1750 54710771066313 137450ustar andrewandrewIn the spirit of the GNU service file included with Emacs, gcc, etc, this file lists conctact information for people or organizations which provide PLplot related services for hire. If you would like to be listed, send your contact information to one of the PLplot maintainers. ----------------------------------------------------------------------------- plplot-5.10.0+dfsg/include/ 775 1750 1750 012406243570 143005ustar andrewandrewplplot-5.10.0+dfsg/include/pldebug.h 644 1750 1750 531311650263310 161450ustar andrewandrew// $Id: pldebug.h 11998 2011-10-21 12:34:16Z andrewross $ // // Copyright (C) 1995 by Maurice J. LeBrun // // Debugging support for PLplot. // // This software may be freely copied, modified and redistributed without // fee provided that this copyright notice is preserved intact on all // copies and modified copies. // // There is no warranty or other guarantee of fitness of this software. // It is provided solely "as is". The author(s) disclaim(s) all // responsibility and liability with respect to this software's usage or // its effect upon hardware or computer systems. // #ifndef __PLDEBUG_H__ #define __PLDEBUG_H__ #include // For the truly desperate debugging task #ifdef DEBUG_ENTER #define dbug_enter( a ) \ if ( plsc->debug ) \ fprintf( stderr, " entered %s (%s, line %d)\n", a, __FILE__, __LINE__ ); #else #define dbug_enter( a ) #endif // If we're using a debugging malloc, include the header file here #ifdef DEBUGGING_MALLOC #include #endif //-------------------------------------------------------------------------- // pldebug() // // Included into every plplot source file to control debugging output. To // enable printing of debugging output, you must #define DEBUG before // including plplotP.h or specify -DDEBUG in the compile line, for each file // that you want to have debug output enabled. When running the program you // must in addition specify -debug. This allows debugging output to tailored // to many different circumstances but otherwise be fairly unobtrusive. // // Note, any file that actually uses pldebug() must also define NEED_PLDEBUG // before the plplotP.h include. This is to eliminate warnings caused by // those files in which this is defined but never referenced. All this could // be much nicer if CPP had the abilities of m4, sigh.. // // Syntax: // pldebug(label, format [, arg1, arg2, ...] ); // // The label is typically the calling function name. //-------------------------------------------------------------------------- #ifdef NEED_PLDEBUG static void pldebug( const char *label, ... ) { #ifdef DEBUG va_list args; char *fmt; if ( plsc->debug ) { if ( plsc->termin ) c_pltext(); va_start( args, label ); // print out identifying tag fprintf( stderr, "%s: ", label ); // print out remainder of message // Need to get fmt BEFORE it's used in the vfprintf fmt = (char *) va_arg( args, char * ); vfprintf( stderr, fmt, args ); va_end( args ); if ( plsc->termin ) c_plgra(); } #else // Avoid warning about unused parameter (void) label; #endif // DEBUG } #endif // NEED_PLDEBUG #endif // __PLDEBUG_H__ plplot-5.10.0+dfsg/include/moc_files.h.in 644 1750 1750 27411460155000 170440ustar andrewandrew// Configured header file listing the moc-generated files to include in plqt.cpp. #ifndef __MOC_FILES_H__ #define __MOC_FILES_H__ #include "@QT_MOC_OUTFILES@" #endif // __MOC_FILES_H__i plplot-5.10.0+dfsg/include/gcw.h 644 1750 1750 1242611462631426 153360ustar andrewandrew// gcw - PLplot Gnome Canvas Widget device driver. // // Copyright (C) 2004, 2005 Thomas J. Duck // Copyright (C) 2004 Rafael Laboissiere // All rights reserved. // // NOTICE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 // USA // #ifndef __GCW_H__ #define __GCW_H__ #include "plDevs.h" #include "plplotP.h" #include "drivers.h" #include #include #include #include #include #include #include #include // #define DEBUG_GCW_1 // #define DEBUG_GCW_2 // #define ASSERT_GCW //-------------------------------------------------------------------------- // GcwPLdev - the PLplot device structure for the GCW driver typedef struct { GnomeCanvas * canvas; // The canvas to draw on GdkPixmap * background; // The background GdkGC * gc; // A graphics context for the pixmap GnomeCanvasGroup* group_visible; // Visible group, removed at next eop GnomeCanvasGroup* group_hidden; // Hidden group --> visible at eop GnomeCanvasGroup* group_persistent; // Persistent group, at from and never erased gboolean use_persistence; // Flags the persistent group should be used, // and that it and the background should not be // erased when the page is advanced. // GtkWidget * window; // A window used in standalone mode GtkWidget * notebook; // A notebook pager in the window GtkWidget * statusbar; // A statusbar for the window GtkWidget * filew; // A file widget chooser when Save is pressed guint32 color; // Current pen color GdkColor bgcolor; // Background color (shouldn't change) GdkColormap* colormap; // The gdk colormap for the canvas PLINT width; // Width of the canvas in device pixels PLINT height; // Height of the canvas in device pixels PLINT pen_color; // Current pen color PLINT pen_width; // Current pen width gboolean use_pixmap; // Flags pixmap use for lines and fills gboolean pixmap_has_data; // Flags that the pixmap has data gboolean plstate_width; // Flags indicating change of state before gboolean plstate_color0; // device is fully initialized gboolean plstate_color1; gboolean allow_resize; // Flags whether device resizing is allowed } GcwPLdev; //-------------------------------------------------------------------------- // Physical dimension constants used by the driver // Virtual coordinate scaling parameter, used to do calculations at // higher resolution. Chosen to be 32 for consistency with the PLplot // metafile (see plplotP.h). // // The trick here is to do everything in device coordinates on the driver // side, but report/receive everything in virtual coordinates to/from the // PLplot core. // #define VSCALE ( 32. ) // pixels per mm #define DEVICE_PIXELS_PER_MM ( 3.4 ) #define VIRTUAL_PIXELS_PER_MM ( DEVICE_PIXELS_PER_MM * VSCALE ) // mm per inch #define MM_PER_IN ( 25.4 ) // pixels per inch #define DEVICE_PIXELS_PER_IN ( DEVICE_PIXELS_PER_MM * MM_PER_IN ) #define VIRTUAL_PIXELS_PER_IN ( VIRTUAL_PIXELS_PER_MM * MM_PER_IN ) // Default dimensions of the canvas (in inches) #define CANVAS_WIDTH ( 10. ) #define CANVAS_HEIGHT ( 7.5 ) // The zoom factor for 100% zoom in #define ZOOM100 ( 1.0 ) #define ZOOMSTEP ( 1.25 ) //-------------------------------------------------------------------------- // GCW "Gnome Canvas Widget" Library prototypes (see gcw-lib.c) // Public_functions void gcw_use_text( PLINT use_text ); void gcw_use_pixmap( PLINT use_pixmap ); void gcw_use_hrshsym( PLINT use_hrshsym ); // Private functions void gcw_debug( char* msg ); PLDLLIMPEXP_GNOME2 void gcw_set_gdk_color(); PLDLLIMPEXP_GNOME2 void gcw_clear_background(); PLDLLIMPEXP_GNOME2 void gcw_init_canvas( GnomeCanvas* canvas ); PLDLLIMPEXP_GNOME2 void gcw_install_canvas( GnomeCanvas *canvas ); PLDLLIMPEXP_GNOME2 void gcw_set_device_size( PLINT width, PLINT height ); void gcw_set_canvas_size( GnomeCanvas* canvas, PLINT width, PLINT height ); void gcw_set_canvas_zoom( GnomeCanvas* canvas, PLFLT magnification ); void gcw_use_persistence( PLINT use_persistence ); #endif // __GCW_H__ plplot-5.10.0+dfsg/include/ps.h 644 1750 1750 535712230657343 151650ustar andrewandrew// // These definitions are for the Postscript (ps.c) and // Postscript/LaTeX (pstex.c) drivers // #ifndef __PS_H__ #define __PS_H__ #include "plunicode-type1.h" // top level declarations #define LINELENGTH 78 #define COPIES 1 #define XSIZE (int) ( pls->xlength * ( pls->xdpi / 72. ) ) #define YSIZE (int) ( pls->ylength * ( pls->ydpi / 72. ) ) #define ENLARGE 5 #define XPSSIZE ENLARGE * XSIZE #define YPSSIZE ENLARGE * YSIZE #define XOFFSET (int) ( pls->xoffset * ( pls->xdpi / 72. ) ) // Margins -- #define YOFFSET (int) ( pls->yoffset * ( pls->ydpi / 72. ) ) // .5 inches each #define PSX XPSSIZE - 1 #define PSY YPSSIZE - 1 #define OF pls->OutFile #define MIN_WIDTH 1. // Minimum pen width #define MAX_WIDTH 30. // Maximum pen width #define DEF_WIDTH 3. // Default pen width // These are for covering the page with the background color #define XMIN -XOFFSET * ENLARGE #define XMAX PSX + XOFFSET * ENLARGE #define YMIN -XOFFSET * ENLARGE #define YMAX PSY + XOFFSET * ENLARGE // Struct to hold device-specific info. typedef struct { PLFLT pxlx, pxly; PLINT xold, yold; PLINT xmin, xmax, xlen; PLINT ymin, ymax, ylen; PLINT xmin_dev, xmax_dev, xlen_dev; PLINT ymin_dev, ymax_dev, ylen_dev; PLFLT xscale_dev, yscale_dev; int llx, lly, urx, ury, ptcnt; // font variables. int nlookup, if_symbol_font; const Unicode_to_Type1_table *lookup; // These are only used by the pstex driver for the additional // file required in this case long cur_pos; FILE *fp; } PSDev; void plD_init_pstex( PLStream * ); void plD_line_pstex( PLStream *, short, short, short, short ); void plD_polyline_pstex( PLStream *, short *, short *, PLINT ); void plD_eop_pstex( PLStream * ); void plD_bop_pstex( PLStream * ); void plD_tidy_pstex( PLStream * ); void plD_state_pstex( PLStream *, PLINT ); void plD_esc_pstex( PLStream *, PLINT, void * ); void plD_init_psm( PLStream * ); void plD_init_psc( PLStream * ); void plD_line_ps( PLStream *, short, short, short, short ); void plD_polyline_ps( PLStream *, short *, short *, PLINT ); void plD_eop_ps( PLStream * ); void plD_bop_ps( PLStream * ); void plD_tidy_ps( PLStream * ); void plD_state_ps( PLStream *, PLINT ); void plD_esc_ps( PLStream *, PLINT, void * ); void plD_init_psttfm( PLStream * ); void plD_init_psttfc( PLStream * ); void plD_line_psttf( PLStream *, short, short, short, short ); void plD_polyline_psttf( PLStream *, short *, short *, PLINT ); void plD_eop_psttf( PLStream * ); void plD_bop_psttf( PLStream * ); void plD_tidy_psttf( PLStream * ); void plD_state_psttf( PLStream *, PLINT ); void plD_esc_psttf( PLStream *, PLINT, void * ); #endif // __PS_H__ plplot-5.10.0+dfsg/include/plunicode-type1.h 644 1750 1750 3235711543675237 176150ustar andrewandrew// // This header file contains the lookup tables used for converting between // unicode and the 3 standard type 1 font sequences, dingbats, standard, and // symbol. These data therefore allow unicode access to at least the 35 // standard type 1 fonts in the gsfonts font package, and probably many other // type 1 fonts as well. // // Copyright (C) 2005 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #ifndef __PLUNICODE_TYPE1_H__ #define __PLUNICODE_TYPE1_H__ typedef struct { PLUNICODE Unicode; unsigned char Type1; } Unicode_to_Type1_table; // The following table values have been updated to be consistent // with zdingbat.txt, stdenc.txt, and symbol.txt downloaded from // http://unicode.org/Public/MAPPINGS/VENDORS/ADOBE/ on 2010-04-28. static const int number_of_entries_in_unicode_to_dingbats_table = 203; static const Unicode_to_Type1_table unicode_to_dingbats_lookup_table[203] = { { 0x0020, 32 }, { 0x00a0, 32 }, { 0x2192, 213 }, { 0x2194, 214 }, { 0x2195, 215 }, { 0x2460, 172 }, { 0x2461, 173 }, { 0x2462, 174 }, { 0x2463, 175 }, { 0x2464, 176 }, { 0x2465, 177 }, { 0x2466, 178 }, { 0x2467, 179 }, { 0x2468, 180 }, { 0x2469, 181 }, { 0x25a0, 110 }, { 0x25b2, 115 }, { 0x25bc, 116 }, { 0x25c6, 117 }, { 0x25cf, 108 }, { 0x25d7, 119 }, { 0x2605, 72 }, { 0x260e, 37 }, { 0x261b, 42 }, { 0x261e, 43 }, { 0x2660, 171 }, { 0x2663, 168 }, { 0x2665, 170 }, { 0x2666, 169 }, { 0x2701, 33 }, { 0x2702, 34 }, { 0x2703, 35 }, { 0x2704, 36 }, { 0x2706, 38 }, { 0x2707, 39 }, { 0x2708, 40 }, { 0x2709, 41 }, { 0x270c, 44 }, { 0x270d, 45 }, { 0x270e, 46 }, { 0x270f, 47 }, { 0x2710, 48 }, { 0x2711, 49 }, { 0x2712, 50 }, { 0x2713, 51 }, { 0x2714, 52 }, { 0x2715, 53 }, { 0x2716, 54 }, { 0x2717, 55 }, { 0x2718, 56 }, { 0x2719, 57 }, { 0x271a, 58 }, { 0x271b, 59 }, { 0x271c, 60 }, { 0x271d, 61 }, { 0x271e, 62 }, { 0x271f, 63 }, { 0x2720, 64 }, { 0x2721, 65 }, { 0x2722, 66 }, { 0x2723, 67 }, { 0x2724, 68 }, { 0x2725, 69 }, { 0x2726, 70 }, { 0x2727, 71 }, { 0x2729, 73 }, { 0x272a, 74 }, { 0x272b, 75 }, { 0x272c, 76 }, { 0x272d, 77 }, { 0x272e, 78 }, { 0x272f, 79 }, { 0x2730, 80 }, { 0x2731, 81 }, { 0x2732, 82 }, { 0x2733, 83 }, { 0x2734, 84 }, { 0x2735, 85 }, { 0x2736, 86 }, { 0x2737, 87 }, { 0x2738, 88 }, { 0x2739, 89 }, { 0x273a, 90 }, { 0x273b, 91 }, { 0x273c, 92 }, { 0x273d, 93 }, { 0x273e, 94 }, { 0x273f, 95 }, { 0x2740, 96 }, { 0x2741, 97 }, { 0x2742, 98 }, { 0x2743, 99 }, { 0x2744, 100 }, { 0x2745, 101 }, { 0x2746, 102 }, { 0x2747, 103 }, { 0x2748, 104 }, { 0x2749, 105 }, { 0x274a, 106 }, { 0x274b, 107 }, { 0x274d, 109 }, { 0x274f, 111 }, { 0x2750, 112 }, { 0x2751, 113 }, { 0x2752, 114 }, { 0x2756, 118 }, { 0x2758, 120 }, { 0x2759, 121 }, { 0x275a, 122 }, { 0x275b, 123 }, { 0x275c, 124 }, { 0x275d, 125 }, { 0x275e, 126 }, { 0x2761, 161 }, { 0x2762, 162 }, { 0x2763, 163 }, { 0x2764, 164 }, { 0x2765, 165 }, { 0x2766, 166 }, { 0x2767, 167 }, { 0x2776, 182 }, { 0x2777, 183 }, { 0x2778, 184 }, { 0x2779, 185 }, { 0x277a, 186 }, { 0x277b, 187 }, { 0x277c, 188 }, { 0x277d, 189 }, { 0x277e, 190 }, { 0x277f, 191 }, { 0x2780, 192 }, { 0x2781, 193 }, { 0x2782, 194 }, { 0x2783, 195 }, { 0x2784, 196 }, { 0x2785, 197 }, { 0x2786, 198 }, { 0x2787, 199 }, { 0x2788, 200 }, { 0x2789, 201 }, { 0x278a, 202 }, { 0x278b, 203 }, { 0x278c, 204 }, { 0x278d, 205 }, { 0x278e, 206 }, { 0x278f, 207 }, { 0x2790, 208 }, { 0x2791, 209 }, { 0x2792, 210 }, { 0x2793, 211 }, { 0x2794, 212 }, { 0x2798, 216 }, { 0x2799, 217 }, { 0x279a, 218 }, { 0x279b, 219 }, { 0x279c, 220 }, { 0x279d, 221 }, { 0x279e, 222 }, { 0x279f, 223 }, { 0x27a0, 224 }, { 0x27a1, 225 }, { 0x27a2, 226 }, { 0x27a3, 227 }, { 0x27a4, 228 }, { 0x27a5, 229 }, { 0x27a6, 230 }, { 0x27a7, 231 }, { 0x27a8, 232 }, { 0x27a9, 233 }, { 0x27aa, 234 }, { 0x27ab, 235 }, { 0x27ac, 236 }, { 0x27ad, 237 }, { 0x27ae, 238 }, { 0x27af, 239 }, { 0x27b1, 241 }, { 0x27b2, 242 }, { 0x27b3, 243 }, { 0x27b4, 244 }, { 0x27b5, 245 }, { 0x27b6, 246 }, { 0x27b7, 247 }, { 0x27b8, 248 }, { 0x27b9, 249 }, { 0x27ba, 250 }, { 0x27bb, 251 }, { 0x27bc, 252 }, { 0x27bd, 253 }, { 0x27be, 254 }, { 0xf8d7, 128 }, { 0xf8d8, 129 }, { 0xf8d9, 130 }, { 0xf8da, 131 }, { 0xf8db, 132 }, { 0xf8dc, 133 }, { 0xf8dd, 134 }, { 0xf8de, 135 }, { 0xf8df, 136 }, { 0xf8e0, 137 }, { 0xf8e1, 138 }, { 0xf8e2, 139 }, { 0xf8e3, 140 }, { 0xf8e4, 141 }, }; static const int number_of_entries_in_unicode_to_standard_table = 154; static const Unicode_to_Type1_table unicode_to_standard_lookup_table[154] = { { 0x0020, 32 }, { 0x0021, 33 }, { 0x0022, 34 }, { 0x0023, 35 }, { 0x0024, 36 }, { 0x0025, 37 }, { 0x0026, 38 }, { 0x0027, 169 }, { 0x0028, 40 }, { 0x0029, 41 }, { 0x002a, 42 }, { 0x002b, 43 }, { 0x002c, 44 }, { 0x002d, 45 }, { 0x002e, 46 }, { 0x002f, 47 }, { 0x0030, 48 }, { 0x0031, 49 }, { 0x0032, 50 }, { 0x0033, 51 }, { 0x0034, 52 }, { 0x0035, 53 }, { 0x0036, 54 }, { 0x0037, 55 }, { 0x0038, 56 }, { 0x0039, 57 }, { 0x003a, 58 }, { 0x003b, 59 }, { 0x003c, 60 }, { 0x003d, 61 }, { 0x003e, 62 }, { 0x003f, 63 }, { 0x0040, 64 }, { 0x0041, 65 }, { 0x0042, 66 }, { 0x0043, 67 }, { 0x0044, 68 }, { 0x0045, 69 }, { 0x0046, 70 }, { 0x0047, 71 }, { 0x0048, 72 }, { 0x0049, 73 }, { 0x004a, 74 }, { 0x004b, 75 }, { 0x004c, 76 }, { 0x004d, 77 }, { 0x004e, 78 }, { 0x004f, 79 }, { 0x0050, 80 }, { 0x0051, 81 }, { 0x0052, 82 }, { 0x0053, 83 }, { 0x0054, 84 }, { 0x0055, 85 }, { 0x0056, 86 }, { 0x0057, 87 }, { 0x0058, 88 }, { 0x0059, 89 }, { 0x005a, 90 }, { 0x005b, 91 }, { 0x005c, 92 }, { 0x005d, 93 }, { 0x005e, 94 }, { 0x005f, 95 }, { 0x0060, 193 }, { 0x0061, 97 }, { 0x0062, 98 }, { 0x0063, 99 }, { 0x0064, 100 }, { 0x0065, 101 }, { 0x0066, 102 }, { 0x0067, 103 }, { 0x0068, 104 }, { 0x0069, 105 }, { 0x006a, 106 }, { 0x006b, 107 }, { 0x006c, 108 }, { 0x006d, 109 }, { 0x006e, 110 }, { 0x006f, 111 }, { 0x0070, 112 }, { 0x0071, 113 }, { 0x0072, 114 }, { 0x0073, 115 }, { 0x0074, 116 }, { 0x0075, 117 }, { 0x0076, 118 }, { 0x0077, 119 }, { 0x0078, 120 }, { 0x0079, 121 }, { 0x007a, 122 }, { 0x007b, 123 }, { 0x007c, 124 }, { 0x007d, 125 }, { 0x007e, 126 }, { 0x00a0, 32 }, { 0x00a1, 161 }, { 0x00a2, 162 }, { 0x00a3, 163 }, { 0x00a4, 168 }, { 0x00a5, 165 }, { 0x00a7, 167 }, { 0x00a8, 200 }, { 0x00aa, 227 }, { 0x00ab, 171 }, { 0x00ad, 45 }, { 0x00af, 197 }, { 0x00b4, 194 }, { 0x00b6, 182 }, { 0x00b7, 180 }, { 0x00b8, 203 }, { 0x00ba, 235 }, { 0x00bb, 187 }, { 0x00bf, 191 }, { 0x00c6, 225 }, { 0x00d8, 233 }, { 0x00df, 251 }, { 0x00e6, 241 }, { 0x00f8, 249 }, { 0x0131, 245 }, { 0x0141, 232 }, { 0x0142, 248 }, { 0x0152, 234 }, { 0x0153, 250 }, { 0x0192, 166 }, { 0x02c6, 195 }, { 0x02c7, 207 }, { 0x02c9, 197 }, { 0x02d8, 198 }, { 0x02d9, 199 }, { 0x02da, 202 }, { 0x02db, 206 }, { 0x02dc, 196 }, { 0x02dd, 205 }, { 0x2013, 177 }, { 0x2014, 208 }, { 0x2018, 96 }, { 0x2019, 39 }, { 0x201a, 184 }, { 0x201c, 170 }, { 0x201d, 186 }, { 0x201e, 185 }, { 0x2020, 178 }, { 0x2021, 179 }, { 0x2022, 183 }, { 0x2026, 188 }, { 0x2030, 189 }, { 0x2039, 172 }, { 0x203a, 173 }, { 0x2044, 164 }, { 0x2215, 164 }, { 0x2219, 180 }, { 0xfb01, 174 }, { 0xfb02, 175 }, }; static const int number_of_entries_in_unicode_to_symbol_table = 194; static const Unicode_to_Type1_table unicode_to_symbol_lookup_table[194] = { { 0x0020, 32 }, { 0x0021, 33 }, { 0x0023, 35 }, { 0x0025, 37 }, { 0x0026, 38 }, { 0x0028, 40 }, { 0x0029, 41 }, { 0x002b, 43 }, { 0x002c, 44 }, { 0x002e, 46 }, { 0x002f, 47 }, { 0x0030, 48 }, { 0x0031, 49 }, { 0x0032, 50 }, { 0x0033, 51 }, { 0x0034, 52 }, { 0x0035, 53 }, { 0x0036, 54 }, { 0x0037, 55 }, { 0x0038, 56 }, { 0x0039, 57 }, { 0x003a, 58 }, { 0x003b, 59 }, { 0x003c, 60 }, { 0x003d, 61 }, { 0x003e, 62 }, { 0x003f, 63 }, { 0x005b, 91 }, { 0x005d, 93 }, { 0x005f, 95 }, { 0x007b, 123 }, { 0x007c, 124 }, { 0x007d, 125 }, { 0x00a0, 32 }, { 0x00ac, 216 }, { 0x00b0, 176 }, { 0x00b1, 177 }, { 0x00b5, 109 }, { 0x00d7, 180 }, { 0x00f7, 184 }, { 0x0192, 166 }, { 0x0391, 65 }, { 0x0392, 66 }, { 0x0393, 71 }, { 0x0394, 68 }, { 0x0395, 69 }, { 0x0396, 90 }, { 0x0397, 72 }, { 0x0398, 81 }, { 0x0399, 73 }, { 0x039a, 75 }, { 0x039b, 76 }, { 0x039c, 77 }, { 0x039d, 78 }, { 0x039e, 88 }, { 0x039f, 79 }, { 0x03a0, 80 }, { 0x03a1, 82 }, { 0x03a3, 83 }, { 0x03a4, 84 }, { 0x03a5, 85 }, { 0x03a6, 70 }, { 0x03a7, 67 }, { 0x03a8, 89 }, { 0x03a9, 87 }, { 0x03b1, 97 }, { 0x03b2, 98 }, { 0x03b3, 103 }, { 0x03b4, 100 }, { 0x03b5, 101 }, { 0x03b6, 122 }, { 0x03b7, 104 }, { 0x03b8, 113 }, { 0x03b9, 105 }, { 0x03ba, 107 }, { 0x03bb, 108 }, { 0x03bc, 109 }, { 0x03bd, 110 }, { 0x03be, 120 }, { 0x03bf, 111 }, { 0x03c0, 112 }, { 0x03c1, 114 }, { 0x03c2, 86 }, { 0x03c3, 115 }, { 0x03c4, 116 }, { 0x03c5, 117 }, { 0x03c6, 102 }, { 0x03c7, 99 }, { 0x03c8, 121 }, { 0x03c9, 119 }, { 0x03d1, 74 }, { 0x03d2, 161 }, { 0x03d5, 106 }, { 0x03d6, 118 }, { 0x2022, 183 }, { 0x2026, 188 }, { 0x2032, 162 }, { 0x2033, 178 }, { 0x2044, 164 }, { 0x20ac, 160 }, { 0x2111, 193 }, { 0x2118, 195 }, { 0x211c, 194 }, { 0x2126, 87 }, { 0x2135, 192 }, { 0x2190, 172 }, { 0x2191, 173 }, { 0x2192, 174 }, { 0x2193, 175 }, { 0x2194, 171 }, { 0x21b5, 191 }, { 0x21d0, 220 }, { 0x21d1, 221 }, { 0x21d2, 222 }, { 0x21d3, 223 }, { 0x21d4, 219 }, { 0x2200, 34 }, { 0x2202, 182 }, { 0x2203, 36 }, { 0x2205, 198 }, { 0x2206, 68 }, { 0x2207, 209 }, { 0x2208, 206 }, { 0x2209, 207 }, { 0x220b, 39 }, { 0x220f, 213 }, { 0x2211, 229 }, { 0x2212, 45 }, { 0x2215, 164 }, { 0x2217, 42 }, { 0x221a, 214 }, { 0x221d, 181 }, { 0x221e, 165 }, { 0x2220, 208 }, { 0x2227, 217 }, { 0x2228, 218 }, { 0x2229, 199 }, { 0x222a, 200 }, { 0x222b, 242 }, { 0x2234, 92 }, { 0x223c, 126 }, { 0x2245, 64 }, { 0x2248, 187 }, { 0x2260, 185 }, { 0x2261, 186 }, { 0x2264, 163 }, { 0x2265, 179 }, { 0x2282, 204 }, { 0x2283, 201 }, { 0x2284, 203 }, { 0x2286, 205 }, { 0x2287, 202 }, { 0x2295, 197 }, { 0x2297, 196 }, { 0x22a5, 94 }, { 0x22c5, 215 }, { 0x2320, 243 }, { 0x2321, 245 }, { 0x2329, 225 }, { 0x232a, 241 }, { 0x25ca, 224 }, { 0x2660, 170 }, { 0x2663, 167 }, { 0x2665, 169 }, { 0x2666, 168 }, { 0xf6d9, 211 }, { 0xf6da, 210 }, { 0xf6db, 212 }, { 0xf8e5, 96 }, { 0xf8e6, 189 }, { 0xf8e7, 190 }, { 0xf8e8, 226 }, { 0xf8e9, 227 }, { 0xf8ea, 228 }, { 0xf8eb, 230 }, { 0xf8ec, 231 }, { 0xf8ed, 232 }, { 0xf8ee, 233 }, { 0xf8ef, 234 }, { 0xf8f0, 235 }, { 0xf8f1, 236 }, { 0xf8f2, 237 }, { 0xf8f3, 238 }, { 0xf8f4, 239 }, { 0xf8f5, 244 }, { 0xf8f6, 246 }, { 0xf8f7, 247 }, { 0xf8f8, 248 }, { 0xf8f9, 249 }, { 0xf8fa, 250 }, { 0xf8fb, 251 }, { 0xf8fc, 252 }, { 0xf8fd, 253 }, { 0xf8fe, 254 }, }; #endif // __PLUNICODE_TYPE1_H__ plplot-5.10.0+dfsg/include/plplotcanvas.h 644 1750 1750 6730512012305413 172540ustar andrewandrew// PlplotCanvas - a GnomeCanvas widget for use with plplot's gcw driver // // Copyright (C) 2004, 2005 Thomas J. Duck // All rights reserved. // // Thomas J. Duck // Department of Physics and Atmospheric Science, // Dalhousie University, Halifax, Nova Scotia, Canada, B3H 3J5 // // // NOTICE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 // USA // #ifndef __PLPLOTCANVAS_H__ #define __PLPLOTCANVAS_H__ #include "plplot.h" #include "gcw.h" #include #include G_BEGIN_DECLS #define PLPLOT_TYPE_CANVAS plplot_canvas_get_type() #define PLPLOT_CANVAS( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( ( obj ), PLPLOT_TYPE_CANVAS, PlplotCanvas ) ) #define PLPLOT_CANVAS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( ( klass ), PLPLOT_TYPE_CANVAS, PlplotCanvasClass ) ) #define PLPLOT_IS_CANVAS( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( ( obj ), PLPLOT_TYPE_CANVAS ) ) #define PLPLOT_IS_CANVAS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( ( klass ), PLPLOT_TYPE_CANVAS ) ) #define PLPLOT_CANVAS_GET_CLASS( o ) ( G_TYPE_INSTANCE_GET_CLASS( ( o ), PLPLOT_TYPE_CANVAS, PlplotCanvasClass ) ) typedef struct _PlplotCanvas PlplotCanvas; typedef struct _PlplotCanvasClass PlplotCanvasClass; struct _PlplotCanvas { GnomeCanvas parent; gint Nstream; // The stream number }; struct _PlplotCanvasClass { GnomeCanvasClass parent; }; PLDLLIMPEXP_GNOME2 GType plplot_canvas_get_type(); PLDLLIMPEXP_GNOME2 PlplotCanvas* plplot_canvas_new(); PLDLLIMPEXP_GNOME2 void plplot_canvas_devinit( PlplotCanvas* self ); PLDLLIMPEXP_GNOME2 void plplot_canvas_dispose( PlplotCanvas *self ); PLDLLIMPEXP_GNOME2 gint plplot_canvas_get_stream_number( PlplotCanvas* self ); PLDLLIMPEXP_GNOME2 void plplot_canvas_set_size( PlplotCanvas* self, gint width, gint height ); PLDLLIMPEXP_GNOME2 void plplot_canvas_set_zoom( PlplotCanvas* self, gdouble magnification ); PLDLLIMPEXP_GNOME2 void plplot_canvas_use_text( PlplotCanvas* self, gboolean use_text ); PLDLLIMPEXP_GNOME2 void plplot_canvas_use_pixmap( PlplotCanvas* self, gboolean use_pixmap ); PLDLLIMPEXP_GNOME2 void plplot_canvas_use_persistence( PlplotCanvas* self, gboolean use_persistence ); //-------------------------------------------------------------------------- // Plplot wrappers - last updated 29 January 2005 // // This should be kept up-to-date with plplot.h // // //-------------------------------------------------------------------------- // set the format of the contour labels PLDLLIMPEXP_GNOME2 void plplot_canvas_setcontlabelformat( PlplotCanvas* self, PLINT lexp, PLINT sigdig ); // set offset and spacing of contour labels PLDLLIMPEXP_GNOME2 void plplot_canvas_setcontlabelparam( PlplotCanvas* self, PLFLT offset, PLFLT size, PLFLT spacing, PLINT active ); // Advance to subpage "page", or to the next one if "page" = 0. PLDLLIMPEXP_GNOME2 void plplot_canvas_adv( PlplotCanvas* self, PLINT page ); // simple arrow plotter. PLDLLIMPEXP_GNOME2 void plplot_canvas_arrows( PlplotCanvas* self, PLFLT *u, PLFLT *v, PLFLT *x, PLFLT *y, PLINT n, PLFLT scale, PLFLT dx, PLFLT dy ); PLDLLIMPEXP_GNOME2 void plplot_canvas_vect( PlplotCanvas* self, PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP_GNOME2 void plplot_canvas_svect( PlplotCanvas* self, PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLINT fill ); // This functions similarly to plbox() except that the origin of the axes // is placed at the user-specified point (x0, y0). PLDLLIMPEXP_GNOME2 void plplot_canvas_axes( PlplotCanvas* self, PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub ); // Plot a histogram using x to store data values and y to store frequencies PLDLLIMPEXP_GNOME2 void plplot_canvas_bin( PlplotCanvas* self, PLINT nbin, PLFLT *x, PLFLT *y, PLINT center ); // Start new page. Should only be used with pleop(). PLDLLIMPEXP_GNOME2 void plplot_canvas_bop( PlplotCanvas* self ); // This draws a box around the current viewport. PLDLLIMPEXP_GNOME2 void plplot_canvas_box( PlplotCanvas* self, const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub ); // This is the 3-d analogue of plbox(). PLDLLIMPEXP_GNOME2 void plplot_canvas_box3( PlplotCanvas* self, const char *xopt, const char *xlabel, PLFLT xtick, PLINT nsubx, const char *yopt, const char *ylabel, PLFLT ytick, PLINT nsuby, const char *zopt, const char *zlabel, PLFLT ztick, PLINT nsubz ); // Calculate world coordinates and subpage from relative device coordinates. PLDLLIMPEXP_GNOME2 void plplot_canvas_calc_world( PlplotCanvas* self, PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window ); // Clear current subpage. PLDLLIMPEXP_GNOME2 void plplot_canvas_clear( PlplotCanvas* self ); // Set color, map 0. Argument is integer between 0 and 15. PLDLLIMPEXP_GNOME2 void plplot_canvas_col0( PlplotCanvas* self, PLINT icol0 ); // Set color, map 1. Argument is a float between 0. and 1. PLDLLIMPEXP_GNOME2 void plplot_canvas_col1( PlplotCanvas* self, PLFLT col1 ); // Draws a contour plot from data in f(nx,ny). Is just a front-end to // plfcont, with a particular choice for f2eval and f2eval_data. // PLDLLIMPEXP_GNOME2 void plplot_canvas_cont( PlplotCanvas* self, PLFLT **f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Draws a contour plot using the function evaluator f2eval and data stored // by way of the f2eval_data pointer. This allows arbitrary organizations // of 2d array data to be used. // PLDLLIMPEXP_GNOME2 void plplot_canvas_fcont( PlplotCanvas* self, PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Copies state parameters from the reference stream to the current stream. // PLDLLIMPEXP_GNOME2 void plplot_canvas_cpstrm(PlplotCanvas* self, PLINT iplsr, PLINT flags); // Converts input values from relative device coordinates to relative plot // coordinates. PLDLLIMPEXP_GNOME2 void plplot_canvas_did2pc( PlplotCanvas* self, PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax ); // Converts input values from relative plot coordinates to relative // device coordinates. PLDLLIMPEXP_GNOME2 void plplot_canvas_dip2dc( PlplotCanvas* self, PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax ); // End a plotting session for all open streams. // PLDLLIMPEXP_GNOME2 void plplot_canvas_plend(PlplotCanvas* self); // End a plotting session for the current stream only. // PLDLLIMPEXP_GNOME2 void plplot_canvas_plend1(PlplotCanvas* self); // Simple interface for defining viewport and window. // PLDLLIMPEXP_GNOME2 void plplot_canvas_plenv(PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis); // similar to plenv() above, but in multiplot mode does not advance the subpage, // instead the current subpage is cleared // PLDLLIMPEXP_GNOME2 void plplot_canvas_plenv0(PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis); // End current page. Should only be used with plbop(). PLDLLIMPEXP_GNOME2 void plplot_canvas_eop( PlplotCanvas* self ); // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) PLDLLIMPEXP_GNOME2 void plplot_canvas_errx( PlplotCanvas* self, PLINT n, PLFLT *xmin, PLFLT *xmax, PLFLT *y ); // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) PLDLLIMPEXP_GNOME2 void plplot_canvas_erry( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *ymin, PLFLT *ymax ); // Advance to the next family file on the next new page // PLDLLIMPEXP_GNOME2 void plplot_canvas_famadv(PlplotCanvas* self); // Pattern fills the polygon bounded by the input points. PLDLLIMPEXP_GNOME2 void plplot_canvas_fill( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y ); // Pattern fills the 3d polygon bounded by the input points. PLDLLIMPEXP_GNOME2 void plplot_canvas_fill3( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLFLT *z ); // Flushes the output stream. Use sparingly, if at all. // PLDLLIMPEXP_GNOME2 void plplot_canvas_flush(PlplotCanvas* self); // Sets the global font flag to 'ifont'. PLDLLIMPEXP_GNOME2 void plplot_canvas_font( PlplotCanvas* self, PLINT ifont ); // Load specified font set. PLDLLIMPEXP_GNOME2 void plplot_canvas_fontld( PlplotCanvas* self, PLINT fnt ); // Get character default height and current (scaled) height PLDLLIMPEXP_GNOME2 void plplot_canvas_gchr( PlplotCanvas* self, PLFLT *p_def, PLFLT *p_ht ); // Returns 8 bit RGB values for given color from color map 0 PLDLLIMPEXP_GNOME2 void plplot_canvas_gcol0( PlplotCanvas* self, PLINT icol0, PLINT *r, PLINT *g, PLINT *b ); // Returns the background color by 8 bit RGB value PLDLLIMPEXP_GNOME2 void plplot_canvas_gcolbg( PlplotCanvas* self, PLINT *r, PLINT *g, PLINT *b ); // Returns the current compression setting PLDLLIMPEXP_GNOME2 void plplot_canvas_gcompression( PlplotCanvas* self, PLINT *compression ); // Get the current device (keyword) name PLDLLIMPEXP_GNOME2 void plplot_canvas_gdev( PlplotCanvas* self, char *p_dev ); // Retrieve current window into device space PLDLLIMPEXP_GNOME2 void plplot_canvas_gdidev( PlplotCanvas* self, PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy ); // Get plot orientation PLDLLIMPEXP_GNOME2 void plplot_canvas_gdiori( PlplotCanvas* self, PLFLT *p_rot ); // Retrieve current window into plot space PLDLLIMPEXP_GNOME2 void plplot_canvas_gdiplt( PlplotCanvas* self, PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax ); // Get FCI (font characterization integer) PLDLLIMPEXP_GNOME2 void plplot_canvas_gfci( PlplotCanvas* self, PLUNICODE *pfci ); // Get family file parameters // PLDLLIMPEXP_GNOME2 void plplot_canvas_gfam(PlplotCanvas* self, PLINT *p_fam, PLINT *p_num, PLINT *p_bmax); // Get the (current) output file name. Must be preallocated to >80 bytes PLDLLIMPEXP_GNOME2 void plplot_canvas_gfnam( PlplotCanvas* self, char *fnam ); // Get the (current) run level. PLDLLIMPEXP_GNOME2 void plplot_canvas_glevel( PlplotCanvas* self, PLINT *p_level ); // Get output device parameters. PLDLLIMPEXP_GNOME2 void plplot_canvas_gpage( PlplotCanvas* self, PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng, PLINT *p_xoff, PLINT *p_yoff ); // Switches to graphics screen. // PLDLLIMPEXP_GNOME2 void plplot_canvas_gra(PlplotCanvas* self); // grid irregularly sampled data PLDLLIMPEXP_GNOME2 void plplot_canvas_griddata( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT *z, PLINT npts, PLFLT *xg, PLINT nptsx, PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data ); // Get subpage boundaries in absolute coordinates PLDLLIMPEXP_GNOME2 void plplot_canvas_gspa( PlplotCanvas* self, PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax ); // Get current stream number. // PLDLLIMPEXP_GNOME2 void plplot_canvas_gstrm(PlplotCanvas* self, PLINT *p_strm); // Get the current library version number PLDLLIMPEXP_GNOME2 void plplot_canvas_gver( PlplotCanvas* self, char *p_ver ); // Get viewport boundaries in normalized device coordinates PLDLLIMPEXP_GNOME2 void plplot_canvas_gvpd( PlplotCanvas* self, PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); // Get viewport boundaries in world coordinates PLDLLIMPEXP_GNOME2 void plplot_canvas_gvpw( PlplotCanvas* self, PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); // Get x axis labeling parameters PLDLLIMPEXP_GNOME2 void plplot_canvas_gxax( PlplotCanvas* self, PLINT *p_digmax, PLINT *p_digits ); // Get y axis labeling parameters PLDLLIMPEXP_GNOME2 void plplot_canvas_gyax( PlplotCanvas* self, PLINT *p_digmax, PLINT *p_digits ); // Get z axis labeling parameters PLDLLIMPEXP_GNOME2 void plplot_canvas_gzax( PlplotCanvas* self, PLINT *p_digmax, PLINT *p_digits ); // Draws a histogram of n values of a variable in array data[0..n-1] PLDLLIMPEXP_GNOME2 void plplot_canvas_hist( PlplotCanvas* self, PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT oldwin ); // Set current color (map 0) by hue, lightness, and saturation. PLDLLIMPEXP_GNOME2 void plplot_canvas_hls( PlplotCanvas* self, PLFLT h, PLFLT l, PLFLT s ); // Initializes PLplot, using preset or default options // PLDLLIMPEXP_GNOME2 void plplot_canvas_plinit(PlplotCanvas* self); // Draws a line segment from (x1, y1) to (x2, y2). PLDLLIMPEXP_GNOME2 void plplot_canvas_join( PlplotCanvas* self, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ); // Simple routine for labelling graphs. PLDLLIMPEXP_GNOME2 void plplot_canvas_lab( PlplotCanvas* self, const char *xlabel, const char *ylabel, const char *tlabel ); // Sets position of the light source PLDLLIMPEXP_GNOME2 void plplot_canvas_lightsource( PlplotCanvas* self, PLFLT x, PLFLT y, PLFLT z ); // Draws line segments connecting a series of points. PLDLLIMPEXP_GNOME2 void plplot_canvas_line( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y ); // Draws a line in 3 space. PLDLLIMPEXP_GNOME2 void plplot_canvas_line3( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLFLT *z ); // Set line style. PLDLLIMPEXP_GNOME2 void plplot_canvas_lsty( PlplotCanvas* self, PLINT lin ); // plot continental outline in world coordinates PLDLLIMPEXP_GNOME2 void plplot_canvas_map( PlplotCanvas* self, void ( *mapform )( PLINT, PLFLT *, PLFLT * ), char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); // Plot the latitudes and longitudes on the background. PLDLLIMPEXP_GNOME2 void plplot_canvas_meridians( PlplotCanvas* self, void ( *mapform )( PLINT, PLFLT *, PLFLT * ), PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); // Plots a mesh representation of the function z[x][y]. PLDLLIMPEXP_GNOME2 void plplot_canvas_mesh( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt ); // Plots a mesh representation of the function z[x][y] with contour PLDLLIMPEXP_GNOME2 void plplot_canvas_meshc( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); // Creates a new stream and makes it the default. // PLDLLIMPEXP_GNOME2 void plplot_canvas_mkstrm(PlplotCanvas* self, PLINT *p_strm); // Prints out "text" at specified position relative to viewport PLDLLIMPEXP_GNOME2 void plplot_canvas_mtex( PlplotCanvas* self, const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text ); // Plots a 3-d representation of the function z[x][y]. PLDLLIMPEXP_GNOME2 void plplot_canvas_plot3d( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLINT side ); // Plots a 3-d representation of the function z[x][y] with contour. PLDLLIMPEXP_GNOME2 void plplot_canvas_plot3dc( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); // Plots a 3-d representation of the function z[x][y] with contour and // y index limits. PLDLLIMPEXP_GNOME2 void plplot_canvas_plot3dcl( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax ); // Set fill pattern directly. PLDLLIMPEXP_GNOME2 void plplot_canvas_pat( PlplotCanvas* self, PLINT nlin, PLINT *inc, PLINT *del ); // Plots array y against x for n points using ASCII code "code". PLDLLIMPEXP_GNOME2 void plplot_canvas_poin( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLINT code ); // Draws a series of points in 3 space. PLDLLIMPEXP_GNOME2 void plplot_canvas_poin3( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT code ); // Draws a polygon in 3 space. PLDLLIMPEXP_GNOME2 void plplot_canvas_poly3( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT *draw, PLINT ifcc ); // Set the floating point precision (in number of places) in numeric labels. PLDLLIMPEXP_GNOME2 void plplot_canvas_prec( PlplotCanvas* self, PLINT setp, PLINT prec ); // Set fill pattern, using one of the predefined patterns. PLDLLIMPEXP_GNOME2 void plplot_canvas_psty( PlplotCanvas* self, PLINT patt ); // Prints out "text" at world cooordinate (x,y). PLDLLIMPEXP_GNOME2 void plplot_canvas_ptex( PlplotCanvas* self, PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, const char *text ); // Replays contents of plot buffer to current device/file. PLDLLIMPEXP_GNOME2 void plplot_canvas_replot( PlplotCanvas* self ); // Set line color by red, green, blue from 0. to 1. PLDLLIMPEXP_GNOME2 void plplot_canvas_rgb( PlplotCanvas* self, PLFLT r, PLFLT g, PLFLT b ); // Set line color by 8 bit RGB values. PLDLLIMPEXP_GNOME2 void plplot_canvas_rgb1( PlplotCanvas* self, PLINT r, PLINT g, PLINT b ); // Set character height. PLDLLIMPEXP_GNOME2 void plplot_canvas_schr( PlplotCanvas* self, PLFLT def, PLFLT scale ); // Set color map 0 colors by 8 bit RGB values PLDLLIMPEXP_GNOME2 void plplot_canvas_scmap0( PlplotCanvas* self, PLINT *r, PLINT *g, PLINT *b, PLINT ncol0 ); // Set number of colors in cmap 0 PLDLLIMPEXP_GNOME2 void plplot_canvas_scmap0n( PlplotCanvas* self, PLINT ncol0 ); // Set color map 1 colors by 8 bit RGB values PLDLLIMPEXP_GNOME2 void plplot_canvas_scmap1( PlplotCanvas* self, PLINT *r, PLINT *g, PLINT *b, PLINT ncol1 ); // Set color map 1 colors using a piece-wise linear relationship between // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. PLDLLIMPEXP_GNOME2 void plplot_canvas_scmap1l( PlplotCanvas* self, PLINT itype, PLINT npts, PLFLT *intensity, PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLINT *alt_hue_path ); // Set number of colors in cmap 1 PLDLLIMPEXP_GNOME2 void plplot_canvas_scmap1n( PlplotCanvas* self, PLINT ncol1 ); // Set a given color from color map 0 by 8 bit RGB value PLDLLIMPEXP_GNOME2 void plplot_canvas_scol0( PlplotCanvas* self, PLINT icol0, PLINT r, PLINT g, PLINT b ); // Set the background color by 8 bit RGB value PLDLLIMPEXP_GNOME2 void plplot_canvas_scolbg( PlplotCanvas* self, PLINT r, PLINT g, PLINT b ); // Used to globally turn color output on/off PLDLLIMPEXP_GNOME2 void plplot_canvas_scolor( PlplotCanvas* self, PLINT color ); // Set the compression level PLDLLIMPEXP_GNOME2 void plplot_canvas_scompression( PlplotCanvas* self, PLINT compression ); // Set the device (keyword) name // PLDLLIMPEXP_GNOME2 void plplot_canvas_sdev(PlplotCanvas* self, const char *devname); // Set window into device space using margin, aspect ratio, and // justification PLDLLIMPEXP_GNOME2 void plplot_canvas_sdidev( PlplotCanvas* self, PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy ); // Set up transformation from metafile coordinates. PLDLLIMPEXP_GNOME2 void plplot_canvas_sdimap( PlplotCanvas* self, PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm ); // Set plot orientation, specifying rotation in units of pi/2. PLDLLIMPEXP_GNOME2 void plplot_canvas_sdiori( PlplotCanvas* self, PLFLT rot ); // Set window into plot space PLDLLIMPEXP_GNOME2 void plplot_canvas_sdiplt( PlplotCanvas* self, PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ); // Set window into plot space incrementally (zoom) PLDLLIMPEXP_GNOME2 void plplot_canvas_sdiplz( PlplotCanvas* self, PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ); // Set the escape character for text strings. PLDLLIMPEXP_GNOME2 void plplot_canvas_sesc( PlplotCanvas* self, char esc ); // Set family file parameters // PLDLLIMPEXP_GNOME2 void plplot_canvas_sfam(PlplotCanvas* self, PLINT fam, PLINT num, PLINT bmax); // Set FCI (font characterization integer) PLDLLIMPEXP_GNOME2 void plplot_canvas_sfci( PlplotCanvas* self, PLUNICODE fci ); // Set the output file name. PLDLLIMPEXP_GNOME2 void plplot_canvas_sfnam( PlplotCanvas* self, const char *fnam ); // Shade region. PLDLLIMPEXP_GNOME2 void plplot_canvas_shade( PlplotCanvas* self, PLFLT **a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP_GNOME2 void plplot_canvas_shade1( PlplotCanvas* self, PLFLT *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP_GNOME2 void plplot_canvas_shades( PlplotCanvas* self, PLFLT **a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT *clevel, PLINT nlevel, PLINT fill_width, PLINT cont_color, PLINT cont_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP_GNOME2 void plplot_canvas_fshade( PlplotCanvas* self, PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ), PLPointer c2eval_data, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLINT sh_width, PLINT min_color, PLINT min_width, PLINT max_color, PLINT max_width, void ( *fill )( PLINT, PLFLT *, PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Set up lengths of major tick marks. PLDLLIMPEXP_GNOME2 void plplot_canvas_smaj( PlplotCanvas* self, PLFLT def, PLFLT scale ); // Set the memory area to be plotted (with the 'mem' driver) // PLDLLIMPEXP_GNOME2 void plplot_canvas_smem(PlplotCanvas* self, PLINT maxx, PLINT maxy, void *plotmem); // Set up lengths of minor tick marks. PLDLLIMPEXP_GNOME2 void plplot_canvas_smin( PlplotCanvas* self, PLFLT def, PLFLT scale ); // Set orientation. Must be done before calling plinit. // PLDLLIMPEXP_GNOME2 void plplot_canvas_sori(PlplotCanvas* self, PLINT ori); // Set output device parameters. Usually ignored by the driver. PLDLLIMPEXP_GNOME2 void plplot_canvas_spage( PlplotCanvas* self, PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff ); // Set the pause (on end-of-page) status // PLDLLIMPEXP_GNOME2 void plplot_canvas_spause(PlplotCanvas* self, PLINT pause); // Set stream number. // PLDLLIMPEXP_GNOME2 void plplot_canvas_sstrm(PlplotCanvas* self, PLINT strm); // Set the number of subwindows in x and y PLDLLIMPEXP_GNOME2 void plplot_canvas_ssub( PlplotCanvas* self, PLINT nx, PLINT ny ); // Set symbol height. PLDLLIMPEXP_GNOME2 void plplot_canvas_ssym( PlplotCanvas* self, PLFLT def, PLFLT scale ); // Initialize PLplot, passing in the windows/page settings. // PLDLLIMPEXP_GNOME2 void plplot_canvas_star(PlplotCanvas* self, PLINT nx, PLINT ny); // Initialize PLplot, passing the device name and windows/page settings. // PLDLLIMPEXP_GNOME2 void plplot_canvas_start(PlplotCanvas* self, const char *devname, PLINT nx, PLINT ny); // Add a point to a stripchart. // PLDLLIMPEXP_GNOME2 void plplot_canvas_stripa(PlplotCanvas* self, PLINT id, PLINT pen, PLFLT x, PLFLT y); // Create 1d stripchart // PLDLLIMPEXP_GNOME2 void plplot_canvas_stripc(PlplotCanvas* self, PLINT *id, char *xspec, char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLINT y_ascl, PLINT acc, PLINT colbox, PLINT collab, PLINT colline[], PLINT styline[], char *legline[], char *labx, char *laby, char *labtop); // Deletes and releases memory used by a stripchart. // PLDLLIMPEXP_GNOME2 void plplot_canvas_stripd(PlplotCanvas* self, PLINT id); // plots a 2d image (or a matrix too large for plshade() ) PLDLLIMPEXP_GNOME2 void plplot_canvas_image( PlplotCanvas* self, PLFLT **data, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); // Set up a new line style PLDLLIMPEXP_GNOME2 void plplot_canvas_styl( PlplotCanvas* self, PLINT nms, PLINT *mark, PLINT *space ); // Plots the 3d surface representation of the function z[x][y]. PLDLLIMPEXP_GNOME2 void plplot_canvas_surf3d( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel ); // Plots the 3d surface representation of the function z[x][y] with y // index limits. PLDLLIMPEXP_GNOME2 void plplot_canvas_surf3dl( PlplotCanvas* self, PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt, PLFLT *clevel, PLINT nlevel, PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax ); // Sets the edges of the viewport to the specified absolute coordinates PLDLLIMPEXP_GNOME2 void plplot_canvas_svpa( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); // Set x axis labeling parameters PLDLLIMPEXP_GNOME2 void plplot_canvas_sxax( PlplotCanvas* self, PLINT digmax, PLINT digits ); // Set inferior X window PLDLLIMPEXP_GNOME2 void plplot_canvas_sxwin( PlplotCanvas* self, PLINT window_id ); // Set y axis labeling parameters PLDLLIMPEXP_GNOME2 void plplot_canvas_syax( PlplotCanvas* self, PLINT digmax, PLINT digits ); // Plots array y against x for n points using Hershey symbol "code" PLDLLIMPEXP_GNOME2 void plplot_canvas_sym( PlplotCanvas* self, PLINT n, PLFLT *x, PLFLT *y, PLINT code ); // Set z axis labeling parameters PLDLLIMPEXP_GNOME2 void plplot_canvas_szax( PlplotCanvas* self, PLINT digmax, PLINT digits ); // Switches to text screen. PLDLLIMPEXP_GNOME2 void plplot_canvas_text( PlplotCanvas* self ); // Sets the edges of the viewport with the given aspect ratio, leaving // room for labels. PLDLLIMPEXP_GNOME2 void plplot_canvas_vasp( PlplotCanvas* self, PLFLT aspect ); // Creates the largest viewport of the specified aspect ratio that fits // within the specified normalized subpage coordinates. PLDLLIMPEXP_GNOME2 void plplot_canvas_vpas( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect ); // Creates a viewport with the specified normalized subpage coordinates. PLDLLIMPEXP_GNOME2 void plplot_canvas_vpor( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); // Defines a "standard" viewport with seven character heights for // the left margin and four character heights everywhere else. PLDLLIMPEXP_GNOME2 void plplot_canvas_vsta( PlplotCanvas* self ); // Set up a window for three-dimensional plotting. PLDLLIMPEXP_GNOME2 void plplot_canvas_w3d( PlplotCanvas* self, PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin0, PLFLT xmax0, PLFLT ymin0, PLFLT ymax0, PLFLT zmin0, PLFLT zmax0, PLFLT alt, PLFLT az ); // Set pen width. PLDLLIMPEXP_GNOME2 void plplot_canvas_wid( PlplotCanvas* self, PLINT width ); // Set up world coordinates of the viewport boundaries (2d plots). PLDLLIMPEXP_GNOME2 void plplot_canvas_wind( PlplotCanvas* self, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); // set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device PLDLLIMPEXP_GNOME2 void plplot_canvas_xormod( PlplotCanvas* self, PLINT mode, PLINT *status ); G_END_DECLS #endif // __PLPLOTCANVAS_H__ plplot-5.10.0+dfsg/include/plfci-truetype.h 644 1750 1750 722711645760115 175160ustar andrewandrew// // This header file contains the lookup table used for converting between // FCIs (font characterization integers) and font names for TrueType fonts. // // Copyright (C) 2005 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // N.B. When updating this table by hand be sure to keep it in // ascending order in fci! // #define N_TrueTypeLookup 30 static const FCI_to_FontName_Table TrueTypeLookup[N_TrueTypeLookup] = { { PL_FCI_MARK | 0x000, (const unsigned char *) PL_FREETYPE_SANS }, { PL_FCI_MARK | 0x001, (const unsigned char *) PL_FREETYPE_SERIF }, { PL_FCI_MARK | 0x002, (const unsigned char *) PL_FREETYPE_MONO }, { PL_FCI_MARK | 0x003, (const unsigned char *) PL_FREETYPE_SCRIPT }, { PL_FCI_MARK | 0x004, (const unsigned char *) PL_FREETYPE_SYMBOL }, { PL_FCI_MARK | 0x010, (const unsigned char *) PL_FREETYPE_SANS_ITALIC }, { PL_FCI_MARK | 0x011, (const unsigned char *) PL_FREETYPE_SERIF_ITALIC }, { PL_FCI_MARK | 0x012, (const unsigned char *) PL_FREETYPE_MONO_ITALIC }, { PL_FCI_MARK | 0x013, (const unsigned char *) PL_FREETYPE_SCRIPT_ITALIC }, { PL_FCI_MARK | 0x014, (const unsigned char *) PL_FREETYPE_SYMBOL_ITALIC }, { PL_FCI_MARK | 0x020, (const unsigned char *) PL_FREETYPE_SANS_OBLIQUE }, { PL_FCI_MARK | 0x021, (const unsigned char *) PL_FREETYPE_SERIF_OBLIQUE }, { PL_FCI_MARK | 0x022, (const unsigned char *) PL_FREETYPE_MONO_OBLIQUE }, { PL_FCI_MARK | 0x023, (const unsigned char *) PL_FREETYPE_SCRIPT_OBLIQUE }, { PL_FCI_MARK | 0x024, (const unsigned char *) PL_FREETYPE_SYMBOL_OBLIQUE }, { PL_FCI_MARK | 0x100, (const unsigned char *) PL_FREETYPE_SANS_BOLD }, { PL_FCI_MARK | 0x101, (const unsigned char *) PL_FREETYPE_SERIF_BOLD }, { PL_FCI_MARK | 0x102, (const unsigned char *) PL_FREETYPE_MONO_BOLD }, { PL_FCI_MARK | 0x103, (const unsigned char *) PL_FREETYPE_SCRIPT_BOLD }, { PL_FCI_MARK | 0x104, (const unsigned char *) PL_FREETYPE_SYMBOL_BOLD }, { PL_FCI_MARK | 0x110, (const unsigned char *) PL_FREETYPE_SANS_BOLD_ITALIC }, { PL_FCI_MARK | 0x111, (const unsigned char *) PL_FREETYPE_SERIF_BOLD_ITALIC }, { PL_FCI_MARK | 0x112, (const unsigned char *) PL_FREETYPE_MONO_BOLD_ITALIC }, { PL_FCI_MARK | 0x113, (const unsigned char *) PL_FREETYPE_SCRIPT_BOLD_ITALIC }, { PL_FCI_MARK | 0x114, (const unsigned char *) PL_FREETYPE_SYMBOL_BOLD_ITALIC }, { PL_FCI_MARK | 0x120, (const unsigned char *) PL_FREETYPE_SANS_BOLD_OBLIQUE }, { PL_FCI_MARK | 0x121, (const unsigned char *) PL_FREETYPE_SERIF_BOLD_OBLIQUE }, { PL_FCI_MARK | 0x122, (const unsigned char *) PL_FREETYPE_MONO_BOLD_OBLIQUE }, { PL_FCI_MARK | 0x123, (const unsigned char *) PL_FREETYPE_SCRIPT_BOLD_OBLIQUE }, { PL_FCI_MARK | 0x124, (const unsigned char *) PL_FREETYPE_SYMBOL_BOLD_OBLIQUE } }; plplot-5.10.0+dfsg/include/dirent_msvc.h 644 1750 1750 1453711571511407 170750ustar andrewandrew// // dirent.h - dirent API for Microsoft Visual Studio // // Copyright (C) 2006 Toni Ronkko // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // ``Software''), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // // // Jan 18, 2008, Toni Ronkko // Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string // between multi-byte and unicode representations. This makes the // code simpler and also allows the code to be compiled under MingW. Thanks // to Azriel Fasten for the suggestion. // // Mar 4, 2007, Toni Ronkko // Bug fix: due to the strncpy_s() function this file only compiled in // Visual Studio 2005. Using the new string functions only when the // compiler version allows. // // Nov 2, 2006, Toni Ronkko // Major update: removed support for Watcom C, MS-DOS and Turbo C to // simplify the file, updated the code to compile cleanly on Visual // Studio 2005 with both unicode and multi-byte character strings, // removed rewinddir() as it had a bug. // // Aug 20, 2006, Toni Ronkko // Removed all remarks about MSVC 1.0, which is antiqued now. Simplified // comments by removing SGML tags. // // May 14 2002, Toni Ronkko // Embedded the function definitions directly to the header so that no // source modules need to be included in the Visual Studio project. Removed // all the dependencies to other projects so that this very header can be // used independently. // // May 28 1998, Toni Ronkko // First version. // #ifndef DIRENT_H #define DIRENT_H #include #include #include typedef struct dirent { // name of current directory entry (a multi-byte character string) char d_name[MAX_PATH + 1]; // file attributes WIN32_FIND_DATAA data; } dirent; typedef struct DIR { // current directory entry dirent current; // is there an un-processed entry in current? int cached; // file search handle HANDLE search_handle; // search pattern (3 = zero terminator + pattern "\\*") char patt[MAX_PATH + 3]; } DIR; static DIR *opendir( const char *dirname ); static struct dirent *readdir( DIR *dirp ); static int closedir( DIR *dirp ); // use the new safe string functions introduced in Visual Studio 2005 #if defined ( _MSC_VER ) && _MSC_VER >= 1400 # define STRNCPY( dest, src, size ) strncpy_s( ( dest ), ( size ), ( src ), _TRUNCATE ) #else # define STRNCPY( dest, src, size ) strncpy( ( dest ), ( src ), ( size ) ) #endif // // Open directory stream DIRNAME for read and return a pointer to the // internal working area that is used to retrieve individual directory // entries. // static DIR* opendir( const char *dirname ) { DIR *dirp; assert( dirname != NULL ); assert( strlen( dirname ) < MAX_PATH ); // construct new DIR structure dirp = (DIR *) malloc( sizeof ( struct DIR ) ); if ( dirp != NULL ) { char *p; // take directory name... STRNCPY( dirp->patt, dirname, sizeof ( dirp->patt ) ); dirp->patt[MAX_PATH] = '\0'; // ... and append search pattern to it p = strchr( dirp->patt, '\0' ); if ( dirp->patt < p && *( p - 1 ) != '\\' && *( p - 1 ) != ':' ) { *p++ = '\\'; } *p++ = '*'; *p = '\0'; // open stream and retrieve first file dirp->search_handle = FindFirstFileA( dirp->patt, &dirp->current.data ); if ( dirp->search_handle == INVALID_HANDLE_VALUE ) { // invalid search pattern? free( dirp ); return NULL; } // there is an un-processed directory entry in memory now dirp->cached = 1; } return dirp; } // // Read a directory entry, and return a pointer to a dirent structure // containing the name of the entry in d_name field. Individual directory // entries returned by this very function include regular files, // sub-directories, pseudo-directories "." and "..", but also volume labels, // hidden files and system files may be returned. // static struct dirent * readdir( DIR *dirp ) { assert( dirp != NULL ); if ( dirp->search_handle == INVALID_HANDLE_VALUE ) { // directory stream was opened/rewound incorrectly or it ended normally return NULL; } // get next directory entry if ( dirp->cached != 0 ) { // a valid directory entry already in memory dirp->cached = 0; } else { // read next directory entry from disk if ( FindNextFileA( dirp->search_handle, &dirp->current.data ) == FALSE ) { // the very last file has been processed or an error occured FindClose( dirp->search_handle ); dirp->search_handle = INVALID_HANDLE_VALUE; return NULL; } } // copy as a multibyte character string STRNCPY( dirp->current.d_name, dirp->current.data.cFileName, sizeof ( dirp->current.d_name ) ); dirp->current.d_name[MAX_PATH] = '\0'; return &dirp->current; } // // Close directory stream opened by opendir() function. Close of the // directory stream invalidates the DIR structure as well as any previously // read directory entry. // static int closedir( DIR *dirp ) { assert( dirp != NULL ); // release search handle if ( dirp->search_handle != INVALID_HANDLE_VALUE ) { FindClose( dirp->search_handle ); dirp->search_handle = INVALID_HANDLE_VALUE; } // release directory handle free( dirp ); return 0; } #endif //DIRENT_H plplot-5.10.0+dfsg/include/pdf.h 644 1750 1750 771311647527346 153240ustar andrewandrew// $Id: pdf.h 11975 2011-10-19 11:05:10Z andrewross $ // // Copyright (C) 1992 by Maurice J. LeBrun // // Macros and prototypes for the PDF package. // // This software may be freely copied, modified and redistributed without // fee provided that this copyright notice is preserved intact on all // copies and modified copies. // // There is no warranty or other guarantee of fitness of this software. // It is provided solely "as is". The author(s) disclaim(s) all // responsibility and liability with respect to this software's usage or // its effect upon hardware or computer systems. // #ifndef __PDF_H__ #define __PDF_H__ //-------------------------------------------------------------------------- // dll functions //-------------------------------------------------------------------------- #include "pldll.h" // Some unsigned types #ifndef U_CHAR #define U_CHAR unsigned char #endif #ifndef U_SHORT #define U_SHORT unsigned short #endif #ifndef U_INT #define U_INT unsigned int #endif #ifndef U_LONG #define U_LONG unsigned long #endif #ifdef PLPLOT_USE_TCL_CHANNELS #include #endif // PDFstrm definition // The low level PDF i/o routines use the transfer method appropriate for // the first non-null type below typedef struct { FILE *file; // Filesystem unsigned char *buffer; // Memory buffer #ifdef PLPLOT_USE_TCL_CHANNELS Tcl_Channel tclChan; // Tcl channel #endif size_t bp, bufmax; // Buffer pointer and max size } PDFstrm; // Info for the i/o device. Only used by Tcl/TK/dp drivers for now typedef struct { int fd; // I/O device file descriptor FILE *file; // File handle const char *fileName; // Fifo or socket name (if needed) const char *fileHandle; // Handle for use from interpreter int type; // Communication channel type const char *typeName; // As above, but in string form } PLiodev; // Error numbers #define PDF_ERROR 1 // Unknown error #define PDF_FNOPEN 2 // File not open #define PDF_FAOPEN 3 // File already open #define PDF_BADUN 4 // Bad unit number #define PDF_BADNBITS 5 // Invalid # of bits #define PDF_RDERR 6 // Read error #define PDF_WRERR 7 // Write error #define PDF_NOTPDF 8 // Not a valid PDF file // Prototypes // Use a wrapper for the prototypes for use from K&R C void pdf_set( char *option, int value ); PLDLLIMPEXP PDFstrm *pdf_fopen( const char *fileName, const char *mode ); PLDLLIMPEXP PDFstrm *pdf_bopen( U_CHAR * buffer, size_t bufmax ); PLDLLIMPEXP PDFstrm *pdf_finit( FILE * file ); PDFstrm *plLibOpenPdfstrm( const char * fn ); PLDLLIMPEXP int pdf_close( PDFstrm * pdfs ); int pdf_putc( int c, PDFstrm * pdfs ); PLDLLIMPEXP int pdf_getc( PDFstrm * pdfs ); PLDLLIMPEXP int pdf_ungetc( int c, PDFstrm * pdfs ); int pdf_rdx( U_CHAR * x, long nitems, PDFstrm * pdfs ); PLDLLIMPEXP int pdf_rd_header( PDFstrm * pdfs, char *header ); PLDLLIMPEXP int pdf_wr_header( PDFstrm * pdfs, const char *header ); int pdf_wr_string( PDFstrm * pdfs, const char *string ); int pdf_rd_string( PDFstrm * pdfs, char *string, int nmax ); PLDLLIMPEXP int pdf_wr_1byte( PDFstrm * pdfs, U_CHAR s ); PLDLLIMPEXP int pdf_rd_1byte( PDFstrm * pdfs, U_CHAR * ps ); PLDLLIMPEXP int pdf_wr_2bytes( PDFstrm * pdfs, U_SHORT s ); PLDLLIMPEXP int pdf_rd_2bytes( PDFstrm * pdfs, U_SHORT * ps ); PLDLLIMPEXP int pdf_wr_2nbytes( PDFstrm * pdfs, U_SHORT * s, PLINT n ); PLDLLIMPEXP int pdf_rd_2nbytes( PDFstrm * pdfs, U_SHORT * s, PLINT n ); PLDLLIMPEXP int pdf_wr_4bytes( PDFstrm * pdfs, U_LONG s ); PLDLLIMPEXP int pdf_rd_4bytes( PDFstrm * pdfs, U_LONG * ps ); PLDLLIMPEXP int pdf_wr_ieeef( PDFstrm * pdfs, float f ); PLDLLIMPEXP int pdf_rd_ieeef( PDFstrm * pdfs, float *pf ); #endif // __PDF_H__ plplot-5.10.0+dfsg/include/plfreetype.h 644 1750 1750 1451012141235265 167250ustar andrewandrew// $Id: plfreetype.h 12334 2013-05-04 16:43:33Z airwin $ // // Header file for Support routines for freetype font engine // // See plfreetype.c for more details // // Copyright (C) 2004 Andrew Roach // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // #ifndef __PLFREETY_H__ #define __PLFREETY_H__ #ifdef PL_HAVE_FREETYPE #include #include FT_FREETYPE_H #include FT_GLYPH_H #include FT_OUTLINE_H #include FT_MODULE_H #define FT_Data _FT_Data_ #ifndef GetGValue #define GetGValue( rgb ) ( (unsigned char) ( ( (unsigned short) ( rgb ) ) >> 8 ) ) #endif #ifndef GetRValue #define GetRValue( rgb ) ( (unsigned char) ( rgb ) ) #endif #ifndef GetBValue #define GetBValue( rgb ) ( (unsigned char) ( ( rgb ) >> 16 ) ) #endif #ifndef RGB #define RGB( r, g, b ) ( ( ( r ) | \ ( ( g ) << 8 ) | \ ( b ) << 16 ) ) #endif typedef void ( *plD_pixel_fp )( PLStream *, PLINT, PLINT ); typedef PLINT ( *plD_read_pixel_fp )( PLStream *, PLINT, PLINT ); typedef PLINT ( *plD_set_pixel_fp )( PLStream *, PLINT, PLINT, PLINT ); //-------------------------------------------------------------------------- // Define the FT_Data data structure. // // These are the "globalish" variables used by Freetype // They are kept here so they are moderately thread safe, and stream specific //-------------------------------------------------------------------------- typedef struct FT_Data { short x; short y; char *textbuf; // temporary string buffer // // If set to 1, scale won't do anything, but this is an "arbitrary" scale // factor for the transformation between virtual and real coordinates. This // is included to fix up the problem with the "hidden line removal bug" of // the 3D plots, which is fixed by providing a super-scaled image. This // should be a mirror, for example, of dev->scale in the PNG driver. If I // was thinking 12 months ahead, I would have put that scale factor in // "pls", not "dev", but at this late stage, we can just live with it // now... // PLFLT scale; // // If different scales are used for x and y, set the next variables instead // of scale. // PLFLT scalex; PLFLT scaley; unsigned char greek; // // Set "invert_y" to 1 if the y coordinates need to be inverted for // plotting. Most bitmaps will need this. // unsigned char invert_y; // // ymax should be equal to, what it says - the maximum y coordinate of the // bitmap. This is used in the process of calculating the inversion of the // bitmap when invert_y is set to 1. If invert_y isn't set, this setting is // ignored. // short ymax; plD_pixel_fp pixel; // pointer to a function which draws a single pixel plD_set_pixel_fp set_pixel; // pointer to a function which draws a single pixel directly plD_read_pixel_fp read_pixel; // pointer to a function which reads the RGB value of a pixel and returns it int want_smooth_text; // flag to request text smoothing (won't // necessarily get it though int smooth_text; // Flag to indicate type of anti-aliasing used, if freetype text is active // // List of font names and paths corresponding to the "predefined" fonts of // plplot. 1024 chars is presumably generous for each one's length, but at // least we probably won't get in trouble this way. // // 30 = five families * 3 styles * 2 weights = N_TrueTypeLookup char font_name[30][1024]; // // This is a mirror of pls->fci and is basically used for detecting when // fonts have been changed . // PLUNICODE fci; PLFLT chrht; // Mirror of pls's copy so we can detect when the font SIZE has been changed PLFLT xdpi, ydpi; // Mirror of pls's copy, so that we can detect, if resolution was changed FT_Matrix matrix; // used for rotating etc... the font. FT_Vector pos; // used for calculating offsets of text boxes/sizes // // The next few variables hold the original size of CMAP0, the number of // extra slots added for anti-aliasing, and the "width" of the table used // for anti-aliasing. // PLINT ncol0_org; // Original number of colours in CMAP0 PLINT ncol0_xtra; // number of extra colours defined in CMAP0 for anti-aliasing PLINT ncol0_width; // Number of greyscale levels for each of the original colours PLINT last_icol0; // Last colour in cmap0, which should be one of the originals // // The rest of the variables should be considered very much PRIVATE, and // more to the point, subject to change. // // Don't rely on them existing in future versions of plplot's freetype // support. If/when the Freetype cache manager is added to plplot, most, if // not all, of these variables will move elsewhere. // FT_Library library; // pointer to freetype library FT_Face face; // pointer to a font face FT_GlyphSlot slot; // pointer to a glyph slot FT_Glyph image; // bitmap or outline image of font short colour; // depreciated ?? must check code PLINT shade, col_idx; // Used for antialiasing // // If a driver is 24Bit, and supports reading pixel values as well as writing, // we can use a more advanced antialiasing algorithm, which blends the text // with the background. Set to 1 if you have this. // unsigned char BLENDED_ANTIALIASING; } FT_Data; #endif #endif // __PLFREETY_H__ plplot-5.10.0+dfsg/include/CMakeLists.txt 644 1750 1750 1074612167035052 171440ustar andrewandrew# include/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/plConfig.h ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/plDevs.h.in ${CMAKE_CURRENT_BINARY_DIR}/plDevs.h ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/pldll.h.in ${CMAKE_CURRENT_BINARY_DIR}/pldll.h ) set(plhershey-unicode-gen_SRCS ${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode-gen.c ) if(NOT CMAKE_CROSSCOMPILING) add_executable(plhershey-unicode-gen ${plhershey-unicode-gen_SRCS}) else(NOT CMAKE_CROSSCOMPILING) SET(IMPORT_EXECUTABLES ${CMAKE_NATIVE_BINARY_DIR}/include/ImportExecutables.cmake) INCLUDE(${IMPORT_EXECUTABLES}) endif(NOT CMAKE_CROSSCOMPILING) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h COMMAND plhershey-unicode-gen ${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode.csv ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h DEPENDS plhershey-unicode-gen ${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode.csv ) if(NOT CMAKE_CROSSCOMPILING) export(TARGETS plhershey-unicode-gen FILE ${CMAKE_CURRENT_BINARY_DIR}/ImportExecutables.cmake ) endif(NOT CMAKE_CROSSCOMPILING) # For cross-directory dependencies.... add_custom_target( plhershey-unicode.h_built DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h ) set(include_INSTALLED_HEADERS disptab.h drivers.h pdf.h pldebug.h ${CMAKE_CURRENT_BINARY_DIR}/pldll.h plevent.h plplot.h plplotP.h plstrm.h plxwd.h gcw.h plplotcanvas.h ${CMAKE_CURRENT_BINARY_DIR}/plConfig.h ${CMAKE_CURRENT_BINARY_DIR}/plDevs.h ) #qt.h only useful if anyone wants to build a Qt application with the Qt widget driver if(PLD_qtwidget OR PLD_extqt) list(APPEND include_INSTALLED_HEADERS qt.h) endif(PLD_qtwidget OR PLD_extqt) if(ANY_QT_DEVICE) set(MOC_OPTIONS) if(PLD_bmpqt) list(APPEND MOC_OPTIONS -DPLD_bmpqt) endif(PLD_bmpqt) if(PLD_jpgqt) list(APPEND MOC_OPTIONS -DPLD_jpgqt) endif(PLD_jpgqt) if(PLD_pngqt) list(APPEND MOC_OPTIONS -DPLD_pngqt) endif(PLD_pngqt) if(PLD_ppmqt) list(APPEND MOC_OPTIONS -DPLD_ppmqt) endif(PLD_ppmqt) if(PLD_tiffqt) list(APPEND MOC_OPTIONS -DPLD_tiffqt) endif(PLD_tiffqt) if(PLD_svgqt) list(APPEND MOC_OPTIONS -DPLD_svgqt) endif(PLD_svgqt) if(PLD_epsqt) list(APPEND MOC_OPTIONS -DPLD_epsqt) endif(PLD_epsqt) if(PLD_pdfqt) list(APPEND MOC_OPTIONS -DPLD_pdfqt) endif(PLD_pdfqt) if(PLD_qtwidget) list(APPEND MOC_OPTIONS -DPLD_qtwidget) endif(PLD_qtwidget) if(PLD_extqt) list(APPEND MOC_OPTIONS -DPLD_extqt) endif(PLD_extqt) if(MOC_OPTIONS) # This creates a custom command with OUTPUT ${QT_MOC_OUTFILES}. qt4_wrap_cpp( QT_MOC_OUTFILES ${CMAKE_SOURCE_DIR}/include/qt.h OPTIONS ${MOC_OPTIONS} ) # Use custom target to force correct target dependencies in # various directories. This target is used in three possible # places (qt_gui, drivers, or src) depending on build options. # The CMake dependency parser creates the necessary file # dependency on qt.h for all qt-related source code so there is no # need to add the ${QT_MOC_OUTFILES} file dependencies for any # target dependency on moc_outfiles_generated. add_custom_target(moc_outfile_generated DEPENDS ${QT_MOC_OUTFILES}) # #include ${QT_MOC_OUTFILES}) indirectly via the configured moc_files.h # header. configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/moc_files.h.in ${CMAKE_CURRENT_BINARY_DIR}/moc_files.h ) else(MOC_OPTIONS) message(FATAL_ERROR "Internal build system inconsistency between ANY_QT_DEVICE true and MOC_OPTIONS false.") endif(MOC_OPTIONS) endif(ANY_QT_DEVICE) install(FILES ${include_INSTALLED_HEADERS} DESTINATION ${INCLUDE_DIR}) plplot-5.10.0+dfsg/include/plfci-type1.h 644 1750 1750 772611647115467 167110ustar andrewandrew// // This header file contains the lookup table used for converting between // FCIs (font characterization integers) and font names for the standard // 35 type 1 fonts. // // Copyright (C) 2005-2010 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This file only relevant to device drivers (currently just pdf and // ps) that use Type1 fonts. // There are no good choices for script fonts for Type1 so default to // the Helvetica (sans) variants in that case. // Default to Helvetica (sans) variants for symbol fonts to follow // what is done for all modern unicode-aware TrueType font devices. // N.B. if the glyph lookup comes up blank for any of the fonts below, // then an additional search of the Type1 Symbol font glyphs is // implemented in the Type1 device drivers as a fallback. // N.B. When updating this table by hand be sure to keep it in // ascending order in fci! #define N_Type1Lookup 30 static const FCI_to_FontName_Table Type1Lookup[N_Type1Lookup] = { { PL_FCI_MARK | 0x000, (const unsigned char *) "Helvetica" }, { PL_FCI_MARK | 0x001, (const unsigned char *) "Times-Roman" }, { PL_FCI_MARK | 0x002, (const unsigned char *) "Courier" }, { PL_FCI_MARK | 0x003, (const unsigned char *) "Helvetica" }, { PL_FCI_MARK | 0x004, (const unsigned char *) "Helvetica" }, { PL_FCI_MARK | 0x010, (const unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x011, (const unsigned char *) "Times-Italic" }, { PL_FCI_MARK | 0x012, (const unsigned char *) "Courier-Oblique" }, { PL_FCI_MARK | 0x013, (const unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x014, (const unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x020, (const unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x021, (const unsigned char *) "Times-Italic" }, { PL_FCI_MARK | 0x022, (const unsigned char *) "Courier-Oblique" }, { PL_FCI_MARK | 0x023, (const unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x024, (const unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x100, (const unsigned char *) "Helvetica-Bold" }, { PL_FCI_MARK | 0x101, (const unsigned char *) "Times-Bold" }, { PL_FCI_MARK | 0x102, (const unsigned char *) "Courier-Bold" }, { PL_FCI_MARK | 0x103, (const unsigned char *) "Helvetica-Bold" }, { PL_FCI_MARK | 0x104, (const unsigned char *) "Helvetica-Bold" }, { PL_FCI_MARK | 0x110, (const unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x111, (const unsigned char *) "Times-BoldItalic" }, { PL_FCI_MARK | 0x112, (const unsigned char *) "Courier-BoldOblique" }, { PL_FCI_MARK | 0x113, (const unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x114, (const unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x120, (const unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x121, (const unsigned char *) "Times-BoldItalic" }, { PL_FCI_MARK | 0x122, (const unsigned char *) "Courier-BoldOblique" }, { PL_FCI_MARK | 0x123, (const unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x124, (const unsigned char *) "Helvetica-BoldOblique" }, }; plplot-5.10.0+dfsg/include/plstrm.h 644 1750 1750 7405212102122103 160550ustar andrewandrew// $Id: plstrm.h 12288 2013-01-30 04:40:35Z airwin $ // // Contains declarations for PLStream and PLDev structs. // Also prototypes for stream & device utility functions. // // Copyright (C) 2004 Andrew Ross // Copyright (C) 2004 Andrew Roach // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #include "pdf.h" #ifndef __PLSTRM_H__ #define __PLSTRM_H__ #include "disptab.h" #include "pldll.h" #include "qsastime.h" //-------------------------------------------------------------------------- // Define the PLDev data structure. // // These are all quantities that must be saved on a per-device basis. // Some drivers (xwin, tk) allocate structures defined internally. //-------------------------------------------------------------------------- typedef struct { PLFLT pxlx, pxly; PLINT xold, yold; PLINT xmin, xmax, xlen; PLINT ymin, ymax, ylen; PLINT xmin_dev, xmax_dev, xlen_dev; PLINT ymin_dev, ymax_dev, ylen_dev; PLFLT xscale_dev, yscale_dev; } PLDev; //-------------------------------------------------------------------------- // Define the PLStream data structure. // // This contains a copy of every variable that is stream dependent, which // tends to be those which are settable by the user and persist for longer // than one plot. // // Only those quantities listed in the PLStream struct will be preserved // for an individual stream. Note that the lack of every plplot constant // means that one should only switch streams at a fairly high level, i.e. // on the scale of an entire plot. Otherwise intermediate quantities // will be confused between the streams, possibly resulting in garbage plots. // This structure may be expanded in time to improve intra-stream independence, // but it is doubtful streams will ever be fully independent (perhaps // neither necessary nor desirable? -- time will tell). // // There are undoubtably some inconsistencies in the declaration & use of // the variables below. This is a result of the continuing evolution of // plplot and the numerous authors involved. Hopefully in time the function // of all variables can be fully documented and made more consistent. // // The quantities in each stream are as follows: // //-------------------------------------------------------------------------- // // Misc control variables // // ipls PLINT Stream number // level PLINT Initialization level // program char* Program name // verbose PLINT Be more verbose than usual // debug PLINT Generate debugging output // initialized PLINT Set if the stream has been initialized // dev_initialized PLINT Set if the device driver has been loaded // stream_closed PLBOOL Set if the stream was closed or if there // was some sort of error // //-------------------------------------------------------------------------- // // Palettes (two of them) // // Color map 0 is intended for static objects, such as boxes, lines, points, // labels, etc. These should be allocated before calling plinit (else you // get 16 by default, which can be undesirable on some platforms). These // are then explicitly selected by number (in order of allocation). The // lowest number is 0, but this is used for the background color, so all // color drivers start with 1 as the default color. // // Color map 1 is for continuous-tone plots, where color is used to // represent function value or intensity. These are set in a relative way // only, for increased portability and flexibility. The actual number of // colors used to represent intensity levels is determined by the driver. // Note that it is only necessary to specify intensity (on a scale from 0 // to 1) to get an appropriate color. Drivers incapable of fine shading // will do the best job they can. // // A palette selection tool for both palettes is available for the Tk // driver. Direct writing of RGB values (i.e. banging on the hardware) is // supported but highly discouraged (colors so written will be affected // unpredictably by the palette tools). // // icol0 PLINT Color map 0 entry, current color (0 <= icol0 <= ncol0) // ncol0 PLINT Number of colors allocated in color map 0. // icol1 PLINT Color map 1 entry, current color (0 <= icol1 <= ncol1) // ncol1 PLINT Number of colors allocated in color map 1. // ncol1cp PLINT Number of control points in cmap1 allocation (max PL_MAX_CMAP1CP) // lcol1cp PLFLT Locations of control points in cmap1 [0,1] // curcmap PLINT Current color map // curcolor RGB[] Current color // tmpcolor RGB[] Temporary color storage // cmap0 RGB[] Color map 0: maximum of ncol0 RGB 8-bit values // cmap1 RGB[] Color map 1: maximum of ncol1 RGB 8-bit values // cmap1_min PLFLT Minimum color map 1 color to use in continuous tone plots // cmap1_max PLFLT Maximum color map 1 color to use in continuous tone plots // //-------------------------------------------------------------------------- // // Variables governing pen width // // width Current pen width // widthset Set if pen width was specified // widthlock Set if pen width is locked // //-------------------------------------------------------------------------- // // Variables governing arrow type // // arrow_x x coordinates of points in arrow // arrow_y y coordinates of points in arrow // arrow_npts number of points in arrow_x, arrow_y // arrow_fill whether the arrow should be filled or not // //-------------------------------------------------------------------------- // // Variables used to pass information between the core and the driver // // It would be nice to use the "dev_" prefix uniformly but changing // all that old code would be quite a lot of work.. // // device PLINT Graphics device id number // dev_minor PLINT Minor device id (for variations on one type) // color PLINT Set if color is available // colorset PLINT Set if "color" was set prior to calling plinit // plbuf_read PLINT Set during a plot buffer redraw // plbuf_write PLINT Set if driver needs to use the plot buffer // dev_fill0 PLINT Set if driver can do solid area fills // dev_gradient PLINT Set if driver can do (linear) gradients // dev_text PLINT Set if driver want to do it's only text drawing // dev_unicode PLINT Set if driver wants unicode // dev_hrshsym PLINT Set for Hershey symbols to be used // dev_fill1 PLINT Set if driver can do pattern area fills // dev_dash PLINT Set if driver can do dashed lines // dev_di PLINT Set if driver wants to handle DI commands // dev_flush PLINT Set if driver wants to handle flushes itself // dev_swin PLINT Set if driver wants to handle 'set window' commands // dev_fastimg PLINT Set if driver has fast image drawing capabilities // dev_xor PLINT Set if driver supports xor mode. // dev_clear PLINT Set if driver support clear. // termin PLINT Set for interactive devices // graphx PLINT Set if currently in graphics mode // nopause PLINT Set if we are skipping the pause between frames // family PLINT Set if familying is enabled // member PLINT Number of current family member file open // finc PLINT Number to increment between member files // fflen PLINT Minimum field length to use in member file number // bytemax PLINT Number of bytes maximum per member file // famadv PLINT Set to advance to the next family member // DevName char* Device name // OutFile FILE Output file pointer // BaseName char* Output base name (i.e. family) // FileName char* Output file name // output_type int 0 for file, 1 for stream // bytecnt PLINT Byte count for output stream // page PLINT Page count for output stream // linepos PLINT Line count for output stream // pdfs PDFstrm* PDF stream pointer // dev_mem_alpha PLINT The user supplied memory buffer supports alpha values // has_string_length PLINT The driver can calculate the lengths of strings // string_length PLFLT Set to the length of the current string (in mm) by the driver // get_string_length PLINT Tells the driver to calculate the length of the string // but not to render it. // // These are used by the escape function (for area fill, etc). // // dev_npts PLINT Number of points we are plotting // dev_x short* Pointer to array of x values // dev_y short* Pointer to array of x values // For the case where the boundary of the filled region is // self-intersecting, use the even-odd fill rule rather than the // default nonzero fill rule. // dev_eofill PLINT // // For images // dev_nptsX PLINT Number of points we are plotting in X // dev_nptsY PLINT Number of points we are plotting in Y // dev_z ushort* Pointer to array of z values for the color // dev_zmin, // dev_zmax ushort Min and max values of z to plot // // The following pointer is for drivers that require device-specific // data. At initialization the driver should malloc the necessary // space and set pls->dev to point to this area. This way there can // be multiple streams using the same driver without conflict. // // dev void* pointer to device-specific data (malloc'ed) // // User-supplied event handlers for use by interactive drivers (e.g. X). // Can be used to take various actions depending on input. Currently // only a keyboard event handler is supported. // // KeyEH void* Keyboard event handler // KeyEH_data void* Pointer to client data to pass // // ButtonEH void* (Mouse) Button event handler // ButtonEH_data void* Pointer to client data to pass // // bop_handler void* bop handler // bop_data void* Pointer to client data to pass // // eop_handler void* eop handler // eop_data void* Pointer to client data to pass // // Variables used for direct specification of device characteristics // Not supported by all drivers (or even very many) // // xdpi.. PLFLT Device DPI settings in x and y // xlength.. PLINT Device output lengths in x and y // xoffset.. PLINT Device offsets from upper left hand corner // pageset PLINT Set if page dimensions were specified // hack PLINT Enables driver-specific hack(s) if set // //-------------------------------------------------------------------------- // // User customization tidy routine. This is called before closing a stream // to do any program specific cleanup. // // tidy void* pointer to cleanup routine // tidy_data void* pointer to client data to pass // //-------------------------------------------------------------------------- // // User error control variables. Pass in a pointer for either to be set // in exceptional conditions. The caller is responsible for clearing the // error code. // // errcode PLINT* pointer to variable to assign error code // errmsg char* pointer to error message buffer (must be >= 160 bytes) // //-------------------------------------------------------------------------- // // Stuff used by Xlib driver // // geometry char* Window geometry (malloc'ed) // window_id long X-window window ID // nopixmap int Set if you want to forbid allocation of pixmaps // db int Set if you want to double buffer output // (only pixmap is drawn to directly; it is blitted // to output window on EOP or an Expose) // ext_resize_draw int Set if you want to control the redraw caused by a // window resize by an external agent. //-------------------------------------------------------------------------- // // These are for support of the TK driver. // // server_name char* Main window name of server // server_host char* Name of host to run server on // server_port char* Port to talk to server on // user char* Your user name on remote host (for remsh command) // plserver char* Name of server // plwindow char* Name of reference server window (malloc'ed) // tk_file char* File for plserver use with its -file option // auto_path char* Additional directories to autoload // bufmax int Number of bytes sent before output buffer is flushed // dp int Use Tcl-DP for communication, if set // server_nokill int Don't kill plserver on a ^C if set // //-------------------------------------------------------------------------- // // Variables for use by the plot buffer // // For BUFFERED_FILE // plbufFile FILE Plot buffer file pointer // // For Memory Buffer (default) // plbuf_buffer_grow size_t Memory buffer growth step // plbuf_buffer_size size_t Current size of memory buffer // plbuf_buffer void * Pointer to memory buffer // plbuf_top size_t Offset to the top of used area/start of free area // plbuf_readpos size_t Offset to current position being read // // plbufOwner int Typically set; only zero if current stream is cloned. // //-------------------------------------------------------------------------- // // Driver interface (DI) // // difilt PLINT Driver interface filter flag // // dipxmin PLFLT // dipymin PLFLT Min, max relative plot coordinates // dipxmax PLFLT // dipymax PLFLT // dipxax PLFLT Plot window transformation: // dipxb PLFLT x' = dipxax * x + dipxb // dipyay PLFLT // dipyb PLFLT y' = dipyay * y + dipyb // // aspdev PLFLT Original device aspect ratio // aspect PLFLT Page aspect ratio // aspori PLFLT Rotation-induced aspect ratio // caspfactor PLFLT Factor applied to preserve character aspect ratio // freeaspect PLINT Allow aspect ratio to adjust to orientation swaps // when overall aspect ratio is changed. // portrait PLINT Portrait mode (orientation and aspect ratio) // mar PLFLT Page margin (minimum) // jx PLFLT Page justification in x // jy PLFLT Page justification in y // // didxax PLFLT Device window transformation: // didxb PLFLT x' = didxax * x + didxb // didyay PLFLT // didyb PLFLT y' = didyay * y + didyb // // diclpxmi PLINT // diclpxma PLINT Device clip limits // diclpymi PLINT // diclpyma PLINT // // diorot PLFLT Rotation angle (in units of pi/2) // dioxax PLFLT Orientation transformation: // dioxay PLFLT x' = dioxax * x + dioxay * y + dioxb // dioxb PLFLT // dioyax PLFLT y' = dioyax * x + dioyay * y + dioyb // dioyay PLFLT // dioyb PLFLT // // dimxmin PLFLT // dimymin PLFLT Target coordinate system parameters. // dimxmax PLFLT // dimymax PLFLT // dimxpmm PLFLT // dimypmm PLFLT // dimxax PLFLT Map meta to physical coordinates: // dimxb PLFLT x' = dimxax * x + dimxb // dimyay PLFLT // dimyb PLFLT y' = dimyay * y + dimyb // // page_status PLINT Flag to indicate current action // //-------------------------------------------------------------------------- // // Fill pattern state information. // patt < 0: Hardware fill, if available (not implemented yet) // patt ==0: Hardware fill, if available, solid // patt > 0: Software fill // // patt Fill pattern number // inclin Array of inclinations in tenths of degree for fill lines // delta Array of spacings in micrometers between fill lines // nps Number of distinct line styles for fills // //-------------------------------------------------------------------------- // // Variables used in line drawing // // currx Physical x-coordinate of current point // curry Physical y-coordinate of current point // line_style index of last call to pllsty // mark Array of mark lengths in micrometers for broken lines // space Array of space lengths in micrometers for broken lines // nms Number of elements for current broken line style // timecnt Timer for broken lines // alarm Alarm indicating change of broken line status // pendn Flag indicating if pen is up or down // curel Current element within broken line // //-------------------------------------------------------------------------- // // Variables governing character strings // // esc Text string escape character // //-------------------------------------------------------------------------- // // Scale factors for characters, symbols, and tick marks. // // scale Scaling factor for chr, sym, maj, min. // chr... Character default height and current (scaled) height // sym... Symbol default height and current (scaled) height // maj... Major tick default height and current (scaled) height // min... Minor tick default height and current (scaled) height // //-------------------------------------------------------------------------- // // Variables governing numeric axis label appearance // // setpre Non-zero to set precision using "prec" // precis User-specified precision // xdigmax.. Allowed #digits in axes labels // xdigits.. Actual field widths (returned) // timefmt Format string (for strftime) // //-------------------------------------------------------------------------- // // Variables governing physical coordinate system // // vpp.. Viewport boundaries in physical coordinates // spp.. Subpage boundaries in physical coordinates // clp.. Clip boundaries in physical coordinates // phy... Physical device limits in physical coordinates // um. Number of micrometers in a pixel // pmm Number of pixels to a millimeter // //-------------------------------------------------------------------------- // // State variables for 3d plots // // base3. World coordinate size of base for 3-d plot // basec. Position of centre of base for 3-d plot // dom... Minimum and maximum values for domain // zzscl Vertical (z) scale for 3-d plot // ran.. Minimum and maximum z values for 3-d plot // c.. Coordinate transformation from 3-d to 2-d // //-------------------------------------------------------------------------- // // Variables for keeping track of world coordinate windows on a page. // // nCWindows Number of coordinate windows on current page // windows Array of plCWindow's for current page // //-------------------------------------------------------------------------- // // Variables governing subpages and viewports. // // nsub... Number of subpages on physical device // cursub Current subpage // spd... Subpage boundaries in normalized device coordinates // vpd... Viewport boundaries in normalized device coordinates // vpw... Viewport boundaries in world coordinates // //-------------------------------------------------------------------------- // // Transformation variables // // wp.... Transformation variables for world to physical conversion // wm.... Transformation variables for world coordinates to mm // //-------------------------------------------------------------------------- // // Other variables // // dev_compression Compression level for supporting devices // //-------------------------------------------------------------------------- // // Font related variables // // cfont Current font number, replaces global 'font' in plsym.c // This can be latter extended for font shape, series, family and size // fci FCI (font characterization integer) // An FCI is sometimes inserted in the middle of a stream of // unicode glyph indices. Thus to distinguish it from those, the FCI is marked // by 0x8 in the most significant 4 bits. The remaining 7 hex digits // stored in the 32-bit integer characterize 7 different font attributes. // The font attributes are interpreted as follows: // hexdigit => 0 1 2 3 4 5 // hexpower Font attribute Possible attribute values // 0 font-family sans-serif serif monospace script symbol |fantasy // 1 font-style upright italic oblique | // 2 font-weight medium bold | bolder light lighter // 3 font-variant normal | small caps // // Everything to the right of the vertical bars is not implemented and is // subject to change. The four font attributes (font-family, font-style, // font-weight, and font-variant are stored in the FCI in the order of // hexpower, the left shift that is applied to the hex digit to place the // hexdigit in the FCI. The hexpower = 3 position is essentially undefined // since there is currently only one hexdigit (0) defined, and similarly // for hexpower = 4-6 so there is room for expansion of this scheme into more // font attributes if required. (hexpower = 7 is reserved for the 0x8 marker // of the FCI.) // //-------------------------------------------------------------------------- // // Time related variable // // qsasconfig is a pointer to a struct that keeps track of the details // of the transformation between broken-down and continuous time used // in the qsastime library. // //-------------------------------------------------------------------------- // // Variables used in plgradient software fallback to communicate the polygon // to the gradient_define callback used by plshades. // // n_polygon Number of vertex points in the polygon defining the // boundary of the gradient. // x_polygon Pointer to array of x vertex points in the polygon // defining the boundary of the gradient. // y_polygon Pointer to array of y vertex points in the polygon // defining the boundary of the gradient. //-------------------------------------------------------------------------- // // Variables used to store gradient information for device drivers. // // xgradient Pointer to array of x coordinates of gradient vector. // ygradient Pointer to array of y coordinates of gradient vector. // ngradient Number of points (two) in gradient vector. //-------------------------------------------------------------------------- #define PL_MAX_CMAP1CP 256 typedef struct { // Misc control information PLINT ipls, level, verbose, debug, initialized, dev_initialized; //CONSTANT SOVERSION FIX // PLBOOL stream_closed; char *program; // Plot-wide coordinate transform void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ); PLPointer coordinate_transform_data; // Colormaps PLINT icol0, ncol0, icol1, ncol1, ncp1, curcmap; PLFLT cmap1_min, cmap1_max; PLColor curcolor, tmpcolor; PLColor *cmap0; PLColor *cmap1; PLControlPt cmap1cp[PL_MAX_CMAP1CP]; // Variables governing pen width PLFLT width; PLINT widthset, widthlock; // Variables governing arrow PLFLT *arrow_x; PLFLT *arrow_y; PLINT arrow_npts; PLINT arrow_fill; // Driver dispatch table, obsoletes "device" member below. PLDispatchTable *dispatch_table; // Variables used for interacting with or by device driver PLINT plbuf_read, plbuf_write; PLINT device, dev_minor, termin, graphx, nopause; PLINT color, colorset; PLINT family, member, finc, fflen, bytemax, famadv; PLINT dev_fill0, dev_fill1, dev_dash, dev_di, dev_flush, dev_swin; PLINT dev_text, dev_xor, dev_clear, dev_fastimg, dev_arc; char DevName[80]; FILE *OutFile; char *BaseName, *FileName; int output_type; PLINT bytecnt, page, linepos; PDFstrm *pdfs; PLINT dev_npts; short *dev_x, *dev_y; // variables for plimage() PLINT dev_nptsX, dev_nptsY; short *dev_ix, *dev_iy; unsigned short *dev_z; unsigned short dev_zmin, dev_zmax; PLINT imclxmin, imclxmax, imclymin, imclymax; // end of variables for plimage() void *dev; void ( *KeyEH )( PLGraphicsIn *gin, void *KeyEH_data, int *exit_eventloop ); void *KeyEH_data; void ( *ButtonEH )( PLGraphicsIn *gin, void *ButtonEH_data, int *exit_eventloop ); void *ButtonEH_data; void ( *LocateEH )( PLGraphicsIn *gin, void *LocateEH_data, int *locate_mode ); void *LocateEH_data; void ( *bop_handler )( void *bop_data, int *skip_driver_bop ); void *bop_data; void ( *eop_handler )( void *eop_data, int *skip_driver_eop ); void *eop_data; PLFLT xdpi, ydpi; PLINT xlength, ylength; PLINT xoffset, yoffset; PLINT pageset, hack; // Per stream tidy function. void ( *tidy )( void * ); void *tidy_data; // Error info PLINT *errcode; char *errmsg; // Stuff used by Xlib driver char *geometry; long window_id; int nopixmap, db, ext_resize_draw; // Stuff used by TK, DP drivers char *server_name, *server_host, *server_port, *user; char *plserver, *plwindow; char *auto_path; char *tk_file; // plserver -file option int bufmax, dp, server_nokill; // Plot buffer settings #ifdef BUFFERED_FILE FILE *plbufFile; #else size_t plbuf_buffer_grow; size_t plbuf_buffer_size; void *plbuf_buffer; size_t plbuf_top; size_t plbuf_readpos; #endif int plbufOwner; // Driver interface (DI) PLINT difilt, diclpxmi, diclpxma, diclpymi, diclpyma; PLFLT dipxmin, dipymin, dipxmax, dipymax; PLFLT dipxax, dipxb, dipyay, dipyb; PLFLT aspdev, aspect, aspori, caspfactor, mar, jx, jy; PLFLT didxax, didxb, didyay, didyb; PLFLT diorot; PLFLT dioxax, dioxay, dioxb, dioyax, dioyay, dioyb; PLFLT dimxax, dimxb, dimyay, dimyb; PLFLT dimxmin, dimymin, dimxmax, dimymax, dimxpmm, dimypmm; PLINT page_status, freeaspect, portrait; // Fill pattern info PLINT patt, inclin[2], delta[2], nps; // Variables used in line drawing PLINT currx, curry; //CONSTANT SOVERSION FIX //PLINT line_style; PLINT mark[10], space[10], nms; PLINT timecnt, alarm, pendn, curel; // Variables governing character strings char esc; // Scale factors for characters, symbols, and tick marks. PLFLT scale; PLFLT chrdef, chrht; PLFLT symdef, symht; PLFLT majdef, majht; PLFLT mindef, minht; // Variables governing numeric axis label appearance PLINT setpre, precis; PLINT xdigmax, ydigmax, zdigmax; PLINT xdigits, ydigits, zdigits; char *timefmt; void ( *label_func )( PLINT, PLFLT, char *, PLINT, PLPointer ); PLPointer label_data; // Variables governing physical coordinate system PLINT vppxmi, vppxma, vppymi, vppyma; PLINT sppxmi, sppxma, sppymi, sppyma; PLINT clpxmi, clpxma, clpymi, clpyma; PLINT phyxmi, phyxma, phyxlen, phyymi, phyyma, phyylen; PLINT umx, umy; PLFLT xpmm, ypmm; // State variables for 3d plots PLFLT base3x, base3y, basecx, basecy; PLFLT domxmi, domxma, domymi, domyma; PLFLT zzscl, ranmi, ranma; PLFLT cxx, cxy, cyx, cyy, cyz, czx, czy, czz; // Variables for keeping track of windows on a page. int nplwin; PLWindow plwin[PL_MAXWINDOWS]; // Variables governing subpages and viewports. PLINT nsubx, nsuby, cursub; PLFLT spdxmi, spdxma, spdymi, spdyma; PLFLT vpdxmi, vpdxma, vpdymi, vpdyma; PLFLT vpwxmi, vpwxma, vpwymi, vpwyma; // Transformation variables PLFLT wpxscl, wpxoff, wpyscl, wpyoff; PLFLT wmxscl, wmxoff, wmyscl, wmyoff; PLFLT wdxscl, wdxoff, wdyscl, wdyoff; // Other variables PLINT dev_compression; PLINT cfont; void *FT; // Stuff used by the Tkwin driver for Plframe struct PlPlotter *plPlotterPtr; // Unicode section PLINT dev_unicode; PLINT alt_unicode; // The alternative interface for unicode text rendering. PLUNICODE fci; PLINT dev_hrshsym; // Used to keep a hold of a temporary copy of the original character height // which I overload as a quick hack to fix up a bug in freetype an plsym() // PLFLT original_chrdef, original_chrht; // // Pointer to postscript document class used by psttf // void *psdoc; // pointer to a struct that keeps track of the details of the // transformation between broken-down and continuous time used in // the qsastime library. QSASConfig *qsasconfig; // Gradient section. PLINT dev_gradient; PLINT ngradient; PLINT *xgradient, *ygradient; // The next three variables define the polygon boundary used // in the software fallback for the gradient. PLINT n_polygon; const PLFLT *x_polygon, *y_polygon; //CONSTANT SOVERSION FIX PLBOOL stream_closed; PLINT line_style; PLINT dev_mem_alpha; PLINT has_string_length; PLFLT string_length; PLINT get_string_length; PLINT dev_eofill; // Drawing mode section PLINT dev_modeset; // Calculate bounding-box limits rather than plot box? PLBOOL if_boxbb; // Bounding box limits in mm for box including decorations // (inverted tick marks and numerical tick labels if either is // present). PLFLT boxbb_xmin, boxbb_xmax, boxbb_ymin, boxbb_ymax; } PLStream; //-------------------------------------------------------------------------- // Prototypes for stream & device utility functions. //-------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif // Get the current stream pointer void PLDLLIMPEXP plgpls( PLStream **p_pls ); // Initializes device cmap 1 entry by interpolation from pls->cmap1 entries PLDLLIMPEXP void plcol_interp( PLStream *pls, PLColor *newcolor, int i, int ncol ); // Opens file for output, prompting if not set. PLDLLIMPEXP void plOpenFile( PLStream *pls ); // Close output file PLDLLIMPEXP void plCloseFile( PLStream *pls ); // Sets up next file member name (in pls->FileName), but does not open it. void plP_getmember( PLStream *pls ); // Sets up file name & family stem name. void plP_sfnam( PLStream *pls, const char *fnam ); // Initializes family file parameters. PLDLLIMPEXP void plFamInit( PLStream *pls ); // Starts new member file of family file set if necessary. PLDLLIMPEXP void plGetFam( PLStream *pls ); // Rotates physical coordinates if necessary for given orientation. PLDLLIMPEXP void plRotPhy( PLINT orient, PLINT xmin, PLINT ymin, PLINT xmax, PLINT ymax, PLINT *px, PLINT *py ); // Allocates a standard PLDev structure for device-specific data PLDLLIMPEXP PLDev * plAllocDev( PLStream *pls ); // Just fills in the PLGraphicsIn with appropriate initial values. PLDLLIMPEXP void plGinInit( PLGraphicsIn *gin ); #ifdef __cplusplus } #endif #endif // __PLSTRM_H__ plplot-5.10.0+dfsg/include/plplotP.h 644 1750 1750 7760212251352476 162210ustar andrewandrew// $Id: plplotP.h 12831 2013-12-09 14:35:42Z andrewross $ // // Internal (private) macros and prototypes for the PLplot package. This // header file must be included before all others, including system header // files. This file is typically needed when including driver specific // header files (e.g. pltkd.h). // // Copyright (C) 1993, 1994, 1995 by // Maurice J. LeBrun, Geoff Furnish, Tony Richardson. // // Copyright (C) 2004 Rafael Laboissiere // Copyright (C) 2004 Joao Cardoso // Copyright (C) 2004 Andrew Roach // Copyright (C) 2006 Andrew Ross // Copyright (C) 2006 Hazen Babcock // // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // #ifndef __PLPLOTP_H__ #define __PLPLOTP_H__ //-------------------------------------------------------------------------- // Select environment. Must be done before anything else. // // Basically we want the widest range of system services that are available. // Fortunately on many systems, that is the default. To get "everything", // one of the following must be defined, as appropriate: // // _GNU_SOURCE on Linux (default) // _OSF_SOURCE on OSF1 (default) // _HPUX_SOURCE on HP (not default) // _ALL_SOURCE on AIX (no idea) // // To see where these are set, do the following: // // cd /usr/include; grep SOURCE *.h | fgrep 'define ' // // and the file containing lots of these is the one you want (features.h on // Linux, standards.h on OSF1, etc). Follow the logic to see what needs to be // defined to get "everything", i.e. POSIX.*, XOPEN, etc. // // Note that for specific functionality, we test using autoconf. Still it's // best to stick to ANSI C, POSIX.1, and POSIX.2, in that order, for maximum // portability. //-------------------------------------------------------------------------- // HPUX - if this is no longer needed, please remove it #ifdef _HPUX #define _HPUX_SOURCE #endif // A/IX - if this is no longer needed, please remove it #ifdef _AIX #define _ALL_SOURCE #endif // Add others here as needed. //-------------------------------------------------------------------------- // Configuration settings // // Some of the macros set during configuration are described here. // // If HAVE_TERMIOS_H is set, we employ POSIX.1 tty terminal I/O. One purpose // of this is to select character-oriented (CBREAK) i/o in the tek driver and // all its variants. It is usable without this but not as powerful. The // reason for using this is that some supported systems are still not // POSIX.1 compliant (and some may never be). // // If STDC_HEADERS is defined, the system's libc is ANSI-compliant. // ANSI libc calls are used for: (a) setting up handlers to be called // before program exit (via the "atexit" call), and (b) for seek // operations. Again, the code is usable without these. An ANSI libc // should be available, given the requirement of an ANSI compiler. Some // reasons why not: (a) the vendor didn't supply a complete ANSI // environment, or (b) the ANSI libc calls are buggy, or (c) you ported // gcc to your system but not glibc (for whatever reason). Note: without // an ANSI C lib, if you ^C out of a program using one of the PLplot tek // drivers, your terminal may be left in a strange state. //-------------------------------------------------------------------------- #include "plConfig.h" #ifdef caddr_t #undef caddr_t #ifndef __USE_BSD typedef char * caddr_t; #endif #endif // System headers #include #include #include #include #include #ifdef PL_HAVE_UNISTD_H #include #endif #include // (AM) Define M_PI if the platform does not include it // (MSVC for instance) #if !defined ( M_PI ) #define M_PI 3.14159265358979323846 #endif // // Macros for file positioning. I tried switching to f[sg]etpos() because I // like the semantics better, but ran into the problem that fpos_t is not // always a base type (it may be a struct). This is a problem because the // metafile driver needs to write relative offsets into the file itself. So // instead we use f{seek,tell} at a low level but keep the f[sg]etpos // semantics using these macros. // #ifdef STDC_FPOS_T #undef STDC_FPOS_T #endif #ifdef STDC_FPOS_T #define FPOS_T fpos_t #define pl_fsetpos( a, b ) fsetpos( a, b ) #define pl_fgetpos( a, b ) fgetpos( a, b ) #else #define FPOS_T long #define pl_fsetpos( a, b ) fseek( a, *b, 0 ) #define pl_fgetpos( a, b ) ( -1L == ( *b = ftell( a ) ) ) #endif #include "pldll.h" // Include all externally-visible definitions and prototypes // plplot.h also includes some handy system header files #include "plplot.h" // plstream definition #include "plstrm.h" // If not including this file from inside of plcore.h, declare plsc #ifndef __PLCORE_H__ #ifdef __cplusplus extern "C" { #endif // extern PLStream PLDLLIMPORT *plsc; extern PLDLLIMPEXP_DATA( PLStream * ) plsc; #ifdef __cplusplus } #endif #include "pldebug.h" #endif //-------------------------------------------------------------------------- // Utility macros //-------------------------------------------------------------------------- #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif // Used to help ensure everything malloc'ed gets freed #define free_mem( a ) \ if ( a != NULL ) { free( (void *) a ); a = NULL; } // Allows multi-argument setup calls to not affect selected arguments #define plsetvar( a, b ) \ if ( b != PL_NOTSET ) a = b; // Lots of cool math macros #ifndef MAX #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef MIN #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef ABS #define ABS( a ) ( ( a ) < 0 ? -( a ) : ( a ) ) #endif #ifndef ROUND #define ROUND( a ) (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) ) #endif #ifndef BETW #define BETW( ix, ia, ib ) ( ( ( ix ) <= ( ia ) && ( ix ) >= ( ib ) ) || ( ( ix ) >= ( ia ) && ( ix ) <= ( ib ) ) ) #endif #ifndef SSQR #define SSQR( a, b ) sqrt( ( a ) * ( a ) + ( b ) * ( b ) ) #endif #ifndef SIGN #define SIGN( a ) ( ( a ) < 0 ? -1 : 1 ) #endif #ifndef TRANSFORM #define TRANSFORM( x, y, xnew, ynew ) if ( plsc->coordinate_transform ) { plsc->coordinate_transform( ( x ), ( y ), ( xnew ), ( ynew ), plsc->coordinate_transform_data ); } else { *xnew = x; *ynew = y; } #endif // A coordinate value that should never occur #define PL_UNDEFINED -9999999 // Declarations for save string functions #ifdef PL_HAVE_SNPRINTF // In case only _snprintf is declared (as for Visual C++ and // Borland compiler toolset) we redefine the function names #ifdef _PL_HAVE_SNPRINTF #define snprintf _snprintf #define snscanf _snscanf #endif // _PL_HAVE_SNPRINTF #else // !PL_HAVE_SNPRINTF // declare dummy functions which just call the unsafe // functions ignoring the size of the string int plsnprintf( char *buffer, int n, const char *format, ... ); int plsnscanf( const char *buffer, int n, const char *format, ... ); #define snprintf plsnprintf #define snscanf plsnscanf #endif // PL_HAVE_SNPRINTF //-------------------------------------------------------------------------- // Add in missing isnan / isinf functions on some platforms //-------------------------------------------------------------------------- #if defined ( PL__HAVE_ISNAN ) # define isnan _isnan # if defined ( _MSC_VER ) # include # endif #endif #if defined ( PL__HAVE_ISINF ) # define isinf _isinf #endif #if defined ( PL_HAVE_FINITE ) # define isfinite finite #endif #if defined ( PL__HAVE_FINITE ) # define isfinite _finite #endif // Note these replacements follow the old BSD convention and not // C99. In particular isinf does not distinguish +/- inf. #if !defined ( PL_HAVE_ISNAN ) # define isnan( x ) ( ( x ) != ( x ) ) #endif #if !defined ( PL_HAVE_ISINF ) # define isinf( x ) ( !isnan( x ) && isnan( x - x ) ) #endif #if !defined ( PL_HAVE_ISFINITE ) # define isfinite( x ) ( !isnan( x - x ) ) #endif // Check if C99 HUGE_VAL macro is available - if not then // define a replacement #ifndef HUGE_VAL #define HUGE_VAL ( 1.0 / 0.0 ) #endif //-------------------------------------------------------------------------- // PLPLOT control macros //-------------------------------------------------------------------------- // Some constants #define PL_MAXPOLY 256 // Max segments in polyline or polygon #define PL_NSTREAMS 100 // Max number of concurrent streams. #define PL_RGB_COLOR -1 // A hack #define TEXT_MODE 0 #define GRAPHICS_MODE 1 #ifndef PI #define PI 3.1415926535897932384 #endif // These define the virtual coordinate system used by the metafile driver. // Others are free to use it, or some variation, or define their own. // Note desktop monitors of reasonable quality typically have 0.25 mm spacing // between dots which corresponds to 4.0 dots per mm. The parameters here // roughly correspond to a 14" monitor at 1024x768 resolution, which should // work fine at other sizes/resolutions. The number of virtual dots per mm is // scaled by a factor of 32, with pixels scaled accordingly. The customary // x/y ratio of 4:3 is used. // #define PIXELS_X 32768 // Number of virtual pixels in x #define PIXELS_Y 24576 // Number of virtual pixels in x #define DPMM 4. // dots per mm #define VDPMM ( DPMM * 32 ) // virtual dots per mm #define LPAGE_X ( PIXELS_X / VDPMM ) // virtual page length in x in mm (256) #define LPAGE_Y ( PIXELS_Y / VDPMM ) // virtual page length in y in mm (192) // This defines the first argument of the plRotPhy invocation that is made // in a number of device drivers (e.g., found in ljii.c, ljiip.c, ps.c, // and pstex.c) to rotate them "permanently" from portrait mode to non- // portrait mode. ORIENTATION of 1 corresponds to seascape mode (90 deg // clockwise rotation from portrait). This is the traditional value // effectively used in all older versions of PLplot. ORIENTATION of 3 // corresponds to landscape mode (90 deg *counter*-clockwise rotation from // portrait) which is the new default non-portrait orientation. #define ORIENTATION 3 // Switches for state function call. #define PLSTATE_WIDTH 1 // pen width #define PLSTATE_COLOR0 2 // change to color in cmap 0 #define PLSTATE_COLOR1 3 // change to color in cmap 1 #define PLSTATE_FILL 4 // set area fill attribute #define PLSTATE_CMAP0 5 // change to cmap 0 #define PLSTATE_CMAP1 6 // change to cmap 1 // Bit switches used in the driver interface #define PLDI_MAP 0x01 #define PLDI_ORI 0x02 #define PLDI_PLT 0x04 #define PLDI_DEV 0x08 // Default size for family files, in KB. #ifndef PL_FILESIZE_KB #define PL_FILESIZE_KB 1000 #endif // Font file names. #define PLPLOT5_FONTS #ifdef PLPLOT5_FONTS #define PL_XFONT "plxtnd5.fnt" #define PL_SFONT "plstnd5.fnt" #else #define PL_XFONT "plxtnd4.fnt" #define PL_SFONT "plstnd4.fnt" #endif //-------------------------------------------------------------------------- // The following environment variables are defined: // // PLPLOT_BIN # where to find executables // PLPLOT_LIB # where to find library files (fonts, maps, etc) // PLPLOT_TCL # where to find tcl scripts // // PLPLOT_HOME # basename of plplot hierarchy // // search order: // 1) the most specific possible locators, one of // $(PLPLOT_BIN) // $(PLPLOT_LIB) // $(PLPLOT_TCL) // as appropriate // // 2) the current directory // // 3) one of $(PLPLOT_HOME)/bin // $(PLPLOT_HOME)/lib // $(PLPLOT_HOME)/tcl // as appropriate // // 4) as appropriate, the compile-time (Makefile) // BIN_DIR, LIB_DIR, TCL_DIR // // 8 Jun 1994 mj olesen (olesen@weber.me.queensu.ca) // // Other notes: // // In addition to the directories above, the following are also used: // // Lib file search path: PLLIBDEV (see plctrl.c). This is checked last, // and is a system-dependent hardwired location. // // Tcl search path: $HOME/tcl is searched before the install location, // TCL_DIR. //-------------------------------------------------------------------------- #define PLPLOT_BIN_ENV "PLPLOT_BIN" #define PLPLOT_LIB_ENV "PLPLOT_LIB" #define PLPLOT_TCL_ENV "PLPLOT_TCL" #define PLPLOT_HOME_ENV "PLPLOT_HOME" // Maximum size for path strings in the plplot code #define PLPLOT_MAX_PATH 1024 // // Some stuff that is included (and compiled into) plsym.h // Other modules might want this, so we will "extern" it // // #ifndef __PLSYM_H__ typedef struct { unsigned int Hershey; PLUNICODE Unicode; char Font; } Hershey_to_Unicode_table; extern int number_of_entries_in_hershey_to_unicode_table; extern Hershey_to_Unicode_table hershey_to_unicode_lookup_table[]; #endif // Greek character translation array (defined in plcore.c) extern const char plP_greek_mnemonic[]; //-------------------------------------------------------------------------- // Function Prototypes // // These typically should not be called directly by the user. //-------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif // Number of elements in the affine vector representation of the affine // transformation matrix. #define NAFFINE 6 // Returns affine identity matrix PLDLLIMPEXP void plP_affine_identity( PLFLT *affine_vector ); // Translate new coordinate system axes relative to the old. PLDLLIMPEXP void plP_affine_translate( PLFLT *affine_vector, PLFLT xtranslate, PLFLT ytranslate ); // Scale new coordinate system axes relative to the old. PLDLLIMPEXP void plP_affine_scale( PLFLT *affine_vector, PLFLT xscale, PLFLT yscale ); // Rotate new coordinate system axes relative to the old. // angle is in degrees. PLDLLIMPEXP void plP_affine_rotate( PLFLT *affine_vector, PLFLT angle ); // Skew new X coordinate axis relative to the old. // angle is in degrees. PLDLLIMPEXP void plP_affine_xskew( PLFLT *affine_vector, PLFLT angle ); // Skew new Y coordinate axis relative to the old. // angle is in degrees. PLDLLIMPEXP void plP_affine_yskew( PLFLT *affine_vector, PLFLT angle ); // Multiply two affine transformation matrices to form a third. // // A = B * C // // PLDLLIMPEXP void plP_affine_multiply( PLFLT *affine_vectorA, const PLFLT *affine_vectorB, const PLFLT *affine_vectorC ); // Determines interval between numeric labels void pldtik( PLFLT vmin, PLFLT vmax, PLFLT *tick, PLINT *nsubt, PLBOOL ld ); // Writes numeric labels on side(s) of box in custom locations void label_box_custom( const char *xopt, PLINT n_xticks, const PLFLT *xticks, const char *yopt, PLINT n_yticks, const PLFLT *yticks ); // Determine factor to convert date / time in seconds to more natural // units void pldtfac( PLFLT vmin, PLFLT vmax, PLFLT *factor, PLFLT *tstart ); // Determines precision of box labels void pldprec( PLFLT vmin, PLFLT vmax, PLFLT tick, PLINT lf, PLINT *mode, PLINT *prec, PLINT digmax, PLINT *scale ); // Draws a polyline within the clip limits. void plP_pllclp( PLINT *x, PLINT *y, PLINT npts, PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax, void ( *draw )( short *, short *, PLINT ) ); // Fills a polygon within the clip limits. void plP_plfclp( PLINT *x, PLINT *y, PLINT npts, PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax, void ( *draw )( short *, short *, PLINT ) ); // Clip a polygon to the 3d bounding plane int plP_clip_poly( int Ni, PLFLT *Vi[3], int axis, PLFLT dir, PLFLT offset ); // Get clipped endpoints int plP_clipline( PLINT *p_x1, PLINT *p_y1, PLINT *p_x2, PLINT *p_y2, PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax ); // Stores hex digit value into FCI (font characterization integer). void plP_hex2fci( unsigned char hexdigit, unsigned char hexpower, PLUNICODE *pfci ); // Retrieves hex digit value from FCI (font characterization integer). PLDLLIMPEXP void plP_fci2hex( PLUNICODE fci, unsigned char *phexdigit, unsigned char hexpower ); // Pattern fills in software the polygon bounded by the input points. PLDLLIMPEXP void plfill_soft( short *x, short *y, PLINT npts ); // In case of an abort this routine is called. It just prints out an // error message and tries to clean up as much as possible. PLDLLIMPEXP void plexit( const char *errormsg ); // Just a front-end to exit(). void pl_exit( void ); // A handy way to issue warnings, if need be. PLDLLIMPEXP void plwarn( const char *errormsg ); // Same as plwarn(), but appends ", aborting plot" to the error message PLDLLIMPEXP void plabort( const char *errormsg ); // Loads either the standard or extended font. void plfntld( PLINT fnt ); // Release memory for fonts. void plfontrel( void ); // A replacement for strdup(), which isn't portable. PLDLLIMPEXP char * plstrdup( const char *src ); // Bin up cmap 1 space and assign colors to make inverse mapping easy. PLDLLIMPEXP void plcmap1_calc( void ); // Draws a slanting tick at position (mx,my) (measured in mm) of // vector length (dx,dy). void plstik( PLFLT mx, PLFLT my, PLFLT dx, PLFLT dy ); // Prints out a "string" at reference position with physical coordinates // (refx,refy). void plstr( PLINT base, PLFLT *xform, PLINT refx, PLINT refy, const char *string ); // Draws a tick parallel to x. void plxtik( PLINT x, PLINT y, PLINT below, PLINT above ); // Draws a tick parallel to y. void plytik( PLINT x, PLINT y, PLINT left, PLINT right ); // Driver interface filter -- // passes all coordinates through a variety of filters. PLDLLIMPEXP void difilt( PLINT *, PLINT *, PLINT, PLINT *, PLINT *, PLINT *, PLINT * ); // Transforms the clipping region coordinates as necessary // based on the current plot orientation, etc. PLDLLIMPEXP void difilt_clip( PLINT *, PLINT * ); // Calculate scale of font size and scale of magnitude of vertical // offset associated with superscripts and subscripts. PLDLLIMPEXP void plP_script_scale( PLBOOL ifupper, PLINT *level, PLFLT *old_scale, PLFLT *scale, PLFLT *old_offset, PLFLT *offset ); // Driver draws text void plP_text( PLINT base, PLFLT just, PLFLT *xform, PLINT x, PLINT y, PLINT refx, PLINT refy, const char *string ); // Save LC_NUMERIC locale string, then set "C" locale to protect // parts of PLplot which absolutely demand the LC_NUMERIC "C" locale. PLDLLIMPEXP char * plsave_set_locale( void ); // Restore LC_NUMERIC locale that was determined by plsave_set_locale. PLDLLIMPEXP void plrestore_locale( char * save_lc_numeric_locale ); // where should structure definitions that must be seen by drivers and core source files, be? // structure to be used by plcore.c and anydriver.c, related to plP_text() typedef struct { PLINT base; // ref point at base(1) or center(0) of text. Currently plplot only use 0 PLFLT just; // continuos justification, 0 left, 0.5 center, 1 right PLFLT *xform; // transformation (rotation) matrix PLINT x; // raw reference point--after any transformation PLINT y; PLINT refx; // processed ref. point--after justification, displacement, etc, processing PLINT refy; char font_face; // font face OPTIONALLY used for rendering hershey codes // The following 3 fields are used by the alternative text handling pathway. // See drivers/cairo.h for details about how this works. PLUNICODE n_fci; // font storage for unicode font handling PLUNICODE n_char; // character storage for unicode font handling PLINT n_ctrl_char; // control character code storage for unicode font handling PLUNICODE unicode_char; // an int to hold either a Hershey, ASC-II, or Unicode value for plsym calls PLUNICODE *unicode_array; // a pointer to an array of ints holding either a Hershey, ASC-II, or Unicode value for cached plsym unsigned short unicode_array_len; const char *string; // text to draw }EscText; // // structure that contains driver specific information, to be used by plargs.c and anydriver.c, // related to plParseDrvOpts() and plHelpDrvOpts() // typedef struct { const char *opt; // a string with the name of the option PLINT type; // the type of the variable to be set, see bellow the available types void *var_ptr; // a pointer to the variable to be set const char *hlp_msg; // help message of the option } DrvOpt; // the available variable types, DrvOpt.type, for driver specific options enum { DRV_INT, DRV_FLT, DRV_STR }; // parse driver specific options, as in -drvopt * PLDLLIMPEXP int plParseDrvOpts( DrvOpt * ); // give help on driver specific options void plHelpDrvOpts( DrvOpt * ); // // structures to store contour lines // #define LINE_ITEMS 20 typedef struct cont_line { PLFLT *x; PLFLT *y; PLINT npts; struct cont_line *next; } CONT_LINE; typedef struct cont_level { // INDENT-OFF (stop infinite recursion) PLFLT level; // contour level struct cont_line *line; // contour line struct struct cont_level *next; // contour level struct // INDENT-ON } CONT_LEVEL; void cont_store( const PLFLT * const *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data, CONT_LEVEL **contour ); void cont_clean_store( CONT_LEVEL *ct ); // Get the viewport boundaries in world coordinates, expanded slightly void plP_xgvpw( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); // Get x-y domain in world coordinates for 3d plots void plP_gdom( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); // Get vertical (z) scale parameters for 3-d plot void plP_grange( PLFLT *p_zscl, PLFLT *p_zmin, PLFLT *p_zmax ); // Get parameters used in 3d plots void plP_gw3wc( PLFLT *p_dxx, PLFLT *p_dxy, PLFLT *p_dyx, PLFLT *p_dyy, PLFLT *p_dyz ); // Get clip boundaries in physical coordinates void plP_gclp( PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax ); // Set clip boundaries in physical coordinates void plP_sclp( PLINT ixmin, PLINT ixmax, PLINT iymin, PLINT iymax ); // Get physical device limits in physical coordinates PLDLLIMPEXP void plP_gphy( PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax ); // Get number of subpages on physical device and current subpage PLDLLIMPEXP void plP_gsub( PLINT *p_nx, PLINT *p_ny, PLINT *p_cs ); // Set number of subpages on physical device and current subpage PLDLLIMPEXP void plP_ssub( PLINT nx, PLINT ny, PLINT cs ); // Set up plot parameters according to the number of subpages. void plP_subpInit( void ); // Get number of pixels to a millimeter PLDLLIMPEXP void plP_gpixmm( PLFLT *p_x, PLFLT *p_y ); // All the drivers call this to set physical pixels/mm. PLDLLIMPEXP void plP_setpxl( PLFLT xpmm0, PLFLT ypmm0 ); // Get background parameters (including line width) for 3d plot. void plP_gzback( PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLFLT **zbw ); // Move to physical coordinates (x,y). void plP_movphy( PLINT x, PLINT y ); // Draw to physical coordinates (x,y). void plP_draphy( PLINT x, PLINT y ); // Move to world coordinates (x,y). void plP_movwor( PLFLT x, PLFLT y ); // Draw to world coordinates (x,y). void plP_drawor( PLFLT x, PLFLT y ); // Draw polyline in physical coordinates. void plP_draphy_poly( PLINT *x, PLINT *y, PLINT n ); // Draw polyline in world coordinates. void plP_drawor_poly( const PLFLT *x, const PLFLT *y, PLINT n ); // Sets up physical limits of plotting device. PLDLLIMPEXP void plP_setphy( PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax ); // Set up the subpage boundaries according to the current subpage selected PLDLLIMPEXP void plP_setsub( void ); // Get the floating point precision (in number of places) in numeric labels. void plP_gprec( PLINT *p_setp, PLINT *p_prec ); // Get the date / time format for numeric labels const char * plP_gtimefmt( void ); // Computes the length of a string in mm, including escape sequences. PLFLT plstrl( const char *string ); // Similar to strpos, but searches for occurence of string str2. PLINT plP_stindex( const char *str1, const char *str2 ); // Searches string str for first occurence of character chr. PLDLLIMPEXP PLINT plP_strpos( const char *str, int chr ); // Searches string str for character chr (case insensitive). PLBOOL plP_stsearch( const char *str, int chr ); // Conversion functions // device coords to physical coords (x) PLINT plP_dcpcx( PLFLT x ); // device coords to physical coords (y) PLINT plP_dcpcy( PLFLT y ); // millimeters from bottom left-hand corner to physical coords (x) PLINT plP_mmpcx( PLFLT x ); // millimeters from bottom left-hand corner to physical coords (y) PLINT plP_mmpcy( PLFLT y ); // world coords to physical coords (x) PLINT plP_wcpcx( PLFLT x ); // world coords to physical coords (y) PLINT plP_wcpcy( PLFLT y ); // physical coords to device coords (x) PLFLT plP_pcdcx( PLINT x ); // physical coords to device coords (y) PLFLT plP_pcdcy( PLINT y ); // millimeters from bottom left corner to device coords (x) PLFLT plP_mmdcx( PLFLT x ); // millimeters from bottom left corner to device coords (y) PLFLT plP_mmdcy( PLFLT y ); // world coords into device coords (x) PLFLT plP_wcdcx( PLFLT x ); // world coords into device coords (y) PLFLT plP_wcdcy( PLFLT y ); // subpage coords to device coords (x) PLFLT plP_scdcx( PLFLT x ); // subpage coords to device coords (y) PLFLT plP_scdcy( PLFLT y ); // device coords to millimeters from bottom left-hand corner (x) PLFLT plP_dcmmx( PLFLT x ); // device coords to millimeters from bottom left-hand corner (y) PLFLT plP_dcmmy( PLFLT y ); // world coords into millimeters (x) PLFLT plP_wcmmx( PLFLT x ); // world coords into millimeters (y) PLFLT plP_wcmmy( PLFLT y ); // device coords to subpage coords (x) PLFLT plP_dcscx( PLFLT x ); // device coords to subpage coords (y) PLFLT plP_dcscy( PLFLT y ); // 3-d coords to 2-d projection (x) PLFLT plP_w3wcx( PLFLT x, PLFLT y, PLFLT z ); // 3-d coords to 2-d projection (y) PLFLT plP_w3wcy( PLFLT x, PLFLT y, PLFLT z ); // 3-d coords to 2-d projection (z) PLFLT plP_w3wcz( PLFLT x, PLFLT y, PLFLT z ); // Returns the rotation and shear angle and stride from a plplot transformation matrix PLDLLIMPEXP void plRotationShear( PLFLT *xFormMatrix, PLFLT *rotation, PLFLT *shear, PLFLT *stride ); // Test whether a point is in a polygon. int plP_pointinpolygon( PLINT n, const PLFLT *x, const PLFLT *y, PLFLT xp, PLFLT yp ); // Driver calls // Initialize device. void plP_init( void ); // Draw line between two points void plP_line( short *x, short *y ); // Draw polyline void plP_polyline( short *x, short *y, PLINT npts ); // Fill polygon void plP_fill( short *x, short *y, PLINT npts ); // Render gradient void plP_gradient( short *x, short *y, PLINT npts ); // draw image void plP_image( PLFLT *z, PLINT nx, PLINT ny, PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Structure for holding arc data typedef struct { PLFLT x; PLFLT y; PLFLT a; PLFLT b; PLFLT angle1; PLFLT angle2; PLFLT rotate; PLBOOL fill; } arc_struct; // End of page PLDLLIMPEXP void plP_eop( void ); // End of page PLDLLIMPEXP void plP_bop( void ); // Tidy up device (flush buffers, close file, etc.) void plP_tidy( void ); // Change state. PLDLLIMPEXP void plP_state( PLINT op ); // Escape function, for driver-specific commands. PLDLLIMPEXP void plP_esc( PLINT op, void *ptr ); // Set up plot window parameters. void plP_swin( PLWindow *plwin ); // Return file pointer to lib file. FILE * plLibOpen( const char *fn ); // Does required startup initialization of library. PLDLLIMPEXP void pllib_init( void ); // Does preliminary setup of device driver. PLDLLIMPEXP void pllib_devinit( void ); // Utility to copy one PLColor to another. PLDLLIMPEXP void pl_cpcolor( PLColor *to, PLColor *from ); // Does required startup initialization of a stream. void plstrm_init( void ); // Builds a list of the active devices/streams by device name void PLDLLIMPEXP plP_getinitdriverlist( char *names ); // Checks a give list of device names against active streams and returns the number of matches PLINT plP_checkdriverinit( char *names ); // disable writing to plot buffer and pixmap void NoBufferNoPixmap( void ); // restart writing to plot buffer and pixmap void RestoreWrite2BufferPixmap( void ); void grimage( short *x, short *y, unsigned short *z, PLINT nx, PLINT ny ); PLDLLIMPEXP int plInBuildTree( void ); void plimageslow( PLFLT *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); typedef struct { PLFLT xmin, ymin, dx, dy; } IMG_DT; // // void plfvect() // // Internal routine to plot a vector array with arbitrary coordinate // and vector transformations. // This is not currently intended to be called direct by the user // PLDLLIMPEXP void plfvect( PLFLT ( *plf2eval )( PLINT, PLINT, PLPointer ), PLPointer f2evalv_data, PLPointer f2evalc_data, PLINT nx, PLINT ny, PLFLT scale, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // // Internal function to get an index to the hershey table // int plhershey2unicode( int in ); // struct used for FCI to FontName lookups. typedef struct { PLUNICODE fci; const unsigned char *pfont; } FCI_to_FontName_Table; // Internal function to obtain a pointer to a valid font name. PLDLLIMPEXP const char * plP_FCI2FontName( PLUNICODE fci, const FCI_to_FontName_Table lookup[], const int nlookup ); // Internal function to free memory from driver options void plP_FreeDrvOpts( void ); // Convert a ucs4 unichar to utf8 char string PLDLLIMPEXP int ucs4_to_utf8( PLUNICODE unichar, char *ptr ); // // Wrapper functions for the system IO routines fread, fwrite // // wraps fwrite void plio_fwrite( void *, size_t, size_t, FILE * ); // wraps fread void plio_fread( void *, size_t, size_t, FILE * ); // wraps fgets void plio_fgets( char *, int, FILE * ); // Draws a tick parallel to x, using world coordinates void plwxtik( PLFLT x, PLFLT y, PLBOOL minor, PLBOOL invert ); // Draws a tick parallel to y, using world coordinates void plwytik( PLFLT x, PLFLT y, PLBOOL minor, PLBOOL invert ); // get drivers directory #ifdef ENABLE_DYNDRIVERS PLDLLIMPEXP const char* plGetDrvDir( void ); #endif #ifdef PL_HAVE_FREETYPE PLDLLIMPEXP void plD_FreeType_init( PLStream * ); PLDLLIMPEXP void plD_render_freetype_text( PLStream *, EscText * ); PLDLLIMPEXP void plD_FreeType_Destroy( PLStream * ); PLDLLIMPEXP void pl_set_extended_cmap0( PLStream *, int, int ); #endif // Create a temporary file securely PLDLLIMPEXP FILE * pl_create_tempfile( char **fname ); // Create a temporary fifo securely PLDLLIMPEXP char * pl_create_tempfifo( const char **p_fifoname, const char **p_dirname ); #ifdef __cplusplus } #endif #endif // __PLPLOTP_H__ plplot-5.10.0+dfsg/include/ltdl_win32.h 644 1750 1750 276411645771433 165310ustar andrewandrew// $Id: ltdl_win32.h 11970 2011-10-14 08:30:19Z airwin $ // // Contains all prototypes for driver functions. // // Copyright (C) 2008 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #ifndef __LTDL_WIN32_H__ #define __LTDL_WIN32_H__ #include #include "pldll.h" struct __dlhandle { HINSTANCE hinstLib; struct __dlhandle* previousHandle; }; typedef struct __dlhandle* lt_dlhandle; typedef void lt_ptr; PLDLLIMPEXP void lt_dlinit( void ); PLDLLIMPEXP void lt_dlexit( void ); PLDLLIMPEXP lt_dlhandle lt_dlopenext( char* dllname ); PLDLLIMPEXP const char* lt_dlerror(); PLDLLIMPEXP void* lt_dlsym( lt_dlhandle dlhandle, const char* symbol ); PLDLLIMPEXP int lt_dlmakeresident( lt_dlhandle handle ); #endif // __LTDL_WIN32_H__ plplot-5.10.0+dfsg/include/plplot.h 644 1750 1750 22707212272056241 161110ustar andrewandrew// $Id: plplot.h 12968 2014-01-29 01:42:57Z airwin $ // // Macros and prototypes for the PLplot package. This header file must // be included by all user codes. // // Note: some systems allow the Fortran & C namespaces to clobber each // other. So for PLplot to work from Fortran, we do some rather nasty // things to the externally callable C function names. This shouldn't // affect any user programs in C as long as this file is included. // // Copyright (C) 1992 Maurice J. LeBrun, Geoff Furnish, Tony Richardson. // Copyright (C) 2004-2010 Alan W. Irwin // Copyright (C) 2004 Rafael Laboissiere // Copyright (C) 2004 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #ifndef __PLPLOT_H__ #define __PLPLOT_H__ #include "plConfig.h" //-------------------------------------------------------------------------- // USING PLplot // // To use PLplot from C or C++, it is only necessary to // // #include "plplot.h" // // This file does all the necessary setup to make PLplot accessible to // your program as documented in the manual. Additionally, this file // allows you to request certain behavior by defining certain symbols // before inclusion. At the moment the only one is: // // #define DOUBLE or.. // #define PL_DOUBLE // // This causes PLplot to use doubles instead of floats. Use the type // PLFLT everywhere in your code, and it will always be the right thing. // // Note: most of the functions visible here begin with "pl", while all // of the data types and switches begin with "PL". Eventually everything // will conform to this rule in order to keep namespace pollution of the // user code to a minimum. All the PLplot source files actually include // "plplotP.h", which includes this file as well as all the internally- // visible declarations, etc. //-------------------------------------------------------------------------- // The majority of PLplot source files require these, so.. // Under ANSI C, they can be included any number of times. #include #include //-------------------------------------------------------------------------- // SYSTEM IDENTIFICATION // // Several systems are supported directly by PLplot. In order to avoid // confusion, one id macro per system is used. Since different compilers // may predefine different system id macros, we need to check all the // possibilities, and then set the one we will be referencing. These are: // // __cplusplus Any C++ compiler // __unix Any Unix-like system // __hpux Any HP/UX system // __aix Any AIX system // __linux Linux for i386 // (others...) // //-------------------------------------------------------------------------- #ifdef unix // the old way #ifndef __unix #define __unix #endif #endif #if 0 #if defined ( __GNUC__ ) && __GNUC__ > 3 // If gcc 4.x, then turn off all visibility of symbols unless // specified as visible using PLDLLIMPEXP. //#pragma GCC visibility push(hidden) // temporary until issues with above hidden can be sorted out #pragma GCC visibility push(default) #endif #endif // Make sure Unix systems define "__unix" #if defined ( SX ) || /* NEC Super-UX */ \ ( defined ( _IBMR2 ) && defined ( _AIX ) ) || /* AIX */ \ defined ( __hpux ) || /* HP/UX */ \ defined ( sun ) || /* SUN */ \ defined ( CRAY ) || /* Cray */ \ defined ( __convexc__ ) || /* CONVEX */ \ ( defined ( __alpha ) && defined ( __osf__ ) ) || /* DEC Alpha AXP/OSF */ \ defined ( __APPLE__ ) // Max OS-X #ifndef __unix #define __unix #endif #endif //-------------------------------------------------------------------------- // dll functions //-------------------------------------------------------------------------- #include "pldll.h" // Macro to mark function parameters as unused. // For gcc this uses the unused attribute to remove compiler warnings. // For all compilers the parameter name is also mangled to prevent // accidental use. #ifdef PL_UNUSED #elif defined ( __GNUC__ ) # define PL_UNUSED( x ) UNUSED_ ## x __attribute__( ( unused ) ) #else # define PL_UNUSED( x ) UNUSED_ ## x #endif //-------------------------------------------------------------------------- // Base types for PLplot // // Only those that are necessary for function prototypes are defined here. // Notes: // // PLINT is typedef'd to a long by default. This is a change from some // previous versions, where a int was used. However, so long as you have // used type PLINT for integer array arguments as specified by the API, // this change will be transparent for you. // // short is currently used for device page coordinates, so they are // bounded by (-32767, 32767). This gives a max resolution of about 3000 // dpi, and improves performance in some areas over using a PLINT. // // PLUNICODE should be a 32-bit unsigned integer on all platforms. // For now, we are using unsigned int for our Linux ix86 unicode experiments, // but that doesn't guarantee 32 bits exactly on all platforms so this will // be subject to change. //-------------------------------------------------------------------------- #if defined ( PL_DOUBLE ) || defined ( DOUBLE ) typedef double PLFLT; #define PLFLT_MAX DBL_MAX #define PLFLT_MIN DBL_MIN #else typedef float PLFLT; #define PLFLT_MAX FLT_MAX #define PLFLT_MIN FLT_MIN #endif #if ( defined ( PL_HAVE_STDINT_H ) && !defined ( __cplusplus ) ) || \ ( defined ( __cplusplus ) && defined ( PL_HAVE_CXX_STDINT_H ) ) #include // This is apparently portable if stdint.h exists. typedef uint32_t PLUINT; typedef int32_t PLINT; typedef int64_t PLINT64; #define PLINT_MIN INT32_MIN #else // A reasonable back-up in case stdint.h does not exist on the platform. typedef unsigned int PLUINT; typedef int PLINT; typedef __int64 PLINT64; // for Visual C++ 2003 and later INT_MIN must be used, otherwise // PLINT_MIN is unsigned and 2147483648 NOT -2147483648, see // http://msdn.microsoft.com/en-us/library/4kh09110(VS.71).aspx for // details #if defined ( _MSC_VER ) && _MSC_VER >= 1310 #include #define PLINT_MIN INT_MIN #else #define PLINT_MIN -2147483648 #endif // // typedef unsigned int PLUINT; // typedef int PLINT; // typedef long long PLINT64; // #endif // For identifying unicode characters typedef PLUINT PLUNICODE; // For identifying logical (boolean) arguments typedef PLINT PLBOOL; // For passing user data, as with X's XtPointer typedef void* PLPointer; //-------------------------------------------------------------------------- // Complex data types and other good stuff //-------------------------------------------------------------------------- // Switches for escape function call. // Some of these are obsolete but are retained in order to process // old metafiles #define PLESC_SET_RGB 1 // obsolete #define PLESC_ALLOC_NCOL 2 // obsolete #define PLESC_SET_LPB 3 // obsolete #define PLESC_EXPOSE 4 // handle window expose #define PLESC_RESIZE 5 // handle window resize #define PLESC_REDRAW 6 // handle window redraw #define PLESC_TEXT 7 // switch to text screen #define PLESC_GRAPH 8 // switch to graphics screen #define PLESC_FILL 9 // fill polygon #define PLESC_DI 10 // handle DI command #define PLESC_FLUSH 11 // flush output #define PLESC_EH 12 // handle Window events #define PLESC_GETC 13 // get cursor position #define PLESC_SWIN 14 // set window parameters #define PLESC_DOUBLEBUFFERING 15 // configure double buffering #define PLESC_XORMOD 16 // set xor mode #define PLESC_SET_COMPRESSION 17 // AFR: set compression #define PLESC_CLEAR 18 // RL: clear graphics region #define PLESC_DASH 19 // RL: draw dashed line #define PLESC_HAS_TEXT 20 // driver draws text #define PLESC_IMAGE 21 // handle image #define PLESC_IMAGEOPS 22 // plimage related operations #define PLESC_PL2DEVCOL 23 // convert PLColor to device color #define PLESC_DEV2PLCOL 24 // convert device color to PLColor #define PLESC_SETBGFG 25 // set BG, FG colors #define PLESC_DEVINIT 26 // alternate device initialization #define PLESC_GETBACKEND 27 // get used backend of (wxWidgets) driver #define PLESC_BEGIN_TEXT 28 // get ready to draw a line of text #define PLESC_TEXT_CHAR 29 // render a character of text #define PLESC_CONTROL_CHAR 30 // handle a text control character (super/subscript, etc.) #define PLESC_END_TEXT 31 // finish a drawing a line of text #define PLESC_START_RASTERIZE 32 // start rasterized rendering #define PLESC_END_RASTERIZE 33 // end rasterized rendering #define PLESC_ARC 34 // render an arc #define PLESC_GRADIENT 35 // render a gradient #define PLESC_MODESET 36 // set drawing mode #define PLESC_MODEGET 37 // get drawing mode // Alternative unicode text handling control characters #define PLTEXT_FONTCHANGE 0 // font change in the text stream #define PLTEXT_SUPERSCRIPT 1 // superscript in the text stream #define PLTEXT_SUBSCRIPT 2 // subscript in the text stream #define PLTEXT_BACKCHAR 3 // back-char in the text stream #define PLTEXT_OVERLINE 4 // toggle overline in the text stream #define PLTEXT_UNDERLINE 5 // toggle underline in the text stream // image operations #define ZEROW2B 1 #define ZEROW2D 2 #define ONEW2B 3 #define ONEW2D 4 // Window parameter tags #define PLSWIN_DEVICE 1 // device coordinates #define PLSWIN_WORLD 2 // world coordinates // Axis label tags #define PL_X_AXIS 1 // The x-axis #define PL_Y_AXIS 2 // The y-axis #define PL_Z_AXIS 3 // The z-axis // PLplot Option table & support constants // Option-specific settings #define PL_OPT_ENABLED 0x0001 // Obsolete #define PL_OPT_ARG 0x0002 // Option has an argment #define PL_OPT_NODELETE 0x0004 // Don't delete after processing #define PL_OPT_INVISIBLE 0x0008 // Make invisible #define PL_OPT_DISABLED 0x0010 // Processing is disabled // Option-processing settings -- mutually exclusive #define PL_OPT_FUNC 0x0100 // Call handler function #define PL_OPT_BOOL 0x0200 // Set *var = 1 #define PL_OPT_INT 0x0400 // Set *var = atoi(optarg) #define PL_OPT_FLOAT 0x0800 // Set *var = atof(optarg) #define PL_OPT_STRING 0x1000 // Set var = optarg // Global mode settings // These override per-option settings #define PL_PARSE_PARTIAL 0x0000 // For backward compatibility #define PL_PARSE_FULL 0x0001 // Process fully & exit if error #define PL_PARSE_QUIET 0x0002 // Don't issue messages #define PL_PARSE_NODELETE 0x0004 // Don't delete options after // processing #define PL_PARSE_SHOWALL 0x0008 // Show invisible options #define PL_PARSE_OVERRIDE 0x0010 // Obsolete #define PL_PARSE_NOPROGRAM 0x0020 // Program name NOT in *argv[0].. #define PL_PARSE_NODASH 0x0040 // Set if leading dash NOT required #define PL_PARSE_SKIP 0x0080 // Skip over unrecognized args // FCI (font characterization integer) related constants. #define PL_FCI_MARK 0x80000000 #define PL_FCI_IMPOSSIBLE 0x00000000 #define PL_FCI_HEXDIGIT_MASK 0xf #define PL_FCI_HEXPOWER_MASK 0x7 #define PL_FCI_HEXPOWER_IMPOSSIBLE 0xf // These define hexpower values corresponding to each font attribute. #define PL_FCI_FAMILY 0x0 #define PL_FCI_STYLE 0x1 #define PL_FCI_WEIGHT 0x2 // These are legal values for font family attribute #define PL_FCI_SANS 0x0 #define PL_FCI_SERIF 0x1 #define PL_FCI_MONO 0x2 #define PL_FCI_SCRIPT 0x3 #define PL_FCI_SYMBOL 0x4 // These are legal values for font style attribute #define PL_FCI_UPRIGHT 0x0 #define PL_FCI_ITALIC 0x1 #define PL_FCI_OBLIQUE 0x2 // These are legal values for font weight attribute #define PL_FCI_MEDIUM 0x0 #define PL_FCI_BOLD 0x1 #ifdef PL_DEPRECATED // Obsolete names #define plParseInternalOpts( a, b, c ) c_plparseopts( a, b, c ) #define plSetInternalOpt( a, b ) c_plsetopt( a, b ) #endif // PL_DEPRECATED // Option table definition typedef struct { const char *opt; int ( *handler )( const char *, const char *, void * ); void *client_data; void *var; long mode; const char *syntax; const char *desc; } PLOptionTable; // PLplot Graphics Input structure #define PL_MAXKEY 16 typedef struct { int type; // of event (CURRENTLY UNUSED) unsigned int state; // key or button mask unsigned int keysym; // key selected unsigned int button; // mouse button selected PLINT subwindow; // subwindow (alias subpage, alias subplot) number char string[PL_MAXKEY]; // translated string int pX, pY; // absolute device coordinates of pointer PLFLT dX, dY; // relative device coordinates of pointer PLFLT wX, wY; // world coordinates of pointer } PLGraphicsIn; // Structure for describing the plot window #define PL_MAXWINDOWS 64 // Max number of windows/page tracked typedef struct { PLFLT dxmi, dxma, dymi, dyma; // min, max window rel dev coords PLFLT wxmi, wxma, wymi, wyma; // min, max window world coords } PLWindow; // Structure for doing display-oriented operations via escape commands // May add other attributes in time typedef struct { unsigned int x, y; // upper left hand corner unsigned int width, height; // window dimensions } PLDisplay; // Macro used (in some cases) to ignore value of argument // I don't plan on changing the value so you can hard-code it #define PL_NOTSET ( -42 ) // See plcont.c for examples of the following // // PLfGrid is for passing (as a pointer to the first element) an arbitrarily // dimensioned array. The grid dimensions MUST be stored, with a maximum of 3 // dimensions assumed for now. // typedef struct { const PLFLT *f; PLINT nx, ny, nz; } PLfGrid; // // PLfGrid2 is for passing (as an array of pointers) a 2d function array. The // grid dimensions are passed for possible bounds checking. // typedef struct { PLFLT **f; PLINT nx, ny; } PLfGrid2; // // NOTE: a PLfGrid3 is a good idea here but there is no way to exploit it yet // so I'll leave it out for now. // // // PLcGrid is for passing (as a pointer to the first element) arbitrarily // dimensioned coordinate transformation arrays. The grid dimensions MUST be // stored, with a maximum of 3 dimensions assumed for now. // typedef struct { PLFLT *xg, *yg, *zg; PLINT nx, ny, nz; } PLcGrid; // // PLcGrid2 is for passing (as arrays of pointers) 2d coordinate // transformation arrays. The grid dimensions are passed for possible bounds // checking. // typedef struct { PLFLT **xg, **yg, **zg; PLINT nx, ny; } PLcGrid2; // // NOTE: a PLcGrid3 is a good idea here but there is no way to exploit it yet // so I'll leave it out for now. // // PLColor is the usual way to pass an rgb color value. typedef struct { unsigned char r; // red unsigned char g; // green unsigned char b; // blue PLFLT a; // alpha (or transparency) const char *name; } PLColor; // PLControlPt is how cmap1 control points are represented. typedef struct { PLFLT h; // hue PLFLT l; // lightness PLFLT s; // saturation PLFLT p; // position PLFLT a; // alpha (or transparency) int alt_hue_path; // if set, interpolate through h=0 } PLControlPt; // A PLBufferingCB is a control block for interacting with devices // that support double buffering. typedef struct { PLINT cmd; PLINT result; } PLBufferingCB; #define PLESC_DOUBLEBUFFERING_ENABLE 1 #define PLESC_DOUBLEBUFFERING_DISABLE 2 #define PLESC_DOUBLEBUFFERING_QUERY 3 typedef struct { PLFLT exp_label_disp; PLFLT exp_label_pos; PLFLT exp_label_just; } PLLabelDefaults; // // typedefs for access methods for arbitrary (i.e. user defined) data storage // // // This type of struct holds pointers to functions that are used to get, set, // modify, and test individual 2-D data points referenced by a PLPointer. How // the PLPointer is used depends entirely on the functions that implement the // various operations. Certain common data representations have predefined // instances of this structure prepopulated with pointers to predefined // functions. // typedef struct { PLFLT ( *get )( PLPointer p, PLINT ix, PLINT iy ); PLFLT ( *set )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); PLFLT ( *add )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); PLFLT ( *sub )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); PLFLT ( *mul )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); PLFLT ( *div )( PLPointer p, PLINT ix, PLINT iy, PLFLT z ); PLINT ( *is_nan )( PLPointer p, PLINT ix, PLINT iy ); void ( *minmax )( PLPointer p, PLINT nx, PLINT ny, PLFLT *zmim, PLFLT *zmax ); // // f2eval is backwards compatible signature for "f2eval" functions that // existed before plf2ops "operator function families" were used. // PLFLT ( *f2eval )( PLINT ix, PLINT iy, PLPointer p ); } plf2ops_t; // // A typedef to facilitate declaration of a pointer to a plfops_t structure. // typedef plf2ops_t * PLF2OPS; //-------------------------------------------------------------------------- // BRAINDEAD-ness // // Some systems allow the Fortran & C namespaces to clobber each other. // For PLplot to work from Fortran on these systems, we must name the the // externally callable C functions something other than their Fortran entry // names. In order to make this as easy as possible for the casual user, // yet reversible to those who abhor my solution, I have done the // following: // // The C-language bindings are actually different from those // described in the manual. Macros are used to convert the // documented names to the names used in this package. The // user MUST include plplot.h in order to get the name // redefinition correct. // // Sorry to have to resort to such an ugly kludge, but it is really the // best way to handle the situation at present. If all available // compilers offer a way to correct this stupidity, then perhaps we can // eventually reverse it. // // If you feel like screaming at someone (I sure do), please // direct it at your nearest system vendor who has a braindead shared // C/Fortran namespace. Some vendors do offer compiler switches that // change the object names, but then everybody who wants to use the // package must throw these same switches, leading to no end of trouble. // // Note that this definition should not cause any noticable effects except // when debugging PLplot calls, in which case you will need to remember // the real function names (same as before but with a 'c_' prepended). // // Also, to avoid macro conflicts, the BRAINDEAD part must not be expanded // in the stub routines. // // Aside: the reason why a shared Fortran/C namespace is deserving of the // BRAINDEAD characterization is that it completely precludes the the kind // of universal API that is attempted (more or less) with PLplot, without // Herculean efforts (e.g. remapping all of the C bindings by macros as // done here). The vendors of such a scheme, in order to allow a SINGLE // type of argument to be passed transparently between C and Fortran, // namely, a pointer to a conformable data type, have slammed the door on // insertion of stub routines to handle the conversions needed for other // data types. Intelligent linkers could solve this problem, but these are // not anywhere close to becoming universal. So meanwhile, one must live // with either stub routines for the inevitable data conversions, or a // different API. The former is what is used here, but is made far more // difficult in a braindead shared Fortran/C namespace. //-------------------------------------------------------------------------- #ifndef BRAINDEAD #define BRAINDEAD #endif #ifdef BRAINDEAD #ifndef __PLSTUBS_H__ // i.e. do not expand this in the stubs #define pl_setcontlabelformat c_pl_setcontlabelformat #define pl_setcontlabelparam c_pl_setcontlabelparam #define pladv c_pladv #define plarc c_plarc #define plaxes c_plaxes #define plbin c_plbin #define plbop c_plbop #define plbox c_plbox #define plbox3 c_plbox3 #define plbtime c_plbtime #define plcalc_world c_plcalc_world #define plclear c_plclear #define plcol0 c_plcol0 #define plcol1 c_plcol1 #define plcolorbar c_plcolorbar #define plconfigtime c_plconfigtime #define plcont c_plcont #define plcpstrm c_plcpstrm #define plctime c_plctime #define plend c_plend #define plend1 c_plend1 #define plenv c_plenv #define plenv0 c_plenv0 #define pleop c_pleop #define plerrx c_plerrx #define plerry c_plerry #define plfamadv c_plfamadv #define plfill c_plfill #define plfill3 c_plfill3 #define plflush c_plflush #define plfont c_plfont #define plfontld c_plfontld #define plgchr c_plgchr #define plgcol0 c_plgcol0 #define plgcol0a c_plgcol0a #define plgcolbg c_plgcolbg #define plgcolbga c_plgcolbga #define plgcompression c_plgcompression #define plgdev c_plgdev #define plgdidev c_plgdidev #define plgdiori c_plgdiori #define plgdiplt c_plgdiplt #define plgdrawmode c_plgdrawmode #define plgfam c_plgfam #define plgfci c_plgfci #define plgfnam c_plgfnam #define plgfont c_plgfont #define plglevel c_plglevel #define plgpage c_plgpage #define plgra c_plgra #define plgradient c_plgradient #define plgriddata c_plgriddata #define plgspa c_plgspa #define plgstrm c_plgstrm #define plgver c_plgver #define plgvpd c_plgvpd #define plgvpw c_plgvpw #define plgxax c_plgxax #define plgyax c_plgyax #define plgzax c_plgzax #define plhist c_plhist #ifdef PL_DEPRECATED #define plhls c_plhls #endif #define plhlsrgb c_plhlsrgb #define plimage c_plimage #define plimagefr c_plimagefr #define plinit c_plinit #define pljoin c_pljoin #define pllab c_pllab #define pllegend c_pllegend #define pllightsource c_pllightsource #define plline c_plline #define plpath c_plpath #define plline3 c_plline3 #define pllsty c_pllsty #define plmap c_plmap #define plmeridians c_plmeridians #define plmesh c_plmesh #define plmeshc c_plmeshc #define plmkstrm c_plmkstrm #define plmtex c_plmtex #define plmtex3 c_plmtex3 #define plot3d c_plot3d #define plot3dc c_plot3dc #define plot3dcl c_plot3dcl #define plparseopts c_plparseopts #define plpat c_plpat #define plpoin c_plpoin #define plpoin3 c_plpoin3 #define plpoly3 c_plpoly3 #define plprec c_plprec #define plpsty c_plpsty #define plptex c_plptex #define plptex3 c_plptex3 #define plrandd c_plrandd #define plreplot c_plreplot #ifdef PL_DEPRECATED #define plrgb c_plrgb #define plrgb1 c_plrgb1 #endif #define plrgbhls c_plrgbhls #define plschr c_plschr #define plscmap0 c_plscmap0 #define plscmap0a c_plscmap0a #define plscmap0n c_plscmap0n #define plscmap1 c_plscmap1 #define plscmap1a c_plscmap1a #define plscmap1l c_plscmap1l #define plscmap1la c_plscmap1la #define plscmap1n c_plscmap1n #define plscmap1_range c_plscmap1_range #define plgcmap1_range c_plgcmap1_range #define plscol0 c_plscol0 #define plscol0a c_plscol0a #define plscolbg c_plscolbg #define plscolbga c_plscolbga #define plscolor c_plscolor #define plscompression c_plscompression #define plsdev c_plsdev #define plsdidev c_plsdidev #define plsdimap c_plsdimap #define plsdiori c_plsdiori #define plsdiplt c_plsdiplt #define plsdiplz c_plsdiplz #define plseed c_plseed #define plsesc c_plsesc #define plsetopt c_plsetopt #define plsfam c_plsfam #define plsfci c_plsfci #define plsfnam c_plsfnam #define plsfont c_plsfont #define plshade c_plshade #define plshade1 c_plshade1 #define plshades c_plshades #define plslabelfunc c_plslabelfunc #define plsmaj c_plsmaj #define plsmem c_plsmem #define plsmema c_plsmema #define plsmin c_plsmin #define plsdrawmode c_plsdrawmode #define plsori c_plsori #define plspage c_plspage #define plspal0 c_plspal0 #define plspal1 c_plspal1 #define plspause c_plspause #define plsstrm c_plsstrm #define plssub c_plssub #define plssym c_plssym #define plstar c_plstar #define plstart c_plstart #define plstransform c_plstransform #define plstring c_plstring #define plstring3 c_plstring3 #define plstripa c_plstripa #define plstripc c_plstripc #define plstripd c_plstripd #define plstyl c_plstyl #define plsurf3d c_plsurf3d #define plsurf3dl c_plsurf3dl #define plsvect c_plsvect #define plsvpa c_plsvpa #define plsxax c_plsxax #define plsyax c_plsyax #define plsym c_plsym #define plszax c_plszax #define pltext c_pltext #define pltimefmt c_pltimefmt #define plvasp c_plvasp #define plvect c_plvect #define plvpas c_plvpas #define plvpor c_plvpor #define plvsta c_plvsta #define plw3d c_plw3d #ifdef PL_DEPRECATED #define plwid c_plwid #endif #define plwidth c_plwidth #define plwind c_plwind #define plxormod c_plxormod #endif // __PLSTUBS_H__ #endif // BRAINDEAD // Redefine some old function names for backward compatibility #ifndef __PLSTUBS_H__ // i.e. do not expand this in the stubs #ifdef PL_DEPRECATED #define plclr pleop #define plpage plbop #define plcol plcol0 #define plcontf plfcont // Comment out these as they can upset the C++ bindings since the C++ // bindings use the function names without the pl prefix. //#define Alloc2dGrid plAlloc2dGrid //#define Free2dGrid plFree2dGrid //#define MinMax2dGrid plMinMax2dGrid #define plP_gvpd plgvpd #define plP_gvpw plgvpw #define plotsh3d( x, y, z, nx, ny, opt ) plsurf3d( x, y, z, nx, ny, opt, NULL, 0 ) #endif // PL_DEPRECATED #endif // __PLSTUBS_H__ //-------------------------------------------------------------------------- // Function Prototypes //-------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif // All void types // C routines callable from stub routines come first // set the format of the contour labels PLDLLIMPEXP void c_pl_setcontlabelformat( PLINT lexp, PLINT sigdig ); // set offset and spacing of contour labels PLDLLIMPEXP void c_pl_setcontlabelparam( PLFLT offset, PLFLT size, PLFLT spacing, PLINT active ); // Advance to subpage "page", or to the next one if "page" = 0. PLDLLIMPEXP void c_pladv( PLINT page ); // Plot an arc PLDLLIMPEXP void c_plarc( PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, PLFLT rotate, PLBOOL fill ); // This functions similarly to plbox() except that the origin of the axes // is placed at the user-specified point (x0, y0). PLDLLIMPEXP void c_plaxes( PLFLT x0, PLFLT y0, const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub ); // Plot a histogram using x to store data values and y to store frequencies // Flags for plbin() - opt argument #define PL_BIN_DEFAULT 0x0 #define PL_BIN_CENTRED 0x1 #define PL_BIN_NOEXPAND 0x2 #define PL_BIN_NOEMPTY 0x4 PLDLLIMPEXP void c_plbin( PLINT nbin, const PLFLT *x, const PLFLT *y, PLINT opt ); // Calculate broken-down time from continuous time for current stream. PLDLLIMPEXP void c_plbtime( PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime ); // Start new page. Should only be used with pleop(). PLDLLIMPEXP void c_plbop( void ); // This draws a box around the current viewport. PLDLLIMPEXP void c_plbox( const char *xopt, PLFLT xtick, PLINT nxsub, const char *yopt, PLFLT ytick, PLINT nysub ); // This is the 3-d analogue of plbox(). PLDLLIMPEXP void c_plbox3( const char *xopt, const char *xlabel, PLFLT xtick, PLINT nxsub, const char *yopt, const char *ylabel, PLFLT ytick, PLINT nysub, const char *zopt, const char *zlabel, PLFLT ztick, PLINT nzsub ); // Calculate world coordinates and subpage from relative device coordinates. PLDLLIMPEXP void c_plcalc_world( PLFLT rx, PLFLT ry, PLFLT *wx, PLFLT *wy, PLINT *window ); // Clear current subpage. PLDLLIMPEXP void c_plclear( void ); // Set color, map 0. Argument is integer between 0 and 15. PLDLLIMPEXP void c_plcol0( PLINT icol0 ); // Set color, map 1. Argument is a float between 0. and 1. PLDLLIMPEXP void c_plcol1( PLFLT col1 ); // Configure transformation between continuous and broken-down time (and // vice versa) for current stream. PLDLLIMPEXP void c_plconfigtime( PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec ); // Draws a contour plot from data in f(nx,ny). Is just a front-end to // plfcont, with a particular choice for f2eval and f2eval_data. // PLDLLIMPEXP void c_plcont( const PLFLT * const *f, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Draws a contour plot using the function evaluator f2eval and data stored // by way of the f2eval_data pointer. This allows arbitrary organizations // of 2d array data to be used. // PLDLLIMPEXP void plfcont( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLINT nx, PLINT ny, PLINT kx, PLINT lx, PLINT ky, PLINT ly, const PLFLT *clevel, PLINT nlevel, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Copies state parameters from the reference stream to the current stream. PLDLLIMPEXP void c_plcpstrm( PLINT iplsr, PLBOOL flags ); // Calculate continuous time from broken-down time for current stream. PLDLLIMPEXP void c_plctime( PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime ); // Converts input values from relative device coordinates to relative plot // coordinates. PLDLLIMPEXP void pldid2pc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax ); // Converts input values from relative plot coordinates to relative // device coordinates. PLDLLIMPEXP void pldip2dc( PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax ); // End a plotting session for all open streams. PLDLLIMPEXP void c_plend( void ); // End a plotting session for the current stream only. PLDLLIMPEXP void c_plend1( void ); // Simple interface for defining viewport and window. PLDLLIMPEXP void c_plenv( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis ); // similar to plenv() above, but in multiplot mode does not advance the subpage, // instead the current subpage is cleared PLDLLIMPEXP void c_plenv0( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis ); // End current page. Should only be used with plbop(). PLDLLIMPEXP void c_pleop( void ); // Plot horizontal error bars (xmin(i),y(i)) to (xmax(i),y(i)) PLDLLIMPEXP void c_plerrx( PLINT n, const PLFLT *xmin, const PLFLT *xmax, const PLFLT *y ); // Plot vertical error bars (x,ymin(i)) to (x(i),ymax(i)) PLDLLIMPEXP void c_plerry( PLINT n, const PLFLT *x, const PLFLT *ymin, const PLFLT *ymax ); // Advance to the next family file on the next new page PLDLLIMPEXP void c_plfamadv( void ); // Pattern fills the polygon bounded by the input points. PLDLLIMPEXP void c_plfill( PLINT n, const PLFLT *x, const PLFLT *y ); // Pattern fills the 3d polygon bounded by the input points. PLDLLIMPEXP void c_plfill3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z ); // Flushes the output stream. Use sparingly, if at all. PLDLLIMPEXP void c_plflush( void ); // Sets the global font flag to 'ifont'. PLDLLIMPEXP void c_plfont( PLINT ifont ); // Load specified font set. PLDLLIMPEXP void c_plfontld( PLINT fnt ); // Get character default height and current (scaled) height PLDLLIMPEXP void c_plgchr( PLFLT *p_def, PLFLT *p_ht ); // Returns 8 bit RGB values for given color from color map 0 PLDLLIMPEXP void c_plgcol0( PLINT icol0, PLINT *r, PLINT *g, PLINT *b ); // Returns 8 bit RGB values for given color from color map 0 and alpha value PLDLLIMPEXP void c_plgcol0a( PLINT icol0, PLINT *r, PLINT *g, PLINT *b, PLFLT *alpha ); // Returns the background color by 8 bit RGB value PLDLLIMPEXP void c_plgcolbg( PLINT *r, PLINT *g, PLINT *b ); // Returns the background color by 8 bit RGB value and alpha value PLDLLIMPEXP void c_plgcolbga( PLINT *r, PLINT *g, PLINT *b, PLFLT *alpha ); // Returns the current compression setting PLDLLIMPEXP void c_plgcompression( PLINT *compression ); // Get the current device (keyword) name PLDLLIMPEXP void c_plgdev( char *p_dev ); // Retrieve current window into device space PLDLLIMPEXP void c_plgdidev( PLFLT *p_mar, PLFLT *p_aspect, PLFLT *p_jx, PLFLT *p_jy ); // Get plot orientation PLDLLIMPEXP void c_plgdiori( PLFLT *p_rot ); // Retrieve current window into plot space PLDLLIMPEXP void c_plgdiplt( PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax ); // Get the drawing mode PLDLLIMPEXP PLINT c_plgdrawmode( void ); // Get FCI (font characterization integer) PLDLLIMPEXP void c_plgfci( PLUNICODE *p_fci ); // Get family file parameters PLDLLIMPEXP void c_plgfam( PLINT *p_fam, PLINT *p_num, PLINT *p_bmax ); // Get the (current) output file name. Must be preallocated to >80 bytes PLDLLIMPEXP void c_plgfnam( char *fnam ); // Get the current font family, style and weight PLDLLIMPEXP void c_plgfont( PLINT *p_family, PLINT *p_style, PLINT *p_weight ); // Get the (current) run level. PLDLLIMPEXP void c_plglevel( PLINT *p_level ); // Get output device parameters. PLDLLIMPEXP void c_plgpage( PLFLT *p_xp, PLFLT *p_yp, PLINT *p_xleng, PLINT *p_yleng, PLINT *p_xoff, PLINT *p_yoff ); // Switches to graphics screen. PLDLLIMPEXP void c_plgra( void ); // Draw gradient in polygon. PLDLLIMPEXP void c_plgradient( PLINT n, const PLFLT *x, const PLFLT *y, PLFLT angle ); // grid irregularly sampled data PLDLLIMPEXP void c_plgriddata( const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT npts, const PLFLT *xg, PLINT nptsx, const PLFLT *yg, PLINT nptsy, PLFLT **zg, PLINT type, PLFLT data ); PLDLLIMPEXP void plfgriddata( const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT npts, const PLFLT *xg, PLINT nptsx, const PLFLT *yg, PLINT nptsy, PLF2OPS zops, PLPointer zgp, PLINT type, PLFLT data ); // type of gridding algorithm for plgriddata() #define GRID_CSA 1 // Bivariate Cubic Spline approximation #define GRID_DTLI 2 // Delaunay Triangulation Linear Interpolation #define GRID_NNI 3 // Natural Neighbors Interpolation #define GRID_NNIDW 4 // Nearest Neighbors Inverse Distance Weighted #define GRID_NNLI 5 // Nearest Neighbors Linear Interpolation #define GRID_NNAIDW 6 // Nearest Neighbors Around Inverse Distance Weighted // Get subpage boundaries in absolute coordinates PLDLLIMPEXP void c_plgspa( PLFLT *xmin, PLFLT *xmax, PLFLT *ymin, PLFLT *ymax ); // Get current stream number. PLDLLIMPEXP void c_plgstrm( PLINT *p_strm ); // Get the current library version number PLDLLIMPEXP void c_plgver( char *p_ver ); // Get viewport boundaries in normalized device coordinates PLDLLIMPEXP void c_plgvpd( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); // Get viewport boundaries in world coordinates PLDLLIMPEXP void c_plgvpw( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax ); // Get x axis labeling parameters PLDLLIMPEXP void c_plgxax( PLINT *p_digmax, PLINT *p_digits ); // Get y axis labeling parameters PLDLLIMPEXP void c_plgyax( PLINT *p_digmax, PLINT *p_digits ); // Get z axis labeling parameters PLDLLIMPEXP void c_plgzax( PLINT *p_digmax, PLINT *p_digits ); // Draws a histogram of n values of a variable in array data[0..n-1] // Flags for plhist() - opt argument; note: some flags are passed to // plbin() for the actual plotting #define PL_HIST_DEFAULT 0x00 #define PL_HIST_NOSCALING 0x01 #define PL_HIST_IGNORE_OUTLIERS 0x02 #define PL_HIST_NOEXPAND 0x08 #define PL_HIST_NOEMPTY 0x10 PLDLLIMPEXP void c_plhist( PLINT n, const PLFLT *data, PLFLT datmin, PLFLT datmax, PLINT nbin, PLINT opt ); // Functions for converting between HLS and RGB color space PLDLLIMPEXP void c_plhlsrgb( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b ); // Initializes PLplot, using preset or default options PLDLLIMPEXP void c_plinit( void ); // Draws a line segment from (x1, y1) to (x2, y2). PLDLLIMPEXP void c_pljoin( PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ); // Simple routine for labelling graphs. PLDLLIMPEXP void c_pllab( const char *xlabel, const char *ylabel, const char *tlabel ); //flags used for position argument of both pllegend and plcolorbar #define PL_POSITION_LEFT 0x1 #define PL_POSITION_RIGHT 0x2 #define PL_POSITION_TOP 0x4 #define PL_POSITION_BOTTOM 0x8 #define PL_POSITION_INSIDE 0x10 #define PL_POSITION_OUTSIDE 0x20 #define PL_POSITION_VIEWPORT 0x40 #define PL_POSITION_SUBPAGE 0x80 // Flags for pllegend. #define PL_LEGEND_NONE 0x1 #define PL_LEGEND_COLOR_BOX 0x2 #define PL_LEGEND_LINE 0x4 #define PL_LEGEND_SYMBOL 0x8 #define PL_LEGEND_TEXT_LEFT 0x10 #define PL_LEGEND_BACKGROUND 0x20 #define PL_LEGEND_BOUNDING_BOX 0x40 #define PL_LEGEND_ROW_MAJOR 0x80 // Flags for plcolorbar #define PL_COLORBAR_LABEL_LEFT 0x1 #define PL_COLORBAR_LABEL_RIGHT 0x2 #define PL_COLORBAR_LABEL_TOP 0x4 #define PL_COLORBAR_LABEL_BOTTOM 0x8 #define PL_COLORBAR_IMAGE 0x10 #define PL_COLORBAR_SHADE 0x20 #define PL_COLORBAR_GRADIENT 0x40 #define PL_COLORBAR_CAP_NONE 0x80 #define PL_COLORBAR_CAP_LOW 0x100 #define PL_COLORBAR_CAP_HIGH 0x200 #define PL_COLORBAR_SHADE_LABEL 0x400 #define PL_COLORBAR_ORIENT_RIGHT 0x800 #define PL_COLORBAR_ORIENT_TOP 0x1000 #define PL_COLORBAR_ORIENT_LEFT 0x2000 #define PL_COLORBAR_ORIENT_BOTTOM 0x4000 #define PL_COLORBAR_BACKGROUND 0x8000 #define PL_COLORBAR_BOUNDING_BOX 0x10000 // Flags for drawing mode #define PL_DRAWMODE_UNKNOWN 0x0 #define PL_DRAWMODE_DEFAULT 0x1 #define PL_DRAWMODE_REPLACE 0x2 #define PL_DRAWMODE_XOR 0x4 // Routine for drawing discrete line, symbol, or cmap0 legends PLDLLIMPEXP void c_pllegend( PLFLT *p_legend_width, PLFLT *p_legend_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT plot_width, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLINT nrow, PLINT ncolumn, PLINT nlegend, const PLINT *opt_array, PLFLT text_offset, PLFLT text_scale, PLFLT text_spacing, PLFLT text_justification, const PLINT *text_colors, const char * const *text, const PLINT *box_colors, const PLINT *box_patterns, const PLFLT *box_scales, const PLFLT *box_line_widths, const PLINT *line_colors, const PLINT *line_styles, const PLFLT *line_widths, const PLINT *symbol_colors, const PLFLT *symbol_scales, const PLINT *symbol_numbers, const char * const *symbols ); // Routine for drawing continous colour legends PLDLLIMPEXP void c_plcolorbar( PLFLT *p_colorbar_width, PLFLT *p_colorbar_height, PLINT opt, PLINT position, PLFLT x, PLFLT y, PLFLT x_length, PLFLT y_length, PLINT bg_color, PLINT bb_color, PLINT bb_style, PLFLT low_cap_color, PLFLT high_cap_color, PLINT cont_color, PLFLT cont_width, PLINT n_labels, const PLINT *label_opts, const char * const *labels, PLINT n_axes, const char * const * axis_opts, const PLFLT *ticks, const PLINT *sub_ticks, const PLINT *n_values, const PLFLT * const *values ); // Sets position of the light source PLDLLIMPEXP void c_pllightsource( PLFLT x, PLFLT y, PLFLT z ); // Draws line segments connecting a series of points. PLDLLIMPEXP void c_plline( PLINT n, const PLFLT *x, const PLFLT *y ); // Draws a line in 3 space. PLDLLIMPEXP void c_plline3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z ); // Set line style. PLDLLIMPEXP void c_pllsty( PLINT lin ); // plot continental outline in world coordinates PLDLLIMPEXP void c_plmap( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), const char *type, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); // Plot the latitudes and longitudes on the background. PLDLLIMPEXP void c_plmeridians( void ( *mapform )( PLINT, PLFLT *, PLFLT * ), PLFLT dlong, PLFLT dlat, PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat ); // Plots a mesh representation of the function z[x][y]. PLDLLIMPEXP void c_plmesh( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt ); // Like plmesh, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfmesh( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt ); // Plots a mesh representation of the function z[x][y] with contour PLDLLIMPEXP void c_plmeshc( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel ); // Like plmeshc, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfmeshc( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel ); // Creates a new stream and makes it the default. PLDLLIMPEXP void c_plmkstrm( PLINT *p_strm ); // Prints out "text" at specified position relative to viewport PLDLLIMPEXP void c_plmtex( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text ); // Prints out "text" at specified position relative to viewport (3D) PLDLLIMPEXP void c_plmtex3( const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text ); // Plots a 3-d representation of the function z[x][y]. PLDLLIMPEXP void c_plot3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); // Like plot3d, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfplot3d( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt, PLBOOL side ); // Plots a 3-d representation of the function z[x][y] with contour. PLDLLIMPEXP void c_plot3dc( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel ); // Like plot3dc, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfplot3dc( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel ); // Plots a 3-d representation of the function z[x][y] with contour and // y index limits. PLDLLIMPEXP void c_plot3dcl( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel, PLINT indexxmin, PLINT indexxmax, const PLINT *indexymin, const PLINT *indexymax ); // Like plot3dcl, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfplot3dcl( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel, PLINT indexxmin, PLINT indexxmax, const PLINT *indexymin, const PLINT *indexymax ); // // definitions for the opt argument in plot3dc() and plsurf3d() // // DRAW_LINEX *must* be 1 and DRAW_LINEY *must* be 2, because of legacy code! // #define DRAW_LINEX 0x001 // draw lines parallel to the X axis #define DRAW_LINEY 0x002 // draw lines parallel to the Y axis #define DRAW_LINEXY 0x003 // draw lines parallel to both the X and Y axis #define MAG_COLOR 0x004 // draw the mesh with a color dependent of the magnitude #define BASE_CONT 0x008 // draw contour plot at bottom xy plane #define TOP_CONT 0x010 // draw contour plot at top xy plane #define SURF_CONT 0x020 // draw contour plot at surface #define DRAW_SIDES 0x040 // draw sides #define FACETED 0x080 // draw outline for each square that makes up the surface #define MESH 0x100 // draw mesh // // valid options for plot3dc(): // // DRAW_SIDES, BASE_CONT, TOP_CONT (not yet), // MAG_COLOR, DRAW_LINEX, DRAW_LINEY, DRAW_LINEXY. // // valid options for plsurf3d(): // // MAG_COLOR, BASE_CONT, SURF_CONT, FACETED, DRAW_SIDES. // // Set fill pattern directly. PLDLLIMPEXP void c_plpat( PLINT nlin, const PLINT *inc, const PLINT *del ); // Draw a line connecting two points, accounting for coordinate transforms PLDLLIMPEXP void c_plpath( PLINT n, PLFLT x1, PLFLT y1, PLFLT x2, PLFLT y2 ); // Plots array y against x for n points using ASCII code "code". PLDLLIMPEXP void c_plpoin( PLINT n, const PLFLT *x, const PLFLT *y, PLINT code ); // Draws a series of points in 3 space. PLDLLIMPEXP void c_plpoin3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT code ); // Draws a polygon in 3 space. PLDLLIMPEXP void c_plpoly3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, const PLBOOL *draw, PLBOOL ifcc ); // Set the floating point precision (in number of places) in numeric labels. PLDLLIMPEXP void c_plprec( PLINT setp, PLINT prec ); // Set fill pattern, using one of the predefined patterns. PLDLLIMPEXP void c_plpsty( PLINT patt ); // Prints out "text" at world cooordinate (x,y). PLDLLIMPEXP void c_plptex( PLFLT x, PLFLT y, PLFLT dx, PLFLT dy, PLFLT just, const char *text ); // Prints out "text" at world cooordinate (x,y,z). PLDLLIMPEXP void c_plptex3( PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, const char *text ); // Random number generator based on Mersenne Twister. // Obtain real random number in range [0,1]. PLDLLIMPEXP PLFLT c_plrandd( void ); // Replays contents of plot buffer to current device/file. PLDLLIMPEXP void c_plreplot( void ); // Functions for converting between HLS and RGB color space PLDLLIMPEXP void c_plrgbhls( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s ); // Set character height. PLDLLIMPEXP void c_plschr( PLFLT def, PLFLT scale ); // Set color map 0 colors by 8 bit RGB values PLDLLIMPEXP void c_plscmap0( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol0 ); // Set color map 0 colors by 8 bit RGB values and alpha values PLDLLIMPEXP void c_plscmap0a( const PLINT *r, const PLINT *g, const PLINT *b, const PLFLT *alpha, PLINT ncol0 ); // Set number of colors in cmap 0 PLDLLIMPEXP void c_plscmap0n( PLINT ncol0 ); // Set color map 1 colors by 8 bit RGB values PLDLLIMPEXP void c_plscmap1( const PLINT *r, const PLINT *g, const PLINT *b, PLINT ncol1 ); // Set color map 1 colors by 8 bit RGB and alpha values PLDLLIMPEXP void c_plscmap1a( const PLINT *r, const PLINT *g, const PLINT *b, const PLFLT *alpha, PLINT ncol1 ); // Set color map 1 colors using a piece-wise linear relationship between // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. PLDLLIMPEXP void c_plscmap1l( PLBOOL itype, PLINT npts, const PLFLT *intensity, const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3, const PLBOOL *alt_hue_path ); // Set color map 1 colors using a piece-wise linear relationship between // intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. // Will also linear interpolate alpha values. PLDLLIMPEXP void c_plscmap1la( PLBOOL itype, PLINT npts, const PLFLT *intensity, const PLFLT *coord1, const PLFLT *coord2, const PLFLT *coord3, const PLFLT *alpha, const PLBOOL *alt_hue_path ); // Set number of colors in cmap 1 PLDLLIMPEXP void c_plscmap1n( PLINT ncol1 ); // Set the color map 1 range used in continuous plots PLDLLIMPEXP void c_plscmap1_range( PLFLT min_color, PLFLT max_color ); // Get the color map 1 range used in continuous plots PLDLLIMPEXP void c_plgcmap1_range( PLFLT *min_color, PLFLT *max_color ); // Set a given color from color map 0 by 8 bit RGB value PLDLLIMPEXP void c_plscol0( PLINT icol0, PLINT r, PLINT g, PLINT b ); // Set a given color from color map 0 by 8 bit RGB value PLDLLIMPEXP void c_plscol0a( PLINT icol0, PLINT r, PLINT g, PLINT b, PLFLT alpha ); // Set the background color by 8 bit RGB value PLDLLIMPEXP void c_plscolbg( PLINT r, PLINT g, PLINT b ); // Set the background color by 8 bit RGB value and alpha value PLDLLIMPEXP void c_plscolbga( PLINT r, PLINT g, PLINT b, PLFLT alpha ); // Used to globally turn color output on/off PLDLLIMPEXP void c_plscolor( PLINT color ); // Set the compression level PLDLLIMPEXP void c_plscompression( PLINT compression ); // Set the device (keyword) name PLDLLIMPEXP void c_plsdev( const char *devname ); // Set window into device space using margin, aspect ratio, and // justification PLDLLIMPEXP void c_plsdidev( PLFLT mar, PLFLT aspect, PLFLT jx, PLFLT jy ); // Set up transformation from metafile coordinates. PLDLLIMPEXP void c_plsdimap( PLINT dimxmin, PLINT dimxmax, PLINT dimymin, PLINT dimymax, PLFLT dimxpmm, PLFLT dimypmm ); // Set plot orientation, specifying rotation in units of pi/2. PLDLLIMPEXP void c_plsdiori( PLFLT rot ); // Set window into plot space PLDLLIMPEXP void c_plsdiplt( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ); // Set window into plot space incrementally (zoom) PLDLLIMPEXP void c_plsdiplz( PLFLT xmin, PLFLT ymin, PLFLT xmax, PLFLT ymax ); // Set seed for internal random number generator PLDLLIMPEXP void c_plseed( unsigned int seed ); // Set the escape character for text strings. PLDLLIMPEXP void c_plsesc( char esc ); // Set family file parameters PLDLLIMPEXP void c_plsfam( PLINT fam, PLINT num, PLINT bmax ); // Set FCI (font characterization integer) PLDLLIMPEXP void c_plsfci( PLUNICODE fci ); // Set the output file name. PLDLLIMPEXP void c_plsfnam( const char *fnam ); // Set the current font family, style and weight PLDLLIMPEXP void c_plsfont( PLINT family, PLINT style, PLINT weight ); // Shade region. PLDLLIMPEXP void c_plshade( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP void c_plshade1( const PLFLT *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void ( *fill )( const PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP void c_plshades( const PLFLT * const *a, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP void plfshades( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, const PLFLT *clevel, PLINT nlevel, PLFLT fill_width, PLINT cont_color, PLFLT cont_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP void plfshade( PLFLT ( *f2eval )( PLINT, PLINT, PLPointer ), PLPointer f2eval_data, PLFLT ( *c2eval )( PLINT, PLINT, PLPointer ), PLPointer c2eval_data, PLINT nx, PLINT ny, PLFLT left, PLFLT right, PLFLT bottom, PLFLT top, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLBOOL rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP void plfshade1( PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT ( *defined )( PLFLT, PLFLT ), PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT shade_min, PLFLT shade_max, PLINT sh_cmap, PLFLT sh_color, PLFLT sh_width, PLINT min_color, PLFLT min_width, PLINT max_color, PLFLT max_width, void ( *fill )( PLINT, const PLFLT *, const PLFLT * ), PLINT rectangular, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // Setup a user-provided custom labeling function PLDLLIMPEXP void c_plslabelfunc( void ( *label_func )( PLINT, PLFLT, char *, PLINT, PLPointer ), PLPointer label_data ); // Set up lengths of major tick marks. PLDLLIMPEXP void c_plsmaj( PLFLT def, PLFLT scale ); // Set the RGB memory area to be plotted (with the 'mem' or 'memcairo' drivers) PLDLLIMPEXP void c_plsmem( PLINT maxx, PLINT maxy, void *plotmem ); // Set the RGBA memory area to be plotted (with the 'memcairo' driver) PLDLLIMPEXP void c_plsmema( PLINT maxx, PLINT maxy, void *plotmem ); // Set up lengths of minor tick marks. PLDLLIMPEXP void c_plsmin( PLFLT def, PLFLT scale ); // Set the drawing mode PLDLLIMPEXP void c_plsdrawmode( PLINT mode ); // Set orientation. Must be done before calling plinit. PLDLLIMPEXP void c_plsori( PLINT ori ); // Set output device parameters. Usually ignored by the driver. PLDLLIMPEXP void c_plspage( PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff ); // Set the colors for color table 0 from a cmap0 file PLDLLIMPEXP void c_plspal0( const char *filename ); // Set the colors for color table 1 from a cmap1 file PLDLLIMPEXP void c_plspal1( const char *filename, PLBOOL interpolate ); // Set the pause (on end-of-page) status PLDLLIMPEXP void c_plspause( PLBOOL pause ); // Set stream number. PLDLLIMPEXP void c_plsstrm( PLINT strm ); // Set the number of subwindows in x and y PLDLLIMPEXP void c_plssub( PLINT nx, PLINT ny ); // Set symbol height. PLDLLIMPEXP void c_plssym( PLFLT def, PLFLT scale ); // Initialize PLplot, passing in the windows/page settings. PLDLLIMPEXP void c_plstar( PLINT nx, PLINT ny ); // Initialize PLplot, passing the device name and windows/page settings. PLDLLIMPEXP void c_plstart( const char *devname, PLINT nx, PLINT ny ); // Set the coordinate transform PLDLLIMPEXP void c_plstransform( void ( *coordinate_transform )( PLFLT, PLFLT, PLFLT*, PLFLT*, PLPointer ), PLPointer coordinate_transform_data ); // Prints out the same string repeatedly at the n points in world // coordinates given by the x and y arrays. Supersedes plpoin and // plsymbol for the case where text refers to a unicode glyph either // directly as UTF-8 or indirectly via the standard text escape // sequences allowed for PLplot input strings. PLDLLIMPEXP void c_plstring( PLINT n, const PLFLT *x, const PLFLT *y, const char *string ); // Prints out the same string repeatedly at the n points in world // coordinates given by the x, y, and z arrays. Supersedes plpoin3 // for the case where text refers to a unicode glyph either directly // as UTF-8 or indirectly via the standard text escape sequences // allowed for PLplot input strings. PLDLLIMPEXP void c_plstring3( PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, const char *string ); // Add a point to a stripchart. PLDLLIMPEXP void c_plstripa( PLINT id, PLINT pen, PLFLT x, PLFLT y ); // Create 1d stripchart PLDLLIMPEXP void c_plstripc( PLINT *id, const char *xspec, const char *yspec, PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax, PLFLT xlpos, PLFLT ylpos, PLBOOL y_ascl, PLBOOL acc, PLINT colbox, PLINT collab, const PLINT colline[], const PLINT styline[], const char *legline[], const char *labx, const char *laby, const char *labtop ); // Deletes and releases memory used by a stripchart. PLDLLIMPEXP void c_plstripd( PLINT id ); // plots a 2d image (or a matrix too large for plshade() ) PLDLLIMPEXP void c_plimagefr( const PLFLT * const *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // // Like plimagefr, but uses an evaluator function to access image data from // idatap. getminmax is only used if zmin == zmax. // PLDLLIMPEXP void plfimagefr( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT valuemin, PLFLT valuemax, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // plots a 2d image (or a matrix too large for plshade() ) - colors // automatically scaled PLDLLIMPEXP void c_plimage( const PLFLT * const *idata, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); // // Like plimage, but uses an operator functions to access image data from // idatap. // PLDLLIMPEXP void plfimage( PLF2OPS idataops, PLPointer idatap, PLINT nx, PLINT ny, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT Dxmin, PLFLT Dxmax, PLFLT Dymin, PLFLT Dymax ); // Set up a new line style PLDLLIMPEXP void c_plstyl( PLINT nms, const PLINT *mark, const PLINT *space ); // Plots the 3d surface representation of the function z[x][y]. PLDLLIMPEXP void c_plsurf3d( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel ); // Like plsurf3d, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfsurf3d( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel ); // Plots the 3d surface representation of the function z[x][y] with y // index limits. PLDLLIMPEXP void c_plsurf3dl( const PLFLT *x, const PLFLT *y, const PLFLT * const *z, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel, PLINT indexxmin, PLINT indexxmax, const PLINT *indexymin, const PLINT *indexymax ); // Like plsurf3dl, but uses an evaluator function to access z data from zp PLDLLIMPEXP void plfsurf3dl( const PLFLT *x, const PLFLT *y, PLF2OPS zops, PLPointer zp, PLINT nx, PLINT ny, PLINT opt, const PLFLT *clevel, PLINT nlevel, PLINT indexxmin, PLINT indexxmax, const PLINT *indexymin, const PLINT *indexymax ); // Set arrow style for vector plots. PLDLLIMPEXP void c_plsvect( const PLFLT *arrowx, const PLFLT *arrowy, PLINT npts, PLBOOL fill ); // Sets the edges of the viewport to the specified absolute coordinates PLDLLIMPEXP void c_plsvpa( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); // Set x axis labeling parameters PLDLLIMPEXP void c_plsxax( PLINT digmax, PLINT digits ); // Set inferior X window PLDLLIMPEXP void plsxwin( PLINT window_id ); // Set y axis labeling parameters PLDLLIMPEXP void c_plsyax( PLINT digmax, PLINT digits ); // Plots array y against x for n points using Hershey symbol "code" PLDLLIMPEXP void c_plsym( PLINT n, const PLFLT *x, const PLFLT *y, PLINT code ); // Set z axis labeling parameters PLDLLIMPEXP void c_plszax( PLINT digmax, PLINT digits ); // Switches to text screen. PLDLLIMPEXP void c_pltext( void ); // Set the format for date / time labels for current stream. PLDLLIMPEXP void c_pltimefmt( const char *fmt ); // Sets the edges of the viewport with the given aspect ratio, leaving // room for labels. PLDLLIMPEXP void c_plvasp( PLFLT aspect ); // Creates the largest viewport of the specified aspect ratio that fits // within the specified normalized subpage coordinates. // simple arrow plotter. PLDLLIMPEXP void c_plvect( const PLFLT * const *u, const PLFLT * const *v, PLINT nx, PLINT ny, PLFLT scale, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); // // Routine to plot a vector array with arbitrary coordinate // and vector transformations // PLDLLIMPEXP void plfvect( PLFLT ( *getuv )( PLINT, PLINT, PLPointer ), PLPointer up, PLPointer vp, PLINT nx, PLINT ny, PLFLT scale, void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data ); PLDLLIMPEXP void c_plvpas( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT aspect ); // Creates a viewport with the specified normalized subpage coordinates. PLDLLIMPEXP void c_plvpor( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); // Defines a "standard" viewport with seven character heights for // the left margin and four character heights everywhere else. PLDLLIMPEXP void c_plvsta( void ); // Set up a window for three-dimensional plotting. PLDLLIMPEXP void c_plw3d( PLFLT basex, PLFLT basey, PLFLT height, PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLFLT zmin, PLFLT zmax, PLFLT alt, PLFLT az ); #ifdef PL_DEPRECATED // Set pen width with deprecated integer width PLDLLIMPEXP void c_plwid( PLINT width ); #endif // Set pen width. PLDLLIMPEXP void c_plwidth( PLFLT width ); // Set up world coordinates of the viewport boundaries (2d plots). PLDLLIMPEXP void c_plwind( PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax ); // Set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device PLDLLIMPEXP void c_plxormod( PLBOOL mode, PLBOOL *status ); //-------------------------------------------------------------------------- // Functions for use from C or C++ only //-------------------------------------------------------------------------- // Returns a list of file-oriented device names and their menu strings PLDLLIMPEXP void plgFileDevs( const char ***p_menustr, const char ***p_devname, int *p_ndev ); // Returns a list of all device names and their menu strings PLDLLIMPEXP void plgDevs( const char ***p_menustr, const char ***p_devname, int *p_ndev ); // Set the function pointer for the keyboard event handler PLDLLIMPEXP void plsKeyEH( void ( *KeyEH )( PLGraphicsIn *, void *, int * ), void *KeyEH_data ); // Set the function pointer for the (mouse) button event handler PLDLLIMPEXP void plsButtonEH( void ( *ButtonEH )( PLGraphicsIn *, void *, int * ), void *ButtonEH_data ); // Sets an optional user bop handler PLDLLIMPEXP void plsbopH( void ( *handler )( void *, int * ), void *handler_data ); // Sets an optional user eop handler PLDLLIMPEXP void plseopH( void ( *handler )( void *, int * ), void *handler_data ); // Set the variables to be used for storing error info PLDLLIMPEXP void plsError( PLINT *errcode, char *errmsg ); // Sets an optional user exit handler. PLDLLIMPEXP void plsexit( int ( *handler )( const char * ) ); // Sets an optional user abort handler. PLDLLIMPEXP void plsabort( void ( *handler )( const char * ) ); // Transformation routines // Identity transformation. PLDLLIMPEXP void pltr0( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ); // Does linear interpolation from singly dimensioned coord arrays. PLDLLIMPEXP void pltr1( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ); // Does linear interpolation from doubly dimensioned coord arrays // (column dominant, as per normal C 2d arrays). PLDLLIMPEXP void pltr2( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ); // Just like pltr2() but uses pointer arithmetic to get coordinates from // 2d grid tables. PLDLLIMPEXP void pltr2p( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data ); // Does linear interpolation from doubly dimensioned coord arrays // (row dominant, i.e. Fortran ordering). PLDLLIMPEXP void pltr2f( PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data ); // // Returns a pointer to a plf2ops_t stucture with pointers to functions for // accessing 2-D data referenced as (PLFLT **), such as the C variable z // declared as... // // PLFLT z[nx][ny]; // PLDLLIMPEXP PLF2OPS plf2ops_c( void ); // // Returns a pointer to a plf2ops_t stucture with pointers to functions for accessing 2-D data // referenced as (PLfGrid2 *), where the PLfGrid2's "f" is treated as type // (PLFLT **). // PLDLLIMPEXP PLF2OPS plf2ops_grid_c( void ); // // Returns a pointer to a plf2ops_t stucture with pointers to functions for // accessing 2-D data stored in (PLfGrid2 *), with the PLfGrid2's "f" field // treated as type (PLFLT *) pointing to 2-D data stored in row-major order. // In the context of plotting, it might be easier to think of it as "X-major" // order. In this ordering, values for a single X index are stored in // consecutive memory locations. // PLDLLIMPEXP PLF2OPS plf2ops_grid_row_major( void ); // // Returns a pointer to a plf2ops_t stucture with pointers to functions for // accessing 2-D data stored in (PLfGrid2 *), with the PLfGrid2's "f" field // treated as type (PLFLT *) pointing to 2-D data stored in column-major order. // In the context of plotting, it might be easier to think of it as "Y-major" // order. In this ordering, values for a single Y index are stored in // consecutive memory locations. // PLDLLIMPEXP PLF2OPS plf2ops_grid_col_major( void ); // Function evaluators (Should these be deprecated in favor of plf2ops?) // // Does a lookup from a 2d function array. plf2eval_data is treated as type // (PLFLT **) and data for (ix,iy) is returned from... // // plf2eval_data[ix][iy]; // PLDLLIMPEXP PLFLT plf2eval1( PLINT ix, PLINT iy, PLPointer plf2eval_data ); // // Does a lookup from a 2d function array. plf2eval_data is treated as type // (PLfGrid2 *) and data for (ix,iy) is returned from... // // plf2eval_data->f[ix][iy]; // PLDLLIMPEXP PLFLT plf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data ); // // Does a lookup from a 2d function array. plf2eval_data is treated as type // (PLfGrid *) and data for (ix,iy) is returned from... // // plf2eval_data->f[ix * plf2eval_data->ny + iy]; // // This is commonly called "row-major order", but in the context of plotting, // it might be easier to think of it as "X-major order". In this ordering, // values for a single X index are stored in consecutive memory locations. // This is also known as C ordering. // PLDLLIMPEXP PLFLT plf2eval( PLINT ix, PLINT iy, PLPointer plf2eval_data ); // // Does a lookup from a 2d function array. plf2eval_data is treated as type // (PLfGrid *) and data for (ix,iy) is returned from... // // plf2eval_data->f[ix + iy * plf2eval_data->nx]; // // This is commonly called "column-major order", but in the context of // plotting, it might be easier to think of it as "Y-major order". In this // ordering, values for a single Y index are stored in consecutive memory // locations. This is also known as FORTRAN ordering. // PLDLLIMPEXP PLFLT plf2evalr( PLINT ix, PLINT iy, PLPointer plf2eval_data ); // Command line parsing utilities // Clear internal option table info structure. PLDLLIMPEXP void plClearOpts( void ); // Reset internal option table info structure. PLDLLIMPEXP void plResetOpts( void ); // Merge user option table into internal info structure. PLDLLIMPEXP int plMergeOpts( PLOptionTable *options, const char *name, const char **notes ); // Set the strings used in usage and syntax messages. PLDLLIMPEXP void plSetUsage( const char *program_string, const char *usage_string ); // Process input strings, treating them as an option and argument pair. // The first is for the external API, the second the work routine declared // here for backward compatibilty. PLDLLIMPEXP int c_plsetopt( const char *opt, const char *optarg ); #ifdef PL_DEPRECATED PLDLLIMPEXP int plSetOpt( const char *opt, const char *optarg ); #endif // PL_DEPRECATED // Process options list using current options info. PLDLLIMPEXP int c_plparseopts( int *p_argc, const char **argv, PLINT mode ); // Print usage & syntax message. PLDLLIMPEXP void plOptUsage( void ); // Miscellaneous // Set the output file pointer PLDLLIMPEXP void plgfile( FILE **p_file ); // Get the output file pointer PLDLLIMPEXP void plsfile( FILE *file ); // Get the escape character for text strings. PLDLLIMPEXP void plgesc( char *p_esc ); // Front-end to driver escape function. PLDLLIMPEXP void pl_cmd( PLINT op, void *ptr ); // Return full pathname for given file if executable PLDLLIMPEXP int plFindName( char *p ); // Looks for the specified executable file according to usual search path. PLDLLIMPEXP char * plFindCommand( const char *fn ); // Gets search name for file by concatenating the dir, subdir, and file // name, allocating memory as needed. PLDLLIMPEXP void plGetName( const char *dir, const char *subdir, const char *filename, char **filespec ); // Prompts human to input an integer in response to given message. PLDLLIMPEXP PLINT plGetInt( const char *s ); // Prompts human to input a float in response to given message. PLDLLIMPEXP PLFLT plGetFlt( const char *s ); // Nice way to allocate space for a vectored 2d grid // Allocates a block of memory for use as a 2-d grid of PLFLT's. PLDLLIMPEXP void plAlloc2dGrid( PLFLT ***f, PLINT nx, PLINT ny ); // Frees a block of memory allocated with plAlloc2dGrid(). PLDLLIMPEXP void plFree2dGrid( PLFLT **f, PLINT nx, PLINT ny ); // Find the maximum and minimum of a 2d matrix allocated with plAllc2dGrid(). PLDLLIMPEXP void plMinMax2dGrid( const PLFLT * const *f, PLINT nx, PLINT ny, PLFLT *fmax, PLFLT *fmin ); // Wait for graphics input event and translate to world coordinates PLDLLIMPEXP int plGetCursor( PLGraphicsIn *gin ); // Translates relative device coordinates to world coordinates. PLDLLIMPEXP int plTranslateCursor( PLGraphicsIn *gin ); #ifdef PL_DEPRECATED // These functions are depreciated and only retained for backwards // compatibility - do not use in new code. // Set current color (map 0) by hue, lightness, and saturation. PLDLLIMPEXP void c_plhls( PLFLT h, PLFLT l, PLFLT s ); // Set line color by red, green, blue from 0. to 1. PLDLLIMPEXP void c_plrgb( PLFLT r, PLFLT g, PLFLT b ); // Set line color by 8 bit RGB values. PLDLLIMPEXP void c_plrgb1( PLINT r, PLINT g, PLINT b ); #endif // PL_DEPRECATED #ifdef __cplusplus } #endif #if 0 #if defined ( __GNUC__ ) && __GNUC__ > 3 #pragma GCC visibility pop #endif #endif #endif // __PLPLOT_H__ plplot-5.10.0+dfsg/include/plConfig.h.in 644 1750 1750 643212260100733 166710ustar andrewandrew// -*-C-*- // $Id: plConfig.h.in 12914 2013-12-29 20:11:07Z airwin $ // // Maurice LeBrun // IFS, University of Texas at Austin // 18-Jul-1994 // // Copyright (C) 2004-2013 Alan W. Irwin // Copyright (C) 2004 Rafael Laboissiere // Copyright (C) 2004 Joao Cardoso // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // Configured (by CMake) macros for PLplot that are required for the // core build and the build of the installed examples (and presumably // any user applications). Therefore, the configured plConfig.h // should be installed. In contrast, plplot_config.h.in (note, // plConfig.h #includes plplot_config.h for the core build because // HAVE_CONFIG_H is #defined in that case) contains configured macros // that are only required for the core build. Therefore, in contrast // to plConfig.h, plplot_config.h should not be installed. // // Maintenance issue: in makes no sense to configure duplicate macros // for both plplot_config.h and plConfig.h. Therefore, when adding a macro // decide which file to put it in depending on whether the result is // needed for the installed examples build or not. Furthermore, move // configured macros from one file to the other as needed depending on // that criterion, but do not copy them. #ifndef __PLCONFIG_H__ #define __PLCONFIG_H__ #ifdef HAVE_CONFIG_H # include #endif // Define if you have c++ accessible stdint.h #cmakedefine PL_HAVE_CXX_STDINT_H // Define if snprintf is available #ifndef PL_HAVE_SNPRINTF #cmakedefine PL_HAVE_SNPRINTF #endif // Define if _snprintf is available #ifndef _PL_HAVE_SNPRINTF #cmakedefine _PL_HAVE_SNPRINTF #endif // Define if isfinite is available #cmakedefine PL_HAVE_ISFINITE // Define if finite is available #cmakedefine PL_HAVE_FINITE // Define if _finite is available #cmakedefine PL__HAVE_FINITE // Define if isinf is available #cmakedefine PL_HAVE_ISINF // Define if _isinf is available #cmakedefine PL__HAVE_ISINF // Define if isnan is available #cmakedefine PL_HAVE_ISNAN // Define if _isnan is available #cmakedefine PL__HAVE_ISNAN // Define to 1 if you have the header file. #cmakedefine PL_HAVE_STDINT_H 1 // Define to 1 if you have the header file. #cmakedefine PL_HAVE_UNISTD_H 1 // Define if nanosleep is available #cmakedefine PL_HAVE_NANOSLEEP // Define if you want PLplot's float type to be double #cmakedefine PL_DOUBLE // Define if C++ compiler accepts using namespace #cmakedefine PL_USE_NAMESPACE // Define if isnan is present in but not in // - broken Mac OSX systems #cmakedefine PL_BROKEN_ISNAN_CXX #endif // __PLCONFIG_H__ plplot-5.10.0+dfsg/include/plplotcanvas-hacktext.h 644 1750 1750 662411665665174 210740ustar andrewandrew// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- // // plplotcanvas-hacktext.h: Hacktext CanvasItem, cloned from the // gnome-print project // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public License // as published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // // Authors: // Federico Mena // Raph Levien // Lauris Kaplinski // // Copyright (C) 1998-1999 The Free Software Foundation // Copyright (C) 2000-2002 Ximian Inc. // // #ifndef __PLPLOT_CANVAS_HACKTEXT_H__ #define __PLPLOT_CANVAS_HACKTEXT_H__ #include G_BEGIN_DECLS // Hacktext item for the canvas. // // The following object arguments are available: // // name type read/write description //-------------------------------------------------------------------------- // text char * RW The string of the text item. // glyphlist GnomeGlyphList * W Glyphlist // fill_color string W X color specification for fill color, // or NULL pointer for no color (transparent). // fill_color_gdk GdkColor* RW Allocated GdkColor for fill. // #define PLPLOT_TYPE_CANVAS_HACKTEXT ( plplot_canvas_hacktext_get_type() ) #define PLPLOT_CANVAS_HACKTEXT( o ) ( G_TYPE_CHECK_INSTANCE_CAST( ( o ), PLPLOT_TYPE_CANVAS_HACKTEXT, PlplotCanvasHacktext ) ) #define PLPLOT_CANVAS_HACKTEXT_CLASS( k ) ( G_TYPE_CHECK_CLASS_CAST( ( k ), PLPLOT_TYPE_CANVAS_HACKTEXT, PlplotCanvasHacktextClass ) ) #define PLPLOT_IS_CANVAS_HACKTEXT( o ) ( G_TYPE_CHECK_INSTANCE_TYPE( ( o ), PLPLOT_TYPE_CANVAS_HACKTEXT ) ) #define PLPLOT_IS_CANVAS_HACKTEXT_CLASS( k ) ( G_TYPE_CHECK_CLASS_TYPE( ( k ), PLPLOT_TYPE_CANVAS_HACKTEXT ) ) typedef struct _PlplotCanvasHacktext PlplotCanvasHacktext; typedef struct _PlplotCanvasHacktextPriv PlplotCanvasHacktextPriv; typedef struct _PlplotCanvasHacktextClass PlplotCanvasHacktextClass; #include struct _PlplotCanvasHacktext { GnomeCanvasItem item; char *text; // String of the text item guint fill_color; // Fill color, RGBA gulong fill_pixel; // Color for fill guint fill_set : 1; // Is fill color set? double size; // size in user units double x, y; // x, y coords of text origin // Antialiased specific stuff follows guint32 fill_rgba; // RGBA color for filling PlplotCanvasHacktextPriv *priv; // Private data }; struct _PlplotCanvasHacktextClass { GnomeCanvasItemClass parent_class; }; GType plplot_canvas_hacktext_get_type( void ); G_END_DECLS #endif // __PLPLOT_CANVAS_HACKTEXT_H__ plplot-5.10.0+dfsg/include/plcore.h 644 1750 1750 2645112052012176 160340ustar andrewandrew// $Id: plcore.h 12275 2012-11-17 22:49:34Z hbabcock $ // // Contains declarations for core plplot data structures. This file // should be included only by plcore.c. // // Copyright (C) 2004 Andrew Roach // Copyright (C) 2005 Thomas J. Duck // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #ifndef __PLCORE_H__ #define __PLCORE_H__ #include "plplotP.h" #include "drivers.h" #include "plDevs.h" #include "disptab.h" #ifdef ENABLE_DYNDRIVERS #ifndef LTDL_WIN32 #include #else #include "ltdl_win32.h" #endif typedef lt_ptr ( *PLDispatchInit )( PLDispatchTable *pdt ); #else typedef void ( *PLDispatchInit )( PLDispatchTable *pdt ); #endif #ifdef HAVE_LIBUNICODE #include #endif // Static function prototypes static const char *utf8_to_ucs4( const char *ptr, PLUNICODE *unichar ); static void grline( short *, short *, PLINT ); static void grpolyline( short *, short *, PLINT ); static void grfill( short *, short *, PLINT ); static void grgradient( short *, short *, PLINT ); static void plSelectDev( void ); static void pldi_ini( void ); static void calc_diplt( void ); static void calc_didev( void ); static void calc_diori( void ); static void calc_dimap( void ); static void plgdevlst( const char **, const char **, int *, int ); static void plInitDispatchTable( void ); static void plLoadDriver( void ); // Static variables static PLINT xscl[PL_MAXPOLY], yscl[PL_MAXPOLY]; static PLINT initfont = 1; // initial font: extended by default static PLINT lib_initialized = 0; //-------------------------------------------------------------------------- // Allocate a PLStream data structure (defined in plstrm.h). // // This struct contains a copy of every variable that is stream dependent. // Only the first [index=0] stream is statically allocated; the rest // are dynamically allocated when you switch streams (yes, it is legal // to only initialize the first element of the array of pointers). //-------------------------------------------------------------------------- static PLStream pls0; // preallocated stream static PLINT ipls; // current stream number static PLStream *pls[PL_NSTREAMS] = { &pls0 }; // Array of stream pointers // Current stream pointer. Global, for easier access to state info PLDLLIMPEXP_DATA( PLStream ) * plsc = &pls0; // Only now can we include this #include "pldebug.h" //-------------------------------------------------------------------------- // Initialize dispatch table. // // Each device is selected by the appropriate define, passed in from the // makefile. When installing plplot you may wish to exclude devices not // present on your system in order to reduce screen clutter. // // If you hit a in response to the plinit() prompt, you get the FIRST // one active below, so arrange them accordingly for your system (i.e. all // the system-specific ones should go first, since they won't appear on // most systems.) //-------------------------------------------------------------------------- static PLDispatchTable **dispatch_table = 0; static int npldrivers = 0; static PLDispatchInit static_device_initializers[] = { #ifdef PLD_mac plD_dispatch_init_mac8, plD_dispatch_init_mac1, #endif #ifdef PLD_next plD_dispatch_init_nx, #endif #ifdef PLD_os2pm plD_dispatch_init_os2, #endif #if defined ( PLD_xwin ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_xw, #endif #if defined ( PLD_gnome ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_gnome, #endif #if defined ( PLD_gcw ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_gcw, #endif #if defined ( PLD_tk ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tk, #endif #if defined ( PLD_linuxvga ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_vga, #endif #ifdef PLD_mgr plD_dispatch_init_mgr, #endif #ifdef PLD_win3 plD_dispatch_init_win3, #endif #if defined ( _MSC_VER ) && defined ( VGA ) // graphics for msc plD_dispatch_init_vga, #endif #ifdef PLD_bgi plD_dispatch_init_vga, #endif #ifdef PLD_gnusvga plD_dispatch_init_vga, #endif #ifdef PLD_tiff plD_dispatch_init_tiff, #endif #if defined ( PLD_jpg ) plD_dispatch_init_jpg, #endif #if defined ( PLD_bmp ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_bmp, #endif #ifdef PLD_emxvga // graphics for emx+gcc plD_dispatch_init_vga, #endif #if defined ( PLD_xterm ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_xterm, #endif #if defined ( PLD_tek4010 ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tekt, #endif #if defined ( PLD_tek4107 ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tek4107t, #endif #if defined ( PLD_mskermit ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_mskermit, #endif #if defined ( PLD_versaterm ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_versaterm, #endif #if defined ( PLD_vlt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_vlt, #endif #if defined ( PLD_conex ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_conex, #endif #if defined ( PLD_dg300 ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_dg, #endif #if defined ( PLD_plmeta ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_plm, #endif #if defined ( PLD_tek4010f ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tekf, #endif #if defined ( PLD_tek4107f ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tek4107f, #endif #if defined ( PLD_ps ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_psm, plD_dispatch_init_psc, #endif #if defined ( PLD_xfig ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_xfig, #endif #if defined ( PLD_ljiip ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_ljiip, #endif #if defined ( PLD_ljii ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_ljii, #endif #if defined ( PLD_hp7470 ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_hp7470, #endif #if defined ( PLD_hp7580 ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_hp7580, #endif #if defined ( PLD_lj_hpgl ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_hpgl, #endif #if defined ( PLD_imp ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_imp, #endif #if defined ( PLD_pbm ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pbm, #endif #if defined ( PLD_png ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_png, #endif #if defined ( PLD_jpeg ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_jpeg, #endif #if defined ( PLD_gif ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_gif, #endif #if defined ( PLD_pstex ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pstex, #endif #if defined ( PLD_ntk ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_ntk, #endif #if defined ( PLD_cgm ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_cgm, #endif #if defined ( PLD_mem ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_mem, #endif #if defined ( PLD_null ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_null, #endif #if defined ( PLD_tkwin ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tkwin, #endif #if defined ( PLD_wingcc ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_wingcc, #endif #if defined ( PLD_aqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_aqt, #endif #if defined ( PLD_wxwidgets ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_wxwidgets, #endif #if defined ( PLD_wxpng ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_wxpng, #endif #if defined ( PLD_svg ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_svg, #endif #if defined ( PLD_pdf ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pdf, #endif #if defined ( PLD_psttf ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_psttfm, plD_dispatch_init_psttfc, #endif #if defined ( PLD_xcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_xcairo, #endif #if defined ( PLD_pdfcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pdfcairo, #endif #if defined ( PLD_pscairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pscairo, #endif #if defined ( PLD_epscairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_epscairo, #endif #if defined ( PLD_svgcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_svgcairo, #endif #if defined ( PLD_pngcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pngcairo, #endif #if defined ( PLD_memcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_memcairo, #endif #if defined ( PLD_extcairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_extcairo, #endif #if defined ( PLD_wincairo ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_wincairo, #endif #if defined ( PLD_bmpqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_bmpqt, #endif #if defined ( PLD_jpgqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_jpgqt, #endif #if defined ( PLD_pngqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pngqt, #endif #if defined ( PLD_ppmqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_ppmqt, #endif #if defined ( PLD_tiffqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_tiffqt, #endif #if defined ( PLD_svgqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_svgqt, #endif #if defined ( PLD_epsqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_epsqt, #endif #if defined ( PLD_pdfqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_pdfqt, #endif #if defined ( PLD_qtwidget ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_qtwidget, #endif #if defined ( PLD_extqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_extqt, #endif #if defined ( PLD_memqt ) && !defined ( ENABLE_DYNDRIVERS ) plD_dispatch_init_memqt, #endif NULL }; static int nplstaticdevices = ( sizeof ( static_device_initializers ) / sizeof ( PLDispatchInit ) ) - 1; static int npldynamicdevices = 0; //-------------------------------------------------------------------------- // Stuff to support the loadable device drivers. //-------------------------------------------------------------------------- #ifdef ENABLE_DYNDRIVERS typedef struct { char *devnam; char *description; char *drvnam; char *tag; int drvidx; } PLLoadableDevice; typedef struct { char *drvnam; lt_dlhandle dlhand; } PLLoadableDriver; static PLLoadableDevice *loadable_device_list; static PLLoadableDriver *loadable_driver_list; static int nloadabledrivers = 0; #endif #endif // __PLCORE_H__ plplot-5.10.0+dfsg/include/disptab.h 644 1750 1750 626712251347661 161740ustar andrewandrew// $Id: disptab.h 12830 2013-12-09 14:12:01Z andrewross $ // // Defines the data structure which holds the driver functions. // #ifndef __DISPATCH_H__ #define __DISPATCH_H__ #include "plConfig.h" struct PLStream_struct; enum { plDevType_FileOriented = 0, plDevType_Interactive = 1, plDevType_Null = -1 }; //-------------------------------------------------------------------------- // Define structure containing pointers to device dependent functions. // // pl_MenuStr Pointer to string that is printed in device menu. // // pl_DevName A short device "name" for device selection by name. // // pl_type 0 for file-oriented device, 1 for interactive // (the null driver uses -1 here) // // pl_seq The sequence number for ordering the presentation list of the // available drivers. This is an ordering only, not an absolute // position in the list. // // pl_init Initialize device. This routine may also prompt the user // for certain device parameters or open a graphics file // (see note). Called only once to set things up. Certain // options such as familying and resolution (dots/mm) should // be set up before calling this routine (note: some drivers // ignore these). // // pl_line Draws a line between two points. // // pl_polyline Draws a polyline (no broken segments). // // pl_eop Finishes out current page (see note). // // pl_bop Set up for plotting on a new page. May also open a new // a new graphics file (see note). // // pl_tidy Tidy up. May close graphics file (see note). // // pl_state Handle change in PLStream state // (color, pen width, fill attribute, etc). // // pl_esc Escape function for driver-specific commands. // // // Notes: // // Most devices allow multi-page plots to be stored in a single graphics // file, in which case the graphics file should be opened in the pl_init() // routine, closed in pl_tidy(), and page advances done by calling pl_eop // and pl_bop() in sequence. If multi-page plots need to be stored in // different files then pl_bop() should open the file and pl_eop() should // close it. Do NOT open files in both pl_init() and pl_bop() or close // files in both pl_eop() and pl_tidy(). //-------------------------------------------------------------------------- typedef void ( *plD_init_fp )( struct PLStream_struct * ); typedef void ( *plD_line_fp )( struct PLStream_struct *, short, short, short, short ); typedef void ( *plD_polyline_fp )( struct PLStream_struct *, short *, short *, PLINT ); typedef void ( *plD_eop_fp )( struct PLStream_struct * ); typedef void ( *plD_bop_fp )( struct PLStream_struct * ); typedef void ( *plD_tidy_fp )( struct PLStream_struct * ); typedef void ( *plD_state_fp )( struct PLStream_struct *, PLINT ); typedef void ( *plD_esc_fp )( struct PLStream_struct *, PLINT, void * ); typedef struct { char *pl_MenuStr; char *pl_DevName; int pl_type; int pl_seq; plD_init_fp pl_init; plD_line_fp pl_line; plD_polyline_fp pl_polyline; plD_eop_fp pl_eop; plD_bop_fp pl_bop; plD_tidy_fp pl_tidy; plD_state_fp pl_state; plD_esc_fp pl_esc; } PLDispatchTable; #endif // __DISPATCH_H__ plplot-5.10.0+dfsg/include/plevent.h 644 1750 1750 1652511462375545 162460ustar andrewandrew// $Id: plevent.h 11283 2010-10-28 22:38:29Z airwin $ // // Input event (especially keyboard) definitions for use from plplot // event handlers. // // Key definitions are taken from the X11/keysymdef.h include file, with // some changes: // - only the control keys are retained // - the XK prefix has been changed to PLK // - control keys with ASCII equivalents use the ASCII code // // By using the ASCII equivalent (if it exists) for all control keys, it // is easier to handle keyboard input from any device which is ASCII based. // Devices which use some other kind of key encoding must translate the raw // keycodes to those used here. // #ifndef __PLEVENT_H__ #define __PLEVENT_H__ // Key definitions //-------------------------------------------------------------------------- // Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, // and the Massachusetts Institute of Technology, Cambridge, Massachusetts. // // All Rights Reserved // // Permission to use, copy, modify, and distribute this software and its // documentation for any purpose and without fee is hereby granted, // provided that the above copyright notice appear in all copies and that // both that copyright notice and this permission notice appear in // supporting documentation, and that the names of Digital or MIT not be // used in advertising or publicity pertaining to distribution of the // software without specific, written prior permission. // // DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING // ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL // DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR // ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, // WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS // SOFTWARE. // //-------------------------------------------------------------------------- // Miscellaneous control keys, those with ASCII equivalents #define PLK_BackSpace 0x08 // back space, back char #define PLK_Tab 0x09 #define PLK_Linefeed 0x0A // Linefeed, LF #define PLK_Return 0x0D // Return, enter #define PLK_Escape 0x1B #define PLK_Delete 0xFF // Delete, rubout // Those without ASCII equivalents #define PLK_Clear 0xFF0B #define PLK_Pause 0xFF13 // Pause, hold #define PLK_Scroll_Lock 0xFF14 // Cursor control & motion #define PLK_Home 0xFF50 #define PLK_Left 0xFF51 // Move left, left arrow #define PLK_Up 0xFF52 // Move up, up arrow #define PLK_Right 0xFF53 // Move right, right arrow #define PLK_Down 0xFF54 // Move down, down arrow #define PLK_Prior 0xFF55 // Prior, previous (Page Up) #define PLK_Next 0xFF56 // Next (Page Down) #define PLK_End 0xFF57 // EOL #define PLK_Begin 0xFF58 // BOL // Misc Functions #define PLK_Select 0xFF60 // Select, mark #define PLK_Print 0xFF61 #define PLK_Execute 0xFF62 // Execute, run, do #define PLK_Insert 0xFF63 // Insert, insert here #define PLK_Undo 0xFF65 // Undo, oops #define PLK_Redo 0xFF66 // redo, again #define PLK_Menu 0xFF67 #define PLK_Find 0xFF68 // Find, search #define PLK_Cancel 0xFF69 // Cancel, stop, abort, exit #define PLK_Help 0xFF6A // Help, ? #define PLK_Break 0xFF6B #define PLK_Mode_switch 0xFF7E // Character set switch #define PLK_script_switch 0xFF7E // Alias for mode_switch #define PLK_Num_Lock 0xFF7F // Keypad Functions, keypad numbers cleverly chosen to map to ascii #define PLK_KP_Space 0xFF80 // space #define PLK_KP_Tab 0xFF89 #define PLK_KP_Enter 0xFF8D // enter #define PLK_KP_F1 0xFF91 // PF1, KP_A, ... #define PLK_KP_F2 0xFF92 #define PLK_KP_F3 0xFF93 #define PLK_KP_F4 0xFF94 #define PLK_KP_Equal 0xFFBD // equals #define PLK_KP_Multiply 0xFFAA #define PLK_KP_Add 0xFFAB #define PLK_KP_Separator 0xFFAC // separator, often comma #define PLK_KP_Subtract 0xFFAD #define PLK_KP_Decimal 0xFFAE #define PLK_KP_Divide 0xFFAF #define PLK_KP_0 0xFFB0 #define PLK_KP_1 0xFFB1 #define PLK_KP_2 0xFFB2 #define PLK_KP_3 0xFFB3 #define PLK_KP_4 0xFFB4 #define PLK_KP_5 0xFFB5 #define PLK_KP_6 0xFFB6 #define PLK_KP_7 0xFFB7 #define PLK_KP_8 0xFFB8 #define PLK_KP_9 0xFFB9 // // Auxilliary Functions; note the duplicate definitions for left and right // function keys; Sun keyboards and a few other manufactures have such // function key groups on the left and/or right sides of the keyboard. // We've not found a keyboard with more than 35 function keys total. // #define PLK_F1 0xFFBE #define PLK_F2 0xFFBF #define PLK_F3 0xFFC0 #define PLK_F4 0xFFC1 #define PLK_F5 0xFFC2 #define PLK_F6 0xFFC3 #define PLK_F7 0xFFC4 #define PLK_F8 0xFFC5 #define PLK_F9 0xFFC6 #define PLK_F10 0xFFC7 #define PLK_F11 0xFFC8 #define PLK_L1 0xFFC8 #define PLK_F12 0xFFC9 #define PLK_L2 0xFFC9 #define PLK_F13 0xFFCA #define PLK_L3 0xFFCA #define PLK_F14 0xFFCB #define PLK_L4 0xFFCB #define PLK_F15 0xFFCC #define PLK_L5 0xFFCC #define PLK_F16 0xFFCD #define PLK_L6 0xFFCD #define PLK_F17 0xFFCE #define PLK_L7 0xFFCE #define PLK_F18 0xFFCF #define PLK_L8 0xFFCF #define PLK_F19 0xFFD0 #define PLK_L9 0xFFD0 #define PLK_F20 0xFFD1 #define PLK_L10 0xFFD1 #define PLK_F21 0xFFD2 #define PLK_R1 0xFFD2 #define PLK_F22 0xFFD3 #define PLK_R2 0xFFD3 #define PLK_F23 0xFFD4 #define PLK_R3 0xFFD4 #define PLK_F24 0xFFD5 #define PLK_R4 0xFFD5 #define PLK_F25 0xFFD6 #define PLK_R5 0xFFD6 #define PLK_F26 0xFFD7 #define PLK_R6 0xFFD7 #define PLK_F27 0xFFD8 #define PLK_R7 0xFFD8 #define PLK_F28 0xFFD9 #define PLK_R8 0xFFD9 #define PLK_F29 0xFFDA #define PLK_R9 0xFFDA #define PLK_F30 0xFFDB #define PLK_R10 0xFFDB #define PLK_F31 0xFFDC #define PLK_R11 0xFFDC #define PLK_F32 0xFFDD #define PLK_R12 0xFFDD #define PLK_R13 0xFFDE #define PLK_F33 0xFFDE #define PLK_F34 0xFFDF #define PLK_R14 0xFFDF #define PLK_F35 0xFFE0 #define PLK_R15 0xFFE0 // Modifiers #define PLK_Shift_L 0xFFE1 // Left shift #define PLK_Shift_R 0xFFE2 // Right shift #define PLK_Control_L 0xFFE3 // Left control #define PLK_Control_R 0xFFE4 // Right control #define PLK_Caps_Lock 0xFFE5 // Caps lock #define PLK_Shift_Lock 0xFFE6 // Shift lock #define PLK_Meta_L 0xFFE7 // Left meta #define PLK_Meta_R 0xFFE8 // Right meta #define PLK_Alt_L 0xFFE9 // Left alt #define PLK_Alt_R 0xFFEA // Right alt #define PLK_Super_L 0xFFEB // Left super #define PLK_Super_R 0xFFEC // Right super #define PLK_Hyper_L 0xFFED // Left hyper #define PLK_Hyper_R 0xFFEE // Right hyper #endif // __PLEVENT_H__ plplot-5.10.0+dfsg/include/qt.h 644 1750 1750 3345612276771565 152250ustar andrewandrew// // // This software is provided under the LGPL in March 2009 by the // Cluster Science Centre // QSAS team, // Imperial College, London // // Copyright (C) 2009 Imperial College, London // Copyright (C) 2009 Alan W. Irwin // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Lesser Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // To received a copy of the GNU Library General Public License // write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // History: // // // March 2009: v1.00 // Initial release. // // // // Interpretation of the -geometry XSIZExYSIZE option (or the third and fourth // parameters of plspage if those are specified by the user instead) for // the various devices: // - the raster devices (bmpqt, jpgqt, pngqt, ppmqt, tiffqt): // XSIZE and YSIZE define the x and y size in pixels // - qtwidget: // XSIZE and YSIZE define the default x and y size of the widget in // pixels, as well as its aspect ratio, which is kept when the widget is // resized. // - svgqt, epsqt, pdfqt: // XSIZE and YSIZE define the x and y size in points (1/72 of inches). // EPS and PDF files will be drawn in A4 pages for Qt versions before 4.4 // // Interpretation of the -dpi DPI option (or the first parameter of // plspage if that is specified by the user instead). // DPI is ignored for all but the raster devices. For those devices // DPI should be set to the DPI value of the monitor being used to view // the results if exact character sizes are desired. Otherwise, DEFAULT_DPI // (set to an average value for modern monitors) is used instead. // #ifndef QT_H #define QT_H #include #include #include #include #include #include #include #include #include #include #include #include #include "plDevs.h" #include "plplotP.h" #include "drivers.h" // Used for devices (epsqt, pdfqt, svgqt) with known physical size in points. #define POINTS_PER_INCH 72 // Average value of dots per inch assumed for modern monitors if the user // does not specify a value appropriate to their monitor with plspage or // the -dpi option. Used only for devices with size specified in pixels // but not qtwidget since it has independent access to information (e.g., // delivered by X) about the DPI of the monitor. So this value is only // used for the raster devices (bmpqt, jpgqt, pngqt, ppmqt, tiffqt). #define DEFAULT_DPI 72 // These values are in units of pixels (the raster devices and qtwidget) // or points (epsqt, pdfqt, svgqt). In the points case, this corresponds // to the A4 paper size. #define QT_DEFAULT_X 842 #define QT_DEFAULT_Y 595 class QtPLDriver; // Master Device Handler for multiple streams // Only handles multiple Qt devices class PLDLLIMPEXP_QT MasterHandler : public QObject { Q_OBJECT public: MasterHandler(); bool isMasterDevice( QtPLDriver* d ); void setMasterDevice( QtPLDriver* d ); void DeviceChangedPage( QtPLDriver* d ); void DeviceClosed( QtPLDriver* d ); signals: void MasterChangedPage(); void MasterClosed(); protected: QtPLDriver* masterDevice; }; // Basic class, offering the common interface to all Qt plplot devices class PLDLLIMPEXP_QT QtPLDriver { public: // Constructor, taking the device size as arguments QtPLDriver( PLINT i_iWidth = QT_DEFAULT_X, PLINT i_iHeight = QT_DEFAULT_Y ); virtual ~QtPLDriver(); // does not delete emitter! void setPLStream( PLStream *pls ); // store the related stream virtual void drawArc( short x, short y, short width, short height, PLFLT angle1, PLFLT angle2, PLFLT rotate, bool fill ); // Draws a line from (x1, y1) to (x2, y2) in internal plplot coordinates virtual void drawLine( short x1, short y1, short x2, short y2 ); virtual void drawPolyline( short * x, short * y, PLINT npts ); virtual void drawPolygon( short * x, short * y, PLINT npts ); virtual void drawText( EscText* txt ); virtual void setColor( int r, int g, int b, double alpha ); virtual void setBackgroundColor( int /* r */, int /* g */, int /* b */, double /* alpha */ ){} virtual void setGradient( int x1, int x2, int y1, int y2, unsigned char *r, unsigned char *g, unsigned char *b, PLFLT *alpha, PLINT ncol1 ); virtual void setWidthF( PLFLT w ); // Set pen to draw solid strokes (called after drawing dashed strokes) virtual void setSolid(); // Conversion factor from internal plplot coordinates to device coordinates double downscale; double m_dWidth, m_dHeight; static QMutex mutex; // All-purpose mutex protected: // Returns font with the good size for a QPicture's resolution QFont getFont( PLUNICODE code ); // Draws text in a QPicture using a sub-QPicture (!), updates the current xOffset void drawTextInPicture( QPainter*, const QString& ); // Gets the QPicture displaying text, with the base chrht char height QPicture getTextPicture( PLUNICODE fci, PLUNICODE* text, int len, PLFLT chrht ); // Text-related variables bool underlined; bool overlined; double currentFontScale; double currentFontSize; double yOffset; double xOffset; PLStream *pls; QPainter * m_painterP; }; #if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) // Driver painting whatever raster format Qt can save class PLDLLIMPEXP_QT QtRasterDevice : public QtPLDriver, public QImage { public: QtRasterDevice( int i_iWidth = QT_DEFAULT_X, int i_iHeight = QT_DEFAULT_Y ); virtual ~QtRasterDevice(); virtual void setBackgroundColor( int r, int g, int b, double alpha ); void definePlotName( const char* fileName, const char* format ); void savePlot(); virtual void setResolution( double dotsPerInch ) { setDotsPerMeterX( (int) ( ( dotsPerInch / 25.4 ) * 1000. ) ); setDotsPerMeterY( (int) ( ( dotsPerInch / 25.4 ) * 1000. ) ); } // used by the memqt driver unsigned char *memory; protected: char format[5]; QString fileName; }; #endif #if defined ( PLD_svgqt ) && QT_VERSION >= 0x040300 #include // Driver painting on an SVG device class PLDLLIMPEXP_QT QtSVGDevice : public QtPLDriver, public QSvgGenerator { public: QtSVGDevice( int i_iWidth = QT_DEFAULT_X, int i_iHeight = QT_DEFAULT_Y ); virtual ~QtSVGDevice(); virtual void setBackgroundColor( int r, int g, int b, double alpha ); void definePlotName( const char* fileName ); void savePlot(); protected: }; #endif #if defined ( PLD_epsqt ) || defined ( PLD_pdfqt ) // Driver painting on an EPS or PDF device, uses QPrinter // A (possibly dummy) QApplication must be declared before use class PLDLLIMPEXP_QT QtEPSDevice : public QtPLDriver, public QPrinter { public: #if QT_VERSION < 0x040400 QtEPSDevice( int i_iWidth = -1, int i_iHeight = -1 ); #else QtEPSDevice( int i_iWidth = QT_DEFAULT_X, int i_iHeight = QT_DEFAULT_Y ); #endif virtual ~QtEPSDevice(); virtual void setBackgroundColor( int r, int g, int b, double alpha ); void definePlotName( const char* fileName, int ifeps ); void savePlot(); protected: }; #endif #if defined ( PLD_qtwidget ) || defined ( PLD_extqt ) typedef enum ElementType_ { LINE, POLYLINE, POLYGON, RECTANGLE, SET_WIDTH, SET_COLOUR, SET_GRADIENT, SET_SMOOTH, TEXT, SET_BG_COLOUR, ARC } ElementType; // Identifiers for elements of the buffer struct ColourStruct_ { PLINT R, G, B, A; }; struct TextStruct_ { PLFLT x; PLFLT y; PLFLT clipxmin; PLFLT clipymin; PLFLT clipxmax; PLFLT clipymax; PLFLT rotation; PLFLT shear; PLFLT stride; PLFLT just; PLUNICODE * text; PLUNICODE fci; PLINT len; PLFLT chrht; }; struct ArcStruct_ { QRectF *rect; QPointF *dx; int startAngle; int spanAngle; PLFLT rotate; bool fill; }; class BufferElement { public: ElementType Element; union DataType { QLineF * Line; QPolygonF * Polyline; QRectF * Rect; QLinearGradient * LinearGradient; struct ColourStruct_* ColourStruct; struct TextStruct_ * TextStruct; struct ArcStruct_ * ArcStruct; PLINT intParam; PLFLT fltParam; } Data; }; // This widget allows to use plplot as a plotting engine in a Qt Application // The aspect ratio of the plotted data is constant, so gray strips are used // to delimit the page when the widget aspect ratio is not the one of the plotted page class PLDLLIMPEXP_QT QtPLWidget : public QWidget, public QtPLDriver { Q_OBJECT public: // Parameters are the actual size of the page, NOT the size of the widget // Call QWidget::resize for that QtPLWidget( int i_iWidth = QT_DEFAULT_X, int i_iHeight = QT_DEFAULT_Y, QWidget * parent = 0 ); virtual ~QtPLWidget(); void clearWidget(); void clearBuffer(); int pageNumber; void drawArc( short x, short y, short width, short height, PLFLT angle1, PLFLT angle2, PLFLT rotate, bool fill ); void drawLine( short x1, short y1, short x2, short y2 ); void drawPolyline( short * x, short * y, PLINT npts ); void drawPolygon( short * x, short * y, PLINT npts ); void setColor( int r, int g, int b, double alpha ); void setBackgroundColor( int r, int g, int b, double alpha ); void setGradient( int x1, int x2, int y1, int y2, unsigned char *r, unsigned char *g, unsigned char *b, PLFLT *alpha, PLINT ncol1 ); void setWidthF( PLFLT r ); void drawText( EscText* txt ); void flush(); void getCursorCmd( PLGraphicsIn *ptr ); protected: void resizeEvent( QResizeEvent* ); void paintEvent( QPaintEvent* ); void mouseEvent( QMouseEvent * event ); void getPlotParameters( double & io_dXFact, double & io_dYFact, double & io_dXOffset, double & io_dYOffset ); // gives the parameters to scale and center the plot on the page void doPlot( QPainter* p, double x_fact, double y_fact, double x_offset, double y_offset ); // Actually draws the plot. Deported in a function for readability void renderText( QPainter* p, struct TextStruct_* s, double x_fact, double x_offset, double y_fact, double y_offset ); void lookupButtonEvent( QMouseEvent * event ); void locate(); void resetPensAndBrushes( QPainter* ); double m_dAspectRatio; // Is kept constant during resizes QPixmap * m_pixPixmap; // stores the drawn image as long as it does not have to be regenerated QLinkedList m_listBuffer; // Buffer holding the draw instructions // bool m_bAwaitingRedraw; // int m_iOldSize; // Holds the size of the buffer. Modified => image has to be redrawn bool redrawFromLastFlush; bool redrawAll; // Pens and brushes required to maintain the status between 2 flushes QPen SolidPen; QPen NoPen; bool hasPen; QBrush SolidBrush; // end parameters QLinkedList::const_iterator start_iterator; struct { int r; int g; int b; double alpha; } lastColour; struct { int r; int g; int b; double alpha; } bgColour; PLGraphicsIn gin; // Graphics Input Structure int locate_mode; // Set while in locate mode protected slots: void mousePressEvent( QMouseEvent * event ); void mouseReleaseEvent( QMouseEvent * event ); void mouseMoveEvent( QMouseEvent * event ); void keyPressEvent( QKeyEvent* event ); void closeEvent( QCloseEvent* event ); void nextPage(); }; #endif #if defined ( PLD_extqt ) class PLDLLIMPEXP_QT QtExtWidget : public QtPLWidget { Q_OBJECT public: QtExtWidget( int i_iWidth = QT_DEFAULT_X, int i_iHeight = QT_DEFAULT_Y, QWidget * parent = 0 ); virtual ~QtExtWidget(); void captureMousePlotCoords( PLFLT* x, PLFLT* y ); public slots: void mouseMoveEvent( QMouseEvent* event ); void mouseReleaseEvent( QMouseEvent* event ); void mousePressEvent( QMouseEvent* event ); protected: void paintEvent( QPaintEvent* ); struct { bool isTracking; double cursor_x, cursor_y; } cursorParameters; bool killed; }; PLDLLIMPEXP_QT void plsetqtdev( QtExtWidget* widget ); // Registers the widget as plot device, as the widget has to be created in the Qt application GUI, prior to any plplot call. Must be called before plinit(). PLDLLIMPEXP_QT void plsetqtdev( QtExtWidget* widget, int argc, char** argv ); // Registers the widget as plot device, as the widget has to be created in the Qt application GUI, prior to any plplot call. Must be called before plinit(). PLDLLIMPEXP_QT void plfreeqtdev(); // Deletes and unregisters the device. #endif // These variables are declared in plqt.cpp but also needed // by the qt driver. extern PLDLLIMPEXP_QT_DATA( int ) vectorize; extern PLDLLIMPEXP_QT_DATA( int ) lines_aa; extern PLDLLIMPEXP_QT_DATA( MasterHandler ) handler; #if defined ( plplot_pyqt4_EXPORTS ) #define initplplot_pyqt4 PLDLLIMPEXP_PYQT4 initplplot_pyqt4 #endif #endif plplot-5.10.0+dfsg/include/plxwd.h 644 1750 1750 1056211647527346 157250ustar andrewandrew// $Id: plxwd.h 11975 2011-10-19 11:05:10Z andrewross $ // // Holds system header includes, prototypes of xwin driver // utility functions, and definition of the state structure. // #ifndef __PLXWD_H__ #define __PLXWD_H__ #include "plplot.h" #include "plstrm.h" #ifdef PL_HAVE_PTHREAD #include #endif // System headers #include #include #include #include #include #include #include // Specify max number of displays in use #define PLXDISPLAYS 100 // Set constants for dealing with colormap. In brief: // // ccmap When set, turns on custom color map // // See Init_CustomCmap() and Init_DefaultCmap() for more info. // Set ccmap at your own risk -- still under development. // static int plplot_ccmap = 0; // One of these holds the display info, shared by all streams on a given // display typedef struct { int nstreams; // Number of streams using display int ixwd; // Specifies xwDisplay number char *displayName; // Name of X display int screen; // X screen Display *display; // X display Visual *visual; // X Visual GC gcXor; // Graphics context for XOR draws Colormap map; // Colormap unsigned depth; // display depth int color; // Set to 1 if a color output device int ncol0; // Number of cmap 0 colors int ncol0_alloc; // Keeps track of storage for *cmap0 int ncol1; // Number of cmap 1 colors int ncol1_alloc; // Keeps track of storage for *cmap1 XColor *cmap0; // Color entries for cmap 0 XColor *cmap1; // Color entries for cmap 1 XColor fgcolor; // Foreground color (if grayscale) Cursor xhair_cursor; // Crosshair cursor int rw_cmap; // Can we allocate r/w color cells? } XwDisplay; // One of these holds the X driver state information typedef struct { XwDisplay *xwd; // Pointer to display info int is_main; // Set if the toplevel X window Window window; // X window id Pixmap pixmap; // Off-screen pixmap GC gc; // Graphics context XColor curcolor; // Current pen color long event_mask; // Event mask int exit_eventloop; // Breaks the event loop when set long init_width; // Initial window width long init_height; // Initial window height unsigned width, height, border; // Current window dimensions double xscale_init; // initial pixels/lx (virt. coords) double yscale_init; // initial pixels/ly (virt. coords) double xscale; // as above, but current value double yscale; // (after possible resizing) short xlen, ylen; // Lengths of device coord space int write_to_window; // Set if plotting direct to window int write_to_pixmap; // Set if plotting to pixmap int instr; // Instruction timer int max_instr; // Limit before X server is queried PLGraphicsIn gin; // Graphics input structure int locate_mode; // Set while in locate mode int drawing_xhairs; // Set during xhair draws XPoint xhair_x[2], xhair_y[2]; // Crosshair lines void ( *MasterEH )( PLStream *, XEvent * ); // Master X event handler #ifdef PL_HAVE_PTHREAD pthread_t updater; // The X events updater thread id #endif XColor bgcolor; // Background color } XwDev; #endif // __PLXWD_H__ plplot-5.10.0+dfsg/include/pldll.h.in 644 1750 1750 1331112276771565 163010ustar andrewandrew#ifndef __PL_DLL_H #define __PL_DLL_H #ifdef USINGDLL #if defined ( WIN32 ) // Visual C/C++, Borland, MinGW and Watcom #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ ) #define PLDLLEXPORT __declspec( dllexport ) #define PLDLLIMPORT __declspec( dllimport ) #else #define PLDLLEXPORT #define PLDLLIMPORT #endif #elif defined ( __CYGWIN__ ) #define PLDLLEXPORT __declspec( dllexport ) #define PLDLLIMPORT __declspec( dllimport ) #elif defined ( __GNUC__ ) && __GNUC__ > 3 // Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x // The following forces exported symbols specifically designated with // PLDLLEXPORT to be visible. #define PLDLLEXPORT __attribute__ ( ( visibility( "default" ) ) ) #define PLDLLIMPORT #endif #endif // For an unknown compiler or static built we clear the macros #ifndef PLDLLEXPORT #define PLDLLEXPORT #define PLDLLIMPORT #endif // The IMPEXP macros will always be set to DLLIMPORT (even for // the static library, but DLLIMPORT is empty in this case), if // cmake didn't set the corresponding macro xxxx_EXPORTS when the // corresponding library is built (DLLIMPEXP is set to DLLEXPORT // then) #if defined ( plplot@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP PLDLLEXPORT #define PLDLLIMPEXP_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP PLDLLIMPORT #define PLDLLIMPEXP_DATA( type ) PLDLLIMPORT type #endif // for dynamic drivers set the macros correctly. If a shared library is built, // but dyanmic drivers disabled, the driver dll macros are the same as the // plplot dll macros #ifdef ENABLE_DYNDRIVERS #if defined ( aqt_EXPORTS ) || defined ( cairo_EXPORTS ) || defined ( cgm_EXPORTS ) || \ defined ( dg300_EXPORTS ) || defined ( gd_EXPORTS ) || defined ( gcw_EXPORTS ) || \ defined ( hpgl_EXPORTS ) || defined ( impress_EXPORTS ) || defined ( linuxvga_EXPORTS ) || \ defined ( ljii_EXPORTS ) || defined ( ljiip_EXPORTS ) || defined ( mem_EXPORTS ) || \ defined ( ntk_EXPORTS ) || defined ( null_EXPORTS ) || defined ( pbm_EXPORTS ) || \ defined ( pdf_EXPORTS ) || defined ( plmeta_EXPORTS ) || defined ( ps_EXPORTS ) || \ defined ( pstex_EXPORTS ) || defined ( psttf_EXPORTS ) || defined ( svg_EXPORTS ) || \ defined ( tek_EXPORTS ) || defined ( tk_EXPORTS ) || defined ( tkwin_EXPORTS ) || \ defined ( wingcc_EXPORTS ) || defined ( wxwidgets_EXPORTS ) || defined ( xfig_EXPORTS ) || \ defined ( xwin_EXPORTS ) || defined ( qt_EXPORTS ) #define PLDLLIMPEXP_DRIVER PLDLLEXPORT #define PLDLLIMPEXP_DRIVER_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_DRIVER PLDLLIMPORT #define PLDLLIMPEXP_DRIVER_DATA( type ) PLDLLIMPORT type #endif #else #define PLDLLIMPEXP_DRIVER PLDLLIMPEXP #define PLDLLIMPEXP_DRIVER_DATA( type ) PLDLLIMPEXP_DATA( type ) #endif #if defined ( plplotcxx@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_CXX PLDLLEXPORT #define PLDLLIMPEXP_CXX_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_CXX PLDLLIMPORT #define PLDLLIMPEXP_CXX_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplotf95c@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_F95C PLDLLEXPORT #define PLDLLIMPEXP_F95C_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_F95C PLDLLIMPORT #define PLDLLIMPEXP_F95C_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplotwxwidgets@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_WX PLDLLEXPORT #define PLDLLIMPEXP_WX_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_WX PLDLLIMPORT #define PLDLLIMPEXP_WX_DATA( type ) PLDLLIMPORT type #endif #if defined ( tclmatrix@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_TCLMAT PLDLLEXPORT #define PLDLLIMPEXP_TCLMAT_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_TCLMAT PLDLLIMPORT #define PLDLLIMPEXP_TCLMAT_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplottcltk_Main@LIB_TAG@_EXPORTS ) | defined ( plplottcltk@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_TCLTK PLDLLEXPORT #define PLDLLIMPEXP_TCLTK_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_TCLTK PLDLLIMPORT #define PLDLLIMPEXP_TCLTK_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplotgnome2@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_GNOME2 PLDLLEXPORT #define PLDLLIMPEXP_GNOME2_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_GNOME2 PLDLLIMPORT #define PLDLLIMPEXP_GNOME2_DATA( type ) PLDLLIMPORT type #endif #if defined ( cplplotcanvasmodule_EXPORTS ) #define PLDLLIMPEXP_CPLPLOTCANVASMODULE PLDLLEXPORT #define PLDLLIMPEXP_CPLPLOTCANVASMODULE_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_CPLPLOTCANVASMODULE PLDLLIMPORT #define PLDLLIMPEXP_CPLPLOTCANVASMODULE_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplot_widgetmodule_EXPORTS ) #define PLDLLIMPEXP_PLPLOT_WIDGETMODULE PLDLLEXPORT #define PLDLLIMPEXP_PLPLOT_MODULE_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_PLPLOT_MODULE PLDLLIMPORT #define PLDLLIMPEXP_PLPLOT_MODULE_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplotqt@LIB_TAG@_EXPORTS ) #define PLDLLIMPEXP_QT PLDLLEXPORT #define PLDLLIMPEXP_QT_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_QT PLDLLIMPORT #define PLDLLIMPEXP_QT_DATA( type ) PLDLLIMPORT type #endif #if defined ( plplot_pyqt4_EXPORTS ) #define PLDLLIMPEXP_PYQT4 PLDLLEXPORT #define PLDLLIMPEXP_PYQT4_DATA( type ) PLDLLEXPORT type #else #define PLDLLIMPEXP_PYQT4 PLDLLIMPORT #define PLDLLIMPEXP_PYQT4_DATA( type ) PLDLLIMPORT type #endif #endif // __PL_DLL_H plplot-5.10.0+dfsg/include/drivers.h 644 1750 1750 1616412052012176 162260ustar andrewandrew// $Id: drivers.h 12275 2012-11-17 22:49:34Z hbabcock $ // // Contains all prototypes for driver functions. // // Copyright (C) 2004 Andrew Roach // Copyright (C) 2005 Thomas J. Duck // Copyright (C) 2006 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #ifndef __DRIVERS_H__ #define __DRIVERS_H__ #include "pdf.h" #include "plstrm.h" #ifdef __cplusplus extern "C" { #endif PLDLLIMPEXP_DRIVER void plD_dispatch_init_mac8( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_mac1( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_aqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_nx( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_os2( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_xw( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_gcw( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_gnome( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tk( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_vga( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_mgr( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_win3( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_vga( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_vga( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_vga( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tiff( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_jpg( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_jpeg( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_bmp( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_vga( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_xterm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tekt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tek4107t( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_mskermit( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_versaterm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_vlt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_conex( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_dg( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_plm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tekf( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tek4107f( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_psm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_psc( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_xfig( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_ljiip( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_ljii( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_hp7470( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_hp7580( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_hpgl( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_imp( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pbm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_png( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_gif( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_cgm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_null( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tkwin( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pstex( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_psttfc( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_psttfm( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_ntk( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_mem( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_wingcc( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_wxwidgets( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_wxpng( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_svg( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdf( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_xcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdfcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pscairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_epscairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_svgcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_memcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_extcairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_wincairo( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_bmpqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_jpgqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pngqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_ppmqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_tiffqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_svgqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_epsqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_pdfqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_qtwidget( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_extqt( PLDispatchTable *pdt ); PLDLLIMPEXP_DRIVER void plD_dispatch_init_memqt( PLDispatchTable *pdt ); // Prototypes for plot buffer calls. void plbuf_init( PLStream * ); void plbuf_line( PLStream *, short, short, short, short ); void plbuf_polyline( PLStream *, short *, short *, PLINT ); void plbuf_eop( PLStream * ); void plbuf_bop( PLStream * ); void plbuf_tidy( PLStream * ); void plbuf_state( PLStream *, PLINT ); void plbuf_esc( PLStream *, PLINT, void * ); PLDLLIMPEXP void * plbuf_save( PLStream *, void * ); PLDLLIMPEXP void * plbuf_switch( PLStream *, void * ); PLDLLIMPEXP void plbuf_restore( PLStream *, void * ); PLDLLIMPEXP void plRemakePlot( PLStream * ); #ifdef __cplusplus } #endif #endif // __DRIVERS_H__ plplot-5.10.0+dfsg/include/metadefs.h 644 1750 1750 426511460155000 163130ustar andrewandrew// $Id: metadefs.h 11269 2010-10-22 00:25:36Z airwin $ // // Geoffrey Furnish // 5 May 1991 // // This file contains definitions of constants and structures which // are needed by the PLplot metafile writer and renderer. // // // PLMETA_HEADER holds the magic string at head of metafile. // PLMETA_VERSION holds the version number (year & letter). // // Note: All strings written into the file header are limited to a maximum // of 80 characters. // #define PLMETA_HEADER "PLPLOT" #define PLMETA_VERSION "2005a" // These are used by the TK driver client/server code #define PLSERV_HEADER "PLPLOT" #define PLSERV_VERSION "2005b" // Symbolic constants for old metafile versions (prior to 1992a). // Now these are stored in the metafile header. #define PLMETA_X_OLD 10000 #define PLMETA_Y_OLD 10000 // Virtual dots/mm for our virtual display space. #define PIXEL_RES_X_OLD 42 #define PIXEL_RES_Y_OLD 56 // Macros to make it easier to abort on nonzero return code // Can't call plexit on a write failure since that would be circular #define plm_wr( code ) \ if ( code ) { fprintf( stderr, "Unable to write to MetaFile\n" ); exit( 1 ); } #define plm_rd( code ) \ if ( code ) plexit( "Unable to read from MetaFile" ) // // Metafile commands. // //** NOTICE !!! *** // If you change ANY of the following, you will wreck backward // backward compatibility with old metafiles. You may add, but do // NOT delete !!! // #define INITIALIZE 1 #define CLOSE 2 #define SWITCH_TO_TEXT 3 // Obsolete, replaced by ESCAPE #define SWITCH_TO_GRAPH 4 // Obsolete, replaced by ESCAPE #define EOP 5 #define BOP 6 #define NEW_COLOR 7 // Obsolete, replaced by CHANGE_STATE #define NEW_WIDTH 8 // Obsolete, replaced by CHANGE_STATE #define LINE 9 #define LINETO 10 #define ESCAPE 11 #define ADVANCE 12 // Obsolete, BOP/EOP used instead #define POLYLINE 13 #define NEW_COLOR0 NEW_COLOR #define NEW_COLOR1 14 #define CHANGE_STATE 15 #define BOP0 16 // First BOP in a file #define END_OF_FIELD 255 plplot-5.10.0+dfsg/include/plDevs.h.in 644 1750 1750 547512167035052 164020ustar andrewandrew// -*-C-*- // $Id: plDevs.h.in 12408 2013-07-09 16:28:26Z airwin $ // // Maurice LeBrun // IFS, University of Texas at Austin // 18-Jul-1994 // // Contains macro definitions that determine what device drivers are // compiled into the PLplot library. On a Unix system, typically the // configure script builds plDevs.h from plDevs.h.in. Elsewhere, it's // best to hand-configure a plDevs.h file and keep it with the // system-specific files. // // Copyright (C) 2004 Andrew Roach // Copyright (C) 2005 Thomas J. Duck // Copyright (C) 2006 Andrew Ross // Copyright (C) 2006 Alan W. Irwin // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #ifndef __PLDEVS_H__ #define __PLDEVS_H__ #cmakedefine PDL_aqt #cmakedefine PLD_plmeta #cmakedefine PLD_null #cmakedefine PLD_xterm #cmakedefine PLD_tek4010 #cmakedefine PLD_tek4010f #cmakedefine PLD_tek4107 #cmakedefine PLD_tek4107f #cmakedefine PLD_mskermit #cmakedefine PLD_vlt #cmakedefine PLD_versaterm #cmakedefine PLD_conex #cmakedefine PLD_linuxvga #cmakedefine PLD_dg300 #cmakedefine PLD_png #cmakedefine PLD_jpeg #cmakedefine PLD_gif #cmakedefine PLD_cgm #cmakedefine PLD_ps #cmakedefine PLD_xfig #cmakedefine PLD_ljiip #cmakedefine PLD_ljii #cmakedefine PLD_lj_hpgl #cmakedefine PLD_hp7470 #cmakedefine PLD_hp7580 #cmakedefine PLD_imp #cmakedefine PLD_xwin #cmakedefine PLD_tk #cmakedefine PLD_pbm #cmakedefine PLD_gcw #cmakedefine PLD_gnome #cmakedefine PLD_pstex #cmakedefine PLD_psttf #cmakedefine PLD_ntk #cmakedefine PLD_tkwin #cmakedefine PLD_mem #cmakedefine PLD_wingcc #cmakedefine PLD_wxwidgets #cmakedefine PLD_wxpng #cmakedefine PLD_svg #cmakedefine PLD_pdf #cmakedefine PLD_xcairo #cmakedefine PLD_pdfcairo #cmakedefine PLD_pscairo #cmakedefine PLD_epscairo #cmakedefine PLD_svgcairo #cmakedefine PLD_pngcairo #cmakedefine PLD_memcairo #cmakedefine PLD_extcairo #cmakedefine PLD_wincairo #cmakedefine PLD_bmpqt #cmakedefine PLD_jpgqt #cmakedefine PLD_pngqt #cmakedefine PLD_ppmqt #cmakedefine PLD_tiffqt #cmakedefine PLD_svgqt #cmakedefine PLD_epsqt #cmakedefine PLD_pdfqt #cmakedefine PLD_qtwidget #cmakedefine PLD_extqt #cmakedefine PLD_memqt #endif // __PLDEVS_H__ plplot-5.10.0+dfsg/uncrustify.cfg 644 1750 1750 17212211571511407 156730ustar andrewandrew# Uncrustify 0.58 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = true # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = ignore # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = force # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = force # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = force # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = force # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = ignore # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = ignore # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = force # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = force # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = force # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = force # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between 'version' and '(' in 'version (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_version_paren = ignore # ignore/add/remove/force # Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_scope_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = ignore # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName)' vs '@selector (msgName)' # Also applies to @protocol() constructs sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space between '@selector(x)' and the following word # '@selector(foo) a:' vs '@selector(foo)a:' sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space inside '@selector' parens # '@selector(foo)' vs '@selector( foo )' # Also applies to @protocol() constructs sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 2 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 12 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 4 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 12 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 3 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 12 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # Aligning parameters in an Obj-C '+' or '-' declaration on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = true # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = ignore # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = ignore # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = ignore # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = ignore # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = ignore # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = ignore # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = false # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = false # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment. # Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. cmt_insert_oc_msg_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # plplot-5.10.0+dfsg/README 644 1750 1750 1163510601725300 136300ustar andrewandrewThis is the distribution for PLplot, a scientific plotting package. PLplot is relatively small, portable, freely distributable, and is rich enough to satisfy most users. It has a wide range of plot types including line (linear, log), contour, 3D, fill, and almost 1000 characters (including Greek and mathematical) in its extended font set. The package is designed to make it easy to quickly get graphical output; only a handful of function calls is typically required. For more advanced use, virtually all aspects of plotting are configurable. The PLplot package is distributable under the terms of the GNU Library General Public License (LGPL) with some exceptions -- see the file "Copyright" for full information. The intent here is to ensure that PLplot continues to evolve in a positive way, while remaining freely distributable. Placing the library under the LGPL enables software developers to use the PLplot library as an integral part of their product, even a commercial product. We welcome suggestions on how to improve this code, especially in the form of user-contributed additions, enhancements or bug fixes. If PLplot is used in any published papers, please include an acknowledgment or citation of our work, which will help us to continue improving PLplot. Also, please remember that as PLplot is not a commercial product, we cannot be expected to offer the kind of support that a commercial product may. There is great interest in extending PLplot and fixing bugs, but the principal authors can only afford to work on it part time. Improvements will necessarily focus on those which help us get our work done. The PLplot library is written in C, enabling it to run on many platforms practically without modification. Fortran programs may use it transparently; stub routines are provided to handle the C<->Fortran interface without any modification of the user program. C programs are required to include the header file "plplot.h"; see the documentation for more details. Programmes written in many other languages can also use the PLplot library. The C++, Tcl, Python, Octave, and Yorick (this front end is maintained independently, see yplot.sf.net) front ends to PLplot are mature, the Java front end is almost there (most examples work), and the Perl front end is still quite incomplete. The main documentation for PLplot is available on-line at http://plplot.sourceforge.net/docbook-manual/. This is generated from DocBook source within the doc/docbook tree. In some cases the documentation lags actual improvements to the code, so consult "NEWS" to see a list of recent changes. At present, PLplot is actively supported on the following systems: Unix: Most Unix systems including recent good reports on AIX (IBM) IRIX (Silicon Graphics) Linux (various) OSF/1 (DEC/Compaq) OS X (Macintosh) SCO (SCO) SunOS (Sun) MS-DOS (DJGPP) Windows (95?, 98, NT, 2000, XP) Many different output device drivers are available, including postscript, PDF, tektronix, HP laserjet, HP pen plotters, XFig, xterm, X-windows, and a portable metafile format, among others. The Tk driver under Unix/X provides a full user interface based on the plframe plotting widget (see below). The metafile renderer (plrender) supports all of the standard operations as well as seeking operations (backward, forward, or to any specified page) when interactively viewing metafile output. Part of the PLplot package is a Tcl-based interpreter (pltcl). This program allows interactive plotting using the Tcl script language with plotting extensions. Also part of PLplot is a Tk-based plotting widget, called a plframe. This widget is based on the Tk frame widget, and supports a variety of user options such as zoom, scrolls, save to a variety of devices, print, resize, page layout, orientation change, and palette manipulation. Direct plotting to the widget may be done by calls to the underlying library using either C or Fortran bindings, and a large number of operations can be interpreted directly (in Tcl) by the widget. For more information on how to get or use PLplot on your system, see: - appendices to the PLplot manual - system-specific documentation in the appropriate sys/ directory. SourceForge provides most of the facilities currently used by PLplot. The PLplot homepage can be found at http://plplot.sf.net. The PLplot project page can be found at http://sourceforge.net/projects/plplot where you can find source tarballs and rpm's for several Linux distributions and browse the CVS tree and the archives of our mailing lists. These mailing lists include plplot-general (announcements and user questions/answers), plplot-devel (discussions of PLplot development), and plplot-cvs (notification of CVS changes). CREDITS ------- PLplot is the result of the effort of many people, so it is impractical to list all the contributors. Those currently supporting and otherwise responsible for the package in its present form are given in the AUTHORS file. plplot-5.10.0+dfsg/pkgcfg/ 775 1750 1750 012406243566 141235ustar andrewandrewplplot-5.10.0+dfsg/pkgcfg/CMakeLists.txt 644 1750 1750 160310502116237 167260ustar andrewandrew# pkgcfg/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA install(FILES README DESTINATION ${DOC_DIR} RENAME README.pkg-config) plplot-5.10.0+dfsg/pkgcfg/README 644 1750 1750 365612243237170 150640ustar andrewandrewREADME for the pkg-config support for PLplot -------------------------------------------- The pkg-config system for PLplot has been completely redesigned. We used to have before two files, plplot.pc.in and plplot-float.pc.in, which were almost identical. The *.pc were obtained at configure time. Essentially, only the -lplplot(d) flag was included in the Libs entries of these files. This works correctly in platforms like Linux, in which the linker program searches recursively for the dependency libraries. With the new system, we try to make the pkg-config support for PLplot work better cross-platform. For that, the whole set of dependency libraries is included in the Libs entry. This is done by parsing the libtool-generated *.lai files at install time, thanks to the install-data-hook rule in Makefile.am. Another improvement of the new system is that there are now separate pkg-config files for the different libraries shipped with PLplot. They are: plplot.pc plplot-c++.pc plplot-f95.pc plplot-tcl.pc for the single precision case, and: plplotd.pc plplotd-c++.pc plplotd-f95.pc plplotd-tcl.pc for the double precision case. Since these files are quite similar, they are generated by a Bourne shell script (gen-pc-files.sh) from a boilerplate template (plplot-master-pc). The template file is obtained during configuration (from plplot-master-pc.in). In my current system, this is what I obtain now: $ pkg-config plplotd --libs -lplplotd -lfreetype -lz -lcsirocsa -lcsironn -lqhull -lm -ldl $ pkg-config plplotd-c++ --libs -lplplotcxxd -lplplotd -lfreetype -lz -lcsirocsa -lcsironn -lqhull -ldl $ pkg-config plplotd-tcl --libs -lplplottcltkd -lplplotd -lfreetype -lz -lcsirocsa -lcsironn -lqhull -ldl -ltclmatrixd -litk3.2 -ltk8.4 -litcl3.2 -ltcl8.4 L/usr/X11R6/lib -lX11 -lm Rafael Laboissiere $Id: README 12725 2013-11-20 22:58:00Z airwin $ plplot-5.10.0+dfsg/pkgcfg/plplot-template.pc.in 644 1750 1750 53512240276136 202330ustar andrewandrewlibdir=@SHLIB_DIR@ includedir=@INCLUDE_DIR@ drvdir=@LIB_DIR@/plplot@PLPLOT_VERSION@/drivers@LIB_TAG@ Name: PLplot @PC_SHORT_NAME@ Description: Scientific plotting library (@PC_LONG_NAME@@PC_PRECISION@ precision) @PC_REQUIRES_TAG@: @PC_REQUIRES@ Version: @PLPLOT_VERSION@ Libs: -L${libdir} @PC_LINK_FLAGS@ Cflags: -I${includedir} @PC_COMPILE_FLAGS@ plplot-5.10.0+dfsg/README.emacs 644 1750 1750 1072311021340171 147100ustar andrewandrewThis file gives cookbooks for using emacs modes to help with editing and maintaining a consistent style for our various kinds of files. ---------------------------------------------- * CMake files There is a cmake mode available for emacs. On some systems (the latest Debian unstable for instance) this may be automatically installed along with cmake. If not, then the following cookbook should work. 1) Get the cmake-mode.el file from the cmake site http://www.cmake.org/CMakeDocs/cmake-mode.el . Note the current file has a couple of lines from diff / patch in (starting with >>> or <<<) which need removing. 2) Install cmake-mode.el in a suitable location in your system / home directory. 3) Add the following to your .emacs file to automatically load cmake mode for .cmake and CMakeLists.txt files. ---- ;-------------------- ; Enable CMake mode | ;-------------------- (setq load-path (cons (expand-file-name "~/lib/site-lisp") load-path)) (autoload 'cmake-mode "CMAKE" "Major mode for editing CMake listfiles") (setq auto-mode-alist (append '(("CMakeLists\\.txt\\'" . cmake-mode) ("\\.cmake\\'" . cmake-mode)) auto-mode-alist)) ---- You will need to alter the directory path depending on where you installed cmake-mode.el 4) Check the file works by loading one of the plplot cmake files into emacs. You should see CMAKE at the bottom of the screen as the major mode. 5) For my version of emacs this does not autoload the helper function for unscreamifying the buffer (i.e. all cmake commands in lower case). Typing "M-x load-library cmake-mode" should fix this. The two most useful functions are "M-x unscreamify-buffer" which will put all cmake commands into lower case "M-x indent-region" which will indent the selected region correctly ---------------------------------------------- DocBook files in doc/docbook/src There is a well-established nxml mode for emacs that should be automatically available for all recent versions of emacs that is useful for editing our DocBook files. 1) Add the following to your .emacs file to automatically load nxml mode for our DocBook files. ---- ;-------------------- ; Support nxml mode according to /usr/share/doc/nxml-mode/README ;-------------------- (load "/usr/share/emacs/site-lisp/nxml-mode/rng-auto.el") (setq auto-mode-alist (cons '("\\.\\(xml\\|xml.in\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode) auto-mode-alist)) ---- 2) Edit one of the DocBook files in doc/docbook/src. i) Recognition of the DocBook schema for our DocBook files. nxml automatically uses schemas.xml in the above directory to use the DocBook schema for our DocBook files. If we add new DocBook files, schemas.xml will have to be changed accordingly. To confirm you are using the correct schema use the C-c-C-s-C-w emacs command. ii) Validation. nxml dynamically validates the file as it is being edited and underlines in red (with a pop-up explaining the problem if you hover your mouse over the underlined element) all elements that it cannot validate. This facility is extremely useful while you edit our DocBook documentation. Note, one nxml validation limitation is it does not understand xml projects split into more than one file. In practice, this means all the entities defined in plplotdoc.xml(.in) will not validate correctly (i.e., will be underlined in red). Of course, to validate the entire PLplot DocBook documentation project including entities, it is important to run "make validate" in the build tree after your editing session is complete. To find the next invalid element use the C-c-C-n emacs command. iii) Standard indentation style. To impose a standard indentation style on our DocBook files, select a region by marking a location with the C-@ emacs command, then moving the point (cursor) to the end of the region you want to select. Then impose a standard indentation style on the selected region using the C-M-\ emacs command. This has recently been done for the entire regions of all DocBook files so the region you normally select would normally be just the one where you have recently made changes. iv) Other nxml possibilities. See "XML document authoring with emacs nxml-mode" at http://infohost.nmt.edu/tcc/help/pubs/nxml/index.html . ---------------------------------------------- plplot-5.10.0+dfsg/README.developers 644 1750 1750 360511652530172 157650ustar andrewandrewInformation for developers on UNIX/Linux ---------------------------------------- The plplot build system now requires CMake. The latest instructions for building PLplot with cmake can be found on the PLplot wiki. http://www.miscdebris.net/plplot_wiki Coding standards for PLplot --------------------------- When writing / contributing code for PLplot the following standards are followed: C: ISO C99 standards with POSIX.1-2001 base specification (required for a number of functions) C++: ISO C++ 1998 standard plus amendents Fortran 95: Fortran 95 standard To check code it is recommended to try compiling with suitable compiler flags to enforce these standards and to enable compiler warnings to check for dubious code. For gcc / g++ / gfortran the following flags can be used CFLAGS='-O3 -std=c99 -pedantic -D_POSIX_C_SOURCE=200112L -Wall \ -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs \ -Wconversion -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings' CCFLAGS='-O3 -fvisibility=hidden -std=c++98 -pedantic -Wall -Wextra' FFLAGS='-std=f95 -O3 -fall-intrinsics -fvisibility=hidden -pedantic \ -Wall -Wextra' Adherence to the standards should help make the code more portable. Some notes and recommendations ------------------------------ - Use C++ style // comments rather than the older /* */ style comments. The only exception to this where a comment is embeded in a line of code, e.g. to comment out a parameter name in a function definition in C++. - To mark function parameters as unused and to suppress at least gcc warnings about these, mark the parameter names with the PL_UNUSED( ) macro. Styling of code --------------- The uncrustify code beautifying program is used to style the source code consistently and in a readable manner. Running the scripts/style_source.sh shell script can be used the check the source code, and to apply any styling changes required. plplot-5.10.0+dfsg/ChangeLog.release 644 1750 1750 13414012276775207 162030ustar andrewandrew------------------------------------------------------------------------ r13009 | airwin | 2014-02-12 14:43:39 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/www/examples.php One additional website tweak ------------------------------------------------------------------------ r13007 | airwin | 2014-02-12 14:06:04 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/ChangeLog.release Second try at committing the ChangeLog for the 5.9.10 release. ------------------------------------------------------------------------ r13006 | airwin | 2014-02-12 14:02:43 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/README.Release_Manager_Cookbook More version tweaks to release process procedure. ------------------------------------------------------------------------ r13005 | airwin | 2014-02-12 14:01:26 -0800 (Wed, 12 Feb 2014) | 4 lines Changed paths: M /trunk/scripts/htdocs-gen_plot-examples.sh M /trunk/www/examples.php Use ".txt" suffix rather than "-" since that appears to give a better result with konqueror (which e.g., attempts to recognize x00c.c- as C code which should be downloaded rather than simply viewed). ------------------------------------------------------------------------ r13003 | airwin | 2014-02-12 11:40:32 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/ChangeLog.release Commit the ChangeLog for the 5.9.10 release. ------------------------------------------------------------------------ r13002 | airwin | 2014-02-12 11:36:50 -0800 (Wed, 12 Feb 2014) | 3 lines Changed paths: M /trunk/README.Release_Manager_Cookbook Update to reflect the change in version for this imminent release and also the actual practices by the release manager for this release. ------------------------------------------------------------------------ r13001 | airwin | 2014-02-12 10:59:52 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/doc/docbook/src/api-obsolete.xml Implement documentation for deprecated plwid. ------------------------------------------------------------------------ r13000 | airwin | 2014-02-12 10:09:32 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/doc/docbook/src/plplotdoc.xml.in Correct version configuration. ------------------------------------------------------------------------ r12999 | airwin | 2014-02-12 08:29:06 -0800 (Wed, 12 Feb 2014) | 3 lines Changed paths: M /trunk/cmake/modules/plplot_version.cmake M /trunk/www/examples.php Update release date and version information for the 5.9.10 release that is about to happen. ------------------------------------------------------------------------ r12998 | airwin | 2014-02-12 08:03:35 -0800 (Wed, 12 Feb 2014) | 2 lines Changed paths: M /trunk/README.release Update the description of Arjen's MinGW/MSYS test results. ------------------------------------------------------------------------ r12997 | arjenmarkus | 2014-02-12 00:55:30 -0800 (Wed, 12 Feb 2014) | 1 line Changed paths: M /trunk/cmake/epa_build/swig/CMakeLists.txt Add the option --with-maximum-compile-warnings=no to avoid errors with gcc 4.8.1 on MinGW/MSYS while building the SWIG target in epa_build. ------------------------------------------------------------------------ r12996 | airwin | 2014-02-11 15:26:27 -0800 (Tue, 11 Feb 2014) | 2 lines Changed paths: M /trunk/cmake/epa_build/README.developers Add some comments about the way foward for development of epa_build. ------------------------------------------------------------------------ r12995 | airwin | 2014-02-10 16:31:22 -0800 (Mon, 10 Feb 2014) | 2 lines Changed paths: M /trunk/cmake/epa_build/README Update instructions with regard to setting NUMBER_PARALLEL_JOBS. ------------------------------------------------------------------------ r12994 | airwin | 2014-02-10 16:06:38 -0800 (Mon, 10 Feb 2014) | 2 lines Changed paths: M /trunk/README.release Describe the exact status of the testing for this release. ------------------------------------------------------------------------ r12993 | airwin | 2014-02-10 13:36:35 -0800 (Mon, 10 Feb 2014) | 5 lines Changed paths: M /trunk/cmake/epa_build/README Update instructions in light of the replacement of ENABLE_COMPREHENSIVE_PLPLOT_TEST with either/both COMPREHENSIVE_PLPLOT_TEST_INTERACTIVE and COMPREHENSIVE_PLPLOT_TEST_NONINTERACTIVE. ------------------------------------------------------------------------ r12992 | airwin | 2014-02-10 13:19:43 -0800 (Mon, 10 Feb 2014) | 11 lines Changed paths: M /trunk/cmake/epa_build/CMakeLists.txt M /trunk/cmake/epa_build/plplot/CMakeLists.txt M /trunk/cmake/epa_build/plplot_lite/CMakeLists.txt Replace ENABLE_COMPREHENSIVE_PLPLOT_TEST option with the COMPREHENSIVE_PLPLOT_TEST_INTERACTIVE and COMPREHENSIVE_PLPLOT_TEST_NONINTERACTIVE options. This allows much more convenient testing where you split off the comprehensive interactive tests (which require hands-on interaction from the user) with the comprehensive noninteractive tests which can be run as a background job with no interaction required from the user. ------------------------------------------------------------------------ r12991 | airwin | 2014-02-10 13:15:26 -0800 (Mon, 10 Feb 2014) | 3 lines Changed paths: M /trunk/scripts/comprehensive_test.sh Fix some PATH manipulation issues that occurred for the MinGW/MSYS interactive test case. ------------------------------------------------------------------------ r12990 | airwin | 2014-02-09 12:52:02 -0800 (Sun, 09 Feb 2014) | 4 lines Changed paths: M /trunk/bindings/tk/plserver.c Make some of the recently added debug output less intrusive by using the DEBUG macro. ------------------------------------------------------------------------ r12989 | airwin | 2014-02-09 12:46:30 -0800 (Sun, 09 Feb 2014) | 3 lines Changed paths: M /trunk/cmake/epa_build/swig/CMakeLists.txt Revert the recent CFLAGS change which has not been comprehensively tested for this release. ------------------------------------------------------------------------ r12988 | airwin | 2014-02-09 12:41:00 -0800 (Sun, 09 Feb 2014) | 3 lines Changed paths: M /trunk/cmake/epa_build/cmake/CMakeLists.txt Revert recent version change which was not comprehensively tested for this release. ------------------------------------------------------------------------ r12987 | airwin | 2014-02-08 21:21:49 -0800 (Sat, 08 Feb 2014) | 4 lines Changed paths: M /trunk/cmake/epa_build/ExternalProject.cmake M /trunk/cmake/epa_build/README M /trunk/cmake/epa_build/README.developers M /trunk/cmake/epa_build/ToDo M /trunk/cmake/epa_build/add_packages.xml M /trunk/cmake/epa_build/configure_epa.cmake M /trunk/cmake/epa_build/configured_pango.patch M /trunk/cmake/epa_build/download_check.cmake M /trunk/cmake/epa_build/epa_CMakeLists.txt.in M /trunk/cmake/epa_build/itk/autoreconf.patch M /trunk/cmake/epa_build/itk/itk4_case.patch M /trunk/cmake/epa_build/itk/itk4_header_list.patch M /trunk/cmake/epa_build/itk3/autotools_backport.patch M /trunk/cmake/epa_build/itstool/itstool-1.2.0-python-location-fixes.patch M /trunk/cmake/epa_build/iwidgets/iwidgets4.1.patch M /trunk/cmake/epa_build/iwidgets/iwidgets4_case.patch M /trunk/cmake/epa_build/libharu/cmake.patch M /trunk/cmake/epa_build/libharu/large_font.patch M /trunk/cmake/epa_build/libharu/remove_configured.patch M /trunk/cmake/epa_build/libharu/visibility.patch M /trunk/cmake/epa_build/ndiff/README.ndiff M /trunk/cmake/epa_build/ndiff/config.h.cmake M /trunk/cmake/epa_build/patch_gtk_packages.xml M /trunk/cmake/epa_build/setup/setup_mingw_makefiles M /trunk/cmake/epa_build/setup/setup_mingw_msys_wine_toolchain M /trunk/cmake/epa_build/setup/setup_msys_makefiles M /trunk/cmake/epa_build/shapelib/README M /trunk/cmake/epa_build/swig/octave-3.8.0.patch M /trunk/cmake/epa_build/wildcard_remove.cmake M /trunk/cmake/epa_build/xmlcatalog-wrapper/filter_arguments.cmake M /trunk/cmake/epa_build/xmlcatalog-wrapper/xmlcatalog-wrapper.sh.in Set svn:eol-style property to native for all files under version control in cmake_epa_build directory tree. This only affects a subset of the files because most of them had this property set already. ------------------------------------------------------------------------ r12986 | airwin | 2014-02-08 19:12:14 -0800 (Sat, 08 Feb 2014) | 2 lines Changed paths: M /trunk/cmake/epa_build/xmlcatalog-wrapper/xmlcatalog-wrapper.sh.in svn:eol property fixup. ------------------------------------------------------------------------ r12985 | airwin | 2014-02-08 11:43:20 -0800 (Sat, 08 Feb 2014) | 3 lines Changed paths: M /trunk/cmake/epa_build/cairo/CMakeLists.txt M /trunk/cmake/epa_build/cmake/CMakeLists.txt M /trunk/cmake/epa_build/docbook-xml/CMakeLists.txt M /trunk/cmake/epa_build/docbook-xsl/CMakeLists.txt M /trunk/cmake/epa_build/fontconfig/CMakeLists.txt M /trunk/cmake/epa_build/glib/CMakeLists.txt M /trunk/cmake/epa_build/gobject-introspection/CMakeLists.txt M /trunk/cmake/epa_build/gperf/CMakeLists.txt M /trunk/cmake/epa_build/gtk-doc/CMakeLists.txt M /trunk/cmake/epa_build/harfbuzz/CMakeLists.txt M /trunk/cmake/epa_build/intltool/CMakeLists.txt M /trunk/cmake/epa_build/itcl3/CMakeLists.txt M /trunk/cmake/epa_build/itk/CMakeLists.txt M /trunk/cmake/epa_build/itk3/CMakeLists.txt M /trunk/cmake/epa_build/itstool/CMakeLists.txt M /trunk/cmake/epa_build/iwidgets/CMakeLists.txt M /trunk/cmake/epa_build/libagg/CMakeLists.txt M /trunk/cmake/epa_build/libffi/CMakeLists.txt M /trunk/cmake/epa_build/libharu/CMakeLists.txt M /trunk/cmake/epa_build/libpcre/CMakeLists.txt M /trunk/cmake/epa_build/libqhull/CMakeLists.txt M /trunk/cmake/epa_build/libxml2/CMakeLists.txt M /trunk/cmake/epa_build/libxslt/CMakeLists.txt M /trunk/cmake/epa_build/ndiff/CMakeLists.txt M /trunk/cmake/epa_build/pango/CMakeLists.txt M /trunk/cmake/epa_build/pixman/CMakeLists.txt M /trunk/cmake/epa_build/pkg-config/CMakeLists.txt M /trunk/cmake/epa_build/plplot/CMakeLists.txt M /trunk/cmake/epa_build/ragel/CMakeLists.txt M /trunk/cmake/epa_build/shapelib/CMakeLists.txt M /trunk/cmake/epa_build/subversion/CMakeLists.txt M /trunk/cmake/epa_build/swig/CMakeLists.txt M /trunk/cmake/epa_build/tcl/CMakeLists.txt M /trunk/cmake/epa_build/tk/CMakeLists.txt M /trunk/cmake/epa_build/wxwidgets/CMakeLists.txt M /trunk/cmake/epa_build/xmlcatalog-wrapper/CMakeLists.txt M /trunk/cmake/epa_build/yelp-tools/CMakeLists.txt M /trunk/cmake/epa_build/yelp-xsl/CMakeLists.txt Set correct native line endings property for all the CMakeLists.txt files of the epa_build project. ------------------------------------------------------------------------ r12984 | arjenmarkus | 2014-02-08 11:09:26 -0800 (Sat, 08 Feb 2014) | 1 line Changed paths: M /trunk/cmake/epa_build/swig/CMakeLists.txt Add two compile flags to avoid compile errors (regarding the off64_t type and regarding the struct for directory contents) ------------------------------------------------------------------------ r12983 | arjenmarkus | 2014-02-08 11:00:24 -0800 (Sat, 08 Feb 2014) | 1 line Changed paths: M /trunk/bindings/tcl/CMakeLists.txt M /trunk/bindings/tk/plserver.c M /trunk/cmake/epa_build/cmake/CMakeLists.txt M /trunk/cmake/epa_build/swig/CMakeLists.txt ------------------------------------------------------------------------ r12982 | airwin | 2014-02-06 21:42:56 -0800 (Thu, 06 Feb 2014) | 3 lines Changed paths: M /trunk/cmake/epa_build/CMakeLists.txt Do not allow a cmake build for the MSYS platform case for the reasons mentioned in cmake/epa_build/README. ------------------------------------------------------------------------ r12981 | airwin | 2014-02-06 18:49:25 -0800 (Thu, 06 Feb 2014) | 6 lines Changed paths: M /trunk/README.release Describe my tests for this release. Note the tough part of these are already done (comprehensive noninteractive test on MinGW/MSYS) and I am completely confident I can finish the rest, but if not these notes will have to be revised. ------------------------------------------------------------------------ r12980 | airwin | 2014-02-06 00:05:34 -0800 (Thu, 06 Feb 2014) | 3 lines Changed paths: M /trunk/cmake/epa_build/README Update directions to be consistent with my recent experience with epa_build. ------------------------------------------------------------------------ r12979 | airwin | 2014-02-05 23:29:41 -0800 (Wed, 05 Feb 2014) | 10 lines Changed paths: M /trunk/cmake/epa_build/setup/setup_mingw_msys_wine_toolchain If cmake is epa_built as one of the buildtools on MinGW/MSYS platforms, ignore it in favor of the more powerful Windows binary version you can download from kitware. This measure will be required until the curl library and its dependencies (including openssl) are configured as part of epa_build and made dependencies of the cmake epa_build. Without access to an external curl, cmake drops back to its internal curl library which does not allow downloads of "https" URLS (essential for epa_build to work!). ------------------------------------------------------------------------ r12978 | airwin | 2014-02-05 21:14:46 -0800 (Wed, 05 Feb 2014) | 11 lines Changed paths: M /trunk/cmake/epa_build/plplot/CMakeLists.txt M /trunk/cmake/epa_build/plplot_lite/CMakeLists.txt Improve logic dealing with ENABLE_COMPREHENSIVE_PLPLOT_TEST choices. This logic gives good test results (so far just the noninteractive case has been tested) for the epa_build build_plplot_lite target on Linux for -DENABLE_COMPREHENSIVE_PLPLOT_TEST=ON A preliminary subset of those plplot_lite tests have been successfully run on MinGW/MSYS/Wine, and a job with the same comprehensive test conditions as above has been started on that platform. ------------------------------------------------------------------------ r12977 | airwin | 2014-02-05 21:06:07 -0800 (Wed, 05 Feb 2014) | 2 lines Changed paths: M /trunk/cmake/modules/pkg-config.cmake Fix recently introduced regression in the Linux case for PKG_CONFIG_ENV. ------------------------------------------------------------------------ r12976 | airwin | 2014-02-05 21:04:19 -0800 (Wed, 05 Feb 2014) | 10 lines Changed paths: M /trunk/examples/CMakeLists.txt Install Darwin-dmd.cmake (which is likely necessary for the CMake-based build system for the installed D examples on Mac OS X). Make CMake minimum version and policy for the installed examples configuration consistent with the core configuration. Output CMAKE_PLATFORM_INFO_DIR since there has sometimes been trouble with that variable being defined. ------------------------------------------------------------------------ r12975 | airwin | 2014-02-05 14:23:38 -0800 (Wed, 05 Feb 2014) | 7 lines Changed paths: M /trunk/cmake/modules/pkg-config.cmake M /trunk/cmake/modules/plplot_functions.cmake M /trunk/src/CMakeLists.txt Update the configuration of pkg-config files so that good results are obtained on MinGW/MSYS. Lightly tested on MinGW/MSYS/Wine using the traditional build of some of the installed examples. ------------------------------------------------------------------------ r12974 | airwin | 2014-02-02 11:32:14 -0800 (Sun, 02 Feb 2014) | 2 lines Changed paths: M /trunk/README.release Update what has been accomplished for this forthcoming release. ------------------------------------------------------------------------ r12973 | airwin | 2014-01-29 09:33:31 -0800 (Wed, 29 Jan 2014) | 2 lines Changed paths: M /trunk/README.Release_Manager_Cookbook Rearrange into more logical order without numbers. ------------------------------------------------------------------------ r12972 | airwin | 2014-01-29 08:52:35 -0800 (Wed, 29 Jan 2014) | 13 lines Changed paths: M /trunk/doc/docbook/src/CMakeLists.txt Adjust to new version of Hǎiliàng Wáng's check programme which now has a -incdir argument to specify where the configured headers included by plplot.h are located. This change in "check" means it is no longer necessary to copy plplot.h from the source to the build directory in order to get this application to work. Tested on Linux using the check_api_xml_consistency target which still produces a clean result on the consistency of api.xml with our API as defined by plplot.h. ------------------------------------------------------------------------ r12971 | airwin | 2014-01-28 18:27:57 -0800 (Tue, 28 Jan 2014) | 6 lines Changed paths: M /trunk/doc/docbook/src/api.xml M /trunk/doc/docbook/src/plplotdoc.xml.in Make remaining changes to bring api.xml into complete consistency with plplot.h according to the new check_api_xml_consistency target that I developed for our build system that was based on Hǎiliàng Wáng's "check" application that was written in the Go language. ------------------------------------------------------------------------ r12970 | airwin | 2014-01-28 18:23:42 -0800 (Tue, 28 Jan 2014) | 2 lines Changed paths: M /trunk/scripts/comprehensive_test.sh Tweak one of the messages. ------------------------------------------------------------------------ r12969 | airwin | 2014-01-28 18:20:43 -0800 (Tue, 28 Jan 2014) | 9 lines Changed paths: M /trunk/README.release This change substantially reorganizes and simplifies the release notes. This is possible because we are dropping the artificial distinction between stable and development releases as discussed on list. ToDo. Add what has changed for this release and add notes on the tests done for this release as those happen. ------------------------------------------------------------------------ r12968 | airwin | 2014-01-28 17:42:57 -0800 (Tue, 28 Jan 2014) | 5 lines Changed paths: M /trunk/include/plplot.h M /trunk/src/plwind.c Use better parameter names (xmin0, xmax0, ymin0, ymax0, zmin0, zmax0) ==> (xmin, xmax, ymin, ymax, zmin, zmax) for some of the plw3d arguments. ------------------------------------------------------------------------ r12967 | airwin | 2014-01-28 16:29:24 -0800 (Tue, 28 Jan 2014) | 6 lines Changed paths: M /trunk/include/plplot.h Change parameter names left, right, bottom, top ==> xmin, xmax, ymin, ymax for plshade and plshade1 to be consistent with the argument names for those functions in src/plshade.c and also to be consistent with the names for the equivalent arguments of plshades (both in include/plplot.h and src/plshade.c). ------------------------------------------------------------------------ r12966 | airwin | 2014-01-28 16:01:50 -0800 (Tue, 28 Jan 2014) | 6 lines Changed paths: M /trunk/include/plplot.h M /trunk/src/plctrl.c Finish the previous renaming of pos ==> intensity for the plscmap1l and plscmap1la arguments in plplot.h by making the same change in src/plctrl.c. Change the argument name of plseed from s ==> seed. ------------------------------------------------------------------------ r12965 | arjenmarkus | 2014-01-28 12:23:52 -0800 (Tue, 28 Jan 2014) | 1 line Changed paths: M /trunk/bindings/tk/plframe.c M /trunk/drivers/tk.c M /trunk/drivers/wingcc.c Small corrections (FALSE instead of 0, plFramePtr->tkwin instead of new and a few superfluous empty lines removed) ------------------------------------------------------------------------ r12964 | airwin | 2014-01-28 01:57:01 -0800 (Tue, 28 Jan 2014) | 12 lines Changed paths: M /trunk/doc/docbook/src/api.xml Additional argument name and type mismatch fixups to reduce size of report delivered by check_api_xml_consistency target, but not done yet. Additional fixups done while I was dealing with the rest: color map [01] ==> cmap[01] Drop period from end of title for some 20 functions to be consistent with the rest. Some redacted form fixups. ------------------------------------------------------------------------ r12963 | airwin | 2014-01-27 22:46:00 -0800 (Mon, 27 Jan 2014) | 4 lines Changed paths: M /trunk/include/plplot.h M /trunk/src/plctrl.c Rename all alpha channel arguments in our public API from a to alpha. Tested on Linux using the plplotd target. ------------------------------------------------------------------------ r12962 | airwin | 2014-01-27 00:07:41 -0800 (Mon, 27 Jan 2014) | 14 lines Changed paths: M /trunk/doc/docbook/src/api.xml M /trunk/doc/docbook/src/plplotdoc.xml.in M /trunk/include/plplot.h M /trunk/src/plot3d.c Document plot3dcl and plsurf3dl. Change the ixstart and ixn arguments of these functions to indexxmin, and indexxmax in the code and documentation to be consistent with the naming of the indexymin and indexymax arguments. Tested by Alan W. Irwin on Linux using the validate target and the check_api_xml_consistency target (which is now available when the cmake option, ADD_SPECIAL_CONSISTENCY_CHECKING, is set to ON). This last test showed there is no more missing documentation of our public API in api.xml. However, that target also shows there are still a lot of argument inconsistencies between plplot.h and api.xml to sort out. ------------------------------------------------------------------------ r12961 | airwin | 2014-01-26 17:39:07 -0800 (Sun, 26 Jan 2014) | 15 lines Changed paths: M /trunk/cmake/modules/ocaml.cmake M /trunk/cmake/modules/plplot.cmake M /trunk/doc/docbook/src/CMakeLists.txt Implement ADD_SPECIAL_CONSISTENCY_CHECKING build system option that adds some custom check targets that ordinarily are not added to a normal build because of the extra dependencies. One of these targets is the already existing check_plplot_h.inc target (to check consistency of the octave binding). Also implement the check_api_xml_consistency target which is an additional target of this kind. That target uses Hǎiliàng Wang's check application (written in Go and available from https://github.com/hailiang/go-plplot/tree/master/c/check) to check the consistency of api.xml with plplot.h. ------------------------------------------------------------------------ r12960 | airwin | 2014-01-26 17:30:31 -0800 (Sun, 26 Jan 2014) | 3 lines Changed paths: M /trunk/src/plctrl.c Improve warnings when drawing mode setting/getting not supported by a device. ------------------------------------------------------------------------ r12959 | airwin | 2014-01-25 18:50:33 -0800 (Sat, 25 Jan 2014) | 3 lines Changed paths: M /trunk/doc/docbook/README.developers Add information concerning (good) rendering of UTF-8 symbols in api.xml by the "man" command. ------------------------------------------------------------------------ r12958 | airwin | 2014-01-25 11:47:30 -0800 (Sat, 25 Jan 2014) | 2 lines Changed paths: M /trunk/doc/docbook/src/api.xml M /trunk/doc/docbook/src/plplotdoc.xml.in Document plgdrawmode and plsdrawmode. ------------------------------------------------------------------------ r12957 | airwin | 2014-01-24 00:34:51 -0800 (Fri, 24 Jan 2014) | 11 lines Changed paths: M /trunk/doc/docbook/src/api.xml M /trunk/doc/docbook/src/plplotdoc.xml.in Implement documentation for plgcmap1_range and plscmap1_range. Thanks to Hǎiliàng Wang for writing the plplot.h/api.xml consistency checker that discovered these functions in our public API did not have any documentation in api.xml. ToDo: There are still 4 more functions that are missing documentation according to that checker report and also inconsistencies between plplot.h and api.xml in the number and names of the function arguments. ------------------------------------------------------------------------ r12956 | airwin | 2014-01-23 21:11:55 -0800 (Thu, 23 Jan 2014) | 6 lines Changed paths: M /trunk/doc/docbook/src/api.xml M /trunk/doc/docbook/src/plplotdoc.xml.in Implement long-overdue documentation for plbtime, plconfigtime, and plctime. Thanks to Hǎiliàng Wang for writing the plplot.h/api.xml consistency checker that discovered these (and 6 other functions in our public API) were missing documentation. ------------------------------------------------------------------------ r12955 | arjenmarkus | 2014-01-23 06:07:07 -0800 (Thu, 23 Jan 2014) | 3 lines Changed paths: M /trunk/examples/tk/runAllDemos.tcl (plplotbugs #142) First step to making the pausing more consistent. With this change the demos run via the runAllDemos.tcl program wait after each page, with a message at the bottom of what is expected. The behaviour in the Pltk package is controlled via the -eopcmd/-bopcmd options to the plframe widget. ------------------------------------------------------------------------ r12954 | airwin | 2014-01-22 15:43:10 -0800 (Wed, 22 Jan 2014) | 3 lines Changed paths: M /trunk/include/plplot.h Finish off the official deprecation of plrgb, plrgb1, plhls, and plwid in a consistent way. ------------------------------------------------------------------------ r12953 | airwin | 2014-01-22 15:18:38 -0800 (Wed, 22 Jan 2014) | 2 lines Changed paths: M /trunk/src/pldeprecated.c Document when plwid was officially deprecated. ------------------------------------------------------------------------ r12952 | airwin | 2014-01-22 15:09:31 -0800 (Wed, 22 Jan 2014) | 15 lines Changed paths: M /trunk/doc/docbook/src/api.xml Make api.xml more consistent with the plplot.h header. These issues were all discovered by a consistency checker written by Hǎiliàng Wang. Tested by Alan W. Irwin using the "make validate" command. ToDo: The checker found ~10 functions in the public API of PLplot that are undocumented in api.xml. At least one of those (plwid) is deprecated so some conditional programming using the PL_DEPRECATED macro should be used to eliminate that function (and any other officially deprecated function) from consideration by the consistency checker. Also, some of those ~10 functions will actually need to be documented in api.xml to provide a clean checker report. ------------------------------------------------------------------------ r12951 | airwin | 2014-01-22 14:55:21 -0800 (Wed, 22 Jan 2014) | 9 lines Changed paths: M /trunk/include/plplot.h M /trunk/src/plcore.c Change name of argument label ==> labels in the plcolorbar function prototype to make it consistent with the name used and documented in the plcolorbar function definition. Change the name of the plgfci argument from pfci ==> p_fci to make it consistent with the names of pointer arguments for other PLplot routines. ------------------------------------------------------------------------ r12950 | airwin | 2014-01-22 12:22:02 -0800 (Wed, 22 Jan 2014) | 6 lines Changed paths: M /trunk/include/plplot.h M /trunk/src/plbox.c Change plbox3 argument names to be consistent with plbox argument names; nsubx ==> nxsub nsuby ==> nysub nsubz ==> nzsub ------------------------------------------------------------------------ r12949 | airwin | 2014-01-22 11:15:08 -0800 (Wed, 22 Jan 2014) | 4 lines Changed paths: M /trunk/doc/docbook/src/api.xml Correct misspelling of function name, plggriddata ==> plgriddata. (Thanks to Hǎiliàng Wang for finding this). ------------------------------------------------------------------------ r12948 | airwin | 2014-01-22 01:06:22 -0800 (Wed, 22 Jan 2014) | 3 lines Changed paths: M /trunk/scripts/comprehensive_test.sh Sort out some PATH issues for the "MinGW Makefiles" or "MSYS Makefiles" case. ------------------------------------------------------------------------ r12947 | airwin | 2014-01-22 01:03:05 -0800 (Wed, 22 Jan 2014) | 9 lines Changed paths: M /trunk/bindings/ada/CMakeLists.txt For the MinGW case, install the *.o files that are created by the plplotada library build. This installation is not required on Linux, and even for the MinGW case gnatmake does not require these *.o files to be installed in order to build the installed Ada examples, but when those built examples are run, they immediately fail with a return code of 3 unless these *.o files are installed. Therefore, I am pretty sure this is a workaround for a MinGW gnatmake issue. ------------------------------------------------------------------------ r12946 | airwin | 2014-01-21 01:10:25 -0800 (Tue, 21 Jan 2014) | 5 lines Changed paths: M /trunk/scripts/comprehensive_test.sh Make this script much more robust against errors. Make the information messages from this more informative. ------------------------------------------------------------------------ r12945 | airwin | 2014-01-21 01:08:28 -0800 (Tue, 21 Jan 2014) | 3 lines Changed paths: M /trunk/cmake/epa_build/CMakeLists.txt Implement NUMBER_PARALLEL_JOBS option with a default of 4 rather than hard coding 4. ------------------------------------------------------------------------ r12944 | airwin | 2014-01-15 21:44:27 -0800 (Wed, 15 Jan 2014) | 2 lines Changed paths: M /trunk/examples/CMakeLists.txt Remove (now-)redundant -geometry options from wish test targets. ------------------------------------------------------------------------ r12943 | airwin | 2014-01-15 15:13:47 -0800 (Wed, 15 Jan 2014) | 3 lines Changed paths: M /trunk/examples/tk/wish_standard_examples.in Improve comments on examples that must be skipped because they don't work properly with this TEA-based wish method. ------------------------------------------------------------------------ r12942 | arjenmarkus | 2014-01-15 13:04:39 -0800 (Wed, 15 Jan 2014) | 1 line Changed paths: A /trunk/bindings/tcl/plitclgen.tcl Translation of the plitclgen script into Tcl code. Note that it is not yet used by the build scripts. That will be a next step. ------------------------------------------------------------------------ r12941 | arjenmarkus | 2014-01-15 12:16:36 -0800 (Wed, 15 Jan 2014) | 1 line Changed paths: M /trunk/bindings/tk/pkgIndex.tcl.in Use the CMake variable plplottcltk_SOVERSION as the suffix for the Tcl/Tk library, so that the pkgIndex.tcl file is adjusted automatically. ------------------------------------------------------------------------ r12940 | airwin | 2014-01-14 18:32:38 -0800 (Tue, 14 Jan 2014) | 11 lines Changed paths: M /trunk/cmake/epa_build/swig/CMakeLists.txt Apply patch to swig-2.0.11 to allow it to support octave-3.8.0. Tested by Alan W. Irwin on Linux by building and installing the patched swig-2.0.11 using epa_build with the -DBUILD_THE_BUILD_TOOLS=ON option. That installed result was then tested (with an ordinary epa_build of plplot_lite). Good results were obtained for a build and install of PLplot, and the test_diff_psc target in the build tree generated good results for Java, Python, Octave, and Lua (our 4 swig-generated bindings). ------------------------------------------------------------------------ r12939 | airwin | 2014-01-14 18:07:27 -0800 (Tue, 14 Jan 2014) | 13 lines Changed paths: A /trunk/cmake/epa_build/swig/octave-3.8.0.patch Commit patch to update swig octave support to version 3.8.0. This patch was implemented by the swig developer, Karl Wette, for the pending release of swig-3.0.0. It was obtained using wget https://github.com/swig/swig/commit/5b167cc12daf9ea275c17fedaefc975450613ab2.patch and modified by commenting out the first file which is an update to the swig-3.0.0 changelog. After that change, this swig-3.0.0 patch does apply cleanly to swig 2.0.11, but has not been tested beyond that yet for that version of swig. ------------------------------------------------------------------------ r12938 | airwin | 2014-01-12 19:27:10 -0800 (Sun, 12 Jan 2014) | 7 lines Changed paths: M /trunk/bindings/python/plplot_widgetmodule.c M /trunk/bindings/tk/tcpip.c M /trunk/plplot_config.h.in For C source code replace use of the ENABLE_tk macro (defined only if the CMake variable ENABLE_tk is true) by the more specifice ENABLE_tkX macro (only defined if the CMake variables ENABLE_tk and X11_FOUND are true). The reason for the change is both tcpip.c and plplot_widgetmodule.c are only viable if X is available. ------------------------------------------------------------------------ r12937 | airwin | 2014-01-12 19:22:38 -0800 (Sun, 12 Jan 2014) | 12 lines Changed paths: M /trunk/bindings/tcl/pkgIndex.tcl.in Update the TEA-based approach for accessing Pltcl under tclsh on Windows platforms. I have dropped the old Windows method which was completely broken and replaced it with a method which slightly adapts the Unix way of accessing PLtcl by using the known different locations for the dll's in the Windows case. Tested by Alan W. Irwin on MinGW/MSYS/Wine by running the tclsh demo given by examples/tcl/README.tcldemos by hand for a few examples and also by running the test_tclsh_standard_examples target. ------------------------------------------------------------------------ r12936 | airwin | 2014-01-12 19:13:30 -0800 (Sun, 12 Jan 2014) | 3 lines Changed paths: M /trunk/examples/CMakeLists.txt Choose ntk (if available) over wingcc as the device used for generic interactive tests on Windows. ------------------------------------------------------------------------ r12935 | airwin | 2014-01-12 19:11:05 -0800 (Sun, 12 Jan 2014) | 2 lines Changed paths: M /trunk/cmake/epa_build/setup/setup_mingw_msys_wine_toolchain Give access to version 3 of the Itcl and Itk libraries on MinGW/MSYS. ------------------------------------------------------------------------ r12934 | airwin | 2014-01-11 19:12:25 -0800 (Sat, 11 Jan 2014) | 23 lines Changed paths: M /trunk/bindings/python/CMakeLists.txt M /trunk/bindings/tcl/CMakeLists.txt M /trunk/bindings/tk/CMakeLists.txt M /trunk/cmake/modules/tcl-related.cmake M /trunk/cmake/modules/tk.cmake M /trunk/examples/CMakeLists.txt M /trunk/examples/plplot_configure.cmake_installed_examples.in M /trunk/examples/python/CMakeLists.txt M /trunk/examples/tcl/tclsh_standard_examples.in M /trunk/examples/tk/CMakeLists.txt M /trunk/examples/tk/CMakeLists.txt_installed_examples_tk M /trunk/plplot_test/plplot-test-interactive.sh.in Define and use ENABLE_tkX and ENABLE_itkX to help distingush cases where X is present or not along with Tk and Itk. Define and use generic_interactive_device, the device that is to be used with generic interactive tests. Normally, this device is xwin on Unix (with X) and wingcc on Windows (without X), but for the test case where X has not been found on Unix, it is ntk. Tested by Alan W. Irwin on Linux where the find for X11 was temporarily commented out so nothing X related was defined, and the build-system logic normally used for the Windows case could be tested (but with ntk as the generic interactive device). ldd -r and nm --undefined-only showed no issues for -dev ntk, the plplottcltk library, and the pltcl executable. The test_pltcl_standard_examples and test_tclsh_standard_examples targets completed without issues (after the ntk cmd array overflow bug found by example 27 was fixed). Note all these tests were in the build tree for the shared library/dynamic devices case so additional more comprehensive testing of these widespread changes with scripts/comprehensive_test.sh is recommended in the long term. ------------------------------------------------------------------------ r12933 | airwin | 2014-01-11 18:53:54 -0800 (Sat, 11 Jan 2014) | 2 lines Changed paths: M /trunk/bindings/tk/pltkd.h M /trunk/bindings/tk/tcpip.c Fix build errors on MinGW. ------------------------------------------------------------------------ r12932 | airwin | 2014-01-11 18:18:40 -0800 (Sat, 11 Jan 2014) | 2 lines Changed paths: M /trunk/drivers/ntk.c Get rid of debugging "flush" output to stderr. ------------------------------------------------------------------------ r12931 | airwin | 2014-01-11 18:14:07 -0800 (Sat, 11 Jan 2014) | 2 lines Changed paths: M /trunk/drivers/ntk.c Fix overflowed cmd buffer caused by example 27. ------------------------------------------------------------------------ r12930 | airwin | 2014-01-10 12:05:57 -0800 (Fri, 10 Jan 2014) | 11 lines Changed paths: M /trunk/bindings/tk/PLWin.itk Follow the directions in bindings/tcl/plitclgen to run that perl script in the bindings/tcl directory and replace the methods listed near the end of bindings/tk/PLWin.itk with the gen.itcl results that are generated by plitclgen. It has been many years since this was done before so the effect of all this is a fairly large number of additions to the methods listed in PLWin.itk (because the PLplot API has expanded) and the removal of a few methods that are no longer a part of the PLplot API. ------------------------------------------------------------------------ r12929 | airwin | 2014-01-09 23:43:02 -0800 (Thu, 09 Jan 2014) | 13 lines Changed paths: M /trunk/cmake/modules/tcl-related.cmake Improve the reliability of determining the Tcl and Tk library version numbers by only version parsing the library name rather the full path of the library name. This change solved a bug where the library version was being parsed from the wine (!) version number that I happened to be using in my build tree prefix to keep track of various results for various wine versions. Add some additional names (with a compact numeric suffix and with no numerical suffix at all) to search for the itcl and itk libraries. This change solved a bug where epa_build creates itcl and itk libraries with compact numerical suffixes on the MinGW/MSYS platform. ------------------------------------------------------------------------ r12928 | airwin | 2014-01-09 17:45:35 -0800 (Thu, 09 Jan 2014) | 2 lines Changed paths: M /trunk/bindings/tcl/CMakeLists.txt Only link the pltcl executable to libitcl when appropriate. ------------------------------------------------------------------------ r12927 | airwin | 2014-01-09 17:44:07 -0800 (Thu, 09 Jan 2014) | 4 lines Changed paths: M /trunk/cmake/modules/tcl-related.cmake Move setup of RPATH directory lists to better locations in the logic where there has been complete success at finding the associated Tcl extension package. ------------------------------------------------------------------------ r12926 | airwin | 2014-01-09 13:38:57 -0800 (Thu, 09 Jan 2014) | 10 lines Changed paths: M /trunk/cmake/epa_build/itk3/CMakeLists.txt A /trunk/cmake/epa_build/itk3/autotools_backport.patch Backport itk version 4 autotools build-system changes to itk version 3 to fix internal error in the autotools-generated configure script that occurs otherwise for the epa_build of itk3 on the MinGW/MSYS platform. Tested by: Alan W. Irwin on both Linux and MinGW/MSYS/Wine platforms using the epa_build -DBUILD_THE_BUILDTOOLS=ON cmake option and by running the resulting build_itk3 target. ------------------------------------------------------------------------ r12925 | airwin | 2014-01-07 12:57:43 -0800 (Tue, 07 Jan 2014) | 15 lines Changed paths: M /trunk/cmake/epa_build/itk/CMakeLists.txt A /trunk/cmake/epa_build/itk/autoreconf.patch Update epa_build configuration so that itk (version 4.0.0) successfully builds on MinGW/MSYS. N.B. A patch corresponding to running "autoreconf -i" on Linux has been applied rather than just running "autoreconf -i" on all platforms because autoreconf is broken on MSYS. Note, this patch is not really necessary for itk because the resulting changes to the configure script are so small they don't make a practical difference. However, I wanted to pioneer applying "autoreconf -i" this way since configure.in for itk4 is not that different than for itk3, and the equivalent patch for the itk3 case might make such a large change in the itk3 configure script that it solves the internal error for that script that is current stopping the itk3 epa_build. ------------------------------------------------------------------------ r12924 | airwin | 2014-01-06 13:18:18 -0800 (Mon, 06 Jan 2014) | 8 lines Changed paths: M /trunk/cmake/epa_build/README Replace references to the "make" command by ${BUILD_COMMAND} (now implemented by the setup files for each appropriate CMake generator for maximum generality. Other changes (such as the reference to the now working "MinGW Makefiles" generator) to bring this documention up to date. ------------------------------------------------------------------------ r12923 | airwin | 2014-01-06 12:51:38 -0800 (Mon, 06 Jan 2014) | 8 lines Changed paths: M /trunk/cmake/epa_build/setup/setup_linux_makefiles M /trunk/cmake/epa_build/setup/setup_mingw_makefiles M /trunk/cmake/epa_build/setup/setup_msys_makefiles Implement the BUILD_COMMAND variable which is a variable that contains the name of the correct build command for the generator. Drop MAKE_COMMAND if it has been implemented. I prefer the variable name BUILD_COMMAND instead because some generators (e.g., ninja) use a build command that has nothing to do with make. ------------------------------------------------------------------------ r12922 | airwin | 2014-01-06 12:41:54 -0800 (Mon, 06 Jan 2014) | 2 lines Changed paths: D /trunk/cmake/epa_build/setup/setup_linux A /trunk/cmake/epa_build/setup/setup_linux_makefiles (from /trunk/cmake/epa_build/setup/setup_linux:12912) Rename setup_linux ==> setup_linux_makefiles ------------------------------------------------------------------------ r12921 | arjenmarkus | 2014-01-06 01:35:54 -0800 (Mon, 06 Jan 2014) | 2 lines Changed paths: M /trunk/bindings/tcl/README.tclAPI Updating information on the generation of the Tcl API. Just a minor update ------------------------------------------------------------------------ r12920 | airwin | 2014-01-05 15:04:10 -0800 (Sun, 05 Jan 2014) | 2 lines Changed paths: M /trunk/cmake/epa_build/itcl3/CMakeLists.txt Update epa_build configuration of itcl3 so that it works on MinGW/MSYS. ------------------------------------------------------------------------ r12919 | airwin | 2014-01-05 12:14:19 -0800 (Sun, 05 Jan 2014) | 10 lines Changed paths: M /trunk/cmake/epa_build/tk/CMakeLists.txt Update the epa_build configuration of tk so that it works on MinGW/MSYS. Tested by: Alan W. Irwin on MinGW/MSYS/Wine-1.6.1 for the epa_build project with -DBUILD_THE_BUILDTOOLS=ON using the build_tk target. N.B. this test shows that Tk builds without issues on MinGW/MSYS against the installed Tcl epa_build result, but the test does not include run-time testing. ------------------------------------------------------------------------ r12918 | airwin | 2014-01-04 22:47:16 -0800 (Sat, 04 Jan 2014) | 2 lines Changed paths: M /trunk/cmake/epa_build/tcl/CMakeLists.txt Update tcl epa_build configuration so that it works on MinGW/MSYS. ------------------------------------------------------------------------ r12917 | airwin | 2014-01-04 14:38:22 -0800 (Sat, 04 Jan 2014) | 6 lines Changed paths: A /trunk/cmake/epa_build/setup/setup_mingw_makefiles M /trunk/cmake/epa_build/setup/setup_msys_makefiles Add a setup for the "MinGW Makefiles" generator case. Add the MAKE_COMMAND environment variable for the "MSYS Makefiles" generator case. ------------------------------------------------------------------------ r12916 | airwin | 2013-12-31 10:06:30 -0800 (Tue, 31 Dec 2013) | 2 lines Changed paths: M /trunk/www/index.php Replace "Fortran 77/90" ==> "Fortran 95". ------------------------------------------------------------------------ r12915 | airwin | 2013-12-31 09:39:32 -0800 (Tue, 31 Dec 2013) | 2 lines Changed paths: M /trunk/INSTALL Replace g77 by gfortran in build instructions. ------------------------------------------------------------------------ r12914 | airwin | 2013-12-29 12:11:07 -0800 (Sun, 29 Dec 2013) | 15 lines Changed paths: M /trunk/CMakeLists.txt D /trunk/config.h.in M /trunk/doc/CMakeLists.txt M /trunk/doc/Doxyfile.in M /trunk/drivers/plplotcanvas-hacktext.c M /trunk/include/plConfig.h.in A /trunk/plplot_config.h.in (from /trunk/config.h.in:12912) M /trunk/scripts/style_source.sh Rename config.h to plplot_config.h to avoid name clashes with other projects (such as octave) which have headers named config.h. This change was comprehensive involving all files found by the following command: find . -type f |grep -v .svn |xargs grep config\\.h |grep -v epa_build \ |grep -vi changelog |grep -v plplot_config\\.h Tested by: Alan W. Irwin on Linux using scripts/make_tarball.sh -c -i /tmp/plplot_install find /tmp/plplot* -name "*.out" |xargs grep -i error ------------------------------------------------------------------------ r12913 | airwin | 2013-12-28 18:13:54 -0800 (Sat, 28 Dec 2013) | 24 lines Changed paths: M /trunk/cmake/modules/tcl-related.cmake Check Tcl/Tk version consistency by implementing the following: * Determine Tcl version from tclsh * Determine Tcl version from library name (if that is possible) and WARN if it is not consistent with Tcl version from tclsh. * Determine Tk version from wish and confirm it is the same as the Tcl version from tclsh or else disable Tk. * Determine Tcl version from wish and confirm it is the same as the Tcl version from tclsh or else disable Tk. * Determine Tk version from tclsh and confirm it is the same as the Tk version from wish or else disable Tk. * Determine Tk version from library name (if that is possible) and confirm consistent with Tcl version from tclsh or else disable Tk. Tested by: Alan W. Irwin using various runs of cmake with wrong results locally imposed to test all the WARNING logic. ------------------------------------------------------------------------ r12912 | airwin | 2013-12-22 14:35:13 -0800 (Sun, 22 Dec 2013) | 2 lines Changed paths: M /trunk/README.release Prepare release notes for the current (5.10.0) stable release cycle. ------------------------------------------------------------------------ r12911 | airwin | 2013-12-22 14:28:45 -0800 (Sun, 22 Dec 2013) | 3 lines Changed paths: M /trunk/OLD-README.release Preserve the historical record of the 5.9.11 release notes by prepending into OLD-README.release. ------------------------------------------------------------------------ r12910 | airwin | 2013-12-22 14:26:29 -0800 (Sun, 22 Dec 2013) | 3 lines Changed paths: M /trunk/README.Release_Manager_Cookbook Tweak directions slightly for the changes I made in the procedure at the last minute before release. ------------------------------------------------------------------------ r12908 | airwin | 2013-12-22 12:17:24 -0800 (Sun, 22 Dec 2013) | 2 lines Changed paths: M /trunk/ChangeLog.release Commit ChangeLog for the duration of the 5.9.11 release cycle. ------------------------------------------------------------------------ r12907 | airwin | 2013-12-22 12:15:07 -0800 (Sun, 22 Dec 2013) | 2 lines Changed paths: M /trunk/README.Release_Manager_Cookbook Update cookbook of release instructions to what was done for 5.9.11. ------------------------------------------------------------------------ plplot-5.10.0+dfsg/README.release 644 1750 1750 4111612276715527 152700ustar andrewandrewPLplot Release 5.10.0 ~~~~~~~~~~~~~~~~~~~~ This is a release of the PLplot plotting package. It represents the ongoing best efforts of the PLplot community to improve this package, and it is the only version of PLplot that we attempt to support. Releases in the 5.x.y series should be available several times per year. If you encounter a problem that is not already documented in the PROBLEMS file or on our bug tracker, then please send bug reports to PLplot developers via the mailing lists at (preferred for initial discussion of issues) and, if no quick resolution is possible, then the issue should be placed on our bug tracker at . Please see the license under which this software is distributed (LGPL), and the disclaimer of all warranties, given in the COPYING.LIB file. INDEX 1. OFFICIAL NOTICES FOR USERS 2. Changes relative to the previous release 3. Tests made for the current release 4. Tests made for the prior release 1. OFFICIAL NOTICES FOR USERS The distinction we made prior to 5.10.0 between stable and development releases was essentially completely artificial and has now been dropped. In each case, the latest release was "stable" in the sense that it was the PLplot team's best effort with substantial testing on the computer platforms available to our test team. And that tradition continues for the release of 5.10.0. Note we have bumped the minor number in this release triplet compared to the previous 5.9.11 release because from now on we want to reserve the patch number in that triplet only for those (rare) releases that contain emergency fixes compared to the previous release. Note especially that 5.10.0 is not that different from the prior release 5.9.11, and we don't ordinarily require such emergency releases so our forthcoming release numbers are likely to be 5.11.0, 5.12.0, etc. 2. Changes relative to the previous release 2.1 Update the parts of the build system that find Tcl-related software. The build system now checks extensively for the consistency of the Tcl/Tk/Itcl/Itk/Iwidgets components that are found. 2.2 Update the Tcl-related epa_build configurations. The epa_build subproject of PLplot design goal is to make it easy to build PLplot dependencies on all platforms. Previously version 8.6 of Tcl/Tk and version 3 of Itcl/Itk, version 4 of Itcl/Itk, and versions 4.0 and 4.1 of Iwidgets could be epa_built on Linux, but now the epa_build configuration files have been updated so these builds also succeed on MinGW/MSYS. 2.3 Update the PLplot build system so that the Tcl/Tk/Itcl/Itk/Iwidgets bindings and examples work on MinGW/MSYS. 2.4 Make many minor build-system fixes so that comprehensive tests (see test summaries below) finally work almost completely on MinGW/MSYS. 2.5 Update api.xml to be consistent with our public API defined by plplot.h. This substantial improvement to our DocBook documentation for our public API has been made possible by the "check" application written by Hǎiliàng Wáng (see https://github.com/hailiang/go-plplot/tree/master/c/check) which uses gccxml to convert the API information in plplot.h into XML and compares those results (names of functions in our public API, and for each of those functions, number of arguments, names of arguments, and types of arguments) with the corresponding information in api.xml. The original report from the check_api_xml_consistency target (which runs the check programme) showed ~150 inconsistencies between api.xml and our public API including several functions in our public API that were not documented at all in api.xml. That number of inconsistencies has now been reduced to zero which constitutes a substantial upgrade in the quality of our API documentation. 3. Tests made for the current release. The "comprehensive tests" below refers to running scripts/comprehensive_test.sh in default mode (i.e., not dropping any tests). For each of our three major configurations (shared libraries/dynamic devices, shared libraries/nondynamic devices, and static libraries/nondynamic devices) this test script runs ctest in the build tree and runs the test_noninteractive and test_interactive targets in the build tree, the installed examples tree configured with a CMake-based build system for the examples, and an installed examples tree configured with our traditional (Make + pkg-config) build system for the examples. Testers can run that script directly or there are convenient options called -DCOMPREHENSIVE_PLPLOT_TEST_INTERACTIVE=ON and -DCOMPREHENSIVE_PLPLOT_TEST_NONINTERACTIVE=ON for epa_build (see cmake/epa_build/README) that automatically runs that script for the build_plplot_lite case (The cairo, qt, and wxwidgets device drivers are dropped) or the usual build_plplot case (no components of PLplot dropped) for either/both the interactive and noninteractive subsets of the tests. Note that all tests mentioned below were successful ones unless noted differently. * Alan W. Irwin ran both interactive and noninteractive comprehensive tests via epa_build of plplot (as opposed to plplot_lite) on a 64-bit Debian Wheezy Linux platform on AMD-64 hardware. That system has virtually every relevant PLplot dependency either epa_built or system-installed. So these tests are virtually complete test of all aspects of PLplot. * Alan W. Irwin ran both interactive and noninteractive comprehensive tests via epa_build of plplot_lite (as opposed to plplot) on a 64-bit Debian Wheezy Linux platform on AMD-64 hardware. These tests show that the remaining components of PLplot work well when some important components (i.e., cairo, qt, and wxwidgets device drivers) are dropped. * Alan W. Irwin ran both interactive and noninteractive comprehensive tests of plplot_lite on 32-bit MinGW/MSYS/Wine for AMD-64 hardware. (This test is only for plplot_lite since currently some of the additional dependencies of plplot do not build on MinGW/MSYS/Wine. It is not clear whether this is due to a Wine issue or an epa_build configuration issue for MinGW/MSYS.) The language bindings and examples tested were ada, c, c++, f95, lua, python, tcl, tk, itcl, itk. and iwidgets. The device drivers tested were ntk, pdf, ps, svg, wingcc, and xfig. So this test is less complete than the equivalent Linux test above due to lack of PLplot dependencies on MinGW/MSYS. But the epa_build project has already closed some of that dependency gap for this platform (e.g., by providing builds of pkg-config, swig, libagg, libharu, shapelib, libqhull, and everything Tcl-related), and it is hoped it will close even more of that dependency gap in the future. The Wine version for this test was 1.6.1 which was built on Debian Wheezy; the compiler was (MinGW) gcc-4.7.2; the Windows binary version of CMake was downloaded from Kitware and was version 2.8.12.1; the CMake generator was "MSYS Makefiles"; and the build command was "make" (i.e., the MSYS version, not the MinGW version). The above noninteractive comprehensive tests finished without issues. In contrast the interactive comprehensive tests failed. In particular, all interactive tests for the shared library/dynamic devices case for the build tree succeeded except for the test_pltcl_standard_examples target which failed close to Tcl exit from that particular test. This failure near Tcl exit is similar to the Tcl exit issue reported at http://sourceforge.net/p/plplot/bugs/139/. Because of this test failure, the remaining configurations are untested on MinGW/MSYS/Wine for the interactive case. * Arjen Markus was unable to confirm the good noninteractive test results obtained above for MinGW/MSYS using his Windows platform consisting of MinGW-4.8.1 and MSYS on 64-bit Windows 7, service pack 1 for AMD-64 hardware. The long-standing MSYS bug for parallel builds was worked around by using the epa_build -DNUMBER_PARALLEL_JOBS:STRING=1 cmake option. The build failure occurred with an "undefined reference to `tclStubsPtr'" that occurred during the course of the Itk epa_build. It is not clear at this point if his setup of epa_build (creating appropriate values for the INSTALL_PREFIX EPA_BUILD_SOURCE_PATH CFLAGS CXXFLAGS FFLAGS CMAKE_INCLUDE_PATH CMAKE_LIBRARY_PATH PATH PKG_CONFIG_PATH BUILD_COMMAND GENERATOR_STRING environment variables) or MinGW-4.8.1 (as opposed to MinGW-4.7.2 used in the above successful test), or some other issue is causing failure of the Itk build on this platform. 4. Tests made for the prior release To remind the test team of the tests that were run for the last release (5.9.11) here are the complete notes on those tests from the previous release announcement. Note that "comprehensive tests" below refers to running scripts/comprehensive_test.sh in default mode (i.e., not dropping any tests). For each of our three major configurations (shared libraries/dynamic devices, shared libraries/nondynamic devices, and static libraries/nondynamic devices) this test script runs ctest in the build tree and runs the test_noninteractive and test_interactive targets in the build tree, the installed examples tree configured with a CMake-based build system for the examples, and an installed examples tree configured with our traditional (Make + pkg-config) build system for the examples. Note that all tests mentioned below were successful ones unless noted differently. * Alan W. Irwin ran comprehensive tests for a complete system build environment on 64-bit Debian Wheezy Linux for AMD-64 hardware. * Alan W. Irwin ran comprehensive tests for a limited (qt, cairo, wxwidgets, and octave PLplot components were dropped) epa_build environment on 64-bit Debian Wheezy Linux for AMD-64 hardware. * Alan W. Irwin ran comprehensive tests for an almost complete epa_build environment (only the wxwidgets and octave components of PLplot were dropped) on 64-bit Debian Wheezy Linux for AMD-64 hardware. * Alan W. Irwin ran fairly comprehensive tests (i.e, for the shared library/dynamic devices case run ctest and also the test_noninteractive and test_interactive targets in the build tree) for a quite limited (qt, cairo, wxwidgets, octave, Tcl/Tk, and Java PLplot components were dropped) epa_build environment for 32-bit MinGW/MSYS/Wine for AMD-64 hardware. The Wine version was a release candidate for Wine-1.6 that was built on Debian Wheezy Linux, the compiler was gcc-4.7.2, the CMake generator was "MSYS Makefiles", and the build command was "make" (i.e., the MSYS version, not the MinGW version). An attempt was made to extend this successful test result to the installed examples built with the CMake-based build system, but for that case the Ada examples all failed at run time with a return code of 3 so no further attempt was made to widen the scope of these MinGW/MSYS/Wine tests. * Andrew Ross ran fairly comprehensive tests (i.e., for the shared library/dynamic devices case use the test_noninteractive and test_interactive targets in the build tree) for a complete system build environment on 64-bit Debian unstable Linux for AMD-64 hardware. * Andrew Ross ran comprehensive tests for a complete system build environment on 64-bit Ubuntu Saucy (13.10) Linux for AMD-64 hardware. The only issue was a segmentation fault on the c++ qt_example for the nondynamic devices case only. This is reproducible on this system, but not on other Linux platforms so may be specific to the Ubuntu version of the Qt libraries. This is unlikely to affect most users since the default is to use dynamically loaded devices. * Andrew Ross ran limited tests with a limited number of nondynamic devices (mem, null, psc, svg, xfig, xwin) and limited language bindings (C / C++ / F95) for a CentOS 5.10 system with AMD64 hardware. The build passed "make test_diff psc". The java version was too old and java support had to be disabled. Ada support had to be disabled due to a bug (now fixed). Cairo support also had to be disabled due to too old a version of the library being installed. * Andrew Ross ran limited tests for an epa_build environment on CentOS 5.10. The buildtools and plplot_lite targets were built (with nondynamic devices), again after disabling java, ada and cairo support. This build added support for tcl / tk bindings and the pdf and tk based devices. The build passed make test_noninteractive in the install tree, but failed make test_interactive due to missing rpath information for the itcl and itk libraries. This bug can be worked around by setting LD_LIBRARY_PATH to point to the libraries, in which case the interactive test works fine. * Arjen Markus ran a fairly comprehensive test (i.e., for the shared library/dynamic devices case use the test_noninteractive target) for a incomplete system build environment (the Ada, D, itcl/itk, Lua, ocaml, octave, Java, and wxwidgets components of PLplot were dropped) on 64-bit Cygwin with gcc-4.8.2. That platform was installed on top of 64-bit Windows 7, service pack 1 for AMD-64 hardware. Java and wxwidgets were dropped because of build errors for those on Cygwin that have not been resolved yet. The remaining components were dropped due to lack of time to investigate them so far. There was close to complete success with the qt and cairo (aside from wincairo) device drivers which is an excellent Windows result since those device drivers add a lot of important capability to PLplot. * Arjen Markus ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the shared libraries/dynamic devices case for a limited build environment (the qt, cairo, wxwidgets, pdf and the components mentioned above of PLplot were dropped except for Java which was included in this test) on 32-bit MinGW. That platform was installed on top of 64-bit Windows 7, service pack 1 for AMD-64 hardware. The compiler was gcc-4.7.0, the CMake generator was "MinGW Makefiles", and the build command was mingw32-make. * Arjen Markus ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the shared libraries/dynamic devices case for a limited build environment (the same limitations as for his MinGW tests above) for MSVC/C++ 2010 and Intel Fortran 2011 compilers on 64-bit Windows 7, service pack 1 for AMD-64 hardware. In general, the CMake generator "NMake Makefiles" and the corresponding build command "nmake" worked well for this platform. The attempted use of Visual Studio generators combined with the Visual Studio 2010 IDE available on that platform was more problematic. * Phil Rosenberg ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the static libraries/nondynamic devices case for a limited build environment (virtually all PLplot components dropped other than C, C++ and wxwidgets 2.8) for the Visual Studio 2008 IDE (with associated MSVC compiler) on 32-bit Windows 7 for AMD-64 hardware. The "Visual Studio 9 2008" generator yielded good results. * Phil Rosenberg ran build tests and limited run-time tests (checking by hand that some components of PLplot worked) for the static libraries/nondynamic devices case for a limited build environment (virtually all PLplot components dropped other than C, CXX, and wxwidgets 3.0) for the Visual Studio 2012 IDE (with associated MSVC compiler) on Windows 8 for AMD-64 hardware. Both x86 and x64 builds were tested. The combination of "NMake Makefiles" generator and MSVC compiler yielded good build results if CMake patches (available at http://www.cmake.org/Bug/view.php?id=14587 and http://www.cmake.org/Bug/view.php?id=14642) to allow use of wxwidgets-3.0 were applied. With those patches some run-time problems with the use of Plplot's wxWidgetsApp with wxWidgets 3.0 were observed in the examples, however plots embedded in wxWidgets apps seem to work fine. The "Visual Studio 11" and "Visual Studio 11 Win64" generators had some additional issues which could be worked around but which nevertheless indicated there are some CMake bugs for those generators that need to be addressed. * Jerry Bauck ran build tests of PLplot for the C core library, the Ada, C++, Java, Lua, and Python bindings, and a fairly complete list of device drivers (including qt and cairo) for PLplot on Mac OS X Mountain Lion for AMD64 hardware. Extremely narrow run-time tests of the Ada examples were a success, but all the standard testing scripts failed because for unknown reasons the lena.pgm file that is used in conjunction with our standard example 20 was not properly copied by our build and test system from the source tree to the correct locations in the build tree. * Felipe Gonzalez ran build tests of PLplot for the C core library and the C++, Fortran 95, and OCaml-4.01.0 bindings on Mac OS X Mountain Lion. The report from Felipe stated the compiler suite used was probably from MacPorts, and did not state anything about the hardware type. plplot-5.10.0+dfsg/drivers/ 775 1750 1750 012406243566 143405ustar andrewandrewplplot-5.10.0+dfsg/drivers/mem.c 644 1750 1750 1237011652522446 153620ustar andrewandrew// // $Id: mem.c 12008 2011-10-28 12:50:46Z andrewross $ // // PLplot MEM (in user-supplied memory) device driver. // The idea here is that the user will specify the Y by X by RGB // area in which to plot using the plsmem function (added by me). // // This is a bare-bones driver which allows one to plot on an existing // image in memory. This is useful if the user has an image in memory // that he wants to decorate with PLPLOT. // // Contributed by Doug Hunt // Included in PLplot by Rafael Laboissiere on Sat Feb 22 18:34:06 CET 2003 // #include "plDevs.h" #ifdef PLD_mem #include "plplotP.h" #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_mem = "mem:User-supplied memory device:-1:mem:46:mem\n"; void plD_dispatch_init_mem( PLDispatchTable *pdt ); void plD_init_mem( PLStream * ); void plD_line_mem( PLStream *, short, short, short, short ); void plD_polyline_mem( PLStream *, short *, short *, PLINT ); void plD_eop_mem( PLStream * ); void plD_bop_mem( PLStream * ); void plD_tidy_mem( PLStream * ); void plD_state_mem( PLStream *, PLINT ); void plD_esc_mem( PLStream *, PLINT, void * ); #undef MAX #undef ABS #define MAX( a, b ) ( ( a > b ) ? a : b ) #define ABS( a ) ( ( a < 0 ) ? -a : a ) #define MAX_INTENSITY 255 void plD_dispatch_init_mem( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "User-supplied memory device"; pdt->pl_DevName = "mem"; #endif pdt->pl_type = plDevType_Null; pdt->pl_seq = 45; pdt->pl_init = (plD_init_fp) plD_init_mem; pdt->pl_line = (plD_line_fp) plD_line_mem; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_mem; pdt->pl_eop = (plD_eop_fp) plD_eop_mem; pdt->pl_bop = (plD_bop_fp) plD_bop_mem; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_mem; pdt->pl_state = (plD_state_fp) plD_state_mem; pdt->pl_esc = (plD_esc_fp) plD_esc_mem; } //-------------------------------------------------------------------------- // plD_init_mem() // // Initialize device (terminal). //-------------------------------------------------------------------------- void plD_init_mem( PLStream *pls ) { // plsmem must have already been called to set pls->dev to the // user supplied plotting area. The dimensions of the plot area // have also been set by plsmem. Verify this. // if ( ( pls->phyxma == 0 ) || ( pls->dev == NULL ) ) { plexit( "Must call plsmem first to set user plotting area!" ); } if ( pls->dev_mem_alpha == 1 ) { plexit( "The mem driver does not support alpha values! Use plsmem!" ); } plP_setpxl( (PLFLT) 4, (PLFLT) 4 ); // rough pixels/mm on *my* screen pls->color = 1; // Is a color device pls->dev_fill0 = 0; // Handle solid fills pls->dev_fill1 = 0; // Use PLplot core fallback for pattern fills pls->nopause = 1; // Don't pause between frames } #define sign( a ) ( ( a < 0 ) ? -1 : ( ( a == 0 ) ? 0 : 1 ) ) // Modified version of the ljii routine (see ljii.c) void plD_line_mem( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { int i; PLINT idx; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; PLINT x1b, y1b, x2b, y2b; PLFLT length, fx, fy, dx, dy; unsigned char *mem = (unsigned char *) pls->dev; PLINT xm = pls->phyxma; PLINT ym = pls->phyyma; // Take mirror image, since (0,0) must be at top left y1 = ym - ( y1 - 0 ); y2 = ym - ( y2 - 0 ); x1b = x1, x2b = x2, y1b = y1, y2b = y2; length = (PLFLT) sqrt( (double) ( ( x2b - x1b ) * ( x2b - x1b ) + ( y2b - y1b ) * ( y2b - y1b ) ) ); if ( length == 0. ) length = 1.; dx = ( x2 - x1 ) / length; dy = ( y2 - y1 ) / length; fx = x1; fy = y1; mem[3 * xm * y1 + 3 * x1 + 0] = pls->curcolor.r; mem[3 * xm * y1 + 3 * x1 + 1] = pls->curcolor.g; mem[3 * xm * y1 + 3 * x1 + 2] = pls->curcolor.b; mem[3 * xm * y2 + 3 * x2 + 0] = pls->curcolor.r; mem[3 * xm * y2 + 3 * x2 + 1] = pls->curcolor.g; mem[3 * xm * y2 + 3 * x2 + 2] = pls->curcolor.b; for ( i = 1; i <= (int) length; i++ ) { fx += dx; fy += dy; idx = 3 * xm * (PLINT) fy + 3 * (PLINT) fx; mem[idx + 0] = pls->curcolor.r; mem[idx + 1] = pls->curcolor.g; mem[idx + 2] = pls->curcolor.b; } } void plD_polyline_mem( PLStream *pls, short *xa, short *ya, PLINT npts ) { int i; for ( i = 0; i < npts - 1; i++ ) plD_line_mem( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } void plD_eop_mem( PLStream *pls ) { // Set the 'dev' member (which holds the user supplied memory image) // to NULL here so it won't be freed when PLplot is closed. // (the user is responsible for freeing it when ready). // pls->dev = NULL; } void plD_bop_mem( PLStream * PL_UNUSED( pls ) ) { // Nothing to do here } void plD_tidy_mem( PLStream * PL_UNUSED( pls ) ) { // Nothing to do here } void plD_state_mem( PLStream * PL_UNUSED( pls ), PLINT PL_UNUSED( op ) ) { // Nothing to do here } void plD_esc_mem( PLStream *PL_UNUSED( pls ), PLINT PL_UNUSED( op ), void * PL_UNUSED( ptr ) ) { // Nothing to do here } #endif // PLD_mem plplot-5.10.0+dfsg/drivers/cairo.driver_info.in 644 1750 1750 70512052242615 203210ustar andrewandrewxcairo:Cairo X Windows Driver:1:cairo:100:xcairo pdfcairo:Cairo PDF Driver:0:cairo:101:pdfcairo pscairo:Cairo PS Driver:0:cairo:102:pscairo epscairo:Cairo EPS Driver:0:cairo:103:epscairo svgcairo:Cairo SVG Driver:0:cairo:104:svgcairo pngcairo:Cairo PNG Driver:0:cairo:105:pngcairo memcairo:Cairo Memory Driver:0:cairo:106:memcairo extcairo:Cairo External Context Driver:0:cairo:107:extcairo wincairo:Cairo Microscoft Windows Driver:0:cairo:108:wincairo plplot-5.10.0+dfsg/drivers/wxwidgets_app.cpp 644 1750 1750 10007311652524323 200430ustar andrewandrew// $Id: wxwidgets_app.cpp 12009 2011-10-28 13:06:27Z andrewross $ // // Copyright (C) 2008 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // TODO: // - Add dialog to get width and height from user for plot size to save. // // wxwidgets headers #include "wx/wx.h" #include "plDevs.h" #ifdef PLD_wxwidgets // plplot headers #include "plplotP.h" #include "drivers.h" #include "plevent.h" // std and driver headers #include "wxwidgets.h" // Application icon as XPM // This free icon was taken from http://2pt3.com/news/twotone-icons-for-free/ static const char *graph[] = { // columns rows colors chars-per-pixel "16 16 4 2", " c black", ". c #BA1825", "X c gray100", "UX c None", // pixels "UX. . . . . . . . . . . . . . UX", ". . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . ", ". . . . . . . . . . . X X . . . ", ". . . . . . . . . . . X X . . . ", ". . . . . . . . . . . X X . . . ", ". . . . . X X . . . . X X . . . ", ". . . . . X X . . . . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . . . X X . X X . X X . . . ", ". . . X X X X X X X X X X . . . ", ". . . . . . . . . . . . . . . . ", ". . . . . . . . . . . . . . . . ", "UX. . . . . . . . . . . . . . UX" }; struct dev_entry dev_entries[] = { { wxT( "wxbmp" ), wxT( "bmp (wx)..." ), wxT( "Save this plot as bmp!" ), wxT( "bmp files (*.bmp)|*.bmp" ), true }, { wxT( "wxpng" ), wxT( "png (wx)..." ), wxT( "Save this plot as png" ), wxT( "png files (*.png)|*.png" ), true }, { wxT( "wxpcx" ), wxT( "pcx (wx)..." ), wxT( "Save this plot as pcx!" ), wxT( "pcx files (*.pcx)|*.pcx" ), true }, { wxT( "wxjpeg" ), wxT( "jpeg (wx)..." ), wxT( "Save this plot as jpeg!" ), wxT( "jpg files (*.jpg;*.jpeg)|*.jpg;*.jpeg" ), true }, { wxT( "wxtiff" ), wxT( "tiff (wx)..." ), wxT( "Save this plot as tiff!" ), wxT( "tiff files (*.tif;*.tiff)|*.tif;*.tiff" ), true }, { wxT( "wxpnm" ), wxT( "pnm (wx)..." ), wxT( "Save this plot as pnm!" ), wxT( "pnm files (*.pnm)|*.pnm" ), true }, { wxT( "pngcairo" ), wxT( "png (cairo)..." ), wxT( "Save this plot as png using cairo!" ), wxT( "png files (*.png)|*.png" ), true }, { wxT( "pdfcairo" ), wxT( "pdf (cairo)..." ), wxT( "Save this plot as pdf using cairo!" ), wxT( "pdf files (*.pdf)|*.pdf" ), false }, { wxT( "ps" ), wxT( "postscript..." ), wxT( "Save this plot as postscript!" ), wxT( "ps files (*.ps)|*.ps" ), false }, { wxT( "psc" ), wxT( "color postscript..." ), wxT( "Save this plot as color postscript!" ), wxT( "ps files (*.ps;*.psc)|*.ps;*.psc" ), false }, { wxT( "pscairo" ), wxT( "color postscript (cairo)..." ), wxT( "Save this plot as color postscript using cairo!" ), wxT( "ps files (*.ps;*.psc)|*.ps;*.psc" ), false }, { wxT( "svg" ), wxT( "svg..." ), wxT( "Save this plot as svg!" ), wxT( "svg files (*.svg)|*.svg" ), false }, { wxT( "svgcairo" ), wxT( "svg (cairo)..." ), wxT( "Save this plot as svg using cairo!" ), wxT( "svg files (*.svg)|*.svg" ), false }, { wxT( "xfig" ), wxT( "xfig..." ), wxT( "Save this plot as xfig!" ), wxT( "fig files (*.fig)|*.fig" ), false } }; // Application implementation IMPLEMENT_PLAPP_NO_MAIN( wxPLplotApp ) // event table for the app BEGIN_EVENT_TABLE( wxPLplotApp, wxApp ) EVT_IDLE( wxPLplotApp::OnIdle ) END_EVENT_TABLE() // event table for frames BEGIN_EVENT_TABLE( wxPLplotFrame, wxFrame ) EVT_MENU( -1, wxPLplotFrame::OnMenu ) // handle all menu events EVT_CLOSE( wxPLplotFrame::OnClose ) END_EVENT_TABLE() // event table for the plot widget BEGIN_EVENT_TABLE( wxPLplotWindow, wxWindow ) EVT_PAINT( wxPLplotWindow::OnPaint ) // (re)draw the plot in window EVT_CHAR( wxPLplotWindow::OnChar ) EVT_IDLE( wxPLplotWindow::OnIdle ) EVT_MOUSE_EVENTS( wxPLplotWindow::OnMouse ) EVT_ERASE_BACKGROUND( wxPLplotWindow::OnErase ) EVT_SIZE( wxPLplotWindow::OnSize ) EVT_MAXIMIZE( wxPLplotWindow::OnMaximize ) END_EVENT_TABLE() // event table for the size dialog BEGIN_EVENT_TABLE( wxGetSizeDialog, wxDialog ) END_EVENT_TABLE() //-------------------------------------------------------------------------- // bool wxPLplotApp::OnInit() // // This method is called before the applications gets control. //-------------------------------------------------------------------------- bool wxPLplotApp::OnInit() { // Log_Verbose( "wxPLplotApp::OnInit" ); exit = false; advance = false; #if wxUSE_LIBPNG wxImage::AddHandler( new wxPNGHandler ); #endif #if wxUSE_LIBJPEG wxImage::AddHandler( new wxJPEGHandler ); #endif #if wxUSE_PCX wxImage::AddHandler( new wxPCXHandler ); #endif #if wxUSE_LIBTIFF wxImage::AddHandler( new wxTIFFHandler ); #endif #if wxUSE_PNM wxImage::AddHandler( new wxPNMHandler ); #endif return true; } //-------------------------------------------------------------------------- // void wxPLplotApp::SetRefreshFlag( bool flag ) // // XXX - missing //-------------------------------------------------------------------------- void wxPLplotApp::SetRefreshFlag( bool flag ) { // Log_Verbose( "wxPLplotApp::SetRefreshFlag" ); for ( size_t i = 0; i < FrameArray.GetCount(); i++ ) FrameArray[i]->SetRefreshFlag( flag ); } //-------------------------------------------------------------------------- // void wxPLplotApp::OnIdle( wxIdleEvent& WXUNUSED(event) ) // // XXX - missing //-------------------------------------------------------------------------- void wxPLplotApp::OnIdle( wxIdleEvent& WXUNUSED( event ) ) { // Log_Verbose( "wxPLplotApp::OnIdle" ); bool refresh = false; if ( exit ) ExitMainLoop(); for ( size_t i = 0; i < FrameArray.GetCount(); i++ ) refresh |= FrameArray[i]->GetRefreshFlag(); if ( advance && !refresh ) ExitMainLoop(); } //-------------------------------------------------------------------------- // wxPLplotFrame::wxPLplotFrame( const wxString& title, PLStream *pls ) // // Constructor of wxPLplotFrame, where we create the menu and add the // wxPLplotWindow. We need also to know the current PLStream. //-------------------------------------------------------------------------- wxPLplotFrame::wxPLplotFrame( const wxString& title, PLStream *pls ) : wxFrame( NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER | wxCLIP_CHILDREN ) { // Log_Verbose( "wxPLplotFrame::wxPLplotFrame" ); m_dev = (wxPLDevBase *) pls->dev; m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN ); wxBoxSizer* box = new wxBoxSizer( wxVERTICAL ); m_window = new wxPLplotWindow( m_panel, pls ); box->Add( m_window, 1, wxALL | wxEXPAND, 0 ); m_panel->SetSizer( box ); m_window->SetFocus(); wxMenu* saveMenu = new wxMenu; saveMenu->Append( wxPL_Save, dev_entries[0].dev_menu_short, dev_entries[0].dev_menu_long ); #if wxUSE_LIBPNG saveMenu->Append( wxPL_Save + 1, dev_entries[1].dev_menu_short, dev_entries[1].dev_menu_long ); #endif #if wxUSE_PCX saveMenu->Append( wxPL_Save + 2, dev_entries[2].dev_menu_short, dev_entries[2].dev_menu_long ); #endif #if wxUSE_LIBJPEG saveMenu->Append( wxPL_Save + 3, dev_entries[3].dev_menu_short, dev_entries[3].dev_menu_long ); #endif #if wxUSE_LIBTIFF saveMenu->Append( wxPL_Save + 4, dev_entries[4].dev_menu_short, dev_entries[4].dev_menu_long ); #endif #if wxUSE_PNM saveMenu->Append( wxPL_Save + 5, dev_entries[5].dev_menu_short, dev_entries[5].dev_menu_long ); #endif for ( size_t j = 6; j < sizeof ( dev_entries ) / sizeof ( dev_entry ); j++ ) for ( int i = 0; i < m_dev->ndev; i++ ) { if ( !strcmp( m_dev->devName[i], dev_entries[j].dev_name.mb_str() ) ) saveMenu->Append( wxPL_Save + j, dev_entries[j].dev_menu_short, dev_entries[j].dev_menu_long ); } wxMenu* fileMenu = new wxMenu; #if ( wxMAJOR_VERSION <= 2 ) & ( wxMINOR_VERSION <= 6 ) fileMenu->Append( -1, wxT( "Save plot as..." ), saveMenu, wxT( "Save this plot as ...!" ) ); #else fileMenu->AppendSubMenu( saveMenu, wxT( "Save plot as..." ), wxT( "Save this plot as ...!" ) ); #endif fileMenu->Append( wxID_EXIT, wxT( "E&xit\tAlt-X" ), wxT( "Exit wxWidgets PLplot App" ) ); wxMenu* orientationMenu = new wxMenu; orientationMenu->Append( wxPL_Orientation_0, wxT( "0 deg." ), wxT( "Orientation 0 deg." ) ); orientationMenu->Append( wxPL_Orientation_90, wxT( "90 deg." ), wxT( "Orientation 90 deg." ) ); orientationMenu->Append( wxPL_Orientation_180, wxT( "180 deg." ), wxT( "Orientation 180 deg." ) ); orientationMenu->Append( wxPL_Orientation_270, wxT( "270 deg." ), wxT( "Orientation 270 deg." ) ); wxMenu* plotMenu = new wxMenu; plotMenu->Append( wxPL_Locate, wxT( "Locate\tL" ), wxT( "Enter locate mode" ) ); // only add the orientation menu for hershey text processing if ( !pls->dev_text ) { #if ( wxMAJOR_VERSION <= 2 ) & ( wxMINOR_VERSION <= 6 ) plotMenu->Append( -1, wxT( "Set Orientation to..." ), orientationMenu, wxT( "Set the Orientation of the plot!" ) ); #else plotMenu->AppendSubMenu( orientationMenu, wxT( "Set Orientation to..." ), wxT( "Set the Orientation of the plot!" ) ); #endif } wxMenuBar* menuBar = new wxMenuBar(); menuBar->Append( fileMenu, wxT( "&File" ) ); menuBar->Append( plotMenu, wxT( "&Plot" ) ); SetMenuBar( menuBar ); SetIcon( wxIcon( graph ) ); } //-------------------------------------------------------------------------- // void wxPLplotFrame::OnMenu( wxCommandEvent& event ) // // Event method, which is called if user //-------------------------------------------------------------------------- void wxPLplotFrame::OnMenu( wxCommandEvent& event ) { // Log_Verbose( "wxPLplotFrame::OnMenu" ); switch ( event.GetId() ) { case wxID_EXIT: m_dev->exit = true; wxPLGetApp().ExitMainLoop(); break; case wxPL_Orientation_0: case wxPL_Orientation_90: case wxPL_Orientation_180: case wxPL_Orientation_270: m_window->SetOrientation( event.GetId() - wxPL_Orientation_0 ); break; case wxPL_Locate: if ( m_dev->locate_mode ) { if ( m_dev->locate_mode == LOCATE_INVOKED_VIA_API ) wxPLGetApp().SetAdvanceFlag(); m_dev->locate_mode = 0; m_dev->draw_xhair = false; } else { m_dev->locate_mode = LOCATE_INVOKED_VIA_DRIVER; m_dev->draw_xhair = true; } break; } size_t index = event.GetId() - wxPL_Save; if ( ( event.GetId() >= wxPL_Save ) && ( index < sizeof ( dev_entries ) / sizeof ( dev_entry ) ) ) { int width = 800; int height = 600; bool proceed = false; // ask for geometry in pixels only for image devices if ( dev_entries[index].pixelDevice ) { wxGetSizeDialog sizeDialog( this, -1, wxT( "Size of plot" ), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, width, height ); if ( sizeDialog.ShowModal() == wxID_OK ) { width = sizeDialog.getWidth(); height = sizeDialog.getHeight(); proceed = true; } } else proceed = true; if ( proceed ) { wxFileDialog dialog( this, wxT( "Save plot as " ) + dev_entries[index].dev_name, wxT( "" ), wxT( "" ), dev_entries[index].dev_file_app + wxT( "|All Files (*.*)|*.*" ), #if ( wxMAJOR_VERSION <= 2 ) & ( wxMINOR_VERSION <= 6 ) wxSAVE | wxOVERWRITE_PROMPT ); #else wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); #endif if ( dialog.ShowModal() == wxID_OK ) { const wxCharBuffer buf1 = dialog.GetPath().mb_str(); const wxCharBuffer buf2 = dev_entries[index].dev_name.mb_str(); SavePlot( (const char *) buf1, (const char *) buf2, width, height ); } } } } //-------------------------------------------------------------------------- // void wxPLplotFrame::OnClose( wxCloseEvent& event ) // // Event method, which is called if user //-------------------------------------------------------------------------- void wxPLplotFrame::OnClose( wxCloseEvent& /* event */ ) { // Log_Verbose( "wxPLplotFrame::OnClose" ); m_dev->exit = true; wxPLGetApp().ExitMainLoop(); } //-------------------------------------------------------------------------- // bool wxPLplotFrame::SavePlot( const char* filename, cost char* dev, int width, // int height ) // // This function saves the current plot to a file (filename) using a // device (devname) with given width and height. There is no test if // the device really exists. //-------------------------------------------------------------------------- bool wxPLplotFrame::SavePlot( const char* filename, const char* devname, int width, int height ) { int pls, pls_save; if ( !strcmp( devname, "wxbmp" ) || !strcmp( devname, "wxpng" ) || !strcmp( devname, "wxpcx" ) || !strcmp( devname, "wxjpeg" ) || !strcmp( devname, "wxtiff" ) || !strcmp( devname, "wxpnm" ) ) { wxMemoryDC memDC; wxBitmap bitmap( width, height, -1 ); memDC.SelectObject( bitmap ); plgstrm( &pls ); plmkstrm( &pls_save ); plsdev( "wxwidgets" ); plspage( 0.0, 0.0, width, height, 0, 0 ); plsetopt( "-drvopt", "backend=0" ); plinit(); pl_cmd( PLESC_DEVINIT, (void *) &memDC ); plcpstrm( pls, 0 ); pladv( 0 ); plreplot(); plend1(); plsstrm( pls ); wxBitmapType type; if ( !strcmp( devname, "wxbmp" ) ) type = wxBITMAP_TYPE_BMP; #if wxUSE_LIBPNG else if ( !strcmp( devname, "wxpng" ) ) type = wxBITMAP_TYPE_PNG; #endif #if wxUSE_PCX else if ( !strcmp( devname, "wxpcx" ) ) type = wxBITMAP_TYPE_PCX; #endif #if wxUSE_LIBJPEG else if ( !strcmp( devname, "wxjpeg" ) ) type = wxBITMAP_TYPE_JPEG; #endif #if wxUSE_LIBTIFF else if ( !strcmp( devname, "wxtiff" ) ) type = wxBITMAP_TYPE_TIF; #endif #if wxUSE_PNM else if ( !strcmp( devname, "wxpnm" ) ) type = wxBITMAP_TYPE_PNM; #endif else type = wxBITMAP_TYPE_BMP; bool status = bitmap.SaveFile( wxString( filename, *wxConvCurrent ), type ); if ( !status ) { char buf[512]; snprintf( buf, 512, "File %s couldn't be saved", filename ); plabort( buf ); return false; } } else { plgstrm( &pls ); plmkstrm( &pls_save ); plsdev( devname ); //plspage( 0., 0., width, height, 0, 0 ); plsfnam( filename ); plcpstrm( pls, 0 ); pladv( 0 ); plreplot(); plend1(); plsstrm( pls ); } return true; } //-------------------------------------------------------------------------- // wxPLplotWindow::wxPLplotWindow( const wxString& title ) // // Constructor of wxPLplotFrame, where we create the menu. //-------------------------------------------------------------------------- wxPLplotWindow::wxPLplotWindow( wxWindow* parent, PLStream *pls ) : wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER | wxWANTS_CHARS | wxCLIP_CHILDREN ) { // Log_Verbose( "wxPLplotWindow::wxPLplotWindow" ); m_pls = pls; m_dev = (wxPLDevBase *) pls->dev; refresh = false; mouse_x = old_mouse_x = -1; mouse_y = old_mouse_y = -1; xhair_drawn = false; SetBackgroundStyle( wxBG_STYLE_CUSTOM ); } //-------------------------------------------------------------------------- // void wxPLplotWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) // // Event method where the plots are actually drawn. Since the plots // are already drawn into bitmaps, which just copy them into to client // area. This method is also called, if (part) of the client area was // invalidated and a refresh is necessary. //-------------------------------------------------------------------------- void wxPLplotWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) ) { // Log_Verbose( "wxPLplotWindow::OnPaint" ); // copy bitmap into client area wxPaintDC dc( this ); // only update damaged regions int vX, vY, vW, vH; wxRegionIterator upd( GetUpdateRegion() ); // remove the xhair before updating if ( m_dev->draw_xhair && upd && xhair_drawn ) { dc.SetLogicalFunction( wxINVERT ); dc.CrossHair( old_mouse_x, old_mouse_y ); dc.SetLogicalFunction( wxCOPY ); xhair_drawn = false; old_mouse_x = old_mouse_y = -1; } while ( upd ) { vX = upd.GetX(); vY = upd.GetY(); vW = upd.GetW(); vH = upd.GetH(); //printf( "Clipping region: x=%d, y=%d, width=%d, height=%d, counter=%d\n", vX, vY, vW, vH, counter++ ); m_dev->BlitRectangle( &dc, vX, vY, vW, vH ); upd++; } if ( m_dev->draw_xhair && !xhair_drawn ) { dc.SetLogicalFunction( wxINVERT ); dc.CrossHair( mouse_x, mouse_y ); dc.SetLogicalFunction( wxCOPY ); old_mouse_x = mouse_x; old_mouse_y = mouse_y; xhair_drawn = true; } } //-------------------------------------------------------------------------- // void wxPLplotWindow::OnChar( wxKeyEvent& event ) // // Handle key events. //-------------------------------------------------------------------------- void wxPLplotWindow::OnChar( wxKeyEvent& event ) { // Log_Verbose( "wxPLplotWindow::OnChar" ); PLGraphicsIn *gin = &( m_dev->gin ); int width, height; GetClientSize( &width, &height ); gin->pX = mouse_x; gin->pY = mouse_y; gin->dX = (PLFLT) mouse_x / ( width - 1 ); gin->dY = 1.0 - (PLFLT) mouse_y / ( height - 1 ); // gin->state = keyEvent->state; int keycode = event.GetKeyCode(); gin->string[0] = (char) keycode; gin->string[1] = '\0'; // ESCAPE, RETURN, etc. are already in ASCII equivalent gin->keysym = keycode; if ( m_dev->locate_mode ) { // End locate mode on if ( gin->keysym == PLK_Escape ) { if ( m_dev->locate_mode == LOCATE_INVOKED_VIA_API ) wxPLGetApp().SetAdvanceFlag(); m_dev->locate_mode = 0; m_dev->draw_xhair = false; DrawCrosshair(); plGinInit( gin ); } Locate(); } else { // Call user keypress event handler. Since this is called first, the user // can disable all internal event handling by setting gin.keysym to 0. if ( m_pls->KeyEH != NULL ) { int advance = 0; ( *m_pls->KeyEH )( gin, m_pls->KeyEH_data, &advance ); if ( advance ) wxPLGetApp().SetAdvanceFlag(); } switch ( gin->keysym ) { case 'L': m_dev->locate_mode = LOCATE_INVOKED_VIA_DRIVER; m_dev->draw_xhair = true; DrawCrosshair(); break; case 'Q': case PLK_Escape: m_dev->exit = true; wxPLGetApp().SetExitFlag(); break; case PLK_Return: case WXK_SPACE: case WXK_RIGHT: wxPLGetApp().SetAdvanceFlag(); break; default: break; } } event.Skip(); } //-------------------------------------------------------------------------- // void wxPLplotWindow::OnIdle( wxIdleEvent& WXUNUSED(event) ) // // If there is no pending event, maybe the canvas needs to be refreshed. //-------------------------------------------------------------------------- void wxPLplotWindow::OnIdle( wxIdleEvent& WXUNUSED( event ) ) { // Log_Verbose( "wxPLplotWindow::OnIdle" ); if ( refresh ) { if ( !m_dev->newclipregion ) { static wxRect rect; rect.x = m_dev->clipminx; rect.y = m_dev->clipminy; rect.width = m_dev->clipmaxx - m_dev->clipminx + 1; rect.height = m_dev->clipmaxy - m_dev->clipminy + 1; #if ( wxMAJOR_VERSION <= 2 ) & ( wxMINOR_VERSION <= 5 ) RefreshRect( rect ); #else RefreshRect( rect, false ); // don't erase background #endif m_dev->newclipregion = true; m_dev->clipminx = m_dev->width; m_dev->clipmaxx = 0; m_dev->clipminy = m_dev->height; m_dev->clipmaxy = 0; } else Refresh( false ); refresh = false; } } //-------------------------------------------------------------------------- // void wxPLplotWindow::OnErase( wxEraseEvent &WXUNUSED(event) ) // // Do nothing here to prevent flickering. //-------------------------------------------------------------------------- void wxPLplotWindow::OnErase( wxEraseEvent &WXUNUSED( event ) ) { // Log_Verbose( "wxPLplotWindow::OnErase" ); } //-------------------------------------------------------------------------- // void wxPLplotWindow::OnSize( wxSizeEvent & WXUNUSED(event) ) // // Allocate a bigger bitmap if necessary and redo the plot if the // window size was changed. //-------------------------------------------------------------------------- void wxPLplotWindow::OnSize( wxSizeEvent & WXUNUSED( event ) ) { // Log_Verbose( "wxPLplotWindow::OnSize" ); int width, height; GetClientSize( &width, &height ); if ( m_dev->waiting ) { if ( ( width != m_dev->width ) || ( height != m_dev->height ) ) { // get a new bitmap if new size is bigger as bitmap size if ( ( width > m_dev->bm_width ) || ( height > m_dev->bm_height ) ) { m_dev->bm_width = m_dev->bm_width > width ? m_dev->bm_width : width; m_dev->bm_height = m_dev->bm_height > height ? m_dev->bm_height : height; } wx_set_size( m_pls, width, height ); m_dev->resizing = true; plRemakePlot( m_pls ); m_dev->resizing = false; Refresh(); } } } //-------------------------------------------------------------------------- // wxPLplotWindow::OnMaximize( wxMaximizeEvent & WXUNUSED(event) ) // // Add a size event if the Window is maximized. //-------------------------------------------------------------------------- void wxPLplotWindow::OnMaximize( wxMaximizeEvent & WXUNUSED( event ) ) { // Log_Verbose( "wxPLplotWindow::OnMax" ); wxSizeEvent event( GetClientSize() ); AddPendingEvent( event ); } //-------------------------------------------------------------------------- // void wxPLplotWindow::OnMouse( wxMouseEvent &event ) // // Handle mouse events. //-------------------------------------------------------------------------- void wxPLplotWindow::OnMouse( wxMouseEvent &event ) { // Log_Verbose( "wxPLplotWindow::OnMouse" ); wxPoint pos( event.GetPosition() ); mouse_x = pos.x; mouse_y = pos.y; if ( event.ButtonDown() ) { PLGraphicsIn *gin = &( m_dev->gin ); int width, height; GetClientSize( &width, &height ); gin->pX = mouse_x; gin->pY = mouse_y; gin->dX = (PLFLT) mouse_x / ( width - 1 ); gin->dY = 1.0 - (PLFLT) mouse_y / ( height - 1 ); if ( event.LeftDown() ) { gin->button = 1; // X11/X.h: #define Button1 1 gin->state = 1 << 8; // X11/X.h: #define Button1Mask (1<<8) } else if ( event.MiddleDown() ) { gin->button = 2; // X11/X.h: #define Button2 2 gin->state = 1 << 9; // X11/X.h: #define Button2Mask (1<<9) } else if ( event.RightDown() ) { gin->button = 3; // X11/X.h: #define Button3 3 gin->state = 1 << 10; // X11/X.h: #define Button3Mask (1<<10) } gin->keysym = 0x20; // keysym for button event from xwin.c if ( m_dev->locate_mode ) Locate(); else { // Call user event handler. Since this is called first, the user can // disable all PLplot internal event handling by setting gin->button to 0. if ( m_pls->ButtonEH != NULL ) { int advance = 0; ( *m_pls->ButtonEH )( gin, m_pls->ButtonEH_data, &advance ); if ( advance ) wxPLGetApp().SetAdvanceFlag(); } // Handle internal events switch ( gin->button ) { case 3: // on right mouse button advance wxPLGetApp().SetAdvanceFlag(); break; default: break; } } } DrawCrosshair(); } //-------------------------------------------------------------------------- // void wxPLplotWindow::Locate( void ) // // Take care of Locate mode, called by OnChar() and OnMouse(). //-------------------------------------------------------------------------- void wxPLplotWindow::Locate( void ) { // Log_Verbose( "wxPLplotWindow::Locate" ); PLGraphicsIn *gin = &( m_dev->gin ); // Some event (key, button) occured, and if the locate mode // was initiated by the API we need to return back to the // user program if ( m_dev->locate_mode == LOCATE_INVOKED_VIA_API ) wxPLGetApp().SetAdvanceFlag(); // Call user locate mode handler if provided if ( m_pls->LocateEH != NULL ) { int locate_mode = m_dev->locate_mode; ( *m_pls->LocateEH )( gin, m_pls->LocateEH_data, &locate_mode ); if ( !locate_mode ) { m_dev->locate_mode = 0; m_dev->draw_xhair = false; } } else { if ( plTranslateCursor( gin ) ) { // If invoked by the API, we're done // Otherwise send report to stdout if ( m_dev->locate_mode == LOCATE_INVOKED_VIA_DRIVER ) { if ( gin->keysym < 0xFF && isprint( gin->keysym ) ) printf( "%f %f %c\n", gin->wX, gin->wY, gin->keysym ); else printf( "%f %f 0x%02x\n", gin->wX, gin->wY, gin->keysym ); } } else { // Selected point is out of bounds, so end locate mode m_dev->locate_mode = 0; m_dev->draw_xhair = false; } } DrawCrosshair(); } //-------------------------------------------------------------------------- // void wxPLplotWindow::DrawCrosshair() // // Draw a cross hair (inverted lines). //-------------------------------------------------------------------------- void wxPLplotWindow::DrawCrosshair() { // draw cross hair wxClientDC dc( this ); if ( m_dev->draw_xhair ) { if ( ( mouse_x != old_mouse_x ) || ( mouse_y != old_mouse_y ) ) { dc.SetLogicalFunction( wxINVERT ); if ( xhair_drawn ) dc.CrossHair( old_mouse_x, old_mouse_y ); dc.CrossHair( mouse_x, mouse_y ); dc.SetLogicalFunction( wxCOPY ); old_mouse_x = mouse_x; old_mouse_y = mouse_y; xhair_drawn = true; } } else { if ( xhair_drawn ) { dc.SetLogicalFunction( wxINVERT ); dc.CrossHair( old_mouse_x, old_mouse_y ); dc.SetLogicalFunction( wxCOPY ); xhair_drawn = false; old_mouse_x = old_mouse_y = -1; } } } //-------------------------------------------------------------------------- // void wxPLplotWindow::SetOrientation( int rot ) // // Set the orientation of the plot. //-------------------------------------------------------------------------- void wxPLplotWindow::SetOrientation( int rot ) { PLINT bgr, bgg, bgb; // red, green, blue //plsstrm( m_pls ); plsdiori( rot ); m_dev->resizing = true; plgcolbg( &bgr, &bgg, &bgb ); // get background color information m_dev->ClearBackground( bgr, bgg, bgb ); plRemakePlot( m_pls ); m_dev->resizing = false; Refresh(); } //-------------------------------------------------------------------------- // wxGetSizeDialog::wxGetSizeDialog( wxWindow *parent, ... ) // // Constructor of GetSizeDialog. //-------------------------------------------------------------------------- wxGetSizeDialog::wxGetSizeDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style, int width, int height ) : wxDialog( parent, id, title, position, size, style ) { wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer *staticSizer = new wxStaticBoxSizer( new wxStaticBox( this, -1, wxT( "Size of plot" ) ), wxVERTICAL ); wxFlexGridSizer *flexSizer = new wxFlexGridSizer( 2, 0, 0 ); flexSizer->AddGrowableCol( 1 ); wxStaticText *textWidth = new wxStaticText( this, -1, wxT( "Width [pixels]:" ), wxDefaultPosition, wxDefaultSize, 0 ); flexSizer->Add( textWidth, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); spinControlWidth = new wxSpinCtrl( this, -1, wxString::Format( wxT( "%d" ), width ), wxDefaultPosition, wxSize( 100, -1 ), wxSP_ARROW_KEYS, 10, 4096, width ); flexSizer->Add( spinControlWidth, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxStaticText *textHeight = new wxStaticText( this, -1, wxT( "Height [pixels]:" ), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); flexSizer->Add( textHeight, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); spinControlHeight = new wxSpinCtrl( this, -1, wxString::Format( wxT( "%d" ), height ), wxDefaultPosition, wxSize( 100, -1 ), wxSP_ARROW_KEYS, 10, 4096, height ); flexSizer->Add( spinControlHeight, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); staticSizer->Add( flexSizer, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); sizer->Add( staticSizer, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL ); wxButton *buttonOK = new wxButton( this, wxID_OK, wxT( "OK" ), wxDefaultPosition, wxDefaultSize, 0 ); buttonSizer->Add( buttonOK, 0, wxALIGN_CENTER | wxALL | wxEXPAND, 5 ); buttonSizer->Add( 20, 20, 1, wxALIGN_CENTER | wxALL, 5 ); wxButton *buttonCancel = new wxButton( this, wxID_CANCEL, wxT( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); buttonSizer->Add( buttonCancel, 0, wxALIGN_CENTER | wxALL | wxEXPAND, 5 ); sizer->Add( buttonSizer, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 15 ); this->SetSizer( sizer ); sizer->SetSizeHints( this ); } #endif // PLD_wxwidgets plplot-5.10.0+dfsg/drivers/gcw.driver_info.in 644 1750 1750 4511466747272 200020ustar andrewandrewgcw:Gnome Canvas Widget:1:gcw:10:gcw plplot-5.10.0+dfsg/drivers/ljiip.driver_info.in 644 1750 1750 10011466747272 203410ustar andrewandrewljiip:LaserJet IIp/deskjet compressed graphics:0:ljiip:32:ljiip plplot-5.10.0+dfsg/drivers/pstex.driver_info.in 644 1750 1750 6711466747272 203710ustar andrewandrewpstex:Combined Postscript/LaTeX files:0:pstex:41:pstex plplot-5.10.0+dfsg/drivers/ps.c 644 1750 1750 11560212253760740 152470ustar andrewandrew// $Id: ps.c 12874 2013-12-17 05:32:16Z airwin $ // // PLplot PostScript device driver. // // Copyright (C) 1992, 2001 Geoffrey Furnish // Copyright (C) 1992, 1993, 1994, 1995, 2001 Maurice LeBrun // Copyright (C) 2000-2010 Alan W. Irwin // Copyright (C) 2001, 2002 Joao Cardoso // Copyright (C) 2001, 2003, 2004 Rafael Laboissiere // Copyright (C) 2004, 2005 Thomas J. Duck // Copyright (C) 2005 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plDevs.h" #define DEBUG #ifdef PLD_ps #define NEED_PLDEBUG #include "plplotP.h" #include "drivers.h" #include "ps.h" #include #include #include "plunicode-type1.h" #include "plfci-type1.h" // Define macro to truncate small values to zero - prevents // printf printing -0.000 #define TRMFLT( a ) ( ( fabs( a ) < 5.0e-4 ) ? 0.0 : ( a ) ) // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_ps = "ps:PostScript File (monochrome):0:ps:29:psm\n" "psc:PostScript File (color):0:ps:30:psc\n"; // Prototypes for functions in this file. void plD_dispatch_init_psm( PLDispatchTable *pdt ); void plD_dispatch_init_psc( PLDispatchTable *pdt ); static char *ps_getdate( void ); static void ps_init( PLStream * ); static void fill_polygon( PLStream *pls ); static void proc_str( PLStream *, EscText * ); static void esc_purge( unsigned char *, unsigned char * ); #define OUTBUF_LEN 128 static char outbuf[OUTBUF_LEN]; static int text = 1; static int color; static int hrshsym = 1; static DrvOpt ps_options[] = { { "text", DRV_INT, &text, "Use Postscript text (text=0|1)" }, { "color", DRV_INT, &color, "Use color (color=0|1)" }, { "hrshsym", DRV_INT, &hrshsym, "Use Hershey symbol set (hrshsym=0|1)" }, { NULL, DRV_INT, NULL, NULL } }; static unsigned char plunicode2type1( const PLUNICODE index, const Unicode_to_Type1_table lookup[], const int number_of_entries ); static const char * get_font( PSDev* dev, PLUNICODE fci ); // text > 0 uses some postscript tricks, namely a transformation matrix // that scales, rotates (with slanting) and offsets text strings. // It has yet some bugs for 3d plots. static void ps_dispatch_init_helper( PLDispatchTable *pdt, const char *menustr, const char *devnam, int type, int seq, plD_init_fp init ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = (char *) menustr; pdt->pl_DevName = (char *) devnam; #else (void) menustr; // Cast to void to silence compiler warnings about unused parameters (void) devnam; #endif pdt->pl_type = type; pdt->pl_seq = seq; pdt->pl_init = init; pdt->pl_line = (plD_line_fp) plD_line_ps; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_ps; pdt->pl_eop = (plD_eop_fp) plD_eop_ps; pdt->pl_bop = (plD_bop_fp) plD_bop_ps; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_ps; pdt->pl_state = (plD_state_fp) plD_state_ps; pdt->pl_esc = (plD_esc_fp) plD_esc_ps; } void plD_dispatch_init_psm( PLDispatchTable *pdt ) { ps_dispatch_init_helper( pdt, "PostScript File (monochrome)", "ps", plDevType_FileOriented, 29, (plD_init_fp) plD_init_psm ); } void plD_dispatch_init_psc( PLDispatchTable *pdt ) { ps_dispatch_init_helper( pdt, "PostScript File (color)", "psc", plDevType_FileOriented, 30, (plD_init_fp) plD_init_psc ); } //-------------------------------------------------------------------------- // plD_init_ps() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_psm( PLStream *pls ) { color = 0; pls->color = 0; // Not a color device plParseDrvOpts( ps_options ); if ( color ) pls->color = 1; // But user wants color ps_init( pls ); } void plD_init_psc( PLStream *pls ) { color = 1; pls->color = 1; // Is a color device plParseDrvOpts( ps_options ); if ( !color ) pls->color = 0; // But user does not want color ps_init( pls ); } static void ps_init( PLStream *pls ) { PSDev *dev; PLFLT pxlx, pxly; // Set default values - 7.5 x 10 [inches] (72 points = 1 inch) if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->xlength = 540; pls->ylength = 720; pls->xoffset = 32; pls->yoffset = 32; } if ( pls->xdpi <= 0 ) pls->xdpi = 72.; if ( pls->ydpi <= 0 ) pls->ydpi = 72.; pxlx = YPSSIZE / LPAGE_X; pxly = XPSSIZE / LPAGE_Y; if ( text ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode if ( hrshsym ) pls->dev_hrshsym = 1; // want Hershey symbols } pls->dev_fill0 = 1; // Can do solid fills // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( PSDev ) ); if ( pls->dev == NULL ) plexit( "ps_init: Out of memory." ); dev = (PSDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; plP_setpxl( pxlx, pxly ); dev->llx = XPSSIZE; dev->lly = YPSSIZE; dev->urx = 0; dev->ury = 0; dev->ptcnt = 0; // Rotate by 90 degrees since portrait mode addressing is used dev->xmin = 0; dev->ymin = 0; dev->xmax = PSY; dev->ymax = PSX; dev->xlen = dev->xmax - dev->xmin; dev->ylen = dev->ymax - dev->ymin; plP_setphy( dev->xmin, dev->xmax, dev->ymin, dev->ymax ); // If portrait mode is specified, then set up an additional rotation // transformation with aspect ratio allowed to adjust via freeaspect. // Default orientation is landscape (ORIENTATION == 3 or 90 deg rotation // counter-clockwise from portrait). (Legacy PLplot used seascape // which was equivalent to ORIENTATION == 1 or 90 deg clockwise rotation // from portrait.) if ( pls->portrait ) { plsdiori( (PLFLT) ( 4 - ORIENTATION ) ); pls->freeaspect = 1; } // Header comments into PostScript file fprintf( OF, "%%!PS-Adobe-2.0 EPSF-2.0\n" ); fprintf( OF, "%%%%BoundingBox: \n" ); fprintf( OF, "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" ); fprintf( OF, "%%%%Title: PLplot Graph\n" ); fprintf( OF, "%%%%Creator: PLplot Version %s\n", PLPLOT_VERSION ); fprintf( OF, "%%%%CreationDate: %s\n", ps_getdate() ); fprintf( OF, "%%%%Pages: (atend)\n" ); fprintf( OF, "%%%%EndComments\n\n" ); // Definitions // Save VM state fprintf( OF, "/PSSave save def\n" ); // Define a dictionary and start using it fprintf( OF, "/PSDict 200 dict def\n" ); fprintf( OF, "PSDict begin\n" ); fprintf( OF, "/@restore /restore load def\n" ); fprintf( OF, "/restore\n" ); fprintf( OF, " {vmstatus pop\n" ); fprintf( OF, " dup @VMused lt {pop @VMused} if\n" ); fprintf( OF, " exch pop exch @restore /@VMused exch def\n" ); fprintf( OF, " } def\n" ); fprintf( OF, "/@pri\n" ); fprintf( OF, " {\n" ); fprintf( OF, " ( ) print\n" ); fprintf( OF, " ( ) cvs print\n" ); fprintf( OF, " } def\n" ); // n @copies - fprintf( OF, "/@copies\n" ); fprintf( OF, " {\n" ); fprintf( OF, " /#copies exch def\n" ); fprintf( OF, " } def\n" ); // - @start - -- start everything fprintf( OF, "/@start\n" ); fprintf( OF, " {\n" ); fprintf( OF, " vmstatus pop /@VMused exch def pop\n" ); fprintf( OF, " } def\n" ); // - @end - -- finished fprintf( OF, "/@end\n" ); fprintf( OF, " {flush\n" ); fprintf( OF, " end\n" ); fprintf( OF, " PSSave restore\n" ); fprintf( OF, " } def\n" ); // bop - -- begin a new page // Only fill background if we are using color and if the bg isn't white fprintf( OF, "/bop\n" ); fprintf( OF, " {\n" ); fprintf( OF, " /SaveImage save def\n" ); fprintf( OF, " } def\n" ); // - eop - -- end a page fprintf( OF, "/eop\n" ); fprintf( OF, " {\n" ); fprintf( OF, " showpage\n" ); fprintf( OF, " SaveImage restore\n" ); fprintf( OF, " } def\n" ); // Set line parameters fprintf( OF, "/@line\n" ); fprintf( OF, " {0 setlinecap\n" ); fprintf( OF, " 0 setlinejoin\n" ); fprintf( OF, " 1 setmiterlimit\n" ); fprintf( OF, " } def\n" ); // d @hsize - horizontal clipping dimension fprintf( OF, "/@hsize {/hs exch def} def\n" ); fprintf( OF, "/@vsize {/vs exch def} def\n" ); // d @hoffset - shift for the plots fprintf( OF, "/@hoffset {/ho exch def} def\n" ); fprintf( OF, "/@voffset {/vo exch def} def\n" ); // Set line width fprintf( OF, "/lw %d def\n", (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ) ); // Setup user specified offsets, scales, sizes for clipping fprintf( OF, "/@SetPlot\n" ); fprintf( OF, " {\n" ); fprintf( OF, " ho vo translate\n" ); fprintf( OF, " XScale YScale scale\n" ); fprintf( OF, " lw setlinewidth\n" ); fprintf( OF, " } def\n" ); // Setup x & y scales fprintf( OF, "/XScale\n" ); fprintf( OF, " {hs %d div} def\n", YPSSIZE ); fprintf( OF, "/YScale\n" ); fprintf( OF, " {vs %d div} def\n", XPSSIZE ); // Macro definitions of common instructions, to keep output small fprintf( OF, "/M {moveto} def\n" ); fprintf( OF, "/D {lineto} def\n" ); fprintf( OF, "/A {0.5 0 360 arc} def\n" ); fprintf( OF, "/S {stroke} def\n" ); fprintf( OF, "/Z {stroke newpath} def\n" ); // Modify to use fill and stroke for better output with // anti-aliasing //fprintf(OF, "/F {fill} def\n"); if ( pls->dev_eofill ) fprintf( OF, "/F {closepath gsave eofill grestore stroke} def " ); else fprintf( OF, "/F {closepath gsave fill grestore stroke} def " ); fprintf( OF, "/N {newpath} def" ); fprintf( OF, "/C {setrgbcolor} def\n" ); fprintf( OF, "/G {setgray} def\n" ); fprintf( OF, "/W {setlinewidth} def\n" ); fprintf( OF, "/SF {selectfont} def\n" ); fprintf( OF, "/R {rotate} def\n" ); fprintf( OF, "/SW {stringwidth 2 index mul exch 2 index mul exch rmoveto pop} bind def\n" ); fprintf( OF, "/B {Z %d %d M %d %d D %d %d D %d %d D %d %d closepath} def\n", XMIN, YMIN, XMIN, YMAX, XMAX, YMAX, XMAX, YMIN, XMIN, YMIN ); fprintf( OF, "/CL {newpath M D D D closepath clip} def\n" ); // End of dictionary definition fprintf( OF, "end\n\n" ); // Set up the plots fprintf( OF, "PSDict begin\n" ); fprintf( OF, "@start\n" ); fprintf( OF, "%d @copies\n", COPIES ); fprintf( OF, "@line\n" ); fprintf( OF, "%d @hsize\n", YSIZE ); fprintf( OF, "%d @vsize\n", XSIZE ); fprintf( OF, "%d @hoffset\n", YOFFSET ); fprintf( OF, "%d @voffset\n", XOFFSET ); fprintf( OF, "@SetPlot\n\n" ); } //-------------------------------------------------------------------------- // plD_line_ps() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_ps( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { PSDev *dev = (PSDev *) pls->dev; PLINT x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; // Rotate by 90 degrees plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x1, &y1 ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x2, &y2 ); if ( x1 == dev->xold && y1 == dev->yold && dev->ptcnt < 40 ) { if ( pls->linepos + 12 > LINELENGTH ) { putc( '\n', OF ); pls->linepos = 0; } else putc( ' ', OF ); snprintf( outbuf, OUTBUF_LEN, "%d %d D", x2, y2 ); dev->ptcnt++; pls->linepos += 12; } else { fprintf( OF, " Z\n" ); pls->linepos = 0; if ( x1 == x2 && y1 == y2 ) // must be a single dot, draw a circle snprintf( outbuf, OUTBUF_LEN, "%d %d A", x1, y1 ); else snprintf( outbuf, OUTBUF_LEN, "%d %d M %d %d D", x1, y1, x2, y2 ); dev->llx = MIN( dev->llx, x1 ); dev->lly = MIN( dev->lly, y1 ); dev->urx = MAX( dev->urx, x1 ); dev->ury = MAX( dev->ury, y1 ); dev->ptcnt = 1; pls->linepos += 24; } dev->llx = MIN( dev->llx, x2 ); dev->lly = MIN( dev->lly, y2 ); dev->urx = MAX( dev->urx, x2 ); dev->ury = MAX( dev->ury, y2 ); fprintf( OF, "%s", outbuf ); pls->bytecnt += 1 + (PLINT) strlen( outbuf ); dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_ps() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_ps( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_ps( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // plD_eop_ps() // // End of page. //-------------------------------------------------------------------------- void plD_eop_ps( PLStream *pls ) { fprintf( OF, " S\neop\n" ); } //-------------------------------------------------------------------------- // plD_bop_ps() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_ps( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; if ( !pls->termin ) plGetFam( pls ); pls->page++; if ( pls->family ) fprintf( OF, "%%%%Page: %d %d\n", (int) pls->page, 1 ); else fprintf( OF, "%%%%Page: %d %d\n", (int) pls->page, (int) pls->page ); fprintf( OF, "bop\n" ); if ( pls->color ) { PLFLT r, g, b; if ( pls->cmap0[0].r != 0xFF || pls->cmap0[0].g != 0xFF || pls->cmap0[0].b != 0xFF ) { r = ( (PLFLT) pls->cmap0[0].r ) / 255.; g = ( (PLFLT) pls->cmap0[0].g ) / 255.; b = ( (PLFLT) pls->cmap0[0].b ) / 255.; fprintf( OF, "B %.4f %.4f %.4f C F\n", r, g, b ); } } pls->linepos = 0; // This ensures the color and line width are set correctly at the beginning of // each page plD_state_ps( pls, PLSTATE_COLOR0 ); plD_state_ps( pls, PLSTATE_WIDTH ); } //-------------------------------------------------------------------------- // plD_tidy_ps() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_ps( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; fprintf( OF, "\n%%%%Trailer\n" ); dev->llx /= ENLARGE; dev->lly /= ENLARGE; dev->urx /= ENLARGE; dev->ury /= ENLARGE; dev->llx += XOFFSET; dev->lly += YOFFSET; dev->urx += XOFFSET; dev->ury += YOFFSET; // changed for correct Bounding boundaries Jan Thorbecke okt 1993 // occurs from the integer truncation -- postscript uses fp arithmetic dev->urx += 1; dev->ury += 1; if ( pls->family ) fprintf( OF, "%%%%Pages: %d\n", (int) 1 ); else fprintf( OF, "%%%%Pages: %d\n", (int) pls->page ); fprintf( OF, "@end\n" ); fprintf( OF, "%%%%EOF\n" ); // Backtrack to write the BoundingBox at the beginning // Some applications don't like it atend rewind( OF ); fprintf( OF, "%%!PS-Adobe-2.0 EPSF-2.0\n" ); fprintf( OF, "%%%%BoundingBox: %d %d %d %d\n", dev->llx, dev->lly, dev->urx, dev->ury ); plCloseFile( pls ); } //-------------------------------------------------------------------------- // plD_state_ps() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_ps( PLStream *pls, PLINT op ) { PSDev *dev = (PSDev *) pls->dev; switch ( op ) { case PLSTATE_WIDTH: { int width = (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ); fprintf( OF, " S\n%d W", width ); dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; break; } case PLSTATE_COLOR0: if ( !pls->color ) { fprintf( OF, " S\n%.4f G", ( pls->icol0 ? 0.0 : 1.0 ) ); break; } // else fallthrough case PLSTATE_COLOR1: if ( pls->color ) { PLFLT r = ( (PLFLT) pls->curcolor.r ) / 255.0; PLFLT g = ( (PLFLT) pls->curcolor.g ) / 255.0; PLFLT b = ( (PLFLT) pls->curcolor.b ) / 255.0; fprintf( OF, " S\n%.4f %.4f %.4f C", r, g, b ); } else { PLFLT r = ( (PLFLT) pls->curcolor.r ) / 255.0; fprintf( OF, " S\n%.4f G", 1.0 - r ); } break; } // Reinitialize current point location. if ( dev->xold != PL_UNDEFINED && dev->yold != PL_UNDEFINED ) { fprintf( OF, " %d %d M \n", (int) dev->xold, (int) dev->yold ); } } //-------------------------------------------------------------------------- // plD_esc_ps() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_ps( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_FILL: fill_polygon( pls ); break; case PLESC_HAS_TEXT: proc_str( pls, (EscText *) ptr ); break; } } //-------------------------------------------------------------------------- // fill_polygon() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. // Only solid color fill supported. //-------------------------------------------------------------------------- static void fill_polygon( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; PLINT n, ix = 0, iy = 0; PLINT x, y; fprintf( OF, " Z\n" ); for ( n = 0; n < pls->dev_npts; n++ ) { x = pls->dev_x[ix++]; y = pls->dev_y[iy++]; // Rotate by 90 degrees plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x, &y ); // First time through start with a x y moveto if ( n == 0 ) { snprintf( outbuf, OUTBUF_LEN, "N %d %d M", x, y ); dev->llx = MIN( dev->llx, x ); dev->lly = MIN( dev->lly, y ); dev->urx = MAX( dev->urx, x ); dev->ury = MAX( dev->ury, y ); fprintf( OF, "%s", outbuf ); pls->bytecnt += (PLINT) strlen( outbuf ); continue; } if ( pls->linepos + 21 > LINELENGTH ) { putc( '\n', OF ); pls->linepos = 0; } else putc( ' ', OF ); pls->bytecnt++; snprintf( outbuf, OUTBUF_LEN, "%d %d D", x, y ); dev->llx = MIN( dev->llx, x ); dev->lly = MIN( dev->lly, y ); dev->urx = MAX( dev->urx, x ); dev->ury = MAX( dev->ury, y ); fprintf( OF, "%s", outbuf ); pls->bytecnt += (PLINT) strlen( outbuf ); pls->linepos += 21; } dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; fprintf( OF, " F " ); } //-------------------------------------------------------------------------- // ps_getdate() // // Get the date and time //-------------------------------------------------------------------------- static char * ps_getdate( void ) { int len; time_t t; char *p; t = time( (time_t *) 0 ); p = ctime( &t ); len = (int) strlen( p ); *( p + len - 1 ) = '\0'; // zap the newline character return p; } // 0.8 should mimic the offset of first superscript/subscript level // implemented in plstr (plsym.c) for Hershey fonts. However, when // comparing with -dev xwin and -dev xcairo results changing this // factor to 0.6 appears to offset the centers of the letters // appropriately while 0.8 gives much poorer agreement with the // other devices. # define RISE_FACTOR 0.6 //-------------------------------------------------------------------------- // proc_str() // // Prints postscript strings. // N.B. Now unicode only, no string access! // //-------------------------------------------------------------------------- void proc_str( PLStream *pls, EscText *args ) { PLFLT *t = args->xform, tt[4]; // Transform matrices PLFLT theta, shear, stride; // Rotation angle and shear from the matrix PLFLT ft_ht, offset; // Font height and offset PLFLT cs, sn, l1, l2; PSDev *dev = (PSDev *) pls->dev; const char *font; char esc; // Be generous. Used to store lots of font changes which take // 3 characters per change. #define PROC_STR_STRING_LENGTH 1000 unsigned char *strp, str[PROC_STR_STRING_LENGTH], *cur_strp, cur_str[PROC_STR_STRING_LENGTH]; float font_factor = 1.4f; PLINT clxmin, clxmax, clymin, clymax; // Clip limits PLINT clipx[4], clipy[4]; // Current clip limits PLFLT scale = 1., up = 0.; // Font scaling and shifting parameters int i = 0; // String index // unicode only! so test for it. if ( args->unicode_array_len > 0 ) { int j, s, f; const char *fonts[PROC_STR_STRING_LENGTH]; const PLUNICODE *cur_text; PLUNICODE fci, fci_save; PLFLT old_sscale, sscale, old_soffset, soffset, ddup; PLINT level = 0; // translate from unicode into type 1 font index. // // Choose the font family, style, variant, and weight using // the FCI (font characterization integer). // plgesc( &esc ); plgfci( &fci ); fci_save = fci; font = get_font( dev, fci ); cur_text = args->unicode_array; for ( f = s = j = 0; j < args->unicode_array_len; j++ ) { if ( cur_text[j] & PL_FCI_MARK ) { // process an FCI by saving it and escaping cur_str // with an escff to make it a 2-character escape // that is not used in legacy Hershey code // if ( ( f < PROC_STR_STRING_LENGTH ) && ( s + 3 < PROC_STR_STRING_LENGTH ) ) { fci_save = cur_text[j]; fonts[f++] = get_font( dev, fci_save ); cur_str[s++] = (unsigned char) esc; cur_str[s++] = 'f'; cur_str[s++] = 'f'; } } else if ( s + 4 < PROC_STR_STRING_LENGTH ) { #undef PL_TEST_TYPE1 #ifdef PL_TEST_TYPE1 // Use this test case only to conveniently view Type1 font // possibilities (as in test_type1.py example). // This functionality is useless other than for this test case. PLINT ifamily, istyle, iweight; plgfont( &ifamily, &istyle, &iweight ); if ( 0 <= cur_text[j] && cur_text[j] < 256 ) cur_str[s++] = cur_text[j]; else cur_str[s++] = 32; // Overwrite font just for this special case. if ( ifamily == PL_FCI_SYMBOL ) font = get_font( dev, 0 ); else font = get_font( dev, fci ); #else cur_str[s] = plunicode2type1( cur_text[j], dev->lookup, dev->nlookup ); if ( cur_text[j] != ' ' && cur_str[s] == ' ' ) { // failed lookup. if ( !dev->if_symbol_font ) { // failed standard font lookup. Use symbol // font instead which will return a blank if // that fails as well. fonts[f++] = get_font( dev, 0 ); cur_str[s++] = (unsigned char) esc; cur_str[s++] = 'f'; cur_str[s++] = 'f'; cur_str[s++] = plunicode2type1( cur_text[j], dev->lookup, dev->nlookup ); } else { // failed symbol font lookup. Use last standard // font instead which will return a blank if // that fails as well. fonts[f++] = get_font( dev, fci_save ); cur_str[s++] = (unsigned char) esc; cur_str[s++] = 'f'; cur_str[s++] = 'f'; cur_str[s++] = plunicode2type1( cur_text[j], dev->lookup, dev->nlookup ); } } else { // lookup succeeded. s++; } #endif pldebug( "proc_str", "unicode = 0x%x, type 1 code = %d\n", cur_text[j], cur_str[s - 1] ); } } cur_str[s] = '\0'; // finish previous polyline dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; // Determine the font height ft_ht = pls->chrht * 72.0 / 25.4; // ft_ht in points, ht is in mm // The transform matrix has only rotations and shears; extract them plRotationShear( t, &theta, &shear, &stride ); cs = cos( theta ); sn = sin( theta ); tt[0] = t[0] * cs + t[2] * sn; tt[1] = t[1] * cs + t[3] * sn; tt[2] = -t[0] * sn + t[2] * cs; tt[3] = -t[1] * sn + t[3] * cs; // // Reference point conventions: // If base = 0, it is aligned with the center of the text box // If base = 1, it is aligned with the baseline of the text box // If base = 2, it is aligned with the top of the text box // // Currently plplot only uses base=0 // Postscript uses base=1 // // We must calculate the difference between the two and apply the offset. // if ( args->base == 2 ) // not supported by plplot offset = ENLARGE * ft_ht / 2.; // half font height else if ( args->base == 1 ) offset = 0.; else offset = -ENLARGE * ft_ht / 2.; // Determine the adjustment for page orientation theta -= PI / 2. * pls->diorot; args->y += (PLINT) ( offset * cos( theta ) ); args->x -= (PLINT) ( offset * sin( theta ) ); // ps driver is rotated by default plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &( args->x ), &( args->y ) ); // Correct for the fact ps driver uses landscape by default theta += PI / 2.; // Output // Set clipping clipx[0] = pls->clpxmi; clipx[2] = pls->clpxma; clipy[0] = pls->clpymi; clipy[2] = pls->clpyma; clipx[1] = clipx[2]; clipy[1] = clipy[0]; clipx[3] = clipx[0]; clipy[3] = clipy[2]; difilt( clipx, clipy, 4, &clxmin, &clxmax, &clymin, &clymax ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[0], &clipy[0] ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[1], &clipy[1] ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[2], &clipy[2] ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[3], &clipy[3] ); fprintf( OF, " gsave %d %d %d %d %d %d %d %d CL\n", clipx[0], clipy[0], clipx[1], clipy[1], clipx[2], clipy[2], clipx[3], clipy[3] ); // move to string reference point fprintf( OF, " %d %d M\n", args->x, args->y ); // Save the current position and set the string rotation fprintf( OF, "gsave %.3f R\n", TRMFLT( theta * 180. / PI ) ); // Purge escape sequences from string, so that postscript can find it's // length. The string length is computed with the current font, and can // thus be wrong if there are font change escape sequences in the string // esc_purge( str, cur_str ); fprintf( OF, "/%s %.3f SF\n", font, TRMFLT( font_factor * ENLARGE * ft_ht ) ); // Output string, while escaping the '(', ')' and '\' characters. // this string is output for measurement purposes only. // fprintf( OF, "%.3f (", TRMFLT( -args->just ) ); while ( str[i] != '\0' ) { if ( str[i] == '(' || str[i] == ')' || str[i] == '\\' ) fprintf( OF, "\\%c", str[i] ); else fprintf( OF, "%c", str[i] ); i++; } fprintf( OF, ") SW\n" ); // Parse string for PLplot escape sequences and print everything out cur_strp = cur_str; f = 0; do { strp = str; if ( *cur_strp == esc ) { cur_strp++; if ( *cur_strp == esc ) // { *strp++ = *cur_strp++; } else if ( *cur_strp == 'f' ) { cur_strp++; if ( *cur_strp++ != 'f' ) { // escff occurs because of logic above. But any suffix // other than "f" should never happen. plabort( "proc_str, internal PLplot logic error;" "wrong escf escape sequence" ); return; } font = fonts[f++]; pldebug( "proc_str", "string-specified fci = 0x%x, font name = %s\n", fci, font ); continue; } else switch ( *cur_strp++ ) { case 'd': //subscript case 'D': plP_script_scale( FALSE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); scale = sscale; // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for subscripts should be // -0.5*(base font size - superscript/subscript font size). ddup = -0.5 * ( 1.0 - sscale ); up = -font_factor * ENLARGE * ft_ht * ( RISE_FACTOR * soffset + ddup ); break; case 'u': //superscript case 'U': plP_script_scale( TRUE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); scale = sscale; // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for superscripts should be // 0.5*(base font size - superscript/subscript font size). ddup = 0.5 * ( 1.0 - sscale ); up = font_factor * ENLARGE * ft_ht * ( RISE_FACTOR * soffset + ddup ); break; // ignore the next sequences case '+': case '-': case 'b': case 'B': plwarn( "'+', '-', and 'b/B' text escape sequences not processed." ); break; } } // copy from current to next token, adding a postscript escape // char '\' if necessary // while ( *cur_strp && *cur_strp != esc ) { if ( *cur_strp == '(' || *cur_strp == ')' || *cur_strp == '\\' ) *strp++ = '\\'; *strp++ = *cur_strp++; } *strp = '\0'; if ( fabs( up ) < 0.001 ) up = 0.; // Watch out for small differences // Apply the scaling and the shear fprintf( OF, "/%s [%.3f %.3f %.3f %.3f 0 0] SF\n", font, TRMFLT( tt[0] * font_factor * ENLARGE * ft_ht * scale ), TRMFLT( tt[2] * font_factor * ENLARGE * ft_ht * scale ), TRMFLT( tt[1] * font_factor * ENLARGE * ft_ht * scale ), TRMFLT( tt[3] * font_factor * ENLARGE * ft_ht * scale ) ); // if up/down escape sequences, save current point and adjust baseline; // take the shear into account if ( up != 0. ) fprintf( OF, "gsave %.3f %.3f rmoveto\n", TRMFLT( up * tt[1] ), TRMFLT( up * tt[3] ) ); // print the string fprintf( OF, "(%s) show\n", str ); // back to baseline if ( up != 0. ) fprintf( OF, "grestore (%s) stringwidth rmoveto\n", str ); } while ( *cur_strp ); fprintf( OF, "grestore\n" ); fprintf( OF, "grestore\n" ); // // keep driver happy -- needed for background and orientation. // arghhh! can't calculate it, as I only have the string reference // point, not its extent! // Still a hack - but at least it takes into account the string // length and justification. Character width is assumed to be // 0.6 * character height. Add on an extra 1.5 * character height // for safety. // cs = cos( theta ); sn = sin( theta ); l1 = -i * args->just; l2 = i * ( 1. - args->just ); // Factor of 0.6 is an empirical fudge to convert character // height to average character width l1 *= 0.6; l2 *= 0.6; dev->llx = (int) ( MIN( dev->llx, args->x + ( MIN( l1 * cs, l2 * cs ) - 1.5 ) * font_factor * ft_ht * ENLARGE ) ); dev->lly = (int) ( MIN( dev->lly, args->y + ( MIN( l1 * sn, l2 * sn ) - 1.5 ) * font_factor * ft_ht * ENLARGE ) ); dev->urx = (int) ( MAX( dev->urx, args->x + ( MAX( l1 * cs, l2 * cs ) + 1.5 ) * font_factor * ft_ht * ENLARGE ) ); dev->ury = (int) ( MAX( dev->ury, args->y + ( MAX( l1 * sn, l2 * sn ) + 1.5 ) * font_factor * ft_ht * ENLARGE ) ); } } static void esc_purge( unsigned char *dstr, unsigned char *sstr ) { char esc; plgesc( &esc ); while ( *sstr ) { if ( *sstr != esc ) { *dstr++ = *sstr++; continue; } sstr++; if ( *sstr == esc ) { *dstr++ = *sstr++; continue; } else { switch ( *sstr++ ) { case 'f': sstr++; break; // two chars sequence default: break; // single char escape } } } *dstr = '\0'; } //-------------------------------------------------------------------------- // unsigned char plunicode2type1 (const PLUNICODE index, // const Unicode_to_Type1_table lookup[], const int number_of_entries) // // Function takes an input unicode index, looks through the lookup // table (which must be sorted by PLUNICODE Unicode), then returns the // corresponding Type1 code in the lookup table. If the Unicode index is // not present the returned value is 32 (which is normally a blank // for Type 1 fonts). //-------------------------------------------------------------------------- static unsigned char plunicode2type1( const PLUNICODE index, const Unicode_to_Type1_table lookup[], const int nlookup ) { int jlo = -1, jmid, jhi = nlookup; while ( jhi - jlo > 1 ) { // Note that although jlo or jhi can be just outside valid // range (see initialization above) because of while condition // jlo < jmid < jhi and jmid must be in valid range. // jmid = ( jlo + jhi ) / 2; if ( index > lookup[jmid].Unicode ) jlo = jmid; else if ( index < lookup[jmid].Unicode ) jhi = jmid; else // We have found it! // index == lookup[jmid].Unicode // return ( lookup[jmid].Type1 ); } // jlo is invalid or it is valid and index > lookup[jlo].Unicode. // jhi is invalid or it is valid and index < lookup[jhi].Unicode. // All these conditions together imply index cannot be found in lookup. // Mark with ' ' (which is normally the index for blank in type 1 fonts). // return ( ' ' ); } //-------------------------------------------------------------------------- // get_font( PSDev* dev, PLUNICODE fci ) // // Sets the Type1 font. //-------------------------------------------------------------------------- static const char * get_font( PSDev* dev, PLUNICODE fci ) { const char *font; // fci = 0 is a special value indicating the Type 1 Symbol font // is desired. This value cannot be confused with a normal FCI value // because it doesn't have the PL_FCI_MARK. if ( fci == 0 ) { font = "Symbol"; dev->nlookup = number_of_entries_in_unicode_to_symbol_table; dev->lookup = unicode_to_symbol_lookup_table; dev->if_symbol_font = 1; } else { // convert the fci to Base14/Type1 font information font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); dev->nlookup = number_of_entries_in_unicode_to_standard_table; dev->lookup = unicode_to_standard_lookup_table; dev->if_symbol_font = 0; } pldebug( "set_font", "fci = 0x%x, font name = %s\n", fci, font ); return ( font ); } #else int pldummy_ps() { return 0; } #endif // PLD_ps plplot-5.10.0+dfsg/drivers/wingcc.c 644 1750 1750 14415012272010730 160630ustar andrewandrew// $Id: wingcc.c 12965 2014-01-28 20:23:52Z arjenmarkus $ // // PLplot WIN32 under GCC device driver. // // Copyright (C) 2004 Andrew Roach // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plDevs.h" #ifdef PLD_wingcc #include #include #if !defined ( __CYGWIN__ ) #include #else #include #define _T( a ) __TEXT( a ) #endif #ifdef _WIN64 #define GWL_USERDATA GWLP_USERDATA #define GCL_HCURSOR GCLP_HCURSOR #endif #include "plplotP.h" #include "drivers.h" #include "plevent.h" #ifdef PL_HAVE_FREETYPE // // Freetype support has been added to the wingcc driver using the // plfreetype.c module, and implemented as a driver-specific optional extra // invoked via the -drvopt command line toggle. It uses the // "PLESC_HAS_TEXT" command for rendering within the driver. // // Freetype support is turned on/off at compile time by defining // "PL_HAVE_FREETYPE". // // To give the user some level of control over the fonts that are used, // environmental variables can be set to over-ride the definitions used by // the five default plplot fonts. // // Freetype rendering is used with the command line "-drvopt text". // Anti-aliased fonts can be used by issuing "-drvopt text,smooth" // #include "plfreetype.h" #ifndef max_number_of_grey_levels_used_in_text_smoothing #define max_number_of_grey_levels_used_in_text_smoothing 64 #endif #endif // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_wingcc = "wingcc:Win32 (GCC):1:wingcc:9:wingcc\n"; // Struct to hold device-specific info. typedef struct { PLFLT scale; // scaling factor to "blow up" to the "virtual" page in removing hidden lines PLINT width; // Window width (which can change) PLINT height; // Window Height PLFLT PRNT_scale; PLINT PRNT_width; PLINT PRNT_height; char FT_smooth_text; // // WIN32 API variables // COLORREF colour; // Current Colour COLORREF oldcolour; // Used for high-speed background erasing MSG msg; // A Win32 message structure. WNDCLASSEX wndclass; // An extended window class structure. HWND hwnd; // Handle for the main window. HPEN pen; // Windows pen used for drawing HDC hdc; // Driver Context HDC hdc2; // Driver Context II - used for Blitting HDC SCRN_hdc; // The screen's context HDC PRNT_hdc; // used for printing PAINTSTRUCT ps; // used to paint the client area of a window owned by that application RECT rect; // defines the coordinates of the upper-left and lower-right corners of a rectangle RECT oldrect; // used for re-sizing comparisons RECT paintrect; // used for painting etc... HBRUSH fillbrush; // brush used for fills HCURSOR cursor; // Current windows cursor for this window HBITMAP bitmap; // Bitmap of current display; used for fast redraws via blitting HGDIOBJ oldobject; // Used for tracking objects probably not really needed but HMENU PopupMenu; PLINT draw_mode; char truecolour; // Flag to indicate 24 bit mode char waiting; // Flag to indicate drawing is done, and it is waiting; // we only do a windows redraw if plplot is plotting char enterresize; // Used to keep track of reszing messages from windows char already_erased; // Used to track first and only first backgroudn erases struct wingcc_Dev *push; // A copy of the entire structure used when printing // We push and pop it off a virtual stack } wingcc_Dev; void plD_dispatch_init_wingcc( PLDispatchTable *pdt ); void plD_init_wingcc( PLStream * ); void plD_line_wingcc( PLStream *, short, short, short, short ); void plD_polyline_wingcc( PLStream *, short *, short *, PLINT ); void plD_eop_wingcc( PLStream * ); void plD_bop_wingcc( PLStream * ); void plD_tidy_wingcc( PLStream * ); void plD_state_wingcc( PLStream *, PLINT ); void plD_esc_wingcc( PLStream *, PLINT, void * ); #ifdef PL_HAVE_FREETYPE static void plD_pixel_wingcc( PLStream *pls, short x, short y ); static void plD_pixelV_wingcc( PLStream *pls, short x, short y ); static PLINT plD_read_pixel_wingcc( PLStream *pls, short x, short y ); static void plD_set_pixel_wingcc( PLStream *pls, short x, short y, PLINT colour ); static void plD_set_pixelV_wingcc( PLStream *pls, short x, short y, PLINT colour ); static void init_freetype_lv1( PLStream *pls ); static void init_freetype_lv2( PLStream *pls ); #endif //-------------------------------------------------------------------------- // Local Function definitions and function-like defines //-------------------------------------------------------------------------- static int GetRegValue( TCHAR *key_name, TCHAR *key_word, char *buffer, int size ); static int SetRegValue( TCHAR *key_name, TCHAR *key_word, char *buffer, int dwType, int size ); static void Resize( PLStream *pls ); static void plD_fill_polygon_wingcc( PLStream *pls ); static void CopySCRtoBMP( PLStream *pls ); static void PrintPage( PLStream *pls ); static void UpdatePageMetrics( PLStream *pls, char flag ); #define SetRegStringValue( a, b, c ) SetRegValue( a, b, c, REG_SZ, strlen( c ) + 1 ) #define SetRegBinaryValue( a, b, c, d ) SetRegValue( a, b, (char *) c, REG_BINARY, d ) #define SetRegIntValue( a, b, c ) SetRegValue( a, b, (char *) c, REG_DWORD, 4 ) #define GetRegStringValue( a, b, c, d ) GetRegValue( a, b, c, d ) #define GetRegIntValue( a, b, c ) GetRegValue( a, b, (char *) c, 4 ) #define GetRegBinaryValue( a, b, c, d ) GetRegValue( a, b, (char *) c, d ) //-------------------------------------------------------------------------- // Some debugging macros //-------------------------------------------------------------------------- #if defined ( _MSC_VER ) #define Debug( a ) do { if ( pls->debug ) { fprintf( stderr, ( a ) ); } } while ( 0 ) #define Debug2( a, b ) do { if ( pls->debug ) { fprintf( stderr, ( a ), ( b ) ); } } while ( 0 ) #define Debug3( a, b, c ) do { if ( pls->debug ) { fprintf( stderr, ( a ), ( b ), ( c ) ); } } while ( 0 ) #elif defined ( __BORLANDC__ ) #define Debug if ( pls->debug ) printf #define Debug2 if ( pls->debug ) printf #define Debug3 if ( pls->debug ) printf #else #define Verbose( ... ) do { if ( pls->verbose ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) #define Debug( ... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) #define Debug2( ... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) #define Debug3( ... ) do { if ( pls->debug ) { fprintf( stderr, __VA_ARGS__ ); } } while ( 0 ) #endif #define ReportWinError() do { \ LPVOID lpMsgBuf; \ FormatMessage( \ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, \ NULL, GetLastError(), \ MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPTSTR) &lpMsgBuf, 0, NULL ); \ MessageBox( NULL, lpMsgBuf, "GetLastError", MB_OK | MB_ICONINFORMATION ); \ LocalFree( lpMsgBuf ); } while ( 0 ) #define CrossHairCursor() do { \ dev->cursor = LoadCursor( NULL, IDC_CROSS ); \ SetClassLong( dev->hwnd, GCL_HCURSOR, (long) dev->cursor ); \ SetCursor( dev->cursor ); } while ( 0 ) #define NormalCursor() do { \ dev->cursor = LoadCursor( NULL, IDC_ARROW ); \ SetClassLongPtr( dev->hwnd, GCL_HCURSOR, (LONG_PTR) dev->cursor ); \ SetCursor( dev->cursor ); } while ( 0 ) #define BusyCursor() do { \ dev->cursor = LoadCursor( NULL, IDC_WAIT ); \ SetClassLongPtr( dev->hwnd, GCL_HCURSOR, (LONG_PTR) dev->cursor ); \ SetCursor( dev->cursor ); } while ( 0 ) #define PopupPrint 0x08A1 #define PopupNextPage 0x08A2 #define PopupQuit 0x08A3 void plD_dispatch_init_wingcc( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Win32 GCC device"; pdt->pl_DevName = "wingcc"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 9; pdt->pl_init = (plD_init_fp) plD_init_wingcc; pdt->pl_line = (plD_line_fp) plD_line_wingcc; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_wingcc; pdt->pl_eop = (plD_eop_fp) plD_eop_wingcc; pdt->pl_bop = (plD_bop_fp) plD_bop_wingcc; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_wingcc; pdt->pl_state = (plD_state_fp) plD_state_wingcc; pdt->pl_esc = (plD_esc_fp) plD_esc_wingcc; } static TCHAR* szWndClass = _T( "PlplotWin" ); //-------------------------------------------------------------------------- // This is the window function for the plot window. Whenever a message is // dispatched using DispatchMessage (or sent with SendMessage) this function // gets called with the contents of the message. //-------------------------------------------------------------------------- LRESULT CALLBACK PlplotWndProc( HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { PLStream *pls = NULL; wingcc_Dev *dev = NULL; // // The window carries a 32bit user defined pointer which points to the // plplot stream (pls). This is used for tracking the window. // Unfortunately, this is "attached" to the window AFTER it is created // so we can not initialise PLStream or wingcc_Dev "blindly" because // they may not yet have been initialised. // WM_CREATE is called before we get to initialise those variables, so // we wont try to set them. // if ( nMsg == WM_CREATE ) { return ( 0 ); } else { #ifndef _WIN64 #undef GetWindowLongPtr #define GetWindowLongPtr GetWindowLong #endif pls = (PLStream *) GetWindowLongPtr( hwnd, GWL_USERDATA ); // Try to get the address to pls for this window if ( pls ) // If we got it, then we will initialise this windows plplot private data area { dev = (wingcc_Dev *) pls->dev; } } // // Process the windows messages // // Everything except WM_CREATE is done here and it is generally hoped that // pls and dev are defined already by this stage. // That will be true MOST of the time. Some times WM_PAINT will be called // before we get to initialise the user data area of the window with the // pointer to the windows plplot stream // switch ( nMsg ) { case WM_DESTROY: if ( dev ) Debug( "WM_DESTROY\t" ); PostQuitMessage( 0 ); return ( 0 ); break; case WM_PAINT: if ( dev ) { Debug( "WM_PAINT\t" ); if ( GetUpdateRect( dev->hwnd, &dev->paintrect, TRUE ) ) { BusyCursor(); BeginPaint( dev->hwnd, &dev->ps ); if ( ( dev->waiting == 1 ) && ( dev->already_erased == 1 ) ) { Debug( "Remaking\t" ); if ( dev->ps.fErase ) { dev->oldcolour = SetBkColor( dev->hdc, RGB( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b ) ); ExtTextOut( dev->hdc, 0, 0, ETO_OPAQUE, &dev->rect, _T( "" ), 0, 0 ); SetBkColor( dev->hdc, dev->oldcolour ); } plRemakePlot( pls ); CopySCRtoBMP( pls ); dev->already_erased++; } else if ( ( dev->waiting == 1 ) && ( dev->already_erased == 2 ) ) { dev->oldobject = SelectObject( dev->hdc2, dev->bitmap ); BitBlt( dev->hdc, dev->paintrect.left, dev->paintrect.top, dev->paintrect.right, dev->paintrect.bottom, dev->hdc2, dev->paintrect.left, dev->paintrect.top, SRCCOPY ); SelectObject( dev->hdc2, dev->oldobject ); } EndPaint( dev->hwnd, &dev->ps ); NormalCursor(); return ( 0 ); } } return ( 1 ); break; case WM_SIZE: if ( dev ) { Debug( "WM_SIZE\t" ); if ( dev->enterresize == 0 ) Resize( pls ); } return ( 0 ); break; case WM_ENTERSIZEMOVE: if ( dev ) { Debug( "WM_ENTERSIZEMOVE\t" ); dev->enterresize = 1; } return ( 0 ); break; case WM_EXITSIZEMOVE: if ( dev ) { Debug( "WM_EXITSIZEMOVE\t" ); Resize( pls ); dev->enterresize = 0; // Reset the variables that track sizing ops } return ( 0 ); break; case WM_ERASEBKGND: if ( dev ) { if ( dev->already_erased == 0 ) { Debug( "WM_ERASEBKGND\t" ); // // This is a new "High Speed" way of filling in the background. // supposidely this executes faster than creating a brush and // filling a rectangle - go figure ? // dev->oldcolour = SetBkColor( dev->hdc, RGB( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b ) ); ExtTextOut( dev->hdc, 0, 0, ETO_OPAQUE, &dev->rect, _T( "" ), 0, 0 ); SetBkColor( dev->hdc, dev->oldcolour ); dev->already_erased = 1; return ( 1 ); } } return ( 0 ); break; case WM_COMMAND: if ( dev ) Debug( "WM_COMMAND\t" ); return ( 0 ); break; } // If we don't handle a message completely we hand it to the system // provided default window function. return DefWindowProc( hwnd, nMsg, wParam, lParam ); } //-------------------------------------------------------------------------- // plD_init_wingcc() // // Initialize device (terminal). //-------------------------------------------------------------------------- void plD_init_wingcc( PLStream *pls ) { wingcc_Dev *dev; #ifdef PL_HAVE_FREETYPE static int freetype = 0; static int smooth_text = 0; static int save_reg = 0; FT_Data *FT; // // Variables used for reading the registary keys // might eventually add a user defined pallette here, but for now it just does freetype // TCHAR key_name[] = _T( "Software\\PLplot\\wingcc" ); TCHAR Keyword_text[] = _T( "freetype" ); TCHAR Keyword_smooth[] = _T( "smooth" ); #endif DrvOpt wingcc_options[] = { #ifdef PL_HAVE_FREETYPE { "text", DRV_INT, &freetype, "Use driver text (FreeType)" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, { "save", DRV_INT, &save_reg, "Save defaults to registary" }, #endif { NULL, DRV_INT, NULL, NULL } }; // // Variable for storing the program name // TCHAR *program; int programlength; // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( wingcc_Dev ) ); if ( pls->dev == NULL ) plexit( "plD_init_wingcc_Dev: Out of memory." ); dev = (wingcc_Dev *) pls->dev; pls->icol0 = 1; // Set a fall back pen colour in case user doesn't pls->termin = 1; // interactive device pls->graphx = GRAPHICS_MODE; // No text mode for this driver (at least for now, might add a console window if I ever figure it out and have the inclination) pls->dev_fill0 = 1; // driver can do solid area fills pls->dev_xor = 1; // driver supports xor mode pls->dev_clear = 0; // driver does not support clear - what is the proper API? pls->dev_dash = 0; // driver can not do dashed lines (yet) pls->plbuf_write = 1; // driver uses the buffer for redraws if ( !pls->colorset ) pls->color = 1; #ifdef PL_HAVE_FREETYPE // // Read registry to see if the user has set up default values // for text and smoothing. These will be overriden by anything that // might be given on the command line, so we will load the // values right into the same memory slots we pass to plParseDrvOpts // GetRegIntValue( key_name, Keyword_text, &freetype ); GetRegIntValue( key_name, Keyword_smooth, &smooth_text ); #endif // Check for and set up driver options plParseDrvOpts( wingcc_options ); #ifdef PL_HAVE_FREETYPE // // We will now save the settings to the registary if the user wants // if ( save_reg == 1 ) { SetRegIntValue( key_name, Keyword_text, &freetype ); SetRegIntValue( key_name, Keyword_smooth, &smooth_text ); } #endif // Set up device parameters if ( pls->xlength <= 0 || pls->ylength <= 0 ) { // use default width, height of 800x600 if not specifed by -geometry option // or plspage plspage( 0., 0., 800, 600, 0, 0 ); } dev->width = pls->xlength - 1; // should I use -1 or not??? dev->height = pls->ylength - 1; // // Begin initialising the window // // Initialize the entire structure to zero. memset( &dev->wndclass, 0, sizeof ( WNDCLASSEX ) ); // This class is called WinTestWin dev->wndclass.lpszClassName = szWndClass; // cbSize gives the size of the structure for extensibility. dev->wndclass.cbSize = sizeof ( WNDCLASSEX ); // All windows of this class redraw when resized. dev->wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC | CS_PARENTDC; // All windows of this class use the WndProc window function. dev->wndclass.lpfnWndProc = PlplotWndProc; // This class is used with the current program instance. dev->wndclass.hInstance = GetModuleHandle( NULL ); // Use standard application icon and arrow cursor provided by the OS dev->wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); dev->wndclass.hIconSm = LoadIcon( NULL, IDI_APPLICATION ); dev->wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); // Color the background white dev->wndclass.hbrBackground = NULL; dev->wndclass.cbWndExtra = sizeof ( pls ); // // Now register the window class for use. // RegisterClassEx( &dev->wndclass ); // //convert the program name to wide char if needed // #ifdef UNICODE printf( pls->program ); programlength = strlen( pls->program ) + 1; program = malloc( programlength * sizeof ( TCHAR ) ); MultiByteToWideChar( CP_UTF8, 0, pls->program, programlength, program, programlength ); #else program = pls->program; #endif // // Create our main window using that window class. // dev->hwnd = CreateWindowEx( WS_EX_WINDOWEDGE + WS_EX_LEFT, szWndClass, // Class name program, // Caption WS_OVERLAPPEDWINDOW, // Style pls->xoffset, // Initial x (use default) pls->yoffset, // Initial y (use default) pls->xlength, // Initial x size (use default) pls->ylength, // Initial y size (use default) NULL, // No parent window NULL, // No menu dev->wndclass.hInstance, // This program instance NULL // Creation parameters ); #ifdef UNICODE free( program ); #endif // // Attach a pointer to the stream to the window's user area // this pointer will be used by the windows call back for // process this window // #ifdef _WIN64 SetWindowLongPtr( dev->hwnd, GWL_USERDATA, (LONG_PTR) pls ); #else SetWindowLong( dev->hwnd, GWL_USERDATA, (LONG) pls ); #endif dev->SCRN_hdc = dev->hdc = GetDC( dev->hwnd ); // // Setup the popup menu // dev->PopupMenu = CreatePopupMenu(); AppendMenu( dev->PopupMenu, MF_STRING, PopupPrint, _T( "Print" ) ); AppendMenu( dev->PopupMenu, MF_STRING, PopupNextPage, _T( "Next Page" ) ); AppendMenu( dev->PopupMenu, MF_STRING, PopupQuit, _T( "Quit" ) ); #ifdef PL_HAVE_FREETYPE if ( freetype ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode init_freetype_lv1( pls ); FT = (FT_Data *) pls->FT; FT->want_smooth_text = smooth_text; } #endif plD_state_wingcc( pls, PLSTATE_COLOR0 ); // // Display the window which we just created (using the nShow // passed by the OS, which allows for start minimized and that // sort of thing). // ShowWindow( dev->hwnd, SW_SHOWDEFAULT ); SetForegroundWindow( dev->hwnd ); // // Set up the DPI etc... // if ( pls->xdpi <= 0 ) // Get DPI from windows { plspage( GetDeviceCaps( dev->hdc, HORZRES ) / GetDeviceCaps( dev->hdc, HORZSIZE ) * 25.4, GetDeviceCaps( dev->hdc, VERTRES ) / GetDeviceCaps( dev->hdc, VERTSIZE ) * 25.4, 0, 0, 0, 0 ); } else { pls->ydpi = pls->xdpi; // Set X and Y dpi's to the same value } // // Now we have to find out, from windows, just how big our drawing area is // when we specified the page size earlier on, that includes the borders, // title bar etc... so now that windows has done all its initialisations, // we will ask how big the drawing area is, and tell plplot // GetClientRect( dev->hwnd, &dev->rect ); dev->width = dev->rect.right; dev->height = dev->rect.bottom; if ( dev->width > dev->height ) // Work out the scaling factor for the { // "virtual" (oversized) page dev->scale = (PLFLT) ( PIXELS_X - 1 ) / dev->width; } else { dev->scale = (PLFLT) PIXELS_Y / dev->height; } Debug2( "Scale = %f (FLT)\n", dev->scale ); plP_setpxl( dev->scale * pls->xdpi / 25.4, dev->scale * pls->ydpi / 25.4 ); plP_setphy( 0, (PLINT) ( dev->scale * dev->width ), 0, (PLINT) ( dev->scale * dev->height ) ); // Set fill rule. if ( pls->dev_eofill ) SetPolyFillMode( dev->hdc, ALTERNATE ); else SetPolyFillMode( dev->hdc, WINDING ); #ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { init_freetype_lv2( pls ); } #endif } //-------------------------------------------------------------------------- // plD_line_wingcc() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_wingcc( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; POINT points[2]; points[0].x = (LONG) ( x1a / dev->scale ); points[1].x = (LONG) ( x2a / dev->scale ); points[0].y = (LONG) ( dev->height - ( y1a / dev->scale ) ); points[1].y = (LONG) ( dev->height - ( y2a / dev->scale ) ); dev->oldobject = SelectObject( dev->hdc, dev->pen ); if ( points[0].x != points[1].x || points[0].y != points[1].y ) { Polyline( dev->hdc, points, 2 ); } else { SetPixel( dev->hdc, points[0].x, points[0].y, dev->colour ); } SelectObject( dev->hdc, dev->oldobject ); } //-------------------------------------------------------------------------- // plD_polyline_wingcc() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_wingcc( PLStream *pls, short *xa, short *ya, PLINT npts ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; int i; POINT *points = NULL; if ( npts > 0 ) { points = GlobalAlloc( GMEM_ZEROINIT | GMEM_FIXED, (size_t) npts * sizeof ( POINT ) ); if ( points != NULL ) { for ( i = 0; i < npts; i++ ) { points[i].x = (LONG) ( xa[i] / dev->scale ); points[i].y = (LONG) ( dev->height - ( ya[i] / dev->scale ) ); } dev->oldobject = SelectObject( dev->hdc, dev->pen ); Polyline( dev->hdc, points, npts ); SelectObject( dev->hdc, dev->oldobject ); GlobalFree( points ); } else { plexit( "Could not allocate memory to \"plD_polyline_wingcc\"\n" ); } } } //-------------------------------------------------------------------------- // plD_fill_polygon_wingcc() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void plD_fill_polygon_wingcc( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; int i; POINT *points = NULL; HPEN hpen, hpenOld; if ( pls->dev_npts > 0 ) { points = GlobalAlloc( GMEM_ZEROINIT, (size_t) pls->dev_npts * sizeof ( POINT ) ); if ( points == NULL ) plexit( "Could not allocate memory to \"plD_fill_polygon_wingcc\"\n" ); for ( i = 0; i < pls->dev_npts; i++ ) { points[i].x = (PLINT) ( pls->dev_x[i] / dev->scale ); points[i].y = (PLINT) ( dev->height - ( pls->dev_y[i] / dev->scale ) ); } dev->fillbrush = CreateSolidBrush( dev->colour ); hpen = CreatePen( PS_SOLID, 1, dev->colour ); dev->oldobject = SelectObject( dev->hdc, dev->fillbrush ); hpenOld = SelectObject( dev->hdc, hpen ); Polygon( dev->hdc, points, pls->dev_npts ); SelectObject( dev->hdc, dev->oldobject ); DeleteObject( dev->fillbrush ); SelectObject( dev->hdc, hpenOld ); DeleteObject( hpen ); GlobalFree( points ); } } //-------------------------------------------------------------------------- // static void CopySCRtoBMP(PLStream *pls) // Function copies the screen contents into a bitmap which is // later used for fast redraws of the screen (when it gets corrupted) // rather than remaking the plot from the plot buffer. //-------------------------------------------------------------------------- static void CopySCRtoBMP( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; // // Clean up the old bitmap and DC // if ( dev->hdc2 != NULL ) DeleteDC( dev->hdc2 ); if ( dev->bitmap != NULL ) DeleteObject( dev->bitmap ); dev->hdc2 = CreateCompatibleDC( dev->hdc ); GetClientRect( dev->hwnd, &dev->rect ); dev->bitmap = CreateCompatibleBitmap( dev->hdc, dev->rect.right, dev->rect.bottom ); dev->oldobject = SelectObject( dev->hdc2, dev->bitmap ); BitBlt( dev->hdc2, 0, 0, dev->rect.right, dev->rect.bottom, dev->hdc, 0, 0, SRCCOPY ); SelectObject( dev->hdc2, dev->oldobject ); } void plD_eop_wingcc( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; Debug( "End of the page\n" ); CopySCRtoBMP( pls ); dev->already_erased = 2; NormalCursor(); if ( !pls->nopause ) { dev->waiting = 1; while ( GetMessage( &dev->msg, NULL, 0, 0 ) ) { TranslateMessage( &dev->msg ); switch ( (int) dev->msg.message ) { case WM_CONTEXTMENU: case WM_RBUTTONDOWN: TrackPopupMenu( dev->PopupMenu, TPM_CENTERALIGN | TPM_RIGHTBUTTON, LOWORD( dev->msg.lParam ), HIWORD( dev->msg.lParam ), 0, dev->hwnd, NULL ); break; case WM_CHAR: if ( ( (TCHAR) ( dev->msg.wParam ) == 32 ) || ( (TCHAR) ( dev->msg.wParam ) == 13 ) ) { dev->waiting = 0; } else if ( ( (TCHAR) ( dev->msg.wParam ) == 27 ) || ( (TCHAR) ( dev->msg.wParam ) == 'q' ) || ( (TCHAR) ( dev->msg.wParam ) == 'Q' ) ) { dev->waiting = 0; PostQuitMessage( 0 ); } break; case WM_LBUTTONDBLCLK: Debug( "WM_LBUTTONDBLCLK\t" ); dev->waiting = 0; break; case WM_COMMAND: switch ( LOWORD( dev->msg.wParam ) ) { case PopupPrint: Debug( "PopupPrint" ); PrintPage( pls ); break; case PopupNextPage: Debug( "PopupNextPage" ); dev->waiting = 0; break; case PopupQuit: Debug( "PopupQuit" ); dev->waiting = 0; PostQuitMessage( 0 ); break; } break; default: DispatchMessage( &dev->msg ); break; } if ( dev->waiting == 0 ) break; } } } //-------------------------------------------------------------------------- // Beginning of the new page //-------------------------------------------------------------------------- void plD_bop_wingcc( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; #ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif Debug( "Start of Page\t" ); // // Turn the cursor to a busy sign, clear the page by "invalidating" it // then reset the colours and pen width // BusyCursor(); dev->already_erased = 0; RedrawWindow( dev->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ERASENOW ); plD_state_wingcc( pls, PLSTATE_COLOR0 ); } void plD_tidy_wingcc( PLStream *pls ) { wingcc_Dev *dev = NULL; #ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { FT_Data *FT = (FT_Data *) pls->FT; plscmap0n( FT->ncol0_org ); plD_FreeType_Destroy( pls ); } #endif Debug( "plD_tidy_wingcc" ); if ( pls->dev != NULL ) { dev = (wingcc_Dev *) pls->dev; DeleteMenu( dev->PopupMenu, PopupPrint, 0 ); DeleteMenu( dev->PopupMenu, PopupNextPage, 0 ); DeleteMenu( dev->PopupMenu, PopupQuit, 0 ); DestroyMenu( dev->PopupMenu ); if ( dev->hdc2 != NULL ) DeleteDC( dev->hdc2 ); if ( dev->hdc != NULL ) ReleaseDC( dev->hwnd, dev->hdc ); if ( dev->bitmap != NULL ) DeleteObject( dev->bitmap ); free_mem( pls->dev ); } } //-------------------------------------------------------------------------- // plD_state_png() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_wingcc( PLStream *pls, PLINT op ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; switch ( op ) { case PLSTATE_COLOR0: case PLSTATE_COLOR1: dev->colour = RGB( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ); break; case PLSTATE_CMAP0: case PLSTATE_CMAP1: dev->colour = RGB( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ); break; } if ( dev->pen != NULL ) DeleteObject( dev->pen ); dev->pen = CreatePen( PS_SOLID, pls->width, dev->colour ); } void plD_esc_wingcc( PLStream *pls, PLINT op, void *ptr ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; switch ( op ) { case PLESC_GETC: break; case PLESC_FILL: plD_fill_polygon_wingcc( pls ); break; case PLESC_DOUBLEBUFFERING: break; case PLESC_XORMOD: if ( *(PLINT *) ( ptr ) == 0 ) SetROP2( dev->hdc, R2_COPYPEN ); else SetROP2( dev->hdc, R2_XORPEN ); break; #ifdef PL_HAVE_FREETYPE case PLESC_HAS_TEXT: plD_render_freetype_text( pls, (EscText *) ptr ); break; // case PLESC_LIKES_UNICODE: // plD_render_freetype_sym(pls, (EscText *)ptr); // break; #endif } } //-------------------------------------------------------------------------- // static void Resize( PLStream *pls ) // // This function calculates how to resize a window after a message has been // received from windows telling us the window has been changed. // It tries to recalculate the scale of the window so everything works out // just right. // The window is only resized if plplot has finished all of its plotting. // That means that if you resize while a picture is being plotted, // unpredictable results may result. The reason I do this is because the // resize function calls redraw window, which replays the whole plot. //-------------------------------------------------------------------------- static void Resize( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; #ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif Debug( "Resizing" ); if ( dev->waiting == 1 ) // Only resize the window IF plplot has finished with it { memcpy( &dev->oldrect, &dev->rect, sizeof ( RECT ) ); GetClientRect( dev->hwnd, &dev->rect ); Debug3( "[%d %d]", dev->rect.right, dev->rect.bottom ); if ( ( dev->rect.right > 0 ) && ( dev->rect.bottom > 0 ) ) // Check to make sure it isn't just minimised (i.e. zero size) { if ( memcmp( &dev->rect, &dev->oldrect, sizeof ( RECT ) ) != 0 ) // See if the window's changed size or not { dev->already_erased = 0; dev->width = dev->rect.right; dev->height = dev->rect.bottom; if ( dev->width > dev->height ) // Work out the scaling factor for the { // "virtual" (oversized) page dev->scale = (PLFLT) ( PIXELS_X - 1 ) / dev->width; } else { dev->scale = (PLFLT) PIXELS_Y / dev->height; } #ifdef PL_HAVE_FREETYPE if ( FT ) { FT->scale = dev->scale; FT->ymax = dev->height; } #endif } RedrawWindow( dev->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ERASENOW ); } else { memcpy( &dev->rect, &dev->oldrect, sizeof ( RECT ) ); // restore the old size to current size since the window is minimised } } } //-------------------------------------------------------------------------- // int SetRegValue(char *key_name, char *key_word, char *buffer,int dwType, int size) // // Function set the registry; if registary entry does not exist, it is // created. Actually, the key is created before it is set just to make sure // that is is there ! //-------------------------------------------------------------------------- static int SetRegValue( TCHAR *key_name, TCHAR *key_word, char *buffer, int dwType, int size ) { int j = 0; DWORD lpdwDisposition; HKEY hKey; j = RegCreateKeyEx( HKEY_CURRENT_USER, key_name, 0, // reserved NULL, // address of class string REG_OPTION_NON_VOLATILE, // special options flag KEY_WRITE, // desired security access NULL, // address of key security structure &hKey, // address of buffer for opened handle &lpdwDisposition // address of disposition value buffer ); if ( j == ERROR_SUCCESS ) { RegSetValueEx( hKey, key_word, 0, dwType, buffer, size ); RegCloseKey( hKey ); } return ( j ); } //-------------------------------------------------------------------------- // int GetRegValue(char *key_name, char *key_word, char *buffer, int size) // // Function reads the registry and gets a string value from it // buffer must be allocated by the caller, and the size is given in the size // paramater. // Return code is 1 for success, and 0 for failure. //-------------------------------------------------------------------------- static int GetRegValue( TCHAR *key_name, TCHAR *key_word, char *buffer, int size ) { int ret = 0; HKEY hKey; int dwType; int dwSize = size; if ( RegOpenKeyEx( HKEY_CURRENT_USER, key_name, 0, KEY_READ, &hKey ) == ERROR_SUCCESS ) { if ( RegQueryValueEx( hKey, key_word, 0, (LPDWORD) &dwType, buffer, (LPDWORD) &dwSize ) == ERROR_SUCCESS ) { ret = 1; } RegCloseKey( hKey ); } return ( ret ); } #ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void plD_pixel_wingcc (PLStream *pls, short x, short y) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is set in the current colour. //-------------------------------------------------------------------------- static void plD_pixel_wingcc( PLStream *pls, short x, short y ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; SetPixel( dev->hdc, x, y, dev->colour ); } static void plD_pixelV_wingcc( PLStream *pls, short x, short y ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; SetPixelV( dev->hdc, x, y, dev->colour ); } //-------------------------------------------------------------------------- // void plD_set_pixelV_wingcc (PLStream *pls, short x, short y,PLINT colour) // // callback function, of type "plD_set_pixel_fp", which specifies how a // single pixel is set in the s[ecified colour. This colour // by-passes plplot's internal table, and directly 'hits the hardware'. //-------------------------------------------------------------------------- static void plD_set_pixel_wingcc( PLStream *pls, short x, short y, PLINT colour ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; SetPixel( dev->hdc, x, y, colour ); } static void plD_set_pixelV_wingcc( PLStream *pls, short x, short y, PLINT colour ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; SetPixelV( dev->hdc, x, y, colour ); } //-------------------------------------------------------------------------- // void plD_read_pixel_wingcc (PLStream *pls, short x, short y) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is read. //-------------------------------------------------------------------------- static PLINT plD_read_pixel_wingcc( PLStream *pls, short x, short y ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; return ( GetPixel( dev->hdc, x, y ) ); } //-------------------------------------------------------------------------- // void init_freetype_lv1 (PLStream *pls) // // "level 1" initialisation of the freetype library. // "Level 1" initialisation calls plD_FreeType_init(pls) which allocates // memory to the pls->FT structure, then sets up the pixel callback // function. //-------------------------------------------------------------------------- static void init_freetype_lv1( PLStream *pls ) { FT_Data *FT; int x; wingcc_Dev *dev = (wingcc_Dev *) pls->dev; plD_FreeType_init( pls ); FT = (FT_Data *) pls->FT; // // Work out if our device support "fast" pixel setting // and if so, use that instead of "slow" pixel setting // x = GetDeviceCaps( dev->hdc, RASTERCAPS ); if ( x & RC_BITBLT ) FT->pixel = (plD_pixel_fp) plD_pixelV_wingcc; else FT->pixel = (plD_pixel_fp) plD_pixel_wingcc; // // See if we have a 24 bit device (or better), in which case // we can use the better antialaaising. // if ( GetDeviceCaps( dev->hdc, BITSPIXEL ) > 24 ) { FT->BLENDED_ANTIALIASING = 1; FT->read_pixel = (plD_read_pixel_fp) plD_read_pixel_wingcc; if ( x & RC_BITBLT ) FT->set_pixel = (plD_set_pixel_fp) plD_set_pixelV_wingcc; else FT->set_pixel = (plD_set_pixel_fp) plD_set_pixel_wingcc; } } //-------------------------------------------------------------------------- // void init_freetype_lv2 (PLStream *pls) // // "Level 2" initialisation of the freetype library. // "Level 2" fills in a few setting that aren't public until after the // graphics sub-system has been initialised. // The "level 2" initialisation fills in a few things that are defined // later in the initialisation process for the GD driver. // // FT->scale is a scaling factor to convert co-ordinates. This is used by // the GD and other drivers to scale back a larger virtual page and this // eliminate the "hidden line removal bug". Set it to 1 if your device // doesn't have scaling. // // Some coordinate systems have zero on the bottom, others have zero on // the top. Freetype does it one way, and most everything else does it the // other. To make sure everything is working ok, we have to "flip" the // coordinates, and to do this we need to know how big in the Y dimension // the page is, and whether we have to invert the page or leave it alone. // // FT->ymax specifies the size of the page FT->invert_y=1 tells us to // invert the y-coordinates, FT->invert_y=0 will not invert the // coordinates. //-------------------------------------------------------------------------- static void init_freetype_lv2( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; FT_Data *FT = (FT_Data *) pls->FT; FT->scale = dev->scale; FT->ymax = dev->height; FT->invert_y = 1; if ( ( FT->want_smooth_text == 1 ) && ( FT->BLENDED_ANTIALIASING == 0 ) ) // do we want to at least *try* for smoothing ? { FT->ncol0_org = pls->ncol0; // save a copy of the original size of ncol0 FT->ncol0_xtra = 16777216 - ( pls->ncol1 + pls->ncol0 ); // work out how many free slots we have FT->ncol0_width = max_number_of_grey_levels_used_in_text_smoothing; // find out how many different shades of anti-aliasing we can do FT->ncol0_width = max_number_of_grey_levels_used_in_text_smoothing; // set a maximum number of shades plscmap0n( FT->ncol0_org + ( FT->ncol0_width * pls->ncol0 ) ); // redefine the size of cmap0 // the level manipulations are to turn off the plP_state(PLSTATE_CMAP0) // call in plscmap0 which (a) leads to segfaults since the GD image is // not defined at this point and (b) would be inefficient in any case since // setcmap is always called later (see plD_bop_png) to update the driver // color palette to be consistent with cmap0. { PLINT level_save; level_save = pls->level; pls->level = 0; pl_set_extended_cmap0( pls, FT->ncol0_width, FT->ncol0_org ); // call the function to add the extra cmap0 entries and calculate stuff pls->level = level_save; } FT->smooth_text = 1; // Yippee ! We had success setting up the extended cmap0 } else if ( ( FT->want_smooth_text == 1 ) && ( FT->BLENDED_ANTIALIASING == 1 ) ) // If we have a truecolour device, we wont even bother trying to change the palette { FT->smooth_text = 1; } } #endif //-------------------------------------------------------------------------- // static void UpdatePageMetrics ( PLStream *pls, char flag ) // // UpdatePageMetrics is a simple function which simply gets new vales for // a changed DC, be it swapping from printer to screen or vice-versa. // The flag variable is used to tell the function if it is updating // from the printer (1) or screen (0). //-------------------------------------------------------------------------- static void UpdatePageMetrics( PLStream *pls, char flag ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; #ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif if ( flag == 1 ) { dev->width = GetDeviceCaps( dev->hdc, HORZRES ); // Get the page size from the printer dev->height = GetDeviceCaps( dev->hdc, VERTRES ); } else { GetClientRect( dev->hwnd, &dev->rect ); dev->width = dev->rect.right; dev->height = dev->rect.bottom; } if ( dev->width > dev->height ) // Work out the scaling factor for the { // "virtual" (oversized) page dev->scale = (PLFLT) ( PIXELS_X - 1 ) / dev->width; } else { dev->scale = (PLFLT) PIXELS_Y / dev->height; } #ifdef PL_HAVE_FREETYPE if ( FT ) // If we are using freetype, then set it up next { FT->scale = dev->scale; FT->ymax = dev->height; if ( GetDeviceCaps( dev->hdc, RASTERCAPS ) & RC_BITBLT ) FT->pixel = (plD_pixel_fp) plD_pixelV_wingcc; else FT->pixel = (plD_pixel_fp) plD_pixel_wingcc; } #endif pls->xdpi = GetDeviceCaps( dev->hdc, HORZRES ) / GetDeviceCaps( dev->hdc, HORZSIZE ) * 25.4; pls->ydpi = GetDeviceCaps( dev->hdc, VERTRES ) / GetDeviceCaps( dev->hdc, VERTSIZE ) * 25.4; plP_setpxl( dev->scale * pls->xdpi / 25.4, dev->scale * pls->ydpi / 25.4 ); plP_setphy( 0, (PLINT) ( dev->scale * dev->width ), 0, (PLINT) ( dev->scale * dev->height ) ); } //-------------------------------------------------------------------------- // static void PrintPage ( PLStream *pls ) // // Function brings up a standard printer dialog and, after the user // has selected a printer, replots the current page to the windows // printer. //-------------------------------------------------------------------------- static void PrintPage( PLStream *pls ) { wingcc_Dev *dev = (wingcc_Dev *) pls->dev; #ifdef PL_HAVE_FREETYPE FT_Data *FT = (FT_Data *) pls->FT; #endif PRINTDLG Printer; DOCINFO docinfo; // // Reset the docinfo structure to 0 and set it's fields up // This structure is used to supply a name to the print queue // ZeroMemory( &docinfo, sizeof ( docinfo ) ); docinfo.cbSize = sizeof ( docinfo ); docinfo.lpszDocName = _T( "Plplot Page" ); // // Reset out printer structure to zero and initialise it // ZeroMemory( &Printer, sizeof ( PRINTDLG ) ); Printer.lStructSize = sizeof ( PRINTDLG ); Printer.hwndOwner = dev->hwnd; Printer.Flags = PD_NOPAGENUMS | PD_NOSELECTION | PD_RETURNDC; Printer.nCopies = 1; // // Call the printer dialog function. // If the user has clicked on "Print", then we will continue // processing and print out the page. // if ( PrintDlg( &Printer ) != 0 ) { // // Before doing anything, we will take some backup copies // of the existing values for page size and the like, because // all we are going to do is a quick and dirty modification // of plplot's internals to match the new page size and hope // it all works out ok. After that, we will manip the values, // and when all is done, restore them. // if ( ( dev->push = GlobalAlloc( GMEM_ZEROINIT, sizeof ( wingcc_Dev ) ) ) != NULL ) { BusyCursor(); memcpy( dev->push, dev, sizeof ( wingcc_Dev ) ); dev->hdc = dev->PRNT_hdc = Printer.hDC; // Copy the printer HDC UpdatePageMetrics( pls, 1 ); #ifdef PL_HAVE_FREETYPE if ( FT ) // If we are using freetype, then set it up next { dev->FT_smooth_text = FT->smooth_text; // When printing, we don't want smoothing FT->smooth_text = 0; } #endif // // Now the stuff that actually does the printing !! // StartDoc( dev->hdc, &docinfo ); plRemakePlot( pls ); EndDoc( dev->hdc ); // // Now to undo everything back to what it was for the screen // dev->hdc = dev->SCRN_hdc; // Reset the screen HDC to the default UpdatePageMetrics( pls, 0 ); #ifdef PL_HAVE_FREETYPE if ( FT ) // If we are using freetype, then set it up next { FT->smooth_text = dev->FT_smooth_text; } #endif memcpy( dev, dev->push, sizeof ( wingcc_Dev ) ); // POP our "stack" now to restore the values GlobalFree( dev->push ); NormalCursor(); RedrawWindow( dev->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ERASENOW ); } } } #else int pldummy_wingcc() { return ( 0 ); } #endif // PLD_wingccdev plplot-5.10.0+dfsg/drivers/wxwidgets.driver_info.in 644 1750 1750 14411466747272 212670ustar andrewandrewwxwidgets:wxWidgets Driver:1:wxwidgets:51:wxwidgets wxpng:wxWidgets PNG Driver:0:wxwidgets:52:wxpng plplot-5.10.0+dfsg/drivers/hpgl.driver_info.in 644 1750 1750 31111466747272 201700ustar andrewandrewhp7470:HP 7470 Plotter File (HPGL Cartridge, Small Plotter):0:hpgl:34:hp7470 hp7580:HP 7580 Plotter File (Large Plotter):0:hpgl:35:hp7580 lj_hpgl:HP Laserjet III, HPGL emulation mode:0:hpgl:36:lj_hpgl plplot-5.10.0+dfsg/drivers/tkwin.c 644 1750 1750 15425411647527346 160000ustar andrewandrew// $Id: tkwin.c 11975 2011-10-19 11:05:10Z andrewross $ // // PLplot Tk device driver. // // Copyright (C) 2004 Maurice LeBrun // Copyright (C) 2004 Joao Cardoso // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // This device driver is designed to be used by a PlPlotter, and in fact requires // the existence of an enclosing PlPlotter. // // The idea is that this should develop into a completely cross-platform driver // for use by the cross platform Tk system. // // #include "plDevs.h" #define DEBUG #ifdef PLD_tkwin #define NEED_PLDEBUG #include "plplotP.h" #include "pltkwd.h" #include "drivers.h" #include "plevent.h" #define _TCLINT #ifdef USE_TCL_STUBS // Unfortunately, tkInt.h ends up loading Malloc.h under Windows // So we have to deal with this mess #undef malloc #undef free #undef realloc #undef calloc #if defined ( __WIN32__ ) || defined ( MAC_TCL ) #include #else #include #endif #define malloc ckalloc #define free( m ) ckfree( (char *) m ) #define realloc ckrealloc #define calloc ckcalloc #else #if defined ( __WIN32__ ) || defined ( MAC_TCL ) #include #else #include #endif #endif #ifdef ckalloc #undef ckalloc #define ckalloc malloc #endif #ifdef ckfree #undef ckfree #define ckfree free #endif #ifdef free #undef free #endif // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_tkwin = "tkwin:New tk driver:1:tkwin:45:tkwin\n"; void * ckcalloc( size_t nmemb, size_t size ); // // We want to use the 'pure Tk' interface. On Unix we can use // some direct calls to X instead of Tk, if we want, although // that code hasn't been tested for some time. So this define // is required on Windows/MacOS and perhaps optional on Unix. // #define USE_TK #ifdef __WIN32__ #define XSynchronize( display, bool ) { display->request++; } #define XSync( display, bool ) { display->request++; } #define XFlush( display ) #endif // Dummy definition of PlPlotter containing first few fields typedef struct PlPlotter { Tk_Window tkwin; // Window that embodies the frame. NULL // means that the window has been destroyed // but the data structures haven't yet been // cleaned up. // Display *display; // Display containing widget. Used, among // other things, so that resources can be // freed even after tkwin has gone away. // Tcl_Interp *interp; // Interpreter associated with // widget. Used to delete widget // command. // } PlPlotter; void CopyColour( XColor* from, XColor* to ); void Tkw_StoreColor( PLStream* pls, TkwDisplay* tkwd, XColor* col ); static int pltk_AreWeGrayscale( PlPlotter *plf ); void PlplotterAtEop( Tcl_Interp *interp, register PlPlotter *plPlotterPtr ); void PlplotterAtBop( Tcl_Interp *interp, register PlPlotter *plPlotterPtr ); static int synchronize = 0; // change to 1 for synchronized operation // for debugging only // Number of instructions to skip between querying the X server for events #define MAX_INSTR 20 // Pixels/mm #define PHYSICAL 0 // Enables physical scaling.. // Set constants for dealing with colormap. In brief: // // ccmap When set, turns on custom color map // // XWM_COLORS Number of low "pixel" values to copy. // CMAP0_COLORS Color map 0 entries. // CMAP1_COLORS Color map 1 entries. // MAX_COLORS Maximum colors period. // // See Init_CustomCmap() and Init_DefaultCmap() for more info. // Set ccmap at your own risk -- still under development. // // plplot_tkwin_ccmap is statically defined in pltkwd.h. Note that // plplotter.c also includes that header and uses that variable. #define XWM_COLORS 70 #define CMAP0_COLORS 16 #define CMAP1_COLORS 50 #define MAX_COLORS 256 #ifndef USE_TK // Variables to hold RGB components of given colormap. // Used in an ugly hack to get past some X11R5 and TK limitations. static int sxwm_colors_set; static XColor sxwm_colors[MAX_COLORS]; #endif // Keep pointers to all the displays in use static TkwDisplay *tkwDisplay[PLTKDISPLAYS]; #if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) static unsigned char CreatePixmapStatus; static int CreatePixmapErrorHandler( Display *display, XErrorEvent *error ); #endif // Function prototypes // Initialization static void Init( PLStream *pls ); static void InitColors( PLStream *pls ); static void AllocCustomMap( PLStream *pls ); static void AllocCmap0( PLStream *pls ); static void AllocCmap1( PLStream *pls ); static void CreatePixmap( PLStream *pls ); static void GetVisual( PLStream *pls ); static void AllocBGFG( PLStream *pls ); // Escape function commands static void ExposeCmd( PLStream *pls, PLDisplay *ptr ); static void RedrawCmd( PLStream *pls ); static void ResizeCmd( PLStream *pls, PLDisplay *ptr ); #ifndef USE_TK static void GetCursorCmd( PLStream *pls, PLGraphicsIn *ptr ); #endif static void FillPolygonCmd( PLStream *pls ); #ifdef USING_PLESC_COPY static void CopyCommand( PLStream *pls ); #endif // Miscellaneous static void StoreCmap0( PLStream *pls ); static void StoreCmap1( PLStream *pls ); static void WaitForPage( PLStream *pls ); void plD_dispatch_init_tkwin( PLDispatchTable *pdt ); void plD_init_tkwin( PLStream * ); void plD_line_tkwin( PLStream *, short, short, short, short ); void plD_polyline_tkwin( PLStream *, short *, short *, PLINT ); void plD_eop_tkwin( PLStream * ); void plD_bop_tkwin( PLStream * ); void plD_tidy_tkwin( PLStream * ); void plD_state_tkwin( PLStream *, PLINT ); void plD_esc_tkwin( PLStream *, PLINT, void * ); void plD_open_tkwin( PLStream *pls ); void plD_dispatch_init_tkwin( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "PLplot Tk plotter"; pdt->pl_DevName = "tkwin"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 45; pdt->pl_init = (plD_init_fp) plD_init_tkwin; pdt->pl_line = (plD_line_fp) plD_line_tkwin; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_tkwin; pdt->pl_eop = (plD_eop_fp) plD_eop_tkwin; pdt->pl_bop = (plD_bop_fp) plD_bop_tkwin; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_tkwin; pdt->pl_state = (plD_state_fp) plD_state_tkwin; pdt->pl_esc = (plD_esc_fp) plD_esc_tkwin; } //-------------------------------------------------------------------------- // plD_init_tkwin() // // Initialize device. // Tk-dependent stuff done in plD_open_tkwin() and Init(). //-------------------------------------------------------------------------- void plD_init_tkwin( PLStream *pls ) { TkwDev *dev; float pxlx, pxly; int xmin = 0; int xmax = PIXELS_X - 1; int ymin = 0; int ymax = PIXELS_Y - 1; dbug_enter( "plD_init_tkw" ); pls->termin = 1; // Is an interactive terminal pls->dev_flush = 1; // Handle our own flushes pls->dev_fill0 = 1; // Handle solid fills pls->plbuf_write = 1; // Activate plot buffer // The real meat of the initialization done here if ( pls->dev == NULL ) plD_open_tkwin( pls ); dev = (TkwDev *) pls->dev; Init( pls ); // Get ready for plotting dev->xlen = (short) ( xmax - xmin ); dev->ylen = (short) ( ymax - ymin ); dev->xscale_init = (double) dev->init_width / (double) dev->xlen; dev->yscale_init = (double) dev->init_height / (double) dev->ylen; dev->xscale = dev->xscale_init; dev->yscale = dev->yscale_init; #if PHYSICAL pxlx = (PLFLT) ( (double) PIXELS_X / dev->width * DPMM ); pxly = (PLFLT) ( (double) PIXELS_Y / dev->height * DPMM ); #else pxlx = (PLFLT) ( (double) PIXELS_X / LPAGE_X ); pxly = (PLFLT) ( (double) PIXELS_Y / LPAGE_Y ); #endif plP_setpxl( pxlx, pxly ); plP_setphy( xmin, xmax, ymin, ymax ); } //-------------------------------------------------------------------------- // plD_open_tkwin() // // Performs basic driver initialization, without actually opening or // modifying a window. May be called by the outside world before plinit // in case the caller needs early access to the driver internals (not // very common -- currently only used externally by plplotter). //-------------------------------------------------------------------------- void plD_open_tkwin( PLStream *pls ) { TkwDev *dev; TkwDisplay *tkwd; int i; dbug_enter( "plD_open_tkw" ); // Allocate and initialize device-specific data if ( pls->dev != NULL ) plwarn( "plD_open_tkw: device pointer is already set" ); pls->dev = (TkwDev *) calloc( 1, (size_t) sizeof ( TkwDev ) ); if ( pls->dev == NULL ) plexit( "plD_init_tkw: Out of memory." ); dev = (TkwDev *) pls->dev; // Variables used in querying the X server for events dev->instr = 0; dev->max_instr = MAX_INSTR; // See if display matches any already in use, and if so use that dev->tkwd = NULL; for ( i = 0; i < PLTKDISPLAYS; i++ ) { if ( tkwDisplay[i] == NULL ) { continue; } else if ( pls->FileName == NULL && tkwDisplay[i]->displayName == NULL ) { dev->tkwd = tkwDisplay[i]; break; } else if ( pls->FileName == NULL || tkwDisplay[i]->displayName == NULL ) { continue; } else if ( strcmp( tkwDisplay[i]->displayName, pls->FileName ) == 0 ) { dev->tkwd = tkwDisplay[i]; break; } } // If no display matched, create a new one if ( dev->tkwd == NULL ) { dev->tkwd = (TkwDisplay *) calloc( 1, (size_t) sizeof ( TkwDisplay ) ); if ( dev->tkwd == NULL ) plexit( "Init: Out of memory." ); for ( i = 0; i < PLTKDISPLAYS; i++ ) { if ( tkwDisplay[i] == NULL ) break; } if ( i == PLTKDISPLAYS ) plexit( "Init: Out of tkwDisplay's." ); tkwDisplay[i] = tkwd = (TkwDisplay *) dev->tkwd; tkwd->nstreams = 1; // // If we don't have a tk widget we're being called on, then // abort operations now // if ( pls->plPlotterPtr == NULL ) { plexit( "No tk plframe widget to connect to" ); } // Old version for MacOS Tk8.0 // // char deflt[] = "Macintosh:0"; // pls->FileName = deflt; // tkwd->display = (Display*) TkpOpenDisplay(pls->FileName); // // Open display #if defined ( MAC_TCL ) || defined ( __WIN32__ ) if ( !pls->FileName ) { // // Need to strdup because Tk has allocated the screen name, // but we will actually 'free' it later ourselves, and therefore // need to own the memory. // pls->FileName = plstrdup( TkGetDefaultScreenName( NULL, NULL ) ); } tkwd->display = pls->plPlotterPtr->display; #else tkwd->display = XOpenDisplay( pls->FileName ); #endif if ( tkwd->display == NULL ) { plexit( "Can't open display" ); } tkwd->displayName = pls->FileName; tkwd->screen = DefaultScreen( tkwd->display ); if ( synchronize ) { XSynchronize( tkwd->display, 1 ); } // Get colormap and visual tkwd->map = Tk_Colormap( pls->plPlotterPtr->tkwin ); GetVisual( pls ); // // Figure out if we have a color display or not. // Default is color IF the user hasn't specified and IF the output device is // not grayscale. // if ( pls->colorset ) tkwd->color = pls->color; else { pls->color = 1; tkwd->color = !pltk_AreWeGrayscale( pls->plPlotterPtr ); } // Allocate & set background and foreground colors AllocBGFG( pls ); pltkwin_setBGFG( pls ); } // Display matched, so use existing display data else { tkwd = (TkwDisplay *) dev->tkwd; tkwd->nstreams++; } tkwd->ixwd = i; } //-------------------------------------------------------------------------- // plD_line_tkwin() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_tkwin( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; if ( dev->flags & 1 ) return; y1 = dev->ylen - y1; y2 = dev->ylen - y2; x1 = (int) ( x1 * dev->xscale ); x2 = (int) ( x2 * dev->xscale ); y1 = (int) ( y1 * dev->yscale ); y2 = (int) ( y2 * dev->yscale ); if ( dev->write_to_window ) XDrawLine( tkwd->display, dev->window, dev->gc, x1, y1, x2, y2 ); if ( dev->write_to_pixmap ) XDrawLine( tkwd->display, dev->pixmap, dev->gc, x1, y1, x2, y2 ); } //-------------------------------------------------------------------------- // plD_polyline_tkwin() // // Draw a polyline in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_polyline_tkwin( PLStream *pls, short *xa, short *ya, PLINT npts ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; PLINT i; XPoint _pts[PL_MAXPOLY]; XPoint *pts; if ( dev->flags & 1 ) return; if ( npts > PL_MAXPOLY ) { pts = (XPoint *) malloc( sizeof ( XPoint ) * (size_t) npts ); } else { pts = _pts; } for ( i = 0; i < npts; i++ ) { pts[i].x = (short) ( dev->xscale * xa[i] ); pts[i].y = (short) ( dev->yscale * ( dev->ylen - ya[i] ) ); } if ( dev->write_to_window ) XDrawLines( tkwd->display, dev->window, dev->gc, pts, npts, CoordModeOrigin ); if ( dev->write_to_pixmap ) XDrawLines( tkwd->display, dev->pixmap, dev->gc, pts, npts, CoordModeOrigin ); if ( npts > PL_MAXPOLY ) { free( pts ); } } //-------------------------------------------------------------------------- // plD_eop_tkwin() // // End of page. User must hit return (or third mouse button) to continue. //-------------------------------------------------------------------------- void plD_eop_tkwin( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; dbug_enter( "plD_eop_tkw" ); if ( dev->flags & 1 ) return; XFlush( tkwd->display ); if ( pls->db ) ExposeCmd( pls, NULL ); if ( !pls->nopause ) WaitForPage( pls ); } //-------------------------------------------------------------------------- // WaitForPage() // // This routine waits for the user to advance the plot, while handling // all other events. //-------------------------------------------------------------------------- static void WaitForPage( PLStream *pls ) { PlPlotter *plf = pls->plPlotterPtr; TkwDev *dev = (TkwDev *) pls->dev; dbug_enter( "WaitForPage" ); dev->flags &= 1; if ( plf == NULL ) { plwarn( "WaitForPage: Illegal call --- driver can't find enclosing PlPlotter" ); return; } PlplotterAtEop( plf->interp, plf ); while ( !( dev->flags ) && !Tcl_InterpDeleted( plf->interp ) && ( Tk_GetNumMainWindows() > 0 ) ) { Tcl_DoOneEvent( 0 ); } if ( Tcl_InterpDeleted( plf->interp ) || ( Tk_GetNumMainWindows() <= 0 ) ) { dev->flags |= 1; } dev->flags &= 1; } //-------------------------------------------------------------------------- // plD_bop_tkwin() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_tkwin( PLStream *pls ) { PlPlotter *plf = pls->plPlotterPtr; TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; XRectangle xrect; xrect.x = 0; xrect.y = 0; xrect.width = (short unsigned) dev->width; xrect.height = (short unsigned) dev->height; dbug_enter( "plD_bop_tkw" ); if ( dev->flags & 1 ) return; if ( dev->write_to_window ) { #ifdef MAC_TCL // MacTk only has these X calls XSetForeground( tkwd->display, dev->gc, tkwd->cmap0[0].pixel ); XFillRectangles( tkwd->display, dev->window, dev->gc, &xrect, 1 ); XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); #else XClearWindow( tkwd->display, dev->window ); #endif } if ( dev->write_to_pixmap ) { XSetForeground( tkwd->display, dev->gc, tkwd->cmap0[0].pixel ); XFillRectangles( tkwd->display, dev->pixmap, dev->gc, &xrect, 1 ); XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); } XSync( tkwd->display, 0 ); pls->page++; PlplotterAtBop( plf->interp, plf ); } //-------------------------------------------------------------------------- // plD_tidy_tkwin() // // Close graphics file //-------------------------------------------------------------------------- void plD_tidy_tkwin( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; dbug_enter( "plD_tidy_tkw" ); tkwd->nstreams--; if ( tkwd->nstreams == 0 ) { int ixwd = tkwd->ixwd; XFreeGC( tkwd->display, dev->gc ); #if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) XCloseDisplay( tkwd->display ); #endif free_mem( tkwDisplay[ixwd] ); } // // Vince removed this November 1999. It seems as if a simple // 'plframe .p ; destroy .p' leaves a temporary buf file open // if we clear this flag here. It should be checked and then // cleared by whoever called us. An alternative fix would // be to carry out the check/tidy here. The plframe widget // handles this stuff for us. // // pls->plbuf_write = 0; } //-------------------------------------------------------------------------- // plD_state_tkwin() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_tkwin( PLStream *pls, PLINT op ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; dbug_enter( "plD_state_tkw" ); if ( dev->flags & 1 ) return; switch ( op ) { case PLSTATE_WIDTH: break; case PLSTATE_COLOR0: { int icol0 = pls->icol0; if ( tkwd->color ) { if ( icol0 == PL_RGB_COLOR ) { PLColor_to_TkColor( &pls->curcolor, &dev->curcolor ); Tkw_StoreColor( pls, tkwd, &dev->curcolor ); } else { dev->curcolor = tkwd->cmap0[icol0]; } XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); } else { dev->curcolor = tkwd->fgcolor; XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); } break; } case PLSTATE_COLOR1: { int icol1; if ( tkwd->ncol1 == 0 ) AllocCmap1( pls ); if ( tkwd->ncol1 < 2 ) break; icol1 = ( pls->icol1 * ( tkwd->ncol1 - 1 ) ) / ( pls->ncol1 - 1 ); if ( tkwd->color ) dev->curcolor = tkwd->cmap1[icol1]; else dev->curcolor = tkwd->fgcolor; XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); break; } case PLSTATE_CMAP0: pltkwin_setBGFG( pls ); StoreCmap0( pls ); break; case PLSTATE_CMAP1: StoreCmap1( pls ); break; } } //-------------------------------------------------------------------------- // plD_esc_tkwin() // // Escape function. // // Functions: // // PLESC_EH Handle pending events // PLESC_EXPOSE Force an expose // PLESC_FILL Fill polygon // PLESC_FLUSH Flush X event buffer // PLESC_GETC Get coordinates upon mouse click // PLESC_REDRAW Force a redraw // PLESC_RESIZE Force a resize //-------------------------------------------------------------------------- void plD_esc_tkwin( PLStream *pls, PLINT op, void *ptr ) { TkwDev *dev = (TkwDev *) pls->dev; #ifndef USE_TK TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; #endif dbug_enter( "plD_esc_tkw" ); if ( dev->flags & 1 ) return; switch ( op ) { case PLESC_EH: #ifndef USE_TK HandleEvents( pls ); #endif break; case PLESC_EXPOSE: ExposeCmd( pls, (PLDisplay *) ptr ); break; case PLESC_FILL: FillPolygonCmd( pls ); break; case PLESC_FLUSH: #ifndef USE_TK HandleEvents( pls ); XFlush( tkwd->display ); #endif break; case PLESC_GETC: #ifndef USE_TK GetCursorCmd( pls, (PLGraphicsIn *) ptr ); #endif break; case PLESC_REDRAW: RedrawCmd( pls ); break; case PLESC_RESIZE: ResizeCmd( pls, (PLDisplay *) ptr ); break; // Added by Vince, disabled by default since we want a minimal patch #ifdef USING_PLESC_COPY case PLESC_COPY: CopyCommand( pls ); break; #endif } } #ifdef USING_PLESC_COPY //-------------------------------------------------------------------------- // CopyCommand() // // Copy a rectangle to a new part of the image. // Points described in first 3 elements of pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void CopyCommand( PLStream *pls ) { int x0, w, x1, y0, h, y1; TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; x0 = (int) ( dev->xscale * pls->dev_x[0] ); x1 = (int) ( dev->xscale * pls->dev_x[2] ); y0 = (int) ( dev->yscale * ( dev->ylen - pls->dev_y[0] ) ); y1 = (int) ( dev->yscale * ( dev->ylen - pls->dev_y[2] ) ); w = (int) ( dev->xscale * ( pls->dev_x[1] - pls->dev_x[0] ) ); h = (int) ( -dev->yscale * ( pls->dev_y[1] - pls->dev_y[0] ) ); if ( dev->write_to_window ) XCopyArea( tkwd->display, dev->window, dev->window, dev->gc, x0, y0, w, h, x1, y1 ); if ( dev->write_to_pixmap ) XCopyArea( tkwd->display, dev->pixmap, dev->pixmap, dev->gc, x0, y0, w, h, x1, y1 ); } #endif //-------------------------------------------------------------------------- // FillPolygonCmd() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. // Only solid color fill supported. //-------------------------------------------------------------------------- static void FillPolygonCmd( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; XPoint _pts[PL_MAXPOLY]; XPoint *pts; int i; if ( pls->dev_npts > PL_MAXPOLY ) { pts = (XPoint *) malloc( sizeof ( XPoint ) * (size_t) ( pls->dev_npts ) ); } else { pts = _pts; } for ( i = 0; i < pls->dev_npts; i++ ) { pts[i].x = (short) ( dev->xscale * pls->dev_x[i] ); pts[i].y = (short) ( dev->yscale * ( dev->ylen - pls->dev_y[i] ) ); } // Fill polygons if ( dev->write_to_window ) XFillPolygon( tkwd->display, dev->window, dev->gc, pts, pls->dev_npts, Nonconvex, CoordModeOrigin ); if ( dev->write_to_pixmap ) XFillPolygon( tkwd->display, dev->pixmap, dev->gc, pts, pls->dev_npts, Nonconvex, CoordModeOrigin ); // If in debug mode, draw outline of boxes being filled #ifdef DEBUG if ( pls->debug ) { XSetForeground( tkwd->display, dev->gc, tkwd->fgcolor.pixel ); if ( dev->write_to_window ) XDrawLines( tkwd->display, dev->window, dev->gc, pts, pls->dev_npts, CoordModeOrigin ); if ( dev->write_to_pixmap ) XDrawLines( tkwd->display, dev->pixmap, dev->gc, pts, pls->dev_npts, CoordModeOrigin ); XSetForeground( tkwd->display, dev->gc, dev->curcolor.pixel ); } #endif if ( pls->dev_npts > PL_MAXPOLY ) { free( pts ); } } //-------------------------------------------------------------------------- // Init() // // Xlib initialization routine. // // Controlling routine for X window creation and/or initialization. // The user may customize the window in the following ways: // // display: pls->OutFile (use plsfnam() or -display option) // size: pls->xlength, pls->ylength (use plspage() or -geo option) // bg color: pls->cmap0[0] (use plscolbg() or -bg option) //-------------------------------------------------------------------------- static void Init( PLStream *pls ) { PlPlotter *plf; TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; dbug_enter( "Init" ); dev->window = (Window) pls->window_id; plf = pls->plPlotterPtr; if ( plf == NULL ) { plwarn( "Init: Illegal call --- driver can't find enclosing PlPlotter" ); return; } // Initialize colors InitColors( pls ); #ifndef MAC_TCL XSetWindowColormap( tkwd->display, dev->window, tkwd->map ); #else #endif // Set up GC for ordinary draws if ( !dev->gc ) dev->gc = XCreateGC( tkwd->display, dev->window, 0, 0 ); // Set up GC for rubber-band draws if ( !tkwd->gcXor ) { XGCValues gcValues; unsigned long mask; gcValues.background = tkwd->cmap0[0].pixel; gcValues.foreground = 0xFF; gcValues.function = GXxor; mask = GCForeground | GCBackground | GCFunction; tkwd->gcXor = XCreateGC( tkwd->display, dev->window, mask, &gcValues ); } // Get initial drawing area dimensions dev->width = (unsigned int) Tk_Width( plf->tkwin ); dev->height = (unsigned int) Tk_Height( plf->tkwin ); dev->border = (unsigned int) Tk_InternalBorderWidth( plf->tkwin ); tkwd->depth = (unsigned int) Tk_Depth( plf->tkwin ); dev->init_width = dev->width; dev->init_height = dev->height; // Set up flags that determine what we are writing to // If nopixmap is set, ignore db if ( pls->nopixmap ) { dev->write_to_pixmap = 0; pls->db = 0; } else { dev->write_to_pixmap = 1; } dev->write_to_window = !pls->db; // Create pixmap for holding plot image (for expose events). if ( dev->write_to_pixmap ) CreatePixmap( pls ); // Set drawing color plD_state_tkwin( pls, PLSTATE_COLOR0 ); XSetWindowBackground( tkwd->display, dev->window, tkwd->cmap0[0].pixel ); XSetBackground( tkwd->display, dev->gc, tkwd->cmap0[0].pixel ); } //-------------------------------------------------------------------------- // ExposeCmd() // // Event handler routine for expose events. // These are "pure" exposures (no resize), so don't need to clear window. //-------------------------------------------------------------------------- static void ExposeCmd( PLStream *pls, PLDisplay *pldis ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; int x, y, width, height; dbug_enter( "ExposeCmd" ); // Return if plD_init_tkw hasn't been called yet if ( dev == NULL ) { plwarn( "ExposeCmd: Illegal call -- driver uninitialized" ); return; } // Exposed area. If unspecified, the entire window is used. if ( pldis == NULL ) { x = 0; y = 0; width = (int) dev->width; height = (int) dev->height; } else { x = (int) pldis->x; y = (int) pldis->y; width = (int) pldis->width; height = (int) pldis->height; } // Usual case: refresh window from pixmap // DEBUG option: draws rectangle around refreshed region XSync( tkwd->display, 0 ); if ( dev->write_to_pixmap ) { XCopyArea( tkwd->display, dev->pixmap, dev->window, dev->gc, x, y, (unsigned int) width, (unsigned int) height, x, y ); XSync( tkwd->display, 0 ); #ifdef DEBUG if ( pls->debug ) { XPoint pts[5]; int x0 = x, x1 = x + width, y0 = y, y1 = y + height; pts[0].x = (short) x0; pts[0].y = (short) y0; pts[1].x = (short) x1; pts[1].y = (short) y0; pts[2].x = (short) x1; pts[2].y = (short) y1; pts[3].x = (short) x0; pts[3].y = (short) y1; pts[4].x = (short) x0; pts[4].y = (short) y0; XDrawLines( tkwd->display, dev->window, dev->gc, pts, 5, CoordModeOrigin ); } #endif } else { plRemakePlot( pls ); XFlush( tkwd->display ); } } //-------------------------------------------------------------------------- // ResizeCmd() // // Event handler routine for resize events. //-------------------------------------------------------------------------- static void ResizeCmd( PLStream *pls, PLDisplay *pldis ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; int write_to_window = dev->write_to_window; dbug_enter( "ResizeCmd" ); // Return if plD_init_tkw hasn't been called yet if ( dev == NULL ) { plwarn( "ResizeCmd: Illegal call -- driver uninitialized" ); return; } // Return if pointer to window not specified. if ( pldis == NULL ) { plwarn( "ResizeCmd: Illegal call -- window pointer uninitialized" ); return; } // Reset current window bounds dev->width = pldis->width; dev->height = pldis->height; dev->xscale = dev->width / (double) dev->init_width; dev->yscale = dev->height / (double) dev->init_height; dev->xscale = dev->xscale * dev->xscale_init; dev->yscale = dev->yscale * dev->yscale_init; #if PHYSICAL { float pxlx = (double) PIXELS_X / dev->width * DPMM; float pxly = (double) PIXELS_Y / dev->height * DPMM; plP_setpxl( pxlx, pxly ); } #endif // Note: the following order MUST be obeyed -- if you instead redraw into // the window and then copy it to the pixmap, off-screen parts of the window // may contain garbage which is then transferred to the pixmap (and thus // will not go away after an expose). // // Resize pixmap using new dimensions if ( dev->write_to_pixmap ) { dev->write_to_window = 0; #if defined ( __WIN32__ ) || defined ( MAC_TCL ) Tk_FreePixmap( tkwd->display, dev->pixmap ); #else // Vince's original driver code used // Tk_FreePixmap(tkwd->display, dev->pixmap); //which is defined in tk-8.3 (and 8.2?) source as //void // Tk_FreePixmap(display, pixmap) // Display *display; // Pixmap pixmap; // { // XFreePixmap(display, pixmap); // Tk_FreeXId(display, (XID) pixmap); // } // But that bombed under Linux and tcl/tk8.2 so now just call // XFreePixmap directly. (Not recommended as permanent solution // because you eventually run out of resources according to man // page if you don't call Tk_FreeXId.) Vince is still looking into // how to resolve this problem. // XFreePixmap( tkwd->display, dev->pixmap ); #endif CreatePixmap( pls ); } // Initialize & redraw (to pixmap, if available). plD_bop_tkwin( pls ); plRemakePlot( pls ); XSync( tkwd->display, 0 ); // If pixmap available, fake an expose if ( dev->write_to_pixmap ) { dev->write_to_window = write_to_window; XCopyArea( tkwd->display, dev->pixmap, dev->window, dev->gc, 0, 0, dev->width, dev->height, 0, 0 ); XSync( tkwd->display, 0 ); } } //-------------------------------------------------------------------------- // RedrawCmd() // // Handles page redraw without resize (pixmap does not get reallocated). // Calling this makes sure all necessary housekeeping gets done. //-------------------------------------------------------------------------- static void RedrawCmd( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; int write_to_window = dev->write_to_window; dbug_enter( "RedrawCmd" ); // Return if plD_init_tkw hasn't been called yet if ( dev == NULL ) { plwarn( "RedrawCmd: Illegal call -- driver uninitialized" ); return; } // Initialize & redraw (to pixmap, if available). if ( dev->write_to_pixmap ) dev->write_to_window = 0; plD_bop_tkwin( pls ); plRemakePlot( pls ); XSync( tkwd->display, 0 ); dev->write_to_window = write_to_window; // If pixmap available, fake an expose if ( dev->write_to_pixmap ) { XCopyArea( tkwd->display, dev->pixmap, dev->window, dev->gc, 0, 0, dev->width, dev->height, 0, 0 ); XSync( tkwd->display, 0 ); } } //-------------------------------------------------------------------------- // CreatePixmap() // // This routine creates a pixmap, doing error trapping in case there // isn't enough memory on the server. //-------------------------------------------------------------------------- static void CreatePixmap( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; Tk_Window tkwin = pls->plPlotterPtr->tkwin; #if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) int ( *oldErrorHandler )( Display *, XErrorEvent * ); oldErrorHandler = XSetErrorHandler( CreatePixmapErrorHandler ); CreatePixmapStatus = Success; #endif #ifdef MAC_TCL // MAC_TCL's version of XCreatePixmap doesn't like 0 by 0 maps if ( dev->width == 0 ) { dev->width = 10; } if ( dev->height == 0 ) { dev->height = 10; } #endif pldebug( "CreatePixmap", "creating pixmap: width = %d, height = %d, depth = %d\n", dev->width, dev->height, tkwd->depth ); // // dev->pixmap = Tk_GetPixmap(tkwd->display, dev->window, // dev->width, dev->height, tkwd->depth); // // // Vince's original driver code used Tk_Display(tkwin) for first argument, // but that bombed on an Linux tcl/tk 8.2 machine. Something was wrong // with that value. Thus, we now use tkwd->display, and that works well. // Vince is looking into why Tk_Display(tkwin) is badly defined under 8.2. // old code: // // dev->pixmap = Tk_GetPixmap(Tk_Display(tkwin), Tk_WindowId(tkwin), // Tk_Width(tkwin), Tk_Height(tkwin), // DefaultDepthOfScreen(Tk_Screen(tkwin))); // dev->pixmap = Tk_GetPixmap( tkwd->display, Tk_WindowId( tkwin ), Tk_Width( tkwin ), Tk_Height( tkwin ), DefaultDepthOfScreen( Tk_Screen( tkwin ) ) ); XSync( tkwd->display, 0 ); #if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) if ( CreatePixmapStatus != Success ) { dev->write_to_pixmap = 0; dev->write_to_window = 1; pls->db = 0; fprintf( stderr, "\n\ Warning: pixmap could not be allocated (insufficient memory on server).\n\ Driver will redraw the entire plot to handle expose events.\n" ); } XSetErrorHandler( oldErrorHandler ); #endif } //-------------------------------------------------------------------------- // GetVisual() // // Get visual info. In order to safely use a visual other than that of // the parent (which hopefully is that returned by DefaultVisual), you // must first find (using XGetRGBColormaps) or create a colormap matching // this visual and then set the colormap window attribute in the // XCreateWindow attributes and valuemask arguments. I don't do this // right now, so this is turned off by default. //-------------------------------------------------------------------------- static void GetVisual( PLStream *pls ) { int depth; TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; dbug_enter( "GetVisual" ); tkwd->visual = Tk_GetVisual( pls->plPlotterPtr->interp, pls->plPlotterPtr->tkwin, "best", &depth, NULL ); tkwd->depth = (unsigned int) depth; } //-------------------------------------------------------------------------- // AllocBGFG() // // Allocate background & foreground colors. If possible, I choose pixel // values such that the fg pixel is the xor of the bg pixel, to make // rubber-banding easy to see. //-------------------------------------------------------------------------- static void AllocBGFG( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; #ifndef USE_TK int i, j, npixels; unsigned long plane_masks[1], pixels[MAX_COLORS]; #endif dbug_enter( "AllocBGFG" ); // If not on a color system, just return if ( !tkwd->color ) return; #ifndef USE_TK // Allocate r/w color cell for background if ( XAllocColorCells( tkwd->display, tkwd->map, False, plane_masks, 0, pixels, 1 ) ) { tkwd->cmap0[0].pixel = pixels[0]; } else { plexit( "couldn't allocate background color cell" ); } // Allocate as many colors as we can npixels = MAX_COLORS; for (;; ) { if ( XAllocColorCells( tkwd->display, tkwd->map, False, plane_masks, 0, pixels, npixels ) ) break; npixels--; if ( npixels == 0 ) break; } // Find the color with pixel = xor of the bg color pixel. // If a match isn't found, the last pixel allocated is used. for ( i = 0; i < npixels - 1; i++ ) { if ( pixels[i] == ( ~tkwd->cmap0[0].pixel & 0xFF ) ) break; } // Use this color cell for our foreground color. Then free the rest. tkwd->fgcolor.pixel = pixels[i]; for ( j = 0; j < npixels; j++ ) { if ( j != i ) XFreeColors( tkwd->display, tkwd->map, &pixels[j], 1, 0 ); } #endif } //-------------------------------------------------------------------------- // pltkwin_setBGFG() // // Set background & foreground colors. Foreground over background should // have high contrast. //-------------------------------------------------------------------------- void pltkwin_setBGFG( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; PLColor fgcolor; int gslevbg, gslevfg; dbug_enter( "pltkwin_setBGFG" ); // // Set background color. // // Background defaults to black on color screens, white on grayscale (many // grayscale monitors have poor contrast, and black-on-white looks better). // if ( !tkwd->color ) { pls->cmap0[0].r = pls->cmap0[0].g = pls->cmap0[0].b = 0xFF; } gslevbg = (int) ( ( (long) pls->cmap0[0].r + (long) pls->cmap0[0].g + (long) pls->cmap0[0].b ) / 3 ); PLColor_to_TkColor( &pls->cmap0[0], &tkwd->cmap0[0] ); // // Set foreground color. // // Used for grayscale output, since otherwise the plots can become nearly // unreadable (i.e. if colors get mapped onto grayscale values). In this // case it becomes the grayscale level for all draws, and is taken to be // black if the background is light, and white if the background is dark. // Note that white/black allocations never fail. // if ( gslevbg > 0x7F ) gslevfg = 0; else gslevfg = 0xFF; fgcolor.r = fgcolor.g = fgcolor.b = (unsigned char) gslevfg; PLColor_to_TkColor( &fgcolor, &tkwd->fgcolor ); // Now store #ifndef USE_TK if ( tkwd->color ) { XStoreColor( tkwd->display, tkwd->map, &tkwd->fgcolor ); XStoreColor( tkwd->display, tkwd->map, &tkwd->cmap0[0] ); } else { XAllocColor( tkwd->display, tkwd->map, &tkwd->cmap0[0] ); XAllocColor( tkwd->display, tkwd->map, &tkwd->fgcolor ); } #else Tkw_StoreColor( pls, tkwd, &tkwd->cmap0[0] ); Tkw_StoreColor( pls, tkwd, &tkwd->fgcolor ); #endif } //-------------------------------------------------------------------------- // InitColors() // // Does all color initialization. //-------------------------------------------------------------------------- static void InitColors( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; dbug_enter( "InitColors" ); // Allocate and initialize color maps. // Defer cmap1 allocation until it's actually used if ( tkwd->color ) { if ( plplot_tkwin_ccmap ) { AllocCustomMap( pls ); } else { AllocCmap0( pls ); } } } //-------------------------------------------------------------------------- // AllocCustomMap() // // Initializes custom color map and all the cruft that goes with it. // // Assuming all color X displays do 256 colors, the breakdown is as follows: // // XWM_COLORS Number of low "pixel" values to copy. These are typically // allocated first, thus are in use by the window manager. I // copy them to reduce flicker. // // CMAP0_COLORS Color map 0 entries. I allocate these both in the default // colormap and the custom colormap to reduce flicker. // // CMAP1_COLORS Color map 1 entries. There should be as many as practical // available for smooth shading. On the order of 50-100 is // pretty reasonable. You don't really need all 256, // especially if all you're going to do is to print it to // postscript (which doesn't have any intrinsic limitation on // the number of colors). // // It's important to leave some extra colors unallocated for Tk. In // particular the palette tools require a fair amount. I recommend leaving // at least 40 or so free. //-------------------------------------------------------------------------- static void AllocCustomMap( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; XColor xwm_colors[MAX_COLORS]; int i; #ifndef USE_TK int npixels; unsigned long plane_masks[1], pixels[MAX_COLORS]; #endif dbug_enter( "AllocCustomMap" ); // Determine current default colors for ( i = 0; i < MAX_COLORS; i++ ) { xwm_colors[i].pixel = (long unsigned) i; } #ifndef MAC_TCL XQueryColors( tkwd->display, tkwd->map, xwm_colors, MAX_COLORS ); #endif // Allocate cmap0 colors in the default colormap. // The custom cmap0 colors are later stored at the same pixel values. // This is a really cool trick to reduce the flicker when changing colormaps. // AllocCmap0( pls ); XAllocColor( tkwd->display, tkwd->map, &tkwd->fgcolor ); // Create new color map tkwd->map = XCreateColormap( tkwd->display, DefaultRootWindow( tkwd->display ), tkwd->visual, AllocNone ); // Now allocate all colors so we can fill the ones we want to copy #ifndef USE_TK npixels = MAX_COLORS; for (;; ) { if ( XAllocColorCells( tkwd->display, tkwd->map, False, plane_masks, 0, pixels, npixels ) ) break; npixels--; if ( npixels == 0 ) plexit( "couldn't allocate any colors" ); } // Fill the low colors since those are in use by the window manager for ( i = 0; i < XWM_COLORS; i++ ) { XStoreColor( tkwd->display, tkwd->map, &xwm_colors[i] ); pixels[xwm_colors[i].pixel] = 0; } // Fill the ones we will use in cmap0 for ( i = 0; i < tkwd->ncol0; i++ ) { XStoreColor( tkwd->display, tkwd->map, &tkwd->cmap0[i] ); pixels[tkwd->cmap0[i].pixel] = 0; } // Finally, if the colormap was saved by an external agent, see if there are // any differences from the current default map and save those! A very cool // (or sick, depending on how you look at it) trick to get over some X and // Tk limitations. // if ( sxwm_colors_set ) { for ( i = 0; i < MAX_COLORS; i++ ) { if ( ( xwm_colors[i].red != sxwm_colors[i].red ) || ( xwm_colors[i].green != sxwm_colors[i].green ) || ( xwm_colors[i].blue != sxwm_colors[i].blue ) ) { if ( pixels[i] != 0 ) { XStoreColor( tkwd->display, tkwd->map, &xwm_colors[i] ); pixels[i] = 0; } } } } // Now free the ones we're not interested in for ( i = 0; i < npixels; i++ ) { if ( pixels[i] != 0 ) XFreeColors( tkwd->display, tkwd->map, &pixels[i], 1, 0 ); } #endif // Allocate colors in cmap 1 AllocCmap1( pls ); } //-------------------------------------------------------------------------- // AllocCmap0() // // Allocate & initialize cmap0 entries. //-------------------------------------------------------------------------- static void AllocCmap0( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; #ifndef USE_TK int npixels; int i; unsigned long plane_masks[1], pixels[MAX_COLORS]; #endif dbug_enter( "AllocCmap0" ); // Allocate and assign colors in cmap 0 #ifndef USE_TK npixels = pls->ncol0 - 1; for (;; ) { if ( XAllocColorCells( tkwd->display, tkwd->map, False, plane_masks, 0, &pixels[1], npixels ) ) break; npixels--; if ( npixels == 0 ) plexit( "couldn't allocate any colors" ); } tkwd->ncol0 = npixels + 1; for ( i = 1; i < tkwd->ncol0; i++ ) { tkwd->cmap0[i].pixel = pixels[i]; } #else // We use the Tk color scheme tkwd->ncol0 = pls->ncol0; #endif StoreCmap0( pls ); } //-------------------------------------------------------------------------- // AllocCmap1() // // Allocate & initialize cmap1 entries. If using the default color map, // must severely limit number of colors otherwise TK won't have enough. //-------------------------------------------------------------------------- static void AllocCmap1( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; int npixels; #ifndef USE_TK int i, j; unsigned long plane_masks[1], pixels[MAX_COLORS]; #endif dbug_enter( "AllocCmap1" ); // Allocate colors in cmap 1 npixels = MAX( 2, MIN( CMAP1_COLORS, pls->ncol1 ) ); #ifndef USE_TK for (;; ) { if ( XAllocColorCells( tkwd->display, tkwd->map, False, plane_masks, 0, pixels, npixels ) ) break; npixels--; if ( npixels == 0 ) break; } if ( npixels < 2 ) { tkwd->ncol1 = -1; fprintf( stderr, "Warning: unable to allocate sufficient colors in cmap1\n" ); return; } else { tkwd->ncol1 = npixels; if ( pls->verbose ) fprintf( stderr, "AllocCmap1 (xwin.c): Allocated %d colors in cmap1\n", npixels ); } // Don't assign pixels sequentially, to avoid strange problems with xor GC's // Skipping by 2 seems to do the job best for ( j = i = 0; i < tkwd->ncol1; i++ ) { while ( pixels[j] == 0 ) j++; tkwd->cmap1[i].pixel = pixels[j]; pixels[j] = 0; j += 2; if ( j >= tkwd->ncol1 ) j = 0; } #else tkwd->ncol1 = npixels; #endif StoreCmap1( pls ); } //-------------------------------------------------------------------------- // StoreCmap0() // // Stores cmap 0 entries in X-server colormap. //-------------------------------------------------------------------------- static void StoreCmap0( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; int i; if ( !tkwd->color ) return; for ( i = 1; i < tkwd->ncol0; i++ ) { PLColor_to_TkColor( &pls->cmap0[i], &tkwd->cmap0[i] ); #ifndef USE_TK XStoreColor( tkwd->display, tkwd->map, &tkwd->cmap0[i] ); #else Tkw_StoreColor( pls, tkwd, &tkwd->cmap0[i] ); #endif } } void CopyColour( XColor* from, XColor* to ) { to->pixel = from->pixel; to->red = from->red; to->blue = from->blue; to->green = from->green; to->flags = from->flags; } //-------------------------------------------------------------------------- // StoreCmap1() // // Stores cmap 1 entries in X-server colormap. //-------------------------------------------------------------------------- static void StoreCmap1( PLStream *pls ) { TkwDev *dev = (TkwDev *) pls->dev; TkwDisplay *tkwd = (TkwDisplay *) dev->tkwd; PLColor cmap1color; int i; if ( !tkwd->color ) return; for ( i = 0; i < tkwd->ncol1; i++ ) { plcol_interp( pls, &cmap1color, i, tkwd->ncol1 ); PLColor_to_TkColor( &cmap1color, &tkwd->cmap1[i] ); #ifndef USE_TK XStoreColor( tkwd->display, tkwd->map, &tkwd->cmap1[i] ); #else Tkw_StoreColor( pls, tkwd, &tkwd->cmap1[i] ); #endif } } void Tkw_StoreColor( PLStream* pls, TkwDisplay* tkwd, XColor* col ) { XColor *xc; #ifndef USE_TK XStoreColor( tkwd->display, tkwd->map, col ); #else (void) tkwd; // tkwd unused in this case // We're probably losing memory here xc = Tk_GetColorByValue( pls->plPlotterPtr->tkwin, col ); CopyColour( xc, col ); #endif } //-------------------------------------------------------------------------- // void PLColor_to_TkColor() // // Copies the supplied PLColor to an XColor, padding with bits as necessary // (a PLColor uses 8 bits for color storage, while an XColor uses 16 bits). // The argument types follow the same order as in the function name. //-------------------------------------------------------------------------- #define ToXColor( a ) ( ( ( 0xFF & ( a ) ) << 8 ) | ( a ) ) #define ToPLColor( a ) ( ( (U_LONG) a ) >> 8 ) void PLColor_to_TkColor( PLColor *plcolor, XColor *xcolor ) { xcolor->red = (short unsigned) ToXColor( plcolor->r ); xcolor->green = (short unsigned) ToXColor( plcolor->g ); xcolor->blue = (short unsigned) ToXColor( plcolor->b ); xcolor->flags = DoRed | DoGreen | DoBlue; } //-------------------------------------------------------------------------- // void PLColor_from_TkColor() // // Copies the supplied XColor to a PLColor, stripping off bits as // necessary. See the previous routine for more info. //-------------------------------------------------------------------------- void PLColor_from_TkColor( PLColor *plcolor, XColor *xcolor ) { plcolor->r = (unsigned char) ToPLColor( xcolor->red ); plcolor->g = (unsigned char) ToPLColor( xcolor->green ); plcolor->b = (unsigned char) ToPLColor( xcolor->blue ); } //-------------------------------------------------------------------------- // void PLColor_from_TkColor_Changed() // // Copies the supplied XColor to a PLColor, stripping off bits as // necessary. See the previous routine for more info. // // Returns 1 if the color was different from the old one. //-------------------------------------------------------------------------- int PLColor_from_TkColor_Changed( PLColor *plcolor, XColor *xcolor ) { int changed = 0; int color; color = ToPLColor( xcolor->red ); if ( plcolor->r != color ) { changed = 1; plcolor->r = (unsigned char) color; } color = ToPLColor( xcolor->green ); if ( plcolor->g != color ) { changed = 1; plcolor->g = (unsigned char) color; } color = ToPLColor( xcolor->blue ); if ( plcolor->b != color ) { changed = 1; plcolor->b = (unsigned char) color; } return changed; } //-------------------------------------------------------------------------- // int pltk_AreWeGrayscale(PlPlotter *plf) // // Determines if we're using a monochrome or grayscale device. // gmf 11-8-91; Courtesy of Paul Martz of Evans and Sutherland. // Changed July 1996 by Vince: now uses Tk to check the enclosing PlPlotter //-------------------------------------------------------------------------- static int pltk_AreWeGrayscale( PlPlotter *plf ) { #if defined ( __cplusplus ) || defined ( c_plusplus ) #define THING c_class #else #define THING class #endif Visual* visual; // get the window's Visual visual = Tk_Visual( plf->tkwin ); if ( ( visual->THING != GrayScale ) && ( visual->THING != StaticGray ) ) return ( 0 ); // if we got this far, only StaticGray and GrayScale classes available return ( 1 ); } #if !defined ( MAC_TCL ) && !defined ( __WIN32__ ) //-------------------------------------------------------------------------- // CreatePixmapErrorHandler() // // Error handler used in CreatePixmap() to catch errors in allocating // storage for pixmap. This way we can nicely substitute redraws for // pixmap copies if the server has insufficient memory. //-------------------------------------------------------------------------- static int CreatePixmapErrorHandler( Display *display, XErrorEvent *error ) { if ( error->error_code == BadAlloc ) { CreatePixmapStatus = error->error_code; } else { char buffer[256]; XGetErrorText( display, error->error_code, buffer, 256 ); fprintf( stderr, "Error in XCreatePixmap: %s.\n", buffer ); } return 1; } #endif #else int pldummy_tkwin() { return 0; } #endif // PLD_tkwin void * ckcalloc( size_t nmemb, size_t size ) { long *ptr; long *p; size *= nmemb; ptr = (long *) malloc( size ); if ( !ptr ) return ( 0 ); #if !__POWERPC__ for ( size = ( size / sizeof ( long ) ) + 1, p = ptr; --size; ) *p++ = 0; #else for ( size = ( size / sizeof ( long ) ) + 1, p = ptr - 1; --size; ) *++p = 0; #endif return ( ptr ); } plplot-5.10.0+dfsg/drivers/ntk.driver_info.in 644 1750 1750 3711466747272 200170ustar andrewandrewntk:New tk driver:1:ntk:43:ntk plplot-5.10.0+dfsg/drivers/pdf.c 644 1750 1750 7636712253724162 153720ustar andrewandrew// $Id: pdf.c 12873 2013-12-17 01:27:14Z airwin $ // // PLplot driver for PDF based on the haru library http://www.libharu.org. // // Copyright (C) 2006, 2008 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // // TODO: // - page orientation // - text clipping // //-------------------------------------------------------------------------- // Header files, defines and local variables //-------------------------------------------------------------------------- #include "plDevs.h" #ifdef PLD_pdf #include #include #include #include #include "hpdf.h" // PLplot header files //#define DEBUG //#define NEED_PLDEBUG #include "plplotP.h" #include "drivers.h" #include "plunicode-type1.h" #include "plfci-type1.h" // Workaround for caseless string comparison #ifndef WIN32 #define stricmp strcasecmp #define strnicmp strncasecmp #endif // constants // We define a virtual page and scale it down to the // paper size chosen by the user (A4 is default). // // Default dimensions of the canvas (in inches) and DPI #define CANVAS_WIDTH ( 50.0 ) #define CANVAS_HEIGHT ( 37.5 ) #define DEVICE_PIXELS_PER_INCH ( 72 ) // mm per inch #define MM_PER_INCH ( 25.4 ) // pixels per mm #define DEVICE_PIXELS_PER_MM ( DEVICE_PIXELS_PER_INCH / MM_PER_INCH ) // maximum string length for own font handling #define MAX_STRING_LEN 1000 // container for device specific data typedef struct { HPDF_Doc pdf; HPDF_Page page; HPDF_PageSizes pageSize; FILE *pdfFile; PLFLT scalex, scaley; // font variables HPDF_Font m_font; int nlookup, if_symbol_font; const Unicode_to_Type1_table *lookup; HPDF_REAL fontSize; HPDF_REAL fontScale; HPDF_REAL textWidth, textHeight; HPDF_REAL yOffset; HPDF_REAL textRed, textGreen, textBlue; } pdfdev; // local variables PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_pdf = "pdf:Portable Document Format PDF:1:pdf:58:pdf\n"; static jmp_buf env; //-------------------------------------------------------------------------- // function declarations //-------------------------------------------------------------------------- // General //static short desired_offset( short, double ); static void poly_line( PLStream *pls, short *xa, short *ya, PLINT npts, short fill ); // String processing static void process_string( PLStream *, EscText * ); // PLplot interface functions void plD_dispatch_init_pdf( PLDispatchTable *pdt ); void plD_init_pdf( PLStream * ); void plD_line_pdf( PLStream *, short, short, short, short ); void plD_polyline_pdf( PLStream *, short *, short *, PLINT ); void plD_eop_pdf( PLStream * ); void plD_bop_pdf( PLStream * ); void plD_tidy_pdf( PLStream * ); void plD_state_pdf( PLStream *, PLINT ); void plD_esc_pdf( PLStream *, PLINT, void * ); void error_handler( HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data ); void PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ); void PSSetFont( pdfdev* dev, PLUNICODE fci ); void PSDrawText( pdfdev* dev, PLUNICODE* ucs4, int ucs4Len, short drawText ); //-------------------------------------------------------------------------- // error_handler( HPDF_STATUS error_no, HPDF_STATUS detail_no, // void *user_data ) // // Error handler for haru library. //-------------------------------------------------------------------------- #ifdef HPDF_DLL void __stdcall #else void #endif error_handler( HPDF_STATUS error_no, HPDF_STATUS detail_no, void * PL_UNUSED( user_data ) ) { // invoke longjmp() when an error has occurred printf( "ERROR: error_no=%04X, detail_no=%d\n", (unsigned int) error_no, (int) detail_no ); longjmp( env, 1 ); } //-------------------------------------------------------------------------- // plD_dispatch_init_pdf( PLDispatchTable *pdt ) // // Initialize device dispatch table. //-------------------------------------------------------------------------- void plD_dispatch_init_pdf( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Portable Document Format PDF"; pdt->pl_DevName = "pdf"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 58; pdt->pl_init = (plD_init_fp) plD_init_pdf; pdt->pl_line = (plD_line_fp) plD_line_pdf; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_pdf; pdt->pl_eop = (plD_eop_fp) plD_eop_pdf; pdt->pl_bop = (plD_bop_fp) plD_bop_pdf; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_pdf; pdt->pl_state = (plD_state_fp) plD_state_pdf; pdt->pl_esc = (plD_esc_fp) plD_esc_pdf; } // driver specific options static PLINT text = 1; static PLINT compress = 1; static PLINT hrshsym = 1; static PLINT color = 1; static char * pageSize = NULL; DrvOpt pdf_options[] = { { "text", DRV_INT, &text, "Use own text routines (text=0|1)" }, { "color", DRV_INT, &color, "Use color (color=0|1)" }, { "compress", DRV_INT, &compress, "Compress pdf output (compress=0|1)" }, { "hrshsym", DRV_INT, &hrshsym, "Use Hershey symbol set (hrshsym=0|1)" }, { "pagesize", DRV_STR, &pageSize, "Set page size (pagesize=A4|letter|A3|A5)" }, { NULL, DRV_INT, NULL, NULL } }; //-------------------------------------------------------------------------- // plD_init_pdf( PLStream *pls ) // // Initialize device. //-------------------------------------------------------------------------- void plD_init_pdf( PLStream *pls ) { pdfdev* dev; // allocate memory for the device storage dev = (pdfdev *) calloc( 1, sizeof ( pdfdev ) ); if ( dev == NULL ) plexit( "Insufficient memory\n" ); pls->dev = (void *) dev; // Check for and set up driver options plParseDrvOpts( pdf_options ); pls->termin = 0; // not an interactive device if ( color ) pls->color = 1; // supports color else pls->color = 0; // monochrome pls->width = 1; pls->bytecnt = 0; if ( text ) { pls->dev_text = 1; // handles text pls->dev_unicode = 1; // wants text as unicode if ( hrshsym ) pls->dev_hrshsym = 1; } pls->page = 0; pls->dev_fill0 = 1; // supports hardware solid fills pls->dev_fill1 = 0; // Use PLplot core fallback for pattern fills pls->graphx = GRAPHICS_MODE; if ( !pls->colorset ) pls->color = 1; // Set the (virtual) page size. The geometry option is // neglected. Page sizes are set with the pagesize option. plspage( DEVICE_PIXELS_PER_INCH, DEVICE_PIXELS_PER_INCH, (PLINT) ( CANVAS_WIDTH * DEVICE_PIXELS_PER_INCH ), (PLINT) ( CANVAS_HEIGHT * DEVICE_PIXELS_PER_INCH ), 0, 0 ); // Set up physical limits of plotting device (in drawing units) plP_setphy( 0, (PLINT) ( CANVAS_WIDTH * DEVICE_PIXELS_PER_INCH ), 0, (PLINT) ( CANVAS_HEIGHT * DEVICE_PIXELS_PER_INCH ) ); // Set the number of pixels per mm plP_setpxl( (PLFLT) DEVICE_PIXELS_PER_MM, (PLFLT) DEVICE_PIXELS_PER_MM ); // If portrait mode is specified, then set up an additional rotation // transformation with aspect ratio allowed to adjust via freeaspect. // Default orientation is landscape (ORIENTATION == 3 or 90 deg rotation // counter-clockwise from portrait). (Legacy PLplot used seascape // which was equivalent to ORIENTATION == 1 or 90 deg clockwise rotation // from portrait.) if ( pls->portrait ) { plsdiori( (PLFLT) ( 4 - ORIENTATION ) ); pls->freeaspect = 1; } // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); dev->pdfFile = pls->OutFile; dev->pdf = HPDF_New( error_handler, NULL ); if ( !dev->pdf ) plexit( "ERROR: cannot create pdf object.\n" ); if ( compress ) HPDF_SetCompressionMode( dev->pdf, HPDF_COMP_ALL ); // determine size of pdf page - A4 is default dev->pageSize = HPDF_PAGE_SIZE_EOF; if ( pageSize == NULL ) dev->pageSize = HPDF_PAGE_SIZE_A4; else if ( !stricmp( pageSize, "letter" ) ) dev->pageSize = HPDF_PAGE_SIZE_LETTER; else if ( !stricmp( pageSize, "A3" ) ) dev->pageSize = HPDF_PAGE_SIZE_A3; else if ( !stricmp( pageSize, "A4" ) ) dev->pageSize = HPDF_PAGE_SIZE_A4; else if ( !stricmp( pageSize, "A5" ) ) dev->pageSize = HPDF_PAGE_SIZE_A5; if ( dev->pageSize == HPDF_PAGE_SIZE_EOF ) plexit( "ERROR: Unknown page size. Allowed strings are: letter, A3, A4, A5.\n" ); if ( setjmp( env ) ) { // HPDF_Free segfaults after error so skip this nicety. //HPDF_Free( dev->pdf ); // can't call plexit because that appears to be circular via // what happens with plend. Therefore, print out an error message // and exit. fprintf( stderr, "ERROR in haru library\n" ); exit( 1 ); } } //-------------------------------------------------------------------------- // plD_bop_pdf( PLStream *pls ) // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_pdf( PLStream *pls ) { pdfdev * dev = (pdfdev *) pls->dev; HPDF_REAL width, height; pls->page++; // add page and set size (default is A4) dev->page = HPDF_AddPage( dev->pdf ); if ( pls->portrait ) HPDF_Page_SetSize( dev->page, dev->pageSize, HPDF_PAGE_PORTRAIT ); else HPDF_Page_SetSize( dev->page, dev->pageSize, HPDF_PAGE_LANDSCAPE ); // Determine scaling parameters. width = HPDF_Page_GetWidth( dev->page ); // in pixels/dots height = HPDF_Page_GetHeight( dev->page ); // in pixels/dots dev->scalex = (PLFLT) ( width / ( CANVAS_WIDTH * DEVICE_PIXELS_PER_INCH ) ); dev->scaley = (PLFLT) ( height / ( CANVAS_HEIGHT * DEVICE_PIXELS_PER_INCH ) ); HPDF_Page_Concat( dev->page, (HPDF_REAL) ( dev->scalex ), 0, 0, (HPDF_REAL) ( dev->scaley ), 0, 0 ); // Set the background by drawing a rectangle that is the size of // of the canvas and filling it with the background color. HPDF_Page_SetRGBFill( dev->page, (HPDF_REAL) ( pls->cmap0[0].r / 255.0 ), (HPDF_REAL) ( pls->cmap0[0].g / 255.0 ), (HPDF_REAL) ( pls->cmap0[0].b / 255.0 ) ); width /= (HPDF_REAL) ( dev->scalex ); height /= (HPDF_REAL) ( dev->scaley ); HPDF_Page_MoveTo( dev->page, (HPDF_REAL) 0.0, (HPDF_REAL) 0.0 ); HPDF_Page_LineTo( dev->page, width, (HPDF_REAL) 0.0 ); HPDF_Page_LineTo( dev->page, width, (HPDF_REAL) height ); HPDF_Page_LineTo( dev->page, 0.0, (HPDF_REAL) height ); HPDF_Page_Fill( dev->page ); } //-------------------------------------------------------------------------- // pdf_line() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_pdf( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { short xa[2], ya[2]; xa[0] = x1a; xa[1] = x2a; ya[0] = y1a; ya[1] = y2a; poly_line( pls, xa, ya, 2, 0 ); } //-------------------------------------------------------------------------- // pdf_polyline() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_pdf( PLStream *pls, short *xa, short *ya, PLINT npts ) { poly_line( pls, xa, ya, npts, 0 ); } //-------------------------------------------------------------------------- // pdf_eop() // // End of page //-------------------------------------------------------------------------- void plD_eop_pdf( PLStream * PL_UNUSED( pls ) ) { // nothing to be done here } //-------------------------------------------------------------------------- // pdf_tidy() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_pdf( PLStream *pls ) { pdfdev* dev = (pdfdev *) pls->dev; // save the document to a stream HPDF_SaveToStream( dev->pdf ); // rewind the stream. HPDF_ResetStream( dev->pdf ); // get the data from the stream and output it to stdout. for (;; ) { HPDF_BYTE buf[4096]; // TODO: not good HPDF_UINT32 size = 4096; // HPDF_STATUS ret = HPDF_ReadFromStream( dev->pdf, buf, &size ); HPDF_ReadFromStream( dev->pdf, buf, &size ); if ( size == 0 ) break; if ( fwrite( buf, size, 1, dev->pdfFile ) != 1 ) plexit( "ERROR: Cannot write to file!" ); } plCloseFile( pls ); // cleanup HPDF_Free( dev->pdf ); } //-------------------------------------------------------------------------- // plD_state_pdf() // // Handle change in PLStream state (color, pen width, fill attribute, etc). // // Nothing is done here because these attributes are aquired from // PLStream for each element that is drawn. //-------------------------------------------------------------------------- void plD_state_pdf( PLStream * PL_UNUSED( pls ), PLINT PL_UNUSED( op ) ) { // Nothing to be done here. } //-------------------------------------------------------------------------- // pdf_esc() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_pdf( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_FILL: // fill polygon poly_line( pls, pls->dev_x, pls->dev_y, pls->dev_npts, 1 ); break; case PLESC_HAS_TEXT: // render text process_string( pls, (EscText *) ptr ); break; } } //-------------------------------------------------------------------------- // poly_line() // // Handles drawing filled and unfilled polygons //-------------------------------------------------------------------------- void poly_line( PLStream *pls, short *xa, short *ya, PLINT npts, short fill ) { pdfdev* dev = (pdfdev *) pls->dev; PLINT i; HPDF_Page_SetLineWidth( dev->page, (HPDF_REAL) ( pls->width ) ); HPDF_Page_SetLineCap( dev->page, HPDF_ROUND_END ); HPDF_Page_SetLineJoin( dev->page, HPDF_ROUND_JOIN ); HPDF_Page_SetRGBStroke( dev->page, (HPDF_REAL) ( pls->curcolor.r / 255.0 ), (HPDF_REAL) ( pls->curcolor.g / 255.0 ), (HPDF_REAL) ( pls->curcolor.b / 255.0 ) ); HPDF_Page_SetRGBFill( dev->page, (HPDF_REAL) ( pls->curcolor.r / 255.0 ), (HPDF_REAL) ( pls->curcolor.g / 255.0 ), (HPDF_REAL) ( pls->curcolor.b / 255.0 ) ); HPDF_Page_MoveTo( dev->page, (HPDF_REAL) xa[0], (HPDF_REAL) ya[0] ); for ( i = 1; i < npts; i++ ) HPDF_Page_LineTo( dev->page, (HPDF_REAL) xa[i], (HPDF_REAL) ya[i] ); if ( fill == 1 ) { if ( pls->dev_eofill ) HPDF_Page_EofillStroke( dev->page ); else HPDF_Page_FillStroke( dev->page ); } else { HPDF_Page_Stroke( dev->page ); } } //-------------------------------------------------------------------------- // unsigned char plunicode2type1 (const PLUNICODE index, // const Unicode_to_Type1_table lookup[], const int number_of_entries) // // Function takes an input unicode index, looks through the lookup // table (which must be sorted by PLUNICODE Unicode), then returns the // corresponding Type1 code in the lookup table. If the Unicode index // is not present the returned value is 32 (which is normally a blank // for Type 1 fonts). //-------------------------------------------------------------------------- static unsigned char plunicode2type1( const PLUNICODE index, const Unicode_to_Type1_table lookup[], const int nlookup ) { int jlo = -1, jmid, jhi = nlookup; while ( jhi - jlo > 1 ) { // Note that although jlo or jhi can be just outside valid // range (see initialization above) because of while condition // jlo < jmid < jhi and jmid must be in valid range. // jmid = ( jlo + jhi ) / 2; if ( index > lookup[jmid].Unicode ) jlo = jmid; else if ( index < lookup[jmid].Unicode ) jhi = jmid; else // We have found it! // index == lookup[jmid].Unicode // return ( lookup[jmid].Type1 ); } // jlo is invalid or it is valid and index > lookup[jlo].Unicode. // jhi is invalid or it is valid and index < lookup[jhi].Unicode. // All these conditions together imply index cannot be found in lookup. // Mark with ' ' (which is normally the index for blank in type 1 fonts). // return ( ' ' ); } //-------------------------------------------------------------------------- // PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ) // // This function determines the extent of the string and does // the actual drawing to the page if drawText is true. //-------------------------------------------------------------------------- void PSDrawTextToCanvas( pdfdev* dev, unsigned char* type1_string, short drawText ) { HPDF_REAL th; // write text to page if ( drawText ) { HPDF_Page_BeginText( dev->page ); HPDF_Page_SetTextRenderingMode( dev->page, HPDF_FILL ); HPDF_Page_SetRGBFill( dev->page, dev->textRed, dev->textGreen, dev->textBlue ); HPDF_Page_MoveTextPos( dev->page, dev->textWidth, dev->yOffset ); HPDF_Page_ShowText( dev->page, (char *) type1_string ); // TODO: this conversion must be wrong HPDF_Page_EndText( dev->page ); } // determine text width and height dev->textWidth += HPDF_Page_TextWidth( dev->page, (char *) type1_string ); // TODO: this conversion must be wrong th = (HPDF_REAL) ( (HPDF_REAL) HPDF_Font_GetCapHeight( dev->m_font ) * dev->fontSize * dev->fontScale / 1000.0 ); dev->textHeight = dev->textHeight > ( th + dev->yOffset ) ? dev->textHeight : ( th + dev->yOffset ); // clear string memset( type1_string, '\0', MAX_STRING_LEN ); } //-------------------------------------------------------------------------- // PSSetFont( pdfdev* dev, PLUNICODE fci ) // // Sets the font. //-------------------------------------------------------------------------- void PSSetFont( pdfdev* dev, PLUNICODE fci ) { const char *font; // fci = 0 is a special value indicating the Type 1 Symbol font // is desired. This value cannot be confused with a normal FCI value // because it doesn't have the PL_FCI_MARK. if ( fci == 0 ) { font = "Symbol"; dev->nlookup = number_of_entries_in_unicode_to_symbol_table; dev->lookup = unicode_to_symbol_lookup_table; dev->if_symbol_font = 1; } else { // convert the fci to Base14/Type1 font information font = plP_FCI2FontName( fci, Type1Lookup, N_Type1Lookup ); dev->nlookup = number_of_entries_in_unicode_to_standard_table; dev->lookup = unicode_to_standard_lookup_table; dev->if_symbol_font = 0; } if ( !( dev->m_font = HPDF_GetFont( dev->pdf, font, NULL ) ) ) plexit( "ERROR: Couldn't open font\n" ); //pldebug( "PSSetFont", "HPDF requested font size = %f\n", dev->fontSize * dev->fontScale ); HPDF_Page_SetFontAndSize( dev->page, dev->m_font, dev->fontSize * dev->fontScale ); } // 0.8 should mimic the offset of first superscript/subscript level // implemented in plstr (plsym.c) for Hershey fonts. However, when // comparing with -dev xwin and -dev xcairo results changing this // factor to 0.6 appears to offset the centers of the letters // appropriately while 0.8 gives much poorer agreement with the // other devices. # define RISE_FACTOR 0.6 //-------------------------------------------------------------------------- // PSDrawText( pdfdev* dev, PLUNICODE* ucs4, int ucs4Len, short drawText ) // // This function is called twice, first to determine the extent of the // text written to the page and then a second time to actually draw // the text. //-------------------------------------------------------------------------- void PSDrawText( pdfdev* dev, PLUNICODE* ucs4, int ucs4Len, short drawText ) { int i, s; unsigned char type1_string[MAX_STRING_LEN]; char plplotEsc; PLUNICODE fci; int last_chance = 0; PLFLT old_sscale, sscale, old_soffset, soffset, dup; PLINT level = 0; memset( type1_string, '\0', MAX_STRING_LEN ); // Get PLplot escape character plgesc( &plplotEsc ); // Get the current font dev->fontScale = 1.0; dev->yOffset = 0.0; plgfci( &fci ); PSSetFont( dev, fci ); dev->textWidth = 0; dev->textHeight = 0; i = 0; s = 0; while ( i < ucs4Len ) { if ( ucs4[i] < PL_FCI_MARK ) // not a font change { if ( ucs4[i] != (PLUNICODE) plplotEsc ) // a character to display { type1_string[s] = plunicode2type1( ucs4[i], dev->lookup, dev->nlookup ); if ( ucs4[i] != ' ' && type1_string[s] == ' ' ) { // failed lookup if ( !dev->if_symbol_font ) { // failed standard font lookup. Try "last chance" // symbol font instead. type1_string[s] = '\0'; PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; last_chance = 1; PSSetFont( dev, 0 ); continue; } else if ( !last_chance ) { // failed symbol font lookup that is not right // after a failed standard font lookup (i.e., // last_change = 0). Try standard fonts lookup instead. type1_string[s] = '\0'; PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; last_chance = 0; PSSetFont( dev, fci ); continue; } else { // failed "last_chance" symbol font lookup that // has occurred right after a failed standard // fonts lookup. Just accept blank result and // move on using standard fonts. PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; last_chance = 0; PSSetFont( dev, fci ); i++; continue; } } else { // font lookup succeeded. s++; i++; last_chance = 0; continue; } } i++; if ( ucs4[i] == (PLUNICODE) plplotEsc ) // a escape character to display { type1_string[s] = plunicode2type1( ucs4[i], dev->lookup, dev->nlookup ); if ( ucs4[i] != ' ' && type1_string[s] == ' ' ) { // failed lookup if ( !dev->if_symbol_font ) { // failed standard font lookup. Try "last chance" // symbol font instead. type1_string[s] = '\0'; PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; last_chance = 1; PSSetFont( dev, 0 ); continue; } else if ( !last_chance ) { // failed symbol font lookup that is not right // after a failed standard font lookup (i.e., // last_change = 0). Try standard fonts lookup instead. type1_string[s] = '\0'; PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; last_chance = 0; PSSetFont( dev, fci ); continue; } else { // failed "last_chance" symbol font lookup that // has occurred right after a failed standard // fonts lookup. Just accept blank result and // move on using standard fonts. PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; last_chance = 0; PSSetFont( dev, fci ); i++; continue; } } else { // font lookup succeeded. s++; i++; last_chance = 0; continue; } } else { if ( ucs4[i] == (PLUNICODE) 'u' ) // Superscript { // draw string so far PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; plP_script_scale( TRUE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for superscripts should be // 0.5*(base font size - superscript/subscript font size). dup = 0.5 * ( 1.0 - sscale ); dev->fontScale = (HPDF_REAL) sscale; PSSetFont( dev, fci ); dev->yOffset = (HPDF_REAL) ( dev->fontSize * ( soffset * RISE_FACTOR + dup ) ); } if ( ucs4[i] == (PLUNICODE) 'd' ) // Subscript { // draw string so far PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; plP_script_scale( FALSE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for subcripts should be // 0.5*(base font size - superscript/subscript font size). dup = -0.5 * ( 1.0 - sscale ); dev->fontScale = (HPDF_REAL) sscale; PSSetFont( dev, fci ); dev->yOffset = (HPDF_REAL) ( -dev->fontSize * ( soffset * RISE_FACTOR + dup ) ); } if ( ucs4[i] == (PLUNICODE) '-' ) // underline { // draw string so far PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; // dev->underlined = !dev->underlined; PSSetFont( dev, fci ); } if ( ucs4[i] == (PLUNICODE) '+' ) // overline { // not implemented yet } i++; } } else // a font change { // draw string so far PSDrawTextToCanvas( dev, type1_string, drawText ); s = 0; // get new font fci = ucs4[i]; PSSetFont( dev, fci ); i++; } } PSDrawTextToCanvas( dev, type1_string, drawText ); } //-------------------------------------------------------------------------- // process_string( PLStream* pls, EscText* args ) // // Handles the output of the text on the page. //-------------------------------------------------------------------------- void process_string( PLStream* pls, EscText* args ) { pdfdev * dev = (pdfdev *) pls->dev; PLFLT rotation, shear, stride; HPDF_REAL cos_rot, sin_rot, cos_shear, sin_shear; // Check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to a pdf driver, ignoring\n" ); return; } // Check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= MAX_STRING_LEN ) { printf( "Sorry, the pdf drivers only handles strings of length < %d\n", MAX_STRING_LEN ); return; } // Calculate the font size (in pixels) dev->fontSize = (HPDF_REAL) ( pls->chrht * DEVICE_PIXELS_PER_INCH / 25.4 * 1.6 ); // text color dev->textRed = (HPDF_REAL) ( pls->curcolor.r / 255.0 ); dev->textGreen = (HPDF_REAL) ( pls->curcolor.g / 255.0 ); dev->textBlue = (HPDF_REAL) ( pls->curcolor.b / 255.0 ); // calculate transformation matrix (rotation and shear of text) plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * M_PI / 2.0; cos_rot = (HPDF_REAL) cos( rotation ); sin_rot = (HPDF_REAL) sin( rotation ); cos_shear = (HPDF_REAL) cos( shear ); sin_shear = (HPDF_REAL) sin( shear ); // calculate text extend -> stored in dev->textWidth and dev->textHeight PSDrawText( dev, args->unicode_array, args->unicode_array_len, 0 ); // apply transformation matrix and draw text HPDF_Page_GSave( dev->page ); HPDF_Page_Concat( dev->page, cos_rot, sin_rot, -cos_rot * sin_shear - sin_rot * cos_shear, -sin_rot * sin_shear + cos_rot * cos_shear, (HPDF_REAL) ( args->x ), (HPDF_REAL) ( args->y ) ); HPDF_Page_Concat( dev->page, (HPDF_REAL) 1.0, (HPDF_REAL) 0.0, (HPDF_REAL) 0.0, (HPDF_REAL) 1.0, (HPDF_REAL) ( -args->just * dev->textWidth ), (HPDF_REAL) ( -0.5 * dev->textHeight ) ); PSDrawText( dev, args->unicode_array, args->unicode_array_len, 1 ); HPDF_Page_GRestore( dev->page ); } #else //-------------------------------------------------------------------------- // pldummy_pdf() // // Dummy function if driver should not be available. //-------------------------------------------------------------------------- int pldummy_pdf() { return 0; } #endif // PLD_pdf plplot-5.10.0+dfsg/drivers/CMakeLists.txt 644 1750 1750 2057612252030714 171740ustar andrewandrew# drivers/CMakeLists.txt for PLplot ### ### Process this file with cmake to produce Makefile ### # Copyright (C) 2006 Alan W. Irwin # # This file is part of PLplot. # # PLplot is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published # by the Free Software Foundation; version 2 of the License. # # PLplot is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with PLplot; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA install( FILES README.drivers README.wxwidgets DESTINATION ${DOC_DIR} ) if(ENABLE_DYNDRIVERS) include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib/qsastime ${CMAKE_SOURCE_DIR}/lib/nistcd ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/include ) option(TEST_DYNDRIVERS "Test dynamic drivers" ON) if(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_dyndrivers_dir) set_source_files_properties( test-drv-info.c PROPERTIES COMPILE_FLAGS "-I${LTDL_INCLUDE_DIR} -DUSINGDLL" ) add_executable(test-drv-info test-drv-info.c) target_link_libraries(test-drv-info plplot${LIB_TAG} ${LTDL_LIBRARIES} ) # in windows we move test-drv-info to the dll directory # otherwise we use the RPATH functionality if(USE_DLL_SUBDIRECTORY) set_target_properties( test-drv-info PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dll ) else(USE_DLL_SUBDIRECTORY) set(test-drv-info_RPATH ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/lib/csa ${CMAKE_BINARY_DIR}/lib/nn ${CMAKE_BINARY_DIR}/lib/qsastime ${libplplot${LIB_TAG}_RPATH} ) set_target_properties( test-drv-info PROPERTIES INSTALL_RPATH "${test-drv-info_RPATH}" BUILD_WITH_INSTALL_RPATH ON ) endif(USE_DLL_SUBDIRECTORY) get_target_property(test-drv-info_LOCATION test-drv-info LOCATION) set(test_dyndrivers_TDEPENDS test-drv-info) endif(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) foreach(SOURCE_ROOT_NAME ${DRIVERS_LIST}) #message("${SOURCE_ROOT_NAME}_SOURCE = ${${SOURCE_ROOT_NAME}_SOURCE}") if(${SOURCE_ROOT_NAME}_COMPILE_FLAGS) set_source_files_properties( ${${SOURCE_ROOT_NAME}_SOURCE} PROPERTIES COMPILE_FLAGS "${${SOURCE_ROOT_NAME}_COMPILE_FLAGS} -DUSINGDLL" ) #message("${SOURCE_ROOT_NAME}_COMPILE_FLAGS = ${${SOURCE_ROOT_NAME}_COMPILE_FLAGS}") else(${SOURCE_ROOT_NAME}_COMPILE_FLAGS) set_source_files_properties( ${${SOURCE_ROOT_NAME}_SOURCE} PROPERTIES COMPILE_FLAGS "-DUSINGDLL" ) endif(${SOURCE_ROOT_NAME}_COMPILE_FLAGS) # ${SOURCE_ROOT_NAME}_LINK_FLAGS is ideally a list of the full path names # to libraries determined with find_library. However, the list can also # include link flags such as the -L and -l form of specifying libraries, # but that way of doing things only works on Unix, and even for Unix, # cmake does not correctly set the rpath for the build tree results # for non-standard locations with the -L and -l forms. #message("${SOURCE_ROOT_NAME}_LINK_FLAGS = ${${SOURCE_ROOT_NAME}_LINK_FLAGS}") # ${SOURCE_ROOT_NAME}_TARGETS is a list of PLplot CMake targets that the # device driver depends on. #message("${SOURCE_ROOT_NAME}_TARGETS = ${${SOURCE_ROOT_NAME}_TARGETS}") if(SOURCE_ROOT_NAME STREQUAL "qt") if(ANY_QT_DEVICE) add_library(${SOURCE_ROOT_NAME} MODULE ${${SOURCE_ROOT_NAME}_SOURCE}) if(NOT ENABLE_qt) # Note this code is never executed considering the way the # build system is set up now (see cmake/modules/qt.cmake), # but nevertheless keep it for the future in case we ever # want to deal with the case where we want to build the qt # device without building the plplotqtd library add_dependencies(${SOURCE_ROOT_NAME} moc_outfile_generated) endif(NOT ENABLE_qt) if(NOT QT_LIBRARIES) message(FATAL_ERROR "Internal build system inconsistency. QT_LIBRARIESis empty but it should be populated") endif(NOT QT_LIBRARIES) target_link_libraries( ${SOURCE_ROOT_NAME} plplot${LIB_TAG} ${MATH_LIB} ${QT_LIBRARIES} ${${SOURCE_ROOT_NAME}_TARGETS} ) # Update the target COMPILE_DEFINITIONS and INCLUDE_DIRECTORIES set_qt_target_properties(${SOURCE_ROOT_NAME}) else(ANY_QT_DEVICE) message(FATAL_ERROR "Internal build system inconsistency. Attempt to build dynamic qt device when ANY_QT_DEVICE is false.") endif(ANY_QT_DEVICE) else(SOURCE_ROOT_NAME STREQUAL "qt") add_library(${SOURCE_ROOT_NAME} MODULE ${${SOURCE_ROOT_NAME}_SOURCE}) target_link_libraries( ${SOURCE_ROOT_NAME} plplot${LIB_TAG} ${MATH_LIB} ${${SOURCE_ROOT_NAME}_LINK_FLAGS} ${${SOURCE_ROOT_NAME}_TARGETS} ) endif(SOURCE_ROOT_NAME STREQUAL "qt") # ${SOURCE_ROOT_NAME}_RPATH originally set in cmake/modules files for # each driver in ${DRIVERS_LIST}. This is only used for the # install-tree rpath since cmake handles the build-tree rpath # automatically (so long as full pathnames to libraries are used). # Order is important here because of /usr/lib concerns. set( ${SOURCE_ROOT_NAME}_RPATH ${LIB_DIR} ${${SOURCE_ROOT_NAME}_RPATH} ${libplplot${LIB_TAG}_RPATH} ) # Our implementation of dynamic loading using libltdl assumes # the prefix should always be nothing (rather than lib) and the suffix # should be set in a platform-dependent manner in order for libltdl # to find the dynamic device. if(WIN32_OR_CYGWIN) # strace showed that .dll was a must for libltdl on Cygwin. set(DYNAMIC_SUFFIX ".dll") else(WIN32_OR_CYGWIN) # So far this works on all non-Cygwin systems, but only Linux and # Mac OS X have been tested so far. set(DYNAMIC_SUFFIX ".so") endif(WIN32_OR_CYGWIN) #message("${SOURCE_ROOT_NAME}_RPATH = ${${SOURCE_ROOT_NAME}_RPATH}") if(USE_RPATH) set_target_properties( ${SOURCE_ROOT_NAME} PROPERTIES PREFIX "" SUFFIX ${DYNAMIC_SUFFIX} INSTALL_RPATH "${${SOURCE_ROOT_NAME}_RPATH}" ) else(USE_RPATH) set_target_properties( ${SOURCE_ROOT_NAME} PROPERTIES PREFIX "" SUFFIX ${DYNAMIC_SUFFIX} ) endif(USE_RPATH) if(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) get_target_property( ${SOURCE_ROOT_NAME}_LOCATION ${SOURCE_ROOT_NAME} LOCATION ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test_dyndrivers_dir/${SOURCE_ROOT_NAME}.driver_info COMMAND test-drv-info ${SOURCE_ROOT_NAME} > ${CMAKE_CURRENT_BINARY_DIR}/test_dyndrivers_dir/${SOURCE_ROOT_NAME}.driver_info COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_BINARY_DIR}/test_dyndrivers_dir/${SOURCE_ROOT_NAME}.driver_info ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ROOT_NAME}.driver_info DEPENDS ${${SOURCE_ROOT_NAME}_LOCATION} ${test-drv-info_LOCATION} ) add_custom_target(test_${SOURCE_ROOT_NAME}_dyndriver DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_dyndrivers_dir/${SOURCE_ROOT_NAME}.driver_info ) set_property(GLOBAL PROPERTY FILE_DEPENDS_${SOURCE_ROOT_NAME}_dyndriver ${CMAKE_CURRENT_BINARY_DIR}/test_dyndrivers_dir/${SOURCE_ROOT_NAME}.driver_info ) add_dependencies(test_${SOURCE_ROOT_NAME}_dyndriver test-drv-info ${SOURCE_ROOT_NAME} ) list(APPEND test_dyndrivers_TDEPENDS test_${SOURCE_ROOT_NAME}_dyndriver) endif(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) install(TARGETS ${SOURCE_ROOT_NAME} EXPORT export_plplot DESTINATION ${DRV_DIR} ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ROOT_NAME}.driver_info DESTINATION ${DRV_DIR} ) endforeach(SOURCE_ROOT_NAME ${DRIVERS_LIST}) if(PLD_tkwin AND USE_TCL_TK_STUBS) set_target_properties( tkwin PROPERTIES COMPILE_DEFINITIONS "USE_TCL_STUBS;USE_TK_STUBS" ) endif(PLD_tkwin AND USE_TCL_TK_STUBS) if(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) add_custom_target(test_dyndrivers ALL ) add_dependencies(test_dyndrivers ${test_dyndrivers_TDEPENDS}) endif(TEST_DYNDRIVERS AND NOT CMAKE_CROSSCOMPILING) endif(ENABLE_DYNDRIVERS) plplot-5.10.0+dfsg/drivers/wxwidgets.cpp 644 1750 1750 12671312141235265 172120ustar andrewandrew// $Id: wxwidgets.cpp 12334 2013-05-04 16:43:33Z airwin $ // // Copyright (C) 2005 Werner Smekal, Sjaak Verdoold // Copyright (C) 2005 Germain Carrera Corraleche // Copyright (C) 1999 Frank Huebner // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // TODO: // - NA // // wxwidgets headers #include #include #include #include "plDevs.h" // plplot headers #include "plplotP.h" #include "drivers.h" // C/C++ headers #include #include "wxwidgets.h" // Static function prototypes #ifdef PL_HAVE_FREETYPE static void plD_pixel_wxwidgets( PLStream *pls, short x, short y ); static PLINT plD_read_pixel_wxwidgets( PLStream *pls, short x, short y ); static void plD_set_pixel_wxwidgets( PLStream *pls, short x, short y, PLINT colour ); static void init_freetype_lv1( PLStream *pls ); static void init_freetype_lv2( PLStream *pls ); #endif // private functions needed by the wxwidgets Driver static void install_buffer( PLStream *pls ); static void wxRunApp( PLStream *pls, bool runonce = false ); static void GetCursorCmd( PLStream *pls, PLGraphicsIn *ptr ); static void fill_polygon( PLStream *pls ); #ifdef __WXMAC__ #include extern "C" { void CPSEnableForegroundOperation( ProcessSerialNumber* psn ); } #endif DECLARE_PLAPP( wxPLplotApp ) //-------------------------------------------------------------------------- // void Log_Verbose( const char *fmt, ... ) // // Print verbose debug message to stderr (printf style). //-------------------------------------------------------------------------- void Log_Verbose( const char *fmt, ... ) { #ifdef _DEBUG_VERBOSE va_list args; va_start( args, fmt ); fprintf( stderr, "Verbose: " ); vfprintf( stderr, fmt, args ); fprintf( stderr, "\n" ); va_end( args ); fflush( stderr ); #else (void) fmt; // Cast to void to silence compiler warnings about unused paraemeter #endif } //-------------------------------------------------------------------------- // void Log_Debug( const char *fmt, ... ) // // Print debug message to stderr (printf style). //-------------------------------------------------------------------------- void Log_Debug( const char *fmt, ... ) { #ifdef _DEBUG va_list args; va_start( args, fmt ); fprintf( stderr, "Debug: " ); vfprintf( stderr, fmt, args ); fprintf( stderr, "\n" ); va_end( args ); fflush( stderr ); #else (void) fmt; // Cast to void to silence compiler warnings about unused paraemeter #endif } //-------------------------------------------------------------------------- // In the following you'll find the driver functions which are // are needed by the plplot core. //-------------------------------------------------------------------------- // Device info #ifdef __cplusplus extern "C" { #endif PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_wxwidgets = #ifdef PLD_wxwidgets "wxwidgets:wxWidgets Driver:1:wxwidgets:51:wxwidgets\n" #endif #ifdef PLD_wxpng "wxpng:wxWidgets PNG Driver:0:wxwidgets:52:wxpng\n" #endif ; #ifdef __cplusplus } #endif //-------------------------------------------------------------------------- // wxPLDevBase::wxPLDevBase( void ) // // Contructor of base class of wxPLDev classes. //-------------------------------------------------------------------------- wxPLDevBase::wxPLDevBase( int bcknd ) : backend( bcknd ) { // Log_Verbose( "wxPLDevBase::wxPLDevBase()" ); ready = false; ownGUI = false; waiting = false; resizing = false; exit = false; comcount = 0; m_frame = NULL; xpos = 0; ypos = 0; // width, height are set in plD_init_wxwidgets // bm_width, bm_height are set in install_buffer // xmin, xmax, ymin, ymax are set in plD_init_wxwidgets // scalex, scaley are set in plD_init_wxwidgets plstate_width = false; plstate_color0 = false; plstate_color1 = false; locate_mode = 0; draw_xhair = false; newclipregion = true; clipminx = 1024; clipmaxx = 0; clipminy = 800; clipmaxy = 0; freetype = 0; smooth_text = 0; devName = (const char **) malloc( NDEV * sizeof ( char** ) ); memset( devName, '\0', NDEV * sizeof ( char** ) ); devDesc = (const char **) malloc( NDEV * sizeof ( char** ) ); memset( devDesc, '\0', NDEV * sizeof ( char** ) ); ndev = NDEV; lineSpacing = 1.0; } wxPLDevBase::~wxPLDevBase( void ) { if ( devDesc ) free( devDesc ); if ( devName ) free( devName ); } void wxPLDevBase::AddtoClipRegion( int x1, int y1, int x2, int y2 ) { newclipregion = false; if ( x1 < x2 ) { if ( x1 < clipminx ) clipminx = x1; if ( x2 > clipmaxx ) clipmaxx = x2; } else { if ( x2 < clipminx ) clipminx = x2; if ( x1 > clipmaxx ) clipmaxx = x1; } if ( y1 < y2 ) { if ( y1 < clipminy ) clipminy = y1; if ( y2 > clipmaxy ) clipmaxy = y2; } else { if ( y2 < clipminy ) clipminy = y2; if ( y1 > clipmaxy ) clipmaxy = y1; } } void wxPLDevBase::PSDrawText( PLUNICODE* ucs4, int ucs4Len, bool drawText ) { int i = 0; char utf8_string[max_string_length]; char utf8[5]; memset( utf8_string, '\0', max_string_length ); // Get PLplot escape character char plplotEsc; plgesc( &plplotEsc ); //Reset the size metrics textWidth = 0; textHeight = 0; superscriptHeight = 0; subscriptDepth = 0; while ( i < ucs4Len ) { if ( ucs4[i] < PL_FCI_MARK ) // not a font change { if ( ucs4[i] != (PLUNICODE) plplotEsc ) // a character to display { ucs4_to_utf8( ucs4[i], utf8 ); strncat( utf8_string, utf8, sizeof ( utf8_string ) - strlen( utf8_string ) - 1 ); i++; continue; } i++; if ( ucs4[i] == (PLUNICODE) plplotEsc ) // a escape character to display { ucs4_to_utf8( ucs4[i], utf8 ); strncat( utf8_string, utf8, sizeof ( utf8_string ) - strlen( utf8_string ) - 1 ); i++; continue; } else { if ( ucs4[i] == (PLUNICODE) 'u' ) // Superscript { // draw string so far PSDrawTextToDC( utf8_string, drawText ); // change font scale if ( yOffset < -0.0001 ) fontScale *= 1.25; // Subscript scaling parameter else fontScale *= 0.8; // Subscript scaling parameter PSSetFont( fci ); yOffset += scaley * fontSize * fontScale / 2.; } if ( ucs4[i] == (PLUNICODE) 'd' ) // Subscript { // draw string so far PSDrawTextToDC( utf8_string, drawText ); // change font scale double old_fontScale = fontScale; if ( yOffset > 0.0001 ) fontScale *= 1.25; // Subscript scaling parameter else fontScale *= 0.8; // Subscript scaling parameter PSSetFont( fci ); yOffset -= scaley * fontSize * old_fontScale / 2.; } if ( ucs4[i] == (PLUNICODE) '-' ) // underline { // draw string so far PSDrawTextToDC( utf8_string, drawText ); underlined = !underlined; PSSetFont( fci ); } if ( ucs4[i] == (PLUNICODE) '+' ) // overline { // not implemented yet } i++; } } else // a font change { // draw string so far PSDrawTextToDC( utf8_string, drawText ); // get new font fci = ucs4[i]; PSSetFont( fci ); i++; } } PSDrawTextToDC( utf8_string, drawText ); } //-------------------------------------------------------------------------- // void common_init( PLStream *pls ) // // Basic initialization for all devices. //-------------------------------------------------------------------------- wxPLDevBase* common_init( PLStream *pls ) { // Log_Verbose( "common_init()" ); wxPLDevBase* dev; PLFLT downscale, downscale2; // default options static PLINT freetype = -1; static PLINT smooth_text = 1; static PLINT text = -1; static PLINT hrshsym = 0; // default backend uses wxGraphicsContext, if not available // the agg library will be used, if not available the basic // backend will be used. static PLINT backend = wxBACKEND_DC; #if wxUSE_GRAPHICS_CONTEXT backend = wxBACKEND_GC; #else #ifdef HAVE_AGG backend = wxBACKEND_AGG; #endif #endif DrvOpt wx_options[] = { #ifdef PL_HAVE_FREETYPE { "freetype", DRV_INT, &freetype, "Use FreeType library" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, #endif { "hrshsym", DRV_INT, &hrshsym, "Use Hershey symbol set (hrshsym=0|1)" }, { "backend", DRV_INT, &backend, "Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext" }, { "text", DRV_INT, &text, "Use own text routines (text=0|1)" }, { NULL, DRV_INT, NULL, NULL } }; // Check for and set up driver options plParseDrvOpts( wx_options ); // allocate memory for the device storage switch ( backend ) { case wxBACKEND_GC: // in case wxGraphicsContext isn't available, the next backend (agg // if available) in this list will be used #if wxUSE_GRAPHICS_CONTEXT dev = new wxPLDevGC; // by default the own text routines are used for wxGC if ( text == -1 ) text = 1; freetype = 0; // this backend is vector oriented and doesn't know pixels break; #endif case wxBACKEND_AGG: // in case the agg library isn't available, the standard backend // will be used #ifdef HAVE_AGG dev = new wxPLDevAGG; // by default the freetype text routines are used for wxAGG text = 0; // text processing doesn't work yet for the AGG backend if ( freetype == -1 ) freetype = 1; break; #endif default: dev = new wxPLDevDC; // by default the own text routines are used for wxDC if ( text == -1 ) { if ( freetype != 1 ) text = 1; else text = 0; } if ( freetype == -1 ) freetype = 0; break; } if ( dev == NULL ) { plexit( "Insufficient memory" ); } pls->dev = (void *) dev; // be verbose and write out debug messages #ifdef _DEBUG pls->verbose = 1; pls->debug = 1; #endif pls->color = 1; // Is a color device pls->dev_flush = 1; // Handles flushes pls->dev_fill0 = 1; // Can handle solid fills pls->dev_fill1 = 0; // Can't handle pattern fills pls->dev_dash = 0; pls->dev_clear = 1; // driver supports clear if ( text ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode if ( hrshsym ) pls->dev_hrshsym = 1; } #ifdef PL_HAVE_FREETYPE // own text routines have higher priority over freetype // if text and freetype option are set to 1 if ( !text ) { dev->smooth_text = smooth_text; dev->freetype = freetype; } if ( dev->freetype ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode if ( hrshsym ) pls->dev_hrshsym = 1; init_freetype_lv1( pls ); FT_Data* FT = (FT_Data *) pls->FT; FT->want_smooth_text = smooth_text; } #endif // initialize frame size and position if ( pls->xlength <= 0 || pls->ylength <= 0 ) plspage( 0.0, 0.0, (PLINT) ( CANVAS_WIDTH * DEVICE_PIXELS_PER_IN ), (PLINT) ( CANVAS_HEIGHT * DEVICE_PIXELS_PER_IN ), 0, 0 ); dev->width = pls->xlength; dev->height = pls->ylength; dev->clipminx = pls->xlength; dev->clipminy = pls->ylength; if ( pls->xoffset != 0 || pls->yoffset != 0 ) { dev->xpos = (int) ( pls->xoffset ); dev->ypos = (int) ( pls->yoffset ); } // If portrait mode, apply a rotation and set freeaspect if ( pls->portrait ) { plsdiori( (PLFLT) ( 4 - ORIENTATION ) ); pls->freeaspect = 1; } // Set the number of pixels per mm plP_setpxl( (PLFLT) VIRTUAL_PIXELS_PER_MM, (PLFLT) VIRTUAL_PIXELS_PER_MM ); // Set up physical limits of plotting device (in drawing units) downscale = (double) dev->width / (double) ( PIXELS_X - 1 ); downscale2 = (double) dev->height / (double) PIXELS_Y; if ( downscale < downscale2 ) downscale = downscale2; plP_setphy( (PLINT) 0, (PLINT) ( dev->width / downscale ), (PLINT) 0, (PLINT) ( dev->height / downscale ) ); // get physical device limits coordinates plP_gphy( &dev->xmin, &dev->xmax, &dev->ymin, &dev->ymax ); // setting scale factors dev->scalex = (PLFLT) ( dev->xmax - dev->xmin ) / ( dev->width ); dev->scaley = (PLFLT) ( dev->ymax - dev->ymin ) / ( dev->height ); // set dpi plspage( VIRTUAL_PIXELS_PER_IN / dev->scalex, VIRTUAL_PIXELS_PER_IN / dev->scaley, 0, 0, 0, 0 ); #ifdef PL_HAVE_FREETYPE if ( dev->freetype ) init_freetype_lv2( pls ); #endif // find out what file drivers are available plgFileDevs( &dev->devDesc, &dev->devName, &dev->ndev ); return dev; } #ifdef PLD_wxwidgets //-------------------------------------------------------------------------- // void plD_dispatch_init_wxwidgets( PLDispatchTable *pdt ) // // Make wxwidgets driver functions known to plplot. //-------------------------------------------------------------------------- void plD_dispatch_init_wxwidgets( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "wxWidgets DC"; pdt->pl_DevName = "wxwidgets"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 51; pdt->pl_init = (plD_init_fp) plD_init_wxwidgets; pdt->pl_line = (plD_line_fp) plD_line_wxwidgets; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_wxwidgets; pdt->pl_eop = (plD_eop_fp) plD_eop_wxwidgets; pdt->pl_bop = (plD_bop_fp) plD_bop_wxwidgets; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_wxwidgets; pdt->pl_state = (plD_state_fp) plD_state_wxwidgets; pdt->pl_esc = (plD_esc_fp) plD_esc_wxwidgets; } //-------------------------------------------------------------------------- // plD_init_wxwidgets( PLStream* pls ) // // Initialize wxWidgets device. //-------------------------------------------------------------------------- void plD_init_wxwidgets( PLStream* pls ) { // Log_Verbose( "plD_init_wxwidgets()" ); wxPLDevBase* dev; dev = common_init( pls ); pls->plbuf_write = 1; // use the plot buffer! pls->termin = 1; // interactive device pls->graphx = GRAPHICS_MODE; // No text mode for this driver (at least for now, might add a console window if I ever figure it out and have the inclination) dev->showGUI = true; dev->bitmapType = (wxBitmapType) 0; } #endif // PLD_wxwidgets #ifdef PLD_wxpng //-------------------------------------------------------------------------- // void plD_dispatch_init_wxpng( PLDispatchTable *pdt ) // // Make wxpng driver functions known to plplot. //-------------------------------------------------------------------------- void plD_dispatch_init_wxpng( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "wxWidgets PNG driver"; pdt->pl_DevName = "wxpng"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 52; pdt->pl_init = (plD_init_fp) plD_init_wxpng; pdt->pl_line = (plD_line_fp) plD_line_wxwidgets; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_wxwidgets; pdt->pl_eop = (plD_eop_fp) plD_eop_wxwidgets; pdt->pl_bop = (plD_bop_fp) plD_bop_wxwidgets; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_wxwidgets; pdt->pl_state = (plD_state_fp) plD_state_wxwidgets; pdt->pl_esc = (plD_esc_fp) plD_esc_wxwidgets; } //-------------------------------------------------------------------------- // void plD_init_wxpng( PLStream *pls ) // // Initialize wxpng device. //-------------------------------------------------------------------------- void plD_init_wxpng( PLStream *pls ) { // Log_Verbose( "plD_init_wxwidgets()" ); wxPLDevBase* dev; dev = common_init( pls ); // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set. plOpenFile( pls ); pls->plbuf_write = 1; // use the plot buffer! pls->dev_flush = 0; // No need for flushes pls->termin = 0; // file oriented device pls->graphx = GRAPHICS_MODE; // No text mode for this driver (at least for now, might add a console window if I ever figure it out and have the inclination) pls->page = 0; dev->showGUI = false; dev->bitmapType = wxBITMAP_TYPE_PNG; } #endif // PLD_wxpng //-------------------------------------------------------------------------- // void plD_line_wxwidgets( PLStream *pls, short x1a, short y1a, // short x2a, short y2a ) // // Draws a line from (x1a, y1a) to (x2a, y2a). //-------------------------------------------------------------------------- void plD_line_wxwidgets( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { // Log_Verbose( "plD_line_wxwidgets(x1a=%d, y1a=%d, x2a=%d, y2a=%d)", x1a, y1a, x2a, y2a ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; if ( !( dev->ready ) ) install_buffer( pls ); dev->DrawLine( x1a, y1a, x2a, y2a ); if ( !( dev->resizing ) && dev->ownGUI ) { dev->comcount++; if ( dev->comcount > MAX_COMCOUNT ) { wxRunApp( pls, true ); dev->comcount = 0; } } } //-------------------------------------------------------------------------- // void plD_polyline_wxwidgets( PLStream *pls, short *xa, short *ya, // PLINT npts ) // // Draw a poly line - points are in xa and ya arrays. //-------------------------------------------------------------------------- void plD_polyline_wxwidgets( PLStream *pls, short *xa, short *ya, PLINT npts ) { // Log_Verbose( "plD_polyline_wxwidgets()" ); // should be changed to use the wxDC::DrawLines function? wxPLDevBase* dev = (wxPLDevBase *) pls->dev; if ( !( dev->ready ) ) install_buffer( pls ); dev->DrawPolyline( xa, ya, npts ); if ( !( dev->resizing ) && dev->ownGUI ) { dev->comcount++; if ( dev->comcount > MAX_COMCOUNT ) { wxRunApp( pls, true ); dev->comcount = 0; } } } //-------------------------------------------------------------------------- // void plD_eop_wxwidgets( PLStream *pls ) // // End of Page. This function is called if a "end of page" is send by the // user. This command is ignored if we have the plot embedded in a // wxWidgets application, otherwise the application created by the device // takes over. //-------------------------------------------------------------------------- void plD_eop_wxwidgets( PLStream *pls ) { // Log_Verbose( "plD_eop_wxwidgets()" ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; if ( dev->bitmapType ) { wxMemoryDC memDC; wxBitmap bitmap( dev->width, dev->height, -1 ); memDC.SelectObject( bitmap ); dev->BlitRectangle( &memDC, 0, 0, dev->width, dev->height ); wxImage buffer = bitmap.ConvertToImage(); wxFFileOutputStream fstream( pls->OutFile ); if ( !( buffer.SaveFile( fstream, dev->bitmapType ) ) ) puts( "Troubles saving file!" ); memDC.SelectObject( wxNullBitmap ); } if ( dev->ownGUI ) { if ( pls->nopause || !dev->showGUI ) wxRunApp( pls, true ); else wxRunApp( pls ); } } //-------------------------------------------------------------------------- // void plD_bop_wxwidgets( PLStream *pls ) // // Begin of page. Before any plot command, this function is called, If we // have already a dc the background is cleared in background color and some // state calls are resent - this is because at the first call of this // function, a dc does most likely not exist, but state calls are recorded // and when a new dc is created this function is called again. //-------------------------------------------------------------------------- void plD_bop_wxwidgets( PLStream *pls ) { // Log_Verbose( "plD_bop_wxwidgets()" ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; if ( dev->ready ) { //if( pls->termin==0 ) { // plGetFam( pls ); // force new file if pls->family set for all subsequent calls to plGetFam // n.b. putting this after plGetFam call is important since plinit calls // bop, and you don't want the familying sequence started until after // that first call to bop. // n.b. pls->dev can change because of an indirect call to plD_init_png // from plGetFam if familying is enabled. Thus, wait to define dev until // now. //dev = (wxPLDevBase*)pls->dev; // // pls->famadv = 1; // pls->page++; // } // clear background PLINT bgr, bgg, bgb; // red, green, blue plgcolbg( &bgr, &bgg, &bgb ); // get background color information dev->ClearBackground( bgr, bgg, bgb ); // Replay escape calls that come in before PLESC_DEVINIT. All of them // required a DC that didn't exist yet. // if ( dev->plstate_width ) plD_state_wxwidgets( pls, PLSTATE_WIDTH ); dev->plstate_width = false; if ( dev->plstate_color0 ) plD_state_wxwidgets( pls, PLSTATE_COLOR0 ); dev->plstate_color0 = false; if ( dev->plstate_color1 ) plD_state_wxwidgets( pls, PLSTATE_COLOR1 ); dev->plstate_color1 = false; // why this? xwin driver has this // pls->page++; } } //-------------------------------------------------------------------------- // void plD_tidy_wxwidgets( PLStream *pls ) // // This function is called, if all plots are done. //-------------------------------------------------------------------------- void plD_tidy_wxwidgets( PLStream *pls ) { // Log_Verbose( "plD_tidy_wxwidgets()" ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; #ifdef PL_HAVE_FREETYPE if ( dev->freetype ) { FT_Data *FT = (FT_Data *) pls->FT; plscmap0n( FT->ncol0_org ); plD_FreeType_Destroy( pls ); } #endif if ( dev->ownGUI ) { wxPLGetApp().RemoveFrame( dev->m_frame ); if ( !wxPLGetApp().FrameCount() ) wxUninitialize(); } delete dev; pls->dev = NULL; // since in plcore.c pls->dev is free_mem'd } //-------------------------------------------------------------------------- // void plD_state_wxwidgets( PLStream *pls, PLINT op ) // // Handler for several state codes. Here we take care of setting the width // and color of the pen. //-------------------------------------------------------------------------- void plD_state_wxwidgets( PLStream *pls, PLINT op ) { // Log_Verbose( "plD_state_wxwidgets(op=%d)", op ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; switch ( op ) { case PLSTATE_WIDTH: // 1 if ( dev->ready ) dev->SetWidth( pls ); else dev->plstate_width = true; break; case PLSTATE_COLOR0: // 2 if ( dev->ready ) dev->SetColor0( pls ); else dev->plstate_color0 = true; break; case PLSTATE_COLOR1: // 3 if ( dev->ready ) dev->SetColor1( pls ); else dev->plstate_color1 = true; break; default: if ( !( dev->ready ) ) install_buffer( pls ); } } //-------------------------------------------------------------------------- // void plD_esc_wxwidgets( PLStream *pls, PLINT op, void *ptr ) // // Handler for several escape codes. Here we take care of filled polygons, // XOR or copy mode, initialize device (install dc from outside), and if // there is freetype support, rerendering of text. //-------------------------------------------------------------------------- void plD_esc_wxwidgets( PLStream *pls, PLINT op, void *ptr ) { // Log_Verbose( "plD_esc_wxwidgets(op=%d, ptr=%x)", op, ptr ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; switch ( op ) { case PLESC_FILL: fill_polygon( pls ); break; case PLESC_XORMOD: // switch between wxXOR and wxCOPY // if( dev->ready ) { // if( dev->m_dc->GetLogicalFunction() == wxCOPY ) // dev->m_dc->SetLogicalFunction( wxXOR ); // else if( dev->m_dc->GetLogicalFunction() == wxXOR ) // dev->m_dc->SetLogicalFunction( wxCOPY ); // } break; case PLESC_DEVINIT: dev->SetExternalBuffer( ptr ); // replay begin of page call and state settings plD_bop_wxwidgets( pls ); break; case PLESC_HAS_TEXT: if ( !( dev->ready ) ) install_buffer( pls ); if ( dev->freetype ) { #ifdef PL_HAVE_FREETYPE plD_render_freetype_text( pls, (EscText *) ptr ); #endif } else dev->ProcessString( pls, (EscText *) ptr ); break; case PLESC_RESIZE: { wxSize* size = (wxSize *) ptr; wx_set_size( pls, size->GetWidth(), size->GetHeight() ); } break; case PLESC_CLEAR: if ( !( dev->ready ) ) install_buffer( pls ); // Since the plot is updated only every MAX_COMCOUNT commands (usually 5000) // before we clear the screen we need to show the plot at least once :) if ( !( dev->resizing ) && dev->ownGUI ) { wxRunApp( pls, true ); dev->comcount = 0; } dev->ClearBackground( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->sppxmi, pls->sppymi, pls->sppxma, pls->sppyma ); break; case PLESC_FLUSH: // forced update of the window if ( !( dev->resizing ) && dev->ownGUI ) { wxRunApp( pls, true ); dev->comcount = 0; } break; case PLESC_GETC: if ( dev->ownGUI ) GetCursorCmd( pls, (PLGraphicsIn *) ptr ); break; case PLESC_GETBACKEND: *( (int *) ptr ) = dev->backend; break; default: break; } } //-------------------------------------------------------------------------- // static void fill_polygon( PLStream *pls ) // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void fill_polygon( PLStream *pls ) { // Log_Verbose( "fill_polygon(), npts=%d, x[0]=%d, y[0]=%d", pls->dev_npts, pls->dev_y[0], pls->dev_y[0] ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; if ( !( dev->ready ) ) install_buffer( pls ); dev->FillPolygon( pls ); if ( !( dev->resizing ) && dev->ownGUI ) { dev->comcount += 10; if ( dev->comcount > MAX_COMCOUNT ) { wxRunApp( pls, true ); dev->comcount = 0; } } } //-------------------------------------------------------------------------- // void wx_set_size( PLStream* pls, int width, int height ) // // Adds a dc to the stream. The associated device is attached to the canvas // as the property "dev". //-------------------------------------------------------------------------- void wx_set_size( PLStream* pls, int width, int height ) { // TODO: buffer must be resized here or in wxplotstream // Log_Verbose( "wx_set_size()" ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; // set new size and scale parameters dev->width = width; dev->height = height; dev->scalex = (PLFLT) ( dev->xmax - dev->xmin ) / dev->width; dev->scaley = (PLFLT) ( dev->ymax - dev->ymin ) / dev->height; // recalculate the dpi used in calculation of fontsize pls->xdpi = VIRTUAL_PIXELS_PER_IN / dev->scalex; pls->ydpi = VIRTUAL_PIXELS_PER_IN / dev->scaley; // clear background if we have a dc, since it's invalid (TODO: why, since in bop // it must be cleared anyway?) if ( dev->ready ) { PLINT bgr, bgg, bgb; // red, green, blue plgcolbg( &bgr, &bgg, &bgb ); // get background color information dev->CreateCanvas(); dev->ClearBackground( bgr, bgg, bgb ); } // freetype parameters must also be changed #ifdef PL_HAVE_FREETYPE if ( dev->freetype ) { FT_Data *FT = (FT_Data *) pls->FT; FT->scalex = dev->scalex; FT->scaley = dev->scaley; FT->ymax = dev->height; } #endif } //-------------------------------------------------------------------------- // int plD_errorexithandler_wxwidgets( const char *errormessage ) // // If an PLplot error occurs, this function shows a dialog regarding // this error and than exits. //-------------------------------------------------------------------------- int plD_errorexithandler_wxwidgets( const char *errormessage ) { if ( errormessage[0] ) { wxMessageDialog dialog( 0, wxString( errormessage, *wxConvCurrent ), wxString( "wxWidgets PLplot App error", *wxConvCurrent ), wxOK | wxICON_ERROR ); dialog.ShowModal(); } return 0; } //-------------------------------------------------------------------------- // void plD_erroraborthandler_wxwidgets( const char *errormessage ) // // If PLplot aborts, this function shows a dialog regarding // this error. //-------------------------------------------------------------------------- void plD_erroraborthandler_wxwidgets( const char *errormessage ) { if ( errormessage[0] ) { wxMessageDialog dialog( 0, ( wxString( errormessage, *wxConvCurrent ) + wxString( " aborting operation...", *wxConvCurrent ) ), wxString( "wxWidgets PLplot App abort", *wxConvCurrent ), wxOK | wxICON_ERROR ); dialog.ShowModal(); } } #ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // static void plD_pixel_wxwidgets( PLStream *pls, short x, short y ) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is set in the current colour. //-------------------------------------------------------------------------- static void plD_pixel_wxwidgets( PLStream *pls, short x, short y ) { // Log_Verbose( "plD_pixel_wxwidgets" ); wxPLDevBase *dev = (wxPLDevBase *) pls->dev; if ( !( dev->ready ) ) install_buffer( pls ); dev->PutPixel( x, y ); if ( !( dev->resizing ) && dev->ownGUI ) { dev->comcount++; if ( dev->comcount > MAX_COMCOUNT ) { wxRunApp( pls, true ); dev->comcount = 0; } } } //-------------------------------------------------------------------------- // static void plD_pixel_wxwidgets( PLStream *pls, short x, short y ) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is set in the current colour. //-------------------------------------------------------------------------- static void plD_set_pixel_wxwidgets( PLStream *pls, short x, short y, PLINT colour ) { // Log_Verbose( "plD_set_pixel_wxwidgets" ); wxPLDevBase *dev = (wxPLDevBase *) pls->dev; if ( !( dev->ready ) ) install_buffer( pls ); dev->PutPixel( x, y, colour ); if ( !( dev->resizing ) && dev->ownGUI ) { dev->comcount++; if ( dev->comcount > MAX_COMCOUNT ) { wxRunApp( pls, true ); dev->comcount = 0; } } } //-------------------------------------------------------------------------- // void plD_read_pixel_wxwidgets (PLStream *pls, short x, short y) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is read. //-------------------------------------------------------------------------- static PLINT plD_read_pixel_wxwidgets( PLStream *pls, short x, short y ) { // Log_Verbose( "plD_read_pixel_wxwidgets" ); wxPLDevBase *dev = (wxPLDevBase *) pls->dev; if ( !( dev->ready ) ) install_buffer( pls ); return dev->GetPixel( x, y ); } //-------------------------------------------------------------------------- // void init_freetype_lv1 (PLStream *pls) // // "level 1" initialisation of the freetype library. // "Level 1" initialisation calls plD_FreeType_init(pls) which allocates // memory to the pls->FT structure, then sets up the pixel callback // function. //-------------------------------------------------------------------------- static void init_freetype_lv1( PLStream *pls ) { // Log_Verbose( "init_freetype_lv1" ); plD_FreeType_init( pls ); FT_Data *FT = (FT_Data *) pls->FT; FT->pixel = (plD_pixel_fp) plD_pixel_wxwidgets; // // See if we have a 24 bit device (or better), in which case // we can use the better antialising. // // the bitmap we are using in the antialized case has always // 32 bit depth FT->BLENDED_ANTIALIASING = 1; FT->read_pixel = (plD_read_pixel_fp) plD_read_pixel_wxwidgets; FT->set_pixel = (plD_set_pixel_fp) plD_set_pixel_wxwidgets; } //-------------------------------------------------------------------------- // void init_freetype_lv2 (PLStream *pls) // // "Level 2" initialisation of the freetype library. // "Level 2" fills in a few setting that aren't public until after the // graphics sub-syetm has been initialised. // The "level 2" initialisation fills in a few things that are defined // later in the initialisation process for the GD driver. // // FT->scale is a scaling factor to convert co-ordinates. This is used by // the GD and other drivers to scale back a larger virtual page and this // eliminate the "hidden line removal bug". Set it to 1 if your device // doesn't have scaling. // // Some coordinate systems have zero on the bottom, others have zero on // the top. Freetype does it one way, and most everything else does it the // other. To make sure everything is working ok, we have to "flip" the // coordinates, and to do this we need to know how big in the Y dimension // the page is, and whether we have to invert the page or leave it alone. // // FT->ymax specifies the size of the page FT->invert_y=1 tells us to // invert the y-coordinates, FT->invert_y=0 will not invert the // coordinates. //-------------------------------------------------------------------------- static void init_freetype_lv2( PLStream *pls ) { // Log_Verbose( "init_freetype_lv2" ); wxPLDevBase *dev = (wxPLDevBase *) pls->dev; FT_Data *FT = (FT_Data *) pls->FT; FT->scalex = dev->scalex; FT->scaley = dev->scaley; FT->ymax = dev->height; FT->invert_y = 1; FT->smooth_text = 0; if ( ( FT->want_smooth_text == 1 ) && ( FT->BLENDED_ANTIALIASING == 0 ) ) // do we want to at least *try* for smoothing ? { FT->ncol0_org = pls->ncol0; // save a copy of the original size of ncol0 FT->ncol0_xtra = 16777216 - ( pls->ncol1 + pls->ncol0 ); // work out how many free slots we have FT->ncol0_width = FT->ncol0_xtra / ( pls->ncol0 - 1 ); // find out how many different shades of anti-aliasing we can do if ( FT->ncol0_width > 4 ) // are there enough colour slots free for text smoothing ? { if ( FT->ncol0_width > max_number_of_grey_levels_used_in_text_smoothing ) FT->ncol0_width = max_number_of_grey_levels_used_in_text_smoothing; // set a maximum number of shades plscmap0n( FT->ncol0_org + ( FT->ncol0_width * pls->ncol0 ) ); // redefine the size of cmap0 // the level manipulations are to turn off the plP_state(PLSTATE_CMAP0) // call in plscmap0 which (a) leads to segfaults since the GD image is // not defined at this point and (b) would be inefficient in any case since // setcmap is always called later (see plD_bop_png) to update the driver // color palette to be consistent with cmap0. { PLINT level_save; level_save = pls->level; pls->level = 0; pl_set_extended_cmap0( pls, FT->ncol0_width, FT->ncol0_org ); // call the function to add the extra cmap0 entries and calculate stuff pls->level = level_save; } FT->smooth_text = 1; // Yippee ! We had success setting up the extended cmap0 } else plwarn( "Insufficient colour slots available in CMAP0 to do text smoothing." ); } else if ( ( FT->want_smooth_text == 1 ) && ( FT->BLENDED_ANTIALIASING == 1 ) ) // If we have a truecolour device, we wont even bother trying to change the palette { FT->smooth_text = 1; } } #endif //-------------------------------------------------------------------------- // GetCursorCmd() // // Waits for a graphics input event and returns coordinates. //-------------------------------------------------------------------------- static void GetCursorCmd( PLStream* pls, PLGraphicsIn* ptr ) { // Log_Verbose( "GetCursorCmd" ); wxPLDevBase *dev = (wxPLDevBase *) pls->dev; PLGraphicsIn *gin = &( dev->gin ); // Initialize plGinInit( gin ); dev->locate_mode = LOCATE_INVOKED_VIA_API; dev->draw_xhair = true; // Run event loop until a point is selected wxRunApp( pls, false ); *ptr = *gin; if ( dev->locate_mode ) { dev->locate_mode = 0; dev->draw_xhair = false; } } //-------------------------------------------------------------------------- // This part includes wxWidgets specific functions, which allow to // open a window from the command line, if needed. //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // void install_buffer( PLStream *pls ) // // If this driver is called from a command line executable (and not // from within a wxWidgets program), this function prepares a DC and a // bitmap to plot into. //-------------------------------------------------------------------------- static void install_buffer( PLStream *pls ) { // Log_Verbose( "install_buffer" ); wxPLDevBase * dev = (wxPLDevBase *) pls->dev; static bool initApp = false; if ( !initApp ) { // this hack enables to have a GUI on Mac OSX even if the // program was called from the command line (and isn't a bundle) #ifdef __WXMAC__ ProcessSerialNumber psn; GetCurrentProcess( &psn ); CPSEnableForegroundOperation( &psn ); SetFrontProcess( &psn ); #endif // initialize wxWidgets wxInitialize(); wxLog::GetActiveTarget(); wxTRY { wxPLGetApp().CallOnInit(); } wxCATCH_ALL( wxPLGetApp().OnUnhandledException(); plexit( "Can't init wxWidgets!" ); ) initApp = true; } wxString title( pls->plwindow, *wxConvCurrent ); switch ( dev->backend ) { case wxBACKEND_DC: title += wxT( " - wxWidgets (basic)" ); break; case wxBACKEND_GC: title += wxT( " - wxWidgets (wxGC)" ); break; case wxBACKEND_AGG: title += wxT( " - wxWidgets (AGG)" ); break; default: break; } dev->m_frame = new wxPLplotFrame( title, pls ); wxPLGetApp().AddFrame( dev->m_frame ); // set size and position of window dev->m_frame->SetClientSize( dev->width, dev->height ); if ( dev->xpos != 0 || dev->ypos != 0 ) dev->m_frame->SetSize( dev->xpos, dev->ypos, wxDefaultCoord, wxDefaultCoord, wxSIZE_USE_EXISTING ); if ( dev->showGUI ) { dev->m_frame->Show( true ); dev->m_frame->Raise(); } else dev->m_frame->Show( false ); // get a DC and a bitmap or an imagebuffer dev->ownGUI = true; dev->bm_width = dev->width; dev->bm_height = dev->height; dev->CreateCanvas(); dev->ready = true; // Set wx error handler for various errors in plplot plsexit( plD_errorexithandler_wxwidgets ); plsabort( plD_erroraborthandler_wxwidgets ); // replay command we may have missed plD_bop_wxwidgets( pls ); } //-------------------------------------------------------------------------- // void wxRunApp( PLStream *pls, bool runonce ) // // This is a hacked wxEntry-function, so that wxUninitialize is not // called twice. Here we actually start the wxApplication. //-------------------------------------------------------------------------- static void wxRunApp( PLStream *pls, bool runonce ) { // Log_Verbose( "wxRunApp" ); wxPLDevBase* dev = (wxPLDevBase *) pls->dev; dev->waiting = true; wxTRY { class CallOnExit { public: // only call OnExit if exit is true (i.e. due an exception) ~CallOnExit() { if ( exit ) wxPLGetApp().OnExit();} bool exit; } callOnExit; callOnExit.exit = true; wxPLGetApp().SetAdvanceFlag( runonce ); wxPLGetApp().SetRefreshFlag(); // add an idle event is necessary for Linux (wxGTK2) // but not for Windows, but it doesn't harm wxIdleEvent event; wxPLGetApp().AddPendingEvent( event ); wxPLGetApp().OnRun(); // start wxWidgets application callOnExit.exit = false; } wxCATCH_ALL( wxPLGetApp().OnUnhandledException(); plexit( "Problem running wxWidgets!" ); ) if ( dev->exit ) { wxPLGetApp().OnExit(); plexit( "" ); } dev->waiting = false; } plplot-5.10.0+dfsg/drivers/pdf.driver_info.in 644 1750 1750 5611466747272 177750ustar andrewandrewpdf:Portable Document Format PDF:1:pdf:58:pdf plplot-5.10.0+dfsg/drivers/wxwidgets_gc.cpp 644 1750 1750 4471512141235265 176440ustar andrewandrew// $Id: wxwidgets_gc.cpp 12334 2013-05-04 16:43:33Z airwin $ // // Copyright (C) 2008 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // TODO: // - text clipping // - implement AddToClipRegion for text correctly // // wxwidgets headers #include #include "plDevs.h" // plplot headers #include "plplotP.h" // std and driver headers #include "wxwidgets.h" #include #include // only compile code if wxGraphicsContext available #if wxUSE_GRAPHICS_CONTEXT wxPLDevGC::wxPLDevGC( void ) : wxPLDevBase( wxBACKEND_GC ) { // Log_Verbose( "%s", __FUNCTION__ ); m_dc = NULL; m_bitmap = NULL; m_context = NULL; m_font = NULL; underlined = false; } wxPLDevGC::~wxPLDevGC() { // Log_Verbose( "%s", __FUNCTION__ ); if ( ownGUI ) { if ( m_dc ) { ( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap ); delete m_dc; } if ( m_bitmap ) delete m_bitmap; } delete m_font; delete m_context; } void wxPLDevGC::DrawLine( short x1a, short y1a, short x2a, short y2a ) { // Log_Verbose( "%s", __FUNCTION__ ); wxDouble x1 = x1a / scalex; wxDouble y1 = height - y1a / scaley; wxDouble x2 = x2a / scalex; wxDouble y2 = height - y2a / scaley; wxGraphicsPath path = m_context->CreatePath(); path.MoveToPoint( x1, y1 ); path.AddLineToPoint( x2, y2 ); m_context->StrokePath( path ); AddtoClipRegion( (int) x1, (int) y1, (int) x2, (int) y2 ); } void wxPLDevGC::DrawPolyline( short *xa, short *ya, PLINT npts ) { // Log_Verbose( "%s", __FUNCTION__ ); wxGraphicsPath path = m_context->CreatePath(); path.MoveToPoint( xa[0] / scalex, height - ya[0] / scaley ); for ( PLINT i = 1; i < npts; i++ ) path.AddLineToPoint( xa[i] / scalex, height - ya[i] / scaley ); m_context->StrokePath( path ); wxDouble x, y, w, h; path.GetBox( &x, &y, &w, &h ); AddtoClipRegion( (int) x, (int) y, (int) ( x + w ), (int) ( y + h ) ); } void wxPLDevGC::ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1, PLINT y1, PLINT x2, PLINT y2 ) { // Log_Verbose( "%s", __FUNCTION__ ); wxDouble x1a, y1a, x2a, y2a; if ( x1 < 0 ) x1a = 0; else x1a = x1 / scalex; if ( y1 < 0 ) y1a = 0; else y1a = height - y1 / scaley; if ( x2 < 0 ) x2a = width; else x2a = x2 / scalex; if ( y2 < 0 ) y2a = height; else y2a = height - y2 / scaley; m_context->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( bgr, bgg, bgb ), 1, wxSOLID ) ) ); m_context->SetBrush( wxBrush( wxColour( bgr, bgg, bgb ) ) ); m_context->DrawRectangle( x1a, y1a, x2a - x1a, y2a - y1a ); m_context->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( mColorRedStroke, mColorGreenStroke, mColorBlueStroke, mStrokeOpacity ), 1, wxSOLID ) ) ); m_context->SetBrush( wxBrush( wxColour( mColorRedFill, mColorGreenFill, mColorBlueFill, mStrokeOpacity ) ) ); AddtoClipRegion( (int) x1a, (int) y1a, (int) x2a, (int) y2a ); } void wxPLDevGC::FillPolygon( PLStream *pls ) { // Log_Verbose( "%s", __FUNCTION__ ); bool isRect = false; short* x = pls->dev_x; short* y = pls->dev_y; if ( pls->dev_npts == 4 ) // Check if it's a rectangle. If so, it can be made faster to display { if ( x[0] == x[1] && x[2] == x[3] && y[0] == y[3] && y[1] == y[2] ) isRect = true; else if ( x[0] == x[3] && x[1] == x[2] && y[0] == y[1] && y[2] == y[3] ) isRect = true; } if ( pls->dev_npts == 5 ) { if ( x[0] == x[4] && y[0] == y[4] ) { if ( x[0] == x[1] && x[2] == x[3] && y[0] == y[3] && y[1] == y[2] ) isRect = true; else if ( x[0] == x[3] && x[1] == x[2] && y[0] == y[1] && y[2] == y[3] ) isRect = true; } } if ( isRect ) //isRect) { { double x1, y1, x2, y2, x0, y0, w, h; x1 = x[0] / scalex; x2 = x[2] / scalex; y1 = height - y[0] / scaley; y2 = height - y[2] / scaley; if ( x1 < x2 ) { x0 = x1; w = x2 - x1; } else { x0 = x2; w = x1 - x2; } if ( y1 < y2 ) { y0 = y1; h = y2 - y1; } else { y0 = y2; h = y1 - y2; } m_context->DrawRectangle( x0, y0, w, h ); AddtoClipRegion( (int) x0, (int) y0, (int) w, (int) h ); } else { wxGraphicsPath path = m_context->CreatePath(); path.MoveToPoint( x[0] / scalex, height - y[0] / scaley ); for ( int i = 1; i < pls->dev_npts; i++ ) path.AddLineToPoint( x[i] / scalex, height - y[i] / scaley ); path.CloseSubpath(); if ( pls->dev_eofill ) m_context->DrawPath( path, wxODDEVEN_RULE ); else m_context->DrawPath( path, wxWINDING_RULE ); wxDouble x, y, w, h; path.GetBox( &x, &y, &w, &h ); AddtoClipRegion( (int) x, (int) y, (int) ( x + w ), (int) ( y + h ) ); } } void wxPLDevGC::BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH ) { // Log_Verbose( "%s", __FUNCTION__ ); if ( m_dc ) dc->Blit( vX, vY, vW, vH, m_dc, vX, vY ); } void wxPLDevGC::CreateCanvas() { // Log_Verbose( "%s", __FUNCTION__ ); if ( ownGUI ) { if ( !m_dc ) m_dc = new wxMemoryDC(); ( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap ); // deselect bitmap if ( m_bitmap ) delete m_bitmap; m_bitmap = new wxBitmap( bm_width, bm_height, 32 ); ( (wxMemoryDC *) m_dc )->SelectObject( *m_bitmap ); // select new bitmap } if ( m_dc ) { delete m_context; m_context = wxGraphicsContext::Create( *( (wxMemoryDC *) m_dc ) ); } } void wxPLDevGC::SetWidth( PLStream *pls ) { // Log_Verbose( "%s", __FUNCTION__ ); m_context->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( mColorRedStroke, mColorGreenStroke, mColorBlueStroke, mStrokeOpacity ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); } void wxPLDevGC::SetColor0( PLStream *pls ) { // Log_Verbose( "%s", __FUNCTION__ ); mColorRedStroke = pls->curcolor.r; mColorGreenStroke = pls->curcolor.g; mColorBlueStroke = pls->curcolor.b; mColorRedFill = pls->curcolor.r; mColorGreenFill = pls->curcolor.g; mColorBlueFill = pls->curcolor.b; mStrokeOpacity = (unsigned char) ( pls->curcolor.a * 255 ); m_context->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( mColorRedStroke, mColorGreenStroke, mColorBlueStroke, mStrokeOpacity ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); m_context->SetBrush( wxBrush( wxColour( mColorRedFill, mColorGreenFill, mColorBlueFill, mStrokeOpacity ) ) ); } void wxPLDevGC::SetColor1( PLStream *pls ) { // Log_Verbose( "%s", __FUNCTION__ ); mColorRedStroke = pls->curcolor.r; mColorGreenStroke = pls->curcolor.g; mColorBlueStroke = pls->curcolor.b; mColorRedFill = pls->curcolor.r; mColorGreenFill = pls->curcolor.g; mColorBlueFill = pls->curcolor.b; mStrokeOpacity = (unsigned char) ( pls->curcolor.a * 255 ); m_context->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( mColorRedStroke, mColorGreenStroke, mColorBlueStroke, mStrokeOpacity ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); m_context->SetBrush( wxBrush( wxColour( mColorRedFill, mColorGreenFill, mColorBlueFill, mStrokeOpacity ) ) ); } //-------------------------------------------------------------------------- // void wx_set_dc( PLStream* pls, wxDC* dc ) // // Adds a dc to the stream. The associated device is attached to the canvas // as the property "dev". //-------------------------------------------------------------------------- void wxPLDevGC::SetExternalBuffer( void* dc ) { // Log_Verbose( "%s", __FUNCTION__ ); m_dc = (wxDC *) dc; // Add the dc to the device m_context = wxGraphicsContext::Create( *( (wxMemoryDC *) m_dc ) ); ready = true; ownGUI = false; } #ifdef PL_HAVE_FREETYPE void wxPLDevGC::PutPixel( short x, short y, PLINT color ) { // Log_Verbose( "%s", __FUNCTION__ ); const wxPen oldpen = m_dc->GetPen(); m_context->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( GetRValue( color ), GetGValue( color ), GetBValue( color ) ), 1, wxSOLID ) ) ); //m_context->DrawPoint( x, y ); AddtoClipRegion( x, y, x, y ); m_context->SetPen( oldpen ); } void wxPLDevGC::PutPixel( short x, short y ) { // Log_Verbose( "%s", __FUNCTION__ ); //m_dc->DrawPoint( x, y ); AddtoClipRegion( x, y, x, y ); } PLINT wxPLDevGC::GetPixel( short x, short y ) { // Log_Verbose( "%s", __FUNCTION__ ); #ifdef __WXGTK__ // Cast function parameters to (void) to silence compiler warnings about unused parameters (void) x; (void) y; // The GetPixel method is incredible slow for wxGTK. Therefore we set the colour // always to the background color, since this is the case anyway 99% of the time. PLINT bgr, bgg, bgb; // red, green, blue plgcolbg( &bgr, &bgg, &bgb ); // get background color information return RGB( bgr, bgg, bgb ); #else wxColour col; m_dc->GetPixel( x, y, &col ); return RGB( col.Red(), col.Green(), col.Blue() ); #endif } #endif // PL_HAVE_FREETYPE void wxPLDevGC::PSDrawTextToDC( char* utf8_string, bool drawText ) { // Log_Verbose( "%s", __FUNCTION__ ); wxDouble w, h, d, l; wxString str( wxConvUTF8.cMB2WC( utf8_string ), *wxConvCurrent ); w = 0; m_context->GetTextExtent( str, &w, &h, &d, &l ); if ( drawText ) { m_context->DrawText( str, 0, -yOffset / scaley ); m_context->Translate( w, 0 ); } textWidth += static_cast( w ); //keep track of the height of superscript text, the depth of subscript //text and the height of regular text if ( yOffset > 0.0001 ) { //determine the height the text would have if it were full size double currentOffset = yOffset; double currentHeight = h; while ( currentOffset > 0.0001 ) { currentOffset -= scaley * fontSize * fontScale / 2.; currentHeight *= 1.25; } textHeight = textHeight > ( currentHeight ) ? textHeight : static_cast( ( currentHeight ) ); //work out the height including superscript superscriptHeight = superscriptHeight > ( currentHeight + yOffset / scaley ) ? superscriptHeight : static_cast( ( currentHeight + yOffset / scaley ) ); } else if ( yOffset < -0.0001 ) { //determine the height the text would have if it were full size double currentOffset = yOffset; double currentHeight = h; double currentDepth = d; while ( currentOffset < -0.0001 ) { currentOffset += scaley * fontSize * fontScale * 1.25 / 2.; currentHeight *= 1.25; currentDepth *= 1.25; } textHeight = textHeight > currentHeight ? textHeight : static_cast( ( currentHeight ) ); //work out the additional depth for subscript note an assumption has been made //that the font size of (non-superscript and non-subscript) text is the same //along a line. Currently there is no escape to change font size mid string //so this should be fine subscriptDepth = subscriptDepth > ( ( -yOffset / scaley + h + d ) - ( currentDepth + textHeight ) ) ? subscriptDepth : static_cast( ( -yOffset / scaley + h + d ) - ( currentDepth + textHeight ) ); subscriptDepth = subscriptDepth > 0 ? subscriptDepth : 0; } else textHeight = textHeight > h ? textHeight : static_cast( h ); memset( utf8_string, '\0', max_string_length ); } void wxPLDevGC::PSSetFont( PLUNICODE fci ) { // Log_Verbose( "%s", __FUNCTION__ ); unsigned char fontFamily, fontStyle, fontWeight; plP_fci2hex( fci, &fontFamily, PL_FCI_FAMILY ); plP_fci2hex( fci, &fontStyle, PL_FCI_STYLE ); plP_fci2hex( fci, &fontWeight, PL_FCI_WEIGHT ); if ( m_font ) delete m_font; m_font = wxFont::New( static_cast( fontSize * fontScale ), fontFamilyLookup[fontFamily], fontStyleLookup[fontStyle] | fontWeightLookup[fontWeight] ); m_font->SetUnderlined( underlined ); m_context->SetFont( *m_font, wxColour( textRed, textGreen, textBlue ) ); } void wxPLDevGC::ProcessString( PLStream* pls, EscText* args ) { // Log_Verbose( "%s", __FUNCTION__ ); // Check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to a cairo driver, ignoring\n" ); return; } // Check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= max_string_length ) { printf( "Sorry, the wxWidgets drivers only handles strings of length < %d\n", max_string_length ); return; } // Calculate the font size (in pixels) fontSize = pls->chrht * VIRTUAL_PIXELS_PER_MM / scaley * 1.3; // Use PLplot core routine to get the corners of the clipping rectangle PLINT rcx[4], rcy[4]; difilt_clip( rcx, rcy ); #ifdef __WXOSX_COCOA__ wxPoint topLeft( width, height ), bottomRight( -1, -1 ); for ( int i = 0; i < 4; i++ ) { topLeft.x = topLeft.x > ( rcx[i] / scalex ) ? ( rcx[i] / scalex ) : topLeft.x; topLeft.y = topLeft.y > ( height - rcy[i] / scaley ) ? ( height - rcy[i] / scaley ) : topLeft.y; bottomRight.x = bottomRight.x < ( rcx[i] / scalex ) ? ( rcx[i] / scalex ) : bottomRight.x; bottomRight.y = bottomRight.y < ( height - rcy[i] / scaley ) ? ( height - rcy[i] / scaley ) : bottomRight.y; } m_context->Clip( wxRegion( topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y ) ); // m_context->Clip( wxRegion( topLeft, bottomRight) ); // this wxRegion constructor doesn't work in wxWidgets 2.9.2/Cocoa #else wxPoint cpoints[4]; for ( int i = 0; i < 4; i++ ) { cpoints[i].x = rcx[i] / scalex; cpoints[i].y = height - rcy[i] / scaley; } m_context->Clip( wxRegion( 4, cpoints ) ); #endif // text color textRed = pls->curcolor.r; textGreen = pls->curcolor.g; textBlue = pls->curcolor.b; // calculate rotation of text plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * M_PI / 2.0; cos_rot = cos( rotation ); sin_rot = sin( rotation ); cos_shear = cos( shear ); sin_shear = sin( shear ); PLUNICODE *lineStart = args->unicode_array; int lineLen = 0; bool lineFeed = false; bool carriageReturn = false; wxCoord paraHeight = 0; // Get the curent font fontScale = 1.0; yOffset = 0.0; plgfci( &fci ); PSSetFont( fci ); while ( lineStart != args->unicode_array + args->unicode_array_len ) { while ( lineStart + lineLen != args->unicode_array + args->unicode_array_len && *( lineStart + lineLen ) != (PLUNICODE) '\n' ) { lineLen++; } //set line feed for the beginning of this line and //carriage return for the end lineFeed = carriageReturn; carriageReturn = lineStart + lineLen != args->unicode_array + args->unicode_array_len && *( lineStart + lineLen ) == (PLUNICODE) ( '\n' ); if ( lineFeed ) paraHeight += textHeight + subscriptDepth; //remember the text parameters so they can be restored double startingFontScale = fontScale; double startingYOffset = yOffset; PLUNICODE startingFci = fci; // determine extent of text PSDrawText( lineStart, lineLen, false ); if ( lineFeed && superscriptHeight > textHeight ) paraHeight += superscriptHeight - textHeight; // actually draw text, resetting the font first fontScale = startingFontScale; yOffset = startingYOffset; fci = startingFci; PSSetFont( fci ); m_context->PushState(); //save current position m_context->Translate( args->x / scalex, height - args->y / scaley ); //move to text starting position wxGraphicsMatrix matrix = m_context->CreateMatrix( cos_rot * stride, -sin_rot * stride, cos_rot * sin_shear + sin_rot * cos_shear, -sin_rot * sin_shear + cos_rot * cos_shear, 0.0, 0.0 ); //create rotation transformation matrix m_context->ConcatTransform( matrix ); //rotate m_context->Translate( -args->just * textWidth, -0.5 * textHeight + paraHeight * lineSpacing ); //move to set alignment PSDrawText( lineStart, lineLen, true ); //draw text m_context->PopState(); //return to original position lineStart += lineLen; if ( carriageReturn ) lineStart++; lineLen = 0; } AddtoClipRegion( 0, 0, width, height ); m_context->ResetClip(); } #endif plplot-5.10.0+dfsg/drivers/wxwidgets_dc.cpp 644 1750 1750 4572012201213431 176220ustar andrewandrew// $Id: wxwidgets_dc.cpp 12475 2013-08-09 16:21:45Z airwin $ // // Copyright (C) 2005 Werner Smekal, Sjaak Verdoold // Copyright (C) 2005 Germain Carrera Corraleche // Copyright (C) 1999 Frank Huebner // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // TODO: // - text clipping // - implement AddToClipRegion for text correctly // // wxwidgets headers #include #include "plDevs.h" // plplot headers #include "plplotP.h" // std and driver headers #include #include "wxwidgets.h" //-------------------------------------------------------------------------- // wxPLDevDC::wxPLDevDC( void ) // // Constructor of the standard wxWidgets device based on the wxPLDevBase // class. Only some initialisations are done. //-------------------------------------------------------------------------- wxPLDevDC::wxPLDevDC( void ) : wxPLDevBase( wxBACKEND_DC ) { m_dc = NULL; m_bitmap = NULL; m_font = NULL; underlined = false; } //-------------------------------------------------------------------------- // wxPLDevDC::~wxPLDevDC( void ) // // The deconstructor frees memory allocated by the device. //-------------------------------------------------------------------------- wxPLDevDC::~wxPLDevDC() { if ( ownGUI ) { if ( m_dc ) { ( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap ); delete m_dc; } if ( m_bitmap ) delete m_bitmap; } if ( m_font ) delete m_font; } //-------------------------------------------------------------------------- // void wxPLDevDC::DrawLine( short x1a, short y1a, short x2a, short y2a ) // // Draw a line from (x1a, y1a) to (x2a, y2a). //-------------------------------------------------------------------------- void wxPLDevDC::DrawLine( short x1a, short y1a, short x2a, short y2a ) { x1a = (short) ( x1a / scalex ); y1a = (short) ( height - y1a / scaley ); x2a = (short) ( x2a / scalex ); y2a = (short) ( height - y2a / scaley ); m_dc->DrawLine( (wxCoord) x1a, (wxCoord) y1a, (wxCoord) x2a, (wxCoord) y2a ); AddtoClipRegion( (int) x1a, (int) y1a, (int) x2a, (int) y2a ); } //-------------------------------------------------------------------------- // void wxPLDevDC::DrawPolyline( short *xa, short *ya, PLINT npts ) // // Draw a poly line - coordinates are in the xa and ya arrays. //-------------------------------------------------------------------------- void wxPLDevDC::DrawPolyline( short *xa, short *ya, PLINT npts ) { wxCoord x1a, y1a, x2a, y2a; x2a = (wxCoord) ( xa[0] / scalex ); y2a = (wxCoord) ( height - ya[0] / scaley ); for ( PLINT i = 1; i < npts; i++ ) { x1a = x2a; y1a = y2a; x2a = (wxCoord) ( xa[i] / scalex ); y2a = (wxCoord) ( height - ya[i] / scaley ); m_dc->DrawLine( x1a, y1a, x2a, y2a ); AddtoClipRegion( (int) x1a, (int) y1a, (int) x2a, (int) y2a ); } } //-------------------------------------------------------------------------- // void wxPLDevDC::ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, // PLINT x1, PLINT y1, PLINT x2, PLINT y2 ) // // Clear parts ((x1,y1) to (x2,y2)) of the background in color (bgr,bgg,bgb). //-------------------------------------------------------------------------- void wxPLDevDC::ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1, PLINT y1, PLINT x2, PLINT y2 ) { if ( x1 < 0 ) x1 = 0; else x1 = (PLINT) ( x1 / scalex ); if ( y1 < 0 ) y1 = 0; else y1 = (PLINT) ( height - y1 / scaley ); if ( x2 < 0 ) x2 = width; else x2 = (PLINT) ( x2 / scalex ); if ( y2 < 0 ) y2 = height; else y2 = (PLINT) ( height - y2 / scaley ); const wxPen oldPen = m_dc->GetPen(); const wxBrush oldBrush = m_dc->GetBrush(); m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( bgr, bgg, bgb ), 1, wxSOLID ) ) ); m_dc->SetBrush( wxBrush( wxColour( bgr, bgg, bgb ) ) ); m_dc->DrawRectangle( x1, y1, x2 - x1, y2 - y1 ); m_dc->SetPen( oldPen ); m_dc->SetBrush( oldBrush ); AddtoClipRegion( x1, y1, x2, y2 ); } //-------------------------------------------------------------------------- // void wxPLDevDC::FillPolygon( PLStream *pls ) // // Draw a filled polygon. //-------------------------------------------------------------------------- void wxPLDevDC::FillPolygon( PLStream *pls ) { wxPoint *points = new wxPoint[pls->dev_npts]; wxCoord xoffset = 0; wxCoord yoffset = 0; for ( int i = 0; i < pls->dev_npts; i++ ) { points[i].x = (int) ( pls->dev_x[i] / scalex ); points[i].y = (int) ( height - pls->dev_y[i] / scaley ); if ( i > 0 ) AddtoClipRegion( points[i - 1].x, points[i - 1].y, points[i].x, points[i].y ); } if ( pls->dev_eofill ) { m_dc->DrawPolygon( pls->dev_npts, points, xoffset, yoffset, wxODDEVEN_RULE ); } else { m_dc->DrawPolygon( pls->dev_npts, points, xoffset, yoffset, wxWINDING_RULE ); } delete[] points; } //-------------------------------------------------------------------------- // void wxPLDevDC::BlitRectangle( wxDC* dc, int vX, int vY, // int vW, int vH ) // // Copy/Blit a rectangle ((vX,vY) to (vX+vW,vY+vH)) into given dc. //-------------------------------------------------------------------------- void wxPLDevDC::BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH ) { if ( m_dc ) dc->Blit( vX, vY, vW, vH, m_dc, vX, vY ); } //-------------------------------------------------------------------------- // void wxPLDevDC::CreateCanvas( void ) // // Create canvas (bitmap and dc) if the driver provides the GUI. //-------------------------------------------------------------------------- void wxPLDevDC::CreateCanvas() { if ( ownGUI ) { if ( !m_dc ) m_dc = new wxMemoryDC(); ( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap ); // deselect bitmap if ( m_bitmap ) delete m_bitmap; m_bitmap = new wxBitmap( bm_width, bm_height, 32 ); ( (wxMemoryDC *) m_dc )->SelectObject( *m_bitmap ); // select new bitmap } } //-------------------------------------------------------------------------- // void wxPLDevDC::SetWidth( PLStream *pls ) // // Set the width of the drawing pen. //-------------------------------------------------------------------------- void wxPLDevDC::SetWidth( PLStream *pls ) { m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); } //-------------------------------------------------------------------------- // void wxPLDevDC::SetColor0( PLStream *pls ) // // Set color from colormap 0. //-------------------------------------------------------------------------- void wxPLDevDC::SetColor0( PLStream *pls ) { m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ) ) ); } //-------------------------------------------------------------------------- // void wxPLDevDC::SetColor1( PLStream *pls ) // // Set color from colormap 1. //-------------------------------------------------------------------------- void wxPLDevDC::SetColor1( PLStream *pls ) { m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ), pls->width > 0 ? pls->width : 1, wxSOLID ) ) ); m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ) ) ); } //-------------------------------------------------------------------------- // void wxPLDevDC::SetExternalBuffer( void* dc ) // // Adds a dc to the device. In that case, the drivers doesn't provide // a GUI. //-------------------------------------------------------------------------- void wxPLDevDC::SetExternalBuffer( void* dc ) { m_dc = (wxDC *) dc; // Add the dc to the device ready = true; ownGUI = false; } #ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void wxPLDevDC::PutPixel( short x, short y, PLINT color ) // // Draw a pixel in color color @ (x,y). //-------------------------------------------------------------------------- void wxPLDevDC::PutPixel( short x, short y, PLINT color ) { const wxPen oldpen = m_dc->GetPen(); m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( GetRValue( color ), GetGValue( color ), GetBValue( color ) ), 1, wxSOLID ) ) ); m_dc->DrawPoint( x, y ); AddtoClipRegion( x, y, x, y ); m_dc->SetPen( oldpen ); } //-------------------------------------------------------------------------- // void wxPLDevDC::PutPixel( short x, short y ) // // Draw a pixel in current color @ (x,y). //-------------------------------------------------------------------------- void wxPLDevDC::PutPixel( short x, short y ) { m_dc->DrawPoint( x, y ); AddtoClipRegion( x, y, x, y ); } //-------------------------------------------------------------------------- // PLINT wxPLDevDC::GetPixel( short x, short y ) // // Get color information from pixel @ (x,y). //-------------------------------------------------------------------------- PLINT wxPLDevDC::GetPixel( short x, short y ) { #ifdef __WXGTK__ // The GetPixel method is incredible slow for wxGTK. Therefore we set the colour // always to the background color, since this is the case anyway 99% of the time. PLINT bgr, bgg, bgb; // red, green, blue (void) x; (void) y; // Cast to void to silence compiler warnings about unused parameters plgcolbg( &bgr, &bgg, &bgb ); // get background color information return RGB( bgr, bgg, bgb ); #else wxColour col; m_dc->GetPixel( x, y, &col ); return RGB( col.Red(), col.Green(), col.Blue() ); #endif } #endif // PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void wxPLDevDC::PSDrawTextToDC( char* utf8_string, bool drawText ) // // Draw utf8 text to screen if drawText==true. Otherwise determine // width and height of text. //-------------------------------------------------------------------------- void wxPLDevDC::PSDrawTextToDC( char* utf8_string, bool drawText ) { wxCoord w, h, d, l; wxString str( wxConvUTF8.cMB2WC( utf8_string ), *wxConvCurrent ); m_dc->GetTextExtent( str, &w, &h, &d, &l ); if ( drawText ) { m_dc->DrawRotatedText( str, (wxCoord) ( posX - yOffset / scaley * sin_rot ), (wxCoord) ( height - (wxCoord) ( posY + yOffset * cos_rot / scaley ) ), rotation * 180.0 / M_PI ); posX += (PLINT) ( w * cos_rot ); posY += (PLINT) ( w * sin_rot ); } textWidth += w; //keep track of the height of superscript text, the depth of subscript //text and the height of regular text if ( yOffset > 0.0001 ) { //determine the height the text would have if it were full size double currentOffset = yOffset; double currentHeight = h; while ( currentOffset > 0.0001 ) { currentOffset -= scaley * fontSize * fontScale / 2.; currentHeight *= 1.25; } textHeight = (wxCoord) textHeight > ( currentHeight ) ? textHeight : currentHeight; //work out the height including superscript superscriptHeight = superscriptHeight > ( currentHeight + yOffset / scaley ) ? superscriptHeight : static_cast( ( currentHeight + yOffset / scaley ) ); } else if ( yOffset < -0.0001 ) { //determine the height the text would have if it were full size double currentOffset = yOffset; double currentHeight = h; double currentDepth = d; while ( currentOffset < -0.0001 ) { currentOffset += scaley * fontSize * fontScale * 1.25 / 2.; currentHeight *= 1.25; currentDepth *= 1.25; } textHeight = (wxCoord) textHeight > currentHeight ? textHeight : currentHeight; //work out the additional depth for subscript note an assumption has been made //that the font size of (non-superscript and non-subscript) text is the same //along a line. Currently there is no escape to change font size mid string //so this should be fine subscriptDepth = (wxCoord) subscriptDepth > ( ( -yOffset / scaley + h + d ) - ( currentDepth + textHeight ) ) ? subscriptDepth : ( ( -yOffset / scaley + h + d ) - ( currentDepth + textHeight ) ); subscriptDepth = subscriptDepth > 0 ? subscriptDepth : 0; } else textHeight = (wxCoord) textHeight > ( h ) ? textHeight : h; memset( utf8_string, '\0', max_string_length ); } //-------------------------------------------------------------------------- // void wxPLDevDC::PSSetFont( PLUNICODE fci ) // // Set font defined by fci. //-------------------------------------------------------------------------- void wxPLDevDC::PSSetFont( PLUNICODE fci ) { unsigned char fontFamily, fontStyle, fontWeight; plP_fci2hex( fci, &fontFamily, PL_FCI_FAMILY ); plP_fci2hex( fci, &fontStyle, PL_FCI_STYLE ); plP_fci2hex( fci, &fontWeight, PL_FCI_WEIGHT ); if ( m_font ) delete m_font; m_font = wxFont::New( (int) ( fontSize * fontScale < 4 ? 4 : fontSize * fontScale ), fontFamilyLookup[fontFamily], fontStyleLookup[fontStyle] | fontWeightLookup[fontWeight] ); m_font->SetUnderlined( underlined ); m_dc->SetFont( *m_font ); } //-------------------------------------------------------------------------- // void wxPLDevDC::ProcessString( PLStream* pls, EscText* args ) // // This is the main function which processes the unicode text strings. // Font size, rotation and color are set, width and height of the // text string is determined and then the string is drawn to the canvas. //-------------------------------------------------------------------------- void wxPLDevDC::ProcessString( PLStream* pls, EscText* args ) { // Check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to the wxWidgets driver, ignoring\n" ); return; } // Check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= 500 ) { printf( "Sorry, the wxWidgets drivers only handles strings of length < %d\n", 500 ); return; } // Calculate the font size (in pixels) fontSize = pls->chrht * VIRTUAL_PIXELS_PER_MM / scaley * 1.3; // Use PLplot core routine to get the corners of the clipping rectangle PLINT rcx[4], rcy[4]; difilt_clip( rcx, rcy ); wxPoint cpoints[4]; for ( int i = 0; i < 4; i++ ) { cpoints[i].x = rcx[i] / scalex; cpoints[i].y = height - rcy[i] / scaley; } wxDCClipper clip( *m_dc, wxRegion( 4, cpoints ) ); // calculate rotation of text plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * M_PI / 2.0; cos_rot = cos( rotation ); sin_rot = sin( rotation ); // Set font color m_dc->SetTextForeground( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ) ); m_dc->SetTextBackground( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ) ); PLUNICODE *lineStart = args->unicode_array; int lineLen = 0; bool lineFeed = false; bool carriageReturn = false; wxCoord paraHeight = 0; // Get the curent font fontScale = 1.0; yOffset = 0.0; plgfci( &fci ); PSSetFont( fci ); while ( lineStart != args->unicode_array + args->unicode_array_len ) { while ( lineStart + lineLen != args->unicode_array + args->unicode_array_len && *( lineStart + lineLen ) != (PLUNICODE) '\n' ) { lineLen++; } //set line feed for the beginning of this line and //carriage return for the end lineFeed = carriageReturn; carriageReturn = lineStart + lineLen != args->unicode_array + args->unicode_array_len && *( lineStart + lineLen ) == (PLUNICODE) ( '\n' ); if ( lineFeed ) paraHeight += textHeight + subscriptDepth; //remember the text parameters so they can be restored double startingFontScale = fontScale; double startingYOffset = yOffset; PLUNICODE startingFci = fci; // determine extent of text posX = args->x / scalex; posY = args->y / scaley; PSDrawText( lineStart, lineLen, false ); if ( lineFeed && superscriptHeight > textHeight ) paraHeight += superscriptHeight - textHeight; // actually draw text, resetting the font first fontScale = startingFontScale; yOffset = startingYOffset; fci = startingFci; PSSetFont( fci ); posX = (PLINT) ( args->x / scalex - ( args->just * textWidth ) * cos_rot - ( 0.5 * textHeight - paraHeight * lineSpacing ) * sin_rot ); //move to set alignment posY = (PLINT) ( args->y / scaley - ( args->just * textWidth ) * sin_rot + ( 0.5 * textHeight - paraHeight * lineSpacing ) * cos_rot ); PSDrawText( lineStart, lineLen, true ); //draw text lineStart += lineLen; if ( carriageReturn ) lineStart++; lineLen = 0; } //posX = args->x; //posY = args->y; //PSDrawText( args->unicode_array, args->unicode_array_len, false ); //posX = (PLINT) ( args->x - ( ( args->just * textWidth ) * cos_rot + ( 0.5 * textHeight ) * sin_rot ) * scalex ); //posY = (PLINT) ( args->y - ( ( args->just * textWidth ) * sin_rot - ( 0.5 * textHeight ) * cos_rot ) * scaley ); //PSDrawText( args->unicode_array, args->unicode_array_len, true ); AddtoClipRegion( 0, 0, width, height ); } plplot-5.10.0+dfsg/drivers/wingcc.driver_info.in 644 1750 1750 4511466747272 204740ustar andrewandrewwingcc:Win32 (GCC):1:wingcc:9:wingcc plplot-5.10.0+dfsg/drivers/null.c 644 1750 1750 541111652522446 155340ustar andrewandrew// $Id: null.c 12008 2011-10-28 12:50:46Z andrewross $ // // PLplot Null device driver. // #include "plDevs.h" #ifdef PLD_null #include "plplotP.h" #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_null = "null:Null device:-1:null:42:null\n"; void plD_dispatch_init_null( PLDispatchTable *pdt ); void plD_init_null( PLStream * ); void plD_line_null( PLStream *, short, short, short, short ); void plD_polyline_null( PLStream *, short *, short *, PLINT ); void plD_eop_null( PLStream * ); void plD_bop_null( PLStream * ); void plD_tidy_null( PLStream * ); void plD_state_null( PLStream *, PLINT ); void plD_esc_null( PLStream *, PLINT, void * ); void plD_dispatch_init_null( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Null device"; pdt->pl_DevName = "null"; #endif pdt->pl_type = plDevType_Null; pdt->pl_seq = 42; pdt->pl_init = (plD_init_fp) plD_init_null; pdt->pl_line = (plD_line_fp) plD_line_null; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_null; pdt->pl_eop = (plD_eop_fp) plD_eop_null; pdt->pl_bop = (plD_bop_fp) plD_bop_null; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_null; pdt->pl_state = (plD_state_fp) plD_state_null; pdt->pl_esc = (plD_esc_fp) plD_esc_null; } //-------------------------------------------------------------------------- // plD_init_null() // // Initialize device (terminal). //-------------------------------------------------------------------------- void plD_init_null( PLStream *PL_UNUSED( pls ) ) { int xmin = 0; int xmax = PIXELS_X - 1; int ymin = 0; int ymax = PIXELS_Y - 1; PLFLT pxlx = (double) PIXELS_X / (double) LPAGE_X; PLFLT pxly = (double) PIXELS_Y / (double) LPAGE_Y; // Set up device parameters plP_setpxl( pxlx, pxly ); plP_setphy( xmin, xmax, ymin, ymax ); } //-------------------------------------------------------------------------- // The remaining driver functions are all null. //-------------------------------------------------------------------------- void plD_line_null( PLStream * PL_UNUSED( pls ), short PL_UNUSED( x1a ), short PL_UNUSED( y1a ), short PL_UNUSED( x2a ), short PL_UNUSED( y2a ) ) { } void plD_polyline_null( PLStream *PL_UNUSED( pls ), short *PL_UNUSED( xa ), short *PL_UNUSED( ya ), PLINT PL_UNUSED( npts ) ) { } void plD_eop_null( PLStream *PL_UNUSED( pls ) ) { } void plD_bop_null( PLStream *PL_UNUSED( pls ) ) { } void plD_tidy_null( PLStream *PL_UNUSED( pls ) ) { } void plD_state_null( PLStream *PL_UNUSED( pls ), PLINT PL_UNUSED( op ) ) { } void plD_esc_null( PLStream *PL_UNUSED( pls ), PLINT PL_UNUSED( op ), void *PL_UNUSED( ptr ) ) { } #else int pldummy_null() { return 0; } #endif // PLD_nulldev plplot-5.10.0+dfsg/drivers/test-drv-info.c 644 1750 1750 462312276771565 173020ustar andrewandrew// Get device info from PLplot driver module // // Copyright (C) 2003 Rafael Laboissiere // Copyright (C) 2004 Joao Cardoso // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify it under // the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your // option) any later version. // // PLplot is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library // General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with the GNU C Library; see the file COPYING.LIB. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301, USA. // #include "plplotP.h" #ifndef LTDL_WIN32 #include #else #include "ltdl_win32.h" #endif #include #include #include #define SYM_LEN 300 #define DRVSPEC_LEN 400 // function prototype RETSIGTYPE catch_segv( int sig ); // SEGV signal handler RETSIGTYPE catch_segv( int PL_UNUSED( sig ) ) { fprintf( stderr, "libltdl error: %s\n", lt_dlerror() ); exit( 1 ); } int main( int PL_UNUSED( argc ), char* argv[] ) { lt_dlhandle dlhand; char sym[SYM_LEN]; char * drvnam = argv[1]; char drvspec[ DRVSPEC_LEN ]; char ** info; // Establish a handler for SIGSEGV signals. signal( SIGSEGV, catch_segv ); lt_dlinit(); #if defined ( LTDL_WIN32 ) || defined ( __CYGWIN__ ) snprintf( drvspec, DRVSPEC_LEN, "%s", drvnam ); #else snprintf( drvspec, DRVSPEC_LEN, "%s/%s", plGetDrvDir(), drvnam ); #endif // LTDL_WIN32 dlhand = lt_dlopenext( drvspec ); if ( dlhand == NULL ) { fprintf( stderr, "Could not open driver module %s\n" "libltdl error: %s\n", drvspec, lt_dlerror() ); exit( 1 ); } snprintf( sym, SYM_LEN, "plD_DEVICE_INFO_%s", drvnam ); info = (char **) lt_dlsym( dlhand, sym ); if ( info != NULL ) { printf( "%s", *info ); exit( 0 ); } else { fprintf( stderr, "Could not read symbol %s in driver module %s\n" "libltdl error: %s\n", sym, drvspec, lt_dlerror() ); exit( 1 ); } } plplot-5.10.0+dfsg/drivers/ljiip.c 644 1750 1750 3304411462322041 157000ustar andrewandrew// $Id: ljiip.c 11282 2010-10-28 16:26:09Z airwin $ // // PLplot Laser Jet IIp device driver. // Based on old LJII driver, modifications by Wesley Ebisuzaki // // DPI = 300, 150, 100 (dots per inch) // default: Unix 300 dpi, MS-DOS 150 dpi // higher = better output, more memory, longer to print // GCMODE = 0, 2 (graphics compression mode) // default: 2, old laser jets should use 0 // compression can speed up the printing up to 3x // // #include "plDevs.h" #ifdef PLD_ljiip #include "plplotP.h" #include "drivers.h" #include #include #ifdef __GO32__ // dos386/djgpp #ifdef MSDOS #undef MSDOS #endif #endif // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_ljiip = "ljiip:LaserJet IIp/deskjet compressed graphics:0:ljiip:32:ljiip\n"; // Function prototypes void plD_dispatch_init_ljiip( PLDispatchTable *pdt ); void plD_init_ljiip( PLStream * ); void plD_line_ljiip( PLStream *, short, short, short, short ); void plD_polyline_ljiip( PLStream *, short *, short *, PLINT ); void plD_eop_ljiip( PLStream * ); void plD_bop_ljiip( PLStream * ); void plD_tidy_ljiip( PLStream * ); void plD_state_ljiip( PLStream *, PLINT ); void plD_esc_ljiip( PLStream *, PLINT, void * ); static void setpoint( PLINT, PLINT ); // top level declarations // GCMODE = graphics compression mode, 0=old laser jets, 2=ljiip or later #define GCMODE 2 // DPI = dots per inch, more dots=better plot, more memory, more time // possible DPI = 75, 100, 150, 300 // if DPI=300 then your machine must have a free 1Mb block of memory #define DPI 300 #ifdef MSDOS #undef DPI #define DPI 150 #endif #define OF pls->OutFile #define CURX ( (long) ( DPI / 5 ) ) #define CURY ( (long) ( DPI / 7 ) ) #define XDOTS ( 376 * ( DPI / 50 ) ) // # dots across #define YDOTS ( 500 * ( DPI / 50 ) ) // # dots down #define JETX ( XDOTS - 1 ) #define JETY ( YDOTS - 1 ) #define BPROW ( XDOTS / 8L ) // # bytes across #define MAX_WID 8 // max pen width in pixels #define BPROW1 ( BPROW + ( MAX_WID + 7 ) / 8 ) // pen has width, make bitmap bigger #define NBYTES BPROW1 * ( YDOTS + MAX_WID ) // total number of bytes // Graphics control characters. #define ESC 0x1b #define FF 0x0c static char mask[8] = { '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' }; #ifndef MSDOS #define _HUGE #else #define _HUGE _huge #endif static unsigned char _HUGE *bitmap; // memory area NBYTES in size void plD_dispatch_init_ljiip( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "LaserJet IIp/deskjet compressed graphics"; pdt->pl_DevName = "ljiip"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 32; pdt->pl_init = (plD_init_fp) plD_init_ljiip; pdt->pl_line = (plD_line_fp) plD_line_ljiip; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_ljiip; pdt->pl_eop = (plD_eop_fp) plD_eop_ljiip; pdt->pl_bop = (plD_bop_fp) plD_bop_ljiip; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_ljiip; pdt->pl_state = (plD_state_fp) plD_state_ljiip; pdt->pl_esc = (plD_esc_fp) plD_esc_ljiip; } //-------------------------------------------------------------------------- // plD_init_ljiip() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_ljiip( PLStream *pls ) { PLDev *dev; if ( pls->width == 0 ) // Is 0 if uninitialized pls->width = DPI / 100; // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data dev = plAllocDev( pls ); dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->xmin = 0; dev->ymin = 0; // number of pixels / mm plP_setpxl( (PLFLT) ( DPI / 25.4 ), (PLFLT) ( DPI / 25.4 ) ); // Rotate by 90 degrees since portrait mode addressing is used dev->xmin = 0; dev->ymin = 0; dev->xmax = JETY; dev->ymax = JETX; dev->xlen = dev->xmax - dev->xmin; dev->ylen = dev->ymax - dev->ymin; plP_setphy( dev->xmin, dev->xmax, dev->ymin, dev->ymax ); // If portrait mode is specified, then set up an additional rotation // transformation with aspect ratio allowed to adjust via freeaspect. // Default orientation is landscape (ORIENTATION == 3 or 90 deg rotation // counter-clockwise from portrait). (Legacy PLplot used seascape // which was equivalent to ORIENTATION == 1 or 90 deg clockwise rotation // from portrait.) if ( pls->portrait ) { plsdiori( (PLFLT) ( 4 - ORIENTATION ) ); pls->freeaspect = 1; } // Allocate storage for bit map matrix #ifdef MSDOS if ( ( bitmap = (unsigned char _HUGE *) halloc( (long) NBYTES, sizeof ( char ) ) ) == NULL ) plexit( "Out of memory in call to calloc" ); #else if ( ( bitmap = (unsigned char *) calloc( NBYTES, sizeof ( char ) ) ) == NULL ) plexit( "Out of memory in call to calloc" ); #endif // Reset Printer fprintf( OF, "%cE", ESC ); } //-------------------------------------------------------------------------- // plD_line_ljiip() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_ljiip( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { PLDev *dev = (PLDev *) pls->dev; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; int abs_dx, abs_dy, dx, dy, incx, incy; int i, j, width, residual; PLFLT tmp; width = MIN( pls->width, MAX_WID ); // Take mirror image, since PCL expects (0,0) to be at top left y1 = dev->ymax - ( y1 - dev->ymin ); y2 = dev->ymax - ( y2 - dev->ymin ); // Rotate by 90 degrees plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x1, &y1 ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x2, &y2 ); dx = x2 - x1; dy = y2 - y1; if ( dx < 0 ) { abs_dx = -dx; incx = -1; } else { abs_dx = dx; incx = 1; } if ( dy < 0 ) { abs_dy = -dy; incy = -1; } else { abs_dy = dy; incy = 1; } // make pixel width narrower for diag lines if ( abs_dy <= abs_dx ) { if ( abs_dx == 0 ) tmp = 1.0; else tmp = 1.0 - (PLFLT) abs_dy / abs_dx; } else { tmp = 1.0 - (PLFLT) abs_dx / abs_dy; } width = floor( 0.5 + width * ( tmp * tmp * tmp * ( 1.0 - 0.707107 ) + 0.707107 ) ); if ( width < 1 ) width = 1; if ( width > 1 ) { for ( i = 0; i < width; i++ ) { for ( j = 0; j < width; j++ ) { setpoint( (PLINT) ( x1 + i ), (PLINT) ( y1 + j ) ); setpoint( (PLINT) ( x2 + i ), (PLINT) ( y2 + j ) ); } } } if ( abs_dx >= abs_dy ) { residual = -( abs_dx >> 1 ); if ( width == 1 ) { for ( i = 0; i <= abs_dx; i++, x1 += incx ) { setpoint( (PLINT) ( x1 ), (PLINT) ( y1 ) ); if ( ( residual += abs_dy ) >= 0 ) { residual -= abs_dx; y1 += incy; } } } else { for ( i = 0; i <= abs_dx; i++, x1 += incx ) { for ( j = 0; j < width; j++ ) { setpoint( (PLINT) ( x1 ), (PLINT) ( y1 + j ) ); setpoint( (PLINT) ( x1 + width - 1 ), (PLINT) ( y1 + j ) ); } if ( ( residual += abs_dy ) >= 0 ) { residual -= abs_dx; y1 += incy; } } } } else { residual = -( abs_dy >> 1 ); if ( width == 1 ) { for ( i = 0; i <= abs_dy; i++, y1 += incy ) { setpoint( (PLINT) ( x1 ), (PLINT) ( y1 ) ); if ( ( residual += abs_dx ) >= 0 ) { residual -= abs_dy; x1 += incx; } } } else { for ( i = 0; i <= abs_dy; i++, y1 += incy ) { for ( j = 0; j < width; j++ ) { setpoint( (PLINT) ( x1 + j ), (PLINT) ( y1 ) ); setpoint( (PLINT) ( x1 + j ), (PLINT) ( y1 + width - 1 ) ); } if ( ( residual += abs_dx ) >= 0 ) { residual -= abs_dy; x1 += incx; } } } } } //-------------------------------------------------------------------------- // plD_polyline_ljiip() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_ljiip( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_ljiip( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // plD_eop_ljiip() // // End of page.(prints it here). //-------------------------------------------------------------------------- void plD_eop_ljiip( PLStream *pls ) { PLINT j; unsigned char _HUGE *p; #if GCMODE > 0 int i, iy, last, n, jmax; unsigned char _HUGE t_buf[BPROW * 2]; unsigned char c; #endif // PCL III setup: ref. Deskjet Plus Printer Owner's Manual fprintf( OF, "\033*rB" ); // end raster graphics fprintf( OF, "\033*t%3dR", DPI ); // set DPI #if GCMODE != 0 fprintf( OF, "\033*r%dS", XDOTS ); // raster width fprintf( OF, "\033*b%1dM", GCMODE ); // graphics mode #endif // First move cursor to origin fprintf( OF, "\033*p%ldX", CURX ); fprintf( OF, "\033*p%ldY", CURY ); fprintf( OF, "\033*r0A" ); // start graphics // Write out raster data #if GCMODE == 0 for ( j = 0, p = bitmap; j < YDOTS; j++, p += BPROW1 ) { fprintf( OF, "\033*b>%dW", BPROW ); fwrite( p, BPROW, sizeof ( char ), OF ); } #endif #if GCMODE == 2 for ( iy = 0, p = bitmap; iy < YDOTS; iy++, p += BPROW1 ) { // find last non-zero byte last = BPROW - 1; while ( last > 0 && p[last] == 0 ) last--; last++; // translate to mode 2, save results in t_buf[] i = n = 0; while ( i < last ) { c = p[i]; jmax = i + 127; jmax = last < jmax ? last : jmax; if ( i < last - 2 && ( c == p[i + 1] ) && ( c == p[i + 2] ) ) { j = i + 3; while ( j < jmax && c == p[j] ) j++; t_buf[n++] = ( i - j + 1 ) & 0xff; t_buf[n++] = c; i = j; } else { for ( j = i + 1; j < jmax; j++ ) { if ( j < last - 2 && ( p[j] == p[j + 1] ) && ( p[j + 1] == p[j + 2] ) ) break; } t_buf[n++] = j - i - 1; while ( i < j ) { t_buf[n++] = p[i++]; } } } fprintf( OF, "\033*b%dW", (int) n ); fwrite( t_buf, (int) n, sizeof ( char ), OF ); } #endif pls->bytecnt += NBYTES; // End raster graphics and send Form Feed fprintf( OF, "\033*rB" ); fprintf( OF, "%c", FF ); // Finally, clear out bitmap storage area memset( (void *) bitmap, '\0', NBYTES ); } //-------------------------------------------------------------------------- // plD_bop_ljiip() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_ljiip( PLStream *pls ) { if ( !pls->termin ) plGetFam( pls ); pls->page++; } //-------------------------------------------------------------------------- // plD_tidy_ljiip() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_ljiip( PLStream *pls ) { // Reset Printer fprintf( OF, "%cE", ESC ); plCloseFile( pls ); free( (char *) bitmap ); } //-------------------------------------------------------------------------- // plD_state_ljiip() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_ljiip( PLStream *pls, PLINT op ) { } //-------------------------------------------------------------------------- // plD_esc_ljiip() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_ljiip( PLStream *pls, PLINT op, void *ptr ) { } //-------------------------------------------------------------------------- // setpoint() // // Sets a bit in the bitmap. //-------------------------------------------------------------------------- static void setpoint( PLINT x, PLINT y ) { PLINT index; index = x / 8 + y * BPROW1; *( bitmap + index ) = *( bitmap + index ) | mask[x % 8]; } #else int pldummy_ljiip() { return 0; } #endif // PLD_ljii plplot-5.10.0+dfsg/drivers/qt.cpp 644 1750 1750 15571612102152123 156020ustar andrewandrew// // // This software is provided under the LGPL in March 2009 by the // Cluster Science Centre // QSAS team, // Imperial College, London // // Copyright (C) 2009 Imperial College, London // Copyright (C) 2009 Alan W. Irwin // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Lesser Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // To received a copy of the GNU Library General Public License // write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // History: // // // March 2009: v1.00 // Initial release. // // #include "qt.h" #include // global variables initialised in init(), used in tidy() // QApplication* app=NULL; static int argc; // argc and argv have to exist when tidy() is used, thus they are made global static char **argv; static int appCounter = 0; // to be rigorous, all uses should be placed between mutexes // Drivers declaration extern "C" { PLDLLIMPEXP_DRIVER_DATA( const char* ) plD_DEVICE_INFO_qt = #if defined ( PLD_bmpqt ) "bmpqt:Qt Windows bitmap driver:0:qt:66:bmpqt\n" #endif #if defined ( PLD_jpgqt ) "jpgqt:Qt jpg driver:0:qt:67:jpgqt\n" #endif #if defined ( PLD_pngqt ) "pngqt:Qt png driver:0:qt:68:pngqt\n" #endif #if defined ( PLD_ppmqt ) "ppmqt:Qt ppm driver:0:qt:69:ppmqt\n" #endif #if defined ( PLD_tiffqt ) "tiffqt:Qt tiff driver:0:qt:70:tiffqt\n" #endif #if defined ( PLD_svgqt ) && QT_VERSION >= 0x040300 "svgqt:Qt SVG driver:0:qt:71:svgqt\n" #endif #if defined ( PLD_qtwidget ) "qtwidget:Qt Widget:1:qt:72:qtwidget\n" #endif #if defined ( PLD_epsqt ) "epsqt:Qt EPS driver:0:qt:73:epsqt\n" #endif #if defined ( PLD_pdfqt ) "pdfqt:Qt PDF driver:0:qt:74:pdfqt\n" #endif #if defined ( PLD_extqt ) "extqt:External Qt driver:0:qt:75:extqt\n" #endif #if defined ( PLD_memqt ) "memqt:Memory Qt driver:0:qt:76:memqt\n" #endif ; } // extern "C" static DrvOpt qt_options[] = { { "text_vectorize", DRV_INT, &vectorize, "Vectorize fonts on output (0|1)" }, { "lines_antialiasing", DRV_INT, &lines_aa, "Toggles antialiasing on lines (0|1)" }, { NULL, DRV_INT, NULL, NULL } }; bool initQtApp( bool isGUI ) { QMutexLocker locker( &QtPLDriver::mutex ); bool res = false; ++appCounter; if ( qApp == NULL && appCounter == 1 ) { argc = 1; argv = new char*[2]; argv[0] = new char[10]; argv[1] = new char[1]; snprintf( argv[0], 10, "qt_driver" ); argv[1][0] = '\0'; #ifdef Q_WS_X11 // On X11 if DISPLAY is not set then cannot open GUI. This allows non-interactive devices to still work in this case. if ( getenv( "DISPLAY" ) == NULL ) isGUI = false; #endif new QApplication( argc, argv, isGUI ); res = true; } return res; } void closeQtApp() { QMutexLocker locker( &QtPLDriver::mutex ); --appCounter; if ( qApp != NULL && appCounter == 0 ) { delete qApp; delete[] argv[0]; delete[] argv[1]; delete[] argv; argv = NULL; } } //-------------------------------------------------------------------------- // qt_family_check () // // support function to help supress more than one page if family file // output not specified by the user (e.g., with the -fam command-line option). // Adapted directly from svg.c //-------------------------------------------------------------------------- static int already_warned = 0; static int qt_family_check( PLStream *pls ) { if ( pls->family || pls->page == 1 ) { return 0; } else { if ( !already_warned ) { already_warned = 1; plwarn( "All pages after the first skipped because family file output not specified.\n" ); } return 1; } } // Declaration of the driver-specific interface functions #if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt ) void plD_init_rasterqt( PLStream * ); void plD_eop_rasterqt( PLStream * ); void plD_line_rasterqt( PLStream *, short, short, short, short ); void plD_polyline_rasterqt( PLStream *, short*, short*, PLINT ); void plD_tidy_rasterqt( PLStream * ); void plD_state_rasterqt( PLStream *, PLINT ); void plD_esc_rasterqt( PLStream *, PLINT, void* ); #endif #if defined ( PLD_bmpqt ) void plD_dispatch_init_bmpqt( PLDispatchTable *pdt ); void plD_bop_bmpqt( PLStream * ); #endif #if defined ( PLD_jpgqt ) void plD_dispatch_init_jpgqt( PLDispatchTable *pdt ); void plD_bop_jpgqt( PLStream * ); #endif #if defined ( PLD_pngqt ) void plD_dispatch_init_pngqt( PLDispatchTable *pdt ); void plD_bop_pngqt( PLStream * ); #endif #if defined ( PLD_ppmqt ) void plD_dispatch_init_ppmqt( PLDispatchTable *pdt ); void plD_bop_ppmqt( PLStream * ); #endif #if defined ( PLD_tiffqt ) void plD_dispatch_init_tiffqt( PLDispatchTable *pdt ); void plD_bop_tiffqt( PLStream * ); #endif #if defined ( PLD_svgqt ) && QT_VERSION >= 0x040300 void plD_dispatch_init_svgqt( PLDispatchTable *pdt ); void plD_init_svgqt( PLStream * ); void plD_bop_svgqt( PLStream * ); void plD_eop_svgqt( PLStream * ); void plD_line_svgqt( PLStream *, short, short, short, short ); void plD_polyline_svgqt( PLStream *, short*, short*, PLINT ); void plD_tidy_svgqt( PLStream * ); void plD_state_svgqt( PLStream *, PLINT ); void plD_esc_svgqt( PLStream *, PLINT, void* ); #endif #if defined ( PLD_epsqt ) || defined ( PLD_pdfqt ) void plD_init_epspdfqt( PLStream * ); void plD_bop_epspdfqt_helper( PLStream *, int ifeps ); void plD_eop_epspdfqt( PLStream * ); void plD_line_epspdfqt( PLStream *, short, short, short, short ); void plD_polyline_epspdfqt( PLStream *, short*, short*, PLINT ); void plD_tidy_epspdfqt( PLStream * ); void plD_state_epspdfqt( PLStream *, PLINT ); void plD_esc_epspdfqt( PLStream *, PLINT, void* ); #endif #if defined ( PLD_epsqt ) void plD_dispatch_init_epsqt( PLDispatchTable *pdt ); void plD_bop_epsqt( PLStream * ); #endif #if defined ( PLD_pdfqt ) void plD_dispatch_init_pdfqt( PLDispatchTable *pdt ); void plD_bop_pdfqt( PLStream * ); #endif #if defined ( PLD_qtwidget ) void plD_dispatch_init_qtwidget( PLDispatchTable *pdt ); void plD_init_qtwidget( PLStream * ); void plD_eop_qtwidget( PLStream * ); void plD_line_qtwidget( PLStream *, short, short, short, short ); void plD_polyline_qtwidget( PLStream *, short*, short*, PLINT ); void plD_tidy_qtwidget( PLStream * ); void plD_state_qtwidget( PLStream *, PLINT ); void plD_esc_qtwidget( PLStream *, PLINT, void* ); void plD_bop_qtwidget( PLStream * ); #endif #if defined ( PLD_extqt ) void plD_dispatch_init_extqt( PLDispatchTable *pdt ); void plD_init_extqt( PLStream * ); void plD_eop_extqt( PLStream * ); void plD_line_extqt( PLStream *, short, short, short, short ); void plD_polyline_extqt( PLStream *, short*, short*, PLINT ); void plD_tidy_extqt( PLStream * ); void plD_state_extqt( PLStream *, PLINT ); void plD_esc_extqt( PLStream *, PLINT, void* ); void plD_bop_extqt( PLStream * ); #endif #if defined ( PLD_memqt ) void plD_dispatch_init_memqt( PLDispatchTable *pdt ); void plD_init_memqt( PLStream * ); void plD_bop_memqt( PLStream * ); void plD_eop_memqt( PLStream * ); #endif ////////////////// Raster driver-specific definitions: class and interface functions ///////// #if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt ) void plD_init_rasterqt( PLStream * pls ) { double dpi; vectorize = 0; lines_aa = 1; plParseDrvOpts( qt_options ); // Stream setup pls->color = 1; pls->plbuf_write = 0; pls->dev_fill0 = 1; pls->dev_fill1 = 0; pls->dev_gradient = 1; // driver renders gradient // Let the PLplot core handle dashed lines since // the driver results for this capability have a number of issues. // pls->dev_dash=1; pls->dev_dash = 0; pls->dev_flush = 1; // Driver does not have a clear capability so use (good) PLplot core // fallback for that instead. pls->dev_clear = 0; pls->termin = 0; pls->page = 0; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode pls->has_string_length = 1; // Driver supports string length calculations // Needs to be true only because of multi-stream case bool isMaster = initQtApp( true ); if ( pls->xdpi <= 0. ) dpi = DEFAULT_DPI; else dpi = pls->xdpi; // Shamelessly copied on the Cairo stuff :) if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->dev = new QtRasterDevice; pls->xlength = (PLINT) ( ( (QtRasterDevice *) ( pls->dev ) )->m_dWidth ); pls->ylength = (PLINT) ( ( (QtRasterDevice *) ( pls->dev ) )->m_dHeight ); } else { pls->dev = new QtRasterDevice( pls->xlength, pls->ylength ); } ( (QtRasterDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtRasterDevice *) ( pls->dev ) ); if ( pls->xlength > pls->ylength ) ( (QtRasterDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->xlength / (PLFLT) ( PIXELS_X - 1 ); else ( (QtRasterDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->ylength / (PLFLT) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / ( (QtRasterDevice *) ( pls->dev ) )->downscale ), (PLINT) 0, (PLINT) ( pls->ylength / ( (QtRasterDevice *) ( pls->dev ) )->downscale ) ); plP_setpxl( dpi / 25.4 / ( (QtRasterDevice *) ( pls->dev ) )->downscale, dpi / 25.4 / ( (QtRasterDevice *) ( pls->dev ) )->downscale ); ( (QtRasterDevice *) ( pls->dev ) )->setResolution( dpi ); // Initialize family file info plFamInit( pls ); plOpenFile( pls ); } void plD_eop_rasterqt( PLStream *pls ) { if ( qt_family_check( pls ) ) { return; } ( (QtRasterDevice *) pls->dev )->savePlot(); handler.DeviceChangedPage( (QtRasterDevice *) pls->dev ); } void plD_line_rasterqt( PLStream * pls, short x1a, short y1a, short x2a, short y2a ) { QtRasterDevice* widget = (QtRasterDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; widget->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawLine( x1a, y1a, x2a, y2a ); } void plD_polyline_rasterqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { QtRasterDevice * widget = (QtRasterDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; widget->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolyline( xa, ya, npts ); } void plD_esc_rasterqt( PLStream * pls, PLINT op, void* ptr ) { short *xa, *ya; unsigned char *r, *g, *b; PLFLT *alpha; PLINT i; QtRasterDevice * widget = (QtRasterDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; switch ( op ) { // case PLESC_DASH: // widget->setDashed(pls->nms, pls->mark, pls->space); // widget->QtPLDriver::setColor(pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a); // widget->drawPolyline(pls->dev_x, pls->dev_y, pls->dev_npts); // widget->setSolid(); // break; case PLESC_FILL: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; break; case PLESC_GRADIENT: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; r = new unsigned char[pls->ncol1]; g = new unsigned char[pls->ncol1]; b = new unsigned char[pls->ncol1]; alpha = new PLFLT[pls->ncol1]; for ( i = 0; i < pls->ncol1; i++ ) { r[i] = pls->cmap1[i].r; g[i] = pls->cmap1[i].g; b[i] = pls->cmap1[i].b; alpha[i] = pls->cmap1[i].a; } widget->setGradient( pls->xgradient[0], pls->xgradient[1], pls->ygradient[0], pls->ygradient[1], r, g, b, alpha, pls->ncol1 ); for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; delete[] r; delete[] g; delete[] b; delete[] alpha; break; case PLESC_HAS_TEXT: // call the generic ProcessString function // ProcessString( pls, (EscText *)ptr ); widget->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawText( (EscText *) ptr ); break; default: break; } } void plD_state_rasterqt( PLStream * pls, PLINT op ) { QtRasterDevice * widget = (QtRasterDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; switch ( op ) { case PLSTATE_WIDTH: widget->setWidthF( pls->width ); break; case PLSTATE_COLOR0: ( (QtPLDriver *) widget )->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; case PLSTATE_COLOR1: ( (QtPLDriver *) widget )->QtPLDriver::setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; default: break; } } void plD_tidy_rasterqt( PLStream * pls ) { QtRasterDevice * widget = (QtRasterDevice *) pls->dev; if ( widget != NULL ) { handler.DeviceClosed( widget ); delete widget; pls->dev = NULL; } plCloseFile( pls ); closeQtApp(); } #endif #if defined ( PLD_bmpqt ) void plD_dispatch_init_bmpqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt Windows bitmap Driver"; pdt->pl_DevName = "bmpqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 66; pdt->pl_init = (plD_init_fp) plD_init_rasterqt; pdt->pl_line = (plD_line_fp) plD_line_rasterqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; pdt->pl_eop = (plD_eop_fp) plD_eop_rasterqt; pdt->pl_bop = (plD_bop_fp) plD_bop_bmpqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; pdt->pl_state = (plD_state_fp) plD_state_rasterqt; pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; } void plD_bop_bmpqt( PLStream *pls ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtRasterDevice *) pls->dev )->definePlotName( pls->FileName, "BMP" ); ( (QtRasterDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif #if defined ( PLD_jpgqt ) void plD_dispatch_init_jpgqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt jpg Driver"; pdt->pl_DevName = "jpgqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 67; pdt->pl_init = (plD_init_fp) plD_init_rasterqt; pdt->pl_line = (plD_line_fp) plD_line_rasterqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; pdt->pl_eop = (plD_eop_fp) plD_eop_rasterqt; pdt->pl_bop = (plD_bop_fp) plD_bop_jpgqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; pdt->pl_state = (plD_state_fp) plD_state_rasterqt; pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; } void plD_bop_jpgqt( PLStream *pls ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtRasterDevice *) pls->dev )->definePlotName( pls->FileName, "JPG" ); ( (QtRasterDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif #if defined ( PLD_pngqt ) void plD_dispatch_init_pngqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt png Driver"; pdt->pl_DevName = "pngqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 68; pdt->pl_init = (plD_init_fp) plD_init_rasterqt; pdt->pl_line = (plD_line_fp) plD_line_rasterqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; pdt->pl_eop = (plD_eop_fp) plD_eop_rasterqt; pdt->pl_bop = (plD_bop_fp) plD_bop_pngqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; pdt->pl_state = (plD_state_fp) plD_state_rasterqt; pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; } void plD_bop_pngqt( PLStream *pls ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtRasterDevice *) pls->dev )->definePlotName( pls->FileName, "PNG" ); ( (QtRasterDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif #if defined ( PLD_ppmqt ) void plD_dispatch_init_ppmqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt ppm Driver"; pdt->pl_DevName = "ppmqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 69; pdt->pl_init = (plD_init_fp) plD_init_rasterqt; pdt->pl_line = (plD_line_fp) plD_line_rasterqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; pdt->pl_eop = (plD_eop_fp) plD_eop_rasterqt; pdt->pl_bop = (plD_bop_fp) plD_bop_ppmqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; pdt->pl_state = (plD_state_fp) plD_state_rasterqt; pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; } void plD_bop_ppmqt( PLStream *pls ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtRasterDevice *) pls->dev )->definePlotName( pls->FileName, "PPM" ); ( (QtRasterDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif #if defined ( PLD_tiffqt ) void plD_dispatch_init_tiffqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt tiff Driver"; pdt->pl_DevName = "tiffqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 70; pdt->pl_init = (plD_init_fp) plD_init_rasterqt; pdt->pl_line = (plD_line_fp) plD_line_rasterqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; pdt->pl_eop = (plD_eop_fp) plD_eop_rasterqt; pdt->pl_bop = (plD_bop_fp) plD_bop_tiffqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; pdt->pl_state = (plD_state_fp) plD_state_rasterqt; pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; } void plD_bop_tiffqt( PLStream *pls ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtRasterDevice *) pls->dev )->definePlotName( pls->FileName, "TIFF" ); ( (QtRasterDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif #if defined ( PLD_svgqt ) && QT_VERSION >= 0x040300 void plD_dispatch_init_svgqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt SVG Driver"; pdt->pl_DevName = "svgqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 71; pdt->pl_init = (plD_init_fp) plD_init_svgqt; pdt->pl_line = (plD_line_fp) plD_line_svgqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_svgqt; pdt->pl_eop = (plD_eop_fp) plD_eop_svgqt; pdt->pl_bop = (plD_bop_fp) plD_bop_svgqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_svgqt; pdt->pl_state = (plD_state_fp) plD_state_svgqt; pdt->pl_esc = (plD_esc_fp) plD_esc_svgqt; } void plD_init_svgqt( PLStream * pls ) { vectorize = 1; lines_aa = 1; plParseDrvOpts( qt_options ); // Stream setup pls->color = 1; pls->plbuf_write = 0; pls->dev_fill0 = 1; pls->dev_fill1 = 0; pls->dev_gradient = 1; // driver renders gradient // Let the PLplot core handle dashed lines since // the driver results for this capability have a number of issues. // pls->dev_dash=1; pls->dev_dash = 0; pls->dev_flush = 1; // Driver does not have a clear capability so use (good) PLplot core // fallback for that instead. pls->dev_clear = 0; pls->termin = 0; pls->page = 0; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode pls->has_string_length = 1; // Driver supports string length calculations // Needs to be true only because of multi-stream case bool isMaster = initQtApp( true ); if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->dev = new QtSVGDevice; pls->xlength = (int) ( ( (QtSVGDevice *) ( pls->dev ) )->m_dWidth ); pls->ylength = (int) ( ( (QtSVGDevice *) ( pls->dev ) )->m_dHeight ); } else { pls->dev = new QtSVGDevice( pls->xlength, pls->ylength ); } ( (QtSVGDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtSVGDevice *) ( pls->dev ) ); if ( pls->xlength > pls->ylength ) ( (QtSVGDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->xlength / (PLFLT) ( PIXELS_X - 1 ); else ( (QtSVGDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->ylength / (PLFLT) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / ( (QtSVGDevice *) ( pls->dev ) )->downscale ), (PLINT) 0, (PLINT) ( pls->ylength / ( (QtSVGDevice *) ( pls->dev ) )->downscale ) ); plP_setpxl( POINTS_PER_INCH / 25.4 / ( (QtSVGDevice *) ( pls->dev ) )->downscale, POINTS_PER_INCH / 25.4 / ( (QtSVGDevice *) ( pls->dev ) )->downscale ); // Initialize family file info plFamInit( pls ); plOpenFile( pls ); } void plD_bop_svgqt( PLStream *pls ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtSVGDevice *) pls->dev )->definePlotName( pls->FileName ); ( (QtSVGDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } void plD_eop_svgqt( PLStream *pls ) { double downscale; QSize s; if ( qt_family_check( pls ) ) { return; } ( (QtSVGDevice *) pls->dev )->savePlot(); // Once saved, we have to create a new device with the same properties // to be able to plot another page. downscale = ( (QtSVGDevice *) pls->dev )->downscale; s = ( (QtSVGDevice *) pls->dev )->size(); bool isMaster = ( handler.isMasterDevice( (QtSVGDevice *) pls->dev ) ); delete ( (QtSVGDevice *) pls->dev ); pls->dev = new QtSVGDevice( s.width(), s.height() ); ( (QtSVGDevice *) pls->dev )->downscale = downscale; ( (QtSVGDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtSVGDevice *) pls->dev ); handler.DeviceChangedPage( (QtSVGDevice *) pls->dev ); } void plD_line_svgqt( PLStream * pls, short x1a, short y1a, short x2a, short y2a ) { QtSVGDevice* widget = (QtSVGDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawLine( x1a, y1a, x2a, y2a ); } void plD_polyline_svgqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { QtSVGDevice * widget = (QtSVGDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolyline( xa, ya, npts ); } void plD_esc_svgqt( PLStream * pls, PLINT op, void* ptr ) { short *xa, *ya; unsigned char *r, *g, *b; PLFLT *alpha; PLINT i; QtSVGDevice * widget = (QtSVGDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; switch ( op ) { case PLESC_FILL: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; break; case PLESC_GRADIENT: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; r = new unsigned char[pls->ncol1]; g = new unsigned char[pls->ncol1]; b = new unsigned char[pls->ncol1]; alpha = new PLFLT[pls->ncol1]; for ( i = 0; i < pls->ncol1; i++ ) { r[i] = pls->cmap1[i].r; g[i] = pls->cmap1[i].g; b[i] = pls->cmap1[i].b; alpha[i] = pls->cmap1[i].a; } widget->setGradient( pls->xgradient[0], pls->xgradient[1], pls->ygradient[0], pls->ygradient[1], r, g, b, alpha, pls->ncol1 ); for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; delete[] r; delete[] g; delete[] b; delete[] alpha; break; case PLESC_HAS_TEXT: // call the generic ProcessString function // ProcessString( pls, (EscText *)ptr ); widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawText( (EscText *) ptr ); break; default: break; } } void plD_state_svgqt( PLStream * pls, PLINT op ) { QtSVGDevice * widget = (QtSVGDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; switch ( op ) { case PLSTATE_WIDTH: widget->setWidthF( pls->width ); break; case PLSTATE_COLOR0: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; case PLSTATE_COLOR1: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; default: break; } } void plD_tidy_svgqt( PLStream * pls ) { QtSVGDevice * widget = (QtSVGDevice *) pls->dev; if ( widget != NULL ) { handler.DeviceClosed( widget ); delete widget; pls->dev = NULL; } plCloseFile( pls ); closeQtApp(); } #endif #if defined ( PLD_epsqt ) void plD_dispatch_init_epsqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt EPS Driver"; pdt->pl_DevName = "epsqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 73; pdt->pl_init = (plD_init_fp) plD_init_epspdfqt; pdt->pl_line = (plD_line_fp) plD_line_epspdfqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_epspdfqt; pdt->pl_eop = (plD_eop_fp) plD_eop_epspdfqt; pdt->pl_bop = (plD_bop_fp) plD_bop_epsqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_epspdfqt; pdt->pl_state = (plD_state_fp) plD_state_epspdfqt; pdt->pl_esc = (plD_esc_fp) plD_esc_epspdfqt; } #endif #if defined ( PLD_pdfqt ) void plD_dispatch_init_pdfqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt PDF Driver"; pdt->pl_DevName = "pdfqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 74; pdt->pl_init = (plD_init_fp) plD_init_epspdfqt; pdt->pl_line = (plD_line_fp) plD_line_epspdfqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_epspdfqt; pdt->pl_eop = (plD_eop_fp) plD_eop_epspdfqt; pdt->pl_bop = (plD_bop_fp) plD_bop_pdfqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_epspdfqt; pdt->pl_state = (plD_state_fp) plD_state_epspdfqt; pdt->pl_esc = (plD_esc_fp) plD_esc_epspdfqt; } #endif #if defined ( PLD_epsqt ) || defined ( PLD_pdfqt ) void plD_init_epspdfqt( PLStream * pls ) { vectorize = 0; lines_aa = 1; plParseDrvOpts( qt_options ); // Stream setup pls->color = 1; pls->plbuf_write = 0; pls->dev_fill0 = 1; pls->dev_fill1 = 0; pls->dev_gradient = 1; // driver renders gradient pls->dev_arc = 1; // driver renders arcs // Let the PLplot core handle dashed lines since // the driver results for this capability have a number of issues. // pls->dev_dash=1; pls->dev_dash = 0; pls->dev_flush = 1; // Driver does not have a clear capability so use (good) PLplot core // fallback for that instead. pls->dev_clear = 0; pls->termin = 0; pls->page = 0; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode pls->has_string_length = 1; // Driver supports string length calculations // QPrinter devices won't create if there is no QApplication declared... // Needs to be true only because of multi-stream case bool isMaster = initQtApp( true ); if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->dev = new QtEPSDevice; pls->xlength = (int) ( ( (QtEPSDevice *) ( pls->dev ) )->m_dWidth ); pls->ylength = (int) ( ( (QtEPSDevice *) ( pls->dev ) )->m_dHeight ); } else { pls->dev = new QtEPSDevice( pls->xlength, pls->ylength ); } ( (QtEPSDevice *) pls->dev )->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( (QtEPSDevice *) ( pls->dev ) ); if ( pls->xlength > pls->ylength ) ( (QtEPSDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->xlength / (PLFLT) ( PIXELS_X - 1 ); else ( (QtEPSDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->ylength / (PLFLT) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / ( (QtEPSDevice *) ( pls->dev ) )->downscale ), (PLINT) 0, (PLINT) ( pls->ylength / ( (QtEPSDevice *) ( pls->dev ) )->downscale ) ); plP_setpxl( POINTS_PER_INCH / 25.4 / ( (QtEPSDevice *) ( pls->dev ) )->downscale, POINTS_PER_INCH / 25.4 / ( (QtEPSDevice *) ( pls->dev ) )->downscale ); // Initialize family file info plFamInit( pls ); plOpenFile( pls ); } void plD_bop_epspdfqt_helper( PLStream *pls, int ifeps ) { // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); pls->famadv = 1; pls->page++; if ( qt_family_check( pls ) ) { return; } ( (QtEPSDevice *) pls->dev )->definePlotName( pls->FileName, ifeps ); ( (QtEPSDevice *) pls->dev )->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } void plD_eop_epspdfqt( PLStream *pls ) { double downscale; if ( qt_family_check( pls ) ) { return; } ( (QtEPSDevice *) pls->dev )->savePlot(); // Once saved, we have to create a new device with the same properties // to be able to plot another page. downscale = ( (QtEPSDevice *) pls->dev )->downscale; bool isMaster = handler.isMasterDevice( (QtEPSDevice *) pls->dev ); delete ( (QtEPSDevice *) pls->dev ); pls->dev = new QtEPSDevice; ( (QtEPSDevice *) pls->dev )->downscale = downscale; if ( isMaster ) handler.setMasterDevice( (QtEPSDevice *) pls->dev ); handler.DeviceChangedPage( (QtEPSDevice *) pls->dev ); } void plD_line_epspdfqt( PLStream * pls, short x1a, short y1a, short x2a, short y2a ) { QtEPSDevice* widget = (QtEPSDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawLine( x1a, y1a, x2a, y2a ); } void plD_polyline_epspdfqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { QtEPSDevice * widget = (QtEPSDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolyline( xa, ya, npts ); } void plD_esc_epspdfqt( PLStream * pls, PLINT op, void* ptr ) { short *xa, *ya; unsigned char *r, *g, *b; PLFLT *alpha; PLINT i; QtEPSDevice * widget = (QtEPSDevice *) pls->dev; arc_struct *arc_info = (arc_struct *) ptr; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; switch ( op ) { case PLESC_FILL: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; break; case PLESC_GRADIENT: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; r = new unsigned char[pls->ncol1]; g = new unsigned char[pls->ncol1]; b = new unsigned char[pls->ncol1]; alpha = new PLFLT[pls->ncol1]; for ( i = 0; i < pls->ncol1; i++ ) { r[i] = pls->cmap1[i].r; g[i] = pls->cmap1[i].g; b[i] = pls->cmap1[i].b; alpha[i] = pls->cmap1[i].a; } widget->setGradient( pls->xgradient[0], pls->xgradient[1], pls->ygradient[0], pls->ygradient[1], r, g, b, alpha, pls->ncol1 ); for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; delete[] r; delete[] g; delete[] b; delete[] alpha; break; case PLESC_HAS_TEXT: // call the generic ProcessString function // ProcessString( pls, (EscText *)ptr ); widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawText( (EscText *) ptr ); break; case PLESC_ARC: widget->drawArc( arc_info->x, arc_info->y, arc_info->a, arc_info->b, arc_info->angle1, arc_info->angle2, arc_info->rotate, arc_info->fill ); break; default: break; } } void plD_state_epspdfqt( PLStream * pls, PLINT op ) { QtEPSDevice * widget = (QtEPSDevice *) pls->dev; if ( widget != NULL && qt_family_check( pls ) ) { return; } if ( widget == NULL ) return; switch ( op ) { case PLSTATE_WIDTH: widget->setWidthF( pls->width ); break; case PLSTATE_COLOR0: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; case PLSTATE_COLOR1: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; default: break; } } void plD_tidy_epspdfqt( PLStream * pls ) { QtEPSDevice * widget = (QtEPSDevice *) pls->dev; if ( widget != NULL ) { handler.DeviceClosed( widget ); delete widget; pls->dev = NULL; } plCloseFile( pls ); closeQtApp(); } #endif #if defined ( PLD_epsqt ) void plD_bop_epsqt( PLStream *pls ) { plD_bop_epspdfqt_helper( pls, 1 ); } #endif #if defined ( PLD_pdfqt ) void plD_bop_pdfqt( PLStream *pls ) { plD_bop_epspdfqt_helper( pls, 0 ); } #endif #if defined ( PLD_qtwidget ) void plD_dispatch_init_qtwidget( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt Widget"; pdt->pl_DevName = "qtwidget"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 72; pdt->pl_init = (plD_init_fp) plD_init_qtwidget; pdt->pl_line = (plD_line_fp) plD_line_qtwidget; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_qtwidget; pdt->pl_eop = (plD_eop_fp) plD_eop_qtwidget; pdt->pl_bop = (plD_bop_fp) plD_bop_qtwidget; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_qtwidget; pdt->pl_state = (plD_state_fp) plD_state_qtwidget; pdt->pl_esc = (plD_esc_fp) plD_esc_qtwidget; } void plD_init_qtwidget( PLStream * pls ) { vectorize = 0; lines_aa = 1; plParseDrvOpts( qt_options ); bool isMaster = initQtApp( true ); QtPLWidget* widget; if ( pls->xlength <= 0 || pls->ylength <= 0 ) { widget = new QtPLWidget; pls->dev = (void *) widget; pls->xlength = (int) widget->m_dWidth; pls->ylength = (int) widget->m_dHeight; } else { widget = new QtPLWidget( pls->xlength, pls->ylength ); pls->dev = (void *) widget; } widget->setPLStream( pls ); if ( isMaster ) handler.setMasterDevice( widget ); if ( plsc->xlength > plsc->ylength ) widget->downscale = (PLFLT) plsc->xlength / (PLFLT) ( PIXELS_X - 1 ); else widget->downscale = (PLFLT) plsc->ylength / (PLFLT) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( plsc->xlength / widget->downscale ), (PLINT) 0, (PLINT) ( plsc->ylength / widget->downscale ) ); QPicture temp; QPainter tempPainter( &temp ); plP_setpxl( temp.logicalDpiX() / 25.4 / widget->downscale, temp.logicalDpiY() / 25.4 / widget->downscale ); pls->color = 1; // Is a color device pls->plbuf_write = 1; // Store commands to device in core buffer pls->dev_fill0 = 1; // Handle solid fills pls->dev_fill1 = 0; pls->dev_gradient = 1; // driver renders gradient pls->dev_arc = 1; // driver renders arcs // Let the PLplot core handle dashed lines since // the driver results for this capability have a number of issues. // pls->dev_dash=1; pls->dev_dash = 0; pls->dev_flush = 1; // Driver does not have a clear capability so use (good) PLplot core // fallback for that instead. pls->dev_clear = 0; pls->termin = 1; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode pls->has_string_length = 1; // Driver supports string length calculations widget->setVisible( true ); widget->resize( plsc->xlength, plsc->ylength ); widget->move( plsc->xoffset, plsc->yoffset ); widget->setWindowTitle( pls->plwindow ); qApp->connect( &handler, SIGNAL( MasterChangedPage() ), widget, SLOT( nextPage() ) ); qApp->connect( &handler, SIGNAL( MasterClosed() ), widget, SLOT( close() ) ); } void plD_eop_qtwidget( PLStream *pls ) { QtPLWidget* widget = ( (QtPLWidget *) pls->dev ); int currentPage = widget->pageNumber; widget->flush(); widget->raise(); while ( currentPage == widget->pageNumber && handler.isMasterDevice( widget ) && !pls->nopause ) { qApp->processEvents( QEventLoop::WaitForMoreEvents ); } } void plD_bop_qtwidget( PLStream *pls ) { QtPLWidget* widget = ( (QtPLWidget *) pls->dev ); widget->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } void plD_line_qtwidget( PLStream * pls, short x1a, short y1a, short x2a, short y2a ) { QtPLWidget* widget = (QtPLWidget *) pls->dev; if ( widget == NULL ) return; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawLine( x1a, y1a, x2a, y2a ); } void plD_polyline_qtwidget( PLStream *pls, short *xa, short *ya, PLINT npts ) { QtPLWidget * widget = (QtPLWidget *) pls->dev; if ( widget == NULL ) return; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolyline( xa, ya, npts ); } void plD_esc_qtwidget( PLStream * pls, PLINT op, void* ptr ) { short *xa, *ya; PLINT i; unsigned char *r, *g, *b; PLFLT *alpha; QtPLWidget * widget = (QtPLWidget *) pls->dev; arc_struct *arc_info = (arc_struct *) ptr; if ( widget == NULL ) return; switch ( op ) { case PLESC_FILL: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; break; case PLESC_GRADIENT: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; r = new unsigned char[pls->ncol1]; g = new unsigned char[pls->ncol1]; b = new unsigned char[pls->ncol1]; alpha = new PLFLT[pls->ncol1]; for ( i = 0; i < pls->ncol1; i++ ) { r[i] = pls->cmap1[i].r; g[i] = pls->cmap1[i].g; b[i] = pls->cmap1[i].b; alpha[i] = pls->cmap1[i].a; } widget->setGradient( pls->xgradient[0], pls->xgradient[1], pls->ygradient[0], pls->ygradient[1], r, g, b, alpha, pls->ncol1 ); for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; delete[] r; delete[] g; delete[] b; delete[] alpha; break; case PLESC_HAS_TEXT: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawText( (EscText *) ptr ); break; case PLESC_ARC: widget->drawArc( arc_info->x, arc_info->y, arc_info->a, arc_info->b, arc_info->angle1, arc_info->angle2, arc_info->rotate, arc_info->fill ); break; case PLESC_FLUSH: widget->flush(); break; case PLESC_GETC: widget->getCursorCmd( (PLGraphicsIn *) ptr ); break; default: break; } } void plD_state_qtwidget( PLStream * pls, PLINT op ) { QtPLWidget * widget = (QtPLWidget *) pls->dev; if ( widget == NULL ) return; switch ( op ) { case PLSTATE_WIDTH: widget->setWidthF( pls->width ); break; case PLSTATE_COLOR0: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; case PLSTATE_COLOR1: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; default: break; } } void plD_tidy_qtwidget( PLStream * pls ) { QtPLWidget * widget = (QtPLWidget *) pls->dev; if ( widget != NULL ) { handler.DeviceClosed( widget ); delete widget; pls->dev = NULL; } closeQtApp(); } #endif #if defined ( PLD_extqt ) void plD_dispatch_init_extqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "External Qt Widget"; pdt->pl_DevName = "extqt"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 75; pdt->pl_init = (plD_init_fp) plD_init_extqt; pdt->pl_line = (plD_line_fp) plD_line_extqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_extqt; pdt->pl_eop = (plD_eop_fp) plD_eop_extqt; pdt->pl_bop = (plD_bop_fp) plD_bop_extqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_extqt; pdt->pl_state = (plD_state_fp) plD_state_extqt; pdt->pl_esc = (plD_esc_fp) plD_esc_extqt; } void plD_init_extqt( PLStream * pls ) { vectorize = 0; lines_aa = 1; if ( pls->dev == NULL /* || pls->xlength <= 0 || pls->ylength <= 0*/ ) { printf( "Error: use plsetqtdev to set up the Qt device before calling plinit()\n" ); return; } QtExtWidget* widget = (QtExtWidget *) ( pls->dev ); if ( widget->m_dWidth > widget->m_dHeight ) widget->downscale = (PLFLT) widget->m_dWidth / (PLFLT) ( PIXELS_X - 1 ); else widget->downscale = (PLFLT) widget->m_dHeight / (PLFLT) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( widget->m_dWidth / widget->downscale ), (PLINT) 0, (PLINT) ( widget->m_dHeight / widget->downscale ) ); QPicture temp; QPainter tempPainter( &temp ); plP_setpxl( temp.logicalDpiX() / 25.4 / widget->downscale, temp.logicalDpiY() / 25.4 / widget->downscale ); pls->color = 1; // Is a color device pls->plbuf_write = 0; pls->dev_fill0 = 1; // Handle solid fills pls->dev_fill1 = 0; pls->dev_gradient = 1; // driver renders gradient pls->dev_arc = 1; // driver renders arcs // Let the PLplot core handle dashed lines since // the driver results for this capability have a number of issues. // pls->dev_dash=1; pls->dev_dash = 0; pls->dev_flush = 1; // Driver does not have a clear capability so use (good) PLplot core // fallback for that instead. pls->dev_clear = 0; pls->termin = 0; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode pls->has_string_length = 1; // Driver supports string length calculations } // // These functions are separated out (instead of using dynamic_cast) // for the benefit of the PyQt4 bindings. C++ QtExtWidgets created // by PyQt4 are not properly type resolved. // void plD_line_extqt( PLStream * pls, short x1a, short y1a, short x2a, short y2a ) { QtExtWidget * widget = NULL; widget = (QtExtWidget *) pls->dev; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawLine( x1a, y1a, x2a, y2a ); } void plD_polyline_extqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { QtExtWidget * widget = NULL; widget = (QtExtWidget *) pls->dev; widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolyline( xa, ya, npts ); } void plD_esc_extqt( PLStream * pls, PLINT op, void* ptr ) { short *xa, *ya; PLINT i; unsigned char *r, *g, *b; PLFLT *alpha; QtExtWidget * widget = NULL; arc_struct *arc_info = (arc_struct *) ptr; widget = (QtExtWidget *) pls->dev; switch ( op ) { case PLESC_FILL: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; break; case PLESC_GRADIENT: xa = new short[pls->dev_npts]; ya = new short[pls->dev_npts]; r = new unsigned char[pls->ncol1]; g = new unsigned char[pls->ncol1]; b = new unsigned char[pls->ncol1]; alpha = new PLFLT[pls->ncol1]; for ( i = 0; i < pls->ncol1; i++ ) { r[i] = pls->cmap1[i].r; g[i] = pls->cmap1[i].g; b[i] = pls->cmap1[i].b; alpha[i] = pls->cmap1[i].a; } widget->setGradient( pls->xgradient[0], pls->xgradient[1], pls->ygradient[0], pls->ygradient[1], r, g, b, alpha, pls->ncol1 ); for ( i = 0; i < pls->dev_npts; i++ ) { xa[i] = pls->dev_x[i]; ya[i] = pls->dev_y[i]; } widget->drawPolygon( xa, ya, pls->dev_npts ); delete[] xa; delete[] ya; delete[] r; delete[] g; delete[] b; delete[] alpha; break; case PLESC_HAS_TEXT: // call the generic ProcessString function // ProcessString( pls, (EscText *)ptr ); widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); widget->drawText( (EscText *) ptr ); break; case PLESC_ARC: widget->drawArc( arc_info->x, arc_info->y, arc_info->a, arc_info->b, arc_info->angle1, arc_info->angle2, arc_info->rotate, arc_info->fill ); break; default: break; } } void plD_state_extqt( PLStream * pls, PLINT op ) { QtExtWidget * widget = NULL; widget = (QtExtWidget *) pls->dev; switch ( op ) { case PLSTATE_WIDTH: widget->setWidthF( pls->width ); break; case PLSTATE_COLOR0: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; case PLSTATE_COLOR1: widget->setColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ); break; default: break; } } void plD_tidy_extqt( PLStream * pls ) { QtExtWidget * widget = NULL; widget = (QtExtWidget *) pls->dev; if ( widget != NULL ) { handler.DeviceClosed( widget ); delete widget; pls->dev = NULL; } closeQtApp(); } void plD_eop_extqt( PLStream * /* pls */ ) { } void plD_bop_extqt( PLStream *pls ) { QtExtWidget * widget = NULL; widget = (QtExtWidget *) pls->dev; widget->setBackgroundColor( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, pls->cmap0[0].a ); } #endif #if defined ( PLD_memqt ) void plD_dispatch_init_memqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Qt Memory Driver"; pdt->pl_DevName = "memqt"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 76; pdt->pl_init = (plD_init_fp) plD_init_memqt; pdt->pl_line = (plD_line_fp) plD_line_rasterqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_rasterqt; pdt->pl_eop = (plD_eop_fp) plD_eop_memqt; pdt->pl_bop = (plD_bop_fp) plD_bop_memqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_rasterqt; pdt->pl_state = (plD_state_fp) plD_state_rasterqt; pdt->pl_esc = (plD_esc_fp) plD_esc_rasterqt; } void plD_init_memqt( PLStream * pls ) { int i; double dpi; unsigned char *qt_mem; unsigned char *input_mem; vectorize = 0; lines_aa = 1; plParseDrvOpts( qt_options ); // Stream setup pls->color = 1; pls->plbuf_write = 0; pls->dev_fill0 = 1; pls->dev_fill1 = 0; pls->dev_gradient = 1; // driver renders gradient pls->dev_arc = 1; // driver renders arcs // Let the PLplot core handle dashed lines since // the driver results for this capability have a number of issues. // pls->dev_dash=1; pls->dev_dash = 0; pls->dev_flush = 1; // Driver does not have a clear capability so use (good) PLplot core // fallback for that instead. pls->dev_clear = 0; pls->termin = 0; pls->page = 0; pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode pls->has_string_length = 1; // Driver supports string length calculations // Needs to be true only because of multi-stream case bool isMaster = initQtApp( true ); if ( pls->xdpi <= 0. ) dpi = DEFAULT_DPI; else dpi = pls->xdpi; // Set the plot size to the memory buffer size, on the off chance // that they are different. pls->xlength = pls->phyxma; pls->ylength = pls->phyyma; // Save a pointer to the user supplied memory input_mem = (unsigned char *) pls->dev; // Create a appropriately sized raster device pls->dev = new QtRasterDevice( pls->xlength, pls->ylength ); ( (QtRasterDevice *) pls->dev )->setPLStream( pls ); ( (QtRasterDevice *) pls->dev )->memory = input_mem; if ( isMaster ) handler.setMasterDevice( (QtRasterDevice *) ( pls->dev ) ); if ( pls->xlength > pls->ylength ) ( (QtRasterDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->xlength / (PLFLT) ( PIXELS_X - 1 ); else ( (QtRasterDevice *) ( pls->dev ) )->downscale = (PLFLT) pls->ylength / (PLFLT) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / ( (QtRasterDevice *) ( pls->dev ) )->downscale ), (PLINT) 0, (PLINT) ( pls->ylength / ( (QtRasterDevice *) ( pls->dev ) )->downscale ) ); plP_setpxl( dpi / 25.4 / ( (QtRasterDevice *) ( pls->dev ) )->downscale, dpi / 25.4 / ( (QtRasterDevice *) ( pls->dev ) )->downscale ); // Copy the user supplied memory into the QImage. // This device assumes that the format of the QImage // is RGB32 (or ARGB). qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine( 0 ); for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { qt_mem[2] = input_mem[0]; // R qt_mem[1] = input_mem[1]; // G qt_mem[0] = input_mem[2]; // B if ( pls->dev_mem_alpha == 1 ) { qt_mem[3] = input_mem[3]; input_mem += 4; } else { input_mem += 3; } qt_mem += 4; } ( (QtRasterDevice *) ( pls->dev ) )->setResolution( dpi ); // This is set so the we'll always make it past the qt_family_check(). pls->family = true; } void plD_bop_memqt( PLStream * /* pls */ ) { // Do nothing to preserve user data } void plD_eop_memqt( PLStream *pls ) { int i; unsigned char *memory; unsigned char *qt_mem; memory = ( (QtRasterDevice *) pls->dev )->memory; qt_mem = ( (QtRasterDevice *) pls->dev )->scanLine( 0 ); for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { memory[0] = qt_mem[2]; // R memory[1] = qt_mem[1]; // G memory[2] = qt_mem[0]; // B if ( pls->dev_mem_alpha == 1 ) { memory[3] = qt_mem[3]; memory += 4; } else { memory += 3; } qt_mem += 4; } } #endif plplot-5.10.0+dfsg/drivers/README.drivers 644 1750 1750 566612052012176 167540ustar andrewandrewThis document is a quick overview of building and configuring drivers from the perspective of what system files have to be modified. (For actual details about how to construct a new device driver read the source for some of the drivers in plplot/drivers. For some additional details about the core paging and familying code see ../src/README.pages. Finally, there are several useful sections in the DocBook documentation [see, for example, "Output Devices" and "Driver Functions" in Chapter 3] that you should look at.) The following are some short notes on what PLplot source tree files need to be added or modified in order to add a device (which we'll call ) to a device driver (which we'll call ). The following PLplot source-tree files are affected: plplot/drivers/.driver_info.in plplot/cmake/modules/drivers-init.cmake plplot/include/drivers.h plplot/include/plDevs.h.cmake plplot/include/plcore.h plplot/plplot-test/plplot-test.sh.cmake plplot/examples/plplot_configure.cmake_installed_examples.in 1. Add a line to plplot/drivers/.driver_info.in consisting of the following colon-separated fields: ::::: This should be the exact duplicate of the corresponding entry in the driver source code for plD_DEVICE_INFO_. 2. Add the following line to plplot/cmake/modules/drivers-init.cmake in set(DRIVERS_DEVICE_LIST... "::ON::" where that file documents how the last two fields should be set depending on the characteristics of the device you are adding. 3. Add the following line to plplot/include/drivers.h: PLDLLIMPEXP_DRIVER void plD_dispatch_init_ ( PLDispatchTable *pdt ); 4. Add the following line to include/plDevs.h.cmake #cmakedefine PLD_ 5. Add the following 3 lines to plplot/include/plcore.h: #if defined(PLD_) && !defined(ENABLE_DYNDRIVERS) plD_dispatch_init_, #endif 6. For each interactive and file device of the driver add the following line to plplot/plplot_test/plplot-test.sh.cmake: PLD_=@PLD_@ Note, that the interactive and file devices are dealt with in separate places in that script so be careful where you put the above change. 7. Add the following line to plplot/examples/plplot_configure.cmake_installed_examples.in: set(PLD_ @PLD_@) If the driver requires additional additional files or external libraries for compiling and linking then you should add a file called .cmake to plplot/cmake/modules and add a call to this file in the file plplot/cmake/modules/drivers.cmake (include()). The file .cmake should consist of cmake instructions for finding and the files and libraries and setting the appropriate environment variables (PLD_, _COMPILE_FLAGS and _LINK_FLAGS). The code for the driver itself should be in a file called .c or .cpp in the plplot/drivers directory. plplot-5.10.0+dfsg/drivers/tek.c 644 1750 1750 10444311462322041 153760ustar andrewandrew// $Id: tek.c 11282 2010-10-28 16:26:09Z airwin $ // // PLplot tektronix device & emulators driver. // #include "plDevs.h" #if defined ( PLD_xterm ) || /* xterm */ \ defined ( PLD_tek4010 ) || /* TEK 4010 */ \ defined ( PLD_tek4010f ) || /* ditto, file */ \ defined ( PLD_tek4107 ) || /* TEK 4107 */ \ defined ( PLD_tek4107f ) || /* ditto, file */ \ defined ( PLD_mskermit ) || /* MS-kermit emulator */ \ defined ( PLD_versaterm ) || /* Versaterm emulator */ \ defined ( PLD_vlt ) || /* VLT emulator */ \ defined ( PLD_conex ) // conex emulator 4010/4014/4105 #define NEED_PLDEBUG #include "plplotP.h" #include "drivers.h" #include "plevent.h" #include // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_tek = #if defined ( PLD_conex ) "conex:Conex vt320/tek emulator:1:tek:24:conex\n" #endif #if defined ( PLD_mskermit ) "mskermit:MS-Kermit emulator:1:tek:21:mskermit\n" #endif #if defined ( PLD_tek4107t ) "tek4107t:Tektronix Terminal (4105/4107):1:tek:20:tek4107t\n" #endif #if defined ( PLD_tek4107f ) "tek4107f:Tektronix File (4105/4107):0:tek:28:tek4107f\n" #endif #if defined ( PLD_tekt ) "tekt:Tektronix Terminal (4010):1:tek:19:tekt\n" #endif #if defined ( PLD_tekf ) "tekf:Tektronix File (4010):0:tek:27:tekf\n" #endif #if defined ( PLD_versaterm ) "versaterm:Versaterm vt100/tek emulator:1:tek:22:versaterm\n" #endif #if defined ( PLD_vlt ) "vlt:VLT vt100/tek emulator:1:tek:23:vlt\n" #endif #if defined ( PLD_xterm ) "xterm:Xterm Window:1:tek:18:xterm\n" #endif ; // Prototype the driver entry points that will be used to initialize the // dispatch table entries. void plD_init_xterm( PLStream * ); void plD_init_tekt( PLStream * ); void plD_init_tekf( PLStream * ); void plD_init_tek4107t( PLStream * ); void plD_init_tek4107f( PLStream * ); void plD_init_mskermit( PLStream * ); void plD_init_versaterm( PLStream * ); void plD_init_vlt( PLStream * ); void plD_init_conex( PLStream * ); // External generic entry points void plD_line_tek( PLStream *, short, short, short, short ); void plD_polyline_tek( PLStream *, short *, short *, PLINT ); void plD_eop_tek( PLStream * ); void plD_bop_tek( PLStream * ); void plD_tidy_tek( PLStream * ); void plD_state_tek( PLStream *, PLINT ); void plD_esc_tek( PLStream *, PLINT, void * ); // Static function prototypes static void WaitForPage( PLStream *pls ); static void tek_init( PLStream *pls ); static void tek_text( PLStream *pls ); static void tek_graph( PLStream *pls ); static void fill_polygon( PLStream *pls ); static void GetCursor( PLStream *pls, PLGraphicsIn *ptr ); static void encode_int( char *c, int i ); static void encode_vector( char *c, int x, int y ); static void decode_gin( char *c, PLGraphicsIn *gin ); static void tek_vector( PLStream *pls, int x, int y ); static void scolor( PLStream *pls, int icol, int r, int g, int b ); static void setcmap( PLStream *pls ); static void LookupEvent( PLStream *pls ); static void InputEH( PLStream *pls ); static void LocateEH( PLStream *pls ); // Stuff for handling tty cbreak mode #ifdef HAVE_TERMIOS_H #include #include static struct termios termios_cbreak, termios_reset; static enum { RESET, CBREAK } ttystate = RESET; static void tty_setup( void ); static int tty_cbreak( void ); static int tty_reset( void ); static void tty_atexit( void ); #else static void tty_setup( void ) { } static int tty_cbreak( void ) { return 0; } static int tty_reset( void ) { return 0; } static void tty_atexit( void ) { } #endif // Pixel settings #define TEKX 1023 #define TEKY 779 // Graphics control characters. #define RING_BELL "\007" // ^G = 7 #define CLEAR_VIEW "\033\f" // clear the view = ESC FF #define ALPHA_MODE "\037" // Enter Alpha mode: US #define VECTOR_MODE "\035" // Enter Vector mode: GS #define GIN_MODE "\033\032" // Enter GIN mode: ESC SUB #define BYPASS_MODE "\033\030" // Enter Bypass mode: ESC CAN #define XTERM_VTMODE "\033\003" // End xterm-Tek mode: ESC ETX #define CANCEL "\033KC" // Cancel // Static vars enum { tek4010, tek4105, tek4107, xterm, mskermit, vlt, versaterm }; // One of these holds the tek driver state information typedef struct { PLINT xold, yold; // Coordinates of last point plotted int exit_eventloop; // Break out of event loop int locate_mode; // Set while in locate (pick) mode int curcolor; // Current color index PLGraphicsIn gin; // Graphics input structure } TekDev; // color for MS-DOS Kermit v2.31 (and up) tektronix emulator // 0 = normal, 1 = bright // foreground color (30-37) = 30 + colors // where colors are 1=red, 2=green, 4=blue // #ifdef PLD_mskermit static char *kermit_color[15] = { "0;30", "0;37", "0;32", "0;36","0;31", "0;35", "1;34", "1;33","1;31", "1;37", "1;35", "1;32","1;36", "0;34", "0;33" }; #endif static void tek_dispatch_init_helper( PLDispatchTable *pdt, char *menustr, char *devnam, int type, int seq, plD_init_fp init ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = menustr; pdt->pl_DevName = devnam; #endif pdt->pl_type = type; pdt->pl_seq = seq; pdt->pl_init = init; pdt->pl_line = (plD_line_fp) plD_line_tek; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_tek; pdt->pl_eop = (plD_eop_fp) plD_eop_tek; pdt->pl_bop = (plD_bop_fp) plD_bop_tek; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_tek; pdt->pl_state = (plD_state_fp) plD_state_tek; pdt->pl_esc = (plD_esc_fp) plD_esc_tek; } void plD_dispatch_init_xterm( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Xterm Window", "xterm", plDevType_Interactive, 18, (plD_init_fp) plD_init_xterm ); } void plD_dispatch_init_tekt( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Tektronix Terminal (4010)", "tekt", plDevType_Interactive, 19, (plD_init_fp) plD_init_tekt ); } void plD_dispatch_init_tek4107t( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Tektronix Terminal (4105/4107)", "tek4107t", plDevType_Interactive, 20, (plD_init_fp) plD_init_tek4107t ); } void plD_dispatch_init_mskermit( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "MS-Kermit emulator", "mskermit", plDevType_Interactive, 21, (plD_init_fp) plD_init_mskermit ); } void plD_dispatch_init_versaterm( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Versaterm vt100/tek emulator", "versaterm", plDevType_Interactive, 22, (plD_init_fp) plD_init_versaterm ); } void plD_dispatch_init_vlt( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "VLT vt100/tek emulator", "vlt", plDevType_Interactive, 23, (plD_init_fp) plD_init_vlt ); } void plD_dispatch_init_conex( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Conex vt320/tek emulator", "conex", plDevType_Interactive, 24, (plD_init_fp) plD_init_conex ); } void plD_dispatch_init_tekf( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Tektronix File (4010)", "tekf", plDevType_FileOriented, 27, (plD_init_fp) plD_init_tekf ); } void plD_dispatch_init_tek4107f( PLDispatchTable *pdt ) { tek_dispatch_init_helper( pdt, "Tektronix File (4105/4107)", "tek4107f", plDevType_FileOriented, 28, (plD_init_fp) plD_init_tek4107f ); } //-------------------------------------------------------------------------- // plD_init_xterm() xterm // plD_init_tekt() Tek 4010 terminal // plD_init_tekf() Tek 4010 file // plD_init_tek4107t() Tek 4105/4107 terminal // plD_init_tek4107f() Tek 4105/4107 file // plD_init_mskermit() MS-Kermit emulator (DOS) // plD_init_vlt() VLT emulator (Amiga) // plD_init_versaterm() VersaTerm emulator (Mac) // plD_init_conex() Conex vt320/Tek 4105 emulator (DOS) // // These just set attributes for the particular tektronix device, then call // tek_init(). The following attributes can be set: // // pls->termin if a terminal device // pls->color if color (1), if only fixed colors (2) // pls->dev_fill0 if can handle solid area fill // pls->dev_fill1 if can handle pattern area fill //-------------------------------------------------------------------------- void plD_init_xterm( PLStream *pls ) { pls->dev_minor = xterm; pls->termin = 1; tek_init( pls ); } void plD_init_tekt( PLStream *pls ) { pls->termin = 1; plD_init_tekf( pls ); } void plD_init_tekf( PLStream *pls ) { pls->dev_minor = tek4010; tek_init( pls ); } void plD_init_tek4107t( PLStream *pls ) { pls->termin = 1; plD_init_tek4107f( pls ); } void plD_init_tek4107f( PLStream *pls ) { pls->dev_minor = tek4107; pls->color = 1; pls->dev_fill0 = 1; tek_init( pls ); } void plD_init_mskermit( PLStream *pls ) { pls->dev_minor = mskermit; pls->termin = 1; pls->color = 1; pls->dev_fill0 = 1; tek_init( pls ); } void plD_init_vlt( PLStream *pls ) { pls->dev_minor = vlt; pls->termin = 1; pls->color = 1; pls->dev_fill0 = 1; tek_init( pls ); } void plD_init_versaterm( PLStream *pls ) { pls->dev_minor = versaterm; pls->termin = 1; pls->color = 1; pls->dev_fill0 = 1; tek_init( pls ); } void plD_init_conex( PLStream *pls ) { pls->dev_minor = xterm; // responds to xterm escape codes pls->termin = 1; pls->color = 2; // only fixed colours tek_init( pls ); } //-------------------------------------------------------------------------- // tek_init() // // Generic tektronix device initialization. //-------------------------------------------------------------------------- static void tek_init( PLStream *pls ) { TekDev *dev; int xmin = 0; int xmax = TEKX; int ymin = 0; int ymax = TEKY; PLFLT pxlx = 4.771; PLFLT pxly = 4.653; pls->graphx = TEXT_MODE; // Allocate and initialize device-specific data pls->dev = calloc( 1, (size_t) sizeof ( TekDev ) ); if ( pls->dev == NULL ) plexit( "tek_init: Out of memory." ); dev = (TekDev *) pls->dev; dev->curcolor = 1; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; plP_setpxl( pxlx, pxly ); plP_setphy( xmin, xmax, ymin, ymax ); // Terminal/file initialization if ( pls->termin ) { pls->OutFile = stdout; tty_setup(); } else { plFamInit( pls ); plOpenFile( pls ); } switch ( pls->dev_minor ) { #ifdef PLD_tek4107 case tek4107: pls->graphx = GRAPHICS_MODE; fprintf( pls->OutFile, "\033%%!0" ); // set tek mode fprintf( pls->OutFile, "\033KN1" ); // clear the view fprintf( pls->OutFile, "\033LZ" ); // clear dialog buffer fprintf( pls->OutFile, "\033ML1" ); // set default color break; #endif // PLD_tek4107 // A sneaky hack: VLT sometimes has leftover panel information, causing // garbage at the beginning of a sequence of color fills. Since // there is no clear panel command, instead I set the fill color to the // same as background and issue an end panel command. // #ifdef PLD_vlt case vlt: { char fillcol[4]; tek_graph( pls ); encode_int( fillcol, 0 ); fprintf( pls->OutFile, "\033MP%s\033LE", fillcol ); break; } #endif // PLD_vlt default: tek_graph( pls ); } // Initialize palette if ( pls->color & 0x01 ) { printf( "\033TM111" ); // Switch to RGB colors setcmap( pls ); } // Finish initialization fprintf( pls->OutFile, VECTOR_MODE ); // Enter vector mode if ( pls->termin ) fprintf( pls->OutFile, CLEAR_VIEW ); // erase and home fflush( pls->OutFile ); } //-------------------------------------------------------------------------- // plD_line_tek() // // Draw a line from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_tek( PLStream *pls, short x1, short y1, short x2, short y2 ) { TekDev *dev = (TekDev *) pls->dev; tek_graph( pls ); // If not continuation of previous line, begin a new one if ( x1 != dev->xold || y1 != dev->yold ) { pls->bytecnt += fprintf( pls->OutFile, VECTOR_MODE ); tek_vector( pls, x1, y1 ); } // Now send following point to complete line draw tek_vector( pls, x2, y2 ); dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_tek() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_tek( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; TekDev *dev = (TekDev *) pls->dev; short x = xa[0], y = ya[0]; tek_graph( pls ); // If not continuation of previous line, begin a new one if ( x != dev->xold || y != dev->yold ) { pls->bytecnt += fprintf( pls->OutFile, VECTOR_MODE ); tek_vector( pls, x, y ); } // Now send following points to complete polyline draw for ( i = 1; i < npts; i++ ) tek_vector( pls, xa[i], ya[i] ); dev->xold = xa[npts - 1]; dev->yold = ya[npts - 1]; } //-------------------------------------------------------------------------- // plD_eop_tek() // // End of page. User must hit a to continue (terminal output). //-------------------------------------------------------------------------- void plD_eop_tek( PLStream *pls ) { tek_graph( pls ); if ( pls->termin ) { if ( !pls->nopause ) WaitForPage( pls ); } fprintf( pls->OutFile, CLEAR_VIEW ); // erase and home } //-------------------------------------------------------------------------- // plD_bop_tek() // // Set up for the next page. Advance to next family file if necessary // (file output). Devices that share graphics/alpha screens need a page // clear. //-------------------------------------------------------------------------- void plD_bop_tek( PLStream *pls ) { TekDev *dev = (TekDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; if ( pls->termin ) { switch ( pls->dev_minor ) { case mskermit: fprintf( pls->OutFile, CLEAR_VIEW ); // erase and home break; } } else { plGetFam( pls ); } pls->page++; // Initialize palette if ( pls->color & 0x01 ) setcmap( pls ); } //-------------------------------------------------------------------------- // plD_tidy_tek() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_tek( PLStream *pls ) { if ( !pls->termin ) { plCloseFile( pls ); } else { tek_text( pls ); fflush( pls->OutFile ); } } //-------------------------------------------------------------------------- // tek_color() // // Change to specified color index. //-------------------------------------------------------------------------- static void tek_color( PLStream *pls, int icol ) { switch ( pls->dev_minor ) { #ifdef PLD_mskermit // Is this really necessary? case mskermit: printf( "\033[%sm", kermit_color[icol % 14] ); break; #endif default: pls->bytecnt += fprintf( pls->OutFile, "\033ML%c", icol + '0' ); } } //-------------------------------------------------------------------------- // plD_state_tek() // // Handle change in PLStream state (color, pen width, fill attribute, // etc). //-------------------------------------------------------------------------- void plD_state_tek( PLStream *pls, PLINT op ) { TekDev *dev = (TekDev *) pls->dev; switch ( op ) { case PLSTATE_WIDTH: break; case PLSTATE_COLOR0: if ( pls->color ) { int icol0 = pls->icol0; tek_graph( pls ); if ( icol0 != PL_RGB_COLOR ) { dev->curcolor = icol0; tek_color( pls, icol0 ); } } break; case PLSTATE_COLOR1: if ( pls->color ) { int icol1, ncol1; tek_graph( pls ); if ( ( ncol1 = MIN( 16 - pls->ncol0, pls->ncol1 ) ) < 1 ) break; icol1 = pls->ncol0 + ( pls->icol1 * ( ncol1 - 1 ) ) / ( pls->ncol1 - 1 ); dev->curcolor = icol1; tek_color( pls, icol1 ); } break; case PLSTATE_CMAP0: case PLSTATE_CMAP1: if ( pls->color & 0x01 ) setcmap( pls ); break; } } //-------------------------------------------------------------------------- // plD_esc_tek() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_tek( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_TEXT: tek_text( pls ); break; case PLESC_GRAPH: tek_graph( pls ); break; case PLESC_FILL: fill_polygon( pls ); break; case PLESC_GETC: GetCursor( pls, (PLGraphicsIn *) ptr ); break; } } //-------------------------------------------------------------------------- // GetCursor() // // Waits for a left button mouse event and returns coordinates. // xterm doesn't handle GIN. I think all the rest do. //-------------------------------------------------------------------------- static void GetCursor( PLStream *pls, PLGraphicsIn *ptr ) { #define MAX_GIN 10 char input_string[MAX_GIN]; int i = 0; plGinInit( ptr ); if ( pls->termin && pls->dev_minor != xterm ) { tek_graph( pls ); // Enter GIN mode printf( GIN_MODE ); fflush( stdout ); // Read & decode report while ( ++i < MAX_GIN && ( input_string[i - 1] = getchar() ) != '\n' ) ; input_string[i - 1] = '\0'; ptr->keysym = input_string[0]; decode_gin( &input_string[1], ptr ); // Switch out of GIN mode printf( VECTOR_MODE ); } } //-------------------------------------------------------------------------- // fill_polygon() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void fill_polygon( PLStream *pls ) { TekDev *dev = (TekDev *) pls->dev; int i; char fillcol[4], firstpoint[5]; if ( pls->dev_npts < 1 ) return; tek_graph( pls ); encode_int( fillcol, -dev->curcolor ); encode_vector( firstpoint, pls->dev_x[0], pls->dev_y[0] ); // Select the fill pattern pls->bytecnt += fprintf( pls->OutFile, "\033MP%s", fillcol ); // Begin panel boundary // Set pls->debug to see the boundary of each fill box -- cool! if ( pls->debug ) pls->bytecnt += fprintf( pls->OutFile, "\033LP%s1", firstpoint ); else pls->bytecnt += fprintf( pls->OutFile, "\033LP%s0", firstpoint ); // Specify boundary (in vector mode) pls->bytecnt += fprintf( pls->OutFile, VECTOR_MODE ); for ( i = 1; i < pls->dev_npts; i++ ) tek_vector( pls, pls->dev_x[i], pls->dev_y[i] ); // End panel pls->bytecnt += fprintf( pls->OutFile, "\033LE" ); } //-------------------------------------------------------------------------- // tek_text() // // Switch to text screen (or alpha mode, for vanilla tek's). Restore // terminal to its original state, to better handle user input if // necessary. // // Note: xterm behaves strangely in the following circumstance: switch to // the text screen, print a string, and switch to the graphics screen, all // done in quick succession. The first character of the printed string // usually comes out blank -- but only apparently so, because if you force // a refresh of the screen in this area it will reappear. This is a // reproducible bug on the HP 720 under X11R5. If you insert a sleep(1) // after the switch to text screen or before the switch to graphics // screen, the string is printed correctly. I've been unable to find a // workaround for this problem (and I've tried, you can believe eet man). //-------------------------------------------------------------------------- static void tek_text( PLStream *pls ) { if ( pls->termin && ( pls->graphx == GRAPHICS_MODE ) ) { tty_reset(); pls->graphx = TEXT_MODE; switch ( pls->dev_minor ) { case xterm: printf( "\033\003" ); // vt100 mode (xterm) = ESC ETX break; case mskermit: case vlt: printf( "\033[?38l" ); // vt100 screen break; case versaterm: printf( "\033%%!2" ); // vt100 screen break; case tek4107: printf( "\033LV1" ); // set dialog visible printf( "\033%%!1" ); // set ansi mode break; default: printf( ALPHA_MODE ); // enter alpha mode } fflush( stdout ); } } //-------------------------------------------------------------------------- // tek_graph() // // Switch to graphics screen. Also switch terminal to cbreak mode, to allow // single keystrokes to govern actions at end of page. //-------------------------------------------------------------------------- static void tek_graph( PLStream *pls ) { if ( pls->termin && ( pls->graphx == TEXT_MODE ) ) { tty_cbreak(); pls->graphx = GRAPHICS_MODE; switch ( pls->dev_minor ) { case xterm: case mskermit: case vlt: printf( "\033[?38h" ); // switch to tek screen break; case versaterm: printf( "\033%%!0" ); // switch to tek4107 screen break; case tek4107: printf( "\033%%!0" ); // set tek mode printf( CLEAR_VIEW ); // clear screen printf( "\033LV0" ); // set dialog invisible break; } } } //-------------------------------------------------------------------------- // encode_int() // // Encodes a single int into standard tek integer format, storing into a // NULL-terminated character string (must be length 4 or greater). This // scheme does not work for negative integers less than 15. //-------------------------------------------------------------------------- static void encode_int( char *c, int i ) { int negative = 0; if ( i > 0 ) { if ( i & 0x7C00 ) // are any of bits 10-14 set? *c++ = ( ( i >> 10 ) & 0x1F ) | 0x40; if ( i & 0x03F0 ) // are any of bits 4-9 set? *c++ = ( ( i >> 4 ) & 0x3F ) | 0x40; } else { i = -i; negative = 1; } if ( i & 0x000F ) // are any of bits 0-3 set? *c = ( i & 0x0F ) | 0x20; else // if not, put in a space *c = 0x20; if ( !negative ) // if positive, set sign bit *c |= 0x10; c++; *c = '\0'; // NULL-terminate return; } //-------------------------------------------------------------------------- // decode_gin() // // Decodes a GIN tek vector string into an xy pair of relative device // coordinates. It's best to not use absolute device coordinates since the // coordinate bounds are different depending on the report encoding used. // // Standard: // Extended: // // where holds the two low order bits for each coordinate. //-------------------------------------------------------------------------- static void decode_gin( char *c, PLGraphicsIn *gin ) { int x, y, lc = strlen( c ); if ( lc == 4 ) { x = ( ( c[0] & 0x1f ) << 5 ) + ( ( c[1] & 0x1f ) ); y = ( ( c[2] & 0x1f ) << 5 ) + ( ( c[3] & 0x1f ) ); gin->pX = x; gin->pY = y; gin->dX = x / (double) TEKX; gin->dY = y / (double) TEKY; } else if ( lc == 5 ) { y = ( ( c[0] & 0x1f ) << 7 ) + ( ( c[2] & 0x1f ) << 2 ) + ( ( c[1] & 0x06 ) >> 2 ); x = ( ( c[3] & 0x1f ) << 7 ) + ( ( c[4] & 0x1f ) << 2 ) + ( ( c[1] & 0x03 ) ); gin->pX = x; gin->pY = y; gin->dX = x / (double) ( TEKX << 2 ); gin->dY = y / (double) ( TEKY << 2 ); } else // Illegal encoding { gin->pX = 0; gin->pY = 0; gin->dY = 0; gin->dX = 0; } } //-------------------------------------------------------------------------- // encode_vector() // // Encodes an xy vector (2 ints) into standard tek vector format, storing // into a NULL-terminated character string of length 5. Note that the y // coordinate always comes first. //-------------------------------------------------------------------------- static void encode_vector( char *c, int x, int y ) { c[0] = ( y >> 5 ) + 0x20; // hy c[1] = ( y & 0x1f ) + 0x60; // ly c[2] = ( x >> 5 ) + 0x20; // hx c[3] = ( x & 0x1f ) + 0x40; // lx c[4] = '\0'; // NULL } //-------------------------------------------------------------------------- // tek_vector() // // Issues a vector draw command, assuming we are in vector plot mode. XY // coordinates are encoded according to the standard xy encoding scheme. //-------------------------------------------------------------------------- static void tek_vector( PLStream *pls, int x, int y ) { char c[5]; encode_vector( c, x, y ); pls->bytecnt += fprintf( pls->OutFile, "%s", c ); } //-------------------------------------------------------------------------- // scolor() // // Sets a color by tek-encoded RGB values. Need to convert PLplot RGB // color range (0 to 255) to Tek RGB color range (0 to 100). //-------------------------------------------------------------------------- static void scolor( PLStream *pls, int icol, int r, int g, int b ) { char tek_col[4], tek_r[4], tek_g[4], tek_b[4]; encode_int( tek_col, icol ); encode_int( tek_r, ( 100 * r ) / 255 ); encode_int( tek_g, ( 100 * g ) / 255 ); encode_int( tek_b, ( 100 * b ) / 255 ); pls->bytecnt += fprintf( pls->OutFile, "\033TG14%s%s%s%s", tek_col, tek_r, tek_g, tek_b ); } //-------------------------------------------------------------------------- // setcmap() // // Sets up color palette. //-------------------------------------------------------------------------- static void setcmap( PLStream *pls ) { int i, ncol1 = MIN( 16 - pls->ncol0, pls->ncol1 ); PLColor cmap1col; tek_graph( pls ); // Initialize cmap 0 colors for ( i = 0; i < pls->ncol0; i++ ) scolor( pls, i, pls->cmap0[i].r, pls->cmap0[i].g, pls->cmap0[i].b ); // Initialize any remaining slots for cmap1 for ( i = 0; i < ncol1; i++ ) { plcol_interp( pls, &cmap1col, i, ncol1 ); scolor( pls, i + pls->ncol0, cmap1col.r, cmap1col.g, cmap1col.b ); } } //-------------------------------------------------------------------------- // WaitForPage() // // This routine waits for the user to advance the plot, while handling // all other events. //-------------------------------------------------------------------------- static void WaitForPage( PLStream *pls ) { TekDev *dev = (TekDev *) pls->dev; printf( ALPHA_MODE ); // Switch to alpha mode (necessary) printf( RING_BELL ); // and ring bell printf( VECTOR_MODE ); // Switch out of alpha mode fflush( stdout ); while ( !dev->exit_eventloop ) { LookupEvent( pls ); if ( dev->locate_mode ) LocateEH( pls ); else InputEH( pls ); } dev->exit_eventloop = FALSE; } //-------------------------------------------------------------------------- // LookupEvent() // // Fills in the PLGraphicsIn from an input event. //-------------------------------------------------------------------------- static void LookupEvent( PLStream *pls ) { TekDev *dev = (TekDev *) pls->dev; PLGraphicsIn *gin = &( dev->gin ); if ( dev->locate_mode ) { GetCursor( pls, gin ); } else { plGinInit( gin ); gin->keysym = getchar(); } if ( isprint( gin->keysym ) ) { gin->string[0] = gin->keysym; gin->string[1] = '\0'; } else { gin->string[0] = '\0'; } pldebug( "LookupEvent", "Keycode %x, string: %s\n", gin->keysym, gin->string ); } //-------------------------------------------------------------------------- // LocateEH() // // Handles locate mode events. // // In locate mode: move cursor to desired location and select by pressing a // key or by clicking on the mouse (if available). Typically the world // coordinates of the selected point are reported. // // There are two ways to enter Locate mode -- via the API, or via a driver // command. The API entry point is the call plGetCursor(), which initiates // locate mode and does not return until input has been obtained. The // driver entry point is by entering a 'L' while the driver is waiting for // events. // // Locate mode input is reported in one of three ways: // 1. Through a returned PLGraphicsIn structure, when user has specified a // locate handler via (*pls->LocateEH). // 2. Through a returned PLGraphicsIn structure, when locate mode is invoked // by a plGetCursor() call. // 3. Through writes to stdout, when locate mode is invoked by a driver // command and the user has not supplied a locate handler. // // Hitting will at all times end locate mode. Other keys will // typically be interpreted as locator input. Selecting a point out of // bounds will end locate mode unless the user overrides with a supplied // Locate handler. //-------------------------------------------------------------------------- static void LocateEH( PLStream *pls ) { TekDev *dev = (TekDev *) pls->dev; PLGraphicsIn *gin = &( dev->gin ); // End locate mode on if ( gin->keysym == PLK_Escape ) { dev->locate_mode = 0; return; } // Call user locate mode handler if provided if ( pls->LocateEH != NULL ) ( *pls->LocateEH )( gin, pls->LocateEH_data, &dev->locate_mode ); // Use default procedure else { // Try to locate cursor if ( plTranslateCursor( gin ) ) { // Successful, so send report to stdout pltext(); if ( isprint( gin->keysym ) ) printf( "%f %f %c\n", gin->wX, gin->wY, gin->keysym ); else printf( "%f %f\n", gin->wX, gin->wY ); plgra(); } else { // Selected point is out of bounds, so end locate mode dev->locate_mode = 0; } } } //-------------------------------------------------------------------------- // InputEH() // // Event handler routine for xterm. Just reacts to keyboard input. // // In locate mode: move cursor to desired location and select by pressing a // key or by clicking on the mouse (if available). The world coordinates of // the selected point are output on the text screen. Terminate by picking a // point out of bounds, hitting page advance, or the escape key. If you // want to customize this, write an event handler to do it. //-------------------------------------------------------------------------- static void InputEH( PLStream *pls ) { TekDev *dev = (TekDev *) pls->dev; PLGraphicsIn *gin = &( dev->gin ); // Call user event handler. // Since this is called first, the user can disable all PLplot internal // event handling by setting gin->keysym to 0 and gin->string to '\0'. // if ( pls->KeyEH != NULL ) ( *pls->KeyEH )( gin, pls->KeyEH_data, &dev->exit_eventloop ); // Remaining internal event handling switch ( gin->keysym ) { case PLK_Linefeed: // Advance to next page (i.e. terminate event loop) on a dev->exit_eventloop = TRUE; break; case 'Q': // Terminate on a 'Q' (not 'q', since it's too easy to hit by mistake) pls->nopause = TRUE; plexit( "" ); break; case 'L': // Begin locate mode dev->locate_mode = 1; break; } } //-------------------------------------------------------------------------- // tty cbreak-mode handlers // // Taken from "Advanced Programming in the UNIX(R) Environment", // by W. Richard Stevens. //-------------------------------------------------------------------------- #ifdef HAVE_TERMIOS_H static void tty_setup( void ) // setup for terminal operations { if ( tcgetattr( STDIN_FILENO, &termios_reset ) < 0 ) { fprintf( stderr, "Unable to set up cbreak mode.\n" ); return; } termios_cbreak = termios_reset; // structure copy termios_cbreak.c_lflag &= ~( ICANON ); // canonical mode off termios_cbreak.c_cc[VMIN] = 1; // 1 byte at a time termios_cbreak.c_cc[VTIME] = 0; // no timer #ifdef STDC_HEADERS if ( atexit( tty_atexit ) ) fprintf( stderr, "Unable to set up atexit handler.\n" ); #endif return; } static int tty_cbreak( void ) // put terminal into a cbreak mode { if ( ttystate != CBREAK ) { if ( tcsetattr( STDIN_FILENO, TCSAFLUSH, &termios_cbreak ) < 0 ) return -1; ttystate = CBREAK; } return 0; } static int tty_reset( void ) // restore terminal's mode { if ( ttystate != RESET ) { if ( tcsetattr( STDIN_FILENO, TCSAFLUSH, &termios_reset ) < 0 ) return -1; ttystate = RESET; } return 0; } static void tty_atexit( void ) // exit handler { tty_reset(); } #endif // HAVE_TERMIOS_H #else int pldummy_tek() { return 0; } #endif // defined(PLD_xterm) || ... plplot-5.10.0+dfsg/drivers/cairo.c 644 1750 1750 36364112251341601 157170ustar andrewandrew// June 2, 2007 // // Graphics drivers that are based on the Cairo / Pango Libraries. // // Copyright (C) 2008 Hazen Babcock // Copyright (C) 2009, 2010 Hezekiah M. Carty // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // //-------------------------------------------------------------------------- // Header files //-------------------------------------------------------------------------- #include #include #include #include #include // PLplot header files (must occur before driver-dependent includes) #include "plDevs.h" #include "plplotP.h" #include "drivers.h" // Driver-dependent includes #if defined ( PLD_wincairo ) #include #endif #if defined ( PLD_xcairo ) #include #include #include #include #include #include #endif #if defined ( PLD_pdfcairo ) #include #endif #if defined ( PLD_pscairo ) #include #endif #if defined ( PLD_svgcairo ) #include #endif //-------------------------------------------------------------------------- // Constants & global (to this file) variables //-------------------------------------------------------------------------- #define DPI 72 #define PLCAIRO_DEFAULT_X 720 #define PLCAIRO_DEFAULT_Y 540 #define MAX_STRING_LEN 500 #define MAX_MARKUP_LEN MAX_STRING_LEN * 10 static int text_clipping; static int text_anti_aliasing; static int graphics_anti_aliasing; static int external_drawable; static int rasterize_image; static int set_background; static int image_buffering; static int already_warned = 0; static DrvOpt cairo_options[] = { { "text_clipping", DRV_INT, &text_clipping, "Use text clipping (text_clipping=0|1)" }, { "text_anti_aliasing", DRV_INT, &text_anti_aliasing, "Set desired text anti-aliasing (text_anti_aliasing=0|1|2|3). The numbers are in the same order as the cairo_antialias_t enumeration documented at http://cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t)" }, { "graphics_anti_aliasing", DRV_INT, &graphics_anti_aliasing, "Set desired graphics anti-aliasing (graphics_anti_aliasing=0|1|2|3). The numbers are in the same order as the cairo_antialias_t enumeration documented at http://cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t" }, { "external_drawable", DRV_INT, &external_drawable, "Plot to external X drawable" }, { "rasterize_image", DRV_INT, &rasterize_image, "Raster or vector image rendering (rasterize_image=0|1)" }, { "set_background", DRV_INT, &set_background, "Set the background for the extcairo device (set_background=0|1). If 1 then the plot background will set by PLplot" }, { "image_buffering", DRV_INT, &image_buffering, "Buffered offscreen rendering for the xcairo device (image_buffering=0|1)." }, { NULL, DRV_INT, NULL, NULL } }; typedef struct { cairo_surface_t *cairoSurface; cairo_t *cairoContext; cairo_surface_t *cairoSurface_raster; cairo_t *cairoContext_raster; short text_clipping; short text_anti_aliasing; short graphics_anti_aliasing; short rasterize_image; short set_background; short image_buffering; double downscale; char *pangoMarkupString; short upDown; float fontSize; short uline; // These are arguments for plP_script_scale which must be retained // in aStream for the alt_unicode approach. level has an // identical meaning to upDown above, but it is incremented and // decremented in plP_script_scale as well as other places in the // code so the only safe thing to do is to treat level separately // from upDown. PLFLT old_sscale, sscale, old_soffset, soffset; PLINT level; #if defined ( PLD_xcairo ) cairo_surface_t *cairoSurface_X; cairo_t *cairoContext_X; short exit_event_loop; Display *XDisplay; Window XWindow; unsigned int xdrawable_mode; #endif #if defined ( PLD_memcairo ) unsigned char *memory; unsigned char *cairo_format_memory; char bigendian; #endif #if defined ( PLD_wincairo ) cairo_surface_t *cairoSurface_win; cairo_t *cairoContext_win; WNDCLASSEX wndclass; HWND hwnd; MSG msg; HDC hdc; HDC SCRN_hdc; COLORREF oldcolour; RECT rect; #endif } PLCairo; PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_cairo = #if defined ( PLD_xcairo ) "xcairo:Cairo X Windows Driver:1:cairo:100:xcairo\n" #endif #if defined ( PLD_pdfcairo ) "pdfcairo:Cairo PDF Driver:0:cairo:101:pdfcairo\n" #endif #if defined ( PLD_pscairo ) "pscairo:Cairo PS Driver:0:cairo:102:pscairo\n" #endif #if defined ( PLD_epscairo ) "epscairo:Cairo EPS Driver:0:cairo:103:epscairo\n" #endif #if defined ( PLD_svgcairo ) "svgcairo:Cairo SVG Driver:0:cairo:104:svgcairo\n" #endif #if defined ( PLD_pngcairo ) "pngcairo:Cairo PNG Driver:0:cairo:105:pngcairo\n" #endif #if defined ( PLD_memcairo ) "memcairo:Cairo Memory Driver:0:cairo:106:memcairo\n" #endif #if defined ( PLD_extcairo ) "extcairo:Cairo External Context Driver:0:cairo:107:extcairo\n" #endif #if defined ( PLD_wincairo ) "wincairo:Cairo Microscoft Windows Driver:0:cairo:108:wincairo\n" #endif ; // // Structure for passing external drawables to xcairo devices via // the PLESC_DEVINIT escape function. // #if defined ( PLD_xcairo ) typedef struct { Display *display; Drawable drawable; } PLXcairoDrawableInfo; #endif //-------------------------------------------------------------------------- // Font style and weight lookup tables (copied // from the psttf driver). //-------------------------------------------------------------------------- #define NPANGOLOOKUP 5 const char *defaultFamilyLookup[NPANGOLOOKUP] = { "sans", "serif", "monospace", "sans,serif", "sans,serif" }; const char *envFamilyLookup[NPANGOLOOKUP] = { "PLPLOT_FREETYPE_SANS_FAMILY", "PLPLOT_FREETYPE_SERIF_FAMILY", "PLPLOT_FREETYPE_MONO_FAMILY", "PLPLOT_FREETYPE_SCRIPT_FAMILY", "PLPLOT_FREETYPE_SYMBOL_FAMILY" }; #define FAMILY_LOOKUP_LEN 1024 char familyLookup[NPANGOLOOKUP][FAMILY_LOOKUP_LEN]; #define TAG_LEN 200 const char *weightLookup[2] = { "normal", "bold" }; const char *styleLookup[3] = { "normal", "italic", "oblique" }; //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is common to all the Cairo Drivers // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // function declarations //-------------------------------------------------------------------------- // General PLCairo *stream_and_font_setup( PLStream *, int ); cairo_status_t write_to_stream( void *, unsigned char *, unsigned int ); void set_clip( PLStream *pls ); int cairo_family_check( PLStream *pls ); // String processing static void proc_str( PLStream *, EscText * ); static void text_begin_cairo( PLStream *pls, EscText *args ); static void text_char_cairo( PLStream *pls, EscText *args ); static void text_esc_cairo( PLStream *pls, EscText *args ); static void text_end_cairo( PLStream *pls, EscText *args ); static char *ucs4_to_pango_markup_format( PLUNICODE *, int, float ); static void open_span_tag( char *, PLUNICODE, float, int ); static void close_span_tag( char *, int ); static char *rise_span_tag( int, float, float, float ); // Graphics static void set_current_context( PLStream * ); static void poly_line( PLStream *, short *, short *, PLINT ); static void filled_polygon( PLStream *pls, short *xa, short *ya, PLINT npts ); static void gradient( PLStream *pls, short *xa, short *ya, PLINT npts ); static void arc( PLStream *, arc_struct * ); static void rotate_cairo_surface( PLStream *, float, float, float, float, float, float, PLBOOL ); static void blit_to_x( PLStream *pls, double x, double y, double w, double h ); // Rasterization of plotted material static void start_raster( PLStream* ); static void end_raster( PLStream* ); // Get/set drawing mode static void set_mode( PLStream*, PLINT* ); static void get_mode( PLStream*, PLINT* ); // Get / set line properties void get_line_properties( PLCairo *aStream, cairo_line_join_t *join, cairo_line_cap_t *cap ); void set_line_properties( PLCairo *aStream, cairo_line_join_t join, cairo_line_cap_t cap ); // PLplot interface functions // general void plD_bop_cairo( PLStream * ); void plD_eop_cairo( PLStream * ); void plD_state_cairo( PLStream *, PLINT ); void plD_esc_cairo( PLStream *, PLINT, void * ); void plD_tidy_cairo( PLStream * ); void plD_line_cairo( PLStream *, short, short, short, short ); void plD_polyline_cairo( PLStream *, short *, short *, PLINT ); //-------------------------------------------------------------------------- // start_raster() // // Set up off-screen rasterized rendering //-------------------------------------------------------------------------- void start_raster( PLStream *pls ) { PLCairo *aStream; cairo_surface_t *tmp_sfc; cairo_t *tmp_context; aStream = (PLCairo *) pls->dev; // Do not use the external surface if the user says not to if ( !aStream->rasterize_image ) return; // Create an image surface and context for the offscreen rendering aStream->cairoSurface_raster = // // cairo_surface_create_similar( aStream->cairoSurface, // CAIRO_CONTENT_COLOR, // pls->xlength, pls->ylength ); // cairo_image_surface_create( CAIRO_FORMAT_ARGB32, pls->xlength, pls->ylength ); aStream->cairoContext_raster = cairo_create( aStream->cairoSurface_raster ); // Disable antialiasing for the raster surface. The output seems to look // better that way. cairo_set_antialias( aStream->cairoContext_raster, CAIRO_ANTIALIAS_NONE ); // Swap the raster and main plot surfaces and contexts tmp_sfc = aStream->cairoSurface; tmp_context = aStream->cairoContext; aStream->cairoSurface = aStream->cairoSurface_raster; aStream->cairoContext = aStream->cairoContext_raster; // Save the main plot surface and context for when we are finished aStream->cairoSurface_raster = tmp_sfc; aStream->cairoContext_raster = tmp_context; } //-------------------------------------------------------------------------- // end_raster() // // Finish off-screen rasterized rendering and copy the result on to the // main plot surface. //-------------------------------------------------------------------------- void end_raster( PLStream *pls ) { PLCairo *aStream; cairo_surface_t *tmp_sfc; cairo_t *tmp_context; aStream = (PLCairo *) pls->dev; // TODO FIXME: This should really only copy the used portion of the // offscreen pixmap. // Do not use the external surface if the user says not to if ( !aStream->rasterize_image ) return; // Some Cairo devices support delayed device setup (eg: xcairo with // external drawable and extcairo with an external context). if ( aStream->cairoContext == NULL ) plexit( "Can not plot to a Cairo device with no context" ); // Restore the main plot surface and context for future plotting tmp_sfc = aStream->cairoSurface; tmp_context = aStream->cairoContext; aStream->cairoSurface = aStream->cairoSurface_raster; aStream->cairoContext = aStream->cairoContext_raster; aStream->cairoSurface_raster = tmp_sfc; aStream->cairoContext_raster = tmp_context; // Blit the raster surface on to the main plot cairo_set_source_surface( aStream->cairoContext, aStream->cairoSurface_raster, 0.0, 0.0 ); cairo_paint( aStream->cairoContext ); // Free the now extraneous surface and context cairo_destroy( aStream->cairoContext_raster ); cairo_surface_destroy( aStream->cairoSurface_raster ); } //-------------------------------------------------------------------------- // plD_bop_cairo() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_cairo( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Some Cairo devices support delayed device setup (eg: xcairo with // external drawable and extcairo with an external context). if ( aStream->cairoContext == NULL ) return; // Fill in the window with the background color. cairo_rectangle( aStream->cairoContext, 0.0, 0.0, pls->xlength, pls->ylength ); if ( (double) pls->cmap0[0].a < 1.0 ) { cairo_set_source_rgba( aStream->cairoContext, 1.0, 1.0, 1.0, 1.0 ); cairo_fill_preserve( aStream->cairoContext ); } cairo_set_source_rgba( aStream->cairoContext, (double) pls->cmap0[0].r / 255.0, (double) pls->cmap0[0].g / 255.0, (double) pls->cmap0[0].b / 255.0, (double) pls->cmap0[0].a ); cairo_fill( aStream->cairoContext ); } //-------------------------------------------------------------------------- // plD_line_cairo() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // (get|set)_line_properties // // (Get|Set) the current Cairo line drawing properties. //-------------------------------------------------------------------------- void get_line_properties( PLCairo *aStream, cairo_line_join_t *join, cairo_line_cap_t *cap ) { *join = cairo_get_line_join( aStream->cairoContext ); *cap = cairo_get_line_cap( aStream->cairoContext ); } void set_line_properties( PLCairo *aStream, cairo_line_join_t join, cairo_line_cap_t cap ) { cairo_set_line_join( aStream->cairoContext, join ); cairo_set_line_cap( aStream->cairoContext, cap ); } void plD_line_cairo( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; set_current_context( pls ); cairo_save( aStream->cairoContext ); set_line_properties( aStream, CAIRO_LINE_JOIN_BEVEL, CAIRO_LINE_CAP_ROUND ); cairo_move_to( aStream->cairoContext, aStream->downscale * (double) x1a, aStream->downscale * (double) y1a ); cairo_line_to( aStream->cairoContext, aStream->downscale * (double) x2a, aStream->downscale * (double) y2a ); cairo_stroke( aStream->cairoContext ); cairo_restore( aStream->cairoContext ); } //-------------------------------------------------------------------------- // plD_polyline_cairo() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_cairo( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; cairo_save( aStream->cairoContext ); set_line_properties( aStream, CAIRO_LINE_JOIN_BEVEL, CAIRO_LINE_CAP_BUTT ); poly_line( pls, xa, ya, npts ); cairo_stroke( aStream->cairoContext ); cairo_restore( aStream->cairoContext ); } //-------------------------------------------------------------------------- // plD_eop_cairo() // // Generic end of page. //-------------------------------------------------------------------------- void plD_eop_cairo( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; cairo_show_page( aStream->cairoContext ); } //-------------------------------------------------------------------------- // plD_tidy_cairo() // // General: Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_cairo( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Free the cairo context and surface. cairo_destroy( aStream->cairoContext ); cairo_surface_destroy( aStream->cairoSurface ); plCloseFile( pls ); } //-------------------------------------------------------------------------- // plD_state_cairo() // // Handle change in PLStream state (color, pen width, fill attribute, etc). // // Nothing is done here because these attributes are acquired from // PLStream for each element that is drawn. //-------------------------------------------------------------------------- void plD_state_cairo( PLStream * PL_UNUSED( pls ), PLINT PL_UNUSED( op ) ) { } //-------------------------------------------------------------------------- // plD_esc_cairo() // // Generic escape function. //-------------------------------------------------------------------------- void plD_esc_cairo( PLStream *pls, PLINT op, void *ptr ) { //PLCairo *aStream; //aStream = (PLCairo *) pls->dev; switch ( op ) { case PLESC_FILL: // filled polygon filled_polygon( pls, pls->dev_x, pls->dev_y, pls->dev_npts ); break; case PLESC_GRADIENT: // render a gradient within a polygon. gradient( pls, pls->dev_x, pls->dev_y, pls->dev_npts ); break; case PLESC_HAS_TEXT: if ( !pls->alt_unicode ) { proc_str( pls, (EscText *) ptr ); } break; case PLESC_BEGIN_TEXT: // get ready to get a handle a string of text text_begin_cairo( pls, (EscText *) ptr ); break; case PLESC_TEXT_CHAR: // handle a character of text to display text_char_cairo( pls, (EscText *) ptr ); break; case PLESC_CONTROL_CHAR: // handle a control character (super/subscript of fontchange) text_esc_cairo( pls, (EscText *) ptr ); break; case PLESC_END_TEXT: // finish a string of text text_end_cairo( pls, (EscText *) ptr ); break; case PLESC_START_RASTERIZE: // Start offscreen/rasterized rendering start_raster( pls ); break; case PLESC_END_RASTERIZE: // End offscreen/rasterized rendering end_raster( pls ); break; case PLESC_ARC: // Draw an arc, either filled or outline arc( pls, (arc_struct *) ptr ); break; case PLESC_MODESET: // Set drawing mode set_mode( pls, (int *) ptr ); break; case PLESC_MODEGET: // Get drawing mode get_mode( pls, (int *) ptr ); break; } } //-------------------------------------------------------------------------- // set_mode // // Set drawing mode. //-------------------------------------------------------------------------- void set_mode( PLStream *pls, PLINT *mode ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; switch ( *mode ) { case PL_DRAWMODE_UNKNOWN: // Invalid - do nothing break; case PL_DRAWMODE_DEFAULT: cairo_set_operator( aStream->cairoContext, CAIRO_OPERATOR_OVER ); break; case PL_DRAWMODE_REPLACE: cairo_set_operator( aStream->cairoContext, CAIRO_OPERATOR_SOURCE ); break; case PL_DRAWMODE_XOR: cairo_set_operator( aStream->cairoContext, CAIRO_OPERATOR_XOR ); break; } return; } //-------------------------------------------------------------------------- // get_mode // // Get drawing mode. //-------------------------------------------------------------------------- void get_mode( PLStream *pls, PLINT *mode ) { PLCairo *aStream; cairo_operator_t op; aStream = (PLCairo *) pls->dev; op = cairo_get_operator( aStream->cairoContext ); switch ( op ) { case CAIRO_OPERATOR_OVER: *mode = PL_DRAWMODE_DEFAULT; break; case CAIRO_OPERATOR_SOURCE: *mode = PL_DRAWMODE_REPLACE; break; case CAIRO_OPERATOR_XOR: *mode = PL_DRAWMODE_XOR; break; default: *mode = PL_DRAWMODE_UNKNOWN; } return; } //-------------------------------------------------------------------------- // text_begin_cairo() // // Begin text. //-------------------------------------------------------------------------- void text_begin_cairo( PLStream *pls, EscText *args ) { int i; PLCairo *aStream; aStream = (PLCairo *) pls->dev; aStream->upDown = 0; aStream->uline = 0; aStream->level = 0; aStream->pangoMarkupString = (char *) malloc( sizeof ( char ) * MAX_MARKUP_LEN ); // Calculate the font size (in points since DPI = 72). aStream->fontSize = (float) ( pls->chrht * DPI / 25.4 ); for ( i = 0; i < MAX_MARKUP_LEN; i++ ) { aStream->pangoMarkupString[i] = 0; } open_span_tag( aStream->pangoMarkupString, args->n_fci, aStream->fontSize, 0 ); } //-------------------------------------------------------------------------- // text_char_cairo() // // Add text. //-------------------------------------------------------------------------- void text_char_cairo( PLStream *pls, EscText *args ) { char utf8[5]; PLCairo *aStream; aStream = (PLCairo *) pls->dev; // make sure we are not too close to the end of the string if ( strlen( aStream->pangoMarkupString ) < ( MAX_MARKUP_LEN - 50 ) ) { switch ( args->n_char ) { case 38: strncat( aStream->pangoMarkupString, "&", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); break; case 60: strncat( aStream->pangoMarkupString, "<", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); break; case 62: strncat( aStream->pangoMarkupString, ">", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); break; default: ucs4_to_utf8( args->n_char, utf8 ); strncat( aStream->pangoMarkupString, utf8, MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); break; } } } //-------------------------------------------------------------------------- // text_esc_cairo() // // A font change, superscript, subscript, etc... //-------------------------------------------------------------------------- void text_esc_cairo( PLStream *pls, EscText *args ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; switch ( args->n_ctrl_char ) { case PLTEXT_FONTCHANGE: close_span_tag( aStream->pangoMarkupString, aStream->upDown ); open_span_tag( aStream->pangoMarkupString, args->n_fci, aStream->fontSize, aStream->upDown ); break; case PLTEXT_SUPERSCRIPT: if ( aStream->upDown < 0 ) { strncat( aStream->pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); aStream->level++; } else { plP_script_scale( TRUE, &aStream->level, &aStream->old_sscale, &aStream->sscale, &aStream->old_soffset, &aStream->soffset ); strncat( aStream->pangoMarkupString, rise_span_tag( TRUE, aStream->fontSize, (float) aStream->sscale, (float) aStream->soffset ), MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); } aStream->upDown++; break; case PLTEXT_SUBSCRIPT: if ( aStream->upDown > 0 ) { strncat( aStream->pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); aStream->level--; } else { plP_script_scale( FALSE, &aStream->level, &aStream->old_sscale, &aStream->sscale, &aStream->old_soffset, &aStream->soffset ); strncat( aStream->pangoMarkupString, rise_span_tag( FALSE, aStream->fontSize, (float) aStream->sscale, (float) aStream->soffset ), MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); } aStream->upDown--; break; case PLTEXT_UNDERLINE: if ( aStream->uline == 1 ) { strncat( aStream->pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); aStream->level++; } else { strncat( aStream->pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( aStream->pangoMarkupString ) ); aStream->level++; } aStream->uline = !aStream->uline; break; case PLTEXT_BACKCHAR: case PLTEXT_OVERLINE: plwarn( "'-', and 'b/B' text escape sequences not processed." ); break; } } //-------------------------------------------------------------------------- // text_end_cairo() // // Draw the text and clean up. //-------------------------------------------------------------------------- void text_end_cairo( PLStream *pls, EscText *args ) { int textXExtent, textYExtent, baseline; PLFLT rotation, shear, stride, cos_rot, sin_rot, cos_shear, sin_shear; cairo_matrix_t *cairoTransformMatrix; cairo_font_options_t *cairoFontOptions; PangoContext *context; PangoLayout *layout; PLCairo *aStream; aStream = (PLCairo *) pls->dev; set_current_context( pls ); // Close the last span tag. close_span_tag( aStream->pangoMarkupString, aStream->upDown ); // printf("%s\n", aStream->pangoMarkupString); // Create the Pango text layout so we can figure out how big it is layout = pango_cairo_create_layout( aStream->cairoContext ); pango_layout_set_markup( layout, aStream->pangoMarkupString, -1 ); pango_layout_get_pixel_size( layout, &textXExtent, &textYExtent ); baseline = pango_layout_get_baseline( layout ); // If asked, set the string length (in mm) and return if ( pls->get_string_length ) { pls->string_length = (PLFLT) textXExtent * 25.4 / DPI; } else { // Set font aliasing context = pango_layout_get_context( layout ); cairoFontOptions = cairo_font_options_create(); cairo_font_options_set_antialias( cairoFontOptions, aStream->text_anti_aliasing ); pango_cairo_context_set_font_options( context, cairoFontOptions ); pango_layout_context_changed( layout ); cairo_font_options_destroy( cairoFontOptions ); // Save current transform matrix & clipping region cairo_save( aStream->cairoContext ); // Set up the clipping region if we are doing text clipping if ( aStream->text_clipping ) { set_clip( pls ); } // Move to the string reference point cairo_move_to( aStream->cairoContext, aStream->downscale * (double) args->x, aStream->downscale * (double) args->y ); // Invert the coordinate system so that the text is drawn right side up cairoTransformMatrix = (cairo_matrix_t *) malloc( sizeof ( cairo_matrix_t ) ); cairo_matrix_init( cairoTransformMatrix, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ); cairo_transform( aStream->cairoContext, cairoTransformMatrix ); // Extract rotation angle and shear from the PLplot tranformation matrix. // Compute sines and cosines of the angles as an optimization. plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * PI / 2.0; cos_rot = cos( rotation ); sin_rot = sin( rotation ); cos_shear = cos( shear ); sin_shear = sin( shear ); // Apply the transform matrix cairo_matrix_init( cairoTransformMatrix, cos_rot * stride, -sin_rot * stride, cos_rot * sin_shear + sin_rot * cos_shear, -sin_rot * sin_shear + cos_rot * cos_shear, 0, 0 ); cairo_transform( aStream->cairoContext, cairoTransformMatrix ); free( cairoTransformMatrix ); // Move to the text starting point // printf("baseline %d %d\n", baseline, textYExtent); cairo_rel_move_to( aStream->cairoContext, (double) ( -1.0 * args->just * (double) textXExtent ), (double) 0.5 * aStream->fontSize - baseline / 1024.0 ); // Render the text pango_cairo_show_layout( aStream->cairoContext, layout ); // Restore the transform matrix to its state prior to the text transform. cairo_restore( aStream->cairoContext ); } // Free the layout object and the markup string g_object_unref( layout ); free( aStream->pangoMarkupString ); } //-------------------------------------------------------------------------- // proc_str() // // Processes strings for display. //-------------------------------------------------------------------------- void proc_str( PLStream *pls, EscText *args ) { float fontSize; int textXExtent, textYExtent, baseline; char *textWithPangoMarkup; PLFLT rotation, shear, stride, cos_rot, sin_rot, cos_shear, sin_shear; cairo_matrix_t *cairoTransformMatrix; cairo_font_options_t *cairoFontOptions; PangoContext *context; PangoLayout *layout; PLCairo *aStream; aStream = (PLCairo *) pls->dev; set_current_context( pls ); // Check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to a cairo driver, ignoring\n" ); return; } // Check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= MAX_STRING_LEN ) { printf( "Sorry, the cairo drivers only handles strings of length < %d\n", MAX_STRING_LEN ); return; } // Calculate the font size (in points since DPI = 72). fontSize = (float) ( pls->chrht * DPI / 25.4 ); // Convert the escape characters into the appropriate Pango markup textWithPangoMarkup = ucs4_to_pango_markup_format( args->unicode_array, args->unicode_array_len, fontSize ); // Create the Pango text layout so we can figure out how big it is layout = pango_cairo_create_layout( aStream->cairoContext ); pango_layout_set_markup( layout, textWithPangoMarkup, -1 ); pango_layout_get_pixel_size( layout, &textXExtent, &textYExtent ); baseline = pango_layout_get_baseline( layout ); // If asked, set the string length (in mm) and return if ( pls->get_string_length ) { pls->string_length = (PLFLT) textXExtent * 25.4 / DPI; return; } // Set font aliasing context = pango_layout_get_context( layout ); cairoFontOptions = cairo_font_options_create(); cairo_font_options_set_antialias( cairoFontOptions, aStream->text_anti_aliasing ); pango_cairo_context_set_font_options( context, cairoFontOptions ); pango_layout_context_changed( layout ); cairo_font_options_destroy( cairoFontOptions ); // Save current transform matrix & clipping region cairo_save( aStream->cairoContext ); // Set up the clipping region if we are doing text clipping if ( aStream->text_clipping ) { set_clip( pls ); } // Move to the string reference point cairo_move_to( aStream->cairoContext, aStream->downscale * (double) args->x, aStream->downscale * (double) args->y ); // Invert the coordinate system so that the text is drawn right side up cairoTransformMatrix = (cairo_matrix_t *) malloc( sizeof ( cairo_matrix_t ) ); cairo_matrix_init( cairoTransformMatrix, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ); cairo_transform( aStream->cairoContext, cairoTransformMatrix ); // Extract rotation angle and shear from the PLplot tranformation matrix. // Compute sines and cosines of the angles as an optimization. plRotationShear( args->xform, &rotation, &shear, &stride ); rotation -= pls->diorot * PI / 2.0; cos_rot = cos( rotation ); sin_rot = sin( rotation ); cos_shear = cos( shear ); sin_shear = sin( shear ); // Apply the transform matrix cairo_matrix_init( cairoTransformMatrix, cos_rot * stride, -sin_rot * stride, cos_rot * sin_shear + sin_rot * cos_shear, -sin_rot * sin_shear + cos_rot * cos_shear, 0, 0 ); cairo_transform( aStream->cairoContext, cairoTransformMatrix ); free( cairoTransformMatrix ); // printf("baseline (ps) %d %d %f\n", baseline, textYExtent, aStream->fontSize); // Move to the text starting point cairo_rel_move_to( aStream->cairoContext, (double) ( -1.0 * args->just * (double) textXExtent ), (double) 0.5 * fontSize - baseline / 1024.0 ); // Render the text pango_cairo_show_layout( aStream->cairoContext, layout ); // Restore the transform matrix to its state prior to the text transform. cairo_restore( aStream->cairoContext ); // Free the layout object and the markup string. g_object_unref( layout ); free( textWithPangoMarkup ); } //-------------------------------------------------------------------------- // ucs4_to_pango_markup_format() // // Converts the plplot string (in ucs4) to a utf8 string that includes // pango markup. // // http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html //-------------------------------------------------------------------------- char *ucs4_to_pango_markup_format( PLUNICODE *ucs4, int ucs4Len, float fontSize ) { char plplotEsc; int i; int upDown = 0; PLUNICODE fci; char utf8[5]; char *pangoMarkupString; PLFLT old_sscale, sscale, old_soffset, soffset; PLINT level = 0; short uline = 0; // Will this be big enough? We might have lots of markup. pangoMarkupString = (char *) malloc( sizeof ( char ) * MAX_MARKUP_LEN ); for ( i = 0; i < MAX_MARKUP_LEN; i++ ) { pangoMarkupString[i] = 0; } // Get PLplot escape character plgesc( &plplotEsc ); // Get the curent font and open the first span tag plgfci( &fci ); open_span_tag( pangoMarkupString, fci, fontSize, 0 ); // Parse the string to generate the tags i = 0; while ( i < ucs4Len ) { // Try to avoid going off the end of the string if ( strlen( pangoMarkupString ) > ( MAX_MARKUP_LEN - 50 ) ) { continue; } if ( ucs4[i] < PL_FCI_MARK ) // not a font change { if ( ucs4[i] != (PLUNICODE) plplotEsc ) // a character to display { // we have to handle "<", ">" and "&" separately since they throw off the XML switch ( ucs4[i] ) { case 38: strncat( pangoMarkupString, "&", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); break; case 60: strncat( pangoMarkupString, "<", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); break; case 62: strncat( pangoMarkupString, ">", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); break; default: ucs4_to_utf8( ucs4[i], utf8 ); strncat( pangoMarkupString, utf8, MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); break; } i++; continue; } i++; if ( ucs4[i] == (PLUNICODE) plplotEsc ) // a escape character to display { ucs4_to_utf8( ucs4[i], utf8 ); strncat( pangoMarkupString, utf8, MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); i++; continue; } else { if ( ucs4[i] == (PLUNICODE) 'u' ) // Superscript { if ( upDown < 0 ) { strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); level++; } else { plP_script_scale( TRUE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); strncat( pangoMarkupString, rise_span_tag( TRUE, fontSize, (float) sscale, (float) soffset ), MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); } upDown++; } if ( ucs4[i] == (PLUNICODE) 'd' ) // Subscript { if ( upDown > 0 ) { strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); level--; } else { plP_script_scale( FALSE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); strncat( pangoMarkupString, rise_span_tag( FALSE, fontSize, (float) sscale, (float) soffset ), MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); } upDown--; } if ( ucs4[i] == (PLUNICODE) '-' ) // Superscript { if ( uline == 1 ) { strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); level++; } else { strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); } uline = uline; } i++; } } else // a font change { close_span_tag( pangoMarkupString, upDown ); open_span_tag( pangoMarkupString, ucs4[i], fontSize, upDown ); i++; } } // Close the last span tag. close_span_tag( pangoMarkupString, upDown ); // printf("%s\n", pangoMarkupString); return pangoMarkupString; } //-------------------------------------------------------------------------- // open_span_tag // // 1. Opens a span tag with the appropriate font description given the // current fci. // 2. Add the appropriate number of or tags to bring us // back to our current sub/super-script level. //-------------------------------------------------------------------------- void open_span_tag( char *pangoMarkupString, PLUNICODE fci, float fontSize, int upDown ) { unsigned char fontFamily, fontStyle, fontWeight; char openTag[TAG_LEN]; int upDown_level; PLFLT old_sscale, sscale, old_soffset, soffset; PLINT level = 0.; // Generate the font info for the open tag & concatenate this // onto the markup string. plP_fci2hex( fci, &fontFamily, PL_FCI_FAMILY ); plP_fci2hex( fci, &fontStyle, PL_FCI_STYLE ); plP_fci2hex( fci, &fontWeight, PL_FCI_WEIGHT ); // From http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html // size = font size in 1024ths of a point. snprintf( openTag, TAG_LEN, "", weightLookup[fontWeight] ); strncat( pangoMarkupString, openTag, MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); // Move to the right superscript/subscript level for ( upDown_level = 0; upDown_level < upDown; upDown_level++ ) { plP_script_scale( TRUE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); strncat( pangoMarkupString, rise_span_tag( TRUE, fontSize, (float) sscale, (float) soffset ), MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); } for ( upDown_level = 0; upDown_level > upDown; upDown_level-- ) { plP_script_scale( FALSE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); strncat( pangoMarkupString, rise_span_tag( FALSE, fontSize, (float) sscale, (float) soffset ), MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); } } //-------------------------------------------------------------------------- // close_span_tag // // Close a span tag & brings us down to zero sub/super-script level. //-------------------------------------------------------------------------- void close_span_tag( char *pangoMarkupString, int upDown ) { if ( upDown > 0 ) { while ( upDown > 0 ) { strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); upDown--; } } if ( upDown < 0 ) { while ( upDown < 0 ) { strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); upDown++; } } strncat( pangoMarkupString, "", MAX_MARKUP_LEN - 1 - strlen( pangoMarkupString ) ); } // 0.8 mimics the offset of first superscript/subscript level implemented // in plstr (plsym.c) for Hershey fonts. Indeed when comparing with // -dev xwin results this factor appears to offset the centers of the // letters appropriately (but not their edges since different font sizes // are involved). # define RISE_FACTOR 0.8 //-------------------------------------------------------------------------- // rise_span_tag // // Create a rise span tag w/ appropriate font size & baseline offset // fontSize is the baseline font size in points (1/72 of an inch), // multiplier is a scaling factor for that font size for superscript // or subscript, and rise is the vertical offset (in units of font // size) for that superscript or subscript. //-------------------------------------------------------------------------- char *rise_span_tag( int ifsuperscript, float fontSize, float multiplier, float rise ) { float offset; static char tag[100]; // http://developer.gnome.org/pango/unstable/PangoMarkupFormat.html says // rise should be in units of 10000 em's, but empirical evidence shows // it is in units of 1024th of a point. Therefore, since FontSize // is in points, a rise of 1024. * fontSize corresponds a rise of // a full character height. rise = 1024.f * fontSize * (float) RISE_FACTOR * rise; // This is the correction for the difference between baseline and // middle coordinate systems. This offset should be // 0.5*(fontSize - superscript/subscript fontSize). offset = 1024.f * 0.5f * fontSize * ( 1.0f - multiplier ); if ( ifsuperscript ) { sprintf( tag, "", (int) ( rise + offset ), (int) ( fontSize * 1024. * multiplier ) ); } else { sprintf( tag, "", (int) -( rise - offset ), (int) ( fontSize * 1024. * multiplier ) ); } return ( tag ); } //-------------------------------------------------------------------------- // write_to_stream() // // Writes data to a open file stream. This function is passed to the // Cairo file IO devices. //-------------------------------------------------------------------------- cairo_status_t write_to_stream( void *filePointer, unsigned char *data, unsigned int length ) { unsigned int bytes_written; bytes_written = (unsigned int) fwrite( data, 1, (size_t) length, (FILE *) filePointer ); if ( bytes_written == length ) { return CAIRO_STATUS_SUCCESS; } else { return CAIRO_STATUS_WRITE_ERROR; } } //-------------------------------------------------------------------------- // stream_and_font_setup() // // Initializes the PLStream structure for the cairo devices. // Initializes the font lookup table. // Checks for cairo specific user options. // Returns a new PLCairo structure. //-------------------------------------------------------------------------- PLCairo *stream_and_font_setup( PLStream *pls, int interactive ) { int i; char *a; PLCairo *aStream; PLFLT downscale; downscale = 0.0; // Stream setup pls->termin = interactive; // Interactive device pls->dev_flush = 1; // Handles flushes pls->color = 1; // Supports color pls->dev_text = 1; // Handles text pls->dev_unicode = 1; // Wants unicode text pls->dev_clear = 0; pls->alt_unicode = 1; // Wants to handle unicode character by character pls->page = 0; pls->dev_fill0 = 1; // Supports hardware solid fills pls->dev_gradient = 1; // driver renders gradient pls->dev_arc = 1; // Supports driver-level arcs pls->plbuf_write = interactive; // Activate plot buffer pls->has_string_length = 1; // Driver supports string length calculations pls->dev_modeset = 1; // Driver supports drawing mode setting if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->xlength = PLCAIRO_DEFAULT_X; pls->ylength = PLCAIRO_DEFAULT_Y; } // Calculate ratio of (smaller) external coordinates used for cairo // devices to (larger) internal PLplot coordinates. if ( pls->xlength > pls->ylength ) downscale = (double) pls->xlength / (double) ( PIXELS_X - 1 ); else downscale = (double) pls->ylength / (double) PIXELS_Y; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / downscale ), (PLINT) 0, (PLINT) ( pls->ylength / downscale ) ); plP_setpxl( DPI / 25.4 / downscale, DPI / 25.4 / downscale ); // Initialize font table with either enviroment variables or defaults. // This was copied from the psttf driver. for ( i = 0; i < NPANGOLOOKUP; i++ ) { if ( ( a = getenv( envFamilyLookup[i] ) ) != NULL ) { strncpy( familyLookup[i], a, FAMILY_LOOKUP_LEN - 1 ); familyLookup[i][FAMILY_LOOKUP_LEN - 1] = '\0'; } else { strncpy( familyLookup[i], defaultFamilyLookup[i], FAMILY_LOOKUP_LEN - 1 ); familyLookup[i][FAMILY_LOOKUP_LEN - 1] = '\0'; } } // Allocate a cairo stream structure aStream = malloc( sizeof ( PLCairo ) ); #if defined ( PLD_xcairo ) aStream->XDisplay = NULL; aStream->XWindow = 0; #endif aStream->cairoSurface = NULL; aStream->cairoContext = NULL; aStream->downscale = downscale; // Set text clipping on by default since it makes little difference in // speed for a modern cairo stack. aStream->text_clipping = 1; text_clipping = 1; text_anti_aliasing = 0; // use 'default' text aliasing by default graphics_anti_aliasing = 0; // use 'default' graphics aliasing by default rasterize_image = 1; // Enable rasterization by default set_background = 0; // Default for extcairo is that PLplot not change the background image_buffering = 1; // Default to image-based buffered rendering // Check for cairo specific options plParseDrvOpts( cairo_options ); // Turn off text clipping if the user desires this if ( !text_clipping ) { aStream->text_clipping = 0; } // Record users desired text and graphics aliasing and rasterization aStream->text_anti_aliasing = (short) text_anti_aliasing; aStream->graphics_anti_aliasing = (short) graphics_anti_aliasing; aStream->rasterize_image = (short) rasterize_image; aStream->set_background = (short) set_background; aStream->image_buffering = (short) image_buffering; return aStream; } //-------------------------------------------------------------------------- // set_current_context() // // Updates the cairo graphics context with the current values in // PLStream. //-------------------------------------------------------------------------- void set_current_context( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; cairo_set_source_rgba( aStream->cairoContext, (double) pls->curcolor.r / 255.0, (double) pls->curcolor.g / 255.0, (double) pls->curcolor.b / 255.0, (double) pls->curcolor.a ); // In Cairo, zero width lines are not hairlines, they are completely invisible. if ( pls->width <= 0. ) { cairo_set_line_width( aStream->cairoContext, 1.0 ); } else { cairo_set_line_width( aStream->cairoContext, (double) pls->width ); } } //-------------------------------------------------------------------------- // poly_line() // // Draws a multi-segmented line. It is then up to the calling function // to decide whether to just draw the line, or fill in the area // enclosed by the line. //-------------------------------------------------------------------------- void poly_line( PLStream *pls, short *xa, short *ya, PLINT npts ) { int i; PLCairo *aStream; aStream = (PLCairo *) pls->dev; set_current_context( pls ); cairo_move_to( aStream->cairoContext, aStream->downscale * (double) xa[0], aStream->downscale * (double) ya[0] ); for ( i = 1; i < npts; i++ ) { cairo_line_to( aStream->cairoContext, aStream->downscale * (double) xa[i], aStream->downscale * (double) ya[i] ); } } //-------------------------------------------------------------------------- // filled_polygon() // // Draws a filled polygon. //-------------------------------------------------------------------------- void filled_polygon( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; cairo_save( aStream->cairoContext ); // Draw the polygons poly_line( pls, xa, ya, npts ); cairo_set_source_rgba( aStream->cairoContext, (double) pls->curcolor.r / 255.0, (double) pls->curcolor.g / 255.0, (double) pls->curcolor.b / 255.0, (double) pls->curcolor.a ); if ( cairo_get_antialias( aStream->cairoContext ) != CAIRO_ANTIALIAS_NONE ) { cairo_fill_preserve( aStream->cairoContext ); // These line properties make for a nicer looking polygon mesh set_line_properties( aStream, CAIRO_LINE_JOIN_BEVEL, CAIRO_LINE_CAP_BUTT ); // Comment out the following call to cairo_set_line width // since the hard-coded width value of 1.0 is not appropriate // for fills of small areas. Instead, use the line width that // has already been set by the user via the above call of // poly_line which in turn calls set_current_context which in // turn calls cairo_set_line_width for the user-specified // width. // cairo_set_line_width( aStream->cairoContext, 1.0 ); cairo_stroke( aStream->cairoContext ); } else { cairo_fill( aStream->cairoContext ); } cairo_restore( aStream->cairoContext ); } //-------------------------------------------------------------------------- // gradient() // // Render a gradient within a polygon. //-------------------------------------------------------------------------- void gradient( PLStream *pls, short *xa, short *ya, PLINT npts ) { int i; PLCairo *aStream; cairo_pattern_t *linear_gradient; aStream = (PLCairo *) pls->dev; // These line properties make for a nicer looking polygon mesh set_line_properties( aStream, CAIRO_LINE_JOIN_BEVEL, CAIRO_LINE_CAP_BUTT ); linear_gradient = cairo_pattern_create_linear( aStream->downscale * pls->xgradient[0], aStream->downscale * pls->ygradient[0], aStream->downscale * pls->xgradient[1], aStream->downscale * pls->ygradient[1] ); cairo_pattern_reference( linear_gradient ); for ( i = 0; i < pls->ncol1; i++ ) { cairo_pattern_add_color_stop_rgba( linear_gradient, (double) i / (double) ( pls->ncol1 - 1 ), (double) pls->cmap1[i].r / 255., (double) pls->cmap1[i].g / 255., (double) pls->cmap1[i].b / 255., (double) pls->cmap1[i].a ); } // Draw the polygon using the gradient. poly_line( pls, xa, ya, npts ); cairo_set_source( aStream->cairoContext, linear_gradient ); cairo_fill( aStream->cairoContext ); cairo_pattern_destroy( linear_gradient ); } //-------------------------------------------------------------------------- // set_clip() // // Set the clipping region to the plot window. // NOTE: cairo_save() and cairo_restore() should probably be called before // and after this, respectively. //-------------------------------------------------------------------------- void set_clip( PLStream *pls ) { PLINT rcx[4], rcy[4]; PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Use PLplot core routine to get the corners of the clipping rectangle difilt_clip( rcx, rcy ); // Layout the bounds of the clipping region // Should we convert PLINT to short and use the polyline routine? cairo_move_to( aStream->cairoContext, aStream->downscale * (double) rcx[0], aStream->downscale * (double) rcy[0] ); cairo_line_to( aStream->cairoContext, aStream->downscale * (double) rcx[1], aStream->downscale * (double) rcy[1] ); cairo_line_to( aStream->cairoContext, aStream->downscale * (double) rcx[2], aStream->downscale * (double) rcy[2] ); cairo_line_to( aStream->cairoContext, aStream->downscale * (double) rcx[3], aStream->downscale * (double) rcy[3] ); cairo_line_to( aStream->cairoContext, aStream->downscale * (double) rcx[0], aStream->downscale * (double) rcy[0] ); // Set the clipping region cairo_clip( aStream->cairoContext ); // Apparently, in some older Cairo versions, cairo_clip does not consume // the current path. cairo_new_path( aStream->cairoContext ); } //-------------------------------------------------------------------------- // cairo_family_check () // // support function to help supress more than one page if family file // output not specified by the user (e.g., with the -fam command-line option). //-------------------------------------------------------------------------- int cairo_family_check( PLStream *pls ) { if ( pls->family || pls->page == 1 ) { return 0; } else { if ( !already_warned ) { already_warned = 1; plwarn( "All pages after the first skipped because family file output not specified.\n" ); } return 1; } } //-------------------------------------------------------------------------- // arc() // // Draws an arc, possibly filled. //-------------------------------------------------------------------------- void arc( PLStream *pls, arc_struct *arc_info ) { PLCairo *aStream; double x, y, a, b; double angle1, angle2, rotate; set_current_context( pls ); aStream = (PLCairo *) pls->dev; // Scale to the proper Cairo coordinates x = aStream->downscale * arc_info->x; y = aStream->downscale * arc_info->y; a = aStream->downscale * arc_info->a; b = aStream->downscale * arc_info->b; // Degrees to radians angle1 = arc_info->angle1 * M_PI / 180.0; angle2 = arc_info->angle2 * M_PI / 180.0; rotate = arc_info->rotate * M_PI / 180.0; cairo_save( aStream->cairoContext ); // Clip the output to the plotting window set_clip( pls ); // Make sure the arc is properly shaped and oriented cairo_save( aStream->cairoContext ); cairo_translate( aStream->cairoContext, x, y ); cairo_rotate( aStream->cairoContext, rotate ); cairo_scale( aStream->cairoContext, a, b ); cairo_arc( aStream->cairoContext, 0.0, 0.0, 1.0, angle1, angle2 ); if ( arc_info->fill ) cairo_line_to( aStream->cairoContext, 0.0, 0.0 ); cairo_restore( aStream->cairoContext ); cairo_set_source_rgba( aStream->cairoContext, (double) pls->curcolor.r / 255.0, (double) pls->curcolor.g / 255.0, (double) pls->curcolor.b / 255.0, (double) pls->curcolor.a ); if ( arc_info->fill ) { cairo_fill( aStream->cairoContext ); } else { cairo_stroke( aStream->cairoContext ); } cairo_restore( aStream->cairoContext ); } //-------------------------------------------------------------------------- // rotate_cairo_surface() // // Rotates the cairo surface to the appropriate orientation. //-------------------------------------------------------------------------- void rotate_cairo_surface( PLStream *pls, float x11, float x12, float x21, float x22, float x0, float y0, PLBOOL is_xcairo ) { cairo_matrix_t *matrix; PLCairo *aStream; aStream = (PLCairo *) pls->dev; matrix = (cairo_matrix_t *) malloc( sizeof ( cairo_matrix_t ) ); cairo_matrix_init( matrix, x11, x12, x21, x22, x0, y0 ); #if defined ( PLD_xcairo ) if ( is_xcairo ) { cairo_transform( aStream->cairoContext_X, matrix ); } else { cairo_transform( aStream->cairoContext, matrix ); } #else cairo_transform( aStream->cairoContext, matrix ); #endif free( matrix ); } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is common to all familying Cairo Drivers // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_pngcairo ) || defined ( PLD_svgcairo ) || defined ( PLD_epscairo ) void plD_bop_cairo_fam( PLStream * ); void plD_eop_cairo_fam( PLStream * ); void plD_state_cairo_fam( PLStream *, PLINT ); void plD_esc_cairo_fam( PLStream *, PLINT, void * ); void plD_tidy_cairo_fam( PLStream * ); void plD_line_cairo_fam( PLStream *, short, short, short, short ); void plD_polyline_cairo_fam( PLStream *, short *, short *, PLINT ); //-------------------------------------------------------------------------- // plD_bop_cairo_fam() // // Familying Devices: Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_cairo_fam( PLStream *pls ) { PLCairo *aStream; // Plot familying stuff. Not really understood, just copying gd.c plGetFam( pls ); aStream = (PLCairo *) pls->dev; pls->famadv = 1; pls->page++; // Suppress multi-page output if family file output is not // specified by the user. if ( cairo_family_check( pls ) ) { return; } // Fill in the window with the background color. cairo_rectangle( aStream->cairoContext, 0.0, 0.0, pls->xlength, pls->ylength ); cairo_set_source_rgba( aStream->cairoContext, (double) pls->cmap0[0].r / 255.0, (double) pls->cmap0[0].g / 255.0, (double) pls->cmap0[0].b / 255.0, (double) pls->cmap0[0].a ); cairo_fill( aStream->cairoContext ); } //-------------------------------------------------------------------------- // plD_eop_cairo() // // End of page. //-------------------------------------------------------------------------- void plD_eop_cairo_fam( PLStream *pls ) { if ( cairo_family_check( pls ) ) { return; } plD_eop_cairo( pls ); } //-------------------------------------------------------------------------- // plD_state_cairo_fam() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_cairo_fam( PLStream *pls, PLINT op ) { if ( cairo_family_check( pls ) ) { return; } plD_state_cairo( pls, op ); } //-------------------------------------------------------------------------- // plD_esc_cairo_fam() // // Generic escape function. //-------------------------------------------------------------------------- void plD_esc_cairo_fam( PLStream *pls, PLINT op, void *ptr ) { if ( cairo_family_check( pls ) ) { return; } plD_esc_cairo( pls, op, ptr ); } //-------------------------------------------------------------------------- // plD_tidy_cairo_fam() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_cairo_fam( PLStream *pls ) { plD_tidy_cairo( pls ); } //-------------------------------------------------------------------------- // plD_line_cairo_fam() // // Draw a line. //-------------------------------------------------------------------------- void plD_line_cairo_fam( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { if ( cairo_family_check( pls ) ) { return; } plD_line_cairo( pls, x1a, y1a, x2a, y2a ); } //-------------------------------------------------------------------------- // plD_polyline_cairo_fam() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_cairo_fam( PLStream *pls, short *xa, short *ya, PLINT npts ) { if ( cairo_family_check( pls ) ) { return; } plD_polyline_cairo( pls, xa, ya, npts ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the xcairo driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_xcairo ) static int XScreen; static Window rootWindow; void plD_dispatch_init_xcairo( PLDispatchTable *pdt ); void plD_init_xcairo( PLStream * ); void plD_bop_xcairo( PLStream * ); void plD_eop_xcairo( PLStream * ); void plD_tidy_xcairo( PLStream * ); void plD_esc_xcairo( PLStream *, PLINT, void * ); static void xcairo_get_cursor( PLStream *, PLGraphicsIn * ); //-------------------------------------------------------------------------- // plD_dispatch_init_xcairo() // // xcairo dispatch table initialization. //-------------------------------------------------------------------------- void plD_dispatch_init_xcairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo X Windows Driver"; pdt->pl_DevName = "xcairo"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 100; pdt->pl_init = (plD_init_fp) plD_init_xcairo; pdt->pl_line = (plD_line_fp) plD_line_cairo; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; pdt->pl_eop = (plD_eop_fp) plD_eop_xcairo; pdt->pl_bop = (plD_bop_fp) plD_bop_xcairo; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_xcairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_xcairo; } //-------------------------------------------------------------------------- // xcairo_init_cairo() // // Configures Cairo to use whichever X Drawable is set up in the given // stream. This is called by plD_init_xcairo() in the event we are // drawing into a plplot-managed window, and plD_esc_xcairo() if // we are using an external X Drawable. // // A return value of 0 indicates success. Currently this function only // returns 0. //-------------------------------------------------------------------------- static signed int xcairo_init_cairo( PLStream *pls ) { PLCairo *aStream; Visual *defaultVisual; aStream = (PLCairo *) pls->dev; // Create an cairo surface & context that are associated with the X window. defaultVisual = DefaultVisual( aStream->XDisplay, 0 ); // Dimension units are pixels from cairo documentation. // This is the X window Cairo surface. aStream->cairoSurface_X = cairo_xlib_surface_create( aStream->XDisplay, aStream->XWindow, defaultVisual, pls->xlength, pls->ylength ); aStream->cairoContext_X = cairo_create( aStream->cairoSurface_X ); // This is the Cairo surface PLplot will actually plot to. if ( aStream->image_buffering == 0 ) { aStream->cairoSurface = cairo_surface_create_similar( aStream->cairoSurface_X, CAIRO_CONTENT_COLOR_ALPHA, pls->xlength, pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); } else { // Plot to an off-screen image aStream->cairoSurface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, pls->xlength, pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); } // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, (float) pls->ylength, TRUE ); // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); // Fill in the X window with the background color to avoid starting out // with a blank window of an unexpected color. cairo_rectangle( aStream->cairoContext_X, 0.0, 0.0, pls->xlength, pls->ylength ); cairo_set_source_rgba( aStream->cairoContext_X, (double) pls->cmap0[0].r / 255.0, (double) pls->cmap0[0].g / 255.0, (double) pls->cmap0[0].b / 255.0, (double) pls->cmap0[0].a ); cairo_fill( aStream->cairoContext_X ); XFlush( aStream->XDisplay ); return 0; } //-------------------------------------------------------------------------- // plD_init_xcairo() // // Initialize Cairo X Windows device. //-------------------------------------------------------------------------- void plD_init_xcairo( PLStream *pls ) { PLCairo *aStream; Atom wmDelete; // Setup the PLStream and the font lookup table. aStream = stream_and_font_setup( pls, 1 ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Create a X Window if required. if ( external_drawable != 0 ) { aStream->xdrawable_mode = 1; } else { // X Windows setup aStream->XDisplay = NULL; if ( pls->FileName != NULL ) aStream->XDisplay = XOpenDisplay( pls->FileName ); else aStream->XDisplay = XOpenDisplay( NULL ); if ( aStream->XDisplay == NULL ) { plexit( "Failed to open X Windows display\n" ); // some sort of error here } XScreen = DefaultScreen( aStream->XDisplay ); rootWindow = RootWindow( aStream->XDisplay, XScreen ); aStream->XWindow = XCreateSimpleWindow( aStream->XDisplay, rootWindow, 0, 0, (unsigned int) pls->xlength, (unsigned int) pls->ylength, 1, BlackPixel( aStream->XDisplay, XScreen ), BlackPixel( aStream->XDisplay, XScreen ) ); XStoreName( aStream->XDisplay, aStream->XWindow, pls->plwindow ); XSelectInput( aStream->XDisplay, aStream->XWindow, NoEventMask ); XMapWindow( aStream->XDisplay, aStream->XWindow ); aStream->xdrawable_mode = 0; wmDelete = XInternAtom( aStream->XDisplay, "WM_DELETE_WINDOW", True ); XSetWMProtocols( aStream->XDisplay, aStream->XWindow, &wmDelete, 1 ); xcairo_init_cairo( pls ); } aStream->exit_event_loop = 0; } //-------------------------------------------------------------------------- // blit_to_x() // // // Blit the offscreen image to the X window. //-------------------------------------------------------------------------- void blit_to_x( PLStream *pls, double x, double y, double w, double h ) { PLCairo *aStream; aStream = pls->dev; cairo_save( aStream->cairoContext ); // "Flatten" any transparent regions to look like they were drawn over the // correct background color cairo_rectangle( aStream->cairoContext, x, y, w, h ); cairo_set_operator( aStream->cairoContext, CAIRO_OPERATOR_DEST_OVER ); cairo_set_source_rgba( aStream->cairoContext, (double) pls->cmap0[0].r / 255.0, (double) pls->cmap0[0].g / 255.0, (double) pls->cmap0[0].b / 255.0, (double) pls->cmap0[0].a ); cairo_fill( aStream->cairoContext ); cairo_restore( aStream->cairoContext ); cairo_save( aStream->cairoContext_X ); // Copy a portion of the surface cairo_rectangle( aStream->cairoContext_X, x, y, w, h ); cairo_set_operator( aStream->cairoContext_X, CAIRO_OPERATOR_SOURCE ); cairo_set_source_surface( aStream->cairoContext_X, aStream->cairoSurface, 0.0, 0.0 ); cairo_fill( aStream->cairoContext_X ); cairo_restore( aStream->cairoContext_X ); } //-------------------------------------------------------------------------- // plD_bop_xcairo() // // X Windows specific start of page. //-------------------------------------------------------------------------- void plD_bop_xcairo( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; plD_bop_cairo( pls ); if ( aStream->xdrawable_mode ) return; XFlush( aStream->XDisplay ); } //-------------------------------------------------------------------------- // plD_eop_xcairo() // // X Windows specific end of page. //-------------------------------------------------------------------------- void plD_eop_xcairo( PLStream *pls ) { int number_chars; long event_mask; char event_string[10]; KeySym keysym; XComposeStatus cs; XEvent event; XExposeEvent *expose; PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Blit the offscreen image to the X window. blit_to_x( pls, 0.0, 0.0, pls->xlength, pls->ylength ); if ( aStream->xdrawable_mode ) return; // Only pause if nopause is unset. if ( pls->nopause ) aStream->exit_event_loop = 1; // Loop, handling selected events, till the user elects to close the plot. event_mask = ButtonPressMask | KeyPressMask | ExposureMask; XSelectInput( aStream->XDisplay, aStream->XWindow, event_mask ); while ( !aStream->exit_event_loop ) { //XWindowEvent( aStream->XDisplay, aStream->XWindow, event_mask, &event ); XNextEvent( aStream->XDisplay, &event ); switch ( event.type ) { case KeyPress: number_chars = XLookupString( (XKeyEvent *) &event, event_string, 10, &keysym, &cs ); event_string[number_chars] = '\0'; if ( keysym == XK_Return ) { aStream->exit_event_loop = 1; } break; case ButtonPress: if ( ( (XButtonEvent *) &event )->button == Button3 ) aStream->exit_event_loop = 1; break; case ClientMessage: // plexit("X Window closed"); pls->stream_closed = TRUE; aStream->exit_event_loop = 1; break; case Expose: // Blit the image again after an expose event, but only for the last // available event. Otherwise multiple redraws occur needlessly. expose = (XExposeEvent *) &event; if ( expose->count == 0 ) { blit_to_x( pls, expose->x, expose->y, expose->width, expose->height ); } break; } } aStream->exit_event_loop = 0; } //-------------------------------------------------------------------------- // plD_tidy_xcairo() // // X Windows: close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_xcairo( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; plD_tidy_cairo( pls ); // Also free up the Cairo X surface and context cairo_destroy( aStream->cairoContext_X ); cairo_surface_destroy( aStream->cairoSurface_X ); if ( aStream->xdrawable_mode ) return; // Close the window and the display. XFlush( aStream->XDisplay ); XDestroyWindow( aStream->XDisplay, aStream->XWindow ); XCloseDisplay( aStream->XDisplay ); } //-------------------------------------------------------------------------- // plD_esc_xcairo() // // Escape function, specialized for the xcairo driver //-------------------------------------------------------------------------- void plD_esc_xcairo( PLStream *pls, PLINT op, void *ptr ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; switch ( op ) { case PLESC_FLUSH: // forced update of the window blit_to_x( pls, 0.0, 0.0, pls->xlength, pls->ylength ); XFlush( aStream->XDisplay ); break; case PLESC_GETC: // get cursor position blit_to_x( pls, 0.0, 0.0, pls->xlength, pls->ylength ); XFlush( aStream->XDisplay ); xcairo_get_cursor( pls, (PLGraphicsIn *) ptr ); break; case PLESC_DEVINIT: { // Set external drawable Window rootwin; PLXcairoDrawableInfo *xinfo = (PLXcairoDrawableInfo *) ptr; signed int x, y; unsigned int w, h, b, d; if ( xinfo == NULL ) { printf( "xcairo: PLESC_DEVINIT ignored, no drawable info provided\n" ); return; } if ( aStream->xdrawable_mode == 0 ) { printf( "xcairo: PLESC_DEVINIT called with drawable but stream not in xdrawable mode\n" ); return; } aStream->XDisplay = xinfo->display; aStream->XWindow = xinfo->drawable; // Ensure plplot knows the real dimensions of the drawable XGetGeometry( aStream->XDisplay, aStream->XWindow, &rootwin, &x, &y, &w, &h, &b, &d ); pls->xlength = (PLINT) w; pls->ylength = (PLINT) h; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / aStream->downscale ), (PLINT) 0, (PLINT) ( pls->ylength / aStream->downscale ) ); // Associate cairo with the supplied drawable xcairo_init_cairo( pls ); // Recalculate dimensions and the like now that the drawable is known plbop(); break; } default: plD_esc_cairo( pls, op, ptr ); break; } } //-------------------------------------------------------------------------- // xcairo_get_cursor() // // X Windows: returns the location of the next mouse click or key press. //-------------------------------------------------------------------------- void xcairo_get_cursor( PLStream *pls, PLGraphicsIn *gin ) { const char *ksname; char str[257]; KeySym keysym; XEvent event; XButtonEvent *xButtonEvent; Cursor xHairCursor; PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Initialize PLplot mouse event structure plGinInit( gin ); // Create cross hair cursor & switch to using it xHairCursor = XCreateFontCursor( aStream->XDisplay, XC_crosshair ); XDefineCursor( aStream->XDisplay, aStream->XWindow, xHairCursor ); // Get the next mouse button release or key press event XSelectInput( aStream->XDisplay, aStream->XWindow, ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | ButtonMotionMask ); XMaskEvent( aStream->XDisplay, ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | ButtonMotionMask, &event ); XSelectInput( aStream->XDisplay, aStream->XWindow, NoEventMask ); // Update PLplot's mouse event structure xButtonEvent = (XButtonEvent *) &event; gin->state = xButtonEvent->state; gin->button = xButtonEvent->button; gin->pX = event.xbutton.x; gin->pY = pls->ylength - event.xbutton.y; gin->dX = (PLFLT) event.xbutton.x / ( (PLFLT) ( pls->xlength ) ); gin->dY = (PLFLT) ( pls->ylength - event.xbutton.y ) / ( (PLFLT) ( pls->ylength ) ); // Get key pressed (if any) if ( event.type == KeyPress || event.type == KeyRelease ) { XLookupString( (XKeyEvent *) &event, str, 100, &keysym, NULL ); if ( keysym == NoSymbol ) ksname = "NoSymbol"; else if ( !( ksname = XKeysymToString( keysym ) ) ) ksname = "(no name)"; strcpy( gin->string, ksname ); // gin->string[number_chars] = '\0'; switch ( keysym ) { case XK_BackSpace: case XK_Tab: case XK_Linefeed: case XK_Return: case XK_Escape: case XK_Delete: gin->keysym = 0xFF & keysym; break; default: gin->keysym = (unsigned int) keysym; } } else // button press { sprintf( gin->string, "button %u", gin->button ); gin->keysym = 0x20; } // Switch back to normal cursor XUndefineCursor( aStream->XDisplay, aStream->XWindow ); XFlush( aStream->XDisplay ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo PDF driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_pdfcairo ) void plD_dispatch_init_pdfcairo( PLDispatchTable *pdt ); void plD_init_pdfcairo( PLStream * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // pdfcairo void plD_dispatch_init_pdfcairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo PDF Driver"; pdt->pl_DevName = "pdfcairo"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 101; pdt->pl_init = (plD_init_fp) plD_init_pdfcairo; pdt->pl_line = (plD_line_fp) plD_line_cairo; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; pdt->pl_eop = (plD_eop_fp) plD_eop_cairo; pdt->pl_bop = (plD_bop_fp) plD_bop_cairo; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_cairo; } //-------------------------------------------------------------------------- // plD_init_pdfcairo() // // Initialize Cairo PDF device //-------------------------------------------------------------------------- void plD_init_pdfcairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table aStream = stream_and_font_setup( pls, 0 ); // Prompt for a file name if not already set. plOpenFile( pls ); // Create an cairo surface & context for PDF file. // Dimension units are pts = 1/72 inches from cairo documentation. aStream->cairoSurface = cairo_pdf_surface_create_for_stream( (cairo_write_func_t) write_to_stream, pls->OutFile, (double) pls->xlength, (double) pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, (float) pls->ylength, FALSE ); // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo PS driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_pscairo ) void plD_dispatch_init_pscairo( PLDispatchTable *pdt ); void plD_init_pscairo( PLStream * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // pscairo void plD_dispatch_init_pscairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo PS Driver"; pdt->pl_DevName = "pscairo"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 102; pdt->pl_init = (plD_init_fp) plD_init_pscairo; pdt->pl_line = (plD_line_fp) plD_line_cairo; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; pdt->pl_eop = (plD_eop_fp) plD_eop_cairo; pdt->pl_bop = (plD_bop_fp) plD_bop_cairo; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_cairo; } //-------------------------------------------------------------------------- // plD_init_pscairo() // // Initialize Cairo PS device //-------------------------------------------------------------------------- void plD_init_pscairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table aStream = stream_and_font_setup( pls, 0 ); // Prompt for a file name if not already set. plOpenFile( pls ); // Create an cairo surface & context for PS file. // Dimension units are pts = 1/72 inches from cairo documentation. aStream->cairoSurface = cairo_ps_surface_create_for_stream( (cairo_write_func_t) write_to_stream, pls->OutFile, (double) pls->ylength, (double) pls->xlength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Handle portrait or landscape if ( pls->portrait ) { plsdiori( 1 ); pls->freeaspect = 1; } rotate_cairo_surface( pls, 0.0, -1.0, -1.0, 0.0, (float) pls->ylength, (float) pls->xlength, FALSE ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo EPS driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_epscairo ) void plD_dispatch_init_epscairo( PLDispatchTable *pdt ); void plD_init_epscairo( PLStream * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // epscairo void plD_dispatch_init_epscairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo EPS Driver"; pdt->pl_DevName = "epscairo"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 102; pdt->pl_init = (plD_init_fp) plD_init_epscairo; pdt->pl_line = (plD_line_fp) plD_line_cairo_fam; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo_fam; pdt->pl_eop = (plD_eop_fp) plD_eop_cairo_fam; pdt->pl_bop = (plD_bop_fp) plD_bop_cairo_fam; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo_fam; pdt->pl_state = (plD_state_fp) plD_state_cairo_fam; pdt->pl_esc = (plD_esc_fp) plD_esc_cairo_fam; } //-------------------------------------------------------------------------- // plD_init_epscairo() // // Initialize Cairo EPS device //-------------------------------------------------------------------------- void plD_init_epscairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table and allocate a cairo // stream structure. // // NOTE: The check below is necessary since, in family mode, this function // will be called multiple times. While you might think that it is // sufficient to update what *should* be the only pointer to the contents // of pls->dev, i.e. the pointer pls->dev itself, it appears that // something else somewhere else is also pointing to pls->dev. If you // change what pls->dev points to then you will get a "bus error", from // which I infer the existence of said bad stale pointer. // if ( pls->dev == NULL ) { aStream = stream_and_font_setup( pls, 0 ); } else { stream_and_font_setup( pls, 0 ); aStream = pls->dev; } // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set. plOpenFile( pls ); // Create an cairo surface & context for EPS file. // Dimension units are pts = 1/72 inches from cairo documentation. aStream->cairoSurface = cairo_ps_surface_create_for_stream( (cairo_write_func_t) write_to_stream, pls->OutFile, (double) pls->ylength, (double) pls->xlength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Set the PS surface to be EPS. cairo_ps_surface_set_eps( aStream->cairoSurface, 1 ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Handle portrait or landscape if ( pls->portrait ) { plsdiori( 1 ); pls->freeaspect = 1; } rotate_cairo_surface( pls, 0.0, -1.0, -1.0, 0.0, (float) pls->ylength, (float) pls->xlength, FALSE ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo SVG driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_svgcairo ) void plD_dispatch_init_svgcairo( PLDispatchTable *pdt ); void plD_init_svgcairo( PLStream * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // svgcairo void plD_dispatch_init_svgcairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo SVG Driver"; pdt->pl_DevName = "svgcairo"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 103; pdt->pl_init = (plD_init_fp) plD_init_svgcairo; pdt->pl_line = (plD_line_fp) plD_line_cairo_fam; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo_fam; pdt->pl_eop = (plD_eop_fp) plD_eop_cairo_fam; pdt->pl_bop = (plD_bop_fp) plD_bop_cairo_fam; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo_fam; pdt->pl_state = (plD_state_fp) plD_state_cairo_fam; pdt->pl_esc = (plD_esc_fp) plD_esc_cairo_fam; } //-------------------------------------------------------------------------- // plD_init_svgcairo() // // Initialize Cairo SVG device //-------------------------------------------------------------------------- void plD_init_svgcairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table and allocate a cairo // stream structure. // // NOTE: The check below is necessary since, in family mode, this function // will be called multiple times. While you might think that it is // sufficient to update what *should* be the only pointer to the contents // of pls->dev, i.e. the pointer pls->dev itself, it appears that // something else somewhere else is also pointing to pls->dev. If you // change what pls->dev points to then you will get a "bus error", from // which I infer the existence of said bad stale pointer. // if ( pls->dev == NULL ) { aStream = stream_and_font_setup( pls, 0 ); } else { stream_and_font_setup( pls, 0 ); aStream = pls->dev; } // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set. plOpenFile( pls ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Create an cairo surface & context for SVG file. // Dimension units are pts = 1/72 inches from cairo documentation. aStream->cairoSurface = cairo_svg_surface_create_for_stream( (cairo_write_func_t) write_to_stream, pls->OutFile, (double) pls->xlength, (double) pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, (float) pls->ylength, FALSE ); // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo PNG driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_pngcairo ) void plD_dispatch_init_pngcairo( PLDispatchTable *pdt ); void plD_init_pngcairo( PLStream * ); void plD_eop_pngcairo( PLStream * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // pngcairo void plD_dispatch_init_pngcairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo PNG Driver"; pdt->pl_DevName = "pngcairo"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 104; pdt->pl_init = (plD_init_fp) plD_init_pngcairo; pdt->pl_line = (plD_line_fp) plD_line_cairo_fam; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo_fam; pdt->pl_eop = (plD_eop_fp) plD_eop_pngcairo; pdt->pl_bop = (plD_bop_fp) plD_bop_cairo_fam; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo_fam; pdt->pl_state = (plD_state_fp) plD_state_cairo_fam; pdt->pl_esc = (plD_esc_fp) plD_esc_cairo_fam; } //-------------------------------------------------------------------------- // plD_init_pngcairo() // // Initialize Cairo PNG device //-------------------------------------------------------------------------- void plD_init_pngcairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table and allocate a cairo // stream structure. // // NOTE: The check below is necessary since, in family mode, this function // will be called multiple times. While you might think that it is // sufficient to update what *should* be the only pointer to the contents // of pls->dev, i.e. the pointer pls->dev itself, it appears that // something else somewhere else is also pointing to pls->dev. If you // change what pls->dev points to then you will get a "bus error", from // which I infer the existence of said bad stale pointer. // if ( pls->dev == NULL ) { aStream = stream_and_font_setup( pls, 0 ); } else { stream_and_font_setup( pls, 0 ); aStream = pls->dev; } // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set. plOpenFile( pls ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Create a new cairo surface & context for PNG file. // Dimension units are pixels from cairo documentation. aStream->cairoSurface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, (int) pls->xlength, (int) pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, (float) pls->ylength, FALSE ); // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } //-------------------------------------------------------------------------- // plD_eop_pngcairo() // // PNG: End of page. //-------------------------------------------------------------------------- void plD_eop_pngcairo( PLStream *pls ) { PLCairo *aStream; if ( cairo_family_check( pls ) ) { return; } aStream = (PLCairo *) pls->dev; cairo_surface_write_to_png_stream( aStream->cairoSurface, (cairo_write_func_t) write_to_stream, pls->OutFile ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo memory driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_memcairo ) void plD_dispatch_init_memcairo( PLDispatchTable *pdt ); void plD_init_memcairo( PLStream * ); void plD_eop_memcairo( PLStream * ); void plD_bop_memcairo( PLStream * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // memcairo void plD_dispatch_init_memcairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo memory driver"; pdt->pl_DevName = "memcairo"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 105; pdt->pl_init = (plD_init_fp) plD_init_memcairo; pdt->pl_line = (plD_line_fp) plD_line_cairo; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; pdt->pl_eop = (plD_eop_fp) plD_eop_memcairo; pdt->pl_bop = (plD_bop_fp) plD_bop_memcairo; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_cairo; } //-------------------------------------------------------------------------- // plD_bop_memcairo() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_memcairo( PLStream * PL_UNUSED( pls ) ) { // nothing to do here (we want to preserve the memory as it is) } //-------------------------------------------------------------------------- // plD_init_memcairo() // // Initialize Cairo memory device //-------------------------------------------------------------------------- void plD_init_memcairo( PLStream *pls ) { PLCairo *aStream; int stride, i; unsigned char *cairo_mem; unsigned char *input_mem; // used for checking byte order union { int testWord; char testByte[sizeof ( int )]; } endianTest; endianTest.testWord = 1; // Set the plot size to the memory buffer size, on the off chance // that they are different. pls->xlength = pls->phyxma; pls->ylength = pls->phyyma; // Setup the PLStream and the font lookup table aStream = stream_and_font_setup( pls, 0 ); // Test byte order if ( endianTest.testByte[0] == 1 ) aStream->bigendian = 0; else aStream->bigendian = 1; // Check that user supplied us with some memory to draw in if ( pls->dev == NULL ) { plexit( "Must call plsmem first to set user plotting area!" ); } // Save a pointer to the memory. aStream->memory = pls->dev; // Create a cairo surface & context. Copy data in from the input memory area // Malloc memory the way cairo likes it. Aligned on the stride computed by cairo_format_stride_for_width // and in the RGB24 format (from http://cairographics.org/manual/cairo-Image-Surfaces.html): // Each pixel is a 32-bit quantity, with the upper 8 bits unused. // Red, Green, and Blue are stored in the remaining 24 bits in that order stride = pls->xlength * 4; // stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, pls->xlength); This function missing from version 1.4 :-( aStream->cairo_format_memory = (unsigned char *) calloc( (size_t) ( stride * pls->ylength ), 1 ); // Copy the input data into the Cairo data format cairo_mem = aStream->cairo_format_memory; input_mem = aStream->memory; // 32 bit word order // cairo mem: Big endian: 0=A, 1=R, 2=G, 3=B // Little endian: 3=A, 2=R, 1=G, 0=B if ( aStream->bigendian ) { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { cairo_mem[1] = input_mem[0]; // R cairo_mem[2] = input_mem[1]; // G cairo_mem[3] = input_mem[2]; // B if ( pls->dev_mem_alpha == 1 ) { cairo_mem[0] = input_mem[3]; input_mem += 4; } else { input_mem += 3; } cairo_mem += 4; } } else { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { cairo_mem[2] = input_mem[0]; // R cairo_mem[1] = input_mem[1]; // G cairo_mem[0] = input_mem[2]; // B if ( pls->dev_mem_alpha == 1 ) { cairo_mem[3] = input_mem[3]; input_mem += 4; } else { input_mem += 3; } cairo_mem += 4; } } // Create a Cairo drawing surface from the input data aStream->cairoSurface = // Dimension units are width, height of buffer image from cairo // documentation. cairo_image_surface_create_for_data( aStream->cairo_format_memory, CAIRO_FORMAT_RGB24, pls->xlength, pls->ylength, stride ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Save the pointer to the structure in the PLplot stream. // Note that this wipes out the direct pointer to the memory buffer. pls->dev = aStream; // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, (float) pls->ylength, FALSE ); // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } //-------------------------------------------------------------------------- // plD_eop_memcairo() // // Memory device specific end of page. This copies the contents // of the cairo surface into the user supplied memory buffer. //-------------------------------------------------------------------------- void plD_eop_memcairo( PLStream *pls ) { int i; unsigned char *memory; unsigned char *cairo_surface_data; PLCairo *aStream; aStream = (PLCairo *) pls->dev; memory = aStream->memory; cairo_surface_data = cairo_image_surface_get_data( aStream->cairoSurface ); // 32 bit word order // cairo mem: Big endian: 0=A, 1=R, 2=G, 3=B // Little endian: 3=A, 2=R, 1=G, 0=B if ( aStream->bigendian ) { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { memory[0] = cairo_surface_data[1]; // R memory[1] = cairo_surface_data[2]; // G memory[2] = cairo_surface_data[3]; // B if ( pls->dev_mem_alpha == 1 ) { memory[3] = cairo_surface_data[0]; memory += 4; } else { memory += 3; } cairo_surface_data += 4; } } else { for ( i = 0; i < ( pls->xlength * pls->ylength ); i++ ) { memory[0] = cairo_surface_data[2]; // R memory[1] = cairo_surface_data[1]; // G memory[2] = cairo_surface_data[0]; // B if ( pls->dev_mem_alpha == 1 ) { memory[3] = cairo_surface_data[3]; memory += 4; } else { memory += 3; } cairo_surface_data += 4; } } // Free up the temporary memory malloc'ed in plD_init_memcairo free( aStream->cairo_format_memory ); } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo external context driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_extcairo ) void extcairo_setbackground( PLStream * ); void plD_dispatch_init_extcairo( PLDispatchTable *pdt ); void plD_init_extcairo( PLStream * ); void plD_bop_extcairo( PLStream * ); void plD_eop_extcairo( PLStream * ); void plD_esc_extcairo( PLStream *, PLINT, void * ); void plD_tidy_extcairo( PLStream * ); //-------------------------------------------------------------------------- // extcairo_setbackground() // // Set the background color for the extcairo device //-------------------------------------------------------------------------- void extcairo_setbackground( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Fill the context with the background color if the user so desires. if ( aStream->cairoContext != NULL ) { cairo_rectangle( aStream->cairoContext, 0.0, 0.0, pls->xlength, pls->ylength ); cairo_set_source_rgba( aStream->cairoContext, (double) pls->cmap0[0].r / 255.0, (double) pls->cmap0[0].g / 255.0, (double) pls->cmap0[0].b / 255.0, (double) pls->cmap0[0].a ); cairo_fill( aStream->cairoContext ); } } //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // extcairo void plD_dispatch_init_extcairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo external context driver"; pdt->pl_DevName = "extcairo"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 106; pdt->pl_init = (plD_init_fp) plD_init_extcairo; pdt->pl_line = (plD_line_fp) plD_line_cairo; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; pdt->pl_bop = (plD_bop_fp) plD_bop_extcairo; pdt->pl_eop = (plD_eop_fp) plD_eop_extcairo; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_extcairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_extcairo; } //-------------------------------------------------------------------------- // plD_init_extcairo() // // Initialize Cairo external context driver. //-------------------------------------------------------------------------- void plD_init_extcairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table aStream = stream_and_font_setup( pls, 0 ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; } //-------------------------------------------------------------------------- // plD_bop_extcairo() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_extcairo( PLStream *pls ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; // Set background if desired if ( aStream->set_background ) { extcairo_setbackground( pls ); } } //-------------------------------------------------------------------------- // plD_eop_extcairo() // // End of page. //-------------------------------------------------------------------------- void plD_eop_extcairo( PLStream * PL_UNUSED( pls ) ) { // nothing to do here, we leave it to the calling program to display // (or not) the update cairo context. } //-------------------------------------------------------------------------- // plD_esc_extcairo() // // The generic escape function, extended so that user can pass in // an external Cairo context to use for rendering. //-------------------------------------------------------------------------- void plD_esc_extcairo( PLStream *pls, PLINT op, void *ptr ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; switch ( op ) { case PLESC_DEVINIT: // Set external context aStream->cairoContext = (cairo_t *) ptr; // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, (float) pls->ylength, FALSE ); // Should adjust plot size to fit in the given cairo context? // Cairo does not provide a way to query the dimensions of a context? // Set background if desired if ( aStream->set_background ) { extcairo_setbackground( pls ); } // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); break; default: // Fall back on default Cairo actions plD_esc_cairo( pls, op, ptr ); break; } } //-------------------------------------------------------------------------- // plD_tidy_extcairo() // // This is nop, it is up to the calling program to clean up the Cairo // context, etc... //-------------------------------------------------------------------------- void plD_tidy_extcairo( PLStream * PL_UNUSED( pls ) ) { } #endif //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // // That which is specific to the cairo microsoft windows driver. // // Much of the Windows specific code here was lifted from the wingcc // driver. // //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- #if defined ( PLD_wincairo ) static char* szWndClass = "PLplot WinCairo"; void plD_dispatch_init_wincairo( PLDispatchTable *pdt ); void plD_init_wincairo( PLStream * ); //void plD_bop_extcairo( PLStream * ); void plD_eop_wincairo( PLStream * ); void plD_esc_wincairo( PLStream *, PLINT, void * ); void plD_tidy_wincairo( PLStream * ); //-------------------------------------------------------------------------- // blit_to_win() // // Blit the offscreen image to the Windows window. //-------------------------------------------------------------------------- void blit_to_win( PLCairo *aStream ) { cairo_set_source_surface( aStream->cairoContext_win, aStream->cairoSurface, 0.0, 0.0 ); cairo_paint( aStream->cairoContext_win ); } //-------------------------------------------------------------------------- // This is the window function for the plot window. Whenever a message is // dispatched using DispatchMessage (or sent with SendMessage) this function // gets called with the contents of the message. //-------------------------------------------------------------------------- LRESULT CALLBACK PlplotCairoWndProc( HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { PLStream *pls = NULL; PLCairo *dev = NULL; // // The window carries a 32bit user defined pointer which points to the // plplot stream (pls). This is used for tracking the window. // Unfortunately, this is "attached" to the window AFTER it is created // so we can not initialise PLStream or wincairo "blindly" because // they may not yet have been initialised. // WM_CREATE is called before we get to initialise those variables, so // we wont try to set them. // if ( nMsg == WM_CREATE ) { return ( 0 ); } else { pls = (PLStream *) GetWindowLong( hwnd, GWL_USERDATA ); // Try to get the address to pls for this window if ( pls ) // If we got it, then we will initialise this windows plplot private data area { dev = (PLCairo *) pls->dev; } } // // Process the windows messages // // Everything except WM_CREATE is done here and it is generally hoped that // pls and dev are defined already by this stage. // That will be true MOST of the time. Some times WM_PAINT will be called // before we get to initialise the user data area of the window with the // pointer to the windows plplot stream // switch ( nMsg ) { case WM_DESTROY: // if ( dev ) // Debug( "WM_DESTROY\t" ); PostQuitMessage( 0 ); return ( 0 ); break; case WM_PAINT: blit_to_win( dev ); return ( 1 ); break; case WM_SIZE: GetClientRect( dev->hwnd, &dev->rect ); return ( 0 ); break; case WM_ENTERSIZEMOVE: return ( 0 ); break; case WM_EXITSIZEMOVE: return ( 0 ); break; case WM_ERASEBKGND: if ( dev ) { dev->oldcolour = SetBkColor( dev->hdc, RGB( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b ) ); ExtTextOut( dev->hdc, 0, 0, ETO_OPAQUE, &dev->rect, "", 0, 0 ); SetBkColor( dev->hdc, dev->oldcolour ); } return ( 1 ); break; case WM_COMMAND: return ( 0 ); break; } // If we don't handle a message completely we hand it to the system // provided default window function. return DefWindowProc( hwnd, nMsg, wParam, lParam ); } //-------------------------------------------------------------------------- // handle_locate() // // Handle getting the cursor location. //-------------------------------------------------------------------------- void handle_locate( PLStream *pls, PLGraphicsIn *gin ) { int located = 0; PLCairo *aStream = (PLCairo *) pls->dev; // Initialize PLplot mouse event structure plGinInit( gin ); while ( GetMessage( &aStream->msg, NULL, 0, 0 ) && !located ) { TranslateMessage( &aStream->msg ); switch ( (int) aStream->msg.message ) { case WM_MOUSEMOVE: case WM_LBUTTONDOWN: gin->state = 1; gin->button = 1; gin->pX = LOWORD( aStream->msg.lParam ); gin->pY = pls->ylength - HIWORD( aStream->msg.lParam ); gin->dX = (PLFLT) LOWORD( aStream->msg.lParam ) / ( (PLFLT) pls->xlength ); gin->dY = (PLFLT) ( pls->ylength - HIWORD( aStream->msg.lParam ) ) / ( (PLFLT) pls->ylength ); break; case WM_CHAR: gin->keysym = aStream->msg.wParam; located = 1; break; default: DispatchMessage( &aStream->msg ); break; } } } //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- // extcairo void plD_dispatch_init_wincairo( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Cairo Microsoft Windows driver"; pdt->pl_DevName = "wincairo"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 107; pdt->pl_init = (plD_init_fp) plD_init_wincairo; pdt->pl_line = (plD_line_fp) plD_line_cairo; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cairo; pdt->pl_bop = (plD_bop_fp) plD_bop_cairo; pdt->pl_eop = (plD_eop_fp) plD_eop_wincairo; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_wincairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_wincairo; } //-------------------------------------------------------------------------- // plD_init_wincairo() // // Initialize Cairo Microsoft Windows driver. //-------------------------------------------------------------------------- void plD_init_wincairo( PLStream *pls ) { PLCairo *aStream; // Setup the PLStream and the font lookup table aStream = stream_and_font_setup( pls, 1 ); // Save the pointer to the structure in the PLplot stream pls->dev = aStream; // Create window memset( &aStream->wndclass, 0, sizeof ( WNDCLASSEX ) ); // This class is called WinTestWin aStream->wndclass.lpszClassName = szWndClass; // cbSize gives the size of the structure for extensibility. aStream->wndclass.cbSize = sizeof ( WNDCLASSEX ); // All windows of this class redraw when resized. aStream->wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC | CS_PARENTDC; // All windows of this class use the PlplotCairoWndProc window function. aStream->wndclass.lpfnWndProc = PlplotCairoWndProc; // This class is used with the current program instance. aStream->wndclass.hInstance = GetModuleHandle( NULL ); // Use standard application icon and arrow cursor provided by the OS aStream->wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); aStream->wndclass.hIconSm = LoadIcon( NULL, IDI_APPLICATION ); aStream->wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); // Color the background white aStream->wndclass.hbrBackground = NULL; aStream->wndclass.cbWndExtra = sizeof ( pls ); // // Now register the window class for use. // RegisterClassEx( &aStream->wndclass ); // // Create our main window using that window class. // aStream->hwnd = CreateWindowEx( WS_EX_WINDOWEDGE + WS_EX_LEFT, szWndClass, // Class name pls->program, // Caption WS_OVERLAPPEDWINDOW, // Style pls->xoffset, // Initial x (use default) pls->yoffset, // Initial y (use default) // This is a little lame since the window border size might change. pls->xlength + 5, // Initial x size (use default) pls->ylength + 30, // Initial y size (use default) NULL, // No parent window NULL, // No menu aStream->wndclass.hInstance, // This program instance NULL // Creation parameters ); // // Attach a pointer to the stream to the window's user area // this pointer will be used by the windows call back for // process this window // SetWindowLong( aStream->hwnd, GWL_USERDATA, (long) pls ); aStream->SCRN_hdc = aStream->hdc = GetDC( aStream->hwnd ); // // Setup the popup menu // // // dev->PopupMenu = CreatePopupMenu(); // AppendMenu( dev->PopupMenu, MF_STRING, PopupPrint, "Print" ); // AppendMenu( dev->PopupMenu, MF_STRING, PopupNextPage, "Next Page" ); // AppendMenu( dev->PopupMenu, MF_STRING, PopupQuit, "Quit" ); // // plD_state_wingcc( pls, PLSTATE_COLOR0 ); // // Display the window which we just created (using the nShow // passed by the OS, which allows for start minimized and that // sort of thing). // ShowWindow( aStream->hwnd, SW_SHOWDEFAULT ); SetForegroundWindow( aStream->hwnd ); // // Now we have to find out, from windows, just how big our drawing area is // when we specified the page size earlier on, that includes the borders, // title bar etc... so now that windows has done all its initialisations, // we will ask how big the drawing area is, and tell plplot // // // GetClientRect( dev->hwnd, &dev->rect ); // dev->width = dev->rect.right; // dev->height = dev->rect.bottom; // // // Initialize Cairo Surface using the windows hdc. // // This is the Win32 Cairo surface. aStream->cairoSurface_win = (cairo_surface_t *) cairo_win32_surface_create( aStream->hdc ); aStream->cairoContext_win = cairo_create( aStream->cairoSurface_win ); // This is the Cairo surface PLplot will actually plot to. aStream->cairoSurface = cairo_image_surface_create( CAIRO_FORMAT_RGB24, pls->xlength, pls->ylength ); aStream->cairoContext = cairo_create( aStream->cairoSurface ); // Invert the surface so that the graphs are drawn right side up. rotate_cairo_surface( pls, 1.0, 0.0, 0.0, -1.0, 0.0, pls->ylength, FALSE ); // Set graphics aliasing cairo_set_antialias( aStream->cairoContext, aStream->graphics_anti_aliasing ); // Set fill rule for the case of self-intersecting boundaries. if ( pls->dev_eofill ) cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_EVEN_ODD ); else cairo_set_fill_rule( aStream->cairoContext, CAIRO_FILL_RULE_WINDING ); } //-------------------------------------------------------------------------- // plD_eop_wincairo() // // Clean up Cairo Microsoft Windows driver. //-------------------------------------------------------------------------- void plD_eop_wincairo( PLStream *pls ) { PLCairo *aStream = (PLCairo *) pls->dev; if ( !pls->nopause ) { while ( GetMessage( &aStream->msg, NULL, 0, 0 ) ) { TranslateMessage( &aStream->msg ); switch ( (int) aStream->msg.message ) { case WM_CHAR: if ( ( (TCHAR) ( aStream->msg.wParam ) == 13 ) || ( (TCHAR) ( aStream->msg.wParam ) == 'q' ) || ( (TCHAR) ( aStream->msg.wParam ) == 'Q' ) ) { PostQuitMessage( 0 ); } break; default: DispatchMessage( &aStream->msg ); break; } } } } //-------------------------------------------------------------------------- // plD_tidy_wincairo() // // Clean up Cairo Microsoft Windows driver. //-------------------------------------------------------------------------- void plD_tidy_wincairo( PLStream *pls ) { PLCairo *aStream = (PLCairo *) pls->dev; plD_tidy_cairo( pls ); // Also free up the Cairo win32 surface and context cairo_destroy( aStream->cairoContext_win ); cairo_surface_destroy( aStream->cairoSurface_win ); if ( aStream != NULL ) { if ( aStream->hdc != NULL ) ReleaseDC( aStream->hwnd, aStream->hdc ); free_mem( pls->dev ); } } //-------------------------------------------------------------------------- // plD_esc_wincairo() // // Escape function, specialized for the wincairo driver //-------------------------------------------------------------------------- void plD_esc_wincairo( PLStream *pls, PLINT op, void *ptr ) { PLCairo *aStream; aStream = (PLCairo *) pls->dev; switch ( op ) { case PLESC_FLUSH: InvalidateRect( aStream->hwnd, NULL, TRUE ); break; case PLESC_GETC: handle_locate( pls, (PLGraphicsIn *) ptr ); break; default: plD_esc_cairo( pls, op, ptr ); break; } } #endif plplot-5.10.0+dfsg/drivers/cgm.driver_info.in 644 1750 1750 3211466747272 177640ustar andrewandrewcgm:CGM file:0:cgm:44:cgm plplot-5.10.0+dfsg/drivers/pstex.c 644 1750 1750 3171211462322041 157340ustar andrewandrew// $Id$ // // PLplot pstex (Postscript/LaTeX) device driver. // #include "plDevs.h" #ifdef PLD_pstex #include "plplotP.h" #include "drivers.h" #include "ps.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_pstex = "pstex:Combined Postscript/LaTeX files:0:pstex:41:pstex\n"; //-------------------------------------------------------------------------- // plD_init_pstex() // // Initialize device. //-------------------------------------------------------------------------- static void parse_str( const char *str, char *dest ); static void proc_str( PLStream *pls, EscText *args ); static int color = 1; static DrvOpt pstex_options[] = { { "color", DRV_INT, &color, "Color Postscript/LaTeX (color=1|0)" }, { NULL, DRV_INT, NULL, NULL} }; void plD_dispatch_init_pstex( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Combined Postscript/LaTeX files"; pdt->pl_DevName = "pstex"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 41; pdt->pl_init = (plD_init_fp) plD_init_pstex; pdt->pl_line = (plD_line_fp) plD_line_ps; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_ps; pdt->pl_eop = (plD_eop_fp) plD_eop_ps; pdt->pl_bop = (plD_bop_fp) plD_bop_pstex; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_pstex; pdt->pl_state = (plD_state_fp) plD_state_ps; pdt->pl_esc = (plD_esc_fp) plD_esc_pstex; } void plD_init_pstex( PLStream *pls ) { char *ofile; size_t len; PSDev *dev; FILE *fp; plParseDrvOpts( pstex_options ); if ( color ) plD_init_psc( pls ); // init color postscript driver else plD_init_psm( pls ); // init monochrome postscript driver dev = (PSDev *) pls->dev; pls->dev_text = 1; // want to draw text pls->dev_unicode = 0; // don't want unicode // open latex output file len = strlen( pls->FileName ) + 3; ofile = (char *) malloc( sizeof ( char ) * len ); snprintf( ofile, len, "%s_t", pls->FileName ); fp = fopen( ofile, "w" ); free( ofile ); dev->fp = fp; fprintf( fp, "\\begin{picture}(0,0)(0,0)%%\n" ); fprintf( fp, "\\includegraphics[scale=1.,clip]{%s}%%\n", pls->FileName ); fprintf( fp, "\\end{picture}%%\n" ); // fprintf(fp,"\\setlength{\\unitlength}{%fbp}%%\n", 72./25.4/pls->xpmm); fprintf( fp, "\\setlength{\\unitlength}{%fbp}%%\n", 1.0 / ENLARGE ); fprintf( fp, "\\begingroup\\makeatletter\\ifx\\SetFigFont\\undefined%%\n" ); fprintf( fp, "\\gdef\\SetFigFont#1#2#3#4#5{%%\n" ); fprintf( fp, "\\reset@font\\fontsize{#1}{#2pt}%%\n" ); fprintf( fp, "\\fontfamily{#3}\\fontseries{#4}\\fontshape{#5}%%\n" ); fprintf( fp, "\\selectfont}%%\n" ); fprintf( fp, "\\fi\\endgroup%%\n" ); dev->cur_pos = ftell( fp ); fprintf( fp, "\\begin{picture}(xxxxxx,xxxxxx)(xxxxxx,xxxxxx)%%\n" ); } void plD_esc_pstex( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_HAS_TEXT: proc_str( pls, ptr ); break; default: plD_esc_ps( pls, op, ptr ); } } void plD_bop_pstex( PLStream *pls ) { plD_bop_ps( pls ); plGetFam( pls ); } void plD_tidy_pstex( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; PLFLT scale; FILE *fp; plD_tidy_ps( pls ); scale = pls->xpmm * 25.4 / 72.; fp = dev->fp; fprintf( fp, "\\end{picture}\n" ); fseek( fp, dev->cur_pos, SEEK_SET ); fprintf( fp, "\\begin{picture}(%d,%d)(%d,%d)%%\n%%", ROUND( ( dev->urx - dev->llx ) * scale ), ROUND( ( dev->ury - dev->lly ) * scale ), ROUND( ( dev->llx - XOFFSET ) * scale ), ROUND( ( dev->lly - YOFFSET ) * scale ) ); plCloseFile( pls ); } void proc_str( PLStream *pls, EscText *args ) { PLFLT *t = args->xform; PLFLT a1, alpha, ft_ht, angle; char cptr[256], jst, ref; PSDev *dev = (PSDev *) pls->dev; PLINT clxmin, clxmax, clymin, clymax; FILE *fp; fp = dev->fp; // font height ft_ht = 1.6 /*!*/ * pls->chrht * 72.0 / 25.4; /* ft_ht in points. ht is in mm */ // calculate baseline text angle angle = ( (PLFLT) ( ORIENTATION - 1 ) + pls->diorot ) * 90.; a1 = acos( t[0] ) * 180. / PI; if ( t[2] > 0. ) alpha = a1 - angle - 90.; else alpha = 360. - a1 - angle - 90.; // parse string for format (escape) characters parse_str( args->string, cptr ); // // Reference point (center baseline of string, not latex character reference point). // If base = 0, it is aligned with the center of the text box // If base = 1, it is aligned with the baseline of the text box // If base = 2, it is aligned with the top of the text box // Currently plplot only uses base=0 // if ( args->base == 2 ) // not supported by plplot ref = 't'; else if ( args->base == 1 ) ref = 'b'; else ref = 'c'; // // Text justification. Left, center and right justification, which // are the more common options, are supported; variable justification is // only approximate, based on plplot computation of it's string lenght // if ( args->just == 0.5 ) jst = 'c'; else if ( args->just == 1. ) jst = 'r'; else { jst = 'l'; args->x = args->refx; // use hints provided by plplot args->y = args->refy; } // apply transformations difilt( &args->x, &args->y, 1, &clxmin, &clxmax, &clymin, &clymax ); // check clip limits. For now, only the reference point of the string is checked; // but the the whole string should be checked -- using a postscript construct // such as gsave/clip/grestore. This method can also be applied to the xfig and // pstex drivers. Zoom side effect: the font size must be adjusted! if ( args->x < clxmin || args->x > clxmax || args->y < clymin || args->y > clymax ) return; plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &( args->x ), &( args->y ) ); #ifdef DEBUG fprintf( fp, "\\put(%d,%d){\\circle{10}}\n", args->x, args->y ); #endif fprintf( fp, "\\put(%d,%d){\\rotatebox{%.1f}{\\makebox(0,0)[%c%c]{\\SetFigFont{%.1f}{12}", args->x, args->y, alpha, jst, ref, ft_ht ); // // font family, serie and shape. Currently not supported by plplot // // Use current font instead: // 1: Normal font (latex document default font) // 2: Roman font // 3: Italic font (most probably latex slanted) // 4: Script font (latex sans serif) // switch ( pls->cfont ) { case ( 1 ): fprintf( fp, "{\\familydefault}" ); break; case ( 2 ): fprintf( fp, "{\\rmdefault}" ); break; case ( 3 ): fprintf( fp, "{\\itdefault}" ); break; case ( 4 ): fprintf( fp, "{\\sfdefault}" ); break; default: fprintf( fp, "{\\familydefault}" ); } fprintf( fp, "{\\mddefault}{\\updefault}\n" ); // font color. if ( color ) fprintf( fp, "\\special{ps: %.3f %.3f %.3f setrgbcolor}{", pls->curcolor.r / 255., pls->curcolor.g / 255., pls->curcolor.b / 255. ); else fprintf( fp, "\\special{ps: 0 0 0 setrgbcolor}{" ); fprintf( fp, "%% Your text follows:\n" ); fprintf( fp, "%s\n", cptr ); fprintf( fp, "}}}}" ); // // keep ps driver happy -- needed for background and orientation. // arghhh! can't calculate it, as I only have the string reference // point, not its extent! // Quick (and final?) *hack*, ASSUME that no more than a char height // extents after/before the string reference point. // dev->llx = MIN( dev->llx, args->x - ft_ht * 25.4 / 72. * pls->xpmm ); dev->lly = MIN( dev->lly, args->y - ft_ht * 25.4 / 72. * pls->ypmm ); dev->urx = MAX( dev->urx, args->x + ft_ht * 25.4 / 72. * pls->xpmm ); dev->ury = MAX( dev->ury, args->y + ft_ht * 25.4 / 72. * pls->ypmm ); } void parse_str( const char *str, char *dest ) { int n, opened = 0, raised = 0, overline = 0, underline = 0, fontset = 0, math = 0; char *tp = dest, c, esc; char greek[] = "abgGdDezyhHiklLmncCopPrsStuUfFxqQwW"; char *mathgreek[] = { "alpha", "beta", "gamma", "Gamma", "delta", "Delta", "epsilon", "zeta", "eta", "theta", "Theta", "iota", "kappa", "lambda", "Lambda", "mu", "nu", "xi", "Xi", "o", "pi", "Pi", "rho", "sigma", "Sigma","tau", "upsilon", "Upsilon", "phi", "Phi", "chi", "psi", "Psi", "omega", "Omega" }; plgesc( &esc ); while ( *str ) { if ( *str != esc ) { *tp++ = *str++; continue; } str++; switch ( *str++ ) { case 'u': // up one level if ( raised < 0 ) { *tp++ = '}'; opened--; } else { n = sprintf( tp, "\\raisebox{%.2fex}{", 0.6 ); tp += n; opened++; } raised++; break; case 'd': // down one level if ( raised > 0 ) { *tp++ = '}'; opened--; } else { n = sprintf( tp, "\\raisebox{%.2fex}{", -0.6 ); tp += n; opened++; } raised--; break; case 'b': // backspace n = sprintf( tp, "\\hspace{-1em}" ); tp += n; break; case '+': // toggles overline mode. Side effect, enter math mode. if ( overline ) { if ( --math ) *tp++ = '}'; else { n = sprintf( tp, "}$" ); tp += n; } overline--; opened--; } else { if ( !math ) *tp++ = '$'; n = sprintf( tp, "\\overline{" ); tp += n; overline++; opened++; math++; } break; case '-': // toggles underline mode. Side effect, enter math mode. if ( underline ) { if ( --math ) *tp++ = '}'; else { n = sprintf( tp, "}$" ); tp += n; } underline--; opened--; } else { if ( !math ) *tp++ = '$'; n = sprintf( tp, "\\underline{" ); tp += n; underline++; opened++; math++; } break; case 'g': // greek letter corresponding to roman letter x c = *str++; n = plP_strpos( greek, c ); if ( n != -1 ) { if ( !math ) *tp++ = '$'; *tp++ = '\\'; strcpy( tp, mathgreek[n] ); if ( isupper( c ) ) *tp = toupper( *tp ); tp += strlen( mathgreek[n] ); if ( !math ) *tp++ = '$'; } else *tp++ = c; break; case '(': // Hershey symbol number (nnn) (any number of digits) FIXME ??? plwarn( "'g(...)' text escape sequence not processed." ); while ( *str++ != ')' ) ; break; case 'f': // switch font switch ( *str++ ) { case 'n': // Normal while ( fontset-- ) { *tp++ = '}'; opened--; } if ( math ) { *tp++ = '$'; math = 0; } n = sprintf( tp, "\\normalfont " ); tp += n; break; case 'r': // Roman if ( math ) n = sprintf( tp, "\\mathrm{" ); else n = sprintf( tp, "\\textrm{" ); tp += n; opened++; fontset++; break; case 'i': // Italic if ( math ) n = sprintf( tp, "\\mathit{" ); else n = sprintf( tp, "\\textit{" ); tp += n; opened++; fontset++; break; case 's': // Script. Don't, use sans serif if ( math ) n = sprintf( tp, "\\mathsf{" ); else n = sprintf( tp, "\\textsf{" ); tp += n; opened++; fontset++; break; } default: if ( *str == esc ) *tp++ = esc; } } while ( opened-- ) *tp++ = '}'; *tp = '\0'; } #else int pldummy_pstex() { return 0; } #endif // PLD_pstexdev plplot-5.10.0+dfsg/drivers/tkwin.driver_info.in 644 1750 1750 4511466747272 203560ustar andrewandrewtkwin:New tk driver:1:tkwin:45:tkwin plplot-5.10.0+dfsg/drivers/hpgl.c 644 1750 1750 2347412230657343 155430ustar andrewandrew// $Id: hpgl.c 12612 2013-10-20 04:41:07Z airwin $ // // File: hpgl.c // // Descript: hp7470, hp7580, and lj_hpgl drivers // // Library: --- // // Requires: --- // // Public: plD_init_hp7470() // plD_init_hp7580() // plD_init_lj_hpgl() // plD_line_hpgl() // plD_polyline_hpgl() // plD_eop_hpgl() // plD_bop_hpgl() // plD_tidy_hpgl() // plD_state_hpgl() // plD_esc_hpgl() // // pldummy_hpgl() // // Private: initialize_hpgl_pls() // // Notes: --- // //-------------------------------------------------------------------------- #include "plDevs.h" #if defined ( PLD_hp7470 ) || defined ( PLD_hp7580 ) || defined ( PLD_lj_hpgl ) #include "plplotP.h" #include #include #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_hpgl = #if defined ( PLD_hp7470 ) "hp7470:HP 7470 Plotter File (HPGL Cartridge, Small Plotter):0:hpgl:34:hp7470\n" #endif #if defined ( PLD_hp7580 ) "hp7580:HP 7580 Plotter File (Large Plotter):0:hpgl:35:hp7580\n" #endif #if defined ( PLD_lj_hpgl ) "lj_hpgl:HP Laserjet III, HPGL emulation mode:0:hpgl:36:lj_hpgl\n" #endif ; void plD_line_hpgl( PLStream *, short, short, short, short ); void plD_polyline_hpgl( PLStream *, short *, short *, PLINT ); void plD_eop_hpgl( PLStream * ); void plD_bop_hpgl( PLStream * ); void plD_tidy_hpgl( PLStream * ); void plD_state_hpgl( PLStream *, PLINT ); void plD_esc_hpgl( PLStream *, PLINT, void * ); // top level declarations // Plotter sizes #define HP7470_XMIN 0 #define HP7470_XMAX 10299 #define HP7470_YMIN 0 #define HP7470_YMAX 7649 #define HP7580_XMIN -4500 #define HP7580_XMAX 4500 #define HP7580_YMIN -2790 #define HP7580_YMAX 2790 #define LJIII_XMIN 0 #define LJIII_XMAX 11000 #define LJIII_YMIN 500 #define LJIII_YMAX 7700 #define OF pls->OutFile #define MIN_WIDTH 1. // Minimum pen width #define MAX_WIDTH 10. // Maximum pen width #define DEF_WIDTH 1. // Default pen width static void hpgl_dispatch_init_helper( PLDispatchTable *pdt, char *menustr, char *devnam, int type, int seq, plD_init_fp init ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = menustr; pdt->pl_DevName = devnam; #endif pdt->pl_type = type; pdt->pl_seq = seq; pdt->pl_init = init; pdt->pl_line = (plD_line_fp) plD_line_hpgl; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_hpgl; pdt->pl_eop = (plD_eop_fp) plD_eop_hpgl; pdt->pl_bop = (plD_bop_fp) plD_bop_hpgl; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_hpgl; pdt->pl_state = (plD_state_fp) plD_state_hpgl; pdt->pl_esc = (plD_esc_fp) plD_esc_hpgl; } //-------------------------------------------------------------------------- // initialize_hpgl_pls() // // Initialize plot stream //-------------------------------------------------------------------------- static void initialize_hpgl_pls( PLStream *pls ) { PLDev *dev = (PLDev *) pls->dev; if ( pls->width == 0 ) // Is 0 if uninitialized pls->width = 1; plFamInit( pls ); // Initialize family file info plOpenFile( pls ); // get file name if not already set dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->xlen = dev->xmax - dev->xmin; dev->ylen = dev->ymax - dev->ymin; plP_setpxl( (PLFLT) 40., (PLFLT) 40. ); plP_setphy( dev->xmin, dev->xmax, dev->ymin, dev->ymax ); } //-------------------------------------------------------------------------- // plD_init_hp7470() // // Initialize device. //-------------------------------------------------------------------------- #ifdef PLD_hp7470 void plD_init_hp7470( PLStream * ); void plD_dispatch_init_hp7470( PLDispatchTable *pdt ) { hpgl_dispatch_init_helper( pdt, "HP 7470 Plotter File (HPGL Cartridge, Small Plotter)", "hp7470", plDevType_FileOriented, 34, (plD_init_fp) plD_init_hp7470 ); } void plD_init_hp7470( PLStream *pls ) { PLDev *dev; pls->color = 1; dev = plAllocDev( pls ); // Allocate device-specific data dev->xmin = HP7470_XMIN; dev->xmax = HP7470_XMAX; dev->ymin = HP7470_YMIN; dev->ymax = HP7470_YMAX; initialize_hpgl_pls( pls ); // initialize plot stream fputs( "\x1b.I200;;17:\x1b.N;19:\x1b.M;;;10:IN;\n", OF ); } #endif // PLD_hp7470 //-------------------------------------------------------------------------- // plD_init_hp7580() // // Initialize device. //-------------------------------------------------------------------------- #ifdef PLD_hp7580 void plD_init_hp7580( PLStream * ); void plD_dispatch_init_hp7580( PLDispatchTable *pdt ) { hpgl_dispatch_init_helper( pdt, "HP 7580 Plotter File (Large Plotter)", "hp7580", plDevType_FileOriented, 35, (plD_init_fp) plD_init_hp7580 ); } void plD_init_hp7580( PLStream *pls ) { PLDev *dev; pls->color = 1; dev = plAllocDev( pls ); // Allocate device-specific data dev->xmin = HP7580_XMIN; dev->xmax = HP7580_XMAX; dev->ymin = HP7580_YMIN; dev->ymax = HP7580_YMAX; initialize_hpgl_pls( pls ); // initialize plot stream fputs( "\x1b.I200;;17:\x1b.N;19:\x1b.M;;;10:IN;\n", OF ); fputs( "RO90;IP;SP4;PA;\n", OF ); } #endif // PLD_hp7580 //-------------------------------------------------------------------------- // plD_init_lj_hpgl() // // Initialize device. //-------------------------------------------------------------------------- #ifdef PLD_lj_hpgl void plD_init_lj_hpgl( PLStream * ); void plD_dispatch_init_hpgl( PLDispatchTable *pdt ) { hpgl_dispatch_init_helper( pdt, "HP Laserjet III, HPGL emulation mode", "lj_hpgl", plDevType_FileOriented, 36, (plD_init_fp) plD_init_lj_hpgl ); } void plD_init_lj_hpgl( PLStream *pls ) { PLDev *dev; dev = plAllocDev( pls ); // Allocate device-specific data dev->xmin = LJIII_XMIN; dev->xmax = LJIII_XMAX; dev->ymin = LJIII_YMIN; dev->ymax = LJIII_YMAX; initialize_hpgl_pls( pls ); // initialize plot stream // HP III changes here up to .I200 puts printer in HPGL/2 emulation // with 300DPI printing. // Next line : added pw 0.2 for pen width 0.2 (of an inch ?) // fputs( "\x1b*T300R\x1b%1B;\x1b.I200;;17:\x1b.N;19:\x1b.M;;;10:IN;\n", OF ); fputs( "RO90;IP;PW 0.2;SP 1;PA;", OF ); } #endif // PLD_lj_hpgl //-------------------------------------------------------------------------- // plD_line_hpgl() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_hpgl( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { PLDev *dev = (PLDev *) pls->dev; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; // Write out old path if ( x1 != dev->xold || y1 != dev->yold ) pls->bytecnt += fprintf( OF, "PU%d %d;", x1, y1 ); // Add new point to path pls->bytecnt += fprintf( OF, "PD%d %d\n", x2, y2 ); dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_hpgl() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_hpgl( PLStream *pls, short *xa, short *ya, PLINT npts ) { register PLINT i; PLDev *dev = (PLDev *) pls->dev; // Write out old path if ( xa[0] != dev->xold || ya[0] != dev->yold ) pls->bytecnt += fprintf( OF, "PU%d %d;", xa[0], ya[0] ); // Add new point to path for ( i = 1; i < npts; i++ ) pls->bytecnt += fprintf( OF, "PD%d %d\n", xa[i], ya[i] ); dev->xold = xa[ npts - 1 ]; dev->yold = ya[ npts - 1 ]; } //-------------------------------------------------------------------------- // plD_eop_hpgl() // // End of page. //-------------------------------------------------------------------------- void plD_eop_hpgl( PLStream *pls ) { } //-------------------------------------------------------------------------- // plD_bop_hpgl() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_hpgl( PLStream *pls ) { PLDev *dev = (PLDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; fputs( "PG;\n", OF ); if ( !pls->termin ) plGetFam( pls ); pls->page++; } //-------------------------------------------------------------------------- // plD_tidy_hpgl() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_hpgl( PLStream *pls ) { fputs( "SP0\n", OF ); plCloseFile( pls ); } //-------------------------------------------------------------------------- // plD_state_hpgl() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_hpgl( PLStream *pls, PLINT op ) { switch ( op ) { case PLSTATE_WIDTH: case PLSTATE_COLOR0: { int width = (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ); if ( pls->icol0 < 1 || pls->icol0 > 8 ) fputs( "\nInvalid pen selection.", stderr ); else fprintf( OF, "SP%d %d\n", pls->icol0, width ); break; } case PLSTATE_COLOR1: break; } } //-------------------------------------------------------------------------- // plD_esc_hpgl() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_hpgl( PLStream *pls, PLINT op, void *ptr ) { } #else int pldummy_hpgl( void ) { return 0; } #endif // PLD_hp7470 || PLD_hp7580 || PLD_lj_hpgl plplot-5.10.0+dfsg/drivers/aqt.c 644 1750 1750 6572311571511407 153760ustar andrewandrew// March 12, 2005 // // PLplot driver for AquaTerm and Mac OS X. // // Copyright (C) Per Persson // Copyright (C) 2005 Hazen Babcock // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // //--------------------------------------------- // Header files, defines and local variables // --------------------------------------------- // OS X specific header files #import #import // PLplot header files #include "plplotP.h" #include "drivers.h" // constants #define SCALE 0.1 #define AQT_Default_X 720 #define AQT_Default_Y 540 #define DPI 72.0 #define MAX_STRING_LEN 1000 // local variables static NSAutoreleasePool *arpool; // Objective-C autorelease pool static id adapter; // Adapter object PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_aqt = "aqt:AquaTerm (Mac OS X):1:aqt:50:aqt\n"; static int currentPlot = 0; static int maxWindows = 30; static int windowXSize = 0; static int windowYSize = 0; static bool didTests = false; static bool hasShear = false; static bool hasAlpha = false; // font stuff // // AquaTerm font look-up table // // The table is initialized with lowest common denominator truetype // fonts that (I hope) most Macs will have. // #define AQT_N_FontLookup 30 static FCI_to_FontName_Table AQT_FontLookup[AQT_N_FontLookup] = { { PL_FCI_MARK | 0x000, (unsigned char *) "Helvetica" }, { PL_FCI_MARK | 0x001, (unsigned char *) "Times-Roman" }, { PL_FCI_MARK | 0x002, (unsigned char *) "Courier" }, { PL_FCI_MARK | 0x003, (unsigned char *) "Times-Roman" }, { PL_FCI_MARK | 0x004, (unsigned char *) "LucidaGrande Regular" }, { PL_FCI_MARK | 0x010, (unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x011, (unsigned char *) "Times-Italic" }, { PL_FCI_MARK | 0x012, (unsigned char *) "Courier-Oblique" }, { PL_FCI_MARK | 0x013, (unsigned char *) "Times-Italic" }, { PL_FCI_MARK | 0x014, (unsigned char *) "LucidaGrande Regular" }, { PL_FCI_MARK | 0x020, (unsigned char *) "Helvetica-Oblique" }, { PL_FCI_MARK | 0x021, (unsigned char *) "Times-Italic" }, { PL_FCI_MARK | 0x022, (unsigned char *) "Courier-Oblique" }, { PL_FCI_MARK | 0x023, (unsigned char *) "Times-Italic" }, { PL_FCI_MARK | 0x024, (unsigned char *) "LucidaGrande Regular" }, { PL_FCI_MARK | 0x100, (unsigned char *) "Helvetica-Bold" }, { PL_FCI_MARK | 0x101, (unsigned char *) "Times-Bold" }, { PL_FCI_MARK | 0x102, (unsigned char *) "Courier-Bold" }, { PL_FCI_MARK | 0x103, (unsigned char *) "Times-Bold" }, { PL_FCI_MARK | 0x104, (unsigned char *) "LucidaGrande Regular" }, { PL_FCI_MARK | 0x110, (unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x111, (unsigned char *) "Times-BoldItalic" }, { PL_FCI_MARK | 0x112, (unsigned char *) "Courier-BoldOblique" }, { PL_FCI_MARK | 0x113, (unsigned char *) "Times-BoldItalic" }, { PL_FCI_MARK | 0x114, (unsigned char *) "LucidaGrande Regular" }, { PL_FCI_MARK | 0x120, (unsigned char *) "Helvetica-BoldOblique" }, { PL_FCI_MARK | 0x121, (unsigned char *) "Times-BoldItalic" }, { PL_FCI_MARK | 0x122, (unsigned char *) "Courier-BoldOblique" }, { PL_FCI_MARK | 0x123, (unsigned char *) "Times-BoldItalic" }, { PL_FCI_MARK | 0x124, (unsigned char *) "LucidaGrande Regular" } }; // // AquaTerm font environment variables // // When the driver is initialized it will check to see if // the user has opted to overide one of the above fonts by // setting one of the environment variables below. // // This list must be in the same order with the same number of // elements as the above list // // These are the same environment variable names as would be used // on a linux system, but they have a slightly different meaning. // Since AquaTerm will find the font for us (if it can) given // just the font name, you should only set the environment // variable to the font name. You don't need to provide // a path. If you installed the font using Font Book, AquaTerm // should not have any trouble finding it. // // FIXME: Would it be better to use different environment variable // names then plfreetype.c? If not, then it probably isn't // ideal to have two different copies of the same list of // environment variable names. // const char *aqt_font_env_names[AQT_N_FontLookup] = { "PLPLOT_FREETYPE_SANS_FONT", "PLPLOT_FREETYPE_SERIF_FONT", "PLPLOT_FREETYPE_MONO_FONT", "PLPLOT_FREETYPE_SCRIPT_FONT", "PLPLOT_FREETYPE_SYMBOL_FONT", "PLPLOT_FREETYPE_SANS_ITALIC_FONT", "PLPLOT_FREETYPE_SERIF_ITALIC_FONT", "PLPLOT_FREETYPE_MONO_ITALIC_FONT", "PLPLOT_FREETYPE_SCRIPT_ITALIC_FONT", "PLPLOT_FREETYPE_SYMBOL_ITALIC_FONT", "PLPLOT_FREETYPE_SANS_OBLIQUE_FONT", "PLPLOT_FREETYPE_SERIF_OBLIQUE_FONT", "PLPLOT_FREETYPE_MONO_OBLIQUE_FONT", "PLPLOT_FREETYPE_SCRIPT_OBLIQUE_FONT", "PLPLOT_FREETYPE_SYMBOL_OBLIQUE_FONT", "PLPLOT_FREETYPE_SANS_BOLD_FONT", "PLPLOT_FREETYPE_SERIF_BOLD_FONT", "PLPLOT_FREETYPE_MONO_BOLD_FONT", "PLPLOT_FREETYPE_SCRIPT_BOLD_FONT", "PLPLOT_FREETYPE_SYMBOL_BOLD_FONT", "PLPLOT_FREETYPE_SANS_BOLD_ITALIC_FONT", "PLPLOT_FREETYPE_SERIF_BOLD_ITALIC_FONT", "PLPLOT_FREETYPE_MONO_BOLD_ITALIC_FONT", "PLPLOT_FREETYPE_SCRIPT_BOLD_ITALIC_FONT", "PLPLOT_FREETYPE_SYMBOL_BOLD_ITALIC_FONT", "PLPLOT_FREETYPE_SANS_BOLD_OBLIQUE_FONT", "PLPLOT_FREETYPE_SERIF_BOLD_OBLIQUE_FONT", "PLPLOT_FREETYPE_MONO_BOLD_OBLIQUE_FONT", "PLPLOT_FREETYPE_SCRIPT_BOLD_OBLIQUE_FONT", "PLPLOT_FREETYPE_SYMBOL_BOLD_OBLIQUE_FONT" }; // Debugging extras static inline void NOOP_( id x, ... ) { ; } #ifdef LOGGING #define LOG NSLog #else #define LOG NOOP_ #endif // LOGGING //----------------------------------------------- // function declarations // ----------------------------------------------- // helper functions static void get_cursor( PLStream *, PLGraphicsIn * ); static void proc_str( PLStream *, EscText * ); NSMutableAttributedString * create_string( const PLUNICODE *, int, PLFLT ); static void set_font_and_size( NSMutableAttributedString *, PLUNICODE, PLFLT, int ); static void check_font_environment_variables( void ); // PLplot interface functions void plD_dispatch_init_aqt( PLDispatchTable *pdt ); void plD_init_aqt( PLStream * ); void plD_line_aqt( PLStream *, short, short, short, short ); void plD_polyline_aqt( PLStream *, short *, short *, PLINT ); void plD_eop_aqt( PLStream * ); void plD_bop_aqt( PLStream * ); void plD_tidy_aqt( PLStream * ); void plD_state_aqt( PLStream *, PLINT ); void plD_esc_aqt( PLStream *, PLINT, void * ); //-------------------------------------------------------------------------- // dispatch_init_init() // // Initialize device dispatch table //-------------------------------------------------------------------------- void plD_dispatch_init_aqt( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "AquaTerm - Mac OS X"; pdt->pl_DevName = "aqt"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 1; pdt->pl_init = (plD_init_fp) plD_init_aqt; pdt->pl_line = (plD_line_fp) plD_line_aqt; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_aqt; pdt->pl_eop = (plD_eop_fp) plD_eop_aqt; pdt->pl_bop = (plD_bop_fp) plD_bop_aqt; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_aqt; pdt->pl_state = (plD_state_fp) plD_state_aqt; pdt->pl_esc = (plD_esc_fp) plD_esc_aqt; } //-------------------------------------------------------------------------- // aqt_init() // // Initialize device //-------------------------------------------------------------------------- void plD_init_aqt( PLStream *pls ) { if ( arpool == NULL ) // Make sure we don't leak mem by allocating every time { arpool = [[NSAutoreleasePool alloc] init]; adapter = [[AQTAdapter alloc] init]; } [adapter setBackgroundColorRed : 0.5 green : 0.5 blue : 0.5]; pls->termin = 1; // interactive device pls->dev_flush = 1; // Handle our own flushes pls->color = 1; // supports color pls->width = 1; pls->verbose = 1; pls->bytecnt = 0; pls->debug = 1; pls->dev_text = 1; // handles text pls->dev_unicode = 1; // wants text as unicode pls->page = 0; pls->dev_fill0 = 1; // supports hardware solid fills pls->dev_fill1 = 1; pls->graphx = GRAPHICS_MODE; if ( !pls->colorset ) pls->color = 1; // Set up device parameters plP_setpxl( DPI / 25.4 / SCALE, DPI / 25.4 / SCALE ); // Pixels/mm. // Set the bounds for plotting. default is AQT_Default_X x AQT_Default_Y unless otherwise specified. if ( pls->xlength <= 0 || pls->ylength <= 0 ) { windowXSize = AQT_Default_X; windowYSize = AQT_Default_Y; plP_setphy( (PLINT) 0, (PLINT) ( AQT_Default_X / SCALE ), (PLINT) 0, (PLINT) ( AQT_Default_Y / SCALE ) ); } else { windowXSize = pls->xlength; windowYSize = pls->ylength; plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / SCALE ), (PLINT) 0, (PLINT) ( pls->ylength / SCALE ) ); } // check font environment variables & update font table as necessary check_font_environment_variables(); // Check to see if the users version of aquaterm supports sheared labels. // If it isn't available 3D plots will look a little strange but things should otherwise be okay. if ( !didTests ) { hasShear = [adapter respondsToSelector:@selector( addLabel:atPoint:angle:shearAngle:align: )]; hasAlpha = [adapter respondsToSelector:@selector( setColorRed:green:blue:alpha: )]; didTests = true; } } //-------------------------------------------------------------------------- // aqt_bop() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_aqt( PLStream *pls ) { currentPlot = currentPlot >= maxWindows ? 0 : currentPlot; [adapter openPlotWithIndex : currentPlot++]; [adapter setPlotSize : NSMakeSize( windowXSize, windowYSize )]; [adapter setLinewidth : 1.0]; if ( hasAlpha ) { [adapter setColorRed : (float) ( pls->curcolor.r / 255. ) green : (float) ( pls->curcolor.g / 255. ) blue : (float) ( pls->curcolor.b / 255. ) alpha : (float) ( pls->curcolor.a )]; } else { [adapter setColorRed : (float) ( pls->curcolor.r / 255. ) green : (float) ( pls->curcolor.g / 255. ) blue : (float) ( pls->curcolor.b / 255. )]; } pls->page++; } //-------------------------------------------------------------------------- // aqt_line() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_aqt( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { [adapter moveToPoint : NSMakePoint( (float) x1a * SCALE, (float) y1a * SCALE )]; [adapter addLineToPoint : NSMakePoint( (float) x2a * SCALE, (float) y2a * SCALE )]; } //-------------------------------------------------------------------------- // aqt_polyline() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_aqt( PLStream *pls, short *xa, short *ya, PLINT npts ) { int i; for ( i = 0; i < npts - 1; i++ ) plD_line_aqt( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // aqt_eop() // // End of page //-------------------------------------------------------------------------- void plD_eop_aqt( PLStream *pls ) { [arpool release]; // prevents a memory leak by freeing everything in // the auto-release pool when the plot is closed. arpool = [[NSAutoreleasePool alloc] init]; [adapter renderPlot]; } //-------------------------------------------------------------------------- // aqt_tidy() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_aqt( PLStream *pls ) { [adapter closePlot]; } //-------------------------------------------------------------------------- // plD_state_aqt() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_aqt( PLStream *pls, PLINT op ) { int i; float r, g, b; switch ( op ) { case PLSTATE_WIDTH: [adapter setLinewidth : (float) pls->width]; break; case PLSTATE_COLOR0: // this seems to work, but that isn't to say that it is done right... if ( hasAlpha ) { [adapter setBackgroundColorRed : (float) ( plsc->cmap0[0].r / 255.0 ) green : (float) ( plsc->cmap0[0].g / 255.0 ) blue : (float) ( plsc->cmap0[0].b / 255.0 ) alpha : (float) ( plsc->cmap0[0].a )]; } else { [adapter setBackgroundColorRed : (float) ( plsc->cmap0[0].r / 255.0 ) green : (float) ( plsc->cmap0[0].g / 255.0 ) blue : (float) ( plsc->cmap0[0].b / 255.0 )]; } case PLSTATE_COLOR1: case PLSTATE_FILL: if ( hasAlpha ) { [adapter setColorRed : (float) ( pls->curcolor.r / 255. ) green : (float) ( pls->curcolor.g / 255. ) blue : (float) ( pls->curcolor.b / 255. ) alpha : (float) ( pls->curcolor.a )]; } else { [adapter setColorRed : (float) ( pls->curcolor.r / 255. ) green : (float) ( pls->curcolor.g / 255. ) blue : (float) ( pls->curcolor.b / 255. )]; } break; case PLSTATE_CMAP0: break; case PLSTATE_CMAP1: break; } } //-------------------------------------------------------------------------- // aqt_esc() // // Escape function. // // Functions: // // PLESC_EH Handle pending events // PLESC_EXPOSE Force an expose // PLESC_FILL Fill polygon // PLESC_FLUSH Flush X event buffer // PLESC_GETC Get coordinates upon mouse click // PLESC_REDRAW Force a redraw // PLESC_RESIZE Force a resize //-------------------------------------------------------------------------- void plD_esc_aqt( PLStream *pls, PLINT op, void *ptr ) { int i; switch ( op ) { case PLESC_EXPOSE: // handle window expose break; case PLESC_RESIZE: // handle window resize break; case PLESC_REDRAW: // handle window redraw break; case PLESC_TEXT: // switch to text screen break; case PLESC_GRAPH: // switch to graphics screen break; case PLESC_FILL: // fill polygon [adapter moveToVertexPoint : NSMakePoint( pls->dev_x[0] * SCALE, pls->dev_y[0] * SCALE )]; for ( i = 1; i < pls->dev_npts; i++ ) { [adapter addEdgeToVertexPoint : NSMakePoint( pls->dev_x[i] * SCALE, pls->dev_y[i] * SCALE )]; } ; break; case PLESC_DI: // handle DI command break; case PLESC_FLUSH: // flush output [adapter renderPlot]; break; case PLESC_EH: // handle Window events break; case PLESC_GETC: // get cursor position [adapter renderPlot]; // needed to give the user something to click on get_cursor( pls, (PLGraphicsIn *) ptr ); break; case PLESC_SWIN: // set window parameters break; case PLESC_HAS_TEXT: proc_str( pls, (EscText *) ptr ); break; } } //-------------------------------------------------------------------------- // get_cursor() // // returns the location of the next mouse click //-------------------------------------------------------------------------- void get_cursor( PLStream *pls, PLGraphicsIn *gin ) { int scanned, x, y, button; NSString *temp; plGinInit( gin ); temp = [adapter waitNextEvent]; scanned = sscanf([temp cString], "1:{%d, %d}:%d", &x, &y, &button ); if ( scanned == 3 ) // check that we did actually get a reasonable event string { gin->button = button; gin->pX = x; gin->pY = y; gin->dX = (PLFLT) x / ( (PLFLT) ( pls->xlength ) ); gin->dY = (PLFLT) y / ( (PLFLT) ( pls->ylength ) ); } else // just return zeroes if we did not { printf( "AquaTerm did not return a valid mouse location!\n" ); gin->button = 0; gin->pX = 0; gin->pY = 0; gin->dX = 0.0; gin->dY = 0.0; } } //-------------------------------------------------------------------------- // proc_str() // // Processes strings for display. The actual parsing of the unicode // string is handled by the sub-routine create_string. //-------------------------------------------------------------------------- void proc_str( PLStream *pls, EscText *args ) { PLFLT a1, ft_ht, angle, shear, stride; PLINT clxmin, clxmax, clymin, clymax; int i, jst, ref; NSMutableAttributedString *str; // check that we got unicode, warning message and return if not if ( args->unicode_array_len == 0 ) { printf( "Non unicode string passed to AquaTerm driver, ignoring\n" ); return; } // check that unicode string isn't longer then the max we allow if ( args->unicode_array_len >= MAX_STRING_LEN ) { printf( "Sorry, the AquaTerm driver only handles strings of length < %d\n", MAX_STRING_LEN ); return; } // set the font height - the 1.2 factor was trial and error ft_ht = 1.2 * pls->chrht * DPI / 25.4; // ft_ht in points. ht is in mm // given transform, calculate rotation angle & shear angle plRotationShear( args->xform, &angle, &shear, &stride ); angle *= 180.0 / PI; shear *= -180.0 / PI; // text justification, AquaTerm only supports 3 options, so we round appropriately if ( args->just < 0.33 ) jst = AQTAlignLeft; // left else if ( args->just > 0.66 ) jst = AQTAlignRight; // right else jst = AQTAlignCenter; // center // set the baseline of the string // Middle and Bottom are set to Middle since this seems to be what PLplot expects // as judged by where it renders the symbols in example 1. if ( args->base == 2 ) // Top ref = AQTAlignTop; else if ( args->base == 1 ) // Bottom ref = AQTAlignMiddle; else ref = AQTAlignMiddle; // Middle // create an appropriately formatted, etc... unicode string str = create_string( args->unicode_array, args->unicode_array_len, ft_ht ); // display the string if ( hasAlpha ) { [adapter setColorRed : (float) ( pls->curcolor.r / 255. ) green : (float) ( pls->curcolor.g / 255. ) blue : (float) ( pls->curcolor.b / 255. ) alpha : (float) ( pls->curcolor.a )]; } else { [adapter setColorRed : (float) ( pls->curcolor.r / 255. ) green : (float) ( pls->curcolor.g / 255. ) blue : (float) ( pls->curcolor.b / 255. )]; } if ( hasShear ) { [adapter addLabel : str atPoint : NSMakePoint( (float) args->x * SCALE, (float) args->y * SCALE ) angle : angle shearAngle : shear align : ( jst | ref )]; } else { [adapter addLabel : str atPoint : NSMakePoint( (float) args->x * SCALE, (float) args->y * SCALE ) angle : angle align : ( jst | ref )]; } [str release]; } //-------------------------------------------------------------------------- // create_string() // // create a NSMutableAttributedString from the plplot ucs4 string // // assumptions : // 1. font changes are unicode >= PL_FCI_MARK // 2. we'll never have to deal with a string longer then MAX_STRING_LEN characters // 3. means we desired as a character & not actually as // 4. there are no two character sequences... i.e. fn is now covered by fci // //-------------------------------------------------------------------------- NSMutableAttributedString * create_string( const PLUNICODE *ucs4, int ucs4_len, PLFLT font_height ) { PLUNICODE fci; char plplot_esc; int i; int cur_loc; int utf8_len; int updown; char dummy[MAX_STRING_LEN + 1]; char *font; char utf8[5]; NSMutableAttributedString *str; updown = 0; // initialize the attributed string for ( i = 0; i < MAX_STRING_LEN; i++ ) dummy[i] = 'i'; dummy[MAX_STRING_LEN] = '\0'; str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithCString:dummy]]; // get plplot escape character & current font plgesc( &plplot_esc ); plgfci( &fci ); // set the font for the string based on the current font & size set_font_and_size( str, fci, font_height, 0 ); // parse plplot ucs4 string cur_loc = 0; i = 0; while ( i < ucs4_len ) { if ( ucs4[i] < PL_FCI_MARK ) // not a font change { if ( ucs4[i] != (PLUNICODE) plplot_esc ) // a character to display { ucs4_to_utf8( ucs4[i], utf8 ); [str replaceCharactersInRange : NSMakeRange( cur_loc, 1 ) withString :[NSString stringWithUTF8String : utf8]]; i++; cur_loc++; continue; } i++; if ( ucs4[i] == (PLUNICODE) plplot_esc ) { ucs4_to_utf8( ucs4[i], utf8 ); [str replaceCharactersInRange : NSMakeRange( cur_loc, 1 ) withString :[NSString stringWithUTF8String : utf8]]; i++; cur_loc++; continue; } else { if ( ucs4[i] == (PLUNICODE) 'f' ) // font change { i++; printf( "hmm, unicode string apparently not following fci convention...\n" ); } if ( ucs4[i] == (PLUNICODE) 'd' ) // Subscript { updown--; [str addAttribute : @ "NSSuperScript" value :[NSNumber numberWithInt : updown] range : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; } if ( ucs4[i] == (PLUNICODE) 'u' ) // Superscript { updown++; [str addAttribute : @ "NSSuperScript" value :[NSNumber numberWithInt : updown] range : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; } i++; } } else // a font change { set_font_and_size( str, ucs4[i], font_height, cur_loc ); i++; } } // trim string to appropriate final length [str deleteCharactersInRange : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; return str; } //-------------------------------------------------------------------------- // set_font_and_size // // set the font & size of a attributable string object //-------------------------------------------------------------------------- void set_font_and_size( NSMutableAttributedString * str, PLUNICODE fci, PLFLT font_height, int cur_loc ) { char *font; font = plP_FCI2FontName( fci, AQT_FontLookup, AQT_N_FontLookup ); // check whether that font exists & if not, use standard font instead if ( font == NULL ) { printf( "AquaTerm : Warning, could not find font given by fci = 0x%x\n", fci ); font = "Helvetica"; } /* font = "FreeSerif"; *//* force the font for debugging purposes */ // printf("Font at %d is : %s\n", cur_loc, font); [str addAttribute : @ "AQTFontname" value :[NSString stringWithCString : font] range : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; [str addAttribute : @ "AQTFontsize" value :[NSNumber numberWithFloat : font_height] range : NSMakeRange( cur_loc, ( MAX_STRING_LEN - cur_loc ) )]; } //-------------------------------------------------------------------------- // check_font_environment_variables // // Checks to see if any font environment variables are defined. // If a font environment variable is defined, then the appropriate // element of the default font table is replaced with the font name // string specified by the environment variable. //-------------------------------------------------------------------------- void check_font_environment_variables( void ) { int i; char *new_font; char *begin; char *end; for ( i = 0; i < AQT_N_FontLookup; i++ ) { if ( ( new_font = getenv( aqt_font_env_names[i] ) ) != NULL ) { // If the user is just blindly following the suggestions in // the plplot examples then we might get a font name with // a path and extension. We need to remove that since it // isn't relevant and will only cause trouble. We warn them // AquaTerm was not expecting a path or extension. begin = strrchr( new_font, '/' ); end = strrchr( new_font, '.' ); if ( end != NULL ) { printf( "Aquaterm : Warning, removing extension from font name : %s\n", new_font ); *end = '\0'; } if ( begin != NULL ) { printf( "AquaTerm : Warning, removing path from font name : %s\n", new_font ); new_font = begin + 1; } // printf("new font : %s\n", new_font); AQT_FontLookup[i].pfont = (unsigned char *) new_font; } } } plplot-5.10.0+dfsg/drivers/linuxvga.driver_info.in 644 1750 1750 5311466747272 210560ustar andrewandrewlinuxvga:Linux VGA driver:0:linuxvga:8:vga plplot-5.10.0+dfsg/drivers/dg300.driver_info.in 644 1750 1750 4611466747272 200400ustar andrewandrewdg300:DG300 Terminal:0:dg300:25:dg300 plplot-5.10.0+dfsg/drivers/ps.driver_info.in 644 1750 1750 12411466747272 176620ustar andrewandrewps:PostScript File (monochrome):0:ps:29:psm psc:PostScript File (color):0:ps:30:psc plplot-5.10.0+dfsg/drivers/pbm.driver_info.in 644 1750 1750 4211466747272 177750ustar andrewandrewpbm:PDB (PPM) Driver:0:pbm:38:pbm plplot-5.10.0+dfsg/drivers/tek.driver_info.in 644 1750 1750 42611466747272 200300ustar andrewandrewconex:Conex vt320/tek emulator:1:tek:24:conex mskermit:MS-Kermit emulator:1:tek:21:mskermit tek4107f:Tektronix File (4105/4107):0:tek:28:tek4107f versaterm:Versaterm vt100/tek emulator:1:tek:22:versaterm vlt:VLT vt100/tek emulator:1:tek:23:vlt xterm:Xterm Window:1:tek:18:xterm plplot-5.10.0+dfsg/drivers/psttf.driver_info.in 644 1750 1750 14611466747272 204040ustar andrewandrewpsttf:PostScript File (monochrome):0:psttf:55:psttfm psttfc:PostScript File (color):0:psttf:56:psttfc plplot-5.10.0+dfsg/drivers/dg300.c 644 1750 1750 1154111462322041 154040ustar andrewandrew// $Id: dg300.c 11282 2010-10-28 16:26:09Z airwin $ // // PLplot dg300 device driver. // #include "plDevs.h" #ifdef PLD_dg300 #include "plplotP.h" #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_dg300 = "dg300:DG300 Terminal:0:dg300:25:dg300\n"; void plD_dispatch_init_dg( PLDispatchTable *pdt ); void plD_init_dg( PLStream * ); void plD_line_dg( PLStream *, short, short, short, short ); void plD_polyline_dg( PLStream *, short *, short *, PLINT ); void plD_eop_dg( PLStream * ); void plD_bop_dg( PLStream * ); void plD_tidy_dg( PLStream * ); void plD_state_dg( PLStream *, PLINT ); void plD_esc_dg( PLStream *, PLINT, void * ); // top level declarations #define DGX 639 #define DGY 239 struct termattr { unsigned char com[4]; unsigned char rom[4]; unsigned char ram[4]; unsigned char con[5]; unsigned char eor; } termattr; void plD_dispatch_init_dg( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "DG300 Terminal"; pdt->pl_DevName = "dg300"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 25; pdt->pl_init = (plD_init_fp) plD_init_dg; pdt->pl_line = (plD_line_fp) plD_line_dg; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_dg; pdt->pl_eop = (plD_eop_fp) plD_eop_dg; pdt->pl_bop = (plD_bop_fp) plD_bop_dg; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_dg; pdt->pl_state = (plD_state_fp) plD_state_dg; pdt->pl_esc = (plD_esc_fp) plD_esc_dg; } //-------------------------------------------------------------------------- // plD_init_dg() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_dg( PLStream *pls ) { // Request terminal configuration report printf( "\n\036\107\051\n" ); scanf( "%s", (char *) &termattr ); while ( getchar() != '\n' ) ; if ( !strncmp( (char *) &termattr.ram[0], "0000", 4 ) ) { printf( "Please wait while graphics interpreter is downloaded.\n" ); // Need to download graphics interpreter. system( "cat /usr/local/src/g300/g300gci110.tx" ); } // Clear screen, Set pen color to green, Absolute positioning printf( "\036\107\063\060\n\036\107\155\061\n\036\107\151\060\n" ); printf( "\036\107\042\061\n" ); pls->termin = 1; // Is an interactive device plP_setpxl( (PLFLT) ( 3.316 * 16 ), (PLFLT) ( 1.655 * 16 ) ); plP_setphy( 0, DGX * 16, 0, DGY * 16 ); } //-------------------------------------------------------------------------- // plD_line_dg() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_dg( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; printf( "LINE %d %d %d %d\n", x1 >> 4, y1 >> 3, x2 >> 4, y2 >> 3 ); } //-------------------------------------------------------------------------- // plD_polyline_dg() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_dg( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_dg( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // plD_eop_dg() // // End of page. User must hit a to continue. //-------------------------------------------------------------------------- void plD_eop_dg( PLStream *pls ) { putchar( '\007' ); fflush( stdout ); while ( getchar() != '\n' ) ; printf( "ERASE\n" ); } //-------------------------------------------------------------------------- // plD_bop_dg() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_dg( PLStream *pls ) { pls->page++; } //-------------------------------------------------------------------------- // plD_tidy_dg() // // Close graphics file //-------------------------------------------------------------------------- void plD_tidy_dg( PLStream *pls ) { printf( "\036\107\042\060\n" ); fflush( stdout ); } //-------------------------------------------------------------------------- // plD_state_dg() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_dg( PLStream *pls, PLINT op ) { } //-------------------------------------------------------------------------- // plD_esc_dg() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_dg( PLStream *pls, PLINT op, void *ptr ) { } #else int pldummy_dg300() { return 0; } #endif // PLD_dg300 plplot-5.10.0+dfsg/drivers/xfig.c 644 1750 1750 4102512232323306 155250ustar andrewandrew// $Id: xfig.c 12626 2013-10-24 23:01:26Z andrewross $ // // PLplot xfig device driver. // #include "plDevs.h" #ifdef PLD_xfig #include "plplotP.h" #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_xfig = "xfig:Fig file:0:xfig:31:xfig\n"; typedef struct { PLINT xold, yold; PLINT xmin, xmax; PLINT ymin, ymax; PLFLT xscale_dev, yscale_dev; int *buffptr, bufflen; int count; int curwid; int curcol; int firstline; long cmap0_pos, cmap1_pos; int cmap0_ncol, cmap1_ncol; int offset, offset_inc; } xfig_Dev; // Function prototypes void plD_dispatch_init_xfig( PLDispatchTable *pdt ); void plD_init_xfig( PLStream * ); void plD_line_xfig( PLStream *, short, short, short, short ); void plD_polyline_xfig( PLStream *, short *, short *, PLINT ); void plD_eop_xfig( PLStream * ); void plD_bop_xfig( PLStream * ); void plD_tidy_xfig( PLStream * ); void plD_state_xfig( PLStream *, PLINT ); void plD_esc_xfig( PLStream *, PLINT, void * ); static void flushbuffer( PLStream * ); // top level declarations #define FIGX 297 // portrait A4 mm #define FIGY 210 #define DPI 1200 // it looks like xfig-3.2.3c has a bug. A4 papersize is 297x210 mm, // and at 1200 dpi this gives 14031x9921 dots. In a file saved from // xfig, with a box of A4 size, the reported sizes are 13365x9450 #define BSIZE 25 #define XFIG_COLBASE 33 // xfig first user color, plplot colormap0[0], // the background color static void stcmap0( PLStream * ); static void stcmap1( PLStream * ); static void proc_str( PLStream *, EscText * ); static int text = 0; static DrvOpt xfig_options[] = { { "text", DRV_INT, &text, "Use Postscript text (text=1|0)" }, { NULL, DRV_INT, NULL, NULL } }; void plD_dispatch_init_xfig( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Xfig file"; pdt->pl_DevName = "xfig"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 31; pdt->pl_init = (plD_init_fp) plD_init_xfig; pdt->pl_line = (plD_line_fp) plD_line_xfig; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_xfig; pdt->pl_eop = (plD_eop_fp) plD_eop_xfig; pdt->pl_bop = (plD_bop_fp) plD_bop_xfig; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_xfig; pdt->pl_state = (plD_state_fp) plD_state_xfig; pdt->pl_esc = (plD_esc_fp) plD_esc_xfig; } //-------------------------------------------------------------------------- // plD_init_xfig() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_xfig( PLStream *pls ) { xfig_Dev *dev; plParseDrvOpts( xfig_options ); if ( text ) pls->dev_text = 1; // want to draw text // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( xfig_Dev ) ); if ( pls->dev == NULL ) plexit( "plD_init_xfig: cannot allocate memory\n" ); dev = (xfig_Dev *) pls->dev; dev->curwid = pls->width < 1 ? 1 : (int) pls->width; dev->firstline = 1; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->xmin = 0; dev->xmax = FIGX; dev->ymin = 0; dev->ymax = FIGY; dev->xscale_dev = DPI / 25.4; dev->yscale_dev = DPI / 25.4; dev->offset_inc = dev->ymax * (PLINT) dev->yscale_dev; dev->offset = -dev->offset_inc; pls->dev_fill0 = 1; // Handle solid fills if ( !pls->colorset ) pls->color = 1; // Is a color device plP_setpxl( dev->xscale_dev, dev->xscale_dev ); // dpmm -- dots per mm plP_setphy( 0, (PLINT) ( FIGX * dev->xscale_dev ), 0, (PLINT) ( FIGY * dev->yscale_dev ) ); // physical dimension in mm // Write out header fprintf( pls->OutFile, "#FIG 3.2\n" ); fprintf( pls->OutFile, "Landscape\n" ); fprintf( pls->OutFile, "Center\n" ); fprintf( pls->OutFile, "Metric\n" ); fprintf( pls->OutFile, "A4\n" ); fprintf( pls->OutFile, "100.0\n" ); fprintf( pls->OutFile, "Single\n" ); fprintf( pls->OutFile, "-2\n" ); fprintf( pls->OutFile, "%d 2\n", DPI ); // user defined colors, for colormap0 dev->cmap0_ncol = 2 * pls->ncol0; // allow for a maximum of 2x the default cmap0 entries dev->cmap0_pos = ftell( pls->OutFile ); stcmap0( pls ); // user defined colors, for colormap1 dev->cmap1_ncol = 2 * pls->ncol1; // allow for a maximum of 2x the default cmap1 entries dev->cmap1_pos = ftell( pls->OutFile ); stcmap1( pls ); dev->bufflen = 2 * BSIZE; dev->buffptr = (int *) malloc( sizeof ( int ) * (size_t) ( dev->bufflen ) ); if ( dev->buffptr == NULL ) plexit( "plD_init_xfig: Out of memory!" ); } void stcmap0( PLStream *pls ) { xfig_Dev *dev; long cur_pos; int i; dev = (xfig_Dev *) pls->dev; if ( pls->ncol0 > dev->cmap0_ncol ) plwarn( "Too many colors for cmap0. Preallocate using command line '-ncol0 n.\n'" ); cur_pos = ftell( pls->OutFile ); if ( fseek( pls->OutFile, dev->cmap0_pos, SEEK_SET ) ) plexit( "Sorry, only file based output, no pipes.\n" ); // fill the colormap for ( i = 0; i < pls->ncol0; i++ ) fprintf( pls->OutFile, "0 %d #%.2x%.2x%.2x\n", i + XFIG_COLBASE, pls->cmap0[i].r, pls->cmap0[i].g, pls->cmap0[i].b ); // fill the nonspecified entries colormap for ( i = pls->ncol0; i < dev->cmap0_ncol; i++ ) fprintf( pls->OutFile, "0 %d #000000\n", i + XFIG_COLBASE ); if ( cur_pos != dev->cmap0_pos ) fseek( pls->OutFile, cur_pos, SEEK_SET ); } void stcmap1( PLStream *pls ) { xfig_Dev *dev; long cur_pos; int i; dev = (xfig_Dev *) pls->dev; if ( pls->ncol1 > dev->cmap1_ncol ) plwarn( "Too many colors for cmap1. Preallocate using command line '-ncol1 n.\n'" ); cur_pos = ftell( pls->OutFile ); if ( fseek( pls->OutFile, dev->cmap1_pos, SEEK_SET ) ) plexit( "Sorry, only file based output, no pipes.\n" ); // fill the colormap for ( i = 0; i < pls->ncol1; i++ ) fprintf( pls->OutFile, "0 %d #%.2x%.2x%.2x\n", i + XFIG_COLBASE + dev->cmap0_ncol, pls->cmap1[i].r, pls->cmap1[i].g, pls->cmap1[i].b ); // fill the nonspecified entries colormap for ( i = pls->ncol1; i < dev->cmap1_ncol; i++ ) fprintf( pls->OutFile, "0 %d #000000\n", i + XFIG_COLBASE + dev->cmap0_ncol ); if ( cur_pos != dev->cmap1_pos ) fseek( pls->OutFile, cur_pos, SEEK_SET ); } //-------------------------------------------------------------------------- // plD_line_xfig() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_xfig( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { xfig_Dev *dev = (xfig_Dev *) pls->dev; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; int *tempptr; int count; // If starting point of this line is the same as the ending point of // the previous line then don't raise the pen. (This really speeds up // plotting and reduces the size of the file. if ( dev->firstline ) { count = 0; *( dev->buffptr + count++ ) = x1; *( dev->buffptr + count++ ) = y1; *( dev->buffptr + count++ ) = x2; *( dev->buffptr + count++ ) = y2; dev->firstline = 0; } else if ( x1 == dev->xold && y1 == dev->yold ) { count = dev->count; if ( count + 2 >= dev->bufflen ) { dev->bufflen += 2 * BSIZE; tempptr = (int *) realloc( (void *) dev->buffptr, (size_t) ( dev->bufflen ) * sizeof ( int ) ); if ( tempptr == NULL ) { free( (void *) dev->buffptr ); plexit( "plD_line_xfig: Out of memory!" ); } dev->buffptr = tempptr; } *( dev->buffptr + count++ ) = x2; *( dev->buffptr + count++ ) = y2; } else { flushbuffer( pls ); count = dev->count; *( dev->buffptr + count++ ) = x1; *( dev->buffptr + count++ ) = y1; *( dev->buffptr + count++ ) = x2; *( dev->buffptr + count++ ) = y2; } dev->count = count; dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_xfig() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_xfig( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_xfig( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // plD_eop_xfig() // // End of page. //-------------------------------------------------------------------------- void plD_eop_xfig( PLStream *pls ) { xfig_Dev *dev = (xfig_Dev *) pls->dev; if ( !dev->firstline ) flushbuffer( pls ); } //-------------------------------------------------------------------------- // plD_bop_xfig() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_xfig( PLStream *pls ) { xfig_Dev *dev; if ( !pls->termin ) plGetFam( pls ); dev = (xfig_Dev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->firstline = 1; pls->famadv = 1; pls->page++; dev->offset += dev->offset_inc; flushbuffer( pls ); // create background FIXME -- sync with orientation in header and pls->diorot dev->curcol = XFIG_COLBASE; // colormap entry 0, background fprintf( pls->OutFile, "2 1 0 1 %d %d 50 0 20 0.0 0 0 -1 0 0 5\n", dev->curcol, dev->curcol ); fprintf( pls->OutFile, "%d %d %d %d %d %d %d %d %d %d\n", 0, dev->offset, 0, (int) ( FIGY * dev->yscale_dev ) + dev->offset, (int) ( FIGX * dev->xscale_dev ), (int) ( FIGY * dev->yscale_dev ) + dev->offset, (int) ( FIGX * dev->xscale_dev ), dev->offset, 0, dev->offset ); } //-------------------------------------------------------------------------- // plD_tidy_xfig() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_xfig( PLStream *pls ) { xfig_Dev *dev = (xfig_Dev *) pls->dev; flushbuffer( pls ); free( (void *) dev->buffptr ); plCloseFile( pls ); } //-------------------------------------------------------------------------- // plD_state_xfig() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_xfig( PLStream *pls, PLINT op ) { xfig_Dev *dev = (xfig_Dev *) pls->dev; switch ( op ) { case PLSTATE_WIDTH: flushbuffer( pls ); dev->firstline = 1; dev->curwid = pls->width < 1 ? 1 : (int) pls->width; break; case PLSTATE_COLOR0: flushbuffer( pls ); dev->curcol = pls->icol0 + XFIG_COLBASE; break; case PLSTATE_COLOR1: flushbuffer( pls ); dev->curcol = pls->icol1 + XFIG_COLBASE + pls->ncol0; break; case PLSTATE_CMAP0: stcmap0( pls ); break; case PLSTATE_CMAP1: stcmap1( pls ); break; } } //-------------------------------------------------------------------------- // plD_esc_xfig() // // Escape function. // Preliminary fill support for colormap0 //-------------------------------------------------------------------------- void plD_esc_xfig( PLStream *pls, PLINT op, void *ptr ) { xfig_Dev *dev = pls->dev; int i, npts; switch ( op ) { case PLESC_FILL: npts = pls->dev_npts; flushbuffer( pls ); fprintf( pls->OutFile, "2 1 0 1 %d %d 50 0 20 0.0 0 0 0 0 0 %d\n", dev->curcol, dev->curcol, npts ); for ( i = 0; i < npts; i++ ) fprintf( pls->OutFile, "%d %d ", pls->dev_x[i], dev->offset + dev->ymax * (int) dev->xscale_dev - pls->dev_y[i] ); fprintf( pls->OutFile, "\n" ); break; case PLESC_HAS_TEXT: proc_str( pls, ptr ); break; } } //-------------------------------------------------------------------------- // Utility functions. //-------------------------------------------------------------------------- static void flushbuffer( PLStream *pls ) { xfig_Dev *dev = pls->dev; int i = 0; if ( dev->count == 0 ) return; fprintf( pls->OutFile, "2 1 0 %d %d 0 50 0 -1 0.0 0 0 0 0 0 %d\n", dev->curwid, dev->curcol, dev->count / 2 ); while ( i < dev->count ) { fprintf( pls->OutFile, "%d %d ", *( dev->buffptr + i ), dev->offset + dev->ymax * (int) dev->yscale_dev - *( dev->buffptr + i + 1 ) ); i += 2; } fprintf( pls->OutFile, "\n" ); dev->count = 0; } void proc_str( PLStream *pls, EscText *args ) { PLFLT *t = args->xform; PLFLT a1, alpha, ft_ht, angle, ref; xfig_Dev *dev = (xfig_Dev *) pls->dev; PLINT clxmin, clxmax, clymin, clymax; int jst, font; // font height ft_ht = pls->chrht * 72.0 / 25.4; // ft_ht in points. ht is in mm // calculate baseline text angle angle = pls->diorot * 90.; a1 = acos( t[0] ) * 180. / PI; if ( t[2] > 0. ) alpha = a1 - angle; else alpha = 360. - a1 - angle; alpha = alpha * PI / 180.; // TODO: parse string for format (escape) characters // parse_str(args->string, return_string); // apply transformations difilt( &args->x, &args->y, 1, &clxmin, &clxmax, &clymin, &clymax ); // check clip limits. For now, only the reference point of the string is checked; // but the the whole string should be checked -- using a postscript construct // such as gsave/clip/grestore. This method can also be applied to the xfig and // pstex drivers. Zoom side effect: the font size must be adjusted! if ( args->x < clxmin || args->x > clxmax || args->y < clymin || args->y > clymax ) return; // // Text justification. Left, center and right justification, which // are the more common options, are supported; variable justification is // only approximate, based on plplot computation of it's string lenght // if ( args->just == 0.5 ) jst = 1; // center else if ( args->just == 1. ) jst = 2; // right else { jst = 0; // left args->x = args->refx; // use hints provided by plplot args->y = args->refy; } // // Reference point (center baseline of string, not latex character reference point). // If base = 0, it is aligned with the center of the text box // If base = 1, it is aligned with the baseline of the text box // If base = 2, it is aligned with the top of the text box // Currently plplot only uses base=0 // xfig use base=1 // if ( args->base == 2 ) // not supported by plplot ref = -DPI / 72. * ft_ht / 2.; // half font height in xfig unities (1/1200 inches) else if ( args->base == 1 ) ref = 0.; else ref = DPI / 72. * ft_ht / 2.; // rotate point in xfig is lower left corner, compensate args->y = (PLINT) ( dev->offset + dev->ymax * (int) dev->xscale_dev - ( args->y - ref * cos( alpha ) ) ); args->x = (PLINT) ( args->x + ref * sin( alpha ) ); // // font family, serie and shape. Currently not supported by plplot // // Use Postscript Times // 1: Normal font // 2: Roman font // 3: Italic font // 4: sans serif // switch ( pls->cfont ) { case ( 1 ): font = 0; break; case ( 2 ): font = 1; break; case ( 3 ): font = 3; break; case ( 4 ): font = 4; break; default: font = 0; } fprintf( pls->OutFile, "4 %d %d 50 0 %d %f %f 4 1 1 %d %d %s\\001\n", jst, dev->curcol, font, 1.8 /*!*/ * ft_ht, alpha, args->x, args->y, args->string ); } #else int pldummy_xfig() { return 0; } #endif // PLD_xfig plplot-5.10.0+dfsg/drivers/psttf.cc 644 1750 1750 12427712253760740 161400ustar andrewandrew// $Id: psttf.cc 12874 2013-12-17 05:32:16Z airwin $ // // PLplot PostScript device driver using LASi to provide fonts // based on original ps.c PostScript driver // // Copyright (C) 1992, 2001 Geoffrey Furnish // Copyright (C) 1992, 1993, 1994, 1995, 2001 Maurice LeBrun // Copyright (C) 2000-2011 Alan W. Irwin // Copyright (C) 2001, 2002 Joao Cardoso // Copyright (C) 2001, 2003, 2004 Rafael Laboissiere // Copyright (C) 2004, 2005 Thomas J. Duck // Copyright (C) 2005, 2006 Andrew Ross // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plDevs.h" #if defined ( PLD_psttf ) //#define NEED_PLDEBUG #include "plplotP.h" #include "drivers.h" #include "ps.h" #include #include #include "plfreetype.h" #include #include #include // Define macro to truncate small values to zero - prevents // * printf printing -0.000 #define TRMFLT( a ) ( ( fabs( a ) < 5.0e-4 ) ? 0.0 : ( a ) ) using namespace LASi; using namespace std; // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_psttf = "psttf:PostScript File (monochrome):0:psttf:55:psttfm\n" "psttfc:PostScript File (color):0:psttf:56:psttfc\n"; // Prototypes for functions in this file. void plD_dispatch_init_psttfm( PLDispatchTable *pdt ); void plD_dispatch_init_psttfc( PLDispatchTable *pdt ); static char *ps_getdate( void ); static void ps_init( PLStream * ); static void fill_polygon( PLStream *pls ); static void proc_str( PLStream *, EscText * ); //static void esc_purge( char *, char * ); #define OUTBUF_LEN 128 static char outbuf[OUTBUF_LEN]; static int text = 1; static int color; static int hrshsym = 0; // Font style and weight lookup tables #define N_Pango_Lookup 5 const char * DefaultFamilyLookup[N_Pango_Lookup] = { "sans", "serif", "monospace", "sans,serif", "sans,serif" }; const char * EnvFamilyLookup[N_Pango_Lookup] = { "PLPLOT_FREETYPE_SANS_FAMILY", "PLPLOT_FREETYPE_SERIF_FAMILY", "PLPLOT_FREETYPE_MONO_FAMILY", "PLPLOT_FREETYPE_SCRIPT_FAMILY", "PLPLOT_FREETYPE_SYMBOL_FAMILY" }; #define FAMILY_LOOKUP_LEN 1024 char FamilyLookup[N_Pango_Lookup][FAMILY_LOOKUP_LEN]; const FontWeight WeightLookup[2] = { NORMAL_WEIGHT, BOLD }; const FontStyle StyleLookup[3] = { NORMAL_STYLE, ITALIC, OBLIQUE }; static DrvOpt ps_options[] = { { "text", DRV_INT, &text, "Use Postscript text (text=0|1)" }, { "color", DRV_INT, &color, "Use color (color=0|1)" }, { "hrshsym", DRV_INT, &hrshsym, "Use Hershey symbol set (hrshsym=0|1)" }, { NULL, DRV_INT, NULL, NULL } }; // text > 0 uses some postscript tricks, namely a transformation matrix // that scales, rotates (with slanting) and offsets text strings. // It has yet some bugs for 3d plots. static void psttf_dispatch_init_helper( PLDispatchTable *pdt, const char *menustr, const char *devnam, int type, int seq, plD_init_fp init ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = (char *) menustr; pdt->pl_DevName = (char *) devnam; #else (void) menustr; // Cast to void to silence compiler warnings about unused parameters (void) devnam; #endif pdt->pl_type = type; pdt->pl_seq = seq; pdt->pl_init = init; pdt->pl_line = (plD_line_fp) plD_line_psttf; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_psttf; pdt->pl_eop = (plD_eop_fp) plD_eop_psttf; pdt->pl_bop = (plD_bop_fp) plD_bop_psttf; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_psttf; pdt->pl_state = (plD_state_fp) plD_state_psttf; pdt->pl_esc = (plD_esc_fp) plD_esc_psttf; } void plD_dispatch_init_psttfm( PLDispatchTable *pdt ) { psttf_dispatch_init_helper( pdt, "PostScript File (monochrome)", "psttf", plDevType_FileOriented, 55, (plD_init_fp) plD_init_psttfm ); } void plD_dispatch_init_psttfc( PLDispatchTable *pdt ) { psttf_dispatch_init_helper( pdt, "PostScript File (color)", "psttfc", plDevType_FileOriented, 56, (plD_init_fp) plD_init_psttfc ); } //-------------------------------------------------------------------------- // plD_init_psttf() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_psttfm( PLStream *pls ) { color = 0; pls->color = 0; // Not a color device plParseDrvOpts( ps_options ); if ( color ) pls->color = 1; // But user wants color ps_init( pls ); } void plD_init_psttfc( PLStream *pls ) { color = 1; pls->color = 1; // Is a color device plParseDrvOpts( ps_options ); if ( !color ) pls->color = 0; // But user does not want color ps_init( pls ); } #define MAX_NUM_TRIES 10 static void ps_init( PLStream *pls ) { int i; char *a; PSDev *dev; PostscriptDocument *doc; PLFLT pxlx, pxly; // Set default values - 7.5 x 10 [inches] (72 points = 1 inch) if ( pls->xlength <= 0 || pls->ylength <= 0 ) { pls->xlength = 540; pls->ylength = 720; } if ( pls->xdpi <= 0 ) pls->xdpi = 72.; if ( pls->ydpi <= 0 ) pls->ydpi = 72.; pxlx = YPSSIZE / LPAGE_X; pxly = XPSSIZE / LPAGE_Y; if ( text ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode if ( hrshsym ) pls->dev_hrshsym = 1; // want Hershey symbols } pls->dev_fill0 = 1; // Can do solid fills // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Create postscript document object if ( pls->psdoc != NULL ) delete (PostscriptDocument *) pls->psdoc; pls->psdoc = new PostscriptDocument(); doc = (PostscriptDocument *) ( pls->psdoc ); doc->osBody() << fixed; doc->osBody().precision( 3 ); // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( PSDev ) ); if ( pls->dev == NULL ) plexit( "ps_init: Out of memory." ); dev = (PSDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; plP_setpxl( pxlx, pxly ); dev->llx = XPSSIZE; dev->lly = YPSSIZE; dev->urx = 0; dev->ury = 0; dev->ptcnt = 0; // Rotate by 90 degrees since portrait mode addressing is used dev->xmin = 0; dev->ymin = 0; dev->xmax = PSY; dev->ymax = PSX; dev->xlen = dev->xmax - dev->xmin; dev->ylen = dev->ymax - dev->ymin; plP_setphy( dev->xmin, dev->xmax, dev->ymin, dev->ymax ); // If portrait mode is specified, then set up an additional rotation // transformation with aspect ratio allowed to adjust via freeaspect. // Default orientation is landscape (ORIENTATION == 3 or 90 deg rotation // counter-clockwise from portrait). (Legacy PLplot used seascape // which was equivalent to ORIENTATION == 1 or 90 deg clockwise rotation // from portrait.) if ( pls->portrait ) { plsdiori( (PLFLT) ( 4 - ORIENTATION ) ); pls->freeaspect = 1; } // File table for font families using either environment variables // or defaults. for ( i = 0; i < N_Pango_Lookup; i++ ) { if ( ( a = getenv( EnvFamilyLookup[i] ) ) != NULL ) { strncpy( FamilyLookup[i], a, FAMILY_LOOKUP_LEN - 1 ); FamilyLookup[i][FAMILY_LOOKUP_LEN - 1] = '\0'; } else { strncpy( FamilyLookup[i], DefaultFamilyLookup[i], FAMILY_LOOKUP_LEN ); FamilyLookup[i][FAMILY_LOOKUP_LEN - 1] = '\0'; } } } //-------------------------------------------------------------------------- // writeHeader() // // Write plplot postscript commands into the header //-------------------------------------------------------------------------- void writeHeader( PLStream *pls ) { PostscriptDocument *doc = (PostscriptDocument *) ( pls->psdoc ); doc->osHeader() << "%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"; doc->osHeader() << "%%Title: PLplot Graph\n"; doc->osHeader() << "%%Creator: PLplot Version " << PLPLOT_VERSION << "\n"; doc->osHeader() << "%%CreationDate: " << ps_getdate() << "\n"; doc->osHeader() << "%%Pages: (atend)\n"; doc->osHeader() << "%%EndComments\n\n"; // Definitions // Save VM state doc->osHeader() << "/PSSave save def\n"; // Define a dictionary and start using it doc->osHeader() << "/PSDict 200 dict def\n"; doc->osHeader() << "PSDict begin\n"; doc->osHeader() << "/@restore /restore load def\n"; doc->osHeader() << "/restore\n"; doc->osHeader() << " {vmstatus pop\n"; doc->osHeader() << " dup @VMused lt {pop @VMused} if\n"; doc->osHeader() << " exch pop exch @restore /@VMused exch def\n"; doc->osHeader() << " } def\n"; doc->osHeader() << "/@pri\n"; doc->osHeader() << " {\n"; doc->osHeader() << " ( ) print\n"; doc->osHeader() << " ( ) cvs print\n"; doc->osHeader() << " } def\n"; // n @copies - doc->osHeader() << "/@copies\n"; doc->osHeader() << " {\n"; doc->osHeader() << " /#copies exch def\n"; doc->osHeader() << " } def\n"; // - @start - -- start everything doc->osHeader() << "/@start\n"; doc->osHeader() << " {\n"; doc->osHeader() << " vmstatus pop /@VMused exch def pop\n"; doc->osHeader() << " } def\n"; // - @end - -- finished doc->osHeader() << "/@end\n"; doc->osHeader() << " {flush\n"; doc->osHeader() << " end\n"; doc->osHeader() << " PSSave restore\n"; doc->osHeader() << " } def\n"; // bop - -- begin a new page // Only fill background if we are using color and if the bg isn't white doc->osHeader() << "/bop\n"; doc->osHeader() << " {\n"; doc->osHeader() << " /SaveImage save def\n"; doc->osHeader() << " } def\n"; // - eop - -- end a page doc->osHeader() << "/eop\n"; doc->osHeader() << " {\n"; doc->osHeader() << " showpage\n"; doc->osHeader() << " SaveImage restore\n"; doc->osHeader() << " } def\n"; // Set line parameters doc->osHeader() << "/@line\n"; doc->osHeader() << " {0 setlinecap\n"; doc->osHeader() << " 0 setlinejoin\n"; doc->osHeader() << " 1 setmiterlimit\n"; doc->osHeader() << " } def\n"; // d @hsize - horizontal clipping dimension doc->osHeader() << "/@hsize {/hs exch def} def\n"; doc->osHeader() << "/@vsize {/vs exch def} def\n"; // d @hoffset - shift for the plots doc->osHeader() << "/@hoffset {/ho exch def} def\n"; doc->osHeader() << "/@voffset {/vo exch def} def\n"; // Set line width doc->osHeader() << "/lw " << (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ) << " def\n"; // Setup user specified offsets, scales, sizes for clipping doc->osHeader() << "/@SetPlot\n"; doc->osHeader() << " {\n"; doc->osHeader() << " ho vo translate\n"; doc->osHeader() << " XScale YScale scale\n"; doc->osHeader() << " lw setlinewidth\n"; doc->osHeader() << " } def\n"; // Setup x & y scales doc->osHeader() << "/XScale\n"; doc->osHeader() << " {hs " << YPSSIZE << " div} def\n"; doc->osHeader() << "/YScale\n"; doc->osHeader() << " {vs " << XPSSIZE << " div} def\n"; // Macro definitions of common instructions, to keep output small doc->osHeader() << "/M {moveto} def\n"; doc->osHeader() << "/D {lineto} def\n"; doc->osHeader() << "/A {0.5 0 360 arc} def\n"; doc->osHeader() << "/S {stroke} def\n"; doc->osHeader() << "/Z {stroke newpath} def\n"; if ( pls->dev_eofill ) doc->osHeader() << "/F {closepath gsave eofill grestore stroke} def\n"; else doc->osHeader() << "/F {closepath gsave fill grestore stroke} def\n"; doc->osHeader() << "/N {newpath} def\n"; doc->osHeader() << "/C {setrgbcolor} def\n"; doc->osHeader() << "/G {setgray} def\n"; doc->osHeader() << "/W {setlinewidth} def\n"; doc->osHeader() << "/R {rotate} def\n"; doc->osHeader() << "/B {Z " << XMIN << " " << YMIN << " M " << XMIN << " " << YMAX << " D " << XMAX << " " << YMAX << " D " << XMAX << " " << YMIN << " D " << XMIN << " " << YMIN << " closepath} def\n"; doc->osHeader() << "/CL {newpath M D D D closepath clip} def\n"; // End of dictionary definition doc->osHeader() << "end\n\n"; // Set up the plots doc->osHeader() << "PSDict begin\n"; doc->osHeader() << "@start\n"; doc->osHeader() << COPIES << " @copies\n"; doc->osHeader() << "@line\n"; doc->osHeader() << YSIZE << " @hsize\n"; doc->osHeader() << XSIZE << " @vsize\n"; doc->osHeader() << YOFFSET << " @hoffset\n"; doc->osHeader() << XOFFSET << " @voffset\n"; doc->osHeader() << "@SetPlot\n" << endl; } //-------------------------------------------------------------------------- // plD_line_psttf() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_psttf( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { PSDev *dev = (PSDev *) pls->dev; PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; PLINT x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; // Rotate by 90 degrees plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x1, &y1 ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x2, &y2 ); if ( x1 == dev->xold && y1 == dev->yold && dev->ptcnt < 40 ) { if ( pls->linepos + 12 > LINELENGTH ) { doc->osBody() << '\n'; pls->linepos = 0; } else doc->osBody() << ' '; snprintf( outbuf, OUTBUF_LEN, "%d %d D", x2, y2 ); dev->ptcnt++; pls->linepos += 12; } else { doc->osBody() << " Z\n"; pls->linepos = 0; if ( x1 == x2 && y1 == y2 ) // must be a single dot, draw a circle snprintf( outbuf, OUTBUF_LEN, "%d %d A", x1, y1 ); else snprintf( outbuf, OUTBUF_LEN, "%d %d M %d %d D", x1, y1, x2, y2 ); dev->llx = MIN( dev->llx, x1 ); dev->lly = MIN( dev->lly, y1 ); dev->urx = MAX( dev->urx, x1 ); dev->ury = MAX( dev->ury, y1 ); dev->ptcnt = 1; pls->linepos += 24; } dev->llx = MIN( dev->llx, x2 ); dev->lly = MIN( dev->lly, y2 ); dev->urx = MAX( dev->urx, x2 ); dev->ury = MAX( dev->ury, y2 ); doc->osBody() << outbuf; pls->bytecnt += 1 + strlen( outbuf ); dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_psttf() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_psttf( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_psttf( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // plD_eop_psttf() // // End of page. //-------------------------------------------------------------------------- void plD_eop_psttf( PLStream *pls ) { PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; doc->osBody() << " S\neop\n"; } //-------------------------------------------------------------------------- // plD_bop_psttf() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_psttf( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; if ( !pls->termin ) plGetFam( pls ); pls->page++; if ( pls->family ) doc->osBody() << "%%Page: " << (int) pls->page << " 1\n"; else doc->osBody() << "%%Page: " << (int) pls->page << " " << (int) pls->page << "\n"; doc->osBody() << "bop\n"; if ( pls->color ) { PLFLT r, g, b; if ( pls->cmap0[0].r != 0xFF || pls->cmap0[0].g != 0xFF || pls->cmap0[0].b != 0xFF ) { r = ( (PLFLT) pls->cmap0[0].r ) / 255.; g = ( (PLFLT) pls->cmap0[0].g ) / 255.; b = ( (PLFLT) pls->cmap0[0].b ) / 255.; doc->osBody() << "B " << r << " " << g << " " << b << " C F\n"; } } pls->linepos = 0; // This ensures the color and line width are set correctly at the beginning of // each page plD_state_psttf( pls, PLSTATE_COLOR0 ); plD_state_psttf( pls, PLSTATE_WIDTH ); } //-------------------------------------------------------------------------- // plD_tidy_psttf() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_psttf( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; dev->llx /= ENLARGE; dev->lly /= ENLARGE; dev->urx /= ENLARGE; dev->ury /= ENLARGE; dev->llx += XOFFSET; dev->lly += YOFFSET; dev->urx += XOFFSET; dev->ury += YOFFSET; // changed for correct Bounding boundaries Jan Thorbecke okt 1993 // occurs from the integer truncation -- postscript uses fp arithmetic dev->urx += 1; dev->ury += 1; if ( pls->family ) doc->osFooter() << "%%Pages: 1\n"; else doc->osFooter() << "%%Pages: " << (int) pls->page << "\n"; doc->osFooter() << "@end" << endl; // Now write the rest of the header writeHeader( pls ); // Write out postscript document to file and close // For C++ stream we first need to close the file using // the C FILE * handle, then reopen as a ofstream. Yuck! if ( !strcmp( pls->FileName, "-" ) ) { doc->write( cout, dev->llx, dev->lly, dev->urx, dev->ury ); } else { plCloseFile( pls ); ofstream out; out.open( pls->FileName ); doc->write( out, dev->llx, dev->lly, dev->urx, dev->ury ); out.close(); } delete doc; pls->psdoc = NULL; } //-------------------------------------------------------------------------- // plD_state_psttf() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_psttf( PLStream *pls, PLINT op ) { PSDev *dev = (PSDev *) pls->dev; PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; switch ( op ) { case PLSTATE_WIDTH: { int width = (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ); doc->osBody() << " S\n" << width << " W"; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; break; } case PLSTATE_COLOR0: if ( !pls->color ) { doc->osBody() << " S\n" << ( pls->icol0 ? 0.0 : 1.0 ) << " G"; break; } // else fallthrough case PLSTATE_COLOR1: if ( pls->color ) { PLFLT r = ( (PLFLT) pls->curcolor.r ) / 255.0; PLFLT g = ( (PLFLT) pls->curcolor.g ) / 255.0; PLFLT b = ( (PLFLT) pls->curcolor.b ) / 255.0; doc->osBody() << " S\n" << r << " " << g << " " << b << " C"; } else { PLFLT r = ( (PLFLT) pls->curcolor.r ) / 255.0; doc->osBody() << " S\n" << 1.0 - r << " G"; } break; } // Reinitialize current point location. if ( dev->xold != PL_UNDEFINED && dev->yold != PL_UNDEFINED ) { doc->osBody() << " " << (int) dev->xold << " " << (int) dev->yold << " M \n"; } } //-------------------------------------------------------------------------- // plD_esc_psttf() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_psttf( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_FILL: fill_polygon( pls ); break; case PLESC_HAS_TEXT: proc_str( pls, (EscText *) ptr ); break; } } //-------------------------------------------------------------------------- // fill_polygon() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. // Only solid color fill supported. //-------------------------------------------------------------------------- static void fill_polygon( PLStream *pls ) { PSDev *dev = (PSDev *) pls->dev; PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; PLINT n, ix = 0, iy = 0; PLINT x, y; doc->osBody() << " Z\n"; for ( n = 0; n < pls->dev_npts; n++ ) { x = pls->dev_x[ix++]; y = pls->dev_y[iy++]; // Rotate by 90 degrees plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &x, &y ); // First time through start with a x y moveto if ( n == 0 ) { snprintf( outbuf, OUTBUF_LEN, "N %d %d M", x, y ); dev->llx = MIN( dev->llx, x ); dev->lly = MIN( dev->lly, y ); dev->urx = MAX( dev->urx, x ); dev->ury = MAX( dev->ury, y ); doc->osBody() << outbuf; pls->bytecnt += strlen( outbuf ); continue; } if ( pls->linepos + 21 > LINELENGTH ) { doc->osBody() << '\n'; pls->linepos = 0; } else doc->osBody() << ' '; pls->bytecnt++; snprintf( outbuf, OUTBUF_LEN, "%d %d D", x, y ); dev->llx = MIN( dev->llx, x ); dev->lly = MIN( dev->lly, y ); dev->urx = MAX( dev->urx, x ); dev->ury = MAX( dev->ury, y ); doc->osBody() << outbuf; pls->bytecnt += strlen( outbuf ); pls->linepos += 21; } dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; doc->osBody() << " F "; } //-------------------------------------------------------------------------- // ps_getdate() // // Get the date and time //-------------------------------------------------------------------------- static char * ps_getdate( void ) { int len; time_t t; char *p; t = time( (time_t *) 0 ); p = ctime( &t ); len = strlen( p ); *( p + len - 1 ) = '\0'; // zap the newline character return p; } // 0.8 should mimic the offset of first superscript/subscript level // implemented in plstr (plsym.c) for Hershey fonts. However, when // comparing with -dev xwin and -dev xcairo results changing this // factor to 0.6 appears to offset the centers of the letters // appropriately while 0.8 gives much poorer agreement with the // other devices. # define RISE_FACTOR 0.6 //-------------------------------------------------------------------------- // proc_str() // // Prints postscript strings. // N.B. Now unicode only, no string access! // //-------------------------------------------------------------------------- void proc_str( PLStream *pls, EscText *args ) { PLFLT *t = args->xform, tt[4]; // Transform matrices PLFLT theta, shear, stride; // Rotation angle and shear from the matrix PLFLT ft_ht, offset; // Font height and offset PLFLT cs, sn; PSDev *dev = (PSDev *) pls->dev; PostscriptDocument *doc = (PostscriptDocument *) pls->psdoc; char *font, esc; FontStyle style; FontWeight weight; // Be generous. Used to store lots of font changes which take // 3 characters per change. #define PROC_STR_STRING_LENGTH 1000 char *strp, str[PROC_STR_STRING_LENGTH], *cur_strp, cur_str[PROC_STR_STRING_LENGTH]; float font_factor = 1.4; PLINT clxmin, clxmax, clymin, clymax; // Clip limits PLINT clipx[4], clipy[4]; // Current clip limits PLFLT scale = 1., up = 0.; // Font scaling and shifting parameters double lineSpacing, xAdvance, ymintmp, ymaxtmp, ymin, ymax, xmin, xmax; PLINT xx[4], yy[4]; // unicode only! so test for it. if ( args->unicode_array_len > 0 ) { int j, s, f; char *fonts[PROC_STR_STRING_LENGTH]; FontStyle styles[PROC_STR_STRING_LENGTH]; FontWeight weights[PROC_STR_STRING_LENGTH]; const PLUNICODE *cur_text; PLUNICODE fci; unsigned char fontfamily, fontstyle, fontweight; PLFLT old_sscale, sscale, old_soffset, soffset, dup; PLINT level = 0; // translate from unicode into type 1 font index. // // Choose the font family, style, variant, and weight using // the FCI (font characterization integer). // plgesc( &esc ); plgfci( &fci ); plP_fci2hex( fci, &fontfamily, PL_FCI_FAMILY ); plP_fci2hex( fci, &fontstyle, PL_FCI_STYLE ); plP_fci2hex( fci, &fontweight, PL_FCI_WEIGHT ); font = (char *) FamilyLookup[fontfamily]; weight = WeightLookup[fontweight]; style = StyleLookup[fontstyle]; // Need to add some error checking here if ( false ) { fprintf( stderr, "fci = 0x%x, font name pointer = NULL \n", fci ); plabort( "proc_str: FCI inconsistent with TrueTypeLookup; " "internal PLplot error" ); return; } //pldebug("proc_str", "fci = 0x%x, font name = %s\n", fci, font); cur_text = args->unicode_array; for ( f = s = j = 0; j < args->unicode_array_len; j++ ) { if ( cur_text[j] & PL_FCI_MARK ) { // process an FCI by saving it and escaping cur_str // with an escff to make it a 2-character escape // that is not used in legacy Hershey code // if ( ( f < PROC_STR_STRING_LENGTH ) && ( s + 3 < PROC_STR_STRING_LENGTH ) ) { plP_fci2hex( cur_text[j], &fontfamily, PL_FCI_FAMILY ); plP_fci2hex( cur_text[j], &fontstyle, PL_FCI_STYLE ); plP_fci2hex( cur_text[j], &fontweight, PL_FCI_WEIGHT ); fonts[f] = (char *) FamilyLookup[fontfamily]; weights[f] = WeightLookup[fontweight]; styles[f] = StyleLookup[fontstyle]; if ( fonts[f] == NULL ) { fprintf( stderr, "string-supplied FCI = 0x%x, font name pointer = NULL \n", cur_text[j] ); plabort( "proc_str: string-supplied FCI inconsistent with font lookup;" ); return; } //pldebug("proc_str", "string-supplied FCI = 0x%x, font name = %s\n", cur_text[j], fonts[f]); cur_str[s++] = esc; cur_str[s++] = 'f'; cur_str[s++] = 'f'; f++; } } else if ( s + 1 < PROC_STR_STRING_LENGTH ) { s += ucs4_to_utf8( cur_text[j], &cur_str[s] ); //pldebug("proc_str", "unicode = 0x%x, type 1 code = %d\n", // cur_text[j], cur_str[j]); } } cur_str[s] = '\0'; // finish previous polyline dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; // Determine the font height ft_ht = pls->chrht * 72.0 / 25.4; // ft_ht in points, ht is in mm // The transform matrix has only rotations and shears; extract them plRotationShear( t, &theta, &shear, &stride ); cs = cos( theta ); sn = sin( theta ); tt[0] = t[0] * cs + t[2] * sn; tt[1] = t[1] * cs + t[3] * sn; tt[2] = -t[0] * sn + t[2] * cs; tt[3] = -t[1] * sn + t[3] * cs; // // Reference point conventions: // If base = 0, it is aligned with the center of the text box // If base = 1, it is aligned with the baseline of the text box // If base = 2, it is aligned with the top of the text box // // Currently plplot only uses base=0 // Postscript uses base=1 // // We must calculate the difference between the two and apply the offset. // if ( args->base == 2 ) // not supported by plplot offset = ENLARGE * ft_ht / 2.; // half font height else if ( args->base == 1 ) offset = 0.; else offset = -ENLARGE * ft_ht / 2.; // Determine the adjustment for page orientation theta -= PI / 2. * pls->diorot; args->y += (int) ( offset * cos( theta ) ); args->x -= (int) ( offset * sin( theta ) ); // ps driver is rotated by default plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &( args->x ), &( args->y ) ); // Correct for the fact ps driver uses landscape by default theta += PI / 2.; // Output // Set clipping clipx[0] = pls->clpxmi; clipx[2] = pls->clpxma; clipy[0] = pls->clpymi; clipy[2] = pls->clpyma; clipx[1] = clipx[2]; clipy[1] = clipy[0]; clipx[3] = clipx[0]; clipy[3] = clipy[2]; difilt( clipx, clipy, 4, &clxmin, &clxmax, &clymin, &clymax ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[0], &clipy[0] ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[1], &clipy[1] ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[2], &clipy[2] ); plRotPhy( ORIENTATION, dev->xmin, dev->ymin, dev->xmax, dev->ymax, &clipx[3], &clipy[3] ); doc->osBody() << " gsave " << clipx[0] << " " << clipy[0] << " " << clipx[1] << " " << clipy[1] << " " << clipx[2] << " " << clipy[2] << " " << clipx[3] << " " << clipy[3] << " CL\n"; // move to string reference point doc->osBody() << " " << args->x << " " << args->y << " M\n"; // Save the current position and set the string rotation doc->osBody() << "gsave " << TRMFLT( theta * 180. / PI ) << " R\n"; doc->osBody() << "[" << TRMFLT( tt[0] ) << " " << TRMFLT( tt[2] ) << " " << TRMFLT( tt[1] ) << " " << TRMFLT( tt[3] ) << " 0 0] concat\n"; xmax = 0; // Dummy run through the string first to work out the // length, including any font changes cur_strp = cur_str; f = 0; do { strp = str; if ( *cur_strp == esc ) { cur_strp++; if ( *cur_strp == esc ) // { *strp++ = *cur_strp++; } else if ( *cur_strp == 'f' ) { cur_strp++; if ( *cur_strp++ != 'f' ) { // escff occurs because of logic above. But any suffix // other than "f" should never happen. plabort( "proc_str, internal PLplot logic error;" "wrong escf escape sequence" ); return; } font = fonts[f]; style = styles[f]; weight = weights[f]; f++; continue; } else switch ( *cur_strp++ ) { case 'd': //subscript case 'D': plP_script_scale( FALSE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); scale = sscale; // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for subscripts should be // -0.5*(base font size - superscript/subscript font size). dup = -0.5 * ( 1.0 - sscale ); up = -font_factor * ENLARGE * ft_ht * ( RISE_FACTOR * soffset + dup ); break; case 'u': //superscript case 'U': plP_script_scale( TRUE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); scale = sscale; // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for superscripts should be // 0.5*(base font size - superscript/subscript font size). dup = 0.5 * ( 1.0 - sscale ); up = font_factor * ENLARGE * ft_ht * ( RISE_FACTOR * soffset + dup ); break; // ignore the next sequences case '+': case '-': case 'b': case 'B': plwarn( "'+', '-', and 'b/B' text escape sequences not processed." ); break; } } // copy from current to next token, adding a postscript escape // char '\' if necessary // while ( *cur_strp && *cur_strp != esc ) { *strp++ = *cur_strp++; } *strp = '\0'; // if(fabs(up)<0.001) up = 0.; /* Watch out for small differences */ // Set the font size doc->setFont( font, style, weight ); doc->setFontSize( font_factor * ENLARGE * ft_ht * scale ); doc->get_dimensions( (const char *) str, &lineSpacing, &xAdvance, &ymintmp, &ymaxtmp ); xmax += xAdvance; } while ( *cur_strp ); // Use the length of the string to calculate offset // Also used later for bounding box xmin = -xmax * args->just; xmax = xmin; ymin = 0; ymax = 0; // Reset parameters level = 0; scale = 1.0; up = 0.0; // Move relative to position to account for justification doc->osBody() << " gsave " << TRMFLT( xmin * tt[0] ) << " " << TRMFLT( xmin * tt[2] ) << " rmoveto\n"; // Parse string for PLplot escape sequences and print everything out cur_strp = cur_str; f = 0; do { strp = str; if ( *cur_strp == esc ) { cur_strp++; if ( *cur_strp == esc ) // { *strp++ = *cur_strp++; } else if ( *cur_strp == 'f' ) { cur_strp++; if ( *cur_strp++ != 'f' ) { // escff occurs because of logic above. But any suffix // other than "f" should never happen. plabort( "proc_str, internal PLplot logic error;" "wrong escf escape sequence" ); return; } font = fonts[f]; style = styles[f]; weight = weights[f]; f++; //pldebug("proc_str", "string-specified fci = 0x%x, font name = %s\n", fci, font); continue; } else switch ( *cur_strp++ ) { case 'd': //subscript case 'D': plP_script_scale( FALSE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); scale = sscale; // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for subscripts should be // -0.5*(base font size - superscript/subscript font size). dup = -0.5 * ( 1.0 - sscale ); up = -font_factor * ENLARGE * ft_ht * ( RISE_FACTOR * soffset + dup ); break; case 'u': //superscript case 'U': plP_script_scale( TRUE, &level, &old_sscale, &sscale, &old_soffset, &soffset ); scale = sscale; // The correction for the difference in magnitude // between the baseline and middle coordinate systems // for superscripts should be // 0.5*(base font size - superscript/subscript font size). dup = 0.5 * ( 1.0 - sscale ); up = font_factor * ENLARGE * ft_ht * ( RISE_FACTOR * soffset + dup ); break; // ignore the next sequences case '+': case '-': case 'b': case 'B': plwarn( "'+', '-', and 'b/B' text escape sequences not processed." ); break; } } // copy from current to next token, adding a postscript escape // char '\' if necessary // while ( *cur_strp && *cur_strp != esc ) { *strp++ = *cur_strp++; } *strp = '\0'; // if(fabs(up)<0.001) up = 0.; /* Watch out for small differences */ // Set the font size doc->setFont( font, style, weight ); doc->setFontSize( font_factor * ENLARGE * ft_ht * scale ); doc->get_dimensions( (const char *) str, &lineSpacing, &xAdvance, &ymintmp, &ymaxtmp ); ymin = MIN( ymintmp + up, ymin ); ymax = MAX( ymaxtmp + up, ymax ); xmax += xAdvance; // if up/down escape sequences, save current point and adjust baseline; // take the shear into account if ( up != 0. ) doc->osBody() << "gsave " << TRMFLT( up * tt[1] ) << " " << TRMFLT( up * tt[3] ) << " rmoveto\n"; // print the string doc->osBody() << show( (const char *) str ); // back to baseline if ( up != 0. ) doc->osBody() << "grestore " << TRMFLT( xAdvance * tt[0] ) << " " << TRMFLT( xAdvance * tt[2] ) << " rmoveto\n"; } while ( *cur_strp ); doc->osBody() << "grestore\n"; doc->osBody() << "grestore\n"; doc->osBody() << "grestore\n"; // // Estimate text bounding box from LASi get_dimensions function. // xmin, xmax are text left and right extents, // ymin, ymax are top and bottom extents. // These need to be rotated / transformed to get the correct values // xx[0] = (PLINT) ( t[0] * xmin + t[1] * ymin ); yy[0] = (PLINT) ( t[2] * xmin + t[3] * ymin ); xx[1] = (PLINT) ( t[0] * xmin + t[1] * ymax ); yy[1] = (PLINT) ( t[2] * xmin + t[3] * ymax ); xx[2] = (PLINT) ( t[0] * xmax + t[1] * ymin ); yy[2] = (PLINT) ( t[2] * xmax + t[3] * ymin ); xx[3] = (PLINT) ( t[0] * xmax + t[1] * ymax ); yy[3] = (PLINT) ( t[2] * xmax + t[3] * ymax ); plRotPhy( ORIENTATION, 0, 0, 0, 0, &xx[0], &yy[0] ); plRotPhy( ORIENTATION, 0, 0, 0, 0, &xx[1], &yy[1] ); plRotPhy( ORIENTATION, 0, 0, 0, 0, &xx[2], &yy[2] ); plRotPhy( ORIENTATION, 0, 0, 0, 0, &xx[3], &yy[3] ); xmin = MIN( MIN( MIN( xx[0], xx[1] ), xx[2] ), xx[3] ) + args->x; xmax = MAX( MAX( MAX( xx[0], xx[1] ), xx[2] ), xx[3] ) + args->x; ymin = MIN( MIN( MIN( yy[0], yy[1] ), yy[2] ), yy[3] ) + args->y; ymax = MAX( MAX( MAX( yy[0], yy[1] ), yy[2] ), yy[3] ) + args->y; dev->llx = (int) ( MIN( dev->llx, xmin ) ); dev->lly = (int) ( MIN( dev->lly, ymin ) ); dev->urx = (int) ( MAX( dev->urx, xmax ) ); dev->ury = (int) ( MAX( dev->ury, ymax ) ); // doc->osBody() << "Z " << xmin << " " << ymin << " M " // << xmin << " " << ymax << " D " // << xmax << " " << ymax << " D " // << xmax << " " << ymin << " D " // << xmin << " " << ymin << " closepath\n" // << "Z " << args->x << " " << args->y << " A closepath\n"; } } //static void //esc_purge( char *dstr, char *sstr ) //{ // char esc; // // plgesc( &esc ); // // while ( *sstr ) // { // if ( *sstr != esc ) // { // *dstr++ = *sstr++; // continue; // } // // sstr++; // if ( *sstr == esc ) // { // *dstr++ = *sstr++; // continue; // } // // else // { // switch ( *sstr++ ) // { // case 'f': // sstr++; // break; // two chars sequence // // default: // break; // single char escape // } // } // } // *dstr = '\0'; //} #else int pldummy_psttf() { return 0; } #endif // defined(PLD_psttf) || .... plplot-5.10.0+dfsg/drivers/xwin.driver_info.in 644 1750 1750 4111466747272 202030ustar andrewandrewxwin:X-Window (Xlib):1:xwin:5:xw plplot-5.10.0+dfsg/drivers/plmeta.c 644 1750 1750 5121311665665174 160770ustar andrewandrew// $Id: plmeta.c 12081 2011-12-01 11:52:28Z andrewross $ // // Copyright (C) 1991, 1992, 1993, 1994, 1995 Geoffrey Furnish // Copyright (C) 1991, 1992, 1993, 1994, 1995 Maurice LeBrun // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // //-------------------------------------------------------------------------- // // This is a metafile writer for PLplot. // // #include "plDevs.h" //#define DEBUG #ifdef PLD_plmeta #define NEED_PLDEBUG #include "plplotP.h" #include "drivers.h" #include "metadefs.h" #include // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_plmeta = "plmeta:PLplot Native Meta-File:0:plmeta:26:plm\n"; void plD_dispatch_init_plm( PLDispatchTable *pdt ); void plD_init_plm( PLStream * ); void plD_line_plm( PLStream *, short, short, short, short ); void plD_polyline_plm( PLStream *, short *, short *, PLINT ); void plD_eop_plm( PLStream * ); void plD_bop_plm( PLStream * ); void plD_tidy_plm( PLStream * ); void plD_state_plm( PLStream *, PLINT ); void plD_esc_plm( PLStream *, PLINT, void * ); // Struct to hold device-specific info. typedef struct { PLFLT pxlx, pxly; PLINT xold, yold; PLINT xmin, xmax, xlen; PLINT ymin, ymax, ylen; FPOS_T lp_offset, index_offset; int notfirst; } PLmDev; // Used for constructing error messages #define BUFFER_LEN 256 static char buffer[BUFFER_LEN]; // Function prototypes static void WriteFileHeader( PLStream *pls ); static void UpdatePrevPagehdr( PLStream *pls ); static void WritePageInfo( PLStream *pls, FPOS_T pp_offset ); static void UpdateIndex( PLStream *pls, FPOS_T cp_offset ); static void plm_fill( PLStream *pls ); static void plm_swin( PLStream *pls ); // A little function to help with debugging #ifdef DEBUG #define DEBUG_PRINT_LOCATION( a ) PrintLocation( pls, a ) static void PrintLocation( PLStream *pls, char *tag ) { int isfile = ( pls->output_type == 0 ); if ( isfile ) { FILE *file = pls->OutFile; FPOS_T current_offset; if ( pl_fgetpos( file, ¤t_offset ) ) plexit( "PrintLocation (plmeta.c): fgetpos call failed" ); pldebug( tag, "at offset %d in file %s\n", (int) current_offset, pls->FileName ); } } #else #define DEBUG_PRINT_LOCATION( a ) #endif void plD_dispatch_init_plm( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "PLplot Native Meta-File"; pdt->pl_DevName = "plmeta"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 26; pdt->pl_init = (plD_init_fp) plD_init_plm; pdt->pl_line = (plD_line_fp) plD_line_plm; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_plm; pdt->pl_eop = (plD_eop_fp) plD_eop_plm; pdt->pl_bop = (plD_bop_fp) plD_bop_plm; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_plm; pdt->pl_state = (plD_state_fp) plD_state_plm; pdt->pl_esc = (plD_esc_fp) plD_esc_plm; } //-------------------------------------------------------------------------- // plD_init_plm() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_plm( PLStream *pls ) { PLmDev *dev; U_CHAR c = (U_CHAR) INITIALIZE; dbug_enter( "plD_init_plm" ); pls->color = 1; // Is a color device pls->dev_fill0 = 1; // Handle solid fills pls->dev_fill1 = 1; // Driver handles pattern fills // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); pls->pdfs = pdf_finit( pls->OutFile ); // Allocate and initialize device-specific data pls->dev = calloc( 1, (size_t) sizeof ( PLmDev ) ); if ( pls->dev == NULL ) plexit( "plD_init_plm: Out of memory." ); dev = (PLmDev *) pls->dev; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->xmin = 0; dev->xmax = PIXELS_X - 1; dev->ymin = 0; dev->ymax = PIXELS_Y - 1; dev->pxlx = (double) PIXELS_X / (double) LPAGE_X; dev->pxly = (double) PIXELS_Y / (double) LPAGE_Y; plP_setpxl( dev->pxlx, dev->pxly ); plP_setphy( dev->xmin, dev->xmax, dev->ymin, dev->ymax ); // Write Metafile header. WriteFileHeader( pls ); // Write color map state info plD_state_plm( pls, PLSTATE_CMAP0 ); plD_state_plm( pls, PLSTATE_CMAP1 ); // Write initialization command. DEBUG_PRINT_LOCATION( "before init" ); plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); } //-------------------------------------------------------------------------- // plD_line_plm() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_plm( PLStream *pls, short x1, short y1, short x2, short y2 ) { PLmDev *dev = (PLmDev *) pls->dev; U_CHAR c; U_SHORT xy[4]; // dbug_enter("plD_line_plm"); // Failsafe check #ifdef DEBUG if ( x1 < dev->xmin || x1 > dev->xmax || x2 < dev->xmin || x2 > dev->xmax || y1 < dev->ymin || y1 > dev->ymax || y2 < dev->ymin || y2 > dev->ymax ) { pldebug( "plD_line_plm", "coordinates out of bounds -- \nActual: (%i,%i), (%i,%i) Bounds: (%i,%i,%i,%i)\n", x1, y1, x2, y2, dev->xmin, dev->xmax, dev->ymin, dev->ymax ); } #endif // If continuation of previous line send the LINETO command, which uses // the previous (x,y) point as it's starting location. This results in a // storage reduction of not quite 50%, since the instruction length for // a LINETO is 5/9 of that for the LINE command, and given that most // graphics applications use this command heavily. // // Still not quite as efficient as tektronix format since we also send the // command each time (so shortest command is 25% larger), but a lot easier // to implement than the tek method. // if ( x1 == dev->xold && y1 == dev->yold ) { c = (U_CHAR) LINETO; plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); xy[0] = x2; xy[1] = y2; plm_wr( pdf_wr_2nbytes( pls->pdfs, xy, 2 ) ); } else { c = (U_CHAR) LINE; plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); xy[0] = x1; xy[1] = y1; xy[2] = x2; xy[3] = y2; plm_wr( pdf_wr_2nbytes( pls->pdfs, xy, 4 ) ); } dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_plm() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_plm( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLmDev *dev = (PLmDev *) pls->dev; U_CHAR c = (U_CHAR) POLYLINE; dbug_enter( "plD_polyline_plm" ); plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) npts ) ); plm_wr( pdf_wr_2nbytes( pls->pdfs, (U_SHORT *) xa, npts ) ); plm_wr( pdf_wr_2nbytes( pls->pdfs, (U_SHORT *) ya, npts ) ); dev->xold = xa[npts - 1]; dev->yold = ya[npts - 1]; } //-------------------------------------------------------------------------- // plD_eop_plm() // // End of page. //-------------------------------------------------------------------------- void plD_eop_plm( PLStream *pls ) { U_CHAR c = (U_CHAR) EOP; plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); } //-------------------------------------------------------------------------- // plD_bop_plm() // // Set up for the next page. // // Page header layout as follows: // // BOP (U_CHAR) // page number (U_SHORT) // prev page offset (U_LONG) // next page offset (U_LONG) // // Each call after the first is responsible for updating the table of // contents and the next page offset from the previous page. //-------------------------------------------------------------------------- void plD_bop_plm( PLStream *pls ) { PLmDev *dev = (PLmDev *) pls->dev; int isfile = ( pls->output_type == 0 ); FPOS_T pp_offset = dev->lp_offset;; dbug_enter( "plD_bop_plm" ); dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; // Update previous page header if ( isfile ) UpdatePrevPagehdr( pls ); // Start next family file if necessary. pls->bytecnt = pls->pdfs->bp; plGetFam( pls ); // Update page counter pls->page++; // Update table of contents info & write new page header. WritePageInfo( pls, pp_offset ); } //-------------------------------------------------------------------------- // WritePageInfo() // // Update table of contents info & write new page header. //-------------------------------------------------------------------------- static void WritePageInfo( PLStream *pls, FPOS_T pp_offset ) { PLmDev *dev = (PLmDev *) pls->dev; FILE *file = pls->OutFile; int isfile = ( pls->output_type == 0 ); U_CHAR c; FPOS_T cp_offset = 0; // Update table of contents. if ( isfile ) { if ( pl_fgetpos( file, &cp_offset ) ) plexit( "WritePageInfo (plmeta.c): fgetpos call failed" ); UpdateIndex( pls, cp_offset ); } // Write new page header if ( dev->notfirst ) c = BOP; else { c = BOP0; dev->notfirst = 1; } plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->page ) ); plm_wr( pdf_wr_4bytes( pls->pdfs, (U_LONG) pp_offset ) ); plm_wr( pdf_wr_4bytes( pls->pdfs, (U_LONG) 0 ) ); // Update last page offset with current page value dev->lp_offset = cp_offset; // Write some page state information just to make things nice later on // Eventually there will be more plD_state_plm( pls, PLSTATE_COLOR0 ); } //-------------------------------------------------------------------------- // UpdatePrevPagehdr() // // Update previous page header. //-------------------------------------------------------------------------- static void UpdatePrevPagehdr( PLStream *pls ) { PLmDev *dev = (PLmDev *) pls->dev; FILE *file = pls->OutFile; FPOS_T cp_offset = 0; fflush( file ); // Determine where we are if ( pl_fgetpos( file, &cp_offset ) ) plexit( "plD_bop_plm: fgetpos call failed" ); // Seek back to previous page header. if ( dev->lp_offset > 0 ) { FPOS_T fwbyte_offset = 0; pldebug( "UpdatePrevPagehdr 1 (plmeta.c)", "Location: %d, seeking to: %d\n", (int) cp_offset, (int) dev->lp_offset ); // The forward byte offset is located exactly 7 bytes after the BOP fwbyte_offset = dev->lp_offset + 7; if ( pl_fsetpos( file, &fwbyte_offset ) ) { snprintf( buffer, BUFFER_LEN, "UpdatePrevPagehdr (plmeta.c): fsetpos to fwbyte_offset (%d) failed", (int) fwbyte_offset ); plexit( buffer ); } // DEBUG: verify current location #ifdef DEBUG if ( pl_fgetpos( file, &fwbyte_offset ) ) plexit( "UpdatePrevPagehdr (plmeta.c): fgetpos call failed" ); pldebug( "UpdatePrevPagehdr 2 (plmeta.c)", "Now at: %d, to write: %d\n", (int) fwbyte_offset, (int) cp_offset ); #endif // Write forward byte offset into previous page header. plm_wr( pdf_wr_4bytes( pls->pdfs, (U_LONG) cp_offset ) ); fflush( file ); // DEBUG: move back to before the write & read it to verify #ifdef DEBUG if ( pl_fsetpos( file, &fwbyte_offset ) ) { snprintf( buffer, BUFFER_LEN, "UpdatePrevPagehdr (plmeta.c): fsetpos to fwbyte_offset (%d) failed", (int) fwbyte_offset ); plexit( buffer ); } { U_LONG read_offset; plm_rd( pdf_rd_4bytes( pls->pdfs, &read_offset ) ); pldebug( "UpdatePrevPagehdr 3 (plmeta.c)", "Value read as: %d\n", read_offset ); } #endif // Return to current page offset if ( pl_fsetpos( file, &cp_offset ) ) { snprintf( buffer, BUFFER_LEN, "UpdatePrevPagehdr (plmeta.c): fsetpos to cp_offset (%d) failed", (int) cp_offset ); plexit( buffer ); } } } //-------------------------------------------------------------------------- // UpdateIndex() // // Update file index. //-------------------------------------------------------------------------- static void UpdateIndex( PLStream *pls, FPOS_T cp_offset ) { PLmDev *dev = (PLmDev *) pls->dev; FILE *file = pls->OutFile; // Update file index. Right now only number of pages. // The ordering here is critical if ( dev->index_offset > 0 ) { pldebug( "UpdateIndex (plmeta.c)", "Location: %d, seeking to: %d\n", (int) cp_offset, (int) dev->lp_offset ); if ( pl_fsetpos( file, &dev->index_offset ) ) { snprintf( buffer, BUFFER_LEN, "UpdateIndex (plmeta.c): fsetpos to index_offset (%d) failed", (int) dev->index_offset ); plexit( buffer ); } plm_wr( pdf_wr_header( pls->pdfs, "pages" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->page ) ); pldebug( "UpdateIndex (plmeta.c)", "Location: %d, seeking to: %d\n", (int) dev->lp_offset, (int) cp_offset ); if ( pl_fsetpos( file, &cp_offset ) ) { snprintf( buffer, BUFFER_LEN, "UpdateIndex (plmeta.c): fsetpos to cp_offset (%d) failed", (int) cp_offset ); plexit( buffer ); } } } //-------------------------------------------------------------------------- // plD_tidy_plm() // // Close graphics file //-------------------------------------------------------------------------- void plD_tidy_plm( PLStream *pls ) { U_CHAR c = (U_CHAR) CLOSE; dbug_enter( "plD_tidy_plm" ); plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); pdf_close( pls->pdfs ); free_mem( pls->dev ); } //-------------------------------------------------------------------------- // plD_state_plm() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_plm( PLStream *pls, PLINT op ) { U_CHAR c = (U_CHAR) CHANGE_STATE; int i; dbug_enter( "plD_state_plm" ); plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); plm_wr( pdf_wr_1byte( pls->pdfs, op ) ); switch ( op ) { case PLSTATE_WIDTH: plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) ( pls->width ) ) ); break; case PLSTATE_COLOR0: plm_wr( pdf_wr_2bytes( pls->pdfs, (short) pls->icol0 ) ); if ( pls->icol0 == PL_RGB_COLOR ) { plm_wr( pdf_wr_1byte( pls->pdfs, pls->curcolor.r ) ); plm_wr( pdf_wr_1byte( pls->pdfs, pls->curcolor.g ) ); plm_wr( pdf_wr_1byte( pls->pdfs, pls->curcolor.b ) ); } break; case PLSTATE_COLOR1: plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->icol1 ) ); break; case PLSTATE_FILL: plm_wr( pdf_wr_1byte( pls->pdfs, (U_CHAR) pls->patt ) ); break; case PLSTATE_CMAP0: plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->ncol0 ) ); for ( i = 0; i < pls->ncol0; i++ ) { plm_wr( pdf_wr_1byte( pls->pdfs, pls->cmap0[i].r ) ); plm_wr( pdf_wr_1byte( pls->pdfs, pls->cmap0[i].g ) ); plm_wr( pdf_wr_1byte( pls->pdfs, pls->cmap0[i].b ) ); } break; case PLSTATE_CMAP1: plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->ncol1 ) ); for ( i = 0; i < pls->ncol1; i++ ) { plm_wr( pdf_wr_1byte( pls->pdfs, pls->cmap1[i].r ) ); plm_wr( pdf_wr_1byte( pls->pdfs, pls->cmap1[i].g ) ); plm_wr( pdf_wr_1byte( pls->pdfs, pls->cmap1[i].b ) ); } break; } } //-------------------------------------------------------------------------- // plD_esc_plm() // // Escape function. Note that any data written must be in device // independent form to maintain the transportability of the metafile. // // Functions: // // PLESC_FILL Fill polygon // PLESC_SWIN Set window parameters // //-------------------------------------------------------------------------- void plD_esc_plm( PLStream *pls, PLINT op, void *ptr ) { U_CHAR c = (U_CHAR) ESCAPE; dbug_enter( "plD_esc_plm" ); plm_wr( pdf_wr_1byte( pls->pdfs, c ) ); plm_wr( pdf_wr_1byte( pls->pdfs, (U_CHAR) op ) ); switch ( op ) { case PLESC_FILL: plm_fill( pls ); break; case PLESC_SWIN: plm_swin( pls ); break; } } //-------------------------------------------------------------------------- // plm_fill() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void plm_fill( PLStream *pls ) { PLmDev *dev = (PLmDev *) pls->dev; dbug_enter( "plm_fill" ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->dev_npts ) ); plm_wr( pdf_wr_2nbytes( pls->pdfs, (U_SHORT *) pls->dev_x, pls->dev_npts ) ); plm_wr( pdf_wr_2nbytes( pls->pdfs, (U_SHORT *) pls->dev_y, pls->dev_npts ) ); dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; } //-------------------------------------------------------------------------- // plm_swin() // // Set window parameters. // Each parameter or group of parameters is tagged to make backward // compatibility easier. //-------------------------------------------------------------------------- static void plm_swin( PLStream *pls ) { dbug_enter( "plm_swin" ); } //-------------------------------------------------------------------------- // WriteFileHeader() // // Writes Metafile header. //-------------------------------------------------------------------------- static void WriteFileHeader( PLStream *pls ) { PLmDev *dev = (PLmDev *) pls->dev; FILE *file = pls->OutFile; int isfile = ( pls->output_type == 0 ); dbug_enter( "WriteFileHeader(PLStream *pls" ); plm_wr( pdf_wr_header( pls->pdfs, PLMETA_HEADER ) ); plm_wr( pdf_wr_header( pls->pdfs, PLMETA_VERSION ) ); // Write file index info. Right now only number of pages. // The order here is critical if ( isfile ) { if ( pl_fgetpos( file, &dev->index_offset ) ) plexit( "WriteFileHeader: fgetpos call failed" ); } plm_wr( pdf_wr_header( pls->pdfs, "pages" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) 0 ) ); // Write initialization info. Tag via strings to make backward // compatibility with old metafiles as easy as possible. plm_wr( pdf_wr_header( pls->pdfs, "xmin" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) dev->xmin ) ); plm_wr( pdf_wr_header( pls->pdfs, "xmax" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) dev->xmax ) ); plm_wr( pdf_wr_header( pls->pdfs, "ymin" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) dev->ymin ) ); plm_wr( pdf_wr_header( pls->pdfs, "ymax" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) dev->ymax ) ); plm_wr( pdf_wr_header( pls->pdfs, "pxlx" ) ); plm_wr( pdf_wr_ieeef( pls->pdfs, (float) dev->pxlx ) ); plm_wr( pdf_wr_header( pls->pdfs, "pxly" ) ); plm_wr( pdf_wr_ieeef( pls->pdfs, (float) dev->pxly ) ); // Geometry info, needed to properly transmit e.g. aspect ratio, via the // length params. Not sure if the others are useful, but they're included for // completeness. plm_wr( pdf_wr_header( pls->pdfs, "xdpi" ) ); plm_wr( pdf_wr_ieeef( pls->pdfs, (float) pls->xdpi ) ); plm_wr( pdf_wr_header( pls->pdfs, "ydpi" ) ); plm_wr( pdf_wr_ieeef( pls->pdfs, (float) pls->ydpi ) ); plm_wr( pdf_wr_header( pls->pdfs, "xlength" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->xlength ) ); plm_wr( pdf_wr_header( pls->pdfs, "ylength" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->ylength ) ); plm_wr( pdf_wr_header( pls->pdfs, "xoffset" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->xoffset ) ); plm_wr( pdf_wr_header( pls->pdfs, "yoffset" ) ); plm_wr( pdf_wr_2bytes( pls->pdfs, (U_SHORT) pls->yoffset ) ); plm_wr( pdf_wr_header( pls->pdfs, "" ) ); } #else int pldummy_plmeta() { return 0; } #endif // PLD_plmeta plplot-5.10.0+dfsg/drivers/wxwidgets.h 644 1750 1750 4715312141235265 166370ustar andrewandrew// $Id: wxwidgets.h 12334 2013-05-04 16:43:33Z airwin $ // // Copyright (C) 2008 Werner Smekal // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #ifndef __WXWIDGETS_H__ #define __WXWIDGETS_H__ // some special wxWidgets headers #include // freetype headers and macros #ifdef PL_HAVE_FREETYPE #include "plfreetype.h" #endif #ifndef max_number_of_grey_levels_used_in_text_smoothing #define max_number_of_grey_levels_used_in_text_smoothing 64 #endif #define NDEV 100 // Max number of output device types in menu //-------------------------------------------------------------------------- // Physical dimension constants used by the driver // Virtual coordinate scaling parameter, used to do calculations at // higher resolution. Chosen so that maximum plP_setphy coordinate // is 32000 which is close to but still less than the maximum possible // which is 32767. // // The trick here is to do everything in device coordinates on the driver // side, but report/receive everything in virtual coordinates to/from the // PLplot core. // #define VSCALE ( 40. ) // pixels per inch #define DEVICE_PIXELS_PER_IN ( 80. ) #define VIRTUAL_PIXELS_PER_IN ( DEVICE_PIXELS_PER_IN * VSCALE ) // mm per inch #define MM_PER_IN ( 25.4 ) // pixels per mm #define DEVICE_PIXELS_PER_MM ( DEVICE_PIXELS_PER_IN / MM_PER_IN ) #define VIRTUAL_PIXELS_PER_MM ( VIRTUAL_PIXELS_PER_IN / MM_PER_IN ) // Default dimensions of the canvas (in inches) #define CANVAS_WIDTH ( 10.0 ) #define CANVAS_HEIGHT ( 7.5 ) // size of plot in pixels on screen if not given #define PLOT_WIDTH ( 800 ) #define PLOT_HEIGHT ( 600 ) // These need to be distinguished since the handling is slightly different. #define LOCATE_INVOKED_VIA_API 1 #define LOCATE_INVOKED_VIA_DRIVER 2 // Available backends #define wxBACKEND_DC 0 #define wxBACKEND_AGG 1 #define wxBACKEND_GC 2 class wxPLplotFrame; // base device class class wxPLDevBase { public: // methods wxPLDevBase( int bcknd ); virtual ~wxPLDevBase( void ); // virtual functions which need to implemented virtual void DrawLine( short x1a, short y1a, short x2a, short y2a ) = 0; virtual void DrawPolyline( short *xa, short *ya, PLINT npts ) = 0; virtual void ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1 = -1, PLINT y1 = -1, PLINT x2 = -1, PLINT y2 = -1 ) = 0; virtual void FillPolygon( PLStream *pls ) = 0; virtual void BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH ) = 0; void AddtoClipRegion( int x1, int y1, int x2, int y2 ); virtual void CreateCanvas() = 0; virtual void SetWidth( PLStream *pls ) = 0; virtual void SetColor0( PLStream *pls ) = 0; virtual void SetColor1( PLStream *pls ) = 0; virtual void SetExternalBuffer( void* buffer ) = 0; #ifdef PL_HAVE_FREETYPE virtual void PutPixel( short x, short y, PLINT color ) = 0; virtual void PutPixel( short x, short y ) = 0; virtual PLINT GetPixel( short x, short y ) = 0; #endif // PL_HAVE_FREETYPE virtual void ProcessString( PLStream* pls, EscText* args ) = 0; virtual void PSDrawText( PLUNICODE* ucs4, int ucs4Len, bool drawText ); virtual void PSDrawTextToDC( char* utf8_string, bool drawText ) = 0; virtual void PSSetFont( PLUNICODE fci ) = 0; public: // variables const int backend; bool ready; bool ownGUI; bool showGUI; bool waiting; bool resizing; bool exit; int comcount; wxPLplotFrame* m_frame; PLINT xpos; PLINT ypos; PLINT width; PLINT height; PLINT bm_width; PLINT bm_height; PLINT xmin; PLINT xmax; PLINT ymin; PLINT ymax; PLFLT scalex; PLFLT scaley; bool plstate_width; // Flags indicating change of state before bool plstate_color0; // device is fully initialized bool plstate_color1; // taken from gcw driver PLGraphicsIn gin; // Graphics input structure int locate_mode; // Set while in locate mode bool draw_xhair; // Set during xhair draws // clipping region int clipminx, clipmaxx; int clipminy, clipmaxy; bool newclipregion; // variables for antializing int freetype; int smooth_text; const char ** devDesc; // Descriptive names for file-oriented devices. Malloc'ed. const char ** devName; // Keyword names of file-oriented devices. Malloc'ed. int ndev; wxBitmapType bitmapType; // font variables static const int max_string_length = 500; wxFont * m_font; bool underlined; double fontSize; double fontScale; wxCoord textWidth, textHeight, textDescent, textLeading; PLUNICODE fci; //the distance between the superscript top and subscript base from the baseline wxCoord superscriptHeight, subscriptDepth; double lineSpacing; double yOffset; PLINT posX, posY; PLFLT rotation, cos_rot, sin_rot; PLFLT shear, cos_shear, sin_shear; PLFLT stride; }; class wxPLDevDC : public wxPLDevBase { public: // methods wxPLDevDC( void ); ~wxPLDevDC( void ); void DrawLine( short x1a, short y1a, short x2a, short y2a ); void DrawPolyline( short *xa, short *ya, PLINT npts ); void ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1 = -1, PLINT y1 = -1, PLINT x2 = -1, PLINT y2 = -1 ); void FillPolygon( PLStream *pls ); void BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH ); void CreateCanvas(); void SetWidth( PLStream *pls ); void SetColor0( PLStream *pls ); void SetColor1( PLStream *pls ); void SetExternalBuffer( void* buffer ); #ifdef PL_HAVE_FREETYPE void PutPixel( short x, short y, PLINT color ); void PutPixel( short x, short y ); PLINT GetPixel( short x, short y ); #endif // PL_HAVE_FREETYPE void ProcessString( PLStream* pls, EscText* args ); void PSDrawTextToDC( char* utf8_string, bool drawText ); void PSSetFont( PLUNICODE fci ); private: // variables wxBitmap* m_bitmap; wxDC * m_dc; }; #ifdef HAVE_AGG // antigrain headers #include "agg2/agg_basics.h" #include "agg2/agg_rendering_buffer.h" #include "agg2/agg_rasterizer_scanline_aa.h" #include "agg2/agg_scanline_u.h" #include "agg2/agg_scanline_bin.h" #include "agg2/agg_conv_stroke.h" #include "agg2/agg_pixfmt_rgb.h" #include "agg2/agg_renderer_base.h" #include "agg2/agg_renderer_scanline.h" #include "agg2/agg_renderer_primitives.h" #include "agg2/agg_path_storage.h" #include "agg2/agg_conv_curve.h" #include "agg2/agg_conv_contour.h" #include "agg2/agg_font_freetype.h" class wxPLDevAGG : public wxPLDevBase { // type definitions and enums typedef agg::pixfmt_rgb24 pixFormat; typedef agg::renderer_base rendererBase; typedef agg::renderer_scanline_aa_solid rendererSolid; typedef agg::font_engine_freetype_int32 fontEngineType; typedef agg::font_cache_manager fontManagerType; typedef agg::font_cache_manager::gray8_adaptor_type fontRasterizer; typedef agg::font_cache_manager::gray8_scanline_type fontScanline; typedef agg::conv_curve convCurve; typedef agg::conv_stroke convStroke; typedef agg::conv_transform pathTransform; typedef agg::conv_transform strokeTransform; enum drawPathFlag { Fill, Stroke, FillAndStroke }; public: // methods wxPLDevAGG( void ); ~wxPLDevAGG( void ); void DrawLine( short x1a, short y1a, short x2a, short y2a ); void DrawPolyline( short *xa, short *ya, PLINT npts ); void ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1 = -1, PLINT y1 = -1, PLINT x2 = -1, PLINT y2 = -1 ); void FillPolygon( PLStream *pls ); void BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH ); void CreateCanvas(); void SetWidth( PLStream *pls ); void SetColor0( PLStream *pls ); void SetColor1( PLStream *pls ); void SetExternalBuffer( void* buffer ); #ifdef PL_HAVE_FREETYPE void PutPixel( short x, short y, PLINT color ); void PutPixel( short x, short y ); PLINT GetPixel( short x, short y ); #endif // PL_HAVE_FREETYPE void ProcessString( PLStream* pls, EscText* args ); void PSDrawTextToDC( char* utf8_string, bool drawText ); void PSSetFont( PLUNICODE fci ); void drawPath( drawPathFlag flag ); void AGGAddtoClipRegion( short x1, short y1, short x2, short y2 ); private: // variables wxDC * mDC; wxImage * mBuffer; agg::rendering_buffer mRenderingBuffer; fontEngineType mFontEngine; fontManagerType mFontManager; agg::conv_curve mCurves; agg::conv_contour > mContour; pixFormat mPixFormat; rendererBase mRendererBase; rendererSolid mRendererSolid; agg::scanline_u8 mScanLine; agg::rasterizer_scanline_aa<> mRasterizer; agg::path_storage mPath; agg::trans_affine mTransform; convCurve mConvCurve; convStroke mConvStroke; pathTransform mPathTransform; strokeTransform mStrokeTransform; double mStrokeWidth; wxUint8 mStrokeOpacity; unsigned char mColorRedStroke; unsigned char mColorGreenStroke; unsigned char mColorBlueStroke; unsigned char mColorRedFill; unsigned char mColorGreenFill; unsigned char mColorBlueFill; double textWidth, textHeight; wxString fontdir; }; #endif #if wxUSE_GRAPHICS_CONTEXT #include class wxPLDevGC : public wxPLDevBase { public: // methods wxPLDevGC( void ); ~wxPLDevGC( void ); void DrawLine( short x1a, short y1a, short x2a, short y2a ); void DrawPolyline( short *xa, short *ya, PLINT npts ); void ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1 = -1, PLINT y1 = -1, PLINT x2 = -1, PLINT y2 = -1 ); void FillPolygon( PLStream *pls ); void BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH ); void CreateCanvas(); void SetWidth( PLStream *pls ); void SetColor0( PLStream *pls ); void SetColor1( PLStream *pls ); void SetExternalBuffer( void* buffer ); #ifdef PL_HAVE_FREETYPE void PutPixel( short x, short y, PLINT color ); void PutPixel( short x, short y ); PLINT GetPixel( short x, short y ); #endif // PL_HAVE_FREETYPE void ProcessString( PLStream* pls, EscText* args ); void PSDrawTextToDC( char* utf8_string, bool drawText ); void PSSetFont( PLUNICODE fci ); private: // variables wxBitmap * m_bitmap; wxDC * m_dc; wxGraphicsContext* m_context; // text colors unsigned char textRed, textGreen, textBlue; unsigned char mStrokeOpacity; unsigned char mColorRedStroke; unsigned char mColorGreenStroke; unsigned char mColorBlueStroke; unsigned char mColorRedFill; unsigned char mColorGreenFill; unsigned char mColorBlueFill; }; #endif struct dev_entry { wxString dev_name; wxString dev_menu_short; wxString dev_menu_long; wxString dev_file_app; bool pixelDevice; }; // after how many commands the window should be refreshed #define MAX_COMCOUNT 10000 // wxwidgets application definition (if needed) WX_DEFINE_ARRAY( wxPLplotFrame *, wxArrayOfwxPLplotFrame ); class wxPLplotApp : public wxApp { public: virtual bool OnInit(); // virtual int OnExit(); void SetExitFlag( bool flag = true ) { exit = flag; }; bool GetExitFlag( void ) { return exit; }; void SetAdvanceFlag( bool flag = true ) { advance = flag; }; bool GetAdvanceFlag( void ) { return advance; }; void SetRefreshFlag( bool flag = true ); void AddFrame( wxPLplotFrame* frame ) { FrameArray.Add( frame ); }; void RemoveFrame( wxPLplotFrame* frame ) { FrameArray.Remove( frame ); }; size_t FrameCount( void ) { return FrameArray.GetCount(); } void OnIdle( wxIdleEvent& event ); private: bool exit; bool advance; wxArrayOfwxPLplotFrame FrameArray; DECLARE_EVENT_TABLE() }; // definition of the actual window/frame shown class wxPLplotWindow : public wxWindow { public: wxPLplotWindow( wxWindow* parent, PLStream *pls ); void SetRefreshFlag( bool flag = true ) { refresh = flag; }; bool GetRefreshFlag( void ) { return refresh; }; void SetOrientation( int rot ); private: void OnPaint( wxPaintEvent& event ); void OnChar( wxKeyEvent& event ); void OnIdle( wxIdleEvent& event ); void OnErase( wxEraseEvent & WXUNUSED( event ) ); void OnSize( wxSizeEvent & WXUNUSED( event ) ); void OnMaximize( wxMaximizeEvent & WXUNUSED( event ) ); void OnMouse( wxMouseEvent& event ); void Locate( void ); void DrawCrosshair(); PLStream * m_pls; wxPLDevBase* m_dev; // windows needs to know this structure bool refresh; bool xhair_drawn; int mouse_x, mouse_y, old_mouse_x, old_mouse_y; DECLARE_EVENT_TABLE() }; // declaration of the actual window/frame shown class wxPLplotFrame : public wxFrame { public: wxPLplotFrame( const wxString& title, PLStream* pls ); void OnMenu( wxCommandEvent& event ); void OnClose( wxCloseEvent& event ); bool SavePlot( const char* filename, const char* devname, int width, int height ); void SetRefreshFlag( bool flag = true ) { m_window->SetRefreshFlag( flag ); }; bool GetRefreshFlag( void ) { return m_window->GetRefreshFlag(); }; private: wxPanel * m_panel; wxPLplotWindow* m_window; wxPLDevBase * m_dev; // frame needs to know this structure DECLARE_EVENT_TABLE() }; // menu ids enum { wxPL_Save = 10000, wxPL_Next = 10100, wxPL_Locate, wxPL_Orientation_0, wxPL_Orientation_90, wxPL_Orientation_180, wxPL_Orientation_270 }; // Pixel size dialog class wxGetSizeDialog : public wxDialog { public: // constructors and destructors wxGetSizeDialog( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, int width = 800, int height = 600 ); int getWidth() { return spinControlWidth->GetValue(); } int getHeight() { return spinControlHeight->GetValue(); } private: wxSpinCtrl* spinControlWidth; wxSpinCtrl* spinControlHeight; private: DECLARE_EVENT_TABLE() }; // Use this macro if you want to define your own main() or WinMain() function // and call wxEntry() from there. #define IMPLEMENT_PLAPP_NO_MAIN( appname ) \ wxAppConsole * wxPLCreateApp() \ { \ wxAppConsole::CheckBuildOptions( WX_BUILD_OPTIONS_SIGNATURE, \ "your program" ); \ return new appname; \ } \ wxAppInitializer \ wxAppInitializer( (wxAppInitializerFunction) ( wxApp::GetInitializerFunction() == NULL ? wxPLCreateApp : wxApp::GetInitializerFunction() ) ); \ DECLARE_PLAPP( appname ) \ appname & wxPLGetApp() { return *wx_static_cast( appname *, wxApp::GetInstance() ); } #define DECLARE_PLAPP( appname ) extern appname &wxPLGetApp(); // workaround against warnings for unused variables static inline void Use( void * ) { } #define WX_SUPPRESS_UNUSED_WARN( x ) Use( &x ) //-------------------------------------------------------------------------- // Declarations for the device. //-------------------------------------------------------------------------- void plD_init_wxwidgets( PLStream * ); void plD_init_wxpng( PLStream * ); void plD_line_wxwidgets( PLStream *, short, short, short, short ); void plD_polyline_wxwidgets( PLStream *, short *, short *, PLINT ); void plD_eop_wxwidgets( PLStream * ); void plD_bop_wxwidgets( PLStream * ); void plD_tidy_wxwidgets( PLStream * ); void plD_state_wxwidgets( PLStream *, PLINT ); void plD_esc_wxwidgets( PLStream *, PLINT, void * ); void wx_set_dc( PLStream* pls, wxDC* dc ); void wx_set_buffer( PLStream* pls, wxImage* buffer ); void wx_set_size( PLStream* pls, int width, int height ); int plD_errorexithandler_wxwidgets( char *errormessage ); void plD_erroraborthandler_wxwidgets( char *errormessage ); //-------------------------------------------------------------------------- // Debug functions //-------------------------------------------------------------------------- // define if you want debug output // #define _DEBUG // // #define _DEBUG_VERBOSE // void Log_Verbose( const char *fmt, ... ); void Log_Debug( const char *fmt, ... ); //-------------------------------------------------------------------------- // Font style and weight lookup tables //-------------------------------------------------------------------------- const wxFontFamily fontFamilyLookup[5] = { wxFONTFAMILY_SWISS, // sans-serif wxFONTFAMILY_ROMAN, // serif wxFONTFAMILY_TELETYPE, // monospace wxFONTFAMILY_SCRIPT, // script wxFONTFAMILY_SWISS // symbol }; const int fontStyleLookup[3] = { wxFONTFLAG_DEFAULT, // upright wxFONTFLAG_ITALIC, // italic wxFONTFLAG_SLANT // oblique }; const int fontWeightLookup[2] = { wxFONTFLAG_DEFAULT, // medium wxFONTFLAG_BOLD // bold }; #endif // __WXWIDGETS_H__ plplot-5.10.0+dfsg/drivers/ljii.driver_info.in 644 1750 1750 6611466747272 201540ustar andrewandrewljii:LaserJet II Bitmap File (150 dpi):0:ljii:33:ljii plplot-5.10.0+dfsg/drivers/null.driver_info.in 644 1750 1750 4111466747272 201700ustar andrewandrewnull:Null device:-1:null:42:null plplot-5.10.0+dfsg/drivers/qt.driver_info.in 644 1750 1750 61611466747272 176720ustar andrewandrewbmpqt:Qt Windows bitmap driver:0:qt:66:bmpqt jpgqt:Qt jpg driver:0:qt:67:jpgqt pngqt:Qt png driver:0:qt:68:pngqt ppmqt:Qt ppm driver:0:qt:69:ppmqt tiffqt:Qt tiff driver:0:qt:70:tiffqt svgqt:Qt SVG driver:0:qt:71:svgqt qtwidget:Qt Widget:1:qt:72:qtwidget epsqt:Qt EPS driver:0:qt:73:epsqt pdfqt:Qt PDF driver:0:qt:74:pdfqt extqt:External Qt driver:0:qt:75:extqt memqt:Memory Qt driver:0:qt:76:memqt plplot-5.10.0+dfsg/drivers/impress.driver_info.in 644 1750 1750 4211466747272 207010ustar andrewandrewimp:Impress File:0:impress:37:imp plplot-5.10.0+dfsg/drivers/cgm.c 644 1750 1750 6141211462375545 153600ustar andrewandrew// $Id: cgm.c 11283 2010-10-28 22:38:29Z airwin $ // // PLplot cgm device driver. // // // This driver generates CGM (computer graphics metafiles) files (bit of a // tautology that... 'computer graphics metaFILES FILES' - oh well). // // The CGM format is vector-based and is widely used as an interchange // format between drawing and plotting programs. Although I have never // looked at them, there are apparently both Java applets and browser // plug-ins for displaying CGM files on web pages. // // This plplot driver supports lines, polylines (they make a difference to // CGM files), fills, and line widths. It is limited to 256 colours, which // should not be a problem. The plplot CGM driver's source (cgm.c) was // derived largely from the gd driver (gd.c). // // The plplot driver requires libcd.a. libcd.a is very similar to libgd.a // and has a similar licencing agreement behind it. Unlike libgd, // development of libcd seems to have crawled to a halt back in 1998 with // V1.3 of the library. The original host site for the library no longer // exists, so probably the best source of the library presently is: // // http://www.pa.msu.edu/reference/cgmdraw_ref.html // http://www.pa.msu.edu/ftp/pub/unix/ // // // Two options are supported by the driver via the -drvopt command line // toggle. // // By default CGM files don't have a background as such. The driver adds // support for different backgrounds by colouring in a large rectangle // underneath everything else. If for some reason you want the "raw plotted // junk" and aren't really interested in having an obtrusive piece of paper // in the back, use the command line toggle "-drvopt no_paper=1" to turn off // this background paper. // // By default the CGM files generated by this driver try to make edges of // polygons (ie fills) "invisible", which is something CGM files can do. // Some programs (ie CoreDraw) ignore this field and draw edges in anyway. // By setting "-drvopt force_edges=1" the driver will render edges on all // filled polygons, and will set their colour to the same as the polygon. // Most drivers should not need this, but if you see lines that you don't // think you should be seeing in your viewer, try this toggle. // // // Driver supports a hack that manipulates the colour palette when // a light background is selected. This is basically to make sure // there are not two "whites" when -bg ffffff is issued at the // command line. // // Related to this change, there is an ability to swap the "new" // black colour (index 15) with the red colour (index 2) by issuing // the command line "-hack" option. I like this for web pages, because // I think that black looks nicer than red (on white) for default // plotting. That is why it can be enabled with -hack, in case you // don't like it working this way. // // For me, these two changes make it easy to switch from a "screen friendly" // black background with red first plotting colour, to a "web friendly" // white background with a black first plotting colour. // // These features are enabled on a driver level by defining // "SWAP_BALCK_WHEN_WHITE". If you wan't the driver to behave 100% like other // drivers, comment out the define // #define SWAP_BALCK_WHEN_WHITE #include "plDevs.h" #ifdef PLD_cgm #include "plplotP.h" #include "drivers.h" #include // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_cgm = "cgm:CGM file:0:cgm:44:cgm\n"; // Prototypes for functions in this file. static void fill_polygon( PLStream *pls ); static void setcmap( PLStream *pls ); static void plD_init_cgm_Dev( PLStream *pls ); // top level declarations // In an attempt to fix a problem with the hidden line removal functions // that results in hidden lines *not* being removed from "small" plot // pages (ie, like a normal video screen), a "virtual" page of much // greater size is used to trick the algorithm into working correctly. // If, in future, this gets fixed on its own, then don't define // "use_experimental_hidden_line_hack" // #define use_experimental_hidden_line_hack static int force_edges = 0; static int disable_background = 0; static DrvOpt cgm_options[] = { { "force_edges", DRV_INT, &force_edges, "Force edges to be drawn on filled polygongs (0|1)" }, { "no_paper", DRV_INT, &disable_background, "Disable background (0|1)" }, { NULL, DRV_INT, NULL, NULL } }; // Struct to hold device-specific info. typedef struct { cdImagePtr im_out; // Graphics pointer PLINT cgmx; PLINT cgmy; // GD does "funny" things with the colour map. // It can't guarantee that the colours will be where you think they are. // So we need this "colour_index" table to store where the colour we // requested happens to be. Messy, but it works. // int colour_index[256]; // Colour "index" table // // I use two colours for both fill and line drawing - a "last colour" and // "current colour". The driver only switches colours if they have changed // and are used. If no fills are ever done, then the instruction to set the // fill colour is never sent to the CGM file. Should make for smaller and // more efficient files (I guess). // int colour; // Current Colour int last_line_colour; // Last line colour used int fill_colour; // Current Fill colour int last_fill_colour; // Last Fill colour used int totcol; // Total number of colours int ncol1; // Actual size of ncol1 we got int scale; // scaling factor to "blow up" to // the "virtual" page in removing hidden lines int force_edges; // Forces edges to be drawn in fills int disable_background; // Turns off background rectangle } cgm_Dev; void plD_init_cgm( PLStream * ); void plD_line_cgm( PLStream *, short, short, short, short ); void plD_polyline_cgm( PLStream *, short *, short *, PLINT ); void plD_eop_cgm( PLStream * ); void plD_bop_cgm( PLStream * ); void plD_tidy_cgm( PLStream * ); void plD_state_cgm( PLStream *, PLINT ); void plD_esc_cgm( PLStream *, PLINT, void * ); void plD_dispatch_init_cgm( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "CGM (Computer Graphics metafile) file"; pdt->pl_DevName = "cgm"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 44; pdt->pl_init = (plD_init_fp) plD_init_cgm; pdt->pl_line = (plD_line_fp) plD_line_cgm; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_cgm; pdt->pl_eop = (plD_eop_fp) plD_eop_cgm; pdt->pl_bop = (plD_bop_fp) plD_bop_cgm; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_cgm; pdt->pl_state = (plD_state_fp) plD_state_cgm; pdt->pl_esc = (plD_esc_fp) plD_esc_cgm; } //-------------------------------------------------------------------------- // plD_init_cgm_Dev() // //-------------------------------------------------------------------------- static void plD_init_cgm_Dev( PLStream *pls ) { cgm_Dev *dev; // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( cgm_Dev ) ); if ( pls->dev == NULL ) plexit( "plD_init_cgm_Dev: Out of memory." ); dev = (cgm_Dev *) pls->dev; // Check for and set up driver options plParseDrvOpts( cgm_options ); dev->force_edges = force_edges; // force edges (for corel draw etc...) dev->disable_background = disable_background; // Disable background dev->colour = 1; // Set a fall back pen colour in case user doesn't dev->fill_colour = dev->colour; // initially set fill and line colour the same dev->last_fill_colour = -1; // set to -1 = unallocated dev->last_line_colour = -1; // set to -1 = unallocated } //-------------------------------------------------------------------------- // plD_init_cgm() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_cgm( PLStream *pls ) { cgm_Dev *dev = NULL; pls->termin = 0; // Not an interactive device pls->icol0 = 1; pls->bytecnt = 0; pls->page = 0; pls->dev_fill0 = 1; // Can do solid fills if ( !pls->colorset ) pls->color = 1; // Is a color device if ( pls->width < 1 ) pls->width = 1; // set a legal line width // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data plD_init_cgm_Dev( pls ); dev = (cgm_Dev *) pls->dev; if ( pls->xlength <= 0 || pls->ylength <= 0 ) { // use default width, height of 800x600 if not specifed by -geometry option // or plspage plspage( 0., 0., 800, 600, 0, 0 ); } pls->graphx = GRAPHICS_MODE; dev->cgmx = pls->xlength - 1; // should I use -1 or not??? dev->cgmy = pls->ylength - 1; #ifdef use_experimental_hidden_line_hack if ( dev->cgmx > dev->cgmy ) // Work out the scaling factor for the { // "virtual" (oversized) page dev->scale = ( PIXELS_X - 1 ) / dev->cgmx; } else { dev->scale = PIXELS_Y / dev->cgmy; } #else dev->scale = 1; #endif if ( pls->xdpi <= 0 ) { // This corresponds to a typical monitor resolution of 4 pixels/mm. plspage( 4. * 25.4, 4. * 25.4, 0, 0, 0, 0 ); } else { pls->ydpi = pls->xdpi; // Set X and Y dpi's to the same value } // Convert DPI to pixels/mm plP_setpxl( dev->scale * pls->xdpi / 25.4, dev->scale * pls->ydpi / 25.4 ); plP_setphy( 0, dev->scale * dev->cgmx, 0, dev->scale * dev->cgmy ); } //-------------------------------------------------------------------------- // plD_line_cgm() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_cgm( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { cgm_Dev *dev = (cgm_Dev *) pls->dev; int x1 = x1a / dev->scale, y1 = y1a / dev->scale, x2 = x2a / dev->scale, y2 = y2a / dev->scale; y1 = y1; y2 = y2; // // Determine if the colour has changed since the last time a line was // drawn. If it has, then set the colour NOW otherwise, keep on going like // "nuthin happened". // if ( dev->last_line_colour != dev->colour ) { cdSetLineColor( dev->im_out, dev->colour ); dev->last_line_colour = dev->colour; } cdLine( dev->im_out, x1, y1, x2, y2 ); } //-------------------------------------------------------------------------- // plD_polyline_cgm() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_cgm( PLStream *pls, short *xa, short *ya, PLINT npts ) { cgm_Dev *dev = (cgm_Dev *) pls->dev; PLINT i; cdPoint *points = NULL; if ( ( points = calloc( npts, (size_t) sizeof ( cdPoint ) ) ) == NULL ) { plexit( "Memory allocation error in \"plD_polyline_cgm\"" ); } for ( i = 0; i < npts; i++ ) { points[i].x = xa[i] / dev->scale; points[i].y = ( ya[i] / dev->scale ); } // // Determine if the colour has changed since the last time a line was // drawn. If it has, then set the colour NOW otherwise, keep on going like // "nuthin happened". // if ( dev->last_line_colour != dev->colour ) { cdSetLineColor( dev->im_out, dev->colour ); dev->last_line_colour = dev->colour; } cdPolyLine( dev->im_out, points, npts ); free( points ); } //-------------------------------------------------------------------------- // fill_polygon() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void fill_polygon( PLStream *pls ) { cgm_Dev *dev = (cgm_Dev *) pls->dev; PLINT i; cdPoint *points = NULL; if ( pls->dev_npts < 1 ) return; if ( ( points = calloc( pls->dev_npts, (size_t) sizeof ( cdPoint ) ) ) == NULL ) { plexit( "Memory allocation error in \"plD_fill_polygon_cgm\"" ); } for ( i = 0; i < pls->dev_npts; i++ ) { points[i].x = pls->dev_x[i] / dev->scale; points[i].y = ( pls->dev_y[i] / dev->scale ); } // // Determine if the fill colour has changed since the last time a fill was // done. If it has, then set the colour NOW otherwise, keep on going like // "nuthin happened". If it's the first time, we will know 'cause the the // "last_fill_colour" will be -1. // if ( ( dev->fill_colour != dev->last_fill_colour ) || ( dev->force_edges == 1 ) ) { cdSetFillColor( dev->im_out, dev->fill_colour ); // // Due to a bug in cd V1.3, we have to set the edge colour to the fill // colour. This is despite telling the library edges should be invisible. // Seems the invisible edges only work with rectangles. // if ( dev->force_edges == 1 ) { cdSetEdgeColor( dev->im_out, dev->fill_colour ); cdSetEdgeVis( dev->im_out, 1 ); } dev->last_fill_colour = dev->fill_colour; } cdPolygon( dev->im_out, points, pls->dev_npts ); if ( dev->force_edges == 1 ) cdSetEdgeVis( dev->im_out, 0 ); // Turn edges off now free( points ); } //-------------------------------------------------------------------------- // setcmap() // // Sets up color palette. //-------------------------------------------------------------------------- static void setcmap( PLStream *pls ) { int i, ncol1 = pls->ncol1; int ncol0 = pls->ncol0, total_colours; PLColor cmap1col; cgm_Dev *dev = (cgm_Dev *) pls->dev; PLFLT tmp_colour_pos; cdImageColorClear( dev->im_out ); // UNDOCUMENTED FUNCTION TO RESET THE // INTERNAL COLOUR TABLE OF THE // CD DRIVER. Seems to work and fix // the errors if ( ncol0 > cdMaxColors / 2 ) // Check for ridiculous number of colours { // in ncol0, and appropriately adjust the plwarn( "Too many colours in cmap0." ); // number, issuing a ncol0 = cdMaxColors / 2; // warning if it does pls->ncol0 = ncol0; } dev->totcol = 0; // Reset the number of colours counter to zero total_colours = ncol0 + ncol1; // Work out how many colours are wanted if ( total_colours > cdMaxColors ) // Do some rather modest error { // checking to make sure that total_colours = cdMaxColors; // we are not defining more colours ncol1 = total_colours - ncol0; // than we have room for. if ( ncol1 <= 0 ) { plexit( "Problem setting colourmap in CGM driver." ); } } dev->ncol1 = ncol1; // The actual size of ncol1, regardless of what was asked. // This is dependent on colour slots available. // It might well be the same as ncol1. // // Initialize cmap 0 colors if ( ncol0 > 0 ) // make sure the program actually asked for cmap0 first { #ifdef SWAP_BALCK_WHEN_WHITE // // Do a kludge to add a "black" colour back to the palette if the // background is "almost white" (ie changed through -bg). // // Also includes an "optional" change to swap the red colour (1) with the // black colour (15), which is off by default. (I don't like the red being // the 'default' colour "1" on a "white" background, or for that matter // yellow being "2", but I can live more with yellow at number two.) // Just use "-hack" from the command line to make it take effect. // // if ( ( pls->ncol0 > 15 ) && ( pls->cmap0[0].r > 227 ) && ( pls->cmap0[0].g > 227 ) && ( pls->cmap0[0].b > 227 ) ) { if ( pls->hack != 1 ) // just set colour 15 to black { pls->cmap0[15].r = 0; pls->cmap0[15].g = 0; pls->cmap0[15].b = 0; } else // swap colour 15 and colour 1 { pls->cmap0[15].r = pls->cmap0[1].r; pls->cmap0[15].g = pls->cmap0[1].g; pls->cmap0[15].b = pls->cmap0[1].b; pls->cmap0[1].r = 0; pls->cmap0[1].g = 0; pls->cmap0[1].b = 0; } } #endif for ( i = 0; i < ncol0; i++ ) { if ( ( dev->colour_index[i] = cdImageColorAllocate( dev->im_out, pls->cmap0[i].r, pls->cmap0[i].g, pls->cmap0[i].b ) ) == -1 ) { plwarn( "Problem setting cmap0 in CGM driver." ); } else ++dev->totcol; // count the number of colours we use as we use them } } // Initialize any remaining slots for cmap1 if ( ncol1 > 0 ) // make sure that we want to define cmap1 first { for ( i = 0; i < ncol1; i++ ) { if ( ncol1 < pls->ncol1 ) // Check the dynamic range of colours { // // Ok, now if we have less colour slots available than are being // defined by pls->ncol1, then we still want to use the full // dynamic range of cmap1 as best we can, so what we do is work // out an approximation to the index in the full dynamic range // in cases when pls->ncol1 exceeds the number of free colours. // tmp_colour_pos = i > 0 ? pls->ncol1 * ( (PLFLT) i / ncol1 ) : 0; plcol_interp( pls, &cmap1col, (int) tmp_colour_pos, pls->ncol1 ); } else { plcol_interp( pls, &cmap1col, i, ncol1 ); } if ( ( dev->colour_index[i + pls->ncol0] = cdImageColorAllocate( dev->im_out, cmap1col.r, cmap1col.g, cmap1col.b ) ) == -1 ) { plwarn( "Problem setting cmap1 in CGM driver." ); } else ++dev->totcol; // count the number of colours we use as we use them } } } //-------------------------------------------------------------------------- // plD_state_cgm() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_cgm( PLStream *pls, PLINT op ) { cgm_Dev *dev = (cgm_Dev *) pls->dev; PLFLT tmp_colour_pos; switch ( op ) { case PLSTATE_WIDTH: cdSetLineWidth( dev->im_out, pls->width ); break; case PLSTATE_COLOR0: dev->colour = pls->icol0; if ( dev->colour == PL_RGB_COLOR ) { int r = pls->curcolor.r; int g = pls->curcolor.g; int b = pls->curcolor.b; if ( dev->totcol < cdMaxColors ) { if ( ( dev->colour_index[++dev->totcol] = cdImageColorAllocate( dev->im_out, r, g, b ) ) == -1 ) plwarn( "Problem changing colour in \"PLSTATE_COLOR0\"" ); else dev->colour = dev->totcol; } } dev->fill_colour = dev->colour; break; case PLSTATE_COLOR1: // // Start by checking to see if we have to compensate for cases where // we don't have the full dynamic range of cmap1 at our disposal // if ( dev->ncol1 < pls->ncol1 ) { tmp_colour_pos = dev->ncol1 * ( (PLFLT) pls->icol1 / ( pls->ncol1 > 0 ? pls->ncol1 : 1 ) ); dev->colour = pls->ncol0 + (int) tmp_colour_pos; } else dev->colour = pls->ncol0 + pls->icol1; dev->fill_colour = dev->colour; break; case PLSTATE_CMAP0: case PLSTATE_CMAP1: // // Code to redefine the entire palette // if ( pls->color ) setcmap( pls ); break; } } //-------------------------------------------------------------------------- // plD_esc_cgm() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_cgm( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_FILL: // fill fill_polygon( pls ); break; } } //-------------------------------------------------------------------------- // plD_bop_cgm() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_cgm( PLStream *pls ) { cgm_Dev *dev; plGetFam( pls ); // force new file if pls->family set for all subsequent calls to plGetFam // n.b. putting this after plGetFam call is important since plinit calls // bop, and you don't want the familying sequence started until after // that first call to bop. pls->famadv = 1; pls->page++; // n.b. pls->dev can change because of an indirect call to plD_init_cgm // from plGetFam if familying is enabled. Thus, wait to define dev until // now. dev = (cgm_Dev *) pls->dev; if ( pls->page == 1 ) { dev->im_out = cdImageCreate( pls->xlength, pls->ylength ); } else if ( pls->family != 1 ) { cdCgmNewPic( dev->im_out, 0 ); } setcmap( pls ); // Continue to initialise the driver cdSetFillStyle( dev->im_out, 1 ); // Set solid fills // // Due to a border being drawn around the edge of the image, we also // manually, then turn them off again to make edges turn off. By // default the driver thinks they are off, so when we tell the driver // to turn them off it says "they are already off, I wont do anything" // but in reality they are on by default. So what we do is turn them ON // manually, then turn them OFF later. // // Due to a boarder being drawn around the edge of the image, we also // want the edges turned on so we can lay down a rectangle coloured in // the background colour at the start. Once we have drawn our // background box, we then turn edges off for the rest of the page. // cdSetEdgeVis( dev->im_out, 1 ); // turn edges on so we can turn them off! if ( dev->disable_background != 1 ) { cdSetEdgeWidth( dev->im_out, pls->xlength / 5 ); // set edge to *really* wide so we can cover the edge of the page completelt cdSetEdgeColor( dev->im_out, 0 ); // set the edge colour to the background colour so we can make a coloured page cdSetFillColor( dev->im_out, 0 ); // set fill colour to background colour so we have a coloured page cdRectangle( dev->im_out, 0, 0, pls->xlength - 1, pls->ylength - 1 ); // Draw a coloured rectangle to act as our "paper" } cdSetEdgeVis( dev->im_out, 0 ); // Turn edges off now cdSetEdgeWidth( dev->im_out, 0 ); // Just to be 100% sure cdSetLineType( dev->im_out, 1 ); // set solid lines cdSetLineWidth( dev->im_out, pls->width ); // set initial line width for each page } //-------------------------------------------------------------------------- // plD_tidy_cgm() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_cgm( PLStream *pls ) { cgm_Dev *dev = (cgm_Dev *) pls->dev; if ( pls->family != 1 ) { cdImageCgm( dev->im_out, pls->OutFile ); } cdImageDestroy( dev->im_out ); plCloseFile( pls ); free_mem( pls->dev ); } //-------------------------------------------------------------------------- // plD_eop_cgm() // // End of page. //-------------------------------------------------------------------------- void plD_eop_cgm( PLStream *pls ) { cgm_Dev *dev = (cgm_Dev *) pls->dev; int i; if ( pls->family == 1 ) { cdImageCgm( dev->im_out, pls->OutFile ); } for ( i = 0; i < cdMaxColors; ++i ) dev->colour_index[i] = -1; dev->fill_colour = dev->colour; // initially set fill and line colour the same dev->last_fill_colour = -1; // set to -1 = unallocated dev->last_line_colour = -1; // set to -1 = unallocated } //#endif #else int pldummy_cgm() { return 0; } #endif // cgm plplot-5.10.0+dfsg/drivers/aqt.driver_info.in 644 1750 1750 4511467025206 177720ustar andrewandrewaqt:AquaTerm (Mac OS X):1:aqt:50:aqt plplot-5.10.0+dfsg/drivers/svg.driver_info.in 644 1750 1750 6411466747272 200220ustar andrewandrewsvg:Scalable Vector Graphics (SVG 1.1):1:svg:57:svg plplot-5.10.0+dfsg/drivers/impress.c 644 1750 1750 1745611462322041 162640ustar andrewandrew// $Id: impress.c 11282 2010-10-28 16:26:09Z airwin $ // // PLplot ImPress device driver. // #include "plDevs.h" #ifdef PLD_imp #include "plplotP.h" #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_impress = "imp:Impress File:0:impress:37:imp\n"; // Function prototypes void plD_dispatch_init_imp( PLDispatchTable *pdt ); void plD_init_imp( PLStream * ); void plD_line_imp( PLStream *, short, short, short, short ); void plD_polyline_imp( PLStream *, short *, short *, PLINT ); void plD_eop_imp( PLStream * ); void plD_bop_imp( PLStream * ); void plD_tidy_imp( PLStream * ); void plD_state_imp( PLStream *, PLINT ); void plD_esc_imp( PLStream *, PLINT, void * ); static void flushline( PLStream * ); // top level declarations #define IMPX 2999 #define IMPY 2249 #define BUFFPTS 50 #define BUFFLENG 2 * BUFFPTS // Graphics control characters. #define SET_HV_SYSTEM 0315 #define OPBYTE1 031 #define OPBYTE2 0140 #define SET_ABS_H 0207 #define SET_ABS_V 0211 #define OPWORDH1 0 #define OPWORDH2 150 #define OPWORDV1 0 #define OPWORDV2 150 #define ENDPAGE 0333 #define SET_PEN 0350 #define CREATE_PATH 0346 #define DRAW_PATH 0352 #define OPTYPE 017 static int *LineBuff; static int FirstLine; static int penchange = 0, penwidth = 1; static int count; void plD_dispatch_init_imp( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "Impress File"; pdt->pl_DevName = "imp"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 37; pdt->pl_init = (plD_init_fp) plD_init_imp; pdt->pl_line = (plD_line_fp) plD_line_imp; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_imp; pdt->pl_eop = (plD_eop_fp) plD_eop_imp; pdt->pl_bop = (plD_bop_fp) plD_bop_imp; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_imp; pdt->pl_state = (plD_state_fp) plD_state_imp; pdt->pl_esc = (plD_esc_fp) plD_esc_imp; } //-------------------------------------------------------------------------- // plD_init_imp() // // Initialize device (terminal). //-------------------------------------------------------------------------- void plD_init_imp( PLStream *pls ) { PLDev *dev; // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data dev = plAllocDev( pls ); dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; dev->xmin = 0; dev->ymin = 0; dev->xmax = IMPX; dev->ymax = IMPY; dev->xlen = dev->xmax - dev->xmin; dev->ylen = dev->ymax - dev->ymin; plP_setpxl( (PLFLT) 11.81, (PLFLT) 11.81 ); plP_setphy( dev->xmin, dev->xmax, dev->ymin, dev->ymax ); LineBuff = (int *) malloc( BUFFLENG * sizeof ( int ) ); if ( LineBuff == NULL ) { plexit( "Error in memory alloc in plD_init_imp()." ); } fprintf( pls->OutFile, "@Document(Language ImPress, jobheader off)" ); fprintf( pls->OutFile, "%c%c", SET_HV_SYSTEM, OPBYTE1 ); fprintf( pls->OutFile, "%c%c%c", SET_ABS_H, OPWORDH1, OPWORDH2 ); fprintf( pls->OutFile, "%c%c%c", SET_ABS_V, OPWORDV1, OPWORDV2 ); fprintf( pls->OutFile, "%c%c", SET_HV_SYSTEM, OPBYTE2 ); } //-------------------------------------------------------------------------- // plD_line_imp() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_imp( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { PLDev *dev = (PLDev *) pls->dev; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; if ( FirstLine ) { if ( penchange ) { fprintf( pls->OutFile, "%c%c", SET_PEN, (char) penwidth ); penchange = 0; } // Add both points to path count = 0; FirstLine = 0; *( LineBuff + count++ ) = x1; *( LineBuff + count++ ) = y1; *( LineBuff + count++ ) = x2; *( LineBuff + count++ ) = y2; } else if ( ( count + 2 ) < BUFFLENG && x1 == dev->xold && y1 == dev->yold ) { // Add new point to path *( LineBuff + count++ ) = x2; *( LineBuff + count++ ) = y2; } else { // Write out old path count /= 2; fprintf( pls->OutFile, "%c%c%c", CREATE_PATH, (char) count / 256, (char) count % 256 ); fwrite( (char *) LineBuff, sizeof ( int ), 2 * count, pls->OutFile ); fprintf( pls->OutFile, "%c%c", DRAW_PATH, OPTYPE ); // And start a new path if ( penchange ) { fprintf( pls->OutFile, "%c%c", SET_PEN, (char) penwidth ); penchange = 0; } count = 0; *( LineBuff + count++ ) = x1; *( LineBuff + count++ ) = y1; *( LineBuff + count++ ) = x2; *( LineBuff + count++ ) = y2; } dev->xold = x2; dev->yold = y2; } //-------------------------------------------------------------------------- // plD_polyline_imp() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_imp( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_imp( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // plD_eop_imp() // // End of page. //-------------------------------------------------------------------------- void plD_eop_imp( PLStream *pls ) { flushline( pls ); fprintf( pls->OutFile, "%c", ENDPAGE ); } //-------------------------------------------------------------------------- // plD_bop_imp() // // Set up for the next page. //-------------------------------------------------------------------------- void plD_bop_imp( PLStream *pls ) { PLDev *dev = (PLDev *) pls->dev; FirstLine = 1; dev->xold = PL_UNDEFINED; dev->yold = PL_UNDEFINED; if ( !pls->termin ) plGetFam( pls ); pls->page++; } //-------------------------------------------------------------------------- // plD_tidy_imp() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_imp( PLStream *pls ) { free( (void *) LineBuff ); plCloseFile( pls ); } //-------------------------------------------------------------------------- // plD_state_imp() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_imp( PLStream *pls, PLINT op ) { switch ( op ) { case PLSTATE_WIDTH: if ( pls->width > 0 && pls->width <= 20 ) { penwidth = pls->width; penchange = 1; } break; case PLSTATE_COLOR0: break; case PLSTATE_COLOR1: break; } } //-------------------------------------------------------------------------- // plD_esc_imp() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_imp( PLStream *pls, PLINT op, void *ptr ) { } //-------------------------------------------------------------------------- // flushline() // // Spits out the line buffer. //-------------------------------------------------------------------------- static void flushline( PLStream *pls ) { count /= 2; fprintf( pls->OutFile, "%c%c%c", CREATE_PATH, (char) count / 256, (char) count % 256 ); fwrite( (char *) LineBuff, sizeof ( int ), 2 * count, pls->OutFile ); fprintf( pls->OutFile, "%c%c", DRAW_PATH, OPTYPE ); FirstLine = 1; } #else int pldummy_impress() { return 0; } #endif // PLD_imp plplot-5.10.0+dfsg/drivers/pbm.c 644 1750 1750 1703411571511407 153570ustar andrewandrew// // $Id: pbm.c 11760 2011-06-01 19:29:11Z airwin $ // // PLplot PBM (PPM) device driver. // // Contributed by John C. Atkinson and Zulfi Cumali. // Slightly modified by Geoffrey Furnish. // #include "plDevs.h" #ifdef PLD_pbm #include "plplotP.h" #include "drivers.h" // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_pbm = "pbm:PDB (PPM) Driver:0:pbm:38:pbm\n"; void plD_dispatch_init_pbm( PLDispatchTable *pdt ); void plD_init_pbm( PLStream * ); void plD_line_pbm( PLStream *, short, short, short, short ); void plD_polyline_pbm( PLStream *, short *, short *, PLINT ); void plD_eop_pbm( PLStream * ); void plD_bop_pbm( PLStream * ); void plD_tidy_pbm( PLStream * ); void plD_state_pbm( PLStream *, PLINT ); void plD_esc_pbm( PLStream *, PLINT, void * ); #undef PIXELS_X #undef PIXELS_Y #define PIXELS_X 640 #define PIXELS_Y 480 static char *cmap; #undef MAX #undef ABS #define MAX( a, b ) ( ( a > b ) ? a : b ) #define ABS( a ) ( ( a < 0 ) ? -a : a ) #define MAX_INTENSITY 255 void plD_dispatch_init_pbm( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "PDB (PPM) Driver"; pdt->pl_DevName = "pbm"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 38; pdt->pl_init = (plD_init_fp) plD_init_pbm; pdt->pl_line = (plD_line_fp) plD_line_pbm; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_pbm; pdt->pl_eop = (plD_eop_fp) plD_eop_pbm; pdt->pl_bop = (plD_bop_fp) plD_bop_pbm; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_pbm; pdt->pl_state = (plD_state_fp) plD_state_pbm; pdt->pl_esc = (plD_esc_fp) plD_esc_pbm; } //-------------------------------------------------------------------------- // plD_init_pbm() // // Initialize device (terminal). //-------------------------------------------------------------------------- void plD_init_pbm( PLStream *pls ) { #if 1 // Initialize family file info plFamInit( pls ); plP_setpxl( (PLFLT) 5.905, (PLFLT) 5.905 ); #endif pls->color = 1; // Is a color device pls->dev_fill0 = 0; // Handle solid fills pls->dev_fill1 = 0; // Use PLplot core fallback for pattern fills pls->nopause = 1; // Don't pause between frames // Prompt for a file name if not already set plOpenFile( pls ); pls->pdfs = pdf_finit( pls->OutFile ); // Allocate and initialize device-specific data pls->dev = NULL; // Set up device parameters if ( pls->xlength <= 0 || pls->ylength <= 0 ) { plspage( 0., 0., PIXELS_X, PIXELS_Y, 0, 0 ); } plP_setphy( 0, pls->xlength, 0, pls->ylength ); } #if 0 void plD_line_pbm( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { int steps, i, dx, dy; double x_off, y_off, dx_step, dy_step; // This algoritm is by Steven Harrington // From "Computer Graphics: A Proogramming Approach dx = x2a - x1a; dy = y2a - y1a; steps = MAX( ABS( dx ), ABS( dy ) ) + 1; steps *= 2; dx_step = dx / steps; dy_step = dy / steps; x_off = x1a + 0.5; y_off = y1a + 0.5; for ( i = 0; i < steps; i++ ) { cmap[(int) y_off][(int) x_off][0] = pls->curcolor.r; cmap[(int) y_off][(int) x_off][1] = pls->curcolor.g; cmap[(int) y_off][(int) x_off][2] = pls->curcolor.b; x_off += dx_step; y_off += dy_step; } cmap[(int) y_off][(int) x_off][0] = pls->curcolor.r; cmap[(int) y_off][(int) x_off][1] = pls->curcolor.g; cmap[(int) y_off][(int) x_off][2] = pls->curcolor.b; return; } #endif #define sign( a ) ( ( a < 0 ) ? -1 : ( ( a == 0 ) ? 0 : 1 ) ) #if 0 #define plot( x, y, c ) { cmap[y - 1][x - 1][0] = ( c )->curcolor.r; \ cmap[y - 1][x - 1][1] = ( c )->curcolor.g; \ cmap[y - 1][x - 1][2] = ( c )->curcolor.b; } // Bresnham's algorithm for line plotting on a scan lines void plD_line_pbm( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { int e, x, y, dx, dy, s1, s2, temp, change, i; x = x1a; y = y1a; dx = ABS( x2a - x1a ); dy = ABS( y2a - y1a ); s1 = sign( x2a - x1a ); s2 = sign( y2a - y1a ); if ( dy > dx ) { temp = dx; dx = dy; dy = temp; change = 1; } else { change = 0; } e = 2 * dy - dx; for ( i = 1; i < dx; i++ ) { plot( x, y, pls ); while ( e >= 0 ) { if ( change == 1 ) x += s1; else y += s2; e = e - 2 * dx; } if ( change == 1 ) y += s2; else x += s1; e = e + 2 * dy; } } #else #define plot( x, y, c ) { int i = 3 * ( ( y ) * ( c )->xlength + ( x ) ); \ cmap[i + 0] = ( c )->curcolor.r; \ cmap[i + 1] = ( c )->curcolor.g; \ cmap[i + 2] = ( c )->curcolor.b; } // Modified version of the ljii routine (see ljii.c) void plD_line_pbm( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { int i; int x1 = x1a, y1 = y1a, x2 = x2a, y2 = y2a; PLINT x1b, y1b, x2b, y2b; PLFLT length, fx, fy, dx, dy; // Take mirror image, since PCL expects (0,0) to be at top left y1 = pls->ylength - ( y1 - 0 ); y2 = pls->ylength - ( y2 - 0 ); x1b = x1, x2b = x2, y1b = y1, y2b = y2; length = (PLFLT) sqrt( (double) ( ( x2b - x1b ) * ( x2b - x1b ) + ( y2b - y1b ) * ( y2b - y1b ) ) ); if ( length == 0. ) length = 1.; dx = ( x2 - x1 ) / length; dy = ( y2 - y1 ) / length; fx = x1; fy = y1; plot( (PLINT) x1, (PLINT) y1, pls ); plot( (PLINT) x2, (PLINT) y2, pls ); for ( i = 1; i <= (int) length; i++ ) { fx += dx; fy += dy; plot( (PLINT) fx, (PLINT) fy, pls ); } } #endif void plD_polyline_pbm( PLStream *pls, short *xa, short *ya, PLINT npts ) { int i; for ( i = 0; i < npts - 1; i++ ) plD_line_pbm( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } void plD_eop_pbm( PLStream *pls ) { FILE *fp = pls->OutFile; size_t im_size, nwrite; if ( fp != NULL ) { fprintf( fp, "%s\n", "P6" ); fprintf( fp, "%d %d\n", pls->xlength, pls->ylength ); fprintf( fp, "%d\n", MAX_INTENSITY ); // // { // int i, j, k; // for (i=0; ixlength * pls->ylength * 3; nwrite = fwrite( cmap, 1, im_size, fp ); if ( nwrite != im_size ) plabort( "pbm driver: Error writing pbm file" ); plCloseFile( pls ); } free( cmap ); cmap = 0; } void plD_bop_pbm( PLStream *pls ) { int i, j, k; cmap = (char *) malloc( pls->xlength * pls->ylength * 3 ); for ( i = 0; i < pls->ylength; i++ ) for ( j = 0; j < pls->xlength; j++ ) { k = ( i * pls->xlength + j ) * 3; cmap[k + 0] = pls->cmap0[0].r; cmap[k + 1] = pls->cmap0[0].g; cmap[k + 2] = pls->cmap0[0].b; } } void plD_tidy_pbm( PLStream *pls ) { // Nothing to do here } void plD_state_pbm( PLStream *pls, PLINT op ) { // Nothing to do here } void plD_esc_pbm( PLStream *pls, PLINT op, void *ptr ) { // Nothing to do here } #else int pldummy_pbm() { return 0; } #endif // PLD_pbm plplot-5.10.0+dfsg/drivers/gd.c 644 1750 1750 15172212141235265 152150ustar andrewandrew// $Id: gd.c 12334 2013-05-04 16:43:33Z airwin $ // // PNG, GIF, and JPEG device driver based on libgd // // Copyright (C) 2004 Joao Cardoso // Copyright (C) 2002, 2003, 2004 Andrew Roach // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // GIF SUPPORT // // Following the expiration of Unisys's worldwide patents on lzw compression // GD 2.0.28+ have reinstated support for GIFs, and so support for this // format has been added to the GD family of drivers. GIF's only support // 1, 4 and 8 bit, so no truecolour. Why would you want GIFs though ? PNG is // a far superior format, not only giving you 1,4,8 and 24 bit, but also // better compression and just about all browsers now support them. // // // The GD drivers, PNG, GIF, and JPEG, support a number of different options // depending on the version of GD installed. // // If you have installed GD Ver 2.+ you gain support for truecolour (24 // bit, 16 millionish) modes as well as different line widths. These // capibilities are part of GD more so than the GD driver, so they aren't // available in any 1.? versions of the driver. // // 24 bit support is, by default, set to "auto" if you have V2.+ of GD. // What this means is the *driver* decides when to use 24 bit or 8 bit // modes for PNG files. The logic is rather simple - if you have less than // 257 colours, it is set to 8 bit mode, if more then it's in 24 bit mode. // This should work fine for most people, most of the time, in most // situations; however, it can be overridden in case it has to via the // "-drvopt" command line switch. The png driver has two related settings: // 8bit and // 24bit // // If either of these command line toggles are set, that mode becomes the // standard used regardless of the number of colours used. It can be envoked // as follows: // x08c -dev png -drvopt 8bit -fam -o 8bitpng // or // x08c -dev png -drvopt 24bit -fam -o 24bitpng // // NOTE: // The 24 bit PNG file is an RGBA file, not RGB - it includes alpha channel // (transparency). Transparency is set to opaque, but the fact it is an // RGBA and not an RGB might cause some problems with some viewers. // Sadly, I can't do anything about it... sorry. // // GIF files can only have 256 colours, so naturally truecolour mode is not // supported for this sub-driver. // // Stuff for GD V1.? as well as V2.+ // // optimise // // From version 1.17 of the GD driver, a command line option has been // added to try and optimise the PNG files. If successful, the optimise // command will create 4 bit (16 colour) PNGs instead of 8 bit (256 colour) // ones. This results in slightly smaller files with no loss in any colour // information. The function has no real memory overhead, but does have a // slight speed hit in exchange for the optimisation. For example: // x08c -dev png -drvopt 8bit,optimise -fam -o 8bitpng // forces the png driver to make 8bit pngs, and will then optimise any PNG // images with 16 or less colours into a 4 bit PNG. Note, this DOESN'T WORK // WITH 24bit PNGs yet, and will never work with JPEGs. // // // Also as of version 1.17 of the GD driver, the options for palette // modification previously set with the command line option "-hack" have // now been moved to two options settable from the -drvopt switch. // // def_black15 // // -drvopt def_black15 sets index 15, usually white, to black if index 0, // the background colour and usually black, has been set to white from the // command line option -bg // // swp_red15 // // -drvopt swp_red15 swaps index 15, usually white, with index 1, which is // usually red. This might be desirable occasionally, but it is principally // included for cases when the background has been set on the command line // to white, and the "def_black15" option has been issued to redefine index // 15 as black. By issuing a command like: // x08c -dev png -bg ffffff -drvopt def_black15,swp_red15 // the driver will set the background to white, then redefine index 15 of // cmap0, which is usually white to black, then swap index 2 (red) to 15 // (white originally, now black), so at the end of the day, the "default" // plotting colour is now black. Why do all of this ? It is a very quick // way of making a nice web-friendly png without having to redefine the // cmaps within your program. // // smoothlines // // -drvopt smoothlines=1 turns on anti-aliased line and polygong drawing if // you are using a 24bit mode. Unfortunately gd doesn't honour line // width when anti-aliasing, so by default it is off. // #include "plDevs.h" #if defined ( PLD_png ) || defined ( PLD_jpeg ) || defined ( PLD_gif ) #include "plplotP.h" #include "drivers.h" #include // Device info // // Don't knoq if all this logic is necessary, but basically we are going to // start with all three sub-drivers present, then work out way down to two // and finally one of each. // PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_gd = #if defined ( PLD_png ) "png:PNG file:0:gd:39:png\n" #endif #if defined ( PLD_jpeg ) "jpeg:JPEG file:0:gd:40:jpeg\n" #endif #if defined ( PLD_gif ) "gif:GIF file:0:gd:47:gif\n" #endif ; #if GD2_VERS >= 2 #ifdef PL_HAVE_FREETYPE #define SMOOTH_LINES_OK #endif #endif #ifdef PL_HAVE_FREETYPE // // Freetype support has been added to the GD family of drivers using the // plfreetype.c module, and implemented as a driver-specific optional extra // invoked via the -drvopt command line toggle. It uses the // "PLESC_HAS_TEXT" command for rendering within the driver. // // Freetype support is turned on/off at compile time by defining // "PL_HAVE_FREETYPE". // // To give the user some level of control over the fonts that are used, // environmental variables can be set to over-ride the definitions used by // the five default plplot fonts. // // Freetype rendering is used with the command line "-drvopt text". // Anti-aliased fonts can be used by issuing "-drvopt text,smooth" // #include "plfreetype.h" #endif // Prototypes for functions in this file. static void fill_polygon( PLStream *pls ); static void setcmap( PLStream *pls ); static void plD_init_png_Dev( PLStream *pls ); static void plD_gd_optimise( PLStream *pls ); static void plD_black15_gd( PLStream *pls ); static void plD_red15_gd( PLStream *pls ); #ifdef PLD_gif static void plD_init_gif_Dev( PLStream *pls ); #endif #ifdef PL_HAVE_FREETYPE static void plD_pixel_gd( PLStream *pls, short x, short y ); static PLINT plD_read_pixel_gd( PLStream *pls, short x, short y ); static void plD_set_pixel_gd( PLStream *pls, short x, short y, PLINT colour ); static void init_freetype_lv1( PLStream *pls ); static void init_freetype_lv2( PLStream *pls ); #endif // top level declarations static int NCOLOURS = gdMaxColors; // In an attempt to fix a problem with the hidden line removal functions // that results in hidden lines *not* being removed from "small" plot // pages (ie, like a normal video screen), a "virtual" page of much // greater size is used to trick the algorithm into working correctly. // If, in future, this gets fixed on its own, then don't define // "use_experimental_hidden_line_hack" // #define use_experimental_hidden_line_hack // I think the current version of Freetype supports up to a maximum of // 128 grey levels for text smoothing. You can get quite acceptable // results with as few as 4 grey-levels. Uusually only about 5 get used // anyway, but the question is where, in the "grey spectrum" will they be ? // Who knows ? The following define lets you set a maximum limit on the // number of grey-levels used. It is really only here for the 24bit mode // and could be set to 255, but that would slow things down and use more // memory. 64 seems to be a nice compromise, but if you want to change it, // then change it here. // #ifndef max_number_of_grey_levels_used_in_text_smoothing #define max_number_of_grey_levels_used_in_text_smoothing 64 #endif // Not present in versions before 2.0 #ifndef gdImagePalettePixel #define gdImagePalettePixel( im, x, y ) ( im )->pixels[( y )][( x )] #endif #if GD2_VERS >= 2 int plToGdAlpha( PLFLT a ) { int tmp = (int) ( ( 1.0 - a ) * gdAlphaMax ); return tmp; } #endif // Struct to hold device-specific info. typedef struct { gdImagePtr im_out; // Graphics pointer PLINT pngx; PLINT pngy; int colour; // Current Colour int totcol; // Total number of colours int ncol1; // Actual size of ncol1 we got PLFLT scale; // scaling factor to "blow up" to // the "virtual" page in removing hidden lines int optimise; // Flag used for 4bit pngs int black15; // Flag used for forcing a black colour int red15; // Flag for swapping red and 15 unsigned char TRY_BLENDED_ANTIALIASING; // Flag to try and set up BLENDED ANTIALIASING #if GD2_VERS >= 2 int truecolour; // Flag to ALWAYS force 24 bit mode int palette; // Flag to ALWAYS force 8 bit mode unsigned char smooth; // Flag to ask for line smoothing #endif } png_Dev; void plD_init_png( PLStream * ); void plD_line_png( PLStream *, short, short, short, short ); void plD_polyline_png( PLStream *, short *, short *, PLINT ); void plD_eop_png( PLStream * ); void plD_eop_jpeg( PLStream * ); void plD_bop_png( PLStream * ); void plD_tidy_png( PLStream * ); void plD_state_png( PLStream *, PLINT ); void plD_esc_png( PLStream *, PLINT, void * ); #ifdef PLD_gif void plD_init_gif( PLStream * ); void plD_eop_gif( PLStream * ); #endif #ifdef PLD_png void plD_dispatch_init_png( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "PNG file"; pdt->pl_DevName = "png"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 39; pdt->pl_init = (plD_init_fp) plD_init_png; pdt->pl_line = (plD_line_fp) plD_line_png; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_png; pdt->pl_eop = (plD_eop_fp) plD_eop_png; pdt->pl_bop = (plD_bop_fp) plD_bop_png; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_png; pdt->pl_state = (plD_state_fp) plD_state_png; pdt->pl_esc = (plD_esc_fp) plD_esc_png; } #endif #ifdef PLD_jpeg void plD_dispatch_init_jpeg( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "JPEG File"; pdt->pl_DevName = "jpeg"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 40; pdt->pl_init = (plD_init_fp) plD_init_png; pdt->pl_line = (plD_line_fp) plD_line_png; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_png; pdt->pl_eop = (plD_eop_fp) plD_eop_jpeg; pdt->pl_bop = (plD_bop_fp) plD_bop_png; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_png; pdt->pl_state = (plD_state_fp) plD_state_png; pdt->pl_esc = (plD_esc_fp) plD_esc_png; } #endif #ifdef PLD_gif void plD_dispatch_init_gif( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "GIF File"; pdt->pl_DevName = "gif"; #endif pdt->pl_type = plDevType_FileOriented; pdt->pl_seq = 47; pdt->pl_init = (plD_init_fp) plD_init_gif; pdt->pl_line = (plD_line_fp) plD_line_png; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_png; pdt->pl_eop = (plD_eop_fp) plD_eop_gif; pdt->pl_bop = (plD_bop_fp) plD_bop_png; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_png; pdt->pl_state = (plD_state_fp) plD_state_png; pdt->pl_esc = (plD_esc_fp) plD_esc_png; } #endif //-------------------------------------------------------------------------- // plD_init_png_Dev() // //-------------------------------------------------------------------------- static void plD_init_png_Dev( PLStream *pls ) { png_Dev *dev; // Stuff for the driver options, these vars are copied into the driver // structure so that everything is thread safe and reenterant. // static int optimise = 0; static int black15 = 0; static int red15 = 0; #if GD2_VERS >= 2 static int truecolour = 0; static int palette = 0; static int smooth_line = 0; #endif #ifdef PL_HAVE_FREETYPE static int freetype = 1; static int smooth_text = 1; FT_Data *FT; #endif DrvOpt gd_options[] = { { "optimise", DRV_INT, &optimise, "Optimise PNG palette when possible" }, { "def_black15", DRV_INT, &black15, "Define idx 15 as black. If the background is \"whiteish\" (from \"-bg\" option), force index 15 (traditionally white) to be \"black\"" }, { "swp_red15", DRV_INT, &red15, "Swap index 1 (usually red) and 1 (usually white); always done after \"black15\"; quite useful for quick changes to web pages" }, #if GD2_VERS >= 2 { "8bit", DRV_INT, &palette, "Palette (8 bit) mode" }, { "24bit", DRV_INT, &truecolour, "Truecolor (24 bit) mode" }, { "smoothlines", DRV_INT, &smooth_line, "Turn line Anti Aliasing on (1) or off (0)" }, #endif #ifdef PL_HAVE_FREETYPE { "text", DRV_INT, &freetype, "Use driver text (FreeType)" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, #endif { NULL, DRV_INT, NULL, NULL } }; // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( png_Dev ) ); if ( pls->dev == NULL ) plexit( "plD_init_png_Dev: Out of memory." ); dev = (png_Dev *) pls->dev; dev->colour = 1; // Set a fall back pen colour in case user doesn't // Check for and set up driver options plParseDrvOpts( gd_options ); dev->black15 = black15; dev->red15 = red15; dev->optimise = optimise; #if GD2_VERS >= 2 dev->palette = palette; dev->truecolour = truecolour; if ( ( dev->truecolour > 0 ) && ( dev->palette > 0 ) ) plwarn( "Selecting both \"truecolor\" AND \"palette\" driver options is contradictory, so\nI will just use my best judgment.\n" ); else if ( dev->truecolour > 0 ) NCOLOURS = 16777216; else if ( ( dev->truecolour == 0 ) && ( dev->palette == 0 ) && ( ( pls->ncol1 + pls->ncol0 ) > NCOLOURS ) ) { NCOLOURS = 16777216; } if ( ( dev->palette == 0 ) && ( dev->optimise == 0 ) && ( smooth_line == 1 ) ) dev->smooth = 1; // Allow smoothing of lines if we have a truecolour device #endif #ifdef PL_HAVE_FREETYPE if ( freetype ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode // As long as we aren't optimising, we'll try to use better antialaising // We can also only do this if the user wants smoothing, and hasn't // selected a palette mode. // init_freetype_lv1( pls ); FT = (FT_Data *) pls->FT; FT->want_smooth_text = smooth_text > 0 ? 1 : 0; if ( ( dev->optimise == 0 ) && ( dev->palette == 0 ) && ( smooth_text != 0 ) ) { FT->BLENDED_ANTIALIASING = 1; dev->truecolour = 1; } } #endif } //-------------------------------------------------------------------------- // plD_init_png() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_png( PLStream *pls ) { png_Dev *dev = NULL; pls->termin = 0; // Not an interactive device pls->icol0 = 1; pls->bytecnt = 0; pls->page = 0; pls->dev_fill0 = 1; // Can do solid fills if ( !pls->colorset ) pls->color = 1; // Is a color device // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data plD_init_png_Dev( pls ); dev = (png_Dev *) pls->dev; if ( pls->xlength <= 0 || pls->ylength <= 0 ) { // use default width, height of 800x600 if not specifed by -geometry option // or plspage plspage( 0., 0., 800, 600, 0, 0 ); } pls->graphx = GRAPHICS_MODE; dev->pngx = pls->xlength - 1; // should I use -1 or not??? dev->pngy = pls->ylength - 1; #ifdef use_experimental_hidden_line_hack if ( dev->pngx > dev->pngy ) // Work out the scaling factor for the { // "virtual" (oversized) page dev->scale = (PLFLT) ( PIXELS_X - 1 ) / (PLFLT) dev->pngx; } else { dev->scale = (PLFLT) PIXELS_Y / (PLFLT) dev->pngy; } #else dev->scale = 1.; #endif if ( pls->xdpi <= 0 ) { // This corresponds to a typical monitor resolution of 4 pixels/mm. plspage( 4. * 25.4, 4. * 25.4, 0, 0, 0, 0 ); } else { pls->ydpi = pls->xdpi; // Set X and Y dpi's to the same value } // Convert DPI to pixels/mm plP_setpxl( dev->scale * pls->xdpi / 25.4, dev->scale * pls->ydpi / 25.4 ); plP_setphy( 0, dev->scale * dev->pngx, 0, dev->scale * dev->pngy ); #ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { init_freetype_lv2( pls ); } #endif } #ifdef PLD_gif //-------------------------------------------------------------------------- // plD_init_gif_Dev() // // We need a new initialiser for the GIF version of the GD driver because // the GIF one does not support TRUECOLOUR //-------------------------------------------------------------------------- static void plD_init_gif_Dev( PLStream *pls ) { png_Dev *dev; // Stuff for the driver options, these vars are copied into the driver // structure so that everything is thread safe and reenterant. // static int black15 = 0; static int red15 = 0; #ifdef PL_HAVE_FREETYPE static int freetype = 1; static int smooth_text = 0; FT_Data *FT; #endif DrvOpt gd_options[] = { { "def_black15", DRV_INT, &black15, "Define idx 15 as black. If the background is \"whiteish\" (from \"-bg\" option), force index 15 (traditionally white) to be \"black\"" }, { "swp_red15", DRV_INT, &red15, "Swap index 1 (usually red) and 1 (usually white); always done after \"black15\"; quite useful for quick changes to web pages" }, #ifdef PL_HAVE_FREETYPE { "text", DRV_INT, &freetype, "Use driver text (FreeType)" }, { "smooth", DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)" }, #endif { NULL, DRV_INT, NULL, NULL } }; // Allocate and initialize device-specific data if ( pls->dev != NULL ) free( (void *) pls->dev ); pls->dev = calloc( 1, (size_t) sizeof ( png_Dev ) ); if ( pls->dev == NULL ) plexit( "plD_init_gif_Dev: Out of memory." ); dev = (png_Dev *) pls->dev; dev->colour = 1; // Set a fall back pen colour in case user doesn't // Check for and set up driver options plParseDrvOpts( gd_options ); dev->black15 = black15; dev->red15 = red15; dev->optimise = 0; // Optimise does not work for GIFs... should, but it doesn't dev->palette = 1; // Always use palette mode for GIF files dev->truecolour = 0; // Never have truecolour in GIFS #ifdef PL_HAVE_FREETYPE if ( freetype ) { pls->dev_text = 1; // want to draw text pls->dev_unicode = 1; // want unicode init_freetype_lv1( pls ); FT = (FT_Data *) pls->FT; FT->want_smooth_text = smooth_text > 0 ? 1 : 0; } #endif } //-------------------------------------------------------------------------- // plD_init_gif() // // Initialize device. //-------------------------------------------------------------------------- void plD_init_gif( PLStream *pls ) { png_Dev *dev = NULL; pls->termin = 0; // Not an interactive device pls->icol0 = 1; pls->bytecnt = 0; pls->page = 0; pls->dev_fill0 = 1; // Can do solid fills if ( !pls->colorset ) pls->color = 1; // Is a color device // Initialize family file info plFamInit( pls ); // Prompt for a file name if not already set plOpenFile( pls ); // Allocate and initialize device-specific data plD_init_gif_Dev( pls ); dev = (png_Dev *) pls->dev; if ( pls->xlength <= 0 || pls->ylength <= 0 ) { // use default width, height of 800x600 if not specifed by -geometry option // or plspage plspage( 0., 0., 800, 600, 0, 0 ); } pls->graphx = GRAPHICS_MODE; dev->pngx = pls->xlength - 1; // should I use -1 or not??? dev->pngy = pls->ylength - 1; #ifdef use_experimental_hidden_line_hack if ( dev->pngx > dev->pngy ) // Work out the scaling factor for the { // "virtual" (oversized) page dev->scale = (PLFLT) ( PIXELS_X - 1 ) / (PLFLT) dev->pngx; } else { dev->scale = (PLFLT) PIXELS_Y / (PLFLT) dev->pngy; } #else dev->scale = 1.; #endif if ( pls->xdpi <= 0 ) { // This corresponds to a typical monitor resolution of 4 pixels/mm. plspage( 4. * 25.4, 4. * 25.4, 0, 0, 0, 0 ); } else { pls->ydpi = pls->xdpi; // Set X and Y dpi's to the same value } // Convert DPI to pixels/mm plP_setpxl( dev->scale * pls->xdpi / 25.4, dev->scale * pls->ydpi / 25.4 ); plP_setphy( 0, dev->scale * dev->pngx, 0, dev->scale * dev->pngy ); #ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { init_freetype_lv2( pls ); } #endif } #endif //-------------------------------------------------------------------------- // plD_line_png() // // Draw a line in the current color from (x1,y1) to (x2,y2). //-------------------------------------------------------------------------- void plD_line_png( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { png_Dev *dev = (png_Dev *) pls->dev; int x1 = x1a / dev->scale, y1 = y1a / dev->scale, x2 = x2a / dev->scale, y2 = y2a / dev->scale; y1 = dev->pngy - y1; y2 = dev->pngy - y2; #ifdef SMOOTH_LINES_OK if ( dev->smooth == 1 ) { gdImageSetAntiAliased( dev->im_out, dev->colour ); gdImageLine( dev->im_out, x1, y1, x2, y2, gdAntiAliased ); } else { gdImageLine( dev->im_out, x1, y1, x2, y2, dev->colour ); } #else gdImageLine( dev->im_out, x1, y1, x2, y2, dev->colour ); #endif } //-------------------------------------------------------------------------- // plD_polyline_png() // // Draw a polyline in the current color. //-------------------------------------------------------------------------- void plD_polyline_png( PLStream *pls, short *xa, short *ya, PLINT npts ) { PLINT i; for ( i = 0; i < npts - 1; i++ ) plD_line_png( pls, xa[i], ya[i], xa[i + 1], ya[i + 1] ); } //-------------------------------------------------------------------------- // fill_polygon() // // Fill polygon described in points pls->dev_x[] and pls->dev_y[]. //-------------------------------------------------------------------------- static void fill_polygon( PLStream *pls ) { png_Dev *dev = (png_Dev *) pls->dev; int i; gdPoint *points = NULL; if ( pls->dev_npts < 1 ) return; points = malloc( (size_t) pls->dev_npts * sizeof ( gdPoint ) ); for ( i = 0; i < pls->dev_npts; i++ ) { points[i].x = pls->dev_x[i] / dev->scale; points[i].y = dev->pngy - ( pls->dev_y[i] / dev->scale ); } #ifdef SMOOTH_LINES_OK if ( dev->smooth == 1 ) { gdImageSetAntiAliased( dev->im_out, dev->colour ); gdImageFilledPolygon( dev->im_out, points, pls->dev_npts, gdAntiAliased ); } else { gdImageFilledPolygon( dev->im_out, points, pls->dev_npts, dev->colour ); } #else gdImageFilledPolygon( dev->im_out, points, pls->dev_npts, dev->colour ); #endif free( points ); } //-------------------------------------------------------------------------- // setcmap() // // Sets up color palette. //-------------------------------------------------------------------------- static void setcmap( PLStream *pls ) { int i, ncol1 = pls->ncol1; int ncol0 = pls->ncol0, total_colours; PLColor cmap1col; png_Dev *dev = (png_Dev *) pls->dev; PLFLT tmp_colour_pos; // // Yuckky fix to get rid of the previosuly allocated palette from the // GD image // if ( dev->im_out != NULL ) { for ( i = 0; i < 256; i++ ) { gdImageColorDeallocate( dev->im_out, i ); } } if ( ncol0 > NCOLOURS / 2 ) // Check for ridiculous number of colours { // in ncol0, and appropriately adjust the plwarn( "Too many colours in cmap0." ); // number, issuing a ncol0 = NCOLOURS / 2; // warning if it does pls->ncol0 = ncol0; } dev->totcol = 0; // Reset the number of colours counter to zero total_colours = ncol0 + ncol1; // Work out how many colours are wanted if ( total_colours > NCOLOURS ) // Do some rather modest error { // checking to make sure that total_colours = NCOLOURS; // we are not defining more colours ncol1 = total_colours - ncol0; // than we have room for. if ( ncol1 <= 0 ) { plexit( "Problem setting colourmap in PNG or JPEG driver." ); } } dev->ncol1 = ncol1; // The actual size of ncol1, regardless of what was asked. // This is dependent on colour slots available. // It might well be the same as ncol1. // // Initialize cmap 0 colors if ( ( ncol0 > 0 ) && ( dev->im_out != NULL ) ) // make sure the program actually asked for cmap0 first { for ( i = 0; i < ncol0; i++ ) { #if GD2_VERS >= 2 gdImageColorAllocateAlpha( dev->im_out, pls->cmap0[i].r, pls->cmap0[i].g, pls->cmap0[i].b, plToGdAlpha( pls->cmap0[i].a ) ); #else gdImageColorAllocate( dev->im_out, pls->cmap0[i].r, pls->cmap0[i].g, pls->cmap0[i].b ); #endif ++dev->totcol; // count the number of colours we use as we use them } } // Initialize any remaining slots for cmap1 if ( ( ncol1 > 0 ) && ( dev->im_out != NULL ) ) // make sure that we want to define cmap1 first { for ( i = 0; i < ncol1; i++ ) { if ( ncol1 < pls->ncol1 ) // Check the dynamic range of colours { // // Ok, now if we have less colour slots available than are being // defined by pls->ncol1, then we still want to use the full // dynamic range of cmap1 as best we can, so what we do is work // out an approximation to the index in the full dynamic range // in cases when pls->ncol1 exceeds the number of free colours. // tmp_colour_pos = i > 0 ? pls->ncol1 * ( (PLFLT) i / ncol1 ) : 0; plcol_interp( pls, &cmap1col, (int) tmp_colour_pos, pls->ncol1 ); } else { plcol_interp( pls, &cmap1col, i, ncol1 ); } #if GD2_VERS >= 2 gdImageColorAllocateAlpha( dev->im_out, cmap1col.r, cmap1col.g, cmap1col.b, plToGdAlpha( cmap1col.a ) ); #else gdImageColorAllocate( dev->im_out, cmap1col.r, cmap1col.g, cmap1col.b ); #endif ++dev->totcol; // count the number of colours we use as we go } } } //-------------------------------------------------------------------------- // plD_state_png() // // Handle change in PLStream state (color, pen width, fill attribute, etc). //-------------------------------------------------------------------------- void plD_state_png( PLStream *pls, PLINT op ) { png_Dev *dev = (png_Dev *) pls->dev; PLFLT tmp_colour_pos; #if GD2_VERS >= 2 long temp_col; #endif switch ( op ) { #if GD2_VERS >= 2 case PLSTATE_WIDTH: gdImageSetThickness( dev->im_out, pls->width ); break; #endif case PLSTATE_COLOR0: #if GD2_VERS >= 2 if ( ( pls->icol0 == PL_RGB_COLOR ) || // Should never happen since PL_RGB_COLOR is depreciated, but here for backwards compatibility ( gdImageTrueColor( dev->im_out ) ) ) // We will do this if we are in "TrueColour" mode { if ( ( dev->totcol < NCOLOURS ) || // See if there are slots left, if so we will allocate a new colour ( gdImageTrueColor( dev->im_out ) ) ) // In TrueColour mode we allocate each colour as we come to it { // Next allocate a new colour to a temporary slot since what we do with it will vary depending on if its a palette index or truecolour #if GD2_VERS >= 2 temp_col = gdImageColorAllocateAlpha( dev->im_out, pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, plToGdAlpha( pls->curcolor.a ) ); #else temp_col = gdImageColorAllocate( dev->im_out, pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ); #endif if ( gdImageTrueColor( dev->im_out ) ) dev->colour = temp_col; // If it's truecolour, then we will directly set dev->colour to our "new" colour else { dev->colour = dev->totcol; // or else, we will just set it to the last colour dev->totcol++; // Bump the total colours for next time round } } } else // just a normal colour allocate, so don't worry about the above stuff, just grab the index { dev->colour = pls->icol0; } #else dev->colour = pls->icol0; if ( dev->colour == PL_RGB_COLOR ) { if ( dev->totcol < NCOLOURS ) { #if GD2_VERS >= 2 gdImageColorAllocateAlpha( dev->im_out, pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, plToGdAlpha( pls->curcolor.a ) ); #else gdImageColorAllocate( dev->im_out, pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ); #endif dev->colour = dev->totcol; } } #endif break; case PLSTATE_COLOR1: #if GD2_VERS >= 2 if ( !gdImageTrueColor( dev->im_out ) ) { #endif // // Start by checking to see if we have to compensate for cases where // we don't have the full dynamic range of cmap1 at our disposal // if ( dev->ncol1 < pls->ncol1 ) { tmp_colour_pos = dev->ncol1 * ( (PLFLT) pls->icol1 / ( pls->ncol1 > 0 ? pls->ncol1 : 1 ) ); dev->colour = pls->ncol0 + (int) tmp_colour_pos; } else dev->colour = pls->ncol0 + pls->icol1; #if GD2_VERS >= 2 } else // it is a truecolour image { #if GD2_VERS >= 2 dev->colour = gdTrueColorAlpha( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, plToGdAlpha( pls->curcolor.a ) ); #else dev->colour = gdTrueColor( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ); #endif } #endif break; case PLSTATE_CMAP0: case PLSTATE_CMAP1: #if GD2_VERS >= 2 if ( ( dev->im_out != NULL ) && !gdImageTrueColor( dev->im_out ) ) { #endif // // Code to redefine the entire palette // if ( pls->color ) setcmap( pls ); #if GD2_VERS >= 2 } #endif break; } } //-------------------------------------------------------------------------- // plD_esc_png() // // Escape function. //-------------------------------------------------------------------------- void plD_esc_png( PLStream *pls, PLINT op, void *ptr ) { switch ( op ) { case PLESC_FILL: // fill fill_polygon( pls ); break; #ifdef PL_HAVE_FREETYPE case PLESC_HAS_TEXT: plD_render_freetype_text( pls, (EscText *) ptr ); break; #endif } } //-------------------------------------------------------------------------- // plD_bop_png() // // Set up for the next page. // Advance to next family file if necessary (file output). //-------------------------------------------------------------------------- void plD_bop_png( PLStream *pls ) { png_Dev *dev; plGetFam( pls ); // force new file if pls->family set for all subsequent calls to plGetFam // n.b. putting this after plGetFam call is important since plinit calls // bop, and you don't want the familying sequence started until after // that first call to bop. // n.b. pls->dev can change because of an indirect call to plD_init_png // from plGetFam if familying is enabled. Thus, wait to define dev until // now. dev = (png_Dev *) pls->dev; pls->famadv = 1; pls->page++; if ( dev->black15 ) plD_black15_gd( pls ); if ( dev->red15 ) plD_red15_gd( pls ); #if GD2_VERS >= 2 if ( ( ( ( ( dev->truecolour > 0 ) && ( dev->palette > 0 ) ) || // In an EXTREMELY convaluted ( ( dev->truecolour == 0 ) && ( dev->palette == 0 ) ) ) && // manner, all this is just ( ( pls->ncol1 + pls->ncol0 ) <= 256 ) ) || // asking the question, do we ( ( ( dev->palette > 0 ) && ( dev->truecolour == 0 ) ) ) ) // want truecolour or not ? { #endif dev->im_out = gdImageCreate( pls->xlength, pls->ylength ); setcmap( pls ); #if GD2_VERS >= 2 } else { dev->im_out = gdImageCreateTrueColor( pls->xlength, pls->ylength ); plP_state( PLSTATE_COLOR0 ); // // In truecolour mode, the background colour GD makes is ALWAYS black, so to // "simulate" (stimulate?) a background colour other than black, we will just // draw a dirty big rectange covering the whole image and colour it in // whatever colour cmap0[0] happens to be. // // Question to C gurus: while it is slightly illogical and ugly, would: // if ((pls->cmap0[0].r+pls->cmap0[0].g+pls->cmap0[0].b)!=0) // be more computationally efficient than: // if ((pls->cmap0[0].r!=0)||(pls->cmap0[0].g!=0)||(pls->cmap0[0].b!=0)) // ??? // if ( ( pls->cmap0[0].r != 0 ) || ( pls->cmap0[0].g != 0 ) || ( pls->cmap0[0].b != 0 ) || ( pls->cmap0[0].a != 0.0 ) ) { gdImageFilledRectangle( dev->im_out, 0, 0, pls->xlength - 1, pls->ylength - 1, gdTrueColorAlpha( pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b, plToGdAlpha( pls->cmap0[0].a ) ) ); } } // This ensures the line width is set correctly at the beginning of // each page plD_state_png( pls, PLSTATE_WIDTH ); #endif } //-------------------------------------------------------------------------- // plD_tidy_png() // // Close graphics file or otherwise clean up. //-------------------------------------------------------------------------- void plD_tidy_png( PLStream *pls ) { #ifdef PL_HAVE_FREETYPE if ( pls->dev_text ) { plD_FreeType_Destroy( pls ); } #endif plCloseFile( pls ); free_mem( pls->dev ); } //-------------------------------------------------------------------------- // plD_black15_gd() // // This small function simply redefines index 15 of cmap0, which is // usually set to white, to black, but only if index 0, which is usually // black, has been redefined to white (for example, through -bg). // //-------------------------------------------------------------------------- void plD_black15_gd( PLStream *pls ) { if ( pls->ncol0 > 15 ) { if ( ( pls->cmap0[0].r > 227 ) && ( pls->cmap0[0].g > 227 ) && ( pls->cmap0[0].b > 227 ) ) { pls->cmap0[15].r = 0; pls->cmap0[15].g = 0; pls->cmap0[15].b = 0; } } } //-------------------------------------------------------------------------- // plD_red15_gd() // // // This function swaps index 1, often the default plotting colour, with // index 15, the last defined colour. // // Colour 15 is usually white, and 1 is usually red, so swapping the two // might be desirable occasionally, but it is principally here for cases // when the background has been set on the command line to white, and the // "def_black15" option has been issued to redefine index 15 as black. By // issuing a command like // // ... -bg ffffff -drvopt def_black15,swp_red15 // // the driver will set the background to white, then redefine index 15 of // cmap0, which is usually white to black, then swap index 2 (red) to 15 // (white originally, now black), so at the end of the day, the "default" // plotting colour is now black. Why do all of this ? It is a very quick // way of making a nice web-friendly png without having to redefine the // cmaps within your program. // // If you don't like it, don't use it ! // //-------------------------------------------------------------------------- void plD_red15_gd( PLStream *pls ) { char r = pls->cmap0[1].r; char g = pls->cmap0[1].g; char b = pls->cmap0[1].b; if ( pls->ncol0 > 15 ) { pls->cmap0[1].r = pls->cmap0[15].r; pls->cmap0[1].g = pls->cmap0[15].r; pls->cmap0[1].b = pls->cmap0[15].r; pls->cmap0[15].r = r; pls->cmap0[15].g = g; pls->cmap0[15].b = b; } } //-------------------------------------------------------------------------- // plD_gd_optimise() // // // This function pretty much does exactly what it says - it optimises the // PNG file. It does this by checking to see if all the allocated colours // were actually used. If they were not, then it deallocates them. This // function often results in the PNG file being saved as a 4 bit (16 // colour) PNG rather than an 8 bit (256 colour) PNG. The file size // difference is not huge, not as great as for GIFs for example (I think // most of the saving comes from removing redundant entries from the // palette entry in the header); however some modest size savings occur. // // The function isn't always successful - the optimiser will always // deallocate unused colours as it finds them, but GD will only deallocate // them "for real" until 16 colours are used up, and then stop since it // doesn't make a difference if you have 17 colours or 255 colours. The // result of this is you may end up with an image using say, 130 colours, // but you will have 240 colour entries, some of which aren't used, and // aren't blanked out. // // Another side-effect of this function is the relative position of the // colour indices MAY shift as colours are deallocated. I really don't // think this should worry anyone, but if it does, don't optimise the // image ! // //-------------------------------------------------------------------------- void plD_gd_optimise( PLStream *pls ) { png_Dev *dev = (png_Dev *) pls->dev; int i, j; char *bbuf; bbuf = calloc( 256, (size_t) 1 ); // Allocate a buffer to "check off" colours as they are used if ( bbuf == NULL ) plexit( "plD_gd_optimise: Out of memory." ); for ( i = 0; i < ( pls->xlength - 1 ); i++ ) // Walk through the image pixel by pixel { // checking to see what colour it is for ( j = 0; j < ( pls->ylength - 1 ); j++ ) // and adding it to the list of used colours { bbuf[gdImagePalettePixel( dev->im_out, i, j )] = 1; } } for ( i = 0; i < 256; i++ ) // next walk over the colours and deallocate { // unused ones if ( bbuf[i] == 0 ) gdImageColorDeallocate( dev->im_out, i ); } free( bbuf ); } #ifdef PLD_png //-------------------------------------------------------------------------- // plD_eop_png() // // End of page. //-------------------------------------------------------------------------- void plD_eop_png( PLStream *pls ) { png_Dev *dev = (png_Dev *) pls->dev; int im_size = 0; int png_compression; void *im_ptr = NULL; size_t nwrite; if ( pls->family || pls->page == 1 ) { if ( dev->optimise ) { #if GD2_VERS >= 2 if ( ( ( ( ( dev->truecolour > 0 ) && ( dev->palette > 0 ) ) || // In an EXTREMELY convaluted ( ( dev->truecolour == 0 ) && ( dev->palette == 0 ) ) ) && // manner, all this is just ( ( pls->ncol1 + pls->ncol0 ) <= 256 ) ) || // asking the question, do we ( ( ( dev->palette > 0 ) && ( dev->truecolour == 0 ) ) ) ) // want truecolour or not ? { #endif plD_gd_optimise( pls ); #if GD2_VERS >= 2 } #endif } // image is written to output file by the driver // since if the gd.dll is linked to a different c // lib a crash occurs - this fix works also in Linux // gdImagePng(dev->im_out, pls->OutFile); #if GD2_VERS >= 2 //Set the compression/quality level for PNG files. // pls->dev_compression values of 1-9 translate to the zlib compression values 1-9 // pls->dev_compression values 10 <= compression <= 99 are divided by 10 to get the zlib // compression value. Values <=0 or greater than 99 are set to 90 which // translates to a zlib compression value of 9, the highest quality // of compression or smallest file size or largest computer time required // to achieve the compression. Smaller zlib compression values correspond // to lower qualities of compression (larger file size), but lower // computer times as well. png_compression = ( ( pls->dev_compression <= 0 ) || ( pls->dev_compression > 99 ) ) ? 90 : pls->dev_compression; png_compression = ( png_compression > 9 ) ? ( png_compression / 10 ) : png_compression; im_ptr = gdImagePngPtrEx( dev->im_out, &im_size, png_compression ); #else im_ptr = gdImagePngPtr( dev->im_out, &im_size ); #endif if ( im_ptr ) { nwrite = fwrite( im_ptr, sizeof ( char ), im_size, pls->OutFile ); if ( nwrite != im_size ) plabort( "gd driver: Error writing png file" ); gdFree( im_ptr ); } gdImageDestroy( dev->im_out ); dev->im_out = NULL; } } #endif #ifdef PL_HAVE_FREETYPE //-------------------------------------------------------------------------- // void plD_pixel_gd (PLStream *pls, short x, short y) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is set in the current colour. //-------------------------------------------------------------------------- void plD_pixel_gd( PLStream *pls, short x, short y ) { png_Dev *dev = (png_Dev *) pls->dev; gdImageSetPixel( dev->im_out, x, y, dev->colour ); } //-------------------------------------------------------------------------- // void plD_set_pixel_gd (PLStream *pls, short x, short y) // // callback function, of type "plD_pixel_fp", which specifies how a single // pixel is set directly to hardware, using the colour provided //-------------------------------------------------------------------------- void plD_set_pixel_gd( PLStream *pls, short x, short y, PLINT colour ) { png_Dev *dev = (png_Dev *) pls->dev; int R, G, B; int Colour; G = GetGValue( colour ); R = GetRValue( colour ); B = GetBValue( colour ); Colour = gdImageColorResolve( dev->im_out, R, G, B ); gdImageSetPixel( dev->im_out, x, y, Colour ); } //-------------------------------------------------------------------------- // PLINT plD_read_pixel_gd (PLStream *pls, short x, short y) // // callback function, of type "plD_read_pixel_gd", which specifies how a // single pixel's RGB is read (in the destination context), then // returns an RGB encoded int with the info for blending. //-------------------------------------------------------------------------- PLINT plD_read_pixel_gd( PLStream *pls, short x, short y ) { png_Dev *dev = (png_Dev *) pls->dev; PLINT colour; unsigned char R, G, B; colour = gdImageGetTrueColorPixel( dev->im_out, x, y ); R = gdTrueColorGetRed( colour ); G = gdTrueColorGetGreen( colour ); B = gdTrueColorGetBlue( colour ); colour = RGB( R, G, B ); return ( colour ); } //-------------------------------------------------------------------------- // void init_freetype_lv1 (PLStream *pls) // // "level 1" initialisation of the freetype library. // "Level 1" initialisation calls plD_FreeType_init(pls) which allocates // memory to the pls->FT structure, then sets up the pixel callback // function. //-------------------------------------------------------------------------- static void init_freetype_lv1( PLStream *pls ) { FT_Data *FT; plD_FreeType_init( pls ); FT = (FT_Data *) pls->FT; FT->pixel = (plD_pixel_fp) plD_pixel_gd; FT->read_pixel = (plD_read_pixel_fp) plD_read_pixel_gd; FT->set_pixel = (plD_set_pixel_fp) plD_set_pixel_gd; } //-------------------------------------------------------------------------- // void init_freetype_lv2 (PLStream *pls) // // "Level 2" initialisation of the freetype library. // "Level 2" fills in a few setting that aren't public until after the // graphics sub-syetm has been initialised. // The "level 2" initialisation fills in a few things that are defined // later in the initialisation process for the GD driver. // // FT->scale is a scaling factor to convert co-ordinates. This is used by // the GD and other drivers to scale back a larger virtual page and this // eliminate the "hidden line removal bug". Set it to 1 if your device // doesn't have scaling. // // Some coordinate systems have zero on the bottom, others have zero on // the top. Freetype does it one way, and most everything else does it the // other. To make sure everything is working ok, we have to "flip" the // coordinates, and to do this we need to know how big in the Y dimension // the page is, and whether we have to invert the page or leave it alone. // // FT->ymax specifies the size of the page FT->invert_y=1 tells us to // invert the y-coordinates, FT->invert_y=0 will not invert the // coordinates. //-------------------------------------------------------------------------- static void init_freetype_lv2( PLStream *pls ) { png_Dev *dev = (png_Dev *) pls->dev; FT_Data *FT = (FT_Data *) pls->FT; FT->scale = dev->scale; FT->ymax = dev->pngy; FT->invert_y = 1; FT->smooth_text = 0; if ( ( FT->want_smooth_text == 1 ) && ( FT->BLENDED_ANTIALIASING == 0 ) ) // do we want to at least *try* for smoothing ? { FT->ncol0_org = pls->ncol0; // save a copy of the original size of ncol0 FT->ncol0_xtra = NCOLOURS - ( pls->ncol1 + pls->ncol0 ); // work out how many free slots we have FT->ncol0_width = FT->ncol0_xtra / ( pls->ncol0 - 1 ); // find out how many different shades of anti-aliasing we can do if ( FT->ncol0_width > 4 ) // are there enough colour slots free for text smoothing ? { if ( FT->ncol0_width > max_number_of_grey_levels_used_in_text_smoothing ) FT->ncol0_width = max_number_of_grey_levels_used_in_text_smoothing; // set a maximum number of shades plscmap0n( FT->ncol0_org + ( FT->ncol0_width * pls->ncol0 ) ); // redefine the size of cmap0 // the level manipulations are to turn off the plP_state(PLSTATE_CMAP0) // call in plscmap0 which (a) leads to segfaults since the GD image is // not defined at this point and (b) would be inefficient in any case since // setcmap is always called later (see plD_bop_png) to update the driver // color palette to be consistent with cmap0. { PLINT level_save; level_save = pls->level; pls->level = 0; pl_set_extended_cmap0( pls, FT->ncol0_width, FT->ncol0_org ); // call the function to add the extra cmap0 entries and calculate stuff pls->level = level_save; } FT->smooth_text = 1; // Yippee ! We had success setting up the extended cmap0 } else plwarn( "Insufficient colour slots available in CMAP0 to do text smoothing." ); } else if ( ( FT->want_smooth_text == 1 ) && ( FT->BLENDED_ANTIALIASING == 1 ) ) // If we have a truecolour device, we wont even bother trying to change the palette { FT->smooth_text = 1; } } #endif #ifdef PLD_jpeg //-------------------------------------------------------------------------- // plD_eop_jpeg() // // End of page. //-------------------------------------------------------------------------- void plD_eop_jpeg( PLStream *pls ) { png_Dev *dev = (png_Dev *) pls->dev; int im_size = 0; void *im_ptr = NULL; size_t nwrite; int jpeg_compression; if ( pls->family || pls->page == 1 ) { // Set the compression/quality level for JPEG files // The higher the value, the bigger/better the image is // if ( ( pls->dev_compression <= 0 ) || ( pls->dev_compression > 99 ) ) jpeg_compression = 90; else jpeg_compression = pls->dev_compression; // image is written to output file by the driver // since if the gd.dll is linked to a different c // lib a crash occurs - this fix works also in Linux // gdImageJpeg(dev->im_out, pls->OutFile, jpeg_compression); im_ptr = gdImageJpegPtr( dev->im_out, &im_size, jpeg_compression ); if ( im_ptr ) { nwrite = fwrite( im_ptr, sizeof ( char ), im_size, pls->OutFile ); if ( nwrite != im_size ) plabort( "gd driver: Error writing png file" ); gdFree( im_ptr ); } gdImageDestroy( dev->im_out ); dev->im_out = NULL; } } #endif #ifdef PLD_gif //-------------------------------------------------------------------------- // plD_eop_gif() // // End of page. //-------------------------------------------------------------------------- void plD_eop_gif( PLStream *pls ) { png_Dev *dev = (png_Dev *) pls->dev; int im_size = 0; void *im_ptr = NULL; size_t nwrite; if ( pls->family || pls->page == 1 ) { // image is written to output file by the driver // since if the gd.dll is linked to a different c // lib a crash occurs - this fix works also in Linux // gdImageGif(dev->im_out, pls->OutFile); im_ptr = gdImageGifPtr( dev->im_out, &im_size ); if ( im_ptr ) { nwrite = fwrite( im_ptr, sizeof ( char ), im_size, pls->OutFile ); if ( nwrite != im_size ) plabort( "gd driver: Error writing png file" ); gdFree( im_ptr ); } gdImageDestroy( dev->im_out ); dev->im_out = NULL; } } #endif //#endif #else int pldummy_png() { return 0; } #endif // PNG plplot-5.10.0+dfsg/drivers/plmeta.driver_info.in 644 1750 1750 5711466747272 205070ustar andrewandrewplmeta:PLplot Native Meta-File:0:plmeta:26:plm plplot-5.10.0+dfsg/drivers/tk.driver_info.in 644 1750 1750 3311466747272 176350ustar andrewandrewtk:Tcl/TK Window:1:tk:7:tk plplot-5.10.0+dfsg/drivers/mem.driver_info.in 644 1750 1750 5611466747272 200020ustar andrewandrewmem:User-supplied memory device:-1:mem:46:mem plplot-5.10.0+dfsg/drivers/ntk.c 644 1750 1750 4466212264375600 154070ustar andrewandrew// $Id: ntk.c 12932 2014-01-12 02:18:40Z airwin $ // // Experimental tk driver using a plain "wish" // // Copyright (C) 2001 Joao Cardoso // Copyright (C) 2004 Rafael Laboissiere // // This file is part of PLplot. // // PLplot is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License as published // by the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // PLplot is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with PLplot; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // // #include "plDevs.h" #ifdef PLD_ntk #include "plplotP.h" #include "drivers.h" #include "plevent.h" #include // Device info PLDLLIMPEXP_DRIVER const char* plD_DEVICE_INFO_ntk = "ntk:New tk driver:1:ntk:43:ntk\n"; void plD_dispatch_init_ntk( PLDispatchTable *pdt ); void plD_init_ntk( PLStream * ); void plD_line_ntk( PLStream *, short, short, short, short ); void plD_polyline_ntk( PLStream *, short *, short *, PLINT ); void plD_eop_ntk( PLStream * ); void plD_bop_ntk( PLStream * ); void plD_tidy_ntk( PLStream * ); void plD_state_ntk( PLStream *, PLINT ); void plD_esc_ntk( PLStream *, PLINT, void * ); void plD_dispatch_init_ntk( PLDispatchTable *pdt ) { #ifndef ENABLE_DYNDRIVERS pdt->pl_MenuStr = "New Tk device"; pdt->pl_DevName = "ntk"; #endif pdt->pl_type = plDevType_Interactive; pdt->pl_seq = 43; pdt->pl_init = (plD_init_fp) plD_init_ntk; pdt->pl_line = (plD_line_fp) plD_line_ntk; pdt->pl_polyline = (plD_polyline_fp) plD_polyline_ntk; pdt->pl_eop = (plD_eop_fp) plD_eop_ntk; pdt->pl_bop = (plD_bop_fp) plD_bop_ntk; pdt->pl_tidy = (plD_tidy_fp) plD_tidy_ntk; pdt->pl_state = (plD_state_fp) plD_state_ntk; pdt->pl_esc = (plD_esc_fp) plD_esc_ntk; } // hardwired window size #define XPIXELS 600 #define YPIXELS 400 static PLFLT scale = 10.0; // Tk canvas units are in pixels, giving corse curves, fool plplot, and scale down when sending to tk static PLFLT ppm; // device pixels per mm static Tcl_Interp *interp = NULL; // tcl interpreter static Tk_Window mainw; // tk main window static char curcolor[80]; // current color in #rrggbb notation // 12000 is large enough to satisfy example 27 needs without // erroring out in plD_polyline_ntk. Quadruple that to be conservative. #define PLPLOT_NTK_CMD_SIZE 48000 static char cmd[PLPLOT_NTK_CMD_SIZE]; // buffer to build command to interp static int ccanv = 0; // current canvas number static char base[80]; // name of frame that contains the canvas static char dash[80]; // dash string, as * // line buffering #define NPTS 1000 static short xold = -1, yold = -1; // last point of last 2 points line static short xb[NPTS], yb[NPTS]; // buffer static int curpts = 0; // current number of points buffered static int local = 1; // "local" or "remote" interpreter static char rem_interp[80]; // name of remote interp // physical devices coordinates static PLINT xmin = 0; static PLINT xmax = XPIXELS; static PLINT ymin = 0; static PLINT ymax = YPIXELS; // locator static PLGraphicsIn gin; static void tk_cmd( const char *gcmd ) { static char scmd[PLPLOT_NTK_CMD_SIZE]; if ( local ) Tcl_Eval( interp, gcmd ); else { // the -async option makes it block, some times! but is *much* faster! // and was working OK till now :( // sprintf(scmd, "send -async %s {%s}", rem_interp, cmd); // sprintf( scmd, "send %s {%s}", rem_interp, gcmd ); // mess! make it more efficient if ( Tcl_Eval( interp, scmd ) != TCL_OK ) fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); } } static void create_canvas( PLStream *pls ) { int columnbreak; ccanv++; columnbreak = ( ccanv % 30 == 0 ); // create new canvas sprintf( cmd, "set ccanv %d; canvas $plf.f2.c$ccanv -width $xmax -height $ymax -background #%02x%02x%02x -xscrollcommand \"$hs set\" -yscrollcommand \"$vs set\" -scrollregion \"0 0 $xmax $ymax\"", ccanv, pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b ); tk_cmd( cmd ); // add new canvas to option menu sprintf( cmd, "$plf.f1.mb.menu add command -label \"Page $ccanv\" -columnbreak %d -command {\n" "set w $plf.f2.c%d;\n" "$hs configure -command \"$w xview\";\n" "$vs configure -command \"$w yview\";\n" "set dname \"Page %d\";\n" "pack forget $ocanvas;\n" "set ocanvas $plf.f2.c%d;\n" "pack $ocanvas -fill both -expand 1;\n" "scan [$w xview] \"%%f %%f\" i j;\n" "$hs set $i $j;\n" "scan [$w yview] \"%%f %%f\" i j;\n" "$vs set $i $j;}", columnbreak, ccanv, ccanv, ccanv ); tk_cmd( cmd ); sprintf( cmd, "set item(%d) 0", ccanv ); tk_cmd( cmd ); // Shif-B1, zooms in // FIXME inform the core lib of the zoom, see plframe.c around line 2818 sprintf( cmd, "bind $plf.f2.c$ccanv {\n" "set cc %d;\n" "incr item($cc); set tt $item($cc);\n" "if {$tt == 1} {\n" "incr scroll_use;\n" "pack $hs -side bottom -fill x;\n" "pack $vs -side right -fill y;\n" "pack forget %%W; pack %%W -fill both -expand 1}\n" "set zx($cc,$tt) %%x;\n" "set zy($cc,$tt) %%y;\n" "%%W scale all %%x %%y 1.6 1.6;\n" "%%W configure -scrollregion [%%W bbox all];\n" "}", ccanv ); tk_cmd( cmd ); // Shif-B3, zooms out sprintf( cmd, "bind $plf.f2.c$ccanv {\n" "set cc %d; set tt $item($cc);\n" "if {$tt != 0} {\n" "%%W scale all $zx($cc,$tt) $zy($cc,$tt) 0.625 0.625\n" "%%W configure -scrollregion [%%W bbox all];\n" "set item($cc) [expr $tt - 1]}\n" "if { $item($cc) == 0} {\n" "set scroll_use [expr $scroll_use - 1];\n" "if {$scroll_use == 0} {\n" "pack forget $plf.f2.hscroll $plf.f2.vscroll}\n" "%%W configure -scrollregion \"0 0 $xmax $ymax\"}}", ccanv ); tk_cmd( cmd ); // Shift-B2, resets sprintf( cmd, "bind $plf.f2.c$ccanv {\n" "set cc %d; set tt $item($cc); \n" "while {$tt != 0} {\n" "%%W scale all $zx($cc,$tt) $zy($cc,$tt) 0.625 0.625\n" "set tt [expr $tt - 1]};\n" "set item($cc) 0;\n" "%%W configure -scrollregion \"0 0 $xmax $ymax\";\n" "set scroll_use [expr $scroll_use - 1];\n" "if {$scroll_use == 0} {\n" "pack forget $plf.f2.hscroll $plf.f2.vscroll}}", ccanv ); tk_cmd( cmd ); // Control-B1-Motion, pan sprintf( cmd, "bind $plf.f2.c$ccanv \"$plf.f2.c%d scan mark %%x %%y\"", ccanv ); tk_cmd( cmd ); sprintf( cmd, "bind $plf.f2.c$ccanv \"$plf.f2.c%d scan dragto %%x %%y\"", ccanv ); tk_cmd( cmd ); // Control-B2, identify and (in the far future) edit object tk_cmd( "bind $plf.f2.c$ccanv {\n" "set xx [ expr [winfo pointerx .] - [winfo rootx %W]];\n" "set yy [ expr [winfo pointery .] - [winfo rooty %W]];\n" "set near [%W find closest $xx $yy];\n" "%W move $near 20 20;\n" "after 500 \"%W move $near -20 -20\"}" ); // change view to the new canvas by invoking the menu buttom sprintf( cmd, "$plf.f1.mb.menu invoke %d", ccanv - 1 ); tk_cmd( cmd ); } //-------------------------------------------------------------------------- // plD_init_ntk() // // Initialize device (terminal). //-------------------------------------------------------------------------- void plD_init_ntk( PLStream *pls ) { pls->dev_fill0 = 1; // Handle solid fills pls->dev_fill1 = 1; // Driver handles pattern fills pls->color = 1; // Is a color device pls->dev_dash = 1; // Handle dashed lines pls->plbuf_write = 1; // Use plot buffer strcpy( curcolor, "black" ); // default color by name, not #rrggbb if ( pls->server_name != NULL ) { local = 0; strcpy( rem_interp, pls->server_name ); } if ( pls->geometry != NULL ) sscanf( pls->geometry, "%dx%d", &xmax, &ymax ); // if ( pls->plwindow != NULL ) // strcpy( base, pls->plwindow ); // else strcpy( base, ".plf" ); // default frame containing the canvas interp = Tcl_CreateInterp(); if ( Tcl_Init( interp ) != TCL_OK ) plexit( "Unable to initialize Tcl." ); if ( Tk_Init( interp ) ) plexit( "Unable to initialize Tk." ); mainw = Tk_MainWindow( interp ); Tcl_Eval( interp, "rename exec {}" ); Tcl_Eval( interp, "tk appname PLplot_ntk" ); // give interpreter a name if ( !local ) { Tcl_Eval( interp, "wm withdraw ." ); sprintf( cmd, "send %s \"set client [tk appname]; wm deiconify .\"", rem_interp ); if ( Tcl_Eval( interp, cmd ) != TCL_OK ) { fprintf( stderr, "%s\n", Tcl_GetStringResult( interp ) ); plexit( "No such tk server." ); } } sprintf( cmd, "set scroll_use 0; set plf %s; set vs $plf.f2.vscroll; set hs $plf.f2.hscroll; set xmax %d; set ymax %d; set ocanvas .;", base, xmax, ymax ); tk_cmd( cmd ); tk_cmd( "catch \"frame $plf\"; pack $plf -fill both -expand 1" ); sprintf( cmd, "frame $plf.f1;\n" "frame $plf.f2 -width %d -height %d;\n" "pack $plf.f1 -fill x;\n" "pack $plf.f2 -fill both -expand 1", xmax, ymax ); tk_cmd( cmd ); tk_cmd( "scrollbar $plf.f2.hscroll -orient horiz;\n" "scrollbar $plf.f2.vscroll" ); tk_cmd( "menubutton $plf.f1.mb -text \"Page 1\" -textvariable dname -relief raised -indicatoron 1 -menu $plf.f1.mb.menu;\n" "menu $plf.f1.mb.menu -tearoff 0;\n" "pack $plf.f1.mb -side left" ); if ( local ) tk_cmd( "button $plf.f1.quit -text Quit -command exit;\n" "pack $plf.f1.quit -side right" ); else tk_cmd( "button $plf.f1.quit -text Quit -command {send -async $client exit;\n" "destroy $plf;\n" "wm withdraw .};\n" "pack $plf.f1.quit -side right" ); // FIXME: I just discovered that Tcl_Eval is slower than Tcl_EvalObj. Fix it global-wide, `man Tcl_Eval' // Set up device parameters Tcl_Eval( interp, "tk scaling" ); // pixels per mm ppm = (PLFLT) atof( Tcl_GetStringResult( interp ) ) / ( 25.4 / 72. ); plP_setpxl( ppm, ppm ); plP_setphy( xmin, (PLINT) ( xmax * scale ), ymin, (PLINT) ( ymax * scale ) ); tk_cmd( "update" ); } static void flushbuffer( PLStream *pls ) { if ( curpts ) { plD_polyline_ntk( pls, xb, yb, curpts ); // if (curpts != 2) fprintf(stderr,"%d ", curpts); xold = yold = -1; curpts = 0; } } void plD_line_ntk( PLStream *pls, short x1a, short y1a, short x2a, short y2a ) { if ( xold == x1a && yold == y1a ) { xold = xb[curpts] = x2a; yold = yb[curpts] = y2a; curpts++; } else { flushbuffer( pls ); xb[curpts] = x1a; yb[curpts] = y1a; curpts++; xold = xb[curpts] = x2a; yold = yb[curpts] = y2a; curpts++; } if ( curpts == NPTS ) { //fprintf( stderr, "\nflush: %d ", curpts ); flushbuffer( pls ); } } void plD_polyline_ntk( PLStream * PL_UNUSED( pls ), short *xa, short *ya, PLINT npts ) { PLINT i, j; // there must exist a way to code this using the tk C API j = sprintf( cmd, "$plf.f2.c%d create line ", ccanv ); for ( i = 0; i < npts; i++ ) { // To be completely safe, assume 5 characters to the left of the // decimal point ==> 2*(5+3) characters written per sprintf // call. if ( ( j + 16 ) > PLPLOT_NTK_CMD_SIZE ) plexit( "plD_polyline_ntk: too many x, y values to hold in static cmd array" ); j += sprintf( &cmd[j], "%.1f %.1f ", xa[i] / scale, ymax - ya[i] / scale ); } j += sprintf( &cmd[j], " -fill %s", curcolor ); if ( dash[0] == '-' ) j += sprintf( &cmd[j], " %s", dash ); tk_cmd( cmd ); } // an event loop has to be designed, getcursor() and waitforpage() are just experimental static void waitforpage( PLStream * PL_UNUSED( pls ) ) { int key = 0, st = 0; // why can't I bind to the canvas? or even any frame? //tk_cmd("bind . {set keypress %N; puts \"\n%k-%A-%K-%N\"}"); tk_cmd( "bind . {set keypress %N}" ); while ( ( key & 0xff ) != PLK_Return && ( key & 0xff ) != PLK_Linefeed && key != PLK_Next && key != 'Q' ) { while ( st != 1 ) { tk_cmd( "update" ); tk_cmd( "info exists keypress" ); sscanf( Tcl_GetStringResult( interp ), "%d", &st ); } tk_cmd( "set keypress" ); sscanf( Tcl_GetStringResult( interp ), "%d", &key ); //fprintf(stderr,"\n%d\n", key);fflush(stderr); tk_cmd( "unset keypress" ); st = 0; } tk_cmd( "bind . {};" ); } void plD_eop_ntk( PLStream *pls ) { flushbuffer( pls ); tk_cmd( "update" ); } void plD_bop_ntk( PLStream *pls ) { create_canvas( pls ); } void plD_tidy_ntk( PLStream *pls ) { if ( !pls->nopause ) waitforpage( pls ); tk_cmd( "destroy $plf; wm withdraw ." ); } void plD_state_ntk( PLStream *pls, PLINT op ) { switch ( op ) { case PLSTATE_COLOR0: case PLSTATE_COLOR1: flushbuffer( pls ); sprintf( curcolor, "#%02x%02x%02x", pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ); break; } } static void getcursor( PLStream * PL_UNUSED( pls ), PLGraphicsIn *ptr ) { int st = 0; plGinInit( &gin ); if ( 0 ) { while ( st != 1 ) { tk_cmd( "update" ); tk_cmd( "winfo exists $plf.f2.c$ccanv" ); sscanf( Tcl_GetStringResult( interp ), "%d", &st ); } st = 0; // this give a "Segmentation fault", even after checking for the canvas! tk_cmd( "set ocursor [lindex [$plf.f2.c$ccanv configure -cursor] 4]" ); } tk_cmd( "$plf.f2.c$ccanv configure -cursor cross;\n" "bind $plf.f2.c$ccanv