Как обеспечить, чтобы данные всегда оставались читаемыми?
Все решения приветствуются, включая использование других пакетов. p>
Мой код:
Код: Выделить всё
import json
import matplotlib.pyplot as plt
# Load the JSON data from the file
with open('sorted_data.json', 'r') as file:
sorted_data = json.load(file)
# Create a list of dates and corresponding values for each number
dates = list(sorted_data.keys())[:150]
numbers = list(sorted_data.values())[:150]
# Set a larger figure size
plt.figure(figsize=(10, 6)) # Adjust the width and height as needed
# Create a scatter plot for each date
for i in range(len(dates)):
date = dates[i]
number_values = list(numbers[i].values())
plt.scatter([date]*7, list(numbers[i].values()), label=date)
# Adding labels and title
plt.xlabel('Dates')
plt.ylabel('Values')
plt.title('Visualization of Sorted JSON Data')
plt.xticks(rotation=45) # Rotate the x-axis labels for better visibility
plt.legend() # Show the legend
# Display the plot
plt.show()
Код: Выделить всё
{
"2000-01-01": {
"n1": 9,
"n2": 19,
"n3": 22,
"n4": 39,
"n5": 41,
"n6": 42,
"n7": 17
},
"2000-01-05": {
"n1": 9,
"n2": 13,
"n3": 14,
"n4": 22,
"n5": 23,
"n6": 39,
"n7": 18
},...
}
Пытаюсь визуализировать большие наборы данных в Python, и я ожидаю, что они всегда будут читаемы
Подробнее здесь: https://stackoverflow.com/questions/782 ... matplotlib
Мобильная версия