Re: [Matplotlib-users] [newbie] 2 problems: a) CJK, b) adding letters to points

2010-03-16 Thread David

Dear Gökhan,

thanks a lot for your reply and help! I could solve some of my problems, 
others remain elusive.


On 16/03/10 07:59, Gökhan Sever wrote:

Probably you need a unicode font-set that contain all the characters for
those alphabets. You can look at this example to see a simple unicode
demonstration example.


Yes, I have done that, for example:

ylab = plt.ylabel(u'输入 2')


Make sure you are using the right font in your matplotlib.


Well, here I get stuck. I checked the fontList.cache, and all the 
relevant CJK fonts are listed in there.
I then added some CJK font names to my /etc/matplotlibrc: (I am using 
Ubuntu 9.10)


#font.sans-serif : SimHei, Adobe Song Std, Bitstream Vera Sans, ...
#font.cursive: Apple Chancery, ...
#font.fantasy: Comic Sans MS, ...
#font.monospace  : Adobe Fangsong Std, Bitstream Vera Sans Mono, ...

In addition, I also defined

rcParams['font.sans-serif'] = ['SimHei']

in my Python code (attached).

All to no avail. I am at a loss. I would greatly appreciate some help here!



You have to adjust your label to get it seen. You may try with:

xlab = plt.xlabel(my x-axes label)
xlab.set_position((0.2, 0.1))


This did not yield any results. With the above code, 
xlab.set_position((0.2, 0.1)), I change the position of the xlabel.
But the problem is that my graph is cut before the xlabel has a chance 
to appear (see dea.png). Basically the graph ends right after the 
x-axis. What I thus need is more whitespace under my x-axis. But how?




Two ways I can think of are: annotate and text functions of pyplot api.
http://matplotlib.sourceforge.net/api/pyplot_api.html


This worked fine! What I did was to define

text( 1, 4.2, u'A')

etc.

Thanks for your ideas and insights!

David
attachment: dea.png#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://suyonggui.blog.sohu.com/115269389.html
# http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html

import matplotlib.pyplot as plt
from pylab import *
#rcParams['figure.figsize'] = 3.56, 2.22
rcParams['figure.figsize'] = 3.6, 2.3
rcParams['axes.labelsize'] = 12.0
rcParams['font.sans-serif'] = ['SimHei']


label = ('A', 'B', 'C', 'E')
shuru1 = [1, 2, 4, 5]
shuru2 = [4, 2, 1, 1]

plt.plot([0,3], [0,3], 'k--', lw=1)
plt.plot([3], [3], 'ko', ms=4)
plt.plot(shuru1, shuru2, 'k-', lw=1)
plt.plot(shuru1, shuru2, 'ko', ms=4)

plt.axis([0, 6, 0, 5])

# plt.title('Title')
xlab = plt.xlabel(u'输入 1')
xlab.set_position((0.2, 0.1))
ylab = plt.ylabel(u'输入 2')

text( 1, 4.2, u'A')
text( 1.95, 2.2, u'B')
text( 4, 1.2, u'C')
text( 5, 1.2, u'E')
text( 3, 3.2, u'D')

plt.grid(True)
plt.show()
plt.savefig('dea.png')
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [ANN] EuroPython 2010 registration and talk submissions now open!

2010-03-16 Thread Ciarán Mooney
EuroPython 2010 - 17th to 24th July 2010

EuroPython is a conference for the Python programming language
community, including the Django, Zope and Plone communities. It is
aimed at everyone in the Python community, of all skill levels, both
users and programmers.

Last year's conference was the largest open source conference in the
UK and one of the largest community organised software conferences in
Europe.

This year EuroPython will be held from the 17th to 24th July in
Birmingham, UK. It will include over 100 talks, tutorials, sprints and
social events.

Registration

Registration is open now at: http://www.europython.eu/registration/

For the best registration rates, book as soon as you can! Extra Early
Bird closes soon, after which normal Early Bird rate will apply until
10th May

Talks, Activities and Events

Do you have something you wish to present at EuroPython? You want to
give a talk, run a tutorial or sprint?
Go to http://www.europython.eu/talks/cfp/ for information and advice!
Go to http://wiki.europython.eu/Sprints to plan a sprint!

Help Us Out
---
EuroPython is run by volunteers, like you! We could use a hand, and
any contribution is welcome.
Go to http://wiki.europython.eu/Helping to join us!
Go to http://www.europython.eu/contact/ to contact us directly!

Sponsors

Sponsoring EuroPython is a unique opportunity to affiliate with this
prestigious conference and to reach a large number of Python users
from computing professionals to academics, from entrepreneurs to
motivated and well-educated job seekers.
http://www.europython.eu/sponsors/

Spread the Word
---
We are a community-run not-for-profit conference. Please help to
spread the word by distributing this announcement to colleagues,
project mailing lists, friends, your blog, Web site, and through your
social networking connections. Take a look at our publicity resources:
http://wiki.europython.eu/Publicity

General Information
---
For more information about the conference, please visit the official
site: http://www.europython.eu/

Looking forward to see you!
The EuroPython Team

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Alpha compositing of ~60000 line p lots takes forever

2010-03-16 Thread Jon Olav Vik
I want to overlay many line plots using alpha transparency. However, plotting 
them in Matplotlib takes about O(n**2) time, and I think I may be running into 
memory limitations as well.

As a simple benchmark, I used IPython to run alco.ipy (below), which runs 
alco.py for an increasing number of data series. Extrapolating from this, 
plotting 6 series would take something like 200 minutes. This is similar to 
my actual use case, which takes about 3 hours to finish a plot. Zooming in and 
saving again is much faster, taking only about 30 seconds.

I would appreciate suggestions on how to speed this up. For instance:

Is there a memoryless canvas object that I could draw on, just accumulating 
the alpha in each pixel: new_alpha = old_alpha + (1 - old_alpha) * this_alpha.

