diff --git a/fig_1.png b/fig_1.png new file mode 100644 index 000000000..d06a8e665 Binary files /dev/null and b/fig_1.png differ diff --git a/fig_2.png b/fig_2.png new file mode 100644 index 000000000..42400c43e Binary files /dev/null and b/fig_2.png differ diff --git a/fig_3.png b/fig_3.png new file mode 100644 index 000000000..c19f6fffc Binary files /dev/null and b/fig_3.png differ diff --git a/fig_4.png b/fig_4.png new file mode 100644 index 000000000..ba300e470 Binary files /dev/null and b/fig_4.png differ diff --git a/fig_task1.png b/fig_task1.png new file mode 100644 index 000000000..1a71b8621 Binary files /dev/null and b/fig_task1.png differ diff --git a/fig_task2.png b/fig_task2.png new file mode 100644 index 000000000..af63018ea Binary files /dev/null and b/fig_task2.png differ diff --git a/fig_task3.png b/fig_task3.png new file mode 100644 index 000000000..3d24a1b33 Binary files /dev/null and b/fig_task3.png differ diff --git a/fig_task4_spiral.png b/fig_task4_spiral.png new file mode 100644 index 000000000..cd5e9ce86 Binary files /dev/null and b/fig_task4_spiral.png differ diff --git a/fig_task4log.png b/fig_task4log.png new file mode 100644 index 000000000..404f74db6 Binary files /dev/null and b/fig_task4log.png differ diff --git a/lab_6_task1.py b/lab_6_task1.py new file mode 100644 index 000000000..5868fd01f --- /dev/null +++ b/lab_6_task1.py @@ -0,0 +1,8 @@ +import matplotlib.pyplot as plt + +x = [1, 1, 5, 5, 1] +y = [1, 5, 5, 1, 1] + +plt.plot(x, y) +plt.axis('equal') +plt.savefig('fig_task1.png') \ No newline at end of file diff --git a/lab_6_task2.py b/lab_6_task2.py new file mode 100644 index 000000000..f0a981d1d --- /dev/null +++ b/lab_6_task2.py @@ -0,0 +1,25 @@ +import matplotlib.pyplot as plt +import numpy as np + +def hyper(minimum, maximum, N): + N = int(N/2) + + x = np.linspace(0, maximum, N+1) + x = np.delete(x, 0) + y = 20/x + plt.plot(x, y, color='b', label="my hyperbola") + + x = np.linspace(minimum, 0, N+1) + x = np.delete(x, -1) + y = 20/x + plt.plot(x, y, color='b') + + plt.xlabel("Coord - x") + plt.ylabel("Coord - y") + plt.title("Parabola") + plt.legend() + plt.grid() + + plt.savefig('fig_task2.png') + +hyper(int(input("Введите значение минимума х: ")), int(input("Введите значение максимума х: ")), int(input("Введите значение N: "))) \ No newline at end of file diff --git a/lab_6_task3.py b/lab_6_task3.py new file mode 100644 index 000000000..21e8044b7 --- /dev/null +++ b/lab_6_task3.py @@ -0,0 +1,17 @@ +import matplotlib.pyplot as plt +import numpy as np + + +def ellipse(a, b, minimum,maximum, N): + + x = np.linspace(minimum, maximum, N) + y = np.linspace(minimum, maximum, N) + + X, Y = np.meshgrid(x, y) + + fxy = (X**2)/(a**2) + (Y**2)/(b**2) - 1 + + plt.contour(X, Y, fxy, levels=[0]) + plt.savefig('fig_task3.png') + +ellipse(int(input("Введите значение большой полуоси: ")), int(input("Введите значение малой полуоси: ")), int(input("Введите значение минимального значения Х: ")), int(input("Введите значение максимального значения Х: ")), int(input("Введите значение N: "))) \ No newline at end of file diff --git a/lab_6_task4log.py b/lab_6_task4log.py new file mode 100644 index 000000000..cfda144ca --- /dev/null +++ b/lab_6_task4log.py @@ -0,0 +1,23 @@ +import matplotlib.pyplot as plt +import numpy as np + +# Уравнение логарифмической спирали в полярных координатах: ρ = a * exp(b * θ) +a = 1 # Масштабный коэффициент +b = 0.2 # Коэффициент, определяющий крутизну спирали + +theta = np.linspace(0, 10*np.pi, 500) # Угол от 0 до 10π +rho = a * np.exp(b * theta) + +# Преобразование в декартовы координаты +x = rho * np.cos(theta) +y = rho * np.sin(theta) + +# Построение графика +plt.figure(figsize=(8, 8)) +plt.plot(x, y) +plt.title('Логарифмическая спираль') +plt.xlabel('x') +plt.ylabel('y') +plt.grid(True) +plt.gca().set_aspect('equal', adjustable='box') # Для правильного отображения +plt.savefig('fig_task4log.png') \ No newline at end of file diff --git a/lab_6_task4spiral.py b/lab_6_task4spiral.py new file mode 100644 index 000000000..65bc46733 --- /dev/null +++ b/lab_6_task4spiral.py @@ -0,0 +1,20 @@ +import matplotlib.pyplot as plt +import numpy as np + +def spiral(k): + phi = np.arange(0, 8*(np.pi), 0.1) + r = k * phi + x = r * np.cos(phi) + y = r * np.sin(phi) + + plt.plot(x, y, label="Архимедоа спираль") + plt.xlabel("Coord - x") + plt.ylabel("Coord - y") + plt.title("Архимедоа спираль") + plt.legend() + plt.grid() + plt.axis('equal') + + plt.savefig('fig_task4_spiral.png') + +spiral(float(input("Введите значение k: "))) \ No newline at end of file diff --git a/less_6_matplotlib.pyplot.py b/less_6_matplotlib.pyplot.py new file mode 100644 index 000000000..2f4529993 --- /dev/null +++ b/less_6_matplotlib.pyplot.py @@ -0,0 +1,6 @@ + +import matplotlib.pyplot as plt + +# Построение графика по точкам +plt.plot([1, 2, 3], [5, 7, 10]) +plt.savefig('fig_1.png') # Сохранение графика diff --git "a/less_6_\320\235\320\265\321\217\320\262\320\275\320\276\320\265 \320\267\320\260\320\264\320\260\320\275\320\270\320\265.py" "b/less_6_\320\235\320\265\321\217\320\262\320\275\320\276\320\265 \320\267\320\260\320\264\320\260\320\275\320\270\320\265.py" new file mode 100644 index 000000000..c8b7b7281 --- /dev/null +++ "b/less_6_\320\235\320\265\321\217\320\262\320\275\320\276\320\265 \320\267\320\260\320\264\320\260\320\275\320\270\320\265.py" @@ -0,0 +1,23 @@ + +import matplotlib.pyplot as plt +import numpy as np + + +def circle_plotter(R=10): + + x = np.arange(-2*R, 2*R, 0.1) + y = np.arange(-2*R, 2*R, 0.1) + + # Переход к неявнозаданным координатам + X, Y = np.meshgrid(x, y) + + fxy = X**2 + Y**2 - R**2 # Уравнение окружности + + # Команда рисования + plt.contour(X, Y, fxy, levels=[0]) + + plt.savefig('fig_4.png') + + +if __name__ == '__main__': + circle_plotter() \ No newline at end of file diff --git "a/less_6_\320\243\320\272\321\200\320\260\321\210\320\260\321\202\320\265\320\273\321\214\321\201\321\202\320\262\320\260.py" "b/less_6_\320\243\320\272\321\200\320\260\321\210\320\260\321\202\320\265\320\273\321\214\321\201\321\202\320\262\320\260.py" new file mode 100644 index 000000000..52daa3a28 --- /dev/null +++ "b/less_6_\320\243\320\272\321\200\320\260\321\210\320\260\321\202\320\265\320\273\321\214\321\201\321\202\320\262\320\260.py" @@ -0,0 +1,15 @@ +import matplotlib.pyplot as plt + +x = [3, 8, 5] +y = [7, 4, 9] + +plt.plot(x, y, color='g', label='Graf 1', marker='>', ms=5) +plt.plot(y, x, color='r', label='Graf 2', marker='o', ms=3) + +# --- Украшательства --- +plt.xlabel('Coord: x') # Подись оси ОХ +plt.ylabel('Coord: y') # Подпись оси ОУ +plt.legend() # Вызов "легенды" +plt.title('Base') # Общая подпись графика +plt.grid() # Подключение сетки +plt.savefig('fig_2.png') diff --git "a/less_6_\320\257\320\262\320\275\320\276\320\265 \320\267\320\260\320\264\320\260\320\275\320\270\320\265.py" "b/less_6_\320\257\320\262\320\275\320\276\320\265 \320\267\320\260\320\264\320\260\320\275\320\270\320\265.py" new file mode 100644 index 000000000..fd08d26b8 --- /dev/null +++ "b/less_6_\320\257\320\262\320\275\320\276\320\265 \320\267\320\260\320\264\320\260\320\275\320\270\320\265.py" @@ -0,0 +1,21 @@ + +import matplotlib.pyplot as plt +import numpy as np + + +def parabola_plotter(a=1, b=1, c=0): + + x = np.arange(-10, 10, 0.01) + y = a*x**2 + b*x + c + + plt.plot(x, y, label='my parabola') + plt.xlabel('coord - x') + plt.ylabel('coord - y') + plt.title('Parabola plotter') + plt.legend() + + plt.savefig('fig_3.png') + + +if __name__ == '__main__': + parabola_plotter() \ No newline at end of file