mailing-list for TeXmacs Users

Text archives Help


Problem with matplotlib


Chronological Thread 
  • From: "Jerzy Wrobel" <address@hidden>
  • To: address@hidden
  • Subject: Problem with matplotlib
  • Date: Sun, 15 Aug 2021 21:45:00 +0200 (CEST)
  • Importance: Normal

Dear All,

I have used Insert->Fold->Executable->Python to display matplotlib
figure in the "big figure" environment. In particular, I have pasted
to the "yellow box" the following script:

exec(open('c:/users/wrobel/documents/texmacs/test1.py').read())
figure = plt.gcf()
ps_out(figure)

where test1.py contains the following lines:

import matplotlib as mpl
mpl.use('PS')
import matplotlib.pyplot as plt
import numpy as np
plt.clf()
x = np.linspace(2,12,201)
mpl.rcParams['font.family'] = 'serif'
# mpl.rcParams['font.serif'] = 'Times New Roman'
fig, ax = plt.subplots()
ax.plot(x, np.sin(2*x)/4/x)

The figure is displayed as expected, however, when line
mpl.rcParams['font.serif'] = 'Times New Roman' is uncommented,
I am getting the following error message:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 625:
invalid start byte
During handling of the above exception, another exception occurred:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 625:
invalid start byte

I suspect that it has something to do with spaces in 'Times New Roman'
string. I use win10 and texmacs 2.1. Any help will be appreciated.
Best regards,

Jerzy




  • Problem with matplotlib, Jerzy Wrobel, 08/15/2021

Archive powered by MHonArc 2.6.19.

Top of page