user interface - python matplotlib blit to axes or sides of the figure? -
i'm trying refresh plots have within gui everytime go 1 time through fitting procedure. also, these plots within framw can resized, axes , labels etc need redrawn after resizing. wondering if knew how update sides of figure using plot.figure.canvas.copy_from_bbox
, blit
. appears re-create , blit background of graphing area (where lines beingness drawn) , not sides of graph or figure (where labels , ticks are). have been trying graphs update trial , error , reading mpl documentation, far code has jst become horrendously complex things self.this_plot.canvas_of_plot..etc.etc.. .plot.figure.canvas.copy_from_bbox
... far convoluted. know language might little off i've been trying read through matplotlb documentation , differences between figure, canvas, graph, plot, figure.figure, etc. starting evade me. first , foremost question be:
1 - how update ticks , labels around matplotlib plot.
and secondly, since have improve grasp on reply question,
2 - difference between plot, figure, canvas, etc. in regards area cover in gui.
thank much help.
all can rather confusing @ first!
to begin with, if you're chaining ticks, etc, there isn't much point in using blitting. blitting way avoid re-drawing if things changing. if changing, there's no point in using blitting. re-draw plot.
basically, want fig.canvas.draw()
or plt.draw()
at rate, reply first question, in cases won't need update them manually. if alter axis limits, they'll update themselves. you're running problems because you're blitting within of axes instead of redrawing plot.
as sec question, good, detailed overview artist tutorial of matplotlib user's guide.
in nutshell, there 2 separate layers. 1 deals grouping things parts you'll worry when plotting (e.g. figure, axes, axis, lines, etc) , deals rendering , drawing in general (the canvas , renderer).
anything can see in matplotlib plot artist
. (e.g. text, line, axes, , figure itself.) artist a) knows how draw itself, , b) can contain other artists.
for artist draw itself, uses renderer (a backend-specific module you'll never touch directly) draw on figurecanvas
a.k.a. "canvas" (an abstraction around either vector-based page or pixel buffer). draw in figure, phone call canvas.draw()
.
because artists can groups of other artists, there's hierarchy things. basically, (obviously, varies):
figure axes (0-many) (an axes plot) axis (usually two) (x-axis , y-axis) ticks ticklabels axis label background patch title, if nowadays you've plotted, e.g. line2d's
hopefully makes things touch clearer, anyway.
if want utilize blitting update tick labels, etc, you'll need grab , restore total part including them. part bit tricky get, because isn't known until after draw-time (rendering text in matplotlib more complicated rendering other things due latex support, etc). can it, , i'll glad give illustration if it's want, it's typically not going yield speed advantage on drawing everything. (the exception if you're updating 1 subplot in figure lots of subplots.)
python user-interface matplotlib
No comments:
Post a Comment