Browse Source

Plot

pull/42/head
Jure Šorn 5 years ago
parent
commit
7820466ead
2 changed files with 14 additions and 6 deletions
  1. 6
      README.md
  2. 14
      index.html

6
README.md

@ -2227,6 +2227,9 @@ Plot
```python ```python
# $ pip3 install matplotlib # $ pip3 install matplotlib
from matplotlib import pyplot from matplotlib import pyplot
```
```python
pyplot.plot(<y_data>) pyplot.plot(<y_data>)
pyplot.plot(<x_data>, <y_data>) pyplot.plot(<x_data>, <y_data>)
pyplot.plot(..., label=<str>) # Use `pyplot.legend()` to add legend. pyplot.plot(..., label=<str>) # Use `pyplot.legend()` to add legend.
@ -2610,6 +2613,9 @@ img.convert('RGB').save('test.png')
### ImageDraw ### ImageDraw
```python ```python
from PIL import ImageDraw from PIL import ImageDraw
```
```python
<ImageDraw> = ImageDraw.Draw(<Image>) <ImageDraw> = ImageDraw.Draw(<Image>)
<ImageDraw>.point((x, y), fill=None) <ImageDraw>.point((x, y), fill=None)
<ImageDraw>.line((x1, y1, x2, y2 [, ...]), fill=None, width=0, joint=None) <ImageDraw>.line((x1, y1, x2, y2 [, ...]), fill=None, width=0, joint=None)

14
index.html

@ -1925,14 +1925,15 @@ reader(adder(printer())) <span class="hljs-comment"># 100, 101, ..., 109</span>
<div><h2 id="plot"><a href="#plot" name="plot">#</a>Plot</h2><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install matplotlib</span> <div><h2 id="plot"><a href="#plot" name="plot">#</a>Plot</h2><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install matplotlib</span>
<span class="hljs-keyword">from</span> matplotlib <span class="hljs-keyword">import</span> pyplot <span class="hljs-keyword">from</span> matplotlib <span class="hljs-keyword">import</span> pyplot
pyplot.plot(&lt;y_data&gt;)
</code></pre></div>
<pre><code class="python language-python hljs">pyplot.plot(&lt;y_data&gt;)
pyplot.plot(&lt;x_data&gt;, &lt;y_data&gt;) pyplot.plot(&lt;x_data&gt;, &lt;y_data&gt;)
pyplot.plot(..., label=&lt;str&gt;) <span class="hljs-comment"># Use `pyplot.legend()` to add legend.</span> pyplot.plot(..., label=&lt;str&gt;) <span class="hljs-comment"># Use `pyplot.legend()` to add legend.</span>
pyplot.savefig(&lt;filename&gt;) <span class="hljs-comment"># Saves figure.</span> pyplot.savefig(&lt;filename&gt;) <span class="hljs-comment"># Saves figure.</span>
pyplot.show() <span class="hljs-comment"># Displays figure.</span> pyplot.show() <span class="hljs-comment"># Displays figure.</span>
pyplot.clf() <span class="hljs-comment"># Clears figure.</span> pyplot.clf() <span class="hljs-comment"># Clears figure.</span>
</code></pre></div>
</code></pre>
<div><h2 id="table"><a href="#table" name="table">#</a>Table</h2><div><h4 id="printsacsvfileasanasciitable">Prints a CSV file as an ASCII table:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install tabulate</span> <div><h2 id="table"><a href="#table" name="table">#</a>Table</h2><div><h4 id="printsacsvfileasanasciitable">Prints a CSV file as an ASCII table:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install tabulate</span>
<span class="hljs-keyword">from</span> tabulate <span class="hljs-keyword">import</span> tabulate <span class="hljs-keyword">from</span> tabulate <span class="hljs-keyword">import</span> tabulate
<span class="hljs-keyword">import</span> csv <span class="hljs-keyword">import</span> csv
@ -2220,15 +2221,16 @@ img.convert(<span class="hljs-string">'RGB'</span>).save(<span class="hljs-strin
</code></pre></div> </code></pre></div>
<div><h3 id="imagedraw">ImageDraw</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> ImageDraw <div><h3 id="imagedraw">ImageDraw</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> ImageDraw
&lt;ImageDraw&gt; = ImageDraw.Draw(&lt;Image&gt;)
</code></pre></div>
<pre><code class="python language-python hljs">&lt;ImageDraw&gt; = ImageDraw.Draw(&lt;Image&gt;)
&lt;ImageDraw&gt;.point((x, y), fill=<span class="hljs-keyword">None</span>) &lt;ImageDraw&gt;.point((x, y), fill=<span class="hljs-keyword">None</span>)
&lt;ImageDraw&gt;.line((x1, y1, x2, y2 [, ...]), fill=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>, joint=<span class="hljs-keyword">None</span>) &lt;ImageDraw&gt;.line((x1, y1, x2, y2 [, ...]), fill=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>, joint=<span class="hljs-keyword">None</span>)
&lt;ImageDraw&gt;.arc((x1, y1, x2, y2), from_deg, to_deg, fill=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>) &lt;ImageDraw&gt;.arc((x1, y1, x2, y2), from_deg, to_deg, fill=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>)
&lt;ImageDraw&gt;.rectangle((x1, y1, x2, y2), fill=<span class="hljs-keyword">None</span>, outline=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>) &lt;ImageDraw&gt;.rectangle((x1, y1, x2, y2), fill=<span class="hljs-keyword">None</span>, outline=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>)
&lt;ImageDraw&gt;.polygon((x1, y1, x2, y2 [, ...]), fill=<span class="hljs-keyword">None</span>, outline=<span class="hljs-keyword">None</span>) &lt;ImageDraw&gt;.polygon((x1, y1, x2, y2 [, ...]), fill=<span class="hljs-keyword">None</span>, outline=<span class="hljs-keyword">None</span>)
&lt;ImageDraw&gt;.ellipse((x1, y1, x2, y2), fill=<span class="hljs-keyword">None</span>, outline=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>) &lt;ImageDraw&gt;.ellipse((x1, y1, x2, y2), fill=<span class="hljs-keyword">None</span>, outline=<span class="hljs-keyword">None</span>, width=<span class="hljs-number">0</span>)
</code></pre></div>
</code></pre>
<ul> <ul>
<li><strong>Use <code class="python hljs"><span class="hljs-string">'fill=&lt;color&gt;'</span></code> to set the primary color.</strong></li> <li><strong>Use <code class="python hljs"><span class="hljs-string">'fill=&lt;color&gt;'</span></code> to set the primary color.</strong></li>
<li><strong>Use <code class="python hljs"><span class="hljs-string">'outline=&lt;color&gt;'</span></code> to set the secondary color.</strong></li> <li><strong>Use <code class="python hljs"><span class="hljs-string">'outline=&lt;color&gt;'</span></code> to set the secondary color.</strong></li>

Loading…
Cancel
Save