Re: [Matplotlib-users] Memory usage

2011-01-13 Thread gary ruben
You're not doing this from ipython are you? It's cache hangs onto the
plot object references and stops python's garbage collector from
releasing them. If so, you can disable the cache as a workaround. A
better option would be if ipython implemented an option to avoid
caching references to matplotlib objects.

Gary R.

On Fri, Jan 14, 2011 at 2:59 AM, Benjamin Root  wrote:
> On Thu, Jan 13, 2011 at 7:54 AM, CASOLI Jules  wrote:
>>
>> Hello to all,
>>
>> This is yet another question about matplotlib not freeing memory, when
>> closing a figure (using close()).
>> Here is what I'm doing (tried with several backends, on MacOSX and Linux,
>> with similar results):
>> 
>> import matplotlib as mpl
>> from matplotlib import pylot as plt
>> import numpy as np
>>
>> a = np.arange(100)
>> mpl.cbook.report_memory()
>> # -> output: 54256
>> plt.plot(a)
>> mpl.cbook.report_memory()
>> # -> output: 139968
>> plt.close()
>> mpl.cbook.report_memory()
>> # -> output: 138748
>> 
>>
>> Shouldn't plt.close() close the figure _and_ free the memory used by it?
>> What am I doing wrong ?
>> I tried several other ways to free the memory, such as f = figure(); ... ;
>> del f, without luck.
>>
>> Any help appreciated !
>>
>> P.S. : side question : how come the call to plot take so much memory (90MB
>> for a 8MB array ?). I have read somewhere that each point is coded on three
>> RGB floats, but it only means an approx. 12MB plot... (plus small overhead)
>>
>> Jules
>>
>>
>
> Jules,
>
> Which version of Matplotlib are you using and which backend?  On my Linux
> install of matplotlib (development branch) using GTKAgg, the memory usage
> does get high during the call to show(), but returns to (near) normal
> amounts after I close.  An interesting observation is that if the
> interactive mode is off, the memory usage returns back to just a few
> kilobytes above where it was before, but if interactive mode was turned on,
> the memory usage returned to being a few hundred kilobytes above where it
> started.
>
> Ben Root
>
> P.S. - As a side note, estimating the memory size of these plots from the
> given data isn't as straight-forward as multiplying by three (actually, it
> would be four because of the transparency value in addition to rgb).  There
> are many other parts of the graph that needs to be represented (all having
> rgba values) but there are also a lot of simplifications that are done to
> reduce the amount of memory needed to represent these objects.
>
> --
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar with Axes3D for a set of collections?

2011-01-13 Thread Eric Firing
On 01/13/2011 01:40 PM, Daniel Mader wrote:
> Hi,
>
> I am trying to plot a set of simulation results of FEM simulations.
> With a lot of help from Ben I can plot the deformed shape quite nicely
> but I have trouble in applying a colorbar to the plot.
>
> In the attached file there are three results with different results.
>
> How can I apply a "global" colorbar so that all collections are nicely
> represented?

Quick thoughts with no testing or concrete examples:

1) Don't set the cmap or norm for the colorbar; let it inherit those 
properties from the mappable to which it is connected.

2) Ensure that the cmap and norm are the same for all collections.  You 
are already taking care of the cmap, so the problem is that you are 
autoscaling the collections separately, which is setting vmin and vmax 
to different values for the different collections.  Use the data to 
figure out the range (vmin, vmax) that you want the colors to span, and 
then for each collection, instead of col.autoscale(), use

col.norm.vmin = vmin
col.norm.vmax = vmax

(You could also make a single norm instance for all the collections to 
use, just as with the cmap, so that you only have to set vmin and vmax 
once.)

Eric

>
> Thanks a lot in advance,
> Daniel
>
>
>
> --
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
>
>
>
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] sensible tick labels for log scale (rephrased)

2011-01-13 Thread Paul Ivanov
Chris Fonnesbeck, on 2011-01-13 14:07,  wrote:
> I was hoping (and still hope) that Matplotlib is able to choose
> reasonable ticks on the log scale that do not overlap, but are
> more informative than just powers of 10.

Chris,

Sorry, I'm no expert with the locators, I rarely find myself
needing to mess with them. The cleaner way to get something other
than decades is to specify basex and basey. To do this for a plot
already created, you'll need to set the base of the LogLocator
and LogFormatter of your minor and major axes, like:

  fmat = plt.gca().xaxis.get_major_formatter()
  fmat.base(2)
  loc = plt.gca().xaxis.get_major_locator()
  loc.base(2)

