1 Apr 04:40 2010

### a quick way to plot 3D surface with point coordination?

Hi, All,

I have a bunch of 3D points with coordinations in a dict
pointset = {
(x1,y1):z1,
(x2,y2):z2,
...
}

It seems I have to
1. fire a loop to change each item and convert the whole dictionary into arrays;
x = []
y = []
for i in pointset.items():
x.append(i[0][0])
y.append(i[0][1])

2. send x and y ranges to meshgrid
3. loop again to put z values into proper positions
4. use plot_surface()

Is there any quicker ways to do that?

And we know that for points with coordination, scatter must be the
simplest way to visualize them.
Is there any trick to convert a scatter graph into a surface picture directly?

Appreciation for any ideas.

Zhe Yao

1 Apr 04:16 2010

### bus error on os x 10.6

I'm using the prebuilt OS X dmg distribution of matplotlib with the mac python 2.6.4 installation on os x
10.6.3.  I find that if I try to use savefig to pdf format, my program terminates with a bus error.  There is no
such error if I save to eps format.

-gideon

------------------------------------------------------------------------------
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
1 Apr 05:40 2010

### Re: a quick way to plot 3D surface with point coordination?

On 3/31/2010 10:40 PM, ericyosho wrote:
> send x and y ranges to meshgrid
>

Does this mean you have the entire grid of points?
In any case, you can get an array of your points
as np.array([(x,y,z) for (x,y),z in d.iteritems()])

fwiw,
Alan Isaac

------------------------------------------------------------------------------
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
1 Apr 09:41 2010

### How to remove white space

