Hi! I am new to Slicer. I am trying to save a plot by script
plt.scatter(np.arange(1, 20, 1), np.arange(1,20, 1))
plt.savefig(os.path.join(results_path, "plotloss.png"))
from slicer. The plot has some additional values, I cannot figure out where they come from. When running the same script from Spyder everything works fine.
pieper
(Steve Pieper (Isomics, Inc.))
August 11, 2019, 2:46pm
2
Can you provide a complete example, ideally with images to show what you mean by additional values?
lassoan
(Andras Lasso)
August 12, 2019, 2:03am
3
After adding the necessary imports, it all worked correctly for me:
pip_install("matplotlib wxPython")
import matplotlib
matplotlib.use('WXAgg')
from matplotlib import pyplot as plt
import numpy as np
plt.scatter(np.arange(1, 20, 1), np.arange(1,20, 1))
plt.savefig("c:/tmp/plotloss.png")
Produced this:
Interesting. Thank you for your answer. Looks like restarting slicer was the solution. My loss was previously accumulating like this: