1TriD::Contours(3) User Contributed Perl Documentation TriD::Contours(3)
2
3
4
6 PDL::Graphics::TriD::Contours - 3D Surface contours for TriD
7
9 # A simple contour plot in black and white
10
11 use PDL::Graphics::TriD;
12 use PDL::Graphics::TriD::Contours;
13 $size = 25;
14 $x = (xvals zeroes $size,$size) / $size;
15 $y = (yvals zeroes $size,$size) / $size;
16 $z = (sin($x*6.3) * sin($y*6.3)) ** 3;
17 $data=new PDL::Graphics::TriD::Contours($z,
18 [$z->xvals/$size,$z->yvals/$size,0]);
19 PDL::Graphics::TriD::graph_object($data)
20
22 new()
23 Define a new contour plot for TriD.
24
25 $data=new PDL::Graphics::TriD::Contours($d,[$x,$y,$z],[$r,$g,$b],$options);
26
27 where $d is a 2D pdl of data to be contoured. [$x,$y,$z] define a 3D
28 map of $d into the visualization space [$r,$g,$b] is an optional [3,1]
29 piddle specifying the contour color and $options is a hash reference to
30 a list of options documented below. Contours can also be colored by
31 value using the set_color_table function.
32
33 ContourInt => 0.7 # explicitly set a contour interval
34 ContourMin => 0.0 # explicitly set a contour minimum
35 ContourMax => 10.0 # explicitly set a contour maximum
36 ContourVals => $pdl # explicitly set all contour values
37 Label => [1,5,$myfont] # see addlabels below
38 Font => $font # explicitly set the font for contour labels
39
40 If ContourVals is specified ContourInt, ContourMin, and ContourMax
41 are ignored. If no options are specified, the algorthym tries to
42 choose values based on the data supplied. Font can also be specified or
43 overwritten by the addlabels() function below.
44
45 addlabels()
46 Add labels to a contour plot
47
48 $contour->addlabels($labelint,$segint,$font);
49
50 $labelint is the integer interval between labeled contours. If you
51 have 8 contour levels and specify $labelint=3 addlabels will attempt to
52 label the 1st, 4th, and 7th contours. $labelint defaults to 1.
53
54 $segint specifies the density of labels on a single contour level.
55 Each contour level consists of a number of connected line segments,
56 $segint defines how many of these segments get labels. $segint
57 defaults to 5, that is every fifth line segment will be labeled.
58
59 set_colortable($table)
60 Sets contour level colors based on the color table.
61
62 $table is passed in as either a piddle of [3,n] colors, where n is the
63 number of contour levels, or as a reference to a function which expects
64 the number of contour levels as an argument and returns a [3,n] piddle.
65 It should be straight forward to use the PDL::Graphics::LUT tables in a
66 function which subsets the 256 colors supplied by the look up table
67 into the number of colors needed by Contours.
68
69 coldhot_colortable()
70 A simple colortable function for use with the set_colortable function.
71
72 coldhot_colortable defines a blue red spectrum of colors where the
73 smallest contour value is blue, the highest is red and the others are
74 shades in between.
75
76
77
78perl v5.28.0 2018-05-05 TriD::Contours(3)