I'm afraid I'm quite out of my element with these guys, maybe
someone else chimes in with another approach. Do post again to
clarify what you want.

Note that by default, the minor_formatter is set to be a
NullFormatter, thus no labels will be placed at the minor tick
locations. That would be a reasonable way to proceed - set the
major ticks to be non-overlapping, and put the minor ones
everywhere else.

You've probably already found it, but just in case:
http://matplotlib.sourceforge.net/api/ticker_api.html

-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] colorbar with Axes3D for a set of collections?

2011-01-13 Thread Daniel Mader
Hi,

I am trying to plot a set of simulation results of FEM simulations.
With a lot of help from Ben I can plot the deformed shape quite nicely
but I have trouble in applying a colorbar to the plot.

In the attached file there are three results with different results.

How can I apply a "global" colorbar so that all collections are nicely
represented?

Thanks a lot in advance,
Daniel
import sys
import scipy,pylab
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D

##--
def closePolys(elements):
  '''
  close the open polygon elements by adding the first node of each poly again.
  '''
  closed = []
  for nodes in elements:
i = nodes[0]
ii = list(nodes)
ii.append(i)
closed.append(ii)
  return closed

elements = [ [ (0,0), (0,1), (1,1), (1,0) ],
  [ (4,1), (2,3), (2,2), (3,1)],
  [ (0,1), (2,3), (2,2), (1,1)],
  [ (3,0), (3,1), (4,1), (4,0)]]
tmp = scipy.array([1,1.1,0.9,1])
data = [tmp, tmp*2, tmp*4]

## workaround for bug in mpl: close polys manually, no auto-closing!
polys = closePolys(elements)

##--
fig = pylab.figure()
ax = Axes3D(fig)

stacks = 3
zpos = scipy.arange(stacks)

collist = []
for i in range(stacks):
  col = mpl.collections.PolyCollection(polys, linewidths=0.05, closed=False)
  col.set_array(data[i])
  collist.append(col)

for i,col in enumerate(collist):
  col.set_cmap(mpl.cm.cool)
  ## get number of elements per collection
  elemno = len(col.get_paths())
  ## create *iterable* for the 3D collection slices [z,z,z,...,z]
  zs = [zpos[i]]*elemno
  col.autoscale()
  ## collection transparency (opaque == 1), needed for projection bug workaround!
  col.set_alpha(0.3)

  ax.add_collection3d(col, zs=zs, zdir='y')
  pylab.draw()

## colorbar:
cb = pylab.colorbar(mappable=collist[-1], drawedges=False, shrink=0.55)#, aspect=5)
cb.set_cmap(mpl.cm.cool)
cb.set_label('colorbar label')
## alternative:
#collist[-1].set_cmap(mpl.cm.cool)
#fig.colorbar(collist[-1], shrink=0.85)#, aspect=5)

## axis limit settings:
ax.set_xlim3d(0,4)
ax.set_zlim3d(0,3)
ax.set_ylim3d(-0.1,stacks-1+0.1)

## labels:
ax.set_title('Transparency workaround')
ax.set_xlabel('x')
ax.set_ylabel('slice')
ax.set_zlabel('y')

##--
pylab.show()
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] sensible tick labels for log scale (rephrased)

2011-01-13 Thread Chris Fonnesbeck
Sorry for the lack of clarity in my last shot at this problem. What I want to 
be able to do is change a plot's axis to the log scale, then have some 
reasonable (i.e. evenly-spaced) tick labels generated automatically. I have 
tried to do this manually, but end up with the following:

http://cl.ly/3h1T2i0a0T3X0K2b3W11

After Paul's answer to the original message, I have tried messing with the 
major_locator:

ml = MultipleLocator(0.2)
ax.xaxis.set_major_locator(ml)

with different values for the MultipleLocator. Though the ticks do change, I 
only am able to see labels such as 10^0, 10^1, etc. -- I need better labels 
than that, such as [0, 0.3, 0.5, 1, 2, 4, 7] -- these are good values, because 
they are unlikely to overlap on the log scale. It will be a pain, however, to 
do this manually for every plot, so I am looking for a way to automate this 
somehow. I was hoping (and still hope) that Matplotlib is able to choose 
reasonable ticks on the log scale that do not overlap, but are more informative 
than just powers of 10.

Hope that is clearer,
cf



--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem (bug?) with mpl_toolkits.mplot3d.Axes3D