Failing that, I could do it manually by keeping a Numpy array of the pixels in 
the image. For each series, find the x values corresponding to each column 
index, then interpolate to find the row index corresponding to each y value. 
Finally, use imshow() or something to add axes and annotation.

That you in advance for any help.

Best regards,
Jon Olav

== Output of alco.ipy ==

The columns are number of series and seconds.

In [8]: run alco.ipy
1000 9.07
2000 24.8
3000 44.73
4000 67.85
5000 95.67
6000 135.1
7000 177.82
8000 226.03
9000 278.32
1 340.81

== alco.ipy ==

n, t = [], []
for i in range(1000, 10001, 1000):
n.append(i)
ti = !python alco.py $i
t.append(float(ti.s))
print n[-1], t[-1]

plot(n, t, '.-')

== alco.py ==

Alpha compositing of line plots. Usage: python alco.py NSERIES ALPHA
from sys import argv
import numpy as np
import matplotlib as mpl
mpl.use(agg) # noninteractive plotting
from pylab import *

n = int(argv[1])
try:
alpha = float(argv[2])
except IndexError:
alpha = 0.02

# generate some data
x = np.arange(200)
for i in range(n):
y = np.sin(x / (2 * np.pi * x[-1] * i))
plot(x, y, 'k-', alpha=alpha)

savefig(test.png)



--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Alpha compositing of ~60000 line plots takes forever

2010-03-16 Thread Jae-Joon Lee
If you're plotting lots of lines, do not use plot but use
LineCollection instead.

http://matplotlib.sourceforge.net/examples/api/collections_demo.html

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

Here is slightly modified version of your code that uses
LineCollection (but I haven't check if the code is correct).
With my not so good macbook, it took me 3 sec for 6000 lines and it
seems like O(n) to me.

Regards,

-JJ



ax = subplot(111)
x = np.arange(200)
yy = [np.array((x, np.sin(x / (2 * np.pi * x[-1] * i) for i in range(n)]
yyt = [np.transpose(y1) for y1 in yy]
from matplotlib.collections import LineCollection

lc = LineCollection(yyt, colors=[(0, 0, 0, alpha)])
ax.add_collection(lc)
ax.autoscale_view()


On Tue, Mar 16, 2010 at 7:26 AM, Jon Olav Vik jono...@gmail.com wrote:
 I want to overlay many line plots using alpha transparency. However, plotting
 them in Matplotlib takes about O(n**2) time, and I think I may be running into
 memory limitations as well.

 As a simple benchmark, I used IPython to run alco.ipy (below), which runs
 alco.py for an increasing number of data series. Extrapolating from this,
 plotting 6 series would take something like 200 minutes. This is similar 
 to
 my actual use case, which takes about 3 hours to finish a plot. Zooming in and
 saving again is much faster, taking only about 30 seconds.

 I would appreciate suggestions on how to speed this up. For instance:

 Is there a memoryless canvas object that I could draw on, just accumulating
 the alpha in each pixel: new_alpha = old_alpha + (1 - old_alpha) * this_alpha.

 Failing that, I could do it manually by keeping a Numpy array of the pixels in
 the image. For each series, find the x values corresponding to each column
 index, then interpolate to find the row index corresponding to each y value.
 Finally, use imshow() or something to add axes and annotation.

 That you in advance for any help.

 Best regards,
 Jon Olav

 == Output of alco.ipy ==

 The columns are number of series and seconds.

 In [8]: run alco.ipy
 1000 9.07
 2000 24.8
 3000 44.73
 4000 67.85
 5000 95.67
 6000 135.1
 7000 177.82
 8000 226.03
 9000 278.32
 1 340.81

 == alco.ipy ==

 n, t = [], []
 for i in range(1000, 10001, 1000):
    n.append(i)
    ti = !python alco.py $i
    t.append(float(ti.s))
    print n[-1], t[-1]

 plot(n, t, '.-')

 == alco.py ==

 Alpha compositing of line plots. Usage: python alco.py NSERIES ALPHA
 from sys import argv
 import numpy as np
 import matplotlib as mpl
 mpl.use(agg) # noninteractive plotting
 from pylab import *

 n = int(argv[1])
 try:
    alpha = float(argv[2])
 except IndexError:
    alpha = 0.02

 # generate some data
 x = np.arange(200)
 for i in range(n):
    y = np.sin(x / (2 * np.pi * x[-1] * i))
    plot(x, y, 'k-', alpha=alpha)

 savefig(test.png)



 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] 2 problems: a) CJK, b) adding letters to points

2010-03-16 Thread Jae-Joon Lee
On Tue, Mar 16, 2010 at 3:30 AM, David ld...@gmx.net wrote:
 On 16/03/10 07:59, Gökhan Sever wrote:

 Probably you need a unicode font-set that contain all the characters for
 those alphabets. You can look at this example to see a simple unicode
 demonstration example.

 Yes, I have done that, for example:

 ylab = plt.ylabel(u'输入 2')

if you use tex for rendering text, see

http://matplotlib.sourceforge.net/users/usetex.html#usetex-with-unicode

If not, the best option I know of is to set the font name directly, see

http://old.nabble.com/Russian-labels-without-LaTeX-td24538302.html

Matplotlib does not support fontset, so you can only use glyphs in the
font you specified.

Regards,

-JJ

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] 2 problems: a) CJK, b) adding letters to points

2010-03-16 Thread Jae-Joon Lee
On Tue, Mar 16, 2010 at 3:30 AM, David ld...@gmx.net wrote:
 This did not yield any results. With the above code, xlab.set_position((0.2,
 0.1)), I change the position of the xlabel.
 But the problem is that my graph is cut before the xlabel has a chance to
 appear (see dea.png). Basically the graph ends right after the x-axis. What
 I thus need is more whitespace under my x-axis. But how?

adjust your subplot parameters.

plt.subplots_adjust(bottom=0.2)

see

http://matplotlib.sourceforge.net/faq/howto_faq.html#move-the-edge-of-an-axes-to-make-room-for-tick-labels

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

