Re: [Matplotlib-users] X axis layout differences between matplotlib 0.98.5.2 and 0.98.3

2009-06-19 Thread Jae-Joon Lee
Hi,

You can try to manually adjust x-limits.

plt.xlim(dateList[0], dateList[-1])

However, manual adjustments will become a bit more difficult as your
plot gets more complex.
Well, I think the best way is to install a newer version of mpl on
your ubuntu 8.10 if possible.

-JJ


On Thu, Jun 18, 2009 at 2:18 PM, Dave Coutts wrote:
> Hi All
>
> Just wondering if anybody could give me some pointers on the problem I have
> described below ?
>
> For those that getting redirected to the freehostia main page for what ever
> reason, please try this link.
> http://waka.freehostia.com/python/
>
> Thanks
>
>> Hi
>>
>> I am developing on a Desktop install Ubuntu 9.04 machine with matplotlib
>> 0.98.5.2,
>> and running the scripts on a Server install Ubuntu 8.10 machine with
>> matplotlib 0.98.3.
>>
>> I have found that the X axis layout for the same script varies between the
>> two machines.
>> Both have standard matplotlib installs using apt-get. I haven't made any
>> tweaks.
>>
>> Rather than go into great detail about the problem, please see the script
>> below and links to the resulting png files.
>> I hope the png files tell the story.
>>
>> http://waka.freehostia.com/python/date_axis_scaling_test.py
>> http://waka.freehostia.com/python/date_axis_scaling_test_0_98_3.png
>> http://waka.freehostia.com/python/date_axis_scaling_test_0_98_5_2.png
>>
>> The plot produced by
>> matplotlib 0.98.3 isn't what I want.
>> Id like the plot to go edge to edge on the x axis grid, as the matplotlib
>> 0.98.5.2 version does.
>>
>> Help and advise would be appreciated.
>> PS : I'm new to python &
>> matplotlib
>>
>>
>> ##
>> #!/usr/bin/env python
>> import matplotlib
>> matplotlib.use('Agg')
>> import matplotlib.pyplot as plt
>> from datetime import datetime, timedelta
>>
>> version   = matplotlib.__version__
>> HOURSBACK = 365 * 24
>> now   = datetime.now()
>> valueList = []
>> dateList  = []
>>
>> for i in range(HOURSBACK):
>>     hoursBack = timedelta( hours = (HOURSBACK - i) )
>>     then = now - hoursBack
>>     valueList.append( i )
>>     dateList.append( then )
>>
>> fig = plt.figure( figsize=(12, 9), dpi=100 )
>> ax  = fig.add_subplot(111)
>> ax.plot(dateList, valueList)
>> plt.title('Date axis scaling test for matplotlib version : %s' % (
>> version  ) )
>> plt.grid(True)
>> plt.ylabel('Widgets')
>> plt.xlabel('Date')
>> fig.autofmt_xdate()
>>
>> plt.savefig( "date_axis_scaling_test_%s.png" % version.replace('.','_'),
>> format='png' )
>>
>> quit()
>>
>> ##
>>
>>
>
>
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] possible bug with scatter

2009-06-21 Thread Jae-Joon Lee
Thanks for the report.
And, this turned out to be a bug. The symbol style code was simply
ignored when its value is 3.

While the bug should now be fixed (both in the trunk and the maint.
branch), you may use marker style like (20,0,0) (or increase the first
number when symbol is large) for a workaround.

Regards,

-JJ


On Sun, Jun 21, 2009 at 1:09 PM, Thomas
Robitaille wrote:
>
> Hi,
>
> I'm trying to use the scatter method, making use of the option to specify
> the marker as a tuple. From the documentation, it would seem that specifying
> marker=(0,3,0) should draw a circle. However, this is not the case. If you
> consider the following code:
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as mpl
>
> fig = mpl.figure()
> ax = fig.add_subplot(111)
> #ax.scatter([x],[y],c='red',marker=(0,3,0.))
> ax.scatter([10.],[10.],c='red',marker=(3,3,0.))
> ax.scatter([11.],[10.],c='red',marker=(6,3,0.))
> ax.set_xlim(5.,15.)
> fig.savefig('scatter.png')
>
> The first ax.scatter causes an error, the second plots a triangle, and the
> third a hexagon. However, the documentation states that (a) setting the
> second element to '3' should plot a circle, and (b) the other arguments
> should be ignored, so the first ax.scatter should not cause an error.
>
> Is this a bug, or am I misunderstanding the documentation?
>
> Thanks,
>
> Thomas
> --
> View this message in context: 
> http://www.nabble.com/possible-bug-with-scatter-tp24136534p24136534.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] possible bug with scatter

2009-06-21 Thread Jae-Joon Lee
On Sun, Jun 21, 2009 at 4:42 PM, Thomas
Robitaille wrote:
> Hi Jae-Joon,
>
> Thanks for the quick fix! Just looked in the svn browser, and noticed you
> changed line 5290 of axes.py to
>
> 'o' : (0,0,3),
>
> Should this not be
>
> 'o' : (0,3,0),
>
> ?

No, somehow the meaning of each item is different there. The last item
is the symbol style, unlike the input parameter for scatter where the
second one is the symbol style. For example,

  's' : (4,math.pi/4.0,0),   # square

Regards,

-JJ


>
> Thanks,
>
> Tom
>
> On Jun 21, 2009, at 2:59 PM, Jae-Joon Lee wrote:
>
>> Thanks for the report.
>> And, this turned out to be a bug. The symbol style code was simply
>> ignored when its value is 3.
>>
>> While the bug should now be fixed (both in the trunk and the maint.
>> branch), you may use marker style like (20,0,0) (or increase the first
>> number when symbol is large) for a workaround.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Sun, Jun 21, 2009 at 1:09 PM, Thomas
>> Robitaille wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to use the scatter method, making use of the option to specify
>>> the marker as a tuple. From the documentation, it would seem that
>>> specifying
>>> marker=(0,3,0) should draw a circle. However, this is not the case. If
>>> you
>>> consider the following code:
>>>
>>> import matplotlib
>>> matplotlib.use('Agg')
>>> import matplotlib.pyplot as mpl
>>>
>>> fig = mpl.figure()
>>> ax = fig.add_subplot(111)
>>> #ax.scatter([x],[y],c='red',marker=(0,3,0.))
>>> ax.scatter([10.],[10.],c='red',marker=(3,3,0.))
>>> ax.scatter([11.],[10.],c='red',marker=(6,3,0.))
>>> ax.set_xlim(5.,15.)
>>> fig.savefig('scatter.png')
>>>
>>> The first ax.scatter causes an error, the second plots a triangle, and
>>> the
>>> third a hexagon. However, the documentation states that (a) setting the
>>> second element to '3' should plot a circle, and (b) the other arguments
>>> should be ignored, so the first ax.scatter should not cause an error.
>>>
>>> Is this a bug, or am I misunderstanding the documentation?
>>>
>>> Thanks,
>>>
>>> Thomas
>>> --
>>> View this message in context:
>>> http://www.nabble.com/possible-bug-with-scatter-tp24136534p24136534.html
>>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>> --
>>> Are you an open source citizen? Join us for the Open Source Bridge
>>> conference!
>>> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
>>> $250.
>>> Need another reason to go? 24-hour hacker lounge. Register today!
>>>
>>> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>
>

--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Help with transforms of collections

2009-06-22 Thread Jae-Joon Lee
Tony,

My understanding is that (which might be wrong) drawing collections
involves (at least) 2 transforms. The first transform is (mostly) for
scaling, and the second transform is for offset. And this seems to be
true for PolygonCollection (which scatter creates) as far as I can
see.

set_transform() method sets the transform for scaling, which means
that (0,0) should transform to (0,0). Otherwise the polygon is not
drawn where you intended.
And, obviously transData does NOT, which I think is the root of the problem.

Unfortunately, the current PolygonCollection class does not seem to
have any support for what you want. On the other hand, it seems that
EllipseCollection lets you specify the ellipse size in data
coordinate.

The easiest solution I can think of is doing some monkey patching.


import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
x = [0.25, 0.75, 0.25, 0.75]
y = [0.25, 0.25, 0.75, 0.75]
r = 0.1 * np.ones(4)
col = plt.scatter(x, y, np.pi*r**2)


from matplotlib.collections import RegularPolyCollection
class RegularPolyCollection2(RegularPolyCollection):
def get_transform(self):
ax = self.axes

sc_x = ax.bbox.width / ax.viewLim.width
sc_y = ax.bbox.height / ax.viewLim.height

return transforms.Affine2D().scale(sc_x, sc_y)

col.__class__ = RegularPolyCollection2

plt.axis('equal')
plt.show()


Alternatively, you may modify your code to use EllipseCollection (if
what you want are just cricles).
I hope this solution fits your need.
Regards,

-JJ



On Thu, Jun 18, 2009 at 7:24 PM, Tony S Yu wrote:
> I'd like to plot a collection and scale the size of the collection
> elements in relation to the data. My guess is that I need to use the
> data transformation (ax.transData) since I would like the size of the
> collection elements altered when zooming in/out.
>
> Unfortunately, my attempt has led to weird results: the collection
> offsets are shifted from the desired coordinates when using
> ax.transData. Weirder still: the collection elements move *relative to
> the data coordinates* when panning the figure.
>
> I suspect that setting the collection transform to ax.transData is
> somehow applying some part of the transform twice. Does anyone know
> what I'm doing wrong here and how I can fix this?
>
> Thanks!
> -Tony
>
> Attached is a toy example of what I'm trying to do. The radii of the
> circles are plotted correctly, but notice the x, y coordinates don't
> match the circle centers in the plot. Also, try panning the plot and
> watch as the circles move relative to the tick marks.
>
>
>  >>> import matplotlib.pyplot as plt
>  >>> import matplotlib.transforms as transforms
>  >>> import numpy as np
>  >>> fig = plt.figure()
>  >>> ax = fig.add_subplot(111)
>  >>> x = [0.25, 0.75, 0.25, 0.75]
>  >>> y = [0.25, 0.25, 0.75, 0.75]
>  >>> r = 0.1 * np.ones(4)
>  >>> col = plt.scatter(x, y, np.pi*r**2)
>  >>> pts2pixels = transforms.Affine2D().scale(72.0/fig.dpi)
>  >>> col.set_transform(pts2pixels + ax.transData)
>  >>> plt.axis('equal')
>  >>> plt.show()
>
> --
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adding grid to animation with blit

2009-06-22 Thread Jae-Joon Lee
Without actual code, it is difficult to figure out what the real problem is.
Anyhow, did you check the below animation example?

http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk.html

In the example, the grid is static (i.e., not animated). If what you
want is to have the grid animated, then an explicit draw_artist call
is required (note that grid is drawn by axis).

Regards,

-JJ


On Sun, Jun 21, 2009 at 11:54 AM, Sandro Tosi wrote:
> Hello,
> I'm using blit to animate my plot, and I'd like to add a grid on it
> but I failed at it.
>
> What I do is:
>
> 1. prepare Figure, Axes, etc without plotting anything
> 2. save teh background with
>     self.bg = self.canvas.copy_from_bbox(self.ax.bbox)
>
> (on graph update)
>
> 3. restore background with
>     self.canvas.restore_region(self.bg)
> 4. .set_ydata(...)
> 5. self.ax.draw_artist(self.)
> 6. self.canvas.blit(self.ax.bbox)
>
> Now, I tried to place a "self.ax.grid(True)" in almost every possible
> position, but never a grid came out :(
>
> What is the right approach to solve it? Thanks in advance
>
> Regards,
> --
> Sandro Tosi (aka morph, morpheus, matrixhasu)
> My website: http://matrixhasu.altervista.org/
> Me at Debian: http://wiki.debian.org/SandroTosi
>
> --
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] equivalent of PlotFilling->Axis

2009-06-24 Thread Jae-Joon Lee
I guess the stem plot is close to what you need.

http://matplotlib.sourceforge.net/examples/pylab_examples/stem_plot.html

Regards,

-JJ




On Wed, Jun 24, 2009 at 3:32 PM, Art wrote:
> Hi Eric,
>
> I was thinking more like the tiny attachment (hope attachments are ok).
> Basically, given a list of (x,y) coordinates, plot the (x,y) point as a
> little circle and drop a line down from the point to the x-axis (but not
> fill the whole region under the plot).
>
> It's very nice for plotting a sparse signal, where most of the y's are equal
> to zero but some are not.
>
> Thanks,
> Art.
>
> On Wed, Jun 24, 2009 at 7:18 PM, Eric Firing  wrote:
>>
>> Art wrote:
>>>
>>> Is there a way to create a line plot similar to Mathematica's
>>> PlotFilling->Axis option for ListPlot?
>>>
>>
>> Like this?
>>
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between_demo.html
>>
>> Eric
>>>
>>> It is a plot of a vector as a line plot, but for each point, there is a
>>> vertical line dropped down to the axis. It is demonstrated on the following
>>> link:
>>>
>>> http://reference.wolfram.com/mathematica/ref/Filling.html
>>>
>>> With the example given:
>>>
>>> ListPlot[Table[{k,
>>>   PDF[BinomialDistribution[50, p], k]}, {p, {0.3, 0.5, 0.8}}, {k, 0,
>>>   50}], Filling -> Axis]
>>>
>>> Thanks!
>>>
>>>
>>> 
>>>
>>>
>>> --
>>>
>>>
>>> 
>>>
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph

2009-06-25 Thread Jae-Joon Lee
The linked page below shows how you put the legend above the graph.

http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location

You can put it below the axes by adjusting the bbox_to_anchor parameter.
Try something like
  bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1

Make sure to adjust the suplot parameter (or axes location) to make
enough room for the legend.

-JJ



On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencer wrote:
> How do you show the legend below the graph, so it doesn't overlap at
> all with the graph? The docs for the legend() "loc" parameter only
> seem to specify where *on* the graph you want it to show, which is
> driving me nuts because even using "best", it usually hides some of my
> data.
>
> I want to see *all* of my graph, as well as the legend. Is there any
> way to do this with pylab?
>
> Any help is appreciated.
>
> Chris
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram with multiple data

2009-06-26 Thread Jae-Joon Lee
I guess you're providing an input data  with a wrong shape.

 aa = np.transpose([listA, listB, listC])
 plt.hist(aa, bins=4, histtype='bar',
alpha=0.75,rwidth=0.85,label=['A','B','C'])

Regards,

-JJ


On Thu, Jun 25, 2009 at 1:37 AM, Uma S wrote:
>
> Hi,
> I have the same problem. If you found the solution could you please post?
>
> Thanks
>
> uma
>
>
>
> Yves-Alexandre wrote:
>>
>> Hi,
>>
>> I'm trying to add label to a histogram with multiple data. The doc says
>> "label can also be a sequence of strings" but when I try:
>>
>> plt.hist([listA, listB, listC], bins=25, histtype='bar',
>> alpha=0.75,rwidth=0.85,label=['A','B','C'])
>>
>> I got an error:
>> "AttributeError: 'tuple' object has no attribute 'startswith'"
>> (for the entire traceback see http://paste.pocoo.org/show/119820/ )
>>
>> is it me or a bug?
>>
>> Can I add a legend in another way?
>>
>> thanks in advance!
>>
>> -Yva.
>>
>> --
>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>> is a gathering of tech-side developers & brand creativity professionals.
>> Meet
>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>> iPhoneDevCamp as they present alongside digital heavyweights like
>> Barbarian
>> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Histogram-with-multiple-data-tp23787422p24197283.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph

2009-06-27 Thread Jae-Joon Lee
sorry.
As guillaume has mentioned, you need to install mpl from svn.

Here is some workaround you can try. I guess it would work with 0.98.5.3.
Basically, you create a separate axes for a legend.

ax1 = axes([0.1, 0.2,0.8, 0.7])
p1, = ax1.plot([1,2,3])
p2, = ax1.plot([3,2,1])

ax2 = axes([0.1, 0.1, 0.8, 0.01], frameon=False)
ax2.xaxis.set_visible(False)
ax2.yaxis.set_visible(False)
l = ax2.legend([p1, p2], ["Legend1", "Legend2"], mode="expand", ncol=2,
   borderaxespad=0.)


-JJ



On Sat, Jun 27, 2009 at 6:00 PM, Chris Spencer wrote:
> Thanks. Is that some sort of blending edge feature? I just installed
> 0.98.5.3, but the sample code gives me the error:
>
> TypeError: __init__() got an unexpected keyword argument 'bbox_to_anchor'
>
> On Thu, Jun 25, 2009 at 10:20 PM, Jae-Joon Lee wrote:
>> The linked page below shows how you put the legend above the graph.
>>
>> http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location
>>
>> You can put it below the axes by adjusting the bbox_to_anchor parameter.
>> Try something like
>>  bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1
>>
>> Make sure to adjust the suplot parameter (or axes location) to make
>> enough room for the legend.
>>
>> -JJ
>>
>>
>>
>> On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencer wrote:
>>> How do you show the legend below the graph, so it doesn't overlap at
>>> all with the graph? The docs for the legend() "loc" parameter only
>>> seem to specify where *on* the graph you want it to show, which is
>>> driving me nuts because even using "best", it usually hides some of my
>>> data.
>>>
>>> I want to see *all* of my graph, as well as the legend. Is there any
>>> way to do this with pylab?
>>>
>>> Any help is appreciated.
>>>
>>> Chris
>>>
>>> --
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] subplots with no space between limited to 6x6?

2009-06-29 Thread Jae-Joon Lee
Yes, I can reproduce this with the current svn.

I think what's happening is that, with larger number of grid,  there
is slight overlapping between each subplots (likely due to the
floating point error). Note that subplot command deletes existing axes
if they overlap with the new one.

There would be several work-arounds. You may use non-zero spacing, eg,
0.001  worked for me. Or, you may manually add subplots to the figure
to avoid any deletion of existing axes.

from matplotlib.axes import Subplot

fig = gcf()

subplots_adjust(hspace=0.,wspace=0.)

for i in xrange(1,65):
ax = Subplot(fig, 8, 8, i)
fig.add_subplot(ax)
plot( [0,1] )

Regards,

-JJ


On Mon, Jun 29, 2009 at 10:29 AM, keflavich wrote:
>
> Hi, I'm trying to make a large grid of subplots with no spacing between.  The
> following code fails for any grid size larger than 6x6 by skipping a row and
> a column.
>
> for i in xrange(1,65):
>    subplot(8,8,i)
>    plot( [0,1] )
>    subplots_adjust(hspace=0,wspace=0)
>
> Is there a way around this problem?
>
> Thanks,
> Adam
> --
> View this message in context: 
> http://www.nabble.com/subplots-with-no-space-between-limited-to-6x6--tp24255224p24255224.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Zooming plot and transforms...

2009-06-29 Thread Jae-Joon Lee
I think the issue here is to connect points in two different axes,
which is possible but can be a bit difficult.

In the svn version of matplotlib, there are some helper classes to
ease this job a bit.
I'm attaching the example.

I think you can also run the example with 0.98.5.3. Just download
inset_locator.py and modify your import statement.

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py?revision=7084&view=markup

Regards,

-JJ


On Mon, Jun 29, 2009 at 1:22 PM, Fabrice Silva wrote:
> Le lundi 29 juin 2009 à 14:39 +0200, Fabrice Silva a écrit :
>> I merely wanted to add a Polygon patch between the upper and the lower
>> subplots, but using data coordinates from these axes.
>
> One more precision : my intent is to draw a figure 'statically', I do
> not need event handling, ie handling manual zoom through an interactive
> backend. The figure is generated from a script and directly saved
> without human interaction.
> --
> Fabrice Silva 
> LMA UPR CNRS 7051
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
<>"""
Demonstrate the use of the BboxPatch, BboxConnector.

Note that the example does not work correctly if the figure size changes interactively.
"""

import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.transforms import blended_transform_factory, TransformedBbox
from mpl_toolkits.axes_grid.inset_locator import BboxPatch, BboxConnector




class BboxConnectorPatch(BboxConnector):

def __init__(self, bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs):
if "transform" in kwargs:
raise ValueError("trnasform should nt be set")

BboxConnector.__init__(self, bbox1, bbox2, loc1a, loc2a, **kwargs)
self.loc1b = loc1b
self.loc2b = loc2b


def get_path(self):
path1 = self.connect_bbox(self.bbox1, self.bbox2,
  self.loc1, self.loc2)

path2 = self.connect_bbox(self.bbox2, self.bbox1,
  self.loc2b, self.loc1b)

path_merged = list(path1.vertices) + list (path2.vertices) + [path1.vertices[0]]

return Path(path_merged)


if 1:

ax1 = plt.subplot(211)
ax2 = plt.subplot(212)


#def update_transform(fig):

# add bbox in upper axes (ax1)
tt = ax2.transScale + ax2.transLimits + ax1.transAxes
trans = blended_transform_factory(ax1.transData, tt)

mybbox = TransformedBbox(ax2.viewLim, trans)
bbox_patch = BboxPatch(mybbox, alpha=0.2)
ax1.add_patch(bbox_patch)


# add connecting lines in lower axes (ax2)

patch_props=dict(ec="b", alpha=0.5)


# connect lower-left corner (loc1=3) of mybbox to upper-left
# corner (loc2=2) of ax2.bbox
c1 = BboxConnector(mybbox, ax2.bbox, loc1=3, loc2=2, **patch_props)
c1.set_clip_on(False)
ax2.add_patch(c1)

# connect lower-right corner (loc1=4) of mybbox to upper-right
# corner (loc2=1) of ax2.bbox
c2 = BboxConnector(mybbox, ax2.bbox, loc1=4, loc2=1, **patch_props)
c2.set_clip_on(False)
ax2.add_patch(c2)

# a polygon patch.
p = BboxConnectorPatch(mybbox, ax2.bbox,
   loc1a=3, loc2a=2,
   loc1b=4, loc2b=1,
   fc="b", ec="none", alpha=0.1)
p.set_clip_on(False)
ax2.add_patch(p)

# adjust the xlim
ax2.set_xlim(0.3, 0.5)

ax1.set_title("try pan/zoom each axes")
plt.show()

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Zooming plot and transforms...

2009-06-30 Thread Jae-Joon Lee
Hi Fabrice,

Good to hear that you were able to get it work.
Here is some tweak on transforms.
This way, the plot is shown correctly even if you change the y-limits of axes.

trans0 = blended_transform_factory(ax0.transData, ax0.transAxes)
trans1 = blended_transform_factory(ax1.transData, ax1.transAxes)

bbox = Bbox.from_extents(xmin, 0, xmax, 1)

mybbox1 = TransformedBbox(bbox, trans0)
mybbox2 = TransformedBbox(bbox, trans1)

I think the code is worth to be included as an mpl example.
I'll push this into the svn if you don't mind.
Regards,

-JJ




On Tue, Jun 30, 2009 at 8:12 AM, Fabrice Silva wrote:
> Le lundi 29 juin 2009 à 16:11 -0400, Jae-Joon Lee a écrit :
>> I think the issue here is to connect points in two different axes,
>> which is possible but can be a bit difficult.
> That was my problem
>
>> In the svn version of matplotlib, there are some helper classes to
>> ease this job a bit.
> Thanks for your pointer. Sadly the mpl.toolkits.axes_grid is not shipped
> by debian package, and downloading it requires other stuff. So I adapted
> from the inset_locator.py the attached file.
>
> Finally I can "zoom" with the mere script :
>        import matplotlib.pyplot as plt
>        from mpl_axes_grid_inset_locator import zoom_effect
>        S1 = plt.subplot(211)
>        S1.plot(... # xlim  (0.,1.2)
>        S2 = plt.subplot(223)
>        S2.plot(... # xlim  (0.0095,.012)
>        S3 = plt.subplot(224)
>        S3.plot(... # xlim  (0.84,1.)
>        # Labels stuff
>        # [...]
>
>        patch_props=dict(ec="r", alpha=0.5, fc="r")
>        zoom_effect(S1,S2, 0.01, 0.011, **patch_props)
>        zoom_effect(S1,S3, 0.90, 0.95, **patch_props)
>
> It produces two zoom subplots with the wanted patch.
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] log scale the Y axis of a stem plot

2009-07-01 Thread Jae-Joon Lee
yscale("log")

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yscale

However the bars in the stem plot will be gone (because of the log 0).
It seems that there is no option for controling the  baseline location
in the stem command.
However, the code for stem command is quite short (~10 lines), so I
guess you can easily modify it to your taste.

Regards,

-JJ


On Wed, Jul 1, 2009 at 8:41 AM, Forrest Sheng Bao wrote:
> Him
>
> I had a stem plot. Now I want to make the Y axis of log scale. But I do not
> want to use semilogy since I prefer the bars in stem plot. Do you know how
> to only scale the Y axis?
>
> Cheers,
> Forrest
>
> Forrest Sheng Bao, BSEE, Graduate Student
> Dept. of Computer Science/Electrical Engineering
> Texas Tech University, Lubbock, Texas
> http://narnia.cs.ttu.edu
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] to much points

2009-07-01 Thread Jae-Joon Lee
A snippet  of code does not help much.
Please try to post a small concise standalone example that we can run and test.

A general advise is to try to reduce the number of plot call, i.e.,
plot as may points as possible with a single plot call.

However, 50million points seems to be awful a lot.
6 inch x 6 inch figure with dpi=100 has 0.36 million number of pixels.
My guess is that it makes little sense to plot 50 million points here.

Anyhow, plotting 50million points with a single plot call dies with
some segfault error in my machine. So, I feel that  matplotlib may not
be suitable for your task. But, John or others may have some insight
how to deal with.

Regards,

-JJ



On Tue, Jun 30, 2009 at 1:22 PM, Markus Feldmann wrote:
> Hi All,
>
> my program lets slow down my cpu. This only appears if i plot to much
> points. I am not sure how many point i need to get this, normally i plot
> 3*14e6 + 8e3, that is round about 50million points. My system is a
> dual core 2GHz cpu with 2Gbyte Ram.
>
> Here is my method to plot,
>     def drawtransientall(self,min):
>         self.subplot = self.figure.add_subplot(111)
>         self.subplot.grid(True)
>         list_t1,list_peaks,t2,list_samples =
> self.computetransientall(min,min+self.maxitems)
>         offset = 0
>         color = ['green','red','blue','magenta','cyan']
>         markerPeaks = ['v','<','1','3','s']
>         markerSamples = ['^','>','2','4','p']
>         self.plots=[[],[]]
>         for i in range(len(self.showBands)):
>             self.plots[0] +=
> self.subplot.plot(list_t1[i],list_peaks[i],color=color[i],marker=markerPeaks[i],
>                                             linestyle='None')
>             self.plots[1] +=
> self.subplot.plot(t2,list_samples[i]+offset,color=color[i],
>
> marker=markerSamples[i],linestyle='None')
>             offset +=1
>
> self.subplot.set_xlim(t2[0]-np.abs(t2[-1]-t2[0])/100,t2[-1]+np.abs(t2[-1]-t2[0])/100)
>         ymax = np.amax(list_samples)
>         ymin = np.amin(list_samples)
>         self.subplot.set_ylim([ymin-np.abs(ymin)*0.1, ymax*1.2 + 2])
>         self.subplot.set_ylabel("abs(Sample(t)) und
> abs(Peak(t)+Offset)-->",fontsize = 12)
>         self.subplot.set_xlabel("Zeit in Sek. -->",fontsize = 12)
>
> Any ideas how to avoid the slow down of my cpu ?
>
> regards Markus
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] to much points

2009-07-01 Thread Jae-Joon Lee
On Wed, Jul 1, 2009 at 2:34 PM, Michael Droettboom wrote:
> I agree with Jae-Joon here -- try to reduce the number of points before
> passing it to matplotlib.
>
> However, I'm a little concerned about the segfault -- I'd rather matplotlib
> give a MemoryError exception if that's in fact what is happening.  Jae-Joon
> -- can you share your test that causes the segfault?
>
> The snippet below completely hogs my machine for a few minutes, but then,
> correctly, aborts with a MemoryError.
>
> This is on FC11 i586, Python 2.6, Numpy 1.3.
>
> 
>
> from matplotlib.pyplot import *
> import numpy as np
>
> points = np.random.random((5000, 2))
> plot(points)
> show()
>

Yes, I also got MemoryError in this case during the plot() call.

But I got segfault for the code below.

x=random(50e6)
y=random(50e6)
plt.plot(x, y)
plt.show()

In this case, plot() runs fine, but segfault during show().

The segfault happens in the _path_module::affine_transform method of
src/_path.cpp.

I wonder if you can reproduce this.

-JJ


> 
>
> Mike
>
> On 07/01/2009 01:34 PM, Jae-Joon Lee wrote:
>
> A snippet  of code does not help much.
> Please try to post a small concise standalone example that we can run and
> test.
>
> A general advise is to try to reduce the number of plot call, i.e.,
> plot as may points as possible with a single plot call.
>
> However, 50million points seems to be awful a lot.
> 6 inch x 6 inch figure with dpi=100 has 0.36 million number of pixels.
> My guess is that it makes little sense to plot 50 million points here.
>
> Anyhow, plotting 50million points with a single plot call dies with
> some segfault error in my machine. So, I feel that  matplotlib may not
> be suitable for your task. But, John or others may have some insight
> how to deal with.
>
> Regards,
>
> -JJ
>
>
>
> On Tue, Jun 30, 2009 at 1:22 PM, Markus Feldmann
> wrote:
>
>
> Hi All,
>
> my program lets slow down my cpu. This only appears if i plot to much
> points. I am not sure how many point i need to get this, normally i plot
> 3*14e6 + 8e3, that is round about 50million points. My system is a
> dual core 2GHz cpu with 2Gbyte Ram.
>
> Here is my method to plot,
>     def drawtransientall(self,min):
>         self.subplot = self.figure.add_subplot(111)
>         self.subplot.grid(True)
>         list_t1,list_peaks,t2,list_samples =
> self.computetransientall(min,min+self.maxitems)
>         offset = 0
>         color = ['green','red','blue','magenta','cyan']
>         markerPeaks = ['v','<','1','3','s']
>         markerSamples = ['^','>','2','4','p']
>         self.plots=[[],[]]
>         for i in range(len(self.showBands)):
>             self.plots[0] +=
> self.subplot.plot(list_t1[i],list_peaks[i],color=color[i],marker=markerPeaks[i],
>                                             linestyle='None')
>             self.plots[1] +=
> self.subplot.plot(t2,list_samples[i]+offset,color=color[i],
>
> marker=markerSamples[i],linestyle='None')
>             offset +=1
>
> self.subplot.set_xlim(t2[0]-np.abs(t2[-1]-t2[0])/100,t2[-1]+np.abs(t2[-1]-t2[0])/100)
>         ymax = np.amax(list_samples)
>         ymin = np.amin(list_samples)
>         self.subplot.set_ylim([ymin-np.abs(ymin)*0.1, ymax*1.2 + 2])
>         self.subplot.set_ylabel("abs(Sample(t)) und
> abs(Peak(t)+Offset)-->",fontsize = 12)
>         self.subplot.set_xlabel("Zeit in Sek. -->",fontsize = 12)
>
> Any ideas how to avoid the slow down of my cpu ?
>
> regards Markus
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] to much points

2009-07-01 Thread Jae-Joon Lee
I tracked this down do line 962 of the _path.cpp.

double* vertex_out = (double*)PyArray_DATA(result);

My guess is that PyArray_SimpleNew at line 957 returns NULL for a
memory error instead of raising an exception, which makes result=NULL
and causes a segfault at line 962.

Since I'm not an c++ expert, I'll leave it to you, Michael.

Regards,

-JJ


On Wed, Jul 1, 2009 at 3:16 PM, Jae-Joon Lee wrote:
> On Wed, Jul 1, 2009 at 2:34 PM, Michael Droettboom wrote:
>> I agree with Jae-Joon here -- try to reduce the number of points before
>> passing it to matplotlib.
>>
>> However, I'm a little concerned about the segfault -- I'd rather matplotlib
>> give a MemoryError exception if that's in fact what is happening.  Jae-Joon
>> -- can you share your test that causes the segfault?
>>
>> The snippet below completely hogs my machine for a few minutes, but then,
>> correctly, aborts with a MemoryError.
>>
>> This is on FC11 i586, Python 2.6, Numpy 1.3.
>>
>> 
>>
>> from matplotlib.pyplot import *
>> import numpy as np
>>
>> points = np.random.random((5000, 2))
>> plot(points)
>> show()
>>
>
> Yes, I also got MemoryError in this case during the plot() call.
>
> But I got segfault for the code below.
>
> x=random(50e6)
> y=random(50e6)
> plt.plot(x, y)
> plt.show()
>
> In this case, plot() runs fine, but segfault during show().
>
> The segfault happens in the _path_module::affine_transform method of
> src/_path.cpp.
>
> I wonder if you can reproduce this.
>
> -JJ
>
>
>> 
>>
>> Mike
>>
>> On 07/01/2009 01:34 PM, Jae-Joon Lee wrote:
>>
>> A snippet  of code does not help much.
>> Please try to post a small concise standalone example that we can run and
>> test.
>>
>> A general advise is to try to reduce the number of plot call, i.e.,
>> plot as may points as possible with a single plot call.
>>
>> However, 50million points seems to be awful a lot.
>> 6 inch x 6 inch figure with dpi=100 has 0.36 million number of pixels.
>> My guess is that it makes little sense to plot 50 million points here.
>>
>> Anyhow, plotting 50million points with a single plot call dies with
>> some segfault error in my machine. So, I feel that  matplotlib may not
>> be suitable for your task. But, John or others may have some insight
>> how to deal with.
>>
>> Regards,
>>
>> -JJ
>>
>>
>>
>> On Tue, Jun 30, 2009 at 1:22 PM, Markus Feldmann
>> wrote:
>>
>>
>> Hi All,
>>
>> my program lets slow down my cpu. This only appears if i plot to much
>> points. I am not sure how many point i need to get this, normally i plot
>> 3*14e6 + 8e3, that is round about 50million points. My system is a
>> dual core 2GHz cpu with 2Gbyte Ram.
>>
>> Here is my method to plot,
>>     def drawtransientall(self,min):
>>         self.subplot = self.figure.add_subplot(111)
>>         self.subplot.grid(True)
>>         list_t1,list_peaks,t2,list_samples =
>> self.computetransientall(min,min+self.maxitems)
>>         offset = 0
>>         color = ['green','red','blue','magenta','cyan']
>>         markerPeaks = ['v','<','1','3','s']
>>         markerSamples = ['^','>','2','4','p']
>>         self.plots=[[],[]]
>>         for i in range(len(self.showBands)):
>>             self.plots[0] +=
>> self.subplot.plot(list_t1[i],list_peaks[i],color=color[i],marker=markerPeaks[i],
>>                                             linestyle='None')
>>             self.plots[1] +=
>> self.subplot.plot(t2,list_samples[i]+offset,color=color[i],
>>
>> marker=markerSamples[i],linestyle='None')
>>             offset +=1
>>
>> self.subplot.set_xlim(t2[0]-np.abs(t2[-1]-t2[0])/100,t2[-1]+np.abs(t2[-1]-t2[0])/100)
>>         ymax = np.amax(list_samples)
>>         ymin = np.amin(list_samples)
>>         self.subplot.set_ylim([ymin-np.abs(ymin)*0.1, ymax*1.2 + 2])
>>         self.subplot.set_ylabel("abs(Sample(t)) und
>> abs(Peak(t)+Offset)-->",fontsize = 12)
>>         self.subplot.set_xlabel("Zeit in Sek. -->",fontsize = 12)
>>
>> Any ideas how to avoid the slow down of my cpu ?
>>
>> regards Markus
>>
>>
>> --
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> --
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] "Ordinal must be >= 1" with SuplotHost and dates

2009-07-02 Thread Jae-Joon Lee
I can reproduce the error with the svn version.
It seems that the problem is not SubplotHost specific, i.e., you have
same problem if you use mpl's original axes with twinx.

I think it has something to do with the axes sharing in general.
Preventing autoscale of xaxis suppress the error.

host.set_autoscalex_on(False)
par1.set_autoscalex_on(False)
par2.set_autoscalex_on(False)

But you have to manually adjust the x-limits later

par1.set_xlim(dates[0], dates[-1])

However, autofmt_xdata does not work. And I guess this is a bug in the
SubplotHost. I may take a more look later today.

Regards,

-JJ


On Sun, Jun 28, 2009 at 1:34 PM, David GUERINEAU wrote:
> Hi matplotlib_users !
>
> I'm David from Berlin, and believe I'm experiencing some problem with the
> SubplotHost module:
>
> I'm generating graphs from hudge databases of cpu and ethernet statistics,
> and I wanted to mix several graphs concerning ethernet statistics in the
> same figure,
> with time as x axis, and bytes-in, bytes-out, packets-in, packets-out and
> number of
> collisions as three different y axes, with three different scale.
>
> I took the inspiration from
>
> for the x axes and from
>
> http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html
> for the y axes
>
> The following code is a synthetic reproduction of the problem I'm
> experiencing (it is also attached):
>
> from matplotlib.dates import date2num
> from matplotlib import pyplot
> from matplotlib import pylab
> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
> from datetime import datetime
>
> dates = [ 733581.2083337, 733581.20837962965, 733581.20842592593,
> 733581.2084721, 733581.20851851848,
>       733581.20855324075, 733581.20858796302, 733581.2086342593,
> 733581.20866898145, 733581.20871527772]
> rxB = [054L, 130L, 144L, 54L, 36L, 9L, 35L, 43L, 85L, 43L]
> txB = [4L, 9L, 9L, 5L, 4L, 4L, 4L, 5L, 6L, 5L]
> rxP = [77, 228, 251, 112, 77, 42, 75, 97, 147, 91]
> txP = [61, 177, 188, 90, 61, 40, 64, 76, 113, 77]
> col = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
>
> ethPlot = pyplot
> fig = ethPlot.figure()
> host = SubplotHost(fig, 111)
>
> host.set_ylabel("kB/s")
> host.set_xlabel("Time")
>
> par1 = host.twinx()
> par2 = host.twinx()
>
> par1.set_ylabel("Packets/s")
>
> par2.axis["right"].set_visible(False)
>
> offset = 60, 0
> new_axisline = par2.get_grid_helper().new_fixed_axis
> par2.axis["right2"] = new_axisline(loc="right",
>                     axes=par2,
>                     offset=offset)
>
> par2.axis["right2"].label.set_visible(True)
> par2.axis["right2"].set_label("Collisions")
>
> par1.set_ylim(0, 6000)
> par2.set_ylim(0, 7000)
>
> host.axis([ dates[0], ( dates[0] + 0.041  ), -7000, 7000])
> par1.axis([ dates[0], ( dates[0] + 0.041  ), -1, 1])
> par2.axis([ dates[0], ( dates[0] + 0.041  ), -700, 700])
>
> fig.add_axes(host)
> ethPlot.subplots_adjust(right=0.75)
>
> drawRxByt, = host.plot_date(dates, rxB, 'g', tz=None, xdate=True,
> ydate=False, label="kB/s in")
> drawTxByt, = host.plot_date(dates, txB, 'b', tz=None, xdate=True,
> ydate=False, label="kB/s out")
> drawRxPaq, = par1.plot_date(dates, rxP, 'm', tz=None, xdate=True,
> ydate=False, label="packets/s in")
> drawTxPaq, = par1.plot_date(dates, txP, 'y', tz=None, xdate=True,
> ydate=False, label="packets/s out")
> drawColls, = par2.plot_date(dates, col, 'r', tz=None, xdate=True,
> ydate=False, label="collisions")
>
> fig.autofmt_xdate()
>
> host.set_xlabel("Time")
> host.set_ylabel("kB/s")
> par1.set_ylabel("Packets/s")
>
> host.legend()
>
> host.axis["left"].label.set_color(drawRxByt.get_color())
> host.axis["left"].label.set_color(drawTxByt.get_color())
> par1.axis["right"].label.set_color(drawRxPaq.get_color())
> par1.axis["right"].label.set_color(drawtxPaq.get_color())
> par2.axis["right2"].label.set_color(drawColls.get_color())
>
> ethPlot.draw()
> pylab.savefig( './test.png', dpi=(640/8))
>
>
>
>
> Maybe I do something wrong somewhere here, but other scripts that do the
> same for a single graphwork like a charm. So it's not a question of dataType
> or something. To compare with a working code, here is the first version of
> the fuction that does the job on single graphs without any problem :
>
> def drawEthGraph(filename, hdates, rxP, txP, rxB, txB, col):
>   ethPlot = pyplot
>   fig = ethPlot.figure()
>   ax = fig.add_subplot(111)
>   ax.plot_date(hdates, rxP, 'g', None, True, False)
>   ax.plot_date(hdates, txP, 'b', None, True, False)
>   ax.plot_date(hdates, rxB, 'g', None, True, False)
>   ax.plot_date(hdates, txB, 'b', None, True, False)
>   ax.plot_date(hdates, col, 'r', None, True, False)
>   ax.axis([ hdates[0], ( hdates[0] + 0.042  ), -7000, 7000])
>   ax.grid(True)
>   fig.autofmt_xdate()
>   pylab.savefig( filename, dpi=(640/8))
>
>
> I don't think I understand the whole process of generation, but I thought at
> least at the beginnig I was having a good feeling with this API.
> Now I wonder how to go around this. Maybe you'll have an idea :-o
>
> Bes

Re: [Matplotlib-users] contourf: black lines connecting contour levels?

2009-07-02 Thread Jae-Joon Lee
The dropbox link is broken (you need a public url).
What version of mpl and what backend are you using?

There was a similar problem which has now been fixed.
Try the work-around described in the thread below, and see if works.

http://www.nabble.com/problems-with-contourf---alpha-td22553269.html


Regards,

-JJ



On Thu, Jul 2, 2009 at 4:26 PM, Rick Muller wrote:
> When I do contourf plots in matplotlib, I get lines connecting the contour
> levels. This doesn't only appear to be an artifact of my plotting
> algorithms, it appears in this example from the matplotlib cookbook:
>
> http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
>
> at least on my mac.
>
> (I think this is the link to the output I get from that:
> https://dl-web.getdropbox.com/get/Photos/griddata-test.png?w=007c9af9
> )
>
> Is there a way to keep these lines from happening? If not, is there a way to
> turn off all of the black lines separating the contour levels?
>
> Thanks in advance,
>
> Rick
>
> --
> Rick Muller
> rpmul...@gmail.com
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Highlighting the axes of coordinates

2009-07-03 Thread Jae-Joon Lee
Changing the properties of the individual grid line can be tricky.
The easier way in my opinion is to draw another line with thinker linewidth.

ax=subplot(111)
ax.grid()

from matplotlib.transforms import blended_transform_factory

# for x=0
trans = blended_transform_factory(ax.transData, ax.transAxes)
ax.plot([0,0], [0,1], "-",
transform=trans,
color="red", linewidth=2,
zorder=5)

# for y=0
trans = blended_transform_factory(ax.transAxes, ax.transData)
ax.plot([0,1], [0,0], "-",
transform=trans,
color="blue", linewidth=2,
zorder=5)

-JJ


On Wed, Jul 1, 2009 at 8:40 AM, Torsten
Bronger wrote:
> Hallöchen!
>
> I have a grid in my plot, but additionally I'd like to highlight the
> "zero" axes, where x=0 or y=0, e.g. by showing them in red, or with
> thicker lines.  How is this possible?
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>                   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>                                  or http://bronger-jmp.appspot.com
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] contourf: black lines connecting contour levels?

2009-07-03 Thread Jae-Joon Lee
The example in the cookbool works fine with svn version of mpl.
So, it seems that this bug has been fixed.

Anyhow, which command (contour or contourf) draws the vertical lines?
I bet it is contourf. And set_edgecolor("none") for return value of
contourf should have some effect. Did you redraw the figure?
Regards,

-JJ


On Thu, Jul 2, 2009 at 9:20 PM, Rick Muller wrote:
> Oh, and I'm using the Agg backend, I think, whatever is the default.
>
> On Thu, Jul 2, 2009 at 7:19 PM, Rick Muller  wrote:
>>
>> JJ
>>
>> Thanks for the tips. I had seen one of those posts whilst googling around
>> for the bug, but discounted it because I'm not using an alpha value.
>>
>> Here are links to one of the cookbook examples, and one of the files that
>> I want to plot:
>> http://files.getdropbox.com/u/533499/griddata-test.png
>> http://files.getdropbox.com/u/533499/silicon_donor_10_newplot.png
>>
>> I'm using Mac OS 10.5.7, Python 2.6.2, and MPL 0.98.5.3.
>>
>> I don't know which bug in the thread you were referring to. I tried the
>>
>> >>> for c in CS.collections: c.set_edgecolor("none")
>>
>> fix, but it didn't have any effect.
>>
>> On Thu, Jul 2, 2009 at 4:49 PM, Jae-Joon Lee  wrote:
>>>
>>> The dropbox link is broken (you need a public url).
>>> What version of mpl and what backend are you using?
>>>
>>> There was a similar problem which has now been fixed.
>>> Try the work-around described in the thread below, and see if works.
>>>
>>> http://www.nabble.com/problems-with-contourf---alpha-td22553269.html
>>>
>>>
>>> Regards,
>>>
>>> -JJ
>>>
>>>
>>>
>>> On Thu, Jul 2, 2009 at 4:26 PM, Rick Muller wrote:
>>> > When I do contourf plots in matplotlib, I get lines connecting the
>>> > contour
>>> > levels. This doesn't only appear to be an artifact of my plotting
>>> > algorithms, it appears in this example from the matplotlib cookbook:
>>> >
>>> >
>>> > http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
>>> >
>>> > at least on my mac.
>>> >
>>> > (I think this is the link to the output I get from that:
>>> > https://dl-web.getdropbox.com/get/Photos/griddata-test.png?w=007c9af9
>>> > )
>>> >
>>> > Is there a way to keep these lines from happening? If not, is there a
>>> > way to
>>> > turn off all of the black lines separating the contour levels?
>>> >
>>> > Thanks in advance,
>>> >
>>> > Rick
>>> >
>>> > --
>>> > Rick Muller
>>> > rpmul...@gmail.com
>>> >
>>> >
>>> > --
>>> >
>>> > ___
>>> > Matplotlib-users mailing list
>>> > Matplotlib-users@lists.sourceforge.net
>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> >
>>> >
>>
>>
>>
>> --
>> Rick Muller
>> rpmul...@gmail.com
>
>
>
> --
> Rick Muller
> rpmul...@gmail.com
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Append _one point_ to a plot?

2009-07-03 Thread Jae-Joon Lee
On Fri, Jul 3, 2009 at 1:05 PM, guillaume ranquet wrote:
> but something sounds plain wrong, It sounds like there's too much
> useless calculations and data copied.
>

Well, if you think something is wrong, I guess you may have chosen a
wrong tool.
MPL is mainly for 2d plotting, and not very strong for animation
although it supports some.

> would it be a good idea to have an array of 1000 points and shift it
> left every round to add the new point at the end?

Shifting array should be done by numpy, not by matplotlib (I'm not
sure if numpy can do this in place). Anyhow, what actually matter is
that even if you shift the array, matplotlib will draw all the points
in the array every time.

One possible option in your case is to save your plot as an image in
each round. And at the next round, you plot the newly available data
upon the shifted image.

http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2.html

Note that the above example requires svn version of matplotlib.

Regards,

-JJ

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] {axesgrid} - How to change fontsize on multiple labels?

2009-07-08 Thread Jae-Joon Lee
axes_grid toolkit uses slightly customized version of axes and
different kind of artists are used to draw ticks and ticklabels, and
some of the commands from original mpl do not work.
But not changing fontsize and not showing up gridlines are things that
should be fixed (I'll work on these in a few days).
Meanwhile, there are workarounds.

For fontsize, try to directly set the font size of the label object.
Unfortunately, the padding between the label and the axis get messed
up, and you need to adjust the padding manually.

host.axis["bottom"].label.set_size(30)
host.axis["bottom"].LABELPAD=10

For grid, it is a bit more tricky.

host.xaxis.set_visible(True)
host.yaxis.set_visible(True)
host.xaxis.get_label().set_visible(False)
host.yaxis.get_label().set_visible(False)
for a in host.xaxis.majorTicks + host.yaxis.majorTicks:
a.gridOn=True
a.tick1On=False
a.tick2On=False
a.label1On=False
a.label2On=False

I hope these workarounds are useful.
Thanks for reporting the problems and I;ll try to fix them soon.
Regards,

-JJ




On Wed, Jul 8, 2009 at 10:00 PM, Gökhan SEVER wrote:
> Hello,
>
> I am using axes_grid toolkit to create multiple axes. The labels' colors are
> nicely being updated, however size or fontsize has no effect on the
> resulting figure :( Are they functional, or is it something wrong with my
> implementation? Oh also I couldn't make the grids switched on my figures.
>
> Here is the snippet that I use:
>
> fig = plt.figure(1)
> host = SubplotHost(fig, 111)
> fig.add_subplot(host)
> par = host.twinx()
> host.set_xlabel("Time [sfm]", size=50)
> host.set_ylabel("DMT CCN Concentration [#/cm^3]", fontsize=20)
> par.set_ylabel("Supersaturation [%]", fontsize=20)
>
> p1, = host.plot(Time, dccnConc, label="dccnConc")
> p2, = host.plot(Time, dccnConAmb, label="dccnConAmb")
> p3, = host.plot(Time, dccnConSTP, label="dccnConSTP")
> p4, = par.plot(Time, dccnSS, label="dccnSS")
> p5, = par.plot(Time, dccnSS_Amb, label="dccnSS_Amb")
>
> host.axis["left"].label.set_color(p1.get_color())
> par.axis["right"].label.set_color(p5.get_color())
>
> host.axis["left"].label.set_label(p1.get_label())
> host.legend()
> plt.show()
>
>
> These are my current system properties:
>
> Linux 2.6.27.19-170.2.35.fc10.i686.PAE (Fedora 11)
> Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
> IPython 0.10.bzr.r1174 (with --pylab)
> and a very recent Matplotlib svn version.
>
> Thanks.
>
> --
> Gökhan
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zoomed in detail box

2009-07-08 Thread Jae-Joon Lee
If you use the svn version of matplotlib, you  may use axes_grid toolkit.

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator

I think the required inset_locator module actually does not depend on
other modules in axes_grid, so if you're not using svn, you may just
download inset_locator.py and use it.
But still, you need to have 0.98.5.3 installed.

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py?view=markup

-JJ


On Wed, Jul 8, 2009 at 6:24 AM, Robin wrote:
> Hi,
>
> I'm sure its a bit lazy to ask but I can't think of the right keywords
> to search for...
>
> I would like to produce a plot with a zoomed in box detail section.
> What I have in mind is a plot of an exponentially decaying line with
> some fine detail, so I would like the main plot to show the scale of
> the exponential decay, but then in the large space in the
> center/top/right of the plot I would like to have a zoomed in box
> showing more detail of a particular bit to show the level of the noise
> etc.
>
> No idea where to start with acheiving this so I thought I'd ask if
> anyone has done anything similar or if there would be any examples on
> the web site - or whether it would be easier just to produce 2 plots
> at different scales then chop them together in a graphics editing
> program. (I thought of inkscape, but in the past when I've tried to
> edit matplotlib vector output it messed up the fonts - or at least
> changed them - so I'm not sure if theres a better program, or some
> trick to using it).
>
> Cheers
>
> Robin
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zoomed in detail box

2009-07-08 Thread Jae-Joon Lee
Arrrg,
it depends on other module in axes_grid toolkit.
So, you need svn version of mpl.

However, It is possible to specify the location of the axes in
normalized axes coordinate.

http://thread.gmane.org/gmane.comp.python.matplotlib.general/16373

-JJ


On Wed, Jul 8, 2009 at 10:57 PM, Jae-Joon Lee wrote:
> If you use the svn version of matplotlib, you  may use axes_grid toolkit.
>
> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator
>
> I think the required inset_locator module actually does not depend on
> other modules in axes_grid, so if you're not using svn, you may just
> download inset_locator.py and use it.
> But still, you need to have 0.98.5.3 installed.
>
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py?view=markup
>
> -JJ
>
>
> On Wed, Jul 8, 2009 at 6:24 AM, Robin wrote:
>> Hi,
>>
>> I'm sure its a bit lazy to ask but I can't think of the right keywords
>> to search for...
>>
>> I would like to produce a plot with a zoomed in box detail section.
>> What I have in mind is a plot of an exponentially decaying line with
>> some fine detail, so I would like the main plot to show the scale of
>> the exponential decay, but then in the large space in the
>> center/top/right of the plot I would like to have a zoomed in box
>> showing more detail of a particular bit to show the level of the noise
>> etc.
>>
>> No idea where to start with acheiving this so I thought I'd ask if
>> anyone has done anything similar or if there would be any examples on
>> the web site - or whether it would be easier just to produce 2 plots
>> at different scales then chop them together in a graphics editing
>> program. (I thought of inkscape, but in the past when I've tried to
>> edit matplotlib vector output it messed up the fonts - or at least
>> changed them - so I'm not sure if theres a better program, or some
>> trick to using it).
>>
>> Cheers
>>
>> Robin
>>
>> --
>> Enter the BlackBerry Developer Challenge
>> This is your chance to win up to $100,000 in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full prize
>> details at: http://p.sf.net/sfu/Challenge
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] {axesgrid} - How to change fontsize on multiple labels?

2009-07-09 Thread Jae-Joon Lee
On Thu, Jul 9, 2009 at 12:40 AM, Gökhan SEVER wrote:
> I have one tiny question left working on these figures; that is: how to make
> mathtext font and a regular label font at the same size?
>
> For instance:
>
> host.set_ylabel(r"DMT CCN Concentration [ #/$cm^3$]")
>
> but as it is seen from the figure they look a bit weird.

My guess is that this is the default behavior of tex rendering, but i
may be wrong.
If you want bigger mathtext, I think you need to use tex command, but
again, i'm not sure and I hope someone else answer this.

-JJ

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] zoomed in detail box

2009-07-09 Thread Jae-Joon Lee
On Thu, Jul 9, 2009 at 7:24 AM, Robin wrote:
>> On Wed, Jul 8, 2009 at 10:57 PM, Jae-Joon Lee wrote:
>>> If you use the svn version of matplotlib, you  may use axes_grid toolkit.
>>>
>>> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator
>
> Wow - this is really amazing. Sometimes it can be a bit frustrating
> when I'm working to a deadline to figure out the details of Bbox's and
> such but when I find something like this it really makes it worth
> while! It does exactly what I want, really easy to use and only took
> about 5 lines! (It would be nice if there were some docstrings in
> there though :))
>
> On Thu, Jul 9, 2009 at 4:02 AM, Jae-Joon Lee wrote:
>> However, It is possible to specify the location of the axes in
>> normalized axes coordinate.
>>
>> http://thread.gmane.org/gmane.comp.python.matplotlib.general/16373
>
> I'm afraid I didn't really understand how to apply this in my case...
> I guess I would have to set the position and everything by hand
> instead of using the zoom helper. I preferred to use the zoom helper,
> but found the legend loc settings put it slightly too close to the
> edge of the surrounding axes for my taste.
>
> So after checking the docstrings for how to position legends I came up
> with something that works, but it required a minor change to the
> inset_locator.py to pass the bbox_to_anchor and bbox_transform (it
> looks like this was intended since they have None default values):
>
> robin-mbp-3:~ robince$ diff
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mpl_toolkits/axes_grid/inset_locator.py
> code/scipy_build/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
> 288c288
> <    axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom,
> loc=loc, bbox_to_anchor=bbox_to_anchor,bbox_transform=bbox_transform)
> ---
>>    axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc)
>
> With this minor change I get exactly what I want!
>

Thanks for the catch. I'll commit the change to the svn soon.
By the way, borderpad keyword is meant to do what you want. However, I
just found that it does not work sine the option is not properly
handled. I'll fix this in the next commit.

Regards,

-JJ


>   ax1ins = zoomed_inset_axes(ax1, 3,
> bbox_to_anchor=(0.1,0,1,1),bbox_transform=ax1.transAxes, loc=6)
>    plot_trial_dists(res515[0],8,ax=ax1ins)
>    ax1ins.set_xlim([5, 50])
>    ax1ins.set_ylim([0, 0.04])
>    ax1ins.set_xticks([])
>    ax1ins.set_yticks([])
>    mark_inset(ax1, ax1ins, loc1=2, loc2=4, fc="none", ec="0.5")
>
> thanks again, this is really terrific!
>
> Cheers
>
> Robin
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problems with numpoints in legend

2009-07-11 Thread Jae-Joon Lee
The number of points in scatter plot has other keyword argument
(scatterpoints). This is true for svn version, but I'm not quite sure
if it is also true for 0.98.5.2.
Anyhow, the documentation still needs to be updated.

Regards,

-JJ


On Sat, Jul 11, 2009 at 9:46 AM, John Hunter wrote:
> On Mon, Jul 6, 2009 at 6:06 AM, Oliver Tomic wrote:
>> Hi,
>>
>> Windows XP
>> Python 2.5.2
>> matplotlib 0.98.5.2
>>
>> I try to use numpoints for a legend my plot, but without luck. I always end
>> up having three points in the legend despite setting numpoints=1 (see below
>> towards the end of the code).
>> Things work nicely though in a much simpler script.
>>
>> Help is greatly appreciated.
>
> When posting an example, it helps if we can run it:-)  In this case,
> we would need your data files
>
> assC = np.loadtxt('Apples_flowerFlavour_assC_corrPlot.txt')
> all = np.loadtxt('Apples_flowerFlavour_allAssessors_corrPlot.txt')
>
> JDH
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib breaks: ValueError: ordinal must be >= 1 from matplotlib/dates.py", line 170, in _from_ordinalf

2009-07-14 Thread Jae-Joon Lee
Please post a standalone example that reproduces your problem.
I tried your example with some junk data but no such exception is raised.

However, there has been a report of a similar ordinal value problem
which I think is not fixed yet, but that problem only occurs when two
and more axes are shared.

See if below helps,
 * move the axhline call after the plotting commands.
 * autoscale only after all the necessary plot elements are in place.

Again, please post a standalone example that reproduces your problem.

Regards,

-JJ


On Tue, Jul 14, 2009 at 9:50 AM, M Osborne wrote:
> I am trying to plot some historical trend data, where x is a date and
> y is a percentage.
>
> When I try to insert a horizontal line with ax1.axhline(y=80,
> linewidth=1, color='r'), matplotlib breaks, with an error "
> ValueError: ordinal must be >= 1".
>
> The Traceback most recent call is,  File
> "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 170, in
> _from_ordinalf
>    dt = datetime.datetime.fromordinal(ix)"
>
> Without the axhline element, matplotlib handles the data fine, and
> plots nice weekly dates.
>
> I'm guessing based on the error that axhline is manually forcing
> autoscale off and/or matplotlib can no longer interpret the date
> values for x?
>
> Below is the matplotlib snippet of my code:
>
>        fig = plt.figure(figsize=(20,10))
>        font = { 'fontname':'Tahoma', 'fontsize':12 }
>        ax1 = fig.add_subplot(211)
>        ax1.set_ylim(0,100)
>        ax1.autoscale_view(tight=False, scalex=True, scaley=False)
>        ax1.grid(True)
>        ax1.axhline(y=80, linewidth=1, color='r')
>        ax1.set_ylim(0,100)
>        ax1.autoscale_view(tight=False, scalex=True, scaley=False)
>        ax1.plot(timestamp, percentu, 'ko-' )
>        ax1.plot(timestamp, percentl, 'b--', linewidth=2)
>        ax2 = fig.add_subplot(212)
>        ax2.grid(True)
>        ax2.plot(predict_x, predict_y, 'bs--', linewidth=2)
>        plt.savefig("plot.pdf")
>
>
> Thank you in advance!
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] The vertical part of y error bars. Where are they?

2009-07-15 Thread Jae-Joon Lee
http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=errorbar#matplotlib.pyplot.errorbar

As described in the doc, the errorbar command creates lines and line
collections, where the  errorbars  are created as line collections.
Axes.collections contains the list of collection artist that belong to
the axes hence this is the place.

However, I don't think manipulating Axes.collections (and the return
value of get_lines() ) in this way is a good idea. All the artist
added to an axes has "remove" method. When called, the artist remove
itself from the axes it belongs.

I'm not sure what your intention is, but if you want to temporarily
remove some artists from the axes, it would be easier  to make them
simply invisible. Otherwise, I recommend you to use the remove method.

Regards,

-JJ



On Tue, Jul 14, 2009 at 6:13 PM, Jack Sankey wrote:
> Hello,
> I'm writing a script that removes data from plots by looping over
> axes.get_lines(), removing data, then using axes.set_lines(). It works quite
> well, but when it's a plot with error bars, the vertical part of the error
> bar is not disappearing.
> I'm assuming the vertical part is a vline or something and so should not be
> with the other lines. Where does this data get stuck? :)
> Thanks!
> Jack
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot a line with an arrow

2009-07-15 Thread Jae-Joon Lee
Check the gallery where a few example shows you how to draw arrows.

My recommendation is to use "annotate" with empty string.

e.g.,

annotate("", (1,2), xytext=(5,2), arrowprops=dict(fc="b"))

http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=annotate#matplotlib.pyplot.annotate

However, a line with an arrow in the middle is not supported. But
something like below may be close enough?

annotate("", (3,5), xytext=(5,5),
 arrowprops=dict(arrowstyle="->", fc="b", shrinkB=0))
annotate("", (1,5), xytext=(3,5),
 arrowprops=dict(arrowstyle="-", fc="b", shrinkA=0))

-JJ


On Tue, Jul 14, 2009 at 2:13 PM, Afi Welbeck wrote:
> Hi all,
>
> I'm a newbie, I'm trying to plot a line with an arrow
> (arrow in the  middle and another with an arrow at
> the end) with the following points: [1, 2] and [5, 2]
> Could anyone please help me with the code?
> Thanks.
> Harriet A. Welbeck
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Creating new type of plot

2009-07-15 Thread Jae-Joon Lee
On Mon, Jul 13, 2009 at 4:56 PM, Uri Laserson wrote:
> Hi everyone,
>
> I am trying to create some brand new types of plots for a unique data set
> that I have.  My question basically boils down to getting some advice on
> what is the proper way to set up a function that will act like one of the
> matplotlib pyplot functions (e.g., have all the same behavior regarding
> interactive stuff, resizing, etc.).

Most of the pyplot functions are wrapper around the method in the Axes class.
For example, pyplot.plot is basically

 ax = gca()
 ax.plot()
 draw_if_interactive()

And the basic role of the plotting method in the Axes class is to
create appropriate
matplotlib artists and add them to the axes. If your plot can be
created with matplotlib's currently existing artists, you can simply
reuse them. Otherwise, you need to create your own artist, but this
requires some understandings of internals.

For example,

def ax_my_plot(ax, *kl, **ka):
# create artists and add them to ax

def my_plot(*kl, **ka):
ax = gca()
ax_my_plot(ax, *kl, **ka)
draw_if_interactive()

"my_plot" will behave similar to other pyplot command.

>
> I have been looking through some of the code for the major functions like
> plot, but have been having trouble parsing it.  I think that some of this is
> obfuscated in the complexity of the functions.
>
> At some level, I would also like to be able to draw on the canvas in a very
> explicit way, like in Processing (http://processing.org/); what is the best
> way to approach this?

You can draw something in the canvas coordinate. But what you can do
is limited by the matplotlib's backend api, which is more like a
vector drawing tool. So things like a pixel manipulation is not
suitable.

Regards,

-JJ

>
> Another thing that could be really nice is to have some boilerplate
> framework that someone could start with to quickly write functions that
> integrate well into the rest of matplotlib.
>
> (And sorry if I am sounding critical of the package.  I actually love it,
> and have been quite the MPL evangelist in my little section of Boston.)
>
> Any suggestions are welcome.
>
> Uri
>
> --
> Uri Laserson
> PhD Candidate, Biomedical Engineering
> Harvard Medical School (Genetics)
> Massachusetts Institute of Technology (Mathematics)
> phone +1 917 742 8019
> laser...@mit.edu
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] dynamically add subplots to figure

2009-07-16 Thread Jae-Joon Lee
One work around is to call

  self.figure.subplots_adjust()

after geometry changed. After this call, the twinx-ed axes will have
the same axes position as the original one.

Another option is to use mpl_toolkits.axes_grid
(http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#parasiteaxes).
But the previous solution seems to be much easier for you.
Regards,

-JJ


On Thu, Jul 16, 2009 at 1:16 PM, Tom Vaughan wrote:
> On Tue, Jun 2, 2009 at 07:33, John Hunter wrote:
>> On Tue, Jun 2, 2009 at 9:03 AM, Tom Vaughan  wrote:
>>> Is it possible to add subplots to a figure if I don't know in advance
>>> how many subplots I need to add?
>>>
>>> What I do now is I call add_subplot like add_subplot(i, 1, i) where i
>>> is 1 initially, and just increases by 1 on each call. This almost
>>> works. Except the first plot takes up the whole figure, the second
>>> plot is placed on top of the bottom half of the first plot, etc. Is
>>> there a way to "resize" the plots when a subplot is added? Or how
>>> would I "re-plot" the previous subplots?
>>
>> See the Axes.change_geometry command
>>
>>  http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.SubplotBase.change_geometry
>
> twinx() does not return an axes that contains the change_geometry
> method. How then can I do the equivalent on this axes? Calling twinx()
> again on the original axes after change_geometry() has been called
> does not do the trick. Thanks.
>
> -Tom
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] non interactive runs keep crashing due to DISPLAY

2009-07-17 Thread Jae-Joon Lee
Are you trying to run your script without opening a gui window?

If yes, "interacitve" is not what you want.

http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server

Anyhow, I had similar experience that some Tk application failed to
open over ssh connection. And sometimes, -Y option helped. If -Y does
not help, see if other backends work.

-JJ



On Fri, Jul 17, 2009 at 10:57 AM, John [H2O] wrote:
>
>
>
> John [H2O] wrote:
>>
>>
>> My $DISPLAY variable does change from time to time, but as I have it set
>> to interactive, why should this matter?
>>
>>
>
> I wanted to explain a little further. I have it set to interactive(False)
> sorry if there is confusion in my above statement.
> The reason my DISPLAY variable changes is that I am running the scripts on a
> remote machine and using ssh -X to login. So each time I log in, the DISPLAY
> variable may change.
>
>
> --
> View this message in context: 
> http://www.nabble.com/non-interactive-runs-keep-crashing-due-to-DISPLAY-tp24535712p24536107.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes position is changed during rendering

2009-07-17 Thread Jae-Joon Lee
"imshow" sets aspect=1 unless you changed your rcparams.
Unless aspect="auto", the axes position changes during the drawing time.

call imshow with aspect="auto"

or use set_aspect method.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=aspect#matplotlib.axes.Axes.set_aspect

Regards,

-JJ


On Thu, Jul 16, 2009 at 10:20 AM, Andrei Kopats wrote:
> Hello
>
> I have a little problem.
>
> On figure I have 2 Axes created by
>        fig = plt.figure(figsize = (16, 10), facecolor='w')
>       ax1 = fig.add_axes([0, 0, 1, 0.1])
>       ax2 = fig.add_axes([0.1, 0.19, 0.8, 0.72], autoscale_on=True)
> There are some text and images on it:
>       ...
>       drawing  on ax1 and ax2
>       ...
>       ax1.imshow(arr, extent=[0.01, 0.29, 0.1, 0.95])
>       ax1.imshow(arr, extent=[0.75, 0.96, 0.5, 0.8])
>       ...
>
> My problem - when I plot the figure - ax1 changes it's geometry.
> Code:
>        print 'ax1:', ax1
>        print 'ax2:', ax2
>
>        plt.show()
>
>
>        print 'ax1:', ax1
>        print 'ax2:', ax2
>        print 'ax1 position changed during plt.show(). Why???'
>
> Output:
>
>        ax1: Axes(0,0;1x0.1)
>        ax2: Axes(0.1,0.19;0.8x0.72)
>        ax1: Axes(0.470649,0;0.0587025x0.1)
>        ax2: Axes(0.1,0.19;0.8x0.72)
>        ax1 position changed during plt.show(). Why???
>
> On resulting plot ax1 has position (0.470649,0;0.0587025x0.1), but
> desired are (0,0;1x0.1).
>
> Could anyone help me, or give an idea, why axes is moved, or give an
> advice, how to resolve this situation.
>
> Thank you
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] grouping several line types together in legend of plots

2009-07-17 Thread Jae-Joon Lee
On Thu, Jul 16, 2009 at 10:49 PM, per freem wrote:
> hi all,
>
> suppose i have am plotting several lines using 'plot', some are dashed
> (using '--') and some are ordinary solid lines. i am plotting several solid
> and several dashed lines, all in different colors, as in:
>
> for n in num_lines:
>   # plot dashed line
>   plot(line_x[n], line_y[n], '--', color=line_color[n], label="line %d"
> %(n))
>   # plot ordinary line in different color
>   plot(line_x[n], line_y[n], color=other_line_color[n], label="line %d"
> %(n))
>   ...
>
> If i plot n lines, i don't want the legend to show n-items, giving a
> separate key for each line. rather, i want it to display a legend containing
> a label for the dashed lines and a label for the solid lines, as in:
>
> Legend:
> [-- line of type A
>  -  line of type B]
>
> so 2 entries rather than as many entries as i have lines. how can i do this?
>

