0
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()

x = np.arange(0, 10, 0.1)
y = np.sin(x)

plt.plot(x, y)
fig.savefig('saved_figure.png')

Whenever I try to generate a basic matplotlib graph as a png I get the error:

(test.py:26168): Gtk-CRITICAL **: 15:14:27.436: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(test.py:26168): Gtk-CRITICAL **: 15:14:27.436: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(test.py:26168): Gtk-CRITICAL **: 15:14:27.436: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Segmentation Fault

If it matters I think my server is a Solaris 10

Terk
  • 25
  • 6

1 Answers1

0

same solution as: Generating a PNG with matplotlib when DISPLAY is undefined

the top answer which solved

import matplotlib

Force matplotlib to not use any XWindow backend.

matplotlib.use('Agg')
273K
  • 29,503
  • 10
  • 41
  • 64
Terk
  • 25
  • 6