-JJ

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how can I show some figures, but not others?

2010-03-16 Thread Nick Schurch
I have a script that calls several subroutines, each of which makes a
different figure. One of these routines makes lots of figures for use
in a webpage, all of which are saved as they are made. When I call
show() at the end of the script it is showing all the figures (as one
might expect), but what I really want is only some of the figures to
be brought up in the GUI. Is there a way of specifying which figures
show() shows (I can't find anything on the webpage)?

-- 
Cheers,

Nick Schurch

Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK

Tel: +44 1382 388707
Fax: +44 1382 345 893

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Alpha compositing of ~60000 line p lots takes forever

2010-03-16 Thread Jon Olav Vik
Jae-Joon Lee lee.j.j...@... writes:

 If you're plotting lots of lines, do not use plot but use
 LineCollection instead.
 
 http://matplotlib.sourceforge.net/examples/api/collections_demo.html
 
 http://matplotlib.sourceforge.net/api/
collections_api.html#matplotlib.collections.LineCollection
 
 Here is slightly modified version of your code that uses
 LineCollection (but I haven't check if the code is correct).
 With my not so good macbook, it took me 3 sec for 6000 lines and it
 seems like O(n) to me.

Thank you, thank you, thank you.

This is just as convenient, 50% faster even for 1000 series, and runtime does 
indeed scale as O(n) up to 1 series. The projected speedup for 6 series 
was 40x. However, in my actual use case it was at least 400x: Finishing in 2 
min 17 sec rather than not getting past halfway in 16 hours.

(The extra difference is probably due to better memory usage. Still, 
LineCollection requires O(n) memory, whereas manually updating a bitmap would 
only use O(1) memory, where 1 = size of bitmap. However, I hope I never have to 
do that...)

May the hours and hours you have saved me be added to your life! 8-)

Jon Olav



--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how can I show some figures, but not others?

2010-03-16 Thread Matthias Michler
On Tuesday 16 March 2010 14:17:26 Nick Schurch wrote:
 I have a script that calls several subroutines, each of which makes a
 different figure. One of these routines makes lots of figures for use
 in a webpage, all of which are saved as they are made. When I call
 show() at the end of the script it is showing all the figures (as one
 might expect), but what I really want is only some of the figures to
 be brought up in the GUI. Is there a way of specifying which figures
 show() shows (I can't find anything on the webpage)?

You can close some of the figures before calling show:

pyplot.close(fig)
or
pyplot.close(fig_number)

Kind regards,
Matthias

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Alpha compositing of ~60000 line plots takes forever

2010-03-16 Thread John Hunter
On Tue, Mar 16, 2010 at 8:46 AM, Jon Olav Vik jono...@gmail.com wrote:

 Thank you, thank you, thank you.

 This is just as convenient, 50% faster even for 1000 series, and runtime does
 indeed scale as O(n) up to 1 series. The projected speedup for 6 
 series
 was 40x. However, in my actual use case it was at least 400x: Finishing in 2
 min 17 sec rather than not getting past halfway in 16 hours.

 (The extra difference is probably due to better memory usage. Still,
 LineCollection requires O(n) memory, whereas manually updating a bitmap would
 only use O(1) memory, where 1 = size of bitmap. However, I hope I never have 
 to
 do that...)

 May the hours and hours you have saved me be added to your life! 8-)

Since you are granting extra life blessings, I thought I should add
something to the mix.  You should be able to achieve something close
to this using the animation blit API.  There is a little hackery at
the end to use the renderer to directly dump a PNG and thereby
circumvent the normal figure.canvas.draw pipeline, but the advantage
is you render directly to the canvas and save no intermediaries.  See
the examples and tutorial at

  http://matplotlib.sourceforge.net/examples/animation/index.html
  http://www.scipy.org/Cookbook/Matplotlib/Animations

Here's some example code::

import matplotlib._png as _png
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)

n = 1
line, = ax.plot([],[], alpha=1)

x = np.arange(200)

fig.canvas.draw()
ax.axis([0, 200, -1, 1])
for i in range(n):
if (i%100)==0: print i
yy = np.sin(x / (2 * np.pi * x[-1] * i))

line.set_data(x, yy)
ax.draw_artist(line)


fig.canvas.blit(ax.bbox)

filename = 'test.png'
renderer = fig.canvas.get_renderer()
_png.write_png(renderer._renderer.buffer_rgba(0, 0),
   renderer.width, renderer.height,
   filename, fig.dpi)



JDH

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to create 3D plots?

2010-03-16 Thread Alexander Dietz
Hi,

I would like to create 3D plots. A search revealed the following page:

http://www.scipy.org/Cookbook/Matplotlib/mplot3D

which explains to install  matplotlib version 0.99 to use the 3D code.
Unfortunately, after installingmatplotlib-0.99.1.1 (from
matplotlib-0.99.1.2.tar.gz) I am not able to use the 3D code. The
command that show that the correct version is used together with the
error is shown below.

Any idea how I can use this code? Do I have to downgrade to the 0.91.x
maintenance branch? Or do you suggest to use mayavi
(http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html)?
I also tried to install the latter, after 1 hour of installing code
and requirements and cmake and easyinstall.. I got the error that VTK
is not installed. So: Any idea how to create a simple 3D scatter plot,
seen from any arbitrary angle?

Thanks
  Alex



In [1]: import matplotlib

In [2]: matplotlib.__version__
Out[2]: '0.99.1.1'

In [3]: import matplotlib.axes3d as p3
---
NotImplementedError   Traceback (most recent call last)

/home/alex/Documents/Job/Travel/2010-03_LSC_Pasadena/3D/ipython
console in module()

