-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Sample code given in Matplotlib's site does not work. #12286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Have you installed latex?
I'm going to close because I think this is just a config error. |
This is not a fix for this issue but a suggestion. |
@RushikeshAgashe That is indeed a totally different problem. If that line of code does not work, it's probably because the example is run with python 2. One could then refer to the matplotlib 2.2.3 version of that example, which looks a bit different. I think this line is especially there to show how to use unicode symbols with tex so I would suggest not to replace it. |
@RushikeshAgashe , thanks for the suggestion, but the script still doesn't work. |
@ImportanceOfBeingErnest , thanks for pointing that 2.2.3 version of the example, but it didn't work either. |
Re-opening, because even if this is a config issue the error should be much clearer. @fbarbuto does the example from 2.2.3 give the same error you posted above? |
@fbarbuto As suggested above by @jklymak you need a working tex install in order to be able to use
I don't think we can give support on installing tex here. |
Something like #9639 (needs additional work, I know) would help with giving a |
OK. MiKTeX installed and added to PATH. Still nothing but error messages and a blank Matplotlib plotting window. The new error messages: """ I don't think it's necessary to attach a snapshot of the blank plotting window here. Just imagine a Matplotlib frame with title & icons & everything else but with no plot inside. Heavenly white. Thanks for the support & ideas you're giving me. Much appreciated. |
Did you run the demo in a new terminal session after updating your PATH? If
the terminal session already existed before you updated the PATH, then the
change wouldn't take effect yet.
…On Wed, Sep 26, 2018 at 11:06 AM fbarbuto ***@***.***> wrote:
OK. MiKTeX installed and added to PATH. Still nothing but error messages
and a blank Matplotlib plotting window.
The new error messages:
"""
F:\Documents\Programs\Python>python tex_demo.py
Traceback (most recent call last):
File "C:\Program
Files\Python\lib\site-packages\matplotlib\backends\backend_qt5.py", line
519, in _draw_idle
self.draw()
File "C:\Program
Files\Python\lib\site-packages\matplotlib\backends\backend_agg.py", line
437, in draw
self.figure.draw(self.renderer)
File "C:\Program Files\Python\lib\site-packages\matplotlib\artist.py",
line 55, in draw_wrapper
return draw(artist, renderer,
*args, **kwargs) File "C:\Program
Files\Python\lib\site-packages\matplotlib\figure.py", line 1484, in draw
**self._tight_parameters) File "C:\Program
Files\Python\lib\site-packages\matplotlib\figure.py", line 2307, in
tight_layout pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect) File "C:\Program
Files\Python\lib\site-packages\matplotlib\tight_layout.py", line 349, in
get_tight_layout_figure pad=pad, h_pad=h_pad, w_pad=w_pad) File "C:\Program
Files\Python\lib\site-packages\matplotlib\tight_layout.py", line 115, in
auto_adjust_subplotpars if ax.get_visible()]) File "C:\Program
Files\Python\lib\site-packages\matplotlib\axes_base.py", line 4192, in
get_tightbbox bb.append(self.title.get_window_extent(renderer)) File
"C:\Program Files\Python\lib\site-packages\matplotlib\text.py", line 924,
in get_window_extent bbox, info, descent = self._get_layout(self._renderer)
File "C:\Program Files\Python\lib\site-packages\matplotlib\text.py", line
309, in get_layout ismath=ismath) File "C:\Program
Files\Python\lib\site-packages\matplotlib\backends\backend_agg.py", line
236, in get_text_width_height_descent s, fontsize, renderer=self) File
"C:\Program Files\Python\lib\site-packages\matplotlib\texmanager.py", line
501, in get_text_width_height_descent dvifile = self.make_dvi(tex,
fontsize) File "C:\Program
Files\Python\lib\site-packages\matplotlib\texmanager.py", line 362, in
make_dvi with Locked(self.texcache): File "C:\Program
Files\Python\lib\site-packages\matplotlib\cbook_init.py", line 2529, in
enter raise self.TimeoutError(err_str) TimeoutError: LOCKERROR: matplotlib
is trying to acquire the lock
u'C:\Users\Fausto\.matplotlib\tex.cache\.matplotlib_lock-*'
and has failed. This maybe due to any other process holding this
lock. If you are sure no other matplotlib process is running try
removing these folders and trying again.
"""
I don't think it's necessary to attach a snapshot of the blank plotting
window here. Just imagine a Matplotlib frame with title & icons &
everything else but with no plot inside. Heavenly white.
Thanks for the support & ideas you're giving me. Much appreciated.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#12286 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-JuDVJUlkgLWn21pS8qYisXlNPCWks5ue5gKgaJpZM4W5i9u>
.
|
@WeatherGod , Yes, I did that. |
Does |
I fixed the problem and the script is now working. Tell you what I did. Matplotlib complained about folder Thanks to everyone who helped me out with that. |
I can get it to work as a script with no problem, but the jupyter notebook fails: `--------------------------------------------------------------------------- C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in (fig) C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py in tight_layout(self, renderer, pad, h_pad, w_pad, rect) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py in auto_adjust_subplotpars(fig, renderer, nrows_ncols, num1num2_list, subplot_list, ax_bbox_list, pad, h_pad, w_pad, rect) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\tight_layout.py in (.0) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes_base.py in get_tightbbox(self, renderer, call_axes_locator, bbox_extra_artists) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py in get_tightbbox(self, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py in _update_label_position(self, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py in _get_tick_boxes_siblings(self, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py in _get_tick_bboxes(self, ticks, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py in get_window_extent(self, renderer, dpi) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py in _get_layout(self, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in get_text_width_height_descent(self, s, prop, ismath) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in iter(self) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in _read(self) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in wrapper(self, byte) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in _fnt_def(self, k, c, s, d, a, l) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in _fnt_def_real(self, k, c, s, d, a, l) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in _fontfile(cls, suffix, texname) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\dviread.py in find_tex_file(filename, format) C:\ProgramData\Anaconda3\lib\subprocess.py in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text) C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session) FileNotFoundError: [WinError 2] The system cannot find the file specified ` |
@juancaros That likely means the installation of latex is visible in the context where you are running it as a script, but not in the context of where the jupyter kernel is running. |
Oddly, I make it work by ignoring the usetex parameter on matplotlib as suggested in other forum. |
Bug report
Bug summary
The sample script given in
https://matplotlib.org/gallery/text_labels_and_annotations/tex_demo.html?highlight=tex
does not work, producing a large number of error messages and an empty (blank) plotting window.
Code for reproduction
Actual outcome
Matplotlib version
Matplotlib was installed through pip.
The text was updated successfully, but these errors were encountered: