Last active
March 6, 2025 10:39
-
-
Save palawer/08ef79958168ecd2648897679247a0d7 to your computer and use it in GitHub Desktop.
Plot values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
# Updated data points | |
y_values = [298643, 299892, 307425, 333984, 349718, 376046, 387230, 386379, 389032, 363783, 338725, 339847, 325985, 321344, 359120, 373366, 377477, 388196, 391048, 392841] | |
x_values = list(range(len(y_values))) | |
# Plot in line | |
plt.figure(figsize=(12, 6)) | |
plt.plot(x_values, y_values, marker='o', linestyle='-', color='g', label="Values") | |
plt.title("Line Plot of Updated Values", fontsize=14) | |
plt.xlabel("Index", fontsize=12) | |
plt.ylabel("Value", fontsize=12) | |
plt.grid(True, linestyle='--', alpha=0.6) | |
plt.legend(fontsize=12) | |
plt.xticks(x_values) # Ensure x-ticks align with the indices | |
plt.tight_layout() | |
plt.show() | |
# Plot in bars | |
plt.figure(figsize=(12, 6)) | |
plt.bar(x_values, y_values, color='skyblue') | |
plt.xticks(rotation=90) | |
plt.xlabel("Month") | |
plt.ylabel("Value") | |
plt.title("Monthly Aggregated Values by SSCC") | |
plt.grid(axis='y', linestyle='--', alpha=0.7) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment