|
From: rogerjames99 <ro...@be...> - 2015-03-26 15:51:20
|
Hi Thomas,I posted via nabble. It looks like something stripped the code.Here
is the bit where the axes are set up def setup_axes(self, fig, rect):
""" With custom locator and formatter. Note that the extreme
values are swapped. """ transform = PolarAxes.PolarTransform()
angle_ticks = [(0, r"$Right$"), (.5*pi, r"$Forward$"),
(pi, r"$Left$")] grid_locator1 = FixedLocator([v for v, s in
angle_ticks]) tick_formatter1 = DictFormatter(dict(angle_ticks))
grid_locator2 = MaxNLocator(4) self.grid_helper =
floating_axes.GridHelperCurveLinear(transform,
extremes=(0, pi, self.sonar_limit, 0),
grid_locator1=grid_locator1,
grid_locator2=grid_locator2,
tick_formatter1=tick_formatter1,
tick_formatter2=None, )
self.axes = floating_axes.FloatingSubplot(fig, rect,
grid_helper=self.grid_helper)
self.axes.axis["bottom"].major_ticklabels.set_rotation(180)
self.axes.axis["left"].set_axis_direction("bottom")
self.axes.grid(b=True, which='major', color='b', linestyle='-')
fig.add_subplot(self.axes) # create a parasite axes whose transData
in RA, cz self.auxiliary_axes = self.axes.get_aux_axes(transform)
self.auxiliary_axes.patch = self.axes.patch # for auxiliary_axis to have a
clip path as in ax self.axes.patch.zorder=0.9 # but this has a side
effect that the patch is # drawn twice, and
possibly over some other # artists. So, we
decrease the zorder a bit to # prevent this.
self.lines, = self.auxiliary_axes.plot(self.theta, self.radius)and here is
the bit where the plot is updated def idleCallback(self): global
root plotit = False logging.debug('Acquire the data lock')
self.dataLock.acquire() if self.newSonarDataAvailable:
plotit = True theta = self.theta[:] radius =
self.radius[:] selfNewSonarDataAvailable = False
self.dataLock.release()# theta.insert(0, 0.)#
theta.append(0.)# radius.insert(0, 0.)# radius.append(0.)
if plotit: logging.debug('Plotting')
self.lines.set_data(theta, radius) self.axes.relim()
self.axes.autoscale_view() self.canvas.draw()if have also put the
full code file here
<https://dl.dropboxusercontent.com/u/84613021/barnaby.py> As you can see I
have been trying a few other things. Looks like if am missing the boat
pretty comprehensively!
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Help-with-updating-the-limits-of-an-axis-to-reflect-the-range-of-new-data-tp45261p45269.html
Sent from the matplotlib - users mailing list archive at Nabble.com. |