/usr/share/doc/python-simpy-doc/html/Manuals/PlotManual/ManualPlotting.html is in python-simpy-doc 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SimPlot Manual — SimPy 2.3.1 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2.3.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="SimPy 2.3.1 documentation" href="../../index.html" />
<link rel="up" title="SimPy Tools" href="../../SimPy_Tools.html" />
<link rel="next" title="SimGUI Manual" href="../GUIManual/SimGUImanual.html" />
<link rel="prev" title="SimPy Tools" href="../../SimPy_Tools.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../GUIManual/SimGUImanual.html" title="SimGUI Manual"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../../SimPy_Tools.html" title="SimPy Tools"
accesskey="P">previous</a> |</li>
<li><a href="../../index.html">SimPy 2.3.1 documentation</a> »</li>
<li><a href="../../SimPy_Tools.html" accesskey="U">SimPy Tools</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="simplot-manual">
<h1><a class="toc-backref" href="#id3">SimPlot Manual</a><a class="headerlink" href="#simplot-manual" title="Permalink to this headline">¶</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Authors:</th><td class="field-body">Klaus Muller <<a class="reference external" href="mailto:Muller%40users.sourceforge.net">Muller<span>@</span>users<span>.</span>sourceforge<span>.</span>net</a>></td>
</tr>
<tr class="field-even field"><th class="field-name">SimPy release:</th><td class="field-body">2.3.1</td>
</tr>
<tr class="field-odd field"><th class="field-name">Web-site:</th><td class="field-body"><a class="reference external" href="http://simpy.sourceforge.net/">http://simpy.sourceforge.net/</a></td>
</tr>
<tr class="field-even field"><th class="field-name">Python-Version:</th><td class="field-body">2.6 and later</td>
</tr>
<tr class="field-odd field"><th class="field-name">Date:</th><td class="field-body">December 2011</td>
</tr>
</tbody>
</table>
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#simplot-manual" id="id3">SimPlot Manual</a><ul>
<li><a class="reference internal" href="#introduction" id="id4">Introduction</a></li>
<li><a class="reference internal" href="#plotting-with-simplot-an-overview" id="id5">Plotting with SimPlot - an overview</a></li>
<li><a class="reference internal" href="#simple-plotting-api" id="id6">Simple plotting API</a></li>
<li><a class="reference internal" href="#advanced-plotting-api" id="id7">Advanced plotting API</a></li>
<li><a class="reference internal" href="#colours-in-simplot" id="id8">Colours in SimPlot</a></li>
</ul>
</li>
</ul>
</div>
<p>The <strong>SimPlot</strong> plotting library has been developed for SimPy users so that
they can produce, view and print simple plots, without having to download and
install any other software package.</p>
<p>This manual is aimed at the SimPy applications programmer. It describes the
capabilities of SimPlot and its programming interface.</p>
<p>There are several more elaborate Open Source plotting packages downloadable from the
Internet which can be used from Python and therefore from SimPy. SimPlot is
the “quick and dirty”, out-of-the-box plotting package for SimPy. If you need
more complex plots or publication-quality graphics, consider using e.g. Matplotlib
( <<a class="reference external" href="http://matplotlib.sourceforge.net/">http://matplotlib.sourceforge.net/</a>>_ ).</p>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id4">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>SimPlot is a basic plotting package based on Tk/Tkinter and designed for use
with SimPy. It has been developed from an Open Source plotting package
published in John E. Grayson’s excellent book ‘Python and Tkinter Programming’
(ISBN 1-884777-81-3) which in turn was derived from Konrad Hinsen’s graph
widget for NumPy (Numerical Python).</p>
<p>SimPlot provides for the generation, viewing and Postscript output of
a variety of plot types by SimPy programs. The data series of SimPy Monitor instances
can be plotted automatically.</p>
<p>SimPlot requires Tk/Tkinter to be installed
(for all major operating systems on which Python runs, the Python installation
already includes the installation of Tk/Tkinter, so no additional download or
installation is required). Test whether Tk/Tkinter is installed by running
‘import Tkinter’ on the Python interpreter command line. If you don’t get
an error message, it is.</p>
<p>To write SimPlot-based programs, only a very rudimentary understanding
of Tk/Tkinter is required. <em>This manual does not attempt to teach Tk/Tkinter!</em></p>
</div>
<div class="section" id="plotting-with-simplot-an-overview">
<h2><a class="toc-backref" href="#id5">Plotting with SimPlot - an overview</a><a class="headerlink" href="#plotting-with-simplot-an-overview" title="Permalink to this headline">¶</a></h2>
<div class="section" id="plot-types-and-capabilities">
<h3>Plot types and capabilities<a class="headerlink" href="#plot-types-and-capabilities" title="Permalink to this headline">¶</a></h3>
<p>A simple plot program using SimPlot basically looks like:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Prog1.py</span>
<span class="kn">from</span> <span class="nn">SimPy.SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plotLine</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],[</span><span class="mi">3</span><span class="p">,</span><span class="mi">9</span><span class="p">]])</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span>
</pre></div>
</div>
<p>When running this program, the resulting output on Windows is
(the outside frame will look different on other platforms):</p>
<img alt="../../_images/Prog1.png" src="../../_images/Prog1.png" />
<p>The program shows the basic structure of any program using
SimPlot:</p>
<blockquote>
<div><ul class="simple">
<li>Line 2 imports the plotting module,</li>
<li>Line 3 creates and instance of the plotting class,</li>
<li>Line 4 plots a line in an x/y coordinate system,</li>
<li>Line 5 starts the main loop of Tk.</li>
</ul>
</div></blockquote>
<p>The frame also shows a ‘File’ menu item (when clicked, it
offers a submenu item ‘Postscript’ which allows saving the plot to a
Postscript file.</p>
<p>Method <em>plotline</em> has many name parameters with default values.
Here is an example showing some of them (they will all be discussed
further down in this manual:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Prog2.py</span>
<span class="kn">from</span> <span class="nn">SimPy.SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plotLine</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],[</span><span class="mi">3</span><span class="p">,</span><span class="mi">9</span><span class="p">]],</span><span class="n">title</span><span class="o">=</span><span class="s">"This is prettier"</span><span class="p">,</span>
<span class="n">color</span><span class="o">=</span><span class="s">"red"</span><span class="p">,</span><span class="n">width</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">smooth</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span>
</pre></div>
</div>
<p>This produces the following plot (the outside frame is not shown):</p>
<img alt="../../_images/Prog2.png" src="../../_images/Prog2.png" />
<p>The plot now has a title and the curve is red, wider and smooth.</p>
<p>In addition to <em>line plots</em>, there are three other plot-types available in SimPlot,
namely <em>stepped line plots</em>, <em>bar charts</em>, and <em>scatter diagrams</em>.</p>
<p>Here are examples of each. First, the stepped line plot:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Prog3.py</span>
<span class="kn">from</span> <span class="nn">SimPy.SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plotStep</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],[</span><span class="mi">3</span><span class="p">,</span><span class="mi">9</span><span class="p">]],</span>
<span class="n">color</span><span class="o">=</span><span class="s">"red"</span><span class="p">,</span><span class="n">width</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span>
</pre></div>
</div>
<p>which produces:</p>
<img alt="../../_images/Prog3.png" src="../../_images/Prog3.png" />
<p>A bar chart program:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Prog4.py</span>
<span class="kn">from</span> <span class="nn">SimPy.SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plotBars</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],[</span><span class="mi">3</span><span class="p">,</span><span class="mi">9</span><span class="p">]],</span>
<span class="n">color</span><span class="o">=</span><span class="s">"blue"</span><span class="p">,</span><span class="n">width</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span>
</pre></div>
</div>
<p>which results in:</p>
<img alt="../../_images/Prog4.png" src="../../_images/Prog4.png" />
<p>And finally, a scatter diagram:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Prog5.py</span>
<span class="kn">from</span> <span class="nn">SimPy.SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plotScatter</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">],[</span><span class="mi">3</span><span class="p">,</span><span class="mi">9</span><span class="p">]],</span>
<span class="n">color</span><span class="o">=</span><span class="s">"green"</span><span class="p">,</span><span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span><span class="n">marker</span><span class="o">=</span><span class="s">'triangle'</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span>
</pre></div>
</div>
<p>and its output:</p>
<img alt="../../_images/Prog5.png" src="../../_images/Prog5.png" />
<p>With a bit more involved programming, it is also possible to have
several plots in one diagram and to have several diagrams
in one Frame (just execute SimPlot.py to get these plots):</p>
<img alt="../../_images/Twoup.png" src="../../_images/Twoup.png" />
<img alt="../../_images/Twodown.png" src="../../_images/Twodown.png" />
<p><em>Note: In future versions of SimPlot, this part of the API
will also be simplified so that it will require significantly
less coding.</em></p>
<div class="section" id="plotting-monitor-instances">
<h4>Plotting Monitor instances<a class="headerlink" href="#plotting-monitor-instances" title="Permalink to this headline">¶</a></h4>
<p>Class <em>Monitor</em> is the prime data collection tool for SimPy simulations.
SimPlot therefore caters for easy plotting from Monitor intances.</p>
<p>Here is an example of a simple simulation using a Monitor:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Monitorplot.py</span>
<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">generators</span>
<span class="kn">from</span> <span class="nn">SimPy.Simulation</span> <span class="kn">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">SimPy.Monitor</span> <span class="kn">import</span> <span class="o">*</span>
<span class="kn">from</span> <span class="nn">SimPy.SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="k">class</span> <span class="nc">Source</span><span class="p">(</span><span class="n">Process</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">monitor</span><span class="p">):</span>
<span class="n">Process</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">moni</span><span class="o">=</span><span class="n">monitor</span>
<span class="bp">self</span><span class="o">.</span><span class="n">arrived</span><span class="o">=</span><span class="mi">0</span>
<span class="k">def</span> <span class="nf">arrivalGenerator</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="k">yield</span> <span class="n">hold</span><span class="p">,</span><span class="bp">self</span><span class="p">,</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">20</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">arrived</span><span class="o">+=</span><span class="mi">1</span>
<span class="bp">self</span><span class="o">.</span><span class="n">moni</span><span class="o">.</span><span class="n">observe</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arrived</span><span class="p">)</span>
<span class="n">initialize</span><span class="p">()</span>
<span class="n">moni</span><span class="o">=</span><span class="n">Monitor</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">"Arrivals"</span><span class="p">,</span><span class="n">ylab</span><span class="o">=</span><span class="s">"nr arrived"</span><span class="p">)</span>
<span class="n">s</span><span class="o">=</span><span class="n">Source</span><span class="p">(</span><span class="n">moni</span><span class="p">)</span>
<span class="n">activate</span><span class="p">(</span><span class="n">s</span><span class="p">,</span><span class="n">s</span><span class="o">.</span><span class="n">arrivalGenerator</span><span class="p">())</span>
<span class="n">simulate</span><span class="p">(</span><span class="n">until</span><span class="o">=</span><span class="mi">100</span><span class="p">)</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plotStep</span><span class="p">(</span><span class="n">moni</span><span class="p">,</span><span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span>
</pre></div>
</div>
<p>This produces:</p>
<img alt="../../_images/Monitorplot.png" src="../../_images/Monitorplot.png" />
</div>
</div>
</div>
<div class="section" id="simple-plotting-api">
<h2><a class="toc-backref" href="#id6">Simple plotting API</a><a class="headerlink" href="#simple-plotting-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="overview">
<h3>Overview<a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h3>
<p>A SimPlot application program has the following structure:</p>
<blockquote>
<div><ul class="simple">
<li>instantiation of the <strong>SimPlot</strong> class</li>
<li>call of one or more plotting methods</li>
<li>call to the SimPlot instance’s <strong>mainloop</strong> method</li>
</ul>
</div></blockquote>
<p>SimPlot exposes plotting methods at two levels, a <em>simple API</em>
with limited capabilities but ease of use, and an <em>advanced API</em>
with SimPlot’s full capabilities, but with more involved, verbose
programming.</p>
<p>This section deals with the simple API.</p>
</div>
<div class="section" id="simplot">
<h3>SimPlot<a class="headerlink" href="#simplot" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="SimPlot">
<em class="property">class </em><tt class="descname">SimPlot</tt><a class="headerlink" href="#SimPlot" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<p>This class provides the plotting capabilities.</p>
</div>
<div class="section" id="plotline">
<h3>plotLine<a class="headerlink" href="#plotline" title="Permalink to this headline">¶</a></h3>
<dl class="classmethod">
<dt id="SimPlot.plotLine">
<em class="property">classmethod </em><tt class="descclassname">SimPlot.</tt><tt class="descname">plotLine</tt><big>(</big><em>values</em><span class="optional">[</span>, <em>optional parameters</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#SimPlot.plotLine" title="Permalink to this definition">¶</a></dt>
<dd><p>Generates a line plot from a list of tuples (or lists) or from a Monitor (any instance which has the attributes ‘name’, ‘tlab’, ‘ylab’).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>values</strong> (<em>list or Monitor</em>) – (<strong>mandatory</strong>) a list of two-element lists (or tuples), or a Monitor instance (any instance which has the attributes ‘name’, ‘tlab’, ‘ylab’)</li>
<li><strong>windowsize</strong> – the plotting window size in pixels (tuple); default: (500,300)</li>
<li><strong>title</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#string" title="(in Python v2.7)"><em>string</em></a>) – the plot title ; if <em>values</em> is a Monitor, Monitor name is used if no <em>title</em> given</li>
<li><strong>width</strong> (<em>integer or floating point</em>) – line drawing width, default: 1</li>
<li><strong>color</strong> (<em>Tkinter colour type</em>) – line colour; default: ‘black’</li>
<li><strong>smooth</strong> (<em>boolean</em>) – if True, makes line smooth; default: “True”</li>
<li><strong>background</strong> (<em>Tkinter colour type</em>) – colour of plot background; default: ‘white’</li>
<li><strong>xlab</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#string" title="(in Python v2.7)"><em>string</em></a>) – ** : label on x-axis of plot; if <em>values</em> is a Monitor, Monitor <em>tlab</em> is taken; default: ‘x’</li>
<li><strong>ylab</strong> – label on y-axis of plot (string); if <em>values</em> is a Monitor, Monitor <em>ylab</em> is taken; default: ‘y’</li>
<li><strong>xaxis</strong> – layout of x-axis (None = omit x-axis; ‘automatic’ = make x-axis at least long enough to include all x-values, using round values; ‘minimal’ = have x-axis go <em>exactly</em> from minimal to maximal x-value provided; tuple (xlow,xhigh) = have x-axis go from xlow to xhigh); default: ‘automatic’</li>
<li><strong>yaxis</strong> – layout of y-axis (None = omit y-axis; ‘automatic’ = make y-axis at least long enough to include all y-values, using round values; ‘minimal’ = have y-axis go <em>exactly</em> from minimal to maximal y-value provided; tuple (ylow,yhigh) = have y-axis go from ylow to yhigh); default: ‘automatic’</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Reference to <em>GraphBase</em> object which contains the plot.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="plotstep">
<h3>plotStep<a class="headerlink" href="#plotstep" title="Permalink to this headline">¶</a></h3>
<dl class="classmethod">
<dt id="SimPlot.plotStep">
<em class="property">classmethod </em><tt class="descclassname">SimPlot.</tt><tt class="descname">plotStep</tt><big>(</big><em>values</em><span class="optional">[</span>, <em>optional parameters</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#SimPlot.plotStep" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<p>Generates a step plot from a list of tuples (or lists) or from a Monitor (any instance which has the attributes ‘name’, ‘tlab’, ‘ylab’).
A horizontal line is drawn at a y-value until y changes, creating a step effect.</p>
<blockquote>
<div><blockquote>
<div><strong><variable> = <SimPlotInstance>.plotStep(values[,optional parameters])</strong></div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">param values:</th><td class="field-body">(<strong>mandatory</strong>) a list of two-element lists (or tuples), or a Monitor instance (any instance which has the attributes ‘name’, ‘tlab’, ‘ylab’)</td>
</tr>
</tbody>
</table>
</div></blockquote>
<dl class="docutils">
<dt>Optional parameters with defaults:</dt>
<dd><ul class="first last simple">
<li><strong>windowsize=(500,300),</strong> : the plotting window size in pixels (tuple)</li>
<li><strong>title=”“</strong> : the plot title (string); if <strong>values</strong> is a Monitor, Monitor name is used if no <strong>title</strong> given</li>
<li><strong>width=1</strong> : line drawing width (integer or floating point)</li>
<li><strong>color=’black’</strong> : line colour (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>background=’white’</strong> : colour of plot background (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>xlab=’x’</strong> : label on x-axis of plot (string); if <strong>values</strong> is a Monitor, Monitor <em>tlab</em> is taken</li>
<li><strong>ylab=’y’</strong> : label on y-axis of plot (string); if <strong>values</strong> is a Monitor, Monitor <em>ylab</em> is taken</li>
<li><strong>xaxis=’automatic’</strong> : layout of x-axis (None = omit x-axis; ‘automatic’ = make x-axis at least long enough to include all x-values, using round values; ‘minimal’ = have x-axis go <em>exactly</em> from minimal to maximal x-value provided; tuple (xlow,xhigh) = have x-axis go from xlow to xhigh)</li>
<li><strong>yaxis=’automatic’</strong> : layout of y-axis (None = omit y-axis; ‘automatic’ = make y-axis at least long enough to include all y-values, using round values; ‘minimal’ = have y-axis go <em>exactly</em> from minimal to maximal y-value provided; tuple (ylow,yhigh) = have y-axis go from ylow to yhigh)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to <em>GraphBase</em> object which contains the plot.</dd>
</dl>
</div>
<div class="section" id="plotbars">
<h3>plotBars<a class="headerlink" href="#plotbars" title="Permalink to this headline">¶</a></h3>
<p>Generates a bar chart plot from a list of tuples (or lists) or from a Monitor.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><p class="first"><strong><SimPlotInstance>.plotBars(values[,optional parameters])</strong></p>
<p class="last"><strong><variable> = <SimPlotInstance>.plotBars(values[,optional parameters])</strong></p>
</dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples), or a Monitor instance</li>
</ul>
</dd>
<dt>Optional parameters with defaults:</dt>
<dd><ul class="first last simple">
<li><strong>windowsize=(500,300),</strong> : the plotting window size in pixels (tuple)</li>
<li><strong>title=’‘</strong> : the plot title (string); if <strong>values</strong> is a Monitor, Monitor name is used if no <strong>title</strong> given</li>
<li><strong>width=1</strong> : outline drawing width (integer or floating point)</li>
<li><strong>color=’black’</strong> : outline colour (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillcolor=’black’</strong> : colour with which bars are filled (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillstyle=’‘</strong> : density of fill (default=100%; Tkinter bitmap)</li>
<li><strong>outline=’black”</strong> : colour of bar outline ((Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>background=’white’</strong> : colour of plot background (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>xlab=’x’</strong> : label on x-axis of plot (string); if <strong>values</strong> is a Monitor, Monitor <em>tlab</em> is taken</li>
<li><strong>ylab=’y’</strong> : label on y-axis of plot (string); if <strong>values</strong> is a Monitor, Monitor <em>ylab</em> is taken</li>
<li><strong>xaxis=’automatic’</strong> : layout of x-axis (None = omit x-axis; ‘automatic’ = make x-axis at least long enough to include all x-values, using round values; ‘minimal’ = have x-axis go <em>exactly</em> from minimal to maximal x-value provided; tuple (xlow,xhigh) = have x-axis go from xlow to xhigh)</li>
<li><strong>yaxis=’automatic’</strong> : layout of y-axis (None = omit y-axis; ‘automatic’ = make y-axis at least long enough to include all y-values, using round values; ‘minimal’ = have y-axis go <em>exactly</em> from minimal to maximal y-value provided; tuple (ylow,yhigh) = have y-axis go from ylow to yhigh)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to <em>GraphBase</em> object which contains the plot.</dd>
</dl>
</div>
<div class="section" id="plothistogram">
<h3>plotHistogram<a class="headerlink" href="#plothistogram" title="Permalink to this headline">¶</a></h3>
<p>Generates a histogram plot from a Histogram or a Histogram-like list or tuple.
A SimPy Histogram instance is a list with items of two elements. It has
n+2 bins of equal width, sorted by the first element, containing integer values
== the counts of the bins. The first bin is the ‘under’ bin, the last the
‘over’ bin.
Histogram objects are produced from Monitor objects by calling the Monitor
method <em>histogram()</em>.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><p class="first"><strong><SimPlotInstance>.plotHistogram(values[,optional parameters])</strong></p>
<p class="last"><strong><variable> = <SimPlotInstance>.plotHistogram(values[,optional parameters])</strong></p>
</dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples), or a Monitor instance</li>
</ul>
</dd>
<dt>Optional parameters with defaults:</dt>
<dd><ul class="first last simple">
<li><strong>windowsize=(500,300)</strong> : the plotting window size in pixels (tuple)</li>
<li><strong>title=’‘</strong> : the plot title (string); if <strong>values</strong> is a Monitor, Monitor name is used if no <strong>title</strong> given</li>
<li><strong>width=1</strong> : line drawing width (integer or floating point)</li>
<li><strong>color=’black’</strong> : line colour (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>background=’white’</strong> : colour of plot background (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>xlab=’x’</strong> : label on x-axis of plot (string)</li>
<li><strong>ylab=’y’</strong> : label on y-axis of plot (string)</li>
<li><strong>xaxis=’automatic’</strong> : layout of x-axis (None = omit x-axis; ‘automatic’ = make x-axis at least long enough to include all x-values, using round values; ‘minimal’ = have x-axis go <em>exactly</em> from minimal to maximal x-value provided; tuple (xlow,xhigh) = have x-axis go from xlow to xhigh)</li>
<li><strong>yaxis=’automatic’</strong> : layout of y-axis (None = omit y-axis; ‘automatic’ = make y-axis at least long enough to include all y-values, using round values; ‘minimal’ = have y-axis go <em>exactly</em> from minimal to maximal y-value provided; tuple (ylow,yhigh) = have y-axis go from ylow to yhigh)</li>
</ul>
</dd>
</dl>
</div>
<div class="section" id="plotscatter">
<h3>plotScatter<a class="headerlink" href="#plotscatter" title="Permalink to this headline">¶</a></h3>
<p>Generates a scatter diagram plot from a list of tuples (or lists) or from a Monitor.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><p class="first"><strong><SimPlotInstance>.plotScatter(values[,optional parameters])</strong></p>
<p class="last"><strong>variable = <SimPlotInstance>. plotScatter(values[,optional parameters])</strong></p>
</dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples), or a Monitor instance</li>
</ul>
</dd>
<dt>Optional parameters with defaults:</dt>
<dd><ul class="first last simple">
<li><strong>windowsize=(500,300),</strong> : the plotting window size in pixels (tuple)</li>
<li><strong>title=’‘</strong> : the plot title (string); if <strong>values</strong> is a Monitor, Monitor name is used if no <strong>title</strong> given</li>
<li><strong>marker=’circle’</strong> : symbol type (literal; values supported: ‘circle, ‘dot’, ‘square’, ‘triangle, ‘triangle_down’, ‘cross’, ‘plus’)</li>
<li><strong>width=1</strong> : line drawing width (integer or floating point)</li>
<li><strong>color=’black’</strong> : line colour (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillcolor=’black’</strong> : colour with which bars are filled (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillstyle=’‘</strong> : density of fill (default=100%; Tkinter bitmap)</li>
<li><strong>outline=’black’</strong> : colour of marker outline ((Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>background=’white’</strong> : colour of plot background (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>xlab=’x’</strong> : label on x-axis of plot (string); if <strong>values</strong> is a Monitor, Monitor <em>tlab</em> is taken</li>
<li><strong>ylab=’y’</strong> : label on y-axis of plot (string); if <strong>values</strong> is a Monitor, Monitor <em>ylab</em> is taken</li>
<li><strong>xaxis=’automatic’</strong> : layout of x-axis (None = omit x-axis; ‘automatic’ = make x-axis at least long enough to include all x-values, using round values; ‘minimal’ = have x-axis go <em>exactly</em> from minimal to maximal x-value provided; tuple (xlow,xhigh) = have x-axis go from xlow to xhigh)</li>
<li><strong>yaxis=’automatic’</strong> : layout of y-axis (None = omit y-axis; ‘automatic’ = make y-axis at least long enough to include all y-values, using round values; ‘minimal’ = have y-axis go <em>exactly</em> from minimal to maximal y-value provided; tuple (ylow,yhigh) = have y-axis go from ylow to yhigh)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to <em>GraphBase</em> object which contains the plot.</dd>
</dl>
</div>
<div class="section" id="postscr">
<h3>postscr<a class="headerlink" href="#postscr" title="Permalink to this headline">¶</a></h3>
<p>Saves Postscript output from a plot to a file. After e.g. <tt class="docutils literal"><span class="pre">aPlot=plotLine([0,1],[3,4])</span></tt>, <tt class="docutils literal"><span class="pre">aPlot.postscr("c:\\myplot.ps")</span></tt>
outputs the line plot in Postscript to file c:\myplot.ps.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><plotinstance>.postscr([optional parameter])</strong> (with <plotinstance> being a reference to the <em>GraphBase</em> object which contains the plot)</dd>
<dt>Mandatory parameters:</dt>
<dd>None.</dd>
<dt>Optional parameters with defaults:</dt>
<dd><ul class="first last simple">
<li><strong>“<filename>”</strong> : name of file (complete path) to which Postscript output is written. If omitted, a dialog asking the user for a filename pops up.</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>None.</dd>
</dl>
</div>
</div>
<div class="section" id="advanced-plotting-api">
<h2><a class="toc-backref" href="#id7">Advanced plotting API</a><a class="headerlink" href="#advanced-plotting-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id1">
<h3>Overview<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<p>The advanced SimPlot API is more verbose than the simple one, but it offers more flexibility and power. The detailed structure of a program using that API is:</p>
<ol class="arabic simple">
<li>make an instance of SimPlot (this initializes Tk and generates a Tk Toplevel container <instance>.root which points at the Tk object.)</li>
<li>(optional) make other Tk container(s)</li>
<li>(optional) give the container a title</li>
<li>make one or more plot objects (the lines or other figures to plot)</li>
<li>put the plot objects into a GraphObject (this does the necessary scaling)</li>
<li>make a Tk container (e.g. a Frame widget) in the previous container (from step 1 or 2)</li>
<li>make a background (with title, axes, frame, etc.) in that container for the GraphObject to be drawn against (i.e., create the graph widget and associate the GraphObject with it)</li>
<li>instruct the Tk geometry manager (pack or grid) where to put the background in the Tk container</li>
<li>draw the GraphObject against the background</li>
<li>instruct the Tk geometry manager concerning the container from step 6</li>
<li>(optional) save plot as Postscript file</li>
<li>start the Tk mainloop</li>
</ol>
<p>An example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># AdvancedAPI.py</span>
<span class="kn">from</span> <span class="nn">SimPy.</span> <span class="nn">SimPlot</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">plt</span><span class="o">=</span><span class="n">SimPlot</span><span class="p">()</span> <span class="c"># step 1</span>
<span class="n">plt</span><span class="o">.</span><span class="n">root</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s">"Advanced API example"</span><span class="p">)</span> <span class="c"># step 3</span>
<span class="n">line</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">makeLine</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">42</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">4</span><span class="p">,</span><span class="mi">16</span><span class="p">]])</span> <span class="c"># step 4</span>
<span class="n">bar</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">makeBars</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span><span class="mi">42</span><span class="p">],[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">],[</span><span class="mi">4</span><span class="p">,</span><span class="mi">16</span><span class="p">]],</span>
<span class="n">color</span><span class="o">=</span><span class="s">'blue'</span><span class="p">)</span> <span class="c"># step 4</span>
<span class="n">sym</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">makeSymbols</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">]],</span><span class="n">marker</span><span class="o">=</span><span class="s">"triangle"</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span><span class="n">fillcolor</span><span class="o">=</span><span class="s">"red"</span><span class="p">)</span> <span class="c"># step 4</span>
<span class="n">obj</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">makeGraphObjects</span><span class="p">([</span><span class="n">line</span><span class="p">,</span><span class="n">bar</span><span class="p">,</span><span class="n">sym</span><span class="p">])</span> <span class="c"># step 5</span>
<span class="n">frame</span><span class="o">=</span><span class="n">Frame</span><span class="p">(</span><span class="n">plt</span><span class="o">.</span><span class="n">root</span><span class="p">)</span> <span class="c"># step 6</span>
<span class="n">graph</span><span class="o">=</span><span class="n">plt</span><span class="o">.</span><span class="n">makeGraphBase</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span><span class="mi">500</span><span class="p">,</span><span class="mi">300</span><span class="p">,</span>
<span class="n">title</span><span class="o">=</span><span class="s">"Line and bars"</span><span class="p">)</span> <span class="c"># step 7</span>
<span class="n">graph</span><span class="o">.</span><span class="n">pack</span><span class="p">()</span> <span class="c"># step 8</span>
<span class="n">graph</span><span class="o">.</span><span class="n">draw</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> <span class="c"># step 9</span>
<span class="n">frame</span><span class="o">.</span><span class="n">pack</span><span class="p">()</span> <span class="c"># step 10</span>
<span class="n">graph</span><span class="o">.</span><span class="n">postscr</span><span class="p">()</span> <span class="c"># step 11</span>
<span class="n">plt</span><span class="o">.</span><span class="n">mainloop</span><span class="p">()</span> <span class="c"># step 12</span>
</pre></div>
</div>
<p>Which generates:</p>
<img alt="../../_images/AdvancedAPI.png" src="../../_images/AdvancedAPI.png" />
<p>Clearly, this level API is more verbose, but allows putting several diagrams with different
plot types into one plot, or putting putting several plots into one frame (side by side, vertically,
or in table fashion).</p>
</div>
<div class="section" id="title">
<h3>title<a class="headerlink" href="#title" title="Permalink to this headline">¶</a></h3>
<p>Assign a title to appear in the container’s title bar. (This is a method exposed by a Tk Toplevel container.)</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><rootInstance>.title(title)</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>title</strong> : the title to appear in the container’s title bar (string)</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd>None.</dd>
<dt>Return value:</dt>
<dd>None.</dd>
</dl>
</div>
<div class="section" id="makeline">
<h3>makeLine<a class="headerlink" href="#makeline" title="Permalink to this headline">¶</a></h3>
<p>Generates a line plot object from a list of tuples (or lists).</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeLine(values[,optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples)</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>color = ‘black’</strong> : line colour (Tk colour value)</li>
<li><strong>width = 1</strong> : line width (integer or float)</li>
<li><strong>smooth = False</strong> : smooth line if True (boolean)</li>
<li><strong>splinesteps = 12</strong> : number of spline steps for smoothing line (integer); the higher, the better the line follows the points provided</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to a line plot object (GraphLine)</dd>
</dl>
</div>
<div class="section" id="makestep">
<h3>makeStep<a class="headerlink" href="#makestep" title="Permalink to this headline">¶</a></h3>
<p>Generates a line plot object from a list of tuples (or lists).
A horizontal line is generated at a y-value until y changes, creating a step effect.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeStep(values[,optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples)</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>color = ‘black’</strong> : line colour (Tk colour value)</li>
<li><strong>width = 1</strong> : line width (integer or float)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to a line plot object (GraphLine)</dd>
</dl>
</div>
<div class="section" id="makesymbols">
<h3>makeSymbols<a class="headerlink" href="#makesymbols" title="Permalink to this headline">¶</a></h3>
<p>Generates a scatter diagram plot object with markers from a list of tuples (or lists).</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeSymbols(values[,optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples)</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>marker=’circle’</strong> : symbol type (literal; values supported: ‘circle, ‘dot’, ‘square’, ‘triangle, ‘triangle_down’, ‘cross’, ‘plus’)</li>
<li><strong>width=1</strong> : line drawing width (integer or floating point)</li>
<li><strong>color=’black’</strong> : line colour (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillcolor=’black’</strong> : colour with which bars are filled (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillstyle=’‘</strong> : density of fill (default=100%; Tkinter bitmap)</li>
<li><strong>outline=’black’</strong> : colour of marker outline ((Tkinter colour type; see section on Colours in SimPlot)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to a scatter plot object (GraphSymbols)</dd>
</dl>
</div>
<div class="section" id="makebars">
<h3>makeBars<a class="headerlink" href="#makebars" title="Permalink to this headline">¶</a></h3>
<p>Generates a bar chart plot object with markers from a list of tuples (or lists).</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeBars(values[,optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a list of two-element lists (or tuples)</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>width=1</strong> : width of bars (integer or floating point)</li>
<li><strong>color=’black’</strong> : bar colour (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillcolor=’black’</strong> : colour with which bars are filled (Tkinter colour type; see section on Colours in SimPlot)</li>
<li><strong>fillstyle=’‘</strong> : density of fill (default=100%; Tkinter bitmap)</li>
<li><strong>outline=’black”</strong> : colour of bar outline ((Tkinter colour type; see section on Colours in SimPlot)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to a bar chart plot object (GraphSymbols)</dd>
</dl>
</div>
<div class="section" id="makehistogram">
<h3>makeHistogram<a class="headerlink" href="#makehistogram" title="Permalink to this headline">¶</a></h3>
<p>Generates a histogram plot from a Histogram or a Histogram-like list or tuple.
A SimPy Histogram instance is a list with items of two elements. It has
n+2 bins of equal width, sorted by the first element, containing integer values
== the counts of the bins. The first bin is the ‘under’ bin, the last the
‘over’ bin.
Histogram objects are produced from Monitor objects by calling the Monitor
method <em>histogram()</em>.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeBars(values[,optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>values</strong> : a Histogram-like object</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>width=1</strong> : width of line (integer or floating point)</li>
<li><strong>color=’black’</strong> : line colour (Tkinter colour type; see section on Colours in SimPlot)</li>
</ul>
</dd>
</dl>
</div>
<div class="section" id="makegraphobjects">
<h3>makeGraphObjects<a class="headerlink" href="#makegraphobjects" title="Permalink to this headline">¶</a></h3>
<p>Combines one or mor plot objects into one plottable GraphObject.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeGraphObjects(list_of_plotObjects)</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>list_of_plotObjects</strong> : a list of plot objects</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd>None</dd>
<dt>Return value:</dt>
<dd>Reference to a GraphObject</dd>
</dl>
</div>
<div class="section" id="makegraphbase">
<h3>makeGraphBase<a class="headerlink" href="#makegraphbase" title="Permalink to this headline">¶</a></h3>
<p>Generates a canvas widget in its Tk container widget (such as a Frame) with the plot’s background (title, axes, axis labels).</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><variable> = <SimPlotInstance>.makeGraphBase(master, width, height [,optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>master</strong> : container widget for graph widget</li>
<li><strong>width</strong> : width of graph widget in pixels (positive integer)</li>
<li><strong>height</strong> : height of graph widget in pixels (positive integer)</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>background=’white’</strong> : colour of plot background (Tk colour value)</li>
<li><strong>title=”“</strong> : title of plot (string)</li>
<li><strong>xtitle=’‘</strong> : label on x-axis (string)</li>
<li><strong>ytitle=’‘</strong> : label on y-axis (string)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>Reference to a GraphBase object (graph widget)</dd>
</dl>
</div>
<div class="section" id="pack">
<h3>pack<a class="headerlink" href="#pack" title="Permalink to this headline">¶</a></h3>
<p>Controls how graph widget is arranged in its master container.
(Inherited from Tk Packer geometry manager.)</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><GraphBaseInstance>.pack([optional parameters])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd>None.</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>side</strong> : where to place graph widget (side=LEFT: to the left; side=TOP: at the top; Tk Packer literals)</li>
<li><strong>fill</strong> : controls whether graph fills available space in window (fill=BOTH: fills in both directions; fill=X: horizontal stretching; fill=Y: vertical stretching)</li>
<li><strong>expand=NO</strong> : controls whether Packer expands graph widget when window is resized (expand=TRUE: widget may expand to fill available space)</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>None</dd>
</dl>
</div>
<div class="section" id="draw">
<h3>draw<a class="headerlink" href="#draw" title="Permalink to this headline">¶</a></h3>
<p>Draws the plot background and the lines/curves in it.</p>
<p>Call:</p>
<blockquote>
<div><strong><GraphBaseInstance>.draw(graph,[optional parameters])</strong></div></blockquote>
<dl class="docutils">
<dt>Mandatory parameters:</dt>
<dd><ul class="first last simple">
<li><strong>graphics</strong> : graph widget (GraphBase) instance</li>
</ul>
</dd>
<dt>Optional parameters:</dt>
<dd><ul class="first last simple">
<li><strong>xaxis=’automatic’</strong> : controls appearance of x-axis (None: no x-axis; “minimal”: axis runs exactly from minimal to maximal x-value; “automatic” : x-axis starts at 0 and includes maximal x-value; tuple (xlow,xhigh) = have x-axis go from xlow to xhigh)</li>
<li><strong>yaxis=’automatic’</strong> : controls appearance of y-axis (None: no y-axis;”minimal”: axis runs exactly from minimal to maximal y-value; “automatic” : y-axis starts at 0 and includes maximal y-value; tuple (ylow,yhigh) = have y-axis go from ylow to yhigh</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>None</dd>
</dl>
</div>
<div class="section" id="id2">
<h3>postscr<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<p>After call to draw , saves Postscript output from a plot to a file.</p>
<dl class="docutils">
<dt>Call:</dt>
<dd><strong><GraphBaseInstance>.postscr([optional parameter])</strong></dd>
<dt>Mandatory parameters:</dt>
<dd>None.</dd>
<dt>Optional parameters with defaults:</dt>
<dd><ul class="first last simple">
<li><strong>“filename”</strong> : name of file (complete path) to which Postscript output is written. If omitted, a dialog asking the user for a filename pops up.</li>
</ul>
</dd>
<dt>Return value:</dt>
<dd>None.</dd>
</dl>
</div>
</div>
<div class="section" id="colours-in-simplot">
<h2><a class="toc-backref" href="#id8">Colours in SimPlot</a><a class="headerlink" href="#colours-in-simplot" title="Permalink to this headline">¶</a></h2>
<p>Colours in SimPlot are defined by Tk. The Tk colour model is RGB. The simplest way to identify a colour
is to use one of the hundreds of Tk-defined literals such as “black”, “aquamarine”, or even “BlanchedAlmond”.
See the <a class="reference external" href="../../_static/Tkcolors.htm">Tk colour page</a> for definitions.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/sm_SimPy_Logo.png" alt="Logo"/>
</a></p>
<h3><a href="../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">SimPlot Manual</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#plotting-with-simplot-an-overview">Plotting with SimPlot - an overview</a><ul>
<li><a class="reference internal" href="#plot-types-and-capabilities">Plot types and capabilities</a><ul>
<li><a class="reference internal" href="#plotting-monitor-instances">Plotting Monitor instances</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#simple-plotting-api">Simple plotting API</a><ul>
<li><a class="reference internal" href="#overview">Overview</a></li>
<li><a class="reference internal" href="#simplot">SimPlot</a></li>
<li><a class="reference internal" href="#plotline">plotLine</a></li>
<li><a class="reference internal" href="#plotstep">plotStep</a></li>
<li><a class="reference internal" href="#plotbars">plotBars</a></li>
<li><a class="reference internal" href="#plothistogram">plotHistogram</a></li>
<li><a class="reference internal" href="#plotscatter">plotScatter</a></li>
<li><a class="reference internal" href="#postscr">postscr</a></li>
</ul>
</li>
<li><a class="reference internal" href="#advanced-plotting-api">Advanced plotting API</a><ul>
<li><a class="reference internal" href="#id1">Overview</a></li>
<li><a class="reference internal" href="#title">title</a></li>
<li><a class="reference internal" href="#makeline">makeLine</a></li>
<li><a class="reference internal" href="#makestep">makeStep</a></li>
<li><a class="reference internal" href="#makesymbols">makeSymbols</a></li>
<li><a class="reference internal" href="#makebars">makeBars</a></li>
<li><a class="reference internal" href="#makehistogram">makeHistogram</a></li>
<li><a class="reference internal" href="#makegraphobjects">makeGraphObjects</a></li>
<li><a class="reference internal" href="#makegraphbase">makeGraphBase</a></li>
<li><a class="reference internal" href="#pack">pack</a></li>
<li><a class="reference internal" href="#draw">draw</a></li>
<li><a class="reference internal" href="#id2">postscr</a></li>
</ul>
</li>
<li><a class="reference internal" href="#colours-in-simplot">Colours in SimPlot</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="../../SimPy_Tools.html"
title="previous chapter">SimPy Tools</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../GUIManual/SimGUImanual.html"
title="next chapter">SimGUI Manual</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/Manuals/PlotManual/ManualPlotting.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../GUIManual/SimGUImanual.html" title="SimGUI Manual"
>next</a> |</li>
<li class="right" >
<a href="../../SimPy_Tools.html" title="SimPy Tools"
>previous</a> |</li>
<li><a href="../../index.html">SimPy 2.3.1 documentation</a> »</li>
<li><a href="../../SimPy_Tools.html" >SimPy Tools</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2002-2011, Klaus Müller, Tony Vignaux, Ontje Lünsdorf, Stefan Scherfke.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
|