/usr/share/doc/pyxplot/html/ex-nanotubes.html is in pyxplot-doc 0.9.2-4.
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 | <!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" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: The construction of large multiplots</title>
<link href="sect0084.html" title="Linked axes and galleries of plots" rel="next" />
<link href="sect0083.html" title="Reordering multiplot items" rel="prev" />
<link href="sect0081.html" title="Editing items on the canvas" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0083.html" title="Reordering multiplot items"><img alt="Previous: Reordering multiplot items" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="sect0081.html" title="Editing items on the canvas"><img alt="Up: Editing items on the canvas" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0084.html" title="Linked axes and galleries of plots"><img alt="Next: Linked axes and galleries of plots" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0056.html">Plotting and Vector Graphics</a> <b>:</b>
</span>
</span><span>
<span>
<a href="ch-vector_graphics.html">Producing vector graphics</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0081.html">Editing items on the canvas</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">The construction of large multiplots</b>
</span>
</span>
<hr />
</div>
<div><h2 id="ex:nanotubes">3.5.3 The construction of large multiplots</h2>
<p>By default, whenever an item is added to a multiplot, or an existing item moved or replotted, the whole multiplot is replotted to show the change. This can be a time consuming process on large and complex multiplots. For this reason, the <tt class="tt">set nodisplay</tt> command<a name="a0000000985" id="a0000000985"></a> is provided, which stops Pyxplot from producing any output. The <tt class="tt">set display</tt> command<a name="a0000000986" id="a0000000986"></a> can subsequently be issued to return to normal behaviour. </p><p>This can be especially useful in scripts which produce large multiplots. There is no point in producing output at each step in the construction of a large multiplot, and a great speed increase can be achieved by wrapping the script with: </p><pre>
set nodisplay
[...prepare large multiplot...]
set display
refresh
</pre><p> <span class="upshape"><span class="mdseries"><span class="rm">A diagram from Euclid’s <i class="it">Elements</i>.</span></span></span></p><div>
<table cellspacing="0" class="tabular">
<tr>
<td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this more extended example script, we use Pyxplot’s <tt class="tt">arrow</tt> and <tt class="tt">text</tt> commands to reproduce a diagram illustrating the 47th Proposition from Euclid’s First Book of <i class="it">Elements</i>, better known as Pythagoras’ Theorem. A full text of the proof which accompanies this diagram can be found at http://www.gutenberg.org/etext/21076. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily">set unit angle nodimensionless</tt><br /><tt class="ttfamily">set multiplot ; set nodisplay</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily"># Lengths of three sides of triangle</tt><br /><tt class="ttfamily">AB = 2*unit(cm)</tt><br /><tt class="ttfamily">AC = 4*unit(cm)</tt><br /><tt class="ttfamily">BC = hypot(AC, AB) # Hypotenuse</tt><br /><tt class="ttfamily">CBA = atan2(AC, AB) # Angle CBA</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily"># Positions of three corners of triangle</tt><br /><tt class="ttfamily">Bx = 0*unit(cm) ; By = 0*unit(cm) # The origin</tt><br /><tt class="ttfamily">Cx = Bx + BC ; Cy = By</tt><br /><tt class="ttfamily">Ax = Bx + AB*cos(CBA) ; Ay = By + AB*sin(CBA)</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily"># Positions of constructed points</tt><br /><tt class="ttfamily">Dx = Bx ; Dy = -BC</tt><br /><tt class="ttfamily">Lx = Ax ; Ly = Dy</tt><br /><tt class="ttfamily">Ex = Cx ; Ey = Dy</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily">Hx = Bx + (AB + AC) * cos(CBA)</tt><br /><tt class="ttfamily">Hy = By + (AB + AC) * sin(CBA)</tt><br /><tt class="ttfamily">Kx = Cx + ( AC) * cos(CBA)</tt><br /><tt class="ttfamily">Ky = Cy + ( AC) * sin(CBA)</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily">Fx = Bx + AB*cos(CBA+90*unit(deg))</tt><br /><tt class="ttfamily">Fy = By + AB*sin(CBA+90*unit(deg))</tt><br /><tt class="ttfamily">Gx = Ax + AB*cos(CBA+90*unit(deg))</tt><br /><tt class="ttfamily">Gy = Ay + AB*sin(CBA+90*unit(deg))</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily"># Construct diagram</tt><br /><tt class="ttfamily">box from Dx,Dy to Cx,Cy with fillcol gray50</tt><br /><tt class="ttfamily">box at Ax,Ay width AC height AC rot CBA-90*unit(deg) with fillcol gray50</tt><br /><tt class="ttfamily">box at Bx,By width AB height AB rot CBA with fillcol gray50</tt><br /><tt class="ttfamily">line from Bx,By to Kx,Ky</tt><br /><tt class="ttfamily">line from Fx,Fy to Cx,Cy</tt><br /><tt class="ttfamily">line from Ax,Ay to Dx,Dy</tt><br /><tt class="ttfamily">line from Ax,Ay to Lx,Ly</tt><br /><tt class="ttfamily">line from Ax,Ay to Ex,Ey</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily"># Label diagram</tt><br /><tt class="ttfamily">set fontsize 1.3</tt><br /><tt class="ttfamily">TG = 0.5*unit(mm) # Gap left between labels and figure</tt><br /><tt class="ttfamily">text "A" at Ax,Ay gap TG*5 hal c val b</tt><br /><tt class="ttfamily">text "B" at Bx,By gap TG hal r val t</tt><br /><tt class="ttfamily">text "C" at Cx,Cy gap TG hal l val t</tt><br /><tt class="ttfamily">text "D" at Dx,Dy gap TG hal c val t</tt><br /><tt class="ttfamily">text "E" at Ex,Ey gap TG hal c val t</tt><br /><tt class="ttfamily">text "F" at Fx,Fy gap TG hal r val c</tt><br /><tt class="ttfamily">text "G" at Gx,Gy gap TG hal c val b</tt><br /><tt class="ttfamily">text "H" at Hx,Hy gap TG hal c val b</tt><br /><tt class="ttfamily">text "K" at Kx,Ky gap TG hal l val c</tt><br /><tt class="ttfamily">text "L" at Lx,Ly gap TG hal c val t</tt><br /></small></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><small class="footnotesize"><tt class="ttfamily"># Display diagram</tt><br /><tt class="ttfamily">set display ; refresh</tt> </small> </p></td>
</tr><tr>
<td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p><center>
<img src="images/img-0564.png" alt="\includegraphics[width=8cm]{examples/eps/ex_euclid_I_47}" style="width:8cm" /></center> </p></td>
</tr>
</table>
</div><p> <span class="upshape"><span class="mdseries"><span class="rm">A diagram of the conductivity of nanotubes.</span></span></span></p><div>
<table cellspacing="0" class="tabular">
<tr>
<td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example we produce a diagram of the <i class="it">irreducible wedge</i> of possible carbon nanotube configurations, highlighting those configurations which are electrically conductive. We use Pyxplot’s loop constructs to automate the production of the hexagonal grid which forms the basis of the diagram. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily">basisAngleX = 0*unit(deg)</tt><br /><tt class="ttfamily">basisAngleY = 120*unit(deg)</tt><br /><tt class="ttfamily">lineLen = 5*unit(mm)</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily"># Set up a transformation matrix</tt><br /><tt class="ttfamily">transformMat = matrix([[sin(basisAngleX),sin(basisAngleY)], <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> [cos(basisAngleX),cos(basisAngleY)] ])</tt><br /><tt class="ttfamily">transformMat *= lineLen</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily">subroutine line(p1,p2,lw)</tt><br /><tt class="ttfamily"> {</tt><br /><tt class="ttfamily"> line from transformMat*p1 to transformMat*p2 with linewid lw</tt><br /><tt class="ttfamily"> }</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily">subroutine hexagon(p,lw)</tt><br /><tt class="ttfamily"> {</tt><br /><tt class="ttfamily"> call line(p+vector([ 0, 0]),p+vector([ 0,-1]),lw)</tt><br /><tt class="ttfamily"> call line(p+vector([ 0,-1]),p+vector([ 1,-1]),lw)</tt><br /><tt class="ttfamily"> call line(p+vector([ 1,-1]),p+vector([ 2, 0]),lw)</tt><br /><tt class="ttfamily"> call line(p+vector([ 2, 0]),p+vector([ 2, 1]),lw)</tt><br /><tt class="ttfamily"> call line(p+vector([ 2, 1]),p+vector([ 1, 1]),lw)</tt><br /><tt class="ttfamily"> call line(p+vector([ 1, 1]),p+vector([ 0, 0]),lw)</tt><br /><tt class="ttfamily"> }</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily">set multiplot ; set nodisplay</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily">for x=0 to 10</tt><br /><tt class="ttfamily"> {</tt><br /><tt class="ttfamily"> for y=0 to x+1</tt><br /><tt class="ttfamily"> {</tt><br /><tt class="ttfamily"> p = vector([x+2*y , 2*x+y])</tt><br /><tt class="ttfamily"> call hexagon(p, ((x-y)%3==0)?4:1)</tt><br /><tt class="ttfamily"> text ’%d,%d’%(x,y) at transformMat*(p+vector([1,0])) <img src="images/img-0038.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="ttfamily"> hal cen val cen</tt><br /><tt class="ttfamily"> }</tt><br /><tt class="ttfamily"> }</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="ttfamily">set display ; refresh</tt> </p></td>
</tr><tr>
<td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p><center>
<img src="images/img-0567.png" alt="\includegraphics[width=9cm]{examples/eps/ex_nanotubes}" style="width:9cm" /></center> </p></td>
</tr>
</table>
</div></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sect0083.html" title="Reordering multiplot items"><img alt="Previous: Reordering multiplot items" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="sect0081.html" title="Editing items on the canvas"><img alt="Up: Editing items on the canvas" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sect0084.html" title="Linked axes and galleries of plots"><img alt="Next: Linked axes and galleries of plots" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0288.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>
</body>
</html>
|