2011-01-13 Thread Daniel Mader
Dear Ben,

again, thanks for all your support! Still, I am unable to get the plot
done. In your example, each set of elements gets a color where as I
need each element to have its own color.

I'll attach a file to demonstrate. Maybe you know how to get this
done, and sorry that I am a bit slow on this :(

Best regards,
Daniel
import sys
import scipy,pylab
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D

##--
def closePolys(elements):
  '''
  close the open polygon elements by adding the first node of each poly again.
  '''
  closed = []
  for nodes in elements:
i = nodes[0]
ii = list(nodes)
ii.append(i)
closed.append(ii)
  return closed

elements = [ [ (0,0), (0,1), (1,1), (1,0) ],
  [ (4,1), (2,3), (2,2), (3,1)],
  [ (0,1), (2,3), (2,2), (1,1)],
  [ (3,0), (3,1), (4,1), (4,0)]]
data = scipy.rand(4)

polys = closePolys(elements)

##--
colors = ['r', 'g', 'b', 'y', 'k']
zpos = [0,1,2,3,4]
zs = []
cs = []
for z, c in zip(zpos, colors) :
zs.extend([z] * len(polys))
cs.extend([c] * len(polys))

allPolys = polys * len(zpos)

poly = mpl.collections.PolyCollection(allPolys, linewidth=0.25, closed=False)
#poly.set_color('r')
poly.set_color(cs)

fig = pylab.figure()
ax = Axes3D(fig)
ax.add_collection3d(poly, zs=zs, zdir='y')

## axis limit settings:
ax.set_xlim3d(0,4)
ax.set_zlim3d(0,3)
ax.set_ylim3d(0,4)

## labels:
ax.set_title('Works')
ax.set_xlabel('x')
ax.set_ylabel('slice')
ax.set_zlabel('y')

##--
fig = pylab.figure()
ax = Axes3D(fig)

stacks = 3
zpos = scipy.arange(stacks)

collist = []
for i in range(stacks):
  col = mpl.collections.PolyCollection(polys, linewidths=0.05, closed=False) # thin elements lines (good for bw plot)
  col.set_array(data)
  collist.append(col)

for i,col in enumerate(collist):
  col.set_cmap(mpl.cm.cool)
  ## get number of elements per collection
  elemno = len(col.get_paths())
  ## create *iterable* for the 3D collection slices [z,z,z,...,z]
  zs = [zpos[i]]*elemno
  col.autoscale()
  ax.add_collection3d(col, zs=zs, zdir='y')
  pylab.draw()

## axis limit settings:
ax.set_xlim3d(0,4)
ax.set_zlim3d(0,3)
ax.set_ylim3d(-0.1,stacks-1+0.1)

## labels:
ax.set_title('Doesn\'t work')
ax.set_xlabel('x')
ax.set_ylabel('slice')
ax.set_zlabel('y')

##--
pylab.show()
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] sensible tick labels for log scale?

2011-01-13 Thread Chris Fonnesbeck
On Jan 12, 2011, at 10:33 PM, Paul Ivanov wrote:
> In [50]: plt.loglog(1,1)
> Out[50]: []
> 
> In [51]: ax = plt.gca()
> 
> In [52]: loc = ax.xaxis.get_major_locator()
> 
> In [53]: loc.numticks
> Out[53]: 15
> 
> In [54]: loc.numticks = 10

Also, this approach does not seem to work in general for me. As an example:

In [49]: loglog([1.341, 0.1034, 0.6076, 1.4278, 0.0374], 
   :  [0.37, 0.12, 0.22, 0.4, 0.08], 'o')

In [50]: loc = ax.xaxis.get_minor_locator()

In [51]: loc.numticks=10

In [52]: loc.numticks=5


This does nothing to change the number of minor ticks, and I tried the same 
thing for get_major_locator(), with the same result. The plot does not change 
at all.

Thanks,
cf

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Font not carrying through Py2Exe

