python - PyPlot - Having difficulty adding axis labels and titles to a plot within a GUI -


when try incorporate plot gui, can't seem figure out how set axis labels , title.

self.figure = plt.figure() self.canvas = figurecanvas(self.figure) self.toolbar = navigationtoolbar(self.canvas, self)  ax = self.figure.add_subplot(111) ax.hold(false)  ax.plot(xdata, ydata)  self.canvas.draw() 

i've tried numerous ways set axis labels , titles, , nothing has worked far.

i've tried:

ax = self.figure.add_subplot(111, xlabel=xlabel, ylabel=ylabel, title=filename) 

i've tried:

ax.set_xlabel(xlabel) ax.set_ylabel(ylabel) ax.set_title(filename) 

neither of these has had effect.

what's correct way this?

ajean pointed me in right direction. of having same problem, label attributes can't applied figure before data plotted. once moved them after plot line (but of course before canvas redraw), worked fine.


Comments

Popular posts from this blog

How to group boxplot outliers in gnuplot -

cakephp - simple blog with croogo -

bash - Performing variable substitution in a string -