/usr/lib/python2.6/site-packages/matplotlib/axes3d.py in module()
 1 raise NotImplementedError('axes3d is not supported in
matplotlib-0.98.  You may want to try the 0.91.x maintenance branch')

NotImplementedError: axes3d is not supported in matplotlib-0.98.  You
may want to try the 0.91.x maintenance branch

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to create 3D plots?

2010-03-16 Thread Pierre de Buyl
Hello,

Unfortunately, the mplot3D page on the SciPy cookbook is not up to date.
The 3D code in mplot3d has been moved to a toolkit and needs to be  
imported as is seen in the examples found here:
http://matplotlib.sourceforge.net/examples/mplot3d/index.html

 So: Any idea how to create a simple 3D scatter plot,seen from any  
 arbitrary angle?

You can rotate the axis in mplot3d :-)

I would say from your error log (the file matplotlib/axes3d.py exists  
whereas it does not in my mpl 0.99.0) that you did not uninstall the  
old matplotlib cleanly. I suggest that you clean the existing  
matplotlib completely and reinstall from the tarball).

Pierre

Le 16 mars 10 à 00:38, Alexander Dietz a écrit :

 Hi,

 I would like to create 3D plots. A search revealed the following page:

 http://www.scipy.org/Cookbook/Matplotlib/mplot3D

 which explains to install  matplotlib version 0.99 to use the 3D code.
 Unfortunately, after installingmatplotlib-0.99.1.1 (from
 matplotlib-0.99.1.2.tar.gz) I am not able to use the 3D code. The
 command that show that the correct version is used together with the
 error is shown below.

 Any idea how I can use this code? Do I have to downgrade to the 0.91.x
 maintenance branch? Or do you suggest to use mayavi
 (http://code.enthought.com/projects/mayavi/docs/development/html/ 
 mayavi/mlab.html)?
 I also tried to install the latter, after 1 hour of installing code
 and requirements and cmake and easyinstall.. I got the error that VTK
 is not installed. So: Any idea how to create a simple 3D scatter plot,
 seen from any arbitrary angle?

 Thanks
   Alex



 In [1]: import matplotlib

 In [2]: matplotlib.__version__
 Out[2]: '0.99.1.1'

 In [3]: import matplotlib.axes3d as p3
 -- 
 -
 NotImplementedError   Traceback (most recent  
 call last)

 /home/alex/Documents/Job/Travel/2010-03_LSC_Pasadena/3D/ipython
 console in module()

 /usr/lib/python2.6/site-packages/matplotlib/axes3d.py in module()
  1 raise NotImplementedError('axes3d is not supported in
 matplotlib-0.98.  You may want to try the 0.91.x maintenance branch')

 NotImplementedError: axes3d is not supported in matplotlib-0.98.  You
 may want to try the 0.91.x maintenance branch

 -- 
 
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] savefig 0.91

2010-03-16 Thread Samuel Teixeira Santos
Hi folks

I'm using ubuntu 8.04 lts and matplotlib 0.91

I cannot upgrade in this moment.

On my app (for web) I fix several errors (because I did her in 0.99)

My last error (I think it is) is on savefig

It tells me that cannot open file

on log error, appears on write_png method.

Is this permission on directory? or a bug?


thanks in advanced
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How do you add contrasting text to color image

2010-03-16 Thread PaterMaximus

I have I have an image with both light and dark regions. I want to write text on
it in a color that contrasts with the underlying image color.

Right now if I make the text black, it is not very legible if the underling
color is dark. Similarly, if I make the text white, it is not legible if the
underlying color is light. (using gray text will not work)

One way to solve the problem would be to: 
-produce the image
e.g. im1=plt.imshow 
(zM,origin='lower',interpolation='hanning',extent=None)
-get the underlying color from the image where I want to place the text
Need help here. How do I get the color from im1
-calculate a contrasting color
Need help here
-plot the text in the contrasting color



Another way would be to use a font with a dark edge and light interior (or vice
versa) but I know of know such font for matplotlib.

Any help appreciated...




--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [newbie] 2 problems: a) CJK, b) adding letters to points

2010-03-16 Thread David
On 16/03/10 20:39, Jae-Joon Lee wrote:
 
  adjust your subplot parameters.
 
  plt.subplots_adjust(bottom=0.2)

Yep, that did the trick! thanks Jae-Joon and Gökhan!

David


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do you add contrasting text to color image

2010-03-16 Thread Jeff Whitaker

On 3/16/10 10:10 AM, PaterMaximus wrote:

I have I have an image with both light and dark regions. I want to write text on
it in a color that contrasts with the underlying image color.

Right now if I make the text black, it is not very legible if the underling
color is dark. Similarly, if I make the text white, it is not legible if the
underlying color is light. (using gray text will not work)

One way to solve the problem would be to:
-produce the image
e.g. im1=plt.imshow 
(zM,origin='lower',interpolation='hanning',extent=None)
-get the underlying color from the image where I want to place the text
Need help here. How do I get the color from im1
-calculate a contrasting color
Need help here
-plot the text in the contrasting color



Another way would be to use a font with a dark edge and light interior (or vice
versa) but I know of know such font for matplotlib.

Any help appreciated...
   


You could put your text inside a colored box - see e.g. 
http://matplotlib.sourceforge.net/users/text_intro.html 
http://matplotlib.sourceforge.net/users/text_intro.html?highlight=text%20box


-Jeff


--
Jeffrey S. Whitaker Phone  : (303)497-6313
Meteorologist   FAX: (303)497-6449
NOAA/OAR/PSD  R/PSD1Email  : jeffrey.s.whita...@noaa.gov
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] savefig 0.91

2010-03-16 Thread Michael Droettboom
Can you please post the entire traceback?

Mike

Samuel Teixeira Santos wrote:
 Hi folks

 I'm using ubuntu 8.04 lts and matplotlib 0.91

 I cannot upgrade in this moment.

 On my app (for web) I fix several errors (because I did her in 0.99)

 My last error (I think it is) is on savefig

 It tells me that cannot open file

 on log error, appears on write_png method.

 Is this permission on directory? or a bug?


 thanks in advanced
 

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 

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

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do you add contrasting text to color image