2011-01-13 Thread Michael Droettboom
On 01/13/2011 11:38 AM, Alex S wrote:
> Hi there,
> I've made a program that makes plots using New Century Schoolbook Lt Std
> font.  I did this by inserting this into the matplotlibrc file:
>
> font.family :  New Century Schoolbook LT Std # serif #sans-serif
>
> There's also a "fontlist.cache" file that I think points to it when it says:
>
> .
> .
> .
> (dp283
> g12
> g45
> sg14
> S'New Century Schoolbook LT Std'
> p284
> sg16
> I400
> sg17
> g13
> sg18
> .
> .
> .
>
> This all works fine on my computer.  But I'm trying to make it run on other
> people's computers (off a network drive) but when I do the plots all go back
> into Ariel font and all the spacing and stuff gets screwed up.  Running the
> exact same exe from the same place, my computer continues to make them with
> the correct font.  I have copied the matplotlibrc file and the
> fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data
> folder in the dist folder (from py2exe) but that didn't work.
>
> Does anyone have any ideas for fixing this stuff?  I think it might just be
> a matter of including the right files in the Py2Exe setup file but I don't
> know which ones.  Or maybe changing how I select the font, which was a
> roundabout way of doing it from the start.
The fontList.cache file maps from the properties (names, weights, 
slants) etc. of the fonts available on a particular system to their file 
path.  You should definitely not ship this file with the exe, but rather 
allow it to be regenerated from scratch on each system, since the 
selection and locations of fonts is very likely to be different.

I think "New Century Schoolbook" is one of the fonts that ships with 
Windows, so you can probably count on it being there.  If not, you need 
to ship the font as part of the exe by adding it to mpl-data/fonts/ttf 
and then following the instructions to include the fonts given here:

http://www.py2exe.org/index.cgi/MatPlotLib
>When I run the plots
> (successfully on my computer) it says this at one point:
>
> c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982:
> UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into a
> Type 3 font. The entire font will be embedded in the output.
>
> Maybe that has somethign to do with what's going on?
>
I don't think that's related.  All this means is that when it embeds the 
font into the PDF file, it has to embed the entire thing rather than 
only the characters that are being used.  (Resulting in a larger PDF 
file, but otherwise fine.)  To avoid this message, you can set the 
rcParam "pdf.fonttype" to 42.

Cheers,
Mike
>
>
> Thanks a lot,
> Alex
>


-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Font not carrying through Py2Exe

2011-01-13 Thread Alex S

Hi there,
I've made a program that makes plots using New Century Schoolbook Lt Std
font.  I did this by inserting this into the matplotlibrc file:

font.family :  New Century Schoolbook LT Std # serif #sans-serif

There's also a "fontlist.cache" file that I think points to it when it says:

.
.
.
(dp283
g12
g45
sg14
S'New Century Schoolbook LT Std'
p284
sg16
I400
sg17
g13
sg18
.
.
.

This all works fine on my computer.  But I'm trying to make it run on other
people's computers (off a network drive) but when I do the plots all go back
into Ariel font and all the spacing and stuff gets screwed up.  Running the
exact same exe from the same place, my computer continues to make them with
the correct font.  I have copied the matplotlibrc file and the
fontlist.cache file from my hard drive (C:...Matplotlib) to the mpl-data
folder in the dist folder (from py2exe) but that didn't work.  

Does anyone have any ideas for fixing this stuff?  I think it might just be
a matter of including the right files in the Py2Exe setup file but I don't
know which ones.  Or maybe changing how I select the font, which was a
roundabout way of doing it from the start.  When I run the plots
(successfully on my computer) it says this at one point:

c:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.py:982:
UserWarning: 'newcenturyschlbkltstd-roman.otf' can not be subsetted into a
Type 3 font. The entire font will be embedded in the output.

Maybe that has somethign to do with what's going on?



Thanks a lot,
Alex
-- 
View this message in context: 
http://old.nabble.com/Font-not-carrying-through-Py2Exe-tp30663871p30663871.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Memory usage

2011-01-13 Thread Benjamin Root
On Thu, Jan 13, 2011 at 7:54 AM, CASOLI Jules  wrote:

> Hello to all,
>
> This is yet another question about matplotlib not freeing memory, when
> closing a figure (using close()).
> Here is what I'm doing (tried with several backends, on MacOSX and Linux,
> with similar results):
> 
> import matplotlib as mpl
> from matplotlib import pylot as plt
> import numpy as np
>
> a = np.arange(100)
> mpl.cbook.report_memory()
> # -> output: 54256
> plt.plot(a)
> mpl.cbook.report_memory()
> # -> output: 139968
> plt.close()
> mpl.cbook.report_memory()
> # -> output: 138748
> 
>
> Shouldn't plt.close() close the figure _and_ free the memory used by it?
> What am I doing wrong ?
> I tried several other ways to free the memory, such as f = figure(); ... ;
> del f, without luck.
>
> Any help appreciated !
>
> P.S. : side question : how come the call to plot take so much memory (90MB
> for a 8MB array ?). I have read somewhere that each point is coded on three
> RGB floats, but it only means an approx. 12MB plot... (plus small overhead)
>
> Jules
>
>
>
Jules,

Which version of Matplotlib are you using and which backend?  On my Linux
install of matplotlib (development branch) using GTKAgg, the memory usage
does get high during the call to show(), but returns to (near) normal
amounts after I close.  An interesting observation is that if the
interactive mode is off, the memory usage returns back to just a few
kilobytes above where it was before, but if interactive mode was turned on,
the memory usage returned to being a few hundred kilobytes above where it
started.

Ben Root

P.S. - As a side note, estimating the memory size of these plots from the
given data isn't as straight-forward as multiplying by three (actually, it
would be four because of the transparency value in addition to rgb).  There
are many other parts of the graph that needs to be represented (all having
rgba values) but there are also a lot of simplifications that are done to
reduce the amount of memory needed to represent these objects.
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Memory usage

