basic_plotting.ipynb - Colab https://colab.research.google.com/drive/1ohYsHiVa-xhxL6...
import matplotlib.pyplot as plt
import numpy as np
import scienceplots
plt.style.use(['science', 'no-latex'])
plt.rcParams['font.family'] = 'DejaVu Sans'
x = np.linspace(0, 6.3, 1000)
y1 = np.sin(x)
y2 = np.sin(2 * x)
y3 = np.cos(x)
plt.figure(figsize=(8, 5))
plt.plot(x, y1, label='sin(x)', linewidth=2, color='black')
plt.plot(x, y2, label='sin(2x)', linewidth=2, color='red')
plt.plot(x, y3, label='cos(x)', linewidth=2, color='green')
plt.xlabel('Angle(rad)', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
plt.legend(fontsize=12)
plt.axhline(0, color='blue')
plt.show()
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
x=np.linspace(-2, 2, 100)
y=np.linspace(-2, 2, 100)
X, Y = np.meshgrid(x, y)
1 of 6 8/1/25, 14:44
basic_plotting.ipynb - Colab https://colab.research.google.com/drive/1ohYsHiVa-xhxL6...
Z=(X**2) * (Y**2)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))
ax1.axis('off')
ax1 = fig.add_subplot(121, projection='3d')
surf = ax1.plot_surface(X, Y, Z, cmap='jet')
ax1.set_xlabel('x', fontsize=20)
ax1.set_ylabel('y', fontsize=20)
cax = ax2.imshow(Z, cmap='jet', interpolation='nearest', aspect='auto', extent=[
fig.colorbar(cax, ax=ax2)
surf = ax1.plot_surface(X, Y, Z, cmap='jet')
plt.tight_layout()
plt.show()
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
x=np.linspace(-2, 2, 100)
y=np.linspace(-2, 2, 100)
X, Y = np.meshgrid(x, y)
Z=Y*np.sin(X)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))
2 of 6 8/1/25, 14:44
basic_plotting.ipynb - Colab https://colab.research.google.com/drive/1ohYsHiVa-xhxL6...
ax1.axis('off')
ax1 = fig.add_subplot(121, projection='3d')
surf = ax1.plot_surface(X, Y, Z, cmap='jet')
ax1.set_xlabel('x', fontsize=20)
ax1.set_ylabel('y', fontsize=20)
cax = ax2.imshow(Z, cmap='jet', interpolation='nearest', aspect='auto', extent=[x.
fig.colorbar(cax, ax=ax2)
surf = ax1.plot_surface(X, Y, Z, cmap='jet')
plt.tight_layout()
plt.show()
import numpy as np
import matplotlib.pyplot as plt
import scienceplots
plt.style.use(['science', 'no-latex'])
plt.rcParams['font.family'] = 'DejaVu Sans'
data = np.loadtxt('/home/asmitha/Desktop/data.txt')
x = data[:, 0]
y = data[:, 1]
yerr = data[:, 2]
plt.figure(figsize=(8,6))
plt.errorbar(x, y, yerr=yerr, fmt='^', capsize=3, markersize=5, color='red')
plt.xlabel('X', fontsize=20)
plt.ylabel('Y', fontsize=20)
3 of 6 8/1/25, 14:44
basic_plotting.ipynb - Colab https://colab.research.google.com/drive/1ohYsHiVa-xhxL6...
plt.ylabel('Y', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
plt.show()
import numpy as np
x = np.arange(-100, 100, 0.1)
y = x**2 - x**3
data = np.stack((x, y), axis=1)
np.savetxt('cwork_data.txt', data, header='x y', comments='')
print("Data generated and saved to 'data.txt'")
Data generated and saved to 'data.txt'
import numpy as np
import matplotlib.pyplot as plt
import scienceplots
plt.style.use(['science', 'no-latex'])
plt.rcParams['font.family'] = 'DejaVu Sans'
data = np.loadtxt('/home/asmitha/Desktop/asmitha/cwork_data.txt', skiprows=1)
x = data[:, 0]
y = data[:, 1]
4 of 6 8/1/25, 14:44
basic_plotting.ipynb - Colab https://colab.research.google.com/drive/1ohYsHiVa-xhxL6...
plt.figure(figsize=(10, 6))
plt.plot(x, y, color='red', linewidth=3)
plt.xlabel('X', fontsize=20)
plt.ylabel('Y', fontsize=20)
plt.xticks(fontsize=15)
plt.yticks(fontsize=15)
plt.savefig('plot.png')
plt.savefig('plot.eps')
plt.show()
Start coding or generate with AI.
5 of 6 8/1/25, 14:44
basic_plotting.ipynb - Colab https://colab.research.google.com/drive/1ohYsHiVa-xhxL6...
6 of 6 8/1/25, 14:44