2010-03-16 Thread Jae-Joon Lee
On Tue, Mar 16, 2010 at 12:10 PM, PaterMaximus
patermaxi...@got2know.net wrote:
 Another way would be to use a font with a dark edge and light interior (or 
 vice
 versa) but I know of know such font for matplotlib.


FYI, the svn version of matplotlib supports this.

http://matplotlib.sourceforge.net/trunk-docs/examples/pylab_examples/patheffect_demo.html

Regards,

-JJ

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to 'rotate' a 3D plot?

2010-03-16 Thread Alexander Dietz
Hi,

I have successfully created a 3D scatter plot with mplot3d, but how
can I rotate the plot around e.g. the z-axis?

I do not want to use the user interface but I would like to use a
command to do that. But I could not find good documentation anywhere
and the commands attributed to the Axes3D also do not show anything
obvious.

Thanks
  Alex

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] savefig 0.91

2010-03-16 Thread Samuel Teixeira Santos
I fix it.

It was a dumb error

I using '\' on windows
and on ubuntu-linux I must use '/'...

sorry...
and thanks

2010/3/16 Michael Droettboom md...@stsci.edu

 Can you please post the entire traceback?

 Mike

 Samuel Teixeira Santos wrote:

 Hi folks

 I'm using ubuntu 8.04 lts and matplotlib 0.91

 I cannot upgrade in this moment.

 On my app (for web) I fix several errors (because I did her in 0.99)

 My last error (I think it is) is on savefig

 It tells me that cannot open file

 on log error, appears on write_png method.

 Is this permission on directory? or a bug?


 thanks in advanced
 


 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 

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



 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] savefig 0.91

2010-03-16 Thread Christopher Barker
Samuel Teixeira Santos wrote:
 I fix it.
 
 It was a dumb error
 
 I using '\' on windows
 and on ubuntu-linux I must use '/'...


note that '\' works in Windows for the most part. Or, better yet, use 
os.path.join() and friends.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to 'rotate' a 3D plot?

2010-03-16 Thread Ben Axelrod
There is an uncommented, and therefore undocumented function:

axes3d.view_init(elev, azim)

that you can use to rotate the axes.  If you have not already, I suggest you 
use the current SVN version of MPL instead of the 0.99.1 version.  Mplot3d has 
some more features in the trunk, but it is still rough around the edges.
 
-Ben



-Original Message-
From: Alexander Dietz [mailto:alexanderdie...@googlemail.com] 
Sent: Tuesday, March 16, 2010 1:25 PM
To: Matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] How to 'rotate' a 3D plot?

Hi,

I have successfully created a 3D scatter plot with mplot3d, but how can I 
rotate the plot around e.g. the z-axis?

I do not want to use the user interface but I would like to use a command to do 
that. But I could not find good documentation anywhere and the commands 
attributed to the Axes3D also do not show anything obvious.

Thanks
  Alex

--
Download Intel#174; Parallel Studio Eval Try the new software tools for 
yourself. Speed compiling, find bugs proactively, and fine-tune applications 
for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to 'rotate' a 3D plot?

2010-03-16 Thread Alexander Dietz
Thanks a lot, that seems to work!

Alex


On Tue, Mar 16, 2010 at 18:54, Ben Axelrod baxel...@coroware.com wrote:
 There is an uncommented, and therefore undocumented function:

 axes3d.view_init(elev, azim)

 that you can use to rotate the axes.  If you have not already, I suggest you 
 use the current SVN version of MPL instead of the 0.99.1 version.  Mplot3d 
 has some more features in the trunk, but it is still rough around the edges.

 -Ben



 -Original Message-
 From: Alexander Dietz [mailto:alexanderdie...@googlemail.com]
 Sent: Tuesday, March 16, 2010 1:25 PM
 To: Matplotlib-users@lists.sourceforge.net
 Subject: [Matplotlib-users] How to 'rotate' a 3D plot?

 Hi,

 I have successfully created a 3D scatter plot with mplot3d, but how can I 
 rotate the plot around e.g. the z-axis?

 I do not want to use the user interface but I would like to use a command to 
 do that. But I could not find good documentation anywhere and the commands 
 attributed to the Axes3D also do not show anything obvious.

 Thanks
  Alex

 --
 Download Intel#174; Parallel Studio Eval Try the new software tools for 
 yourself. Speed compiling, find bugs proactively, and fine-tune applications 
 for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] [CJK] can create png but not eps

2010-03-16 Thread David

Hello everybody,

I have a final problem with my graph. As a last step I produce an *.eps 
file that I use in conjunction with LaTeX.


Here is the last part of my code:

# plt.title('Title')
xlab = plt.xlabel(u'输入 1')
#xlab.set_position((0.2, 0.1))
ylab = plt.ylabel(u'输入 2')
plt.grid(True)
plt.subplots_adjust(bottom=0.2)
plt.show()
plt.savefig('dea.eps')


plt.show() produces the correct output,

but

plt.savefig('dea.eps') produces an error (the error message is attached).

The error is clearly linked to the Chinese, as it runs through if I take 
the Chinese out of the code.

Also, plt.savefig('dea.png') works fine.

Could anyone indicate where I would have to look for the mistake? The 
matplotlibrc should be fine, but I am not sure.


Your help would be greatly appreciated!

Many thanks,

David





In [63]: run dea.py
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))

---
RuntimeError  Traceback (most recent call last)

/home/david/Documents/PhD/Dissertation/LaTeX/figures/dea.py in module()
 37 plt.subplots_adjust(bottom=0.2)
 38 plt.show()
--- 39 plt.savefig('dea.eps')
 40
 41

/usr/lib/pymodules/python2.6/matplotlib/pyplot.pyc in savefig(*args, **kwargs)
354 def savefig(*args, **kwargs):
355 fig = gcf()
-- 356 return fig.savefig(*args, **kwargs)
357 if Figure.savefig.__doc__ is not None:
358 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib/pymodules/python2.6/matplotlib/figure.pyc in savefig(self, *args, 
**kwargs)
   1031 patch.set_alpha(0.0)
   1032
