@@ -259,29 +259,30 @@ python codeStr =
259
259
Right <$> readProcess " /usr/bin/python3" [codeFile] " " ))
260
260
(\ e -> return $ Left $ show (e :: IOException ))
261
261
262
+ pyBackend backend = " matplotlib.use('" ++ backend ++ " ')"
263
+
262
264
-- | The standard python includes of every plot
263
- pyIncludes :: [[Char ]]
264
- pyIncludes = [" import matplotlib"
265
- -- TODO Provide a way to set the render backend
266
- -- ,"matplotlib.use('GtkAgg')"
267
- ," import matplotlib.path as mpath"
268
- ," import matplotlib.patches as mpatches"
269
- ," import matplotlib.pyplot as plot"
270
- ," import matplotlib.mlab as mlab"
271
- ," import matplotlib.colors as mcolors"
272
- ," import matplotlib.collections as mcollections"
273
- ," import matplotlib.ticker as mticker"
274
- ," from matplotlib import cm"
275
- ," from mpl_toolkits.mplot3d import axes3d"
276
- ," import numpy as np"
277
- ," import os"
278
- ," import sys"
279
- ," import json"
280
- ," import random, datetime"
281
- ," from matplotlib.dates import DateFormatter, WeekdayLocator"
282
- ," fig = plot.gcf()"
283
- ," axes = [plot.gca()]"
284
- ," ax = axes[0]" ]
265
+ pyIncludes :: String -> [[Char ]]
266
+ pyIncludes backend = [" import matplotlib"
267
+ ,backend
268
+ ," import matplotlib.path as mpath"
269
+ ," import matplotlib.patches as mpatches"
270
+ ," import matplotlib.pyplot as plot"
271
+ ," import matplotlib.mlab as mlab"
272
+ ," import matplotlib.colors as mcolors"
273
+ ," import matplotlib.collections as mcollections"
274
+ ," import matplotlib.ticker as mticker"
275
+ ," from matplotlib import cm"
276
+ ," from mpl_toolkits.mplot3d import axes3d"
277
+ ," import numpy as np"
278
+ ," import os"
279
+ ," import sys"
280
+ ," import json"
281
+ ," import random, datetime"
282
+ ," from matplotlib.dates import DateFormatter, WeekdayLocator"
283
+ ," fig = plot.gcf()"
284
+ ," axes = [plot.gca()]"
285
+ ," ax = axes[0]" ]
285
286
286
287
-- | The python command that reads external data into the python data array
287
288
pyReadData :: [Char ] -> [[Char ]]
0 commit comments