我在C ++中使用Embedding Python,在我的程序中,我必须多次运行python模块。不幸的是,plt.show()
只获得一次数字,其他人获得空数
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Ellipse, Circle
import time
def show(x,y,x1,y1):
fig=plt.figure()
fig.gca().invert_yaxis()
ax1 = fig.add_subplot(111)
cir1 = Circle(xy = (x1, y1), radius=0.02, alpha=0.5)
ax1.add_patch(cir1)
print len(x)
print x1
ax1.set_title('Scatter Plot')
plt.xlabel('X')
plt.ylabel('Y')
ax1.scatter(x,y,c = 'r',marker = 'o')
plt.ion()
plt.show()
time.sleep(1)
plt.close()
return 'ok'