diff --git a/bigos/lecture20241203/matplot01.py b/bigos/lecture20241203/matplot01.py new file mode 100644 index 0000000..4fc08c3 --- /dev/null +++ b/bigos/lecture20241203/matplot01.py @@ -0,0 +1,20 @@ +import matplotlib.pyplot as plt +import numpy as np + +plt.style.use('_mpl-gallery') + +# Make data +n = 100 +xs = np.linspace(0, 1, n) +ys = np.sin(xs * 6 * np.pi) +zs = np.cos(xs * 6 * np.pi) + +# Plot +fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) +ax.plot(xs, ys, zs) + +ax.set(xticklabels=[], + yticklabels=[], + zticklabels=[]) + +plt.show() \ No newline at end of file diff --git a/bigos/lecture20241203/matplot02.py b/bigos/lecture20241203/matplot02.py new file mode 100644 index 0000000..a404e90 --- /dev/null +++ b/bigos/lecture20241203/matplot02.py @@ -0,0 +1,24 @@ +import matplotlib.pyplot as plt +import numpy as np + +plt.style.use('_mpl-gallery') + +# make data +x = np.linspace(0, 10, 100) +y = 4 + 1 * np.sin(2 * x) +x2 = np.linspace(0, 10, 25) +y2 = 4 + 1 * np.sin(2 * x2) + +print(x) + +# plot +fig, ax = plt.subplots() + +#ax.plot(x2, y2 + 2.5, 'x', markeredgewidth=2) +ax.plot(x, y, linewidth=2.0) +#ax.plot(x2, y2 - 2.5, 'o-', linewidth=2) + +ax.set(xlim=(0, 8), xticks=np.arange(1, 8), + ylim=(0, 8), yticks=np.arange(1, 8)) + +plt.show() \ No newline at end of file diff --git a/bigos/lecture20241203/numpy01.py b/bigos/lecture20241203/numpy01.py new file mode 100644 index 0000000..ba302c3 --- /dev/null +++ b/bigos/lecture20241203/numpy01.py @@ -0,0 +1,8 @@ +import numpy as np +from numpy import pi +np.linspace(0, 2, 9) # 9 numbers from 0 to 2 +x = np.linspace(0, 2 * pi, 100) # useful to evaluate function at lots of points +f = np.sin(x) + +print(x) +print(f) diff --git a/bigos/lecture20241203a/barcode01.py b/bigos/lecture20241203a/barcode01.py new file mode 100644 index 0000000..1a60c33 --- /dev/null +++ b/bigos/lecture20241203a/barcode01.py @@ -0,0 +1,12 @@ +# import EAN13 from barcode module +from barcode import EAN13 + +# Make sure to pass the number as string +number = '5901234123457' + +# Now, let's create an object of EAN13 +# class and pass the number +my_code = EAN13(number) + +# Our barcode is ready. Let's save it. +my_code.save("new_code") diff --git a/bigos/lecture20241203a/barcode02.py b/bigos/lecture20241203a/barcode02.py new file mode 100644 index 0000000..f5089ee --- /dev/null +++ b/bigos/lecture20241203a/barcode02.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# https://stackoverflow.com/questions/57427243/how-to-generate-barcode-in-python-3-7 + +import barcode +from barcode.writer import ImageWriter + +def testEan(): + EAN = barcode.get_barcode_class('ean13') + ean = EAN(u'123456789011', writer=ImageWriter()) + fullname = ean.save('my_ean13_barcode') + +if __name__ == '__main__': + testEan() + diff --git a/bigos/lecture20241203a/basic_qrcode.png b/bigos/lecture20241203a/basic_qrcode.png new file mode 100644 index 0000000..d26782d Binary files /dev/null and b/bigos/lecture20241203a/basic_qrcode.png differ diff --git a/bigos/lecture20241203a/my_ean13_barcode.png b/bigos/lecture20241203a/my_ean13_barcode.png new file mode 100644 index 0000000..77935f6 Binary files /dev/null and b/bigos/lecture20241203a/my_ean13_barcode.png differ diff --git a/bigos/lecture20241203a/myqr.png b/bigos/lecture20241203a/myqr.png new file mode 100644 index 0000000..33857ba Binary files /dev/null and b/bigos/lecture20241203a/myqr.png differ diff --git a/bigos/lecture20241203a/myqr.svg b/bigos/lecture20241203a/myqr.svg new file mode 100644 index 0000000..eb0d0b7 --- /dev/null +++ b/bigos/lecture20241203a/myqr.svg @@ -0,0 +1,2 @@ + + diff --git a/bigos/lecture20241203a/qrcode01.py b/bigos/lecture20241203a/qrcode01.py new file mode 100644 index 0000000..6f855d5 --- /dev/null +++ b/bigos/lecture20241203a/qrcode01.py @@ -0,0 +1,6 @@ +# basic_qrcode.py + +import segno + +qrcode = segno.make_qr("Hello, World") +qrcode.save("basic_qrcode.png") diff --git a/bigos/lecture20241203a/qrcode02.py b/bigos/lecture20241203a/qrcode02.py new file mode 100644 index 0000000..ae1992d --- /dev/null +++ b/bigos/lecture20241203a/qrcode02.py @@ -0,0 +1,21 @@ +# Import QRCode from pyqrcode + +# from https://www.geeksforgeeks.org/python-generate-qr-code-using-pyqrcode-module/ + +import pyqrcode +import png +from pyqrcode import QRCode + + +# String which represents the QR code +#s = "www.geeksforgeeks.org" +s = "cset.stcc.edu" + +# Generate QR code +url = pyqrcode.create(s) + +# Create and save the svg file naming "myqr.svg" +url.svg("myqr.svg", scale = 8) + +# Create and save the png file naming "myqr.png" +url.png('myqr.png', scale = 6)