If you set "_nolegend_" as label, that line will not be displayed in the legend.

http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=legend#matplotlib.pyplot.legend

Or, you may manually select which lines to be displayed.
See the above documentation for more details.


> finally, how can i make it so the legend does not interfere with the plot?
> right now the lines appear "behind" the legend. it'd be great if the legend
> could be made to be in the background of the line (i.e. be transparent.)
>

reduce the zorder of the legend less than that of the lines.

http://matplotlib.sourceforge.net/api/artist_api.html?highlight=zorder#matplotlib.artist.Artist.set_zorder

e.g.,

l = legend()
l.set_zorder(0)


Regards,

-JJ


> thank you.
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] formatting help with legend for stacked bar graph with many categories

2009-07-17 Thread Jae-Joon Lee
To change the legend font size, you may change the "legend.fontsize"
in rcParams.
The change will be global. If you want to change the font size of some
particular legend, use the appropriate font property as the "prop"
keyword.

http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=legend#matplotlib.pyplot.legend

List of spacing parameters are also available in the above
documentation. Most of other spacing parameters are meant to scale
with the font size.

For legend position, take a look at the below legend guide.

http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location

However, I guess this will only work if you use svn version.
If you're not using svn version, you can have similar result by
creating a separate axes.

http://www.nabble.com/Stopping-Legend-From-Overlapping-the-Graph-td24213554.html#a24213554

Regards,

-JJ






On Thu, Jul 16, 2009 at 7:15 PM, Chuck Pepe-Ranney wrote:
> Hello Users,
>
> I need some help with formatting a legend for a stacked bar graph.  Each bar
> is segmented into ~35 categories so my legend ends up being a long mess
> overlapping my plot.  How can I position my legend outside of the plot and
> reduce the spacing and fontsize for the text?
>
> Thanks,
>
> - Chuck
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem using subplots with ion()

2009-07-17 Thread Jae-Joon Lee
On Wed, Jul 15, 2009 at 3:23 PM, Louise
Loudermilk wrote:
> Hi.  I am trying to output multiple 2D graphs (subplots) in one figure
> (using pylab) for each time-step that the python code runs - basically an
> interactive graphs.  We use the 'ion()' and 'imshow()' functions for this.
> I have many graphs to chose from, but say if I chose 4 graphs to output, all
> 4 will output for the 1st time step, but for every additional time step only
> the last graph will update.  The first 3 will remain the same, as they were
> in the 1st time step.  Has anyone has this problem?  Any suggestions?
>


I'm not sure what exactly an issue here.
You want to know how to keep the first three graph during each step?
Can't you just clear the last axes, and redraw it.

e.g.,

self.subplot4.cla()
self.subplot4.imshow(...)

if you want to stick to the pylab interface (which I don't think a
good idea for application development),

sca(self.subplot4)
cla()
imshow(...)

A snippet of code does not help much.
Please take your time to create a small, standalone script that
reproduces your problem and post that on the mailing list.

Regards,

-JJ



> A portion of the O-O code is below.  This function is called in another
> file. I tried to add notes where I thought they were helpful.
>
>     def multi_display(self, n=4):
>
>     ''' displaying multiple graphs '''
>
>     ion()
>     m = self.displayed_multi     # four input graph names (provided when
> function is called)
>     nsub = n      # no. of subgraphs/time step
>
>     for i in range(nsub): # for each subplot
>
>     p = i +1
>     exec ("self.subplot" + str(p) + " = subplot(2, 2, p)")   # OR
> subplot(2,2,p)
>
>     self.displayed = m[i]
>     self.display_stand()   # this calls the function below  with
> 'self.displayed' in it.
>
> def display_stand(self): # displays individual graphs
>
>     if self.displayed == 'ht': # this is only one of the four graphs (or
> subplots)
>
>     vm = 0.0
>     vx = 40.0
>     t = 'Height (m)'
>     imshow(self.old_ht, vmin = vm, vmax = vx,
>    interpolation = 'nearest')
>     title(t)
>
> Thanks,
> Louise
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with autofmt_xdate()

2009-07-17 Thread Jae-Joon Lee
Please post a simple, standalone script that reproduces your problem,
so that we can track down what is causing the problem. I don't think
there has been any report of a similar issue (but not sure). As far as
I know, autofmt_xdata only adjusts the alignment and rotation of the
ticklabels and does not change the font property.

-JJ


On Thu, Jul 16, 2009 at 10:55 AM, Domenico
Nappo wrote:
> Whenever I try to use autofmt_xdate() on a Figure(), dates on x axis
> disappear...I guess this is related with something concerning font
> management...
> Anyone experienced this kind of issues?
>
> I use most recent versions of matplotlib, numpy, gtk2, pygtk on a Python 2.5
> platform (installed via binaries on a window xp machine).
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Annotation on an axis

2009-07-17 Thread Jae-Joon Lee
Drawing box around a text is quite easy.

http://matplotlib.sourceforge.net/examples/pylab_examples/fancytextbox_demo.html

To place a text in a way like ticklabels, you need to use blended transform.

The short example may give you some starting point.

-JJ


from matplotlib.transforms import blended_transform_factory

ax = subplot(111)
# x position in axes coordinate : 1.02
# y position in data coordinate : 0.3
t = ax.text(1.02, 0.3, "label", ha="left",
transform=blended_transform_factory(ax.transAxes,
ax.transData),
bbox=dict(boxstyle="round", fc="cyan"),
)



On Fri, Jul 17, 2009 at 12:51 PM, Christophe
Dupre wrote:
> Hello,
>
> I am trying to add some annotations onto an axis as shown in the attached 
> picture.
> Is that do-able? If yes, any pointers on how to achieve this are welcome.
>
> Thanks,
>
> Christophe
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Russian labels without LaTeX

2009-07-17 Thread Jae-Joon Lee
I'm not an expert on this issue, and I never used Russian language.
But here is my experience with unicode in matplotlib.

Matplotlib's own font rendering engine (based on truetype)  does
support unicode rendering. But I don't think there is any support for
things like a fontset. And, as far as you specify the font file to be
used, you can draw unicode text.
Here is an example (this is to draw some Korean text). Modify this for
your need.

-JJ

# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt

plt.rcParams["text.usetex"] = False
import matplotlib.font_manager as fm
fp1=fm.FontProperties(fname="/users/research/lee/.fonts/Eunjin.ttf")

plt.text(0.5, 0.5, u"한글", fontproperties=fp1)
plt.show()



2009/7/17 Alexander Bruy :
> Hi, list!
>  I want to use Russian or Ukrainian language in text within matplotlib plot.
> There is solution, which I know - it is possible when text rendered with 
> external LaTeX:
>
> from matplotlib import rc
> rc('font',**{'family':'serif'})
> rc('text', usetex=True)
> rc('text.latex',unicode=True)
> rc('text.latex',preamble='\usepackage[utf8]{inputenc}')
> rc('text.latex',preamble='\usepackage[russian]{babel}')
>
> But LaTex is really large dependency, and many users don't want to install 
> it. So my question.
> Is it possible to use Russian or Ukrainian language in text within matplotlib 
> plot in another way than using LaTeX?
>
>
> Alexander Bruy
>
> -- реклама ---
> Создай свой сайт бесплатно! www.hostpro.ua
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] changing appearance of legend line entries

2009-07-19 Thread Jae-Joon Lee
http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=legend#matplotlib.pyplot.legend

numpoints=1 is what you want.

For font size and etc, check the similar question posted a few days ago.

http://www.nabble.com/formatting-help-with-legend-for-stacked-bar-graph-with-many-categories-td24526118.html#a24537195

-JJ


On Fri, Jul 17, 2009 at 6:12 PM, per freem wrote:
> hi all,
>
> i am plotting two distinct lines, one of the format '-o' the other of the
> format '-s' -- i.e. one line with circular markers the other with a square
> marker. when i add a legend to the figure, it gives a legend that looks like
> this:
>
> o---o  label of circular marker line
> s---s  label of square marker line
>
> however, in these types of plots, it's standard for the line in the legend
> to only have *one* marker. meaning the legend should look like this:
>
> --o--  label of circular marker line
> --s--  label of square marker line
>
> is there a way to get this modified legend appearance?
>
> second question: how can i make the legend altogether smaller? or at least
> make the label text font smaller?
>
> thanks.
>
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] rotating labels, what is wrong?!

2009-07-20 Thread Jae-Joon Lee
get_xmajorticklabels() returns a list of matplotlib's "Text" objects,
not python strings.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=get_xmajorticklabels#matplotlib.axes.Axes.get_xmajorticklabels

On the other hand, set_xticklabels() takes a list of python strings.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=set_xticklabels#matplotlib.axes.Axes.set_xticklabels


Something like below will work.

plt.setp(plt.gca().get_xmajorticklabels(),
 size=6,rotation=30)


-JJ



On Mon, Jul 20, 2009 at 11:48 AM, John [H2O] wrote:
>
> I am trying simply to shrink the font size and rotate xaxis labels:
>
> fig1 = plt.figure()
> ax1 = fig1.add_subplot(211)
> ax2 = fig1.add_subplot(212)
> ax1.plot_date(x,y,'r')
> ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
>                    size=6,rotation=30)
> ax2.plot_date(o_X['time'],o_X['CO'],'y')
> ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
>                     size=6,rotation=30)
>
> I end up with labels as:  ("Text(0,0"Text(0,0,"")")
>
> 
> --
> View this message in context: 
> http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] rotating labels, what is wrong?!

2009-07-20 Thread Jae-Joon Lee
On Mon, Jul 20, 2009 at 4:48 PM, John [H2O] wrote:
>
>
>
> Jae-Joon Lee wrote:
>>
>> get_xmajorticklabels() returns a list of matplotlib's "Text" objects,
>> not python strings.
>>
>
> This is what I've now come to understand, but it seems very odd. Why
> wouldn't it return the list of strings, or alternatively, how can you get
> the list of strings? I guess you have to use the pyplot tools, but I was
> trying to use so called 'fine grain' control and do everything at the axes
> level.
>

Why it does not return a list of strings? Because the documentation
says it does not. Well, I acknowledge the asymetry in the API, but
this is how things are.

How to get the list of strings? Use the "get_text" method of the "Text" object.

http://matplotlib.sourceforge.net/api/artist_api.html?#matplotlib.text.Text.get_text

I used pyplot function because you were calling plt.gca(). If you
don't like it, you can explicitly go over the for loop with
appropriate methods.

for t in ax1.get_xmajorticklabels():
t.set(size=6,rotation=30)

or use set_size and set_rotation if you prefer.

See the documentation for more details.

Regards,

-JJ


>
>
>>
>> plt.setp(plt.gca().get_xmajorticklabels(),
>>          size=6,rotation=30)
>>
>
> In fact, what you show is how I was testing in ipython and it does worked,
> it just seemed in a script it would be better to use the axis method, but
> apparently it is different from the gca() method. This is what I don't
> understand.
>
> Thanks!
>
>
> On Mon, Jul 20, 2009 at 11:48 AM, John [H2O] wrote:
>>
>> I am trying simply to shrink the font size and rotate xaxis labels:
>>
>> fig1 = plt.figure()
>> ax1 = fig1.add_subplot(211)
>> ax2 = fig1.add_subplot(212)
>> ax1.plot_date(x,y,'r')
>> ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
>>                    size=6,rotation=30)
>> ax2.plot_date(o_X['time'],o_X['CO'],'y')
>> ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
>>                     size=6,rotation=30)
>>
>> I end up with labels as:  ("Text(0,0"Text(0,0,"")")
>>
>> 
>> --
>> View this message in context:
>> http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> --
>> Enter the BlackBerry Developer Challenge
>> This is your chance to win up to $100,000 in prizes! For a limited time,
>> vendors submitting new applications to BlackBerry App World(TM) will have
>> the opportunity to enter the BlackBerry Developer Challenge. See full
>> prize
>> details at: http://p.sf.net/sfu/Challenge
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24577287.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Having trouble with aligning subplots

2009-07-20 Thread Jae-Joon Lee
index for subplot starts from 1, not 0 (the convention is from Matlab).

Regards,

-JJ


On Mon, Jul 20, 2009 at 6:31 PM, W. Augustine Dunn
III wrote:
> Hello y'all:
>
> I am trying to plot a fig with three subplots.  However when I run my
> script the subplots are all shifted way too high
> (http://img.skitch.com/20090720-fp462u8ww4bq38j29u9bjtr2cx.png) and
> the top subplot is cut off.
>
> I tried doing something like this from reading another poster's thread
> but this did absolutely nothing:
> mpl.figure.SubplotParams(left=  (48 / 72.0) / figW,   # 48-point left 
> margin
>  bottom=    (36 / 72.0) / figH,   # etc.
>  right= 1 - (18 / 72.0) / figW,
>  top=   1 - (12 / 72.0) / figH)
>
> Anyone have an idea how to fix this.
>
> Thank you for your time.
>
> Gus
>
> The code is below for those interested:
> 
> supTitle = 'Ortholog Pairs Matching "Real" or "Control" Ag miRNA seeds.'
>
> data = []
> for dFile in iFiles:
>    data.append(pickle.load(open(dFile,'rU')))
>
> ks = []
> for i in range(len(data)):
>    ks.append(sorted(data[i].keys()))
>
> for i in range(len(ks)):
>    if "!doc" in ks[i]: ks[i].pop(0)  # if the pkl has a !doc entry.  pop it
>    assert odd_or_even(len(ks[i])) == 'even', 'Error: len(ks[i]) must be even.'
> pos1Data = eval('[%s]' % ('[],'*len(data)))
> pos1Keys = eval('[%s]' % ('[],'*len(data)))
> pos2Data = eval('[%s]' % ('[],'*len(data)))
> pos2Keys = eval('[%s]' % ('[],'*len(data)))
>
> for i in range(len(ks)):
>    for j in range(len(ks[i])):
>        if odd_or_even(j) == 'even': # remember that we start with 0
> which is even.
>            pos1Data[i].append(data[i][ks[i][j]])
>            pos1Keys[i].append(ks[i][j])
>        else:
>            pos2Data[i].append(data[i][ks[i][j]])
>            pos2Keys[i].append(ks[i][j])
>
> figW = 16
> figH = 8
> plt.figure(num=None, figsize=None, dpi=None, facecolor='w', edgecolor='k')
> subplotpars=mpl.figure.SubplotParams(left=      (48 / 72.0) / figW,
> # 48-point left margin
>                                     bottom=    (36 / 72.0) / figH,   # etc.
>                                     right= 1 - (18 / 72.0) / figW,
>                                     top=   1 - (12 / 72.0) / figH)
>
> plt.suptitle(supTitle)
> for i in range(len(data)):
>    matches1 = [x[0] for x in pos1Data[i]]
>    ctrls1   = [-x[1] for x in pos1Data[i]]
>    matches2 = [x[0] for x in pos2Data[i]]
>    ctrls2   = [-x[1] for x in pos2Data[i]]
>
>    assert len(matches1) == len(matches2), 'Error: matches1 and
> matches 2 do not have the same number of elements!'
>    N = len(matches1)
>
>
>
>    ind = np.arange(N)    # the x locations for the groups
>    width = 0.35       # the width of the bars: can also be len(x) sequence
>
>
>    plt.subplot(len(data),1,i,)
>    p1 = plt.bar(ind, ctrls1,   width, color='w',)
>    p2 = plt.bar(ind, matches1, width, color='b',)
>    p3 = plt.bar(ind+width, ctrls2,   width, color='w',)
>    p4 = plt.bar(ind+width, matches2, width, color='b', )
>    plt.ylabel(subTitles[i])
>    if i == len(data)-1:
>        plt.xlabel('miRNA seed')
>
>    axMax = max(matches1+matches2)*1.1
>    axMin = min(ctrls1+ctrls2)*1.1
>    #plt.axis([0,len(matches1),axMin,axMax])
>    if i == 0:
>        plt.legend( (p2[0], p1[0]), ('Real', 'Ctrls'), loc=(1.01,0.65) )
> 
>
> --
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problems with autofmt_xdate()

2009-07-21 Thread Jae-Joon Lee
As the warning message indicates, I think this is a backend issue.
The recommended backend (for screen display) is the Agg family, e.g.,
TkAgg, GTKAgg, etc.

I rarely use Windows and I never used matplotlib on Windows, so there
is not much I can help.
I'm not sure which backend is available on Windows, but try some other backend.

http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend

Also, please check out the binary installer for windows,

http://matplotlib.sourceforge.net/faq/installing_faq.html#windows-questions

Regards,

-JJ


On Tue, Jul 21, 2009 at 4:01 AM, Domenico Nappo wrote:
> Hi JJ,
> thanks for your reply.
> Let me say first that I've some problems with installation, I think: when I
> try to run ipython -pylab I got the following:
> C:\Documents and Settings\user>ipython -pylab
> Traceback (most recent call last):
>   File "C:\Python25\scripts\ipython.py", line 28, in 
>   IPython.Shell.start().mainloop()
>   File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1233, in start
>   return shell(user_ns = user_ns)
>   File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 1108, in
> __init__
>   shell_class=MatplotlibMTShell)
>   File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 793, in
> __init__
>   on_kill=[mainquit])
>   File "C:\Python25\Lib\site-packages\IPython\ipmaker.py", line 103, in
> make_IPython
>   embedded=embedded,**kw)
>   File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 639, in
> __init__
>   user_ns,user_global_ns,b2 =
> self._matplotlib_config(name,user_ns,user_global_ns)
>   File "C:\Python25\Lib\site-packages\IPython\Shell.py", line 559, in
> _matplotlib_config
>   import matplotlib.pylab as pylab
>   File "C:\Python25\Lib\site-packages\matplotlib\pylab.py", line 253, in
> 
>   from matplotlib.pyplot import *
>   File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 75, in
> 
>   new_figure_manager, draw_if_interactive, show = pylab_setup()
>   File "C:\Python25\Lib\site-packages\matplotlib\backends\__init__.py", line
> 25, in pylab_setup
>   globals(),locals(),[backend_name])
>   File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_gtk.py",
> line 25, in 
>   from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
>   File "C:\Python25\lib\site-packages\matplotlib\backends\backend_gdk.py",
> line 29, in 
>   from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
> ImportError: No module named _backend_gdk
>
> If I comment the import statement for _backend_gdk in backend_gdk.py,
> ipython runs well.
> Below, the code:
> In [20]:
> X=load('E:\\user\\Applicazioni\\EFGExtractor\\dataJan03Dec08.matplotlibtest',converters={0:strpdate2num('%Y-%m-%d')})
>
> In [21]: time = X[:,0]
>
> In [22]: time
> Out[22]: array([ 731216., 731217., 731218., ..., 733040., 733041., 733042.])
>
> In [23]: data = X[:,1]
>
> In [24]: data
> Out[24]: array([ 150., 140., 142., ..., 92., 84., 76.])
>
>
> In [30]: fig = figure()
>
> In [31]: ax = fig.add_subplot(111)
>
> In [32]: ax.plot_date(time, data, '-')
> Out[32]: []
>
> In [33]: show()
>
> In [34]: fig.autofmt_xdate()
>
>
> In [37]:
> C:\Python25\lib\site-packages\matplotlib\backends\backend_gdk.py:148:
> UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90
>   'other than 0 or 90')
> This time I've noticed the warning above: "unable to draw text at angles
> other than 0 or 90"
> Thanks in advance for any clarification...
> 2009/7/17 Jae-Joon Lee 
>>
>> Please post a simple, standalone script that reproduces your problem,
>> so that we can track down what is causing the problem. I don't think
>> there has been any report of a similar issue (but not sure). As far as
>> I know, autofmt_xdata only adjusts the alignment and rotation of the
>> ticklabels and does not change the font property.
>>
>> -JJ
>>
>>
>> On Thu, Jul 16, 2009 at 10:55 AM, Domenico
>> Nappo wrote:
>> > Whenever I try to use autofmt_xdate() on a Figure(), dates on x axis
>> > disappear...I guess this is related with something concerning font
>> > management...
>> > Anyone experienced this kind of issues?
>> >
>> > I use most recent versions of matplotlib, numpy, gtk2, pygtk on a Python
>> > 2.5
>> > platform (installed via binaries on a window xp machine).
>> >
>> >
>> > --

Re: [Matplotlib-users] adjusting the height of rectangle legend handles

2009-07-21 Thread Jae-Joon Lee
The height of the box will scale with the font size. If you want to
change the height independent of the font size, you need to manually
adjust the properties of the individual legend handles.

l = legend()
patches = l.get_patches() # list of legend handles whose type is
matplotlib.Patch.
for p in patches:
p.set_height(20) # height in point. you can also adjust y
positionwith set_y method. Note that y=0 is the baseline.

Regards,

-JJ




On Tue, Jul 21, 2009 at 3:30 PM, Chuck Pepe-Ranney wrote:
> I know that there is a keyword argument for adjusting the width of legend
> handles but how would I reduce the height of rectangle label handles?
>
> -Chuck
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to get ticks "out" using mpl_toolkits.axes_grid.axislines ?

2009-07-23 Thread Jae-Joon Lee
Hi,

Thanks for reporting this.
The axes class in axes_grid toolkits uses different artists to render
ticks and ticklabels. And some of the features in the original
matplotlib won't work correctly, and the "tick direction" turned out
to be one of them.

However, I just committed a fix for this to the svn (r7292), so it
should work now.
So, please install mpl from the current svn again, and test it.
Unfortunately, while the ticks are rotated, the pad for tick labels
are not automatically adjusted.
Therefore, you may want to adjust it manually. e.g.,

ax.axis["left"].major_tick_pad = 10

I'll try to improve this in the future.

On the other hand, you may take a look at the recently added "spine"
support in the main matplotlib.

http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html

If you use spine, than all the ticks & ticklabels feature in mpl will work.

Regards,

-JJ


On Thu, Jul 23, 2009 at 3:23 PM, Nicolas Pinto wrote:
> Hello,
>
> I'm trying to get the ticks "out" in the following scripts using matplotlib
> svn version. Any reason why it's not working ? Should I dig deeper in
> mpl_toolkits ?
>
> # -- Script 1
> # modified from
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline3.html
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.axislines import Subplot
>
> plt.rc("xtick", direction="out")
> plt.rc("ytick", direction="out")
>
> fig = plt.figure(1, (3,3))
>
> ax = Subplot(fig, 111)
> fig.add_subplot(ax)
>
> ax.axis["right"].set_visible(False)
> ax.axis["top"].set_visible(False)
>
> plt.show()
>
> # -- EOF
>
> # -- Script 2
> # modified from
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html
>
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.axislines import SubplotZero
> import numpy as np
>
> plt.rc("xtick", direction="out")
> plt.rc("ytick", direction="out")
>
> fig = plt.figure(1, (4,3))
>
> # a subplot with two additiona axis, "xzero" and "yzero". "xzero" is
> # y=0 line, and "yzero" is x=0 line.
> ax = SubplotZero(fig, 1, 1, 1)
> fig.add_subplot(ax)
>
> # make xzero axis (horizontal axis line through y=0) visible.
> ax.axis["xzero"].set_visible(True)
> ax.axis["xzero"].label.set_text("Axis Zero")
>
> # make other axis (bottom, top, right) invisible.
> for n in ["bottom", "top", "right"]:
>     ax.axis[n].set_visible(False)
>
> xx = np.arange(0, 2*np.pi, 0.01)
> ax.plot(xx, np.sin(xx))
>
> plt.show()
>
> # -- EOF
>
> Thanks for your help.
>
> Best regards,
>
> --
> Nicolas Pinto
> Ph.D. Candidate, Brain & Computer Sciences
> Massachusetts Institute of Technology, USA
> http://web.mit.edu/pinto
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] imshow with side plots whitespace problem

