0% found this document useful (0 votes)
2 views10 pages

Lab1

The document contains multiple Python code snippets that utilize Matplotlib and NumPy for data visualization. It includes examples of scatter plots, line graphs, sine and cosine curves, exponential curves, and implicit plots of various mathematical equations. Each section demonstrates different plotting techniques and graphing functionalities.

Uploaded by

Nemo Hi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views10 pages

Lab1

The document contains multiple Python code snippets that utilize Matplotlib and NumPy for data visualization. It includes examples of scatter plots, line graphs, sine and cosine curves, exponential curves, and implicit plots of various mathematical equations. Each section demonstrates different plotting techniques and graphing functionalities.

Uploaded by

Nemo Hi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

copy-of-lab1

December 26, 2023

[ ]: import matplotlib.pyplot as plt

x = [1,2,3,4,6,7,8]
y = [2,7,9,1,5,10,3]
plt.scatter(x,y)
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('Scatter points')
plt.show()

1
[ ]: import matplotlib.pyplot as plt

x = [1,2,3,4,6,7,8]
y = [2,7,9,1,5,10,3]
plt.plot(x,y,'g+--')
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title('My first graph!')
plt.show()

[ ]: import numpy as np
import matplotlib.pyplot as plt

x=np.arange(-10,10,0.001)
y1=np.sin(x)
y2=np.cos(x)
plt.plot(x,y1,'r',x,y2,'g',)
plt.title("sine and cosine curve ")
plt.xlabel("values of x")
plt.ylabel("values of sin(x) and cos(x)")

2
plt.grid()
plt.show()

[ ]: import numpy as np
import matplotlib.pyplot as plt

x =np.arange(-10,10,0.001)

y =np.exp(x)
plt.plot(x,y)
plt.title("Exponential Curve")
plt.grid()
plt.show()

3
[ ]: import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(0,2,100)

plt.plot(x,x,'r',label='linear')
plt.plot(x,x**2,'g',label='quadratic')
plt.plot(x,x**3,'b',label='cubic')
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.title("Simple Plot")
plt.legend()
plt.show()

4
[ ]: from sympy import plot_implicit,symbols,Eq
x,y=symbols('x y')
p1=plot_implicit(Eq(x**2 + y**2,4),(x,-4,4),(y,-4,4),title='Circle:$x^2+y^2=4$')

5
[ ]: p3=␣
↪plot_implicit(Eq((y**2)*(2-x),(x**2)*(2+x)),(x,-5,5),(y,-5,5),title='Strophoid:

↪$y^2(a-x)=x^2 (a+x), a> 0$')

6
[ ]: p4=plot_implicit(Eq((y**2)*(3-x),x**3),(x,-2,5),(y,-5,5),title='Cissiod:
↪$y^2(a-x)=x^2,a>0$')

7
[ ]: p5=plot_implicit(Eq(4*(y**2),(x**2)*(4-x**2)),(x,-5,5),(y,-5,5),title='Lemniscate:
↪$a^2y^2=x^2(a^2-x^2)$')

8
[ ]: p6=plot_implicit(Eq(x**3+y**3,3*2*x*y),(x,-5,5),(y,-5,5),title='Folium of␣
↪De-Cartes:$x^2+y^2=3axy$')

9
10

You might also like