- 1033 self.canvas.print_figure(*args, **kwargs)
   1034
   1035 if transparent:

/usr/lib/pymodules/python2.6/matplotlib/backend_bases.pyc in print_figure(self, 
filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   1474 orientation=orientation,
   1475 bbox_inches_restore=_bbox_inches_restore,
- 1476 **kwargs)
   1477 finally:
   1478 if bbox_inches and restore_bbox:

/usr/lib/pymodules/python2.6/matplotlib/backend_bases.pyc in print_eps(self, 
*args, **kwargs)
   1327 from backends.backend_ps import FigureCanvasPS # lazy import
   1328 ps = self.switch_backends(FigureCanvasPS)
- 1329 return ps.print_eps(*args, **kwargs)
   1330
   1331 def print_pdf(self, *args, **kwargs):

/usr/lib/pymodules/python2.6/matplotlib/backends/backend_ps.pyc in 
print_eps(self, outfile, *args, **kwargs)
853
854 def print_eps(self, outfile, *args, **kwargs):
-- 855 return self._print_ps(outfile, 'eps', *args, **kwargs)
856
857

/usr/lib/pymodules/python2.6/matplotlib/backends/backend_ps.pyc in 
_print_ps(self, outfile, format, *args, **kwargs)
886 self._print_figure(outfile, format, imagedpi, facecolor, 
edgecolor,
887orientation, isLandscape, papertype,
-- 888**kwargs)
889
890 def _print_figure(self, outfile, format, dpi=72, facecolor='w', 
edgecolor='w',

/usr/lib/pymodules/python2.6/matplotlib/backends/backend_ps.pyc in 
_print_figure(self, outfile, format, dpi, facecolor, edgecolor, orientation, 
isLandscape, papertype, **kwargs)
978 bbox_inches_restore=_bbox_inches_restore)
979
-- 980 self.figure.draw(renderer)
981
982 if dryrun: # return immediately if dryrun (tightbbox=True)

/usr/lib/pymodules/python2.6/matplotlib/artist.pyc in draw_wrapper(artist, 
renderer, *kl)
 44 def draw_wrapper(artist, renderer, *kl):
 45 before(artist, renderer)
--- 46 draw(artist, renderer, *kl)
 47 after(artist, renderer)
 48

/usr/lib/pymodules/python2.6/matplotlib/figure.pyc in draw(self, renderer)
772
773 # render the axes

-- 774 for a in self.axes: a.draw(renderer)
775
776 # render the figure text


/usr/lib/pymodules/python2.6/matplotlib/artist.pyc in draw_wrapper(artist, 
renderer, *kl)
 44 def draw_wrapper(artist, renderer, *kl):
 45 before(artist, renderer)
--- 46 draw(artist, renderer, *kl)
 47 after(artist, renderer)
 48


Re: [Matplotlib-users] [CJK] can create png but not eps

2010-03-16 Thread Michael Droettboom
The font you are using (SimHei) does not have any glyph names -- these 
are used in the Postscript backend to refer to glyphs outside of the 
ASCII range.  More specifically, it looks like it has at least one 
invalid glyph name (glyph names can only contain ASCII characters) -- 
loading it in FontForge complains about this. I haven't come across such 
a font before, but maybe that's common in CJK fonts.  I don't know.  I'm 
looking through the spec to find a way that glyphs can be referenced 
without a name, but I'm not finding one.  Note, the PDF backend has the 
same issue.

Do you have the same problem if you remove SimHei from the 
font.sans-serif list and thus use Adobe Song Std instead?  (I was able 
to find an online download of SimHei to test with, but not Adobe Song Std).

As a workaround, the Cairo backend seems to handle this font just fine.  
You can add

  import matplotlib
  matplotlib.use('GtkCairo')

to the top of your script.

Mike

David wrote:
 Hello everybody,

 I have a final problem with my graph. As a last step I produce an 
 *.eps file that I use in conjunction with LaTeX.

 Here is the last part of my code:

 # plt.title('Title')
 xlab = plt.xlabel(u'输入 1')
 #xlab.set_position((0.2, 0.1))
 ylab = plt.ylabel(u'输入 2')
 plt.grid(True)
 plt.subplots_adjust(bottom=0.2)
 plt.show()
 plt.savefig('dea.eps')


 plt.show() produces the correct output,

 but

 plt.savefig('dea.eps') produces an error (the error message is attached).

 The error is clearly linked to the Chinese, as it runs through if I 
 take the Chinese out of the code.
 Also, plt.savefig('dea.png') works fine.

 Could anyone indicate where I would have to look for the mistake? The 
 matplotlibrc should be fine, but I am not sure.

 Your help would be greatly appreciated!

 Many thanks,

 David





 

 --
 Download Intel#174; Parallel Studio Eval
 Try the new software tools for yourself. Speed compiling, find bugs
 proactively, and fine-tune applications for parallel performance.
 See why Intel Parallel Studio got high marks during beta.
 http://p.sf.net/sfu/intel-sw-dev
 

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

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [CJK] can create png but not eps

2010-03-16 Thread David

Dear Michael,

thanks for your input. So far, though, no luck.

I have deleted SimHei in matplotlibrc, and I can then continue 
generating CJK characters. The png is generated, the eps is not. Thus, 
no change. The error output is also the same:


RuntimeError: Face has no glyph names
WARNING: Failure executing file: dea.py

I have tried

 import matplotlib
 matplotlib.use('GtkCairo')

as you suggested, but they had no effect whatsoever. Even the error 
output is the same.


I attach my code, maybe that gives a hint.

Note: in line 327 and 328 of the matplotlibrc I have added

ps.fonttype=42
pdf.fonttype=42

whereas I have uncommented

pdf.fonttype: 3

Any ideas? I would most welcome any hint and suggestion!

Many thanks,

David




