8000 update docs with format string · pratikscodes/matplotlib-cpp@0acff6b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0acff6b

Browse files
committed
update docs with format string
1 parent 87cb62f commit 0acff6b

File tree

8 files changed

+339
-12
lines changed

8 files changed

+339
-12
lines changed

docs/build/doctrees/docs.doctree

12.9 KB
Binary file not shown.
2.22 KB
Binary file not shown.

docs/build/html/_sources/docs.rst.txt

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,108 @@ The Docs
88

99
.. _style:
1010

11-
The formatting string
12-
=====================
11+
The style of a line
12+
===================
1313

14-
Bla
14+
The style of a line in a plot has three characteristics; the
15+
marker, the color and the line.
16+
They can be specified using the keywords map
17+
or the formatting string.
1518

19+
They keywords map is a possibility to specify additional parameters
20+
for the plot commands. To set the line style it can be used as follows.
21+
.. code-block:: cpp
22+
23+
// for a red dashed line with circle markers
24+
plt::plot(x, y, {{"color", "red"}, {"marker": "o"}, {"linestyle": "--"}})
25+
26+
// shorthand notation for color and linestyle is usually supported
27+
plt::plot(x, y, {{"c", "red"}, {"marker": "o"}, {"ls": "--"}})
28+
29+
See sections `Marker`_, `Color`_ and `Line`_
30+
for supported values.
31+
32+
The formatting string is a convenient notation to set the style of a line.
33+
Almost all plot commands support the formatting string as
34+
first argument after the `x` and `y` data.
35+
36+
A formatting string's structure is
37+
```
38+
s = "<marker><color><line>"
39+
```
40+
41+
The rules are
42+
43+
x. The valid parameters (``<>``) are listed in the following sections.
44+
45+
x. Different ordering of the parameters is supported.
46+
However, to avoid ambiguity this order should be used throughout.
47+
48+
x. Parameters might be dropped.
49+
50+
x. If only the colour parameters is specified, more color
51+
parameters are supported, see section `Color`_.
52+
53+
**Examples**
54+
55+
.. code-block:: cpp
56+
57+
"b" // blue line
58+
"og" // green circles, no connecting line
59+
"og-" // green circles with connecting line
60+
"r--" // dashed red line
61+
"seagreen" // a solid line in the colour seagreen
62+
"#008000" // a solid line coloured in the HEX code
63+
64+
The following sections list the supported markers, colours and linestyles.
65+
66+
Marker
67+
++++++
68+
69+
========= ======
70+
character marker
71+
========= ======
72+
'o' circle
73+
========= ======
74+
75+
Color
76+
+++++
77+
78+
The color can be specified via a character code,
79+
a full name or a HEX code.
80+
81+
.. note::
82+
83+
If a formatting string contains more parameters than just the color,
84+
only the character code is supported.
85+
86+
Character code
87+
^^^^^^^^^^^^^^
88+
89+
========= ======
90+
character color
91+
========= ======
92+
'r' red
93+
========= ======
94+
95+
Full name
96+
^^^^^^^^^
97+
98+
E.g. seagreen
99+
100+
HEX code
101+
^^^^^^^^
102+
103+
Just use HEX
104+
105+
Line
106+
++++
107+
108+
========= ======
109+
character line
110+
========= ======
111+
'-' solid
112+
========= ======
16113

17114
The `Vector` type
18115
=================

docs/build/html/docs.html

Lines changed: 137 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,17 @@
8585
<ul class="current">
8686
<li class="toctree-l1"><a class="reference internal" href="compiling.html">Compiling a program</a></li>
8787
<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>
8999
<li class="toctree-l2"><a class="reference internal" href="#the-vector-type">The <cite>Vector</cite> type</a></li>
90100
<li class="toctree-l2"><a class="reference internal" href="#plot-commands">Plot commands</a></li>
91101
<li class="toctree-l2"><a class="reference internal" href="#figure-commands">Figure commands</a></li>
@@ -160,9 +170,132 @@
160170

161171
<div class="section" id="the-docs">
162172
<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">&quot;&lt;marker&gt;&lt;color&gt;&lt;line&gt;&quot;</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">&lt;&gt;</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">&quot;b&quot;</span> <span class="c1">// blue line</span>
216+
<span class="s">&quot;og&quot;</span> <span class="c1">// green circles, no connecting line</span>
217+
<span class="s">&quot;og-&quot;</span> <span class="c1">// green circles with connecting line</span>
218+
<span class="s">&quot;r--&quot;</span> <span class="c1">// dashed red line</span>
219+
<span class="s">&quot;seagreen&quot;</span> <span class="c1">// a solid line in the colour seagreen</span>
220+
<span class="s">&quot;#008000&quot;</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>
166299
</div>
167300
<div class="section" id="the-vector-type">
168301
<h2>The <cite>Vector</cite> type<a class="headerlink" href="#the-vector-type" title="Permalink to this headline"></a></h2>

docs/build/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ <h3>Purpose<a class="headerlink" href="#purpose" title="Permalink to this headli
179179
</ul>
180180
</li>
181181
<li class="toctree-l1"><a class="reference internal" href="docs.html">The Docs</a><ul>
182-
<li class="toctree-l2"><a class="reference internal" href="docs.html#the-formatting-string">The formatting string</a></li>
182+
<li class="toctree-l2"><a class="reference internal" href="docs.html#the-style-of-a-line">The style of a line</a></li>
183183
<li class="toctree-l2"><a class="reference internal" href="docs.html#the-vector-type">The <cite>Vector</cite> type</a></li>
184184
<li class="toctree-l2"><a class="reference internal" href="docs.html#plot-commands">Plot commands</a></li>
185185
<li class="toctree-l2"><a class="reference internal" href="docs.html#figure-commands">Figure commands</a></li>

docs/build/html/objects.inv

-1 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
0