Note that there are some explanatory texts on larger screens.

plurals
  1. POPython Interactive Console Hangs during matplotlib?
    primarykey
    data
    text
    <p>When I run the following drawing, the console always just hangs there and the drawing is never finished. The computation is not heavy, but I am not sure where is inappropriate.</p> <pre><code>import matplotlib.pyplot as plt def showTrajectories(datafilename): with open(datafilename) as f1: content1 = f1.readlines() content1 = [line.strip() for line in content1] # remove newline character for i in range(int(content1[1])): traj = [float(x) for x in content1[i+2].split()] x = traj[2:][::2] y = traj[2:][1::2] plt.plot(x, y, color = '#99ffff') plt.title(datafilename) plt.xlabel('x (m)', fontsize=16) plt.ylabel('y (m)', fontsize=16) plt.show() def showRepresentatives(resultfilename): with open(resultfilename) as f2: content2 = f2.readlines() content2 = [line.strip() for line in content2] # remove newline character for i in range(int(content2[0])): traj = [float(x) for x in content2[i+1].split()] x = traj[2:][::2] y = traj[2:][1::2] plt.plot(x, y, linewidth=3, color='#006633') plt.title(datafilename) plt.xlabel('x (m)', fontsize=16) plt.ylabel('y (m)', fontsize=16) plt.show() </code></pre> <p>I am using <a href="http://pytools.codeplex.com/" rel="nofollow">Python Tools for Visual Studio</a> and Python 2.7, if these matter.</p> <hr> <p>The <code>showTrajectories(datafilename)</code> can be plotted correctly. It hangs when it comes to <code>showRepresentatives(resultfilename)</code>. So I will just post the <code>resultfilename</code> data here as follows:</p> <pre><code>10 0 4 -23.6 -2.7 -35.6 -2.1 -47.3 -1.2 -58.0 -1.0 1 6 -56.6 4.5 -58.0 16.7 -59.2 27.4 -60.4 38.8 -61.5 49.5 -62.5 60.1 2 7 -0.6 10.7 -1.5 21.9 -2.6 32.7 -3.6 43.4 -4.7 54.5 -5.6 65.1 -5.8 75.7 3 10 -26.9 73.9 -11.1 75.4 -0.4 75.9 11.9 76.0 22.6 76.0 33.5 76.5 44.2 76.3 55.5 76.2 66.8 77.0 79.3 77.8 4 10 9.2 -8.5 19.1 -14.1 29.6 -16.0 41.4 -16.5 52.2 -16.6 63.0 -16.7 74.1 -15.3 85.8 -12.9 96.5 -13.8 107.0 -15.4 5 8 71.0 -21.0 72.1 -10.4 72.4 0.6 72.2 11.4 72.2 22.7 71.0 33.3 70.0 45.6 70.7 56.5 6 2 72.2 -18.8 79.9 -26.3 7 3 72.6 28.8 86.5 29.4 98.1 30.6 8 5 -60.4 61.2 -71.0 54.2 -81.2 47.0 -90.0 40.9 -99.1 33.3 9 3 73.2 56.2 86.4 58.0 97.7 59.1 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload