#AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'?
#import matplotlib.pyplot as plt
#========================
# This can be work
# import matplotlib
# matplotlib.use('TkAgg')
# import matplotlib.pyplot as plt
#=========================
with open('notebook.txt', encoding='utf-8') as file:
# contents = file.read()
# print(contents)
# for line in file:
# print('line:', line)
contents = file.readlines()
print(contents)
newList = []
for content in contents:
newContent = content.replace('\n', '')
money = newContent.split(':')[-1]
newList.append(int(money))
# 6月: 9000
# contents = content.replace('\n', '')
print(newList)
x = [1, 2, 3, 4, 5, 6]
y = newList
plt.plot(x, y, 'r')
plt.xlabel('month')
plt.ylabel('money')
plt.legend()
plt.show()
Я учусь рисовать графики с помощью matplotlib, но импортирую matplolib.plylot, поскольку plt не распознает данные. У меня установлен пакет matplotlib, но я подозреваю, что он установлен не по правильному пути. Есть ли способ решить эту проблему?
[code]#AttributeError: 'FigureCanvasInterAgg' object has no attribute 'tostring_rgb'. Did you mean: 'tostring_argb'? #import matplotlib.pyplot as plt
#======================== # This can be work # import matplotlib # matplotlib.use('TkAgg') # import matplotlib.pyplot as plt #=========================
with open('notebook.txt', encoding='utf-8') as file: # contents = file.read() # print(contents) # for line in file: # print('line:', line) contents = file.readlines() print(contents)
newList = [] for content in contents: newContent = content.replace('\n', '') money = newContent.split(':')[-1] newList.append(int(money)) # 6月: 9000 # contents = content.replace('\n', '') print(newList) x = [1, 2, 3, 4, 5, 6] y = newList plt.plot(x, y, 'r') plt.xlabel('month') plt.ylabel('money') plt.legend() plt.show() [/code] [code]1月: 7000 2月: 10000 3月: 15000 4月: 12000 5月: 13000 6月: 9000 [/code] Я учусь рисовать графики с помощью matplotlib, но импортирую matplolib.plylot, поскольку plt не распознает данные. У меня установлен пакет matplotlib, но я подозреваю, что он установлен не по правильному пути. Есть ли способ решить эту проблему?
Я пытаюсь следовать инструкциям и реплицировать этот репозиторий github, при этом я сначала клонировал весь репозиторий в свою систему, как указано в уценке readme, однако когда я хотел загрузить все зависимости и необходимые библиотеки, я получаю...
Ранее я установил несколько пакетов, таких как Matplotlib, NumPy, pip (версия 23.3.1), Wheel (версия 0.41.2) и т. д., и немного программировал с их помощью. Я использовал команду C:\Users\UserName>pip list, чтобы найти список установленных мной...
Мне интересно увидеть нейронную сеть в виде графа с использованием тензорной доски. Я построил сеть в pytorch со следующим кодом:
import torch
BATCH_SIZE = 16
DIM_IN = 1000
HIDDEN_SIZE = 100
DIM_OUT = 10