Re: [Matplotlib-users] Help with updating the limits of an axis to reflect the range of new data

2015-03-26 Thread Thomas Caswell
Can you include a minimal example of the code you are using (it looks like
you did include code, but it did not come through)?  It is very hard to
guess at what is wrong without it.

Tom

On Wed, Mar 25, 2015 at 2:29 PM rogerjames99 
wrote:

> Hi,
>
> I am trying to draw a polar plot of a sonar scan. The idea being to present
> it like a radar display. I have used axisartist to do the ploar plot. This
> is working fine but I would like to reset the limits of the radius axis
> with
> each new scan. I have tried a number of ways of doing this without success.
> My current code to set up the plot looks like this.
>
>
>
> and to update the plot. Like this
>
>
> I have tried doing the above on the host axes and the auxiliary one and
> with
> different parameters to the relim etc. Nothing seems to work. Before I
> tried
> various other calls to manipulate the extremes but with the same lack of
> results. Can anyone set me straight on this? I feel I must be missing
> something obvious. However I find the documentation and the class
> inheritance hierarchy almost impossible to follow.
>
> Here are a couple of links to snapshots of the output.
>
> Before
>  202015-03-25%2018%3A17%3A24.png>
>
> After
>  202015-03-25%2018%3A18%3A30.png>
>
> Thanks,
>
> Roger
>
>
>
> --
> 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-tp45261.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> 
> --
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help with updating the limits of an axis to reflect the range of new data

2015-03-26 Thread rogerjames99
Hi Thomas,I posted via nabble. It looks like something stripped the code.Here
is the bit where the axes are set updef 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, czself.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 axself.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 updateddef idleCallback(self):global
rootplotit = Falselogging.debug('Acquire the data lock')   
self.dataLock.acquire()if self.newSonarDataAvailable:   
plotit = Truetheta = 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
  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.--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help with updating the limits of an axis to reflect the range of new data

2015-03-26 Thread Thomas Caswell
Yikes, that formatting is almost worse!

On Thu, Mar 26, 2015 at 11:53 AM rogerjames99 
wrote:

> 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 
> 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: Re: Help with updating the limits of an
> axis to reflect the range of new data
> 
> Sent from the matplotlib - users mailing list archive
>  at
> Nabble.com.
> 
> --
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help with updating the limits of an axis to reflect the range of new data

2015-03-26 Thread Thomas Caswell
And if I look at this on nabble the code looks fine, it just was not
redndering in inbox.  Sorry, the issues is on my end.

On Thu, Mar 26, 2015 at 11:54 AM Thomas Caswell  wrote:

> Yikes, that formatting is almost worse!
>
> On Thu, Mar 26, 2015 at 11:53 AM rogerjames99 
> wrote:
>
>> 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 
>> 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: Re: Help with updating the limits of an
>> axis to reflect the range of new data
>> 
>> Sent from the matplotlib - users mailing list archive
>>  at
>> Nabble.com.
>> 
>> --
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> things parallel software development, from weekly thought leadership
>> blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help with updating the limits of an axis to reflect the range of new data

2015-03-26 Thread rogerjames99
Ok the last one got garbled.

My apologies to the list but here is another go.

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
  

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-tp45261p45271.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ANN: John Hunter SciPy 2015 Plotting Contest - Call for Entries by 4/13 (Cash prizes!)

2015-03-26 Thread Courtenay Godshall (Enthought)
*3rd Annual SciPy Conference John Hunter Plotting Contest Open for Entries:
Cash Prizes*

 

In memory of John Hunter, creator of matplotlib, we are pleased to announce
the Third Annual SciPy John Hunter Excellence in Plotting Competition. This
open competition aims to highlight the importance of quality plotting to
scientific progress and showcase the capabilities of the current generation
of plotting software. 

 

Participants are invited to submit scientific plots by 4/13/15. John
Hunter's family is graciously sponsoring cash prizes from $500-$1,000 for
the contest and the winning entries will be announced and displayed at the
conference. 

 

Full requirements and submission details here:
http://www.scipy2015.scipy.org/ehome/115969/276538/?
 &

 

See the 2014 Contest entries here for inspiration:
http://stsdas.stsci.edu/download/mdroe/plotting/ 

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ANN: John Hunter SciPy 2015 Plotting Contest - Call for Entries by 4/13 (Cash prizes!)

2015-03-26 Thread Jody Klymak

> On 26 Mar 2015, at  12:55 PM, Courtenay Godshall (Enthought) 
>  wrote:
> 
> See the 2014 Contest entries here for inspiration: 
> http://stsdas.stsci.edu/download/mdroe/plotting/ 
> 
The plots in here are great!  However, I couldn’t figure out who won?

Cheers,  Jody


--
Jody Klymak
http://web.uvic.ca/~jklymak/





--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users