/usr/share/doc/python-pyx-doc/html/unit.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 | <!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>Module unit — 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="Module trafo: Linear transformations" href="trafo.html" />
<link rel="prev" title="Module pattern" href="pattern.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="trafo.html" title="Module trafo: Linear transformations"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pattern.html" title="Module pattern"
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-unit"></span><div class="section" id="id1">
<h1>Module <a class="reference internal" href="#module-unit" title="unit"><tt class="xref py py-mod docutils literal"><span class="pre">unit</span></tt></a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
<p>With the <tt class="docutils literal"><span class="pre">unit</span></tt> module PyX makes available classes and functions for the
specification and manipulation of lengths. As usual, lengths consist of a number
together with a measurement unit, e.g., 1 cm, 50 points, 0.42 inch. In
addition, lengths in PyX are composed of the five types “true”, “user”,
“visual”, “width”, and “TeX”, e.g., 1 user cm, 50 true points, 0.42 visual + 0.2
width inch. As their names indicate, they serve different purposes. True
lengths are not scalable and are mainly used for return values of PyX functions.
The other length types can be rescaled by the user and differ with respect to
the type of object they are applied to:</p>
<dl class="docutils">
<dt>user length:</dt>
<dd>used for lengths of graphical objects like positions etc.</dd>
<dt>visual length:</dt>
<dd>used for sizes of visual elements, like arrows, graph symbols, axis ticks, etc.</dd>
<dt>width length:</dt>
<dd>used for line widths</dd>
<dt>TeX length:</dt>
<dd>used for all TeX and LaTeX output</dd>
</dl>
<p>When not specified otherwise, all types of lengths are interpreted in terms of a
default unit, which, by default, is 1 cm. You may change this default unit by
using the module level function</p>
<dl class="function">
<dt id="unit.set">
<tt class="descclassname">unit.</tt><tt class="descname">set</tt><big>(</big><em>uscale=None</em>, <em>vscale=None</em>, <em>wscale=None</em>, <em>xscale=None</em>, <em>defaultunit=None</em><big>)</big><a class="headerlink" href="#unit.set" title="Permalink to this definition">¶</a></dt>
<dd><p>When <em>uscale</em>, <em>vscale</em>, <em>wscale</em>, or <em>xscale</em> is not <cite>None</cite>, the
corresponding scaling factor(s) is redefined to the given number. When
<em>defaultunit</em> is not <cite>None</cite>, the default unit is set to the given
value, which has to be one of <tt class="docutils literal"><span class="pre">"cm"</span></tt>, <tt class="docutils literal"><span class="pre">"mm"</span></tt>, <tt class="docutils literal"><span class="pre">"inch"</span></tt>, or <tt class="docutils literal"><span class="pre">"pt"</span></tt>.</p>
</dd></dl>
<p>For instance, if you only want thicker lines for a publication version of your
figure, you can just rescale all width lengths using</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">unit</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">wscale</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
</pre></div>
</div>
<p>Or suppose, you are used to specify length in imperial units. In this,
admittedly rather unfortunate case, just use</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">unit</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">defaultunit</span><span class="o">=</span><span class="s">"inch"</span><span class="p">)</span>
</pre></div>
</div>
<p>at the beginning of your program.</p>
<div class="section" id="class-length">
<h2>Class length<a class="headerlink" href="#class-length" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="unit.length">
<em class="property">class </em><tt class="descclassname">unit.</tt><tt class="descname">length</tt><big>(</big><em>f</em>, <em>type="u"</em>, <em>unit=None</em><big>)</big><a class="headerlink" href="#unit.length" title="Permalink to this definition">¶</a></dt>
<dd><p>The constructor of the <a class="reference internal" href="#unit.length" title="unit.length"><tt class="xref py py-class docutils literal"><span class="pre">length</span></tt></a> class expects as its first argument a
number <em>f</em>, which represents the prefactor of the given length. By default this
length is interpreted as a user length (<tt class="docutils literal"><span class="pre">type="u"</span></tt>) in units of the current
default unit (see <a class="reference internal" href="#unit.set" title="unit.set"><tt class="xref py py-func docutils literal"><span class="pre">set()</span></tt></a> function of the <a class="reference internal" href="#module-unit" title="unit"><tt class="xref py py-mod docutils literal"><span class="pre">unit</span></tt></a> module). Optionally, a
different <em>type</em> may be specified, namely <tt class="docutils literal"><span class="pre">"u"</span></tt> for user lengths, <tt class="docutils literal"><span class="pre">"v"</span></tt> for
visual lengths, <tt class="docutils literal"><span class="pre">"w"</span></tt> for width lengths, <tt class="docutils literal"><span class="pre">"x"</span></tt> for TeX length, and <tt class="docutils literal"><span class="pre">"t"</span></tt>
for true lengths. Furthermore, a different unit may be specified using the
<em>unit</em> argument. Allowed values are <tt class="docutils literal"><span class="pre">"cm"</span></tt>, <tt class="docutils literal"><span class="pre">"mm"</span></tt>, <tt class="docutils literal"><span class="pre">"inch"</span></tt>, and
<tt class="docutils literal"><span class="pre">"pt"</span></tt>.</p>
</dd></dl>
<p>Instances of the <a class="reference internal" href="#unit.length" title="unit.length"><tt class="xref py py-class docutils literal"><span class="pre">length</span></tt></a> class support addition and substraction either
by another <a class="reference internal" href="#unit.length" title="unit.length"><tt class="xref py py-class docutils literal"><span class="pre">length</span></tt></a> or by a number which is then interpeted as being a
user length in default units, multiplication by a number and division either by
another <a class="reference internal" href="#unit.length" title="unit.length"><tt class="xref py py-class docutils literal"><span class="pre">length</span></tt></a> in which case a float is returned or by a number in
which case a <a class="reference internal" href="#unit.length" title="unit.length"><tt class="xref py py-class docutils literal"><span class="pre">length</span></tt></a> instance is returned. When two lengths are
compared, they are first converted to meters (using the currently set scaling),
and then the resulting values are compared.</p>
</div>
<div class="section" id="predefined-length-instances">
<h2>Predefined length instances<a class="headerlink" href="#predefined-length-instances" title="Permalink to this headline">¶</a></h2>
<p>A number of <tt class="docutils literal"><span class="pre">length</span></tt> instances are already predefined, which only differ in
there values for <tt class="docutils literal"><span class="pre">type</span></tt> and <tt class="docutils literal"><span class="pre">unit</span></tt>. They are summarized in the following
table</p>
<table border="1" class="docutils">
<colgroup>
<col width="52%" />
<col width="24%" />
<col width="24%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">type</th>
<th class="head">unit</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">m</span></tt></td>
<td>user</td>
<td>m</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">cm</span></tt></td>
<td>user</td>
<td>cm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">mm</span></tt></td>
<td>user</td>
<td>mm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">inch</span></tt></td>
<td>user</td>
<td>inch</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">pt</span></tt></td>
<td>user</td>
<td>points</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">t_m</span></tt></td>
<td>true</td>
<td>m</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">t_cm</span></tt></td>
<td>true</td>
<td>cm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">t_mm</span></tt></td>
<td>true</td>
<td>mm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">t_inch</span></tt></td>
<td>true</td>
<td>inch</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">t_pt</span></tt></td>
<td>true</td>
<td>points</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">u_m</span></tt></td>
<td>user</td>
<td>m</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">u_cm</span></tt></td>
<td>user</td>
<td>cm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">u_mm</span></tt></td>
<td>user</td>
<td>mm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">u_inch</span></tt></td>
<td>user</td>
<td>inch</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">u_pt</span></tt></td>
<td>user</td>
<td>points</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">v_m</span></tt></td>
<td>visual</td>
<td>m</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">v_cm</span></tt></td>
<td>visual</td>
<td>cm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">v_mm</span></tt></td>
<td>visual</td>
<td>mm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">v_inch</span></tt></td>
<td>visual</td>
<td>inch</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">v_pt</span></tt></td>
<td>visual</td>
<td>points</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">w_m</span></tt></td>
<td>width</td>
<td>m</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">w_cm</span></tt></td>
<td>width</td>
<td>cm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">w_mm</span></tt></td>
<td>width</td>
<td>mm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">w_inch</span></tt></td>
<td>width</td>
<td>inch</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">w_pt</span></tt></td>
<td>width</td>
<td>points</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">x_m</span></tt></td>
<td>TeX</td>
<td>m</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">x_cm</span></tt></td>
<td>TeX</td>
<td>cm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">x_mm</span></tt></td>
<td>TeX</td>
<td>mm</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">x_inch</span></tt></td>
<td>TeX</td>
<td>inch</td>
</tr>
<tr><td><tt class="xref py py-const docutils literal"><span class="pre">x_pt</span></tt></td>
<td>TeX</td>
<td>points</td>
</tr>
</tbody>
</table>
<p>Thus, in order to specify, e.g., a length of 5 width points, just use
<tt class="docutils literal"><span class="pre">5*unit.w_pt</span></tt>.</p>
</div>
<div class="section" id="conversion-functions">
<h2>Conversion functions<a class="headerlink" href="#conversion-functions" title="Permalink to this headline">¶</a></h2>
<p>If you want to know the value of a PyX length in certain units, you may use the
predefined conversion functions which are given in the following table</p>
<table border="1" class="docutils">
<colgroup>
<col width="37%" />
<col width="63%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">function</th>
<th class="head">result</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">tom(l)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">l</span></tt> in units of m</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">tocm(l)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">l</span></tt> in units of cm</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">tomm(l)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">l</span></tt> in units of mm</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">toinch(l)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">l</span></tt> in units of inch</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">topt(l)</span></tt></td>
<td><tt class="docutils literal"><span class="pre">l</span></tt> in units of points</td>
</tr>
</tbody>
</table>
<p>If <tt class="docutils literal"><span class="pre">l</span></tt> is not yet a <tt class="docutils literal"><span class="pre">length</span></tt> instance but a number, it first is interpreted
as a user length in the default units.</p>
</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="#">Module <tt class="docutils literal"><span class="pre">unit</span></tt></a><ul>
<li><a class="reference internal" href="#class-length">Class length</a></li>
<li><a class="reference internal" href="#predefined-length-instances">Predefined length instances</a></li>
<li><a class="reference internal" href="#conversion-functions">Conversion functions</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="pattern.html"
title="previous chapter">Module <tt class="docutils literal docutils literal docutils literal"><span class="pre">pattern</span></tt></a></p>
<h4>Next topic</h4>
<p class="topless"><a href="trafo.html"
title="next chapter">Module <tt class="docutils literal docutils literal docutils literal"><span class="pre">trafo</span></tt>: Linear transformations</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/unit.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="trafo.html" title="Module trafo: Linear transformations"
>next</a> |</li>
<li class="right" >
<a href="pattern.html" title="Module pattern"
>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>
|