Using Latex features while plotting in Julia (using Jupyter Notebook)

My code to plot with Latex features is,

rc(“text”, usetex=true)
rc(“font”, family=“serif”)

Plot

errorbar(ω, A, yerr=ΔA, fmt=“.”, label=“Messdaten”)
plot(ω, model(ω, γ), label=“Fit”)

title(“Schwingungsamplitude vs. Motorfrequenz”)
xlabel(L"Motorfrequenz \omega“)
ylabel(L"Schwingungsamplitude A”)
legend()

savefig(“Schwingungsamplitude.pdf”)

While executing this code, I get this error (a huge one :frowning:),
PyError ($(Expr(:escape, :(ccall(#= C:\Users\Purvaash.julia\packages\PyCall\zqDXB\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class ‘RuntimeError’>
RuntimeError(‘Failed to process string with tex because latex could not be found’)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\pyplot.py”, line 859, in savefig
res = fig.savefig(*args, **kwargs)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\figure.py”, line 2311, in savefig
self.canvas.print_figure(fname, **kwargs)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\backend_bases.py”, line 2210, in print_figure
result = print_method(
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\backend_bases.py”, line 1639, in wrapper
return func(*args, **kwargs)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\backends\backend_pdf.py”, line 2593, in print_pdf
self.figure.draw(renderer)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\artist.py”, line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\figure.py”, line 1863, in draw
mimage._draw_list_compositing_images(
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\image.py”, line 131, in _draw_list_compositing_images
a.draw(renderer)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\artist.py”, line 41, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\cbook\deprecation.py”, line 411, in wrapper
return func(*inner_args, **inner_kwargs)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\axes_base.py”, line 2707, in draw
self._update_title_position(renderer)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\axes_base.py”, line 2648, in _update_title_position
if title.get_window_extent(renderer).ymin < top:
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\text.py”, line 902, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\text.py”, line 287, in _get_layout
_, lp_h, lp_d = renderer.get_text_width_height_descent(
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\backends_backend_pdf_ps.py”, line 86, in get_text_width_height_descent
w, h, d = texmanager.get_text_width_height_descent(
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\texmanager.py”, line 423, in get_text_width_height_descent
dvifile = self.make_dvi(tex, fontsize)
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\texmanager.py”, line 309, in make_dvi
self._run_checked_subprocess(
File “C:\Users\Purvaash.julia\conda\3\lib\site-packages\matplotlib\texmanager.py”, line 279, in _run_checked_subprocess
raise RuntimeError(

Stacktrace:
[1] pyerr_check at C:\Users\Purvaash.julia\packages\PyCall\zqDXB\src\exception.jl:60 [inlined]
[2] pyerr_check at C:\Users\Purvaash.julia\packages\PyCall\zqDXB\src\exception.jl:64 [inlined]
[3] _handle_error(::String) at C:\Users\Purvaash.julia\packages\PyCall\zqDXB\src\exception.jl:81

I followed the following discussion: python - RuntimeError: Failed to process string with tex because latex could not be found - Stack Overflow and installed Latex, dvipng and Ghostscript. Also added the executables to path. But still get the error. Moreover added the following package on Julia: Pkg.add(“PGFPlotsX”) while following instructions from here: “Installation · Plots” (not sure if this is required though).

Any helps/tips/suggestion?

Hi Purvaash, have you found a solution yet?