From 77a6afa3404c1b0839a1dc1d257c289aff46788f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 30 Mar 2023 18:09:22 +0200 Subject: [PATCH] Plot, Curses --- README.md | 13 +++++++------ index.html | 17 +++++++++-------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 20e4fe3..df113a3 100644 --- a/README.md +++ b/README.md @@ -2398,11 +2398,11 @@ Plot ```python # $ pip3 install matplotlib import matplotlib.pyplot as plt -plt.plot(, [, label=]) # Or: plt.plot() -plt.legend() # Adds a legend. -plt.savefig() # Saves the figure. -plt.show() # Displays the figure. -plt.clf() # Clears the figure. +plt.plot/bar/scatter(x_data, y_data [, label=]) # Or: plt.plot(y_data) +plt.legend() # Adds a legend. +plt.savefig() # Saves the figure. +plt.show() # Displays the figure. +plt.clf() # Clears the figure. ``` @@ -2433,7 +2433,8 @@ def main(screen): height, width = screen.getmaxyx() screen.erase() for y, filename in enumerate(paths[first : first+height]): - screen.addstr(y, 0, filename[:width-1], A_REVERSE * (filename == paths[selected])) + color = A_REVERSE if filename == paths[selected] else 0 + screen.addstr(y, 0, filename[:width-1], color) ch = screen.getch() selected += (ch == KEY_DOWN) - (ch == KEY_UP) selected = max(0, min(len(paths)-1, selected)) diff --git a/index.html b/index.html index eccb661..c42da56 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -1969,11 +1969,11 @@ Processing: 100%|████████████████████| 3

#Plot

# $ pip3 install matplotlib
 import matplotlib.pyplot as plt
-plt.plot(<x_data>, <y_data> [, label=<str>])   # Or: plt.plot(<y_data>)
-plt.legend()                                   # Adds a legend.
-plt.savefig(<path>)                            # Saves the figure.
-plt.show()                                     # Displays the figure.
-plt.clf()                                      # Clears the figure.
+plt.plot/bar/scatter(x_data, y_data [, label=<str>])  # Or: plt.plot(y_data)
+plt.legend()                                          # Adds a legend.
+plt.savefig(<path>)                                   # Saves the figure.
+plt.show()                                            # Displays the figure.
+plt.clf()                                             # Clears the figure.
 

#Table

Prints a CSV file as an ASCII table:

# $ pip3 install tabulate
@@ -1995,7 +1995,8 @@ print(table)
         height, width = screen.getmaxyx()
         screen.erase()
         for y, filename in enumerate(paths[first : first+height]):
-            screen.addstr(y, 0, filename[:width-1], A_REVERSE * (filename == paths[selected]))
+            color = A_REVERSE if filename == paths[selected] else 0
+            screen.addstr(y, 0, filename[:width-1], color)
         ch = screen.getch()
         selected += (ch == KEY_DOWN) - (ch == KEY_UP)
         selected = max(0, min(len(paths)-1, selected))
@@ -2934,7 +2935,7 @@ $ pyinstaller script.py --add-data '<path>:.'