import matplotlib.pyplot as plt import numpy as np from scipy.stats import t x = np.linspace(-5, 5, 100) degrees_of_freedom = [1, 4, 9, 29] # Varying degrees of freedom # Plotting T-distribution curves for different degrees of freedom for df in degrees_of_freedom: y = t.pdf(x, df) # Using default location and scale parameters (0 and 1) plt.plot(x, y, label=f"df = {df}") plt.xlabel('t') plt.ylabel('f(t)') plt.title('t-Distribution with Varying df') plt.legend() plt.show()