Skip to content

Commit

Permalink
accept a mode
Browse files Browse the repository at this point in the history
  • Loading branch information
teuben committed Sep 3, 2024
1 parent 4df32aa commit a5b196d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions examples/simple_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# a simple matplotlib plot - testing for pipelines
#
_version = "3-sep-2023"
_mode = 0

import os
import sys
Expand All @@ -12,12 +13,21 @@


if __name__ == "__main__":
if len(sys.argv) > 1:
_mode = int(sys.argv[1])
plotfile = 'simple_plot.png'
else:
_mode = 0
plotfile = None

x = np.arange(0,2,0.1)
y = np.sqrt(x)

plt.figure()
plt.plot(x,y, label="test");
plt.legend()
plt.show()
fn = 'simple_plot.png'
plt.savefig(fn)
if plotfile == None:
plt.show()
else:
plt.savefig(plotfile)
print("Wrote ",plotfile)

0 comments on commit a5b196d

Please sign in to comment.