Dear All,
I have one .png image of 940X780 and i am plotting waveforms on it. When I save this plot as .png , matp[lotlib gives image in
800X600 that too with white space. I dont want to keep the white space and i want the same resolution as original image.How should I go ahead?
Regards
Yogesh

------------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
1 Apr 09:49 2010

### Re: How to remove white space

On Thursday 01 April 2010 09:41:06 yogesh karpate wrote:
> Dear All,
>                I have one .png image of 940X780 and i am plotting waveforms
> on it. When I save this plot as .png , matp[lotlib gives image in
> 800X600 that too with white space. I dont want to keep the white space and
> i want the same resolution as original image.How should I go ahead?
> Regards
> Yogesh

Hi Yogesh,

Doesn't the following example fulfill your needs (already posted to "How to
save file in to image in desired resolution in matplotlib?")?

fig = plt.figure(figsize=(9.4, 7.8))
ax = plt.axes([0.0, 0.0, 1.0, 1.0]) # leaves no white space around the axes
ax.plot([1, 2, 4], lw=5)
ax.set_xticks([]) # removes ticks
ax.set_yticks([])

fig.savefig('test.png', dpi=100)

Kind regards,
Matthias

------------------------------------------------------------------------------
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
1 Apr 12:27 2010

### Change axis's scale

Hi all,
I have several graph to create and the position on the x axis can vary
quite a lot.
Most of the time I'm quite happy with the default behavior but when my x
values are very high matplotlib automatically change the ticks and set a
scale on the axis (see screenshot)
<http://img6.imageshack.us/img6/6834/chab052195802198642shif.png>
I looking for a way to change the default behavior to get a scale in
10E** instead of some random scale.
Is there a simple way of doing that?

Thanks a lot for your help

Tim

--

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

------------------------------------------------------------------------------
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
1 Apr 13:16 2010

### Re: Change axis's scale

On Thursday 01 April 2010 12:27:59 timothee cezard wrote:
> Hi all,
> I have several graph to create and the position on the x axis can vary
> quite a lot.
> Most of the time I'm quite happy with the default behavior but when my x
> values are very high matplotlib automatically change the ticks and set a
> scale on the axis (see screenshot)
> <http://img6.imageshack.us/img6/6834/chab052195802198642shif.png>
> I looking for a way to change the default behavior to get a scale in
> 10E** instead of some random scale.
> Is there a simple way of doing that?
>
> Thanks a lot for your help
>
> Tim

Hi Tim,

the "random scale" you are observing is the originalscale, where "some useful"
offset has been substracted and is shown in the lower right.
You can circumvent this behaviour by using your own Formatter like a
ScalarFormatter withour offset:
formatter = plt.ScalarFormatter(useOffset=False)
Furthermore you can switch off the scientific formatting (extracting a common
prefactor) using
formatter.set_scientific(False)
Applying this formatter to the current axes:
plt.gca().xaxis.set_major_formatter(formatter)

or a string-formatter like
majorFormatter = plt.FormatStrFormatter('%.5e')
or
majorFormatter = plt.FormatStrFormatter('%g')

Kind regards,
Matthias

PS: By the way, you should start a new thread for a new topic (sending a new
mail to mpl-users) instead of responding to another message.

------------------------------------------------------------------------------
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
1 Apr 13:53 2010

### Problems with Matplotlib and Python 2.6

Dear ALL,

Long time no see.... Well, I have recently upgraded from Ubuntu
Intrepid to Jaunty (sure, I know that I'm a couple of versions
delayed, but keeping a working system stable is essential). I did not
a fresh install of Ubuntu, just upgraded using the system's facility
for that. Previously I have did that from Ubuntu Hardy to Intrepid,
with less (or no) troubles. However, in Jaunty the default Python
interpreter has been upgraded from 2.5 to 2.6 and this is presenting
the most annoying problems.

For now, the most vexing problem is that although Matplotlib is
correctly installed and seemingly working, it does not show any
graphics! For exemple, if I run the simple example from Matplotlib's
website:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
>>> from pylab import randn, hist
>>> x = randn(10000)
>>> hist(x, 100)

Instead of a nice histogram, I am just presented with a "dump" of the
contents of an array:

(array([  2,   0,   1,   2,   1,   2,   1,   3,   4,   7,  15,  16,   9,
(cut here to save space)
3.97823055,  4.05708515,  4.13593975,  4.21479434,  4.29364894,
4.37250354]), <a list of 100 Patch objects>)

No error messages or complaints about a missing graphics backend is
issued, so I'm lost.

Any hints?

Thanks in advance for any assistance you can provide.

Best wishes,

--

--
Dr. Mauro J. Cavalcanti
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@...
Linux Registered User #473524 * Ubuntu User #22717

------------------------------------------------------------------------------
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
1 Apr 14:03 2010

### Re: Problems with Matplotlib and Python 2.6

On Thu, Apr 1, 2010 at 13:53, Mauro Cavalcanti <maurobio@...> wrote:
> Dear ALL,
>
> Long time no see.... Well, I have recently upgraded from Ubuntu
> Intrepid to Jaunty (sure, I know that I'm a couple of versions
> delayed, but keeping a working system stable is essential). I did not
> a fresh install of Ubuntu, just upgraded using the system's facility
> for that. Previously I have did that from Ubuntu Hardy to Intrepid,
> with less (or no) troubles. However, in Jaunty the default Python
> interpreter has been upgraded from 2.5 to 2.6 and this is presenting
> the most annoying problems.

Yeah, let's all thanks Ubuntu for the its attention to quality and
well-prepared transitions...

> For now, the most vexing problem is that although Matplotlib is
> correctly installed and seemingly working, it does not show any
> graphics! For exemple, if I run the simple example from Matplotlib's
> website:
>
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
>>>> from pylab import randn, hist
>>>> x = randn(10000)
>>>> hist(x, 100)

On Debian,

\$ python2.6
Python 2.6.5rc2 (r265rc2:78822, Mar 11 2010, 16:48:00)
[GCC 4.4.3] on linux2
>>> from pylab import randn, hist, show
>>> x = randn(10000)
>>> hist(x, 100)
>>> show()

works as expected

\$ python2.6 -c "import matplotlib ; print matplotlib.__version__"
0.99.1.1

Wouldn't you want to run ipython instead of python?

Regards,
--

--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

------------------------------------------------------------------------------
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
1 Apr 14:06 2010

### Re: Problems with Matplotlib and Python 2.6

On Thu, Apr 1, 2010 at 7:53 AM, Mauro Cavalcanti <maurobio <at> gmail.com> wrote:
> Dear ALL,
>
> Long time no see.... Well, I have recently upgraded from Ubuntu
> Intrepid to Jaunty (sure, I know that I'm a couple of versions
> delayed, but keeping a working system stable is essential). I did not
> a fresh install of Ubuntu, just upgraded using the system's facility
> for that. Previously I have did that from Ubuntu Hardy to Intrepid,
> with less (or no) troubles. However, in Jaunty the default Python
> interpreter has been upgraded from 2.5 to 2.6 and this is presenting
> the most annoying problems.
>
> For now, the most vexing problem is that although Matplotlib is
> correctly installed and seemingly working, it does not show any
> graphics! For exemple, if I run the simple example from Matplotlib's
> website:
>
> Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
> [GCC 4.3.3] on linux2
>>>> from pylab import randn, hist
>>>> x = randn(10000)
>>>> hist(x, 100)
>
> Instead of a nice histogram, I am just presented with a "dump" of the
> contents of an array:
>
> (array([  2,   0,   1,   2,   1,   2,   1,   3,   4,   7,  15,  16,   9,
>      (cut here to save space)
>       3.97823055,  4.05708515,  4.13593975,  4.21479434,  4.29364894,
>        4.37250354]), <a list of 100 Patch objects>)
>
> No error messages or complaints about a missing graphics backend is
> issued, so I'm lost.
>
> Any hints?

When you run setup.py, the install routines attempt to determine what
backend to use. If a suitable gui toolkit is not found, mpl defaults
to the Agg backend. I suggest creating a matplotlibrc file that
specifies a gui backend.

Darren

------------------------------------------------------------------------------