2011-01-13 Thread CASOLI Jules
Hello to all,

This is yet another question about matplotlib not freeing memory, when closing 
a figure (using close()).
Here is what I'm doing (tried with several backends, on MacOSX and Linux, with 
similar results):

import matplotlib as mpl
from matplotlib import pylot as plt
import numpy as np

a = np.arange(100)
mpl.cbook.report_memory()
# -> output: 54256
plt.plot(a)
mpl.cbook.report_memory()
# -> output: 139968
plt.close()
mpl.cbook.report_memory()
# -> output: 138748


Shouldn't plt.close() close the figure _and_ free the memory used by it?
What am I doing wrong ?
I tried several other ways to free the memory, such as f = figure(); ... ; del 
f, without luck.

Any help appreciated !

P.S. : side question : how come the call to plot take so much memory (90MB for 
a 8MB array ?). I have read somewhere that each point is coded on three RGB 
floats, but it only means an approx. 12MB plot... (plus small overhead)

Jules




--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with matplotlib 1.0.1 and psfrag (LaTeX)

2011-01-13 Thread Michael Droettboom

The change in behavior was to fix this bug:

http://sourceforge.net/tracker/?func=detail&aid=3062773&group_id=80706&atid=560720

It seems it may be impossible to produce Postscript that works across 
all fonts and all readers at the same time.


Can you provide a simple LaTeX document that illustrates the problem 
with psfrag?  This is still compliant Postscript, AFAICT.


Mike

On 01/11/2011 10:43 AM, Benjamin Root wrote:



On Tue, Jan 11, 2011 at 8:45 AM, Lebostein > wrote:



I have compared the new and old output. For example the "0.0" in a
diagram:

old eps (1.0.0):

35.223 19.934 m
0 0.141 rmoveto
(0.0) show
[1 2] 0 setdash
0.502 setgray

new eps (1.0.1):

35.222810 19.933563 translate
0.00 rotate
0.00 0.140625 m /zero glyphshow
6.362305 0.140625 m /period glyphshow
9.541016 0.140625 m /zero glyphshow
grestore
[1 2] 0 setdash
0.502 setgray

...


Ah, this bit me yesterday as well.  I wanted to edit some labels using 
InkScape and it became easier to just modify my original script and 
just re-make the image.  I know there were some "fixes" recently, but 
I don't know the specifics.


Ben Root


--
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl


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



--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting arial bold font

2011-01-13 Thread Michael Droettboom
Do you have Arial installed?  (I see you are on Linux, so it's unlikely 
to have been installed by default -- that font is shipped with Windows 
and copyright Microsoft).  If it is installed, you may need to clear 
your matplotlib font cache in ~/.matplotlib/fontList.cache.


Mike

On 01/13/2011 05:42 AM, Bala subramanian wrote:

Friends,
The journal in which i am planning to send my paper says that the 
figure and panel labels should be in 'ARIAL' bold.


When i try to set the font as arial, i get a warning message. Someone 
kindly let me know what is the appropriate setting to get the font 
arial bold.


/usr/lib/python2.5/site-packages/matplotlib/font_manager.py:1242: 
UserWarning: findfont: Font family ['sans-serif'] not found. Falling 
back to Bitstream Vera Sans (prop.get_family(), 
self.defaultFamily[fontext]))



FIG=plt.figure(figsize=(6.8,4),dpi=200)
FIG.subplots_adjust(hspace=0.02,wspace=0.02)
NROW=2;NCOL=2
TXT=['A','B','C','D']
mpl.rcParams['font.sans-serif']='Arial'

