Include a header file required for build on mac 10.4
[supercollider.git] / Help / GUI / GUI-Tools / plot.html
blobebf31104df31e5f026f9d3bf3c91f219d4bbbfb3
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="1038.25">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000; min-height: 12.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
19 span.s1 {font: 18.0px Helvetica}
20 span.s2 {text-decoration: underline ; color: #0000bf}
21 span.s3 {color: #0000bf}
22 span.s4 {color: #606060}
23 span.s5 {color: #737373}
24 span.s6 {color: #bf0000}
25 span.s7 {color: #000000}
26 span.Apple-tab-span {white-space:pre}
27 </style>
28 </head>
29 <body>
30 <p class="p1"><span class="s1"><b>plot<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>plot data in a graph</b></p>
31 <p class="p2"><br></p>
32 <p class="p1">The <b>.plot</b> method provides the ability to plot data in a GUI window. The method is implemented in the <a href="../../Collections/ArrayedCollection.html"><span class="s2">ArrayedCollection</span></a> class but is also available for other classes for convenience, including <a href="../../Core/Kernel/Function.html"><span class="s3">Function</span></a>, <a href="../../Control/Env.html"><span class="s3">Env</span></a>, <a href="../../ServerArchitecture/Buffer.html"><span class="s3">Buffer</span></a>, <a href="../../Files/SoundFile.html"><span class="s3">SoundFile</span></a>, <a href="../../Collections/Wavetable.html"><span class="s3">Wavetable</span></a>.</p>
33 <p class="p2"><br></p>
34 <p class="p1"><b>receiver.plot(name, bounds, discrete, numChannels, minval, maxval, parent, labels)</b></p>
35 <p class="p2"><br></p>
36 <p class="p1">Arguments (all optional):</p>
37 <p class="p2"><br></p>
38 <p class="p3"><b><span class="Apple-tab-span"> </span>name</b> - the name to be used as the GUI window title.</p>
39 <p class="p3"><span class="Apple-tab-span"> </span><b>bounds</b> - a <a href="../../Geometry/Rect.html"><span class="s3">Rect</span></a> providing coordinates for the GUI location.</p>
40 <p class="p3"><span class="Apple-tab-span"> </span><b>discrete</b> - plots are line-plots by default. Set this to true for bar charts.</p>
41 <p class="p3"><span class="Apple-tab-span"> </span><b>numChannels</b> - the number of interleaved channels that an array represents. For Buffers this argument is not available, since it's filled in automatically.</p>
42 <p class="p3"><span class="Apple-tab-span"> </span><b>minval</b> - minimum value(s) for the display range. For a Buffer this defaults to -1 but can be changed.</p>
43 <p class="p3"><span class="Apple-tab-span"> </span><b>maxval</b> - maximum value(s) for the display range. For a Buffer this defaults to +1 but can be changed.</p>
44 <p class="p3"><span class="Apple-tab-span"> </span><b>parent</b> - by default the plot is placed in a new GUI window. This argument can be used to specify an existing GUI container to send the plot to.</p>
45 <p class="p3"><span class="Apple-tab-span"> </span><b>labels</b> - by default labels appear at the top left of the plot giving a data readout based on mouse position. Set this argument to false to prevent them appearing.</p>
46 <p class="p2"><br></p>
47 <p class="p3">If <b>minval</b> and/or <b>maxval</b> are set to nil (this is default, except for Buffers), they will be automatically calculated from the dataset minimum and/or maximum. For multi-channel data, <b>minval</b> and <b>maxval</b> may be arrays, specifying the range independently for each channel (including use of nil, in which case the min/max will be calculated for the specific channel rather than for the overall dataset).</p>
48 <p class="p4"><br></p>
49 <p class="p1">Hitting the<b> L-key </b>on the keyboard when the window is focussed toggles the lock, and the window</p>
50 <p class="p1">can be used to edit the data.</p>
51 <p class="p2"><br></p>
52 <p class="p2"><br></p>
53 <p class="p1"><b>Examples</b></p>
54 <p class="p2"><br></p>
55 <p class="p1">(See some of the classes linked above for more examples)</p>
56 <p class="p2"><br></p>
57 <p class="p5">// Arrays</p>
58 <p class="p6">[5, 6, 7, 6.5, 4.5, 3.5].plot(<span class="s4">"Some data"</span>)</p>
59 <p class="p6">[5, 6, 7, 6.5, 4.5, 3.5].plot(<span class="s4">"Some data, in stereo"</span>, numChannels:2)</p>
60 <p class="p6">[5, 6, 7, 6.5, 4.5, 3.5].plot(<span class="s4">"Some data, in stereo"</span>, numChannels:2, discrete: <span class="s3">true</span>)</p>
61 <p class="p7"><br></p>
62 <p class="p6">{ <span class="s3">|i|</span> { <span class="s3">|j|</span> j + 1 * i % 6 }.dup(5) }.dup(200).plot(<span class="s5">"Some 2-d data"</span>);</p>
63 <p class="p8"><br></p>
64 <p class="p5">// 3-channel interlaced data</p>
65 <p class="p6">b = [{1.0.rand}.dup(50), { 20.0.rand - 30 }.dup(50),{ 10.0.rand }.dup(50)].lace(150);</p>
66 <p class="p6">b.plot(numChannels:3, minval: <span class="s3">nil</span>, maxval: <span class="s3">nil</span>); <span class="s6">// Common rescaling</span></p>
67 <p class="p6">b.plot(numChannels:3, minval: [<span class="s3">nil</span>, <span class="s3">nil</span>, <span class="s3">nil</span>], maxval: [<span class="s3">nil</span>, <span class="s3">nil</span>, <span class="s3">nil</span>]); <span class="s6">// Separate rescaling</span></p>
68 <p class="p8"><br></p>
69 <p class="p5">// Envelopes</p>
70 <p class="p6"><span class="s3">Env</span>.adsr(0.4, 0.4, 0.8, 0.9).plot</p>
71 <p class="p7"><br></p>
72 <p class="p5">// Buffers</p>
73 <p class="p6">s.boot;</p>
74 <p class="p9"><span class="s7">b = </span><span class="s3">Buffer</span><span class="s7">.read(s,</span>"sounds/a11wlk01.wav"<span class="s7">);</span></p>
75 <p class="p5"><span class="s7">b.plot; </span>// +-1 range</p>
76 <p class="p6">b.plot(minval: <span class="s3">nil</span>, maxval: <span class="s3">nil</span>); <span class="s6">// auto range</span></p>
77 <p class="p6">b.plot(minval: 0, maxval: <span class="s3">nil</span>); <span class="s6">// semi-auto range</span></p>
78 <p class="p7"><br></p>
79 </body>
80 </html>