/usr/share/doc/pyxplot/html/ex-cmbrtemp.html is in pyxplot-doc 0.8.4-3.
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 | <!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: Linked Axes</title>
<link href="sec-set_colours.html" title="Gridlines" rel="next" />
<link href="sec-set_xformat.html" title="Configuring how Tick Marks are Labelled" rel="prev" />
<link href="sect0053.html" title="Configuring Axes" 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="sec-set_xformat.html" title="Configuring how Tick Marks are Labelled"><img alt="Previous: Configuring how Tick Marks are Labelled" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="sect0053.html" title="Configuring Axes"><img alt="Up: Configuring Axes" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sec-set_colours.html" title="Gridlines"><img alt="Next: Gridlines" 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="sect0255.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="sect0043.html">Plotting and Vector Graphics</a> <b>:</b>
</span>
</span><span>
<span>
<a href="ch-plotting.html">Plotting: A Detailed Survey</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0053.html">Configuring Axes</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">Linked Axes</b>
</span>
</span>
<hr />
</div>
<div><h2 id="ex:cmbrtemp">1.8.9 Linked Axes</h2>
<p>Often it may be desired that multiple axes on a graph share a common range, or be related to one another by some algebraic expression. For example, a plot with wavelength <img src="images/img-0478.png" alt="$\lambda $" style="vertical-align:0px;
width:9px;
height:13px" class="math gen" /> of light as one axis may usefully also have parallel axes showing frequency of light <img src="images/img-0479.png" alt="$\nu =c/\lambda $" style="vertical-align:-5px;
width:60px;
height:18px" class="math gen" /> or photon energy <img src="images/img-0480.png" alt="$E=hc/\lambda $" style="vertical-align:-5px;
width:75px;
height:18px" class="math gen" />. The following example sets the <tt class="tt">x2</tt> axis to share a common range with the <tt class="tt">x</tt> axis: </p><pre>
set axis x2 linked x
</pre><p> An algebraic relationship between two axes may be set by stating the algebraic relationship after the keyword <tt class="tt">using</tt>, as in the following example which implement the formulae shown above for the frequency and energy of photons of light as a function of their wavelength: </p><pre>
set xrange [200*unit(nm):unit(800*nm)]
set axis x2 linked x1 using phy_c/x
set axis x3 linked x2 using phy_h*x
</pre><p> As in the <tt class="tt">set xformat</tt> command, a dummy variable of <tt class="tt">x</tt>, <tt class="tt">y</tt> or <tt class="tt">z</tt> is used in the linkage expression depending upon the direction of the axis being linked to, but a dummy variable of <tt class="tt">x</tt> is still used when linking to, for example, the <tt class="tt">x2</tt> axis. </p><p>As these examples demonstrate, the functions used to link axes need not be linear. In fact, axes with any arbitrary mapping between position and value can be produced by linked in a non-linear fashion to another linear axis, which, if desired, can then be hidden using the <tt class="tt">set axis invisible</tt> command. Multi-valued mappings are also permitted. Any data plotted against the following <tt class="tt">x2</tt>-axis for a suitable range of <tt class="tt">x</tt>-axis </p><pre>
set axis x2 linked x1 using x**2
</pre><p> would appear twice, symmetrically on either side of <img src="images/img-0131.png" alt="$x=0$" style="vertical-align:0px;
width:43px;
height:12px" class="math gen" />. </p><p>Insofar as is possible, linked axes autoscale intelligently when no range is set. Thus, if the <tt class="tt">x2</tt>-axis is linked to the <tt class="tt">x</tt>-axis, and no range to set for the <tt class="tt">x</tt>-axis, the <tt class="tt">x</tt>-axis will autoscale to include all of the data plotted against both itself and the <tt class="tt">x2</tt>-axis. Similarly, if the <tt class="tt">x2</tt>-axis is linked to the <tt class="tt">x</tt>-axis by means of some algebraic expression, the <tt class="tt">x</tt>-axis will attempt to autoscale to include the data plotted against the <tt class="tt">x2</tt>-axis, though in some cases – especially with non-monotonic linking functions – this may prove too difficult. Where PyXPlot detects that it has failed, a warning is issued recommending that a hard range be set for – in this example – the <tt class="tt">x</tt>-axis. </p><p> <span class="upshape"><span class="mdseries"><span class="rm">A plot of many blackbodies demonstrating the use of linked axes.</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 plot of blackbody spectra for five different temperatures <img src="images/img-0142.png" alt="$T$" style="vertical-align:0px;
width:13px;
height:12px" class="math gen" />, using the Planck formula </p><table id="a0000000794" class="equation" width="100%" cellspacing="0" cellpadding="7">
<tr>
<td style="width:40%"> </td>
<td><img src="images/img-0143.png" alt="\[ B_\nu (\nu ,T)=\left(\frac{2h^3}{c^2}\right)\frac{\nu ^3}{\exp (h\nu /kT)-1} \]" style="width:281px;
height:45px" class="math gen" /></td>
<td style="width:40%"> </td>
<td class="eqnnum" style="width:20%"> </td>
</tr>
</table><p> which is evaluated in PyXPlot by the system-defined mathematical function <tt class="tt">Bv(nu,T)</tt>. We use the axis linkage commands listed as an example in the text of Section <a href="ex-cmbrtemp.html">1.8.9</a> to produce three parallel horizontal axes showing wavelength of light, frequency of light and photon energy. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">set numeric display latex</tt><br /><tt class="tt">set unit angle nodimensionless</tt><br /><tt class="tt">set log x y</tt><br /><tt class="tt">set key bottom right</tt><br /><tt class="tt">set ylabel "Flux density" ; set unit preferred W/Hz/m**2/sterad</tt><br /><tt class="tt">set x1label "Wavelength"</tt><br /><tt class="tt">set x2label "Frequency" ; set unit of frequency Hz</tt><br /><tt class="tt">set x3label "Photon Energy" ; set unit of energy eV</tt><br /><tt class="tt">set axis x2 linked x1 using phy_c/x</tt><br /><tt class="tt">set axis x3 linked x2 using phy_h*x</tt><br /><tt class="tt">set xtics unit(0.1*um),10</tt><br /><tt class="tt">set x2tics 1e12*unit(Hz),10</tt><br /><tt class="tt">set x3tics 0.01*unit(eV),10</tt><br /><tt class="tt">set xrange [80*unit(nm):unit(mm)]</tt><br /><tt class="tt">set yrange [1e-20*unit(W/Hz/m**2/sterad):]</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">bb(wlen,T) = Bv(phy_c/wlen,T)</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">plot bb(x, 30) title "$T= 30$<img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />,K", <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="tt">bb(x, 100) title "$T= 100$<img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />,K", <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="tt">bb(x, 300) title "$T= 300$<img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />,K", <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="tt">bb(x,1000) title "$T=1000$<img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />,K", <img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" /></tt><br /><tt class="tt">bb(x,3000) title "$T=3000$<img src="images/img-0006.png" alt="$\backslash $" style="vertical-align:-5px;
width:7px;
height:18px" class="math gen" />,K"</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-0482.png" alt="\includegraphics[width=10cm]{examples/eps/ex_multiaxes}" style="width:10cm" /></center> </p></td>
</tr>
</table>
</div><p> <span class="upshape"><span class="mdseries"><span class="rm">A plot of the temperature of the CMBR as a function of redshift demonstrating non-linear axis linkage.</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 plot of the temperature of the cosmic microwave background radiation (CMBR) as a function of time <img src="images/img-0056.png" alt="$t$" style="vertical-align:0px;
width:6px;
height:12px" class="math gen" /> since the Big Bang, on the <tt class="tt">x</tt>-axis, and equivalently as a function of redshift <img src="images/img-0101.png" alt="$z$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" />, on the <tt class="tt">x2</tt>-axis. The specialist cosmology function <tt class="tt">ast_Lcdm_z(<img src="images/img-0056.png" alt="$t$" style="vertical-align:0px;
width:6px;
height:12px" class="math gen" />,<img src="images/img-0484.png" alt="$H_0$" style="vertical-align:-2px;
width:22px;
height:14px" class="math gen" />,<img src="images/img-0485.png" alt="$\Omega _\mathrm {M}$" style="vertical-align:-3px;
width:26px;
height:15px" class="math gen" />,<img src="images/img-0486.png" alt="$\Omega _\Uplambda $" style="vertical-align:-3px;
width:24px;
height:15px" class="math gen" />)</tt><a name="a0000000795" id="a0000000795"></a> is used to make the highly non-linear conversion between time <img src="images/img-0056.png" alt="$t$" style="vertical-align:0px;
width:6px;
height:12px" class="math gen" /> and redshift <img src="images/img-0101.png" alt="$z$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" />, adopting some standard values for the cosmological parameters <img src="images/img-0484.png" alt="$H_0$" style="vertical-align:-2px;
width:22px;
height:14px" class="math gen" />, <img src="images/img-0485.png" alt="$\Omega _\mathrm {M}$" style="vertical-align:-3px;
width:26px;
height:15px" class="math gen" /> and <img src="images/img-0486.png" alt="$\Omega _\Uplambda $" style="vertical-align:-3px;
width:24px;
height:15px" class="math gen" />. Because the temperature of the CMBR is most easily expressed as a function of redshift as <img src="images/img-0487.png" alt="$T=2.73\, \mathrm{K}/(1+z)$" style="vertical-align:-5px;
width:149px;
height:19px" class="math gen" />, we plot this function against axis <tt class="tt">x2</tt>. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">h0 = 70</tt><br /><tt class="tt">omega_m = 0.27</tt><br /><tt class="tt">omega_l = 0.73</tt><br /><tt class="tt">age = ast_Lcdm_age(h0,omega_m,omega_l)</tt><br /><tt class="tt">set xrange [0.01*age:0.99*age]</tt><br /><tt class="tt">set unit of time Gyr</tt><br /><tt class="tt">set axis x2 linked x using ast_Lcdm_z(age-x,h0,omega_m,omega_l)</tt><br /><tt class="tt">set xlabel "Time since Big Bang $t$"</tt><br /><tt class="tt">set ylabel "CMBR Temperature $T$"</tt><br /><tt class="tt">set x2label "Redshift $z$"</tt><br /><tt class="tt">plot unit(2.73*K)*(1+x) axes x2y1</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-0489.png" alt="\includegraphics[width=8cm]{examples/eps/ex_cmbrtemp}" style="width:8cm" /></center> </p></td>
</tr>
</table>
</div></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="sec-set_xformat.html" title="Configuring how Tick Marks are Labelled"><img alt="Previous: Configuring how Tick Marks are Labelled" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="sect0053.html" title="Configuring Axes"><img alt="Up: Configuring Axes" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sec-set_colours.html" title="Gridlines"><img alt="Next: Gridlines" 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="sect0255.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>
|