# Block 1
ax1=FIG.add_subplot(NROW,NCOL,1)
data1=np.loadtxt(flist[0],usecols=(1,)); 
m1=round(np.mean(data1[10001:]),2)
data2=np.loadtxt(flist[1],usecols=(1,)); 
m2=round(np.mean(data2[10001:]),2)

ax1.plot(data1,color='black',label=str(m1))
ax1.plot(data2,color='red',label=str(m2))
plt.setp(ax1.get_xticklabels(),visible=False)




--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl


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



--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] setting arial bold font

2011-01-13 Thread Bala subramanian
Friends,
The journal in which i am planning to send my paper says that the figure and
panel labels should be in 'ARIAL' bold.

When i try to set the font as arial, i get a warning message. Someone kindly
let me know what is the appropriate setting to get the font arial bold.

/usr/lib/python2.5/site-packages/matplotlib/font_manager.py:1242:
UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to
Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext]))


FIG=plt.figure(figsize=(6.8,4),dpi=200)
FIG.subplots_adjust(hspace=0.02,wspace=0.02)
NROW=2;NCOL=2
TXT=['A','B','C','D']
mpl.rcParams['font.sans-serif']='Arial'

# Block 1
ax1=FIG.add_subplot(NROW,NCOL,1)
data1=np.loadtxt(flist[0],usecols=(1,)); m1=round(np.mean(data1[10001:]),2)
data2=np.loadtxt(flist[1],usecols=(1,)); m2=round(np.mean(data2[10001:]),2)
ax1.plot(data1,color='black',label=str(m1))
ax1.plot(data2,color='red',label=str(m2))
plt.setp(ax1.get_xticklabels(),visible=False)

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bug in boxplot/mlab.prctile

2011-01-13 Thread Jochen Deibele
Hi!

 > I noticed that the boxplot function incorrectly calculates the
 > location of the median line in each box.  As a simple example,
 > plotting
 > the dataset [1, 2, 3, 4] incorrectly plots the median line at 3.
I can confirm this.

 > [..]
 > I would suggest that mlab.prctile be fixed to conform to some one
 > or other of these methods, rather than adding to the proliferation of
 > approaches to quantile-calculation.  Is there any motivation for
 > always truncating to integer (other that "it's quicker to type" :-)?
And I agree here. I also recently (before I noticed this thread) posted 
a bug report #3151034 [1]

There is also documented, that the mlab.prctle function does not yield 
the same results as scipy.stats.scoreatpercentile. In addition to make 
the confusion complete matlab reports yet another result ... But I think 
at least matplotlib and the scipy-stats-package should agree.

Jochen


[1] 
http://sourceforge.net/tracker/?func=detail&aid=3151034&group_id=80706&atid=560720



-- 
Jochen Deibele, PhD candidate, Dipl.-Ing.
Department of Circulation and Medical Imaging
Norwegian University of Science and Technology (NTNU)
Phone: +47 728 28028   E-Mail: jochen.deib...@ntnu.no

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Hidding plots

2011-01-13 Thread Paul Ivanov

Salvador Benimeli, on 2011-01-13 10:10,  wrote:
> I would like to known if it is possible to hide a plot from a graph.
> 
> For example, I have the following python code:
> 
> for i in range(0,len(self.data):
> ..
> c = np.array(s[i])
> self.axes.plot_date(t[i],c,self.colors[i],label=self.labels[i])
> .
> 
> currently this code "draws" to plots on the canvas. The question is if its
> possible to hide/unhide a plot while remains the other.

Hi Salvador,

yes, it is possible. Just save the list plot_date returns, and
then call set_visible(False) on every member of that list.

  lines = plot_date([2000.10,2000.20,2000.30],[1,2,3])
  [l.set_visible(False) for l in lines]

or something like this to toggle visibility on and off

  [l.set_visible(not l.get_visible()) for l in lines]

 
best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Hidding plots

2011-01-13 Thread Salvador Benimeli
Hello,

I would like to known if it is possible to hide a plot from a graph.

For example, I have the following python code:

for i in range(0,len(self.data):
..
c = np.array(s[i])
self.axes.plot_date(t[i],c,self.colors[i],label=self.labels[i])
.

currently this code "draws" to plots on the canvas. The question is if its
possible to hide/unhide a plot while remains the other.

Thaks a lot.
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users