On 17/03/10 04:15, Michael Droettboom wrote:

The font you are using (SimHei) does not have any glyph names -- these
are used in the Postscript backend to refer to glyphs outside of the
ASCII range. More specifically, it looks like it has at least one
invalid glyph name (glyph names can only contain ASCII characters) --
loading it in FontForge complains about this. I haven't come across such
a font before, but maybe that's common in CJK fonts. I don't know. I'm
looking through the spec to find a way that glyphs can be referenced
without a name, but I'm not finding one. Note, the PDF backend has the
same issue.

Do you have the same problem if you remove SimHei from the
font.sans-serif list and thus use Adobe Song Std instead? (I was able
to find an online download of SimHei to test with, but not Adobe Song Std).

As a workaround, the Cairo backend seems to handle this font just fine.
You can add

import matplotlib
matplotlib.use('GtkCairo')

to the top of your script.

Mike

David wrote:

Hello everybody,

I have a final problem with my graph. As a last step I produce an
*.eps file that I use in conjunction with LaTeX.

Here is the last part of my code:

# plt.title('Title')
xlab = plt.xlabel(u'输入 1')
#xlab.set_position((0.2, 0.1))
ylab = plt.ylabel(u'输入 2')
plt.grid(True)
plt.subplots_adjust(bottom=0.2)
plt.show()
plt.savefig('dea.eps')


plt.show() produces the correct output,

but

plt.savefig('dea.eps') produces an error (the error message is attached).

The error is clearly linked to the Chinese, as it runs through if I
take the Chinese out of the code.
Also, plt.savefig('dea.png') works fine.

Could anyone indicate where I would have to look for the mistake? The
matplotlibrc should be fine, but I am not sure.

Your help would be greatly appreciated!

Many thanks,

David







--

Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev


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




attachment: dea.png#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://suyonggui.blog.sohu.com/115269389.html
# http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html

#import matplotlib
#matplotlib.use('GtkCairo')
import matplotlib.pyplot as plt
from pylab import *
#rcParams['figure.figsize'] = 3.56, 2.22
rcParams['figure.figsize'] = 4, 3
rcParams['axes.labelsize'] = 14.0
#rcParams['font.sans-serif'] = ['Adobe Song Std']


label = ('A', 'B', 'C', 'E')
shuru1 = [1, 2, 4, 5]
shuru2 = [4, 2, 1, 1]

plt.plot([0,3], [0,3], 'k--', lw=2)
plt.plot([3], [3], 'ko', ms=6)
plt.plot(shuru1, shuru2, 'k-', lw=2)
plt.plot(shuru1, shuru2, 'ko', ms=6)

plt.axis([0, 6, 0, 5])

# plt.title('Title')
xlab = plt.xlabel(u'输入 1')
ylab = plt.ylabel(u'输入 2')

text( 1, 4.2, u'A')
text( 1.95, 2.2, u'B')
text( 4, 1.2, u'C')
text( 5, 1.2, u'E')
text( 3, 3.2, u'D')

plt.grid(True)
plt.subplots_adjust(bottom=0.2)
#plt.show()
plt.savefig('dea.png')
plt.savefig('dea.eps')
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] installling on ubuntu

2010-03-16 Thread Friedrich Romstedt
For the Windows machine, if you installed with the superpack, you
should find an deinstaller in the Python directory called
Removematplotlib.exe, I *guess* it only removes in fact the
matplotlib package.  You can also safely rename (or delete) the old
matplotlib directory and the mpl_toolkits directory in
Python-dir\Lib\site-packages\.

Ah I see, you mean how to deinstall on Ubuntu?  I would recommend to
rename the old folders in your site-package directory to, say,
matplotlib_ and mpl_toolkits_, and when you are shure later you could
be able to safely remove.  Does Ubuntu have a package mgr?

Hope I could help,
Friedrich

2010/3/16 Samuel Teixeira Santos arcano...@gmail.com:
 Hi all...
 On this afternoon I installed on my ubuntu 8.04 server the python-matplotlib
 package and his dependencies.
 but If I pay attention right that package installed matplotlib 0.91
 on my local desktop wich run windows, I installed the last version...
 Anyone knows how do I de-install only matplotlib pack, let only the
 dependancies
 and install the most recent version?

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Is there a maximum number of x tickmarks?

2010-03-16 Thread Josh Hemann

I have an issue with showing more than 81 tick marks on an X axis and I am
trying to determine a way around it. Background... I am plotting vectors in
which each element represents a different variable and I really do want to
see the labels associated with each element. The vectors may be only 8
elements long, or as much as 110. When there are more than say 40 elements,
I usually split the plot into two plots contained in a single figure window
(e.g., plotting elements 0:30 in fig.add_subplot(211) and 30:60 in
fig.add_subplot(212)).

Here are a couple of examples...

Only 41 variables:
http://old.nabble.com/file/p27924845/Factor_2_TrainingProfiles.png 


71 variables:
http://old.nabble.com/file/p27924845/Factor_2_TrainingProfiles.jpeg 


I have a vector with a 105 elements and before I split things into three
plots I wanted to see what cramming 53 or so variables into a single set of
axes would look like. But, my code that works for these cases does not show
enough tickmarks for the 105 element data.

Here is an example that you can copy and paste to see for yourself.

import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
fig = plt.figure(figsize=[12,7])
ax = fig.add_subplot(111)
ax.plot(range(110))
fig.canvas.draw()
ints = range(1,111)
ints = [str(num) for num in ints]
ax.xaxis.set_major_locator(MaxNLocator(110))
xtickNames = plt.setp(ax, xticklabels=ints)
plt.setp(xtickNames, rotation=90, fontsize=7);

If you play with the argument to MaxNLocator, you'll see how for smaller
values (like 40) things work as expected (or at least how I have shown the
code has worked for the smaller data sets).

I have been poking around trying to see what options I have and have not
found anything to get past this limit. Before I start diving into source
code, can anyone suggest 

