Wednesday 15 February 2012

python - Canvas figure not showing title or axis format -



python - Canvas figure not showing title or axis format -

i having problem when ploting graph within main window.

i using qtdesigner main window.

inside 1 of horizontal_layout want disply graph.

here code using generate plot:

def plotdistribution(datatoplot, layout, numrows, nowcols): """ delete previous elements in layout if any""" in reversed(range(layout.count())): layout.itemat(i).widget().deletelater() plt.ioff() """ extract info plot """ xdata = [i[0] in datatoplot] ydata = [i[3] in datatoplot] fig, ax = plt.subplots() """ format label ticks , values x , y""" xtickspos = np.arange(50,(100*numrows)+50,100) xticksvals = ["row "+str(i) in np.arange(1,max(xdata),1) ] plt.xticks(xtickspos ,xticksvals ,rotation=90) ytickspos = np.arange(83,(166*numcols)+83,166) yticksvals = ["column "+str(i) in np.arange(1,max(ydata),1) ] plt.yticks((ytickspos),(yticksvals)) plt.title("rows , cols distributuion") """ create canvas , display in main window """ mycanvas = figurecanvas(fig) layout.addwidget(mycanvas) plt.close(fig)

this programme called main window, giving him info plot , layout want graph displayed.

however, if phone call same routine more 1 time, after first time nil displayed in title, nor in axes.

i not understand rare behaviour.

any help??

python canvas matplotlib

No comments:

Post a Comment