У меня возникли проблемы с запуском моего кода. Я никогда раньше не сталкивался с этой ошибкой (несколько месяцев назад), когда писал код, мне даже удалось получить свой график. Однако, когда я вчера попытался запустить его еще раз, я внезапно обнаружил ошибки (см. ниже).
ЭТО МОЙ КОД`
import importlib
импортировать панды как pd
импортировать numpy как np
импортировать научные графики
import sys
из pathlib путь импорта
из сигнала импорта scipy
импортировать matplotlib.pyplot как plt
импортировать matplotlib.ticker как тикер
импортировать matplotlib.gridspec как GridSpec `
FileNotFoundError Traceback (most recent call last)
Cell In[18], line 42
38 plt.xticks(fontsize=6)
39 plt.yticks(fontsize=6)
---> 42 plt.savefig("7_cT.png", dpi=600)
43 plt.savefig("7_cT.svg", dpi=300)
44 plt.tight_layout()
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\pyplot.py:1243, in savefig(*args, **kwargs)
1240 fig = gcf()
1241 # savefig default implementation has no return, so mypy is unhappy
1242 # presumably this is here because subclasses can return?
-> 1243 res = fig.savefig(*args, **kwargs) # type: ignore[func-returns-value]
1244 fig.canvas.draw_idle() # Need this if 'transparent=True', to reset colors.
1245 return res
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\figure.py:3490, in Figure.savefig(self, fname, transparent, **kwargs)
3488 for ax in self.axes:
3489 _recursively_make_axes_transparent(stack, ax)
-> 3490 self.canvas.print_figure(fname, **kwargs)
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2152 # we do this instead of `self.figure.draw_without_rendering`
2153 # so that we can inject the orientation
...
--> 343 raise self._missing_font.to_exception()
344 name = self._dtable[byte].__name__
345 if name == "_push":
FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'cmr6.tfm' in your texmf tree, but could not find it
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python313\site-packages\IPython\core\formatters.py:402, in BaseFormatter.__call__(self, obj)
400 pass
401 else:
--> 402 return printer(obj)
403 # Finally look for special method names
404 method = get_real_method(obj, self.print_method)
File ~\AppData\Roaming\Python\Python313\site-packages\IPython\core\pylabtools.py:170, in print_figure(fig, fmt, bbox_inches, base64, **kwargs)
167 from matplotlib.backend_bases import FigureCanvasBase
168 FigureCanvasBase(fig)
--> 170 fig.canvas.print_figure(bytes_io, **kw)
171 data = bytes_io.getvalue()
172 if fmt == 'svg':
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2152 # we do this instead of `self.figure.draw_without_rendering`
2153 # so that we can inject the orientation
2154 with getattr(renderer, "_draw_disabled", nullcontext)():
-> 2155 self.figure.draw(renderer)
2156 if bbox_inches:
2157 if bbox_inches == "tight":
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\artist.py:94, in _finalize_rasterization..draw_wrapper(artist, renderer, *args, **kwargs)
...
--> 343 raise self._missing_font.to_exception()
344 name = self._dtable[byte].__name__
345 if name == "_push":
FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'ptmr7t.tfm' in your texmf tree, but could not find it
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Я пробовал понизить версию Python, удалить и переустановить его, обновить пакеты и т. д. Я также нашел предложения о том, что мне нужно использовать sudo install texlive-full. Я попытался установить его, но процесс занял слишком много времени и в итоге завершился ошибкой.
У меня возникли проблемы с запуском моего кода. Я никогда раньше не сталкивался с этой ошибкой (несколько месяцев назад), когда писал код, мне даже удалось получить свой график. Однако, когда я вчера попытался запустить его еще раз, я внезапно обнаружил ошибки (см. ниже).
[b]ЭТО МОЙ КОД[/b]` import importlib импортировать панды как pd импортировать numpy как np импортировать научные графики import sys из pathlib путь импорта из сигнала импорта scipy импортировать matplotlib.pyplot как plt импортировать matplotlib.ticker как тикер импортировать matplotlib.gridspec как GridSpec `
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\pyplot.py:1243, in savefig(*args, **kwargs) 1240 fig = gcf() 1241 # savefig default implementation has no return, so mypy is unhappy 1242 # presumably this is here because subclasses can return? -> 1243 res = fig.savefig(*args, **kwargs) # type: ignore[func-returns-value] 1244 fig.canvas.draw_idle() # Need this if 'transparent=True', to reset colors. 1245 return res
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\figure.py:3490, in Figure.savefig(self, fname, transparent, **kwargs) 3488 for ax in self.axes: 3489 _recursively_make_axes_transparent(stack, ax) -> 3490 self.canvas.print_figure(fname, **kwargs)
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs) 2152 # we do this instead of `self.figure.draw_without_rendering` 2153 # so that we can inject the orientation ... --> 343 raise self._missing_font.to_exception() 344 name = self._dtable[byte].__name__ 345 if name == "_push":
FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'cmr6.tfm' in your texmf tree, but could not find it Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
File ~\AppData\Roaming\Python\Python313\site-packages\IPython\core\pylabtools.py:170, in print_figure(fig, fmt, bbox_inches, base64, **kwargs) 167 from matplotlib.backend_bases import FigureCanvasBase 168 FigureCanvasBase(fig) --> 170 fig.canvas.print_figure(bytes_io, **kw) 171 data = bytes_io.getvalue() 172 if fmt == 'svg':
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\backend_bases.py:2155, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs) 2152 # we do this instead of `self.figure.draw_without_rendering` 2153 # so that we can inject the orientation 2154 with getattr(renderer, "_draw_disabled", nullcontext)(): -> 2155 self.figure.draw(renderer) 2156 if bbox_inches: 2157 if bbox_inches == "tight":
File c:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\matplotlib\artist.py:94, in _finalize_rasterization..draw_wrapper(artist, renderer, *args, **kwargs) ... --> 343 raise self._missing_font.to_exception() 344 name = self._dtable[byte].__name__ 345 if name == "_push":
FileNotFoundError: Matplotlib's TeX implementation searched for a file named 'ptmr7t.tfm' in your texmf tree, but could not find it Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings... [/code]
Я пробовал понизить версию Python, удалить и переустановить его, обновить пакеты и т. д. Я также нашел предложения о том, что мне нужно использовать sudo install texlive-full. Я попытался установить его, но процесс занял слишком много времени и в итоге завершился ошибкой.
У меня возникли проблемы с запуском моего кода. Я никогда раньше не сталкивался с этой ошибкой (несколько месяцев назад), когда писал код, мне даже удалось получить свой график. Однако, когда я вчера попытался запустить его еще раз, я внезапно...
Я понимаю, что в matplotlib вы можете использовать rc или rcParams для настройки стиля построения графиков. Однако кажется, что эти функции существуют на двух уровнях, например matplotlib.rc против matplotlib.pyplot.rc или matplotlib.rcParams против...
Я пытаюсь написать программу, которая представляет данные из нескольких файлов CSV. Ось X соответствует каждому году, и потенциально в каждом году может быть 6 разных столбцов. Проблема в том, что некоторые столбцы имеют значение
Я начал работать с Python пару недель назад, и поэтому мои знания о Python низкие. Заполните его любым цветом. Я хочу видеть только последние края, как гистограмма линии. Я не могу использовать белый цвет, потому что я буду перекрывать различные...