Hello I would like to have multiple plots in one function using a python script.
I have tried two possibilies:
1)
import matplotlib.pyplot as plt1
import matplotlib.pyplot as plt2
and than draw in both plt1 and plt2 unfortunately they draw in each other....
2)
using figures
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
fig1 = plt.figure()
fig2 = plt.figure()
x = np.linspace(0,10,1000)
y1 = x**2
y2 = np.sin(x)
ax1 = fig1.add_subplot(1, 1, 1)
ax2 = fig2.add_subplot(1, 1, 1)
ax1.plot(x,y1)
ax2.plot(x,y2)
but this yields the following error:
Traceback (most recent call last):
File "<string>", line 2, in <module>
AttributeError: 'Figure' object has no attribute 'gcf'
it.eng.spagobi.utilities.exceptions.SpagoBIRuntimeException: Python engine error
Technical details:
PythonOutputExecutor.java:
fig1.savefig('fig1.png')
fig1.gcf().clear()
fig1.gcf().clear()
EXECUTION FAILED
See log file for other details
Grateful for any help