You are on page 1of 2

1/17/23, 3:50 PM Untitled - Jupyter Notebook

2-D Plotting
Date: 17/01/2023 Name: Srikanth Rajkumar Reg No: 2140869

Quote for the day: "Be the change you want to see in this is world"

In [26]:

import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(1,50,100)
y = np.exp(x)
plt.plot(x,y,'r')
plt.title("Function")
plt.xlabel('x')
plt.ylabel("exp(x)")
plt.show

Out[26]:

<function matplotlib.pyplot.show(close=None, block=None)>

In [28]:

y = x/5
z = x**(0.5)
plt.plot(y,color='r',label = 'square')
plt.plot(z,color='b',label='root')
plt.legend()
plt.show

Out[28]:

<function matplotlib.pyplot.show(close=None, block=None)>

localhost:8888/notebooks/Untitled Folder/Untitled.ipynb?kernel_name=python3 1/2


1/17/23, 3:50 PM Untitled - Jupyter Notebook

Subplots
In [33]:

X = np.arange(0, 6, 0.05)

Y1 = np.sin(X)
Y2 = np.cos(X)
Y3 = np.tan(X)
Y4 = np.tanh(X)

figure, axis = plt.subplots(2, 2)

axis[0, 0].plot(X, Y1)


axis[0, 0].set_title("Sine Function")

axis[0, 1].plot(X, Y2)


axis[0, 1].set_title("Cosine Function")

axis[1, 0].plot(X, Y3)


axis[1, 0].set_title("Tangent Function")

axis[1, 1].plot(X, Y4)


axis[1, 1].set_title("Tanh Function")

plt.suptitle("Cool plots")

plt.show()

In [ ]:

localhost:8888/notebooks/Untitled Folder/Untitled.ipynb?kernel_name=python3 2/2

You might also like