/usr/share/doc/python-pyx-doc/html/graph.html is in python-pyx-doc 0.11.1-2.
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 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | <!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>Graphs — PyX v0.11.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: '0.11.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="PyX v0.11.1 documentation" href="index.html" />
<link rel="next" title="Axes" href="axis.html" />
<link rel="prev" title="Module text: TeX/LaTeX interface" href="text.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="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="axis.html" title="Axes"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="text.html" title="Module text: TeX/LaTeX interface"
accesskey="P">previous</a> |</li>
<li><a href="manual.html">PyX v0.11.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<span class="target" id="module-graph"></span><div class="section" id="graphs">
<h1>Graphs<a class="headerlink" href="#graphs" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>PyX can be used for data and function plotting. At present x-y-graphs and
x-y-z-graphs are supported only. However, the component architecture of the
graph system described in section <a class="reference internal" href="#graph-components"><em>Component architecture</em></a> allows for additional
graph geometries while reusing most of the existing components.</p>
<p>Creating a graph splits into two basic steps. First you have to create a graph
instance. The most simple form would look like:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">pyx</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">g</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">graphxy</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="mi">8</span><span class="p">)</span>
</pre></div>
</div>
<p>The graph instance <tt class="docutils literal"><span class="pre">g</span></tt> created in this example can then be used to actually
plot something into the graph. Suppose you have some data in a file
<tt class="file docutils literal"><span class="pre">graph.dat</span></tt> you want to plot. The content of the file could look like:</p>
<div class="highlight-python"><pre>1 2
2 3
3 8
4 13
5 18
6 21
</pre>
</div>
<p>To plot these data into the graph <tt class="docutils literal"><span class="pre">g</span></tt> you must perform:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">graph</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">file</span><span class="p">(</span><span class="s">"graph.dat"</span><span class="p">,</span> <span class="n">x</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="mi">2</span><span class="p">))</span>
</pre></div>
</div>
<p>The method <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> takes the data to be plotted and optionally a list of
graph styles to be used to plot the data. When no styles are provided, a default
style defined by the data instance is used. For data read from a file by an
instance of <a class="reference internal" href="#graph.data.file" title="graph.data.file"><tt class="xref py py-class docutils literal"><span class="pre">graph.data.file</span></tt></a>, the default are symbols. When
instantiating <a class="reference internal" href="#graph.data.file" title="graph.data.file"><tt class="xref py py-class docutils literal"><span class="pre">graph.data.file</span></tt></a>, you not only specify the file name, but
also a mapping from columns to axis names and other information the styles might
make use of (<em>e.g.</em> data for error bars to be used by the errorbar style).</p>
<p>While the graph is already created by that, we still need to perform a write of
the result into a file. Since the graph instance is a canvas, we can just call
its <tt class="xref py py-meth docutils literal"><span class="pre">writeEPSfile()</span></tt> method.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span><span class="o">.</span><span class="n">writeEPSfile</span><span class="p">(</span><span class="s">"graph"</span><span class="p">)</span>
</pre></div>
</div>
<p>The result <tt class="file docutils literal"><span class="pre">graph.eps</span></tt> is shown in figure <a class="reference internal" href="#fig-graph"><em>A minimalistic plot for the data from file graph.dat.</em></a>.</p>
<div class="figure align-center" id="fig-graph">
<img alt="_images/graph.png" src="_images/graph.png" />
<p class="caption">A minimalistic plot for the data from file <tt class="file docutils literal"><span class="pre">graph.dat</span></tt>.</p>
</div>
<p>Instead of plotting data from a file, other data source are available as well.
For example function data is created and placed into <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> by the
following line:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">graph</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">function</span><span class="p">(</span><span class="s">"y(x)=x**2"</span><span class="p">))</span>
</pre></div>
</div>
<p>You can plot different data in a single graph by calling <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> several
times before <tt class="xref py py-meth docutils literal"><span class="pre">writeEPSfile()</span></tt> or <tt class="xref py py-meth docutils literal"><span class="pre">writePDFfile()</span></tt>. Note that a calling
<tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> will fail once a graph was forced to “finish” itself. This happens
automatically, when the graph is written to a file. Thus it is not an option to
call <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> after <tt class="xref py py-meth docutils literal"><span class="pre">writeEPSfile()</span></tt> or <tt class="xref py py-meth docutils literal"><span class="pre">writePDFfile()</span></tt>. The topic
of the finalization of a graph is addressed in more detail in section
<a class="reference internal" href="#module-graph.graph" title="graph.graph"><tt class="xref py py-mod docutils literal"><span class="pre">graph.graph</span></tt></a>. As you can see in figure <a class="reference internal" href="#fig-graph2"><em>Plotting data from a file together with a function.</em></a>, a function is
plotted as a line by default.</p>
<div class="figure align-center" id="fig-graph2">
<img alt="_images/graph2.png" src="_images/graph2.png" />
<p class="caption">Plotting data from a file together with a function.</p>
</div>
<p>While the axes ranges got adjusted automatically in the previous example, they
might be fixed by keyword options in axes constructors. Plotting only a function
will need such a setting at least in the variable coordinate. The following code
also shows how to set a logathmic axis in y-direction:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">pyx</span> <span class="kn">import</span> <span class="o">*</span>
<span class="n">g</span> <span class="o">=</span> <span class="n">graph</span><span class="o">.</span><span class="n">graphxy</span><span class="p">(</span><span class="n">width</span><span class="o">=</span><span class="mi">8</span><span class="p">,</span> <span class="n">x</span><span class="o">=</span><span class="n">graph</span><span class="o">.</span><span class="n">axis</span><span class="o">.</span><span class="n">linear</span><span class="p">(</span><span class="nb">min</span><span class="o">=-</span><span class="mi">5</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="mi">5</span><span class="p">),</span>
<span class="n">y</span><span class="o">=</span><span class="n">graph</span><span class="o">.</span><span class="n">axis</span><span class="o">.</span><span class="n">logarithmic</span><span class="p">())</span>
<span class="n">g</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">graph</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">function</span><span class="p">(</span><span class="s">"y(x)=exp(x)"</span><span class="p">))</span>
<span class="n">g</span><span class="o">.</span><span class="n">writeEPSfile</span><span class="p">(</span><span class="s">"graph3"</span><span class="p">)</span>
<span class="n">g</span><span class="o">.</span><span class="n">writePDFfile</span><span class="p">(</span><span class="s">"graph3"</span><span class="p">)</span>
</pre></div>
</div>
<p>The result is shown in figure <a class="reference internal" href="#fig-graph3"><em>Plotting a function for a given axis range and use a logarithmic y-axis.</em></a>.</p>
<div class="figure align-center" id="fig-graph3">
<img alt="_images/graph3.png" src="_images/graph3.png" />
<p class="caption">Plotting a function for a given axis range and use a logarithmic y-axis.</p>
</div>
</div>
<div class="section" id="component-architecture">
<span id="graph-components"></span><h2>Component architecture<a class="headerlink" href="#component-architecture" title="Permalink to this headline">¶</a></h2>
<p>Creating a graph involves a variety of tasks, which thus can be separated into
components without significant additional costs. This structure manifests itself
also in the PyX source, where there are different modules for the different
tasks. They interact by some well-defined interfaces. They certainly have to be
completed and stabilized in their details, but the basic structure came up in
the continuous development quite clearly. The basic parts of a graph are:</p>
<dl class="docutils">
<dt>graph</dt>
<dd>Defines the geometry of the graph by means of graph coordinates with range
[0:1]. Keeps lists of plotted data, axes <em>etc.</em></dd>
<dt>data</dt>
<dd>Produces or prepares data to be plotted in graphs.</dd>
<dt>style</dt>
<dd>Performs the plotting of the data into the graph. It gets data, converts them
via the axes into graph coordinates and uses the graph to finally plot the data
with respect to the graph geometry methods.</dd>
<dt>key</dt>
<dd>Responsible for the graph keys.</dd>
<dt>axis</dt>
<dd>Creates axes for the graph, which take care of the mapping from data values to
graph coordinates. Because axes are also responsible for creating ticks and
labels, showing up in the graph themselves and other things, this task is
splitted into several independent subtasks. Axes are discussed separately in
chapter <tt class="xref py py-mod docutils literal"><span class="pre">axis</span></tt>.</dd>
</dl>
<span class="target" id="module-graph.graph"></span></div>
<div class="section" id="module-graph-graph-graph-geometry">
<h2>Module <a class="reference internal" href="#module-graph.graph" title="graph.graph"><tt class="xref py py-mod docutils literal"><span class="pre">graph.graph</span></tt></a>: Graph geometry<a class="headerlink" href="#module-graph-graph-graph-geometry" title="Permalink to this headline">¶</a></h2>
<p>The classes <a class="reference internal" href="#graph.graph.graphxy" title="graph.graph.graphxy"><tt class="xref py py-class docutils literal"><span class="pre">graphxy</span></tt></a> and <a class="reference internal" href="#graph.graph.graphxyz" title="graph.graph.graphxyz"><tt class="xref py py-class docutils literal"><span class="pre">graphxyz</span></tt></a> are part of the module
<a class="reference internal" href="#module-graph.graph" title="graph.graph"><tt class="xref py py-mod docutils literal"><span class="pre">graph.graph</span></tt></a>. However, there are shortcuts to access the classes via
<tt class="docutils literal"><span class="pre">graph.graphxy</span></tt> and <tt class="docutils literal"><span class="pre">graph.graphxyz</span></tt>, respectively.</p>
<dl class="class">
<dt id="graph.graph.graphxy">
<em class="property">class </em><tt class="descclassname">graph.graph.</tt><tt class="descname">graphxy</tt><big>(</big><em>xpos=0</em>, <em>ypos=0</em>, <em>width=None</em>, <em>height=None</em>, <em>ratio=goldenmean</em>, <em>key=None</em>, <em>backgroundattrs=None</em>, <em>axesdist=0.8*unit.v_cm</em>, <em>xaxisat=None</em>, <em>yaxisat=None</em>, <em>**axes</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy" title="Permalink to this definition">¶</a></dt>
<dd><p>This class provides an x-y-graph. A graph instance is also a fully functional
canvas.</p>
<p>The position of the graph on its own canvas is specified by <em>xpos</em> and <em>ypos</em>.
The size of the graph is specified by <em>width</em>, <em>height</em>, and <em>ratio</em>. These
parameters define the size of the graph area not taking into account the
additional space needed for the axes. Note that you have to specify at least
<em>width</em> or <em>height</em>. <em>ratio</em> will be used as the ratio between <em>width</em> and
<em>height</em> when only one of these is provided.</p>
<p><em>key</em> can be set to a <a class="reference internal" href="#graph.key.key" title="graph.key.key"><tt class="xref py py-class docutils literal"><span class="pre">graph.key.key</span></tt></a> instance to create an automatic
graph key. <tt class="xref docutils literal"><span class="pre">None</span></tt> omits the graph key.</p>
<p><em>backgroundattrs</em> is a list of attributes for drawing the background of the
graph. Allowed are decorators, strokestyles, and fillstyles. <tt class="xref docutils literal"><span class="pre">None</span></tt> disables
background drawing.</p>
<p><em>axisdist</em> is the distance between axes drawn at the same side of a graph.</p>
<p><em>xaxisat</em> and <em>yaxisat</em> specify a value at the y and x axis, where the
corresponding axis should be moved to. It’s a shortcut for corresonding calls of
<a class="reference internal" href="#graph.graph.graphxy.axisatv" title="graph.graph.graphxy.axisatv"><tt class="xref py py-meth docutils literal"><span class="pre">axisatv()</span></tt></a> described below. Moving an axis by <em>xaxisat</em> or <em>yaxisat</em>
disables the automatic creation of a linked axis at the opposite side of the
graph.</p>
<p><em>**axes</em> receives axes instances. Allowed keywords (axes names) are <tt class="docutils literal"><span class="pre">x</span></tt>,
<tt class="docutils literal"><span class="pre">x2</span></tt>, <tt class="docutils literal"><span class="pre">x3</span></tt>, <em>etc.</em> and <tt class="docutils literal"><span class="pre">y</span></tt>, <tt class="docutils literal"><span class="pre">y2</span></tt>, <tt class="docutils literal"><span class="pre">y3</span></tt>, <em>etc.</em> When not providing an
<tt class="docutils literal"><span class="pre">x</span></tt> or <tt class="docutils literal"><span class="pre">y</span></tt> axis, linear axes instances will be used automatically. When not
providing a <tt class="docutils literal"><span class="pre">x2</span></tt> or <tt class="docutils literal"><span class="pre">y2</span></tt> axis, linked axes to the <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt> axes are
created automatically and <em>vice versa</em>. As an exception, a linked axis is not
created automatically when the axis is placed at a specific position by
<em>xaxisat</em> or <em>yaxisat</em>. You can disable the automatic creation of axes by
setting the linked axes to <tt class="xref docutils literal"><span class="pre">None</span></tt>. The even numbered axes are plotted at the
top (<tt class="docutils literal"><span class="pre">x</span></tt> axes) and right (<tt class="docutils literal"><span class="pre">y</span></tt> axes) while the others are plotted at the
bottom (<tt class="docutils literal"><span class="pre">x</span></tt> axes) and left (<tt class="docutils literal"><span class="pre">y</span></tt> axes) in ascending order each.</p>
</dd></dl>
<p>Some instance attributes might be useful for outside read-access. Those are:</p>
<dl class="attribute">
<dt id="graph.graph.graphxy.axes">
<tt class="descclassname">graphxy.</tt><tt class="descname">axes</tt><a class="headerlink" href="#graph.graph.graphxy.axes" title="Permalink to this definition">¶</a></dt>
<dd><p>A dictionary mapping axes names to the <tt class="xref py py-class docutils literal"><span class="pre">anchoredaxis</span></tt> instances.</p>
</dd></dl>
<p>To actually plot something into the graph, the following instance method
<tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> is provided:</p>
<dl class="method">
<dt id="graph.graph.graphxy.plot">
<tt class="descclassname">graphxy.</tt><tt class="descname">plot</tt><big>(</big><em>data</em>, <em>styles=None</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.plot" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds <em>data</em> to the list of data to be plotted. Sets <em>styles</em> to be used for
plotting the data. When <em>styles</em> is <tt class="xref docutils literal"><span class="pre">None</span></tt>, the default styles for the data as
provided by <em>data</em> is used.</p>
<p><em>data</em> should be an instance of any of the data described in section
<a class="reference internal" href="#module-graph.data" title="graph.data"><tt class="xref py py-mod docutils literal"><span class="pre">graph.data</span></tt></a>.</p>
<p>When the same combination of styles (<em>i.e.</em> the same references) are used
several times within the same graph instance, the styles are kindly asked by the
graph to iterate their appearance. Its up to the styles how this is performed.</p>
<p>Instead of calling the plot method several times with different <em>data</em> but the
same style, you can use a list (or something iterateable) for <em>data</em>.</p>
</dd></dl>
<p>While a graph instance only collects data initially, at a certain point it must
create the whole plot. Once this is done, further calls of <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> will
fail. Usually you do not need to take care about the finalization of the graph,
because it happens automatically once you write the plot into a file. However,
sometimes position methods (described below) are nice to be accessible. For
that, at least the layout of the graph must have been finished. By calling the
<tt class="xref py py-meth docutils literal"><span class="pre">do()</span></tt>-methods yourself you can also alter the order in which the graph
components are plotted. Multiple calls to any of the <tt class="xref py py-meth docutils literal"><span class="pre">do()</span></tt>-methods have
no effect (only the first call counts). The orginal order in which the
<tt class="xref py py-meth docutils literal"><span class="pre">do()</span></tt>-methods are called is:</p>
<dl class="method">
<dt id="graph.graph.graphxy.dolayout">
<tt class="descclassname">graphxy.</tt><tt class="descname">dolayout</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.dolayout" title="Permalink to this definition">¶</a></dt>
<dd><p>Fixes the layout of the graph. As part of this work, the ranges of the axes are
fitted to the data when the axes ranges are allowed to adjust themselves to the
data ranges. The other <tt class="xref py py-meth docutils literal"><span class="pre">do()</span></tt>-methods ensure, that this method is always
called first.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.dobackground">
<tt class="descclassname">graphxy.</tt><tt class="descname">dobackground</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.dobackground" title="Permalink to this definition">¶</a></dt>
<dd><p>Draws the background.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.doaxes">
<tt class="descclassname">graphxy.</tt><tt class="descname">doaxes</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.doaxes" title="Permalink to this definition">¶</a></dt>
<dd><p>Inserts the axes.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.doplotitem">
<tt class="descclassname">graphxy.</tt><tt class="descname">doplotitem</tt><big>(</big><em>plotitem</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.doplotitem" title="Permalink to this definition">¶</a></dt>
<dd><p>Plots the plotitem as returned by the graphs plot method.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.doplot">
<tt class="descclassname">graphxy.</tt><tt class="descname">doplot</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.doplot" title="Permalink to this definition">¶</a></dt>
<dd><p>Plots all (remaining) plotitems.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.dokeyitem">
<tt class="descclassname">graphxy.</tt><tt class="descname">dokeyitem</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.dokeyitem" title="Permalink to this definition">¶</a></dt>
<dd><p>Inserts a plotitem in the graph key as returned by the graphs plot method.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.dokey">
<tt class="descclassname">graphxy.</tt><tt class="descname">dokey</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.dokey" title="Permalink to this definition">¶</a></dt>
<dd><p>Inserts the graph key.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.finish">
<tt class="descclassname">graphxy.</tt><tt class="descname">finish</tt><big>(</big><big>)</big><a class="headerlink" href="#graph.graph.graphxy.finish" title="Permalink to this definition">¶</a></dt>
<dd><p>Finishes the graph by calling all pending <tt class="xref py py-meth docutils literal"><span class="pre">do()</span></tt>-methods. This is done
automatically, when the output is created.</p>
</dd></dl>
<p>The graph provides some methods to access its geometry:</p>
<dl class="method">
<dt id="graph.graph.graphxy.pos">
<tt class="descclassname">graphxy.</tt><tt class="descname">pos</tt><big>(</big><em>x</em>, <em>y</em>, <em>xaxis=None</em>, <em>yaxis=None</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.pos" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the given point at <em>x</em> and <em>y</em> as a tuple <tt class="docutils literal"><span class="pre">(xpos,</span> <span class="pre">ypos)</span></tt> at the graph
canvas. <em>x</em> and <em>y</em> are anchoredaxis instances for the two axes <em>xaxis</em> and
<em>yaxis</em>. When <em>xaxis</em> or <em>yaxis</em> are <tt class="xref docutils literal"><span class="pre">None</span></tt>, the axes with names <tt class="docutils literal"><span class="pre">x</span></tt> and
<tt class="docutils literal"><span class="pre">y</span></tt> are used. This method fails if called before <a class="reference internal" href="#graph.graph.graphxy.dolayout" title="graph.graph.graphxy.dolayout"><tt class="xref py py-meth docutils literal"><span class="pre">dolayout()</span></tt></a>.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.vpos">
<tt class="descclassname">graphxy.</tt><tt class="descname">vpos</tt><big>(</big><em>vx</em>, <em>vy</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.vpos" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the given point at <em>vx</em> and <em>vy</em> as a tuple <tt class="docutils literal"><span class="pre">(xpos,</span> <span class="pre">ypos)</span></tt> at the
graph canvas. <em>vx</em> and <em>vy</em> are graph coordinates with range [0:1].</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.vgeodesic">
<tt class="descclassname">graphxy.</tt><tt class="descname">vgeodesic</tt><big>(</big><em>vx1</em>, <em>vy1</em>, <em>vx2</em>, <em>vy2</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.vgeodesic" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the geodesic between points <em>vx1</em>, <em>vy1</em> and <em>vx2</em>, <em>vy2</em> as a path. All
parameters are in graph coordinates with range [0:1]. For <a class="reference internal" href="#graph.graph.graphxy" title="graph.graph.graphxy"><tt class="xref py py-class docutils literal"><span class="pre">graphxy</span></tt></a> this
is a straight line.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.vgeodesic_el">
<tt class="descclassname">graphxy.</tt><tt class="descname">vgeodesic_el</tt><big>(</big><em>vx1</em>, <em>vy1</em>, <em>vx2</em>, <em>vy2</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.vgeodesic_el" title="Permalink to this definition">¶</a></dt>
<dd><p>Like <a class="reference internal" href="#graph.graph.graphxy.vgeodesic" title="graph.graph.graphxy.vgeodesic"><tt class="xref py py-meth docutils literal"><span class="pre">vgeodesic()</span></tt></a> but this method returns the path element to connect the
two points.</p>
</dd></dl>
<p id="index-0">Further geometry information is available by the <tt class="xref py py-attr docutils literal"><span class="pre">axes</span></tt> instance variable,
with is a dictionary mapping axis names to <tt class="xref py py-class docutils literal"><span class="pre">anchoredaxis</span></tt> instances.
Shortcuts to the anchoredaxis positioner methods for the <tt class="docutils literal"><span class="pre">x</span></tt>- and <tt class="docutils literal"><span class="pre">y</span></tt>-axis become available after <tt class="xref py py-meth docutils literal"><span class="pre">dolayout()</span></tt> as <a class="reference internal" href="#graph.graph.graphxy" title="graph.graph.graphxy"><tt class="xref py py-class docutils literal"><span class="pre">graphxy</span></tt></a> methods
<tt class="docutils literal"><span class="pre">Xbasepath</span></tt>, <tt class="docutils literal"><span class="pre">Xvbasepath</span></tt>, <tt class="docutils literal"><span class="pre">Xgridpath</span></tt>, <tt class="docutils literal"><span class="pre">Xvgridpath</span></tt>, <tt class="docutils literal"><span class="pre">Xtickpoint</span></tt>,
<tt class="docutils literal"><span class="pre">Xvtickpoint</span></tt>, <tt class="docutils literal"><span class="pre">Xtickdirection</span></tt>, and <tt class="docutils literal"><span class="pre">Xvtickdirection</span></tt> where the prefix
<tt class="docutils literal"><span class="pre">X</span></tt> stands for <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt>.</p>
<dl class="method">
<dt id="graph.graph.graphxy.axistrafo">
<tt class="descclassname">graphxy.</tt><tt class="descname">axistrafo</tt><big>(</big><em>axis</em>, <em>t</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.axistrafo" title="Permalink to this definition">¶</a></dt>
<dd><p>This method can be used to apply a transformation <em>t</em> to an
<tt class="xref py py-class docutils literal"><span class="pre">anchoredaxis</span></tt> instance <em>axis</em> to modify the axis position and the like.
This method fails when called on a not yet finished axis, i.e. it should be used
after <a class="reference internal" href="#graph.graph.graphxy.dolayout" title="graph.graph.graphxy.dolayout"><tt class="xref py py-meth docutils literal"><span class="pre">dolayout()</span></tt></a>.</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxy.axisatv">
<tt class="descclassname">graphxy.</tt><tt class="descname">axisatv</tt><big>(</big><em>axis</em>, <em>v</em><big>)</big><a class="headerlink" href="#graph.graph.graphxy.axisatv" title="Permalink to this definition">¶</a></dt>
<dd><p>This method calls <a class="reference internal" href="#graph.graph.graphxy.axistrafo" title="graph.graph.graphxy.axistrafo"><tt class="xref py py-meth docutils literal"><span class="pre">axistrafo()</span></tt></a> with a transformation to move the axis
<em>axis</em> to a graph position <em>v</em> (in graph coordinates).</p>
</dd></dl>
<p>The class <a class="reference internal" href="#graph.graph.graphxyz" title="graph.graph.graphxyz"><tt class="xref py py-class docutils literal"><span class="pre">graphxyz</span></tt></a> is very similar to the <a class="reference internal" href="#graph.graph.graphxy" title="graph.graph.graphxy"><tt class="xref py py-class docutils literal"><span class="pre">graphxy</span></tt></a> class,
except for its additional dimension. In the following documentation only the
differences to the <a class="reference internal" href="#graph.graph.graphxy" title="graph.graph.graphxy"><tt class="xref py py-class docutils literal"><span class="pre">graphxy</span></tt></a> class are described.</p>
<dl class="class">
<dt id="graph.graph.graphxyz">
<em class="property">class </em><tt class="descclassname">graph.graph.</tt><tt class="descname">graphxyz</tt><big>(</big><em>xpos=0</em>, <em>ypos=0</em>, <em>size=None</em>, <em>xscale=1</em>, <em>yscale=1</em>, <em>zscale=1/goldenmean</em>, <em>projector=central(10</em>, <em>-30</em>, <em>30)</em>, <em>key=None</em>, <em>**axes</em><big>)</big><a class="headerlink" href="#graph.graph.graphxyz" title="Permalink to this definition">¶</a></dt>
<dd><p>This class provides an x-y-z-graph.</p>
<p>The position of the graph on its own canvas is specified by <em>xpos</em> and <em>ypos</em>.
The size of the graph is specified by <em>size</em> and the length factors <em>xscale</em>,
<em>yscale</em>, and <em>zscale</em>. The final size of the graph depends on the projector
<em>projector</em>, which is called with <tt class="docutils literal"><span class="pre">x</span></tt>, <tt class="docutils literal"><span class="pre">y</span></tt>, and <tt class="docutils literal"><span class="pre">z</span></tt> values up to <em>xscale</em>,
<em>yscale</em>, and <em>zscale</em> respectively and scaling the result by <em>size</em>. For a
parallel projector changing <em>size</em> is thus identical to changing <em>xscale</em>,
<em>yscale</em>, and <em>zscale</em> by the same factor. For the central projector the
projectors internal distance would also need to be changed by this factor. Thus
<em>size</em> changes the size of the whole graph without changing the projection.</p>
<p><em>projector</em> defines the conversion of 3d coordinates to 2d coordinates. It can
be an instance of <a class="reference internal" href="#graph.graph.central" title="graph.graph.central"><tt class="xref py py-class docutils literal"><span class="pre">central</span></tt></a> or <a class="reference internal" href="#graph.graph.parallel" title="graph.graph.parallel"><tt class="xref py py-class docutils literal"><span class="pre">parallel</span></tt></a> described below.</p>
<p><em>**axes</em> receives axes instances as for <a class="reference internal" href="#graph.graph.graphxyz" title="graph.graph.graphxyz"><tt class="xref py py-class docutils literal"><span class="pre">graphxyz</span></tt></a>. The graphxyz allows
for 4 axes per graph dimension <tt class="docutils literal"><span class="pre">x</span></tt>, <tt class="docutils literal"><span class="pre">x2</span></tt>, <tt class="docutils literal"><span class="pre">x3</span></tt>, <tt class="docutils literal"><span class="pre">x4</span></tt>, <tt class="docutils literal"><span class="pre">y</span></tt>, <tt class="docutils literal"><span class="pre">y2</span></tt>,
<tt class="docutils literal"><span class="pre">y3</span></tt>, <tt class="docutils literal"><span class="pre">y4</span></tt>, <tt class="docutils literal"><span class="pre">z</span></tt>, <tt class="docutils literal"><span class="pre">z2</span></tt>, <tt class="docutils literal"><span class="pre">z3</span></tt>, and <tt class="docutils literal"><span class="pre">z4</span></tt>. The x-y-plane is the
horizontal plane at the bottom and the <tt class="docutils literal"><span class="pre">x</span></tt>, <tt class="docutils literal"><span class="pre">x2</span></tt>, <tt class="docutils literal"><span class="pre">y</span></tt>, and <tt class="docutils literal"><span class="pre">y2</span></tt> axes are
placed at the boundary of this plane with <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt> always being in front.
<tt class="docutils literal"><span class="pre">x3</span></tt>, <tt class="docutils literal"><span class="pre">x4</span></tt>, <tt class="docutils literal"><span class="pre">y3</span></tt>, and <tt class="docutils literal"><span class="pre">y4</span></tt> are handled similar, but for the top plane of
the graph. The <tt class="docutils literal"><span class="pre">z</span></tt> axis is placed at the origin of the <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt>
dimension, whereas <tt class="docutils literal"><span class="pre">z2</span></tt> is placed at the final point of the <tt class="docutils literal"><span class="pre">x</span></tt> dimension,
<tt class="docutils literal"><span class="pre">z3</span></tt> at the final point of the <tt class="docutils literal"><span class="pre">y</span></tt> dimension and <tt class="docutils literal"><span class="pre">z4</span></tt> at the final point
of the <tt class="docutils literal"><span class="pre">x</span></tt> and <tt class="docutils literal"><span class="pre">y</span></tt> dimension together.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.graph.graphxyz.central">
<tt class="descclassname">graphxyz.</tt><tt class="descname">central</tt><a class="headerlink" href="#graph.graph.graphxyz.central" title="Permalink to this definition">¶</a></dt>
<dd><p>The central attribute of the graphxyz is the <a class="reference internal" href="#graph.graph.central" title="graph.graph.central"><tt class="xref py py-class docutils literal"><span class="pre">central</span></tt></a> class. See the
class description below.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.graph.graphxyz.parallel">
<tt class="descclassname">graphxyz.</tt><tt class="descname">parallel</tt><a class="headerlink" href="#graph.graph.graphxyz.parallel" title="Permalink to this definition">¶</a></dt>
<dd><p>The parallel attribute of the graphxyz is the <a class="reference internal" href="#graph.graph.parallel" title="graph.graph.parallel"><tt class="xref py py-class docutils literal"><span class="pre">parallel</span></tt></a> class. See the
class description below.</p>
</dd></dl>
<p>Regarding the 3d to 2d transformation the methods <tt class="xref py py-meth docutils literal"><span class="pre">pos()</span></tt>, <tt class="xref py py-meth docutils literal"><span class="pre">vpos()</span></tt>,
<tt class="xref py py-meth docutils literal"><span class="pre">vgeodesic()</span></tt>, and <tt class="xref py py-meth docutils literal"><span class="pre">vgeodesic_el()</span></tt> are available as for class
<a class="reference internal" href="#graph.graph.graphxy" title="graph.graph.graphxy"><tt class="xref py py-class docutils literal"><span class="pre">graphxy</span></tt></a> and just take an additional argument for the dimension. Note
that a similar transformation method (3d to 2d) is available as part of the
projector as well already, but only the graph acknowledges its size, the scaling
and the internal tranformation of the graph coordinates to the scaled
coordinates. As the projector also implements a <tt class="xref py py-meth docutils literal"><span class="pre">zindex()</span></tt> and a
<tt class="xref py py-meth docutils literal"><span class="pre">angle()</span></tt> method, those are also available at the graph level in the graph
coordinate variant (i.e. having an additional v in its name and using values
from 0 to 1 per dimension).</p>
<dl class="method">
<dt id="graph.graph.graphxyz.vzindex">
<tt class="descclassname">graphxyz.</tt><tt class="descname">vzindex</tt><big>(</big><em>vx</em>, <em>vy</em>, <em>vz</em><big>)</big><a class="headerlink" href="#graph.graph.graphxyz.vzindex" title="Permalink to this definition">¶</a></dt>
<dd><p>The depths of the point defined by <em>vx</em>, <em>vy</em>, and <em>vz</em> scaled to a range [-1:1]
where 1 in closed to the viewer. All arguments passed to the method are in graph
coordinates with range [0:1].</p>
</dd></dl>
<dl class="method">
<dt id="graph.graph.graphxyz.vangle">
<tt class="descclassname">graphxyz.</tt><tt class="descname">vangle</tt><big>(</big><em>vx1</em>, <em>vy1</em>, <em>vz1</em>, <em>vx2</em>, <em>vy2</em>, <em>vz2</em>, <em>vx3</em>, <em>vy3</em>, <em>vz3</em><big>)</big><a class="headerlink" href="#graph.graph.graphxyz.vangle" title="Permalink to this definition">¶</a></dt>
<dd><p>The cosine of the angle of the view ray thru point <tt class="docutils literal"><span class="pre">(vx1,</span> <span class="pre">vy1,</span> <span class="pre">vz1)</span></tt> and the
plane defined by the points <tt class="docutils literal"><span class="pre">(vx1,</span> <span class="pre">vy1,</span> <span class="pre">vz1)</span></tt>, <tt class="docutils literal"><span class="pre">(vx2,</span> <span class="pre">vy2,</span> <span class="pre">vz2)</span></tt>, and
<tt class="docutils literal"><span class="pre">(vx3,</span> <span class="pre">vy3,</span> <span class="pre">vz3)</span></tt>. All arguments passed to the method are in graph coordinates
with range [0:1].</p>
</dd></dl>
<p>There are two projector classes <a class="reference internal" href="#graph.graph.central" title="graph.graph.central"><tt class="xref py py-class docutils literal"><span class="pre">central</span></tt></a> and <a class="reference internal" href="#graph.graph.parallel" title="graph.graph.parallel"><tt class="xref py py-class docutils literal"><span class="pre">parallel</span></tt></a>:</p>
<dl class="class">
<dt id="graph.graph.central">
<em class="property">class </em><tt class="descclassname">graph.graph.</tt><tt class="descname">central</tt><big>(</big><em>distance</em>, <em>phi</em>, <em>theta</em>, <em>anglefactor=math.pi/180</em><big>)</big><a class="headerlink" href="#graph.graph.central" title="Permalink to this definition">¶</a></dt>
<dd><p>Instances of this class implement a central projection for the given parameters.</p>
<p><em>distance</em> is the distance of the viewer from the origin. Note that the
<a class="reference internal" href="#graph.graph.graphxyz" title="graph.graph.graphxyz"><tt class="xref py py-class docutils literal"><span class="pre">graphxyz</span></tt></a> class uses the range <tt class="docutils literal"><span class="pre">-xscale</span></tt> to <tt class="docutils literal"><span class="pre">xscale</span></tt>, <tt class="docutils literal"><span class="pre">-yscale</span></tt> to
<tt class="docutils literal"><span class="pre">yscale</span></tt>, and <tt class="docutils literal"><span class="pre">-zscale</span></tt> to <tt class="docutils literal"><span class="pre">zscale</span></tt> for the coordinates <tt class="docutils literal"><span class="pre">x</span></tt>, <tt class="docutils literal"><span class="pre">y</span></tt>, and
<tt class="docutils literal"><span class="pre">z</span></tt>. As those scales are of the order of one (by default), the distance should
be of the order of 10 to give nice results. Smaller distances increase the
central projection character while for huge distances the central projection
becomes identical to the parallel projection.</p>
<p><tt class="docutils literal"><span class="pre">phi</span></tt> is the angle of the viewer in the x-y-plane and <tt class="docutils literal"><span class="pre">theta</span></tt> is the angle
of the viewer to the x-y-plane. The standard notation for spheric coordinates
are used. The angles are multiplied by <em>anglefactor</em> which is initialized to do
a degree in radiant transformation such that you can specify <tt class="docutils literal"><span class="pre">phi</span></tt> and
<tt class="docutils literal"><span class="pre">theta</span></tt> in degree while the internal computation is always done in radiants.</p>
</dd></dl>
<dl class="class">
<dt id="graph.graph.parallel">
<em class="property">class </em><tt class="descclassname">graph.graph.</tt><tt class="descname">parallel</tt><big>(</big><em>phi</em>, <em>theta</em>, <em>anglefactor=math.pi/180</em><big>)</big><a class="headerlink" href="#graph.graph.parallel" title="Permalink to this definition">¶</a></dt>
<dd><p>Instances of this class implement a parallel projection for the given
parameters. There is no distance for that transformation (compared to the
central projection). All other parameters are identical to the <a class="reference internal" href="#graph.graph.central" title="graph.graph.central"><tt class="xref py py-class docutils literal"><span class="pre">central</span></tt></a>
class.</p>
</dd></dl>
<span class="target" id="module-graph.data"></span></div>
<div class="section" id="module-graph-data-graph-data">
<h2>Module <a class="reference internal" href="#module-graph.data" title="graph.data"><tt class="xref py py-mod docutils literal"><span class="pre">graph.data</span></tt></a>: Graph data<a class="headerlink" href="#module-graph-data-graph-data" title="Permalink to this headline">¶</a></h2>
<p>The following classes provide data for the <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> method of a graph. The
classes are implemented in <a class="reference internal" href="#module-graph.data" title="graph.data"><tt class="xref py py-mod docutils literal"><span class="pre">graph.data</span></tt></a>.</p>
<dl class="class">
<dt id="graph.data.file">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">file</tt><big>(</big><em>filename</em>, <em>commentpattern=defaultcommentpattern</em>, <em>columnpattern=defaultcolumnpattern</em>, <em>stringpattern=defaultstringpattern</em>, <em>skiphead=0</em>, <em>skiptail=0</em>, <em>every=1</em>, <em>title=notitle</em>, <em>context={}</em>, <em>copy=1</em>, <em>replacedollar=1</em>, <em>columncallback="__column__"</em>, <em>**columns</em><big>)</big><a class="headerlink" href="#graph.data.file" title="Permalink to this definition">¶</a></dt>
<dd><p>This class reads data from a file and makes them available to the graph system.
<em>filename</em> is the name of the file to be read. The data should be organized in
columns.</p>
<p>The arguments <em>commentpattern</em>, <em>columnpattern</em>, and <em>stringpattern</em> are
responsible for identifying the data in each line of the file. Lines matching
<em>commentpattern</em> are ignored except for the column name search of the last non-
empty comment line before the data. By default a line starting with one of the
characters <tt class="docutils literal"><span class="pre">'#'</span></tt>, <tt class="docutils literal"><span class="pre">'%'</span></tt>, or <tt class="docutils literal"><span class="pre">'!'</span></tt> as well as an empty line is treated as a
comment.</p>
<p>A non-comment line is analysed by repeatedly matching <em>stringpattern</em> and,
whenever the stringpattern does not match, by <em>columnpattern</em>. When the
<em>stringpattern</em> matches, the result is taken as the value for the next column
without further transformations. When <em>columnpattern</em> matches, it is tried to
convert the result to a float. When this fails the result is taken as a string
as well. By default, you can write strings with spaces surrounded by <tt class="docutils literal"><span class="pre">'"'</span></tt>
immediately surrounded by spaces or begin/end of line in the data file.
Otherwise <tt class="docutils literal"><span class="pre">'"'</span></tt> is not taken to be special.</p>
<p><em>skiphead</em> and <em>skiptail</em> are numbers of data lines to be ignored at the
beginning and end of the file while <em>every</em> selects only every <em>every</em> line from
the data.</p>
<p><em>title</em> is the title of the data to be used in the graph key. A default title is
constructed out of <em>filename</em> and <em>**columns</em>. You may set <em>title</em> to <tt class="xref docutils literal"><span class="pre">None</span></tt>
to disable the title.</p>
<p>Finally, <em>columns</em> define columns out of the existing columns from the file by a
column number or a mathematical expression (see below). When <em>copy</em> is set the
names of the columns in the file (file column names) and the freshly created
columns having the names of the dictionary key (data column names) are passed as
data to the graph styles. The data columns may hide file columns when names are
equal. For unset <em>copy</em> the file columns are not available to the graph styles.</p>
<p>File column names occur when the data file contains a comment line immediately
in front of the data (except for empty or empty comment lines). This line will
be parsed skipping the matched comment identifier as if the line would be
regular data, but it will not be converted to floats even if it would be
possible to convert the items. The result is taken as file column names, <em>i.e.</em>
a string representation for the columns in the file.</p>
<p>The values of <em>**columns</em> can refer to column numbers in the file starting at
<tt class="docutils literal"><span class="pre">1</span></tt>. The column <tt class="docutils literal"><span class="pre">0</span></tt> is also available and contains the line number starting
from <tt class="docutils literal"><span class="pre">1</span></tt> not counting comment lines, but lines skipped by <em>skiphead</em>,
<em>skiptail</em>, and <em>every</em>. Furthermore values of <em>**columns</em> can be strings:
file column names or complex mathematical expressions. To refer to columns
within mathematical expressions you can also use file column names when they are
valid variable identifiers. Equal named items in context will then be hidden.
Alternatively columns can be access by the syntax <tt class="docutils literal"><span class="pre">$<number></span></tt> when
<em>replacedollar</em> is set. They will be translated into function calls to
<em>columncallback</em>, which is a function to access column data by index or name.</p>
<p><em>context</em> allows for accessing external variables and functions when evaluating
mathematical expressions for columns. Additionally to the identifiers in
<em>context</em>, the file column names, the <em>columncallback</em> function and the
functions shown in the table “builtins in math expressions” at the end of the
section are available.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">graph</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">file</span><span class="p">(</span><span class="s">"test.dat"</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="s">"B"</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="s">"2*B+$3"</span><span class="p">)</span>
</pre></div>
</div>
<p>with <tt class="file docutils literal"><span class="pre">test.dat</span></tt> looking like:</p>
<div class="highlight-python"><pre># A B C
1.234 1 2
5.678 3 4</pre>
</div>
<p>The columns with name <tt class="docutils literal"><span class="pre">"a"</span></tt>, <tt class="docutils literal"><span class="pre">"b"</span></tt>, <tt class="docutils literal"><span class="pre">"c"</span></tt> will become <tt class="docutils literal"><span class="pre">"[1.234,</span>
<span class="pre">5.678]"</span></tt>, <tt class="docutils literal"><span class="pre">"[1.0,</span> <span class="pre">3.0]"</span></tt>, and <tt class="docutils literal"><span class="pre">"[4.0,</span> <span class="pre">10.0]"</span></tt>, respectively. The columns
<tt class="docutils literal"><span class="pre">"A"</span></tt>, <tt class="docutils literal"><span class="pre">"B"</span></tt>, <tt class="docutils literal"><span class="pre">"C"</span></tt> will be available as well, since <em>copy</em> is enabled by
default.</p>
<p>When creating several data instances accessing the same file, the file is read
only once. There is an inherent caching of the file contents.</p>
</dd></dl>
<p>For the sake of completeness we list the default patterns:</p>
<dl class="attribute">
<dt id="graph.data.file.defaultcommentpattern">
<tt class="descclassname">file.</tt><tt class="descname">defaultcommentpattern</tt><a class="headerlink" href="#graph.data.file.defaultcommentpattern" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">re.compile(r"(#+|!+|%+)\s*")</span></tt></p>
</dd></dl>
<dl class="attribute">
<dt id="graph.data.file.defaultcolumnpattern">
<tt class="descclassname">file.</tt><tt class="descname">defaultcolumnpattern</tt><a class="headerlink" href="#graph.data.file.defaultcolumnpattern" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">re.compile(r"\"(.*?)\"(\s+|$)")</span></tt></p>
</dd></dl>
<dl class="attribute">
<dt id="graph.data.file.defaultstringpattern">
<tt class="descclassname">file.</tt><tt class="descname">defaultstringpattern</tt><a class="headerlink" href="#graph.data.file.defaultstringpattern" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">re.compile(r"(.*?)(\s+|$)")</span></tt></p>
</dd></dl>
<dl class="class">
<dt id="graph.data.function">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">function</tt><big>(</big><em>expression</em>, <em>title=notitle</em>, <em>min=None</em>, <em>max=None</em>, <em>points=100</em>, <em>context={}</em><big>)</big><a class="headerlink" href="#graph.data.function" title="Permalink to this definition">¶</a></dt>
<dd><p>This class creates graph data from a function. <em>expression</em> is the mathematical
expression of the function. It must also contain the result variable name
including the variable the function depends on by assignment. A typical example
looks like <tt class="docutils literal"><span class="pre">"y(x)=sin(x)"</span></tt>.</p>
<p><em>title</em> is the title of the data to be used in the graph key. By default
<em>expression</em> is used. You may set <em>title</em> to <tt class="xref docutils literal"><span class="pre">None</span></tt> to disable the title.</p>
<p><em>min</em> and <em>max</em> give the range of the variable. If not set, the range spans the
whole axis range. The axis range might be set explicitly or implicitly by ranges
of other data. <em>points</em> is the number of points for which the function is
calculated. The points are choosen linearly in terms of graph coordinates.</p>
<p><em>context</em> allows for accessing external variables and functions. Additionally to
the identifiers in <em>context</em>, the variable name and the functions shown in the
table “builtins in math expressions” at the end of the section are available.</p>
</dd></dl>
<dl class="class">
<dt id="graph.data.paramfunction">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">paramfunction</tt><big>(</big><em>varname</em>, <em>min</em>, <em>max</em>, <em>expression</em>, <em>title=notitle</em>, <em>points=100</em>, <em>context={}</em><big>)</big><a class="headerlink" href="#graph.data.paramfunction" title="Permalink to this definition">¶</a></dt>
<dd><p>This class creates graph data from a parametric function. <em>varname</em> is the
parameter of the function. <em>min</em> and <em>max</em> give the range for that variable.
<em>points</em> is the number of points for which the function is calculated. The
points are choosen lineary in terms of the parameter.</p>
<p><em>expression</em> is the mathematical expression for the parametric function. It
contains an assignment of a tuple of functions to a tuple of variables. A
typical example looks like <tt class="docutils literal"><span class="pre">"x,</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">cos(k),</span> <span class="pre">sin(k)"</span></tt>.</p>
<p><em>title</em> is the title of the data to be used in the graph key. By default
<em>expression</em> is used. You may set <em>title</em> to <tt class="xref docutils literal"><span class="pre">None</span></tt> to disable the title.</p>
<p><em>context</em> allows for accessing external variables and functions. Additionally to
the identifiers in <em>context</em>, <em>varname</em> and the functions shown in the table
“builtins in math expressions” at the end of the section are available.</p>
</dd></dl>
<dl class="class">
<dt id="graph.data.values">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">values</tt><big>(</big><em>title="user provided values"</em>, <em>**columns</em><big>)</big><a class="headerlink" href="#graph.data.values" title="Permalink to this definition">¶</a></dt>
<dd><p>This class creates graph data from externally provided data. Each column is a
list of values to be used for that column.</p>
<p><em>title</em> is the title of the data to be used in the graph key.</p>
</dd></dl>
<dl class="class">
<dt id="graph.data.points">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">points</tt><big>(</big><em>data</em>, <em>title="user provided points"</em>, <em>addlinenumbers=1</em>, <em>**columns</em><big>)</big><a class="headerlink" href="#graph.data.points" title="Permalink to this definition">¶</a></dt>
<dd><p>This class creates graph data from externally provided data. <em>data</em> is a list of
lines, where each line is a list of data values for the columns.</p>
<p><em>title</em> is the title of the data to be used in the graph key.</p>
<p>The keywords of <em>**columns</em> become the data column names. The values are the
column numbers starting from one, when <em>addlinenumbers</em> is turned on (the zeroth
column is added to contain a line number in that case), while the column numbers
starts from zero, when <em>addlinenumbers</em> is switched off.</p>
</dd></dl>
<dl class="class">
<dt id="graph.data.data">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">data</tt><big>(</big><em>data</em>, <em>title=notitle</em>, <em>context=</em>, <em>copy=1</em>, <em>replacedollar=1</em>, <em>columncallback="__column__"</em>, <em>**columns</em><big>)</big><a class="headerlink" href="#graph.data.data" title="Permalink to this definition">¶</a></dt>
<dd><p>This class provides graph data out of other graph data. <em>data</em> is the source of
the data. All other parameters work like the equally called parameters in
<a class="reference internal" href="#graph.data.file" title="graph.data.file"><tt class="xref py py-class docutils literal"><span class="pre">graph.data.file</span></tt></a>. Indeed, the latter is built on top of this class by
reading the file and caching its contents in a <tt class="xref py py-class docutils literal"><span class="pre">graph.data.list</span></tt>
instance.</p>
</dd></dl>
<dl class="class">
<dt id="graph.data.conffile">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">conffile</tt><big>(</big><em>filename</em>, <em>title=notitle</em>, <em>context=</em>, <em>copy=1</em>, <em>replacedollar=1</em>, <em>columncallback="__column__"</em>, <em>**columns</em><big>)</big><a class="headerlink" href="#graph.data.conffile" title="Permalink to this definition">¶</a></dt>
<dd><p>This class reads data from a config file with the file name <em>filename</em>. The
format of a config file is described within the documentation of the
<tt class="xref py py-mod docutils literal"><span class="pre">ConfigParser</span></tt> module of the Python Standard Library.</p>
<p>Each section of the config file becomes a data line. The options in a section
are the columns. The name of the options will be used as file column names. All
other parameters work as in <em>graph.data.file</em> and <em>graph.data.data</em> since they
all use the same code.</p>
</dd></dl>
<dl class="class">
<dt id="graph.data.cbdfile">
<em class="property">class </em><tt class="descclassname">graph.data.</tt><tt class="descname">cbdfile</tt><big>(</big><em>filename</em>, <em>minrank=None</em>, <em>maxrank=None</em>, <em>title=notitle</em>, <em>context=</em>, <em>copy=1</em>, <em>replacedollar=1</em>, <em>columncallback="__column__"</em>, <em>**columns</em><big>)</big><a class="headerlink" href="#graph.data.cbdfile" title="Permalink to this definition">¶</a></dt>
<dd><p>This is an experimental class to read map data from cbd-files. See
<a class="reference external" href="http://sepwww.stanford.edu/ftp/World_Map/">http://sepwww.stanford.edu/ftp/World_Map/</a> for some world-map data.</p>
</dd></dl>
<p>The builtins in math expressions are listed in the following table:</p>
<table border="1" class="docutils">
<colgroup>
<col width="29%" />
<col width="71%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">value</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">neg</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">-x</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">abs</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">x</span> <span class="pre"><</span> <span class="pre">0</span> <span class="pre">and</span> <span class="pre">-x</span> <span class="pre">or</span> <span class="pre">x</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">sgn</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">x</span> <span class="pre"><</span> <span class="pre">0</span> <span class="pre">and</span> <span class="pre">-1</span> <span class="pre">or</span> <span class="pre">1</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">sqrt</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.sqrt</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">exp</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.exp</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">log</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.log</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">sin</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.sin</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">cos</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.cos</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">tan</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.tan</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">asin</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.asin</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">acos</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.acos</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">atan</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.atan</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">sind</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">math.sin(math.pi/180*x)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">cosd</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">math.cos(math.pi/180*x)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">tand</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">math.tan(math.pi/180*x)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">asind</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">180/math.pi*math.asin(x)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">acosd</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">180/math.pi*math.acos(x)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">atand</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x:</span> <span class="pre">180/math.pi*math.atan(x)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">norm</span></tt></td>
<td><tt class="docutils literal"><span class="pre">lambda</span> <span class="pre">x,</span> <span class="pre">y:</span> <span class="pre">math.hypot(x,</span> <span class="pre">y)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">splitatvalue</span></tt></td>
<td>see the <tt class="docutils literal"><span class="pre">splitatvalue</span></tt> description below</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">pi</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.pi</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">e</span></tt></td>
<td><tt class="docutils literal"><span class="pre">math.e</span></tt></td>
</tr>
</tbody>
</table>
<p><tt class="docutils literal"><span class="pre">math</span></tt> refers to Pythons <tt class="xref py py-mod docutils literal"><span class="pre">math</span></tt> module. The <tt class="docutils literal"><span class="pre">splitatvalue</span></tt> function is
defined as:</p>
<dl class="function">
<dt id="graph.data.splitatvalue">
<tt class="descclassname">graph.data.</tt><tt class="descname">splitatvalue</tt><big>(</big><em>value</em>, <em>*splitpoints</em><big>)</big><a class="headerlink" href="#graph.data.splitatvalue" title="Permalink to this definition">¶</a></dt>
<dd><p>This method returns a tuple <tt class="docutils literal"><span class="pre">(section,</span> <span class="pre">value)</span></tt>. The section is calculated by
comparing <em>value</em> with the values of splitpoints. If <em>splitpoints</em> contains only
a single item, <tt class="docutils literal"><span class="pre">section</span></tt> is <tt class="docutils literal"><span class="pre">0</span></tt> when value is lower or equal this item and
<tt class="docutils literal"><span class="pre">1</span></tt> else. For multiple splitpoints, <tt class="docutils literal"><span class="pre">section</span></tt> is <tt class="docutils literal"><span class="pre">0</span></tt> when its lower or
equal the first item, <tt class="xref docutils literal"><span class="pre">None</span></tt> when its bigger than the first item but lower or
equal the second item, <tt class="docutils literal"><span class="pre">1</span></tt> when its even bigger the second item, but lower or
equal the third item. It continues to alter between <tt class="xref docutils literal"><span class="pre">None</span></tt> and <tt class="docutils literal"><span class="pre">2</span></tt>, <tt class="docutils literal"><span class="pre">3</span></tt>,
etc.</p>
</dd></dl>
<span class="target" id="module-graph.style"></span></div>
<div class="section" id="module-graph-style-graph-styles">
<h2>Module <a class="reference internal" href="#module-graph.style" title="graph.style"><tt class="xref py py-mod docutils literal"><span class="pre">graph.style</span></tt></a>: Graph styles<a class="headerlink" href="#module-graph-style-graph-styles" title="Permalink to this headline">¶</a></h2>
<p>Please note that we are talking about graph styles here. Those are responsible
for plotting symbols, lines, bars and whatever else into a graph. Do not mix it
up with path styles like the line width, the line style (solid, dashed, dotted
<em>etc.</em>) and others.</p>
<p>The following classes provide styles to be used at the <tt class="xref py py-meth docutils literal"><span class="pre">plot()</span></tt> method of a
graph. The plot method accepts a list of styles. By that you can combine several
styles at the very same time.</p>
<p>Some of the styles below are hidden styles. Those do not create any output, but
they perform internal data handling and thus help on modularization of the
styles. Usually, a visible style will depend on data provided by one or more
hidden styles but most of the time it is not necessary to specify the hidden
styles manually. The hidden styles register themself to be the default for
providing certain internal data.</p>
<dl class="class">
<dt id="graph.style.pos">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">pos</tt><big>(</big><em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.pos" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a hidden style providing a position in the graph. It needs a data
column for each graph dimension. For that the column names need to be equal to
an axis name. Data points are considered to be out of graph when their position
in graph coordinates exceeds the range [0:1] by more than <em>epsilon</em>.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.range">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">range</tt><big>(</big><em>usenames=</em>, <em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.range" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a hidden style providing an errorbar range. It needs data column
names constructed out of a axis name <tt class="docutils literal"><span class="pre">X</span></tt> for each dimension errorbar data
should be provided as follows:</p>
<table border="1" class="docutils">
<colgroup>
<col width="29%" />
<col width="71%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">data name</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">Xmin</span></tt></td>
<td>minimal value</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">Xmax</span></tt></td>
<td>maximal value</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">dX</span></tt></td>
<td>minimal and maximal delta</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">dXmin</span></tt></td>
<td>minimal delta</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">dXmax</span></tt></td>
<td>maximal delta</td>
</tr>
</tbody>
</table>
<p>When delta data are provided the style will also read column data for the axis
name <tt class="docutils literal"><span class="pre">X</span></tt> itself. <em>usenames</em> allows to insert a translation dictionary from
axis names to the identifiers <tt class="docutils literal"><span class="pre">X</span></tt>.</p>
<p><em>epsilon</em> is a comparison precision when checking for invalid errorbar ranges.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.symbol">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">symbol</tt><big>(</big><em>symbol=changecross</em>, <em>size=0.2*unit.v_cm</em>, <em>symbolattrs=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#graph.style.symbol" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style for plotting symbols in a graph. <em>symbol</em> refers to a
(changeable) symbol function with the prototype <tt class="docutils literal"><span class="pre">symbol(c,</span> <span class="pre">x_pt,</span> <span class="pre">y_pt,</span> <span class="pre">size_pt,</span>
<span class="pre">attrs)</span></tt> and draws the symbol into the canvas <tt class="docutils literal"><span class="pre">c</span></tt> at the position <tt class="docutils literal"><span class="pre">(x_pt,</span>
<span class="pre">y_pt)</span></tt> with size <tt class="docutils literal"><span class="pre">size_pt</span></tt> and attributes <tt class="docutils literal"><span class="pre">attrs</span></tt>. Some predefined symbols
are available in member variables listed below. The symbol is drawn at size
<em>size</em> using <em>symbolattrs</em>. <em>symbolattrs</em> is merged with <tt class="docutils literal"><span class="pre">defaultsymbolattrs</span></tt>
which is a list containing the decorator <tt class="xref py py-class docutils literal"><span class="pre">deco.stroked</span></tt>. An instance of
<a class="reference internal" href="#graph.style.symbol" title="graph.style.symbol"><tt class="xref py py-class docutils literal"><span class="pre">symbol</span></tt></a> is the default style for all graph data classes described in
section <a class="reference internal" href="#module-graph.data" title="graph.data"><tt class="xref py py-mod docutils literal"><span class="pre">graph.data</span></tt></a> except for <tt class="xref py py-class docutils literal"><span class="pre">function</span></tt> and
<tt class="xref py py-class docutils literal"><span class="pre">paramfunction</span></tt>.</p>
</dd></dl>
<p>The class <a class="reference internal" href="#graph.style.symbol" title="graph.style.symbol"><tt class="xref py py-class docutils literal"><span class="pre">symbol</span></tt></a> provides some symbol functions as member variables,
namely:</p>
<dl class="attribute">
<dt id="graph.style.symbol.cross">
<tt class="descclassname">symbol.</tt><tt class="descname">cross</tt><a class="headerlink" href="#graph.style.symbol.cross" title="Permalink to this definition">¶</a></dt>
<dd><p>A cross. Should be used for stroking only.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.plus">
<tt class="descclassname">symbol.</tt><tt class="descname">plus</tt><a class="headerlink" href="#graph.style.symbol.plus" title="Permalink to this definition">¶</a></dt>
<dd><p>A plus. Should be used for stroking only.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.square">
<tt class="descclassname">symbol.</tt><tt class="descname">square</tt><a class="headerlink" href="#graph.style.symbol.square" title="Permalink to this definition">¶</a></dt>
<dd><p>A square. Might be stroked or filled or both.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.triangle">
<tt class="descclassname">symbol.</tt><tt class="descname">triangle</tt><a class="headerlink" href="#graph.style.symbol.triangle" title="Permalink to this definition">¶</a></dt>
<dd><p>A triangle. Might be stroked or filled or both.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.circle">
<tt class="descclassname">symbol.</tt><tt class="descname">circle</tt><a class="headerlink" href="#graph.style.symbol.circle" title="Permalink to this definition">¶</a></dt>
<dd><p>A circle. Might be stroked or filled or both.</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.diamond">
<tt class="descclassname">symbol.</tt><tt class="descname">diamond</tt><a class="headerlink" href="#graph.style.symbol.diamond" title="Permalink to this definition">¶</a></dt>
<dd><p>A diamond. Might be stroked or filled or both.</p>
</dd></dl>
<p><a class="reference internal" href="#graph.style.symbol" title="graph.style.symbol"><tt class="xref py py-class docutils literal"><span class="pre">symbol</span></tt></a> provides some changeable symbol functions as member variables,
namely:</p>
<dl class="attribute">
<dt id="graph.style.symbol.changecross">
<tt class="descclassname">symbol.</tt><tt class="descname">changecross</tt><a class="headerlink" href="#graph.style.symbol.changecross" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([cross, plus, square, triangle, circle, diamond])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changeplus">
<tt class="descclassname">symbol.</tt><tt class="descname">changeplus</tt><a class="headerlink" href="#graph.style.symbol.changeplus" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([plus, square, triangle, circle, diamond, cross])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changesquare">
<tt class="descclassname">symbol.</tt><tt class="descname">changesquare</tt><a class="headerlink" href="#graph.style.symbol.changesquare" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([square, triangle, circle, diamond, cross, plus])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changetriangle">
<tt class="descclassname">symbol.</tt><tt class="descname">changetriangle</tt><a class="headerlink" href="#graph.style.symbol.changetriangle" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([triangle, circle, diamond, cross, plus, square])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changecircle">
<tt class="descclassname">symbol.</tt><tt class="descname">changecircle</tt><a class="headerlink" href="#graph.style.symbol.changecircle" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([circle, diamond, cross, plus, square, triangle])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changediamond">
<tt class="descclassname">symbol.</tt><tt class="descname">changediamond</tt><a class="headerlink" href="#graph.style.symbol.changediamond" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([diamond, cross, plus, square, triangle, circle])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changesquaretwice">
<tt class="descclassname">symbol.</tt><tt class="descname">changesquaretwice</tt><a class="headerlink" href="#graph.style.symbol.changesquaretwice" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([square, square, triangle, triangle, circle, circle, diamond,
diamond])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changetriangletwice">
<tt class="descclassname">symbol.</tt><tt class="descname">changetriangletwice</tt><a class="headerlink" href="#graph.style.symbol.changetriangletwice" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([triangle, triangle, circle, circle, diamond, diamond, square,
square])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changecircletwice">
<tt class="descclassname">symbol.</tt><tt class="descname">changecircletwice</tt><a class="headerlink" href="#graph.style.symbol.changecircletwice" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([circle, circle, diamond, diamond, square, square, triangle,
triangle])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changediamondtwice">
<tt class="descclassname">symbol.</tt><tt class="descname">changediamondtwice</tt><a class="headerlink" href="#graph.style.symbol.changediamondtwice" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([diamond, diamond, square, square, triangle, triangle, circle,
circle])</p>
</dd></dl>
<p>The class <a class="reference internal" href="#graph.style.symbol" title="graph.style.symbol"><tt class="xref py py-class docutils literal"><span class="pre">symbol</span></tt></a> provides two changeable decorators for alternated
filling and stroking. Those are especially useful in combination with the
<tt class="xref py py-meth docutils literal"><span class="pre">change()</span></tt>-<tt class="xref py py-meth docutils literal"><span class="pre">twice()</span></tt>-symbol methods above. They are:</p>
<dl class="attribute">
<dt id="graph.style.symbol.changestrokedfilled">
<tt class="descclassname">symbol.</tt><tt class="descname">changestrokedfilled</tt><a class="headerlink" href="#graph.style.symbol.changestrokedfilled" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([deco.stroked, deco.filled])</p>
</dd></dl>
<dl class="attribute">
<dt id="graph.style.symbol.changefilledstroked">
<tt class="descclassname">symbol.</tt><tt class="descname">changefilledstroked</tt><a class="headerlink" href="#graph.style.symbol.changefilledstroked" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([deco.filled, deco.stroked])</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.line">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">line</tt><big>(</big><em>lineattrs=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#graph.style.line" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to stroke lines in a graph. <em>lineattrs</em> is merged with
<tt class="docutils literal"><span class="pre">defaultlineattrs</span></tt> which is a list containing the member variable
<tt class="docutils literal"><span class="pre">changelinestyle</span></tt> as described below. An instance of <a class="reference internal" href="#graph.style.line" title="graph.style.line"><tt class="xref py py-class docutils literal"><span class="pre">line</span></tt></a> is the
default style of the graph data classes <tt class="xref py py-class docutils literal"><span class="pre">function</span></tt> and
<tt class="xref py py-class docutils literal"><span class="pre">paramfunction</span></tt> described in section <a class="reference internal" href="#module-graph.data" title="graph.data"><tt class="xref py py-mod docutils literal"><span class="pre">graph.data</span></tt></a>.</p>
</dd></dl>
<p>The class <a class="reference internal" href="#graph.style.line" title="graph.style.line"><tt class="xref py py-class docutils literal"><span class="pre">line</span></tt></a> provides a changeable line style. Its definition is:</p>
<dl class="attribute">
<dt id="graph.style.line.changelinestyle">
<tt class="descclassname">line.</tt><tt class="descname">changelinestyle</tt><a class="headerlink" href="#graph.style.line.changelinestyle" title="Permalink to this definition">¶</a></dt>
<dd><p>attr.changelist([style.linestyle.solid, style.linestyle.dashed,
style.linestyle.dotted, style.linestyle.dashdotted])</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.impulses">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">impulses</tt><big>(</big><em>lineattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>fromvalue=0</em>, <em>frompathattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>valueaxisindex=1</em><big>)</big><a class="headerlink" href="#graph.style.impulses" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to plot impulses. <em>lineattrs</em> is merged with
<tt class="docutils literal"><span class="pre">defaultlineattrs</span></tt> which is a list containing the member variable
<tt class="docutils literal"><span class="pre">changelinestyle</span></tt> of the <a class="reference internal" href="#graph.style.line" title="graph.style.line"><tt class="xref py py-class docutils literal"><span class="pre">line</span></tt></a> class. <em>fromvalue</em> is the baseline
value of the impulses. When set to <tt class="xref docutils literal"><span class="pre">None</span></tt>, the impulses will start at the
baseline. When fromvalue is set, <em>frompathattrs</em> are the stroke attributes used
to show the impulses baseline path.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.errorbar">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">errorbar</tt><big>(</big><em>size=0.1*unit.v_cm</em>, <em>errorbarattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.errorbar" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to stroke errorbars in a graph. <em>size</em> is the size of the
caps of the errorbars and <em>errorbarattrs</em> are the stroke attributes. Errorbars
and error caps are considered to be out of the graph when their position in
graph coordinates exceeds the range [0:1] by more that <em>epsilon</em>. Out of graph
caps are omitted and the errorbars are cut to the valid graph range.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.text">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">text</tt><big>(</big><em>textname="text"</em>, <em>dxname=None</em>, <em>dyname=None</em>, <em>dxunit=0.3*unit.v_cm</em>, <em>dyunit=0.3*unit.v_cm</em>, <em>textdx=0*unit.v_cm</em>, <em>textdy=0.3*unit.v_cm</em>, <em>textattrs=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#graph.style.text" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to stroke text in a graph. The text to be written has to
be provided in the data column named <tt class="docutils literal"><span class="pre">textname</span></tt>. <em>textdx</em> and <em>textdy</em> are the
position of the text with respect to the position in the graph. Alternatively
you can specify a <tt class="docutils literal"><span class="pre">dxname</span></tt> and a <tt class="docutils literal"><span class="pre">dyname</span></tt> and provide appropriate data in
those columns to be taken in units of <em>dxunit</em> and <em>dyunit</em> to specify the
position of the text for each point separately. <em>textattrs</em> are text attributes
for the output of the text. Those attributes are merged with the default
attributes <tt class="docutils literal"><span class="pre">textmodule.halign.center</span></tt> and <tt class="docutils literal"><span class="pre">textmodule.vshift.mathaxis</span></tt>.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.arrow">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">arrow</tt><big>(</big><em>linelength=0.25*unit.v_cm</em>, <em>arrowsize=0.15*unit.v_cm</em>, <em>lineattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>arrowattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>arrowpos=0.5</em>, <em>epsilon=1e-10</em>, <em>decorator=deco.earrow</em><big>)</big><a class="headerlink" href="#graph.style.arrow" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to plot short lines with arrows into a two-dimensional
graph to a given graph position. The arrow parameters are defined by two
additional data columns named <tt class="docutils literal"><span class="pre">size</span></tt> and <tt class="docutils literal"><span class="pre">angle</span></tt> define the size and angle
for each arrow. <tt class="docutils literal"><span class="pre">size</span></tt> is taken as a factor to <em>arrowsize</em> and <em>linelength</em>,
the size of the arrow and the length of the line the arrow is plotted at.
<tt class="docutils literal"><span class="pre">angle</span></tt> is the angle the arrow points to with respect to a horizontal line.
The <tt class="docutils literal"><span class="pre">angle</span></tt> is taken in degrees and used in mathematically positive sense.
<em>lineattrs</em> and <em>arrowattrs</em> are styles for the arrow line and arrow head,
respectively. <em>arrowpos</em> defines the position of the arrow line with respect to
the position at the graph. The default <tt class="docutils literal"><span class="pre">0.5</span></tt> means centered at the graph
position, whereas <tt class="docutils literal"><span class="pre">0</span></tt> and <tt class="docutils literal"><span class="pre">1</span></tt> creates the arrows to start or end at the
graph position, respectively. <em>epsilon</em> is used as a cutoff for short arrows in
order to prevent numerical instabilities. <em>decorator</em> defines the decorator to
be added to the line.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.rect">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">rect</tt><big>(</big><em>gradient=color.gradient.Grey</em><big>)</big><a class="headerlink" href="#graph.style.rect" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to plot colored rectangles into a two-dimensional graph.
The size of the rectangles is taken from the data provided by the <a class="reference internal" href="#graph.style.range" title="graph.style.range"><tt class="xref py py-class docutils literal"><span class="pre">range</span></tt></a>
style. The additional data column named <tt class="docutils literal"><span class="pre">color</span></tt> specifies the color of the
rectangle defined by <em>gradient</em>. The valid color range is [0:1].</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.histogram">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">histogram</tt><big>(</big><em>lineattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>steps=0</em>, <em>fromvalue=0</em>, <em>frompathattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>fillable=0</em>, <em>rectkey=0</em>, <em>autohistogramaxisindex=0</em>, <em>autohistogrampointpos=0.5</em>, <em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.histogram" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a style to plot histograms. <em>lineattrs</em> is merged with
<tt class="docutils literal"><span class="pre">defaultlineattrs</span></tt> which is <tt class="docutils literal"><span class="pre">[deco.stroked]</span></tt>. When <em>steps</em> is set, the
histrogram is plotted as steps instead of the default being a boxed histogram.
<em>fromvalue</em> is the baseline value of the histogram. When set to <tt class="xref docutils literal"><span class="pre">None</span></tt>, the
histogram will start at the baseline. When fromvalue is set, <em>frompathattrs</em> are
the stroke attributes used to show the histogram baseline path.</p>
<p>The <em>fillable</em> flag changes the stoke line of the histogram to make it fillable
properly. This is important on non-steped histograms or on histograms, which hit
the graph boundary. <em>rectkey</em> can be set to generate a rectanglar area instead
of a line in the graph key.</p>
<p>In the most general case, a histogram is defined by a range specification (like
for an errorbar) in one graph dimension (say, along the x-axis) and a value for
the other graph dimension. This allows for the widths of the histogram boxes
being variable. Often, however, all histogram bin ranges are equally sized, and
instead of passing the range, the position of the bin along the x-axis fully
specifies the histogram - assuming that there are at least two bins. This common
case is supported via two parameters: <em>autohistogramaxisindex</em>, which defines
the index of the independent histogram axis (in the case just described this
would be <tt class="docutils literal"><span class="pre">0</span></tt> designating the x axis). <em>autohistogrampointpos</em>, defines the
relative position of the center of the histogram bin: <tt class="docutils literal"><span class="pre">0.5</span></tt> means that the bin
is centered at the values passed to the style, <tt class="docutils literal"><span class="pre">0</span></tt> (<tt class="docutils literal"><span class="pre">1</span></tt>) means that the bin
is aligned at the right-(left-)hand side.</p>
<p>XXX describe, how to specify general histograms with varying bin widths</p>
<p>Positions of the histograms are considered to be out of graph when they exceed
the graph coordinate range [0:1] by more than <em>epsilon</em>.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.barpos">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">barpos</tt><big>(</big><em>fromvalue=None</em>, <em>frompathattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.barpos" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a hidden style providing position information in a bar graph.
Those graphs need to contain a specialized axis, namely a bar axis. The data
column for this bar axis is named <tt class="docutils literal"><span class="pre">Xname</span></tt> where <tt class="docutils literal"><span class="pre">X</span></tt> is an axis name. In the
other graph dimension the data column name must be equal to an axis name. To
plot several bars in a single graph side by side, you need to have a nested bar
axis and provide a tuple as data for nested bar axis.</p>
<p>The bars start at <em>fromvalue</em> when provided. The <em>fromvalue</em> is marked by a
gridline stroked using <em>frompathattrs</em>. Thus this hidden style might actually
create some output. The value of a bar axis is considered to be out of graph
when its position in graph coordinates exceeds the range [0:1] by more than
<em>epsilon</em>.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.stackedbarpos">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">stackedbarpos</tt><big>(</big><em>stackname</em>, <em>addontop=0</em>, <em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.stackedbarpos" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a hidden style providing position information in a bar graph by
stacking a new bar on top of another bar. The value of the new bar is taken from
the data column named <em>stackname</em>. When <em>addontop</em> is set, the values is taken
relative to the previous top of the bar.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.bar">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">bar</tt><big>(</big><em>barattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>epsilon=1e-10</em>, <em>gradient=color.gradient.RedBlack</em><big>)</big><a class="headerlink" href="#graph.style.bar" title="Permalink to this definition">¶</a></dt>
<dd><p>This class draws bars in a bar graph. The bars are filled using <em>barattrs</em>.
<em>barattrs</em> is merged with <tt class="docutils literal"><span class="pre">defaultbarattrs</span></tt> which is a list containing
<tt class="docutils literal"><span class="pre">[color.gradient.Rainbow,</span> <span class="pre">deco.stroked([color.grey.black])]</span></tt>.</p>
<p>The bar style has limited support for 3d graphs: Occlusion does not work
properly on stacked bars or multiple dataset. <em>epsilon</em> is used in 3d to prevent
numerical instabilities on bars without hight. When <em>gradient</em> is not <tt class="xref docutils literal"><span class="pre">None</span></tt>
it is used to calculate a lighting coloring taking into account the angle
between the view ray and the bar and the distance between viewer and bar. The
precise conversion is defined in the <tt class="xref py py-meth docutils literal"><span class="pre">lighting()</span></tt> method.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.changebar">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">changebar</tt><big>(</big><em>barattrs=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#graph.style.changebar" title="Permalink to this definition">¶</a></dt>
<dd><p>This style works like the <a class="reference internal" href="#graph.style.bar" title="graph.style.bar"><tt class="xref py py-class docutils literal"><span class="pre">bar</span></tt></a> style, but instead of the <em>barattrs</em> to
be changed on subsequent data instances the <em>barattrs</em> are changed for each
value within a single data instance. In the result the style can’t be applied to
several data instances and does not support 3d. The style raises an error
instead.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.gridpos">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">gridpos</tt><big>(</big><em>index1=0</em>, <em>index2=1</em>, <em>gridlines1=1</em>, <em>gridlines2=1</em>, <em>gridattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>epsilon=1e-10</em><big>)</big><a class="headerlink" href="#graph.style.gridpos" title="Permalink to this definition">¶</a></dt>
<dd><p>This class is a hidden style providing rectangular grid information out of graph
positions for graph dimensions <em>index1</em> and <em>index2</em>. Data points are considered
to be out of graph when their position in graph coordinates exceeds the range
[0:1] by more than <em>epsilon</em>. Data points are merged to a single graph
coordinate value when their difference in graph coordinates is below <em>epsilon</em>.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.grid">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">grid</tt><big>(</big><em>gridlines1=1</em>, <em>gridlines2=1</em>, <em>gridattrs=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#graph.style.grid" title="Permalink to this definition">¶</a></dt>
<dd><p>Strokes a rectangular grid in the first grid direction, when <em>gridlines1</em> is set
and in the second grid direction, when <em>gridlines2</em> is set. <em>gridattrs</em> is
merged with <tt class="docutils literal"><span class="pre">defaultgridattrs</span></tt> which is a list containing the member variable
<tt class="docutils literal"><span class="pre">changelinestyle</span></tt> of the <a class="reference internal" href="#graph.style.line" title="graph.style.line"><tt class="xref py py-class docutils literal"><span class="pre">line</span></tt></a> class.</p>
</dd></dl>
<dl class="class">
<dt id="graph.style.surface">
<em class="property">class </em><tt class="descclassname">graph.style.</tt><tt class="descname">surface</tt><big>(</big><em>colorname="color"</em>, <em>gradient=color.gradient.Grey</em>, <em>mincolor=None</em>, <em>maxcolor=None</em>, <em>gridlines1=0.05</em>, <em>gridlines2=0.05</em>, <em>gridcolor=None</em>, <em>backcolor=color.gray.black</em><big>)</big><a class="headerlink" href="#graph.style.surface" title="Permalink to this definition">¶</a></dt>
<dd><p>Draws a surface of a rectangular grid. Each rectangle is divided into 4
triangles.</p>
<p>The grid can be colored using values provided by the data column named
<em>colorname</em>. The values are rescaled to the range [0:1] using mincolor and
maxcolor (which are taken from the minimal and maximal values, but larger bounds
could be set).</p>
<p>If no <em>colorname</em> column exists, the surface style falls back to a lighting
coloring taking into account the angle between the view ray and the triangle and
the distance between viewer and triangle. The precise conversion is defined in
the <tt class="xref py py-meth docutils literal"><span class="pre">lighting()</span></tt> method.</p>
<p>If a <em>gridcolor</em> is set, the rectangular grid is marked by small stripes of the
relative (compared to each rectangle) size of <em>gridlines1</em> and <em>gridlines2</em> for
the first and second grid direction, respectively.</p>
<p><em>backcolor</em> is used to fill triangles shown from the back. If <em>backcolor</em> is set
to <tt class="xref docutils literal"><span class="pre">None</span></tt>, back sides are not drawn differently from the front sides.</p>
<p>The surface is encoded using a single mesh. While this is quite space efficient,
it has the following implications:</p>
</dd></dl>
<ul>
<li><p class="first">All colors must use the same color space.</p>
</li>
<li><dl class="first docutils">
<dt>HSB colors are not allowed, whereas Gray, RGB, and CMYK are allowed. You can</dt>
<dd><p class="first last">convert HSB colors into a different color space before passing them to the
surface.</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>The grid itself is also constructed out of triangles. The grid is transformed</dt>
<dd><p class="first last">along with the triangles thus looking quite different from a stroked grid (as
done by the grid style).</p>
</dd>
</dl>
</li>
<li><p class="first">Occlusion is handled by proper painting order.</p>
</li>
<li><p class="first">Color changes are continuous (in the selected color space) for each triangle.</p>
</li>
</ul>
<span class="target" id="module-graph.key"></span></div>
<div class="section" id="module-graph-key-graph-keys">
<h2>Module <a class="reference internal" href="#module-graph.key" title="graph.key"><tt class="xref py py-mod docutils literal"><span class="pre">graph.key</span></tt></a>: Graph keys<a class="headerlink" href="#module-graph-key-graph-keys" title="Permalink to this headline">¶</a></h2>
<p>The following class provides a key, whose instances can be passed to the
constructor keyword argument <tt class="docutils literal"><span class="pre">key</span></tt> of a graph. The class is implemented in
<a class="reference internal" href="#module-graph.key" title="graph.key"><tt class="xref py py-mod docutils literal"><span class="pre">graph.key</span></tt></a>.</p>
<dl class="class">
<dt id="graph.key.key">
<em class="property">class </em><tt class="descclassname">graph.key.</tt><tt class="descname">key</tt><big>(</big><em>dist=0.2*unit.v_cm</em>, <em>pos="tr"</em>, <em>hpos=None</em>, <em>vpos=None</em>, <em>hinside=1</em>, <em>vinside=1</em>, <em>hdist=0.6*unit.v_cm</em>, <em>vdist=0.4*unit.v_cm</em>, <em>symbolwidth=0.5*unit.v_cm</em>, <em>symbolheight=0.25*unit.v_cm</em>, <em>symbolspace=0.2*unit.v_cm</em>, <em>textattrs=</em><span class="optional">[</span><span class="optional">]</span>, <em>columns=1</em>, <em>columndist=0.5*unit.v_cm</em>, <em>border=0.3*unit.v_cm</em>, <em>keyattrs=None</em><big>)</big><a class="headerlink" href="#graph.key.key" title="Permalink to this definition">¶</a></dt>
<dd><p>This class writes the title of the data in a plot together with a small
illustration of the style. The style is responsible for its illustration.</p>
<p><em>dist</em> is a visual length and a distance between the key entries. <em>pos</em> is the
position of the key with respect to the graph. Allowed values are combinations
of <tt class="docutils literal"><span class="pre">"t"</span></tt> (top), <tt class="docutils literal"><span class="pre">"m"</span></tt> (middle) and <tt class="docutils literal"><span class="pre">"b"</span></tt> (bottom) with <tt class="docutils literal"><span class="pre">"l"</span></tt> (left),
<tt class="docutils literal"><span class="pre">"c"</span></tt> (center) and <tt class="docutils literal"><span class="pre">"r"</span></tt> (right). Alternatively, you may use <em>hpos</em> and
<em>vpos</em> to specify the relative position using the range [0:1]. <em>hdist</em> and
<em>vdist</em> are the distances from the specified corner of the graph. <em>hinside</em> and
<em>vinside</em> are numbers to be set to 0 or 1 to define whether the key should be
placed horizontally and vertically inside of the graph or not.</p>
<p><em>symbolwidth</em> and <em>symbolheight</em> are passed to the style to control the size of
the style illustration. <em>symbolspace</em> is the space between the illustration and
the text. <em>textattrs</em> are attributes for the text creation. They are merged with
<tt class="docutils literal"><span class="pre">[text.vshift.mathaxis]</span></tt>.</p>
<p><em>columns</em> is a number of columns of the graph key and <em>columndist</em> is the
distance between those columns.</p>
<p>When <em>keyattrs</em> is set to contain some draw attributes, the graph key is
enlarged by <em>border</em> and the key area is drawn using <em>keyattrs</em>.</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="manual.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Graphs</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#component-architecture">Component architecture</a></li>
<li><a class="reference internal" href="#module-graph-graph-graph-geometry">Module <tt class="docutils literal"><span class="pre">graph.graph</span></tt>: Graph geometry</a></li>
<li><a class="reference internal" href="#module-graph-data-graph-data">Module <tt class="docutils literal"><span class="pre">graph.data</span></tt>: Graph data</a></li>
<li><a class="reference internal" href="#module-graph-style-graph-styles">Module <tt class="docutils literal"><span class="pre">graph.style</span></tt>: Graph styles</a></li>
<li><a class="reference internal" href="#module-graph-key-graph-keys">Module <tt class="docutils literal"><span class="pre">graph.key</span></tt>: Graph keys</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="text.html"
title="previous chapter">Module <tt class="docutils literal docutils literal"><span class="pre">text</span></tt>: TeX/LaTeX interface</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="axis.html"
title="next chapter">Axes</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/graph.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="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="axis.html" title="Axes"
>next</a> |</li>
<li class="right" >
<a href="text.html" title="Module text: TeX/LaTeX interface"
>previous</a> |</li>
<li><a href="manual.html">PyX v0.11.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2011, Jörg Lehmann, Michael Schindler, André Wobst.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
</div>
</body>
</html>
|