RuntimeError: LaTeX was not able to process the following string
See original GitHub issueTrying to reproduce the example:
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use(['science','ieee'])
x = np.linspace(0.75, 1.25, 201)
def model(x, p):
return x ** (2 * p + 1) / (1 + x ** (2 * p))
fig, ax = plt.subplots()
for p in [10, 15, 20, 30, 50, 100]:
ax.plot(x, model(x, p), label=p)
ax.legend(title=r'Order')
ax.set(xlabel=r'$V_0 / V_\mathrm{{gap}}$')
ax.set(ylabel=r'$I_\mathrm{{dc}}^0 / I_\mathrm{{gap}}$')
ax.autoscale(tight=True)
plt.show()
RuntimeError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
330 pass
331 else:
--> 332 return printer(obj)
333 # Finally look for special method names
334 method = get_real_method(obj, self.print_method)
~/anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py in <lambda>(fig)
235
236 if 'png' in formats:
--> 237 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
238 if 'retina' in formats or 'png2x' in formats:
239 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~/anaconda3/lib/python3.6/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
119
120 bytes_io = BytesIO()
--> 121 fig.canvas.print_figure(bytes_io, **kw)
122 data = bytes_io.getvalue()
123 if fmt == 'svg':
~/anaconda3/lib/python3.6/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2198 orientation=orientation,
2199 dryrun=True,
-> 2200 **kwargs)
2201 renderer = self.figure._cachedRenderer
2202 bbox_inches = self.figure.get_tightbbox(renderer)
~/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
543
544 def print_png(self, filename_or_obj, *args, **kwargs):
--> 545 FigureCanvasAgg.draw(self)
546 renderer = self.get_renderer()
547 original_dpi = renderer.dpi
~/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in draw(self)
462
463 try:
--> 464 self.figure.draw(self.renderer)
465 finally:
466 RendererAgg.lock.release()
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
61 def draw_wrapper(artist, renderer, *args, **kwargs):
62 before(artist, renderer)
---> 63 draw(artist, renderer, *args, **kwargs)
64 after(artist, renderer)
65
~/anaconda3/lib/python3.6/site-packages/matplotlib/figure.py in draw(self, renderer)
1142
1143 mimage._draw_list_compositing_images(
-> 1144 renderer, self, dsu, self.suppressComposite)
1145
1146 renderer.close_group('figure')
~/anaconda3/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite)
137 if not_composite or not has_images:
138 for zorder, a in dsu:
--> 139 a.draw(renderer)
140 else:
141 # Composite any adjacent images together
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
61 def draw_wrapper(artist, renderer, *args, **kwargs):
62 before(artist, renderer)
---> 63 draw(artist, renderer, *args, **kwargs)
64 after(artist, renderer)
65
~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe)
2424 renderer.stop_rasterizing()
2425
-> 2426 mimage._draw_list_compositing_images(renderer, self, dsu)
2427
2428 renderer.close_group('axes')
~/anaconda3/lib/python3.6/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, dsu, suppress_composite)
137 if not_composite or not has_images:
138 for zorder, a in dsu:
--> 139 a.draw(renderer)
140 else:
141 # Composite any adjacent images together
~/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
61 def draw_wrapper(artist, renderer, *args, **kwargs):
62 before(artist, renderer)
---> 63 draw(artist, renderer, *args, **kwargs)
64 after(artist, renderer)
65
~/anaconda3/lib/python3.6/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs)
1136 ticks_to_draw = self._update_ticks(renderer)
1137 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
-> 1138 renderer)
1139
1140 for tick in ticks_to_draw:
~/anaconda3/lib/python3.6/site-packages/matplotlib/axis.py in _get_tick_bboxes(self, ticks, renderer)
1076 for tick in ticks:
1077 if tick.label1On and tick.label1.get_visible():
-> 1078 extent = tick.label1.get_window_extent(renderer)
1079 ticklabelBoxes.append(extent)
1080 if tick.label2On and tick.label2.get_visible():
~/anaconda3/lib/python3.6/site-packages/matplotlib/text.py in get_window_extent(self, renderer, dpi)
965 raise RuntimeError('Cannot get window extent w/o renderer')
966
--> 967 bbox, info, descent = self._get_layout(self._renderer)
968 x, y = self.get_unitless_position()
969 x, y = self.get_transform().transform_point((x, y))
~/anaconda3/lib/python3.6/site-packages/matplotlib/text.py in _get_layout(self, renderer)
351 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',
352 self._fontproperties,
--> 353 ismath=False)
354 offsety = (lp_h - lp_bl) * self._linespacing
355
~/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height_descent(self, s, prop, ismath)
228 fontsize = prop.get_size_in_points()
229 w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
--> 230 renderer=self)
231 return w, h, d
232
~/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py in get_text_width_height_descent(self, tex, fontsize, renderer)
674 else:
675 # use dviread. It sometimes returns a wrong descent.
--> 676 dvifile = self.make_dvi(tex, fontsize)
677 dvi = dviread.Dvi(dvifile, 72 * dpi_fraction)
678 try:
~/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py in make_dvi(self, tex, fontsize)
421 'string:\n%s\nHere is the full report generated by '
422 'LaTeX: \n\n' % repr(tex.encode('unicode_escape')) +
--> 423 report))
424 else:
425 mpl.verbose.report(report, 'debug')
RuntimeError: LaTeX was not able to process the following string:
b'lp'
Here is the full report generated by LaTeX:
<matplotlib.figure.Figure at 0x7fbdfc553a20>```
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Matplotlib Error: LaTeX was not able to process the following ...
It seems you are missing a package for the dvi rendering. On debian-based distributions, this should suffice to get all the needed packages:...
Read more >LaTeX was not able to process the following string
RuntimeError : LaTeX was not able to process the following string: 'user_dir/ubm_gmm/scores/nonorm/scores-dev'. I need some help if possible. Thanks.
Read more >Latex does not work in Python's matplotlib - TeX
There, I want to use Latex, but I get the following error: ... RuntimeError: latex was not able to process the following string:...
Read more >Binder-examples / latex fails - repo help
I was able to launch the notebook on Binder. ... RuntimeError: latex was not able to process the following string: b'lp' Here is...
Read more >Getting Started With Matplotlib - Kaggle
Easy to get started; Support LATEX formatted labels and texts ... return report RuntimeError: latex was not able to process the following string:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @taneta,
This error seems to be caused by LaTeX. You can disable LaTeX by using:
Otherwise, I’ve also added a new style to disable LaTeX:
Please let me know if that works!
I faced this problem when I used Jupyter notebook.