Home

PGPLOT Graphics Subroutine Library

image

Contents

1. Plot syrrbols at selected points cpgpt 9 xs ys 18 Close the graphics device cpgclos return O More complex graphs supported by PGPLOT include e Scatter plots PGPLOT Scotter plet e Function plots PGPLOT Functene Bessel Functions e Contour maps PGPLOT Contour map e Images PGPLOT image pixel array e Histograms PGPLOT Hlatograrne 100 80 60 40 20 All these graphs are also available in a single PostScript file 3 pages Further examples can be found in the directory pgplot examples distributed with PGPLOT PGPLOT TimPearson California Institute of Technology tjp stro caltech edu Copyright 1997 California Institute of T echnology PGPLOT Version 5 0 All changes are intended to be backwards compati ble i e existing programs should run correctly when recompiled and recompilation should not be necessary Sorre programs may give slightly different results owing to the bug fixes described bel ow New install ation procedure The installation procedure for UNIX systems has changed substantially to allow autorratic generation of the makefile and the device dispatch routine grexec f New C binding This release of PGPLOT includes an experimental C binding for calling PGPLOT fromC progrars It consists of two files a header file cpgplot h that should be included in C programs that call PGPLOT and a system dependent wrapper library that
2. RANLIB ranlib PGPLOT_LIB L pwa I pgplot CPGPLOT_LIB L pwad Icpgplot I pgpl ot T his was contributed by David Billinghurst David Billinghurst riotinto comau who writes To date have only used PSDRIV T here is a problemmaking li bpgplot a suspect a gnuwin32 bug T o work around it edit the makefile generated by makerake Change libpgplot a PG_ ROUTINES PG_NON_ST ANDARD GR_ROUT INES DISPAT CH_ROUT INE DRIVERS SYST EM ROUTINES ar ru libpgplot a Is PG_ROUTINES PG_NON_ST ANDARD GR_ROUT INES DISPAT CH_ROUT INE DRIVERS SYSTEM_ROUTINES sort uniq RANLIB libpgplot a to libpgplot a PG_ ROUTINES PG_NON_ST ANDARD GR_ROUT INES DISPAT CH_ROUT INE DRIVERS SYST EM ROUTINES ar ru libpgplot a RANLIB libpgplot a PGPLOT T imPearson California Institute of Technology tipo stro caltech edu Copyright 1997 California Institute of Technology PGPLOT Annotated List of Routines Version 5 2 Many of the routines that set the values of parameters used by PGPLOT have corresponding inquiry routines that can be used to determine the current parameter values Most of these routines have names starting PGQ and are indicated in italics Opening Closing and Selecting Devices Use PGOPEN to open a graphical device or file and select it for PGPLOT output PGCL OS to close the device when graphical output is completed and PGSLCT to switch su
3. The GIF specification incorporates the L erpel Zev Welch L ZW compression algorithmwhich is the subject of a patent awarded to Unisys Use of this technology and in particular creation of GIF forrrat files using this PGPLOT device driver may require a license fromUnisys Device type code GIF landscape orientation V GIF portrait orientation Default file name pgpl ot gif A GIF file can contain only a single image so for multi page plots PGPLOT creates additional files If the supplied file nan contains the character the file narre is derived by replacing this character with the current page number If the supplied file nan does not contain a PGPLOT appends an underscore and the page number for the second and subsequent pages e g PGBEG filename File nan s used pgp ot gif pgplotl gif pgplot2 gif pgplot3 gif pgpl ot gif pgplot gif pgplot gif_2 pgplot gif_3 If the supplied file name is the output is sent to the standard output stream so that it can for example be piped into a viewing program T his will only work for single page plots Default view surface dimensions GIF 850 by 680 pixels nominally 10 0 by 8 0 inches VGIF 680 by 850 pixels nominally 8 0 by 10 0 inches T hese defaults can be overridden by specifying environment variables or by calling routine PGPAP T he maxinmumsize is limited only by available merory Resolution PGPLOT assun s that the device resolution is 85 pix
4. DATA YS 1 4 9 16 25 IER PGBEG 0 1 1 IF IER NE 1 STOP CALL PGENV 0 10 0 20 0 1 CALL PGLAB x y A Simple Graph CALL PGPT 5 XS YS 9 DO 10 1 60 XR I 0 1 I Y R I XR 1 2 10 CONT INUE CALL PGLINE 60 XR YR CALL PGEND END T he following sections of this chapter describe how the programworks and the resulting plot is shown in Figure 2 1 2 3 Data Initialization We shall store the x and y coordinates of the five data points in arrays XS and YS For convenience this programdefines the values in DAT A statements but a more realistic program might read themfroma file Arrays XR and YR will be used later in the programfor the theoretical curve REAL XR 100 Y R 100 REAL XS 5 Y S 5 DATA XS 1 2 3 4 5 DATA YS 1 4 9 16 25 2 4 Starting PGPLOT T he first thing the programrust do is to start up PGPLOT and select the graphics device for output INT EGER PGBEG IER PGBEG 0 1 1 IF IER NE 1 ST OP Note that PGBEG is a Fortran function not a subroutine and must be declared INT EGER It has four arguments and returns an integer code which will have value 1 if the device was opened successfully e hefirst argument is present for historical reasons It should always be set to zero 0 e T he second argument is a character string which gives a device specification for the interactive graphics device or disk file for hardcopy graphics see Chapter 1 and Appendix D
5. INT EGER FUNCT ION PGCURSE X Y CH REAL X Y CHARACT ER 1 CH See description of PGCURS PGLABEL non standard alias for PGLAB SUBROUTINE PGLABEL XLBL YLBL TOPLBL CHARACT ER XLBL YLBL TOPLBL See description of PGLAB PGMT EXT non standard alias for PGMT XT SUBROUTINE PGMT EXT SIDE DISP COORD FJ UST T EXT CHARACT ER SIDE TEXT REAL DISP COORD FJ UST See description of PGMT XT PGNCURSE non standard alias for PGNCUR SUBROUTINE PGNCURSE MAXPT NPT X Y SYMBOL INT EGER MAXPT NPT REAL X Y INT EGER SYMBOL See description of PGNCUR PGPAPER non standard alias for PGPAP SUBROUTINE PGPAPER WIDTH ASPECT REAL WIDTH ASPECT See description of PGPAP PGPOINT non standard alias for PGPT SUBROUTINE PGPOINT N XPTS YPTS SYMBOL INTEGERN REAL XPT S YPT S INT EGER SYMBOL See description of PGPT PGPTEXT non standard alias for PGPT XT SUBROUTINE PGPT EXT X Y ANGLE FJ UST TEXT REAL X Y ANGLE FJ UST CHARACT ER TEXT See description of PGPT XT PGVPORT non standard alias for PGSV P SUBROUTINE PGVPORT XLEFT XRIGHT YBOT YT OP REAL XLEFT XRIGHT YBOT YT OP See description of PGSVP PGV SIZE non standard alias for PGV SIZ SUBROUTINE PGVSIZE XLEFT XRIGHT YBOT YT OP REAL XLEFT XRIGHT YBOT YT OP See description of PGV SIZ PGV ST AND non standard alias for PGV ST D SUBROUTINE PGVST AND See descri
6. PGPLOT Graphics Subroutine L ibrary Contents e Contents e Introduction e Exar Y pl es e Copyright e Status e Obtaining PGPLOT e Documentation o User s manual draft o Annotated list of subroutines o Subroutine synopses o Known problems in PGPLOT version 5 2 o Wish list for future improvements o Some frequently asked questions e CallingPGPLOT fromother languages e Interactive drawing programs and other PGPLOT extensions e Reporting problems New Web Addresses T he web address for PGPLOT changed in October 2000 T he new web address is http www astro caltech edu tj p pgpl ot and the ftp address for downloading PGPLOT is ftp ftp astro caltech edu pub pgpl ot pgpl ot5 2 tar gz Introduction The PGPLOT Graphics Subroutine Library is a Fortran or C callable device independent graphics package for making simple scientific graphs It is intended for making graphical images of publication quality with minimumeffort on the part of the user For most applications the program can be device independent and the output can be directed to the appropriate device at run ti n The PGPLOT library consists of two major parts a device independent part and a set of device dependent device handler subroutines for output on various terminals image displays dot matrix printers laser printers and pen plotters Common file formats supported include PostScript and GIF PGPLOT itself is written mo
7. X1 Y 1 input world coordinates of one endpoint of the axis X2 Y 2 input world coordinates of the other endpoint of the axis V input draw the tick mark at fraction V 0 lt V lt 1 along the line from X1 Y 1 to X2 Y 2 TIKL input length of tick nerk drawn to left of axis as seen looking fromfirst endpoint to second in units of the character height TIKR input length of major tick marks drawn to right of axis in units of the character height DISP input displacement of label text to right of axis in units of the character height ORIENT input orientation of label text in degrees angle between baseline of text and direction of axis 0 360 STR input text of label may be blank PGUPDT update display void cpgupdt void SUBROUTINE PGUPDT Update the graphics display flush any pending commands to the output device T his routine empties the buffer created by PGBBUF but it does not alter the PGBBUF PGEBUF counter T he routine should be called when it is essential that the display be completely up to date before interaction with the user for example but it is not known if output is being buffered Argurrents none PGVECT vector nep of a 2D data array with blanking void cpgvect const float a const float b int idim int jdim intil int i2 int j1 int j2 float c int nc const float tr float blank SUBROUTINE PGVECT A B IDIM J DIM 11 12 1 J2 C NC
8. e WIP by J ames Morgan WIP is an interactive package with a simple to use interface desi gned to produce high quality graphical output WIP was developed as part of the Berkeley IIlinois Maryland Association BIMA project F or further information see the WWW page http bi ma astro und edu bi me wi p wip htm Reporting problems If you have questions about PGPLOT please send themto T imPearson preferably by e mail to tjp _astro caltech edu or by FAX to 1 626 568 9352 If you have a problemwith installation please include information about your operating systemversion Fortran and C compilers and the version of PGPLOT you are trying to install If you think you have found a bug in PGPLOT a simpletest programin F ortran or C that derronstrates the problemis very helpful maintain a mailing list for announcements about PGPL OT and I will add your narre to the list if you send me your e mail address TimPearson California Institute of Technology tjp _astro caltech edu Copyright 1995 2002 California Institute of Technology PROGRAM SIMPLE INT EGER I IER PGBEG REAL XR 100 Y R 100 REAL XS 5 YS 5 DATA XS 1 2 3 4 5 DATA YS 1 4 9 16 25 IER PGBEG 0 1 1 IF IER NE 1 ST OP CALL PGENV 0 10 0 20 0 1 CALL PGLAB x y A Simple Graph CALL PGPT 5 XS YS 9 DO 101 1 60 XR I 0 1 1 Y Ril XR I1 2 10 CONT INUE CALL PGLINE 60 XR Y R CALL PGEND END 255 250 250 snow
9. yscrollcommand prefix This is the Y axis equivalent of the xscrollconmand configuration option mincolors T his specifies the srrallest acceptable number of colors before a widget switches to monochrorre T he default is 2 If fewer colors than this number are available a black and white colormap will be adopted and grey scale images will be dithered T his option is only consulted when a widget is created Changes made thereafter using the configure command will be ignored maxcolors T his specifies the nurrber of colors that the widget will attempt to allocate for itself T he default is 100 On computers with 8 bit frame buffers colors are a scarce resource so be sure to set this number as low as possible F or example if you don t intend to use cpgimag or coggray to draw images then the default of 100 colors is likely to be much nore than you need In this case setting maxcolors to 16 will give access to all 16 of PGPLOT s pre defined line colors while reducing the likelihood that either your application or somebody else s will run out of colors This is especially important if you intend to use nore than one PGPLOT widget within your application T his option is only consulted when a widget is created Changes made thereafter using the configure command will be ignored Other widget commands After aPGPLOT widget has been created the following commands can be applied to that widget using the normal T k syntax of widget_
10. 0 0128 navy blue O 0128 NavyBlue 100 149 237 cornflower blue 100 149 237 CornflowerBlue 72 61139 dark slate blue 72 61 139 DarkSlateBlue 106 90 205 slate blue 106 90 205 SlateBlue 123 104 238 mediumslate blue 123 104 238 M ediun6lateBlue 132 112 255 light slate blue 132 112 255 LightSlateBlue 0 0205 mediumblue 0 0205 MediunBlue 65 105 225 royal blue 65 105 225 RoyalBlue 0 0255 blue 30 144 255 dodger blue 30 144 255 DodgerBlue 0 191 255 deep sky blue 0 191 255 DeepSkyBlue 135 206 235 sky blue 135 206 235 SkyBlue 135 206 250 light sky blue 135 206 250 LightSkyBlue 70 130 180 steel blue 70 130 180 Steel Blue 176 196 222 light steel bl ue 176 196 222 LightStee Bl ue 173 216 230 light blue 173 216 230 LightBl ue 176 224 230 powder blue 176 224 230 PowderBlue 175 238 238 pale turquoise 175 238 238 PaleT urquoise 0 206 209 dark turquoise 0 206 209 DarkT urquoise 72 209 204 mediumturquoise 72 209 204 M edi unf urquoise 64 224 208 turquoise 0 255 255 cyan 224 255 255 light cyan 224 255 255 LightCyan 95 158 160 cadet blue 95 158 160 CadetBlue 102 205 170 medi umaquarrerine 102 205 170 M edi umA quarerine 127 255 212 aquarrarine 0100 Odark green 0100 ODarkGreen 85 107 47 dark olive green 85 107 47 DarkOliveGreen 143 188 143 dark sea green 143 188 143 DarkSeaGreen 46 139 87 sea green 46 139 87 SeaGreen 60 179 113 mediumsea green 60 179 113 MediunfeaGreen 32 178 170 light sea green 32 178 170 LightSeaGreen 152 251 152 pale green 15
11. 1 A complete device specification of the form device type or file type where type is one of the allowed PGPLOT device types instal lation dependent and device or file is the nan of a graphics device or disk file appropriate for this type T he device or file may contain characters the final delimits the type If necessary to avoid ambiguity the device part of the string may be enclosed in double quotation marks 2 A device specification of the form type where type is one of the allowed PGPLOT devicetypes PGPLOT supplies a default file or device narre appropriate for this device type 3 A device specification with type omitted in this case the type is taken fromthe environment variable PGPLOT_TYPE if defined e g setenv PGPLOT_TYPE PS Because of possible confusion with in file names omitting the device type in this way is not recommended 4 A blank string in this case PGOPEN will use the value of environment variable PGPLOT _ DEV as the device specification or NULL if the environment variable is undefined 5 A single question mark with optional trailing spaces in this case PGPLOT will prompt the user to supply the device specification with a prompt string of the form Graphics device type to see list default XXX where XXX is the default value of environment variable PGPLOT DEV 6 A non blank string in which the first chara
12. PGET XT erase text fromgraphics display PGIDEN write usernarre date and time at bottomof plot PGPLOT T imPearson California Institute of Technology tip stro caltech edu Copyright 1997 California Institute of Technology Known Problems in PGPL OT Version 5 2 0 General Problems e ext Thereis no way to display a subscript of a superscript or a superscript of a subscript T his is due to a design flaw in PGPLOT I don t think there is any way that can fix this problemwith the current escape codes u and d there is no way to distinguish a d meaning end of superscri pt froma d meaning start of subscri pt of superscript will try to address this in a future version of PGPLOT if can think of a way of doing so while retaining backwards compatibility think that will have to introduce new bracketting delimiters like HT ML lt Sup gt lt sup gt and lt sub gt lt sub gt or T eX s and_ e Thereis no printed manual yet e CPGPLOT C binding o Routines that require the narre of a subroutine as an argument PGCONX PGFUNX PGF UNY PGFUNT etc are not handled by the C binding o CPGPLOT requires an ANSI C compiler Problems with Specific Subroutines e PGBIN the first and last bins in CENT ER node or the last bin in non center mode are plotted incorrectly a redesign is needed because the argurrents to PGBIN don t provide enough information to do the job e PGBOX and PGENV if th
13. PGMT XT write text at position relative to viewport PGNCUR merk a set of points using the cursor PGNUMB convert a number into a plottable character string PGOLIN mark aset of points using the cursor PGOPEN open a graphics device PGPAGE advance to new page PGPANL switch to a different panel on the view surface PGPAP change the size of the view surface PGPIXL draw pixels PGPNT S draw several graph rrarkers not all the same PGPOLY draw apolygon using fill area attributes PGPT draw several graph markers PGPT 1 draw one graph marker PGPT XT write text at arbitrary position and angle PGQAH inquire arrow head style PGQCF inquire character font PGQCH inquire character height PGQCI inquire color index PGQCIR inquire color index range PGQCLP inquire clipping status PGQCOL inquire color capability PGQCR inquire color representation PGQCS inquire character hei ght in a variety of units PGQDT inquire nan of nth available device type PGQFS inquire fill area style PGQHS inquire hatching style PGQID inquire current device identifier PGQINF inquire PGPLOT general information PGQITF inquire image transfer function PGQLS inquire line style PGQL W inquire line width PGQNDT inquire nunber of available device types PGQPOS inquire current pen position PGQT BG inquire text background color index PGQT XT find bounding box of text string
14. T his programrrakes use of a special shorthand feature of PGPL OT however if this argurrent is set to the programwill ask the user to supply the device specification at run time e helast two argurents are described in Section 3 2 Usually they are both set to 1 asin this example 2 5 Defining Plot Scales and Drawing Axes Subroutine PGENV starts a new picture and defines the range of variables and the scale of the plot PGENV also draws and labels the enclosing box and the axes if requested In this case the x axis of the plot will run from0 0 to 10 0 and the y axis will run from0 0 to 20 0 CALL PGENV 0 10 0 20 0 1 PGENV has six argurrents e theleft and right limits for the x horizontal axis real numbers not integers e thebottomand top limits for the y vertical axis also real numbers e Aninteger argurrent if this is 1 the scales of the x axis and y axis in units per inch will be equal otherwise the axes will be scaled independently In this case we have not requested equal scales e Another integer argument that controls whether an enclosing box tick marks nurreric labels and or a grid will be put on the graph T he recommended value is 0 Sore of the allowed values are 2 no annotation 1 draw box only 0 draw box and label it with coordinate values around the edge 1 in addition to the box and labels draw the two axes lines x 0 y 0 with tick marks 2 in addition to the box labels and
15. V GIF or son of the other printers cd usr local pgpl ot cp usr local src pgpl ot drivers list vi drivers list or use your preferred editor Note If you select either the Motif widget driver XM DRIV or the T k T cl widget driver T KDRIV the installation procedure will install additional files and demonstration programs Do not select these drivers unless you are planning to develop prograns that will use them F or further information see the appropriate documentation e XMDRIV e TKDRIV Create the makefile The PGPLOT installation procedure for UNIX uses a script called makerrake to generate a standard UNIX makefile for your operating system corrpilers and list of selected PGPLOT device drivers Operating systemand compiler information is obtained froma configuration file Configuration files are available for the following systers If your configuration is not one of those listed or if you have trouble using the generated makefile see bel ow for information about creating your own configuration file Note that the configuration files are for particular compilers on particular operating systens If for example you have set up your systemso that the command f77 invokes the GNU g77 compiler then you cannot use a configuration file designed for say aSPARC f77 compiler Y ou will have to create a special configuration file In the following table Arg 2 is a code for the operating system and Arg 3 is a code for the
16. text void coggah int fs float angle float barb void cpgacf int font void cpgqch float size void cpgaci int ci void cpgacir int icilo int icihi void cpgacl plint state void cpgqcol int ci1 int ci2 void cpggcr int ci float cr float cg float cb void cpgaqcs int units float xch float ych void cpggqat int n char type int type_length char descr int descr_length int inter void cpgafs int fs void cpgghs float angle float sepn float phase void cpgqi d int id void cpgqinf const char item char value int value_length void cpgqitf int itf void cpgal s int Is void cpgql w int Iw void cpgqndt int n void cpgqpos fl oat x float y void cpgaqtba int tbci void cpggtxt float x float y float angle float fj ust const char text float xbox float ybox void cpgqvp int units float x1 float x2 float y1 float y2 void cpgqvsz int units float x1 float x2 float y1 float y2 void cpgqwin float x1 float x2 float y1 float y2 void cpgrect float x1 float x2 float y1 float y2 float cpgrnd float x int nsub void cpgrnge float x1 float x2 float xlo float xhi void cpgsah int fs float angle float barb void cpgsave void void cpgunsa void void cpgscf int font void cpgsch float size void cpgsci int ci void cpgscir int icilo int icihi void cpgscl p int state void cpgscr int ci float cr float cg float cb void cpgscrl float dx f
17. 1 the curve is plotted inthe current window and viewport if PGF LAG O PGENV is called autorratically by PGF UNT to start a new plot with autorratic scaling Note T he functions F X and FY must be declared EXTERNAL inthe Fortran programunit that calls PGF UNT PGF UNX function defined by Y F X SUBROUTINE PGFUNX FY N XMIN XMAX PGFLAG REAL FY EXTERNAL FY INTEGERN REAL XMIN XMAX INT EGER PGFLAG Draw a curve defined by the equation Y F Y X where FY isa user supplied subroutine Argurrents FY external real function supplied by the user evaluates Y value at a given X coordinate N input the number of points required to define the curve T he function FY will be called N 1 times If PGF LAG 0 and N is greater than 1000 1000 will be used instead If N is less than 1 nothing will be drawn XMIN input the minimumvalue of X XMAX input the maximumvalue of X PGFLAG input if PGFLAG 1 the curve is plotted inthe current window and viewport if PGF LAG O PGENV is called autorratically by PGF UNX to start a new plot with X limits XMIN XMAX and autorretic scalinginY Note T he function FY must be declared EXTERNAL inthe Fortran programunit that calls PGF UNX It has one argurrent the x coordinate at which the y value is required e g REAL FUNCTION FY XxX REAL X PGF UNY function defined by X F Y SUBROUTINE PGFUNY FX N YMIN YMAX PGFLAG REAL FX EXTERNAL FX IN
18. BRIGHT input The brightness of the color ramp T his is normally 0 5 but can sensibly hold any value between 0 0 and 1 0 Values at or beyond the latter two extremes saturate the color ramp with the colors of the respective end of the color table PGCURS read cursor position int cpgcurs float x float y char ch_ scalar INT EGER FUNCT ION PGCURS X Y CH REAL X Y CHARACT ER CH Read the cursor position and a character typed by the user T he position is returned in world coordinates PGCURS positions the cursor at the position specified allows the user to move the cursor using the joystick or arrow keys or whatever is available on the device When he has positioned the cursor the user types a single character on the keyboard PGCURS then returns this character and the new cursor position in world coordinates Returns PGCURS Lif the call was successful O if the device has no cursor or sore other error occurs Argurrents X in out the world x coordinate of the cursor Y in out the world y coordinate of the cursor CH output the character typed by the user if the device has no cursor or if sorre other error occurs the value CHAR 0 ASCII NUL character is returned Note T he cursor coordinates X Y may be changed by PGCURS even if the device has no cursor or if the user does not move the cursor Under these circumstances the position returned in X Y is that of the pixel nearest to
19. XMAX YMIN YMAX INT EGER J UST AXIS Set PGPLOT Plotter Environment PGENV establishes the scaling for subsequent calls to PGPT PGLINE etc T he plotter is advanced to a new page or panel clearing the screen if necessary If the prompt state is ON see PGASK confirmation is requested fromthe user before clearing the screen If requested a box axes labels etc are drawn according to the setting of argument AXIS Argurrents XMIN_ input the world x coordinate at the bottomleft corner of the viewport XMAX input the world x coordinate at the top right corner of the viewport note XMAX may be less than XMIN YMIN_ input the world y coordinate at the bottom eft corner of the viewport YMAX input the world y coordinate at the top right corner of the viewport note Y MAX may be less than Y MIN JUST input if J UST 1 the scales of the x and y axes in world coordinates per inch will be equal otherwise they will be scaled independently AXIS input controls the plotting of axes tick marks etc AXIS 2 draw no box axes or labels AXIS 1 draw box only AXIS 0 draw box and label it with coordinates AXIS 1 sane as AXIS 0 but also draw the coordinate axes X 0 Y 0 AXIS 2 same as AXIS 1 but also draw grid lines at major increments of the coordinates AXIS 10 draw box and label X axis logarithmically AXIS 20 draw box and label Y axis logarithmically AXIS 30 draw box and la
20. aaaread me new file Includes sore notes on incompatibilities between versions of Motif C compiler and VMS grlgtr f T his has been rewritten it now treats logical names as case insensitive and uses T RNLNM instead of obsolete T RNL OG makedoc com new file A DCL command procedure to extract the docurrentation fromthe source code TimPearson California Institute of T echnology tjo stro caltech edu Copyright 1996 California Institute of Technology PGPLOT version 5 2 1 T his version is a maintenance release It introduces no new subroutines or functionality T ested Systems Version 5 2 1 has been tested on the following systerrs e Solaris 2 5 1 SunOS 5 5 1 GNU Fortran g77 and C gcc 2 8 1 Sol2 g77_ gcc tested on SPARC Ultra 1 device drivers CGDRIV GIDRIV GLDRIV NUDRIV PPDRIV PSDRIV TKDRIV TT DRIV WDDRIV XMDRIV XWDRIV Changes to configuration files and system support New systems sys_cygwin sysS_gnuwin32 sys_solx86 Modified systens See the appropriate pgplot sys_ aaaread me file for details of changes Many configuration files not listed here have been modified to correct errors and add new configuration variables SyS_aix Modified aaaread me xlf_cc conf added g77_gcc conf sys hp Added g77_gcc conf sys_linux Added f95_gcc conf and directory f95_ src fort77_gcc conf g77_elf conf g77_gcc_aout conf nag_gcc conf and directory nag_src sys_osfl Added g77_gcc conf sys_win Added gidriv f
21. are zero unless the coordinate transforrration involves a rotation or shear BLANK input elements of arrays A or B that are exactly equal to this value are ignored blanked PGV SIZ set viewport inches void cpgvsiz float xleft float xright float ybot float ytop SUBROUTINE PGVSIZ XLEFT XRIGHT YBOT YT OP REAL XLEFT XRIGHT YBOT YT OP Change the size and position of the viewport specifying the viewport in physical device coordinates inches The viewport is the rectangle on the view surface through which one views the graph All the PG routines which plot lines etc plot themwithin the viewport and lines are truncated at the edge of the viewport except for axes labels etc drawn with PGBOX or PGLAB T he region of world space the coordinate space of the graph which is visible through the viewport is specified by a call to PGSWIN It is legal to request a viewport larger than the view surface only the part which appears on the view surface will be plotted Argurrents XLEFT input x coordinate of left hand edge of viewport in inches fromleft edge of view surface XRIGHT input x coordinate of right hand edge of viewport in inches fromleft edge of view surface YBOT input y coordinate of bottomedge of viewport in inches frombottomof view surface YTOP input y coordinate of top edge of viewport in inches frombottomof view surface PGVST D set standard default viewport void cp
22. do not wish to do so unless there is a clear need None of the graphical operations in PGPLOT require double precision calculations to achieve the accuracy warranted by current graphics devices so it is mainly a matter of convenience for prograntrers who maintain their data in double precision for other reasons Sorre users have reported success using F ortran compiler qualifiers to cause REAL variables and constants to be compiled as double precision but note that you must also change sorre of the C support code and drivers Rotated coordinate systens Extend the world to device coordinate transforrration to allow rotation as well as scaling and translation T his would allow world coordinate axes that are not parallel to the edge of the viewport and would hence cause complications for routines like PGBOX that label the viewport in world coordinate space Positioning workstation windows Unfortunately there is no way fromwithinaPGPLOT programto control the location of PGPLOT X windows will consider adding a new subroutine to the API to specify this but there are sorre potential problems how should other devices not X window interpret this and sorre X window managers do not honor position requests Opaque syrrbols An option to make the graph symbols opaque so that underlying graphics do not show through e g a circle symbol would consist of a filled disk in the background color surrounded by a ring in the current color instead of just th
23. ending at x n Ly T he values should be valid integer color indices for the device passed as REAL numbers T he number of pixels is specified by the argument NBUF n NBUF 2 Case Q T his case is used for devices like PostScript where PGPLOT cannot address individual device pixels the handler or the device must map the image array onto hardware pixels taking care of clipping In this case the first call specifies the parameters of the image and subsequent calls pass color indices of image pixels and a final call indicates the end of the image Pararreters passed to handler on first call RBUF RBUF RBUF RBUF 0 0 indicates start of image 3 dimension of the image image pixels in x and y RBUF 7 the current clipping rectangle in device coordinates RBUF 13 a matrix used to transformimage coordinates to device coordinates 1 2 4 8 mn mnnm Pararreters passed to handler on first call e RBUF 1 number nof pixels inthis call gt 0 e RBUF 2 RBUF n 2 color indices for n pixels Pararreters passed to handler on last call e RBUF 1 1 0 OPCODE 27 Scaling information This function is only used if OPCODE 4 indicates a cursor of type X It is used to tell the device handler what the user s world coordinate systemis T he handler may ignore the information or it may use it to generate a read out of the cursor position in the world coordinate system Pararreters pa
24. include lt math h gt int main int i static float xs 1 0 2 0 3 0 4 0 5 0 static float ys 1 0 4 0 9 0 16 0 25 0 float xr 60 yr 60 int n sizeof xr sizeof xr 0 Call PGBEG to initiate PGPLOT and open the output device PGBEG will prompt the user to supply the device nan and type if cpgbeg 0 1 1 1 return EXIT_FAILURE Call PGENV to specify the range of the axes and to draw a box and PGLAB to label it T he x axis runs fromO to 10 and y from0 to 20 cpgenv 0 0 10 0 0 0 20 0 O 1 cpglab x y PGPLOT Example 1 y x u2 d Mark five points coordinates in arrays XS and Y S using symbol nurrber 9 cpgpt 5 xs ys 9 Compute the function at n 60 points and use PGLINE to draw it for i 0 i lt n i xr i 0 1 i yrli xr i Fxrfil cpgline n xr yr sk Finally call PGEND to terminate things properly a cpgend return EXIT SUCCESS A second example shows how a two dimensional FORT RAN array should be handled include cpgplot h include lt stdio h gt include lt stdlib h gt include lt math h gt int main static int nx 40 ny 40 inti j k lw ci Is float f 1600 frrin frrax alev double x y static float tr 6 0 0 1 0 0 0 0 0 0 0 1 0 printf Dermonstration of PGPLOT contouring routines n Compute a suitable function A C array is used
25. int iy1 int iy2 const float x int ioff float bias Logical center float ylims void cpghist int n const float data float datmin float datmax int nbin int pgflag void cpgiden void void cpgimag const float a int idim int jdim int il int i2 intj1 intj2 float al float a2 const float tr void cpglab const char xlbl const char ylbl const char topl bl void cpglcur int maxpt int npt float x float y void cpgldev void void cpglen int units const char string float xl float yl void cpgline int n const float xpts const float ypts void cogmove float x float y void cpgntxt const char side float disp float coord float fjust const char text void cogncur int maxpt int npt float x float y int symbol void cpgnumb int nm int pp int form char string int string_length void cpgolin int maxpt int npt float x float y int symbol int cpgopen const char device void cpgpage void void cpgpanl int nxc int nyc void cpgpap float width float aspect void Cpgpi xl const int ia int idim int jdim intil int i2 int j1 int j2 float x1 float x2 float y1 float y2 void cpgpnts int n const float x const float y const int symbol int ns void cpgpoly int n const float xpts const float ypts void cpgpt int n const float xpts const float ypts int symbol void cpgpt1 float xpt float ypt int symbol void cpgptxt float x float y float angle float fj ust const char
26. interpretation is up to the handler usually the string will be sent directly to the device or ignored Use of this function should be avoided Pararreters passed to handler e CHR L CHR character string OPCODE 24 Rectangle fill T his function is not used if OP CODE 4 indicates that the device does not support hardware rectangle fill Pararreters passed to handler e RBUF 1 RBUF 2 x y coordinates of lower left corner of rectangle e RBUF 3 RBUF 4 x y coordinates of upper right corner of rectangle OPCODE 25 Set fill pattern T his function is not yet implemented OPCODE 26 Line of pixels orlmage T his operation is used for gray scale and color imaging e g routine PGGRAY It is used in two different ways depending whether OP CODE 4 reports CHR 7 7 P or Q Case P T his function is used to write a horizontal line of pixels on the device screen with specified color indices it should be more efficient to do this with one device handler call rather than separate calls for each pixel If the device handler implements this operation it is important that the device coordinates should be true pixel numbers Pararreters passed to handler e RBUF 1 RBUF 2 x y coordinates of the first pixel to be written T hese should be integer pixel nurrbers in the device coordinate system passed as REAL numbers e RBUF 3 RBUF NBUF color indices for n pixels to be filled in starting at x y and
27. of direct access records frombytes to 4 byte words assurre byterecl T his option is set as follows P roject Settings F ortran tab Settings F or All Configurations Source files Gidriv f Category F ortran Data ver 5 check Use Bytes as Units for Unformatted F iles ver 6 Data Options check Use Bytes as RECL unit for Unformatted F iles T he remaining default compiler options are suitable in particular the Debug configuration is not optimized but the Release configuration uses full optimization If the choice of Release is not apparent use Build Set Active Configuration F romthe Build menu choose Build PGPLOT LIB Expect 7 Warning messages with ver 4 or 2 with vers 5 6 When both Debug and Release have successfully completed like to copy the Release version of the library so that subsequent applications can find it more easily ver 4 from x MSDEV PRO ECT S PGPLOT RELEASE to x MSDEV LIB ver 5 from x P rogram F iles DevStudio M yP rojects P GPL OT RELEASE to x ProgramF iles DevStudio DF LIB ver 6 fromx ProgramF iles Microsoft Visual Studio MyProjects P GPL OT RELEASE to x ProgramF iles Microsoft Visual Studio DF 98 L1B 6 Run the examples In the sarre Project Workspace use F ile New and the Projects tab or if using ver 4 Insert Project to create a QuickWin Application Name EXAMPLES T hen use Project Dependencies ver 4 Build Subproj ects to specify that PGPLOT is a subproject
28. on VAXstation 4000 90 New PGPLOT routines T he following routines are documented in the list of subroutines and will be explained more fully in the manual pgaxis Draw a linear or logarithmic axis more options will be added in later versions pgconf Shade area between two contours pgerr1 Draw a single error bar useful for systems which cannot pass a scalar to a routine that expects an array pgptl Draw a single graph marker useful for systems which cannot pass a scalar to a routine that expects an array pgsclp pgqclp Set query clipping status used by PGBOX and PGAXIS to ensure that axes are not clipped against the viewport pgadt pggqndt Inquiry routines used to determine the list of device types available ina PGPLOT installation useful for building menus etc pgscrl Scroll a rectangular region of the screen useful for making animated displays without redrawing the whole screen currently only supported on X Window and related devices pgtick Used by pgaxis to draw single labelled tick mark may be called directly e g for special non linear axes Modified PGPLOT routines Internal changes that do not affect the API are not listed Several routines have been modified to improve their descriptions or improve speed pgctab T he behavior of the argurrents brightness and contrast has been changed slightly T he color indices set by this routine will be slightly changed fromearlier versions of PGPLOT
29. subdivided in this way PGPAGE moves the plotter to the next panel and only clears the screen or loads a new piece of paper if there are no panels left on the current page In addition to selecting the view surface PGBEG also defines a default viewport and window It is good practice however to define the viewport and window explicitly as described below 3 3 Defining the Viewport A viewport is arectangular portion of the plotting surface onto which the graph is mapped PGPLOT has a default viewport which is centered on the plotting surface and leaves sufficient space around it for annotation T he application programcan redefine the viewport by calling routine PGSVP or PGVSIZ PGSVP defines the viewport in a device independent manner using a coordinate system whose coordinates run from0 to 1in both x and y T his coordinate systemis called normalized device coordinate space F or example if we wish to divide the view surface into four quadrants and map a different plot onto each quadrant we can define a new viewport before starting each plot PGSVP has the fornet CALL PGSVP XMIN XMAX YMIN YMAX F or example to map the viewport onto the upper left quadrant of the view surface CALL PGSVP 0 0 0 5 0 5 1 0 Note that this does not leave roomaround the edge of the viewport for annotation PGV SIZ defines the viewport in absol ute coordinates inches it should only be used when it is known how big the view surface is and a def
30. wrapper to the generated cpgplot h file Added support for const qualified declarations in the function prototypes pgpl ot drivers gidriv f ppdriv f psdriv f ttdriv wddriv f x2driv c Modified to prevent concurrent access gidriv f ppdriv f psdriv f wddriv f On sone systems the decoding of environment variables PGPLOT_xx_WIDTH HEIGHT failed owing to a bad F ortran fornet Rewritten to avoid this problem nudriv f Modified to allow concurrent access up to 8 devices xndriv c pgxwin c pgxwin h New files PGPLOT driver for Motif applications fromMartin Shepherd xwdri v C Fix bug in handling query color representati on pgxwin_server c Fix bug 256 colors allowed not 255 popl ot drivers old New directory several obsolete drivers and associated drivers ist have been moved from pgplot drivers into this directory T hese drivers should not be used contact T imPearson if you still have a need for any of them pgpl ot drivers xrmotif New directory support routines and example programfor Motif applications pgpl ot exampl es Sore of the example programs have been modified to use PGOPEN PGCL OS instead of PGBEG PGEND pgdenv1 f Changed the pseudo random nunber generator to avoid integer overflows pgdero6 f key now cycles between cursor modes rubber band cross hair etc pgden13 f New program Derronstration of two open devices pgdernv14 f New program T his programdermonstrates a method of coding a user interface i
31. 0 30 R 0 59 G 0 11 B asin US color television systes NT SC encoding Note that most devices do not have an infinite range of colors or monochrorre intensities available the nearest available color is used Examples for black set CR CG CB 0 0 for white set CR CG CB 1 0 for mediumgray set CR CG CB 0 5 for mediumyellow set CR CG 0 5 CB 0 0 Argument CI input the color index to be defined in the range O rex If the color index greater than the device maximumis specified the call is ignored Color index 0 applies to the background color CR input red green and blue intensities CG input in range 0 0to 1 0 CB input PGSCRL scroll window void cpgscrl float dx float dy SUBROUTINE PGSCRL DX DY REAL DX DY T his routine moves the window in world coordinate space while leaving the viewport unchanged On devices that have the capability the pixels within the viewport are scrolled horizontally vertically or both in such a way that graphics previously drawn in the window are shifted so that their world coordinates are unchanged If the old window coordinate range was X1 X2 Y 1 Y 2 the new coordinate range will be approximately X1 DX X2 DX Y1 DY Y 2 DY T he size and scale of the window are unchanged T hee window can only be shifted by a whole nurber of pixels device coordinates If DX and DY do not correspond to integral numbers of pixels the shift will be slightly different fromtha
32. 0 Sore progrars including GhostV iew for Windows apparently have problems if a multi page file has an EPSF header If necessary change the first line of the PostScript file to read P S A dobe 3 0 Sore users have reported that the CUPS printing system on Linux prints all pages superimposed on a single page unless this change is made T his sounds like a bug in CUPS or in the configuration files Other versions of CUPS e g in MacOS X do not have this problem For more information about PGPL OT PS files see the manual Changing the Background Color amusing PGPL OT to plot stuff on an X Window rrachine T he color scherre by default is white on a black background was able to change the color of the irrage using PGSCI but how does on control the color of the background T he background is color index 0 You can change what color it is by using PGSCR or PGSCRN Y ou can also change background and foreground color indices 0 and 1 with environment variables at run time e g to draw in black on white instead of white on black setenv PGPLOT_ BACKGROUND white setenv PGPLOT__BACKGROUND black although a call to PGSCR or PGSCRN in the programwill override these License requirements for GIF T he drivers list file indicates that using the GIF driver may require a license from Unisys Do you have any further information on the licensing requirements cannot give you an authoritative statement on this T he furore seers to ha
33. 12 0 5 J 2 0 5 Arguments A input the array to be plotted IDIM input the first dimension of array A J DIM input the second dimension of array A 11 12 input the inclusive range of the first index 1 to be plotted J 1 J 2 input the inclusive range of the second index J to be plotted Al input the array value which is to appear with shade C1 A2 input the array value which is to appear with shade C2 TR input transformation matrix between array grid and world coordinates PGLAB write labels for x axis y axis and top of plot void cpglab const char xI bl const char ylbl const char topl bl SUBROUTINE PGLAB XLBL YLBL TOPLBL CHARACT ER XLBL YLBL TOPLBL Write labels outside the viewport T his routine is a simple interface to PGMT XT which should be used if PGLAB is inadequate Argurrents XLBL input alabel for the x axis centered below the viewport YLBL input a label for the y axis centered to the left of the viewport drawn vertically TOPLBL input a label for the entire plot centered above the viewport PGL CUR draw a line using the cursor void cpglcur int maxpt int npt float x float y SUBROUTINE PGLCUR MAXPT NPT X Y INT EGER MAXPT NPT REAL X Y Interactive routine for user to enter a polyline by use of the cursor Routine allows user to Add and Delete vertices vertices are joined by straight line segments Argurr
34. 180 LightY ellow3 139 139 122 LightY ellow4 255 255 0 yellowl 238 238 0 yellow2 205 205 Oyellow3 139139 Oyellow4 255 215 Ogold1 238201 Ogold2 205173 Ogold3 139117 Ogold4 255 193 37 goldenrod1 238 180 34 goldenrod2 205 155 29 goldenrod3 139 105 20 goldenrod4 255 185 15 DarkGoldenrod1 238 173 14 DarkGoldenrod2 205 149 12 DarkGoldenrod3 139 101 8 DarkGoldenrod4 255 193 193 RosyBrown1 238 180 180 RosyBrown2 205 155 155 RosyBrown3 139 105 105 RosyBrown4 255 106 106 IndianRed1 238 99 99 IndianRed2 205 85 85 IndianRed3 139 58 58 IndianRed4 255 130 71 siennal 238 121 66 sienna2 205 104 57 sienna3 139 71 38 sienna4 255 211 155 burl ywood1 238 197 145 burl ywood2 205 170 125 burl ywood3 139 115 85 burl ywood4 255 231 186 wheat1 238 216 174 wheat2 205 186 150 wheat3 139 126 102 wheat4 255 165 79 tan1 238 154 73 tan2 205 133 63 tan3 139 90 43 tan4 255 127 36 chocolatel 238 118 33 chocolate2 205 102 29 chocolate3 139 69 19 chocolate4 255 48 48 firebrickl 238 44 44firebrick2 205 38 38 firebrick3 139 26 26 firebrick4 255 64 64 brownl 238 59 59 brown2 205 51 51 brown3 139 35 35 brown4 255 140 105 salmon1 238 130 98 salmon2 205 112 84 salrron3 139 76 57 salrmmon4 255 160 122 LightSalrmon1 238 149 114 LightSalmon2 205 129 98 LightSalrmon3 139 87 66LightSalmon4 255165 Oorangel 238 154 O orange2 205 133 Oorange3 139 90 Oorange4 255127 ODarkOrangel 238118 0 DarkOrange2 205 102 0 DarkOrange3 139 69 0 DarkOrange4 255 114 86 corall1 238 106 80coral2 205 91 69coral3 139 62 47 c
35. 248 248 255 ghost white 248 248 255 GhostWhite 245 245 245 white smoke 245 245 245 WhiteSmoke 220 220 220 gainsboro 255 250 240 floral white 255 250 240 F loralWhite 253 245 230 old lace 253 245 230 OldL ace 250 240 230 linen 250 235 215 antique white 250 235 215 AntiqueWhite 255 239 213 papaya whip 255 239 213 PapayaWhip 255 235 205 blanched almond 255 235 205 BlanchedA mond 255 228 196 bisque 255 218 185 peach puff 255 218 185 PeachP uff 255 222 173 navajo white 255 222 173 NavajoWhite 255 228 181 moccasin 255 248 220 cornsilk 255 255 240 ivory 255 250 205 lemon chiffon 255 250 205 L emonChiffon 255 245 238 seashell 240 255 240 honeydew 245 255 250 mint cream 245 255 250 MintCream 240 255 255 azure 240 248 255 alice blue 240 248 255 AliceBlue 230 230 250 lavender 255 240 245 lavender blush 255 240 245 L avenderBl ush 255 228 225 misty rose 255 228 225 MistyRose 255 255 255 white O O Oblack 47 79 79 dark slate gray 47 79 79 DarkSlateGray 47 79 79 dark slate grey 47 79 79 DarkSlateGrey 105 105 105 dimgray 105 105 105 DimGray 105 105 105 dim grey 105 105 105 DimGrey 112 128 144 slate gray 112 128 144 SlateGray 112 128 144 slate grey 112 128 144 SlateGrey 119 136 153 light slate gray 119 136 153 LightSlateGray 119 136 153 light slate grey 119 136 153 LightSlateGrey 190 190 190 gray 190 190 190 grey 211 211 211 light grey 211 211 211 LightGrey 211 211 211 light gray 211 211 211 LightGray 25 25 112 midnight blue 25 25 112 MidnightBlue 0 0128 navy
36. 6 00 inches Resolution Depends on which version of the driver is chosen via the logical name PGPLOT_LJ MODE Driver Equivalence Resolution LJ09 PLBS 100 DPI Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Input capability None T o choose one of the specific Laser et drivers you must execute a DCL command of the following form before executing your program DEFINE PGPLOT_LJ_ MODE LJ nn where nn is a number 01 09 NDEV inclusive Y ou may also use one of the equivalent nares listed above T hese equivalent names are an atterpt to make the driver names make sense T hey are decoded as follows 1st character P for protrait orientation or L for landscape orientation 2nd character H for high resolution 300 dpi or M for medium resolution 150 dpi or L for low resolution 100 dpi 3rd character B for a straight bitrrap dump or O for an opti mized bitrrap dump 4th character R for a rectangular view surface or S for a square view surface A few notes are in order First not all of the possible combinations above are supported currently T he driver that goes by the narre of PHOT is a driver that puts out bitmaps suitable for inclusion in T eX output if you are using the Arbortext DVIHP program T he only drivers that will work with unexpanded L aser et are LJ 08 and LJ 09 T he other seven drivers require a Laser et Plus or Laser et II Finally do NO
37. 7 00 60 0 00 1 00 7 00 0 00 1 00 0 50 0 00 0 50 7 00 0 50 0 00 7 90 1 00 0 00 0 50 20 88 0 55 O30 gt O 8Y O67 O67 EEL STU PGPLOT TimPearson California Institute of Technology tjo stro caltech edu Copyright 1995 California Institute of T echnology Figure 5 2 Fill Area Styles illustrated with PGPOLY PGCIRC and PGRECT PSPLOT fill area routines PGPOLY PSCIRC PGRECT 0 040 m Fill style 1 solid Fill A 3 ie Us Fill style 4 crogss hatched PGPLOT T imPearson California Institute of Technology t p stro caltech edu Copyright 1995 California Institute of Technology Higher L evel Routines Introduction T his chapter describes a number of high level routines that simplify the composition of complicated graphical images T hey include routines for drawing graphs of one variable or function against another xy plots histograms and display of two dimensional data functions of two variables Rather than giving complete details of all the available routines this chapter just points out son of the ways that they can be used See Appendix A for details of the calling sequences XY plots T he basic technique for drawing xy plots is described in Chapter 2 which showed how to make scatter plots using graph rrarkers produced by PGPT and ine plots produced by PGLINE Considerable variation in the appearance of the graph can be achieved using the following tec
38. California Institute of Technology Figure 4 1 PGPLOT standard graph markers PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995 California Institute of Technology F igure 4 2 T ext Examples Normol ABCDO efgh 1234 agy ABAN Roman ABCD afgh 1254 afyd ABAT talic ABGDG efgh 1234 nfy ABAD Script AWW gye IZEIA apy ABA fix connate E 5 85 lan g Mpo 2 3 8 12188 Bigger 1 5 qatt justified 0 0 Cantera 0 5 Right justified 1 0 PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995 California Institute of Technology F igure 4 3 Escape Sequences for Greek L etters eS O NN fH Fe a Ww Pe ri K ral M N II 2 e K amp n a u uga PGPLOT TimPearson California Institute of T echnolooy tjo stro caltech edu Copyright 1995 California Institute of T echnology 5 Attributes 5 1 Introduction T he appearance of the primitive elerrents of a graphical image lines graph markers text and area fill can be changed by specifying primitive attributes T he attributes and the corresponding routines for changing them are Color Index PGSCI Color Representation PGSCR PGSCRN and PGSHLS Line Style PGSLS Line Width PGSLW Character Height PGSCH Character F ont PGSCF T ext Background PGST BG Fill area Style PGSFS PGSHS T he routines to change attributes can
39. Fortran and C compilers F or more inforrration about the supported systers see the file pgplot sys_ aaaread me where stands for one of the options for Arg 2 Arg 2 Arg 3 aix xIf_cc alliant fortran_cc bsd g 7_gcc convex fc_cc cray cf77_cc epix2 f77_cc Control Data EP IX 2 x freebsd f77_cc fujitsu uxpm_frt_cc fujitsu uxpv_frt_cc hp fort77_c89 hp fort77_gcc irix f77_cc linux absoft_gcc linux 77_gcc linux g77_elf linux g77_gcc next af77_cc next f2c cc next g77_cc next gf77_cc osf1 f77_cc osf1 f77_cc_shared sol2 f77_cc Solaris 2 x SunOs 5 x sol2 f77_gcc sol2 f90 cc sol2 g77_gcc sun4 f77_acc SunOS 4 x sun4 f77_cc sun4 f77_gcc ultrix f77_cc If your systemis one of those listed proceed as follows Make the target directory your current default directory e g cd usr local pgpl ot Execute the script makerrake fromthe distribution directory e g usr local src pgpl ot makerake usr local src pgplot sun4 T he first argument supplied to makerrake is the narre of the distribution directory Note that when you run makerrake your current default directory should be the target directory i e the directory in which you want to put the compiled library T he second argument is the nan of the operating system Arg 2 fromthe above table if you omt it or Supply an unrecognized name makerrake will indicate the allowed values On sorre operating systems where more than one F ortran or C compiler is ava
40. INT EGER NXV NYV IX 1X2 1Y1 IY2 REAL DATA NXV NYV REAL X IX2 1X1 1 YLIMS IX2 IX1 1 INT EGER IOFF REAL BIAS LOGICAL CENTER Plot a series of cross sections through a 2D data array Each cross section is plotted as a hidden line histogram T he plot can be slanted to give a pseudo 3D effect if this is done the call to PGENV may have to be changed to allow for the increased X range that will be needed Argurrents DATA input the data array to be plotted NXV input the first dimension of DATA NYV input the second dimension of DATA IX1 input IX2 input IY1 input IY2 input PGHI2D plots a subset of the input array DATA T his subset is delimited in the first x dimension by IX1 and 1X2 and the 2nd y by IY 1 and IY 2 inclusively Note IY2 lt IY Lis permitted resulting in a plot with the cross sections plotted in reverse Y order However X2 must be gt 1X1 X input the abscissae of the bins to be plotted T hat is X 1 should be the X value for DAT A IX1 lY 1 and X should have IX2 IX1 1 elements T he program has to assure that the X value for DAT A x y is the sarve for all y IOFF input an offset in array elements applied to successive cross sections to produce a slanted effect A plot with IOFF gt Oslants to the right one with IOFF lt Oslants left BIAS input a bias value applied to each successive cross section in order to raise it above the previous cross se
41. MININT T he routine follows the contour through the array counting the number of cells that the contour crosses T he first label will be written in the MININT th cell and additional labels will be written every INTVAL cells thereafter A contour that crosses less than MININT cells will not be labelled Some experi mentation may be needed to get satisfactory results a good place to start is INT VAL 20 MININT 10 Argurrents A _ input data array IDIM input first dimension of A J DIM input second dimension of A 11 12 input range of first index to be contoured inclusive J 1 J 2 input range of second index to be contoured inclusive C input the level of the contour to be labelled one of the values given to PGCONT TR input array defining a transformation between the 1 J grid of the array and the world coordinates T he world coordinates of the array point A I J are given by X T R 1 T R 2 Fl T R 3 J Y T R 4 T R 5 l T R 6 J Usually T R 3 and T R 5 are zero unless the coordinate transforrration involves a rotation or shear LABEL input character strings to be used to label the specifi ed contour L eading and trailing blank spaces are ignored INTVAL input spacing along the contour between labels in grid cells MININT input contours that cross less than MININT cells will not be labelled PGCONS contour nep of a 2D data array fast algorithm void cpgco
42. PGLAB the calls to PGBBUF and PGEBUF have no effect On sore devices e g X Window workstations use of buffering can greatly speed up the execution of a program Next Appendix A PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995 California Institute of Technology PGPLOT Subroutine Descriptions Introduction T his appendix includes alist of all the PGPLOT subroutines and then gives detailed instructions for the use of each routine T he subroutine descriptions are in alphabetical order F or more information about PGPLOT see the PGPLOT horre page F ortran Usage T he subroutine descriptions indicate the data type of each argument When arguments are described as input they may be replaced with constants or expressions in the CALL statement but make sure that the constant or expression has the correct data type INT EGER arguments these should be declared INT EGER or INT EGER 4 in the calling program not INT EGER 2 REAL argurrents these should be declared REAL or REAL 4in the calling program not REAL 8 or DOUBLE PRECISION LOGICAL arguments these should be declared LOGICAL or LOGICAL 4 in the calling program CHARACT ER argurrents any valid F ortran CHARACT ER variable may be used declared CHARACT ER n for some integer n C usage A standard C synopsis indicating argument types is provided for each subroutine that has a C binding The PGPLOT header file should
43. PGQVP inquire viewport size and position PGQV SZ inquire size of view surface PGQWIN inquire window boundary coordinates PGRECT draw a rectangle using fill area attributes PGRND find the smallest round number greater than x PGRNGE choose axis limits PGSAH set arrow head style PGSAVE save PGPLOT attributes PGUNSA restore PGPLOT attributes PGSCF set character font PGSCH set character height PGSCI set color index e PGSCIR set color index range e PGSCLP enable or disable clipping at edge of viewport e PGSCR set color representation e PGSCRL scroll window e PGSCRN set color representation by name e PGSFS set fill area style e PGSHLS set color representation using HLS system e PGSHS set hatching style e PGSITF set image transfer function e PGSLCT select an open graphics device e PGSLS set linestyle e PGSLW set line width e PGST BG set text background color index e PGSUBP subdivide view surface into panels e PGSVP set viewport normalized device coordinates e PGSWIN set window e PGT BOX draw frame and write DD HH MM SS S labelling e PGTEXT write text horizontal eft j ustified e PGTICK draw asingle tick mark onan axis e PGUPDT update display e PGVECT vector rap of a 2D data array with blanking e PGVSIZ set viewport inches e PGVSTD set standard default viewport e PGWEDG annotate an image plot with
44. TEK the logged in terminal e tta4 TEK VMS device_TTA4 e dev tty6 T EK Unix device tty6 Disk file PostScript fornet e plot ps PS in the current default directory e plot ps VPS the sare but in portrait orientati on e scr tjp plot ps PS in a specified directory 1 5 Environment V ariables Sore aspects of the behavior of PGPLOT can be modified at run time by specifying environment variables T he variables have names which begin with PGPLOT_ In UNIX systems environment variables can be defined using the shell F or the bash bourne sh or korn ksh shell use commands like the following PGPLOT _DIR usr local pgplot export PGPLOT_DIR For the c shell and tcsh use setenv PGPLOT _ DIR usr local pgplot Note that the nares of PGPLOT environrrent variables are specified using upper case characters e g PGPLOT _DIR not pgplot_dir In VMS systems environment variables are logical names and can be defined with the DE FINE or ASSIGN commend e g DEFINE PGPLOT_DIR user_disk local pgplot DEASSIGN PGPLOT _DIR T he following environment variables affect all PGPLOT prograrrs PGPLOT_DIR Directory narre Unless told otherwise by environment variables PGPLOT FONT and PGPLOT_RGB PGPLOT looks for the files it needs at run timein this directory T he binary font file is grfont dat and the color narre database is rgb txt If this variable is undefined or if the specified file does not exist in this d
45. TR 1 BLANK INTEGER IDIM J DIM 11 12 J 1 J 2 NC REAL A IDIM DIM B IDIM J DIM T R 6 BLANK C Draw a vector map of two arrays T his routine is similar to PGCONB in that array elements that have the magic value defined by the argument BLANK are ignored making gaps in the vector map The routine may be useful for data measured on most but not all of the points of a grid Vectors are displayed as arrows the style of the arrowhead can be set with routine PGSAH and the the size of the arrowhead is determined by the current character size set by PGSCH Argurrents A input horizontal component data array B input vertical component data array IDIM input first dimension of A and B J DIM input second dimension of A and B 11 12 input range of first index to be mapped inclusive J 1 2 input range of second index to be mapped inclusive C input scale factor for vector lengths if 0 0 C will be set so that the longest vector is equal to the smaller of TR 2 T R 3 and T R 5 T R 6 NC input vector positioning code lt 0 vector head positioned on coordinates gt 0 vector base positioned on coordinates 0 vector centered on the coordinates TR input array defining a transformation between the grid of the array and the world coordinates T he world coordinates of the array point A I J are given by X T R 1 T R 2 I T R 3 J Y TR 4 T R 5 1 T R 6 J Usually T R 3 and T R 5
46. Usually T R 3 and T R 5 are zero unless the coordinate transforrration involves a rotation or shear PGCONL label contour map of a 2D data array void cpgconl const float a int idim int jdim int il int i2 int j1 int j2 float c const float tr const char label int intval int minint SUBROUTINE PGCONL A IDIM J DIM 11 12 J1 J2 C TR 1 LABEL INTVAL MININT INT EGER IDIM J DIM 11 J 1 12 J 2 INTVAL MININT REAL A IDIM J DIM C T R 6 CHARACT ER LABEL Label a contour map drawn with routine PGCONT Routine PGCONT should be called first to draw the contour lines then this routine should be called to add the labels Labels are written at intervals along the contour lines centered on the contour lines with lettering aligned in the up hill direction Labels are opaque so a part of the under lying contour line is obscured by the label Labels use the current attributes character height line width color index character font T he first 7 argurrents and the 9th argument T R are the sarre as the corresponding arguments to PGCONT and they should normally be identical to those used with PGCONT Note that the argument C is not an array unlike PGCONT only one contour level can be specified to label more contours call PGCONL for each level T he label is supplied as a character string in argument LABEL T he spacing of labels along the contour is specified by parameters INT VAL and
47. Y T draw mejor T ick rrarks at the major coordinate interval S draw minor tick marks Subticks V orient nurreric labels Vertically T his is only applicable to Y T he default is to write Y labels parallel to the axis 1 force decimal labelling instead of autorratic choice see PGNUMB 2 force exponential labelling instead of autormatic T o get a complete frarre specify BC in both XOPT and YOPT Tick marks if requested are drawn on the axes or frame or both depending which are requested If none of ABC is specified tick marks will not be drawn When PGENV calls PGBOX it sets both XOPT and YOPT according to the value of its parameter AXIS 1 BC 0 BCNST 1 ABCNST 2 ABCGNST For a logarithmic axis the mejor tick interval is always 1 0 T he nurreric label is 10 x where x is the world coordinate at the tick mark If subticks are requested 8 subticks are drawn between each major tick at equal logarithmic intervals T o label an axis with time days hours minutes seconds or angle degrees arcmin arcsec use routine PGT BOX PGCIRC draw a circle using fill area attributes void cpgcirc float xcent float ycent float radius SUBROUTINE PGCIRC XCENT YCENT RADIUS REAL XCENT YCENT RADIUS Draw a circle T he action of this routine depends on the setting of the F ill Area Style attribute If Fill Area Style is SOLID the default the interior of the circle is solid filled using
48. a 2D data array e PGCONS contour map of a 2D data array fast algorithm e PGCONT contour map of a 2D data array contour following e PGCONX contour map of a 2D data array non rectangular e PGCTAB install the color table to be used by PGIMAG e PGCURS read cursor position e PGDRAW draw aline fromthe current pen position to a point e PGEBUF end batch of output buffer e PGEND close all open graphics devices e PGENV set window and viewport and draw labeled frame e PGERAS erase all graphics fromcurrent page e PGERRI1 horizontal or vertical error bar e PGERRB horizontal or vertical error bar e PGERRX horizontal error bar e PGERRY vertical error bar e PGETXT erase text fromgraphics display e PGFUNT function defined by X F T Y G T e PGFUNX function defined by Y F X e PGFUNY function defined by X F Y e PGGRAY gray scale rrap of a 2D data array e PGHI2D cross sections through a 2D data array e PGHIST histogramof unbinned data e PGIDEN write username date and time at bottomof plot e PGIMAG color image froma 2D data array e PGLAB write labels for x axis y axis and top of plot e PGLCUR draw aline using the cursor e PGLDEV list available device types on standard output e PGLEN find length of a string ina variety of units e PGLINE draw a polyline curve defined by line segrents e PGMOVE move pen change current pen position
49. a wedge e PGWNAD set window and adjust viewport to sarre aspect ratio e PGADVANCE non standard alias for PGPAGE e PGBEGIN non standard alias for PGBEG e PGCURSE non standard alias for PGCURS e PGLABEL non standard alias for PGLAB e PGMTEXT non standard alias for PGMT XT e PGNCURSE non standard alias for PGNCUR e PGPAPER non standard alias for PGPAP e PGPOINT non standard alias for PGPT e PGPT EXT non standard alias for PGPT XT e PGVPORT nor standard alias for PGSVP e PGVSIZE non standard alias for PGV SIZ e PGVSTAND non standard alias for PGVST D e PGWINDOW non standard alias for PGSWIN PGARRO draw an arrow void cpgarro float x1 float y1 float x2 float y2 SUBROUTINE PGARRO X1 Y1 X2 Y 2 REAL X1 Y1 X2 Y2 Draw an arrow fromthe point with world coordinates X1 Y 1 to X2 Y 2 T he size of the arrowhead at X2 Y 2 is determi ned by the current character size set by routine PGSCH T he default size is 1 40th of the srraller of the width or height of the view surface T he appearance of the arrowhead Shape and solid or open is controlled by routine PGSAH Argurrents X1 Y 1 input world coordinates of the tail of the arrow X2 Y 2 input world coordinates of the head of the arrow PGASK control new page prompting void cpgask L ogical flag SUBROUTINE PGASK FLAG LOGICAL FLAG Change the prompt state of PGPLOT If the prompt state is O
50. already exists it will be overwritten unless the operating system can create multiple versions of the file If the filename is the file will be sent to the standard output and can be piped into another program on operating systems that support this Default view surface dimensions T he default view surface is 6400x 4800 units with a nominal scale and resol ution of 1000 units per inch about 40 units per mm T he actual scale can be changed when the metafile is displayed T he default can be overridden by calling pgpap inthe PGPLOT program or if pgpap is not used by setting environment variables logical names in VMS o PGPLOT_PGMF_WIDTH default 6400 o PGPLOT_PGMF_HEIGHT default 4800 T hese variables specify width and height in metafile units Color capability Color indices 0 255 are available color indices 0 15 have the standard PGPLOT default color representations with white background color index 0 and black foreground color index 1 T he RGB representation of any color index can be changed by calling pgscr The default representations of color indices 0 and 1 can be changed with PGPLOT environment variables e g o PGPLOT_ BACKGROUND default white o PGPLOT FOREGROUND default black Input capability None non interactive device Limitations 1 Only one PGPLOT device of this type may be opened at once 2 T he driver does not yet support the rmage functions routines pgi nag pggray etc T eX PK
51. are character sequences that are not plotted but are interpreted as instructions to change font draw superscripts or subscripts draw non ASCII characters e g Greek letters etc All escape sequences start with a backslash character T he following escape sequences are defined the letter following the may be either upper or lower case u start a superscript or end a subscript d start a subscript or end a superscript note that u and d must always be used in pairs b backspace i e do not advance text pointer after plotting the previous character fn swi tch to Normal font 1 fr swi tch to Ronen font 2 fi swi tch to Italic font 3 fs swi tch to Script font 4 backsi ash character x multiplication sign x centered dot A ngstr m syrrbol A gx greek letter corresponding to roman letter x as indicated in Figure 4 3 ae graph marker number nor nn 1 31 as indicated in Figure 4 1 character number nnnn 1 to 4 decimal digits fromthe Hershey character set the closing parenthesis may be omitted if the next character is neither a digit nor This makes a nnnn number of special characters e g matherratical musical astronomical and cartographical symbols available See Appendix B for alist of available characters 4 6 Area Fill Polygons Rectangles and Circles T he Area Fill primitives allow the programmer to shade the interior of an arbitrary polygonal
52. axes draw a grid at major increrrents of the x and y coordinates 2 6 Labeling the Axes Subroutine PGLAB may optionally be called after PGENV to write identifying labels on the x and y axes and at the top of the picture CALL PGLAB x y A Simple Graph All three argurrents are character variables or constants any of themcan be blank e A label for the x axis bottomof picture e A label for the y axis left hand edge e A label for the plot top of picture 2 7 Drawing Graph Markers Subroutine PGPT draws graph markers at one or more points on the graph Here we use it to mark the five data points CALL PGPT 5 XS YS 9 If any of the specified points fall outside the window defined in the call to PGENV they will not be plotted The arguments to PGPT are e T he nunber of points to be marked integer e hexand y coordinates of the points real arrays e T henurber of the symbol to be used to rrark the points In this example we use symbol number 9 which is a circle with a central dot T he available symbols are shown in Chapter 4 2 8 Drawing Lines T he following code draws the theoretical curve through the data points DO 10 1 60 XR I 0 1 I Y R I XR 1 2 10 CONT INUE CALL PGLINE 60 XR Y R We compute the x and y coordinates at 60 points on the theoretical curve and use subroutine PGLINE to draw acurve through them PGLINE joins up the points with straight line segments so
53. be freely intermixed with the PGPLOT drawing routines Once an attribute has been changed by a call to the appropriate routine it remains in effect for all subsequent plotting until it is changed again In addition to the routines that set attributes P GSxx there are routines for determining the current value of each attribute P GQxx T hese make it possible to write subroutines which change attribute values terporarily but restore the old attributes before returning to the calling program 5 2 Color Index T his attribute affects all the primitives lines graph markers text and area fill and is controlled by routine PGSCI Devices differ considerably in their ability to draw in more than one color On most hardcopy devices the default color is black on a white background while on most CRT devices it is white on a black background Color is selected using an integer parameter called the color index Color index Lis the default color and color index 0is the background color The number of different color indices available depends on the device On most monochrome devices only color indices 0 and 1 are available while some color CRT devices may permit color indices from0 to 255 On sone monochrome devices color index can be used to select different brightnesses intensities Color index 0 the background color can be used to erase elements froma picture by overwriting themwith color index 0 Note that not all devices are capable
54. by typing any printable ASCII character on the keyboard Most control characters eg are intercepted by the operating systemand cannot be used File format Binary byte stream Under Unix the output may be directed to a file under VMS this is not possible the output device must be a terminal T ektronix 4014 Disk File Supported device disk file which may be printable on a T ektronix cormpatible device T his driver uses the extended 12 bit addressing of the T ektronix 4014 T his driver is for VMS systems on Unix systems the regular T ektronix driver T EK can produce a disk file Device type code TFILE Default device name PGPLOT TFPLOT Default view surface dimension Depends on printer nominally 400 pixels inch giving 10 24 in horizontal x 7 80 in vertical Resolution T he coordinate systemused for T ektronix emulation is 4096 x 3120 pixels Color capability Only color index 1 is supported Primitives drawn in erase mode color index 0 are ignored not erased It is not possible to change color representation Input capability None File format Binary variable length records maximum 1024 bytes no carriage control attribute Obtaining hardcopy depends on the available printer Note the file cannot easily be displayed on a T ektroni x compatible terminal because it contains control characters which nay be interpreted by the operating system T he terminal must be set to PASSALL mode before the file c
55. calling F ortran subroutines directly fromC or C is a messy difficult and unportable exercise T his is due to the lack of a universal set of interlanguage calling conventions and to the lack of a standard on how FORT RAN LOGICAL and CHARACTER types are represented in terns of basic machine types F urtherrmore since C implements call by value argument passing semantics whereas F ORT RAN uses pass by reference there is the added complication that literal values must be sent indirectly by way of references to dunmy variables The CPGPLOT library adds an intermediate level of wrapper functions between C programs and the PGPLOT library T hese functions hide the systemdependencies of calling PGPLOT behinda systemi ndependert interface It is essential when using the CPGPLOT interface library to include the library header file cpgplot h at the top of all C files containing calls to the library Without this file the functions will not be correctly prototyped and your code will not work The CPGPLOT library can be used only with an ANSI cormpatible C compiler that understands C function prototypes Using the CPGPL OT library T he narres of the C interface library functions are the sare as their PGPLOT counterparts but are prefixed with ac and written in lower case e g PGT EXT becomes cpgtext T he header file cogplot h declares the types of the arguments of each CPGPLOT routine The types can usually be deduced fromthe F ORT RAN subrout
56. convert a nurber into a plottable character string void cpgnumb int mm int pp int form char string int string_ length SUBROUTINE PGNUMB MM PP FORM ST RING NC INTEGER MM PP FORM CHARACT ER STRING INTEGER NC T his routine converts a number into a decimal character representation T o avoid problems of floating point roundoff the number must be provided as an integer MM multiplied by a power of 10 10 PP The output string retains only significant digits of MM and will bein either integer format 123 decimal fornet 0 0123 or exponential fornet 1 23x10 5 Standard escape sequences u d raise the exponent and x is used for the multiplication sign This routine is used by PGBOX to create nurreric labels for a plot F ormatting rules a Decimal notation F ORM 1 Trailing zeros to the right of the decimal sign are omitted The decirral sign is omitted if there are no digits to the right of it When the decimal sign is placed before the first digit of the nurrber a zero is placed before the decimal sign The decirval sign is a period No spaces are placed between digits ie digits are not grouped in threes as they should be A leading minus is added if the number is negative b Exponential notation F ORM 2 The exponent is adjusted to put just one non zero digit before the decimal sign The mantissa is formatted as in a unless its value is lin which case it and the mu
57. default view surface is 768 horizontal by 460 vertical pixels On most Regis devices the resolution is degraded in the vertical direction giving only 230 distinguishable raster lines T here are actually 240 raster lines but 10 are reserved for a line of text Color capability Color indices 0 3 are supported By default color index 0 is black the background color Color indices 1 3 are white red and green on color monitors or white dark grey and light grey on monochrore monitors T he color representation of all the color indices can be changed although only a finite number of different colors can be obtained see the manual for the terminal Input capability T he graphics cursor is a blinking diamond crosshair T he user positions the cursor using the arrow keys and PF 1 PF 4 keys on his keyboard Note NOT the keyboard of the terminal on which he is plotting if that is different T he arrow keys move the cursor in the appropriate direction the size of the step for each keystroke is controlled by the PF 1 PF 4 keys PF1 1 pixel PF2 4 pixels PF3 16 pixels PF 4 64 pixels T he VT 240 terminal has a built in capability to position the cursor but PGPLOT does not use this as it is not available on the VT 125 T he user indicates that the cursor has been positioned by typing any character other than an arrow or PF 1 PF 4 key control characters eg ctrl C and other special characters should be avoided as they may be intercept
58. f grldev f Changed to totally ignore a PGPLOT driver that reports a zero length device type T his is to allow for stub drivers more to corre on this orfa f Fix bug polygon fill was ignored on devices for which fill must be emulated in PGPLOT if the y axis was reversed orfa f grrec0 f Changed to avoid use of a real variable as a do loop index not allowed by some compilers grscr f Fix bug that affected sorre drivers if you change the color representation of the current color these drivers did not notice grsyds f Changed to allow 304 256 48 characters in a font rather than 12848 the 48 are the greek characters Added escape sequence grsynk f Changed to allow 304 256 48 characters in a font rather than 1284 48 T his isin preparation for using the ISO L atin 1 character set rather than US ASCII Unaccented glyphs have been assigned for most of the SO L atin 1 accented characters pgcl f Under rare circumstances could crash with both arguments to atan2 equal to zero T his is aninternal routine used by PGCONL pgpol y f Fixed a bug in the clipping algorithmthat affected sore polygons that lie entirely outside the viewport pgacs f Added option UNIT S 4 to determi ne the character height in world coordinates and fixed a bug that would give wrong values on devices with non square pixels pgahs f Corrected conrrents argurrents are output not input pgai nf f Changed version number to 5 0 3 Changed cursor te
59. fill 25 Set fill pattern 26 Line of pixels 27 Scaling information 28 Draw merker 29 Query color representation 30 Scroll rectangle E 4 Handler state PGPLOT will send conrrands to the device handler in a set sequence Inquiry commands opcodes 1 7 and 29 may be sent at any time whether or not a device has been selected for output T he open workstation and close workstation commands are used to open and close a device T he begin picture and end picture commands are used to start and finish a frarre one page on a hardcopy device Graphical output commands opcodes 12 13 16 20 and 22 28 are only used between begin picture and end picture T he set color representation command opcode 21 can be used at any tin that a device is open T hus the sequence of contrands for a plot consisting of two frames will be query conrrands open workstation query comrands set color rep begin picture graphical output commands end picture query comrands set color rep begin picture graphical output commands end picture close workstation Any violation of this sequence is due to a bugin PGPLOT Device handlers should atterrpt to trap all errors including I O errors e g insufficient disk space or insufficient memory and issue a warning message rather than terminating execution of the program E 5 Sunmery of operations OPCODE 1 Return device type T hisis an inquiry function the handler returns the name by which
60. he last argument passed to the device handler is an integer specifying which of the supported types is required T his argument is omitted for handlers that support only one type NUDRIV inthe above exarple To reconfigure PGPLOT GREXEC must be modified as follows a set pararreter NDEV to the number of device types b make sure that the computed goto statement has NDEV branches c supply a target for each branch to call the appropriate device handler E 3 Device handler interface A device handler is a F ortran or F ortran callable subroutine T he narre of the subroutine must be of the form xxDRIV where xx is a two character code for the device type usually the first two letters of the type this code must of course be different for each different device handler SUBROUTINE xxDRIV OPCODE RBUF NBUF CHR LCHR MODE INTEGER OP CODE REAL RBUF INTEGER NBUF CHARACT ER CHR INTEGER LCHR INTEGER MODE T he first argument OP CODE is an integer operation code which specifies what operation the device handler is to perform it is an input pararreter to the subroutine see T able E 2 T he MODE argurrent is another input parameter that distinguishes between multi ple device types supported by the sarre handler T he other arguments are used for both input and output and their meaning depends on the value of the operation code Not all arguments are used for every operation code RBUF isa floating point array used t
61. height FG input The value which is to appear with shade 1 foreground Use the values of FG and BG that were supplied to PGGRAY or PGIMAG BG input the value which is to appear with shade 0 background LABEL input Optional units label If no label is required use PGWNAD set window and adjust viewport to sarre aspect ratio void cpgwnad float x1 float x2 float y1 float y2 SUBROUTINE PGWNAD X1 X2 Y 1 Y2 REAL X1 X2 Y1 Y2 Change the window in world coordinate space that is to be mapped on to the viewport and simultaneously adjust the viewport so that the world coordinate scales are equal in x and y T he new viewport is the largest one that can fit within the previously set viewport while retaining the required aspect ratio Argurrents X1 input the x coordinate of the bottomleft corner of the viewport X2 input the x coordinate of the top right corner of the viewport note X2 may be less than X1 Y1 input the y coordinate of the bottomleft corner of the viewport Y2 input the y coordinate of the top right corner of the viewport note Y 2 may be less than Y 1 PGADV ANCE non standard alias for PGPAGE SUBROUTINE PGADVANCE See description of PGPAGE PGBEGIN non standard alias for PGBEG INT EGER FUNCT ION PGBEGIN UNIT FILE NXSUB NY SUB INTEGER UNIT CHARACT ER FILE INTEGER NXSUB NYSUB See description of PGBEG PGCURSE non standard alias for PGCURS
62. hey should be rewritten to improve portability Do not select these drivers on UNIX systerrs e PSdriv PostScript handler o Theround terminals of thick lines are not clipped at the edge of the window this bug affects all handlers that do hardware thick lines e Tdriv T K4100 o set color representation doesn t work correctly colors are not reset on exit should they be e VT driv VT 125 handler o Cursor input does not work correctly Unfortunately do not have any good way to test this e X2DRIV PGDISP Note that this driver is no longer supported and the following problems will not be fixed use the X Window driver XSERV instead o pgdisp lineColor 2 crashes inmediatel y o figdisp_commce fails to compile in systems that lack values h e g ConvexOS 10 1 o Thedriver tries to start up figdisp instead of pgdi sp you can change this in the code figdisp_conmc if you wish o PGDISP cannot be compiled with DECC on VAX VMS not AXP o Compilation of pgdisp on AXP makes warning messages _LINK W MUL DEF symbol DECC NT OHS multiply defined in module DECC SHR file SY S COMMON SY SL IB JDECC SHR EXE 1 LINK W MUL DEF symbol DECC HT ONS multiply defined in module DECC SHR file SY S COMMON SY SL IB JDECC SHR EXE 1 e XWadriv X Window driver o Does not compile with some non ANSI compilers e g Convex that do not have string h o Does not support the old XEdriv methods of specifying a label for
63. image that would appear outside the viewport are suppressed T he various primitives behave slightly differently A ineis clipped where it crosses the edge of the viewport A graph rrarker is plotted if the center the point marked lies within or on the edge of the viewport otherwise it is suppressed Text which is usually used for annotation is not clipped except at the edge of the view surface A filled areais clipped at the edge of the viewport 4 3 Lines T he primitive line drawing routine is PGLINE This draws one or more connected straight line segrrents generally called a poly inein computer graphics It has three arguments the nurrber N of points defining the polyline and two arrays XPT S and YPT S containing the world x and y coordinates of the points T he polyline consists of N 1 straight line segments connecting points 1 2 2 3 N 1 N CALL PGLINE N XPTS YPTS T he two routines PGMOVE and PGDRAW are even nore primitive than PGLINE inthe sense that any line graph can be produced by calling these two routines alone In general PGLINE should be preferred as it is more modular PGMOVE and PGDRAW are provided for those who are used to Calcormp style plotting packages PGMOVE moves the plotter pen to a specified point without drawing a line pen up It has two argurrents the world coordinates of the required new pen position PGDRAW moves the plotter pen fromits current position defined by the
64. in world coordi nate space SEPN input the spacing of the hatch lines T he unit spacing is 1 percent of the smaller of the height or width of the view surface T his should not be zero PHASE input areal number between 0 and 1 the hatch lines are displaced by this fraction of SEPN froma fixed reference Adjacent regions hatched with the sane PHASE have contiguous hatch lines T o hatch a region with alternating lines of two colors fill the area twice with PHASE 0 0 for one color and PHASE 0 5 for the other color PGSIT F set image transfer function void cpgsitf int itf SUBROUTINE PGSITF ITF INTEGER ITF Set the Image T ransfer F unction for subsequent images drawn by PGIMAG PGGRAY or PGWEDG T he Image T ransfer F unction is used to map array values into the available range of color indices specified with routine PGSCIR or for PGGRAY on sore devices into dot density Argument ITF input type of transfer function ITF O linear ITF 1 logarithmic ITF 2 square root PGSLCT select an open graphics device void cpgsl ct int id SUBROUTINE PGSLCT ID INTEGERID Select one of the open graphics devices and direct subsequent plotting to it T he argument is the device identifier returned by PGOPEN when the device was opened If the supplied argument is not a valid identifier of an open graphics device a warning message is issued and the current selection is unchanged T his routine
65. into a single file called derrn c the file can be compiled and linked on a Sun running Solaris 2 5 1 as follows cc c O denw c usr local pgplot 1 usr local include f77 o demo denn o Itkpgpl ot Icpoplot I pgpl ot Itk4 1 Itcl 7 5 1X11 Insl lsocket Idl T he actual compilation and linking steps will differ frommachine to machine However note that the main PGPLOT library is written in FORT RAN For this reason it is usually easiest to link the programusing a fortran compiler as shown above T his is easier than having to figure out what FORT RAN support libraries to cite when linking with a C compiler Having compiled and linked the example program we now need aT cl script to show how to use the commands that it implements T he following script creates a PGPLOT widget opens it to PGPLOT and draws the exanple plot in it It also arranges that whenever the user resizes the application the plot will be redrawn to take advantage of the new size Tcl example script Give the application window a title wmtitle Example plot Show a usage label label usage text Mouse button 1 selects range 2 cancels 3 unzoons usage configure bd 2 relief groove bg yellow pack usage si de top anchor c fill x Create a PGPLOT widget pgplot plot maxcolors 4 width 500 height 500 pack plot side top expand true fill both Open the widget to PGPLOT pgopen plot xtk Arrange for the plot to be redrawn whene
66. is pressed when the pointer is in the given PGPLOT widget a procedure called report_button_press is invoked T his procedure then converts the X window pixel coordinates to world coordinates and reports themto stdout Tcl button press exarrple pgplot plot maxcolors 16 bind plot lt ButtonP ress gt report_button_press YW b x Yay proc report_button_press plot button xpixel ypixel set x plot world x xpi xel set y plot world y ypixel puts stdout Y ou pressed mouse button button at X x Y y T he rubber band cursors that would normally be provided by the cpgband PGP LOT function are also available via the setcursor command of pgplot widgets T hese augment the normal X Window cursor of the widget and remain attached to the cursor until the clrcursor command is next invoked on the widget T he following is a complex example that shows how one might arrange for the user to select an X axis range using rubber band cursors and T k bindings T he code acts as follows xrange_step1 takes aPGPLOT widget and a callback command as its arguments It displays a vertical line cursor in this widget and arranges that when the user next presses mouse button 1 xrange_step2 will be called xrange_step2 changes the cursor to an X axis range cursor with one of its two vertical lines anchored where the user pressed button 1 It then rebinds button 1 to invoke xrange_finish when the user selects the other end of the range
67. last call of PGMOVE or PGDRAW to anew point drawing a straight line as it goes pen down T he above call to PGLINE could be replaced by the foll owing CALL PGMOVE XPT S 1 Y PT S 1 DO 1 2 N CALL PGDRAW XPT S I YPT S 1 END DO 4 4 Graph Markers A Graph Marker is a symbol such as a cross dot or circle drawn on a graph to nerk a specific point Usually the symbol used will be chosen to be symretrical with a well defined center T he routine PGPT draws one or more graph rrarkers Sometimes called a pol yrrarker It has four argurrents the number N of points to mark two arrays XPT S and Y PT S containing the world x and y coordinates of the points and a nurrber NSY M identifying the syrbol to use CALL PGPT N XPTS YPTS NSYM T he symbol number can be 1 to draw a dot of the smallest possible size one pixel 0 31 to draw any one of the syrrbols in Figure 4 1 3 8 to draw regular polygon with 3 8 sides 33 127 to draw the corresponding ASCII character the character is taken fromthe currently selected text font or gt 127 to draw one of the Hershey syrrbols fromAppendix B T he Fortran ICHAR function can be used to obtain the ASCII value e g to use letter F CALL PGPT 1 0 5 0 75 ICHAR F 4 5T ext The T ext primitive routine is used for writing labels and titles on the image It converts an internal computer representation of the text ASCII codes into readable text T he s
68. must match exactly except for case but only the first 8 characters are significant For itens rrarked PGPLOT must be in the OPEN state for the inquiry to succeed If the inquiry is unsuccessful either because the itemcode is not recognized or because the information is not available a question mark is returned VERSION version of PGPLOT software in use STATE status of PGPLOT OPEN if a graphics device is open for output CL OSE D otherwise USER the usernarre associated with the calling program NOW current date and time e g 17 F EB 1986 10 04 DEVICE current PGPLOT device or file FILE current PGPLOT device or file TYPE device type of the current PGPLOT device DEV TYPE current PGPLOT device and type in a formwhich is acceptable as an argument for PGBEG HARDCOPY is the current device a hardcopy device Y ES or NO TERMINAL isthe current device the user s interactive terminal Y ES or NO CURSOR does the current device have a graphics cursor YES or NO SCROLL does current device have rectangle scrol capability Y ES or NO see PGSCRL Argurrents ITEM input character string defining the information to be returned see above for a list of possible values VALUE output returns a character string containing the requested information truncated to the length of the supplied string or padded on t
69. nearest to the cursor rather than the last entered point It can be used for example to allow the user to supply a set of points to represent the continuumlevel on a spectrum PGLCUR is similar to PGOLIN but instead of using a graph marker to mark each entered point it draws a polyline through them 7 4 Buffering By default PGPLOT ensures that the image seen on the view surface is up to date at all times that is each PGPLOT subroutine updates the image before returning control to the calling program T o improve efficiency PGPLOT can save instructions for controlling the graphics device in a buffer and only send themto the device when the buffer is filled up T his means that at any given nonent the image displayed on the screen may not be completely up to date T his can be a problemin an interactive program where for example the user has to tell the program what to do next based on his interpretation of the current display Three PGPLOT routines PGBBUF PGEBUF and PGUPDT are provided for controlling the buffering of output All three routines have no argurrents T he routine PGBBUF causes PGPLOT to begin saving graphical output in a buffer T he output is saved until 1 a matching PGEBUF call is made or 2 the buffer fills up or 3 the buffer is emptied by acall to PGUPDT or 4 PGEND is called T he routine PGEBUF stops buffering and causes the buffered commrands to be sent to the output device Calls to PGBBUF and PGE BUF shou
70. of PGPLOT 2 1 Introduction T his chapter introduces the basic subroutines needed to create a graph using PGPL OT by way of a concrete example It does not describe all the capabilities of PGPLOT these are presented in later chapters A graph is composed of several elements a box or axes delineating the graph and indicating the scale labels if required and one or more points or lines T o draw a graph you need to call at least four of the PGPLOT functions and subroutines 1 PGBEG to start up PGPLOT and specify the device you want to plot on 2 PGENV to define the range and scale of the graph and draw labels axes etc 3 oneor more calls to PGPT or PGLINE or both or other drawing routines to draw points or lines 4 PGEND to close the plot T o draw more than one graph on the san device repeat steps 2 and 3 It is only necessary to call PGBEG and PGEND once each unless you want to plot on more than one device T his chapter presents a very simple example programto demonstrate the above four steps 2 2 AnExanple A typical application of PGPLOT is to draw a set of measured data points and a theoretical curve for comparison T his chapter describes a simple programfor drawing such a plot in this case there are five data points and the theoretical curve is y X Here is the complete F ortran code for the program PROGRAM SIMPLE INTEGER I IER PGBEG REAL XR 100 Y R 100 REAL XS 5 Y S 5 DATA XS 1 2 3 4 5
71. of the pen position Y output world y coordinate of the pen position PGQT BG inquire text background color index void cpgqtba i nt tbci SUBROUTINE PGQT BG T BCI INTEGER TBCI Query the current T ext Background Color Index set by routine PGST BG Argurrent T BCI output receives the current text background color index PGQT XT find bounding box of text string void cpgaqtxt float x float y float angle float fjust const char text float xbox float ybox SUBROUTINE PGQT XT X Y ANGLE FJ UST TEXT XBOX Y BOX REAL X Y ANGLE FJ UST CHARACT ER TEXT REAL XBOX 4 Y BOX 4 T his routine returns a bounding box for a text string Instead of drawing the string as routine PGPT XT does it returns in XBOX and Y BOX the coordinates of the corners of a rectangle parallel to the string baseline that just encloses the string T he four corners are in the order lower left upper left upper right lower right where left and right refer to the first and last characters in the string If the string is blank or contains no drawable characters all four elements of XBOX and Y BOX are assigned the starting point of the string X Y Argurrents X Y ANGLE FJ UST TEXT input these arguments are the sare as the corrresponding arguments inPGPT XT XBOX Y BOX output arrays of dimension 4 on output they contain the world coordinates of the bounding box in XBOX 1 YBOX 1 XBO
72. of this e g T ektronix storage tube terminals and pen plotters cannot erase part of a displayed picture T o select a new color index for subsequent plotting use routine P GSCI Set Color Index e g CALL PGSCI 2 CALL PGLINE 100 XP YP CALL PGSCI 3 CALL PGPT 15 XP YP 17 Appendix D lists the capabilities of the devices for plotting in color and variable intensity The default color index is 1 all devices accept this Most devices also accept color index 0 background or erase and several accept color index up to 15 or more T he maximumcolor index is the number of different colors that can be displayed at once Some devices permit the assignrrent of colors to color indices to be changed by calling PGSCR see below T he range of color indices available on the active device can be determined by calling routine PGQCOL T he lower limit is always either 0 or 1 and the upper limit can be in the range 1 to 255 5 3 Color Representation Each color index has an associated Color Representation which defines the associated color and intensity Color Representation may be expressed by a set of three numbers either the Hue Lightness and Saturation H L S components or the Red Green and Blue R G B components R G B are quantities in the range 0 0 to 1 0 with 1 0 being maximumintensity if R G 8 the color is a shade of gray In the H L S system hue is a cyclic quantity expressed as an angle in the range 0 to 360 while L an
73. on the coordinates is that they be represented as floating point REAL or REAL 4 numbers otherwise we are totally free to choose the meaning of the coordinates F or example in a graph showing the tenporal variation of a radio source the abscissa x coordinate mi ght be Epoch in years and the ordinate y coordi nate F lux Density inJ y In accordance with common practice in graphics programing these coordinates chosen by the prograntrer are termed world coordinates PGPLOT neps a selected rectangular region of the world coordinate space termed the window onto a specified rectangle termed the viewport on the view surface the screen of an interactive display or a sheet of paper on a hardcopy plotter T he program must make calls to PGPLOT routines to define both the window and the viewport F or complete descriptions of the routines and their argurrents refer to Appendix A 3 2 Selecting a View Surface The first thing a graphics programrmust do is to tell PGPLOT what device it is going to use T his is done by calling function PGBEG For example to create a plot file for a PostScript printer INT EGER PGBEG IER PGBEG 0 plotfileps PS 1 1 Equally important when all plotting has been completed it is necessary to call PGEND to flush any pending plot requests CALL PGEND Note that only one device can be used at a time If PGBEG is called while a plot is in progress the old plot is closed and a new one is begun A
74. open to PGPLOT T he xmp_disarm_cursor function returns 0 if successful or 1if the specified widget is nota PGPLOT widget Advanced cursor input On its own xmp_arm_cursor provides a convenient but limited cursor input facility designed to mimic cpgband What it doesn t provide is a general means of responding to the full variety of X window events F or example it doesn t report Motion events via its callback T his section describes the facilities available for establishing one s own cursor input handlers To display a rubber band cursor without using its callback facility call xmp_arm_cursor with its callback argument specified as 0 T his tells the widget s cursor event handler not to select for button press and key press events and disables the special interpretation of mouse buttons and T ab keys with respect to keyboard focus managerrent To register input event handlers externally to xmp_arm_cursor use the standard XtA ddE ventHander In order to convert fromthe reported X window coordinates to PGPLOT world coordinates use the xmp _pixel_to_world function described later For exanple having created a L abel widget w_label anda PGPLOT widget w_plot the following code would result in a world coordinate readout of the cursor being displayed in the label whenever the cursor was moved over the PGPL OT widget XtAddE ventHandler w_plot PointerMotionMask F alse report_cursor XtPointer w_label static v
75. overridden by specifying environment variables or by calling routine PGPAP T he meximumsize is limited only by available merory Resolution PGPLOT assurres that the device resolution is 85 pixels inch but the actual resolution will vary depending on the display device Color capability Color indices 0 255 are accepted with standard defaults for color indices 0 15 If the color representation of a color index is changed it affects all pixels drawn in that color on the current page Input capability None Environment variables PGPLOT_WD_WIDTH width of image in pixels default 850 PGPLOT_WD_HEIGHT height of image in pixels default 680 File format X Window Dunp files are binary files Author Scott Allendorf 1995 X Window Workstations Author M C Shepherd 1994 Supported device All workstations running the X Window System V ersion 11 Release 4 and above under UNIX VMS and OpenVMS Device type codes o XWINDOW opens a window that disappears when PGEND is called o XSERVE opens a window that persists for reuse after PGEND is called Default device name T he default X display name defined by one s environment Under UNIX this is given by the DISPLAY environment variable Under VMS it is the device last created with CREAT E DISPLAY Device narre specification window host display screen T he device narre specifies the X window display to use the screen of that display and the PGPLOT window number to use T
76. pgi nit f New internal routine Initialize PGPLOT this is to avoid an illegal initialization of data in COMMON pgopen f New routine Open and select a graphics device unlike PGBEG this does not close any previously opened device pgai d f New routine Returns the identifier of the currently selected graphics device for use with PGSLCT pgsl ct f New routine Selects one of the open devices for graphics output pgai nf f Changed version number to 5 1 0 pgshs f Added checks on validity of arguments pgplot sys Changes to configuration files to support compilation of the Motif driver and example progrars pgplot sys_arc Contents of directory updated for version 5 1 0 by Dave Crennell See file AAAREADME pgplot sys_ linux T he current version of gcc does not require system specific variants of any files The variants for f2c have been moved into a subdirectory pgplot sys_linux f77_src and the configuration files have been modified accordingly pgplot sys_mac Contents of directory updated for version 5 0 3 by J S Salmento See file aaaread ne pgplot sys_msdos Contents of directory updated for version 5 1 0 by C T Dum See file aaaread re pgplot sys_next Contents of directory updated for version 5 1 0 and NextStep 3 0 by Allyn T ennant Configuration file for GNU F ortran g77 added See file aaaread ire pgplot sys sol2 Added R options to the Id commands in the configuration files these hel p the demo progran to find t
77. pgplot drivers xwdriv c Such drivers only understand the two calling conventions mentioned above Unlike the systemroutines the drivers are complicated so for maintenance reasons it would be unwise to modify copies of themjust to support a new calling convention Instead makemake checks to see if there are any C wrapper functions in the systemdirectory T hese are routines that act as intermediaries between F ORT RAN and the unmodified drivers and rakerrake arranges to have both the original driver code and wrapper code compiled and linked In order that makerrake detect such wrapper functions for driver code called xxdriv c the wrapper function should be called xxwrap c where the two letter prefix xx names a particular driver T he sarre mechanismcan be used for Objective C drivers in which case the file would be called xxwrap m However as mentioned before you should try to stick to C and FORT RAN code if possible Note that there is no requirerrent that you support all of the drivers in the pgplot drivers directory Many of themare targeted at specific systems and others are for rare devices When first porting PGPLOT you should probably first stick to a small simple subset until PGPLOT appears to be working reliably then rerun makemake with a larger selection of drivers uncommented to test more of them PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995 California Institute of Technology
78. pink 255 105 180 HotPink 255 20 147 deep pink 255 20 147 DeepP ink 255 192 203 pink 255 182 193 light pink 255 182 193 LightPink 219 112 147 pale violet red 219 112 147 PaleVioletRed 176 48 96 maroon 199 21 133 medium violet red 199 21 133 MediunWVioletRed 208 32 144 violet red 208 32 144 VioletRed 255 0255 magenta 238 130 238 violet 221 160 221 plum218 112 214 orchid 186 85 211 mediumorchid 186 85 211 MediumOrchid 153 50 204 dark orchid 153 50 204 DarkOrchid 148 0211 dark violet 148 0211 DarkViolet 138 43 226 blue violet 138 43 226 BlueViolet 160 32 240 purple 147 112 219 medium purple 147 112 219 MediunP urple 216 191 216 thistle 255 250 250 snow1 238 233 233 snow2 205 201 201 snow3 139 137 137 snow4 255 245 238 seashel 1 238 229 222 seashell2 205 197 191 seashel 3 139 134 130 seashell 4 255 239 219 AntiqueWhitel 238 223 204 AntiqueWhite2 205 192 176 AntiqueWhite3 139 131 120 AntiqueWhite4 255 228 196 bisquel 238 213 183 bisque2 205 183 158 bisque3 139 125 107 bisque4 255 218 185 PeachPuff1 238 203 173 PeachP uff2 205 175 149 PeachPuff3 139 119 101 PeachP uff4 255 222 173 NavajoWhitel 238 207 161 NavajoWhite2 205 179 139 NavajoWhite3 139 121 94 NavajoWhite4 255 250 205 L emonChiffonl1 238 233 191 LemonChiffon2 205 201 165 L emonChiffon3 139 137 112 L emonChiffon4 255 248 220 cornsi k1 238 232 205 cornsi k2 205 200 177 cornsi k3 139 136 120 cornsi lk4 255 255 240 ivory 1 238 238 224 ivory2 205 205 193 ivory3 139 139 131 ivory4 240 255 240 honeydew1 224
79. screen resolution is 92 dpi T he driver generates PostScript commands with a resolution 10 times greater than the screen resolution T his allows the window to be resized and or a hardcopy to be made with no loss of resolution Color capability On all devices color indices 0 15 are supported T he default colors are 0 is white Lis black 14 is light gray 15 dark gray On monochrore devices color indices 2 13 default to black If the driver detects a color server then color indices 0 255 are allowed and color indices 2 13 default to the standard PGPLOT colors Input capability The PGPLOT cursor is supported When a cursor read is requested the the viewer becomes the active application and the active plot window becorres the key window T his allows the user to terminate the cursor read by either a mouse click which generates an A character or by pressing a key on the keyboard File format By using the print conmand in the main menu you can send the contents of the current window to a file T his file can then be printed on any PostScript printer Obtaining hardcopy If you click on the print itemin the main menu then the standard NeXT print panel comes up T his allows the contents of the current window to be sent to a printer disk file or previewer References 1 Adobe Systens Inc PostScript Language Reference Manual Addison Wesley Reading Massachusetts 1985 2 Adobe Systens Inc PostScript Language T utorial and Cookbook Addiso
80. specification GIF in PGOPEN or PGBEG Alternatively the script may create aterporary named GIF file and return HT ML code for a Web page that includes the GIF file using an IMG tag If the Web server is a Windows system it may bea little more complicated Bernhard Rupp has put sore hints for using a Fortran PGPLOT programin a CGI script on his web page http www structure Inl gov Xray comp gif_prog htm How do compile PGPLOT for Linux using the Absoft F ortran compiler T he following inforrration is fromA bsoft support support absoft absoft com It will be included inPGPLOT 5 2 1 We ve had source modifications for using PGPLOT with our F ortran compilers on Linux available on our ftp site for some time now We provide three different configuration files fold to upper fold to lower and fold to lower append an underscore so that the end user can choose the nan space that fits his her project We also include an absoft_src directory under sys linux that contains the necessary source mods to build the library T he installation procedure is 1 tar xzvf pgplot5 2 tar gz 2 cd pgplot 3 tar xzvf pgplot_absoft50_linux tar gz 4 makemake whereJ pgplot linux absoftucs_gcc or absoftg77_ gcc or absoftlcs_ gcc Y ou can download our modifications from ftp ftp absoft com pub linux profortran5 O pgplot_absoft50_linux tar gz Is there a double precision version of PGPLOT PGPLOT is only available in single precision
81. supported Requests for other color indices are converted to 1 It is not possible to change color representation Input capability None File format ASCII text variable length records nex 130 bytes Obtaining hardcopy VMS PRINT QUEUE QMS filetype site dependent Author P P Murphy 1987 T alaris EXCL Devices Supported device Any Talaris printer that accepts the EXCL page description language 7 bit mode is used Device type code EXCL landscape orientation V EXCL portrait orientation Default file name PGPLOT EXPLOT Default view surface dimensions 10 25 inches horizontal by 7 75 inches vertical landscape mode 7 75 inches horizontal by 10 25 inches vertical portrait mode Resolution T he driver uses coordinate increments of 1 1000 inch T he true resolution is device dependent at time of writing it is typically 300 dots per inch Color capability Color indices 0 erase and 1 black are supported Requests for other color indices are converted to 1 It is not possible to change color representation Input capability None File format Ascii variable length records max 80 bytes Author A L Fey 1989 P J Scott 1989 Toshiba 3 in one Printer T ODRIV Author T J Pearson 1987 Supported device Toshiba 3 in one printer model P 351 Devi ce type code T OSHIBA Default device narre PGPLOT TOPLOT Default view surface dimensions 10 5 in horizontal by 8 0 in vertical Resolution 180
82. that the widget was subsequently given by the T k geometry manager T o ensure that the widget has been displayed and given its final size before drawing into it place the following T cl command before your first plotting command update idl etasks How do I stop a pgplot widget fromcomplai ning about there being insufficient colors See the private colormaps section Martin Shepherd mcs _astro caltech edu PGPLOT version 5 2 0 T his version includes bug fixes improvements in existing routines new routines and new device drivers All changes are intended to be compati ble existing programs should run unchanged and produce the sarre output except for a few bug fixes T ested Systems Version 5 2 0 has been tested with the following operating systers and compilers Drivers tested include GI GL NU PG PP PS TT TK VT WD X2 XM XW but not all combinations of drivers and systems have been tested exhaustively e Solaris 2 5 1 SunOS 5 5 1 Sun F ortran f77 3 0 1 Sun C cc 3 0 1 tested on SPARC Ultra 1 sol2 f77_cc e Solaris 2 5 1 SunOS 5 5 1 GNU F ortran g77 0 5 18 GNU C gcc 2 7 2 1 tested on SPARC Ultra 1 sol2 g77_ gcc e SunOS 4 1 3 Sun Fortran f77 GNU C gcc tested on Sun SPARCStation 2 Sun4 f77_ gcc e OpenVMS AXP V6 1 DEC FORT RAN V6 2 DEC C V4 0 DE Cwindows Motif 1 1 tested on DEC 3000 M 600 e OpenVMS VAX V6 1 DEC FORT RAN V6 2 DEC C V4 0 DE Cwindows Motif 1 2 tested
83. the following table PHOT puts out bitrraps suitable for inclusion in T eX output if you are using the Arbortext DVIHP program T he only options that will work with unexpanded Laser et are HJ 08 and HJ 09 T he other seven options require a L aserj et Plus or Laser et II Do NOT attempt to send grayscale plots to the drivers that use the optimized bitmap dumps T errible things will happen Option Equiv Size H xV Resolution HJ Ol LHOR 10 25 by 8 00inches 300 DPI HJ 02 PHOR 8 00 by 10 25inches 300 DPI HJ 03 PHOT 8 00 by 10 25 inches 300 DPI HJ 04 LHBR 6 54 by 4 91inches 300 DPI HJ 05 PHBS 5 65 by 5 65inches 300 DPI HJ 06 LMBR 10 25 by 8 00inches 150 DPI HJ 07 PMBR 8 00 by 10 25inches 150 DPI HJ 08 PMBS 4 48 by 4 48inches 150 DPI HJ 09 PLBS 6 00 by 6 00inches 100 DPI T he following logical names will override the PGPLOT _HJ MODE settings if used PGPLOT_HJ_RES H or HIGH for 300 bpi M or MEDIUM for 150 bpi LorLOW _ for 100 bpi V or VERYLOW for 75 bpi PGPLOT_HJ_ MAR gt xx xx yy yy where xx xx and yy yy are the vertical and horizontal margin dimensions in inches T he nurrber of characters including spaces preceding and following the conme should not exceed five PGPLOT_HJ SIZE xx xx yy yy where xx xx and yy yy are the vertical and horizontal plot dimensions in inches T he number of characters including spaces preceding and following the cons should not exceed five PGPLOT_HJ_TEX if this is defined with any
84. the current Color Index If Fill Area Style is HOLLOW the outline of the circle is drawn using the current line attributes color index line style and line width Argurrents XCENT input world x coordinate of the center of the circle YCENT input world y coordinate of the center of the circle RADIUS input radius of circle world coordinates PGCLOS close the selected graphics device void cpgclos void SUBROUTINE PGCLOS Close the currently selected graphics device After the device has been closed either another open device must be selected with PGSL CT or another device must be opened with PGOPEN before any further plotting can be done If the call to PGCL OS is omitted sore or all of the plot may be lost T his routine was added to PGPLOT in Version 5 1 0 Older programs use PGEND instead Arguments none PGCONB contour map of a 2D data array with blanking void cpgconb const float a int idim int jdim int i1 int i2 int j1 int j2 const float c int nc const float tr float blank SUBROUTINE PGCONB A IDIM J DIM 11 12 J 1 J2 C NC TR 1 BLANK INTEGER IDIM J DIM 11 12 J 1 J 2 NC REAL A IDIM DIM C TR 6 BLANK Draw a contour map of an array T his routine is the same as PGCONS except that array elements that have the magic value defined by argurrent BLANK are ignored making gaps in the contour map T he routine may be useful for data measured on most but n
85. the plot Using a resize callback Another way to handle the situation is to register a callback to be called whenever the PGPLOT widget gets resized F or this to be useful you should have the callback call the PGPLOT cpgpage procedure so as to synchronize the size of the pixmap with the window and then re draw any graphics that you want to re appear there Registering such a call back is just a netter of calling XtAddCal back with the PGPLOT widget as the first argument XrmNresizeCal back as the second argument your call back function as the third argument and an optional client context data argument as the final argurrent T he callback function should be declared like void whatever w client_data call_ data Where the argurrents are declared and interpreted as Widget w T he XnP gplot widget that has been resized XtPointer client_data This is the client_data pointer that was registered with XtA ddCall back It should be cast back to its actual type before use XtPointer call_ data This argurrent is always NULL Cursor input functions T he standard PGPLOT cpgcurs and cpgband cursor input functions are not recommended for use in Motif applications because they block the tool kit event loop Instead an alternative callback system designed to mimic cpgband but without blocking the event loop has been provided Arming and disarming the cursor is achieved through two functions int xmp_arm_cursor widget mode xr
86. the plot then you have not successfully created or located the file GRF ONT DAT see step 3 above If windows are created but neither graphics nor text appear the problemmay be that the display is set to a mode which doesn t use the SV GA color registers decrease the color palette to 16M or fewer colors After successfully testing the library you may delete all of the PGPLOT folders from X MSDEV PRO ECTS ver 4 or from x ProgramF iles DevStudio MyP rojects ver 5 or from x ProgramF iles Microsoft Visual Studio MyProjects ver 6 7 Drivers for Windows95 NT PostScript GIF LaT eX and the Null driver are included by default If you add additional drivers which may require debugging to eliminate perceived syntax errors etc to the library then the CASE structure in subroutine GRE XEC F must also be modified to reflect the changes also NDEV must reflect the total number of drivers T he default graphic window size for device type W9 is 800 600 with 236 colors SV GA 20 colors are reserved for systemuse T he default can be changed by setting an environment variable either in AUT OEXEC BAT or froma contrand line before starting the application as follows SET PGPLOT_VIDEO VGA orV 640 480 SVGA or S 800 600 XGA or X 1024 768 ZGA or Z 1280 1024 Modes nay also be selected by using alternate device types WV IWS WX or WZ Modes exceeding the capability of your Windows screen driver will be re
87. the requested position PGDRAW draw aline fromthe current pen position to a point void cpgdraw float x float y SUBROUTINE PGDRAW x Y REAL X Y Draw a line fromthe current pen position to the point with world coordinates X Y The line is clipped at the edge of the current window T he new pen position is X Y in world coordinates Argurrents X input world x coordinate of the end point of the line Y input world y coordinate of the end point of the line PGEBUF end batch of output buffer void cpgebuf void SUBROUTINE PGEBUF A call to PGEBUF rrarks the end of a batch of graphical output begun with the last call of PGBBUF PGBBUF and PGEBUF calls should always be paired Each call to PGBBUF increments a counter while each call to PGEBUF decrerrents the counter When the counter reaches 0 the batch of output is written on the output device Arguments none PGEND close all open graphics devices void cpgend void SUBROUTINE PGEND Close and release any open graphics devices All devices must be closed by calling either PGCLOS for each device or PGEND before the programtermi nates If a device is not closed properly some or all of the graphical output may be lost Arguments none PGENV set window and viewport and draw labeled frame void cpgenv float xmin float xmax float yin float ymax int just int axis SUBROUTINE PGENV XMIN XMAX YMIN YMAX J UST AXIS REAL XMIN
88. the special case of drawing a rectangle aligned with the coordinate axes only two vertices need be specified instead of four On most devices it is faster to use PGRECT than PGPOLY for drawing rectangles The rectangle has vertices at X1 Y 1 X LY 2 X2 Y 2 and X2 Y 1 Argurrents X1 X2 input the horizontal range of the rectangle Y 1 Y 2 input the vertical range of the rectangle PGRND find the smallest round number greater than x float cpgrnd float x int nsub REAL FUNCTION PGRND X NSUB REAL X INT EGER NSUB Routine to find the srrellest round nurrber larger than x a round number being 1 2 or 5 times a power of 10 If X is negative PGRND X PGRND ABS X eg PGRND 8 7 10 0 PGRND 0 4 0 5 If X is zero the value returned is Zero T his routine is used by PGBOX for choosing tick intervals Returns PGRND the round number Argurrents X input the number to be rounded NSUB output a suitable number of subdivisions for subdividing the nice number 2 or 5 PGRNGE choose axis limits void cpgrnge float x1 float x2 float xlo float xhi SUBROUTINE PGRNGE X1 X2 XLO XHI REAL X1 X2 XLO XHI Choose plotting limits XLO and XHI which enconpass the data range X1 to X2 Argurrents X1 X2 input the data range X1 lt X2 ie the min and max values to be plotted XLO XHI output suitable values to use as the extremes of a graph axis XLO lt X
89. the user can interactively change which part of the PGPLOT window is visible F or example pgpl ot plot rmaxcolors 16 scrollbar xscroll command plot xview orient horizontal scrollbar yscroll command plot yview orient vertical plot configure xscrollcommand xscroll set plot configure yscrollcommand yscroll set 2 The other is to establish a T k event binding to redraw the plot whenever the user resizes the window Provided that your redraw command calls cpgpage the new view surface will then match the current size of the widget pgpl ot plot maxcolors 16 bd 2 relief sunken bind plot lt Configure gt your_redraw_command Cursor facilities T he standard PGPLOT cursor functions cpgband and cpgcurs were not designed with event driven prograns in mind and they are not appropriate for use in T k because they block the T k event loop T his section describes how to display rubber band cursors using pgpl ot widget conmands and how to asynchronously respond to user input via the T k bind command T heT k bind conmand arranges for user specified T cl code to be executed whenever a given X window event occurs Events such as ButtonPress KeyPress and Motion events have associated X and Y X Window coordinates at which the event occurred T hese can be converted to PGPLOT world coordinates with the world command provided by pgplot widgets F or exarple the following code arranges that whenever any mouse button
90. to emulate a 2D fortran array f nx ny fmin fnax 0 0 for L j lt ny j for i 1 i lt ny i k j 1 nx i 1 Fortran convention x tr 0 tr 1Pi tr 2 j y tr 3 tr 4Fi tr 5Fj f k cos 0 3 sqrt x 2 0 13333 y cos 0 13333 x x y doubl e nx if f k lt frrin fnin f k if f k gt frrax frrax f k Call PGBEG to initiate PGPLOT and open the output device PGBEG will prompt the user to supply the device nan and type if cpgbeg 0 1 1 1 return EXIT_FAILURE Clear the screen Set up window and viewport cpgpage cpgsvp 0 05 0 95 0 05 0 95 cpgswin 1 0 float nx 1 0 float ny cpgbox bcts 0 0 0 bcts 0 0 0 cpgntxt t 1 0 0 0 0 0 Contouring using PGCONT Draw the map PGCONT is called once for each contour using different line attributes to distinguish contour levels cpgbbuf for i 1 i lt 21 i alev fmin i frrax fmin 20 0 lw i 5 0 3 1 ci i lt 10 2 3 Is i lt 10 2 1 cpgslw lw cpgsci ci cpgsl s Is cpgcont f nx ny 1 nx 1 ny amp aley 1 tr cpgsl w 1 cpgsl s 1 cpgsci 1 cpgebuf Finally call PGEND to terminate things properly cpgend return EXIT SUCCESS Next Appendix D PGPLOT T imPearson California Institute of Technology tipo stro caltech edu Copyright 1995 1998 California Institute of Technology Appendix D Supported De
91. to see alist of the available device types and verify that PGPLOT has been configured properly Points to check for the PGPLOT programcorrectly reads the font file and displays superscripts subscripts and special characters pgdenw2 the PGPLOT programcan read the color database pgdemo10 on interactive devices the cursor works correctly pgdem5 pgden6 9 Install the documentation files Unlike the UNIX installation procedure the VMS installation procedure does not generate docurrentation A list of subroutine synopses is available in a variety of formats by anonymous ftp fromftp ftp astro caltech edu pub pgpl ot DOC e pgplot doc plain ASCII file e pgplot hip VMS help fornet e pgplot htm HT ML WWW fornet e pgplot ps PostScript The help file can be installed ina VMS help library with a DCL command like the following library insert hel p pgplot hlb pgpl ot hl p PGPLOT T imPearson California Institute of Technology tip stro caltech edu Copyright 1997 California Institute of Technology PGPLOT Installation Instructions Windows 95 98 NT with Absoft Pro F ortran PGPLOT version 5 2 0 Supported systent Microsoft Windows 95 98 or Windows NT with Absoft Pro F ortran 6 0 from Absoft Corporation 2781 Bond Street Rochester Hills MI 48309 USA http www absoft com ampresently installing and testing PGPLOT under this system and full instructions should be available soon Contact me for additional in
92. used then XTICK and or YT ICK must be in seconds NXSUB Number of intervals for minor ticks on X axis 0 for default NY SUB Number of intervals for minor ticks on Y axis 0 for default The regular XOPT and YOPT axis options for PGBOX are A draw Axis X axis is horizontal line Y 0 Y axis is vertical line X 0 B draw bottom X or left Y edge of frarre C draw top X or right Y edge of frarre G draw Grid of vertical X or horizontal Y lines Invert the tick marks ie draw themoutside the viewport instead of inside L label axis Logarithmically see below N write Nurreric labels in the conventional location below the viewport X or to the left of the viewport Y P extend Project major tick marks outside the box ignored if option is specified M write nurreric labels in the unconventional location above the viewport X or to the right of the viewport Y T draw mejor T ick marks at the major coordinate interval S draw minor tick marks Subticks V orient nurreric labels Vertically T his is only applicable to Y T he default is to write Y labels parallel to the axis 1 force decimal labelling instead of automatic choice see PGNUMB 2 force exponential labelling instead of automatic T he default is to write Y labels parallel to the axis Note that 1 PGBOX option L log labels is ignored with option Z 2 The O option will be ignored for the V optio
93. value T eX mode see above will be used PGPLOT_HJ_NOFF if this is defined with any value the form feed needed to eject the final page will be omitted T his is useful for spooled printers it prevents wasted blank pages PGPLOT HJ PAGE L or LANDSCAPE for Landscape mode P or PORT RAIT for Portrait mode PGPLOT_HJ OPT O or OPTIMIZE so that bitmap will be optinize pr C or COMPRESS so that bitrmap will be compressed Opti mi zed mode nini mi zes the memory usage for the L aser et devices T his sometimes leads to a larger file than if optimization is not used Optimized mode may not be used with the Desk et devices Compressed mode decreases the size of the bitrrap file for later model HP devices particularly the Desk et devices Author S C Allendorf 1989 B H T oby 1991 Hewlett Packard L aser et Printer Author S C Allendorf 1989 Supported device Hewlett Packard Laser et Laser et or Laser et Il Device type code LJ nn where nn is a number 01 09 Default device name PGPLOT LJ PLT Default view surface dimensions Depends on which version of the driver is chosen via the logical name PGPLOT_LJ MODE Driver Equivalence Size H x V LJOL LHOR 10 50 by 8 00 inches LJO2 PHOR 8 00 by 10 50 inches LJO3 PHOT 8 00 by 10 50 inches LJO4 LHBR 6 54 by 4 91 inches LJOS PHBS 5 65 by 5 65 inches LJO6 LMBR 10 50 by 8 00 inches LJO7 PMBR 8 00 by 10 50 inches LJ 08 PMBS 4 48 by 4 48 inches LJO9 PLBS 6 00 by
94. values can be determined by calling PGQCIR Note that color representations should be assigned to color indices C1 to C2 by calling PGSCR before calling PGIMAG On sorre devices but not all the color representation can be changed after the call to PGIMAG by calling PGSCR again Array values in the range A1 to A2 are mapped on to the range of color indices C1 to C2 with array values lt A1 being given color index C1 and values gt A2 being given color index C2 T he mapping function for intermediate array values can be specified by calling routine PGSIT F before PGIMAG the default is linear On devices which have no available color indices C1 gt C2 PGIMAG will return without doing anything On devices with only one color index C1 C2 all array values map to the sarre color which is rather uninteresting An image is always opaque i e it obscures all graphical elements previously drawn in the region T he transformation matrix TR is used to calculate the world coordinates of the center of the cell that represents each array elerrent T he world coordinates of the center of the cell corresponding to array element A I J are given by X TR 1 TRI T R 3 J Y T R 4 T R 5 l T R 6 J Usually T R 3 and T R 5 are zero unless the coordinate transformation involves a rotation or shear T he corners of the quadrilateral region that is shaded by PGIMAG are given by appl ying this transformation to 11 0 5 1 0 5
95. viewport size STRING String of interest Output XL Length of string in x direction YL Length of stringin y direction PGLINE draw a polyline curve defined by line segments void cpgline int n const float xpts const float ypts SUBROUTINE PGLINE N XPTS YPTS INTEGER N REAL XPTS YPTS Primitive routine to draw a Polyline A polyline is one or more connected straight line segments T he polyline is drawn using the current setting of attributes color index line style and line width T he polyline is clipped at the edge of the window Argurrents N input number of points defining the line the line consists of N 1 straight line segments N should be greater than 1 if it is 1 or less nothing will be drawn XPTS input world x coordinates of the points YPTS input world y coordinates of the points T he dimension of arrays X and Y must be greater than or equal to N T he pen position is changed to X N Y N in world coordinates if N gt 1 PGMOVE move pen change current pen position void cpgrove float x float y SUBROUTINE PGMOVE X Y REAL X Y Primitive routine to move the pen to the point with world coordinates X Y No line is drawn Argurrents X input world x coordinate of the new pen position Y input world y coordinate of the new pen position PGMT XT write text at position relative to viewport void cpgntxt const char side float disp float co
96. way to portably call C fromF ORT RAN The C routines in pgplot sys support the two most common conventions both of which are based on the convention used in the original BSD 77 compiler In the BSD f77 convention FORT RAN symbols are converted to lower case and postfixed with an underscore when exported to the linker all arguments are passed by pointer and the lengths of any string argurrents are silently appended to the end of the argument list A common modification to the BSD f77 convention is to omit the trailing underscore If you need the trailing underscore this is the most common convention then you must include DPG_PPU inthe configuration file CF LAGS assignment If neither of the above conventions are supported by your compiler then you will have to copy the C routines to the new systemdirectory and modify themto support the calling conventions on your system Where C routines have been provided they are usually based on the availability of POSIX 1 If your machine doesn t support POSIX yet then you will have some changes to make particularly as regards terminal O routines If your systemis of BSD decent then try the BSD compatible terminal 1 0 routines in the pgplot sys_convex systemdirectory Wrapper routines for C drivers As rrentioned above there is no portable way to call C fromF ORT RAN yet there are several drivers that are written in C in the pgplot drivers directory A prominent example is the X windows drivers
97. window using X resources see xwdriv which may reduce conflicts with other applications but not with greedy ones like Netscape PGPLOT initializes its color map to all black until you start plotting in the window T his exacerbates the problem and we will try to improve this in a future version Encapsulated PostScript What is the difference between a file produced by PGPL OT using ps and an encapsulated PostScript file or is there none A PostScript ps file produced by PGPLOT isa valid encapsulated PostScript file except for the following 1 It must bea single page Multi page plots are not valid EPS 2 The BoundingBox contrent is at the end of the file not the beginning T he reason for this is that PGPLOT doesn t know what the bounding box will be until it has finished creating the file If the programthat is trying to read the file complains you can move this comment fromthe end of the file to the beginning It is simplest to use the UNIX script pscaps inthe PGPLOT directory pscaps yourfile ps T his modifies the file s in place 3 Sone EPS files include a screen preview section to allow themto be displayed by programs that cannot interpret PostScript T he fornet of this is machine dependent different for Macintosh and DOS for example PGPLOT does not write a screen preview section All PGPLOT PostScript files both single page and multi page are labelled at the beginning PS Adobe 3 0 EPSF 3
98. 0 0 33 0 00 0 33 0 33 0 33 15 Light Gray 0 0 66 0 00 0 66 0 66 0 66 16 255 Undefined On sone devices but not all the assignments of colors to color indices can be changed by calling routine PGSCR to specify the color in ters of its R G B components PGSHLS to specify the color in terms of its H L S components or PGSCRN to specify the color by name Note that color index 0 the background color can be redefined in this way T he effect of changing color representation is device dependent Devices usually fall into one of three classes static color unchangeable representation pseudo color color lookup table and direct color On static color devices e g pen plotters Printronix printer T ektronix terminal attempts to change the color representation are ignored On pseudo color devices e g most X Window devices changing the color representation of index J changes the lookup table Pixels already drawn with index J change to the new color as do subsequent ones On direct color devices e g PostScript color printers some X Window devices changing color representation only affects the color of pixels drawn with that color index later in the program On monochrome devices which can display a range of intensities the displayed intensity is calculated fromthe requested R G B intensities by the following formul a 0 30R 0 59G 0 11 B as inthe NT SC encoding used by US color television systers Setting Color
99. 0 3 drivers list Added HGDRIV install txt Updated makehtm This is a perl script used for making the htm documentation file Some systems had trouble executing this script have now modified it to invoke perl by the mechanism Y ou may have to modify the first line of the script to specify the location of perl on your system makerake Now includes the non standard routines in the documentation files pgplot doc pgplot htm Also modified the non standard routines to get cross references to their aliases inthe HT ML file T he list of include file dependencies is now generated by searching the code Special code for the Motif widget has been added Added HGDRIV ver503 txt New file Release notes pgpl ot drivers hgdriv f New file Driver fromColin Lonsdale for HP GL 2 devices have not tested this It is an alternative to GL DRIV you should probably not include both in your PGPLOT configuration Ixdriv f Removed a non standard DAT A initialization psdriv f Changed interpretation of environment variables PGPLOT_PS_BBOX and PGPLOT_PS DRAW _BBOx see the documentation xwdri v C Fix an error in display of large images gidriv f ppdriv f wddriv f Added contrents to indicate what must be changed on operating systers like OSF 1 that use 64 bit addresses pgpl ot exampl es pgdenv1 f Fixed error in scatter plot and rewrote randomnunber routines pgdeno2 f Exercise a few nore escape sequences pgpl ot src grdtyp
100. 1 XHI gt X2 PGSAH set arrow head style void cpgsah int fs float angle float barb SUBROUTINE PGSAH FS ANGLE BARB INTEGER FS REAL ANGLE BARB Set the style to be used for arrowheads drawn with routine PGARRO Argurrent FS input FS 1 gt filled FS 2 gt outline Other values are treated as 2 Default 1 ANGLE input the acute angle of the arrow point in degrees angles in the range 20 0 to 90 0 give reasonable results Default 45 0 BARB input the fraction of the triangular arrow head that is cut away fromthe back 0 0 gives a triangular wedge arrow head 1 0 gives an open gt Values 0 3 to 0 7 give reasonable results Default 0 3 PGSAVE save PGPLOT attributes void cpgsave voi d SUBROUTINE PGSAVE T his routine saves the current PGPLOT attributes in a private storage area T hey can be restored by calling PGUNSA unsave Attributes saved are character font character height color index fill area style line style line width pen position arrow head style hatching style and clipping state Color representation is not saved Calls to PGSAVE and PGUNSA should always be paired Up to 20 copies of the attributes may be saved PGUNSA always retrieves the last saved values last in first out stack Note that when multiple devices are in use PGUNSA retrieves the values saved by the last PGSAVE call even if they were for a different device Arguments none PGUNSA restore PGP
101. 10 25 in vertical Resolution 144 x x 140 y pixels inch reversed for portrait mode Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Input capability None File format Variable length records maximum 197 bytes with embedded carriage control characters A full page plot occupies 600 512 byte blocks Obtaining hardcopy Use the commrand PRINT PASSALL Author J H Trice 1990 Hewlett Packard Deskjet or Laserjet Supported device Hewlett Packard Laser et Laser et or Laser et II Desk et Desk et Plus Desk et 500 Device type code H Default device name PGPLOT HJ PLT Default view surface dimensions Depends on which driver settings are chosen via environment variables PGPLOT_ HJ MODE PGPLOT_HJ_MAR PGPLOT_HJ_SIZE and PGPLOT_HJ_PAGE Resolution Depends on which driver settings are chosen via logical names PGPLOT _HJ MODE or PGPLOT_Hj_RES Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Input capability None File format See the Laser et andDesk et Printer T echnical Reference Manuals for details of the file fornet Obtaining hardcopy VMS use the command PRINT PASSALL Environment variables use DEFINE in VMS setenv in Unix to define the following environment variables or logical names PGPLOT _HJ MODE xxxx where xxxx is one of the entries in
102. 12 212 212 gray83 212 212 212 grey83 214 214 214 gray84 214 214 214 grey84 217 217 217 gray85 217 217 217 grey85 219 219 219 gray86 219 219 219 grey86 222 222 222 gray87 222 222 222 grey87 224 224 224 gray88 224 224 224 grey88 227 227 227 gray89 227 227 227 grey89 229 229 229 gray90 229 229 229 grey90 232 232 232 gray91 232 232 232 grey91 235 235 235 gray92 235 235 235 grey92 237 237 237 gray93 237 237 237 grey93 240 240 240 gray94 240 240 240 grey 94 242 242 242 gray95 242 242 242 grey95 245 245 245 gray96 245 245 245 grey96 247 247 247 gray97 247 247 247 grey97 250 250 250 gray98 250 250 250 grey98 252 252 252 gray99 252 252 252 grey99 255 255 255 gray 100 255 255 255 grey 100 ifndef cpgplot_h define cpgplot_h ifdef cplusplus extern C endif typedef int L ogical void cpgarro float x1 float y1 float x2 float y2 void cpgask L ogical flag void cpgaxis const char opt float x1 float y1 float x2 float y2 float v1 float v2 float step int nsub float draj float dn jr float fmin float disp float orient int cpgband int mode int posn float xref float yref float x float y char ch_ scalar void cpgbbuf void int cpgbeg int unit const char file int nxsub int nysub void cpgbin int nbin const float x const float data Logical center void cpgbox const char xopt float xtick int nxsub const char yopt float ytick int nysub void cpgcirc float xcent float ycent float radius void cpgcl os void void cp
103. 2 251 152 PaleGreen 0 255 127 spring green 0 255 127 SpringGreen 124 252 Olawn green 124252 OLawnGreen 0255 Ogreen 127255 Ochartreuse 0 250 154 medi umspri ng green 0 250 154 Mediun6 pringGreen 173 255 47 green yellow 173 255 47 GreenY ellow 50 205 50 line green 50 205 50 LimeGreen 154 205 50 yellow green 154 205 50 Y ellowGreen 34 139 34 forest green 34 139 34 F orestGreen 107 142 35 olive drab 107 142 35 OliveDrab 189 183 107 dark khaki 189 183 107 DarkKhaki 240 230 140 khaki 238 232 170 pale goldenrod 238 232 170 PaleGoldenrod 250 250 210 light goldenrod yellow 250 250 210 LightGoldenrodY ellow 255 255 224 light yellow 255 255 224 LightY ellow 255 255 0 yellow 255 215 0 gold 238 221 130 light goldenrod 238 221 130 LightGoldenrod 218 165 32 goldenrod 184 134 11 dark goldenrod 184 134 11 DarkGoldenrod 188 143 143 rosy brown 188 143 143 RosyBrown 205 92 92 indian red 205 92 92 IndianRed 139 69 19 saddle brown 139 69 19 SaddleBrown 160 82 45 sienna 205 133 63 peru 222 184 135 burlywood 245 245 220 bei ge 245 222 179 wheat 244 164 96 sandy brown 244 164 96 SandyBrown 210 180 140 tan 210 105 30 chocolate 178 34 34 firebrick 165 42 42 brown 233 150 122 dark sal non 233 150 122 DarkSalmon 250 128 114 salmon 255 160 122 light salmon 255 160 122 LightSalmon 255 165 0 orange 255140 0 dark orange 255 140 0 DarkOrange 255 127 80 coral 240 128 128 light coral 240 128 128 LightCoral 255 99 71tormato 255 69 0 orange red 255 69 OOrangeRed 255 0O O red 255 105 180 hot
104. 2 Porting to UNIX systems Background While no two UNIX systems are identical the overall similarities allow for a single installation procedure T he procedure embodied in pgplot makerrake is implemented as a Bourne shell script whose job is to create makefiles specific to specific systems T he design goals of the script were 1 To provide a uniforminstall ation procedure for as many systers as possible 2 Tosupport PGPLOT compilation in directories other than the distribution directory If the disk containing the source code distribution is cross mounted over a number of different UNIX systens this allows one copy of the source code to be used to compile PGPLOT on each of those systems It also allows the source code directory to be placed on a read only disk partition or CD ROM 3 To allow more than one compiler combination on systers that support multiple compilers Separate configuration files are provided for each compiler combination 4 To avoid code duplication of systemspecific routines where possible T he script allows one to selectively override generic routines with systemspecific versions 5 T o make the script behave as told by the user rather than have it try to autorretically determine its configuration fromthe systemthat it is run upon T his enables one to make makefiles for many systems without actually having to login to those systers How to port PGPLOT to anew UNIX system Create a systemdirectory T he first th
105. 238 224 honeydew2 193 205 193 honeydew3 131 139 131 honeydew4 255 240 245 LavenderBlush1 238 224 229 L avenderBlush2 205 193 197 LavenderBlush3 139 131 134 L avenderBlush4 255 228 225 MistyRose1 238 213 210 MistyRose2 205 183 181 MistyRose3 139 125 123 MistyRose4 240 255 255 azurel 224 238 238 azure2 193 205 205 azure3 131 139 139 azure4 131 111 255 SlateBluel 122 103 238 SlateBlue2 105 89 205 SlateBlue3 71 60 139 SlateBlue4 72 118 255 RoyalBluel 67 110 238 RoyalBlue2 58 95 205 RoyalBlue3 39 64139 RoyalBlue4 0 0255 bluel 0 0238 blue2 0 0205 blue3 0 0139 blue4 30 144 255 DodgerBluel 28 134 238 DodgerBlue2 24 116 205 DodgerBlue3 16 78 139 DodgerBl ue4 99 184 255 SteelBlue1 92 172 238 SteelBlue2 79 148 205 SteelBlue3 54 100 139 Steel Blue4 0 191 255 DeepSkyBl uel 0 178 238 DeepSkyBlue2 0 154 205 DeepSkyBlue3 0 104 139 DeepSkyBlue4 135 206 255 SkyBlue1 126 192 238 SkyBlue2 108 166 205 SkyBlue3 74 112 139 SkyBlue4 176 226 255 LightSkyBluel 164 211 238 LightSkyBlue2 141 182 205 LightSkyBlue3 96 123 139 LightSkyBlue4 198 226 255 SlateGray1 185 211 238 SlateGray2 159 182 205 SlateGray3 108 123 139 SlateGray4 202 225 255 LightSteelBluel 188 210 238 LightSteelBlue2 162 181 205 LightSteel Blue3 110 123 139 LightSteelBlue4 191 239 255 LightBlue1 178 223 238 LightBlue2 154 192 205 LightBlue3 104 131 139 LightBlue4 224 255 255 LightCyan1 209 238 238 LightCyan2 180 205 205 LightCyan3 122 139 139 LightCyan4 187 255 255 PaleT urquoisel 174 238 238 PaleT u
106. 24 2125 2126 2127 2128 Ww x y z a E 2132 2133 2134 2135 2136 2137 2138 7 v i K A ht 2142 21435 2144 2145 2146 2147 2148 T p g T v g X 2152 2153 2154 2155 2156 2157 2158 b C d J h 2162 2163 2164 2165 2166 2167 2168 t 7 n p q r 2172 21735 2174 2175 2176 2177 2178 v wW x y z if fi 2182 2184 2145 2146 2187 2180 2181 fil 1 E 8 3 p if H ta E m Fa 2 Ei a 2 A i z mm oe ba E D we F r E or tn p ta 7 mg he a a ha Lio a 2124 u 2131 e144 i 2151 a ho ms T a i p be mes Co pail atl off af 2740 2141 2182 21484 2145 2146 2187 2180 2181 2182 ffl ffl 1 E g p g F it PGPLOT TimPearson California Institute of Technology t p stro caltech edu Copyright 1995 California Institute of Technology Figure B 5 PGPLOT Symbols 7105 2106 21a 2108 2105 2200 zagi earl es it q a 1 5 ir 2207 ar g 2210 2211 ade p a mE a ao a g H S ddd 5 E i B E ka a bay Le a ia st Bade he H e y BEBE ho gE i H i z i 1 ford ror foro Por fore Paro ore va P a p ap ae ee a E PGPLOT TimPearson California Institute of Technology tipor stro caltech edu Copyright 1995 California Institute of Technology Figure B 6 PGPLOT Symbols 2544 lass ase 2517 N 0 P Q oBep ona esa4 2525 2526 2551 Y W x Y Fd if 2556 255 ossa lasse eseo ese1 25e2 F F I Fi x Pole 2673 2B74 2675 26
107. 300 CONT INUE DO 400 1 10 ALEV l F MIN l 1 F MAX F MIN 9 0 400 CONT INUE Next we choose a window and viewport and set up an array T R containing the 6 constants in the transformation between array indices and world coordinates In this case the transformation is simple as we want x I y 5J CALL PGENV 0 50 5 45 0 2 Finally we call PGCONT actually we call it twice to draw the first five contours in color index 2 red and the remaining 5 in color index 3 green CALL PGSCI 2 CALL PGCONT F 50 50 1 50 1 50 AL EV 5 T R CALL PGSCI 3 CALL PGCONT F 50 50 1 50 1 50 AL EV 6 5 T R Normally PGCONT is preferable to PGCONS See the description in Appendix A for suggestions as to when PGCONS should be used Gray scale plots T he routine PGGRAY is used in a simlar way to PGCONT Instead of drawing contours it shades the interior of the viewport the intensity of shading representing the value of the function at each point T he exact appearance of the resulting image is device dependent On sore devices PGGRAY does the shading by drawing many dots so it can be very slow Cross sections Routine PGHI2D draws a series of cross sections through a two dimensional data array Each cross section hides those that appear behind it giving a three dimensional effect See Appendix A for details 7 Interactive Graphics 7 1 Introduction T he previous chapters have described how to produce a static g
108. 4 0 grayO 0 greyO 3gray1 3grey1 5 gray2 5 grey2 8 gray3 ouuUuWWO O o U U w Uw O O 8 8 8grey3 10 10 10 gray4 10 10 10grey4 13 13 13gray5 13 13 13grey5 15 15 15gray6 15 15 15grey6 18 18 18 gray7 18 18 18 grey7 20 20 20gray8 20 20 20grey8 23 23 23 gray9 23 23 23 grey9 26 26 26gray10 26 26 26grey10 28 28 28 gray11 28 28 28 grey11 31 31 31 gray12 31 31 31 grey12 33 33 33 gray13 33 33 33 grey13 36 36 36 gray14 36 36 36 grey14 38 38 38 gray15 38 38 38 grey15 41 41 41 gray16 41 41 41 grey16 43 43 43 gray17 43 43 43 grey17 46 46 46gray18 46 46 46grey18 48 48 48 gray19 48 48 48 grey19 51 51 51 gray20 51 51 51 grey20 54 54 54gray21 54 54 54grey21 56 56 56 gray22 56 56 56 grey22 59 59 59 gray23 59 59 59 grey23 61 61 61 gray24 61 61 61 grey24 64 64 64 gray25 64 64 64 grey25 66 66 66 gray26 66 66 66 grey26 69 69 69 gray27 69 69 69 grey27 71 71 71gray28 71 71 71grey28 74 74 74gray29 74 74 74grey29 77 77 77 gray30 77 77 77 grey30 79 79 79gray31 79 79 79 grey31 82 82 82 gray32 82 82 82 grey32 84 84 84 gray33 84 84 84 grey33 87 87 87 gray34 87 87 87 grey34 89 89 89 gray35 89 89 89 grey35 92 92 92 gray36 92 92 92 grey36 94 94 94 gray37 94 94 94 grey37 97 97 97 gray38 97 97 97 grey38 99 99 99 gray39 99 99 99 grey39 102 102 102 gray40 102 102 102 grey40 105 105 105 gray41 105 105 105 grey41 107 107 107 gray42 107 107 107 grey42 110 110 110 gray43 110 110 110 grey43 112 112 112 gray4
109. 4 world coordinates Other values give an error message and are treated as 0 XCH output T he character height for text written with a vertical baseline YCH output The character height for text written with a horizontal baseline the usual case T he character hei ght is returned in both XCH and Y CH If UNIT S 1 or UNIT S 2 XCH and YCH both receive the sare value If UNIT S 3 XCH receives the height in horizontal pixel units and YCH receives the height in vertical pixel units on devices for which the pixels are not square XCH and Y CH will be different If UNIT S 4 XCH receives the height in horizontal world coordinates as used for the x axis and Y CH receives the height in vertical world coordinates as used for the y axis Unless special care has been taken to achive equal world coordinate scales on both axes the values of XCH and YCH will be different If UNIT S 0 XCH receives the character height as a fraction of the horizontal dimension of the view surface and Y CH receives the character height as a fraction of the vertical dimension of the view surface PGQDT inquire narre of nth available device type void cpgqdt int n char type int type_length char descr int descr_length int inter SUBROUTINE PGQDT N TYPE TLEN DESCR DLEN INT ER INTEGERN CHARACT ER TYPE DESCR INTEGERTLEN DLEN INTER Return the nan of the Nth available device type as a character string T he number o
110. 4 1 3 U1 Sun F ortran f77 1 3 1 GNU C gcc 2 7 0 tested on SPARC 5 e Solaris 2 5 SunOS 5 5 Sun F ortran 77 3 0 1 Sun C cc 3 0 1 tested on SPARC IPX e Solaris 2 5 SunOS 5 5 Sun F ortran f77 3 0 1 GNU C gcc 2 7 2 tested on SPARC IPX SPARC Ultra 1 e OpenVMS AXP V6 1 DEC FORT RAN V6 2 DEC C V4 0 DE Cwindows Motif 1 1 tested on DEC 3000 M 600 e OpenVMS VAX V6 1 DEC FORT RAN V6 2 DEC C V4 0 DE Cwindows Motif 1 2 tested on V AXstation 4000 90 Changes in Version 5 1 1 All changes are bug fixes or minor improverrents T he most notable bug fixes are e PGOPEN PGBEG a device specification like question mark with one or more trailing Spaces causes PGOPEN to issue a blank prompt for device specification T his was an unintended change in 5 1 0 and has been fixed in version 5 1 1 e PGBEG in version 5 1 0 the ordering of panels changed fromrow order to colunn order T he way the sign of the NXSUB argument was interpreted was precisely the opposite of the docurrented interpretation NXSUB gt 0 should give row order and lt 0 should give colunn order PGSUBP has always been wrong but PGBEG acquired the incorrect behavior in version 5 1 0 Both PGBEG and PGSUBP now behave as docurrented e hePostScript driver was ignoring environment variables used to set the paper size It now recognizes these variables In addition it will accept requests via routine PGPAP to change the paper size even if the s
111. 4 112 112 112 grey44 115 115 115 gray45 115 115 115 grey45 117 117 117 gray46 117 117 117 grey 46 120 120 120 gray47 120 120 120 grey47 122 122 122 gray48 122 122 122 grey48 125 125 125 gray49 125 125 125 grey49 127 127 127 gray50 127 127 127 grey50 130 130 130 gray51 130 130 130 grey51 133 133 133 gray52 133 133 133 grey52 135 135 135 gray53 135 135 135 grey53 138 138 138 gray54 138 138 138 grey54 140 140 140 gray55 140 140 140 grey55 143 143 143 gray56 143 143 143 grey56 145 145 145 gray57 145 145 145 grey57 148 148 148 gray58 148 148 148 grey58 150 150 150 gray59 150 150 150 grey59 153 153 153 gray60 153 153 153 grey60 156 156 156 gray61 156 156 156 grey61 158 158 158 gray62 158 158 158 grey62 161 161 161 gray63 161 161 161 grey63 163 163 163 gray64 163 163 163 grey64 166 166 166 gray65 166 166 166 grey65 168 168 168 gray66 168 168 168 grey66 171 171 171 gray67 171 171 171 grey67 173 173 173 gray68 173 173 173 grey68 176 176 176 gray69 176 176 176 grey69 179 179 179 gray 70 179 179 179 grey70 181 181 181 gray71 181 181 181 grey 71 184 184 184 gray72 184 184 184 grey 72 186 186 186 gray73 186 186 186 grey 73 189 189 189 gray74 189 189 189 grey 74 191 191 191 gray 75 191 191 191 grey 75 194 194 194 gray 76 194 194 194 grey 76 196 196 196 gray77 196 196 196 grey 77 199 199 199 gray78 199 199 199 grey 78 201 201 201 gray 79 201 201 201 grey 79 204 204 204 gray80 204 204 204 grey80 207 207 207 gray81 207 207 207 grey81 209 209 209 gray82 209 209 209 grey82 2
112. 76 vary ey 26a vary ear 2yo4 2705 2706 Peay 2708 20g 2713 2714 27415 2716 2717 2718 2715 a 7 R amp oars E724 e 2726 cee 272 ia FF H Z E 272 272 2723 2724 2725 2726 Bray 2728 272 Pray x F FI o PGPLOT TimPearson California Institute of Technology t p stro caltech edu Copyright 1995 California Institute of Technology Figure B 7 PGPLOT Symbols vo Ln vege A 27RD oar 2A vee ie 2AA PRG varia yay 07 2 a 4s 5 amp I 7 2758 2759 27 eo year OBE 2763 oy b4 2766 27EG eyes a tee Ue tate le eemaliicetee wees E relives 2768 eae a ar i ar rE eer oy eye ea oye oe tr il ae if oh e E eye og RDT ed aa p ed oa ved aE 2 BOE ed aT ROT ed n P Hs e ee e cabled eae ny oe gt ile line Bog 810 2811 PRIE BIS 814 28615 816 2B17 2818 HIIT EKR I HNI M I IHIOT THOHIPITIC p n Fak y oO L va 5 5D ao H 2 BI T 7 TF a Sy fo PS fi PS Ai fi fA Pe p a Pt PASO PASE z251 p Di AAS vedt pi e fi a AJG b A a S B T fii g p A a pa e D Fa a e Da ea a 2011 pa e i 2013 z014 2015 z016 E t E JI M H o II Sad z018 z015 ea et z021 P lee a ea z025 z226 P T y o x I 1 TI I epay epa 2pag 2030 z831 ved es h b E to a PGPLOT TimPearson California Institute of Technology tip stro caltech edu Copyright 1995 California Institute of Technology Calling PGPLOT froma C or C Program Introduction PGPLOT isaFortran subroutine library and
113. 9 California Institute of Technology PGPLOT Frequently Asked Questions OMNDUBRWNH PP PPP UBWNHEO Problems with subscripts superscripts and Greek letters Color Map Problems X Window Encapsulated PostScript Changing the Background Color License requirements for GIF Solaris can t find libpgplot so Why doesn t PGPLOT redraw the plot when the window size is changed Will PGPLOT ever do three dimensional graphics Will PGPLOT be rewritten to use F ortran 90 constructions Does PGPLOT havea Y 2K probler My compiler complains about use of V AL in some drivers CanPGPLOT be used ina Web based CGI application How do compile PGPLOT for Linux using the Absoft F ortran compiler Is there a double precision version of PGPL OT My publisher has requested that provide my PostScript color image in CMYK rather than RGB forrrat Can I do that with PGPL OT Problems with subscripts superscripts and Greek letters amtrying to use escape sequences for subscripts and superscripts and greek letters however the output is as follows call pglab h D ge ur d T E u011 a The y axis label turns out to be geurd and similar results occur for the title Many UNIX Fortran compilers treat a backslash in a literal Fortran string as a UNIX escape character converting n to the code for new line for example If you have one of these compilers and if yo
114. Attributes Figure 5 1 Default color representations of color indices 0 15 Figure 5 2 Fill area styles Chapter 6 Higher L evel Routines O O O s Introduction XY plots Histograms Functions of two variables Chapter 7 Interactive Graphics O O O O 7 1 Introduction 7 2 T he Cursor 7 3 Using the Cursor 7 4 Buffering Appendix A Subroutine Descriptions Appendix B PGPLOT Symbols O O B 1 Character Encoding B 2 Additional Symbols Figure B 0 Character Encoding Figure B 1 Symbols 1 527 Figure B 2 Symbols 528 713 Figure B 3 Symbols 714 2017 Figure B 4 Symbols 2018 2192 Figure B 5 Symbols 2193 2400 Figure B 6 Symbols 2401 2747 Figure B 7 Symbols 2748 2932 e Appendix C Calling PGPLOT froma C Program O O C 1 Introduction C 2 Using the CPGPLOT library o C 3 Limitations o C 4 Other Machine Dependencies o C 5 Examples e Appendix D Supported Devices o Introduction o Available Devices e Appendix E Writing a Device Handler E 1 Introduction E 2 T he device dispatch routine GRE XEC E 3 Device handler interface E 4 Handler state E 5 Summary of operations O 0 0 0 0 e Appendix F Installation Instructions e Appendix G Porting PGPLOT o G 1 General Notes o G 2 Porting to UNIX systers TimPearson California Institute of Technology tjp stro caltech edu Copyright 1995 6 California Institute of Technology Acknowledgments Many people have contri
115. D or X Routine PGBAND is similar to PGCURS but has additi onal options that request that a visible line rubber band or rectangle join the cursor position to a fixed point and track it as it moves T hese options are not available on every device that supports a cursor In addition PGPLOT provides three higher level routines for cursor input PGOLIN PGNCUR and PGL CUR T hese three routines require that the device has erase capability PGOLIN allows the user to specify a set of points within the viewport with the capability of correcting mistakes Interactive conrrands single characters A D or X typed on the keyboard allow the user to adda point at the current cursor position de ete the last entered point or exit fromthe subroutine T he world coordinates of the entered points are returned to the calling program T he following programfragrrent illustrates the use of PGOL IN the user supplies NPT up to 50 points with world coordi nates X and Y and the programthen shades the polygon defined by these points by calling PGPOLY INT EGER NPT REAL X 50 Y 50 WRIT E 6 Use the cursor to draw a polygon WRIT E 6 T ype A to add point D to delete X to exit NPT 0 CALL PGOLIN 50 NPT X Y 0 IF NPT GE 3 CALL PGPOLY NPT X Y PGNCUR is similar to PGOLIN but the points are sorted into increasing order of x before being returned to the calling program In addition the delete command deletes the point
116. E F PGBIND MAK T his will create cpgplot lib and cpgplot h T he makefile compiles pgbind c no unusual compiler flags are needed to produce the pgbind program It then produces the C wrapper functions one file per wrapper and the cpgplot h header file using pgbind ms w h pgbind_prototypes T he cpg c files are then compiled and gathered into a library T o use cpgplot in your programs you should include cpgplot h at the top of all C files that use cpgplot functions and link your programs with both of cpgplot lib and pgplot lib F or further information about using the C binding see file PGP LOT CPG CPGPL OT DOC or the Web page http www astro caltech edu tj p pgpl ot cbinding htm PGPLOT T imPearson California Institute of Technology tipo stro caltech edu Copyright 1997 2002 California Institute of Technology PGPLOT Installation Instructions GNU Win32 T he GNU Win32 tools are ports of the popular GNU development tools to Windows NT 95 for the x86 and PowerPC processors Toinstall PGPLOT inthis environment using g77 and gcc follow the UNIX installation instructions using the following configuration file Better support will be provided in a future version of PGPLOT The GNU g77 FORT RAN compiler and Gnu gcc C compiler EE E E E T XINCL MOTIF_INCL F COMPL g77 FFLAGC Wall O F FLAGD fno backsl ash CCOMPL gcc CFLAGC DPG_PPU O2 CFLAGD O2 PGBIND_FLAGS bsd LIBS
117. F M file forrrat T he files are output as FORT RAN DIRECT ACCESS UNF ORMATT ED 512 BYT E RECORDS so that we can have compatability with the VAX and our UNIX machine A raw bitmap copy is also possible if you define the logical PGPLOT_T X_BIT FILE DEFINE PGPLOT_TX_BITFILE MINIMAL will produce a file copy of the portion of the bitmap which is within the minimal bounding box of the character DEFINE PGPLOT_TX_BITFILE ALL will produce a file copy of the complete bitrrap of the graphics character Obtaining hardcopy Use the command DUMP to view the output files or run T eX and include the character of this new font and DVI the output and print the resulting binary file to the correct printer with PASSALL NOFEED or whatever is required for printing binary output to your specific printer Also the PKT YPE and TFT OPL T eX debugging programs will allow you to view your output font characteristics T eX Example Assure you have produced a graph into a PK Font and that the output file names are popl ot 300pk and pgpl ot tfmthen the following lines in your T eX code would include the graph corresponding to the letter A of the T eX PK font PGPLOT inthe middle of your paper font myfntname pgpl ot This is sentence one of the T eX file Now will include the character centerline myfntnarre A This is the last sentence bye T he above example for LaT eX would be T his is the first sentence Now will include the char
118. F ortran REAL All floating point arguments passed to PGPLOT routines should be of type REAL not DOUBLE PRECISION or REAL 8 for exarple Higher precision is not needed internally by PGPLOT given the limited resolution of nost graphics devices If the data that you wish to plot are DOUBLE PRECISION quantities you need to convert themto REAL before passing themto PGPL OT If this is very inconvenient you can in principle compile PGPLOT in double precision some F ortran compilers have an option to do this but you also need to change the C support routines so do not recommend this T he above remarks apply to F ortran for C arguments should be float not double In some cases the function prototypes will direct the C compiler to autormatically convert double to float for you but this does not happen with array arguments may in future distribute two versions of the library for REAL and DOUBLE PRECISION if do the double precision routines would have different names My publisher has requested that provide my PostScript color image in CMYK rather than RGB format Can I do that with PGPL OT PGPLOT uses the device RGB color model in PostScript files All PostScript interpreters should convert RGB to CMYK when the output device requires it so there is no real need for a CMYK option in PGPLOT Sore publishers prefer CMYK because they believe that it gives better color fidelity However consistency of color is difficult to achi
119. Font file Supported device PK Font files for T ex Device type code MX Default file names popl ot RE Spk pgplot tfmwhere the RES is a default value of 300 but may be set to something else If RES 300 then the default file names would be pgpl ot 300pk and pgplot tfm If more than 15 font characters are produced then the file names become pgplot_2 300pk and pgplot_2 tfm etc for each set of 15 characters output i e for each PK font produced Default view surface dimensions 2 8 x 2 8inches May be overridden by the environment variables PGPLOT_TX_YINCHES and PGPLOT_TX_XINCHES DEFINE PGPLOT_T X_XINCHES 5 0 DEFINE PGPLOT_T X_YINCHES 4 5 would provide a view surface of 5 0 inches horizontally by 4 5 inches vertically Resolution 300 dots per inch May be overridden by the logicals PGPLOT _T X_XRESOL and PGPLOT_TX_YRESOL DEFINE PGPLOT_T X_XRESOL 78 0 DEFINE PGPLOT_T X_YRESOL 78 0 will produce a font at 78 dots per inch resolution T his would be good for a V axstation 2000 workstation T he default 300 dots per inch is good for a laser printer such as a QMS1200 L aserGrafix or an HP 2000 L aser et Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Output Orientation Portrait Can be overridden by setting the environment variable PGPLOT_T X_ORIENT LANDSCAPE Input capability None File forrrats TeX PK Font file fornet and T eX T
120. GPAP T he maxinmumsize is limited only by available merory Resolution PGPLOT assurres that the device resolution is 85 pixels inch but the actual resolution will vary depending on the display device Color capability Color indices 0 255 are accepted with standard defaults for color indices 0 15 If the color representation of a color index is changed it affects only pixels drawn subsequently so the nunber of different colors that can be used in an image is not limited to 256 Input capability None Environment variables PGPLOT_PPM_WIDT H width of image in pixels default 850 PGPLOT_PPM_HEIGHT height of image in pixels default 680 File format PPM files are binary files Author Renko Scharroo T imPearson 1994 PGPLOT driver for PostScript printers T he PostScript page description language is widely used for desktop publishing PostScript files can be printed on many laser printers and photo typesetters and they can also be viewed on nost workstations e g use ghostview on UNIX workstations pageview on Sun workstations view format ps interface decw on VMS workstations A single page PGPLOT PostScript file is valid encapsulated P ostScript and can be included in another file by way of a page composition program PGPLOT generates evel 1 PostScript which is accepted by all PostScript printers PostScript is a traderrark of Adobe Systerrs Incorporated Device type code PS monochrome landscape mode long edge of paper ho
121. IL O Argurrents ICILO input the lowest color index to use for images ICIHI input the highest color index to use for images PGSCLP enable or disable clipping at edge of viewport void cpgscl p int state SUBROUTINE PGSCLP STATE INTEGERSTATE Normally all PGPLOT primitives except text are clipped at the edge of the viewport parts of the pri miti ves that lie outside the viewport are not drawn If clipping is disabled by calling this routine primitives are visible wherever they lie on the view surface T he default clipping enabled is appropriate for almost all applications Argurrent STATE input Oto disable clipping or 1 to enable clipping 25 F eb 1997 T J P new routine PGSCR set color representation void cpgscr int ci float cr float cg float cb SUBROUT INE PGSCR Cl CR CG CB INT EGER Cl REAL CR CG CB Set color representation i e define the color to be associated with a color index Ignored for devices which do not support variable color or intensity Color indices 0 15 have predefined color representations see the PGPLOT manual but these may be changed with PGSCR Color indices 16 maximumhave no predefined representations if these indices are used PGSCR must be called to define the representation On monochrome output devices e g VT 125 terminals with monochrorre monitors the monochrore intensity is computed fromthe specified Red Green Blue intensities as
122. LAB Frequency gn GHz 1 Flux Density S d gn u J y DO 101 1 15 XPT S I ALOG10 F REQ I YPT S 1 AL OG10 F LUX 1 10 CONT INUE CALL PGPT 15 XPTS YPTS 17 Thisis a fragment of a programto draw the spectrumof a radio source which is usually plotted as alog log plot of flux density v frequency It first calls PGENV to initialize the viewport and window the AXIS argument is 30 so both axes will be logarithrric T he x axis frequency runs from0 01 to 100 GHz the y axis flux density runs from0 3 to 300 y Note that it is necessary to specify the logarithms of these limits in the call to PGENV T he penultimate argument requests equal scales in x and y so that slopes will be correct T he programthen marks 15 data points suppl ying the ogarithms of frequency and flux density to PGPT Histograms T he routine PGHIST draws a histogram that is the frequency distribution of measured values ina dataset Suppose we have 500 measurements of a quantity the sky brightness temperature at 20 GHz say in mK stored in Fortran array VALUES T he following program fragment draws a histogramof the distribution of these values in the range 0 0 to 5 0 using 25 bins so that each bin is 0 2 K wide the first running from0 0 to 0 2 the second from0 2 to 0 4 etc DO 10 1 1 500 VALUES I 10 CONT INUE CALL PGHIST 500 VALUES 0 00 5 00 25 0 CALL PGLAB T erperature K 1 Number of measurements 2 Sky Brigh
123. LOT attributes void cpgunsa void ENT RY PGUNSA T his routine restores the PGPLOT attributes saved in the last call to PGSAVE Usage CALL PGUNSA no arguments See PGSAVE Arguments none PGSCF set character font void cpgscf int font SUBROUTINE PGSCF F ONT INTEGER FONT Set the Character F ont for subsequent text plotting F our different fonts are available 1 default a simple single stroke font norrral font 2 roman font 3 italic font 4 script font T his call determines which font is in effect at the beginning of each text string T he font can be changed terporarily within a text string by using the escape sequences fn fr fi and fs for fonts 1 2 3 and 4 respectively Argurrent FONT input the font nurrber to be used for subsequent text plotting in range 1 4 PGSCH set character height void cpgsch float size SUBROUTINE PGSCH SIZE REAL SIZE Set the character size attribute T he size affects all text and graph markers drawn later in the program T he default character size is 1 0 corresponding to a character height about 1 40 the hei ght of the view surface Changing the character size also scales the length of tick marks drawn by PGBOX and terminals drawn by PGERRX and PGERRY Argument SIZE input new character size dimensionless multiple of the default size PGSCI set color index void cpgsci int ci SUBROUTINE PGSCI Cl INTEGER Cl Set the Col
124. N PGPAGE will type T ype RET URN for next page and will wait for the user to type a carriage return before starting a new page T he initial prompt state after the device has been opened is ON for interactive devices Prompt state is always OFF for non interactive devices Argurrents FLAG input if TRUE and if the device is an interactive device the prompt state will be set to ON If FALSE the prompt state will be set to OFF PGAXIS draw an axis void cpgaxis const char opt float x1 float y1 float x2 float y2 float v1 float v2 float step int nsub float drrgjl float dr jr float fmin float disp float orient SUBROUTINE PGAXIS OPT X1 Y1 X2 Y2 V1 V2 STEP NSUB DMAJ L DMAJ R F MIN DISP ORIENT CHARACT ER OPT REAL X1 Y1 X2 Y2 V1 V2 STEP DMAJ L DMAJ R FMIN DISP REAL ORIENT INT EGER NSUB Draw a labelled graph axis fromworld coordinate position X1 Y 1 to X2 Y 2 Normally this routine draws a standard LINEAR axis with equal subdivisions T he quantity described by the axis runs fromV 1 to V 2 this may be but need not be the sarre as X or Y If the L option is specified the routine draws aL OGARIT HMIC axis In this case the quantity described by the axis runs from 10 V 1 to 10 V 2 A logarithmic axis always has n jor labeled tick marks spaced by one or more decades If the major tick marks are spaced by one decade as specified by the ST EP argument the
125. ONT DAT GRPCKG OLB GRPSHR E XE GRPSHR OLB PGDE MOLEXE PGDEMOI16 EXE PGXWIN_SERVER EXE RGB T XT T he script assumes that you have the current DEC F ortran and C compilers installed A C compiler is required for XWDRIV and X2DRIV and the associated progrars PGXWIN_ SERVER and PGDISP and for generating the C wrapper library CPGPLOT OLB If you don t have the DEC C compiler the script will have to be modified T he script may fail if you redefine any of the conmon DCL commands like PURGE or DELETE Note Demonstration program pgdenw14 is compiled incorrectly by the DEC F ortran 6 2 compiler when optimization is enabled the symptomis that the labels like Number of V ertices do not appear on the screen T he problemis solved by disabling optimization 6 Compile the optional components C wrapper library T o install the optional C wrapper library proceed as follows USR LOCAL PGPLOT SYS _VMSlinstall USR LOCAL PGPLOT CPG T his creates three files CPGPLOT H ANSI C header file CPGPLOT OLB library containing the C binding CPGDEMO EXE deronstration program PGDISP program The PGDISP programis required if you selected the XDISP device driver Use of this driver is not recommended you should use the standard X Window driver XWIN or XSERV instead USR LOCAL PGPLOT SYS _VMSlinstall USR LOCAL PGPLOT PGDISP This adds one file PGDISP EXE T he PGDISP programsonwti mes gives compilation problems Most
126. OT OLB The PGPLOT C wrapper library and the static version of the main PGPLOT library T he shareable PGPLOT library can not be used when the Motif driver is required XMOTIF OPT T his file can be used to link PGPLOT applications that use the XnP gplot widget driver It is a linker options file that lists the PGPLOT Motif X toolkit and X11 libraries It should be used like LINK PROGRAM PGPLOT _DIR PGMOTIF OPT OPT Configuration T he configuration of individual widgets is controlled by X resources It is usually most convenient to set such resources in the call to XtV aCreateM anagedWi dget when each PGPLOT widget is created but they can also be placed in app defaults files or on POSIX compliant systems the Xdefaults file in your horre directory Under VMS this fileis called DECW USER_DEFAULT S DECW XDEFAULT S DAT Note that by default DECW USER_DEFAULT S is defined as SYS L OGIN Configuration of the widget colormap and visual XnP oplot widgets allocate colors fromthe Visual and Colormap specified via the XrmNcolormap and XmNvisual resources T hese default to CopyF ron arent as they do in nost other widgets As a result XnPgplot widgets normally allocate colors fromthe default colormap and visual of the screen If the default colormap of the screen is insufficient for your needs and you need to allocate a private colormap then suggest that you register the result with the top level widget of the application rather than with
127. On interactive devices clear the screen only if requested Deallocate buffers that were created by begin picture OPCODE 11 Pararreters passed to handler e RBUF 1 if not 0 0 clear screen OPCODE 15 Set color index Set the color index for subsequent plotting T he default color index is 1 Pararreters passed to handler e RBUF 1 color index in range defined by OPCODE 2 OPCODE 16 Flush buffer If the handler is buffering output to an interactive device it should flush its buffers to ensure that the displayed image is up to date Hardcopy devices can ignore this opcode OPCODE 17 Read cursor T his function is not used if OP CODE 4 indicates that the device has no cursor T he handler should make the cursor visible at position x y allow the user to move the cursor and wait for a key stroke It should then return the new cursor x y position and the character key stroke typed If it is not possible to make the cursor visible at a particular position the handler may ignore the requested x y coordinates On a device with a mouse or similar device clicking mouse button 1 should return character A mouse button 2 should return D and mouse button 3 should return X If the hardware permits the handler should interpret the mode as specified in the description of routine PGBAND T he exact appearance of the dynamic rubber band lines may be hardware specific if possible they should be drawn w
128. PAGE is called clearing the screen or starting a new page when the last panel has been used It is also possible to jump fromone panel to another in randomorder by calling PGPANL Argurrents NXSUB input the nurrber of subdivisions of the view surface in X gt O or lt NY SUB input the nurrber of subdivisions of the view surface in Y gt 0 PGSVP set viewport norrralized device coordi nates void cpgsvp float xleft float xright float ybot float ytop SUBROUTINE PGSVP XLEFT XRIGHT YBOT YT OP REAL XLEFT XRIGHT YBOT YT OP Change the size and position of the viewport specifying the viewport in normalized device coordinates Norrrelized device coordinates run from0 to lin each dimension T he viewport is the rectangle on the view surface through which one views the graph All the PG routines which plot lines etc plot themwithin the viewport and lines are truncated at the edge of the viewport except for axes labels etc drawn with PGBOX or PGLAB T he region of world space the coordinate space of the graph which is visible through the viewport is specified by acall to PGSWIN Itis legal to request a viewport larger than the view surface only the part which appears on the view surface will be plotted Argurrents XLEFT input x coordinate of left hand edge of viewport in NDC XRIGHT input x coordinate of right hand edge of viewport in NDC YBOT input y coordinate of bottomedge of view
129. PGBEG instead Returns PGOPEN returns either a positive value the identifier of the graphics device for use with PGSLCT or aOor negative value indicating an error In the event of error a message iS written on the standard error unit Argurrents DEVICE input the device specification for the plot device see above PGPAGE advance to new page void cpgpage void SUBROUTINE PGPAGE Advance plotter to a new page or panel clearing the screen if necessary If the prompt state is ON see PGASK confirmation is requested fromthe user before clearing the screen If the view surface has been subdivided into panels with PGBEG or PGSUBP then PGPAGE advances to the next panel and if the current panel is the last on the page PGPAGE clears the screen or starts a new sheet of paper PGPAGE does not change the PGPLOT window or the viewport in normalized device coordinates but note that if the size of the view surface is changed externally e g by a workstation window manager the size of the viewport is changed in proportion Arguments none PGPANL switch to a different panel on the view surface void cpgpanl int nxc int nyc SUBROUTINE PGPANL IX IY INTEGER IX IY Start plotting in a different panel If the view surface has been divided into panels by PGBEG or PGSUBP this routine can be used to move to a different panel Note that PGPLOT does not remember what viewport and window were in use in
130. PGDE MO5 and PGDE MO6 9 Plots can be clipped and copied to other applications such as Word Unfortunately black is black and white is white so printing uses a lot of ink and the white lines tend to disappear One option is to exchange palette colors O and 1inPGPLOT with CALL PGSCR 0 1 1 1 black becomes white CALL PGSCR 1 0 0 0 white becon s black before making the version to be printed another is to cut and paste to a utility I use Paint Shop Pro in which you can adjust the color palette and a third way is to specify either the filenare ps PS or filename gif GI device and write a file Note this might bea good use for a custommenu entry in your application Yet another option is to create a second device window and change the color palette only in that window See PGDEMO13 for an example of multiple simultaneous windows 10 Finally this port has been thoroughly tested starting with earlier versions of PGPLOT and using the Microsoft compiler but no responsibility for any damages is accepted by either PAS CT D or even TJ P User input concerning features of the driver or this docurrent is welcomed F requently Asked Questions A A window is created but nothing appears in it Most new graphics driver cards do not errulate color registers when they run in T rue Color 32 bit mode Y ou will have to reset the Display Properties Settings tab to a srraller number of colors such a
131. PGPLOT Graphics Subroutine Library T J Pearson Copyright 1988 1997 by California Institute of T echnology Contents e Acknowledgments e Chapter 1 Introduction O O O O O 1 1PGPLOT 1 2 T his Manual 1 3 Using PGPLOT 1 4 Graphics Devices 1 5 Environrrent V ariables e Chapter 2 Simple Use of PGPLOT O 0000 0 00 0 0 0 2 1 Introduction 2 2 An Example 2 3 Data Initialization 2 4 Starting PGPLOT 2 5 Defining Plot Scales and Drawing Axes 2 6 Labeling the Axes 2 7 Drawing Graph Markers 2 8 Drawing Lines 2 9 Ending the Plot 2 10 Compiling and Running the Program Figure 2 1 Output of Example Program e Chapter 3 Windows and Viewports a O O 2 O 2 3 1 Introduction 3 2 Selecting a View Surface 3 3 Defining the V iewport 3 4 Defining the Window 3 5 Annotating the V iewport 3 6 Routine PGENV e Chapter 4 Primitives O O O O O 4 1 Introduction 4 2 Clipping 4 3 Lines 4 4 Graph Markers 4 5 T ext O O 4 6Area Fill Polygons Rectangles and Circles Figure 4 1 PGPLOT standard graph nerkers Figure 4 2 T ext Examples Figure 4 3 Escape Sequences for Greek L etters e Chapter 5 Attributes Or 0000000 0 0 0 0 O 5 1 Introducti on 5 2 Color Index 5 3 Color Representation 5 4 Line Style 5 5 Line Width 5 6 Character Height 5 6 Character F ont 5 7 T ext Background 5 8 Fill Area Style 5 9T he Inquiry Routines 5 10 Saving and Restoring
132. PLOT the reported world coordinates will be 0 0 0 0 T he function arguments are Widget widget The target PGPLOT widget int px py T he pixel coordinates to be converted T hese are interpretted with respect to the origin at the top left corner of the widget window T his is the normal coordinate system used by X windows float wx wy On output the variables pointed to by wx and wy will be assigned the PGPLOT world coordinates that correspond to pixel px py T he function returns 0 on success or 1 if the widget is invalid int xnp_world_to_pixel widget wx wy px py T his function takes the PGPLOT world coordinates of a point on the viewsurface of aPGPLOT widget and returns the X window coordinates of the nearest pixel If the widget is not open to PGPLOT the reported coordinates will be 0 0 T he function arguments are Widget widget The target PGPLOT widget float wx wy The PGPLOT world coordinates to be converted int px py On output the variables pointed to by px and py will be assigned the X window coordinates of the pixel nearest to world coordinate wx wy T he function returns 0 on success or 1 if the widget is invalid Widget identification functions T wo convenience functions are provided for determining the nane and PGPLOT id associated with a particular PGPLOT widget int xmp_device_name Widget widget T his function returns a device narre string suitable for use with the cpgopen or cpgbeq functions
133. QFS inquire fill area style e PGSHS set hatching style e PGQHS inquire hatching style Arrow Attributes e PGSAH set arrow head style e PGQAH inquire arrow head style Saving and Restoring Attributes e PGSAVE save PGPLOT attributes e PGUNSA restore PGPLOT attributes Axes Boxes and L abels To label a graph with axes or a box around the viewport use PGBOX or PGT BOX if one or both coordinates are to be treated as a time or angle More complete control over axes is possible with PGAXIS including drawing axes that are not parallel to the edges of the viewport If you need complete control over how an axis is labeled e g for non linear or curved axes draw the axis with line drawing routines and then label it with PGTICK e PGBOxX draw labeled frame around viewport e PGT BOX draw frame and write DD HH MM SS S labelling e PGAXIS draw an axis New in version 5 2 e PGTICK draw asingle tick mark on an axis New in version 5 2 To place labels around the edges of the viewport use PGL AB or PGMT XT e PGLAB write labels for x axis y axis and top of plot e PGMTXT write text at position relative to viewport XY Plots Error Bars e PGERRB horizontal or vertical error bars e PGERR1 single horizontal or vertical error bar New in version 5 2 e PGERRX horizontal error bars e PGERRY vertical error bars Curves Defined by F unctions e PGFUNT function defined by X F T Y G T e PGFUNX function
134. R Should be at least 10 Additional characters are assumed to be N if they are not supplied by the driver e CHR 1 1 H if the deviceis a hardcopy device l if it is an interactive device On an interactive device the image is visible as it is being drawn while on a hardcopy device it cannot be viewed until the workstation is closed e CHR 2 2 C if a cursor is available X if a cursor is available and opcode 27 is accepted by the handler N if there is no cursor PGPLOT cannot emulate a cursor if none is available e CHR 3 3 D if the hardware can draw dashed lines N if it cannot PGPLOT emulates dashed lines by drawing line segments Software emulation is usually superior to hardware dashed lines and not much slower so CHR 3 3 N is recommended e CHR 4 4 A if the hardware can fill arbitrary polygons with solid color N if it cannot PGPLOT emulates polygon fill by drawing horizontal or vertical lines spaced by the pen diarreter see OPCODE 3 e CHR 5 5 T if the hardware can draw lines of variable width N if it cannot PGP LOT emulates thick lines by drawing multiple strokes Note that thick lines are supposed to have rounded ends as if they had been drawn by a circular nib of the specified di ameter e CHR 6 6 R if the hardware can fill rectangles with solid color N if it cannot If this feature is not available PGPLOT will treat the rectangle as an arbitrary polygon In this context a
135. R E XE with complete directory information e g define GRPSHR PGPLOT _DIR GRPSHR EXE If this logical narre is not defined RUN will look for GRPSHR EXE inthe systemlibrary directory SY S LIBRARY PGPLOT_DIR T his is the nan of the directory in which PGPLOT will look for the files grfont dat and rgb txt unless logical names PGPLOT FONT and PGPLOT _RGB are defined to override this default behavior and if needed the X window server programpgxwin_ server define PGPLOT_DIR USR LOCAL PGBIN PGPLOT_ DEV It is also convenient but not essential to define a default PGPLOT device with logical nane PGPLOT _DEV eg define PGPLOT_DEV xwin LNK LIBRARY If you develop PGPLOT prograns you can arrange for the linker to autorratically scan the PGPLOT library by naming GRPSHR OLB in one of the LNK LIBRARY logical narres e g define LNK LIBRARY PGPLOT_DIR GRPSHR OLB If you do not do this you will need to include this library note GRPSHR OLB not GRPSHR EXE in your LINK commands Other PGPLOT logical names environment variables are described in the manual 8 Run the demonstration programs Run the demonstration prograns on your selected devices and verify that they run satisfactorily T o run a program use the RUN conrrand run pgdenw1 run pgdenw2 run cpgdeno optional component run pgmdeno optional component All the demonstration programs prompt for a device nan and type T ype a question merk
136. REGROUND T he values of these variables are color nares as used by routine PGSCRN F or exanple to ensure that all devices use a black foreground on a white background on a UNIX system type setenv PGPLOT _FOREGROUND black setenv PGPLOT BACKGROUND white before running the PGPLOT program Or you can be nore creative e g setenv PGPLOT FOREGROUND gold setenv PGPLOT BACKGROUND slategrey On direct color devices e g PostScript it is necessary to fill the view surface with the background color by calling routine PGERAS for a change in color representation to affect the whole view surface 5 4 Line Style Line Style can be e g solid dashed or dotted T he attribute affects only lines not the other primitives It is controlled by subroutine PGSLS T he default line style is a full unbroken line Line styleis described by an integer code e 1 full line e 2 long dashes e 3 dash dot dash dot e 4 dotted e 5 dash dot dot dot To change the line style use routine PGSLS For example to draw a dashed line CALL PGSLS 2 CALL PGLINE 620 X Y CALL PGSLS 1 5 5 Line Width Line Width affects lines graph markers and text It is specified with routineP GSLS which takes an integer argument specifying the line width rmultil pier T he exact appearance of thick lines is device dependent it depends on the resol ution of the device but on most devices PGPL OT attempts to make the line width unit equal to 0 005
137. RGL UN get a F ortran logical unit number GRGMENM allocate menory GRGMSG print system message GRIBF 1 fill buffer with a specified character GROPT X open input output text file GRSY 00 initialize font definition GRT ERMIO routines GROT ER GRCT ER GRWT ER GRPT ER GRRT ER for I O to terminals GRT RML get narre of user s terminal o GRTTER test whether device is user s terminal GRUSER get user name 3 T he device dispatch routine grexec f T his routine includes calls to all the sel ected device drivers It is the only routine that needs to be modified to configure PGPLOT fora particular installation It is usally generated automatically fromdrivers list For more information about this routine see Appendix E 4 The device drivers Most device drivers are included in single files in the pgplot drivers directory with file name XXdriv f or XXdriv c Some C drivers require additional c or h files The drivers you wish to include in PGPLOT should be compiled and added to the object library Many of the device drivers are written in portable standard F ortran 77 but others cannot be written portably and either use F ortran 77 with extensions such as BYTE and VAL or C Some of the older drivers are sloppily written and could be rade more portable F or driver written in C it is necessary to pay careful attention to the system dependent conventions for calling C subroutines fromF ortran progran G
138. Representation in the RGB System Use routine PGSCR which requires red green and blue values in the range 0 0 dark to 1 0 maxi mumintensity T he following example changes color index 2 to dark blue CALL PGSCR 2 0 0 0 0 0 3 Note that most devices do not have an infinite range of colors or monochrorre intensities avail able the nearest available color is used Examples for black set R G B 0 0 for white set R G B 1 0 for mediumgray set R G B 0 5 for mediumyellow set R G 0 5 B 0 0 Setting Color Representation in the HLS System The HLS or Hue Saturation Lightness systemis an alternative to RGB for specifying color representation Use routine PGSHLS instead of PGSCR Hue is represented by an angle in degrees with red at 120 green at 240 and blue at 0 or 360 Lightness ranges from0 0 to 1 0 with black at lightness 0 0 and white at lightness 1 0 Saturation ranges from0 0 gray to 1 0 pure color Hue is irrelevant when saturation is 0 0 Examples H L S R G B black any 0 0 0 0 0 0 0 0 0 0 white any 1 0 0 0 10 10 10 mediumgray any 0 5 0 0 0 5 0 5 0 5 red 120 0 5 1 0 10 00 0 0 yellow 180 0 5 10 10 10 0 0 pink 120 0 7 0 8 0 94 0 46 0 46 Reference SIGGRAPH Status Report of the Graphic Standards Planning Conmittee Computer Graphics V ol 13 No 3 Association for Computing Machinery New Y ork NY 1979 See also J D Foley et al Computer Graphics Principles and Practice second edition Add
139. S2 2 Supported device Canon L aserShot LIPS2 2 Conforms to SO646 2022 2375 and 6429 specifications V DM graphics conforms to proposed Arrerican National Standard V DM mode Device type code LIPS2 landscape V LIP S2 portrait Default file name PGPLOT LPS Default view surface dimensions 23 cmby 18 cm landcsape 18 cmby 23 cm portrait Resolution 240 pixels per inch in both directions Color capability Color indices 0 erase and 1 black are supported Note hardware polygon fill is used and colors 0 11 control the fill pattern Input capability None File format V ariable length text records Obtaining hardcopy Use lpr unix or print dos command Author M Harrabe 1994 DEC LJ 250 Color Companion Printer Supported device DEC LJ 250 Color Companion printer Device type code CCP portrait or CCL landscape Note T o choose portrait mode you must execute a DCL command of the following form before executing your program DEFINE PGPLOT_CC_MODE PORTRAIT Default device name PGPLOT CCPLT Default view surface dimensions 8 0 inches by 10 5 inches Resolution 90 dots inch Color capability Color indices 0 15 are supported It is not yet possible to change color representation Input capability None File format DEC color sixel format Obtaining hardcopy Use the VMS PRINT commend Author S C Allendorf 1989 DEC Sixel Printers LA50 Supported device DEC LA50 printer may also wor
140. T attempt to send grayscale plots to the drivers that use the optimized bitmap dumps T errible things will happen Printronix Printers Supported device Printronix P 300 or P600 dot matrix printer Device type code PRINT RONIX Default device name PGPLOT PXPLOT Default view surface dimensions 13 2 in horizontal by 10 25 in vertical Resolution 60 x x 72 y pixels inch Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Input capability None File format Variable length records maximum 135 bytes with embedded carriage control characters A full page plot occupies 200 512 byte blocks Obtaining hardcopy VMS Use the command PRINT PASSALL Author T J Pearson 1987 QUIC Printers Supported device Any printer that accepts the QUIC page description language QMS and T alaris 800 1200 1500 2400 4 bit mode is used Device type code QMS landscape orientation V QMS portrait orientation Default file name PGPLOT QMPLOT PGPLOT QPPLOT Default view surface dimensions 10 25 inches horizontal by 7 75 inches vertical landscape mode 7 75 inches vertical by 10 25 inches horizontal portrait mode margins of 0 5 inches on top and left of page Resolution T he driver uses coordinate increments of 1 1000 inch T he true resolution is device dependent it is typically 300 dots per inch Color capability Color indices 0 erase and 1 black are
141. T his is only required if any of the systemcode that you supply is written in Objective C F ew people have Objective C compilers so you should stick to using just C and FORT RAN if at all possi ble MFLAGC T he compiler flags to use with MCOMPL Note that this should not include the c or o options which are autorratically added where needed by the makerrake script Creating system dependent files While every effort was nade to write PGPLOT in standard FORT RAN 77 sorre routines particularly those that provide interfaces to terminals and other graphics devices had to be written using either FORT RAN extensions or C code V ersions of these routines that work on many systens are included in the pgplot sys directory When the makerake script looks for the systemdependent routines it looks first in the specific pgplot sys_ xxx directory then in the default pgplot sys directory so you can override one or more of the default versions by placing your own versions in the new systemdirectory T he new versions can bein C FORT RAN or if unavoidable Objective C postfixed with f c or mrespectivel y Points to consider when determining whether new versions of the default system routines are required include FORT RAN routines All of the f files in pgplot sys use FORT RAN extensions or rely upon unportable assumptions such as unforrratted I O record sizes If you are not familiar with the specifics of your FORT RAN compiler t
142. TEGERN REAL YMIN YMAX INTEGER PGFLAG Draw a curve defined by the equation X F X Y whereFY isa user supplied subroutine Argurrents FX external real function supplied by the user evaluates X value at a given Y coordinate N input the number of points required to define the curve T he function FX will be called N 1 times If PGF LAG 0 and N is greater than 1000 1000 will be used instead If N is less than 1 nothing will be drawn YMIN input the minimumvalue of Y YMAX input the maximumvalue of Y PGFLAG input if PGFLAG 1 the curve is plotted inthe current window and viewport if PGF LAG O PGENV is called autorratically by PGF UNY to start a new plot with Y limits YMIN YMAX and autorratic scaling in X Note T he function FX must be declared EXT ERNAL inthe F ortran programunit that calls PGFUNY It has one argurrent the y coordinate at which the x value is required e g REAL FUNCTION FX Y REAL Y PGGRAY gray scale map of a 2D data array void cpggray const float a int idim int jdim int i1 int i2 int j1 int j2 float fg float bg const float tr SUBROUTINE PGGRAY A IDIM J DIM 11 12 1 J 2 1 FG BG TR INT EGER IDIM J DIM 11 12 1 J 2 REAL A IDIM DIM FG BG TR 6 Draw gray scale map of an array in current window T he subsection of the array A defined by indices 11 12 J 1 2 is mapped onto the view surface world coordinate systemby the transformation
143. VST D 0 05 0 95 0 05 0 95 must be replaced with CALL PGVSTD D I can t read the hardcopy files created with GI Review step 5 above Some applications namely Paint Shop P ro will read files written when the code is compiled without this option but most will not If you read the file in Paint Shop Pro and then save it other applications will be able to read it PGPLOT T imPearson California Institute of Technology tip stro caltech edu Copyright 1997 2002 California Institute of Technology PGPLOT Installation Instructions Windows 95 NT with PowerStation F ortran Version 5 2 0 T he following notes are based on information received fromP A Seeger C T Dum and J oe Walston Please send any suggestions for improvement to TimPearson Supported systent Microsoft Windows 95 or Windows NT with Microsoft PowerStation F ortran 4 0 Note applications devel oped in this F ortran will not execute under DOS or Windows 3 x no not even with WIN32s Once PGPLOT LIB is built applications are most easily compiled using the Microsoft Devel oper Studio T he application type must be QuickWin or it must be compiled with command line option MW Programs execute in a text window with the graphical output in up to 8 separate child windows Cursor functions including rubber band modes are implemented with the mouse Installation Instructions 1 Download PGPLOT by your favorite method fromURL ftp ftp astro caltech edu pub pg
144. X 4 YBOX 4 PGQVP inquire viewport size and position void cpgqvp int units float x1 float x2 float y1 float y2 SUBROUTINE PGQVP UNITS X1 X2 Y1 Y2 INTEGER UNITS REAL X1 X2 Y1 Y2 Inquiry routine to determi ne the current viewport setting T he values returned may be norralized device coordinates inches mm or pixels depending on the value of the input parameter CF LAG Argurrents UNITS input used to specify the units of the output pararreters UNITS 0 normalized device coordinates UNITS 1 inches UNITS 2 millimeters UNITS 3 pixels Other values give an error message and are treated as 0 X1 output the x coordinate of the bottom eft corner of the viewport X2 output the x coordinate of the top right corner of the viewport Y1 output the y coordinate of the bottomleft corner of the viewport Y2 output the y coordinate of the top right corner of the viewport PGQV SZ inquire size of view surface void cpgqvsz int units float x1 float x2 float y1 float y2 SUBROUTINE PGQVSZ UNITS X1 X2 Y1 Y 2 INTEGER UNITS REAL X1 X2 Y1 Y2 T his routine returns the dimensions of the view surface the maximum plottable area of the currently selected graphics device in a variety of units T he size of the view surface is device dependent and is established when the graphics device is opened On sore devices it can be changed by calling PGPAP before starting a new page w
145. _Applnit T cl_Interp interp static int usage_error T cl_Interp interp char usage static int tcl_ pgopen ClientData data T cl_Interp interp int argc char argv static int tcl_draw_plot ClientData data T cl_Interp interp int argc char argv int main int argc char argv T k_Main argc argv Dermo_ Appl nit return 0 static int Demo_Applnit T cl_Interp interp if T cl_Init interp TCL_ERROR Tk_Init interp TCL_ERROR T kpgplot_Init interp T CL_ERROR return T CL_ERROR T cl_CreateCommand interp pgopen tcl_ pgopen NULL 0 T cl_CreateCommand interp draw_plot tcl_draw_plot NULL 0 return T CL_OK Implement the example pgopen T cl command T his takes a single PGPLOT device specification argument and returns the corresponding PGPLOT id for use with cpgsict static int tcl_pgopen ClientData data T cl_Interp interp int argc char argv char resul t 20 int id Make sure that the right number of arguments have been provided if argc 2 return usage_error interp pgopen device Attenpt to open the PGPLOT device specified in argv 1 id cpgopen argv 1 if id lt 0 T cl_AppendResult interp Unable to open device argv 1 NULL return T CL_ERROR T urn off new page prompting cpgask 0 Return the PGPLOT id of the device via the T cl result string i sprintf result d id T cl_Appe
146. a specific XnP gplot widget T his will then be inherited by all widgets in the application including XnP gplot widgets T he steps to performto allocate a private colormap and assign it to the top level widget of the application are as follows a Call XtV aAppinitialize as you norrrelly would For the sake of the example let s say that you store the returned top level widget in a variable called w_top a Call XtDisplay w_top to acquire the Display Xlib context object a Usethenorrel Xlib functions to find an appropriate visual and allocate the required private colormap a Register the selected colorrmap and visual to the top level widget XtV aSetV alues w_top XmNcolorrrep colormap XmNvisual visual NULL Alternatively if you really want to assign private colormaps to indi vidual XnP gplot widgets then note that to get the window manager to autorretically install the colormap of a widget window one has to set the WM_COLORMAP_WINDOWS property on the top level window of the host application The X toolkit provides the function XtSetWM ColormapWindows to do this Other X resources that effect the way that colors are allocated are XmpNninColors T his has a default value of 2 Its value determines the minimumacceptable number of colors ina colorrrap If fewer colors are available than this number then the color allocation code will give up and fall back on using just the black and white colors of the screen to draw PGPLOT gra
147. acter as a figure begin fi gure newfont myfntname pgpl ot centerline myfntnarre A caption L etter A of PGPLOT font end fi gure T his is the last sentence Of course you must tell TeX and the DVI driver where to find your fonts On our VAX we have defined a search list so that if you define the logical TEX _USER_FONTS to be your directory where you keep your fonts then T eX and the DV driver will find the pgplot tfm file and the pgplot 300pk file So DEFINE TEX_USER_FONTS SYS USERDISK USERNAME F ONT S would cause T eX and the DVI driver to search the normal search path and also the directory SY S USERDISK USERNAME F ONT S for any fonts that you specified in your T eX file Here is an exception for UNIX Our UNIX T eX and DVI prograrrs will look in your current directory autorratically for the fonts and then will check the systemlibrary if it cannot find the fonts in your directory Notes Y ou must change the resol ution for different output devices our DV driver DVIHP for our HP 2000 L aser et would use a resol ution of 300 dots per inch while our DVI driver for the V axstation 2000 workstation would need a resolution of 78 dots per inch T he pgplot tfmfile would of course be the san in both cases but the DV drivers would look for pgpl ot 300pk and pgpl ot 78pk respectively If you produce an image which is too large by defining logicals PGPLOT_T X_XINCHES and PGPLOT _T X_YINCHES then some DVI drivers
148. ad PGPLOT 5 2 0 by your favorite method decompressed ver 5 0 3 on VAX VMS system and ver 5 1 beta froma Unix machine uncompress followed by tar xcf But have now acquired WinZip Nico Mak Computing Inc www winzip com which performs Gunzip and tar in the PC very good program even sent themthe 29 fee J ust make the file name PGP LOT 52 T GZ and open it in WinZip 2 Create an appropriate subdirectory structure e g xX PGPLOT SRC SYS_ WIN DRIVERS FONTS EXAMPLES where x is either C or another hard disk in your system Extract files fromthe corresponding subdirectories of the downloaded T GZ file Note T he copy of GRGFIL F fromthe SRC folder must be omitted in favor of the copy in SYS_WIN to get an appropriate default directory Personal preference note also copy APPLICAT PLOT 10 PLOT 10 F into the SRC subdirectory The filesin SYS_WIN should include AAAREAD ME this file AAAREAD ME2 inforrration for C programrrers GIDRIV F F ortran90 version of GIF driver without C calls GRDOS F GRE XEC F GRGFIL F replace the version in SRC GRSYOO F not systemdependent PGBIND MAK see AAAREAD ME2 for discussion WODRIV F the driver itself with attached subroutines T he file WODRIV F as included is appropriate for Digital or Compaq T o convert to Microsoft replace the fourth line USE DFLIB with USE MSFLIB T his sarre change must be made in subroutines GRW900 and GRW901 3 If you did no
149. alled pgplot T he first argument of this command is the T k path narre to give the new widget T his doubles as the PGP LOT device nan of the widget Default view surface dimensions pgpl ot widgets adopt a default size of 256x 256 pixels T his can be changed via the width and height configuration options during or after creation of the widget Resolution Depends on rronitor Multiple device capability Applications are allowed to create multiple PGPLOT T k widgets and open them simultaneously to PGPLOT If you do this be sure to reduce the default number of colors allocated by each widget by using the maxcolors configuration option Otherwise you will run out of colors very quickly and sore of your widgets will be forced to use monochrore colors Also be sure that all asynchronous callbacks call cpgsict to select the appropriate widget for PGPLOT output Color capability Colors are allocated fromthe colormap of the top level window of the application Colorraps of types PseudoColor StaticColor GrayScale StaticGray and T rueColor are supported T he value of the rmmaxcolors configuration option specifies the number of colors that each widget should attempt to allocate T his defaults to 100 T he actual number allocated will be less than this if there are fewer color cells left in the application s color table If fewer colors than the value of the rmincolors configuration option are available then monochrome is used Note tha
150. allows output to be piped to a viewing program e g pgprog xv T his will only work for single page plots In this version have started work to change the character coding of PGPLOT text strings from US ASCII to ISO Latin 1 Unfortunately do not have digitized versions of most of the required glyphs so this work is not complete Programs which use characters with decimal codes in the range 128 255 will now display differently in most cases the glyph will be an approximation to the ISO Latin 1 character e g an unaccented letter instead of the correctly accented one A new escape sequence has been added for a centered dot _ A bug has been fixed that affected PostScript and possibly sorre other drivers they would ignore a change to the color representation of the currently selected color index Sorre changes have been made in the way PGPLOT writes BoundingBox comments in PostScript files T wo bugs in polygon fill have been fixed PGPOLY would issue an error message about a polygon with less than 3 vertices on sorre occasions when a polygon was completely outside the viewport and polygon fill was ignored completely on son devices if the y axis ran downwards instead of upwards T here is one new driver HGDRIV for HP GL 2 devices Minor corrections have been made in several other subroutines and text files pgpl ot aaaread me Changed version nurber to 5 0 3 copyright notice Changed version number to 5
151. an be displayed Author T J Pearson 1987 Darvid R Chang 1995 GOC Signa T erminal Supported device Signa T 5670 terminal Devi ce type code GOC Default file name TT logical name usually equi valent to the logged in terminal Default view surface dimensions 38 cmdisplay Resolution T he full view surface is 768 by 512 pixels Color capability Color indices 0 erase and 1 are supported Input capability Cursor is a cross hair and can be moved using the joystick or the cursor keys to the left of the keyboard T erminate cursor motion and send the cursor position to the program by typing any printable character on the keyboard File format It is not possible to send GOC plots to a disk file Obtaining hardcopy A hardcopy of the plot may be obtained using a T ektronix hardcopy unit attached to the terminal Author Allyn F Tennant 1986 DEC Regis T erminals Author T J Pearson 1988 Supported devices Digital Equipment Corporation VT 125 VT 240 or VT 241 terminal other REGIS devices may also work Device type code IVT 125 Default file name TT PGPLOT VT PLOT T his usually means the terminal you are logged in to logical nane TT but the plot can be sent to another terminal by giving the device nars e g TT CO0 VT or it can be saved ina file by specifying a file nan in this case a disk name rust be included as part of the file narre Default view surface dimensions Depends on rronitor Resolution T he
152. and 1 T he default background is black and the default foreground is white T hus to create an XnP gplot widget with these colors swapped one could type plot XtV aCreateM anagedWi dget plot xP gplotWidgetClass parent XnNheight 400 XnNwidth 400 XmpNrrexColors 50 XrmWNtraversal On False XtV aT ypedArg XnNbackground XmRString white strlen white 1 XtV aT ypedArg XnNforeground XnRString black strlen black 1 NULL How to create and usea Motif PGPLOT widget with PGPLOT Motif PGPLOT widgets are created just like other widgets by calling XtV aCreateM anagedWi dget T he first argument to XtV aCreateM anagedWi dget must be the device narre by which you wish to refer to the widget in cpgbeg or cpgopen and the second argurrent must be xnP gplotWidgetClass T he third argument specifies the parent widget If you want the widget to have scroll bars then this should be a Motif Scroll Bar widget T he remaining argurrents are a list of X resource value pairs terminated by a NULL argurrent T hese should be used to configure the widget via the resources listed earlier A non variadic convenience function for creating a PGPLOT widget is also available called XmCreateP gpl ot and the equivalent function to create both aPGPLOT widget and an associated Scroll Bar widget is called XmCreateScrolledP gpl ot Note that in both cases you should apply XtManageChild to the returned widget Before a PGPLOT widget ca
153. and emulators T EK 4010 GF RET RO GT ERM XT ERM ZST EM V603 KRM3 T K4100 e T ektronix formet disk file TFILE e GOC Signs T 5670 terminal GOC e DEC Regis terminals VT 125 etc VT 125 Printers If you have a printer that supports PostScript use the PostScript format in preference to any of the following e Canon laser printers CANON BCANON VCANON VBCANON e Canon LaserShot printer LIPS2 VLIPS2 e DEC LJ 250 Color Companion printer CCP e DEC LA50 and other sixel printers LA50 e DEC LNO3 PLUS Laser printer L NO3 V L NO3 e Epson dot matrix printer EPSON e Genicom4410 dot matrix printer GENICOM GVENICOM e Hewlett Packard Desk L aserjet printers HJ e Hewlett Packard Laserjet printers LJ e Printronix P300 or P600 dot netrix printer PRINT RONIX e QUIC printers QMS and T alaris QMS VQMS e Talaris EXCL printers EXCL e Toshiba 3 in one printer TOSHIBA Pen Plotters e Gould Bryans Colourwriter 6320 pen plotter CW6320 e Hewlett Packard HP GL plotters HPGL VHPGL e Hewlett Packard HP GL 2 plotters HPGL2 e Hewlett Packard HP 7221 pen plotter HP 7221 e Houston Instruments HIDMP pen plotter HIDMP e Zeta8 Digital Plotter ZET A Null Device T he null device can be used to suppress graphical output froma program e Null device no output NULL Miscellaneous Devices e PGPLOT metafile PGMF e eX PK Font Outp
154. and pgpack f special versions of these routines for Windows Modified support routines sys grgetc c Removed unused variables sys grgmemc Modified to work with 64 bit systems or other systerrs in which a pointer does not fit in an int Changes to device drivers New device drivers cgdriv Driver for CGM Computer Graphics Metafile pndriv Driver for PNG Portable Network Graphics forrrat Note to install this you must have libpng xadriv T his is a widget driver like xmdriv that uses the X athena widget set instead of the Motif widget set See the documentation for xmdriv for further information Modified device drivers Many Changes to PGPLOT subroutines pgaqi nf Returns new version number 5 2 1 TimPearson California Institute of Technology tjp astro caltech edu Copyright 1999 California Institute of Technology PGPLOT version 5 2 2 T his version is a maintenance release It introduces no new subroutines or functionality Modified configuration files Configuration files for aix linux and solaris have been updated Windows support The files sys_win aaaread me and sys_win gidriv f have been modified Modified device drivers Minor bugs in the X window device drivers have been corrected Changes to PGPLOT subroutines pgqinf returns new version number 5 2 2 TimPearson California Institute of Technology tjp _astro caltech edu Copyright 2001 California Institute of Technology Fro
155. andard viewport T he first four arguments define the world coordinate limits of the window T he fifth argument can be Oor 1 if itis 1 PGENV calls PGWNAD instead of PGSWIN so that the plot has equal scales in x and y The sixth argument controls the amount of annotation Next Chapter 4 PGPLOT T imPearson California Institute of Technology t p stro caltech edu Copyright 1995 California Institute of Technology 4 Primitives 4 1 Introduction Having selected a view surface and defined the viewport and the window we are ready to draw the substance of the image that is to appear within the viewport T his chapter describes the most basic routines called primtives that can be used for drawing elements of the image T here are four different sorts of primitive ines graph markers text and area fill Chapter 5 explains how to change the attributes of these primitives e g color line style text font and Chapter 6 describes sore higher level routines that simplify the composition of images that would require a large number of calls to the primitive routines T he primitive routines can be used in any combination and order after the viewport and window have been defined T hey all indicate where the primitive is to appear on the view surface by specifying world coordinates See the subroutine descriptions in Appendix A for more details 4 2 Clipping T he primitives are clipped at the edge of the viewport any parts of the
156. are coped with by fields of 6 characters long T hus you could have times with days or hours as big as 999999 However in practice you might have trouble with labels overwriting themselves with such large numbers unless you a use a small time INTERVAL b use a small character size or c choose your own sparse ticks in the call to PGT BOX PGT BOX will attermpt when choosing its own ticks not to overwrite the labels but this algorithmis not very bright and may fail Note that small intervals but large absolute times such as T MIN 200000 0 s and T MAX 200000 1 s will cause the algorithm to fail This is inherent in PGPLOT s use of single precision and cannot be avoided In such cases you should use relative tines if possible PGT BOX s labelling philosophy is that the left most or bottomtick of the axis contains a full label Thereafter only changing fields are labelled Negative fields are given a label positive fields have none Axes that have the DD or HH if the day field is not used field on each major tick carry the sign on each field If the axis crosses zero the zero tick will carry a full label and sign T his labelling style can cause a little confusion with sore special cases but as long as you know its philosophy the truth can be divined Consider an axis with T MIN 20s TMAX 20s The labels will look like OhOn2Os 10s OhOnDs 10s 20s Knowing that the left field always has a full label and that positive f
157. arting pgdisp both the Figaro and the X11 environment must be set up The X11 environment consists of setting the DISPLAY environment variable appropriately F or example setenv DISPLAY 0 or setenv DISPLAY lo fan 0 0 T he first exanple would cause the display to appear on the local machine Other values which can be used to accomplish this are unix 0 0 and Ihost 0 0 where Ihost is the narre of the local host Multi ple Copies If you wish to start up a second copy of pgdisp type the line pgdisp id options amp where represents any integer Note that there cannot be a copy of figdisp and a copy of pgdisp running on the sarre screen with the sarre id T o send graphics to a particular pgdisp window specify the id nurrber before XDISP e g 1 XDISP T he default is 0 Options T he PGDISP window uses a default of 16 colors 2 if on a monochrorre screen or it can t get 16 colors for sorre reason but this can be changed with the lineColors resource Y ou need nore than 16 colors for PGPLOT gray scales recommend 64 More than 64 colors is likely to steal too many fromother windows T he window can be resized arbitrarily The initial size is determined by the fi gdi sp lg geometry resource Since PGPLOT autorratically scales to use the entire window the line graphics window should not be resized while a programis accessing it If this is done the display server will not crash but the output will look odd and curs
158. at x1 const float x2 const float y float t SUBROUTINE PGERRX N X1 X2 Y T INTEGERN REAL X1 X2 Y REAL T Plot horizontal error bars T his routine draws an error bar only to mark the data point in the middle of the error bar an additional call to PGPT or PGERRY is required Argurrents N input nurrber of error bars to plot X1 input world x coordinates of lower end of the error bars X2 input world x coordinates of upper end of the error bars Y input world y coordinates of the data T input length of terminals to be drawn at the ends of the error bar as a multiple of the default length if T 0 0 no terminals will be drawn Note the dimension of arrays X1 X2 and Y must be greater than or equal to N If N is 1 X1 X2 and Y may be scalar variables or expressions eg CALL PGERRX 1 X SIGMA X SIGMA Y PGERRY vertical error bar void cpgerry int n const float x const float y1 const float y2 float t SUBROUTINE PGERRY N X Y1 2 T INTEGERN REAL X Y 1 Y 2 REAL T Plot vertical error bars T his routine draws an error bar only to mark the data point in the middle of the error bar an additional call to PGPT or PGERRX is required Argurrents N input number of error bars to plot X input world x coordinates of the data Y1 input world y coordinates of top end of the error bars Y2 input world y coordinate
159. at the library is compiled with the sarre version of the compilers that you will use with application programs and allows you to select which PGPLOT device drivers are included in the library Precompiled versions are available for some varieties of LINUX however containing a limited set of device drivers did not create these myself and if you have problems with them suggest that you obtain the source distri bution If anyone wishes to make other binary packages would appreciate it if they would consult me first Linux for Astronomy PGPLOT is included on the L inux for Astronony CD ROMs available fromT he Random F actory Debian G J ohn Lapeyre lapeyre physics arizona edu has put source code and binary packages on his Web page at http physics arizona edu apeyre pgpl ot T hey are also available at the official Debian site http cgi debi an org www master debi an org P ackages unstabl e math pgplot htm and mirrors ELF Evgeny Stambulchik fnevgeny pl asne gate weiznenn ac il has created a precompiled ELF package e http sunsite unc edu pub L i nux devel l ang fortran pgplot5 2 0 bin lsm e http sunsite unc edu pub L i nux devel l ang fortran pgplot5 2 0 bi n tgz PGPLOT TimPearson California Institute of T echnolooy tjo stro caltech edu Copyright 1997 California Institute of T echnology PGPLOT Installation Instructions VMS systems Version 5 2 0 Note T he following instruction
160. atement if your compiler does not accept this you need to replace the INCLUDE staterrent with the contents of the named file pgplot inc or grpckgl inc as appropriate Sore routines have names longer than 6 characters the maxi mumallowed by the F ortran 77 standard these routines can be omitted all have shorter aliases that can be used in preference e g PGPAGE instead of PGADVANCE One routine GRSY XD uses a non standard INT EGER 2 statement you can replace this with INT EGER but if you do so you must make the corresponding change in GRSY 00 and PGPACK see below Routine GRCLPL uses function IAND I J for bitwise logical and of two integers most compilers recognize this as an intrinsic function and compile it inline but if yours does not you will need to supply this as an external function 2 T he system dependent routines Versions of these routines that work for many UNIX systems are provided in directory pgplot sys but for other systerrs these will need to be written Son of the routines are used only by certain device drivers and will not be needed if you do not use these drivers O GRDAT E get date and tire as character string o GRFILEIO routines GROFIL GRCFIL GRWFIL GRWF CH for binary file I O FO WO MO O10 Oy IQ O10 O GRF LUN free a Fortran logical unit number GRF MEM free menory GRGCOM read with prompt fromuser s terminal GRGENV get value of PGPLOT environment parameter G
161. ation returned by PGQDT SystemP roblems e OSF1 sys_osf1 o All the Fortran drivers that use the V AL mechanismfor passing an address fail under DEC UNIX OSF 1 these drivers will work if you change the declarations of certain pointer variables fromINT EGER to INT EGER 8 In several of the drivers have included contrents to indicate what should be changed o Cpgden does not link on OSF 1 error message cpgdenv o main multiply defined Unresolved MAIN__ The best solution to this is to use the flag nofor_main on the 77 comrand used to link the program thanks to David T errett e Silicon Graphics sys_irix o InIRIX 6 2 the library names have changed If the installation fails to find the X11 library Edit the conf file in the pgplot sys irix directory and change LIBS lX11_s to LIBS X11 and then rerun makerrake o A user has reported that PGNUMB does not generate correct code for numbers in exponential format T his affects axes drawn with PGBOX etc when labels require a multiplying power of 10 T his appears to be a due to a bug in the SGI F ortran compiler It can apparently be fixed by specifying backslash when compiling the pgplot library Edit the conf file and change FFLAGC u O2 to FFLAGC u 02 backsl ash o Theinstallation procedure for cpgdern fails Id reports unresolved __ main The conmand is 77 o cpgdero cpgdern o L pwd Icpgplot Ipgplot 1X11_s A work around is to link
162. ation and before calling any other PGPL OT routine the entire termanl screen is blacked out and i can only get my windows to appear again by clicking with the mouse over the area where i know a terminal exists then everything appears as normal and the nnormal PGPL OT window appears have you seen this problem before Colors are a limited resource on X displays most are 8 bit devices that can display only 256 different colors simultaneously Different client programs have to divide the available colors between them If no colors are available for a new window it either has to make do by sharing colors that are already in use by other windows in which case it shouldn t change them or it has to allocate a private color map which will display the correct colors but only while the cursor isin that window colors of other windows will be incorrect T he problemis much less severe for 24 bit displays which have many more colors available Netscape is particularly bad it appears to grab all the available colors forcing PGPLOT to usea private color map which produces the result you see Y ou can tell Netscape to use less colors see its documentation under Hel p F requently Asked Questions Netscape Navigator for X item14 Or you can open the PGPLOT window before the Netscape window this forces Netscape to use less colors create an XSERVE window and keep it around for your PGPLOT progran Y ou can also tell PGPLOT to allocate less colors for each
163. bber band and cursor input facilities have been reworked T he changes include O O O O O Setting the XnNtraversalOn widget resource to F alse now correctly disables keyboard focus management Previously this resource was ignored xnp_arm cursor now allows one to specify 0 for its callback argument T his allows people to use the rubber band cursor augmentation facility without incuring the side effects of its callback facility T his paves the way for programrrers to use XtA ddE ventHandler to register more advanced cursor event handlers than would otherwise be possible T here are two new coordinate conversion functions for use by those who want to write their own X window event handlers T he cursor used to be disarmed whenever the world coordinate systemof a widget changed It no longer is It used to be the case that if graphics were drawn while the rubber band cursor was displayed the new graphics could overwrite parts of the cursor T o counter this the rubber band cursor is redrawn every time the PGPLOT buffer is flushed T his will slow down graphical output unless you use cpgbbuf and cpgebuf prudently to buffer sequential pgplot calls V arious bugs have been fixed that had been causing the rubber band cursor to be left un erased in certain obscure situations or to leave a bristly edge in the highlight border where the cursor shouldn t have been drawn in the first place or to flip to the bottomwhen the mouse pointe
164. be accomplished with the routines PGSAVE and PGUNSA PGSAVE saves the current PGPLOT attributes in a private storage area T hey can be restored by calling PGUNSA unsave Attributes saved are character font character height color index fill area style line style line width pen position arrow head style hatching style Color representation is not saved Calls to PGSAVE and PGUNSA should always be paired Up to 20 copies of the attributes may be saved PGUNSA always retrieves the last saved values last in first out stack Note that when multi ple devices are in use PGUNSA retrieves the values saved by the last PGSAVE call even if they were for a different device T he example in the previous section can be written more simply as save the current attributes CALL PGSAVE change the attributes and draw something CALL PGSLW 2 CALL PGSCI 11 CALL PGLINE 7 X Y restore the attributes CALL PGUNSA RET URN Next Chapter 6 PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995 1997 California Institute of Technology Figure 5 1 Default color representations of color indices 0 15 on most color and gray scale devices Note Some Web browsers may not display the colors correctly T he PostScript version of the figure may be more reliable Color Index R S B karez h raria 0 1 00 1 00 1 00 0 00 7 00 6 06 3 00 1 00 7 00 0 00 7 00 1 00 1 00 0 00 7 00 1 00
165. be included in all prograrrs that use these subroutines include cpgplot h int arguments Input int arguments are passed by value and non int values will be converted to int for output arguments supply a pointer to int float arguments Single valued float argurrents are passed by value and non float values e g double will be converted to float for output arguments supply a pointer to float Array arguments are passed by address char arguments For input supply a pointer to a null termi nated string for an output argurrent char value there is another argument int value_length value_length should be set to the maximum number of characters that may be stored in value before entry to the routine it receives the actual number of characters used 2 din ensional arrays T wo dimensional arrays should be packed in a one dimensional C array with the first index changing fastest Index of Routines e PGARRO draw an arrow e PGASK control new page prompting e PGAXIS draw an axis e PGBAND read cursor position with anchor e PGBBUF begin batch of output buffer e PGBEG open a graphics device e PGBIN histogramof binned data e PGBOX draw labeled frame around viewport e PGCIRC draw a circle using fill area attri butes e PGCLOS close the selected graphics device e PGCONB contour map of a 2D data array with blanking e PGCONF fill between two contours e PGCONL label contour map of
166. bel both axes logarithmically For other axis options use routine PGBOX PGENV can be persuaded to call PGBOX with additional axis options by defining an environment parameter PGPLOT ENVOPT containing the required option codes Examples PGPLOT_ENVOPT _ draw Projecting tick marks PGPLOT_ENVOPTA _ Invert the tick marks PGPLOT_ENVOPTAV _ Invert tick marks and label y Vertically PGERAS erase all graphics fromcurrent page void cpgeras voi d SUBROUTINE PGERAS Erase all graphics fromthe current page or current panel if the view surface has been divided into panels with PGSUBP Arguments none PGERR1 horizontal or vertical error bar void cpgerrL int dir float x float y float e float t SUBROUTINE PGERR1 DIR X Y E T INTEGER DIR REAL X Y E REAL T Plot a single error bar in the direction specified by DIR T his routine draws an error bar only to mark the data point at the start of the error bar an additional call to PGPT is required To plot many error bars use PGERRB Argurrents DIR input direction to plot the error bar relative to the data point One sided error bar DIR is 1 for X X to X 2 for Y Y to Y E 3 for X X to X E 4for Y Y to Y E T wo sided error bar DIR is 5for X X E to X 6 for Y Y E toY input world x coordinate of the data input world y coordinate of the data input value of error bar distance to be added to the data position in
167. bit address pgplot sys_sun4 conf Changed shared library version nurrber from 1 6 to 1 7 pgplot sys_vins grfileio c Now recognizes file name as standard output TimPearson California Institute of T echnology tjo stro caltech edu Copyright 1995 California Institute of Technology PGPLOT version 5 1 0 T ested Systems Version 5 1 0 has been tested with the following operating systerrs and compilers Drivers tested include GI GL NU PP PS TT VT WD X2 XM XW but not all combinations of drivers and systems have been tested exhaustively e SunOS 4 1 3 U1 Sun F ortran f77 1 3 1 GNU C gcc 2 7 0 tested on SPARC 5 e Solaris 2 5 SunOS 5 5 Sun F ortran 77 3 0 1 Sun C cc 3 0 1 tested on SPARC IPX e Solaris 2 5 SunOS 5 5 Sun F ortran f77 3 0 1 GNU C gcc 2 7 2 tested on SPARC IPX SPARC Ultra 1 e OpenVMS AXP V6 1 DEC FORT RAN V6 2 DEC C V4 0 DE Cwindows Motif 1 1 tested on DEC 3000 M 600 e OpenVMS VAX V6 1 DEC FORT RAN V6 2 DEC C V4 0 DE Cwindows Motif 1 2 tested on V AXstation 4000 90 Changes in Version 5 1 0 New F eatures 1 A major change in this version allows a programto have more than one PGPLOT device open at once T he devices can be of the sarre type e g two windows on an X window workstation or of different types e g a T ektronix terminal emulator and a PostScript file Up to 8 devices may be open at once T o support this new feature four new routines hav
168. bsequent output to a different open device PGBEG is an alternative to PGOPEN retained for compatibility with existing programs PGEND can be used to close all open devices e PGOPEN open a graphics device e PGBEG open a graphics device e PGSLCT select an open graphics device e PGCLOS close the selected graphics device e PGEND closeall open graphics devices e PGQID inquire current device identifier T he following routines can be used to determine what types of graphics device are available the list of types is installation dependent e PGLDEV list available device types on standard output e PGQNDT inquire number of available device types New in version 5 2 e PGQDT inquire nane of nth available device type New in version 5 2 After a graphics device has been opened the following routines may be used to determine sore of its device dependent characteristics e PGQINF inquire PGPL OT general information e PGQCOL inquire color capability Controlling the View Surface Use PGPAGE to start a new page or PGERAS to clear the screen without starting a new page On interactive devices PGPLOT prompts the user before starting a new page unless told not to via PGASK e PGPAGE advance to new page e PGERAS erase all graphics fromcurrent page e PGASK control new page prompting T he size of the view surface is device dependent and is established when the graphics device is opened Use PGQV SZ if you need to know t
169. bute affects the appearance of text T ext may be either transparent the default in which case underlying graphics show between the characters of the text or opaque in which case the bounding box of the text is filled with a specified color before drawing the text characters Use routine P GST BG to specify the text background the argurrent is an integer which may be e 1 to select transparent text the default or e 0 255 to select opaque text with the argument specifying the color index of the text background Use color index 0 to erase underlying graphics before drawing text If the color index specified by PGST BG is the sare as that specified by PGSCI then text will be written on a background of the sarre color and will be unreadable T he following code draws yellow test on a blue background INT EGER YELLOW BLUE PARAMET ER BLUE 4 YELLOW CALL PGSCI YELLOW CALL PGST BG BLUE CALL PGTEXT X Y SPQR 5 9 Fill Area Style Fill Area Style can be solid fill the area with the current color outline only the outline of the polygon is drawn hatched the region is shaded with parallel lines or cross hatched the region is shaded with two sets of perpendicular lines The style is defined by an integer code 1 solid default 2 outline 3 hatched 4 cross hatched T hese are illustrated in Figure 5 2 Fill area style applies to polygons PGPOLY circles PGCIRC and rectangles PGRECT To c
170. buted to PGPLOT over the years and I thank all who have contributed code and device drivers or who have helped in debugging PGPLOT ona variety of systerrs am particularly grateful to the following for their major contributions Klaus Georg Adans Scott Allendorf Robert Deverill C T Dum Alan Fey Karl Glazebrook Diab J erius Chris J acobs Neil Killeen Harry Lehto Colin Lonsdale Grant McIntosh Massimo Manghi Michael Michelsen J im Morgan Martin Shepherd SamSouthard Allyn T ennant David T errett Peter T euben J ean Marc Zucconi 1 Introduction 1 1PGPLOT PGPLOT isaFortran subroutine package for drawing simple scientific graphs on various graphics display devices It was originally developed for use with astronomical data reduction programs in the Caltech Astronomy department This manual is intended for the F ortran progranirer who wishes to write a program generating graphical output F or most applications the programcan be device independent and the output can be directed to the appropriate device at run time T he output device is described by a device specification discussed below T he prograntrer can build a specific device specification into the program but it is better to make this a parameter which the user of the programcan supply All the examples in this manual use standard F ortran 77 PGPLOT itself is written mostly in standard F ortran 77 with a few non standard system dependent subroutines 1 2 T hi
171. cally correct htm with cross references Diab J erius makerake Add instructions for SV driv and WDdriv Make it work with bash as well as sh No longer makes pgplot htm by default Renove VV driv pgpl ot drivers gidriv f Avoid integer overflow caused driver to crash on VAX V MS Add warning that use of this driver may require a license fromUnisys tfdriv f Correct error in usage of GRF MEM svdriv c svblock c Restored fromv4 9H note this driver for SunV iew is no longer supported use XWadriv instead vedriv f Merge landscape and portrait modes in one driver vvdriv f Deleted wddriv f New file generates X window dump file Scott Allendorf xwdriv c pgxwin_server c Fixes to datatypes of properties corrects bugs found on Cray and Dec Alpha OSF 1 Support for all visual types including T rueColor Ability to set different attributes for each window via X resources On V MS checks that pgxwin_server has E or R access x2driv c figdisp_commc Suppress warning messages produced by DECC compiler bcdriv f ccdriv f hjdriv f ladriv f ljdriv f todriv f txdriv f Eliminate use of routine gribf1 pgpl ot exarmpl es pgdenv2 f Add atest of an invisible polygon pgpl ot fonts aaaread me Note that pgunpack and pgdchar are unsupported pgpl ot src grcurs f Correct bug start new picture if necessary grldev f Change Legal PGPLOT device types are to Device types available grivker f Fix bug viewport grew as symbols
172. capability T he XnPgplot driver places no restrictions on the nurber of XnP gplot widgets that can be open to PGPLOT simultaneously Note however that PGPLOT does set limits on the total number of open devices Currently April 96 this limt is 8 Required files fromthe PGPL OT installation C include files XnP gplot h T his header file should be included by all application source code files fromwhich XnP gplot widget functions or resources are used cpgplot h Since Motif is usually used fromC the include file for the C PGPLOT wrapper library should also be included in all Motif applications that make calls to the PGPLOT library UNIX PGPLOT libraries libXnP gplot a This library contains the Motif PGPLOT widget and its PGPLOT driver The main PGPLOT library only contains a stub version of the driver so when linking Motif applications it is essential that libXmP gplot a appear beforethe main PGPLOT library For example a snapshot of the link line under UNIX would be IXnP oplot Icpoplot I pgplot IXm IXt 1X11 libcpoplot a and libpgplot a The PGPLOT C wrapper library and the FORT RAN PGPLOT library VMS PGPLOT libraries XMPGPLOT OBJ T his object file contains the compiled Motif PGPLOT widget and its PGPLOT driver Note that the main PGPLOT library only contains a stub version of the driver and that programs that use the Motif widget must link with XMPGPLOT OBJ in addition to the the main PGPLOT library GRPCKG OLB and CPGPL
173. color representation is defined by nan instead of R G B corponents Color names are defined in an external file which is read the first time that PGSCRN is called The nan of the external file is found as follows 1 if environment variable logical name PGPLOT _RGB is defined its value is used as the file names 2 otherwise if environment variable PGPL OT _DIR is defined a file rgb txt in the directory named by this environment variable is used 3 otherwise file rgb txt in the current directory is used If all of these fail to find a file an error is reported and the routine does nothing Each line of the file defines one color with four blank or tab separated fields per line The first three fields are the R G B components which are integers in the range 0 Zero intensity to 255 maximum intensity T he fourth field is the color name T he color nane may include embedded blanks Example 255 O Ored 255 105 180 hot pink 255 255 255 white O O Oblack Arguments Cl input the color index to be defined in the range O rrex If the color index greater than the device maximumis specified the call is ignored Color index 0 applies to the background color NAME input the name of the color to be associated with this color index T his nane must bein the external file T he names are not case sensitive If the color is not listed in the file the color representation is not changed IER output r
174. command would change the X window cursor of the widget to asrrell cyan crosshair cursor plot configure cursor crosshair black cyan T he following is alist of the configurable options of PGPLOT widgets background color bg color Set or change the background color of the widget Note that this also changes the color associated with PGPLOT color index 0 T his command takes a standard T k color specification as its only argument T he default foreground color is black foreground color fg color Set or change the color that is associated with PGPLOT color index 1 T his comand takes a standard T k color specification as its only argument T he default foreground color is white cursor tk cursor specification T his changes the cursor image that will be displayed when the cursor is within the PGPLOT widget It takes a standard T k cursor specification as its only argument T he default cursor is the cursor of the parent widget T his does not affect any rubber band cursor that has been established borderwidth width bd width T his sets the width of the 3D border that is drawn around the widget T he single argurrent is a standard T k width specification T he default width is zero which results in no border being drawn relief raised sunken flat ridge groove T his specifies how the 3D border is to appear It takes a single argument naming one of the standard T k reliefs T he default is raised height height T his specifies t
175. correctly with either static or autorratic storage e g FFLAGC u O FFLAGC u PIC O FFLAGC u pic O FFLAGC u FF LAGC WF o novector i 64 FFLAGD In most cases this should be the sare as FF LAGC It is used instead of F FLAGC when compiling and linking the PGPLOT den progrars T he main potential difference has to do with the fact that many of the der programs exploit the character to introduce special plot symbols within PGPLOT text Unfortunately many compilers treat this as an escape character T o avoid this FF LAGD should include a flag to tell the compiler to turn off special treatment of this character Options for shared libraries position independent code are not required e g FFLAGD F FLAGD O0 F FLAGD assurre backslash FFLAGD u bs FFLAGD u O FFLAGD u backslash O0 F FLAGD u qnoescape FFLAGD xl u O CCOMPL T he comand used to invoke the chosen C compiler on your system If you intend to use the C wrapper library cpgplot then this should be an ANSI C compiler Otherwise a pre ANSI K amp R C compiler will be sufficient e g CCOMPL usr ucb cc CCOMPL c89 CCOMPL cc CCOMPL gcc CFLAGC LIBS Any C compiler flags that are needed to compile PGPL OT Note that this should not include the c or o options which are automatically added where needed by the makerake script Examples of possible flags to include are optimization level flags and f
176. cter is a question merk e g Device inthis case PGPLOT will prompt the user to supply the device specification using the supplied string as the prompt without the leading question mark but including any trailing spaces In cases 5 and 6 the device specification is read fromthe standard input T he user should respond to the prompt with a device specification of the form 1 2 or 3 If the user types a questi on rrark in response to the prompt alist of available device types is displayed and the prompt is re issued If the user supplies an invalid device specification the prompt is re issued If the user responds with an end of file character e g ctrl D in UNIX program execution is aborted this avoids the possibility of an infinite prompting loop A prograntrer should avoid use of PGPL OT prompting if this behavior is not desirable T he device type is case insensitive e g ps and PS are equivalent T he device or file name may be case sensitive in some operating systems Examples of valid DEVICE arguments 1 plot ps ps dir plot ps ps dir plot ps ps user tj p pl ots pl ot ps P S 2 ps PGPLOT interprets this as pgplot ps ps 3 plot ps if PGPLOT_TYPE is defined as ps PGPLOT interprets this as plot ps ps 4 if PGPLOT_DEV is defined 5 6 Device specification for PGPLOT T his routine was added to PGPLOT inVersion 5 1 0 Older programs use
177. ction This is inthe sarre units as the data CENTER input if true the X values denote the center of the bins if false the X values denote the lower edges in X of the bins YLIMS input workspace Should be an array of at least IX2 IX1 1 elements PGHIST histogramof unbinned data void cpghist int n const float data float datrin float datmax int nbin int pgflag SUBROUTINE PGHIST N DATA DAT MIN DAT MAX NBIN PGF LAG INTEGERN REAL DATA REAL DATMIN DAT MAX INT EGER NBIN PGFLAG Draw a histogramof N values of a variable in array DAT A 1 N inthe range DAT MIN to DAT MAX using NBIN bins Note that array elements which fall exactly on the boundary between two bins will be counted in the higher bin rather than the lower one and array elements whose value is less than DAT MIN or greater than or equal to DAT MAX will not be counted at all Argurrents N input the number of data values DATA input the data values Note the dimension of array DAT A must be greater than or equal to N The first N elements of the array are used DAT MIN input the mininumdata value for the histogram DAT MAX input the maximum data value for the histogram NBIN input the number of bins to use the range DAT MIN to DAT MAX is divided into NBIN equal bins and the number of DAT A values in each binis determined by PGHIST NBIN may not exceed 200 PGFLAG input if PGFLAG 1 the histogramis plotted
178. d S are in the range 0 0 to 1 0 T he following table and F igure 5 1 show how the color indices are defined on most devices when PGPLOT isstarted Note that these assignments are device dependent and in particular some devices plot in black on white background color index 0 white color index 1 black while others plot in white on black background color index 0 black color index 1 white Color indices 0 15 have these predefined color representations but these may be changed with by calling PGSCR PGSCRN or PGSHLS Color indices 16 maximumhave no predefined representations if these indices are used one of these routines rust be called to define the representation T able 5 1 Default Color Representation Color Index Color H L S R G B O Black background 0 0 00 0 00 0 00 0 00 0 00 1 White default O 1 00 0 00 1 00 1 00 1 00 2 Red 120 0 50 1 00 1 00 0 00 0 00 3 Green 240 0 50 1 00 0 00 1 00 0 00 4 Blue 0 0 50 1 00 0 00 0 00 1 00 5 Cyan Green Blue 300 0 50 1 00 0 00 1 00 1 00 6 Magenta Red Blue 60 0 50 1 00 1 00 0 00 1 00 7 Yellow Red Green 180 0 50 1 00 1 00 1 00 0 00 8 Red Y alow Orange 150 0 50 1 00 1 00 0 50 0 00 9 Green Yedlow 210 0 50 1 00 0 50 1 00 0 00 10 Green Cyan 270 0 50 1 00 0 00 1 00 0 50 11 Blue Cyan 330 0 50 1 00 0 00 0 50 1 00 12 Blue Magenta 30 0 50 1 00 0 50 0 00 1 00 13 Red Magenta 90 0 50 1 00 1 00 0 00 0 50 14 Dark Gray
179. d by on the user s behalf by PGENV but may also be called explicitly Arguments XOPT input string of options for X horizontal axis of plot Options are single letters and may bein any order See below XTICK input world coordinate interval between major tick marks on X axis If XT ICK 0 0 the interval is chosen by P GBOX so that there will be at least 3 major tick marks along the axis NXSUB input the number of subintervals to divide the major coordinate interval into If XT ICK 0 0 or NXSUB 0 the number is chosen by PGBOX YOPT input string of options for Y vertical axis of plot Coding is the sarre as for XOPT YTICK input like XTICK for the Y axis NY SUB input like NXSUB for theY axis Options for parameters XOPT and Y OPT A draw Axis X axis is horizontal line Y O Y axis is vertical line X 0 B draw bottom X or left Y edge of frarre C draw top X or right Y edge of frarre G draw Grid of vertical X or horizontal Y lines Invert the tick marks ie draw themoutside the viewport instead of inside L label axis Logarithmically see below N write Nurreric labels in the conventional location below the viewport X or to the left of the viewport Y P extend Project major tick marks outside the box ignored if option is specified M write nurreric labels in the unconventional location above the viewport X or to the right of the viewport
180. d open it in WinZip 2 Create an appropriate subdirectory structure e g X PGPLOT SRC SYS_ WIN DRIVERS FONTS EXAMPLES where x is either C or another hard disk in your system Extract files fromthe corresponding subdirectories of the downloaded T GZ file Note T he copy of GRGFIL F fromthe SRC folder must be omitted in favor of the copy in SYS_WIN to get an appropriate default directory Personal preference note also copy APPLICAT PLOT 10 PL OT 10 F into the SRC subdirectory T he files in SYS_WIN should include AAAREAD ME this file AAAREAD ME2 inforrration for C programrers GIDRIV F F ortran90 version of GIF driver without C calls GRDOS F GRE XEC F GRGFIL F replace the version in SRC GRSYOO F not systemdependent PGBIND MAK seeAAAREAD ME2 for discussion WODRIV F the driver itself with attached subroutines T he file WODRIV F as included is appropriate for Digital or Compaq T o convert to Microsoft replace the fourth line USE DFLIB with USE MSFLIB T his sare change must be made in subroutines GRW900 and GRW901 3 If you did not use C in step 2 create a directory C PGPLOT and copy RGB T XT to it fromx PGPLOT You also need to compile and execute the programPGPACK fromsubdirectory x PGPL OT F ONT S to convert file GRFONT T XT to binary fileGRFONT DAT Torun PGPACK in the Windows environment put this statement before the REA Ds OPEN 5 FILE x pgplot fonts grfont txt Likewise t
181. d so will be difficult to edit 2 PGPLOT doesn t structure the file into hierarchical objects which would be convenient for editing Extensions to PGPLOT might neke these features possible GIF driver Add option for transparent background GIF PPM XWD drivers Rewrite in C for improved portability these drivers all use dynamic memory allocation which is not possible in standard F ortran 77 PostScript driver o Put bounding box info at head of file difficult in F ortran o Method of autorratically printing PostScript output or pi ping to another program PostScript and other drivers Mechanism e g environment variable to set paper size to e g A4 instead of US letter Ideally this should work with all printer drivers X Window driver XW XS o Ability to change mapping of mouse clicks onto A D X different mapping for modified button press events e g control Hrouse o Copy sore colors fromthe default color map to private color map when appropriate to ameliorate problems of color map switching o Readout of current cursor position T his is not possible to do except while the cursor is inthe current PGPLOT window T his may be addressed in the Motif driver o User selectable run time cross hair cursor currently can be selected by changing Xdefaults or under program control May also be addressed in Motif driver PGPLOT T imPearson California Institute of Technology tjp _astro caltech edu Copyright 1995 199
182. d symbols to the font file will look into methods of accontodating this Additional Characters e g Greek cursive pi varpi Alternate syntax for text A request has been made for an alternate syntax for subscripts superscripts etc possi bilities include L aT eX T eX or HT ML This would only be desirable if it follows an already established standard Current e ui gp d LaTex e i pi HTML e lt sup gt i amp pi lt sup gt Ability to change color within a text string e g with an escape code to specify the color index Improved support for C Shared version of libcpgplot support for PGERRX etc better documentation Meanwhile you can make a shared version of ilbcpgpl ot using commands like the following the Id options are highly system dependent ar xv libcpgplot a Id o libcpgplot so z text G i cpg o L 1 pgplot rm f cpg o Improved Contouring Routines o Routine to label contours with blanking i e a version of PGCONL for use with PGCONB instead of PGCONT o Methods for srroothing data interpol ation to finer grid before contouring o Contouring a non rectangular grid e g with x and y coordinates of each element supplied by user o Better control over labeling in PGCONL especially orientation of text e g uphill downhill up page etc Improved Imaging Routines o A method to specify an arbitrary transfer function o Imaging with non rectangular pixels like PGCONX e g for polar gr
183. d the world coordinates T he world coordinates of the array point A I J are given by X T R 1 T R 2 I T R 3 J Y TR 4 T R 5 1 T R 6 J Usually T R 3 and T R 5 are zero unless the coordinate transforrration involves a rotation or shear PGCONT contour nep of a 2D data array contour followino void cpgcont const float a int idim int jdim int i1 int i2 int j1 int j2 const float c int nc const float tr SUBROUTINE PGCONT A IDIM J DIM 11 12 J 1 J 2 C NC TR INT EGER IDIM J DIM 11 J 1 12 J 2 NC REAL A IDIM J DIM C TR 6 Draw a contour map of an array T he map is truncated if necessary at the boundaries of the viewport Each contour line is drawn with the current line attri butes color index style and width except that if argument NC is positive see below the line style is set by PGCONT to 1 solid for positive contours or 2 dashed for negative contours Argurrents A input data array IDIM input first dimension of A J DIM input second dimension of A 11 12 input range of first index to be contoured inclusive J 1 J 2 input range of second index to be contoured inclusive C input array of NC contour levels dimension at least NC NC input number of contour levels less than or equal to dimension of C If NC is positive it is the number of contour levels and the line style is chosen autorretically as described above If NC is negat
184. de by side ina frarre frarre f label f x width 12 anchor w label f y width 12 anchor w pack f x f y side left anchor w Create the PGPLOT widget and place it below the labels poplot plot maxcolors 16 pack f plot side top Arrange to update the labels whenever the cursor moves inthe PGPLOT window bind plot lt Motion gt f x configure text X plot world x x f y configure text Y plot world y y Note that this example will display X 0 0 and Y 0 0 until the widget is opened to PGPLOT Up to that point no world coordinates exist so the world command returns 0 0 for all input coordinates Private colormaps T he T k pgplot widget allocates colors fromthe colormap of the top level widget that encloses it By default this is also the default colormap of the screen which is being competed for by most of the other X window prograrrs that are being displayed T o avoid running out of colors you can do two things 1 Set the value of the pgplot maxcolors configuration option to as small a value as you actually need 2 Allocate a private colormap for the top level widget of your application T he latter option is easily available via the colormap configuration argument of the T cl T k toplevel conmrand T his means that you can either create your own separate top evel widget with its own colormap or you can request a private colormap for the main window when the application starts F or exa
185. defined by Y F X e PGFUNY function defined by X F Y Histograms e PGBIN histogramof binned data e PGHI2D cross sections through a 2D data array e PGHIST histogramof unbinned data Contour Maps e PGCONB contour nep of a 2D data array with blanking e PGCONMF fill between two contours New in version 5 2 e PGCONL label contour map of a 2D data array e PGCONS contour map of a 2D data array fast algorithm e PGCONT contour nep of a 2D data array contour foll owing e PGCONX contour map of a 2D data array non rectangular l mages e PGIMAG color image froma 2D data array e PGSCIR set color index range e PGQCIR inquire color index range e PGCTAB install the color table to be used by PGIMAG e PGGRAY gray scale rap of a 2D data array e PGPIXL draw pixels e PGSITFE set image transfer function e PGQITF inquire image transfer function e PGWEDG annotate an image plot with a wedge Vector Plots e PGVECT vector nep of a 2D data array with blanking Interactive Graphics PGCURS read cursor position PGBAND read cursor position with anchor PGLCUR draw a line using the cursor PGNCUR nerk a Set of points using the cursor PGOLIN merk a set of points using the cursor PGSCRL scroll window New in version 5 2 Miscellaneous Routines PGNUMB convert a nurber into a plottable character string PGRND find the smallest round number greater than x PGRNGE choose axis limits
186. duced to the maxi mumavailable F or an example of the 236 color modes see PGDEMO4 For an example of different resolutions try using Menu WV for the first window and Graphs WX for the second window in PGDEMO13 Note the use of the device specification to narre the window 8 T he cursor is emulated by an interrupt driven mouse routine see GRW901 in file W9DRIV F T he cursor moves continuously whenever the window is selected but the position is not returned to the calling program until a key has been struck and the character is also returned Control then returns to the text window for any additional input or processing If you lose track there is a status message at the bottomof the frane window which tells you which window is waiting for input except see Note in previous section T he color of the cursor may be dimagainst some backgrounds especially green in the default palette but you can usually see it at the tip of the mouse arrow while you move it around You might try using PGBAND mode 7 for the cursor to improve visibility See especially programs PGDE MO5 and PGDE MO6 9 Plots can be clipped and copied to other applications such as Word Unfortunately black is black and white is white so printing uses a lot of ink and the white lines tend to disappear One option is to exchange palette colors O and 1in PGPLOT with CALL PGSCR 0 1 1 1 black becomes white CALL PGSCR 1 0 0 0 white becon s black b
187. e been added PGOPEN PGQID PGSLCT and PGCLOS and many routines have been modified internally At present support for multiple devices of the same type is not complete Each PGPLOT device driver needs to be modified to support multi ple devices of the sarre type i e served by the sane driver or to explicitly prohibit opening more than one device Some of the older drivers have not yet been modified and these drivers may give incorrect results if you attempt to use themto open two devices T here should never be any problemwith unlike devices served by different drivers e g XTERM and PS 2 A new driver xmdriv and support routines have been provided by Martin Shepherd to facilitate use of PGPLOT ina Motif application Note that this is an experimental driver feedback would be appreciated 3 The C function prototypes cpgplot h and C binding are now compatible with C as well as C Bugs Fixed A bug has been fixed in GRPOCL support routine for PGPOLY This could cause overflow and incorrect plots if the world coordinate values were greater than about 1E 18 on most machines A rounding error has been fixed in GRF A support routine for PGPOLY this could cause gaps between polygons that should abut A bug has been fixed in GRPIXL support routine for PGPIXL this should improve speed T wo bugs have been fixed in the X window driver XWDRIV it would sometimes cause color maps to be set incorrectly it allow
188. e Portable Bitrrap Utilities available on the Internet can be used to translate it into a variety of other formats T he program xv by J ohn Bradley bradley cis upenn edu can be used to display PPM files on UNIX and VMS workstations PGPLOT uses the P6 variant with 24 bits 8 each for R G B for each pixel The format is not efficient in use of storage so for most purposes the GIF fornet is preferred Device type code PPM landscape orientation VPPM portrait orientation Default file name pgplot ppm A PPM file can contain only a single image so for multi page plots PGPLOT creates additional files If the supplied file name contains the character the file narre is derived by replacing this character with the current page number If the supplied file nan does not contain a PGPLOT appends an underscore and the page number for the second and subsequent pages e g PGBEG filename Filenames used pgpl ot ppm pgplotl ppm pgplot2 ppm pgplot3 ppm pgpl ot ppm pgplot ppm pgplot ppm_ 2 pgplot ppm 3 If the supplied file name is the output is sent to the standard output stream so that it can for exarrple be piped into a viewing program T his will only work for single page plots Default view surface dimensions PPM 850 by 680 pixels nominally 10 0 by 8 0 inches VPPM 680 by 850 pixels nominally 8 0 by 10 0 inches T hese defaults can be overridden by specifying environment variables or by calling routine P
189. e acceptable to most HP GL 2 devices specifically the HP Laser et 3 Device type code HPGL2 Default file name pgpl ot hppl ot Default view surface dimensions 8128 by 10160 pixels 8 00 by 10 0 inches Resolution T he nominal resolution is 1016 pixels inch but the actual resolution will vary depending on the display device Color capability Color indices 1 6 are accepted and are interpreted as pen nurbers Input capability None Author Colin J Lonsdale 1990 Hewlett Packard HP 7221 pen plotter Device type code HP 7221 Default file name popl ot hppl ot Houston Instruments HIDMP Pen Plotter HIDRIV Supported device Houston Instruments pen plotters implementing the HIDMP control commands Device type code HIDMP Default device name pgplot hi plot Default view surface dimensions 2099 x 1599 pixels 10 5 x 8inches Resolution T he nominal resolution is 200 pixels per inch the actual resol ution depends on the pen used Color capability Only color index 1 is supported erase in color index 0 is not possible T he color is determined by the pen installed on the plotter Input capability None File format ASCII text Author T J Pearson 1987 ZETA Plotter ZEDRIV Supported device Zeta 8 Digital Plotter Device type code ZEta Default file name PGPLOT ZET Default view surface dimensions 11 inches by 11 inches Current version does not allow larger plots although the manual indicates plo
190. e axis range is srrall compared with the absolute values of the endpoints an integer overflow can occur V MS or the axis can be labeled incorrectly UNIX Example range 2200 0 to 2200 01 e PGCONF has sore algorithmic problems noted in the subroutine synopsis e PGCONL with arrays larger than 100x 100 pixels the routine does not place labels precisely as advertised T his is a design flaw It arises because the contouring routines do a segrrent of the array at atime not more than 100x 100 T his breaks continuous contours and interferes with the labeling sequence tried to mitigate this in 5 0 3 by increasing the segment from50x50 to 100x 100 but this only helps a bit I ll try to do something about this in a later version Ideally would like to allocate a temporary work array equal in size to the array to be contoured but that is not very portable also need to make labeling and blanking PGCONL and PGCONT work together at present you can have either one but not both PGCONL implicitly requires that PGCINT be greater than PGCMIN this is an unnecessary restriction e PGNUMB this routine does not always honor a request for decimal fornet 1 but will use an exponential format instead e PGQDT note that some PGPLOT installations include stub drivers that should not be called PGQDT returns a blank TYPE string and T LEN 0 for such drivers If you use PGQDT inaprogram you should test for this condition before using the inform
191. e can then be combined with PGBAND to interactively manipulate the displayed colors of data previously plotted with PGIMAG Limitations 1 Sore devices do not propagate color representation changes to previously drawn graphics 2 Sore devices ignore requests to change color representations 3 T he appearance of specific color representations on grey scale devices is device dependent Notes T o reverse the sense of a color table change the chosen contrast and brightness to CONT RA and 1 BRIGHT In the following the term color table refers to the input L R G B arrays whereas color rarp refers to the resulting ramp of colors that would be seen with PGWEDG Arguments L input An array of NC norrrelized ramp intensity levels corresponding to the RGB prirrary color intensities in R G B Colors on the ramp are linearly interpolated fromneighbouring levels Levels must be sorted in increasing order 0 0 places a color at the beginning of the ranp 1 0 places a color at the end of the ranp Colors outside these limits are legal but will not be visible if CONT RA 1 0 and BRIGHT 0 5 R input An array of NC normalized red intensities G input An array of NC norrrelized green intensities B input An array of NC normalized blue intensities NC input The nurber of color table entries CONT RA input The contrast of the color ranp normally 1 0 Negative values reverse the direction of the ranp
192. e g setenv PGPLOT_TYPE ps PGPLOT_ ENVOPT Character string T his affects prograrrs that call routine PGENV T he characters supplied are options for PGBOX in addition to those assumed by default by PGENV i e BCNST Useful options include G to draw a grid V to draw y axis labels upright I to draw axis tick marks outside the box instead of inside 1 or 2 to change the nurreric label style e g setenv PGPLOT_ENVOPT IVG PGPLOT FOREGROUND Color narre T his variable can be used to change the color representation of color index 1 the foreground color fromits device dependent default usually white or black T he value of the variable should be a color name defined in the color nan database If the variable is defined the effect is the sare as a call to PGSCRN with this name as argument intrediately after the graphics device is opened Color names are case insensitive and embedded spaces are ignored e g setenv PGPLOT FOREGROUND springgreen PGPLOT BACKGROUND Color name T his variable can be used to change the color representation of color index 0 the background color fromits device dependent default usually black or white T he value of the variable should be a color nan defined in the color narre database If the variable is defined the effect is the sarre as a call to PGSCRN with this narre as argument immediately after the graphics device is opened On devices without a color lookup table changing the back
193. e handles this transparently for input only strings by using strlen to determine the length of the string but for return string argurrents it needs to be told the length available in the passed char array Fortunately all PGPLOT routines that return such strings also have an argurrent to return the unpadded length of the return string In CPGPLOT you must initialize this argument with the dimension of the string array that has been sent In the prototypes listed in cpgplot h the length arguments are distinguishable by virtue of their having the name of the string to which they relate postfixed with _length For example the PGPLOT routine PGQINF is prototyped as void cpgqinf char item char value int value_ ength where the value_length argument is the length argument for the string argument value For exanple to write a C function to return 1 if aPGPLOT device is open or 0 otherwise one could write include cpgplot h int pgplot_is_open void char answer 10 The PGQINF return string int answer_len sizeof answer allocated size of answer cpgainf ST AT E answer amp answer_len return strcp answer Y ES 0 Note that the dimension sent as the third argurrent is the total number of characters allocated to the answer array T he interface function actually subtracts one fromthis when it tells PGPLOT how long the string is T his leaves roomfor the interface function to terminate the returned stri
194. e it and then modify the shell variable assignments to suite your system Note that within these scripts no spaces are tolerated around the operator and that you should enclose the assignment string within double quotes Configuration file variables Sorre of the supported variables are obligatory while others are optional T he required variables and their meanings are XINCL T he argument used to tell the C compiler where the X11 include directory can be found If your machine doesn t have X windows assign the empty string e g XINCL XINCL I usr local incl ude XINCL 1 usr openwin include FCOMPL T he commrand used to invoke the FORT RAN compiler e g F COMPL f77 F COMPL fort77 F COMPL fortran F COMPL frt F COMPL gf 77 FCOMPL xlIf FFLAGC Any FORT RAN compiler flags required for compiling and linking the PGPLOT library Note that this should not include the c or o options which are autorretically added where needed by the makerrake script Examples of possible flags to include are optimization level flags and flags pertinent to creating shared libraries where possible T his is usually an option to generate position independent code e g z fpic K PIC An option to check for undeclared variables e g u may be specified but is not required An option to use static rather than automatic storage e g static is not required but may be used PGPLOT should work
195. e left edge of the rectangle are to be filled with the background color Vertical scrolling is defined similarly Parameters passed to handler e NBUF 6 e RBUF 1 RBUF 2 x y coordinates of lower left corner of rectangle e RBUF 3 RBUF 4 x y coordinates of upper right corner of rectangle e RBUF 5 RBUF 6 dx dy coordinate offsets of the scrolled rectangle All of these pararreters are intended to be integral and should be rounded to the nearest integer Note that RBUF 5 and RBUF 6 are allowed to exceed the lengths of the corresponding sides of the scrolling region In such cases the region should be completely filled with the background color Next Appendix F PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995 1996 California Institute of Technology Introduction T hese instructions are for Version 5 2 of PGPLOT Toinstall PGPLOT you need to performthe following steps T hese steps are described more fully below for each operating system Read the release notes file ver520 txt to see what is new in this version 1 Copy the distribution file by anonymous ftp from Caltech T his is a gzipped tar archive ftp ftp astro caltech edu pub pgpl ot pgpl ot 5 2 tar gz 2 Unpack the distribution file to create the PGPLOT distribution directory tree T his is identical for all implementations of PGPLOT and can be placed on any disk that is visible on the target sys
196. e once for a plot session which could consist of several frames should be done here Allocate buffer if its size is fixed for the device No visible I O should be performed on an interactive device e g the screen should not be cleared this should be deferred until the begin picture call Pararreters passed to handler e RBUF 3 if this is not 0 0 the device specification included the APPEND flag If this flag is specified the device handler should suppress any initial screen erase so that the new image is superimposed on any previously displayed image T he device handler may ignore this if it is inappropriate e g for a hardcopy device e CHR L CHR the file device to be opened T his may be a physical device narre or the narre of a disk file Pararreters returned by handler e RBUF 1 identification number for the opened device PGPLOT will use this number in subsequent select device calls for this device see OP CODE 8 e RBUF 2 error flag 1 0 indicates that the workstation was opened successfully any other number indicates an error OPCODE 10 Close workstation Close the device opened by the open workstation command and deallocate any resources allocated for the device e g memory I O channels OPCODE 11 Begin picture Prepare the workstation for plotting T his command has two arguments which specify a size for the view surface overriding the default size if the device handler is unable to change
197. e origin T he input array for PGCONX should be dimensioned 11 5 and data values should be provided for all 55 elements PGCONX can also be used for special applications in which the height of the contour affects its appearance e g stereoscopic views T he rap is truncated if necessary at the boundaries of the viewport Each contour line is drawn with the current line attributes color index style and width except that if argument NC is positive see below the line style is set by PGCONX to 1 solid for positive contours or 2 dashed for negative contours Attributes for the contour lines can also be set in the user supplied subroutine if desired Argurrents A input data array IDIM input first dimension of A J DIM input second dimension of A 11 12 input range of first index to be contoured inclusive J 1 J 2 input range of second index to be contoured inclusive C input array of NC contour levels dimension at least NC NC input number of contour levels less than or equal to dimension of C If NC is positive it is the number of contour levels and the line style is chosen autorretically as described above If NC is negative it is minus the number of contour levels and the current setting of line styleis used for all the contours PLOT input the address nams of a subroutine supplied by the user which will be called by PGCONX to do the actual plotting T his must be dec
198. e ring T here should be solid and open versions of each symbol User defined symbols A method of defining new symbols that can be used as graph rrarkers like the built in ones Bar and colum charts An example programis included in PGPLOT v5 2 0 pgdenv16 and intend to include the subroutine in the main pgplot library in a future version Comments on the design of this subroutine are solicited Surface Plots of 2 D arrays and functions Todo this properly requires full three dimensional graphics capability which is beyond the scope of PGPLOT However a restricted implementation might be possible Meanwhile see demo program pgdenn7 f Variable line width Allow line width to be a real float parameter rather than an integer this would require new routines P GSL W and PGQL W would not be changed Control of dashed line appearance T he ability to set the scaling of the dashed or dotted or dash dotted etc line styles and alter the dash pattern Color Provide a way to determi ne whether the active device is true color or pseudo color with a dynamic lookup table String input Put a prompt on a plot and then read back a nurvber or string with echo editing etc A prototype subroutine to do this is include in pgderno14 in version 5 1 0 more work is needed before it can be included in the PGPL OT library J ournalling PGPLOT should be able to save the plotting instructions used to create the current picture so that they can be used
199. e scalars constants or variables If NS is 1 then SYMBOL may bea scalar If Nis less than 1 nothing is drawn PGPOLY draw a polygon using fill area attributes void cpgpol y int n const float xpts const float y pts SUBROUTINE PGPOLY N XPTS YPTS INTEGERN REAL XPT S YPT S Fill area primitive routine shade the interior of a closed polygon in the current window T he action of this routine depends on the setting of the F ill Area Style attribute see PGSF S T he polygon is clipped at the edge of the window T he pen position is changed to XPT S 1 Y PT S 1 in world coordinates if N gt 1 If the polygon is not convex a point is assumed to lie inside the polygon if a straight line drawn to infinity intersects and odd number of the polygon s edges Argurrents N input number of points defining the polygon the line consists of N straight line segrrents joining points 1 to 2 2 to 3 N 1to N N to 1 N should be greater than 2 if it is 2 or less nothing will be drawn XPTS input world x coordinates of the vertices YPTS input world y coordinates of the vertices Note the dimension of arrays XPT S and YPT S must be greater than or equal to N PGPT draw several graph markers void cpgpt int n const float xpts const float ypts int symbol SUBROUTINE PGPT N XPTS YPTS SYMBOL INTEGERN REAL XPT S YPT S INT EGER SYMBOL Primitive routine to draw Graph Markers pol y
200. e the appropriate device specific command A PGPLOT graphical output device is described by a device specification that consists of two parts separated by a slash the device narre or file name and the device type 1 4 1 Device Name device nares or file name is the narre by which the output device is known to the operating system For most hardcopy devices this should be the nan of a disk file while for interactive devices it should be the nan of a device of the appropriate type in both cases the narre should be specified according to the syntax of the operating systemin use If the device or file nan includes a slash enclose the narre in double quotation rrarks If the device narre is omitted fromthe device specification a default device is used the default depending on the device type see Appendix D In Unix device and file names are case sensitive 1 4 2 DeviceT ype device type tells PGPLOT what sort of graphical device it is Appendix D lists the device types available at the time of writing together with the names by which they are known to PGPLOT If the device type is omitted a system dependent default type is assumed this is the value of the environment variable PGPLOT_TY PE T he device type is not case sensitive you can use uppercase or lowercase letters or a mixture of the two 1 4 3 Examples A window on the default Xwindow display screen e XWINDOW T ektronix 4006 4010 termi nal e
201. each panel these should be reset if necessary after calling PGPANL Nor does PGPLOT clear the panel call PGERAS after calling PGPANL to do this Argurrents IX input the horizontal index of the panel in the range 1 lt 1X lt numnber of panels in horizontal direction IY input the vertical index of the panel in the range 1 lt IY lt number of panels in horizontal direction PGPAP change the size of the view surface void cpgpap float width float aspect SUBROUTINE PGPAP WIDTH ASPECT REAL WIDTH ASPECT T his routine changes the size of the view surface paper size to a specified width and aspect ratio hei ght width in so far as this is possible on the specific device It is always possible to obtaina view surface smaller than the default size on sore devices e g printers that print on roll or fan feed paper it is possible to obtain a view surface larger than the default T his routine should be called either inmrediately after PGBEG or inmedi ately before PGPAGE T he new size applies to all subsequent images until the next call to PGPAP Argurmrents WIDTH input the requested width of the view surface in inches if WIDT H 0 0 PGPAP will obtain the largest view surface available consistent with argument ASPECT Linch 25 4 nm ASPECT input the aspect ratio hei ght width of the view surface e g ASPECT 1 0 gives a square view surface ASPECT 0 618 gives a horizontal rectang
202. eased 1995 12 29 sys_ mac directory updated 1996 01 23 sys_arc directory updated 1996 03 27 e Changes in Version 5 1 0 Released 1996 05 10 e Changes in Version 5 1 1 Released 1996 11 04 sys_arc directory updated 1996 11 06 e Changes in Version 5 2 0 Released 1997 06 16 e Changesin Version 5 2 1 Released 2000 12 07 e Changesin Version 5 2 2 Released 2001 02 26 e Known problems in PGPLOT version 5 2 e Wish list for future improverrents e Sore frequently asked questions Installation For instructions for obtaining PGPLOT frommy ftp site and for details of supported operating systems read the installation instructions If you cannot use ftp PGPLOT is available on tape for a fee Consult tjp _astro caltech edu Documentation T he manual PGPL OT Graphics Subroutine L ibrary by T J Pearson is being updated for version 5 2 of PGPLOT A draft of the manual is available see the T able of Contents A PostScript file of the manual will be made available when it is completed A PostScript file of the old manual version 4 9 0 27 Mbyte gzipped is still available but it does not include the many changes made in version 5 0 Calling PGPLOT FromOther Languages PGPLOT is distributed with subroutine interfaces for C and F ortran 77 these interfaces can also be used with C and F ortran 90 Several users have contributed bindings for PGPLOT that allow the PGPLOT functions to be called fromother
203. ecific libraries data files and demonstration prograns will be created It is recomended that you create new empty directories for these T hey should not be the sane directory In the examples below these directories are named usr local src pgplot distribution directory usr local pgpl ot target directory but you can use any convenient names Unusual root privileges are not required to install PGPLOT assuming you have write access to the directories A single distribution directory can be used to install versions of PGPLOT for different architectures in different target directories Copy the distribution file Copy the distribution file by anonymous ftp fromCaltech Use anonymous ftp user anonymous password your id username machine to node ftp astro caltech edu T he distribution file is a UNIX tar file compressed with gzip Issue the following ftp commands to retrieve the file cd pub pgplot binary get pgpl ot5 2 tar gz T he text files in this directory are also included in the tar file T he distribution file can also be fetched fromURL ftp ftp astro caltech edu pub pgp ot pgpl ot 5 2 tar gz Decompress the files Use gunzip and tar to decompress the archive and extract its contents T his will create directory pgpl ot and subdirectories in the current directory Make sure that your current directory is where you want to create the PGPLOT distribution directory tree cd usr local src gunzip c pgp
204. ed by the operating system File format A REGIS plot file is formatted in records of 80 characters or less and has no carri age control attributes The records are grouped into buffers each of which begins with a contrand to put the terminal into graphics mode and ends with a command to put it back into text mode T he terminal is in graphics mode only while a buffer is being transmitted SO a user s programcan write to the terminal at any time in text mode without worrying if it might bein graphics mode Obtaining hardcopy A hardcopy of the plot can be obtained using a printer attached to the VT 125 VT 240 terminal See the instruction manual for the terminal A plot stored in disk file can be displayed by issuing a TYPE contrand e g TYPE PGPLOT VT PLOT onaVT 1250r VT 240 Canon L aser Printer Supported device Canon L BP 8 A2 Laser printer Conforms to ISO 646 2022 2375 and 6429 specifications V DM graphics conforms to proposed Arrerican National Standard V DM mode Device type code CAnon or BCAnon landscape mode V CAnon portrait mode Device type CANON or V CANON uses vector instructions for printing while type BCANON produces a bitmap T he default bitmap size is 1556 blocks and takes 5 min parallel or 15 min serial 9600 baud to print T hus for simple line graphs CANON produces much smaller files typically lt 100 blocks that that plot in lt 30 sec However for complex graphs for example those obtai
205. ed only 255 colors not 256 Drivers Removed T he following device drivers have been moved into directory pgplot drivers old and cannot be selected in a norrral installation believe that no one is still using these drivers ardriv f Args image display grdriv f Grinnell image display ikdriv Ikon pixel engine lidriv Liacomdisplay pkdriv f and pzdriv f P eritek image displays vedriv f Versatec V 80 printer List of Changes pgpl ot aaaread ire copyright notice makedoc makehtm Updated date and version nurrber drivers list Added XMDRIV Motif driver Do not select this unless you have the necessary Motif support and plan to write Motif applications that call PGPLOT Removed obsolete drivers as noted above makerake Added new subroutines Added targets pgplot hlp VMS help file pgplot routines tex LaT eX pgmden example Motif application Name changes pgdisp is now pgdispd directory pgview is now pgview app NeXT makehel p New file Script to generate VMS help file maketex New file Script to generate LaT eX docurrentation pgdispd Changed nan of directory frompgdisp to pgdispd to avoid problems if you try to compile PGPLOT inthe source directory ver510 txt New file List of changes since previous version pgpl ot cpg cpgdern c Added a third page to exercise more routines cpgplot h Deleted file note that this file needs to be created as part of the install ation pgbind c Added C
206. eentrant polygon Support is added for the F reeBSD operating systemand for PCs running MS DOS with Salford Software F ortran pgplot sys_salford or Microsoft PowerStation F ortran pgplot sys_msdos All the UNIX configuration files have been modified to add a CF LAGD pararreter that controls linking of C programs that call PGPLOT pgpl ot aaaread ne Updated for version 5 0 2 ver500 txt ver501L txt Earlier release notes renamed and reforrratted ver502 txt Release notes for this release this file copyright notice Updated drivers list Updated for new drivers install txt Updated makerrake Add PGHT CH PGSHS PGQHS to routine list remove GRSF S Modify to avoid use of shell functions that are not supported by son old versions of the Bourne Shell pscaps sh New file Script to modify a PostScript file by moving the BoundingBox comment fromtrailer to header T his will convert a single page PGPLOT PostScript file into valid Encapsulated PostScript pgpl ot cpg cpgplot doc Added further instructions on linking C and F ortran libgcc_path sh A new script that tries to generate the correct linking commands for use with mixed Fortran and gcc pgpl ot drivers ccdriv f ladriv f Indriv f Remove backslashes and PDP 11 octal constants fromcode to improve portability but these drivers are probably still specific to VMS epdriv f Remove sorre V MS dependencies has not been tested under UNIX however hgdriv f New file Dri
207. ef yref callback client_ data T his function augments the X cursor with the type of rubber band specified in the mode argurrent It also optionally registers a callback function to be passed the world coordinates and character of key press and button press events T he cursor can subsequently be disarmed via a call to xmp_disarm_cursor T he cursor is autorratically disarmed when the device is closed to PGPLOT by cpgclos or cpgend and whenever the cursor is re armed Note that when the cursor is augmented the rubber band is redrawn every time that the PGPLOT buffer is flushed T his happens after every call to PGPLOT functions unless sensible use is made of cpgbbuf and cpgebuf to buffer sequential calls Be sure to use these functions properly if you don t want your PGPLOT code to be slow T he arguments of xn_arm_cursor are Widget widget The target PGPLOT widget T he widget must be open to PGPLOT int mode T he type of cursor to display from XMP_NORM_CURSOR T he un augmented X cursor XMP_LINE_ CURSOR A line drawn between xref yref and the pointer XMP_RECT CURSOR A rectangular cursor with opposing vertices at xref yref and the pointer XMP_YRNG_CURSOR T wo horizontal lines one through xref and the other through the pointer XMP_XRNG_CURSOR T wo vertical lines one through yref and the other through the pointer XMP_HLINE_CURSOR A horizontal line through the pointer XMP_VLINE_CURSOR A vertical line thro
208. efault compiler options are suitable in particular the Debug configuration is not optimized but the Release configuration uses full optimization If the choice of Release is not apparent use Build Set Active Configuration F romthe Build menu choose Build PGPLOT LIB Expect 7 Warning messages with ver 4 or 2 with vers 5 6 When both Debug and Release have successfully completed like to copy the Release version of the library so that subsequent applications can find it more easily ver 4 from x MSDEV PRO ECT S PGPLOT RELEASE to x MSDEV LIB ver 5 from x P rogram F iles DevStudio M yP rojects P GPL OT RELEASE to x ProgramF iles DevStudio DF LIB ver 6 fromx ProgramF iles Microsoft Visual Studio MyProjects P GPL OT RELEASE to x ProgramF iles Microsoft Visual Studio DF 98 L1B 6 Run the examples In the sarre Project Workspace use File New and the Projects tab or if using ver 4 Insert Project to create a QuickWin Application Name EXAMPLES T hen use Project Dependencies ver 4 Build Subproj ects to specify that PGPLOT is asubproject of EXAMPLES Oneat atins use Project Add to Project F iles ver 4 Insert F iles into Project to select a file fromx PGPLOT EXAMPLES T he previous file may be deleted fromthe F ileV iew window when success fully completed Fromthe Build menu choose Execute EXAMPLES EXE T he first page of the first test P GDE MOL F should be a parabola If there is no text on
209. efore making the version to be printed another is to cut and paste to a utility I use Paint Shop Pro in which you can adjust the color palette and a third way is to specify either the filenare ps PS or filename gif GI device and write a file Note this might bea good use for a custommenu entry in your application Yet another option is to create a second device window and change the color palette only in that window See PGDEMO13 for an example of multiple simultaneous windows 10 Finally this port has been thoroughly tested starting with earlier versions of PGPLOT and using the Microsoft compiler but no responsibility for any damages is accepted by either PAS CT D or even TJ P User input concerning features of the driver or this document is welcomed F requently Asked Questions A A window is created but nothing appears in it Most new graphics driver cards do not emulate color registers when they run in T rue Color 32 bit mode Y ou will have to reset the Display Properties Settings tab to a smaller number of colors such as High Color 16 bit B Graphs appear but no labels Review step 3 above T he version of file GRF ONT DAT for your corrpiler must be in directory C PGPLOT C All of the demo programs work except PGDE MO3 gives a Linker error T here is a bug in PGDE MO3 that is only picked up by these conpilers About 27 lines fromthe end of PGDEMO3 F the statement CALL PG
210. els inch but the actual resolution will vary depending on the display device Color capability Color indices 0 255 are accepted with standard defaults for color indices O0 15 If the color representation of a color index is changed it affects all pixels drawn in that color on the current page Input capability None Environment variables PGPLOT_GIF_WIDTH width of image in pixels default 850 PGPLOT_GIF_HEIGHT height of image in pixels default 680 File format GIF files are binary files Author Renko Scharroo TimPearson 1994 Transparent Background mages T he GIF 87a images produced by PGPLOT do not have a way of specifying a transparent background Y ou can nerk the background as transparent if you convert the file to GIF 89a format using giftrans and specify that color index 0 should be transparent e Giftrans source code for Unix is available fromthe European FTP site e Giftrans documentation nroff fornet is available fromthe European FTP site e Giftrans exe executable for DOS is available fromEuropean FTP site To use giftrans just type giftrans t index GIF 87a file gt GIF 89a file T his converts the G F 87a fileto a GIF 89a file with the index entry in the colormap made transparent Invoke giftrans with the option to see a complete usage description Hewlett Packard HPGL Plotters HPGL Hewlett Packard Graphics Language is a vector graphics format for control of pen plotters and aser printers man
211. encapsulates the manipulations necessary to call Fortran subroutines fromC prograr s e g converting C null termi nated char arrays to Fortran character strings T he wrapper library requires an ANSI compliant C compiler and is not available on all systems interlanguage calls are very difficult or impossible on some systerrs Changes to device drivers e PostScript the PostScript device driver device types PS VPS CPS and V CPS has been changed to handle the new PGIMAG routine Use CPS or VCPS for color images One side effect is that the monochrome types PS and VPS now honor color representation changes requested by PGSCR although they substitute a grey level for the requested color e X Window the X Window driver has had major changes to speed it up make it more portable and add new features T he window is now resizable and it is possible to specify that it stay up after the PGPLOT programexits T he driver provides support for the new cursor features in PGBAND T he number of colors reserved and the default placement of the window can be specified in X resources e GIF Graphics Interchange F orrrat a new driver to create GIF files type GIF or VGIF e PPM Portable Pixmep a new driver to create PPM files type PPM or VPPM e Many of the other drivers have been cleaned up to make themmore portable New routines F or details of all the PGPLOT routines see file pgplot doc or pgplot htm that the installati
212. enko Scharroo vtdriv virs f This is an alternative to vtdriv f It uses VMS specific Fortran but may work better than vtdriv f on V MS systers xwdriv c pgxwin_server c Bug fix images were displayed incorrectly on Some X servers with more than 8 bits per pixel pgpl ot exampl es pgdenv2 f Added exanple of Cyrillic text on page 3 pgpl ot src grdtyp f grpars f Bug fix improved rminrmetch routine for device types to allow eg HPGL even if HPGL 2 is also an option grpocl f Bug fix this is a support routine for polygon fill with PGPOLY etc A polygon with one vertex exactly aligned with the edge of the window was not clipped correctly thanks to Renko Scharroo for the bug fix pgopen f Bug fix and improvement in header comrents V 5 1 0 introduced a bug a device argurrent of with one or nore trailing spaces did not issue the correct prompt pgai nf f Change version to 5 1 1 pgsave f Correction in header comments pgsubp f T his routine was interpreting a negative NXSUB argurent incorrectly According to the documentation positive NXSUB should step through the panels in row order while negative NXSUB should step through themin column order but the routine was interpreting positive NXSUB as colunn order and negative as row order T he behavior has been corrected to match the docurrentation In version 5 1 0 pgbeg was changed to call pgsubp thus introducing this bug in pgbeg as well pgtbox f T he positioning of labe
213. ents MAXPT input maximumnumber of points that may be accepted NPT in out number of points entered should be zero on first call X in out array of x coordinates dimension at least MAXPT Y in out array of y coordinates dimension at least MAXPT Notes 1 On return fromthe program cursor points are returned in the order they were entered Routine may be re called with points already defined in X Y in NPT and they will be plotted first before editing 2 User commands the user types single character commands after positioning the cursor the following are accepted A Add add point at current cursor location D Delete delete ast entered point X eXit leave subroutine PGLDEV list available device types on standard output void cpgl dev void SUBROUTINE PGL DEV Writes to standard output a list of all device types available in the current PGPLOT installation Argurrents none PGLEN find length of a string ina variety of units void cpglen int units const char string float xl float y1 SUBROUTINE PGLEN UNITS STRING XL YL REAL XL YL INTEGER UNITS CHARACT ER STRING Work out length of a string in x and y directions Input UNITS 0 answer in normelized device coordinates 1 gt answer in inches 2 gt answer in nm 3 gt answer in absolute device coordinates dots 4 gt answer in world coordinates 5 gt answer as a fraction of the current
214. ested colormap type is not available the driver reverts to its default colormap search strategy By default the driver tries to allocate 100 colors T his number usually makes it possible to have two windows displayed simultaneously without having to allocate a private colormap T his helps to avoid colormap flashing as the pointer is moved between windows Y ou can override this default with a number in the range 2 to 255 by using the pgxwin Win maxColors X resource Input capability T he cursor is usually controlled by a mouse Cursor input is achieved by moving the cursor into the window and pressing either a mouse button or a keyboard key to select a given position in the window and return a key value T he mouse buttons are mapped to return characters A D and X The cursor can also be moved horizontally and vertically with the keyboard arrow keys each keystroke moves the cursor by one pixel or 10 pixels if the SHIFT key is depressed Rubber banding is supported see routine PGBAND With Click to focus window nanagers you may have to explicitly click on the window to enable keyboard input in the PGPLOT window X resources T he following optional X window resources can be used to specify configuration options On POSIX compliant systers these should be placed ina file called Xdefaults in your home directory Under VMS they should be placed in DECW USER_DEF AULT S DECW XDEF AULT S DAT Note that by default DECW USER_DEFAULTS is defined a
215. eturns 0 if the routine was successful 1 if an error occurred either the external file could not be read or the requested color was not defined in the file PGSFS set fill area style void cpgsfs int fs SUBROUTINE PGSFS FS INTEGER FS Set the F ill Area Style attribute for subsequent area fill by PGPOLY PGRECT or PGCIRC Four different styles are available solid fill polygon with solid color of the current color index outline draw outline of polygon only using current line attributes hatched Shade interior of polygon with parallel lines using current line attributes or cross hatched T he orientation and Spacing of hatch lines can be specified with routine PGSHS set hatch style Argument FS input the fill area style to be used for subsequent plotting FS 1 gt solid default FS 2 gt outline FS 3 gt hatched FS 4 cross hatched Other values give an error message and are treated as 2 PGSHLS set color representation using HLS system void cpgshls int ci float ch float cl float cs SUBROUTINE PGSHLS Cl CH CL CS INT EGER Cl REAL CH CL CS Set color representation i e define the color to be associated with a color index T his routine is equivalent to PGSCR but the color is defined in the Hue Lightness Saturation model instead of the Red Green Blue mode Hue is represented by an angle in degrees with red at 120 green at 240 and blue at 0 or 360 Lightness ranges fro
216. eve using either RGB or CMY K because different devices use different methods to represent color and different devices produce different ranges of colors Y ou will see differences e g between a printout and an on screen display of aPGPLOT PostScript file If color fidelity is important recommend that you import the PGPLOT fileinto a graphics application such as Adobe Photoshop on aPC or Macintosh with color managerrent software modern versions of Windows and MacOS are good about this but Unix is not After adjusting the colors to your liking save the filein PDF or PS forrrat fromthat program using any options recommended by your publisher PGPLOT T imPearson California Institute of Technology tjp astro caltech edu Copyright 1996 1999 California Institute of Technology PGPLOT Examples PGPLOT is designed to neke it easy to generate simple graphs while providing full capability for more complex graphs As an exanple of a simple graph here is a graph of the function y xexp x which was drawn with six PGPLOT subroutine calls PSPLOT Graph y x7exp x 0 6 0 4 a 0 2 D O o 2 4 4 3 10 This figure is a GIF file With no change to the source code the programcan also generate files in other formats such as PostScript Here is the F ortran code required to draw this graph with coments to explain the purpose of each subroutine call T he question mark as an argurrent to PGOPEN allows the user to specify a file nane a
217. ex end docurrent Limitations T he Lal eX picture environment has a very limited set of primitives In particular diagonal lines must be composed out of dots T his can lead to very large files F or some graphs especially with alot of shaded areas the capacity of many LaT eX systems can easily be exceeded Author Originally written by Grant McIntosh gmcint rel ay drev dnd ca F ebruary 1995 X Motif widget driver Author M C Shepherd 1996 Supported device Restricted to Motif applications on workstations running the X Window System V ersion 11 Release 4 and above Availability Released as a beta test driver in PGPLOT 5 1 0 Updated for general use in PGPLOT 5 2 0 See the changes section for revision details Device type code XMOTIF Device narre specification T he device narve used to refer to an already created and realized XmP gplot widget is the narre that was given to the widget as the first argument of XtV aCreateM anagedWi dget when the widget was created T he full device specification used to open a given widget to PGPLOT with cpgbeq or cpgopen can also be obtained through the xmp_device_narme convenience function Default view surface dimensions By default the size of an XnP gplot widget window is 256x 256 pixels T his can be overridden by setting the XnWheight and XmNwidth X resources when creating the widget Resolution T his depends on the monitor on which the windows are to be displa
218. except when these arguments have their default values 0 5 and 1 0 T he routine is desi gned for use in an interactive environment in which the user can explore the effect of changing these pararreters in the new version they behave somewhat more as one might expect paai nf Added ability to determi ne whether a device supports pgscrl New device drivers pgdriv device type PGMF Creates a disk file in a private PGPL OT Metafileforrrat T his is a portable file format using only printable ASCII characters It is intended to replace the old metafile created by MF DRIV which uses a binary machine dependent format Subroutines are being prepared to allow aPGPLOT programto read and display files written in this fornet an example programis provided in directory pgplot pgnf T he driver uses only standard F ortran 77 and so should be portable to all operating systers on which PGPLOT is supported tkdriv device type XT K For plotting in PGPLOT Tcl T k widgets under the X Window System UNIX systems only An example programis included F eedback on this driver would be appreciated send email to Martin Shepherd mcs _astro caltech edu Modified device drivers Ixdriv LaT eX picture environment driver Fixed bug picture size can now be adjusted with PGPAP Note T he PostScript driver gives much better results than this one if your LaT eX environnant allows PostScript files to be included in LaT eX docurrents xmdriv Motif widge
219. f available types can be determi ned by calling PGQNDT If the value of N supplied is outside the range from 1 to the number of available types the routine returns DLEN T LEN 0 Argurrents N input the nurrber of the device type 1 maximun TYPE output receives the character device type code of the Nth device type T he argument supplied should be large enough for at least 8 characters T he first character in the string is a character TLEN output receives the nurrber of characters in TYPE excluding trailing blanks DESCR output receives a description of the device type T he argument supplied should be large enough for at least 64 characters DLEN output receives the number of characters in DESCR excluding trailing blanks INTER output receives 1 if the device type is an interactive one 0 otherwise PGOQFS inquire fill area style void cpgafs int fs SUBROUTINE PGQFS FS INTEGER FS Query the current F ill Area Style attribute set by routine PGSFS Argument FS output the current fill area style FS 1 gt solid default FS 2 gt outline FS 3 gt hatched FS 4 gt cross hatched PGQHS inquire hatching style void cpgghs float angle float sepn float phase SUBROUTINE PGQHS ANGLE SEPN PHASE REAL ANGLE SEPN PHASE Query the style to be used hatching fill area with fill style 3 Argurrents ANGLE output the angle the hatch lines make with the horizontal
220. for x or top to bottomfor y PGPLOT uses the window specification to construct a mapping that causes the image of the window to coincide with the viewport on the view surface Furthermore PGPLOT clips lines so that only those portions of objects that lie within the window are displayed on the view surface Like the viewport the window must be defined before drawing any objects T he window can be defined either before or after the viewport the effect will be the sare T he default window set up by PGBEG has x limits 0 0 1 0 and y limits 0 0 1 0 If the ratio of the sides of the window does not equal the ratio of the sides of the viewport the mapping of the world coordinates onto the view surface results in an image whose shape is compressed in either x or y One way to avoid this compression is to carefully choose the viewport to have the sarre aspect ratio as the window Routine PGWNAD can do this it defines the window and simultaneously adjusts the viewport to have the sarre aspect ratio as the window T he new viewport is the largest that can fit inside the old one and is centered in the old one 3 5 Annotating the Viewport For a simple graph it is usually necessary to draw a frarre around the viewport and label the frame with tick marks and nurreric labels T his can be done with the routine PGBOX F or our sarmple graph the call might be CALL PGBOX BCT N 0 0 0 BCNST 0 0 0 Another routine PGLAB provides tex
221. formation amgrateful to Absoft Corporation for providing a copy of the compiler Most of the PGPLOT code including the standard drivers PostScript GIF should work without change on this system T here is currently no driver to display PGPLOT graphics in a Windows screen window this is obviously a major drawback However cannot yet predict when such a driver will be available Anyone interested in providing such a driver should contact me to avoid duplication of effort PGPLOT T imPearson California Institute of Technology tjp astro caltech edu Copyright 1999 California Institute of Technology PGPLOT Installation Instructions Windows 95 NT with Compaq Visual F ortran PGPL OT version 5 2 2 T he following notes are based on information received fromPhil Seeger Please send any suggestions for improvement to TimPearson Supported systent Microsoft Windows 95 or Windows NT with Compag Visual F ortran 5 0 Information about the compiler can be found at http www digital con fortran index htm Note T he Compaq Visual F ortran driver for Windows uses an extension quickwin which prevents the PGPLOT library frombeing dynamically loadable So although PGPLOT itself works code generated with it cannot be made into a shared object Among other things this means it cannot be used with PGPERL Installation Instructions 1 Download PGPLOT by your favorite method fromURL ftp ftp astro caltech edu pub pgpl ot popl ot 5 2
222. foro ozi one Fi 5 3 ae i 1 1 1 1 a a a H p 3 ia EE oza fovos joxe jomaz faves lome jono foray ome ora 4 5 5 Fi 5 3 r PGPLOT TimPearson California Institute of Technology tjp stro caltech edu Copyright 1995 California Institute of T echnology Figure B 3 PGPLOT Symbols ia J ae cu Bt oie ofl ove oFf1g I Il OF26 oF2 O72 ofa Es Me JA oyag 746 OFa Ora Ora OFaS F 7 oF6o FEN TE Ed a k ea a OBIE ta l is I he in EE I tH i oO Si Cc a Ey j p Z e gt bej q S 2 r a Ee i p D zeoe ore 7At oF23 oat oFa2 733 gt OF55 OF56 ores A 765 7 ofa oo OBE lt E pia p OBA 0B34 Te Pea 2m7 G ewa fecoe zmo 2c eoie jama Jers fect zme 2017 H I J K L M N 0 P Q PGPLOT TimPearson California Institute of Technology t p stro caltech edu Copyright 1995 California Institute of Technology Figure B 4 PGPLOT Symbols 2020 o 4 2022 2O23 2024 2025 2026 2O27 T U y wW x Y FA 2030 2031 2052 2035 2034 2035 2036 E FA H 8 I K 2040 20 2042 2043 2044 2045 20465 0 IT F i T T 2A ZERI 2ER 2EAJ 2O54 2AB 2056 A C D E F 2060 2O61 pa B 2063 2O64 2065 2066 ZOEF i K L if N 0 P 2070 S074 2O72 2073 2074 2075 2076 va T U F F X Y FA 2102 2193 21094 2705 2706 2197 2198 219 d e g h 2112 2113 2114 2115 116 2117 2118 l r TL P q r 2122 2123 21
223. fter calling PGBEG the programhas access to a view surface F or workstations it is a window on the workstation screen F or interactive devices this is the full screen of the device F or hardcopy devices it is a standard page usually about 10 inches width by 8 inches height ona device used in landscape mode e g device type PS or QMS or 8inches by 10 inches ona device used in portrait mode e g device type VPS and V QMS On sore devices it is possible to plot on a larger or smaller piece of paper than the standard page see the description of routine PGPAP which must be called immediately after PGBEG to change the size of the view surface T he different devices differ not only in the size of the view surface but also in its aspect ratio hei ght width PGPAP can be called to ensure that a plot has the sare aspect ratio no matter what device it is plotted on After completing a graph it is possible to advance to a new page to start a new graph without closing the plot file by calling PGPAGE CALL PGPAGE T his clears the screen on interactive devices or gives a new piece of paper on hardcopy devices It does not change the viewport or window T he last two arguments of PGBEG NX and NY can be used to subdivide the view surface into srreller pieces called panels each of which can then be used separately T he view surface is divided into NX horizontally by NY vertically panels When the view surface has been
224. g box of the text is filled with the color specified by PGST BG before drawing the text characters in the current color index set by PGSCI Use color index 0 to erase underlying graphics before drawing text Argurrent TBCI input the color index to be used for the background for subsequent text plotting T BCI lt 0 gt transparent default T BCI gt 0 gt text will be drawn on an opaque background with color index T BCI PGSUBP subdivide view surface into panels void cpgsubp int nxsub int nysub SUBROUTINE PGSUBP NXSUB NY SUB INT EGER NXSUB NY SUB PGPLOT divides the physical surface of the plotting device screen window or sheet of paper into NXSUB x NY SUB panels When the view surface is sub divided in this way PGPAGE moves to the next panel not the next physical page T he initial subdivision of the view surface is set inthe call to PGBEG When PGSUBP is called it forces the next call to PGPAGE to start a new physical page subdivided in the manner indicated No plotting should be done between a call of PGSUBP and a call of PGPAGE or PGENV which calls PGPAGE If NXSUB gt 0 PGPLOT uses the panels in row order if lt 0 PGPLOT uses themin column order e g NXSUB 3 NY SUB 2 NXSUB 3 NY SUB 2 112 3 1 3 5 4 4 5 6 2416 PGPLOT advances fromone panels to the next when PG
225. g the control middle mouse button menu Device spec file T FILE produces a disk file in T ektronix format T here are two points to note 1 it does not include the code to switch an XT ERM so you can only display itin an XTERM if the XT ERM is already in T ektronix mode 2 It uses the T ektronix extended high resolution addressing mode and apparently XT ERM doesn t recognize this so the plot is slightly garbled T here are many variants of the T ektronix format and this variety is exacerbated on VMS where you cannot use the sarre code to write to a terminal as you would use to write a disk file will try to address this problemin a future version of PGPLOT Basically need to modify the I O routines used by the T ektronix drivers so that they can be used to write a disk file as well as send output to a terminal T his would give you the option of a disk file with any of the T ektronix variants T EK XT ERM etc PGPLOT T imPearson California Institute of Technology tip stro caltech edu Copyright 1997 California Institute of Technology PGPLOT Wishlist Thisis alist of requested improvements that amconsidering for possible implementation in future versions of PGPLOT No promises are implied If you have other suggestions or want me to give high priority to any of the suggestions please let me know A double precision version of the library Maintaining two parallel versions of the library is time consuning and
226. gconb const float a intidim int jdim intil int i2 int j1 int j2 const float c int nc const float tr float blank void cpgconf const float a int idim int jdim intil inti2 int j1 int j2 float c1 float c2 const float tr void cpgconl const float a int idim int jdim int il inti2 intj1 int j2 float c const float tr const char label int intval int minint void cpgcons const float a int idim int jdim intil int i2 int j1 int j2 const float c int nc const float tr void cpgcont const float a int idim int jdim int 11 int i2 int j1 int j2 const float c int nc const float tr void cpgctab const float const float r const float g const float b int nc float contra float bright int cpgcurs float x float y char ch_ scalar void cpgdraw float x float y void cpgebuf void void cpgend void void cpgenv float xmin float xmax float ymin float yrrax int just int axis void cpgeras void void cpgerrL int dir float x float y float e float t void cpgerrb int dir int n const float x const float y const float e float t void cpgerrx int n const float x1 const float x2 const float y float t void cpgerry int n const float x const float y1 const float y2 float t void cpgetxt void void cpggray const float a int idim int jdim intil int i2 int j1 int j2 float fg float bg const float tr void cpghi2d const float data int nxv int nyv int ix1 int ix2
227. gh T he transformation matrix TR is used to calculate the world coordinates of the center of the cell that represents each array elerrent T he world coordinates of the center of the cell corresponding to array elerrent A I J are given by X T R 1 TR 2 1 T R 3 J Y T R 4 T R 5 l T R 6 J Usually T R 3 and T R 5 are zero unless the coordinate transforrration involves a rotation or shear T he corners of the quadrilateral region that is shaded by PGGRAY are given by applying this transformation to 11 0 5 1 0 5 12 0 5 J 2 0 5 Argun rts A input the array to be plotted IDIM input the first dimension of array A J DIM input the second dimension of array A 11 12 input the inclusive range of the first index 1 to be plotted J 1 J 2 input the inclusive range of the second index J to be plotted FG input the array value which is to appear with the foreground color corresponding to color index 1 BG input the array value which is to appear with the background color corresponding to color index 0 TR input transformation matrix between array grid and world coordinates PGHIZ2D cross sections through a 2D data array void cpghi2d const float data int nxv int nyv int ix1 int ix2 int iy1 int iy2 const float x int ioff float bias Logical center float ylims SUBROUTINE PGHI2D DATA NXV NYV IX1 1X2 IY 1 IY 2 X OFF 1 BIAS CENT ER YLIMS
228. gplot_scroll bar xn6crolledWindowWidgetClass w_top NULL Create a PGPLOT widget as a child of the scroll bar wi dget Giveit an initial size of 300x300 pixels and allow it to allocate up to 60 colors fromthe colormap used by the parent widget w_pgplot1 XtV aCreateM anagedWi dget pgplot1 xnP gplotWidgetClass w_scroll XnNheight 300 XnNwidth 300 XnpNnexColors 60 Create and display the application windows XtRealizeWi dget w_top Open w_p oplot1 as the current PGPLOT device if cpgopen xmp_device_name w_pgplotl lt 0 fprintf stderr F ailed to open PGPLOT widget s n xmp_device_narre w_pgplot1 exit 1 i Proceed with the Xt event loop XtA ppMainL oop app NOT REACHED return 0 T his example doesn t actually do anything useful except create a PGPLOT widget with scroll bars and open it to PGPLOT T o neake the example useful you would have to arrange for something to draw into the PGPLOT widget T his could be a work procedure a callback registered to a communication streamfor logging incoming data or a push button callback T he pgndenn der program provides a much more complete example T he source code for it can be found inthe PGPLOT distribution in pgplot drivers xmotif pgndeno c It is compiled automatically when the xndriv driver is unconmented in drivers list during PGPLOT installation Changes in the PGPLOT 5 2 0 release T he ru
229. ground color only affects the color of elements explicitly drawn in color index 0 T o ensure that the background of the entire view surface changes to the new color it is also necessary to call PGERAS at the start of each page e g setenv PGPLOT_ BACKGROUND slateblue PGPLOT BUFFER Switch If this variable is defined with any non null value PGPLOT buffers output T he effect is the sarre as if PGBBUF is called inmrediately after opening the graphics device and PGEBUF intrediately before closing it It will have no effect on progrars that already include these calls On sore devices buffering output can lead to large inproverrents in speed but enabling buffering may upset synchronization between graphical output and other programactivity e g setenv PGPLOT_BUFFER yes PGPLOT DEBUG Switch If this variable is defined with any non null value PGPLOT will print some debugging information on the standard output Currently this includes attempts to open input files binary font file and color narme database and when the null device is selected for output statistics of device driver calls eg setenv PGPLOT_DEBUG yes In addition to these environment variables several device drivers use device specific environment variables See the device descriptions for details Next Chapter 2 PGPLOT T imPearson California Institute of Technology tjel stro caltech edu Copyright 1995 California Institute of Technology 2 Simple Use
230. gurrents are used to set the origin of cursors that have anchor points The ci argument is aPGPLOT color index and is used to specify the color used to draw the cursor T he mode argument must be one of the following nares norm No cursor augrrentati on a line A line drawn between the specified anchor point and the position of the cursor a rect An open rectangle with vertices at the specified anchor point and the position of the cursor a yrng T wo horizontal lines extending the width of the view surface one passes through the Y coordinate of the specified anchor point and the other passes through the cursor T his was designed for selecting the end of a Y axis range whose start has already been selected a xrng T wo vertical lines extending the height of the view surface one passes through the x coordinate of the specified anchor point and the other passes through the cursor a hline A horizontal line that passes through the cursor and extends the width of the view surface T his was designed for selecting the start of a Y axis range E vli ne A vertical line that passes through the cursor and extends the height of the view surface T his was designed for selecting the start of an X axis range cross A crosshair cursor that passes through the cursor and extends the width and height of the view surface Note that this command will have no effect if the widget has not been opened to PGPLOT Also note that when the cursor is augmen
231. gvstd void SUBROUTINE PGVST D Define the viewport to be the standard viewport T he standard viewport is the full area of the view surface or panel less armargin of 4 character heights all round for labelling It thus depends on the current character size set by PGSCH Arguments none PGWEDG annotate an image plot with a wedge void cpgwedg const char side float disp float width float fg float bg const char abel SUBROUTINE PGWEDG SIDE DISP WIDT H FG BG LABEL CHARACTER SIDE LABEL REAL DISP WIDTH FG BG Plot an annotated grey scale or color wedge parallel to a given axis of the the current viewport T his routine is designed to provide a brightness color scale for an image drawn with PGIMAG or PGGRAY T he wedge will be drawn with the transfer function set by PGSIT F and using the color index range set by PGSCIR Argurrents SIDE input The first character must be one of the characters B L T or R signifying the Bottom Left T op or Right edge of the viewport T he second character should be l to use PGIMAG to draw the wedge or G to use PGGRAY DISP input the displacement of the wedge fromthe specified edge of the viewport measured outwards fromthe viewport in units of the character height Use a negative value to write inside the viewport a positive value to write outside WIDTH input T he total width of the wedge including annotation in units of the character
232. h rrarkers e PGPNTS draw several graph rrarkers not all the sane Text T he basic routine for drawing text is PGPT XT PGT EXT provides a simplified interface for the commonest case e PGTEXT writetext horizontal eft justified e PGPT XT write text at arbitrary position and angle In order to correctly position text on a graph it may be necessary to determine the space occupied by a text string without actually drawing it e PGLEN find length of a string ina variety of units e PGQTXT find bounding box of text string Arrows An arrow is made up of a line for the shaft and a polygon for the head but can be regarded as a separate primitive e PGARRO draw an arrow Attributes Color e PGSCI set color index e PGQCI inquire color index e PGSCR set color representation e PGQCR inquire color reoresentation e PGSCRN set color representation by name e PGSHLS set color representation using HLS system Line Attributes e PGSLS set line style e PGQLS inquire line style e PGSLW set line width e PGQL W inquire line width T ext and Marker Attributes e PGSCF set character font e PGQCF inquire character font e PGSCH set character height e PGQCH inquire character height e PGQCS inquire character height in a variety of units e PGST BG set text background color index e PGQT BG inquire text background color index Fill Area Attributes e PGSFS set fill areastyle e PG
233. hange the fill area style use routine P GSF S T he following example uses both outline and solid fill it first erases a rectangle using color index 0 and fill area style 1 and then draws a frarre around it using color index 1 and fill area style 2 CALL PGSCI 0 CALL PGSF S 1 CALL PGRECT 0 31 0 69 0 85 0 97 CALL PGSCI 1 CALL PGSF S 2 CALL PGRECT 0 31 0 69 0 85 0 97 T he spacing and orientation of the hatching lines in styles 3 and 4 can be changed by calling routine PGSHS 5 10 T he Inquiry Routines T he current setting of each attribute can be determined with an inquiry routine e g PGQCH to determine the current character height A general purpose subroutine that needs to change attributes terrporarily should first determine the current settings and then restore thembefore finishing e g INT EGER LW Cl save the current attri butes CALL PGQLW LW CALL PGQCI CI change the attri butes and draw something CALL PGSLW 2 CALL PGSCI 11 CALL PGLINE 7 X Y restore the attributes CALL PGSLW LW CALL PGSCI Cl RET URN T here are also inquiry routines for determining the current window PGQWIN current viewport PGQVP and current pen position for use with PGMOVE and PGDRAW PGQP OS 5 11 Saving and Restoring Attributes It is sometimes convenient to change the current attributes terporarily to draw a sral prt of a picture for example and then restore themto their previous settings T his can
234. he OPEN staterrent for the output can be modified OPEN 2 FILE c pgplot grfont dat T he output file is different for Microsoft and Digital Cormpag T he directory with these two files can be elsewhere if identified by environment variable PGPLOT _DIR or the full path filenames can be given in environment variables PGPLOT_RGB and PGPLOT_FONT 4 Inthe Developer Studio in the F ile New menu Create a new Project Workspace of T ype Static Library Name PGPLOT Location X MSDEV PRO ECT S ver 4 or x ProgramF iles DevStudio MyP rojects ver 5 or x ProgramF iles Microsoft Visual Studio MyProjects ver 6 Use the Insert F iles into Project ver 4 or Project Add to Project F iles vers 5 6 and the search box to associate the foll owing files with the project X PGPL OT SRC F X PGPLOT SYS_WIN F x PGPLOT DRIVERS LXDRIV F NUDRIV F PSDRIV F T he dependent INC files will be included autorreti cally 5 Build the project F or Digital Cormpag the following compiler option is required for GIDRIV F because Digital changed the default for length of direct access records frombytes to 4 byte words assurre byterecl T his option is set as follows P roject Settings F ortran tab Settings F or All Configurations Source files Gidriv f Category F ortran Data ver 5 check Use Bytes as Units for Unformatted F iles ver 6 Data Options check Use Bytes as RECL unit for Unformatted F iles T he rerraining d
235. he PGPLOT shared library at run time assuring you haven t moved it after compilation pgplot sys_sun4 Changed version nurrber from1 7 to 1 8in all conf files pgplot sys_ vis bui ld com compile com Added new routines to shared library transfer vector Added instructions for linking with Motif library when needed grl otr f T his routine fornerly converted all PGPLOT device specifications to uppercase for VMS It now preserves case V MS file and device nan s are not case sensitive but some PGPLOT device specifications can be install com Added new target pgndemp to compile install the Motif demonstration program make_cpg com Corrected to use the version of cpgplot h in the current directory set correct protection on generated files make_pgdisp com Changed name of directory fromPGDISP to PGDISPD make_pgndeno com New file Used in compilation of the Motif example program pgplot sys_ win New directory fromP hil Seeger Port of version 5 1 0 to MS PowerStation F ortran Windows95 or WindowsNT environment See file aaaread me TimPearson California Institute of T echnology tjo stro caltech edu Copyright 1996 California Institute of Technology PGPLOT version 5 1 1 T ested Systems Version 5 1 1 has been tested with the following operating systers and compilers Drivers tested include GI GL NU PP PS TT VT WD X2 XM XW but not all combinations of drivers and systems have been tested exhaustively e SunOS
236. he absolute size of the view surface On sore devices it can be changed by calling PGPAP before starting a new page with PGPAGE On sore devices the size can be changed e g by a workstation window manager outside PGPLOT and PGPLOT detects the change when PGPAGE is used e PGPAP change the size of the view surface e PGQVSZ inquire size of view surface PGPLOT can divide the view surface into two or more panels to request this call PGSUBP after opening the device or before starting a new page When the view surface is divided into panels PGPAGE advances to the next panel only clearing the screen or starting a new page after all the panels have been filled It is also possible to move to a specific panel by calling PGPANL e PGSUBP subdivide view surface into panels e PGPANL switch to a different panel on the view surface T oimprove efficiency by buffering graphical output group a sequence of PGPLOT routines between PGBBUF and PGEBUF calls T o force a screen update call PGUPDT e PGBBUF begin batch of output buffer e PGEBUF end batch of output buffer e PGUPDT update display Windows and Viewports Specify the viewport to indicate where on the device s view surface you want the graph to appear e PGSVP set viewport norrrelized device coordinates e PGVSIZ set viewport inches e PGVSTD set standard default viewport e PGQVP inquire viewport size and position Specify the window to define the range of your wo
237. he characters passing through point X Y the positioning of the string along this line is controlled by argurent FJ UST ANGLE input angle in degrees that the baseline is to make with the horizontal increasing counter clockwise 0 0 is horizontal FJUST input controls horizontal justification of the string If FJ UST 0 0 the string will be left j ustified at the point X Y if FJ UST 0 5 it will be centered and if FJ UST 1 0 it will be right justified Other values of FJ UST give other justifications TEXT input the character string to be plotted PGQAH inquire arrow head style void cpggah int fs float angle float barb SUBROUTINE PGQAH FS ANGLE BARB INTEGER FS REAL ANGLE BARB Query the style to be used for arrowheads drawn with routine PGARRO Argurrent FS output FS 1 gt filled FS 2 gt outline ANGLE output the acute angle of the arrow point in degrees BARB output the fraction of the triangular arrow head that is cut away fromthe back PGQCF inquire character font void cpgacf int font SUBROUTINE PGQCF FONT INTEGER FONT Query the current Character F ont set by routine PGSCF Argument FONT output the current font number in range 1 4 PGQCH inquire character height void cpgqch fl oat si ze SUBROUTINE PGQCH SIZE REAL SIZE Query the Character Size attribute set by routine PGSCH Argument SIZE output current character s
238. he height of the PGPLOT window displayed in the widget It takes a standard T k width specification as its only argument T he default is 256 pixels width width T his specifies the width of the PGPLOT window displayed in the widget It takes a standard T k width specification as its only argument T he default is 256 pixels highlightbackground color T his sets the color of the widget s highlight border when the widget does not have the keyboard input focus It takes a standard T k color specification as its sole argurrent T he default color is grey chosen to match the default background color of most standard T k widgets highlightcolor color T his sets the color of the widget s highlight border when the widget has the keyboard input focus It takes a standard T k color specification as its sole argurrent T he default color is white such that it stands out against the default black background of the PGPLOT window highlightthickness width T his sets the width of the widget s highlight border T he single argument is a standard T k width specification By default the highlight thickness is zero If you intend to adopt T k s default click to focus input model and you intend to select for keypress events in the widget then be sure to set this thickness to a finite width such as 2 Otherwise users will not be able to tell when the widget has the keyboard input focus takefocus T his selects whether the widget will be given the keyboard inpu
239. he plot correctly T o fix this problem you may need to move the comment fromthe trailer to the header with a text editor or special program Alternatively you can define PGPLOT_PS_ BBOX MAX T his tells PGPLOT to put a BoundingBox coment in the header of the PostScript file the bounding box is one which encompasses the whole plottable area not a minimal one because PGPLOT does not know the correct bounding box until it has finished writing the file PGPLOT_ PS DRAW_BBOX If this variable is set the bounding box the smallest rectangle that includes all the graphics is drawn on each page PGPLOT_PS VERBOSE_T EXT If this variable is set the text of each plotted character string is included in the PostScript file as a coment before the sequence of vectors that represents the string T his makes the file slightly larger but it can be useful if you want to edit the PostScript file PGPLOT_PS EOF Normally the output file does not contain special end of file characters But if environment variable PGPLOT_PS_EOF is defined with any value PGPLOT writes a control D job separator character at the beginning and at the end of the file This is appropriate for Apple L aserWriters using the serial interface but it may not be appropriate for other PostScript devices PGPLOT_PS MARKERS Specify NO to suppress use of a PostScript font for the graph markers markers are then emulated by line drawing If this option is not requested PGPLOT graph rrarkers a
240. he right with spaces if necessary LENGTH output the number of characters returned in VALUE excluding trailing blanks PGQIT F inquire image transfer function void cpgaitf int itf SUBROUTINE PGQITF ITF INTEGER ITF Return the Image T ransfer F unction as set by default or by a previous call to PGSIT F Thelmage T ransfer F unction is used by routines PGIMAG PGGRAY and PGWEDG Argument ITF output type of transfer function see PGSIT F PGQLS inquire line style void cpgqls int Is SUBROUTINE PGQLS LS INTEGER LS Query the current Line Style attribute set by routine PGSL S Argument LS output the current line style attribute in range 1 5 PGQL W inquire line width void cpgql w int w SUBROUTINE PGQL W LW INTEGER LW Query the current Line Width attribute set by routine PGSL W Argument LW output the line width in range 1 201 PGQNDT inquire nurber of available device types void cpgqndt int n SUBROUTINE PGQNDT N INTEGERN Return the number of available device types T his routine is usually used in conjunction with PGQDT to get a list of the available device types Argurrents N output the number of available device types PGQPOS inquire current pen position void cpgqpos float x float y SUBROUTINE PGQPOS X Y REAL X Y Query the current pen position in world C coordinates X Y Argurrents X output world x coordinate
241. he window nurrber is a srrall integer used to identify individual windows created by PGPLOT You can either specify the number of an existing inactive window to reuse or provide a new nunber to assign to a new window If the nurrber is oritted or specified as zero then either the last window to becorre inactive will be reused or a new window will be created and assigned the lowest unused window number T he nurrber of each window is displayed in the title of the window T he host part of the specification is the address of the host on which the display resides If aDECNET address is used the host narre should be separated fromthe display number by two colons instead of one T he display part of the specification is the number of the display server on the given host Usually this is 0 but if you have multiple X terminals connected to the sarre machine then each terminal is generally assigned a different display number T he screen number is also usually 0 but if your display has multi ple screens then each is identified by asrmall integer F or example 2 foo wherever edu 0 0 xw opens PGPLOT window 2 as a xwindow window on host foo wherever edu Note that the symbol is optional if the display name is omitted T hus 2 xw opens window 2 on the default display Default view surface dimensions T he default geometry of each window is specified in pixels using the following hierarchy of specifications Missing details at each level are su
242. hen probably the best thing to do here is to simply try to compile PGPLOT without overriding any of the default FORT RAN code and see what the compiler or linker chokes upon Problems that might only show up at run time include o PGPLOT crashes when trying to read its FONT file This probably means that grsy00 f which relies upon being able to read large unformatted record sizes will need to be re written T his is a difficult problemto fix T he simplest way is to replace both pgplot sys grsy00 f and pgpl ot fonts pgpack f with versions that read and write a useable file fornet Both files should be placed in your local system directory makemake will pick themup fromthere and compile themin place of the default versions o When PGPLOT prompts for terminal input the cursor is placed on the line after the prompt This is only a cosmetic problem but if you can find a way to suppress the carriage return at the end of the prompt string the appearance will be better An optional routine that makerrake only compiles if it finds a version in your system directory is areplacerent for the common IAND intrinsic function T his is used by pgplot src grcl pl f and if your compiler doesn t have the IAND intrinsic you should place a function to replace it in your systemdirectory Its purpose is simply to return the bitwise logical AND of two FORT RAN integers C routines Where C routines have been used you should be aware that there is no guaranteed
243. hidethe PGPLOT server window set pgxwin server visible False pgxwin server iconGeorretry X Y T his specifies the position of the server window icon on the X display in display pixels The X and Y values specify the position of the top left corner of the window wrt the top left corner of the screen if positive or the bottomright corner wrt the bottomright corner if negative Note that resource specifications that start with pgxwin Win apply to all PGPLOT xwindow and xserve windows T o target options at specific windows replace the Win component of the specification with win where is the number of the PGPLOT window F or example pgxwin Win crosshair T rue pgxwin win2 crosshair False stipulates that all windows except PGPLOT window 2 will use a crosshair for the default cursor Note that Win is spelt with an upper case initial W whereas win is spelt with an initial lower case w T his is important because all resource names are case sensitive A better example of the utility of targeting options at specific windows is the following pgxwin Win georretry 500x500 600 360 pgxwin winl geometry 500x500 600 33 T his example places the first PGPLOT window in one position on the display and all other windows in a second location thus avoiding obscuring the first by the second etc Similarly if one wanted to dedicate one window to line graphics one could designate a specific window number to have a reduced number of co
244. hni ques Attributes Use different attributes to distinguish different datasets Graph markers can be distinguished by choosing different markers different colors or different sizes character height attribute Lines and curves can be distinguished by line style color or line width Box parameters If routine PGENV is replaced by calls to the nore basic routines see Section 3 6 including PGBOxX considerable variety in the appearance of the graph can be achieved F or example one can suppress the tick marks draw the tick marks projecting out of the box instead of into it or draw a grid over the whole viewport Note that PGBOX may be called many times one might call it once to draw a grid using thin dotted lines and again to draw the frarre and tick marks using thick lines CALL PGSLW 1 CALL PGSLS 4 CALL PGBOX G 30 0 0 G 0 2 0 CALL PGSLW 3 CALL PGSLS 1 CALL PGBOX ABCT SN 90 0 3 A BCT SNV 0 0 0 Note that in this example we have also specified tick intervals explicitly If the horizontal axis is to represent an angle in degrees it is convenient to choose a tick interval that is a simple fraction of 360 here we have a mejor tick interval of 90 degrees and a minor tick interval of 30 degrees Stepped line plots As an alternative to PGLINE which joins up the dots using straight line segrrents it is soneti mes appropriate to use PGBIN which produces a stepped line plot Sometimes misleadingly cal
245. hould set the OPCODE 4 response to disable hardware fill If hardware fill is enabled the handler should respond to this function by filling the polygon with the current color index T o draw an N sided polygon PGPLOT uses this opcode N 1 times Pararreters passed to handler on first call e RBUF 1 number of points N in polygon Pararreters passed to handler on next N calls e RBUF 1 x value e RBUF 2 y value OPCODE 21 Set color representation Assign the specified R G B color or the best available approximation to the specified color index If colors cannot be changed dynamically ignore the request Pararreters passed to handler e RBUF e RBUF e RBUF e RBUF 1 color index integer in range defined by OPCODE 2 2 red component 0 0 1 0 3 green component 0 0 1 0 4 blue component 0 0 1 0 ee mnm OPCODE 22 Set line width T his function is not used if OPCODE 4 indicates that the device does not support hardware thick lines Subsequent lines and dots should be drawn with the requested width or the closest available approximation T he units of line width are 0 005 inches A requested line width of zero should give the narrowest line available on the device hair line Pararreters passed to handler e RBUF 1 requested line width in units of 0 005 inch OPCODE 23 Escape function T his function allows an arbitrary character string to be sent to the device handler T he
246. ice For explanation see description of PGOPEN NXSUB input the nurrber of subdivisions of the view surface in X gt 0 or lt 0 NY SUB input the nurrber of subdivisions of the view surface in Y gt 0 PGPLOT puts NXSUB x NYSUB graphs on each plot page or screen when the view surface is sub divided in this way PGPAGE moves to the next panel not the next physical page If NXSUB gt 0 PGPLOT uses the panels in row order if lt 0 PGPLOT uses themin colunn order PGBIN histogramof binned data void cpgbin int nbin const float x const float data Logical center SUBROUTINE PGBIN NBIN X DATA CENT ER INT EGER NBIN REAL X DAT A LOGICAL CENTER Plot a histogramof NBIN values with X 1 NBIN values along the ordinate and DAT A 1 NBIN along the abscissa Bin width is spacing between X values Argurrents NBIN input number of values X input abscissae of bins DATA input data values of bins CENT ER input if T RUE the X values denote the center of the bin if F ALSE the X values denote the lower edge in X of the bin PGBOXxX draw labeled fran around viewport void cpgbox const char xopt float xtick int nxsub const char yopt float ytick int nysub SUBROUTINE PGBOX XOPT XTICK NXSUB YOPT YTICK NY SUB CHARACT ER XOPT YOPT REAL XTICK YTICK INT EGER NXSUB NY SUB Annotate the viewport with frarre axes numeric labels etc PGBOxX is calle
247. ich works well on the systems have tried f2c is unable to compile many of the PGPLOT device drivers that use non standard extensions to F ortran 77 e An ANSI C compiler for your computer system e Utilities for retrieving and unpacking the distribution file ftp or a Web browser tar and gunzip e Tousethe PGPLOT X window device drivers the X Window Systemfor your computer including the standard X header files h and the Xlib library e ousethePGPLOT Motif X window widget driver the X Window System the Xmand Xt libraries and associated header files e ousethe PGPLOT Tcl Tk X window widget driver the X Window System the tk and tcl libraries and associated header files Detailed installation instructions are available for the following operating systerrs e UNIX all varieties e For LINUX systerns see the note about precompiled binaries e VMS OpenVMS VAX or OpenVMS Alpha Digital Equipment Corp e Windows 95 98 NT_ with Absoft Pro F ortran Absoft Corp e Windows 95 NT with Digital Compag Visual F ortran Compaq Corp e Windows 95 NT with PowerStation F ortran Microsoft Corp e Windows 95 NT with GNU Win32 utilities e For Acorn RISCOS machines see the F ortran Friends web page A zip file of the RISCOS version can be downloaded from http www argonet co uk users fortran Deros P Gpl ot zi p F or Windows 95 98 NT 2000 etc also recommend using a version of PGPLOT that includes a drive
248. id or arbitrary irregular grid difficult o Interpolation between pixels o True color images Provide a way to specify separate R G B components for each pixel on devices that permit this rather than limiting colors to a 256 entry look up table Axes A user has requested the option of putting tick marks at non integer multiples of the interval e g 0 5 2 5 4 5 6 5 A user has requested logarithnic axes with bases other than 10 L og axes that span 1 decade or less not labeled very well A more intelligent version of PGLAB that could figure out where to put its labels without overlapping with numeric labels on the axis would be nice More control over the format of nurreric labels is needed e g to specify a fixed number of decirrel places A means to suppress labels at either end of an axis when they would overlap an adjacent plot eg options in PGBOX Date Axis An option in PGAXIS to treat a world coordinate as a tire or date e g Modified J ulian Date and label the axis with e g hours minutes seconds year and day year month and day month and year day of week Legends A convenient way to produce a legend for a plot i e alist of syrrbols line styles etc with associated text A general solution is quite difficult VMS Installation Procedure T his does not contain a way to extract the documentation fromthe source code Circles and Arcs Add acircle arc primitive to the driver interface Add aPGARC routine fo
249. ields are unsigned informs that time is decreasing fromleft to right not vice versa This can becorre very unclear if you have used the F option but that is your problem Exceptions to this labelling philosophy are when the finest time increment being displayed is hours with option Y or days Then all fields carry a label For example PGT BOX can be used in place of PGBOX it calls PGBOX and only invokes tine labelling if requested Other options are passed intact to PGBOX Inputs XOPT X options for PGT BOX San as for PGBOX plus Z for DD HH MM SS S time labelling Y means don t include the day field so that labels are HH MM SS S rather than DD HH MM SS S The hours will accumulate beyond 24 if necessary in this case X label the HH field as modulo 24 T hus a label such as 25h 10mwould corre out as 1h 10m H means superscript numbers with d h m amp s symbols D means superscript numbers with o amp symbols F causes the first label left or bottom most to be omitted Useful for sub panels that abut each other Care is needed because first label carries sign as well O means omit leading zeros in numbers lt 10 E g 3h 3m1 2s rather than 03h 03m01 2s Useful to help save space on X axes T he day field does not use this facility YOPT Y options for PGT BOX See above XTICK X axis major tick increment 0 0 for default YTICK Y axis major tick increrrent 0 0 for default If the Z option is
250. ilable a third argurrent is required Arg 3 fromthe above table usually this is composed of the two compiler narres separated by an underscore If you omit it makemake will indicate the allowed values Once you have supplied valid arguments makemake may complain that it can t find the drivers list file Go back to step 4 Example pgplot makemake pgpl ot sol2 f77_ gcc For additional information read file pgplot sys_sol2 aaaread me Reading configuration file pgplot sys_sol2 f77_gcc conf Selecting uncommented drivers from drivers list Found drivers GIDRIV NUDRIV PPDRIV PSDRIV TKDRIV TT DRIV WDDRIV XMDRIV XWDRIV Creating make file makefile Determining object file dependencies T he script makerake generates a file makefile for subsequent use a F ortran file grexec f that calls the selected device drivers and a text file rgb txt that contains color definitions for use by routine PGSCRN If you already have a file rgb txt possibly modified with your own customdefi nitions makerrake does not modify it It also copies two F ortran include files that will be needed during compilation So at this stage you will have at least the following files drivers list grexec f grpckgl1 inc makefile pgpl ot inc rgb txt You should check that these files have been created and you should also check that the list of drivers that makemake says that it found corresponds to those you selected in drivers list If your UNIX sys
251. implest routine for writing text is PGT EXT which writes a horizontal character string starting at a specific x y world coordinate position e g CALL PGTEXT X Y A text string PGT EXT is actually a simplified interface to the more general primitive routine PGPT XT which allows one to change orientation and justification of the text e g CALL PGPT XT X Y 45 0 0 5 A text string writes the text at an angle of 45 degrees to the horizontal centered at x y Both PGT EXT and PGPT XT require the position of the text string to be specified in world coordinates When annotating a graph it is usually more convenient to position the text relative to the edge of the viewport rather than in world coordinate space T he routine PGMT XT is provided for this and PGL AB provides a simple interface to PGMT XT for the norrrel job of annotating an x y graph T he appearance of text can be altered by specifying a nurrber of attributes described in the next chapter In particular the character size and character font can be changed F igure 4 2 illustrates sorre of the possibilities T o include one of the graph marker symbols 0 32 in a text string use the F ortran CHAR function e g CALL PGTEXT X Y Points marked with CHAR 17 4 5 1 Escape Sequences T he routine PGPT XT and all the PGPLOT routines which call it e g PGT EXT PGLAB allows one to include escape sequences in the text string to be plotted T hese
252. imply typing pgxwin_server with no argurrents should start the server and the server icon should appear on the display If an alternate display is desired then the default display can be overridden with the display argument Other options to override selected X resources fromthe command line are also available T o see themtype pgxwin_ server help Potential problems T he server fails to start If the server fails to start autorraticall y then this means that the xw and xs driver was unable to find the pgxwin_server executable It first looks in the directory specified in your PGPLOT _DIR environment variable or LOGICAL PGPLOT _DIR variable under VMS Under UNIX if it fails to find the executable there it then looks for the executable in each component directory cited in your PATH environment variable T o fix the problem first determi ne where the person who compiled PGPLOT installed pgxwin_server and then either place this directory narein your PGPLOT _DIR variable or under UNIX add it to your PATH If you are still unable to get the server to start autorratically please send ne Email at mcs _astro caltech edu In the meantime you can work around the problem by starting the server by hand as described previously X resource options are ignored First check check both the spelling and case of your resource names Resource names are case sensitive and must appear exactly as indicated above T he X resource database
253. in degrees increasing counterclockwise this is an angle on the view surface not in world coordi nate space SEPN output the spacing of the hatch lines T he unit spacing is 1 percent of the smaller of the height or width of the view surface PHASE output areal number between 0 and 1 the hatch lines are displaced by this fraction of SEPN froma fixed reference Adjacent regions hatched with the same PHASE have contiguous hatch lines PGQID inquire current device identifier void cpgqi d int id SUBROUTINE PGQID ID INTEGER ID T his subroutine returns the identifier of the currently selected device or 0 if no device is selected T he identifier is assigned when PGOPEN is called to open the device and may be used as an argurrent to PGSLCT Each open device has a different identifier T his routine was added to PGPLOT in Version 5 1 0 Argurrent ID output the identifier of the current device or Oif no device is currently selected PGQINF inquire PGPLOT general information void cpgainf const char item char value int value_length SUBROUTINE PGQINF ITEM VALUE LENGT H CHARACT ER ITEM VALUE INT EGER LENGTH T his routine can be used to obtain miscellaneous information about the PGPLOT environment Input is a character string defining the information required and output is a character string containing the requested information T he following itemcodes are accepted note that the strings
254. in the current window and viewport if PGF LAG 0 PGENV is called autorratically by PGHIST to start anew plot the x limits of the window will be DAT MIN and DAT MAX the y limits will be chosen autorratically IF PGFLAG 2 3 the histogramwill bein the sane window and viewport but with a filled area style If pgflag 4 5 as for pgflag 0 1 but sinple line drawn as for PGBIN PGIDEN write username date and time at bottomof plot void cpgiden void SUBROUTINE PGIDEN Write usernarre date and tine at bottomof plot Argurrents none PGIMAG color image froma 2D data array void cpgimag const float a int idim int jdim intil int i2 int j1 int j2 float al float a2 const float tr SUBROUTINE PGIMAG A IDIM J DIM 11 12 J 1 J 2 1 Al A2 TR INT EGER IDIM J DIM 11 12 1 2 REAL A IDIM DIM Al A2 TR 6 Draw a color image of an array in current window T he subsection of the array A defined by indices 11 12 J 1 2 is mapped onto the view surface world coordinate systemby the transformation matrix TR The resulting quadrilateral region is clipped at the edge of the window Each element of the array is represented in the image by astral quadrilateral which is filled with a color specified by the corresponding array value T he subroutine uses color indices in the range C1 to C2 which can be specified by calling PGSCIR before PGIMAG T he default values for C1 and C2 are device dependent these
255. inches 0 13 nm T he default width is 1 and the maximumthat may be specified is 201 Requesting a line width of 10 say will give lines that are approxi rately 1 20 inch thick e g CALL PGSLW 5 5 6 Character Height Character Height affects graph rmarkers and text Character height is specified as a multiple of the default character height the default character height one fortieth of the height or width of the view surface whichever is less T o change the character height use routine PGSCH Note that the argurrent is a real variable or constant not an integer like the other attribute routines T he following example is part of the programused to draw F igure 4 2 CALL PGSCH 1 5 CALL PGSLW 3 CALL PGT EXT 0 05 10 0 Bigger 1 5 CALL PGSCH 0 5 CALL PGSLW 1 CALL PGT EXT 0 5 10 0 Smaller 0 5 CALL PGSCH 1 0 5 7 Character F ont Character F ont affects text only F our fonts are available T he default font 1 is simple and is the fastest to draw T he font is defined by an integer code 1 norrrel simple font default 2 roman font 3 italic font 4 script font T o change the character font use routine PGSCF it is also possible to change the font temporarily by using escape sequences See Chapter 4 F or example the following code generates text in roman font INT EGER ROMAN PARAMET ER ROMAN 2 CALL PGSCF ROMAN CALL PGTEXT X Y SPQR 5 8 T ext Background T his attri
256. ine descriptions in Appendix A as described bel ow but cpgplot h should be consulted in case of doubt REAL and INT EGER argurrents Where the PGPLOT routine expects a REAL or INTEGER argument supply the C routine witha float or int argument as appropriate If the F ortran routine uses the argurrent for input only it should be passed by value but if it is used to return a value supply a pointer to a variable of the appropriate type If the FORT RAN argurrent is an array the C argument should be a pointer to an array F or two dimensional arrays supply a pointer to a one dimensional C array in which the elements are packed with the first index changing fastest see exarple below LOGICAL argurrents Where the PGPLOT routine expects a LOGICAL argurrent the C routine requires an int argument Zero is interpreted as FORT RAN FALSE and non zero as FORT RAN T RUE eg FORT RAN call C equivalent call s PGASK FALSE cpgask 0 PGASK TRUE cpgask 1 or cpgask 2 etc CHARACT ER argurrents When the F ORT RAN routine expects a CHARACT ER argurrent for input the C routine takes a norrrel C pointer to a nul termi nated string char array with end of string narked by 0 Arguments that are used to return FORT RAN character strings must be treated with care FORT RAN doesn t understand 0 termination of strings and instead requires that the dimension of the character array be specified along with the array T he interfac
257. ine to use a different set of device handlers no other changes to PGPLOT are needed Usually the F ortran code for GRE XEC is created automatically froma list of selected device handlers during the installation of PGPLOT Table E 1 Exarrple Device Dispatch Routine C GRE XEC PGPLOT device handler dispatch routine C SUBROUT INE GREXEC IDEV IF UNC RBUF NBUF CHR L CHR INT EGER IDEV IFUNC NBUF LCHR REAL RBUF CHARACT ER CHR C INT EGER NDEV PARAMETER NDEV 6 CHARACT ER 10 MSG C GOT O 1 2 3 4 5 6 IDEV IF IDEV EQ 0 THEN RBUF 1 NDEV NBUF 1 ELSE WRIT E MSG 110 IDEV CALL GRWARN Unknown device code in GRE XEC MSG ENDIF RET URN C 1 CALL NUDRIV IFUNC RBUF NBUF CHR LCHR RET URN 2 CALL PSDRIV IFUNC RBUF NBUF CHR L CHR 1 RET URN 3 CALL PSDRIV IFUNC RBUF NBUF CHR LCHR 2 RET URN 4 CALL TT DRIV IFUNC RBUF NBUF CHR L CHR 1 RET URN 5 CALL XWDRIV IFUNC RBUF NBUF CHR L CHR 1 RET URN 6 CALL XWDRIV IFUNC RBUF NBUF CHR L CHR 2 RET URN END Table E 1 gives an example T he first argument IDEV is an integer specifying the type of the currently selected device Routine GRE XEC calls the appropriate device handler for this type passing the rerai ni ng argurrents to the device handler If IDEV is zero GREXEC returns the number of device types available Some device handlers handle more than one PGPLOT device type e g in the above exanple PSDRIV handles both types PS and VPS T
258. ing to do when porting to a new systemis to create a systemdirectory for the port This is where system specific source code and systemattributes will be placed If the generic name for your systemis say xxx then the systemdirectory must be called pgplot sys_ xxx The xxx suffix is the narre used by users to to specify a systemtype to the makerreke script Create a configuration file T he next thing to do is to create a configuration file within the new systemdirectory Thisisa Bourne shell script containing assignments to the shell variables that determine how makermake will configure a makefile for your system Configuration files are distinguished fromother files by a conf file name extension If you intend to support more than one FORT RAN and or C compiler then one configuration file will be needed per compiler combination By convention configuration files are named as a_b conf where a is the name of the FORT RAN compiler and b is the nan of the C compiler T he first line must be a short Bourne shell comment that describes how the configuration differs fromother configuration files in the systemdirectory In most configuration files the comment just ellaborates on which FORT RAN and C compilers are being configured T he contrent is displayed alongside the configuration name when makerrake users fail to specify a configuration name T he easiest way to create a new configuration file is to copy one fromanother sys_xxx directory renam
259. inite plot scale is required T he argurrents are the sarre as for PGSVP but measured in inches fromthe bottomleft corner of the view surface F or example CALL PGVSIZ 1 5 9 5 1 5 6 5 defines a rectangular viewport 8 by 5 inches offset 1 5 inches fromthe bottomand left edges of the view surface PGV ST D defines a standard viewport the size of which depends on the particular device being used and on the current character size it uses the whole view surface excluding a margin of four character heights all around CALL PGVSTD T his is the default viewport set up by PGBEG Note that the viewport must be defined before calling any routines that would actually generate a display T he viewport may however be changed at any time this will affect the appearance of objects drawn later in the program 3 4 Defining the Window T he program defines the window by calling routine PGSWIN whose arguments specify the world coordinate limits of the window along each coordinate axis e g CALL PGSWIN 1975 0 1984 0 5 0 20 0 specifies that the x axis epoch is going to run left to right from1975 to 1984 and the y axis flux density is going to run bottomto top from5 to 204 y Note that the argurrents are floating point numbers F ortran REAL variables or constants and require decimal points If the order of either the x pair or the y pair is reversed the corresponding axis will point in the opposite sense ie right to left
260. ion to include the X11 library 2 Add the directory of the PGPLOT library to the list of directories in your LD_LIBRARY_PATH environment variable e g setenv LD_LIBRARY_PATH usr local pgplot usr openwin Iib usr dt lib 77 o example example I pgplot TheLD_LIBRARY_PATH variable is read both by the compile time linker and the run time linker so you no longer have to use L T he only disadvantage of this method is that if somebody else wants to use your programthey will also have to modify their LD_LIBRARY_PATH before running it 3 Place the directory of the PGPLOT library in yourLD RUN_PATH environrrent variable setenv LD_RUN_PATH usr local pgplot 77 o example example f L usr local pgplot l pgplot T he contents of the LD _RUN_PAT H variable are recorded in the executable and thereafter used as the path to search for shared libraries In this case you still have to use L or set your LD_LIBRARY_PATH appropriately to tell the linker where to find the library at link time but thereafter anybody will be able to run the program without modifying their LD_LIBRARY_PATH or LD_RUN_PATH variables 4 Usethe R switch of f77 in place of setting LD_RUN_PATH T his can be more problerratic because f77 quietly appends the path of its run time libraries to the LD RUN_PATH variable and this is ignored when R is used As a result you have to remember to specify the directory of the f77 libraries usually opt SUNWspro Iib 77 o exam
261. ions of Linux Id shared o ibcpgplot so whole archive lilbcpgplot a Run the demonstration programs Run the demonstration prograns on your selected devices and verify that they run satisfactorily Before running any PGPLOT program you must ensure that the environment variable PGPLOT _DIR is correctly defined T his is the name of the directory in which PGPLOT will look for the files grfont dat and rgb txt unless environment variables PGPLOT FONT and PGPLOT_RGB are defined to override this default behavior and if needed the X window server program pgxwin_ server UNIX csh setenv PGPLOT _ DIR usr local pgpl ot UNIX sh PGPLOT_DIR usr local pgplot export PGPLOT_DIR It is also convenient but not essential to define a default PGPLOT device with environment variable PGPLOT _ DEV e g UNIX csh setenv PGPLOT_DEV xwindow Other PGPLOT environment variables are described in the manual When using a UNIX shared library e g on Solaris 2 x you may also need to put the PGPL OT directory in your loader search path defined in environment variable LD_LIBRARY_PATH Torun a program type its narre with directory if the current directory is not in your path pgderro1 All the deronstration programs prompt for a device nan and type T ype a question rrark to see alist of the available device types and verify that PGPLOT has been configured properly Points to check for the PGPLOT programcorrectly reads the font file and dis
262. irectory PGPLOT looksinthe current default directory e g setenv PGPLOT _ DIR usr local lilb pgpl ot PGPLOT_FONT File nane for the binary font file If this variable is defined PGPLOT will interpret the value as a file narre for the binary font file If it is not defined PGPLOT will look for the binary font file under narre grfont dat in the directory specified by PGPLOT _DIR eg setenv PGPLOT_FONT usr local pgpl ot grfont dat PGPLOT_ RGB File nane for the color narre database If this variable is defined PGPLOT will interpret the value as a file nan for the color narre database If it is not defined PGPLOT will look for the binary font file under name rgb txt in the directory specified by PGPLOT_DIR T he color narre database is only used by programs that call PGSCRN or when environment variable PGPLOT _BACKGROUND or PGPLOT_FOREGROUND is defined e g setenv PGPLOT _RGB usr local pgplot rgb txt PGPLOT_DEV Device specification If this variable is defined it is used as the default device specification if the device specification given to PGBEG or supplied by the user in response to the PGPLOT prompt is a blank string this device specification is used e g setenv PGPLOT _ DEV xwin PGPLOT_TYPE Device type If this variable is defined it is used as the default device type if the device specification supplied to PGBEG consists of a file name without a trailing slash and device type this device type is assumed
263. ironment variable either in AUT OEXEC BAT or froma commend line before starting the application as follows SET PGPLOT_VIDEO VGA orV 640 480 SVGA or S 800 600 XGA or X 1024 768 ZGA or Z 1280 1024 Modes nay also be selected by using alternate device types WV IWS WX or WZ Modes exceeding the capability of your Windows screen driver will be reduced to the raximumavailable F or an example of the 236 color modes see PGDEMO4 For an example of different resolutions try using Menu WV for the first window and Graphs WX for the second window in PGDEMO13 Note the use of the device specification to name the window 8 T he cursor is emulated by an interrupt driven mouse routine see GRW901 in file W9DRIV F T he cursor moves continuously whenever the window is selected but the position is not returned to the calling programuntil a key has been struck and the character is also returned Control then returns to the text window for any additional input or processing If you lose track there is a status message at the bottomof the frame window which tells you which window is waiting for input except see Note in previous section T he color of the cursor may be dimagainst some backgrounds especially green in the default palette but you can usually see it at the tip of the mouse arrow while you move it around You might try using PGBAND mode 7 for the cursor to improve visibility See especially programs
264. is compiled by the pgxwin_server programwhen it is started Resources set after it has been started are ignored and pgxwin_server will need to be restarted before they are acquired T here are a nurrber of places in which the server can find resources and your specifications will not be seen if they appear in the wrong place pgxwin_server attempts to follow the rules laid down by the X T oolkit First it looks fora RESOURCE_MANAGER property on the root window of your display T his contains a list of resource names and values and corres into being when the standard xrdb programis applied to a resource file It is contron for xrdb to be applied autorratically to your Xdefaults file or to a system supplied xdefaults file when the X server is first started If this is the case then changes to your Xdefaults file will be ignored until the server is restarted or you explicitly re run the xrdb command If and only if the RESOURCE_ MANAGER property does not exist then under UNIX pgxwin_server looks for a file called Xdefaults in your home directory and under VMS it looks for a file called DECW USER_DEFAULT S DECW XDEFAULT S DAT If it finds this file it initializes its resource database fromit It then also looks to see if the XENVIRONMENT environrrent variable contains a valid file name and if so reads resources fromthat file overriding any contrasting resources fromyour X defaults file T o be sure that changes to resources in your Xdefaults a
265. ison Wesley 1990 section 13 3 5 Setting Color Representation by Name A third alternative to PGSCR and PGSHLS is routine PGSCRN which specifies color by name For example CALL PGSCRN 2 MediunOrchid IER T he nan is converted to R G B intensities by consulting an external file which is read the first time that PGSCRN is called T he nan of the external file is found as follows 1 if environment variable logical name PGPLOT_RGB is defined ts value is used as the file name 2 otherwise if environment variable PGPLOT _DIR is defined a file rgb txt in the directory named by this environrrent variable is used 3 otherwise file rgb txt in the current directory is used 4 If all of these fail to find a file an error is reported and the routine does nothing Each line of the file defines one color with four blank or tab separated fields per line T he first three fields are the R G B components which are integers in the range 0 zero intensity to 255 maxi mumintensity T he fourth field is the color name T he color nane may include erbedded blanks T he file rgb txt distributed with PGPLOT is based on the standard list of color names supported by the X window system Setting Background and F oreground colors at run time T he device dependent default color representation of color indices 0 background and 1 foreground can be overridden at run time by defining environment variables PGPLOT BACKGROUND and PGPOLOT FO
266. it is necessary to compute coordinates at fairly close intervals in order to get a smooth curve Any lines which cross the boundary of the window defined in PGENV are clipped at the boundary and lines which lie outside the boundary are not drawn T he arguments of PGLINE are like those of PGPT e T henurber of points defining the line integer e hexand y coordinates of the points real arrays 2 9 Ending the Plot Subroutine PGE ND must be called to complete the graph properly otherwise some pending output may not get sent to the device CALL PGEND 2 10 Compiling and Running the Program To compile the programand link it with the PGPLOT library see Chapter 1 For example under Unix emacs simple f f77 0 simple simple f lpgplot 1X11 Under VMS EDIT SIMPLE FOR FORTRAN SIMPLE LINK SIMPLE When you run the program it will ask you to supply the graphics device specification T ypein any allowed device specification or type a question rrark to get a list of the available device types For example if you are using an X Window display type XWIN the graph will appear on the terminal screen If you want a hard copy you can run the programagain and specify a different device type e g simple ps PS to make a disk file in PostScript fornet T o obtain the hard copy print the file but first check with your systemmanager what the correct print command is it is possible to waste a lot of paper by using the wr
267. it is relatively easy to add features like dialog boxes and custommenus Once PGPLOT LIB is built applications are most easily compiled using the Microsoft Developer Studio T he application type must be QuickWin or it must be compiled with command line option MW Programs execute in a text window with the graphical output in up to 8 separate child windows Cursor functions including rubber band modes are implemented by moving the mouse and typing a keyboard key T here are three versions of the Developer Studio You MUST have the sare version for F ortran and for C in order to mx languages Although the F ortran code is the sarre the user interface is slightly different T he versions are Developer Studio 4 0 Microsoft PowerStation F ortran 4 0 Developer Studio 5 0 Digital Visual F ortran 5 0 Developer Studio 6 0 Digital Visual F ortran 6 0 or Compaq Visual F ortran 6 1 NOT E applications developed in these F ortrans will NOT execute under DOS or Windows 3 x no not even with WIN32s installed T he steps in building PGPLOT LIB are the following 1 Download PGPLOT 5 2 0 by your favorite method decompressed ver 5 0 3 on VAX VMS system and ver 5 1 beta froma Unix machine uncompress followed by tar xcf But 1 have now acquired WinZip Nico Mak Computing Inc www winzip com which performs Gunzip and tar in the PC very good program even sent themthe 29 fee J ust make the file name PGP LOT 52 T GZ an
268. ith PGPAGE On sore devices the size can be changed e g by a workstation window manager outside PGPLOT and PGPLOT detects the change when PGPAGE is used Call this routine after PGPAGE to find the current size Note 1 the width and the height of the view surface in norrrelized device coordinates are both always equal to 1 0 Note 2 when the device is divided into panels see PGSUBP the view surface is a single panel Argurrents UNITS input 0 1 2 3 for output in normalized device coords inches nm or device units pixels output always returns 0 0 output width of view surface Y1 output always returns 0 0 output height of view surface PGQWIN inquire window boundary coordinates void cpgqwin float x1 float x2 float y1 float y2 SUBROUTINE PGQWIN X1 X2 Y1 Y 2 REAL X1 X2 Y1 Y2 Inquiry routine to determi ne the current window setting T he values returned are world coordinates Argurrents X1 output the x coordinate of the bottom eft corner of the window X2 output the x coordinate of the top right corner of the window Y1 output the y coordinate of the bottomleft corner of the window Y2 output the y coordinate of the top right corner of the window PGRECT draw a rectangle using fill area attributes void cpgrect float x1 float x2 float y1 float y2 SUBROUTINE PGRECT X1 X2 Y1 Y 2 REAL X1 X2 Y1 Y2 T his routine can be used instead of PGPOLY for
269. ith the current color index but they must not erase previously drawn graphics Handlers that cannot draw the rubber band lines should treat all modes as mode 0 Pararreters passed to handler RBUF RBUF 1 initial x position of cursor 2 initial y position of cursor 3 x position of reference point 4 y position of reference point RBUF 5 mode 0 no feedback 1 rubber band 2 rubber rectangle 3 vertical range 4 horizontal range 5 horizontal line 6 vertical line 7 cross hair xY 1 2 3 4 e o o o JJ W Cc mn Pararreters returned by handler e RBUF 1 x position of cursor e RBUF 2 y position of cursor e CHR 1 1 character typed by user OP CODE 18 Erase alpha screen If the graphics device is a terminal that displays both graphics and text on the sarre screen clear the text screen leaving graphics unchanged All other devices should ignore this opcode OPCODE 19 Set line style T his opcode is not used if OPCODE 4 indicates that the device does not support hardware dashing PGPLOT will use software generated dashed lines Pararreters passed to handler e RBUF 1 requested line style integer 1 5 OPCODE 20 Polygon fill T his function is not used if OPCODE 4 indicates that the device does not support hardware polygon fill T he polygon may be arbitrarily complex concave or re entrant if the hardware cannot cope with this the handler s
270. ive it is minus the number of contour levels and the current setting of line styleis used for all the contours TR input array defining a transformation between the I J grid of the array and the world coordinates T he world coordinates of the array point A I J are given by X T R 1 T R 2 1 T R 3J Y T R 4 T R 5 Fl T R 6 J Usually T R 3 and T R 5 are zero unless the coordinate transforrration involves a rotation or shear PGCONX contour nep of a 2D data array non rectangular SUBROUTINE PGCONX A IDIM J DIM 11 12 J 1 2 C NC PLOT INTEGER IDIM J DIM 11 J 1 12 J 2 NC REAL A IDIM J DIM C EXTERNAL PLOT Draw a contour mep of an array using a user supplied plotting routine T his routine should be used instead of PGCONT when the data are defined on anor rectangular grid PGCONT pernits only a linear transforrration between the I J grid of the array and the world coordinate system x y but PGCONX permits any transformation to be used the transformation being defined by a user suppl ied subroutine T he nature of the contouring algorithm however dictates that the transformation should maintain the rectangular topology of the grid although grid points may be allowed to coalesce As an example of a deformed rectangular grid consider data given on the polar grid theta 0 1n pi 2 for n 0 1 10 and r 0 25m for m 0 1 4 T his grid contains 55 points of which 11 are coincident at th
271. ize dimensionless multiple of the default size PGQCI inquire color index void cpgaci int ci SUBROUTINE PGQCI Cl INTEGER Cl Query the Color Index attribute set by routine PGSC1 Argument Cl output the current color index in range 0 max T his is the color index actually in use and may differ fromthe color index last requested by P GSCI if that index is not available on the output device PGQCIR inquire color index range void cpgacir int icilo int icihi SUBROUTINE PGQCIR ICILO ICIHI INTEGER ICILO ICIHI Query the color index range to be used for producing images with PGGRAY or PGIMAG as set by routine PGSCIR or by device default Arguments ICILO output the lowest color index to use for images ICIHI output the highest color index to use for i mages PGQCLP inquire clipping status void cpgacl p int state SUBROUTINE PGQCLP STATE INTEGER STATE Query the current clipping status set by routine PGSCLP Argunert STATE output receives the clipping status 0 gt disabled 1 gt enabled PGQCOL inquire color capability void cpgqcol int ci 1 int ci2 SUBROUTINE PGQCOL CI1 CI2 INTEGER C11 Cl2 Query the range of color indices available on the current device Argurrent Cl1 output the minimumavailable color index T his will be either 0 if the device can write in the background color or 1 if not Cl2 output the maxi mumavailable color i
272. ize requested is larger than the default size You can still set the default size with environment variables PGPLOT_ PS WIDTH and PGPLOT_PS_HEIGHT T here are two side effects of this change 1 When PGPAP is used a portrait mode graph is placed in the lower left corner of the paper offset by the amount specified by environment variables PGPLOT PS HOFFSET and PGPLOT_PS_VOFFSET alandscape mode graph is placed in the sare corner of the paper but in this case it appears to be the top left corner 2 When PGPAP is used the bounding box cannot be guessed when the file is opened so you should not use the PGPLOT_PS_BBOX environment variable if you do not set this variable a correct bounding box will be written in the file trailer see the discussion in the note on the PostScript printer driver List of Changes pgpl ot aaaread me Revised for version 5 1 1 copyright notice Version number changed makerake It now issues a message encouraging the installer to read the appropriate README file ver511 txt new file List of changes this file pgpl ot drivers psdriv f Bug fixes PGPLOT PS HOFFSET andPGPLOT_ PS _VOFFSET were not decoded correctly bug introduced in v5 1 0 bounding box could be incorrect probably only on systems with non static allocation of F ortran variables Driver now honors all requests to change the paper size with PGPAP Optimization suppressed attempts to draw zero length continuation line segments thanks to R
273. k on LA 100 or L NOB Device type code LA50 Default device name LA50 PGPLOT LAPLOT Default view surface dimensions 9 5 in horizontal by 6 in vertical Resolution 72 x by 144 y pixels inch Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Input capability None File format V ariable length records with list carriage control maximum 80 bytes Obtaining hardcopy If the LA50 is connected to the user s VT 2xx or VT 3xx terminal then the printer can be accessed by sending the file directly to the terminal use PGPLOT device TT LA50 or DEFINE PGPLOT_LA50TT be sure to do a SET TERM F ORM if page spacing is inportant If the LA50is attached to a different terminal port e g T XZ99 which preferably has been set spooled use PGPLOT device T XZ99 L A50 or DEFINE PGPLOT_LAS5OT XZ99 Author B H T oby 1988 DEC L NO3 Laser Printer Supported device the LNO3 PL US Laser Printer Device type code L NO3 landscape orientation L V NO3 portrait Author Sid Penstone 1989 EPSON F X100 Dot Matrix Printer EPDRIV Author PSB 1987 AFT 1988 GenicomP rinter Supported device Genicom 4410 dot matrix printer Device type code GENICOM landscape V GE NICOM portrait Default device name PGPLOT PRPLOT Default view surface dimensions Landscape 10 25 in horizontal by 7 8 in vertical Portrait 7 8 in horizontal by
274. kefile pgderol pgdero16 derronstration programms pgdisp required by XDISP driver pgpl ot doc ASCII docurrentati on file pgxwin_ server required by XWINDOW driver rgb txt color narre database If you requested XMDRIV or T KDRIV you will also have sorre of the following files pgndemo executable denb program libXnPoplot a object library required by PGPLOT Motif applications XnP gplot h header file required by PGPLOT Motif applications libtkpgplot a object library required by PGPLOT T k applications pgtkdemo executable denb program pgtkdero tcl script used by denb program tkpgplot h header file required by PGPLOT T k applications If you want to copy the compiled version of PGPLOT to another directory you must copy at least the files marked with an asterisk T he documentation file contains the PGPLOT subroutine descriptions which are also available in the manual Install the C binding Optionally install and test the C binding for PGPLOT T his requires an ANSI C compiler that understands function prototypes and is not available on all systems make cpg T his creates three files cpgplot h ANSI C header file libcpgplot a library containing the C binding cpgdeno dermonstration program Note T he installation procedure does not create a shared library for the C binding If you want one you can create it by hand using the appropriate conmands for your system e g for some vers
275. l T k commands including those defined by the example program A more complicated demonstration programcormes with the PGPLOT distribution and is autorretically compiled if the T k driver is selected T o run it change to the pgplot installation directory and type pgtkdero pgtkdern tcl or potkdenv pgtkdern tcl colormap new if it complains about there being insufficient colors Note that this demo uses different resize strategies for its two PGPLOT widgets T he topnost pgplot widget displays a grey scale image and is slow to redraw so this has been given scrollbars If you resize the application to a smaller size then you will be able to use the scroll bars to see any part of the partially obscured image If you want to replot the image with the sare size as the shrunk widget simply select an image function fromthe option menu T he other pgpl ot widget displays a line graph which is quick to redraw so when the application is resized by the user the graph is redrawn to take advantage of the new size Frequently asked questions and answers T he following is a collection of problems that you might initially encounter and suggestions for how to resol ve them Why does the first plot that draw appear to have the wrong size Y ou probably attempted to plot in the widget before it had been displayed for the first time so the pgplot widget created a view surface that had the default or specified size of the widget rather than the size
276. l T k interfaces for PGPLOT have been developed by three groups o Nick Elias of the US Naval Observatory has released ptcl a package that registers PGPLOT functions as T cl contrands Information is available at http www InfoMagic con nme2 ptcl ptcl htm ptcl has been ported to OpenV MS by Gilles Ratel T he Sloan Digital Sky Survey project has developed aT cl interface to PGPLOT as part of its DERVISH package See the Dervish Horre Page for a description of the interface under P lotting For more information contact Eileen Berman PGT K by Brian T oby T his includes a driver for a T k canvas widget T he driver tkdriv distributed with PGPLOT is more powerful and is recommended for people using a Unix X window system o O YORICK A PGPLOT interface to the Y orick language has been written by Alexey Goldin alexey oddj ob uchicago edu See http flight uchicago edu gol din yorick pgplot Interactive Drawing Programs and Other PGPLOT Extensions T he following list does not include the many application specific programs that have been written using PGPLOT BUTT ON by N Cardiel and J Gorgas of the Universidad Complutense de Madrid is a package of subroutines to facilitate the creation of interactive F ortran programs using graphics buttons F or further information see the WWW page http www ucmes OT ROS Astrof button button htm GENPLOT by Dale Gary PGXT AL Devinder Sivia has written sorre 3D p
277. lags pertinent to creating shared libraries where possible the option usually required is the one that generates position independent code Also if your system exports FORT RAN syrrbols to the linker postfixed with an underscore then you should include the DPG_PPU flag e g CFLAGC CF LAGC 4z O D_HPUX_SOURCE CFLAGC DPG_PPU pic O T his should specify the loader flags required to cite any external libraries that are required when linking any of the dem and server progrars In most cases this is just the X windows library cited as L directory_ name 1X11 where directory_narre is the name of the directory in which the library resides e g LIBS LIBS L usr lib X11R5 1X 11 LIBS L usr openwin lib IX 11 RANLIB Many older UNIX systems require newly created or modified libraries to be post processed for better access speed On such systems you should set RANLIB ranlib On other systems you should set RANL IB echo ranlib T he following are optional If they are not pertinent to your systemconfi guration you must omit themfromthe configuration script MOTIF_INCLUDE MOTIF_LIBS On systems where Motif is installed the MOT IF_INCLUDE and MOTIF_LIBS configuration variables should contain flags telling the C compiler and loader where to find the include files and libraries associated with Motif T his should include files related to X11 Xt and Xm Note that the XINCL and LIBS variables are not consulted when com
278. languages Several of these bindings allow PGPLOT to be used interactively ADA Martin Stift has an ADA and ADA95 interface to PGPLOT C CCPL is an interesting graphing library interface for use with C A graph is generated by sending data to a stream e g pout lt lt line_plot my_data lt lt endp Author Matt Howlett University of Tasmania URL http ccpl sourceforge net GLISH A PGPLOT binding for GLISH has been developed as part of the ai ps project by a consortium led by the National Radio Astronomy Observatory it is currently in beta release F or details see the ai ps web page OCTAVE PGPLOT may be called fromthe Octave language for nurrerical computations via Matwrap fromGary Holt PERL PGPERL by Karl Glazebrook provides an interface between the Perl language and the PGPLOT FORT RAN library F or further information see the WWW page http www aao gov au local www kgb pgper PYT HON RUBY Nick Patavalis npat at efault net has developed an interface between PGPLOT and the Python and NunPy languages See http efault net npat hacks ppgpl ot Scott Ransom ransom cfa harvard edu has written another wrapper layer that simplifies use of this interface See ftp cfa ftp harvard edu pub ransony Ruby PGPLOT isaPGPLOT interface to the Ruby language written by Masahiro T anaka SCHEME Koji Ejiri has made a Gauche binding for PGPL OT Gauche is a Scherre interpreter TCL TK T c
279. lared EXTERNAL inthe programunit calling PGCONX T he subroutine PLOT will be called with four arguments CALL PLOT VISBLE X Y Z where X Y input are real variables corresponding to I J indices of the array A If VISBLE input integer is 1 PLOT should draw a visible line fromthe current pen position to the world coordinate point corresponding to X Y if it is 0 it should move the pen to X Y Z is the value of the current contour level and may be used by PLOT if desired Example SUBROUTINE PLOT VISBLE X Y Z REAL X Y Z XWORLD YWORLD INTEGER VISBLE XWORLD X COS Y this is the user defined Y WORL D X SIN Y transformation IF VISBLE EQ 0 THEN CALL PGMOVE XWORLD Y WORLD ELSE CALL PGDRAW XWORLD YWORLD ENDIF END PGCT AB install the color table to be used by PGIMAG void cpgctab const float const float r const float g const float b int nc float contra float bright SUBROUTINE PGCT AB L R G B NC CONT RA BRIGHT INTEGER NC REAL L NC R NC G NC B NC CONT RA BRIGHT Use the given color table to change the color representations of all color indexes marked for use by PGIMAG T o change which color indexes are thus marked call PGSCIR before calling PGCT AB or PGIMAG On devices that can change the color representations of previously plotted graphics PGCT AB will also change the colors of existing graphics that were plotted with the marked color indexes T his featur
280. ld always be paired PGBBUF increments an internal counter while PGEBUF decrements this counter and flushes the buffer to the output device when the counter drops to zero T his allows a subroutine to turn on and turn off buffering without disturbing any buffering that may have been established by the calling program Routine PGUPDT empties the buffer created by PGBBUF but it does not alter the internal counter T he routine should be called when it is essential that the display be completely up to date before interaction with the user for example but it is not Known if output is being buffered Usually output is not buffered this is the default state established by PGBEG T he default behavior can be changed however by defining an environment variable PGPLOT_ BUFFER If this variable is defined with any value PGBEG will start buffering output by calling PGBBUF T he following example shows how routine PGLAB might be implemented in terms of routine PGMT XT SUBROUTINE PGLAB XLBL YLBL TOPLBL CHARACT ER XLBL YLBL TOPLBL CALL PGBBUF CALL PGMT XT T 2 0 0 5 0 5 TOPL BL CALL PGMT XT B 3 2 0 5 0 5 XLBL CALL PGMT XT L 2 2 0 5 0 5 YLBL CALL PGEBUF END T he calls to PGBBUF and PGEBUF ensure that the output generated by the three calls to PGMT XT is buffered i e sent to the output device as a single command instead of three separate ones If buffering is already enabled by the programwhich calls
281. le ASPECT 1 618 gives a vertical rectangle PGPIXL draw pixels void cpgpixl const int ia int idim int jdim int il int i2 int j1 int j2 float x1 float x2 float y1 float y2 SUBROUTINE PGPIXL IA IDIM J DIM I1 12 J 1 J 2 1 X1 X2 1 Y 2 INT EGER IDIM J DIM 11 12 J 1 J 2 INT EGER IA IDIM J DIM REAL X1 X2 Y1 Y2 Draw lots of solid filled tiny rectangles aligned with the coordinate axes Best performance is achieved when output is directed to a pixel oriented device and the rectangles coincide with the pixels on the device In other cases pixel output is emulated T he subsection of the array IA defined by indices 11 12 J 1 J 2 iS mapped onto world coordinate rectangle defined by X1 X2 Y1 and Y 2 T his rectangle is divided into 12 11 1 J 2 J1 1 snell rectangles Each of these small rectangles is solid filled with the color index specified by the corresponding element of IA On most devices the output region is opaque i e it obscures all graphical elements previously drawn in the region But on devices that do not have erase capability the background shade is transparent and allows previ ously drawn graphics to show through Argurrents IA input the array to be plotted IDIM input the first dimension of array A J DIM input the second dimension of array A 11 12 input the inclusive range of the first index 1 to be plotted J 1 J 2 input the inclusive range
282. led a histogram with horizontal line segments at each data point and vertical line segments joining them T his is often used for example in displaying digitized spectra Error bars Graphs of real data often require the inclusion of error bars T he two routines PGERRX and PGERRY draw horizontal and vertical error bars respectively T hese routines are usually used in combination with PGPT e g to draw a set of points with 2 signa error bars DO 101 1 15 YHI Y PT S 1 2 0 E RR I YLO YPT Si I 2 0 ERR I CALL PGPT 1 XPT S I YPT S 1 17 CALL PGERRY 1 XPT S I YLO YHI 1 0 10 CONT INUE Logarithmic axes It is commonly required that the x axis the y axis or both be logarithmic instead of linear that is one wishes to plot the logarithmof the quantity instead of its actual value PGPLOT doesn t provide any automatic mechanismto do this one has to adopt 1099 x and or 10919 y instead of x and y as world coordinates i e if the range of xis to be 1 to 1000 choose as world coordinate limits for the window log 1 0 0 and log 1000 3 0 and supply the logarithms of x to PGPT and PGLINE However PGENV and PGBOX have options for abelingthe axis logarithmically if this option is used in our example the axis will have labeled major tick marks at 1 10 100 and 1000 with logarithm cally spaced minor tick marks at 2 3 4 20 30 40 etc An example may make this clearer CALL PGENV 2 0 2 0 0 5 2 5 1 30 CALL PG
283. licy This implements a click to focus model whereby the user must explicitly set the input focus either by pressing the TAB key repeatedly until the required widget is reached or by moving the pointer into the widget window and pressing a mouse button Unfortunately this means that when aPGPLOT widget doesn t have the keyboard input focus the first button press is used to acquire the input focus rather than being reported as cursor input Similarly once the widget has the keyboard input focus TAB characters are used to move the input focus to the next widget rather than being delivered as cursor input T his is confusing to users so it is better to either use the XnP OINT ER focus policy or to tell the widget that keyboard input is not desired as described above In order to allow users to determine in advance whether an XnP gplot widget has input focus the border of the widget is changed fromthe background color of its parent to white T his color was chosen so as to be distinct fromthe default black background color of XnP gplot widgets T he color and other aspects of highlighting can be changed via the highlighting resources of the Primitive widget Note that X conventions discourage applications frommoving the keyboard focus unless under user direction However in cases where the user presses a button who s primary function is to activate an XnP gplot cursor for user input you might consider actively setting the keyboard i
284. loat dy void cpgscrn int ci const char nare int ier void cpgsfs int fs void cpgshis int ci float ch float cl float cs void cpgshs float angle float sepn float phase void cpositf int itf void cpgsl ct int id void cpgsls int Is void cpgs w int Iw void cpgstbg int tbci void cpgsubp int nxsub int nysub void cpgsvp float xleft float xright float ybot float ytop void cpgswin float x1 float x2 float y1 float y2 void cpgtbox const char xopt float xtick int nxsub const char yopt float ytick int nysub void cpgtext float x float y const char text void cpgtick float x1 float y1 float x2 float y2 float v float tikl float tikr float disp float orient const char str void cpgupdt void void cpgvect const float a const float b int idim int jdim intil int i2 int j1 int j2 float c int nc const float tr float blank void cpgvsiz float xleft float xright float ybot float ytop void cpgvstd void void cogwedg const char side float disp float width float fg float bg const char l abel void cpgwnad float x1 float x2 float y1 float y2 ifdef cplusplus endif endif GIF Graphics Interchange F ormat GIF is a widely supported fornet for raster graphics defined by Compuserve Inc T he program xv by J ohn Bradley bradley cis upenn edu can be used to display GIF files on UNIX and VMS workstations PGPLOT uses the GIF 87a variant with up to 8 bits per pixel 256 colors
285. lors pgxwin winl0 maxColors 16 T his window would then be selected using a device specification of 10 xserve T he XWINDOW and XSERVE window server pgxwin_ server All PGPLOT xwindow and xserve windows on a single display are created and maintained by a separate server program called pgxwin_server If PGPLOT has been installed correctly then this programis autorretically started by the xw and xs driver when first called upon pgxwin_ server then continues to serve windows to subsequent PGPLOT prograns and remains running indefinitely In order that it be possible to kill the server an icon window for it is displayed Window managers generally provide a way to interactively kill windows and if this is applied to the server window then the server will close any inactive xserve windows and if no active xw or xs windows remain then the server will shut itself down cleanly Note that inactive windows are distinguishable from active windows by the appearance of a skull and crossbones cursor If pgxwin_server fails to start autormatically see the Potential problems section below on how to remedy this However if for some reason it is necessary to run pgxwin_ server manually you ll need to know the following In particular under VMS before you can run the server you will first need to register it as a foreign command by typing pgxwin_server directory_name pgxwin_server exe If your default display is correctly set then s
286. lot5 2 tar gz tar xvof This exarple will create usr local src pgplot and subdirectories Create the target directory Create a writeable directory in which the PGPLOT library and associated files will be created One such directory is needed for each different operating system and compiler combination target system that you wish to support e g mkdir usr local pgpl ot Do not try to create the PGPLOT library in the distribution directory Select device drivers Configure PGPLOT by selecting device drivers fromthe available list First copy the file drivers list fromthe distribution directory to the target directory and then use a text editor to select device drivers T his file contains one line for each available device driver delete the exclamation mark at the beginning of the line to include the driver or ensure that an exclamation mark is present if you want to exclude the driver Many of the drivers can be used only on certain operating systems see notes in drivers list so include only the drivers you plan to use PGPLOT can later be reconfigured by restarting the installation at this step Most installations should include the null device NULL PostScript printers PS VPS CPS and V CPS T ektronix terminals T EK XT ERM and possibly other variants and if the X window systemis available on the target the X window drivers X WINDOW XSERVE You may also wish to include drivers for GIF files GIF
287. lotting routines for use with PGPLOT For details see http www isis rl ac uk dataanal ysis dsplot T his package makes use of undocumented internal features of PGPLOT something strongly counsel against and may not work with all versions of PGPLOT PLOT DAT by Vincent J acobs vjacobs physics rutgers edu is fully interactive and features legends three dimensional hi stograns an echo scripting mechanism parsing to add Greek or other fancy characters to plots and extensive online help Please visit the site http www physics rutgers edu vj acobs P LOT DAT plotdat htm PONGO by Paul Harrison T his is supported by Starlink see http star www rl ac uk Starlink also maintains a version of PGPLOT layered on the GKS library QDP PLT by Allyn T ennant PLT is an interactive plotting and fitting subroutine layered on PGPLOT and QDP provides a commend interface to this routine QDP PLT is used by sore tasks within the FT OOLS package available fromthe NASA Laboratory for High Energy Astrophysics e STAP by Mingsheng Han ST AP is an interactive command driven statistic and plotting program for information see http www astro wisc edu han stap stap htm e VB by Georges GONCZI Observatoire de Nice F rance is a semi interactive tool which gives access to the whole graphic possibilities of PGPLOT without having to learn it and without having to know any special language See http www obs nice fr tvb tvb htm
288. lowing MODE values Cursor types that are not supported by a given device are treated as MODE 0 If MODE 0 the anchor point is ignored and the routine behaves like PGCURS If MODE 1 a straight line is drawn joining the anchor point and the cursor position If MODE 2 a hollow rectangle is extended as the cursor is moved with one vertex at the anchor point and the opposite vertex at the current cursor position the edges of the rectangle are horizontal and vertical If MODE 3 two horizontal lines are extended across the width of the display one drawn through the anchor point and the other through the moving cursor position T his could be used to select a Y axis range when one end of the range is known If MODE 4 two vertical lines are extended over the height of the display one drawn through the anchor point and the other through the moving cursor position T his could be used to select an X axis range when one end of the range is known If MODE 5 a horizontal line is extended through the cursor position over the width of the display T his could be used to select an X axis value such as the start of an X axis range T he anchor point is ignored If MODE a vertical line is extended through the cursor position over the height of the display T his could be used to select a Y axis value such as the start of a Y axis range T he anchor point is ignored If MODE 7 a cross hair centered on the cu
289. ls relative to the axis has been improved the displacement of labels fromthe axis should now be the sare as in PGBOX Problems were most noticeable when a large character size was requested T hanks to Neil Killeen for the fix pgvect f T he routine was ignoring the first row and colunn of the array when finding the scale factor for the vector length T hanks to David Singleton for pointing this out pgplot sys_arc F 77 ACDriver Revised to allow a concurrent hardcopy device Dave Crennell F 77 GRexecAC Correct typo Dave Crennell pgplot sys fujitsu T his new directory replaces sys_vp2200 T he files are fromDavid Singleton aaaread me Revised uxpm _ frt_cc conf Configuration file for F ujitsu UXP M frt FORT RAN compiler and usr ucb cc compiler uxpv_frt_cc conf Configuration file for F ujitsu UXP V frt FORT RAN compiler and usr ucb cc compiler pgplot sys hp conf Added support for compiling the Motif driver xrmdriv mcs pgplot sys_ linux aaaread me Added notes on Linux variants and problerrs g77_elf conf new file Configuration file for Linux systems that use ELF binaries pgplot sys sol2 aaaread me Added notes about use of Sun 90 compiler and GNU g77 compiler Added note about problem with the ucb version of Id f90_cc conf new file For Solaris f90 1 1 F ortran compiler from Ricardo PiriZ g77_gcc conf new file For GNU g77 Fortran compiler with gcc pgplot sys_vp2200 Directory removed pgplot sys_vns
290. ltiplication sign are omitted If the power of 10 is not zero and the mantissa is not zero an exponent of the form x10 u Jnnn is appended where x is a multiplication sign cross u is an escape sequence to raise the exponent and as many digits nnn are used as needed c Autorratic choice F ORM 0 Decimal notation is used if the absolute value of the number is greater than or equal to 0 01 and less than 10000 Otherwise exponential notation is used Argurrents MM input PP input the value to be formatted is MM 10 PP FORM input controls how the number is formatted FORM 0 use either decimal or exponential FORM 1 use decimal notation FORM 2 use exponential notation ST RING output the formatted character string left justified If the length of ST RING is insufficient asingle asterisk is returned and NC 1 NC output the nurrber of characters used in ST RING the string to be printed is ST RING 1 NC PGOLIN mark a set of points using the cursor void cpgolin int maxpt int npt float x float y int symbol SUBROUTINE PGOLIN MAXPT NPT X Y SYMBOL INT EGER MAXPT NPT REAL X Y INT EGER SYMBOL Interactive routine for user to enter data points by use of the cursor Routine allows user to Add and Delete points T he points are returned in the order that they were entered unlike PGNCUR Argurrents MAXPT input maximumnumber of points that may be accepted NPT in out nu
291. m Koji Ejiri lt eji s9 dion ne j p gt Date J anuary 27 2006 1 59 31 PM PST To tj p astro caltech edu Subject Gauche P GPL OT Hi I MKoji Ejiri make Gauche binding for PGPLOT Gauche is one of Scheme interpreter Gauche http www shiro dreamhost con scheme gauche i ndex htm Download tarball http www kono cis iwate u ac p Koj i eji Gauche pgplot 0 1 0 tar gz Subversion repository http www cozm xng org repos pgpl ot check out svn co http www cozm xng org repos pgpl ot nstall Following progran need to install before to install Gauche PGPLOT PGPLOT Gauche libpng 977 think you can install Gauche PGPLOT if you type following command gauche package install install as root path to Gauche pgpl ot X X X tar gz product requirements Following OS checked to install Gauche P GPL OT FreeBSD Debian GNU Linux It is first time for me to make a package program Please tell me when sore problems find Sincerely Koji Ejiri email yi s9 dion nejp 0 6 0 4 O 2 PSPLOT Graphi y x axp x 1C
292. m0 0 to 1 0 with black at lightness 0 0 and white at lightness 1 0 Saturation ranges from 0 0 gray to 1 0 pure color Hue is irrelevant when saturation is 0 0 Examples H L S R G B black any 0 0 0 0 0 0 0 0 0 0 white any 1 0 0 0 1 0 1 0 1 0 mediumgray any 0 5 0 0 0 5 0 5 0 5 red 120 0 5 10 10 00 0 0 yellow 180 0 5 1 0 10 1 0 0 0 pink 120 0 7 0 8 0 94 0 46 0 46 Reference SIGGRAPH Status Report of the Graphic Standards Planning Committee Computer Graphics V ol 13 No 3 Association for Computing Machinery New Y ork NY 1979 See also J D Foley et al Computer Graphics Principles and Practice second edition Addison Wesley 1990 section 13 3 5 Argurrent Cl input the color index to be defined in the range O rrex If the color index greater than the device maximumis specified the call is ignored Color index 0 applies to the background color CH input hue in range 0 0 to 360 0 CL input lightness in range 0 0 to 1 0 CS input saturation in range 0 0 to 1 0 PGSHS set hatching style void cpgshs float angle float sepn float phase SUBROUTINE PGSHS ANGLE SEPN PHASE REAL ANGLE SEPN PHASE Set the style to be used for hatching fill area with fill style 3 T he default style is ANGLE 45 0 SEPN 1 0 PHASE 0 0 Argurrents ANGLE input the angle the hatch lines make with the horizontal in degrees increasing counterclockwise this is an angle on the view surface not
293. matrix TR The resulting quadrilateral region is clipped at the edge of the window and shaded with the shade at each point determi ned by the corresponding array value T he shade is a number in the range 0 to 1 obtained by linear interpolation between the background level BG and the foreground level FG i e shade A i j BG FG BG T he background level BG can be either less than or greater than the foreground level FG Points in the array that are outside the range BG to F G are assigned shade 0 or 1 as appropriate PGGRAY uses two different algorithrs depending how many color indices are available in the color index range specified for images T his range is set with routine PGSCIR and the current or default range can be queried by calling routine PGQCIR If 16 or more color indices are available PGGRAY first assigns color representations to these color indices to give a linear ramp between the background color color index 0 and the foreground color color index 1 and then calls PGIMAG to draw the image using these color indices In this mode the shaded region is opaque every pixel is assigned a color If less than 16 color indices are available PGGRAY uses only color index 1 and uses a dithering algorithmto fill in pixels with the shade computed as above determining the faction of pixels that are filled In this mode the shaded region is transparent and allows previousl y drawn graphics to show throu
294. may not occur Y ou will then need to include the graphics library explicitly by using a LINK commands like the following LINK EXAMPLE PGPLOT_DIR GRPSHR LIB The PGPLOT subroutines are not included in your EXE file but are fetched froma shareable image when you execute the RUN comand T his makes the EXE file much smaller and means that the programneed not be relinked when changes are made to the graphics subroutines but the EXE file can only be run ona machine that has a copy of the shareable image and is running a compatible version of VMS T o make a transportable E XE file use the non shared library as follows the XLIB library is not required if your version of PGPLOT does not include an X window driver LINK EXAMPLE PGPLOT_DIR GRPCKG LIB SY S INPUT OPT SY S SHARE DECW XLIBSHR EXE SHARE ctrl Z 1 4 Graphics Devices Graphics devices fall into two classes devices which produce a hardcopy output usually on paper and interactive devices which usually display the plot ona TV monitor Sore of the interactive devices allow modification to the displayed picture and sorre have a movable cursor which can be used as a graphical input device There is also a null device to which unwanted graphical output can be directed Hardcopy devices are not used interactively One must first create a disk file and then send it to the appropriate device with a print or copy command Consult Appendix D or your System M anager to determin
295. mber of points entered should be zero on first call X in out array of x coordinates Y in out array of y coordinates SYMBOL input code number of symbol to use for marking entered points see PGPT Note 1 T he dimension of arrays X and Y must be greater than or equal to MAXPT Note 2 On return fromthe program cursor points are returned in the order they were entered Routine may be re called with points already defined in X Y number in NPT and they will be plotted first before editing Note 3 User comands the user types single character commands after positioning the cursor the following are accepted A Add add point at current cursor location D Delete delete the last point entered X eXit leave subroutine PGOPEN open a graphics device int cpgopen const char devi ce INT EGER FUNCT ION PGOPEN DEVICE CHARACT ER DEVICE Open a graphics device for PGPLOT output If the deviceis opened successfully it becomes the selected device to which graphics output is directed until another device is selected with PGSLCT or the device is closed with PGCLOS T he value returned by PGOPEN should be tested to ensure that the device was opened successfully e g ISTAT PGOPEN plot ps PS IF ISTAT LE 0 STOP Note that PGOPEN must be declared INT EGER in the calling program The DEVICE argument is a character constant or variable its value should be one of the foll owing
296. mple using the standard T cl T k window shell wish colormap new will allocate wish its own private colorrrap If you start your application via the standard T k_Main function and pass it the command line arguments of your programthen it too will accept the colormap option fromthe command line How to use the driver fromC T he most efficient way to usethe Tk PGPLOT driver is to handle user interaction using a T cl T k script and delegate drawing operations to T cl callable C functions T his section gives a complete example to illustrate how this is done If you want to try this code extract the following C code fragments eg using cut and paste assemble theminto a c file and compile the result as described later T he main function of the example programda egates starting up T cl T k to the standard T k main function T his in turn calls the example custom zation function Demo_ Appl nit T he customization function calls T kpgplot_init to create the T cl pgplot command then creates two other new T cl commands T he first is simply a wrapper around cpgopen T he second is a wrapper around an example drawing function that draws a plot of x versus x C exarrple program include lt tk h gt include lt stddef h gt include lt stdlib h gt include tkpgplot h Needed solely for tkpgplot_Init include cpgplot h Needed for cpg pgplot functions Prototype local functions static int Demo
297. n PGPLOT It requires the XSERV device For amore professional approach to graphical user interfaces consider using the PGPLOT Motif driver pgpl ot src Many pg routines Changed the C function prototypes to use the const qualifier where appropriate T his makes it easier to use the function prototypes with C Most arguments declared float or char are now const float or const char except for returned values grpckgl inc Modified to allow up to 8 concurrent devices orfa f Rounding error fix thanks to Rerrko Scharroo twice grinit f New routine initializes common block avoids BLOCK DATA grpi xl f Minor bug fix Renko Scharroo grpocl f Rewrite to avoid potential overflow thanks to T onesz Plewa pgplot inc Modified to allow up to 8 concurrent devices many variables changed fromscalars to arrays with new names pgask f pgband f pgbbuf f pgbeg f pgbox f pgcirc f pgebuf f pgend f pgerrb f pgerrx f pgerry f pggray f pghi2d f pgiden f pginag f pglen f pgntxt f pgncur f pgnoto f pgpage f pgpanl f pgpap f pgpoly f pgptxt f pgqah f pgach f pgacir f pgacs f pgafs f pgahs f pgainf f pgaitf f pgqtbg f pgatxt f pgqvp f pgqvsz f pgqwin f pgrect f pgsah f pgsch f pgscir f pgsfs f pgshs f pgsitf f pgstbg f pgsubp f pgsvp f pgswin f pgvsiz f pgvstd f pgvw f pgwnad f Modified to allow multi ple concurrent devices pgcl os f New routine Closes the currently selected graphics device
298. n PGEND is called or when the programis terminated If instead you wish the window to be iconized until opened by anew PGPLOT program set pgxwin Win iconize T rue Win maxColors 100 T his specifies the maxi mumnunber of colors that PGPLOT tries to allocate for each X window Reducing the number of colors allocated makes it more likely that each window will share the sare colormap and thus stop colormap flashing Note that the value of the maxColors option must not be less than that of the minColors resource described below Win ninColors 16 To reject colormaps with fewer than a given nurber of color entries specify the minimumnurrber of colors required Win visual default If you have a preference for the type of colormap to use specify the name of the preferred type PGPLOT will then try that type first T he following type names are recognized a default Use the colormap search strategy described in the Color Capability section a monochrome Use black and white a PseudoColor Read write color visual a DirectColor This is treated as an alias for T rueColor a StaticColor Read only color visual a T rueColor Read only color visual 3 primary colortables a GrayScale Read write gray scale visual a StaticGray Read only gray scale visual pgxwin Win crosshair F alse T o augrrent the default active PGPLOT cursor with cross hairs set pgxwin Win crosshair T rue pgxwin server visible T rue To
299. n Wesley Reading Massachusetts 1985 3 Adobe Systens Inc PostScript L anguage Reference Manual Second Edition Addison Wesley Reading Massachusetts 1990 4 Adobe Systens Inc Programming the Display PostScript Systemwith NeXT step Addison Wesley Reading Massachusetts 1992 Author A F T ennant 1992 Acorn Archimedes T his driver will cause the systemto leave the Desktop but leave the screen mode provided it has the norrrel 16 colours T his routine must be compiled with F ortran release 2 and linked with the F ortran F riends graphics and utils libraries Resolution Depends on graphics mode Ensure that the current mode is suitable before running the PGPLOT program MS DOS Machines Supported device IBM PCs and compatibles running Microsoft F ortran 5 0 T his driver will put the display into graphics mode T o avoid erasing the screen when the programexits the display will be left in graphics mode T herefore you will need sorre other programto restore to the display to a faster text mode Device type code MSOFT Default device name none the device nans if specified is ignored Default view surface dimensions depends on monitor typical 7 x 10 inches Resolution Depends on graphics card T ested with a 640 x 300 EGA card Driver should work with other graphics cards however expect to tweak it a bit Color capability Color indices 0 15 are accepted T his version maps the PGPLOT color indice
300. n as it makes it impossible to align the labels nicely 3 Option Y is forced with option D DEAR AAR AR RK ARK AR AAR A RK RAR AR AA A A ARK BARK AR AR AR A ARR BARR AR AAR AR ARK RAR AR RAR AK ARK BARAK AR PGT EXT write text horizontal eft justified void cpgtext float x float y const char text SUBROUTINE PGT EXT X Y TEXT REAL X Y CHARACT ER TEXT Write text The bottomleft corner of the first character is placed at the specified position and the text is written horizontally Thisis a simplified interface to the primitive routine PGPT XT For non horizontal text use PGPT XT Argurrents X input world x coordinate of start of string Y input world y coordinate of start of string TEXT input the character string to be plotted PGT ICK draw a single tick mark onan axis void cpgtick float x1 float y1 float x2 float y2 float v float tikl float tikr float disp float orient const char str SUBROUTINE PGT ICK X1 Y1 X2 Y2 V TIKL TIKR DISP ORIENT STR REAL X1 Y1 X2 Y2 V TIKL TIKR DISP ORIENT CHARACT ER STR Draw and label single tick mark on a graph axis T he tick mark is a short line perpendicular to the direction of the axis which is not drawn by this routine T he optional text label is drawn with its baseline parallel to the axis and reading in the same direction as the axis frompoint 1 to point 2 Current line and text attributes are used Argurrents
301. n be used fromPGPLOT it has to be opened by calling cogbeg or cpgopen T his can be done any time afterthe PGPLOT widget has been realized Note that PGPLOT now supports multiple open PGPLOT devices via cogopen cpgsl ct and cpgclos You can thus create and have multiple PGPLOT widgets open to PGPLOT simultaneously If you do this be sure to call cpgslct in each callback to ensure that the intended PGPLOT widget is addressed T he id to pass to cpgsict to select a given XnP gplot widget can be obtained via the xmp device _id convenience function Please see the previous sections on configuration resize options and how to get cursor input An exanple of creating a PGPLOT widget as the child of a scroll bar widget is as follows include lt stdio h gt include lt X11 Intrinsic h gt include XmXmh gt include lt Xn7yScrolledW h gt include XnP gplot h include cpgplot h int main int argc char argv XtA ppContext app Application context Widget w_top T he top level widget of the application Widget w_scroll Scroll bar widget Widget w_pgplot1 PGPLOT widget Initialize Motif and request a pointer following keyboard focus policy XtSetL anguageProc NULL NULL NULL w_top XtV aApplnitialize amp app Pgplot NULL O amp argc argv NULL XmNkeyboardF ocusP olicy XnPOINT ER NULL Create a ScrollBar widget w_scroll XtV aCreateM anagedWi dget p
302. n event and it is also difficult to get access to the X events fromthe program Will PGPLOT ever do three dimensional graphics No A comprehensive 3D capability including projection hidden line and hidden surface removal and lighting is beyond the scope of PGPLOT Sore of the PGPLOT demonstration programs do rudimentary 3D graphics but they take care of projection and hidden line removal these ves and pass only 2D data to PGPLOT For 3D graphics a nurrber of packages are available such as OpenGL and PHIGS Will PGPLOT be rewritten to use F ortran 90 constructions do not plan to rewrite PGPLOT in Fortran 90 do not think that F ortran 90 has yet taken over fromF ortran 77 e g there are no free corpilers and do not have the resources to maintain two versions You should be able to call PGPLOT routines fromf90 with no problem recommend that you compile PGPLOT with anf77 compiler and link it into your f90 program would hope that your f90 compiler can handle the argument passing conventions of 77 but this may depend on which compilers you use Alternatively you can compile PGPLOT with the f90 compiler but you will be unable to use sore of the drivers which use non standard extensions to F ortran 77 intend to address this by rewriting these drivers in C rather than F ortran 90 Does PGPLOT havea Y 2K problen I amchecking our software for Y ear2000 compliancy and was wondering if should be concerned about any func
303. n minor tick marks are placed at 2 3 9 times each power of 10 otherwise minor tick marks are spaced by one decade If the axis spans less than two decades nurreric labels are placed at 1 2 and 5 times each power of ten If the axis spans less than one decade or if it spans many decades it is preferable to use a linear axis labeled with the logarithmof the quantity of interest Argurrents OPT input astring containing single letter codes for various options T he options currently recognized are L draw a logarithmic axis N write numeric labels 1 force decimal labelling instead of autorratic choice see PGNUMB 2 force exponential labelling instead of autorratic X1 Y 1 input world coordinates of one endpoint of the axis X2 Y 2 input world coordinates of the other endpoint of the axis V1 input axis value at first endpoint V2 input axis value at second endpoint STEP input mejor tick marks are drawn at axis value 0 0 plus or minus integer multiples of ST EP If ST EP 0 0 a value is chosen autorretically NSUB input minor tick marks are drawn to divide the major divisions into NSUB equal subdivisions ignored if ST EP 0 0 If NSUB lt 1 no minor tick marks are drawn NSUB is ignored for a logarithmic axis DMAJL input length of major tick marks drawn to left of axis as seen looking fromfirst endpoint to second in units of the character height DMAJR input length of maj
304. nd file format at run tire PROGRAM EX1 INTEGER PGOPEN REAL XS 9 Y S 9 XR 101 Y R 101 C Compute nunbers to be plotted DO 10 1 1 101 XR I 0 1 1 1 Y R I XR 1 2 E XP XR I 10 CONTINUE DO 20 1 1 9 XS l I YS I XS I 2 E XP XS 1 20 CONTINUE C Open graphics device IF PGOPEN LT 1 STOP C Define coordinate range of graph 0 lt x lt 10 0 lt y lt 0 65 C and draw axes CALL PGENV 0 10 0 0 65 O 0 C Label the axes note use of u and d for raising exponent CALL PGLAB x y PGPLOT Graph y x u2 dexp x C Plot the line graph CALL PGLINE 101 XR YR C Plot symbols at selected points CALL PGPT 9 XS YS 18 C Close the graphics device CALL PGCLOS END T he sarre programcan be written in C using the cpgplot library include cpgplot h include math h int main int i float xs 9 ys 9 float xr 101 yr 101 Compute numbers to be plotted for i 0 i lt 101 i xr i 0 1 i yr i xr i xr i exp xr i for i 0 i lt 9 i xsi i 1 ysli xsli xsli Fexp xsli Open graphics device if cpgopen lt 1 return 1 Define coordinate range of graph 0 lt x lt 10 0 lt y lt 0 65 and draw axes cpgenv 0 10 O 0 65 O 0 Label the axes note use of u and d for raising exponent cpglab x y PGPLOT Graph y x u2 dexp x Plot the line graph cpgline 101 xr yr
305. ndResult interp result NULL return T CL_OK Implement the example T cl draw_plot command T his takes three arguments T he id of the PGPLOT device to plot to the leftmost X axis value to display and the rightmost X axis value to display static int tcl_draw_plot ClientData data T cl_Interp interp int argc char argv double xa xb T he X axis range to plot int id The PGPLOT id of the target device int i Make sure that the right nunber of arguments have been provided and that the PGPLOT id makes sense if argc 4 id atoi argv 1 lt 0 return usage_error interp draw_plot id xmin xrax Decode the two X axis world coordi nate limits if T cl_ GetDoubl e interp argv 2 amp xa T CL_ERROR T cl_GetDouble interp argv 3 amp xb T CL_ERROR return T CL_ERROR Select the PGPLOT device and draw the plot cpgsl ct id cpgpage Cpgswin xa xb 0 0 1 0 cpgsci 1 cpgbox BCNST 0 0 BCNST 0 0 cpgsci 2 cpgrove 0 0 0 0 for i 1 i lt 100 i float x i 100 0 cpgdraw x x x return T CL_OK The final function is just a utility function for reporting command usage errors and returning the standard T cl error code static int usage_error T cl_Interp interp char usage T cl_AppendResult interp Usage usage NULL return T CL_ERROR Having assembled the above C fragrrents
306. ndex T his will be 1 if the device has no color capability or a larger nurrber e g 3 7 15 255 PGQCR inquire color representation void cpgacr int ci float cr float cg float cb SUBROUTINE PGQCR Cl CR CG CB INT EGER Cl REAL CR CG CB Query the RGB colors associated with a color index Argurrents Cl input color index CR output red green and blue intensities CG output inthe range 0 0 to 1 0 CB output PGQCS inquire character height in a variety of units void cpggcs int units float xch float ych SUBROUTINE PGQCS UNIT S XCH YCH INTEGER UNITS REAL XCH YCH Return the current PGPLOT character height in a variety of units T his routine provides facilities that are not available via PGQCH Use PGQCS if the character height is required in units other than those used in PGSCH ThePGPLOT character height is a dimension that scales with the size of the view surface and with the scale factor specified with routine PGSCH T he default value is 1 40th of the height or width of the view surface whichever is less this value is then multiplied by the scale factor supplied with PGSCH Note that it is a nominal height only the actual character size depends on the font and is usually somewhat smaller Argurrents UNITS input Used to specify the units of the output value UNITS 0 normalized device coordinates UNITS 1 inches UNITS 2 millimeters UNITS 3 pixels UNIT S
307. ned with PGGRAY BCANON will produce the smaller file and plot faster Default file name PGPLOT CAN Default view surface dimensions 24 cmby 19 cm landscape 19 cmby 24 cm portrait Resolution 300 pixels per inch in both directions Color capability Color indices 0 erase and 1 black are supported Note hardware polygon fill is used and colors 0 11 control the fill pattern Input capability None File format Variable length records with Carriage control of LIST Obtaining hardcopy If printer is connected to a terminal line RS 232 option then printing the file on the corresponding queue should suffice If the printer is connected using the Centronics interface which appears the to VAX as anLP device then it is important to ensure that 1 all 8 bit characters are passed to the printer 2 lines longer than 132 bytes are not truncated and 3 no extra forrratting commands e g form feeds are sent to the printer T his can be done with the VMS command SET PRINT PASSALL LOWER CR device Note sorre interface boards have a option to append a carriage return after a fornfeed or LF character it is suggested that this be disabled T he file should be printed with the PASSALL qualifier i e PRINT PASSALL filename Note SET PRINT PASSALL and PRINT PASSALL do not do the sare things and hence PASSALL is required in both locations Author Allyn F Tennant 1988 Martin Shepherd 1991 Canon L aserShot printer LIP
308. ng with a 0 All returned strings are terminated in this manner at the length returned by PGPLOT in the length argument Limitations PGPLOT procedures that take FORT RAN SUBROUT INEs or FUNCT IONS as argurrents e g PGF UNX PGCONX are not represented in the CPGPL OT library Such procedures cannot be handled on most systems Other Machine Dependencies Many systemvendors say that if you call FORT RAN functions that do any I O you should havea FORT RAN rain program so that the FORT RAN I O module gets correctly initialized Since PGPLOT uses FORT RAN I O this applies to C or C programs that call PGPLOT However this can be difficult to arrange and in many systerrs it is not necessary Consult the docurrentation for your operating systemto determine how to write a C or C programthat calls subroutines written in Fortran When you nix languages it is usually necessary to include systemsupport libraries for each language Again you will need to consult the docurrentation for your operating system and compilers to determi ne what libaries are needed and where they are located On UNIX systers the compiler usually invokes the linker loader itself specifying the necessary libraries However with this method the linker lodaer will not autorratically find the libraries required by the other compilers involved Since FORT RAN usually has to be linked with a lot of support libraries it is usually most convenient to use the FORT RAN c
309. nput focus to the respective XnP gplot widget via a statement of the following form XnP rocessT raversal widget Xml RAVERSE_CURRENT placed just after the call to xmp_arm_cursor widget T his statement has no effect if the focus policy isnot XmEXPLICIT 2 XMPOINT ER In this scheme the widget in which the pointer lies is the one that receives keyboard input and button presses are al ways unarrbi guousl y treated as cursor input T his avoids all keyboard focus complications However some users don t like it because they like to be able to move the pointer out of the window in which they are typing Note that the above resource values can either be hard coded via the call to XtV aA ppl nitialize or specified in the application s app defaults file If having read this you still want to be told about keyboard input in addition to mouse button input but you don t like the way xmp_arm_cursor manages the keyboard input focus then you can write your own using the facilities described above under Advanced cursor input Coordinate conversion functions T he following functions are designed for use with customevent handlers T hey perform conversions between widget X window coordinates and PGPLOT world coordinates int xmp_pixel_to_world widget px py wx wy T his function takes the X window coordinates of a pixel withinaPGPLOT widget and returns the corresponding PGPLOT world coordinates If the widget is not open to PG
310. ns const float a int idim int jdim int i1 int i2 int j1 int j2 const float c int nc const float tr SUBROUTINE PGCONS A IDIM J DIM 11 12 J 1 J 2 C NC TR INT EGER IDIM J DIM 11 12 J 1 J 2 NC REAL A IDIM J DIM C T R 6 Draw a contour mep of an array T he mep is truncated if necessary at the boundaries of the viewport Each contour line is drawn with the current line attributes color index style and width T his routine unlike PGCONT does not draw each contour as a continuous line but draws the straight line segments composing each contour in arandomorder It is thus not suitable for use on pen plotters and it usually gives unsatisfactory results with dashed or dotted lines It is however faster than PGCONT especially if several contour levels are drawn with one call of PGCONS Arguments A input data array IDIM input first dimension of A J DIM input second dimension of A 11 12 input range of first index to be contoured inclusive J 1 2 input range of second index to be contoured inclusive C input array of contour levels in the sare units as the data in array A dimension at least NC NC input number of contour levels less than or equal to dimension of C T he absolute value of this argurent is used for compatibility with PGCONT where the sign of NC is significant TR input array defining a transformation between the grid of the array an
311. nstructions for their use Appendix B shows the complete set of PGPLOT characters and symbols that can be used for annotating graphs Appendix C is intended for those who want to call PGPLOT subroutines froma programwritten in C Appendix D gives details of the devices supported by PGPLOT Appendix E provides instructions for programmers who want to extend PGPLOT to support other devices Appendix F provides installation instructions and Appendix G gives sorre hints for porting PGPLOT to anew operating system 1 3 Using PGPLOT In order to use PGPLOT subroutines you will need to link your programwith the graphics subroutine library 1 3 1 UNIX T he following assures that the PGPL OT library libpgplot a has been installed in a standard location where the loader can find it T o compile link and run a graphics programexanpl e f 77 o example example lpgplot example In sorre installations it may be necessary to include other libraries such as the Xwindow library and specify a directory to search for the PGPLOT library eg 77 o example examplef L usr local pgpl ot pgplot 1X11 example 13 2VMS On most VMS computers the graphics subroutine library is scanned autorratically by the LINK command so the following sequence of instructions suffices to compile link and run a graphics programE XAMPLE FOR FORT RAN EXAMPLE LINK EXAMPLE RUN EXAMPLE On other VMS computers the autorratic search of the graphics library
312. ntly remove the severe menory restrictions of DOS T hesize of applications which can be linked with PGPLOT LIB is limited only by total physical and virtual memory T he graphics libraries MSFLIB Microsoft or DF LIB Digital Cormpaq also include many additional system functions known fromC Even for an old fashioned command line Fortran prograrrer like PAS it is relatively easy to add features like dialog boxes and custommenus Once PGPLOT LIB is built applications are most easily compiled using the Microsoft Developer Studio T he application type must be QuickWin or it rust be compiled with command line option MW Programs execute in a text window with the graphical output in up to 8 separate child windows Cursor functions including rubber band modes are implemented by moving the mouse and typing a keyboard key T here are three versions of the Developer Studio You MUST have the sare version for F ortran and for C in order to mx languages Although the F ortran code is the sarre the user interface is slightly different T he versions are Developer Studio 4 0 Microsoft PowerStation F ortran 4 0 Developer Studio 5 0 Digital Visual F ortran 5 0 Developer Studio 6 0 Digital Visual F ortran 6 0 or Cormpag Visual F ortran 6 1 NOT E applications developed in these F ortrans will NOT execute under DOS or Windows 3 x no not even with WIN32s installed T he steps in building PGPLOT LIB are the following 1 Downlo
313. o pass nurrerical data to or fromthe device handler and NBUF indicates how many elerrents of the array are used CHR is a character variable used to pass character data to or fromthe device handler and LCHR indicates how many characters are used NBUF or LCHR should be set to zero if no data of the corresponding type are passed If the function requested by the operation code OP CODE is not implemented in the device handler the subroutine should set NBUF 1 before returning T he device handler subroutine can communicate with PGPLOT only through the argurrents It should not attempt to reference the PGPLOT common blocks this is because the internal structure of the PGPLOT common blocks may change Data stored internally by the handler between calls should be placed in static storage use the Fortran SAVE staterrent Table E 2 Device Handler Operation Codes Opcode F unction Return device type Return maximumdimensions of view surface and range of color index Return device scale Return device capabilities Return default device file name Return default size of view surface Return miscellaneous defaults Select device Open workstation Close workstation Begin picture Draw line Draw dot End picture IF lS I I jar is IO l IN Im I IB IW IN le Set color index 16 Flush buffer 17 Read cursor 18 Erase alpha screen 19 Set line style 20 Polygon fill 21 Set color representation 22 Se line width 23 Escape functi on 24 Rectangle
314. o zero RBUF Maxinum physical x value a value of 1 indicates no effective mexi mum Minimumphysical y value set to zero Maxinum physical y value a value of 1 indicates no effective maxi mum Minimumallowed color index usually 0 Maximumallowed color index in range 1 255 RBUF RBUF RBUF 6 1 2 3 4 5 Z ows N wes OPCODE 3 Return device scale Thisis an inquiry function the handler returns the device scale in device coordinate units per inch 1inch 25 4 mm Usually the units of the device coordinates are pixels so this also gives the physical resolution in pixels per inch F or hardcopy devices the values should be as accurate as possible to ensure that an image has the correct scale F or video display terminals and other devices where the scale is variable nominal values should be returned Pararreters returned by handler e RBUF 1 xscalein device coordinates per inch e RBUF 2 y scale in device coordinates per inch e RBUF 3 pen diarreter in device coordinates i e the width of a hardware line this value is used by PGPLOT when emulating thick lines and polygon fill usually 1 OPCODE 4 Return device capabilities T his is an inquiry function which is used to informPGPLOT of the device s capabilities If the device lacks a capability in hardware PGPLOT will try to emulate it Pararreters returned by handler e LCHR nurrber of characters defined in CH
315. of EXAMPLES Oneat atins use Project Add to Project F iles ver 4 Insert F iles into Project to select a file fromx PGPLOT EXAMPLES T he previous file may be deleted fromthe F ileV iew window when success fully completed Fromthe Build menu choose Execute EXAMPLES EXE T he first page of the first test P GDE MOL F should be a parabola If there is no text on the plot then you have not successfully created or located the file GRF ONT DAT see step 3 above If windows are created but neither graphics nor text appear the problemmay be that the display is set to a mode which doesn t use the SV GA color registers decrease the color palette to 16M or fewer colors After successfully testing the library you may delete all of the PGPLOT folders from X MSDEV PRO ECTS ver 4 or from x ProgramF iles DevStudio MyP rojects ver 5 or from x ProgramF iles Microsoft Visual Studio MyProjects ver 6 7 Drivers for Windows95 NT PostScript GIF LaT eX and the Null driver are included by default If you add additional drivers which may require debugging to eliminate perceived syntax errors etc to the library then the CASE structure in subroutine GRE XEC F must also be modified to reflect the changes also NDEV must reflect the total number of drivers T he default graphic window size for device type W9 is 800 600 with 236 colors SV GA 20 colors are reserved for systemuse T he default can be changed by setting an env
316. of the second index J to be plotted X1 Y 1 input world coordinates of one corner of the output region X2 Y 2 input world coordinates of the opposite corner of the output region PGPNT S draw several graph rrarkers not all the same void cpgpnts int n const float x const float y const int syrmbol int ns SUBROUTINE PGPNTS N X Y SYMBOL NS INTEGERN NS REAL X Y INT EGER SY MBOL Draw Graph Markers Unlike PGPT this routine can draw a different symbol at each point T he markers are drawn using the current values of attributes color index line width and character hei ght character font applies if the symbol number is gt 31 If the point to be marked lies outside the window no marker is drawn The pen position is changed to XPT S N Y PT S N in world coordinates if N gt 0 Arguments N input number of points to mark X input world x coordinate of the points Y input world y coordinate of the points SYMBOL input code number of the symbol to be plotted at each point see PGPT NS input number of values inthe SYMBOL array If NS lt N then the first NS points are drawn using the value of SY MBOL I at X 1 Y 1 and SY MBOL 1 for all the values of X I Y 1 where I gt NS Note the dimension of arrays X and Y must be greater than or equal to N and the dimension of the array SY MBOL must be greater than or equal to NS If Nis 1 X and Y may b
317. of these are non fatal warnings that can be ignored Motif support and example files If you plan to develop Motif applications that use the PGPLOT widget or if you want to inspect a sample Motif application you will need to do this step Y ou rust first a ensure that the Motif header files and libraries are installed on your system b select XMDRIV in drivers list before installing the PGPLOT library and c install the C wrapper library Execute the following command USR LOCAL PGPLOT SYS_VMS install USR LOCAL PGPLOT PGMDEMO T his creates five files PGMDEMO EXE executable denb program PGMOTIF OPT linker options file for linking PGPL OT Motif applications PGXWIN OBJ object module required by PGPL OT Motif applications XMPGPLOT OBJ object module required by PGPLOT Motif applications XMPGPLOT H header file required by PGPLOT Motif applications T his step ray not work on all VMS systems there are many differences between the various available versions of the DEC C compiler and DECwindows Motif If you get error messages you may need to modify file local pgplot sys_vims rake_pgndeno com 7 Define logical names Before running any PGPLOT program you must ensure that the following logical names are correctly defined T he logical names may be placed in the process table or the systemtable It may be convenient to place the definitions in LOGIN COM GRPSHR T his should point to the PGPLOT shared library GRPSH
318. oid report_cursor Widget w XtPointer context XEvent event Boolean continue_dispatch Widget w_label Widget context char text 80 float wx wy Convert fromX window coordinates to world coordinates if xmp_pixel_to_world w event gt xmotion x event gt xmotion y amp wx amp wy 0 sprintf text X 10g Y 10g wx wy XtV aSetV alues w_label XtV aT ypedArg XnmNlabel String XmRString text strlen text 1 NULL continue_dispatch T rue Keyboard focus issues A widget that receives keyboard input is said to have the keyboard input focus Only one widget can have this at one ti n If you want to be told of keyboard input when an XnP gplot cursor is armed then read on about the awkward issue of how an XnP oplot widget receives the input focus Alternatively if you only care about receiving cursor input frombutton presses then you should set the XnNtraversal On widget resource to F alse otherwise sore button presses will be lost to focus managerrent When a Motif application has the keyboard input focus the Motif library decides which of the application s widgets will receive keyboard input T his is independent of the method used by the window manager for top level windows Motif supports two scherres either of which can be selected by setting the value of the XmNkeyboardF ocusP olicy resource of the top level widget to one of the following values 1 XrmEXPLICIT T he default focus po
319. olor assignrrents File format T he file contains variable length records maximum 132 characters containing PostScript commands T he conmands use only printable ASCII characters and the file can be examined or rrodified with a text editor Obtaining hardcopy Use the operating system print or copy contrand to send the file to a suitable PostScript printer Environment variables PGPLOT_PS_ WIDTH default 7800 PGPLOT_PS_ HEIGHT default 10500 PGPLOT_PS_HOFFSET default 350 PGPLOT_PS _VOFFSET default 250 T hese variables tell PGPLOT how big an image to produce T he defaults are appropriate for 8 5 x 11 inch paper T he maximumdimensions of aPGPLOT image are WIDT H by HEIGHT with the lower left corner offset by HOF FSET horizontally and V OF FSET vertically fromthe lower left corner of the paper T he units are milli inches T he top of the paper is the edge that corres out of the printer first PGPLOT_IDENT If this variable is defined with any value the user narre date and time are written in the bottom right corner of each page PGPLOT_ PS BBOX Normally PGPLOT computes the bounding box for the entire plot the smallest rectangle that includes all the graphics as it creates the PostScript file and writes this information ina BoundingBox contrent in the file trailer Some prograrrs that read encapsulated PostScript files expect to find the BoundingBox coment in the file header not the trailer and may not display t
320. ompiler to link your C program If your compiler is not the systemsupplied compiler then it is unlikely that the FORT RAN compiler will cite the correct C run time library to the linker T his means that you will have to do it yourself e g the gcc compiler requires prograns to be linked with libgcc a e g gcc c blob c f77 o blob blob o Icpgplot I pgplot 1X11 lgcc Im Example Solaris A C programcalling PGPLOT in this case it is easiest to use f77 to do the link cc C l usr local pgplot ctest c 77 o ctest ctest o L usr local pgpl ot cpgpl ot pgpl ot Replace usr local pgplot with your PGPLOT directory A C program calling PGPLOT inthis case we need both F ortran and C libraries and it is easiest to use CC to do the link and to provide the F ortran libraries explicitly CC c c tHest C CC c test o L usr local pgpl ot cpgpl ot pgpl ot usr local lang SUNWspro SC3 0 1 lib libM 77 a 1X11 IF 77 Note that the names and locations of the F ortran libraries will depend on the version of the compiler in use Example Digital UNIX A C programcalling PGPLOT cc C l usr local pgplot ctest c 77 o ctest ctest o L usr local pgpl ot Icpgpl ot pgpl ot 1X11 Im nofor_main Note the use of f77 to do the link step and the use of the nofor_main switch Examples T he following example shows son simple CPGPLOT calls include cpgplot h include lt stdio h gt include lt stdlib h gt
321. on mark at the beginning of the line to include the driver or ensure that an exclamation mark is present if you want to exclude the driver Many of the drivers can be used only on certain operating systems see notes in drivers list so include only the drivers you plan to use PGPLOT can later be reconfigured by restarting the installation at this step Most installations should include the null device NULL PostScript printers PS VPS CPS and V CPS T ektronix terminals T EK XT ERM and possibly other variants and if the X window system DE Cwindows is available the X window drivers XWIN XSERV You may also wish to include drivers for GIF files GIF V GIF or sorre of the other printers copy USR LOCAL PGPLOT drivers list edit drivers list 5 Compile the library and demonstration programs Execute the script install comfromthe V MS subdirectory of the distribution directory e g USR LOCAL PGPLOT SYS_VMSlinstall USR LOCAL PGPLOT T he first argument supplied to install is the narre of the distribution directory T he script will attempt to determine your machine architecture VAX or Alpha and compile appropriate code T he script has been tested under several versions of VMS but if you have problems you may need to edit the script T he install script issues messages as it proceeds it usually takes quite along time It should generate the following files DRIVERS LIST GRE XEC F GRF
322. on procedures puts in the pgplot directory T he file pgplot htm can be viewed with Mosaic e g Mosaic usr local pgpl ot pgpl ot htm e PGSCIR PGQCIR set query the range of color indices used by routines PGGRAY and PGIMAG e PGERAS erase screen without advancing to new page e PGCONL for labelling contours drawn with PGCONT e PGBAND new cursor routine with many more features than PGCURS including cross hairs and rubber bands on devices that support this currently only X window e PGIMAG new routine like PGGRAY for color images e PGCT AB for generating a color table for use with PGIMAG e PGSITF PGQIT F set query the image transfer function used by routines PGGRAY and PGIMAG e PGPANL to moveto a different panel when the view surface has been divided into panels with PGBEG or PGSUBP T he pgden programs in pgplot examples have been enhanced to deronstrate the new routines and there are new demos programs 10 12 Enhanced routines e PGBOX new options for forcing decimal or exponential abel ing e PGBEG PGBEGIN now parses device specifications differently so that file names including slash characters do not need to be quoted e PGCONX contours are now traced in a consistent direction clockwise or anticlockwise e PGGRAY enhanced to allow use of linear log or square root mapping of array value onto image brightness see PGSIT F e PGPIXL new algorithmmakes smaller PS files that print fas
323. ong conmend or sending a file to the wrong sort of printer Next Chapter 3 PGPLOT TimPearson California Institute of T echnology t p stro caltech edu Copyright 1995 California Institute of T echnology Figure 2 1 Output of Example Program A Bimpla Graph PGPLOT TimPearson California Institute of Technology tjo stro caltech edu Copyright 1995 California Institute of Technology 3 Windows and Viewports 3 1 Introduction T his chapter is concerned with positioning a graph on the screen or hardcopy page and controlling its scale In simple applications the position and scale of the graph are controlled more or less autorratically by the routine PGENV but in order to obtain complete control of positioning and scaling it is necessary to understand the concepts of the View Surface the Window and the Viewport and two coordinate systems World Coordinates and Device Coordinates A simple PGPLOT picture mght be a two dimensional graph showing the dependence of one variable on another A typical graph has data points represented by error bars or special markers such as dots or diamonds possibly connected by lines or perhaps plotted on the sarre scale as a theoretical model drawn as a smooth curve T he graph must be labeled with two axes to indicate the coordinate scales T he prograntrer must describe to PGPL OT the various elements of the graph in terms of rectangular Cartesian coordinates T he only limitation
324. ons PGPLOT Scroll area ThePGPLOT scroll area option is supported See the PGPLOT documentation on cpgscrl for details Associated files tkpgplot h This header file is intended for use by the C part of a T cl T k application It includes prototypes of the package initiali zation function of the PGPLOT Tk widget and a few optional convenience functions for communicating with the widget directly via C libtkpgplot a This library file contains the Tk PGPLOT widget and its PGPLOT driver The main PGPLOT library only contains a stub version of the driver so it is essential to present ibtkpgplot a to the linker beforethe main PGPLOT library For example a snapshot of the link line under Solaris would look something like Itkpgpl ot I cpgpl ot pgpl ot IT k4 1 Itcl 7 5 1X11 Idl cpgplot h T he include file for the C PGPLOT wrapper library should also be included in all files that make calls to the PGPLOT library fromC libcpoplot a and libpgplot a ThePGPLOT C wrapper library and the FORT RAN PGPLOT library Configuration Asis custorrary in Tk PGPLOT widgets can be configured both when they are created and thereafter by using the path narre of the widget as a command F or example the following T cl conmmand creates aPGPLOT widget called plot and gives it an initial size of 10x10 cm up to 16 colors and a 3D border width of 2 pixels pgplot plot width 10c height 10c maxcolors 16 bd 2 Having done this the following
325. ons in a later version of PGPLOT Note that if your computer systemdoes not use the SO Latin 1 character set the output of aPGPLOT programwill not correspond to the characters in the source code T he complete character encoding is displayed in Figure B 0 T his is for the standard PGPL OT roman font font number 2 some of the syrrbols will differ fromfont to font B 2 Additional Symbols An escape code allows a large number of additional symbols to be displayed by PGPLOT Each symbol is composed of a set of vectors based on digitized type fonts devised by A V Hershey of the US Naval Postgraduate School and is assigned a number in the range 0 4000 Figures B 1 to B 7 show the graphical representation of all the available symbols arranged according to Hershey s numerical sequence the blank spaces in this table represent space characters of various widths Note that not every nunber has an associated character Any character can be inserted in a text string using an escape sequence of the form nnnn where nnnn is the 4 digit Hershey number e FigureB 1 Symbols 1 527 e Figure B 2 Synmols 528 713 e FigureB 3 Symbols 714 2017 e FigureB 4 Symbols 2018 2192 e Figure B 5 Symbols 2193 2400 e FigureB 6 Symbols 2401 2747 e FigureB 7 Symbols 2748 2932 Next Appendix C PGPLOT TimPearson California Institute of T echnology tjp stro caltech edu Copyright 1996 California Institute of Technology Figure B 0 PGPLOT Charac
326. or circular region T he appearance of the primitive is controlled by attributes fi area style and color index see Chapter 5 Note that one fill style option is hollow i e draw the outline only T he routine PGPOLY is used to fill an area defined as a polygon It has three arguments the nurrber N of vertices defining the polygon and two arrays XPT S and Y PT S containing the world x and y coordinates of the vertices CALL PGPOLY N XPTS YPTS If the polygon is not convex it may not be obvious which points in the image are inside the polygon PGPLOT assures that a point is inside the polygon if a straight line drawn fromthe point to infinity intersects an odd number of the pol ygon s edges For the special case of a rectangle with edges parallel to the coordinate axes it is better to use routine PGRECT instead of PGPOLY this routine will use the hardware rectangle fill capability if available PGRECT has four argurrents the x y world coordinates of two opposite corners note the order of the arguments CALL PGRECT X1 X2 Y1 Y 2 To draw a circle use routine PGIRC T his routine has three arguments the x y world coordinates of the center and the radius in world coordinates Note that a circle may appear elliptical if the world coordinate scaling is not the same in x and y CALL PGCIRC X Y RADIUS Next Chapter 5 PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1995
327. or Index for subsequent plotting if the output device permits this T he default color index is 1 usually white on a black background for video displays or black on a white background for printer plots T he color index is an integer in the range 0 to a device dependent maximum Color index 0 corresponds to the background color lines may be erased by overwriting themwith color index 0 if the device permits this If the requested color index is not available on the selected device color index 1 will be substituted T he assignrrent of colors to color indices can be changed with subroutine PGSCR set color representation Color indices 0 15 have predefined color representations see the PGPLOT manual but these may be changed with PGSCR Color indices above 15 have no predefined representations if these indices are used PGSCR must be called to define the representation Argument Cl input the color index to be used for subsequent plotting on the current device in range O rax If the index exceeds the device dependent maximum the default color index 1 is used PGSCIR set color index range void cpgscir int icilo int icihi SUBROUTINE PGSCIR ICILO ICIHI INTEGER ICILO ICIHI Set the color index range to be used for producing images with PGGRAY or PGIMAG If the range is not all within the range supported by the device a smaller range will be used T he number of different colors available for images is ICIHI IC
328. or positioning may be incorrect T he window title is updated to show the position of the cursor when the cursor is in the line graphics window Command Line Option X resource Default Notes display disp display none Thedisplay on which the display server should run id id O Theidnunber of this copy of figdisp or pgdisp An arbitrary nunber of copies of figdisp pgdisp may be run at the sare time as long as each one s id number is unique geometry WxH x y 512x512 T his flag corresponds to omgeorretry in figdisp and lg georretry in pgdisp gGeorretry WxH x y lg geometry 512x512 T he line graphics window geometry lineColors lineColors 16 Thenurber of colors to use for line graphics vi sual vi sual Any Thevisual to use Accepted values include the X11 visuals PseudoColor and GrayScale as well as Default only the default visual is allowed and Any any visual is allowed for either pgdisp or figdisp Pgdisp also allows the X11 visual classes StaticGray StaticColor DirectColor and T rueColor gCrosshair 1g Crosshair Specify to get cross hair cursor VMS Workstations Running V WS software Supported device T his driver should work with all VAX VMS workstations running VWS software it requires the UISSHR shareable image provided by DEC Device type code WS Default device name PGPLOT Output is always directed to device SY S WORKST ATION the device narre provided by the user is
329. or tick marks drawn to right of axis in units of the character height FMIN input length of minor tick marks as fraction of major DISP input displacement of baseline of tick labels to right of axis in units of the character height ORIENT input orientation of label text in degrees angle between baseline of text and direction of axis 0 360 PGBAND read cursor position with anchor int cogband int mode int posn float xref float yref float x float y char ch_ scalar INT EGER FUNCT ION PGBAND MODE POSN XREF YREF X Y CH INT EGER MODE POSN REAL XREF YREF X Y CHARACT ER CH Read the cursor position and a character typed by the user T he position is returned in world coordinates PGBAND positions the cursor at the position specified if POSN 1 allows the user to move the cursor using the mouse or arrow keys or whatever is available on the device When he has positioned the cursor the user types a single character on the keyboard PGBAND then returns this character and the new cursor position in world coordinates Sore interactive devices offer a selection of cursor types implemented as thin lines that move with the cursor but without erasing underlying graphics Of these types some extend between a stationary anchor point at XREF Y REF and the position of the cursor while others simply follow the cursor without changing shape or size T he cursor type is specified with one of the fol
330. oral4 255 99 71tomstol 238 92 66 tomato2 205 79 57 tormato3 139 54 38 torato4 255 69 OOrangeRed1 238 64 O OrangeRed2 205 55 OOrangeRed3 139 37 OOrangeRed4 255 O Ored1238 O O red2 205 O Ored3139 O Ored4255 20 147 DeepPink1 238 18 137 DeepPink2 205 16 118 DeepPink3 139 10 80 DeepPink4 255 110 180 HotPink1 238 106 167 HotPink2 205 96 144 HotPink3 139 58 98 HotPink4 255 181 197 pink1 238 169 184 pi nk2 205 145 158 pink3 139 99 108 pink4 255 174 185 LightPink1 238 162 173 LightPink2 205 140 149 LightPink3 139 95 101 LightPink4 255 130 171 PaleVioletRed1 238 121 159 PaleV ioletRed2 205 104 137 PaleVioletRed3 139 71 93 PaleVioletRed4 255 52179 maroonl 238 48 167 maroon2 205 41 144 maroon3 139 28 98 maroon4 255 62 150 VioletRed1 238 58 140 VioletRed2 205 50120 VioletRed3 139 34 82 VioletRed4 255 0255 magental 238 0238 magenta2 205 0205 magenta3 139 0139 magenta4 255 131 250 orchid1 238 122 233 orchid2 205 105 201 orchid3 139 71 137 orchid4 255 187 255 plum 238 174 238 plun 205 150 205 plums 139 102 139 pl un 224 102 255 MediumOrchid1 209 95 238 MediumOrchid2 180 82 205 MediumOrchid3 122 55 139 MediumOrchid4 191 62 255 DarkOrchid1 178 58 238 DarkOrchid2 154 50 205 DarkOrchid3 104 34 139 DarkOrchid4 155 48 255 purplel 145 44 238 purple2 125 38 205 purple3 85 26 139 purple4 171 130 255 MediunPurplel 159 121 238 MediunP urple2 137 104 205 M ediun urpl e3 93 71 139 Mediun urple4 255 225 255 thistle1 238 210 238 thistle2 205 181 205 thistle3 139 123 139 thi stl e
331. ord float fjust const char text SUBROUTINE PGMT XT SIDE DISP COORD FJ UST TEXT CHARACT ER SIDE TEXT REAL DISP COORD FJ UST Write text at a position specified relative to the viewport outside or inside T his routine is useful for annotating graphs It is used by routine PGLAB The text is written using the current values of attributes color index line width character hei ght and character font Argurrents SIDE input must include one of the characters B L T or R signifying the Bottom Left T op or Right margin of the viewport If it includes LV or RV the string is written perpendicular to the frarre rather than parallel to it DISP input the displacement of the character string fromthe specified edge of the viewport measured outwards fromthe viewport in units of the character height Use a negative value to write inside the viewport a positive value to write outside COORD input the location of the character string along the specified edge of the viewport as a fraction of the length of the edge FJUST input controls justification of the string parallel to the specified edge of the viewport If FJ UST 0 0 the left hand end of the string will be placed at COORD if J UST 0 5 the center of the string will be placed at COORD if J UST 1 0 the right hand end of the string will be placed at at COORD Other values between 0 and 1 give inter mediate placing but they are not ver
332. ot all of the points of a grid Argurrents A input data array IDIM input first dimension of A J DIM input second dimension of A 11 12 input range of first index to be contoured inclusive J 1 2 input range of second index to be contoured inclusive C input array of contour levels in the sarre units as the data in array A dimension at least NC NC input number of contour levels less than or equal to dimension of C T he absolute value of this argurrent is used for compatibility with PGCONT where the sign of NC is significant TR input array defining a transformation between the grid of the array and the world coordinates T he world coordinates of the array point A I J are given by X T R 1 T R 2 I T R 3 J Y TR 4 T R 5 1 T R 6 J Usually T R 3 and T R 5 are zero unless the coordinate transforrration involves a rotation or shear BLANK input elements of array A that are exactly equal to this value are ignored blanked PGCONMF fill between two contours void cpgconf const float a int idim int jdim int i1 int i2 int j1 int j2 float c1 float c2 const float tr SUBROUTINE PGCONF A IDIM J DIM 11 12 J 1 J 2 C1 C2 TR INT EGER IDIM J DIM 11 12 J 1 2 REAL A IDIM DIM C1 C2 TR 6 Shade the region between two contour levels of a function defined on the nodes of a rectangular grid T he routine uses the current fill attributes ha
333. ote that many drivers cannot be compiled note about disabling backslash interpretation f77_gcc conf Corrected to use ranlib and revised list of libraries pgplot sys_next pgview P GView m Allyn T ennant Correct resize bar af77_src grfileio c add O_T RUNC to cause truncation when an existing file is overwritten pgplot sys sol2 aaaread me Added warning about non ANSI C compilers pgplot sys_ sun aaaread me Added note about SunV iew driver pgplot sys_vins build com Add PGQIT F PGSITF PGPANL to transfer vector grfileio c Suppress warning messages produced by DECC compiler Add O_T RUNC to cause anew version of the file to be created instead of overwriting usual VMS behavior grlgtr f Convert supplied string to uppercase before attermpting to translate it as a logical nane make_demos com Correct comment make_font com Change protection of grfont dat TimPearson California Institute of T echnology tjo stro caltech edu Copyright 1995 California Institute of Technology PGPLOT changes in Version 5 0 2 This version implements fi area styles 3 and 4 hatching and cross hatching T his affects polygons drawn with PGPOLY PGCIRC and PGRECT Hatching is selected by CALL PGSF S 3 and cross hatching is selected by CALL PGSF S 4 see also PGQF S T here is a new user callable routine PGSHS to control the angle and spacing of hatch lines and a corresponding new inquiry routine PGQHS T here is also one new internal
334. ou do not specify a configuration on the makerake contrand line New and modified demonstration programs pgdenol Now uses new routine pgpt1 when a single marker is to be drawn pgderno2 Modified text sarple page pgdeno3 Added denm of new routine pgconf Demo of pgvect has been moved to pgdemn 15 pgden4 Demo of pgimrag modified to use slightly more realistic transformation matrices to show the use of pgctab and to show how the color palette may be modified interactively pgden6 Now uses new routine pgpt1 when a single marker is to be drawn pgdenv13 Now uses new routine pgpt1 when a single marker is to be drawn pgdeno15 New denv for routine pgvect forrrerly in pgderrv3 pgdenw16 New denv for bar and column charts T his uses a general purpose subroutine that may get included in a future version of pgplot although not exactly in this form pgdenv17 New den fromDr Martin Weisser showing animated rotation of a molecular structure Changes to C binding T he programthat creates the PGPLOT C binding pgbind can now generate a binding for MS Powerstation Windows TimPearson California Institute of T echnology tjo stro caltech edu Copyright 1997 California Institute of Technology Installation Instructions UNIX systems Note T he following instructions refer to two directories the distribution source directory which will contain the PGPLOT source code directory tree and the target directory in which the machine sp
335. outside the window no marker is drawn T he pen position is changed to XPT YPT in world coordinates T o draw several markers with coordinates specified by X and Y arrays use routine PGPT Argurrents XPT input world x coordinate of the point YPT input world y coordinate of the point SYMBOL input code number of the symbol to be drawn 1 2 a single dot diameter current line width 3 31 a regular polygon with ABS SY MBOL edges style set by current fill style 0 31 standard marker syrrbols 32 127 ASCII characters in current font e g to use letter F as a rrarker let SYMBOL ICHAR F gt 127 a Hershey symbol number PGPT XT write text at arbitrary position and angle void cpgptxt float x float y float angle float fj ust const char text SUBROUTINE PGPT XT X Y ANGLE FJ UST TEXT REAL X Y ANGLE FJ UST CHARACT ER TEXT Primitive routine for drawing text T he text may be drawn at any angle with the horizontal and may be centered or left or right justified at a specified position Routine PGT EXT provides a sinple interface to PGPT XT for horizontal strings T ext is drawn using the current values of attributes color index line width character height and character font T ext is NOT subject to clipping at the edge of the window Argurrents X input world x coordi nate Y input world y coordinate T he string is drawn with the baseline of all t
336. owing forns pixel x worldx T his returns the horizontal X window pixel coordinate that corresponds to the given X axis world coordinate pixel y worldy T his returns the vertical X window pixel coordinate that corresponds to a given Y axis world coordinate pixel xy worldx worldy T his returns the X window pixel coordinate pair that corresponds to the given world coordinates Note that if the widget is not open to PGPL OT O will be returned for all world coordinates T his returns the integer id that was returned by cpgopen when the widget was last connected to PGPL OT T his can then be used with cpgsict to select the widget to be the target for subsequent PGPLOT output If the widget has not been opened 0 is returned Handling widget resizes When an application is resized by the user sorre or all of its nested widgets are resized to fit the new area T his means that aPGPLOT widget can get resized at unpredictable times whereas PGPLOT assures that the size of its view surface remains unchanged between the start of one page and the start of the next T o cope with this pgplot widgets draw to an off screen pixmap which is kept fixed in size for the duration of each page and is only resized to fit the window when cpgpage is called T hus when the widget is smaller than the pixmap only part of the PGPLOT view surface will be visible T here are two ways to deal with this 1 One way is to provide the widget with scrollbars so that
337. path_name command_nare arguments configure option argurrents T his allows widget configuration options to be changed after aPGPLOT widget has been created T he supported options and their arguments have already been described in the Configuration section cget option T his allows the current value of the specified configuration option to be queri ed T he return string is formatted in the sarre fashion as the arguments of the corresponding pathNarre configure option command xview This is used to scroll the widget horizontally It can take any of the following forms as used by T k scrollbar widgets xview moveto fraction Where fraction is the fractional width of the PGPLOT view surface that lies to the left of the left edge of the widget xview scroll increment units Move the view surface increment pixels to the right Negative values move the view surface to the left xview scroll increment pages Move the view surface increment widget widths to the right Negative values move the view surface to the left yview This is used to scroll the widget vertically It takes the sare forms as described for the xview command except that positive increments are defined as moving the widget downwards instead of to the right setcursor mode x y Ci This is used to augment the normal X window cursor of aPGPLOT widget with one of a selection of rubber band cursors T he mode argurrent selects the type of cursor to use and the x and y ar
338. phics XmpNmaxColors This has a default value of 100 It specifies how many colors to attempt to allocate per widget T hus if you have two PGPLOT widgets sharing a colormap that has only 100 free colors then you would need to make the XmpNmaxColors resource values of the two widgets add up to no more than 100 Configuring how widget resizes are handled When georretry management widgets are resized by users their child widgets generally also get resized T his means that the PGPLOT widget can get resized at unpredictable times However PGPLOT assures that the size of its view surface remains unchanged between the start of one page and the start of the next T o handle this XnP gplot widgets use an off screen pixmap for buffering and backing store T his is kept fixed in size for the duration of each page and is only resized to fit the window when cpgpage is called If the widget window is resized to a sneller size then part of the plot will becorre obscured until the next page is started T he XnP gplot widget driver supports two optional ways to improve this situation Scrolled PGPLOT windows If you arrange for the parent widget of a XnPgplot widget to be a Motif ScrolledWindow widget then the PGPLOT widget will autorraticall y adopt the scroll bars of its parent and arrange that they scroll the underlying pixmap relative to the window T hen if the window is resized to a smaller size the scroll bars can be used to see the obscured part of
339. piling and linking Motif code e g MOTIF_INCL I usr dt incl ude XINCL MOTIF_LIBS L usr dt lib IXm L usr openwin lib IXt L1BS SYSDIR On entering the configuration script this variable contains the directory narre of the systemdirectory in which the configuration file resides If you have multiple compiler combinations which require a different set of system specific routines then you should create a subdirectory in the systemdirectory for each corrbination and redirect SY SDIR in each configuration file to point at the relevant directory eg SY SDIR SY SDIR f77_cc PGBIND_FLAGS If you wish to have the PGPLOT C wrapper library compiled for your system then you will need to assign this variable Its arguments are the configuration flags to the PGPL OT pgbind contrand T o see the available options compile the pgbind programin pgpl ot cpg with an ANSI C compiler and invoke it with no argurrents SHARED LIB If your systemsupports shared libraries you should specify the narre to give the shared library here SHARED_LD If your systemsupports shared libraries then you should specify the command and its leading arguments which when all the PGPLOT object files are appended as trailing argurrents will create a shared library You can use the SHARE D_LIB variable specified above as an argument to this command by referring to it as sHARED LIB MCOMPL T he command used to invoke the chosen Objective C compiler on your system
340. pixels inch Color capability Color indices 0 erase white and 1 black are supported It is not possible to change color representation Input capability None File format Variable length records maximum 132 bytes with erbedded carriage control characters A full page plot occupies 901 512 byte blocks Obtaining hardcopy VMS Use the conmand PRINT PASSALL Colorwriter 6320 Plotter Supported device Gould now Bryans Colourwriter 6320 or any device obeying Gould Plotter Language Device type code CW6320 Default device name PLOT TERI a logical narre Default view surface dimensions 280 nm by 360 mm A 3 Resolution 0 025 nm Color capability Up to 10 pens Default is pen 1 which is picked up on initialization without a call to PGSCI Calls to PGSCI are interpreted as the pen nunber and colors therefore depend on how the pens have been loaded into the stalls If a call is made for a pen higher than 10 the sel ected pen defaults to 1 Input capability Possible but not supported File format Ascii character strings It is possible to send the data to a file which can then be copied to the plotter or on a terminal Author Len Pointon J odrell Bank 1988 Hewlett Packard HP GL 2 Plotters HP GL Hewlett Packard Graphics Language is a vector graphics fornet for control of pen plotters and aser printers manufactured by Hewlett Packard Co and sore other manufacturers This PGPLOT device handler produces files that should b
341. pl ot pgpl ot5 2 tar gz 2 Uncompress the file gunzip and extract the files fromthe tar archive tar cv Versions of gunzip and tar for Windows are available on the Web One programthat will handle both steps is WinZip It is available fromhttp www winzip comand many other web sites T he files in the tar archive are organized in a hierarchical directory structure with the top level directory called PGPLOT You will need the files fromthe following directories X PGPLOT CPG DRIVERS EXAMPLES FONTS PGMF SRC SYS_WIN T he other SY S_ directories can be ignored T he directory PGPLOT SYS_WIN contains system specific files for this operating systemand compiler GRDOS F GRE XEC F GRGFIL F GRSY 00 F WODRIV F screen driver PGBIND MAK 3 Then follow the instructions in PGPLOT SYS_WIN AAAREAD ME below T hese instructions apply to both Microsoft P owerStation F ortran and Compad Digital Visual Fortran Note that for PowerStation F ortran you must edit the file W9DRIV F PGPLOT 5 2 0 for Windows95 98 NT and Microsoft Digital Compaq F ortran P A Seeger August 27 1998 docurrent revised J uly 15 2000 emil PASeeger aol com Based on C T Dum May 1995 T he following notes describe the porting of TimPearson s PGPLOT 5 2 0 to Microsoft Windows95 98 or WindowsNT using Microsoft Developer Studio and the corresponding F ortran compiler T he 32 bit Windows systems are easy to use but most importa
342. plays superscripts subscripts and special characters pgderno2 the PGPLOT programcan read the color database pgder10 on interactive devices the cursor works correctly pgdemo5 pgdenw6 Totest the PGPLOT Motif widget driver run pgrdem in the sarre way as the other demonstration progran Y ou must first ensure that an X window display is available and that environment variable PGPLOT _DIR is correctly defined Totest the PGPLOT Tk T cl widget driver type pgtkderpo pgtkdern tcl See the docurrentation for the driver for more information Note T he installation procedure does not install the T k den correctly on Digital Unix 4 0B T he demos program pgtkdernn is unable to read command line argurrents Use the following comrands to conpile and link the deno cc c I pwd I usr local include pgtkdemp c cc 0 pgtkdemp pgtkdenn o L pwd Itkpgpl ot I cpgplot I pgpl ot L usr local shlib al pha Itk Itcl 1X11 lUfor Ifor Im i e omit DmainSMAIN__ and use cc instead of f77 for the link step Install documentation files optional T he standard installation procedure creates an ASCII text file containing synopses of all the PGPLOT subroutines pgplot doc A documentation file in HT ML fornet that can be displayed with a Web browser or an HT ML reader can be created by typing make pgplot htm This file is created by executing a perl programto extract the documentation fromthe source code If you do not ha
343. ple example R usr local pgpl ot opt S UNWspro lib L usr local pgpl ot pgpl ot 1X11 T hanks to Martin Shepherd Why doesn t PGPLOT redraw the plot when the window size is changed PGPLOT cannot autorretically redraw the plot at a new scale when the window size is changed If you use the PGPLOT X window driver device XSERV or XWIN PGPLOT in concert with the X server maintains an off screen pixmap a pixel by pixel copy of the screen picture which is used to redraw the picture when it is de iconized uncovered resized etc However the pi xrmap cannot be rescaled PGPLOT does not keep a record of the elements comprising the plot vectors polygons etc which could be used to redraw the plot at a new scale such a record could potentially require a very large amount of memory and slow down the PGPLOT process If you want your application to redraw the plot you should call PGPAGE and re issue the subroutine calls required to draw the plot If you do not have to recalculate your data this should be quite quick If the window has been resized PGPLOT becomes aware of the new size when PGPAGE is called T here is one problemthough how does your application tell that the window has been resized and that the plot must be redrawn T his is an asynchronous event it could happen at any time during the execution of your program and it is difficult for a standard F ortran program with a single thread of execution to respond to such a
344. port in NDC YTOP input y coordinate of top edge of viewport in NDC PGSWIN set window void cpgswin float x1 float x2 float y1 float y2 SUBROUTINE PGSWIN X1 X2 Y1 Y 2 REAL X1 X2 Y1 Y2 Change the window in world coordinate space that is to be mapped on to the viewport Usually PGSWIN is called autorratically by PGENV but it may be called directly by the user Argurrents X1 input the x coordinate of the bottomleft corner of the viewport X2 input the x coordinate of the top right corner of the viewport note X2 may be less than X1 Y1 input the y coordinate of the bottomleft corner of the viewport Y2 input the y coordinate of the top right corner of the viewport note Y 2 may be less than Y 1 PGT BOX draw frame and write DD HH MM SS S labelling void cpgtbox const char xopt float xtick int nxsub const char yopt float ytick int nysub SUBROUTINE PGT BOX XOPT XTICK NXSUB YOPT YTICK NY SUB REAL XTICK YTICK INT EGER NXSUB NY SUB CHARACTER XOPT Y OPT Draw a box and optionally label one or both axes with DD HH MM SS style numeric labels useful for time or RA DEC plots If this style of labelling is desired then PGSWIN should have been called previously with the extrema in SECONDS of time In the seconds field you can have at most 3 places after the decimal point so that 1 ms is the srrallest time interval you can time label L arge nurrbers
345. pplied by those below 1 X resource pgxwin win geometry WIDT HXHEIGHT X Y 2 X resource pgxwin Win geometry WIDT HXHEIGHT X Y 3 Environment variable PGPLOT_XW_WIDTH fractional display width 4 Width 867 height 669 and aspect 8 5 11 Once displayed the window can be resized with the mouse but the drawing area is only resized to reflect this when the next page is started Resolution Depends on monitor Color capability Colorrraps of types PseudoColor StaticColor GrayScale StaticGray and T rueColor are supported By default the first available colormap fromone of the following lists is used o For color displays PseudoColor StaticColor T rueColor o For gray scale displays GrayScale StaticGray o Formonochrorme displays T he default colormap of the screen T hus where possible a read write colormap is chosen T his allows color representation changes via PGCT AB PGSCR and PGSHLS to be applied immediately to previously drawn graphics which makes it possible to interactively fiddle the colors when used in conjunction with PGBAND If the first available colormap type happens to match that of the default colorrmap of the screen and enough colors are available therein then that colormap is used Otherwise allocation of a private colorrrap is attempted If this fails the device is treated as monochrome T he default color map type can be overriden via the pgxwin Win visual resource described below However if the requ
346. pt for a carriage return before switching If this is not done intervening text will appear on the graphics screen Graphics mode can be entered and exited fromthe setup menu or by SHIFT PF 1 Graphics extensions include rectangle fill selective erase and switch between T ek and VT 100 modes IBM PC s and compatibles running MS Kermit 3 as a terminal emulator T he video board is assumed to have sufficient memory to retain the graphics image in menory when switched to text T his will be true for VGA and EGA but some early PCs might not be able to do this If Kermit is using full VGA resolution ie SET TERMINAL GRAPHICS VGA there is not usually enough merrory to store the full 480 vertical lines so the bottomfew lines may disappear T ektronix enhancerrents include selective erase colours rectangle fill and switching between text and graphics mode T he cursor may be operated with the mouse T ested with Kermit version 3 1 T ektronix 4100 series color terminals and emulators e g V ersatermP RO for Macintosh Device type codes WO ONDUBWNE T EK4010T ektronix 4010 terminal GF GraphOn terminal RET RO Retrographics V T 640 terminal GT ERM GT ERM terminal emulator XTERM XTERM terninal emulator ZST EM ZST EM terminal emulator V603 Visual V 603 terminal KRM3 Kermt 30n IBM PC T K4100T ektronix 4100 series terminals Default device nane T he logged in terminal dev tty UNIX TT VMS Defa
347. ption of PGV ST D PGWINDOW non standard alias for PGSWIN SUBROUTINE PGWINDOW X1 X2 Y1 Y 2 REAL X1 X2 Y1 Y2 See description of PGSWIN PGPLOT T imPearson California Institute of T echnology t p stro caltech edu Copyright 1995 2002 California Institute of Technology Appendix B PGPLOT Symbols B 1 Character Encoding The PGPLOT routines that display text e g PGT EXT PGMT XT and PGMT XT generate a visible representation of the characters supplied in a Fortran character variable or constant On nost computer systems a F ortran character can take any of 256 values nunbered 0 255 deci mal PGPLOT interprets the values as follows 0 31 T hese are used for the standard graph markers On most computer systems they are non printable control characters 32 127 PGPLOT interprets these according to the US ASCII character set a subset of the ISO Latin character sets with one exception character number 94 which should be a circunflex 9 is displayed as a degree symbol T he degree symbol is also available as character 176 which should be used in preference eventually the display of character 94 will be corrected 128 159 T hese are unassigned in the SO L atin character sets they are reserved for non printable control characters 160 255 As far as possible PGPLOT interprets these according to the SO L atin 1 character set In sore cases required accents are omitted hope to rectify the omissi
348. put capability None Environment variables PGPLOT_DEBUG if this environment variable is defined with any value some statistics are reported on standard output Author T J Pearson 1988 1994 PGPLOT rretafile driver Beta test version released with PGPL OT v5 2 0 Author T J Pearson 1997 Supported device This PGPLOT driver creates a disk file in the private PGPLOT rretafile fornet Do not confuse this fornet with other formats such as the Windows Metafile fornet F iles in this format can be read into aPGPLOT programwith subroutine pgrdnf and displayed on another PGPLOT device T he device driver is written in standard F ortran 77 and can be used with all operating systems for which PGPLOT is available ThePGPLOT metafile is a plain ASCII text file it can be transferred fromone machine to another using standard channels e g ftp e mail The first five characters in the file must be P GMF to identify the filetype PGPLOT metafiles can contain more than one picture page PGPLOT rretafiles may be concatenated the resulting file is also a valid PGPLOT rretafile Files can be substantially compressed by using standard utilities such as gzip It should be fairly easy to write translation progrars to convert files fromthis fornet to another graphics fornet Device specification filenama P GMF PGMF Supply any file nan suitable for use on the host operating system T he default file name is pgplot pgnf If the file
349. pyright 1995 California Institute of Technology PGPLOT version 5 0 3 T ested Systems Version 5 0 3 has been tested with the following operating systems and compilers Drivers tested include GI GL NU PP PS TT VT WD X2 XW but not all combinations of drivers and systems have been tested exhaustively e HP UX version A 09 01 HP F ortran 9000 fort77 HP C c89 e OpenVMS AXP V6 1 DEC FORT RAN V6 2 DEC C V4 0 tested on DEC 3000 M 600 e OpenVMS VAX V6 1 DEC FORT RAN V6 2 DEC C V4 0 tested on VA Xstation 4000 90 Note the PGDISP server cannot be compiled on this system e Solaris 2 4 SunOS 5 4 Sun F ortran 2 0 1 Sun C 2 0 1 tested on SPARCstation 10 e SunOS 4 1 4 Sun Fortran 1 3 1 cc tested on SPARCstation IPX Note the C binding cannot be compiled with this non ANSI C compiler e SunOS 4 1 4 Sun Fortran 1 3 1 GNU gcc v2 7 0 tested on SPARCstation IPX e IRIX 6 0 1 Power Indigo2 f77 m ps4 cc 64 reported by T orrasz Plewa Changes in Version 5 0 3 Routine PGQCS has a new option to determi ne the character height in world coordinates and a bug that would give wrong values on devices with non square pixels has been corrected Routine PGT BOX has a new option X to label the HH field modulo 24 T hus a label such as 25h 10mwould corre out as 1h 10m Graphical output fromthe GIF and PPM drivers can now be directed to the standard output by specifying a file name e g gif T his
350. r based on the GrWin graphics library T his can be used with many different compilers See e GrWin Graphics Library by T arraribuchi T suguhiro e PGPLOT for Win32 with Microsoft VC v6 0 and Digital Visual F ortran 6 0 by Karl Glazebrook and Roberto Abraham T his version has not yet been ported to MS DOS OS 2 or MacOS F or notes about earlier attempts to port PGPLOT to these operating systers see the files called aaaread me in the directories pgplot sys dos pgplot sys_msdos pgplot sys salford and pgplot sys_mac inthe tar file appreciate feedback fromusers PGPLOT TimPearson California Institute of Technology tjp _astro caltech edu Copyright 1995 1998 California Institute of Technology Appendix G Porting PGPLOT G 1 General Notes The PGPLOT library consists of the following routines 1 The standard routines pgplot src pg f and pgplot src gr f All of these routines should be compiled and put in the obj ect module library although the obsol ete routines may be omitted they are not used by current PGPLOT programs and will not be included in future versions of PGPLOT T he obsolete routines are grchar grchr0 grdat2 grgtcO grinafont gringli gringpen grlinr grmark grmovr grsetfont grsetli grsetpen grtran grvect pgsetc pgsize All routines in the pgplot src directory are standard F ortran 77 with the following exceptions o O Several routines use the non standard INCL UDE st
351. r drawing partial circles Specified by center radius and two angles Window titles Add a subroutine to modify the window title on X window and similar devices that put a title bar on PGPLOT windows Query routine number of open devices A new routine to return the number of open devices and their PGPLOT IDs PGPAP T his routine should indicate to the caller when it has failed to allocate a view surface of the requested size Cubic splines PGPLOT draws curves by linear interpolation between a set of points straight line segirents plan to add a routine to draw a smoother curver through the points e g a cubic spline Smoothing measured data i e drawing a smooth curve that does not pass through all the points is beyond the scope of PGPLOT T he choice of the best way to smooth the data depends on the characteristics of the data and you should smooth the data with an appropriate method before passing themto PGPLOT Device Drivers Driver for CGM Computer Graphics Metafile This is an official standard interchange forrret but not widely adopted David Billinghurst has contributed a driver layered on CD fromNIST I amtesting this driver and hope to include it in a future version of PGPLOT Driver for F IG fornet It would be nice to have an editable graphics fornet but PGPLOT will not be able to easily take advantage of XF IG s capability for two reasons 1 text will appear in the output file as vectors not characters an
352. r exited the top of a widget T he XmNbackground and XmNforeground resources were being overriden by the default pgplot background and foreground colors whenever a widget was opened to pgpl ot T his made these resources useless They now work correctly If not specified the default background and foreground colors will be black and white as before rather than taking on the conventional blue and black Motif colors See the Inherited widget resources section for more details Martin Shepherd nxs astro caltech edu X Window T k widget driver Author M C Shepherd 1997 Supported device Restricted to T cl T k T k4 0 and above applications on workstations running the X Window System Device type code IXTK Compatibility So far the driver has been tested by the author on a Sparc running Solaris 2 5 1 and the following combinations of T cl and T k o Tcl7 5b3 and T k4 1b3 o Tcl8 0a2 and T k8 0a2 No changes were needed to upgrade between the above versions so it is probably safe to assure that all intervening versions will work as well F uture incormpati bilities will be accommodated as needed and distributed with later versions of PGPLOT T he driver is unlikely to work fully with versions of T k prior to T k4 0 At the very least the changed definitions of the xview and yview commands will prevent the use of scrollbars with the widget Device narre specification TkPGPLOT widgets are created with aT cl command c
353. raphical image if the sane programis run twice with the same input pararreters the sare image will result An interactive programallows the user to control the behavior of the programwith a graphical input device PGPLOT supports a limited interactive capability on devices with a cursor for graphical input e g Xwindow workstations some T ektronix terminals and emulators T he capabilities are necessarily limited by the aimto keep PGPLOT device independent 7 2 T he Cursor Sone of the graphics devices supported by PGPLOT havea graphics cursor T his appears on the view surface as a plus sign a cross hair or a diamond and can be moved around the view surface with a mouse joy stick or trackball attached to the graphics device If the hardware does not provide this mechanism PGPLOT allows the user to move the cursor using the arrow keys on his terminal See Appendix D for instructions for using the cursor on a specific device 7 3 Using the Cursor T he basic routines for cursor input are PGCURS and PGBAND Routine PGCURS enables the cursor on the selected device positions it at a specified location within the viewport and allows the user to move it When the user has positioned the cursor he types a key on his terminal PGCURS returns the cursor position in world coordinates and the character that was typed On sorre devices the user can also click depress and release a mouse button Buttons 1 2 3 have the sarre effect as typing A
354. re scaled georretrically with the character height attribute and the line width attribute is ignored T his is different frommost of the other drivers where the line width used for markers is set by the line width attribute rather than the character height attribute Requesting this option makes the PostScript driver behave like the other drivers but it also rakes the PostScript files larger Document Structuring Conventions T he PostScript files conformto V ersion 3 0 of the Adobe Document Structuring Conventions see ref 3 and to version 3 0 of the encapsulated PostScript file E PSF format T his should allow the files to be read by other prograrrs that accept the EPSF fornet Note though that multi page plots are not valid EPSF files T he files do not contain a screen preview section A device independent screen preview can be added to PGPL OT files with the programps2epsi by George Carreron available with the GhostScript PostScript interpreter fromAladdin Enterprises Note that a valid EPSF file should have a BoundingBox coment in the header of the file By default PGPLOT puts the comrent in the trailer of the file where sorre but not all prograrrs will find it You may need to move this comment into the file header using a text editor or special program See also the discussion of the environment variable PGPLOT_PS_BBOX above References 1 Adobe Systems Inc PostScript Language Reference Manual Addison Wesley Reading Ma
355. re seen by pgxwin_server you should use the xrdb command to install themon the display UNIX cd xrdb X defaults VMS xrdb nocpp decw user_defaults decw xdefaul ts dat If the xrdb contrand is not defined on your system then first execute DECW UT ILS DECW DEFINE_UTILS COM T hen terminate pgxwin_server by quiting its icon and ask for xw or xs again to restart it PGDISP or FIGDISP server for X Window workstations T he figdisp server is part of Figaro it maintains a line graphics window which can be addressed by PGPLOT using the XDISP device type T he pgdisp server is a subset of figdisp that shows only the line graphics window Both server programs run in the background and keep the PGPL OT window open Most users will prefer to use XSERV instead of XDISP Author SamSouthard J r 1991 Device type code XDISP Starting PGDISP T o start up the pgdisp server in the background use pgdi sp options amp You can change the size of the server window with the mouse Y ou can also use standard georretry and display options with pgdisp PGPLOT will adapt to the size selected but it is not possible to change the size of a graph after it has been displayed T o remove the server select Quit fromits menu If the pgdisp programis not in a directory in your path you will need to use the full file name or create an alias e g usr local pgpl ot pgdisp options amp Redirecting the Display Before st
356. rectangle is assumed to have its edges parallel to the device coordinate axes e CHR 7 7 P if the handler understands the pixel primitives Q if it understands the image primitives opcode 26 or N otherwise see the description of opcode 26 e CHR 8 8 V if PGPLOT should issue an extra prompt to the user before closing the device in PGCLOS N otherwise Use V for devices where the PGPLOT window is deleted fromthe screen when the device is closed e CHR 9 9 Y if the handler accepts color representation queries opcode 29 N if it does not e CHR 10 10 M if the device handler accepts opcode 28 to draw graph markers N otherwise e CHR 11 11 S if the device handler accepts opcode 30 to scroll the underlying pixel map N otherwise OPCODE 5 Return default device file name This is an inquiry routine T he device handler returns the device or file name to be used if the PGPLOT device specification does not include one On VMS the default file name may also be used to fill in missing fields of the supplied file narre e g disk directory and file type Pararreters returned by handler e CHR L CHR default device file narre OPCODE 6 Return default size of view surface Thisis an inquiry function the handler returns the default dimensions of the plot surface in device coordinates At present PGPLOT assurres that the device coordinates of the bottomleft corner are 0 0 Note on sore de
357. rizontal CPS color landscape mode long edge of paper horizontal VPS monochrone portrait mode short edge of paper horizontal VCPS color portrait mode short edge of paper horizontal Color PostScript files can be printed on monochrone printers the colors will be rendered as shades of grey Use the monochrorre codes PS V PS when you know that the file is to be printed only on monochrone printers Default file nane e pgplot ps If afile narre of is specified e g P S the PostScript file is sent to the standard output stream stdout in UNIX Default view surface dimensions 10 5 inches horizontal by 7 8 inches vertical landscape mode 7 8 inches horizontal by 10 5 inches vertical portrait mode T hese dimensions can be changed with environment variables Resolution T he driver uses coordinate increments of 0 001 inch giving an apparent resol ution of 1000 pixels inch T he true resolution is device dependent e g on an Apple LaserWriter it is 300 pixels inch in both dimensions Color capability Color indices 0 255 are supported and the color representation can be changed with routine PGSCR With device types PS and V PS color index 0 is white erase or background color indices 1 13 are black 14 is light grey and 15 is dark grey while with device types CPS and VCPS color index 0 is white erase or background color index 1is black and indices 2 15 have the standard PGPLOT c
358. rld coordinate space that will be visible in the viewport e PGSWIN set window e PGWNAD set window and adjust viewport to same aspect ratio e PGQWIN inquire window boundary coordinates Norrrelly all PGPLOT primitives except text are clipped at the edge of the viewport use PGSCLP to disable or re enable clipping e PGSCLP enable or disable clipping at edge of viewport New in version 5 2 e PGQCLP inquire clipping status New in version 5 2 Primitives Lines Straight lines and curves made up of straight line segments can be specified either segment by segment PGMOVE PGDRAW or by alist of points to be joined together PGLINE e PGMOVE move pen change current pen position e PGDRAW draw a line fromthe current pen position to a point e PGQPOS inquire current pen position e PGLINE draw a polyline curve defined by line segments Polygons and Filled A reas Closed polygons circles and rectangles canbe outlined filled with solid color or shaded using hatching depending on the current fill area attributes e PGPOLY draw a polygon using fill area attrutes e PGCIRC draw a circle using fill area attributes e PGRECT draw a rectangle using fill area attributes Graph Markers Use PGPT 1 to mark a single point PGPT to mark several points with the same symbol or PGP NT S to mark several points with different symbols e PGPT 1 draw one graph rerker New in version 5 2 e PGPT draw several grap
359. routine PGHT CH Drivers have been modified so that they all interpret sel f intersecting polygons the sarre way a point is inside the polygon if an infinite ray with the point as origin crosses an odd number of polygon edges E venOddRule in X window terminology Example programP GDE MO1 has been revised to show the new fill area styles Routine PGERRB has acquired new options that allow symretric two sided error bars to be drawn with one call instead of two T here are two new drivers LXDRIV to create aLaT eX picture environment this is only useful for very simple plots and HGDRIV to create a plot in HPGL 2 fornet T he PostScript driver has been updated to record a correct bounding box for each page and optionally include comments describing text strings Note that the bounding box is now written at the end of the file i e after PGPLOT has figured out what it should be Some progran that import PostScript require the bounding box in the file header T he script pgpl ot pscaps sh can be used to move the bounding box information into the header T here are four bug fixes 1 in routine PGSUBP which was not setting the viewport correctly 2 in routine PGCONL actually PGCL which was writing contour labels at the wrong angle 3 in routine GRPARS which was incorrectly atterpting to overwrite the supplied device spec when doing ogical narre translation VMS only 4 in routine GRFA which would sometimes incorrectly fill a r
360. rquoise2 150 205 205 PaleT urquoise3 102 139 139 PaleT urquoise4 152 245 255 CadetBlue1 142 229 238 CadetBlue2 122 197 205 CadetBlue3 83 134 139 CadetBlue4 0 245 255 turquoisel 0 229 238 turquoise2 0 197 205 turquoise3 0 134 139 turquoise4 0 255 255 cyanl 0 238 238 cyan2 0 205 205 cyan3 0 139 139 cyan4 151 255 255 DarkSlateGray 1 141 238 238 DarkSlateGray2 121 205 205 DarkSlateGray3 82 139 139 DarkSlateGray4 127 255 212 aquarrerinel 118 238 198 aquarrarine2 102 205 170 aquarrarine3 69 139 116 aquarrerine4 193 255 193 DarkSeaGreen1 180 238 180 DarkSeaGreen2 155 205 155 DarkSeaGreen3 105 139 105 DarkSeaGreen4 84 255 159 SeaGreen1 78 238 148 SeaGreen2 67 205 128 SeaGreen3 46 139 87 SeaGreen4 154 255 154 PaleGreenl 144 238 144 P aleGreen2 124 205 124 PaleGreen3 84139 84PaleGreen4 0 255 127 SpringGreen1 0 238 118 SpringGreen2 0 205 102 SpringGreen3 0139 69 SpringGreen4 0255 Ogreenl 0238 Ogreen2 0205 Ogreen3 0139 Ogreen4127 255 Ochartreusel 118 238 Ochartreuse2 102 205 0 chartreuse3 69139 Ochartreuse4 192 255 62 OliveDrab1 179 238 58 OliveDrab2 154 205 50 OliveDrab3 105 139 34 OliveDrab4 202 255 112 DarkOliveGreen1 188 238 104 DarkOliveGreen2 162 205 90 DarkOliveGreen3 110 139 61 DarkOliveGreen4 255 246 143 khaki 1 238 230 133 khaki 2 205 198 115 khaki3 139 134 78 khaki4 255 236 139 LightGoldenrod1 238 220 130 LightGoldenrod2 205 190 112 LightGol denrod3 139 129 76 LightGoldenrod4 255 255 224 LightY ellow1 238 238 209 LightY ellow2 205 205
361. rrarker T he markers are drawn using the current values of attributes color index line width and character hei ght character font applies if the symbol number is gt 31 If the point to be marked lies outside the window no rrarker is drawn T he pen position is changed to XPT S N Y PT S N in world coordinates if N gt 0 Argurrents N input number of points to merk XPTS input world x coordinates of the points YPTS input world y coordinates of the points SYMBOL input code number of the symbol to be drawn at each point 1 2 a single dot diameter current line width 3 31 a regular polygon with ABS SY MBOL edges style set by current fill style 0 31 standard marker syrrbols 32 127 ASCII characters in current font e g to use letter F as a merker let SYMBOL ICHAR F gt 127 a Hershey symbol number Note the dimension of arrays X and Y must be greater than or equal to N If Nis 1 X and Y may be scalars constants or variables If N is less than 1 nothing is drawn PGPT 1 draw one graph marker void cpgpt1 float xpt float ypt int symbol SUBROUTINE PGPT1 XPT YPT SYMBOL REAL XPT YPT INT EGER SYMBOL Primitive routine to draw a single Graph Marker at a specified point T he marker is drawn using the current values of attributes color index line width and character hei ght character font applies if the syrrbol number is gt 31 If the point to be marked lies
362. rsor is extended over the width and height of the display T he anchor point is ignored Returns PGBAND Lif the call was successful O if the device has no cursor or sorre other error occurs Arguirents MODE input display node 0 1 7 see above POSN input if POSN 1 PGBAND attempts to place the cursor at point X Y if POSN 0 it leaves the cursor at its current position On sore devices this request may be ignored XREF input the world x coordinate of the anchor point YREF input the world y coordinate of the anchor point X in out the world x coordinate of the cursor Y in out the world y coordinate of the cursor CH output the character typed by the user if the device has no cursor or if sorre other error occurs the value CHAR 0 ASCII NUL character is returned Note T he cursor coordinates X Y may be changed by PGBAND even if the device has no cursor or if the user does not move the cursor Under these circumstances the position returned in X Y is that of the pixel nearest to the requested position PGBBUF begin batch of output buffer void cpgbbuf void SUBROUTINE PGBBUF Begin saving graphical output commands in an internal buffer the comrands are held until a matching PGEBUF call or until the buffer is emptied by PGUPDT T his can greatly improve the efficiency of PGPLOT PGBBUF increments an internal counter while PGE BUF decrements this counter and flushe
363. s pgpl ot src orfa f Bug fix Fixed bug in filling re entrant polygons thanks to Andrew Carnan grlin3 f Prevent a possible sqrt of negative number error gropen f Bug fix Avoid a zero length string problem Explicitly initialize variable to zero grpars f Bug fix No longer overwrites supplied string with logical name translation avoid a zero length string problem grpckgl inc Remove unused variable GRF ASL grsfs f File deleted grtext f Now sends text as a contrent to output when requested pgbeg f Initialize hatching attributes Explicitly initialize variable to zero pgbox f Aesthetic improverrent Move labels outwards slightly when inverted ticks are requested adjust position of MV y labels pgcl f Support routine for pgcon Bug fix T he contour labels were written at the wrong angle when x and y scales differed thanks to Gerry Haines for discovering this also labels could be drawn outside the window pgerrb f Enhancerrent Add options 5 and 6 for drawing symrretric two sided error bars pghtch f New file Routine for hatching shading polygon pgntxt f Bug fix T he routine could try to use a zero length character substring which is not allowed by the F ortran 77 standard popl ot i nc Add hatching attri butes popoly f Add support for hatching poqfs f Add file styles 3 and 4 hatching pgai nf f Change version to 5 0 2 Avoid sorre zero length string problems pgahs f New file Rou
364. s High Color 16 bit B Graphs appear but no labels Review step 3 above T he version of file GRF ONT DAT for your corrpiler must be in directory C PGPLOT C All of the deno prograns work except PGDE MO3 gives a Linker error T here is a bug in PGDE MO3 that is only picked up by these compilers About 27 lines fromthe end of PGDEMO3 F the statement CALL PGVST D 0 05 0 95 0 05 0 95 must be replaced with CALL PGVSTD D I can t read the hardcopy files created with GI Review step 5 above Sore applications narrel y Paint Shop P ro will read files written when the code is compiled without this option but most will not If you read the file in Paint Shop Pro and then save it other applications will be able to read it Using the C binding The PGPLOT C binding cpgplot allows the F ortran PGPLOT library to be called fromC prograr s using C calling conventions T he following instructions apply to e C programs compiled with MS Visual C V 4 0 e calling PGPLOT compiled with MS Powerstation F ortran V 4 0 e under MS Windows 95 or Windows NT Other compilers may use different calling conventions and will require a different version of the C binding To build the cpgplot binding library you will need the following files PGPLOT CPG PGBIND C PGPLOT SYS_WIN PGBIND MAK PGPLOT CPG PGBIND_PROTOTYPES T hese files can be located anywhere convenient To build the library froma console DOS window type NMAK
365. s Manual This manual is intended both as a tutorial introduction to PGPLOT and as a reference manual T he remainder of this chapter describes some fundamentals how to include the PGPL OT library in your program and the types of graphic devices that PGPLOT can use Chapter 2 is tutorial it presents a F ortran programfor drawing a graph using the minimum number of PGPLOT subroutines and explains what each of these subroutines does After reading this chapter you should be able to write your own PGPLOT program although it may be helpful to refer to the individual subroutine descriptions in Appendix A T he basic features of PGPLOT are introduced in Chapters 3 4 and 5 Chapter 3 explains the positioning and scaling of plots on the page Chapter 4 describes the basic primitive routines for drawing lines writing text drawing graph markers and shading areas and Chapter 5 describes the routines for changing the attributes of these primitives color line style line width text font etc Chapter 6 describes some high level routines that use the primitive routines to build up more complicated pictures e g function plots histograms bar charts and contour maps Chapter 7 describes PGPL OT s capabilities for interactive graphics whereby the user of the PGPLOT programcan control its action with a cursor joystick mouse etc T here are seven appendices Appendix A is alist of all the PGPLOT routines with detailed i
366. s SYS L OGIN Resource specification is discussed further in the Potential problems section further below T he following resource descriptions show how a resource line should be constructed in one s resource file Where default values are available they are indicated Otherwise the value is indicated symbolically and instructions are given for substituting appropriate values pgxwin Win geometry WIDT HxHEIGHT X Y T his specifies the size and position of a window in pixels Any of the above components can be omitted T he X and Y values specify the position of the top left corner of the window wrt the top left corner of the screen if positive or the bottom right corner wrt the bottomright corner if negative pgxwin Win iconGeorretry X Y T his specifies the position of the iconized formof a window in pixels The X and Y values specify the position of the top left corner of the window wrt the top left corner of the screen if positive or the bottomright corner wrt the bottomright corner if negative pgxwin Win acceptQuit F alse Most window managers provide a way for the user to destroy a window using the mouse often via an option in a pull down menu By default PGPLOT takes steps to ignore this action when a window is actually being used by aPGPLOT program To re enable it set pgxwin Win acceptQuit T rue pgxwin Win i conize F alse pgxwin pgxwin pgxwin By default PGPLOT XSERVE windows remain mapped whe
367. s into the IBM color indices with the default color most closely corresponds to the PGPLOT default color Thus PGPLOT index 2 red maps to IBM index 12 light red Input capability Author A F T ennant MS DOS machines running L ahey F 77 32 bit FORT RAN This PGPLOT driver is for IBM PC s and clones running MS DOS and Lahey F 77 32 bit F ortran v5 0 The driver will put the display into graphics mode and calls to close the workstation PGEND will set it back into the previous mode generally erasing the display so don t do it until you are really finished T his routine must be compiled and linked with the Lahey graphics library GRAP H3 supplied with Lahey Fortran v4 0 or greater Supported device IBM PC s and compatibles Device type code LH Default device name None the device nans if specified is ignored Default view surface dimensions Depends on rronitor typically 7x10 inches Resolution Depends on graphics card T ested with a 640x480 V GA card Driver should work with other graphics cards Color capability Color indices 0 15 are accepted The PGPLOT color indices are mapped into the IBM color indices for with the default color most closely corresponds to the PGPLOT default color Thus PGPLOT index 2 red maps to IBM index 12 light red Input capability Graphics cursor implemented using Microsoft Mouse or compati ble accessed through DOS Calls File format None T ektronix T erminals and Emula
368. s of bottomend of the error bars T input length of terminals to be drawn at the ends of the error bar as a multiple of the default length if T 0 0 no terminals will be drawn Note the dimension of arrays X Y 1 and Y 2 must be greater than or equal to N If N is 1 X Y 1 and Y 2 may be scalar variables or expressions eg CALL PGERRY 1 X Y SIGMA Y SIGMA PGET XT erase text fromgraphics display void cpgetxt void SUBROUTINE PGET XT Sone graphics terminals display text the normal interactive dialog on the sare screen as graphics T his routine erases the text fromthe view surface without affecting the graphics It does nothing on devices which do not display text on the graphics screen and on devices which do not have this capability Argurrents None PGF UNT function defined by X F T Y G T SUBROUTINE PGFUNT FX FY N TMIN TMAX PGFLAG REAL FX FY EXTERNAL FX FY INTEGERN REAL T MIN TMAX INT EGER PGFLAG Draw a curve defined by pararretric equations X F X T Y FY T Argurrents FX external real function supplied by the user evaluates X coordi nate FY external real function supplied by the user evaluates Y coordinate N input the nurrber of points required to define the curve T he functions FX and FY will each be called N times TMIN input the minimumvalue for the parameter T TMAX input the maxinmumvalue for the pararreter T PGFLAG input if PGFLAG
369. s refer to two directories the distribution source directory which will contain the PGPLOT source code directory tree and the binary directory in which the machine specific libraries data files and demonstration prograr s will be created It is recontrended that you create new empty directories for these They should not be the sane directory In the examples below these directories are named USR LOCAL PGPLOT distribution directory USR LOCAL PGBIN binary directory but you can use any convenient names Unusual system privileges are not required to install PGPLOT assuming you have write access to the directories In a mixed VAX Alpha cluster you can use a single distribution directory but you will need two binary directories one for each architecture T he distribution directory may be deleted after the installation has been competed but it will be needed if you later decide to select different device drivers 1 Copy the distribution file Copy the distribution file by anonymous ftp fromCaltech Use anonymous ftp user anonymous password your id usernare machine to node ftp astro caltech edu T he distribution file is a UNIX tar file compressed with Gzip Issue the following ftp commands to retrieve the file cd pub pgplot binary get pgpl ot5 2 tar gz pgplot tar gz Note that you need to provide a VMS corrpatible output file narre in the get command 2 Decompress the files You will need two prograrrs
370. s the buffer to the output device when the counter drops to zero PGBBUF and PGEBUF calls should always be paired Arguments none PGBEG open a graphics device int cpgbeg int unit const char file int nxsub int nysub INT EGER FUNCT ION PGBEG UNIT FILE NXSUB NY SUB INTEGER UNIT CHARACT ER FILE INTEGER NXSUB NYSUB Note new programs should use PGOPEN rather than PGBEG PGOPEN is retained for compatibility with existing programs Unlike PGOPEN PGBEG closes any graphics devices that are already open so it Cannot be used to open devices to be used in parallel PGBEG opens a graphical device or file and prepares it for subsequent plotting A device must be opened with PGBEG or PGOPEN before any other calls to PGPLOT subroutines for the device If any device is already open for PGPLOT output it is closed before the new device is opened Returns PGBEG a status return value A value of 1 indicates successful completion any other value indicates an error In the event of error a message is written on the standard error unit To test the return value call PGBEG as a function eg IER PGBEG note that PGBEG must be declared INT EGER inthe calling program Some F ortran compilers allow you to use CALL PGBEG and discard the return value but this is not standard F ortran Arguments UNIT input this argument is ignored by PGBEG use zero FILE input the device specification for the plot dev
371. ssachusetts 1985 2 Adobe Systems Inc PostScript L anguage T utorial and Cookbook Addison Wesley Reading Massachusetts 1985 3 Adobe Systems Inc PostScript L anguage Reference Manual Second Edition Addison Wesley Reading Massachusetts 1990 Author T J Pearson 1991 1995 X Window Durp X Window dump files can be displayed on X Window workstations using the xwud utility and converted to a printable formusing the xpr utility T hese utilities are available in most X Window installations T he X Window systemcan produce dunp files in a variety of forrrats PGPLOT uses an image format of ZPixmap with 8 bits per pixel Device type code WD landscape orientation V WD portrait orientation Default file name pgpl ot xwd An X Window dump file can contain only a single image so for multi page plots PGPL OT creates additional files If the supplied file name contains the character the file narre is derived by replacing this character with the current page number If the supplied file name does not contain a PGPLOT appends an underscore and the page nurrber for the second and subsequent pages e g PGBEG filename Filenames used pgpl ot xwd pgplotl xwd pgplot2 xwd pgplot3 xwd pgpl ot xwd pgplot xwd pgplot xwd_2 pgplot xwdc_ 3 Default view surface dimensions WD 850 by 680 pixels nominally 10 0 by 8 0 inches VWD 680 by 850 pixels nominally 8 0 by 10 0 inches T hese defaults can be
372. ssed to handler e RBUF 1 RBUF 4 should be interpreted as follows xd yd are device coordinates as used by the handler xw yw are user s world coordinates xw xd RBUF 1 RBUF 2 yw yd RBUF 3 RBUF 4 T he device handler may but is not required to display the current cursor location in world coordinates T he display can be continuous or only while the PGPLOT cursor is active during execution of opcode 17 Until opcode 27 is received the handler should assure that xw yw xd ya OPCODE 28 Draw marker This function is only used if OPCODE 4 indicates that the device handler can draw graph markers If it is to be used the device handler or hardware rust know how to draw each of the markers nurrbered 0 to 31 see F igure 4 1 Pararreters passed to handler e RBUF 1 the nurrber of the marker symbol to be drawn integer 0 31 e RBUF 2 RBUF 3 the x y coordinates of the center of the marker device coordinates e RBUF 4 scale factor number of device units per unit of marker coordinate space T he shapes of the marker symbols are defined in a coordinate systemin which the radius of typical symbols is 10 units or less for more information see the Hershey definitions of the markers Appendix B OPCODE 29 Query color representation T his function ay be called at any time after open workstation 9 and before close workstation 10 It will not be called if the handler does not repor
373. st to determine whether the driver reports a cursor rather than assuming that all interactive devices have cursors pgtbox f New option X to label the HH field modulo 24 Neil Killeen pgi mag f Minor changes to header coments pgswin f pgwnad f T hese routines now check whether a window of zero width or zero height has been requested in order to prevent a nasty divide by Zero error pg f many files Many of the top level PG routines have been modified to issue a warning message by calling PGNOT O if no device is open T his is in preparation for multiple open devices popl ot sys grfileio c Recognize file name as standard output pgplot sys_ dos msdri v f Revised device driver for PCs running DOS with Microsoft F ortran 5 0 fromHarry Lehto T his replaces medriv f msdriv koyarma and msdriv ehto pgplot sys_ linux aaaread me Add notes on use of Gnu g77 compiler Brian T oby g77_gcc conf New file Configuration file for Gnu g77 compiler Brian T oby pgplot sys_mac New directory Macintosh OS LS F ortran 2 1 See file aaaread me pgplot sys_msdos aaaread me Added information about a serious bug in the Microsoft P owerstation F ortran compiler fromC T Dum pgplot sys_ osf1 aaaread me Added notes about the 64 bit address problem some PGPLOT device drivers must be modified to be used with this operating system grgmremc This is a variant of pgplot sys grgmemc that returns the pointer as an INT EGER 8 64
374. stly in standard F ortran 77 with a few non standard system dependent subroutines PGPLOT subroutines can be called directly froma F ortran 77 or F ortran 90 program A C binding library cpgplot and header file cpgplot h are provided that allow PGPLOT to be called froma C or C program the binding library handles conversion between C and F ortran argument passing conventions PGPLOT has been tested with UNIX most varieties including Linux SunOS Solaris HPUX AIX Irix and MacOS X Darwin and OpenV MS operating systems amunable to provide support for DOS Microsoft Windows but do distribute code provided by users for use with these operating systen Examples Sore example graphs showing son of the capabilities of PGPLOT and source code in F ortran and C for a simple example can be found in the PGPLOT Portfolio Caution this page contains several large graphics files Copyright PGPLOT is not public domain software However it is freely available for non commercial use T he source code and documentation are copyrighted by California Institute of Technology and may not be redistributed or placed on public Web servers without permission T he software is provided as is with no warranty Status T he current version of PGPLOT is 5 2 2 e Changes in Version 5 0 0 Released 1994 12 30 e Changes in Version 5 0 1 Released 1995 02 16 e Changesin Version 5 0 2 Released 1995 06 14 e Changes in Version 5 0 3 Rel
375. t requested T he new window coordinate range and hence the exact amount of the shift can be determined by calling PGQWIN after this routine Pixels that are moved out of the viewport by this operation are lost completely they cannot be recovered by scrolling back Pixels that are scrolled into the viewport are filled with the background color color index 0 If the absol ute value of DX is bigger than the width of the window or the abosl ute value of DY is bigger than the height of the window the effect will be the sare as zeroing all the pixels in the viewport Not all devices have the capability to support this routine It is only available on sore interactive devices that have discrete pixels T o determine whether the current device has scroll capability call PGQINF Arguments DX input distance in world coordinates to shift the window horizontally positive shifts window to the right and scrolls to the left DY input distance in world coordinates to shift the window vertically positive shifts window up and scrolls down PGSCRN set color representation by nane void cpgscrn int ci const char narme int ier SUBROUTINE PGSCRN CI NAME IER INT EGER Cl CHARACT ER NAME INTEGERIER Set color representation i e define the color to be associated with a color index Ignored for devices which do not support variable color or intensity T his is an alternative to routine PGSCR T he
376. t changes to the representation of a given PGPLOT color index will change the colors of previously drawn graphics if a PseudoColor or GrayScale colormap is being used For other colormaps only subsequently drawn graphics will take on the new colors See the section on private colormaps for further information Input capability T he standard T k event binding mechanismcan be used to select for any combination of keyboard and button press events received by aPGPLOT T k widget T o facilitate combining this with PGPLOT PGPLOT T k widgets provide T cl conmmands for converting between widget X coordinates and PGPLOT world coordinates T hey also provide facilities for augmenting the X cursor with rubber band cursors T hese facilities are described later Cursor input can also be acquired via cpgband and cpgcurs but these functions are not recommended because they block the T k event loop Scroll capability T here are two types of scrolling available T k window scrolling T he widget window will be smaller than the PGPLOT view surface if cpgpage has not been called since the user resized the window to a smaller size cpgpap has been used to request a larger physical size than that of the widget In such cases a T k scrollbar could be used to scroll the visible area of the view surface F or this purpose the widget provides the conventional xview and yview commands and the xscrol command and yscrollconmand configuration opti
377. t driver Added support for scrolling improved cursor handling bug fixes xwdriv X Window driver Added support for scrolling bug fixes The PGPLOT cursor can now be moved horizontally and vertically with the keyboard arrow keys which can be more precise than using the mouse Each keystroke moves the cursor by one pixel or 10 pixels if the SHIFT key is depressed Deprecated drivers T he following drivers are probably no longer useful and their use is discouraged T hey have been noved frompgplot drivers to pgpl ot drivers old If you still need any of these drivers please contact T imPearson indriv vidriv Imagen printers irdriv Silicon Graphics workstations use the X window drivers instead svdriv Sun workstations running SunV iew use the X window drivers instead Changes to install ation procedures T he installation instructions have been rewritten T here are two changes you should be aware of 1 All the UNIX configuration files pgplot sys_ conf have been modified to add new pararreters that may be required for the new widget drivers If you have made modifications to configuration files and haven t sent them back to TimPearson you will need to change them again 2 If you need to modify a configuration file for your system it is now recommended that you make a new configuration file called local conf in the build directory by editing a confi guration file for a related system makerrake will now read this file if y
378. t focus when T ab or Shift T ab is pressed in a neighboring widget T he default is 0 which means that the widget will not receive the input focus unless it is explicitly set using the T k focus command If you intend to select for keyboard input in the widget as opposed to mouse button input then be sure to reconfigure this to 1 You should then also establish event bindings such that once the widget has the keyboard input focus T ab and Shift T ab will move the input focus in the conventional manner F or example pgplot plot takefocus 1 bind plot lt T ab gt focus tk_focusNext W bind plot lt Shift T ab gt focus tk_focusP rev W xscrollcommand prefix Whenever the visible part of the PGPLOT view surface underlying a PGPL OT widget is changed either by resizing the widget or by scrolling horizontally with the xview widget command the specified command prefix is augmented with two extra argurrents and evaluated T he two argurrents are floating point numbers which denote the left and right edges of the visible part of the view surface 0 refers to the leftmost edge of the view surface and 1 refers to the rightmost edge T his is designed for use with T k scrollbar widgets F or example given a horizontal scroll bar called hscroll anda PGPLOT widget called plot the following commands would connect the scrollbar and the PGPLOT widget plot configure xscrollcommand hscroll set Ascroll configure command plot xview
379. t itself as having this capability T he handler should attempt to return the actual color representation in use on the device if it is possible that this is different fromthe values requested Otherwise it should return the values requested in the last call with opcode 21 set color representation for this color index Re calling opcode 21 with the values returned by opcode 29 should not change the actual color representation If the handler does not have this capability PGQCR will return R G B 0 0 for color index 0 and R G B 1 0 for all other color indices Pararreters passed to handler e NBUF 1 e RBUF 1 color index to query integer passed as real in the device range reported by opcode 2 Pararreters returned by handler NBUF 4 RBUF 1 unchanged frominput RBUF 2 red component real 0 0 1 0 RBUF 3 green component real 0 0 1 0 RBUF 4 blue component real 0 0 1 0 OPCODE 30 Scroll rectangle T his function is not used if OPCODE 4 indicates that the device does not support scrolling If it is to be used then the device handler should be capable of scrolling a rectangular region of the display surface both horizontally and vertically by an integral number of device coordinates A horizontal scroll of positive dx device pixels is defined to mean that all but the rightmost dx pixels of the rectangle should be copied dx pixels to the right of their original positions The vacated dx pixels at th
380. t labels for the bottom left hand side and top of the viewport CALL PGLAB Epoch Flux Density J y V ariation of 3C345 at 10 7 GHz T he first two arguments provide explanations for the two axes the third provides a title for the whole plot Note that unlike all the other plotting routines the lines and characters drawn by PGBOX and PGLAB are not clipped at the boundaries of the window PGLAB actually calls a more general routine PGMT XT which can be used for plotting labels at any point relative to the viewport T he amount of space needed outside the viewport for annotation depends on the exact options specified in PGBOX usually four character heights will be sufficient and this is the amount allowed when the standard viewport created by PGV ST D is used T he character height can be changed by using routine PGSCH 3 6 Routine PGENV Having to specify calls to PGPAGE PGSVP PGSWIN and PGBOX is excessively cunbersome for drawing simple graphs Routine PGENV for PGplot ENVironment combines all four of these in one subroutine using the standard viewport and a limited set of the capabilities of PGBOX For example the graph described above could be initiated by the following call CALL PGENV 1975 0 1984 0 5 0 20 0 O 0 which is equivalent to the following series of calls CALL PGPAGE CALL PGVSTD CALL PGSWIN 1975 0 1984 0 5 0 20 0 CALL PGBOX BCNST 0 0 0 BCNST 0 0 0 PGENV uses the st
381. t use C in step 2 create a directory C PGPLOT and copy RGB T XT to it fromx PGPLOT You also need to compile and execute the programPGPACK fromsubdirectory x PGPL OT F ONT S to convert file GRFONT T XT to binary fileGRFONT DAT Torun PGPACK in the Windows environment put this statement before the REA Ds OPEN 5 FILE x pgplot fonts grfont txt Likewise the OPEN staterrent for the output can be modified OPEN 2 FILE c pgplot grfont dat T he output file is different for Microsoft and Digital Corpag T he directory with these two files can be elsewhere if identified by environment variable PGPLOT _DIR or the full path filenames can be given in environment variables PGPLOT_RGB and PGPLOT_FONT 4 Inthe Developer Studio in the F ile New menu Create a new Project Workspace of T ype Static Library Name PGPLOT Location X MSDEV PRO ECT S ver 4 or x ProgramF iles DevStudio MyP rojects ver 5 or x ProgramF iles Microsoft Visual Studio MyProjects ver 6 Use the Insert F iles into Project ver 4 or Project Add to Project F iles vers 5 6 and the search box to associate the foll owing files with the project X PGPL OT SRC F X PGPLOT SYS_WIN F x PGPLOT DRIVERS L XDRIV F NUDRIV F PSDRIV F T he dependent INC files will be included autorretically 5 Build the project F or Digital Cormpag the following compiler option is required for GI DRIV F because Digital changed the default for length
382. tar gz 2 Uncompress the file gunzip and extract the files fromthe tar archive tar cv Versions of gunzip and tar for Windows are available on the Web One programthat will handle both steps is WinZip It is available fromhttp www winzip comand many other web sites T he files in the tar archive are organized in a hierarchical directory structure with the top level directory called PGPLOT You will need the files fromthe following directories X PGPLOT CPG DRIVERS EXAMPLES FONTS PGMF SRC SYS_WIN T he other SY S_ directories can be ignored 3 T hen follow the installation instructions in PGPLOT SYS_WIN AAAREAD ME PGPLOT 5 2 0 for Windows95 98 NT and Microsoft Digital Compaq F ortran P A Seeger August 27 1998 docurrent revised J uly 15 2000 emil PASeeger aol com Based on C T Dum May 1995 T he following notes describe the porting of TimPearson s PGPLOT 5 2 0 to Microsoft Windows95 98 or WindowsNT using Microsoft Developer Studio and the corresponding F ortran compiler T he 32 bit Windows systems are easy to use but most importantly remove the severe memory restrictions of DOS T hesize of applications which can be linked with PGPLOT LIB is limited only by total physical and virtual memory T he graphics libraries MSFLIB Microsoft or DF LIB Digital Compaq also include many additional system functions known fromC Even for an old fashioned command line Fortran prograrrer like PAS
383. tching style if appropriate and color index If you want to both shade between contours and draw the contour lines call this routine first once for each pair of levels and then CALL PGCONT or PGCONS to draw the contour lines on top of the Shading Note 1 T his routine is not very efficient it generates a polygon fill command for each cell of the mesh that intersects the desired area rather than consolidating adjacent cells into a single polygon Note 2 If both contours intersect all four edges of a particular mesh cell the program behaves badly and may consider sorre parts of the cell to lie in more than one contour range Note 3 If a contour crosses all four edges of a cell this routine may not generate the sare contours as PGCONT or PGCONS these two routines may not agree either Such cases are always ambiguous and the routines use different approaches to resol ving the ambiguity Argurrents A input data array IDIM input first dimension of A J DIM input second dimension of A 11 12 input range of first index to be contoured inclusive J 1 2 input range of second index to be contoured inclusive C1 C2 input contour levels note that C1 must be less than C2 TR input array defining a transformation between the grid of the array and the world coordinates T he world coordinates of the array point A I J are given by X T R 1 T R 2 I T R 3 J Y TR 4 T R S Fl T R 6 FJ
384. ted the rubber band is redrawn every time that the PGPLOT buffer is flushed T his happens after every call to PGPLOT functions unless sensible use is made of cpgbuf and cpgebuf to buffer sequential calls Be sure to use these functions properly if you don t want your PGPLOT code to be slow clrcursor This is used to remove any cursor augmentation that was previously established with the setcursor command world T his returns the floating point PGPLOT world coordinates that correspond to specified integer X window coordinates such as those reported in the x and y fields of T k event bindings It can take any of the following forms world x xoffset T his returns the X axis PGPLOT world coordinate that corresponds to an offset of xoffset pixels in fromthe left edge of the PGPLOT window world y yoffset This returns the Y axis PGPLOT world coordinate that corresponds to an offset of yoffset pixels in fromthe top edge of the PGPLOT window world xy xoffset yoffset This returns the PGPLOT X and Y axis world coordinate pair that corresponds to an offset of xoffset pixels in fromthe left edge of the PGPLOT window and an offset of yoffset pixels in fromthe top edge of the PGPLOT window Note that if the widget is not open to PGPL OT 0 0 will be returned for all pixel coordinates pixel T his returns the integer X window coordinates that correspond to specified floating point PGPLOT world coordinates It can take any of the foll
385. tem including read only network mounted disks 3 Create a writable directory in which the PGPLOT library and associated files will be created One such directory is needed for each different operating systemand compiler combination target systent that you wish to support T his should not be the same directory as the directory containing the source code 4 Configure PGPLOT by selecting device drivers fromthe available list 5 Execute the supplied scripts and makefiles to create the library and demonstration prograr s 6 Install the optional C binding for PGPLOT which provides a convenient way to call PGPLOT subroutines froma programwritten in C or C T his requires an ANSI C compiler that understands function prototypes and is not available on all systems 7 Run the demonstration programs on your selected devices and verify that they run satisfactorily 8 Install the optional documentation files Y ou will need the following software which is not distributed with PGPLOT e A Fortran 77 compiler for your computer system Consult your operating system vendor to see what F ortran 77 compilers are available for your system A useful index of F ortran compilers can be found at T he Fortran Market web site http www fortran con fortran compilers htm T he following are widely used o GNU Fortran compiler g77 ftp prep ai mit edu pub gnu g77 o f2c Fortran 77 to C translator ftp ftp netlib org f2c prefer g77 wh
386. temis not one of the supported systerrs listed above create your own configuration file in the target directory with narre local conf It is best to copy one of the configuration files provided frompgplot sys_ conf and then edit it following the comments in the file T he makerrake procedure will use local conf if it exists in the current directory and if you do not specify Arg 3 Note that you must still specify Arg 2 operating system F or more information about configuration files see Porting PGPL OT or consult tjp _astro caltech edu Use make to compile the code Now use the UNIX make command to compile the PGPL OT library following the instructions in makefile make By default make will generate an obj ect module library libpgplot a a shareable library if possible on the selected operating system the binary PGPLOT font file grfont dat the derronstration programs pgdero and a docurrentation file pgplot doc In addition if the XWINDOW and or XKSERVE driver was selected in step 4 it will generate a program pgxwin_ server and if the XDISP driver was selected it will generate a program pgdisp If this step proceeds satisfactorily you may want to type make clean to remove unneeded intermediate files Y ou will then have the following files in the current directory drivers list grexec f grfont dat binary font file libpgplot a PGPLOT library libpgpl ot so shared library optional ma
387. ter e PGPAGE no longer beeps when prompting for next page Bugs fixed e PGNUMB the FORM argument was ignored but is now used as docurrented e PGPAP PGPAPER was boken in 4 9H it now works as documented and can be used to change size between pages e PGQCR now works as advertised on most devices e Calling PGSCR before starting a new page or defining PGPLOT _BACKGROUND or PGPLOT_ FOREGROUND no longer creates a blank page in the graphics file e Filled polygons are now correctly clipped against the window on all devices formerly they were not clipped on PostScript and X Window devices e heunit of line width in PGSLW is now 0 005 inch on all devices e Soretimes nerkers centered exactly on the edge of the window were not drawn when they should have been TimPearson California Institute of Technology tjp stro caltech edu Copyright 1995 California Institute of Technology PGPLOT changes in Version 5 0 1 T his version corrects several minor bugs corrects a serious error in PGGRAY adds functionality to the X window driver adds a new driver for X window dunp files pgpl ot aaaread me Split into files aaaread me install txt whatsnew txt changes txt drivers list Add warning that use of GIDRIV ney require a license Add WD and V WD X window dump files Add contrents to discourage people fromtrying to use PC drivers on UNIX systems Revise VERS and VVERS makehtm New perl script now generates syntacti
388. ter Encoding in font nurrber 2 PGPLOT Choracter Encoding 1x17 sot fo 1 ee T wws T wem a fT wel o oo a PGPLOT T imPearson California Institute of Technology tjo stro caltech edu Copyright 1996 California Institute of Technology Figure B 1 PGPLOT Symbols RPE th ogg o200 2il O202 o205 o204 o205 1 F 4 i ana o270 o216 fa fo m oa7e oa7a foes joes joere oga loaves ji wee t par owed osal oboe jossz Joses osas osos Ill A B C D E F oss Jomo osai ob12 Joma jop14 lomis os4s J K L hl M D F osa foe osez ope osas osas osze T E y W b 1 Fd F J ho 3 vas es Cc an Gi ogia opta joszo osat oaz obese fopem osses osa7 R 5 T UJ W x Y Fd A PGPLOT TimPearson California Institute of Technology t p stro caltech edu Copyright 1995 California Institute of Technology Figure B 2 PGPLOT Symbols cr Cc E aS c D T G m G E 5 Bo Ti in T D T A BE7 x 057E Obs 574 OG Es r ee E ee mi Te pot OE O55 E oed4 O60 0606 oes DEJA gl f h 613 o614 0615 0616 a 0613 O61 n O D q r 62 o624 O625 DE W 3 B43 GA ST x y z a A E beH T 0654 0657 a f g DBJ O6b4 O665 O666 DEF DE oes o6y4 DrK G oes DAJ osa7 ogsaa oses jowo oz 0702 1 2 omy foros Joza
389. the PGPLOT window title bar e VT driv Dec REGIS driver T his driver has problers on VMS T hereis a special VMS variant of this driver in the PGPLOT DRIVERS directory Rename file VT DRIV VMS F to VT DRIV F replacing the file of that name which is designed for UNIX and recompile the library T his driver will accept a device specification of the form VT to display on the terminal or file VT to create a disk file that you can display with T YPE T he driver still has some problems however 1 it is limited to 4 colors even if your REGIS device can display more 2 think the cursor doesn t work on most REGIS devices although believe it works on a real VT 125 terminal a rare beast indeed 3 if you direct output to a file the driver still thinks the output is an interacrtive device and issues a prompt for each new page do not plan to fix any of these problems as REGIS is now an obsolete graphics language e ektronix drivers TT driv T Fdriv and disk files If you want your graphics to display in an XT ERM window you should use a device specification XT ERM or possibly terminal XT ERM if you have acces to a terminal other than the one you are running the programin Device type T EK designed for a real T ektronix terminal does not generate the code required to switch an XT ERM into T ektronix mode Y ou canuse T EK with an XT ERM if you first switch the terminal into T ektronix mode by hand usin
390. the size of the view surface it may ignore these argurrents On interactive devices erase the screen Note this command has no way to return an error to the user if an error occurs e g insufficient memory for a frarre buffer the handler should issue an error message with routine GRWARN and ignore subsequent output conmands rather than terminating execution of the program Pararreters passed to handler e RBUF 1 maximumx coordinate e RBUF 2 maximumy coordinate OPCODE 12 Draw line Draw a straight line fromdevice coordinates x1 y1 to x2 y2 using the current line attributes color index line style and line width T he coordinates are floating point and may need to be rounded to the nearest integer before they are passed to the hardware they are in the range 0 0 to the maxima specified with begin picture Pararreters passed to handler e o o o JJ W Cc nm OPCODE 13 Draw dot Draw a dot at device coordinates x y using the current line attributes color index and line width T he result should be an approximation to a filled circle of diarreter equal to the line width or a dot of minimumsize if line width is 0 T he coordinates are floating point and may need to be rounded to the nearest integer before they are passed to the hardware Pararreters passed to handler e RBUF 1 x e RBUF 2 y OPCODE 14 End picture T ermi nate the current frame On hardcopy devices always advance the paper
391. the the user will refer to the device type e g PS for a PostScript device handler T his nane must be different for each mode of each device handler installed in PGPLOT and should preferably be unique in the first two or three characters A descriptive character string displayed by routine PGL DEV should be included in parentheses after the narre e g PS PostScript file landscape orientation Pararreters returned by handler e CHR L CHR the device type supported by the handler in the specified mode OPCODE 2 Return maxi mumdimensions of view surface and range of color index This is an inquiry function the handler returns the maxi mumdimensions of the plot surface and the range of color indices available T hese will usually be the sare as the default dimensions but if it is possible to make a larger image the maxi mumdimensions may be larger If there is no set upper limit to a dimension the corresponding maxi mumshould be set to 1 All dimensions are in device coordinates All devices should support color indices 0 and 1 color and gray scale devices will allow color indices gt 1 up to a device dependent maxi mumvalue which should not exceed 255 Color index 0 is the background color and is used to erase if it is not possible to erase by overwriting in the background color then requests to write in color index 0 should be ignored Pararreters returned by handler RBUF RBUF 1 Minimumphysical x value set t
392. tine to inquire hatching style pgrect f Add support for hatching pgsave f Save hatching style pgsfs f Add file styles 3 and 4 hatching pgshs f New file Routine to set hatching style pgsubp f Bug fix Rescale viewport when panel size changes pgplot sys_ dos f Split grdos for into separate files for easier nai ntenance pgplot sys_ freebsd aaaread me f77_cc conf iand c New directory Support for F reeBSD operating system J ean M arc Zucconi pgplot sys hp aaaread me New file Add notes about optimization fort77_gcc conf New file Configuration file for use with gcc compiler not tested pgplot sys_msdos aaaread me etc New directory Support files for MS Power Station 32 bit Fortran fromC T Dum poplot sys_osf1 aaaread me Modified Add note about shareable library f77_cc_shared conf New file F or making a shareable library pgplot sys_salford aaaread ie f New directory New system specific files for MS DOS with Salford Software F ortran fromMichael Michelson pgplot sys_sun4 conf Change pic to PIC a large global offset table is needed if many drivers are selected pgplot sys_ultrix f77_cc conf Add X11 in LIBS and Olimit 600 for optimizing complex routines in CFLAGC J aiyong L ee pgplot sys_vins build com Add PGSHS PGQHS to transfer vector Do not attempt to link with UIS onan AXP machine TimPearson California Institute of T echnology tjo stro caltech edu Co
393. tions in pgplot No you should not be concerned T he only routinein PGPLOT that does anything with dates is PGQINF which can return the current date obtained fromthe operating system to the caller It uses a 4 digit year T here should be no Y 2K problemunless the underlying operating systemhas a problem No Y 2K problens with PGPLOT have been reported My compiler complains about use of V AL in some drivers My Fortran 77 compiler doesn t understand the syntax VAL that is used in sore of the PGPL OT device drivers What should I do Unfortunately sorre of the PGPLOT device drivers require dynarically allocated memory and cannot be written using standard F ortran 77 in these cases the drivers are written either in C or in non standard F ortran If your compiler does not understand the Yaval extension used for passing an argurrent by value instead of address and used in PGPLOT to pass a dynamically allocated array to a subroutine you will be unable to use these drivers unless you rewrite them T here are standard mechanisms in both C and F ortran 90 for handling dynarically allocated menory and may ina future version replace these drivers with C or F ortran 90 versions Can PGPLOT be used ina Web based CGI application Yes Several people have used PGPLOT ina Web CGI application to generate plots in GIF format on the fly In most UNIX systems the CGI script is required to send the plot to standard output in PGPLOT use a device
394. tness at 20 GHz T he histogramdoes not depend on the order of the values within the array Functions of two variables A function of two variables f x y really needs a three dimensional display PGPLOT does not have any three dimensional display capability but it provides three methods for two dimensional display of three dirmensional data Contour maps In acontour map of f x y the world coordinates are x and y and the contours are lines of constant f T he PGPLOT contouring routines PGCONT and PGCONS require the input data to be stored in atwo dimensional Fortran array F with element F I J containing the value of the function f x y for a point x y Furthermore the function must be sampled on a regular grid the x y coordinates corresponding to I J must be related to andj by xX atbl c y d el f T he constants a b c d e f are supplied to PGCONT in a six element F ortran array T he other input required is an array containing the contour values i e the constant values of f corresponding to each contour to be drawn In the following example we assure that values have been assigned to the elerrents of array F We first find the nexinumand nininumvalues of F and choose 10 contour levels evenly spaced between the maxi mumand mini munt REAL F 50 50 ALEV 10 T R 6 FMIN F 1 1 FMAX F 1 1 DO 3001 1 50 DO 200J 1 50 FMIN MIN F lJ F MIN FMAX MAX F I J F MAX 200 CONTINUE
395. to decompress and extract the contents of the distribution file gunzip and vmstar T hese progrars are not part of VMS but are widely available on the Internet e g at http www openvirs di gital conyopenvirs freeware cd htm Use gunzip to decompress the distribution file e g gunzip pgplot tar gz T hen use vstar to extract the contents of the archive set default USR L OCAL vimstar extract verbose popl ot tar OR vmstar xvf pgplot tar delete pgplot tar This will create a subdirectory P GPL OT and lower level subdirectories in the current directory e g USR L OCAL PGPLOT Make sure that your current directory is where you want to create the PGPLOT distribution directory tree 3 Create the binary directory Create a writable directory in which the PGPLOT library and associated files will be created One such directory is needed for each different binary system e g you may want separate directories for VAX and Alpha create directory USR LOCAL PGBIN set default USR L OCAL PGBIN Do not try to create the PGPLOT library in the source distribution directory 4 Select device drivers Configure PGPLOT by selecting device drivers fromthe available list First copy the file drivers list fromthe distribution directory to the binary directory and then use a text editor to select device drivers T his file contains one line for each available device driver delete the exclamati
396. to open the specified XnP gplot widget to PGPLOT An exarple of how this can be used with cpgopen is shown later T he returned string is part of the specified widget and must be treated as read only by the caller T he formof the returned string is widget_name XMOT IF where widget_nameis the name that was given to the widget when it was created If the specified widget is not aPGPLOT widget then an error message will be emitted and the returned device name will be null int xmp_device_id Widget widget When aPGPLOT device is opened with the cpgopen function PGPLOT returns an integral identifier T his may then be used via the cpgslct function to select which of the open PGPLOT devices is to be the current graphics device T he xmp_device_id convenience function returns the PGPL OT identifier associated with the given XnP gplot widget T his can be useful in callbacks where the Widget argument passed to the callback function can then be used to select the widget as the current PGPLOT device If the Widget argument passed to the xmp_device_id function either hasn t been opened to PGPLOT or hasn t been re opened after being closed then xmp_device_id emits an error message and returns 0 Inherited widget resources XnP gplot widgets inherit all of the X resources of the Core and Primitive Motif widget classes Note that the XmNbackground and XnNforeground resources change the color representations of pgplot color indexes 0
397. to regenerate the picture on another device e g PostScript copy of the current X window display Eileen Berman has implemented something along these lines by calling the metafile driver in parallel with the active device driver but this has sore problems that need to be sorted out before it can be generally implemented Improved cursor input Extension of PGCURS PGBAND to return more information about the key stroke e g whether it came fromthe keyboard or the mouse and the state of modifier keys shift control etc for devices for which this is possible New routine to return cursor position intrediately without waiting for a keystroke or other event Support for PostScript or other native fonts Allow use of arbitrary PostScript fonts on PostScript devices and possibly X window fonts on X window devices One or more mono spaced fonts Useful for lining things up in colurms Implementation of tab stops in text might help here too Eight Bit Character Set At present the PGPLOT routines for displaying text only handle the 7 bit US ASCII character set decimal codes 32 126 some other characters can be obtained with escape sequences propose to implement all the printable characters of the 8 bit ISO 8859 1 Latin 1 character set and possibly provide a way to specify a different character set will also add the gothic Hershey fonts for those who find themappealing Some people have requested ways to define their own fonts or ad
398. tors Supported device 1 U B amp W 9 T ektronix 4006 4010 storage tube terminal can be used with emulators but the options bel ow take advantage of features not present in the basic T ektronix terminal GraphOn Corporation 200 series terminals T hese emulate a T ektronix 4010 with enhancerrents selective erase rectangle fill switch between T ek and VT 100 modes Digital Engineering Inc Retrographics modified VT 100 terminal VT 640 IRAF GT ERM T ektronix terminal emulator with color extensions Xtermwindow on an X window server E mulates a T ektronix 4014 with extensions switch between T ek and VT 100 windows ZST EM 240 and ZST EM 4014 terninal emulators for the IBM PC and clones ZST EM supports T ektronix 4014 emulation and the 4105 color escape sequences ZST EM can be obtained from KEA Systers Ltd 2150 West Broadway Suite 412 Vancouver British Columbia Canada V 6K 4L 9 Visual 603 and 630 terminals T hese are VT 100 220 compatible terminals with T ektronix 4010 4014 emulation Visual T echnology Incorporated 1703 Middlesex Street Lowell Mass 01851 T he Visual 630 has the capability of displaying dual text and graphics T his feature is not used in this driver Graphics mode is entered autorraticall y when the graph is drawn but only exited when PGPAGE or PGEND is called Therefore for multiple plots interspersed with text I O use PGPAGE at the end of each plot T his will prom
399. ts up to 144 feet are possible Resolution T his version is written for the case where the resolution switch is set to 0 025 nm Actual resolution depends on thickness of pen tip Color capability Color indices 1 to 8 are supported corresponding to pens 1 8 It is not possible to erase lines Input capability None File format Variable length records Obtaining hardcopy On Starlink print the file on the queue associated with the Zeta plotter If the Plotter is attached to a terminal line then T Y PEing the file at the terminal will produce a plot On Starlink PRINT NOF EED QUE ZET A PGPLOT ZET T o stop a Zeta plot job once it has been started use the buttons on the plotter Press PAUSE NEXT PLOT and CLEAR Only after this sequence is it safe to delete the job fromthe ZET A Queue F ailing to press the NEXT PLOT button will not correctly advance the paper F ailing to press CLEAR but deleteing the current job can prevent the following plot frombeing plotted Author Allyn F Tennant 1986 Null Device no graphical output T he null device can be used to suppress all graphic output froma program Device type code NULL Default device name None the device nans if specified is ignored Default view surface dimensions Undefined the device pretends to be a hardcopy device with 1000 pixels inch and a view surface 8in high by 10 5in wide Resolution Undefined Color capability Color indices 0 255 are accepted In
400. u want to use asa PGPLOT escape character you must do either one or other of the following but not both 1 2 Double all backslashes in literal strings in your code e g change ge ur d to ge ur d the compiler will translate to Enable the compiler option that suppresses this behavior Most UNIX compilers have such an option but it isn t always well documented Sorre possibilities for various compilers are assurre backslash backslash qnoescape xl Solaris f77 bs f2c fno backsl ash 977 If you can t find the option or can t neke it work consult your compiler supplier 3 An ingenious way to write a programthat will work with most compilers is the following define CHARACT ER BACKSL PARAMETER BACKSL and then use concatenation e g call pglab h D BACKSL ge BACKSL ur BACKSL d T E BACKSL u011 BACKSL d T his rapidly leads to unreadable code Color Map Problems X Window amseeing an unusual situation when running PGPL OT using the X Window device when a previous executable is using up a lot of the available colors amrunning Netscape and PGPL OT on an ncd 19c color when Netscape starts first it grabs alot of the colors so when i do a pgbegin fromry application or run one of the supplied pgderrn prograrrs the entire terminal screen is blacked out and then the PGPL OT window appears in fact when i do a pgbegin fromny applic
401. ufactured by Hewlett Packard Co and sorre other manufacturers This PGPLOT device handler produces files that should be acceptable to most HPGL and HPGL 2 devices specifically the HP 7475A Plotter Device type code HPGL landscape orientation V HPGL portrait orientation Default file name pgpl ot hpgl Default view surface dimensions HPGL 16640 by 11040 pixels 16 38 by 10 87 inches VHPGL 110400 by 16640 pixels nominally 10 87 by 16 38 inches T hese dimensions are chosen for 17 by 11 inch paper Resolution T he nominal resolution is 1016 pixels inch but the actual resolution will vary depending on the display device Color capability Color indices 1 6 are accepted and are interpreted as pen numbers Input capability None Environment variables If environment variable PGPLOT _GL_TERMINAL has value YES or any string beginning with Y or y it is assumed that the output device is a plotter connected before the terminal using the Y cable HP part 17455A in which case the plotter is turned on and xon xoff handshaking is enabled using escape sequences Otherwise it is the user s responsibility to add control codes if needed If there is more than one plot and the plot is ona terminal a prompt will be generated allowing the page to be advanced File format HPGL files are plain text Author B H Toby T J Pearson 1988 1994 PPM Portable Pixel Map The PPM raster fornet was defined by J ef Poskanzer whos
402. ugh the pointer XMP_CROSS_ CURSOR A cross hair cursor centered on the pointer float xref yref T he cursor reference position in the current world coordinate system If the world coordinate systemis subsequently changed the reference position will not be recomputed XtCallbackP roc callback T he cursor input callback function or 0 if not required T his is used just like any other Xt callback function except that its call_ data argument is a pointer to a struct of the following declaration cast to XtPointer typedef struct float x y The world coordinate position of the cursor char key The key pressed by the user Mouse buttons are encode as A D X left to right XmpCursorCal backStruct T he callback function will be called whenever a key if the widget has keyboard input focus or pointer button is pressed while the pointer is in the associated PGPLOT widget void client_data Client context data T his pointer will be passed verbatimto the callback function whenever a cursor input event is reported T he return value of xmp_arm_cursor is Oif successful or 1 if the specified widget is not an open PGPLOT widget or the callback argument is NULL int xmp_disarm_cursor widget T his function can be called to undo the effect of a previous call to xmp_arm_cursor for the specified widget Note that this function can be called even when the cursor has not been previously armed or when the widget is not
403. ult view surface dimensions Depends on rronitor nominally 8in horizontal by 6in vertical Resolution A standard T ektronix terminal displays a screen of 1024 pixels horizontal by 780 pixels vertical with a norinal resolution of 130 pixels per inch T he actual resolution may be less Color capability o TEK4010 XT ERM none only color index 1 is available selective erase is not possible Requests to draw in color index 0 are ignored o GF RET RO V 603 color indices 0 erase black and 1 bright usually white green or arrber are supported It is not possible to change color representation o GT ERM color indices 0 to 15 are available and default to the standard PGPL OT colors T he color representation can be changed o ZST EM color indices Oto 7 are available and default to the indicated in the ZST EM setup menu which default to the standard PGPLOT colors T he color representation cannot be changed o KRM3 color indices 0 to 7 are the standard PGPLOT colors Indices 8to 14 are also available but are BRIGHT versions of 1 to 7 and thus non standard Color representation can t be changed o TK4100 color indices 0 15 Input capability Depending on the emulation the graphics cursor may be a pointer a snell cross or a crosshair across the entire screen T he user positions the cursor using thumbwheels mouse trackball or the arrow keys on the keyboard T he user indicates that the cursor has been positioned
404. used to label the PGPLOT window Default view surface dimensions Depends on monitor PGPLOT uses a window which is nominally 11 inches wide by 8 5 inches tall i e the sare size as you would get in a hardcopy If you prefer a vertical orientation execute the following command before running the program DEFINE PGPLOT_WS_ ASPECT PORTRAIT Substitute LANDSCAPE for PORT RAIT to revert to horizontal orientation Resolution Depends on monitor Color capability VAX workstations can have 1 4 or 8 bitplanes On 1 plane devices there are only two colors background white color index 1 black On 4 plane devices color indices 0 11 are available 4 indices are reserved for text windows and pointers On 8 plane systems color indices 0 249 are available 6 indices are reserved for text windows and pointers Input capability T he cursor is controlled by the mouse or the keypad available on the controlling DE C like keyboard T he user positions the cursor and then types any key on the controlling keyboard T he mouse buttons are ignored at present Author S C Allendorf 1990 NeXT Workstations Supported device Any computer running NeXT step Device type code next Default device name none Default view surface dimensions T he default screen size is 720 by 535 pixels about 8 by 6 inches on a 19 inch monitor T he aspect ratio was selected to match the PS device T he window can be resized larger or srreller Resolution T he
405. using cc instead cc 0 cpgdern cpgdern o L pwd Icpgplot I pgplot 1X11_s Iftn Im e VMS sys_ vrs o Installation procedure should compile only required drivers o Installation procedure assures that a C compiler CC is available It should be modified to skip the C compilations when this is not true Device drivers e Gldriv GIF driver o GIF uses the LZW compression systemwhich is patented by Unisys a license may be required to use this driver o Uses space inefficient algorithm o It might be nicer to insert page nurber before the gif extension instead of after but what if there is no extension e HPGL drivers o In son porgrans the HPGL plot will be filled with many horizontal lines think this is caused by using PGERAS which is trying to fill the page with black when it should be filling in the background color As the HPGL has no erase capability the PGERAS call should really be ignored Unfortunately have no easy way to test the HPGL driver if someone would like to work with mre on this problem or can point me to a viewer for HPGL files for UNIX machines please contact me e HJ driv LJ driv Hewlett Packard PCL o have no way to test these drivers and amnot at all sure that they work on any systens except VMS don t know whether to recommend one or the other would appreciate feedback e GOdriv VBdriv ZEdriv o These drivers require a routine grge00 that is not available on UNIX systems T
406. ut files T X e Lal eX picture environrrent LAT EX Special Applications The following device drivers can be used to create PGPL OT graphics within an application that uses either the X window Motif graphical user interface or a T cl T k user interface T hey cannot be used in other applications e Motif widget for X window system XMOT IF e Tcl Tk widget for X window system XT K Next Appendix E PGPLOT TimPearson California Institute of T echnoloogy t p stro caltech edu Copyright 1995 1997 California Institute of T echnology Appendix E Writing a Device Handler E 1 Introduction PGPLOT can be configured for a particular installation by adding or removing device handlers A device handler is a subroutine which handles all the device specific aspects of graphical output for a particular device or class of devices To write a new device handler it is simplest to start by modifying an existing one T his Appendix explains what the device handler must do but it does not explain how to do it which is of course very hardware dependent E 2 T he device dispatch routine GRE XEC All graphical output and input is handled by a device dispatch routine in PGPLOT called GREXEC Routine GRE XEC is called whenever PGPLOT needs to determine device specific information or performgraphical I O T his routine in turn calls on the appropriate device handler Reconfiguring PGPLOT involves modifying the GRE XEC rout
407. ve died down a bit but believe that Unisys still requires a license certainly for comercial use See for example http www unisys con L eadStory Izwfag htm You can find much more about this by searching for say unisys gif and Ccompuserve At least one new graphics fornet to replace GIF is under development P NG Portable Network Graphics but don t intend to add this to PGPLOT until it is clear that it is going to be widely adopted See e g http www wco cony png http www group42 com png htm Solaris can t find libpgplot so When I run pgderno for example pgdernnl1 get the error message Id so 1 pgdervl fatal libogplot so can t open file errno 2 Killed What could be the reason libpgplot a is seen by the program Thisisa feature of shared libraries under Solaris 2 x Under Solaris as with most UNIX systems you link a programwith PGPLOT with a command like the following f77 o example example L usr local pgpl ot pgpl ot The L option tells the linker where to look for the library Unfortunately this information is not recorded in the executable file and the run time shared library loader thus doesn t know where to find the PGPLOT library T here are a number of solutions to this problem 1 Link the programstatically 77 o exarrple example L usr local pgplot Bstatic lpgplot Bdynamic 1X11 T his will result in a big executable and you also have to specify the L X11 opt
408. ve perl installed on your system you can access the file at URL http www astro caltech edu j p pgpl ot subroutines htm Y ou may need to edit the first line of file pgpl ot makehtm to include the correct commands for invoking perl on your system A docurrentation file in LaT eX format Appendix A of the manual can be created by typing make pgpl ot routines tex This file is also created by executing a perl programto extract the docurrentation fromthe source code Y ou may need to edit the first line of file pgplot maketex to include the correct commands for invoking perl on your system T o print this file you will need to run LaT eX to create a dvi file and a dvi interpreter to print it e g on Unix systems latex pgpl ot routines dvi ps popl ot routines o Install the library of obsolete routines optional T he library libpgobs a includes sorre obsolete PGPLOT routines If you have old programs that use these routines you can install the library by make li bpgobs a However these routines will not be included in future versions of PGPLOT so you should rewrite your progrars to avoid their use PGPLOT TimPearson California Institute of Technology tip astro caltech edu Copyright 1995 1999 California Institute of Technology PGPLOT Installation Instructions LINUX systems Version 5 2 0 For LINUX systems recommend installing fromthe source code following the standard UNIX instructions T his will ensure th
409. ver for HPGL 2 graphics fromColin Lonsdale lj driv f Bug fix Add a SAVE statement for non static compilers Ixdriv f New file Driver for LaT eX picture environment fromGrant Mcintosh pgxwin_server c Add omitted include X11 Xos h psdriv f New feature If the supplied file name is the driver send the PostScript output to standard output Note this will only work when F ortran unit 6 is connected to standard output A correct PageBoundingBox conirent is now included for each page Plotted text can be included in the PostScript file as comrents if environment variable PGPLOT PS VERBOSE_T EXT is set tfdriv f Improved optimization David R Chang Note that this driver is for VMS systens where the regular T ektronix driver ttdriv f can send output to a terminal but cannot create a disk file xwdri v C Change polygon fill rule from WindingRule to EvenOddRule to match other drivers Suppress message about starting server when it starts successfully Update contrents pgpl ot exarmpl es pgderol f Revise example 6 to show all four fill area styles and example 7 to use the new options in PGERRB pgdenv2 f Revise to exercise hatching styles pgden3 f Change internal subroutine name PL OT to avoid possible conflicts with other libraries pgdenw12 f Call PGBEG as a function rather than a subroutine pgpl ot pgdi sp initlgwin c Change polygon fill rule from WindingRule to EvenOddRule to match other driver
410. ver the user resizes it bind plot lt Configure gt draw_plot W id 0 0 1 0 Reproduce the previously explained range selection functions proc xrange_step1 plot cnd plot setcursor vline 0 0 3 bind plot lt 1 gt xrange_step2 YW cmd x proc xrange_step2 plot crd x set xa plot world x x plot setcursor xrng xa 0 3 bind plot lt 1 gt xrange_finish YW cnd xa x proc xrange_finish plot cmd xa x set xb plot world x x xrange_cancel plot eval cnd plot xa xb proc xrange_cance plot bind plot lt 1 gt plot clrcursor T his function is called to draw a zoomed version of the plot proc zoom plot plot xa xb draw_ plot plot id xa xb start_zoom plot T his procedure sets up the cursor to allow users to zoom inonthe plot proc start_zoom plot xrange_step1 plot zoom plot bind plot lt 2 gt start_zoom plot bind plot lt 3 gt draw_plot W id 0 0 1 0 Start the ball rolling start_zoom plot T otry the above script cut and paste it into a file called der tcl and run it by typing demo derno tcl If the pgpl ot widget complains that there aren t sufficient colors left in the default colormap then rerun the demo with a private colormap as follows demo deno tcl colormap new In addition if you just run the program without specifying a script file demo then you will be given a wish shell prompt at which you can type T c
411. vices D 1 Introduction T he following list shows the devices for which PGPLOT device handlers are available together with the names by which they are known to PGPLOT T he narres of the device types can be abbreviated so long as there is no arrbiguity in most cases this means the first two letters are sufficient Each installation of PGPLOT is configured with the devices appropriate for that installation so not every device is available in every installation of PGPLOT Not all devices are available under all operating systems D 2 Available Devices Conon Graphics F ile F ormats e GIF file GIF VGIF e Hewlett Packard HP GL plotters HPGL VHPGL e Portable Pixel Map file PPM VPPM e PostScript page description language PS VPS CPS VCPS e X Window dunp file WD VWD Workstations e Workstations running X Window System XWINDOW XSERVE e PGDISP or FIGDISP server for X workstations XDISP not recommended e VAX workstations running VWS software WS not recommended e Workstations running NeXT step operating system NE XT Personal Computers T he following device types are only available when PGPL OT is installed on a computer of the appropriate type with the required graphics hardware and software e Acorn Archimedes computer ARC e IBM PC MS DOS Microsoft F ortran 5 0 MSOF T e IBM PC MS DOS Lahey F 77 32 bit Fortran v5 0 LH Graphics T erminals e T ektronix terminals
412. vices the default size can change during PGPLOT execution e g on windowing workstations the window manager may allow the user to change the size of the PGPLOT window PGPLOT uses this opcode to determine the current the default size before starting each new page Pararreters returned by handler RBUF RBUF RBUF RBUF 1 default x coordinate of bottom eft corner must be zero 2 default x coordinate of top right corner 3 default y coordinate of bottom eft corner must be Zero 4 default y coordinate of top right corner ann nN OPCODE 7 Return miscellaneous defaults T his is an inquiry routine The handler returns a scale factor to be used for the obsolete character set used by old GRPCKG routines but not by PGPLOT Pararreters returned by handler e RBUF 1 character scale factor integer gt 0 OPCODE 8 Select device A PGPLOT device handler may handle more than one open device at once All graphical I O operations apply to the active device T his opcode is used to select a new active device note that opcode 9 open workstation also changes the active device Pararreters passed to handler e RBUF 1 plot ID T his is not needed by the handler and can be ignored e RBUF 2 identification number of selected device as returned by open workstation OPCODE 9 Open workstation Allocate an I O channel to the requested device and open the device Any hardware resets that need to be don
413. was added to PGPLOT inVersion 5 1 0 Argurrents ID input integer identifier of the device to be selected PGSLS set line style void cpgsl s int Is SUBROUTINE PGSLS LS INTEGER LS Set the line style attribute for subsequent plotting T his attribute affects line primitives only it does not affect graph markers text or area fill Five different line styles are available with the following codes 1 full line 2 dashed 3 dot dash dot dash 4 dotted 5 dash dot dot dot T he default is 1 normal full line Argurrent LS input the line style code for subsequent plotting in range 1 5 PGSLW set line width void cpgsl w int Iw SUBROUTINE PGSL W LW INTEGER LW Set the line width attribute T his attribute affects lines graph markers and text T he line width is specified in units of 1 200 0 005 inch about 0 13 mm and must be an integer in the range 1 201 On sorre devices thick lines are generated by tracing each line with multiple strokes offset in the direction perpendicular to the line Argurrent LW input width of line in units of 0 005 inch 0 13 mm in range 1 201 PGST BG set text background color index void cpgstbg int tbci SUBROUTINE PGST BG T BCI INTEGER T BCI Set the T ext Background Color Index for subsequent text By default text does not obscure underlying graphics If the text background color index is positive however text is opaque the boundin
414. were plotted pgband f pgcurs f Issue message if device is not open pggray f grgray f PGGRAY now uses a color ramp between the colors assigned to color index 0 background and color index 1 foreground T his should restore the old behavior the ranp runs fromblack to white on devices with black background and white foreground and fromwhite to black on devices with white background and black foreground pgpage f If this routine detects that the size of the view surface has been changed e g by a workstation window manager it now rescales the viewport in proportion F ormerly the size of the viewport in absolute units e g mm was not changed and so the viewport might extend outside the view surface T his only affects prograrrs that do not reset the viewport for each page pgpoly f grpocl f Correct bug an invisible polygon generated a spurious error message pgacs f pglen f pgqvsz f Fix minor formatting errors in header comments pgai nf f Change version to 5 0 1 pgs w f pgaqlw f grsl w f Correct header contrents line width unit is 0 005 inch pgpl ot sys gribf1 f Deleted also system dependent variants grfileio c Add O_T RUNC to cause truncation when an existing file is overwritten pgplot sys_ convex fc_cc conf Added IX11 pgplot sys_cray aaaread me Removed note about X WIN it now works grfileio c add O_T RUNC to cause truncation when an existing file is overwritten pgplot sys_ linux aaaread me New file n
415. will leave the page blank where the graph of the character belongs can sometimes use hsize and vsize to help with this Finally if your device driver only works with PXL files like our PRINT RONIX DVI driver then you may want to run the PKT OP X program to convert the PK Font into a PXL Font which your device driver needs Author Bob Forrest Electrical Engineering Dept Texas A amp M University College Station T exas 77843 forrest ee tarru edu Lal eX Picture Environment Supported device T his driver creates a text file containing commands for drawing inthe LaT eX picture environment bracketted by begin picture and end picture T he file can be included in a LaT eX docurent If you have the option of including a PostScript file in your LaT eX docurrent then that will usually give much better results than using this driver which has very linited Capabilities Device type code LATEX Default file name pgpl ot tex Default view surface dimensions T he default picture size is 6 inches by 6 inches which corresponds to 1728x 1728 units where a unit is 0 25pt 1 288 inch T he picture size can be changed by using PGPAP in the PGPLOT program Resolution T he driver rounds coordinates to multiples of 0 25pt 1 288 inch Color capability None Obtaining hardcopy Embed the file in aL aT eX docurent and use the norrval L aT eX tools to process it e g docurrentsty ef article begin document input pgpl ot t
416. world coordinates T input length of terminals to be drawn at the ends of the error bar as a multiple of the default length if T 0 0 no terminals will be drawn m lt xX PGERRB horizontal or vertical error bar void cpgerrb int dir int n const float x const float y const float e float t SUBROUTINE PGERRB DIR N X Y E T INT EGER DIR N REAL X Y E REAL T Plot error bars in the direction specified by DIR T his routine draws an error bar only to mark the data point at the start of the error bar an additional call to PGPT is required Argurrents DIR input direction to plot the error bar relative to the data point One sided error bar DIR is 1 for X X to X 2 for Y Y to Y 3 for X X to X E 4for Y Y to Y E T wo sided error bar DIR is 5for X X E to X 6 for Y Y E to Y nurrber of error bars to plot input world x coordinates of the data i world y coordinates of the data input value of error bar distance to be added to the data position in world coordinates input length of terminals to be drawn at the ends of the error bar as a multiple of the default length if T 0 0 no terminals will be drawn m lt xzZ Note the dimension of arrays X Y and E must be greater than or equal to N If Nis 1 X Y and E may be scalar variables or expressions PGERRX horizontal error bar void cpgerrx int n const flo
417. xrange_finish deletes the cursor and the associated event binding by calling on xrange_cancel then it evaluates the command that was originally passed to xrange_step1 via its cmd argument and tacks on the two selected world coordi nate limits as trailing argurrents Tcl range selection example proc xrange_step1 plot cmd plot setcursor vline 003 bind plot lt 1 gt xrange_step2 YW cmd x proc xrange_step2 plot crd x set xa plot world x x pl ot setcursor xrng xa 0 3 bind plot lt 1 gt xrange_finish YW cnd xa x proc xrange_finish plot xa x set xb plot world x x xrange_cancel plot eval cnd plot xa xb proc xrange_cancel plot bind plot lt 1 gt plot clrcursor T he following is an example of how this could be used A more complete example is provided later pgplot plot maxcolors 16 proc report_xrange plot xa xb puts Y ou selected X axis range xa gt xb xrange_step1 plot report_xrange Finally the following example shows how one can provide a continuous readout of the world coordinates of the cursor whenever the cursor is in the target PGPLOT widget It creates two label widgets in which to display the X and Y coordinates places themleft to right above a PGPLOT widget and then arranges for the positions reported by Motion events to be transl ated to world coordinates and placed in the labes Tcl cursor readout example Create two labels si
418. y useful TEXT input the text string to be plotted T railing spaces are ignored when justifying the string but leading spaces are significant PGNCUR mark a set of points using the cursor void cpgncur int maxpt int npt float x float y int symbol SUBROUTINE PGNCUR MAXPT NPT X Y SYMBOL INT EGER MAXPT NPT REAL X Y INT EGER SYMBOL Interactive routine for user to enter data points by use of the cursor Routine allows user to Add and Delete points T he points are returned in order of increasing x coordinate not in the order they were entered Argurrents MAXPT input maximumnumber of points that may be accepted NPT in out nurrber of points entered should be zero on first call X in out array of x coordinates Y inout array of y coordinates SYMBOL input code number of symbol to use for marking entered points see PGPT Note 1 T he dimension of arrays X and Y must be greater than or equal to MAXPT Note 2 On return fromthe program cursor points are returned in increasing order of X Routine may be re called with points already defined in X Y number in NPT and they will be plotted first before editing Note 3 User comands the user types single character commands after positioning the cursor the following are accepted A Add add point at current cursor location D Delete delete nearest point to cursor X eXit leave subroutine PGNUMB
419. yed Color capability Colorraps of types PseudoColor StaticColor GrayScale StaticGray and T rueColor are supported By default colors are allocated fromthe colormap used by the parent window of the widget unless it has too few colors in which case the window uses the black and white pixels of the screen to implement a monochrome window Note that with PseudoColor and GrayScale colormaps colors of already drawn graphics will respond to changes to their color representations whereas with other colorrrap types color representation changes will only effect the colors of subsequently drawn graphics Input capability T he cursor is usually controlled by a mouse Cursor input is achieved by moving the cursor into the window of the widget and pressing either a mouse button or a keyboard key to select a given position in the window and return a key value T he mouse buttons are mapped to return characters A D and X An asynchronous alternative to the cpgcurs and cpgband procedures is provided T his provides the sare functionality as cogband except that once armed cursor input is delivered to the application via callback functions Facilities are also provided to support applications that want to handle cursor input themselves via XtA ddE ventHandler T his includes optional augmentation of the X cursor with rubber bands and functions for converting between X window coordinates and world coordinates Multiple open device

Download Pdf Manuals

image

Related Search

Related Contents

    Lab User Manual - University of Washington  Graco 313873H User's Manual  アムウェイ フードプロセッサー取扱説明書・お料理集  COLUMBUS User Manual Version 3.8 - Best  Intel E10GSFPSR network transceiver module  Uncontrolled copy  

Copyright © All rights reserved.
Failed to retrieve file