import matplotlib.pyplot as plt
from numpy import arange
from numpy import meshgrid
xs = arange(-13,13, 0.1)
ys = arange(-13,13, 0.1)
x, y = meshgrid(xs, ys)
eq1 = abs(abs(x)-5)+abs(abs(y)-5)-6
eq2 = x**2+y**2-16
eq3 = x**2+y**2-36
eq4 = x**6+y**6-1960000
plt.contour(x, y, eq1,[0])
plt.contour(x, y, eq2,[0])
plt.contour(x, y, eq3,[0])
plt.contour(x, y, eq4,[0])
plt.show()
#設計 Logo
# 作圖 y=sin(x) and y=cos(x^2)
# y=sin(x) and y=cos(x^2)
# python code is as follows:
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 1000)
y1 = np.sin(x)
y2= np.cos(x**2)
plt.figure(figsize=(8,6))
plt.plot(x,y1,color="red",linewidth=2,label="$y=sin(x)$")
plt.plot(x,y2,"b--",label="$y=cos(x^2)$")
plt.xlabel("Time(s)")
plt.ylabel("Volt")
plt.title("$y=sin(x)$ and $y=cos(x^2)$ ")
plt.ylim(-1.2,1.2)
plt.legend(loc='lower left')
plt.show()
# The output is as follows:
訂閱:
文章 (Atom)