1PGPLOT(3) User Contributed Perl Documentation PGPLOT(3)
2
3
4
6 PDL::Graphics::PGPLOT - PGPLOT enhanced interface for PDL
7
9 pdl> $a = pdl [1..100]
10 pdl> $b = sqrt($a)
11 pdl> line $b
12 pdl> hold
13 Graphics on HOLD
14 pdl> $c = sin($a/10)*2 + 4
15 pdl> line $c
16
18 "PDL::Graphics::PGPLOT" is a convenience interface to the PGPLOT
19 commands, implemented using the object oriented PGPLOT plotting package
20 in PDL::Graphics::PGPLOT::Window. See the documentation for that
21 package for in-depth information about the usage of these commands and
22 the options they accept.
23
24 The list of currently availably commands:
25
26 imag - Display an image (uses pgimag()/pggray() as appropriate)
27 im - Shorthand to display an image with aspect ratio of 1
28 fits_imag - Display a FITS image with appropriate transforms & labels
29 cont - Display image as contour map
30 fits_cont - Display a FITS image in scientific coordinates as a contour map
31 vect - Display 2 images as a vector field
32 fits_vect - Display 2 FITS images in sci. coordinates as a vector field
33 ctab - Load an image colour table
34 ctab_info - Get information about currently loaded colour table
35 line - Plot vector as connected points
36 points - Plot vector as points
37 errb - Plot error bars
38 bin - Plot vector as histogram (e.g. bin(hist($data)) )
39 hi2d - Plot image as 2d histogram (not very good IMHO...)
40 poly - Draw a polygon
41 text - Write text in the plot area
42 label_axes - Print axis titles
43 legend - Create a legend with different texts, linestyles etc.
44 cursor - Interactively read cursor positions.
45 circle - Draw a circle
46 ellipse - Draw an ellipse.
47
48 Device manipulation commands:
49
50 hold - Hold current plot window range - allows overlays etc.
51 release - Release back to autoscaling of new plot window for each
52 command
53 rel - short alias for 'release'
54 env - Define a plot window, put on 'hold'
55 dev - Explicitly set a new PGPLOT graphics device
56 new_window - Create a new plot window (use of dev is recommended)
57 focus_window - Change focus to a new window
58 window_list - Get a list of currently existing plot windows
59 close_window - Close an open window
60
62 The following is a list of the functions that are private to this
63 package, for the other functions please read the
64 PDL::Graphics::PGPLOT::Window documentation.
65
66 dev
67 Open PGPLOT graphics device
68
69 Usage: dev $device, [$nx,$ny, $opt];
70
71 $device is a PGPLOT graphics device such as "/xserve" or "/ps", if
72 omitted defaults to last used device (or value of env var "PGPLOT_DEV"
73 if first time). $nx, $ny specify sub-panelling. The function returns
74 the id of the newly created window - this can subsequently be used as
75 argument to "focus_window" to select the window.
76
77 The result of this command can be modified using options. The options
78 recognised are the same as for "new_window" - which primarily and in
79 addition it is possible to set the default values for a window that are
80 defined in PDL::Graphics::PGPLOTOptions, see this for details but see
81 below for a synopsis.
82
83 In addition "dev" recognises the option "NewWindow" which allows the
84 user to specify that a "dev" command is to create a new window rather
85 than closing the previous. This allows a large number of output
86 destinations to be open at the same time, which occasionally can be
87 convenient.
88
89 Here is a quick summary of the most useful additional options that can
90 be given:
91
92 Device
93 Alternative to $device.
94
95 AspectRatio
96 The aspect ratio of the output window
97
98 WindowWidth
99 The width of the plot window in inches
100
101 AxisColour
102 The axis colour to be used as default for plots in this window. In
103 the same way it is possible to set the default character size
104 ("CharSize") and axis and box styles. See
105 PDL::Graphics::PGPLOTOptions for details.
106
107 WindowName
108 The name of a window. This name can subsequently be used to refer
109 to the window instead of its ID, making interactive use somewhat
110 more intuitive.
111
112 To open a X-window output that will stay on screen:
113
114 $win = dev('/xs');
115
116 To open two windows, one small and square, one large and wide:
117
118 $win1 = dev('/xs', {Aspect => 1, WindowWidth => 4});
119 $win2 = dev('/xs', {Aspect => 0.5, WindowWidth => 10});
120
121 new_window
122 Open a PGPLOT graphics device
123
124 $win = new_window($dev, $nx, $ny, $opt);
125
126 This function is identical to dev except that it always creates a new
127 window. This means that the user is required to close all windows
128 explicitly using close_window. All functionality is otherwise like
129 "dev" so see the documentation for dev for details of use.
130
131 close_window
132 Close a PGPLOT output device
133
134 Usage: close_window($id)
135
136 This function closes a PGPLOT output device created with "dev" or
137 "new_window". It requires the id of the window to close. If $id is left
138 undefined, the currently focussed window is deleted and focus is
139 transferred to the lowest numbered window in existence. If many windows
140 have been created and deleted this might not be what you expect, so it
141 is recommended to make an explicit call to focus_window after any call
142 to "close_window".
143
144 _get_windownumber
145 Internal function to obtain the ID of a window. This allows the user to
146 refer to a window with its name.
147
148 focus_window
149 Switch to another output window.
150
151 Usage: focus_window($id);
152
153 This command is used to switch output focus to another window created
154 by dev or new_window. The window can be referred to either by its ID or
155 by its name.
156
157 $win1 = dev('/xs', {WindowName => 'X-output'});
158 $win2 = dev('test.ps/ps', {WindowName => 'PS-output'});
159
160 focus_window('X-output'); # Or focus_window($win1);
161 <.. Commands ..>
162 focus_window($win2); # Or focus_window('PS-output');
163 <.. Commands ..>
164
165 window_list
166 Return a list of ID numbers and names of the windows currently opened
167 using dev or new_window.
168
169 Usage: ($numbers, $names)=window_list();
170
171 $numbers and $names are anonymous arrays giving the ID numbers and
172 names of the open windows respectively.
173
174
175
176perl v5.30.0 2019-09-05 PGPLOT(3)