File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -2227,10 +2227,12 @@ Plot
2227
2227
``` python
2228
2228
# $ pip3 install matplotlib
2229
2229
from matplotlib import pyplot
2230
- pyplot.plot(< data_1> [, < data_2> , ... ]) # Or: pyplot.hist(<data>)
2231
- pyplot.savefig(< filename> )
2232
- pyplot.show()
2233
- pyplot.clf() # Clears figure.
2230
+ pyplot.plot(< y_data> )
2231
+ pyplot.plot(< x_data> , < y_data> )
2232
+ pyplot.plot(... , label = < str > ) # Use `pyplot.legend()` to add legend.
2233
+ pyplot.savefig(< filename> ) # Saves figure.
2234
+ pyplot.show() # Displays figure.
2235
+ pyplot.clf() # Clears figure.
2234
2236
```
2235
2237
2236
2238
Original file line number Diff line number Diff line change 1925
1925
1926
1926
< 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 >
1927
1927
< span class ="hljs-keyword "> from</ span > matplotlib < span class ="hljs-keyword "> import</ span > pyplot
1928
- pyplot.plot(<data_1> [, <data_2>, ...]) < span class ="hljs-comment "> # Or: pyplot.hist(<data>)</ span >
1929
- pyplot.savefig(<filename>)
1930
- pyplot.show()
1931
- pyplot.clf() < span class ="hljs-comment "> # Clears figure.</ span >
1928
+ pyplot.plot(<y_data>)
1929
+ pyplot.plot(<x_data>, <y_data>)
1930
+ pyplot.plot(..., label=<str>) < span class ="hljs-comment "> # Use `pyplot.legend()` to add legend.</ span >
1931
+ pyplot.savefig(<filename>) < span class ="hljs-comment "> # Saves figure.</ span >
1932
+ pyplot.show() < span class ="hljs-comment "> # Displays figure.</ span >
1933
+ pyplot.clf() < span class ="hljs-comment "> # Clears figure.</ span >
1932
1934
</ code > </ pre > </ div >
1933
1935
1934
1936
< 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 >
You can’t perform that action at this time.
0 commit comments