2009-07-25 Thread Jae-Joon Lee
The axes_grid toolkit is base on use cases for images of aspect 1, and
I haven't carefully considered cases where the aspect is different
from 1. And I guess this is one of such cases I overlooked.

Please try to add below lines in your code (I couldn't try your code
because of the missing data file, but it works with the the scatter
example you referred).


ax.set_aspect("auto")
divider.set_aspect(True)
divider.get_horizontal()[0]._aspect=0.5

The interface should be improved but I guess this will work.

Regards,

-JJ


On Fri, Jul 24, 2009 at 1:19 PM, Jeff Thomas wrote:
> Currently, I am trying to plot a 2D array with imshow and two 1D arrays
> on separate plots attached to the top and right of the imshow image. I got
> it to work, however when I change the aspect of the image (which I want to
> do) white space and unusual scalings appear. I want to get rid of it and
> have the scales that match the aspect.
> Basically, I want to do the same thing shown in the
> example http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html
> attached is the result with out the aspect change.
> also attached is the result with aspect change attempt.
> here is the code that produces the result above:
> import numpy as np
> import tables
> from matplotlib.pyplot import *
> import matplotlib as mpl
> import matplotlib.cm as cm
>
>
> fig = figure(figsize=[12.5,7.5])
> from mpl_toolkits.axes_grid import make_axes_locatable
> #get 3D array from hdf5 file
> a =
> tables.openFile("/Users/magoo/vorpal-data-2/unl-1mm-3d_ElecMultiField_25.h5")
> b = a.root.ElecMultiField[ : , : , : ,1]
> ax = fig.add_subplot(111)
> ax.set_autoscale_on(False)
> divider = make_axes_locatable(ax)
> axLOutx = divider.new_vertical(1, pad=0.3, sharex=ax)
> fig.add_axes(axLOutx)
> #plot line above
> axLOutx.plot(b[365,:,75])
> axLOutx.set_xlim( (0,145))
> axLOuty = divider.new_horizontal(2, pad=0.5, sharey=ax)
> fig.add_axes(axLOuty)
> #plot line on right
> yarr = np.arange(0, np.shape(b[:, 75, 75])[0], 1)
> axLOuty.plot(b[:,75,75], yarr)
> axLOuty.set_ylim( (769,0))
> # plot image/2D array
> im = ax.imshow(b[:,:,75], extent=[0,145,769,0],cmap=cm.jet)  # when I add
> (aspect = .5) as another argument I get what is shown in the second attached
> image
> cb = colorbar(im, fraction=0.015)
>
> plt.draw()
> plt.show()
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Design questions

2009-07-27 Thread Jae-Joon Lee
On Mon, Jul 27, 2009 at 11:55 AM, Tony S Yu wrote:
> The 3rd issue is a bit more difficult. One approach is to use
> Jae-Joon's AxesGrid toolkit; you
> may need to be using the latest development version of matplotlib to use the toolkit.

I think it would be easier to use the recently added spine support,
because using the AxesGrid toolkit has some side-effects.

http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html

Regards,

-JJ

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] square plots with linear equal axes -- help

2009-07-27 Thread Jae-Joon Lee
Well, I think the meaning of the axis("equal") is a bit misleading (at
least to me), but if you look at the documentation, it says that it
changes the xlimit and ylimit (limits in data coordinate), so this is
NOT what you want.
What you need is axis("scaled") or axis("image").

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axis

With this, you will have square axes regardless of the figure size or
subplot params (assuming that the x- and y- data limits are same).

Regards,

-JJ


On Sun, Jul 26, 2009 at 8:43 PM, kbkb wrote:
>
> Thanks for trying to help Andreas.
>
> Those suggestions did not really solve the problem, but I did realize where
> I was going astray and post that information here to help others.  I did see
> others new to the libraries looking for similar help.
>
> First the conceptual misunderstanding:  I did not realize the 'figure size',
> as set by something like
> plt.gcf().set_size_inches(6,6) includes all area: white plot area, grey
> surrounding area, labels, etc.  Everything inside the window frame.  A bad
> coincidence slowed my realization.  I measured the white area inside the
> axis to be 480x464 pixels, which  at 80 dpi worked almost for a 6x6.  So, I
> thought it was close but off just a bit.  But, I had set the dpi to 100, and
> the total frame was exactly 600x600 as it should be.  The dimensions of the
> plot area inside the axes was being set automatically, and just
> coincidentally worked out to be 480 in one dimension.
>
> Solution to get truly square plots of known size with axis scale set:
>    fig = plt.gcf()
>    fig.set_dpi(100)  # or whatever you like
>    fig.set_size_inches((6.0,6.0),forward=True) #for example
>    # to control the fraction of the total area set aside for axis tick mark
> labels, etc.
>    # this is key to keeping the interior plot area square
>    plt.subplots_adjust(left=0.10,bottom=0.10,right=0.95,top=0.95)
>    ## plt.axis('equal')  # I had this for a while but do not think it
> useful
>    plt.gca().grid(True)
>    # to keep the axis scale from being automatically changed as line2d
> objects are added or removed
>    plt.gca().set_autoscale_on(False)
>    plt.axis([1.0,9.0,1.0,9.0])  # set the axis scale as appropriate
>    plt.show()
>    fig.canvas.draw()
>
> Cheers
> Kersey
>
> --
> View this message in context: 
> http://www.nabble.com/square-plots-with-linear-equal-axes-help-tp24638812p24672100.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Design questions

2009-07-27 Thread Jae-Joon Lee
On Mon, Jul 27, 2009 at 4:06 PM, Gewton Jhames wrote:
> How to "trim the canvas" of the image generated? It's transparent, but still
> have a "padding", if it would be cropped, I can safe almost 200px!. I have
> attached a file to this email to show it, the background of the graph was
> set to red only to you see the padding.

As John suggested, you can adjust the subplot params. This adjusts the
area occupied by the axes, while the figure size (canvas size) is
fixed.

The subplot params can be automatically adjusted.

http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=automatic%20adjust#automatically-make-room-for-tick-labels


On the other hand, there is some crude support for trimming, i.e.,
reducing the figure size while the axes area fixed.

savefig("file.png", bbox_inches="tight")

Note that the figure size of the saved output is only affected. This
does not change the figure displayed on the screen.

Regards,

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animation/"live"-plotting + performance

2009-07-29 Thread Jae-Joon Lee
On Tue, Jul 28, 2009 at 9:11 AM, Roland Koebler wrote:
> Hi,
>
> I've got some performance problems with matplotlib, and would like to
> ask if you know any way I can make it faster.
>
> If there is no such way, I have to decide to (a) either enhance matplotlib
> or (b) write my own plotting-library.
> (I'm currently using matplotlib to plot data "live" on the screen, including
> animation, scrolling, zoom+pam, custom scales (to zoom out some part of the
> plot), and multiple X-/Y-Axes. I therefore already wrote some wrappers around
> matplotlib to implement some of these features.)
>
> In detail:
> - I have a figure containing some plots (lines).
> - About every second I "update" the plot:
>  - Add a few points to the lines.
>    (=add point to an array and call set_data(array))
>  - Scroll the plot, so that the latest point is on the right of the plot.
>    Older points disappear on the left side of the plot.
>    (=set_xaxis() + draw())
> - I'm using GtkAgg, incl. animation, (re)storing the background, drawing
>  the artists and blit.
>  (canvas.restore_region(...), ax.draw_artist(...), canvas.blit(bbox))
>
> This works as long as the plot only contains a few points,
> although 2 figures + 5-10 lines per figure and an update every 0.5 s
> already consumes about 10-20% CPU (on a 1.4 GHz Pentium).
> By the way: Is this speed normal, or is matplotlib usually faster?
>
> But as soon as the plot contains *many* points (several 1 up to
> several 10), the plotting becomes terribly slow -- up to 30s
> per update and more!
>
> Do you know any way to make this faster?
>
> My ideas are:
> - Since I only add points to the *right* of the lines, I could reduce the
>  number of points, by first removing all points which are outside of
>  the current visible plotting-window from my array, and then calling
>  set_data() with the reduced array.
> - This unfortunately wouldn't reduce the number of points in very dense
>  plots. It would be possible to (a) replace several points which all
>  result in the same plotted point by a single point or (b) cache the
>  plotted points e.g. on pixel-level. I think (b) would probably require
>  to write a new backend.
>
> Any ideas?
>

http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2.html

The above example does something similar to (b).
It saves the previous plot (only axes area is saved) as a bitmap. In
next run, it restores the saved bitmap after shifting. And then draw
only the new data points.

The example requires the svn version of matplotlib.
Regards,

-JJ


>
> regards,
> Roland
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Crosshairs

2009-07-29 Thread Jae-Joon Lee
scatter() currently does not support arbitrary path as its marker. The
current marker customization is limited to what can be described by
RegularPolyCollection and etc. And the crosshair marker do not fit in
to this category.

I'm attaching a snippet of a code I have been using for an exactly
same purpose as yours (to mark stars).
I hope this is also useful for you.
It provide a scatter-like function that takes arbitrary path
(PathPatch as a matter of fact).

It would not be difficult to extend the matplotlib's scatter function
to support an arbitrary path. I may give it a try later this week.

Regards,

-JJ



On Tue, Jul 28, 2009 at 5:57 PM, Paul Ray wrote:
> Hi,
>
> I see that scatter() has a variety of different symbols that you can
> choose from, and even a way to create your own custom markers.
> However, I can't figure out how to make a crosshair symbol (a plus
> with non-touching lines) as my marker, which I'd like to use to show
> the  location of a star on an underlying image without obscuring the
> star itself.
>
> Graphically, I'd like a marker symbol that looks like this...
>
>          |
>          |
>          |
>
> ===     ===
>
>          |
>          |
>          |
>
> Does anyone know how to pull this off?
>
> Thanks!
>
> -- Paul
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
import matplotlib.collections as mcoll
import matplotlib.transforms as mtransforms
from matplotlib.path import Path
from matplotlib.patches import PathPatch

def make_crosshair(inner_radius=0.5):
verts = [(inner_radius, 0.),
 (1, 0.),
 (-inner_radius, 0.),
 (-1, 0.),
 (0, inner_radius),
 (0, 1.),
 (0, -inner_radius),
 (0, -1),
 (0,0)]
codes = [Path.MOVETO,
 Path.LINETO,
 Path.MOVETO,
 Path.LINETO,
 Path.MOVETO,
 Path.LINETO,
 Path.MOVETO,
 Path.LINETO,
 Path.STOP]

return PathPatch(Path(verts, codes))


def make_crosshair2(inner_radius=0.5):
verts = [(inner_radius, 0.),
 (1, 0.),
 (0, inner_radius),
 (0, 1.),
 (0,0)]
codes = [Path.MOVETO,
 Path.LINETO,
 Path.MOVETO,
 Path.LINETO,
 Path.STOP]

return PathPatch(Path(verts, codes))


def scatter_patch(ax, patch, x, y, color=None, linewidth=None,
  size=1.,
  **kwargs):

coll = mcoll.PatchCollection([patch], match_original=False,
 facecolors = "none",
 edgecolors = color,
 linewidths = linewidth,
 offsets = zip(x,y),
 transOffset = ax.transData,
 )
coll.set_transform( mtransforms.Affine2D().scale(size, size))

coll.update(kwargs)
ax.add_collection(coll)


if __name__ == "__main__":
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure(1)
fig.clf()
ax = fig.add_subplot(111)
nx = 500
x1, y1 = np.random.rand(2,5) * nx
x2, y2 = np.random.rand(2,5) * nx

# draw red dots
coll1 = ax.scatter(x1, y1, s=1, marker="o",
   color="r")
coll1 = ax.scatter(x2, y2, s=1, marker="o",
   color="r")

# create a crosshair patch. each hair(?) spans from 0.5 to 1.
crosshair_patch = make_crosshair(0.5)
# create a crosshair patch with only two hair. each hair(?) spans
# from 0.3 to 1.
crosshair_patch2 = make_crosshair2(0.3)

# draw crosshair of size=10 pixel.
coll2 = scatter_patch(ax, crosshair_patch, x1, y1, size=10,
  color="b")

coll3 = scatter_patch(ax, crosshair_patch2, x2, y2, size=10,
  color="g")

ax.set_xlim(0, nx)
ax.set_ylim(0, nx)


plt.draw()

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/

Re: [Matplotlib-users] question about legend

2009-07-29 Thread Jae-Joon Lee
The documentation for scatter command is out of date unfortunately.
You need to use "scatterpoints" keyword.

http://www.nabble.com/legend-bug--td22466216.html#a22466216

-JJ

On Mon, Jul 27, 2009 at 3:44 PM, per freem wrote:
> Hi all
>
> i am making a scatter plot and want to label one of the points in the
> legend. i run
>
> scatter([x], [y], ..., label="mylabel")
>
> and then run legend as follows
>
> plt.legend(loc='lower right', numpoints=1, pad=0.01, labelsep=.01,
> handlelen=.05)
>
> i set numpoints=1 because i want it to show just one point and then its
> label. however, this always generates a legend with three points, i.e.
>
> o o o   my label
>
> rather than
>
> o mylabel
>
> does anyone know how to fix this?  thank you.
>
>
> --
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Include icon in plot

2009-07-30 Thread Jae-Joon Lee
The location of the image can be set by specifying the "extent"
keyword, however, this is set in data coordinate.
figimage may be close to what you want.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figimage

As far as I know, there is no direct support in matplotlib to place an
image with arbitrary transformation. But it may not be difficult to
implement. However, "annotate a plot with icons" is not enough to
figure out what you really want.
Maybe some screenshots from other plotting tool will be helpful. Or,
please elaborate how you want to position your image.

-JJ


On Thu, Jul 30, 2009 at 12:11 PM, Bas van Leeuwen wrote:
> Hi all,
>
> Is there any way to annotate a plot with icons?
> The only way to include an image that I've found is using imshow, but
> imshow does not accept (x,y) coordinates.
>
> There probably is an easy solution, but I have not been able to find
> any. Please be patient :-)
>
> Thank you in advance for your reply,
> Bas van Leeuwen
>
> PS, I'm sorry if this mail arrives multiple times, I didn't see the
> previous one in the archive.
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting user defined color map as default

2009-07-30 Thread Jae-Joon Lee
I don't think there is any user-visible support for registering a
custom colormap.
However, it seems to me that adding the colormap to
matplotlib.cm.datad distionary is enough.
Note that the value need to be a dictionary of RGB specification, not
the actual colormap instance.

for example,

mycolormap = {'blue': ((0.0, 0.40002, 0.40002),
  (1.0, 0.40002, 0.40002)),
 'green': ((0.0, 0.5, 0.5), (1.0, 1.0, 1.0)),
 'red': ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))}

matplotlib.cm.datad["mycolormap"] = mycolormap
rcParams["image.cmap"]="mycolormap"

Having a function (like jet in pylab) would not be also difficult.
Take a look at the definition of "jet" function (for example) in the
pylab.py.

We may be better to have a proper way to register a custom colormap.
I'll try to take a more look later, but any patch will be appreciated.

Regards,

-JJ



On Thu, Jul 30, 2009 at 3:48 AM, Philipp
Lies wrote:
>
> Does no one have an idea? If not, this is a severe usability bug!
>
> Philipp Lies wrote:
>>
>> Hi,
>>
>> I just created a hsv-like color map with gray levels only, now I'd like to
>> use this as default color map. But how? Calling it like hsv() does not
>> work and I did not find a hint in the documentation how to set a user
>> defined color map interactively as default color map.
>>
>> Cheers
>>
>> Philipp
>>
>
> --
> View this message in context: 
> http://www.nabble.com/setting-user-defined-color-map-as-default-tp24587528p24733739.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AxesGrid question

2009-08-01 Thread Jae-Joon Lee
The axes_grid toolkit is recently added to the matplotlib, and you
need to have development version of matplotlib.
You may try the matplotlib 0.99rc1 released a few days ago

http://www.nabble.com/matplotlib-0.99.0-rc1-%3A-call-for-testing-td24760373.html

or you may try to install from the svn

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn

-JJ



On Fri, Jul 31, 2009 at 10:39 PM, Tommy Grav wrote:
> i am trying to use the example at
> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axesgrid.html
>
> but axes_grid is not in mpl_toolkits for the standard matplotlib
> build. Where
> can I get the axes_grid tools?
>
> Cheers
>   Tommy
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] clabel and bbox

2009-08-01 Thread Jae-Joon Lee
The clable command returns a list of Text instances.
You need call set_bbox method for each of them.

tl = clabel(...)
for t in tl:
t.set_bbox(dict(fc="y"))

For clabels, which are often rotated, it may better to use fancy box
style (the default bbox is not rotated even though the text is).

  t.set_bbox(dict(boxstyle="round",fc="y"))

Regards,

-JJ


On Sat, Aug 1, 2009 at 5:32 AM, Andres Luhamaa wrote:
> Hello!
> Is it possible to add a bbox behind a clabel, like one can do with a
> plt.text or something that would look similar?
>
> Best regards,
> Andres
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AxesGrid question

2009-08-01 Thread Jae-Joon Lee
On Sat, Aug 1, 2009 at 9:32 AM, Tommy Grav wrote:
> Thanks, I downloaded and installed 0.99rc1 and that worked beautifully.
> Might be good to put this explicitly on the webpages as it is very
> confusing.

This is not just a issue of axes_grid toolkit. The current mpl
document on the home page (including the gallery) reflects what is in
the svn development tree.
Yes, I agree that this is confusing.  I guess there have been similar
issues raised before, but I can't remember what the resolution was.

John, is it possible to have two different set of documents on the
web? One for the stable release, and the other for development
version? This seems to be one of the obvious solutions to me.

Regards,

-JJ



>
> Tommy
>
> On Aug 1, 2009, at 9:27 AM, Jae-Joon Lee wrote:
>
>> The axes_grid toolkit is recently added to the matplotlib, and you
>> need to have development version of matplotlib.
>> You may try the matplotlib 0.99rc1 released a few days ago
>>
>> http://www.nabble.com/matplotlib-0.99.0-rc1-%3A-call-for-testing-td24760373.html
>>
>> or you may try to install from the svn
>>
>> http://matplotlib.sourceforge.net/faq/installing_faq.html#install-svn
>>
>> -JJ
>>
>>
>>
>> On Fri, Jul 31, 2009 at 10:39 PM, Tommy Grav wrote:
>>> i am trying to use the example at
>>> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axesgrid.html
>>>
>>> but axes_grid is not in mpl_toolkits for the standard matplotlib
>>> build. Where
>>> can I get the axes_grid tools?
>>>
>>> Cheers
>>>  Tommy
>>>
>>> --
>>> Let Crystal Reports handle the reporting - Free Crystal Reports
>>> 2008 30-Day
>>> trial. Simplify your report design, integration and deployment -
>>> and focus on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Include icon in plot

2009-08-02 Thread Jae-Joon Lee
A snippet of code does not help in general.
Please take your time to create a simple, standalone code that
reproduces your problem and post that code in this mailing list so
that we can easily test.

Here is the code, based on yours, that works for me.

im = Image.open("icon.jpg")

ax = gca()
limx = ax.get_xlim()
limy = ax.get_ylim()
ax.set_autoscale_on(False)

[x0, y0], [x1, y1] = ax.bbox.get_points()

datawidth = limx[1] - limx[0]
dataheight = limy[1] - limy[0]
pixelwidth = x1 - x0
pixelheight = y1 - y0
adaptedwidth = im.size[0] * (datawidth/pixelwidth)
adaptedheight = im.size[1] * (dataheight/pixelheight)

ax.imshow(im, origin="lower",
  extent=(0.5, 0.5+adaptedwidth, 0.5, 0.5+adaptedheight))


plt.draw()

-JJ



On Fri, Jul 31, 2009 at 3:44 PM, Bas van Leeuwen wrote:
> Hello,
>
> I tried to implement a solution for this issue. Basically I want to
> give the x and y position in datacoords and the width + height in
> pixels.
> However, when using the following code:
>
>            im = Image.open("../Icons/Program Icon.png")
>
>            limx = self.mainAxes.get_xlim()
>            limy = self.mainAxes.get_ylim()
>
>            [x0, y0], [x1, y1] = self.mainAxes.bbox.get_points()
>
>            datawidth = limx[1] - limx[0]
>            dataheight = limy[1] - limy[0]
>            pixelwidth = x1 - x0
>            pixelheight = y1 - y0
>            adaptedwidth = im.size[0] * (datawidth/pixelwidth)
>            adaptedheight = im.size[1] * (dataheight/pixelheight)
>
>
>            for peak in Blocks.peaks(self.quote.Close,
> self.peakSpanSlider.value()):
>                self.mainAxes.imshow(im, origin = 'lower', extent =
> (date2num(peak.datetime), date2num(peak.datetime) + 100 , 400, 425)) #
> left right bottom top
>            self.mainAxes.set_xlim(limx)
>            self.mainAxes.set_ylim(limy)
>
> There is no visible result. When zooming in to a place where an image
> should be present I encounter the following error every time I move
> the mouse.
>
> Traceback (most recent call last):
>  File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4.py",
> line 135, in mouseReleaseEvent
>    FigureCanvasBase.button_release_event( self, x, y, button )
>  File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
> line 1198, in button_release_event
>    self.callbacks.process(s, event)
>  File "C:\Python25\lib\site-packages\matplotlib\cbook.py", line 155, in 
> process
>    func(*args, **kwargs)
>  File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
> line 2048, in release_zoom
>    self.draw()
>  File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
> line 2070, in draw
>    self.canvas.draw()
>  File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4agg.py",
> line 133, in draw
>    FigureCanvasAgg.draw(self)
>  File "C:\Python25\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 279, in draw
>    self.figure.draw(self.renderer)
>  File "C:\Python25\lib\site-packages\matplotlib\figure.py", line 772, in draw
>    for a in self.axes: a.draw(renderer)
>  File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1545, in draw
>    im.draw(renderer)
>  File "C:\Python25\lib\site-packages\matplotlib\image.py", line 233, in draw
>    im = self.make_image(renderer.get_image_magnification())
>  File "C:\Python25\lib\site-packages\matplotlib\image.py", line 220,
> in make_image
>    rx = widthDisplay / numcols
> ZeroDivisionError: float division
>
> Any idea what might cause this issue? Did I do something wrong? I know
> it's not pretty, but it should work right?
>
> Cheers!
> Bas
>
>
>
> 2009/7/30 Bas van Leeuwen :
>> Hi JJ,
>>
>> Thank you for your kind and speedy reply, I completely glanced over
>> the extent parameter.
>> Datacoords are actually what I need so this is perfect for me.
>>
>> To clarify what I want, I want to mark certain parts of a graph with
>> an icon representing the reason it's interesting. Icons are for peaks,
>> trends, correlation, etc.
>>
>> Thank you very much!
>>
>> Bas
>>
>>
>> 2009/7/30 Jae-Joon Lee :
>>> The location of the image can be set by specifying the "extent"
>>> keyword, however, this is set in data coordinate.
>>> figimage may be close to what you want.
>>>
>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figimage
>>>
>>> As far as I know, there is no direct s

