|
85 | 85 | <ul class="current">
|
86 | 86 | <li class="toctree-l1"><a class="reference internal" href="compiling.html">Compiling a program</a></li>
|
87 | 87 | <li class="toctree-l1 current"><a class="current reference internal" href="#">The Docs</a><ul>
|
88 |
| -<li class="toctree-l2"><a class="reference internal" href="#the-formatting-string">The formatting string</a></li> |
| 88 | +<li class="toctree-l2"><a class="reference internal" href="#the-style-of-a-line">The style of a line</a><ul> |
| 89 | +<li class="toctree-l3"><a class="reference internal" href="#marker">Marker</a></li> |
| 90 | +<li class="toctree-l3"><a class="reference internal" href="#color">Color</a><ul> |
| 91 | +<li class="toctree-l4"><a class="reference internal" href="#character-code">Character code</a></li> |
| 92 | +<li class="toctree-l4"><a class="reference internal" href="#full-name">Full name</a></li> |
| 93 | +<li class="toctree-l4"><a class="reference internal" href="#hex-code">HEX code</a></li> |
| 94 | +</ul> |
| 95 | +</li> |
| 96 | +<li class="toctree-l3"><a class="reference internal" href="#line">Line</a></li> |
| 97 | +</ul> |
| 98 | +</li> |
89 | 99 | <li class="toctree-l2"><a class="reference internal" href="#the-vector-type">The <cite>Vector</cite> type</a></li>
|
90 | 100 | <li class="toctree-l2"><a class="reference internal" href="#plot-commands">Plot commands</a></li>
|
91 | 101 | <li class="toctree-l2"><a class="reference internal" href="#figure-commands">Figure commands</a></li>
|
|
160 | 170 |
|
161 | 171 | <div class="section" id="the-docs">
|
162 | 172 | <span id="docs"></span><h1>The Docs<a class="headerlink" href="#the-docs" title="Permalink to this headline">¶</a></h1>
|
163 |
| -<div class="section" id="the-formatting-string"> |
164 |
| -<span id="style"></span><h2>The formatting string<a class="headerlink" href="#the-formatting-string" title="Permalink to this headline">¶</a></h2> |
165 |
| -<p>Bla</p> |
| 173 | +<div class="section" id="the-style-of-a-line"> |
| 174 | +<span id="style"></span><h2>The style of a line<a class="headerlink" href="#the-style-of-a-line" title="Permalink to this headline">¶</a></h2> |
| 175 | +<p>The style of a line in a plot has three characteristics; the |
| 176 | +marker, the color and the line. |
| 177 | +They can be specified using the keywords map |
| 178 | +or the formatting string.</p> |
| 179 | +<p>They keywords map is a possibility to specify additional parameters |
| 180 | +for the plot commands. To set the line style it can be used as follows. |
| 181 | +.. code-block:: cpp</p> |
| 182 | +<blockquote> |
| 183 | +<div><p>// for a red dashed line with circle markers |
| 184 | +plt::plot(x, y, {{“color”, “red”}, {“marker”: “o”}, {“linestyle”: “–”}})</p> |
| 185 | +<p>// shorthand notation for color and linestyle is usually supported |
| 186 | +plt::plot(x, y, {{“c”, “red”}, {“marker”: “o”}, {“ls”: “–”}})</p> |
| 187 | +</div></blockquote> |
| 188 | +<p>See sections <a class="reference internal" href="#marker">Marker</a>, <a class="reference internal" href="#color">Color</a> and <a class="reference internal" href="#line">Line</a> |
| 189 | +for supported values.</p> |
| 190 | +<p>The formatting string is a convenient notation to set the style of a line. |
| 191 | +Almost all plot commands support the formatting string as |
| 192 | +first argument after the <cite>x</cite> and <cite>y</cite> data.</p> |
| 193 | +<p>A formatting string’s structure is |
| 194 | +<code class="docutils literal notranslate"><span class="pre">`</span> |
| 195 | +<span class="pre">s</span> <span class="pre">=</span> <span class="pre">"<marker><color><line>"</span> |
| 196 | +<span class="pre">`</span></code></p> |
| 197 | +<p>The rules are</p> |
| 198 | +<blockquote> |
| 199 | +<div><ol class="loweralpha simple" start="24"> |
| 200 | +<li>The valid parameters (<code class="docutils literal notranslate"><span class="pre"><></span></code>) are listed in the following sections.</li> |
| 201 | +</ol> |
| 202 | +<ol class="loweralpha simple" start="24"> |
| 203 | +<li>Different ordering of the parameters is supported. |
| 204 | +However, to avoid ambiguity this order should be used throughout.</li> |
| 205 | +</ol> |
| 206 | +<ol class="loweralpha simple" start="24"> |
| 207 | +<li>Parameters might be dropped.</li> |
| 208 | +</ol> |
| 209 | +<ol class="loweralpha simple" start="24"> |
| 210 | +<li>If only the colour parameters is specified, more color |
| 211 | +parameters are supported, see section <a class="reference internal" href="#color">Color</a>.</li> |
| 212 | +</ol> |
| 213 | +</div></blockquote> |
| 214 | +<p><strong>Examples</strong></p> |
| 215 | +<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="s">"b"</span> <span class="c1">// blue line</span> |
| 216 | +<span class="s">"og"</span> <span class="c1">// green circles, no connecting line</span> |
| 217 | +<span class="s">"og-"</span> <span class="c1">// green circles with connecting line</span> |
| 218 | +<span class="s">"r--"</span> <span class="c1">// dashed red line</span> |
| 219 | +<span class="s">"seagreen"</span> <span class="c1">// a solid line in the colour seagreen</span> |
| 220 | +<span class="s">"#008000"</span> <span class="c1">// a solid line coloured in the HEX code</span> |
| 221 | +</pre></div> |
| 222 | +</div> |
| 223 | +<p>The following sections list the supported markers, colours and linestyles.</p> |
| 224 | +<div class="section" id="marker"> |
| 225 | +<h3>Marker<a class="headerlink" href="#marker" title="Permalink to this headline">¶</a></h3> |
| 226 | +<table border="1" class="docutils"> |
| 227 | +<colgroup> |
| 228 | +<col width="60%" /> |
| 229 | +<col width="40%" /> |
| 230 | +</colgroup> |
| 231 | +<thead valign="bottom"> |
| 232 | +<tr class="row-odd"><th class="head">character</th> |
| 233 | +<th class="head">marker</th> |
| 234 | +</tr> |
| 235 | +</thead> |
| 236 | +<tbody valign="top"> |
| 237 | +<tr class="row-even"><td>‘o’</td> |
| 238 | +<td>circle</td> |
| 239 | +</tr> |
| 240 | +</tbody> |
| 241 | +</table> |
| 242 | +</div> |
| 243 | +<div class="section" id="color"> |
| 244 | +<h3>Color<a class="headerlink" href="#color" title="Permalink to this headline">¶</a></h3> |
| 245 | +<p>The color can be specified via a character code, |
| 246 | +a full name or a HEX code.</p> |
| 247 | +<div class="admonition note"> |
| 248 | +<p class="first admonition-title">Note</p> |
| 249 | +<p class="last">If a formatting string contains more parameters than just the color, |
| 250 | +only the character code is supported.</p> |
| 251 | +</div> |
| 252 | +<div class="section" id="character-code"> |
| 253 | +<h4>Character code<a class="headerlink" href="#character-code" title="Permalink to this headline">¶</a></h4> |
| 254 | +<table border="1" class="docutils"> |
| 255 | +<colgroup> |
| 256 | +<col width="60%" /> |
| 257 | +<col width="40%" /> |
| 258 | +</colgroup> |
| 259 | +<thead valign="bottom"> |
| 260 | +<tr class="row-odd"><th class="head">character</th> |
| 261 | +<th class="head">color</th> |
| 262 | +</tr> |
| 263 | +</thead> |
| 264 | +<tbody valign="top"> |
| 265 | +<tr class="row-even"><td>‘r’</td> |
| 266 | +<td>red</td> |
| 267 | +</tr> |
| 268 | +</tbody> |
| 269 | +</table> |
| 270 | +</div> |
| 271 | +<div class="section" id="full-name"> |
| 272 | +<h4>Full name<a class="headerlink" href="#full-name" title="Permalink to this headline">¶</a></h4> |
| 273 | +<p>E.g. seagreen</p> |
| 274 | +</div> |
| 275 | +<div class="section" id="hex-code"> |
| 276 | +<h4>HEX code<a class="headerlink" href="#hex-code" title="Permalink to this headline">¶</a></h4> |
| 277 | +<p>Just use HEX</p> |
| 278 | +</div> |
| 279 | +</div> |
| 280 | +<div class="section" id="line"> |
| 281 | +<h3>Line<a class="headerlink" href="#line" title="Permalink to this headline">¶</a></h3> |
| 282 | +<table border="1" class="docutils"> |
| 283 | +<colgroup> |
| 284 | +<col width="60%" /> |
| 285 | +<col width="40%" /> |
| 286 | +</colgroup> |
| 287 | +<thead valign="bottom"> |
| 288 | +<tr class="row-odd"><th class="head">character</th> |
| 289 | +<th class="head">line</th> |
| 290 | +</tr> |
| 291 | +</thead> |
| 292 | +<tbody valign="top"> |
| 293 | +<tr class="row-even"><td>‘-‘</td> |
| 294 | +<td>solid</td> |
| 295 | +</tr> |
| 296 | +</tbody> |
| 297 | +</table> |
| 298 | +</div> |
166 | 299 | </div>
|
167 | 300 | <div class="section" id="the-vector-type">
|
168 | 301 | <h2>The <cite>Vector</cite> type<a class="headerlink" href="#the-vector-type" title="Permalink to this headline">¶</a></h2>
|
|
0 commit comments