<div dir="ltr"><span style="font-size:12.8px">Hello everyone,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thomas Caswell has kindly directed me from the old Matplotlib-users mailing list on Sourceforge, to this address at Python.org.  <span style="font-size:12.8px">I submitted this post once before to this mailing list, yesterday, before I found the web page for subscribing.  If a duplicate message should appear, please accept my apologies.</span></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I am using MPL 1.4.2, Python 3.4, and Ubuntu 15.04.  I am developing a program which displays real-time data.  On each update cycle, the graph needs to adjust the y-axis scale.  I have code that mostly works, but when it re-renders the y-axis, it is not completely erasing the old one.  I get tick labels written on top of each other, until everything is an unreadable smear, like this:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><img src="cid:ii_15598a4b823b3dc0" alt="Inline image 1" width="409" height="193" class="" tabindex="0"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Here is the relevant part of my update method:</div><div style="font-size:12.8px"><br></div><blockquote style="font-size:12.8px;margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace" size="1">self.plot.set_data(self.x[:size], self.y[:size])</font></div><div><font face="monospace, monospace" size="1">lo = self.y[:size].min()</font></div><div><font face="monospace, monospace" size="1">hi = self.y[:size].max()</font></div><div><font face="monospace, monospace" size="1">if hi - lo > 150:</font></div><div><font face="monospace, monospace" size="1">    self.ax.set_ylim(lo-25, hi+25)</font></div><div><font face="monospace, monospace" size="1">else:</font></div><div><font face="monospace, monospace" size="1">    mid = self.y[:size].mean()</font></div><div><font face="monospace, monospace" size="1">    self.ax.set_ylim(mid-100, mid+100)</font></div><div><font face="monospace, monospace" size="1">self.ax.relim()</font></div><div><font face="monospace, monospace" size="1">self.ax.autoscale_view(None, False, True)</font></div><div><font face="monospace, monospace" size="1">self.ax.redraw_in_frame()</font></div><div><font face="monospace, monospace" size="1"># Something which erases the Y axis should go here?</font></div><div><font face="monospace, monospace" size="1">self.ax.get_yaxis().draw(self.parent.get_renderer())</font></div></blockquote><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I think that the details of setting the Y limits are unimportant, but I've included that code anyway, so that you can see my set_data() method call at the top, and you can also see that I'm continually adjusting the Y range to track the data.  </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I think that I am searching for a method in the axis class which would erase the previously drawn tick marks and labels.  So far, I haven't found one.  It would replace the comment line in my code.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I am trying to avoid redrawing the entire canvas on which this plot is embedded, since there are several other live data plots besides the one I have shown. The first version of my program did a full redraw, and it took over 150 milliseconds to complete an update call.  That's too slow for my needs.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks for any help you can provide!</div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>John J. Ladasky Jr., Ph.D.</b><div><b>Research Scientist</b></div><div><b>International Technological University</b></div><div><b>2711 N. First St, San Jose, CA 95134 USA</b></div></div></div>
</div>