Re: [Matplotlib-users] Change the text of yticklabels

2009-08-02 Thread Jae-Joon Lee
Use pylab's yticks command.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yticks

Or Axes.set_yticklabels together with Axes.set_yticks.

http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_yticklabels

-JJ


On Fri, Jul 31, 2009 at 4:07 PM, Lukas Hetzenecker wrote:
> Hello,
>
> I have y values in the range of -100 to 100.
> I want that the negative values are shown as positive (the minus gets removed
> from the output).
>
> I tried a for loop over all self.ax.get_yticklabels() and call
> label.set_text("...") on each item but it didn't work - nothing got changed.
>
> If I print the label in the loop they seem to be empty:
> Text(0,0,'')
> Text(0,0,'')
> Text(0,0,'')
> ..
>
> Is there anything I do wrong?
>
> Thanks,
> Lukas
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] clabel and bbox

2009-08-02 Thread Jae-Joon Lee
On Sat, Aug 1, 2009 at 5:04 PM, Andres Luhamaa wrote:
> Thank You,
>
> but now I have another little annoying issue. Besides clabel I add some
> text manually to my plot with plt.text and sometimes the clabel and
> plt.text overlap, and no matter in which order I plot them, the string
> from clabel is always above the one from plt.text, but I would like, if
> the manually added text would be more visible.
>

please define "more visible".
Maybe adjusting the zorder is sufficient?

http://matplotlib.sourceforge.net/api/artist_api.html?highlight=zorder#matplotlib.artist.Artist.set_zorder

If not, I would adjust the clable position manually (of course, this
is not a good choice if you need to do this for a lot of plots).
I'm not sure if there are more elegant solutions.

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] spines versus subplotzero

2009-08-02 Thread Jae-Joon Lee
Yes, using spines will be best in most situation.

The problem with using axes_grid toolkit is that some mpl commands
that changes the properties of the ticks and ticklabels do not work.

I think you may consider to use axes_grid if you want to keep both of
the bottom and top axis, which I guess would be very rare.

-JJ


On Sun, Aug 2, 2009 at 8:59 AM, John Hunter wrote:
> On Sun, Aug 2, 2009 at 2:14 AM,  wrote:
>> I'm trying to understand some of the changes in 0.99, for example, the
>> recommended way of getting a plot so that the axes cross at the origin
>> (i.e., the axes are in the middle of the plot).  I see two examples that
>> seem to give this:
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html
>>
>> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html
>>
>> Is one or the other of these methods the recommended way to get a plot
>> with axes in the middle that cross at the origin?  Or are they both good
>> and apply to different situations?
>
> I'll let Andrew and JJ fill in some color, since they wrote the spine
> and axes_grid, respectively, but both are good.  The spines are in the
> mainline and JJ's solution is in a toolkit, so when in doubt go with
> something in the mainline since that is more likely to be stable.
> Both JJ and Andrew will be attending the scipy sprint this year (if
> you're going to be there be sure to stop by), and one of the items on
> our agenda is to incorporate their work into a unified API in the
> mainline.  So there may be some changes to one or both approaches, but
> hopefully soon we will have most of the feature set of both in our
> main axis code.
>
> JDH
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Include icon in plot

2009-08-03 Thread Jae-Joon Lee
Hmm, your code runs just fine for me (of course with different icon,
but I don't think it matters).
Can you try to install the 0.99rc version of mpl and see if it solves
the problem?
Since the error is not reproduced in my side, I have little to help.

Also, try the figimage and see if you see a same error.

Regards,

-JJ



On Mon, Aug 3, 2009 at 7:55 AM, Bas van Leeuwen wrote:
> Hi,
>
> Sorry about the snippet, I will privide working code from now on.
> I found a reproduction path for the error, it occurs (seemingly
> random, but frequent) when there is more than one image in the plot
> and you try to zoom. Code:
>
> import Image
> from pylab import *
> im = Image.open("icon.png")
>
> ax = subplot(111)
> limx = ax.set_xlim((-5, 15))
> limy = ax.set_ylim((-5, 15))
> ax.set_autoscale_on(False)
>
> [x0, y0], [x1, y1] = ax.bbox.get_points()
>
> datawidth = limx[1] - limx[0]
> dataheight = limy[1] - limy[0]
> pixelwidth = x1 - x0
> pixelheight = y1 - y0
> adaptedwidth = im.size[0] * (datawidth / pixelwidth)
> adaptedheight = im.size[1] * (dataheight / pixelheight)
>
> for i in range(0,10,2):
>    ax.imshow(im, origin="lower",
>             extent=(i, i + adaptedwidth, i, i + adaptedheight))
>
> plt.draw()
> show()
>
> Thank you very much for the support!
> Bas
>
> PS, @John, I'd like to try the imshow approach first because it is not
> in a figure but in a QT frame containing several subplots. But thank
> youfor the suggestion, I will try if the imshow approach appears
> fruitless.
>
>
> 2009/8/2 Jae-Joon Lee :
>> A snippet of code does not help in general.
>> Please take your time to create a simple, standalone code that
>> reproduces your problem and post that code in this mailing list so
>> that we can easily test.
>>
>> Here is the code, based on yours, that works for me.
>>
>>    im = Image.open("icon.jpg")
>>
>>    ax = gca()
>>    limx = ax.get_xlim()
>>    limy = ax.get_ylim()
>>    ax.set_autoscale_on(False)
>>
>>    [x0, y0], [x1, y1] = ax.bbox.get_points()
>>
>>    datawidth = limx[1] - limx[0]
>>    dataheight = limy[1] - limy[0]
>>    pixelwidth = x1 - x0
>>    pixelheight = y1 - y0
>>    adaptedwidth = im.size[0] * (datawidth/pixelwidth)
>>    adaptedheight = im.size[1] * (dataheight/pixelheight)
>>
>>    ax.imshow(im, origin="lower",
>>              extent=(0.5, 0.5+adaptedwidth, 0.5, 0.5+adaptedheight))
>>
>>
>>    plt.draw()
>>
>> -JJ
>>
>>
>>
>> On Fri, Jul 31, 2009 at 3:44 PM, Bas van Leeuwen wrote:
>>> Hello,
>>>
>>> I tried to implement a solution for this issue. Basically I want to
>>> give the x and y position in datacoords and the width + height in
>>> pixels.
>>> However, when using the following code:
>>>
>>>            im = Image.open("../Icons/Program Icon.png")
>>>
>>>            limx = self.mainAxes.get_xlim()
>>>            limy = self.mainAxes.get_ylim()
>>>
>>>            [x0, y0], [x1, y1] = self.mainAxes.bbox.get_points()
>>>
>>>            datawidth = limx[1] - limx[0]
>>>            dataheight = limy[1] - limy[0]
>>>            pixelwidth = x1 - x0
>>>            pixelheight = y1 - y0
>>>            adaptedwidth = im.size[0] * (datawidth/pixelwidth)
>>>            adaptedheight = im.size[1] * (dataheight/pixelheight)
>>>
>>>
>>>            for peak in Blocks.peaks(self.quote.Close,
>>> self.peakSpanSlider.value()):
>>>                self.mainAxes.imshow(im, origin = 'lower', extent =
>>> (date2num(peak.datetime), date2num(peak.datetime) + 100 , 400, 425)) #
>>> left right bottom top
>>>            self.mainAxes.set_xlim(limx)
>>>            self.mainAxes.set_ylim(limy)
>>>
>>> There is no visible result. When zooming in to a place where an image
>>> should be present I encounter the following error every time I move
>>> the mouse.
>>>
>>> Traceback (most recent call last):
>>>  File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4.py",
>>> line 135, in mouseReleaseEvent
>>>    FigureCanvasBase.button_release_event( self, x, y, button )
>>>  File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py",
>>> line 1198, in button_release_event
>>>    self.callbacks.process(s, event)
>>>  File "C:\Python25\lib\site-packages\matplotlib\cbook.py", line 155, in 

Re: [Matplotlib-users] Hiding data via legend

2009-08-04 Thread Jae-Joon Lee
On Tue, Aug 4, 2009 at 12:50 PM, John Hunter wrote:
> On Mon, Aug 3, 2009 at 11:38 PM, Gökhan Sever wrote:
>> Hello,
>>
>> I was wondering if it is possible to hide some data on figures using a say
>> right click option to any of the legend entry and make it temporarily
>> hidden/visible to better analyse the rest of the data?
>>
>> Check this screenshot for example:
>>
>> http://img25.imageshack.us/img25/9427/datahiding.png
>>
>> The red data clutters the rest of the figure, and I would like to be able to
>> hide it temporarily so that I can investigate the other two relations more
>> easily.
>>
>> Any ideas? or alternative solutions?
>
> It's a nice idea, and should be doable with the pick interface we have
> for all mpl artists.  Unfortunately, there were a few problems in the
> legend implementation which blocked the pick events from hitting the
> proxy lines they contained.  I just made a few changes to mpl svn HEAD
> to support this, and added a new example.
>
>  examples/event_handling/legend_picking.py
>
> which I'll include below.   JJ could you review the changes to legend.py?

John,

This looks good.
I guess I have overlooked the importance of setting the children properly.

Regards,

-JJ


>
> Instructions for checking out svn are at::
>
>  http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
>
> Here is the example:
>
> """
> Enable picking on the legend to toggle the legended line on and off
> """
> import numpy as np
> import matplotlib.pyplot as plt
>
> t = np.arange(0.0, 0.2, 0.1)
> y1 = 2*np.sin(2*np.pi*t)
> y2 = 4*np.sin(2*np.pi*2*t)
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz')
> line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz')
>
> leg = ax.legend(loc='upper left', fancybox=True, shadow=True)
> leg.get_frame().set_alpha(0.4)
>
>
> lines = [line1, line2]
> lined = dict()
> for legline, realine in zip(leg.get_lines(), lines):
>    legline.set_picker(5)  # 5 pts tolerance
>    lined[legline] = realine
>
> def onpick(event):
>    legline = event.artist
>    realline = lined[legline]
>    vis = realline.get_visible()
>    realline.set_visible(not vis)
>    fig.canvas.draw()
>
> fig.canvas.mpl_connect('pick_event', onpick)
>
> plt.show()
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 example

2009-08-04 Thread Jae-Joon Lee
On Tue, Aug 4, 2009 at 12:14 PM, Christophe
Dupre wrote:
> Hello,
>
>
>
> I've been playing with the animation_blit_gtk2 example
> (http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2.html
>
> ) and the latest version of matplotlib version 0.99.0-RC1.
>
> I've modified the example so that it displays candlesticks moving towards
> the lelf. The example is attached if anybody is interested.
>
>
>
>
>
> In my example, I'm using 1 minute bars and therefore I would like to shift
> the graph by 1 minute instead of a few pixels. Is there a way to convert a
> time difference into pixels?
>

The "get_dx_data" method coverts a pixel offset to a data offset.
So, what you need is just to invert it.
This requires some knowledge of transformation, but I guess the code
is rather self-explanatory.

For example,  something like below will work (sorry, I haven't
actually tested the code)

def get_dx_pixel(self, dx_data):
tp = self.ax.transData.transform_point
x0, y0 = tp((0, 0))
x1, y1 = tp((dx_data, 0))
return (x1-x0)

Regards,

-JJ

>
>
> Thanks,
>
>
>
> Christophe
>
>
>
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Subaxes

2009-08-06 Thread Jae-Joon Lee
The thread below might be helpful.

http://thread.gmane.org/gmane.comp.python.matplotlib.general/16373

This will work as far as you keep the aspect="auto".

Also, if you're using matplotlib 0.99rc version, or matplotlib from
svn, you may take a look at

http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator

This works even though aspect=1 (or other value).

Regards,

-JJ



On Thu, Aug 6, 2009 at 7:27 AM, Matthias Michler wrote:
> Hi Gaël,
>
> there might be a better way of doing it, but the attached example seems to do
> the job.
>
> best regards Matthias
>
> On Thursday 06 August 2009 10:46:44 Gael Varoquaux wrote:
>> Given an axes instance ax1, I would like to create another axes instance
>> ax2, embedded in the first one with a given rectangle, in ax1
>> coordinates.
>>
>> For instance, I might want to create axes ax2 that sit in the top left
>> corner of ax1, with height and width 0.25 times those of ax1.
>>
>> What is the right way of doing this? I have been too stupid to figure it
>> out.
>>
>> Cheers,
>>
>> Gaël
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 example

2009-08-06 Thread Jae-Joon Lee
Christophe,

Unfortunately, the background is always shifted by integer pixel. So,
shift in data and shift in pixel have some offset and what you see is
the accumulation of this offset.
And you have to manage the pixel and and data coordinates in sync.

For example, you may try to keep the original transform and calculate
the pixel shift in this
coordinate. This would work if you're not worried about the overflow.

The attached example solve this with different approach. However,
dx_data in this approach is not constant but fluctuate, although its
mean value should be one minute.

Regards,

-JJ



On Wed, Aug 5, 2009 at 7:48 AM, Christophe
Dupre wrote:
> Hi JJ,
>
> Thanks for that. It works fairly well, but I've noticed that the graph 
> content (the candlesticks) move slightly faster than the x axis. I've added a 
> sleep(0.1) statement to slow things down, and we can see that at the start 
> the first bar is displayed at around 13:15 but by the times is gets to the 
> left, the same bar is then displayed at about 13:00.
>
> Do you have any suggestion on how to improve that?
>
> Apart from that, shifting the graph is quite fast. On my machine, I get a 
> frame rate of 30 FPS if I redraw both X and Y axis. The rate goes much higher 
> ( greater than 100 FPS) if I don't redraw the axis.
>
> Thanks,
>
> Christophe
>
>
> -Original Message-
> From: Jae-Joon Lee [mailto:lee.j.j...@gmail.com]
> Sent: 05 August 2009 03:36
> To: Christophe Dupre
> Cc: matplotlib-users
> Subject: Re: [Matplotlib-users] 0.99.0-RC1 and the animation_blit_gtk2 example
>
> On Tue, Aug 4, 2009 at 12:14 PM, Christophe
> Dupre wrote:
>> Hello,
>>
>>
>>
>> I've been playing with the animation_blit_gtk2 example
>> (http://matplotlib.sourceforge.net/examples/animation/animation_blit_gtk2.html
>>
>> ) and the latest version of matplotlib version 0.99.0-RC1.
>>
>> I've modified the example so that it displays candlesticks moving towards
>> the lelf. The example is attached if anybody is interested.
>>
>>
>>
>>
>>
>> In my example, I'm using 1 minute bars and therefore I would like to shift
>> the graph by 1 minute instead of a few pixels. Is there a way to convert a
>> time difference into pixels?
>>
>
> The "get_dx_data" method coverts a pixel offset to a data offset.
> So, what you need is just to invert it.
> This requires some knowledge of transformation, but I guess the code
> is rather self-explanatory.
>
> For example,  something like below will work (sorry, I haven't
> actually tested the code)
>
>    def get_dx_pixel(self, dx_data):
>        tp = self.ax.transData.transform_point
>        x0, y0 = tp((0, 0))
>        x1, y1 = tp((dx_data, 0))
>        return (x1-x0)
>
> Regards,
>
> -JJ
>
>>
>>
>> Thanks,
>>
>>
>>
>> Christophe
>>
>>
>>
>>
>>
>> --
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.392 / Virus Database: 270.13.43/2281 - Release Date: 08/04/09 
> 05:57:00
>


animation_blit_gtk2-3.py
Description: application/python
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] No legend using scatter function

2009-08-06 Thread Jae-Joon Lee
This turned out to be a bug introduced recently, which is now fixed in
the 0.99 maintenance branch.
The fix is not merged into the head yet. I tried svnmerge.py but it
gave some merge conflict. While the conflict seems rather trivial,
I'll leave it to others.

Meanwhile, you can explicitly give artists and labels to create the legend.

s1 = scatter(..)
s2 = scatter(..)

legend([s1, s2], ["", ""])

-JJ


On Tue, Aug 4, 2009 at 4:51 PM, Gökhan Sever wrote:
> Hello,
>
> Could not get a legend shown on scatter function used plot:
>
> In [4]: a = rand(100)
>
> In [5]: b = rand(100)
>
> In [22]: scatter(a,b, c=a, s=b, label="")
> Out[22]: 
>
> In [23]: scatter(a,b, c=a*5, s=b*5, label="")
> Out[23]: 
>
> In [24]: legend()
>
> at rev 7355.
>
> with
>
> Python 2.6 (r26:66714, Jun  8 2009)
> IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.
>
> Any suggestions?
>
>
> --
> Gökhan
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] No legend using scatter function

2009-08-06 Thread Jae-Joon Lee
On Thu, Aug 6, 2009 at 12:54 PM, Gökhan Sever wrote:
> Thanks JJ,
>
> I was playing with different ways to create legends, and found myself a way
> just like you suggested.
>
> I guess in legend as long as a sequence is provided it doesn't matter
> whether it is a tuple or list. Am I correct?
>

As far as it is iterable, it should be okay.

> Additionally, speaking of scatters; is there a way to add a colorbar next to
> scatters depicting the variation in colors or size of the scatters?
>

I'm not sure what exactly you're trying to do here.

You mean something like this?

http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html

The example uses EllipseCollection but scatter basically creates collections.

If there is any screenshot you can show (may be from other plotting
tool), it would be much easier to figure out.

-JJ

-ps. By the way, I'm afraid that this fix missed the 0.99 release.


> Thanks.
>
> On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee  wrote:
>>
>> This turned out to be a bug introduced recently, which is now fixed in
>> the 0.99 maintenance branch.
>> The fix is not merged into the head yet. I tried svnmerge.py but it
>> gave some merge conflict. While the conflict seems rather trivial,
>> I'll leave it to others.
>>
>> Meanwhile, you can explicitly give artists and labels to create the
>> legend.
>>
>> s1 = scatter(..)
>> s2 = scatter(..)
>>
>> legend([s1, s2], ["", ""])
>>
>> -JJ
>>
>>
>> On Tue, Aug 4, 2009 at 4:51 PM, Gökhan Sever wrote:
>> > Hello,
>> >
>> > Could not get a legend shown on scatter function used plot:
>> >
>> > In [4]: a = rand(100)
>> >
>> > In [5]: b = rand(100)
>> >
>> > In [22]: scatter(a,b, c=a, s=b, label="")
>> > Out[22]: 
>> >
>> > In [23]: scatter(a,b, c=a*5, s=b*5, label="")
>> > Out[23]: 
>> >
>> > In [24]: legend()
>> >
>> > at rev 7355.
>> >
>> > with
>> >
>> > Python 2.6 (r26:66714, Jun  8 2009)
>> > IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.
>> >
>> > Any suggestions?
>> >
>> >
>> > --
>> > Gökhan
>> >
>> >
>> > --
>> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> > 30-Day
>> > trial. Simplify your report design, integration and deployment - and
>> > focus
>> > on
>> > what you do best, core application coding. Discover what's new with
>> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> > ___
>> > Matplotlib-users mailing list
>> > Matplotlib-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>> >
>
>
>
> --
> Gökhan
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] No legend using scatter function

2009-08-06 Thread Jae-Joon Lee
On Thu, Aug 6, 2009 at 1:13 PM, John Hunter wrote:
> On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee wrote:
>> This turned out to be a bug introduced recently, which is now fixed in
>> the 0.99 maintenance branch.
>> The fix is not merged into the head yet. I tried svnmerge.py but it
>> gave some merge conflict. While the conflict seems rather trivial,
>> I'll leave it to others.
>
> I've merged and resolved these conflicts, so HEAD should be good now.
>

Thanks John.

> Too bad the fix squaeked in minutes after the release -- it will have
> to wait for the bugfix release, which hopefully will not be too soon,
> since we did a fair amount of rc testing this time around.
>
> JDH
>

The bug is that CircleCollections are ignored when legend items are
automatically created.
While, I hope not much people are affected by this bug.

Regards,

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Using bbox_to_anchor to get the legend off of my graph

2009-08-08 Thread Jae-Joon Lee
The guide is based on mpl 0.99.
You may upgrade your mpl,
or take a look at the thread below. it is a workaround that will work
with older version.

-JJ


On Fri, Aug 7, 2009 at 8:29 PM, Eliezer, David wrote:
> Hi,
>     I am graphing several time series together on the same graph,
> and so it is important to have a legend.  I am also stacking two graphs
> on top of one another, because some of the data is of a different type.
>
> I wrote the graphing code as follows (pardon the newbie code, this is my
> first matplotlib day…)
>
> fig = plt.figure()
> axU = fig.add_subplot(211)
> axU.set_ylabel('price,$', color='r')
> axU.grid(True)
> axL = fig.add_subplot(212)
> axL.set_ylabel('size, shs', color='b')
> axL.grid(True)
> stepPlotsU = []
> stepPlotsL = []
> for i in range( len( plotvalues ) ) :
>     if axisSide[i] == 'U' :
>     stepPlotsU.append(axU.step( T,plotvalues[i], where='post' ))
>     else :
>     stepPlotsL.append(axL.step( T,plotvalues[i], where='post' ))
>
> lU = axU.legend(tuple(stepPlotsU),tuple(legendArrayU),loc='upper right')
> lL = axL.legend( tuple(stepPlotsL),tuple(legendArrayL),loc='upper right')
> axU.axis([float(TMin),float(TMax),1.1 * minValueU -0.1 *
> maxValueU,1.1*maxValueU - 0.1*minValueU])
> axL.axis([float(TMin),float(TMax),0.8*minValueL,1.2*maxValueL])
> axU.set_xlabel("Time, secs")
> fig.savefig('test.png')
>
> My code works, and produces an almost perfect graph, BUT…
> My problem is that the legend is quite large, and covers up a lot of the
> graph.
> The solution seems to be in the user guide, here
>
> 
>
> where it shows how to call legend with the kwarg bbox_to_anchor=(1.05,1),
> and in the
> example, the box is nicely moved.
>
> In my case, though, I am calling
>
> axU.legend(tuple(stepPlotsU),tuple(legendArrayU),loc='upper right',
> bbox_to_anchor=(1.05,1))
>
> but it says this is an “unexpected keyword)”, I assume it is saying that
> axis.legend() doesn’t use this
> keyword, even if legend does.
>
>     lL = axL.legend( tuple(stepPlotsL),tuple(legendArrayL),loc='upper
> right',bbox_to_anchor=(1.05,1))
>   File
> "/etg/source/Linux/pkg/Python-2.6.2/lib/python2.6/site-packages/matplotlib/axes.py",
> line 3823, in legend
>     self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
> TypeError: __init__() got an unexpected keyword argument 'bbox_to_anchor'
>
> Does anyone out there know what I can do to get the legend off my graph?
> And is there a way
> to shrink the legend font size down?  It is way too large, and I can’t find
> anything in the docs about this,
> that axis.legend() will accept…
>
>     Dave
>
> PS:  I am using Python 2.6.2, matplotlib 0.98.5.3, numpy 1.3.0, scipy 0.7.1
>
>
>
> DISCLAIMER:
> This e-mail, and any attachments thereto, is intended only for use by the
> addressee(s) named herein and may contain legally privileged and/or
> confidential information. If you are not the intended recipient of this
> e-mail, you are hereby notified that any dissemination, distribution or
> copying of this e-mail, and any attachments thereto, is strictly prohibited.
> If you have received this in error, please immediately notify me and
> permanently delete the original and any copy of any e-mail and any printout
> thereof. E-mail transmission cannot be guaranteed to be secure or
> error-free. The sender therefore does not accept liability for any errors or
> omissions in the contents of this message which arise as a result of e-mail
> transmission.
> NOTICE REGARDING PRIVACY AND CONFIDENTIALITY Knight Capital Group may, at
> its discretion, monitor and review the content of all e-mail communications.
> http://www.knight.com
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] axes_grid examples

2009-08-10 Thread Jae-Joon Lee
John,

I changed the axes_grid examples to use get_sample_data and committed
them to the svn yesterday.
However, these examples won't work unless the user uses mpl from the
svn (I don't think get_sample_data is in 0.99 maint).
But, at some point during the last dev cycle, I think the gallery in
our web page started to show the examples from the svn. So, if we're
going to repeat it again (I mean pushing the docs from the svn), I
think I'd better revert those changes I made. And maybe modify them to
run standalone.

Regards,

-JJ


On Mon, Aug 10, 2009 at 7:27 AM, John Hunter wrote:
> On Mon, Aug 10, 2009 at 5:05 AM, Gary Ruben wrote:
>> Many of the axes_grid examples in the thumbnail gallery don't work out
>> of the box with the latest matplotlib 0.99 because they rely on
>> demo_image and demo_axes_divider modules. Should these have been
>> packaged with 0.99 or were they left out deliberately?
>
> We've addressed this already in svn HEAD, but the fixes won't be out
> until mpl1.0.  For now, just drop the attached file in the same
> directory as your example code (you may also need to touch a
> __init__.py in that dir.
>
> As developers, we run all of our code from the examples directory
> (which has the data and files) but now that the website has actually
> become useful, more and more people are running examples downloaded
> from the server, and so they don't have the extra code and files that
> some examples need.  We have mostly resolved this problem in svn HEAD,
> but will be a little while before it makes it into a production
> release, so you may want to check out the examples from svn
>
> svn co 
> https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib/examples
> mpl_examples
>
> JDH
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Confused about get_tightbbox() and renderer

2009-08-12 Thread Jae-Joon Lee
get_tightbbox is a bit experimental feature and it is discouraged for
an ordinary user (maybe the method should not be an public method).
Unless you understand how the internal transformation thing works, I'm
afraid there is not much thing you can do with its return value.

Instead, you should use the savefig function with bbox_inches="tight"
(it actually calls the get_tightbbox method with the proper renderer
for you). For example,

fig.savefig("a.pdf", bbox_inches="tight")


Another approach to eliminate the space is to adjust the subplot
parameters (note that the script you posted does not use Subplot, but
it can be easily modified).

http://matplotlib.sourceforge.net/faq/howto_faq.html?#automatically-make-room-for-tick-labels

-JJ




On Wed, Aug 12, 2009 at 11:35 AM, Damon
McDougall wrote:
> Hello all,
>
> So I'm trying to use matplotlib's OO interface (so programming without using
> 'from pylab import *') and found this useful
> page:http://matplotlib.sourceforge.net/leftwich_tut.txt after much googling.
>
> My problem is that, in general, after producing a plot, I would open the
> .pdf produced to find lots of whitespace that I don't want. The reason I
> don't want the whitespace is that I want to include these figures in a latex
> document and I want to maximise space. I did some reading and from what I
> understand, Axes.get_tightbbox() is the correct tool to use to return a
> tight bounding box which I can then use to adjust the Axes limits. Here is
> the code I currently have:
>
>
> import numpy as np
> import matplotlib
>
> fig_width_pt  = 483.69687 # figure width in pt as
> returned by \showthe in LaTeX
> inches_per_pt = 1.0/72.27
> golden_ratio  = (np.sqrt(5) - 1.0) / 2.0
> fig_width_in  = fig_width_pt * inches_per_pt  # figure width in inches
> fig_height_in = fig_width_in * golden_ratio   # figure height in inches
> fig_dims  = [fig_width_in, fig_height_in] # fig dims as a list
>
> matplotlib.use('PDF')
> matplotlib.rc('font',**{'family':'serif','serif':['Computer Modern Roman']})
> matplotlib.rc('text', usetex=True)
> matplotlib.rc('axes', labelsize=10)
> matplotlib.rc('legend', fontsize=10)
> matplotlib.rc('xtick', labelsize=10)
> matplotlib.rc('ytick', labelsize=10)
> matplotlib.rc('font', size=10)
> matplotlib.rc('figure', figsize=fig_dims)
>
> from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas
> from matplotlib.figure import Figure
> fig = Figure()
> canvas = FigureCanvas(fig)
> ax.fig_add_axes([0.2, 0.2, 0.5, 0.7])
> ax.hold(True)
> ax.grid(True)
> plot_means = ax.plot(means, 'b', label='$m_k$')
> plot_vars = ax.plot(vars, 'g', label='$\sigma_k^2$')
> plot_ictruth = ax.axhline(y = x_0, xmin = 0, xmax = numtimes, color='r',
> label='$x_0$')
> ax.set_xlabel('$k$')
> ax.legend(loc='upper right')
> tightbox = ax.get_tightbbox()
> canvas.print_pdf(a)
>
> The problem here is that get_tightbbox() takes 2 arguments, namely self and
> renderer. My question is, what is a renderer and how do I instantiate/create
> one? After some reading I think it's something to do with
> maplotlib.backend_bases or something. Am I on the right track? After the
> call I want to adjust the Axes limits to the thing returned by
> get_tightbbox(), would ax.set_position(tightbox) do that here?
>
> Any help would be greatly appreciated.
> Regards,
> --Damon
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] twinx/twiny usage

2009-08-12 Thread Jae-Joon Lee
On Wed, Aug 12, 2009 at 3:16 PM, Uri Laserson wrote:
> Hi,
>
> I am trying to overlay a few Axes object that need to share axes.  I would
> like it to be the case that if I change the properties of one axis (e.g.,
> scale), the corresponding axis of the other axes will have the properties
> changed automatically.  I was trying to use twinx/twiny, but this behavior
> failed.  After looking at the code, it appears to me that the sharex/sharey
> parameters to the Axes class never actually copies the axis instances of the
> given axes object.  Is this intentional?  If I want to get properties to be
> connected between axis objects in different axes, could I manually assign
> the xaxis attribute of one axes to reference an Axis instance in a different
> axes object?  Or would this make everything break?

Axis in matplotlib is partly a transform (not exactly, but sort of)
and partly an artist. And it became tricky to share axis among
different axes.
The solution depends on details of what you want. If the scale is set
before twin is called, than the twined axes will have a same scale as
the original. If you need to change the scale after the axes is
twined, you need to manually change the all shared axes
(get_shared_x_axes and get_shared_y_axes would be helpful).
Also, depending on you need, the ParasiteAxes in axes_grid toolkit may
be useful.

Regards,

-JJ


>
> Thanks!
> Uri
>
> --
> Uri Laserson
> PhD Candidate, Biomedical Engineering
> Harvard Medical School (Genetics)
> Massachusetts Institute of Technology (Mathematics)
> phone +1 917 742 8019
> laser...@mit.edu
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] placing xlabel in the correct place when using tick_top

2009-08-12 Thread Jae-Joon Lee
http://matplotlib.sourceforge.net/search.html?q=set_label_position&check_keywords=yes&area=default

ax2.xaxis.set_label_position("top")
ax2.yaxis.set_label_position("right")

Regards,

-JJ


On Thu, Aug 13, 2009 at 12:10 AM, Duncan Mortimer wrote:
> Hi all,
>
> I'm trying to produce a graph in which two different sets of axes are
> superimposed, with both x- and y- ticks taking on different ranges.
>
> I've managed to get the first set of axes to place its ticks on the
> bottom and left of the figure, and the second set to place its ticks
> on the top and right, however, xlabel and ylabel behave in an
> unexpected manner: for the bottom-left axes, xlabel and ylabel place
> text in the correct location, however, for the "top-right" axes,
> xlabel and ylabel misbehave, placing the axis label text at the bottom
> (for xlabel) and the left (for ylabel), but positioned closer to the
> axis lines.
>
> This seems to be due to some sort of bug with the "alignment" keyword
> for xlabel and ylabel: i.e. alignment = "top" or alignment = "right"
> does not behave as I would have expected.
>
> I'm sorry if this has been reported before; I wasn't able to find
> anything useful in the archives or elsewhere on the web.
> Can anyone suggest a workaround?  I don't have the time at the moment
> to get to grips with the source.
>
> See below for a simple example.
>
> Thanks for your help!
> Duncan
>
> 
>
> from pylab import *
>
> fig = figure()
>
> ax1 = fig.add_axes([0.1,0.1,0.8,0.8],label='axes 1')
> ax2 = fig.add_axes([0.1,0.1,0.8,0.8],label='axes 2')
>
> plot1 = ax1.plot([1,2,3],[1,2,3])
> plot2 = ax2.plot([4,5,6],[3,2,1])
>
> ax1.axis([0,4,0,4])
> ax1.set_xlabel('bottom')
> ax1.set_ylabel('left')
>
> ax2.axis([3,7,0,4])
> ax2.xaxis.tick_top()
> ax2.yaxis.tick_right()
> ax2.set_xlabel('top')       # I expected this to place the word "top"
> at the top of the figure, corresponding to the ticks for ax2's x-axis
> ax2.set_ylabel('right')      # I expected this to place the word
> "right" at the right of the figure, corresponding to the ticks for
> ax2's y-axis
>
> ax2.axesPatch.set_fill(False)   # so that you can see through to ax1
>
> fig.canvas.draw()
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] executing function when view interval changes

2009-08-17 Thread Jae-Joon Lee
I took a stab at this during the weekends and a patch is attached.

1) introduces a new command subplot2grid. e.g.,

subplot2grid(shape=(3,3), loc=(0,0), colspan=3)

it still creates a Subplot instance.

2) subplot command can take a SubplotSpec instance which is created
using the GridSpec.

gs = GridSpec(3,3) # shape=3,3
subplot(gs.new_subplotspec(loc=(0,0), colspan=3))

or

subplot(gs[0,:])

or

subplot(gs[0:3]) # supermongo-like

For suplot with a single cell,

subplot(gs[0])  # => subplot(331)

or

subplot(gs[0,0])


3) Each GridSpec can have associated subplot parameters (subplot
params of the figure is used if not set).


Also see the example (demo_gridspec.py).

We may further try to improve it (during the sprint maybe) if others
are happy with the patch.

Regards,

-JJ



On Sun, Aug 2, 2009 at 1:00 AM, John Hunter wrote:
> On Sat, Aug 1, 2009 at 7:32 PM, Alan G Isaac wrote:
>> On 8/1/2009 4:07 PM Thomas Robitaille apparently wrote:
>>> Since matplotlib is about to hit 0.99,
>>
>>
>> Which reminds me, was there a decision on subplot2grid etc?
>> http://sourceforge.net/mailarchive/message.php?msg_name=6e8d907b0905172009j21b5077fp242c7598ee9fb2c9%40mail.gmail.com>
>
> There are lots of good suggestions in that thread -- on this issue,
> all the best people will be at scipy and/or participating in the
> sprint (Andrew who wrote the mpl sizer toolkit, JJ who does more
> strange and wonderful things than anyone, Ryan May who has thought
> through the issues and has done a lot of great work).  So we'll
> definitely bring it up and see if we can do something about it.  There
> are two pieces to this thread: the non-pythonic 1 based addressing of
> the current subplot command ("don't blame me, talk to the mathworks"),
> and the ability to easily specify column or row spans across the grid.
>  The former is a minor wart that is unlikely to change, the latter is
> a significant feature that we should definitely support. Maybe you can
> join us via skype if not in person in  Pasadena, and we can try an
> improve the current implementation.  I don't imagine adding support
> for spans would be too hard,
>
> JDH
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
diff --git examples/pylab_examples/demo_gridspec.py examples/pylab_examples/demo_gridspec.py
new file mode 100644
index 000..4d0751a
--- /dev/null
+++ examples/pylab_examples/demo_gridspec.py
@@ -0,0 +1,43 @@
+import matplotlib.pyplot as plt
+
+# demo 1 : subplot2grid
+
+plt.figure(1)
+ax1 = plt.subplot2grid((3,3), (0,0), colspan=3)
+ax2 = plt.subplot2grid((3,3), (1,0), colspan=2)
+ax3 = plt.subplot2grid((3,3), (1, 2), rowspan=2)
+ax4 = plt.subplot2grid((3,3), (2, 0))
+ax5 = plt.subplot2grid((3,3), (2, 1))
+
+# demo 2 : gridspec with python indexing
+
+plt.figure(2)
+
+from matplotlib.axes import GridSpec
+
+gs = GridSpec(3, 3)
+ax1 = plt.subplot(gs[0, :])
+# identical to ax1 = plt.subplot(gs.new_subplotspec((0,0), colspan=3))
+ax2 = plt.subplot(gs[1,:-1])
+ax3 = plt.subplot(gs[1:, -1])
+ax4 = plt.subplot(gs[-1,0])
+ax5 = plt.subplot(gs[-1,-2])
+
+
+# demo 3 : gridspec with subplotpars set.
+
+f = plt.figure(3)
+
+gs1 = GridSpec(3, 3)
+ax1 = f.add_subplot(gs1[:-1, :])
+ax2 = f.add_subplot(gs1[-1, :-1])
+ax2 = f.add_subplot(gs1[-1, -1])
+gs1.update(left=0.05, right=0.48, wspace=0.05)
+
+gs2 = GridSpec(3, 3)
+ax1 = f.add_subplot(gs2[:, :-1])
+ax2 = f.add_subplot(gs2[:-1, -1])
+ax2 = f.add_subplot(gs2[-1, -1])
+gs2.update(left=0.55, right=0.98, hspace=0.05)
+
+plt.show()
diff --git lib/matplotlib/axes.py lib/matplotlib/axes.py
index 77e9cc4..0af5254 100644
--- lib/matplotlib/axes.py
+++ lib/matplotlib/axes.py
@@ -7749,6 +7749,200 @@ class Axes(martist.Artist):
 self.yaxis.set_minor_locator(mticker.NullLocator())
 
 
+
+class GridSpec(object):
+def __init__(self, nrows, ncols, 
+ left=None, bottom=None, right=None, top=None,
+ wspace=None, hspace=None):
+#self.figure = figure
+self._nrows , self._ncols = nrows, ncols
+self.left=left
+self.bottom=bottom
+self.right=right
+self.top=top
+self.wspace=wspace
+self.hspace=hspace
+
+def get_geometry(self):
+return self._nrows, self._ncols
+
+_AllowedKeys = ["left", "bottom", "right", "top", "wspace", "hspace"]
+
+def update(self, **kwargs):
+"""
+Update the current values.  If any kwarg is None, default to
+the current value, if set, otherwise to rc
+
+

[Matplotlib-users] pywcsgrid2 : matplotlib with astronomical fits images

2009-08-17 Thread Jae-Joon Lee
Hello,

pywcsgrid2 is my personal project to display astronomical fits images
using matplotlib.

While there are other tools, my approach is to extend the capability
of the matplolib, rather than building something new on top of it.
pywcsgrid2 provides a custom Axes class (derived from the matplotlib's
original Axes) whose main functionality improvement is to draw ticks,
ticklabels, and grids in an appropriate sky coordinate.


Requirement


* Matplotlib 0.99 version (http://matplotlib.sourceforge.net/)

* kapteyn package (http://www.astro.rug.nl/software/kapteyn/) or pywcs
(https://www.stsci.edu/trac/ssb/astrolib, svn version is required)

* pyfits

And it is only supported in linux and mac os X (although pywcsgrid2
itself is written in pure python).


URLs
--

Home page : http://leejjoon.github.com/pywcsgrid2/

Overview doc. : http://leejjoon.github.com/pywcsgrid2/users/overview.html

Download : http://github.com/leejjoon/pywcsgrid2/downloads

github : http://github.com/leejjoon/pywcsgrid2

Unfortunately, the code is documented rather sparsely (with poor
english), but I hope the above  overview gives enough idea on how to
start.

pywcsgrid2 is still in development, and there will be bug fixes and
improvements. While a downloadable tar file is available, installing
from the git repository is recommended if you're familiar with it.

For questions, bug reports or feature suggestions, please email me or
use the issue tracker in the github.

Regards,

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] animate histogram

2009-08-18 Thread Jae-Joon Lee
On Tue, Aug 18, 2009 at 1:53 PM, Alan G Isaac wrote:
> 2. This is pretty fast.  Would there be additional
> speed gains to blitting, and if so, how would it
> be done?  (I'm just asking for clues, not a complete
> example.)

Blitting will improve the performance when significant portion of your
plot is (semi-)stationary. And I guess your example, as it is, may not
benefit from blitting.

A. init
  1. draw stationary artists (animated=False) on the canvas
  2. save the area of canvas as a pixmap array.

B. looping for animation
  1. restore the stationary artists by blitting the saved pixmap array
  2. draw animated artists.
  3. optionally update the saved pixmap.

And your speed gain comes from B.1

Regards,

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] One more time: frame linewidth

2009-08-18 Thread Jae-Joon Lee
I guess you're using 0.99?
Use spines instead.

for example,

gca().spines["bottom"].set_linewidth(2) # it only changes the
linewidth of the bottom spine.

also, see this example,

http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html#pylab-examples-spine-placement-demo

Regards,

-JJ



On Tue, Aug 18, 2009 at 5:18 PM, Christopher Brown wrote:
> I have asked this question before. How do I set the linewidth of the
> axis frame? Long ago, I used gca().get_frame().set_linewidth(2). More
> recently, I used gca().frame.set_linewidth(2), but this doesn't seem to
> work anymore. I've tried gca().patch, to no avail. Any suggestions?
>
> Thanks.
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] figure legend with mplot3d

2009-08-18 Thread Jae-Joon Lee
On Tue, Aug 18, 2009 at 1:33 PM, dek wrote:
>
> the patch3dcollection object not good for legend figure, I am having trouble
> thinking of a work
> around. Is there manually a way to insert artist and labels into the legend
> and make it such that it is independent from the axes? Using a proxy artist
> requires it not be part of the axes correct?

It actually does not matter. But in most cases, you do not want to see
the proxy artists (except in the legend), and easiest solution is just
not to add them to any axes. See the link below.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

Regards,

-JJ


> --
> View this message in context: 
> http://www.nabble.com/figure-legend-with-mplot3d-tp25029801p25029801.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticklabels possition on a bar chart

2009-08-18 Thread Jae-Joon Lee
You need to adjust the positions of the ticks.
bar command (by default) creates boxes so that their left side
corresponds the first argument.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar

so, in your case, something like below will work (0.4 from 0.8/2 where
0.8 is the default width of the bar).

axes.set_xticks([x+0.4 for x in indx])

Alternatively, bars can be center-aligned.

See the docs for more,

Also, take a look at the example below (there are bunch of other
examples in the gallery)

http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html

-JJ



On Tue, Aug 18, 2009 at 1:29 PM, Werner F. Bruhin wrote:
> My lables for the different bars are not centered below the bar but are all
> to the left side of the bars (lower left corner).
>
>
>
> This is what I am basically doing:
>
>     axes = panel.figure.add_subplot(2, 2, 3)
> ...
>     axes.bar(indx, values, color=colors)
>     axes.set_xticklabels(labels)
>
> I can not find how to provide the lables to the "bar" call or how else to
> make sure that "Rot" is centered under the first bar, "Weiß" under the
> second bar and so on.
>
> Ideally I would like to have these labels printed at an angle.
>
> Appreciate any hints
> Werner
>
> P.S.
> mpl version: '0.99.0'
> Python 2.5.2 on Vista
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to get the properties for elements in a collection?

2009-08-18 Thread Jae-Joon Lee
sct1 = axes.scatter(x,y, c=some_list, cmap=plt.get_cmap(colmap))
colors = sct1.get_facecolors()

The return value is an array of rgb values.

-JJ


On Mon, Aug 17, 2009 at 3:40 PM, Carlos
Grohmann wrote:
> Hi, I have a collection, which is a scatter plot, and I want to
> iterate through all the elements in this collection and retrieve their
> properties, like facecolor.
>
> the scatterplot is created like this:
>
> axes.scatter(x,y, c=some_list, cmap=plt.get_cmap(colmap))
>
> many thanks
>
> --
> Carlos Henrique Grohmann - Geologist D.Sc.
> a.k.a. Guano - Linux User #89721
> ResearcherID: A-9030-2008
>
> http://digitalelevation.blogspot.com
>
> http://www.igc.usp.br/pessoais/guano
> _
> Can’t stop the signal.
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to get the properties for elements in a collection?

2009-08-18 Thread Jae-Joon Lee
See below for available public methods.

http://matplotlib.sourceforge.net/api/collections_api.html#matplotlib.collections.Collection

-JJ



On Tue, Aug 18, 2009 at 6:16 PM, Jae-Joon Lee wrote:
> sct1 = axes.scatter(x,y, c=some_list, cmap=plt.get_cmap(colmap))
> colors = sct1.get_facecolors()
>
> The return value is an array of rgb values.
>
> -JJ
>
>
> On Mon, Aug 17, 2009 at 3:40 PM, Carlos
> Grohmann wrote:
>> Hi, I have a collection, which is a scatter plot, and I want to
>> iterate through all the elements in this collection and retrieve their
>> properties, like facecolor.
>>
>> the scatterplot is created like this:
>>
>> axes.scatter(x,y, c=some_list, cmap=plt.get_cmap(colmap))
>>
>> many thanks
>>
>> --
>> Carlos Henrique Grohmann - Geologist D.Sc.
>> a.k.a. Guano - Linux User #89721
>> ResearcherID: A-9030-2008
>>
>> http://digitalelevation.blogspot.com
>>
>> http://www.igc.usp.br/pessoais/guano
>> _
>> Can’t stop the signal.
>>
>> --
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Line2D on multiple plots?

2009-08-18 Thread Jae-Joon Lee
On Mon, Aug 17, 2009 at 10:29 AM, Ole Streicher wrote:
> Hi,
>
> I want to show the same data on multiple plots. Is it possible to re-use
> the Line2D object for that? t.m.,
>
> line = axes1.plot(xdata, ydata, ...)
>
> ...
>
> axes2.lines.append(line)
>
> Or is a Line2D bound to a certain axes instance?
>

I guess you already know the answer as this can be easily tested.
For the record, the answer is Yes, all matplotlib artists are bound to
a certain axes. You may come up with some workaround by updating the
axes-related properties before each draw call, but the easiest
solution seems to be creating multiple artists.

-JJ


> Best regards
>
> Ole
>
>
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Custom ticklabels on colorbar

2009-08-21 Thread Jae-Joon Lee
On Fri, Aug 21, 2009 at 10:01 AM, Scott
Sinclair wrote:
>> I just realized that I did not give the correct plot object when creating
>> the colorbar. Now it works perfectly to pass arguments by set_xticklabels().
>>
>> However, another question just arose. To format the numbers on the tick
>> labels I tried to pass a format string when creating the colorbar with the
>> format parameter. But it has no effect. The same when I give a
>> FormatStrFormatter object. I also tried to use
>> cb.ax.axis.set_major_formatter(). The effect of this was. That it sets the
>> labels to the range between 0 and 1. Is there a solution for this problem
>> besides entering the tick labels manually?

The tick locator and tick formatter needs to be passed during the
colorbar creation. Otherwise,
it gets very tricky to deal with. This is because the data coordinate
of the colorbar axes is not directly associated with the ticklabels.

If passing the formatter during the colorbar creation has no effect,
this should be filed as a bug. Please post a small standalone example
that reproduces your problem. Also, please report your version of
matplotlib. If you're using older version, I recommend you to test it
with newer version.

Just in case, my quick test worked fine.

imshow([[1,2],[2,3]])
cb=colorbar(format=r"$%2.1f\%%$")

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Create axes instance position relative to another axes instance position??

2009-08-22 Thread Jae-Joon Lee
What you need is to adjust the axes position of the colorbar at the
drawing time (because the axes position of the contour plot is
adjusted only during the drawing time).
You may do this by properly setting the axe_locator property of the axes.

If you're using mpl 0.99, axes_grid toolkit may be helpful.
I just posted a simple example with the screenshot in the link below.

http://abitofpythonabitofastronomy.blogspot.com/2009/08/creating-color-bar-using-inset-axes.html

Regards,

-JJ



On Sat, Aug 22, 2009 at 9:51 PM, Patrick Marsh wrote:
> Greeting MPL world,
>
> I have a contourf plot where the aspect ratio is 1.  I need to add a
> colorbar to the plot in a manner that keeps the colorbar in the same
> place relative to the contourf plot (good.png), even if the parent
> window is resized.  I can do this with text, but haven't been able to
> figure out how to do it with a colorbar.  To the best of my knowledge,
> there are two ways forward.
>
> 1.)  I can create an entirely new axis instance (cax) but will need to
> find a way to define the axes in a relative way to the original ax
> instance.  As it stands now, I can only define axes in terms of the
> total figure size.  As a result, the figure looks like it does in
> bad.png
>
>
> 2.)  I can use the original ax instance, but need to find a way to
> have more control over the colorbar placement.  For example, it needs
> to "sit" on the x-axis and not be centered in the middle of the yaxis.
>  Using shrink and aspect, I can get the plot size to be correct,
> however it's position is centered on the yaxis as in bad2.png
>
> Is there a way to accomplish what I'm needing to do and I'm just missing it?
>
> Thanks in advance,
> Patrick
> ---
> Patrick MarshC
> Graduate Research Assistant
> School of Meteorology
> University of OklahomaC
> http://www.patricktmarsh.com
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] help needed in plotting curved elements

2009-08-22 Thread Jae-Joon Lee
On Thu, Aug 20, 2009 at 2:01 AM, Sameer Regmi wrote:
> We tried the method 1 but the result was a garbled mesh

Please describe what you did and why the result is wrong.

The method 1 with quadratic bezier curve should be most
straight-forward and easy thing to do. Calculating the control points
is also straight forward. While you may simply use
matplotlib.bezier.get_intersection, you'd better come up with some
optimized version since you need to calculate this for lots of
positions.

It is not clear how you're drawing path currently, but Line2D class is
not suitable for bezier lines. You may use PathPatch class. Or you can
create your own artist class (maybe this is what you meant by
"implemented"). A simple version of bezier artist can be found in
mpl_toolkits.axes_grid.axeslines.BezierPath (included in mpl 0.99).

If you haven't, please take a look at the tutorial below.

http://matplotlib.sourceforge.net/users/path_tutorial.html


-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Create axes instance position relative to another axes instance position??

2009-08-24 Thread Jae-Joon Lee
I think you can just copy the axes_grid.inset_locator.py file and use
it after deleting a few lines of code that gives some ImportError.

However, here is a some related post.

http://www.nabble.com/embedding-figures-inside-another-%28coordinates%29-td22826126.html#a22832238


Just replace the bbox coordinate of the inset axes, eg.,

ip = InsetPosition(ax, [1.1, 0., 0.1, 0.5])

Note that the coordinate is the normalized axes coordinate of the parent axes.

*axes_locator* takes a callable object which takes arguments of the
axes itself and the renderer, and subsequently returns the bbox
object. Once set, the axes_locator is called at the drawing time and
adjust the axes position to the returned bbox.

-JJ


On Sun, Aug 23, 2009 at 10:42 AM, Patrick Marsh wrote:
> Hi JJ,
>
> I'm not sure I understand how to properly set the axe_locator.  Below
> is my snippet of code that I use to create my contourf plot and then
> create the colorbar.  I'm unsure how I would modify it to do as you
> suggested.  Any help would be appreciated.
>
>        plot = ax.contourf(xc, yc, data, cmap=cmap, levels=clevels)
>        cax = plt.axes([0.85, 0.125, 0.035, 0.325])
>        cbar = fig.colorbar(plot, format='%.1f', cax=cax)
>
> I should also point out that the reason I'm not using the axes_grid
> toolkit is because I'm constrained to develop based on the current
> Enthought release.
>
> Patrick
> ---
> Patrick Marsh
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> http://www.patricktmarsh.com
>
>
>
>
> On Sat, Aug 22, 2009 at 10:37 PM, Jae-Joon Lee wrote:
>> What you need is to adjust the axes position of the colorbar at the
>> drawing time (because the axes position of the contour plot is
>> adjusted only during the drawing time).
>> You may do this by properly setting the axe_locator property of the axes.
>>
>> If you're using mpl 0.99, axes_grid toolkit may be helpful.
>> I just posted a simple example with the screenshot in the link below.
>>
>> http://abitofpythonabitofastronomy.blogspot.com/2009/08/creating-color-bar-using-inset-axes.html
>>
>> Regards,
>>
>> -JJ
>>
>>
>>
>> On Sat, Aug 22, 2009 at 9:51 PM, Patrick Marsh 
>> wrote:
>>> Greeting MPL world,
>>>
>>> I have a contourf plot where the aspect ratio is 1.  I need to add a
>>> colorbar to the plot in a manner that keeps the colorbar in the same
>>> place relative to the contourf plot (good.png), even if the parent
>>> window is resized.  I can do this with text, but haven't been able to
>>> figure out how to do it with a colorbar.  To the best of my knowledge,
>>> there are two ways forward.
>>>
>>> 1.)  I can create an entirely new axis instance (cax) but will need to
>>> find a way to define the axes in a relative way to the original ax
>>> instance.  As it stands now, I can only define axes in terms of the
>>> total figure size.  As a result, the figure looks like it does in
>>> bad.png
>>>
>>>
>>> 2.)  I can use the original ax instance, but need to find a way to
>>> have more control over the colorbar placement.  For example, it needs
>>> to "sit" on the x-axis and not be centered in the middle of the yaxis.
>>>  Using shrink and aspect, I can get the plot size to be correct,
>>> however it's position is centered on the yaxis as in bad2.png
>>>
>>> Is there a way to accomplish what I'm needing to do and I'm just missing it?
>>>
>>> Thanks in advance,
>>> Patrick
>>> ---
>>> Patrick MarshC
>>> Graduate Research Assistant
>>> School of Meteorology
>>> University of OklahomaC
>>> http://www.patricktmarsh.com
>>>
>>> --
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>>> trial. Simplify your report design, integration and deployment - and focus 
>>> on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> ___
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Cursor position

2009-08-24 Thread Jae-Joon Lee
On Mon, Aug 24, 2009 at 1:14 PM, Thomas
Robitaille wrote:
>
> Hi,
>
> I'm interested in controlling how the cursor position appears at the bottom
> of interactive windows.
>
> I noticed that by default, it is the Formatter that gets called. However, in
> my case, the displayed coordinates each depend on both the x and y pixel
> value, and therefore I need to somehow override the Formatter.
>

I doubt if overriding formatter works. Formatter basically does not
know about the other coordinate.

I think the easiest solution is to override the Axes.format_coord. For example,

  ax = gca()
  ax.format_coord = lambda x,y : "x=%g y=%g" % (x, y)

x,y are in data coordinate. I'm not sure if there is any side effect,
but it seems that the format_coord method is only used to display the
coordinate in the toolbar.



> Does anyone have any suggestions? Should I use event handling with the
> 'motion_notify_event' event? If so, how do I make sure that the formatter
> doesn't still get called, and where is the string object that I should
> update?

Take a look at the NavigationToolbar2 class in backend_bases.py.
If you go down this road, you may need to modify mouse_move method to
prevent it displaying the coordinate. You may use set_message method
to display the coordinate.

But I personally think overriding format_coord method is good enough.

Regards,

-JJ

>
> Thanks,
>
> Thomas
> --
> View this message in context: 
> http://www.nabble.com/Cursor-position-tp25119919p25119919.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] display pixels values on the backends

2009-08-24 Thread Jae-Joon Lee
On Mon, Aug 24, 2009 at 1:48 PM, Xavier Gnata wrote:
> Hi,
>
> I have already asked about that but I'm back once again :)
>
> The way I use matplotlib may be a corner case:
> I'm often looking at large (4k x 4k) images and I do want to see the
> pixels values moving the mouse over the display.
> imshow does a great job but all the backend only display "x= y=".
> I would love to see "x= y= Z=" (or "value="...call it the way you want ;))
>
> What is the best way to do that?
> imshow is great because there is nothing to connect to see x and y
> values on the backend.
> I need to code something as simple as imshow to get also the pixel values.

The easiest way I can think of is to override Axes.format_coord
method.  A pseudo code might look like below

def report_pixel(x, y):
   # get the pixel value
   v = get_pixel_value_of_your_image(x,y)

   return "x=%f y=%f value=%f" % (x, y, v)

ax = gca()
ax.format_coord = report_pixel

The code will become more complicated if you want to support multiple images.
This solution is far from elegant, but maybe the easiest one.

-JJ

>
> Is there really on way to get that as a new option in imshow? at least
> in one of the backend (as a starting point)
>
> Best Regards,
> Xavier
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Custom ticklabels on colorbar

2009-08-25 Thread Jae-Joon Lee
Please, take your time and post a "standalone" code that reproduces
your problem so that others can actually test. Also, please describe
what results you have and why they are wrong.

On Tue, Aug 25, 2009 at 4:08 AM, Daniel
Platz wrote:
> fig1.colorbar(pc1,ax=ax1,orientation='horizontal',pad=0.025,ticks=temp,format=r"$%2.1f\%%$")
>     cb1.ax.set_xticklabels(temp,fontsize=10,family='serif')

The set_xticklabels command actually overrides the format setting you
specified in the colorbar call, which might be the reason that the
script does not work as you intended. But, it is hard to tell without
the runnable code.

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] mplot3D plot_surface colors

2009-08-26 Thread Jae-Joon Lee
On Wed, Aug 26, 2009 at 6:22 AM, German Ocampo wrote:
> Hello
>
> Are there some way to take out the gridlines from a surface in mplot3D
> and get a smooth colour change?
>


I think surface plot does not draw any gridlines by default (linewidth
set to 0). Maybe you're referring the artifacts between each surface
elements, as can be seen in the example below

http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo.html

My guess is that they are artifacts of antialiasing that edges gets
somewhat transparent.

So, you may turn off antialiasing, but plot gets a bit ugly. Or you
may actually strokes the edges with their face colors.

See the example plot attached.

The second example is created with high resolution grid to demonstrate
smooth color variation (this is extremely slow to render though).

It may be better if mplot3d has option for this, but I'll leave it to
Reinier, the original author of mplot3d.

Micheal,
If my understanding is correct, we will see this artifacts even with
the Gouraud shading. What do you think?

Regards,

-JJ

ps. I'm resending this message with external link to images due to the
attachment size limit in mpl list.

http://dl.getdropbox.com/u/178748/mpl/mplo3d_test_lowres.png
http://dl.getdropbox.com/u/178748/mpl/mplo3d_test_hires.png

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] yaxis labels on both sides

2009-08-27 Thread Jae-Joon Lee
I don't think there is a direct support for this in mpl and I guess
only way is to adjust the parameters of each ticks.

def set_ticks_both(axis):
ticks = list( axis.majorTicks ) # a copy
ticks.extend( axis.minorTicks )

for t in ticks:
t.tick1On = True # tick marker on left (or bottom)
t.tick2On = True # tick marker on right (or top)
t.label1On = True # tick label marker on left (or bottom)
t.label2On = True # tick label on right (or top)

set_ticks_both(ax.yaxis)

-JJ



On Thu, Aug 27, 2009 at 7:22 AM, Peter Saffrey wrote:
> Some of my plots are very wide. I'd like Y axis labels on both sides so
> that it's clearer to read the bars towards the right hand side.
>
> I can change the ticks with yaxis.set_ticks_position("both") but there
> doesn't seem to be a similar call for labels. Any ideas?
>
> Thanks,
>
> Peter
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] preserving transparency in eps

2009-08-31 Thread Jae-Joon Lee
If you need to stick to eps, another option is to use rasterization
feature of the matplotlib itself. This way you can keep part of plot
in vector format (e.g., texts, lines, etc ) while rasterizing others.
Of course this solution only works if the "quality" of those being
rasterized is not very important.

http://matplotlib.sourceforge.net/examples/misc/rasterization_demo.html

The rasterization in the ps backend works in a way that all the artist
whose zorder is smaller than the specified value are rasterized while
those with larger zorder are not.

Regards,

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Placing vector eps graphics

2009-09-01 Thread Jae-Joon Lee
You may use PyX for compositing two eps images. It is not a gui
application like inkscape.
But it is one of the best option I know for eps compositing.

http://pyx.sourceforge.net/manual/epsfile.html

Regards,

-JJ


On Tue, Sep 1, 2009 at 11:09 AM, jakobg wrote:
>
> Hi there,
>
> I want to place an eps graphic I created in Inkscape in a plot. The final
> image is supposed to be a vector eps as well. I looked up the forum but just
> found the option with the Image (PIL) library which obviously rasterizes my
> vector image. And I use the Tex option so I cannot just save as SVG and do
> the compositing stuff in Inkscape.
>
> The placing of the image is straight forward and fine documented (with
> additional axes and imshow), so it is just a problem of importing a eps
> vector image.
>
> I would be very grateful if someone could help me with this issue.
>
> Thanks!
> Jakob
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/Placing-vector-eps-graphics-tp25242043p25242043.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Delete Line & legend from graph using matplotlib & wxPython

2009-09-02 Thread Jae-Joon Lee
On Wed, Sep 2, 2009 at 11:41 AM, Sebastian Rhode wrote:
> So I already figure out how to delete the last drawn line, but this is not a
> very good solution. What I actually would need, is a selection which line &
> legend the users whats to remove from the graph (perfect would be
> interactivly directly from the graph). But so far, I could not figure this
> out. Has anyone a good ides how to achieve this?

All the matplotlib plot commands return artists created by that plot
command. Unless you want those permanently removed from the current
plot, it is suffice to just make them invisible
(http://matplotlib.sourceforge.net/api/artist_api.html?highlight=set_visible#matplotlib.artist.Artist.set_visible).

For interactive stuff, the following example may be a good starting
point (well, the example is in the svn trunk and I'm not sure if it
will run with older version of matplotlib).

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/examples/event_handling/legend_picking.py?revision=7351&view=markup

Regards,

-JJ

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] funny bug with greek letters

2009-09-04 Thread Jae-Joon Lee
In [162]: print "$\beta$"
eta$

In [163]: print r"$\beta$"
$\beta$

use the raw sting for math expression.
Regards,

-JJ


On Fri, Sep 4, 2009 at 12:06 PM, Nicolas
Chopin wrote:
>  Hi list,
> when I do:
> hist(randn(100)); xlabel('$\gamma$')
> things work as expected.
> However, if I try:
> hist(randn(100)); xlabel('$\beta$')
> then either I get an error, or I get the label "eta" under the plot.
> Other letters seem to trigger this: tau, alpha, rho, maybe others.
> This problems wether text.usetex is set to True or not (in matplolibrc file).
>
> Version: 0.98.5.2 (Ubuntu Jaunty, ipython 0.9.1 shell).
>
> Has anyone had the same problem, and is there any fix?
> Sorry if this has been reported before, I tried to find it, but
> nothing came out.
>
> Thanks in advance
>
> --
> 
> Nicolas Chopin
> ENSAE
> 3, Avenue Pierre Larousse
> 92245 Malakoff CEDEX
> FRANCE
> tel +33 1 41 17 65 22 | fax +33 1 41 17 38 52
> http://www.crest.fr/pageperso/Nicolas.Chopin/Nicolas.Chopin.htm
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] cannot plot in loops with matplotlib 0.99. 0.98 works fine

2009-09-06 Thread Jae-Joon Lee
I presume you're running that script in interactive shell?
Try draw() instead of show().

Regards,

-JJ


On Sun, Sep 6, 2009 at 3:06 PM, tva wrote:
>
> Hi all
>
> with matplotlib 0.98.5.3 this script will draw new lines as the scrips is
> running:
>
> from pylab import *
> x = arange(0,2*pi,0.01)
> for i in arange(1,20):
>
>        y=sin(x+i)
>        plot(x,y)  # update the data
>        show()
>
>
> with matplotlib 0.99, the exact same script runs to the end without plotting
> and then plots all the lines. This is just a trivial example but for some
> applications it is useful to monitor the evolution of curves as the script
> is running - allows me to update parameters if something diverges.
> Any idea why there is such a difference between 0.98.5.3 and 0.99 ??
> --
> View this message in context: 
> http://www.nabble.com/cannot-plot-in-loops-with-matplotlib-0.99.-0.98-works-fine-tp25320454p25320454.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] slow rendering of 2K images using Animation_blit_tk.py - bis

2009-09-06 Thread Jae-Joon Lee
There are a few ways to improve the speed, which, I guess, will give
you factor of a few speed up.
If you need more than that, I guess matplotlib is not suitable for your purpose.

* try a simple interpolation method, eg.  imshow(arr, interpolation="nearest")
* reduce the image size. Unless you have a monitor this large, you
loose the image quality anyhow.

In my machine (linux, xeon 2.6 GHz), it takes about ~0.8 s to display
2k x 2k image. 0.3 s for 1k x 1k.

Regards,

-JJ



On Fri, Sep 4, 2009 at 5:18 AM, Auré Gourrier wrote:
> Dear all,
>
> I recently cried for help (see below) but sadly didn't get any answer...
> This problem is really a bottleneck for me and if I must find a solution...
> Can anyone PLEASE point me in the right direction ?
>
> I recently bumped into a problem while trying to display imshow images
> (2048x2048 pix) in a GUI based on TkAgg (matplotib0.91.2, python 2..4.4,
> numpy1.0.4). In brief, building the image with imshow is Ok, but the call to
> show() or draw() takes about 1.2 s on my system (XP, 2.8Ghz, 2Go ram). After
> reading a lot of posts and trying out a few things, I turned to the
> Animation_blit_tk.py example and modified it accordingly (code attached
> below). In the end, the display is still not much faster using this method
> (still in the order of 1.2 s as indicated by the result below).
> Could any one tel me whether I'm doing something wrong ?
>
> As far as I understand, at least in my Tk GUI, the limiting step using the
> ImageTk.FigureCanvasTkAgg is the call to draw() or draw_artist(). I read
> some comments from John regarding TkAgg being slow in some cases but
> couldn't find a definite answer.
>
> Any hint would be much appreciated
>
> Cheers,
>
> Aure
>
>
> 
> # For detailed comments on animation and the techniqes used here, see
> # the wiki entry http://www.scipy.org/Cookbook/Matplotlib/Animations
>
> import matplotlib
> matplotlib.use('TkAgg')
>
> import sys
> import pylab as p
> #import matplotlib.numerix as nx
> import time
>
> from FileUtils10 import fileHandling
>
> # for profiling
> tstart = time.time()
> tprevious = time.time()
>
> fnamelist = ['fname1','fname2','fname3']
>
> ax = p.subplot(111)
> canvas = ax.figure.canvas
>
> print 't1 ',time.time()-tprevious
> tprevious = time.time()
>
> # create the initial line
> dataarr = fileHandling(fnamelist[0]).readSpecial()
> #print dataarr.dtype        =>  numpy dtype uint16
> #dataarr = dataarr.astype('uint8')
> print 't2 ',time.time()-tprevious
> tprevious = time.time()
>
> image = p.imshow(dataarr, animated=True)
> print 't3 ',time.time()-tprevious
> tprevious = time.time()
>
> def run(*args):
>     tprevious = time.time()
>     background = canvas.copy_from_bbox(ax.bbox)
>     print 't4 ',time.time()-tprevious
>     tprevious = time.time()
>     while 1:
>         #print fnamelist[run.cnt]
>         # restore the clean slate background
>         canvas.restore_region(background)
>         print 't5 ',time.time()-tprevious
>         tprevious = time.time()
>         # update the data
>         dataarr = fileHandling(fnamelist[run.cnt]).readSpecial()
>         print 't6 ',time.time()-tprevious
>         tprevious = time.time()
>         image.set_data(dataarr)
>         print 't7 ',time.time()-tprevious
>         tprevious = time.time()
>         # just draw the animated artist
>         ax.draw_artist(image)
>         print 't8 ',time.time()-tprevious
>         tprevious = time.time()
>         # just redraw the axes rectangle
>         canvas.blit(ax.bbox)
>         print 't9 ',time.time()-tprevious
>         tprevious = time.time()
>
>         if fnamelist[run.cnt] == fnamelist[-1]:
>             # print the timing info and quit
>             print 'total time:' , time.time()-tstart
>             print 'FPS:' , 1000./(time.time()-tstart)
>             p.close('all')
>             sys.exit()
>
>         run.cnt += 1
> run.cnt = 0
>
>
> p.subplots_adjust(left=0.3, bottom=0.3) # check for flipy bugs
> p.grid() # to ensure proper background restore
> manager = p.get_current_fig_manager()
> manager.window.after(100, run)
>
> p.show()
>
>
> 
> Results in:
>
> t1  0.85867575
> t2  0.032648499
> t3  1.3126376
> t4  0.0
> t5  0.0
> t6  0.0310001373291
> t7  0.0
> t8  1.1873624
> t9  0.016324249
> t5  0.0
> t6  0.046313354
> t7  0..0
> t8  1.17200016975
> t9  0.0149998664856
> t5  0.0
> t6  0.047000169754
> t7  0.0
> t8  1.21899986267
> t9  0.0
> t5  0.0
> t6  0.046038147
> t7  0.0
> t8  1.1713134
> t9  0.0
> t5  0.0
> t6  0.046313354
> t7  0.0
> t8  1.1873624
> t9  0.016324249
> total time: 8.75
> FPS: 114.285714286
>
>
>
> --
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Repor

  1   2   3   4   5   6   7   8   9   >