-Is there a limit?
-Is there an obvious way to accomplish what I need? 

Ultimately, I may split large vectors like this into more than two plots but
hitting that limit has made me want to investigate why.

Thanks!


 


-
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhem...@vni.com | P 720.407.4214 | F 720.407.4199 

-- 
View this message in context: 
http://old.nabble.com/Is-there-a-maximum-number-of-x-tickmarks--tp27924845p27924845.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is there a maximum number of x tickmarks?

2010-03-16 Thread Gökhan Sever
On Tue, Mar 16, 2010 at 4:37 PM, Josh Hemann jhem...@vni.com wrote:


 I have an issue with showing more than 81 tick marks on an X axis and I am
 trying to determine a way around it. Background... I am plotting vectors in
 which each element represents a different variable and I really do want to
 see the labels associated with each element. The vectors may be only 8
 elements long, or as much as 110. When there are more than say 40 elements,
 I usually split the plot into two plots contained in a single figure window
 (e.g., plotting elements 0:30 in fig.add_subplot(211) and 30:60 in
 fig.add_subplot(212)).

 Here are a couple of examples...

 Only 41 variables:
 http://old.nabble.com/file/p27924845/Factor_2_TrainingProfiles.png


 71 variables:
 http://old.nabble.com/file/p27924845/Factor_2_TrainingProfiles.jpeg


 I have a vector with a 105 elements and before I split things into three
 plots I wanted to see what cramming 53 or so variables into a single set of
 axes would look like. But, my code that works for these cases does not show
 enough tickmarks for the 105 element data.

 Here is an example that you can copy and paste to see for yourself.

 import matplotlib.pyplot as plt
 from matplotlib.ticker import MaxNLocator
 fig = plt.figure(figsize=[12,7])
 ax = fig.add_subplot(111)
 ax.plot(range(110))
 fig.canvas.draw()
 ints = range(1,111)
 ints = [str(num) for num in ints]
 ax.xaxis.set_major_locator(MaxNLocator(110))
 xtickNames = plt.setp(ax, xticklabels=ints)
 plt.setp(xtickNames, rotation=90, fontsize=7);

 If you play with the argument to MaxNLocator, you'll see how for smaller
 values (like 40) things work as expected (or at least how I have shown the
 code has worked for the smaller data sets).

 I have been poking around trying to see what options I have and have not
 found anything to get past this limit. Before I start diving into source
 code, can anyone suggest

 -Is there a limit?
 -Is there an obvious way to accomplish what I need?

 Ultimately, I may split large vectors like this into more than two plots
 but
 hitting that limit has made me want to investigate why.

 Thanks!


Oh these busy chemical compound plots :) Are those results of gas
chromatography analysis?

Something like below produces a nice fully plotted output here. Could you
give it a try?

import matplotlib.pyplot as plt
plt.plot(range(100))
locs, labels = plt.xticks(range(100), range(100))
plt.setp(labels, rotation=90, fontsize=7)
plt.show()


-- 
Gökhan
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Contour with locator=FixedLocator(...) drops first and last contours from the list.

2010-03-16 Thread David Smith
Eric,
   Thank you, thank you, thank you.  This not only fixes the problem I
reported with with
FixedLocator(..) but also another one where I was using MultipleLocator(..)
and getting
the same problem issue with dropping first and last contours.  The later
isn't as easy
to work-around but your change fixed it.

David Smith

On Sat, Mar 13, 2010 at 12:30 PM, Eric Firing efir...@hawaii.edu wrote:

 David Smith wrote:

 This is a bug report.

 I am using matplotlib 0.99.1 on Windows.  When using contour with the
 keyword
 argument locator=ticker.FixedLocator(levels), the plot is always dropping
 the first
 and last contour level.  If there are less than 3 levels, contour.py
 throws an
 exception.

 My workaround is to duplicate the first and last levels when using the
 fixed locator: e.g. my argument becomes

 locator=FixedLocator( [levels[0]] + levels + [levels[-1]] )

 I have traced the problem to the last line in contour.py, method
 _autolev() which
 strips the first and last levels if the contours are not filled:

  return lev[1:-1]

 This line occurs at line 682 in my version of contour.py which came with
 the 0.991 installation.

 I realize that I could specify the levels in the argument V and this does
 work.  However
 this code is embedded in GUI-ness which allows the user to choose how the
 contours
 are selected.  Passing the locator seems to be the best option code-wise.


 I committed a small change to svn trunk (r8190) that I think will handle
 your use case without fouling anything else up.

 Eric


 Thank you,

 Dave Smith


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is there a maximum number of x tickmarks?

2010-03-16 Thread Josh Hemann


Gökhan SEVER-2 wrote:
 
 Oh these busy chemical compound plots :) Are those results of gas
 chromatography analysis?
 
 Something like below produces a nice fully plotted output here. Could you
 give it a try?
 
 import matplotlib.pyplot as plt
 plt.plot(range(100))
 locs, labels = plt.xticks(range(100), range(100))
 plt.setp(labels, rotation=90, fontsize=7)
 plt.show()
 
 
 -- 
 Gökhan
 


Gokhan,

Your suggestion works great. I guess the MaxNLocator approach I have been
using will place __up__to__ N ticks but not necessarily N ticks?

And yes, these chemical profiles are from GCMS and other devices/techniques.
I added upper X axis tick labels so you know a given chemical species' name
and number; I chose to only have one legend to keep the clutter down as much
as possible; I position the upper X axis labels in or outside the plot
depending on whether the plot title exists. Luckily, I don't imagine having
to deal with more species than 105 any time soon. Thanks again! Here is the
improved plot (sorry for the pink background, I am not sure why it is
showing up that way):


http://old.nabble.com/file/p27927991/PMF2BasecaseProfiles.jpeg 


-
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhemann at vni dizzot com 

-- 
View this message in context: 
http://old.nabble.com/Is-there-a-maximum-number-of-x-tickmarks--tp27924845p27927991.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users