]> gerrit.simantics Code Review - simantics/python.git/blob - org.simantics.pythonlink/test/org/simantics/pythonlink/test/scripts/Matplotlib.sts
Change to tycho 1.4.0
[simantics/python.git] / org.simantics.pythonlink / test / org / simantics / pythonlink / test / scripts / Matplotlib.sts
1 > import "Python"\r
2\r
3 > code = """\r
4 > import matplotlib\r
5 > import matplotlib.pyplot as plt\r
6 > import numpy as np\r
7 > import io\r
8\r
9 > x, y = np.random.randn(2, 100)\r
10 > fig = plt.figure()\r
11 > ax1 = fig.add_subplot(211)\r
12 > ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)\r
13 > ax1.grid(True)\r
14 > ax1.axhline(0, color='black', lw=2)\r
15\r
16 > ax2 = fig.add_subplot(212, sharex=ax1)\r
17 > ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)\r
18 > ax2.grid(True)\r
19 > ax2.axhline(0, color='black', lw=2)\r
20\r
21 > imgdata = io.StringIO()\r
22 > fig.savefig(imgdata, format='svg')\r
23 > svg_data = imgdata.getvalue()[0:5]\r
24 > """\r
25 > runPython do\r
26 >     executePythonStatement code\r
27 >     getPythonStringVariable "svg_data"\r
28 "<?xml"\r