Content deleted Content added
Grasshopperx (talk | contribs) Added section "Animations" containing information about matplotlib animations. |
No edit summary Tags: Reverted Mobile edit Mobile web edit |
||
Line 35:
[[Matplotlib]] supports various types of 2 dimensional and 3 dimensional plots. The support for two dimensional plots is robust. The support for three dimensional plots was added later and while it is good, it is not as robust as 2 dimensional plots.
import matplotlib.pyplot as plt
import statistics
UA_data = [301, 311, 294, 279, 275, 285, 302, 308, 295, 297, 315, 312, 316, 316, 311, 304, 298, 292, 288, 300]
days = range(1, 21)
mean_UA = statistics.mean(UA_data)
stdev_UA = statistics.stdev(UA_data)
plt.figure(figsize=(10, 6)) # Adjust figure size as needed
plt.plot(days, UA_data, marker='o', linestyle='-')
plt.axhline(mean_UA, color='r', linestyle='--', label=f'Mean: {mean_UA:.2f}')
plt.axhline(mean_UA + stdev_UA, color='g', linestyle='--', label=f'Mean + 1SD')
plt.axhline(mean_UA - stdev_UA, color='g', linestyle='--')
plt.axhline(mean_UA + 2 * stdev_UA, color='b', linestyle='--', label=f'Mean + 2SD')
plt.axhline(mean_UA - 2 * stdev_UA, color='b', linestyle='--')
plt.axhline(mean_UA + 3 * stdev_UA, color='k', linestyle='--', label=f'Mean + 3SD')
plt.axhline(mean_UA - 3 * stdev_UA, color='k', linestyle='--')
plt.xlabel('Day')
plt.ylabel('Uric Acid Level')
plt.title('Levey-Jennings Chart for Uric Acid')
plt.legend()
plt.grid(True)
plt.show()
==Animations==
|