SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S
1
(4)
2
(20)
3
(8)
4
(10)
5
(4)
6
(8)
7
(4)
8
(9)
9
(11)
10
(12)
11
(13)
12
(3)
13
(17)
14
(4)
15
16
(10)
17
(9)
18
(11)
19
(4)
20
(17)
21
(6)
22
(9)
23
(35)
24
(17)
25
(9)
26
(16)
27
(17)
28
(14)

Showing 16 results of 16

From: Armin M. <arm...@st...> - 2009年02月20日 23:23:03
Eric Firing wrote:
> Jeff Whitaker wrote:
>> Armin Moser wrote:
>>> Jeff Whitaker wrote:
>>> 
>>>> Armin Moser wrote:
>>>> 
>>>>> Hi,
>>>>>
>>>>> I would like to interpolate an array of shape (801,676) to regularily
>>>>> spaced datapoints using griddata. This interpolation is quick if the
>>>>> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
>>>>> condition is not fullfilled the delaunay triangulation is extremely
>>>>> slow, i.e. not useable. Is this a known property of the used
>>>>> triangulation? The triangulation can be performed with matlab without
>>>>> any problems.
>>>>>
>>>>> Armin
>>>>> 
>>>> Armin: You could try installing the natgrid toolkit and see if that
>>>> speeds up griddata at all. If not, please post a test script with data
>>>> and maybe we can figure out what is going on.
>>>> 
>>> I have already tried natgrid and it didn't improve the situation. As
>>> suggested I append a script demonstrating the problem.
>>>
>>> Thanks
>>> Armin
>>> 
>>
>> Armin: On my mac, your two benchmarks take 15 and 14 seconds. Do you
>> consider that too slow?
> 
> I got 10 s and 8 s on my Thinkpad--but that was without natgrid. When I
> installed natgrid, the benchmark was taking so long I killed the window.
Thats the behaviour I observed (on Windows and Linux) with and without
natgrid. I'm very puzzled at the moment.
Thanks a lot
Armin
From: bpklmd <rp...@re...> - 2009年02月20日 23:16:47
I have searched the web for a solution to the following problem and nothing
works.
I call matplotlib code from a python script (2.5) running on Apache2.2 and
mod_python. When I get to the point where I the code is to save a figure in
the website dir I get the following error. 
File "/usr/lib/python2.5/site-packages/matplotlib/__init__.py", line 324, in
_get_configdir
 raise RuntimeError("'%s' is not a writable dir; you must set environment
variable HOME to be a writable dir "%h)
RuntimeError: '/root' is not a writable dir; you must set environment
variable HOME to be a writable dir 
The code that creates the fig is a follows:
import matplotlib
from matplotlib import pylab as plt
import numpy as np
matplotlib.use('AGG') # use a nongui backend
matplotlib.rdParams['MPLCONFIGDIR']='/var/www/modtest/'
...
plot code here
...
plt.savefig('/var/www/modtest/plot_data/' + plotfile[0]) # use 1st
generated random file name
First can anyone tell me what "HOME" variable the error message is referring
to? 
I have changed the $HOME env variable under linux Ubuntu Gutsy
I have added a $HOME variable to httpd.conf, however I am not an
experienced Apache user
I can get the code to work from the interactive.py shell
rlp
-- 
View this message in context: http://www.nabble.com/Problems-with-saving-figure-from-within-mod_python-script-tp22129192p22129192.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Armin M. <arm...@st...> - 2009年02月20日 21:27:21
Jeff Whitaker wrote:
> Armin Moser wrote:
>> Jeff Whitaker wrote:
>> 
>>> Armin Moser wrote:
>>> 
>>>> Hi,
>>>>
>>>> I would like to interpolate an array of shape (801,676) to regularily
>>>> spaced datapoints using griddata. This interpolation is quick if the
>>>> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
>>>> condition is not fullfilled the delaunay triangulation is extremely
>>>> slow, i.e. not useable. Is this a known property of the used
>>>> triangulation? The triangulation can be performed with matlab without
>>>> any problems.
>>>>
>>>> Armin
>>>> 
>>> Armin: You could try installing the natgrid toolkit and see if that
>>> speeds up griddata at all. If not, please post a test script with data
>>> and maybe we can figure out what is going on.
>>> 
>> I have already tried natgrid and it didn't improve the situation. As
>> suggested I append a script demonstrating the problem.
>>
>> Thanks
>> Armin
>> 
> 
> Armin: On my mac, your two benchmarks take 15 and 14 seconds. Do you
> consider that too slow?
No definitely not but up to now I always killed the process (after more
than 10 minutes). I tried the script again and it worked... I have to
check the original on monday at work.
> 
> Perhaps this is just a toy example to test griddata, but I assume you
> realize that you wouldn't normally use griddata to interpolate data on
> one regular grid to another regular grid. griddata is strictly for
> interpolating scatter data (not on a regular mesh) to a regular mesh.
Yes I do, but the supporting points of the second example are not on a
regular grid.
Thanks a lot
Armin
From: Eric F. <ef...@ha...> - 2009年02月20日 21:11:04
Jeff Whitaker wrote:
> Armin Moser wrote:
>> Jeff Whitaker wrote:
>> 
>>> Armin Moser wrote:
>>> 
>>>> Hi,
>>>>
>>>> I would like to interpolate an array of shape (801,676) to regularily
>>>> spaced datapoints using griddata. This interpolation is quick if the
>>>> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
>>>> condition is not fullfilled the delaunay triangulation is extremely
>>>> slow, i.e. not useable. Is this a known property of the used
>>>> triangulation? The triangulation can be performed with matlab without
>>>> any problems.
>>>>
>>>> Armin
>>>> 
>>>> 
>>> Armin: You could try installing the natgrid toolkit and see if that
>>> speeds up griddata at all. If not, please post a test script with data
>>> and maybe we can figure out what is going on.
>>> 
>> I have already tried natgrid and it didn't improve the situation. As
>> suggested I append a script demonstrating the problem.
>>
>> Thanks
>> Armin
>> 
> 
> Armin: On my mac, your two benchmarks take 15 and 14 seconds. Do you 
> consider that too slow?
Jeff,
I got 10 s and 8 s on my Thinkpad--but that was without natgrid. When I 
installed natgrid, the benchmark was taking so long I killed the window.
I'm running 32-bit Ubuntu.
Eric
> 
> Perhaps this is just a toy example to test griddata, but I assume you 
> realize that you wouldn't normally use griddata to interpolate data on 
> one regular grid to another regular grid. griddata is strictly for 
> interpolating scatter data (not on a regular mesh) to a regular mesh.
> 
> -Jeff
>> ------8<-------------
>> from numpy import *
>> from pylab import *
>> import time
>>
>> deg2rad = pi/180.0
>> ai = 0.12*deg2rad
>> x = linspace(13,40,676)
>> y = linspace(10,22,801)
>>
>> x = x*deg2rad
>> y = y*deg2rad
>> [x,y] = meshgrid(x,y)
>> z = (x**2+y**2)
>>
>> xi = linspace(x.min(),x.max(),x.shape[1])
>> yi = linspace(y.min(),y.max(),y.shape[0])
>> tic= time.time()
>> zi = griddata(x.flatten(),y.flatten(),z.flatten(),xi,yi)
>> toc = time.time()
>> print toc-tic
>>
>> fac = 2*pi/1.2681
>> nx = fac * (cos(y)*cos(x) - cos(ai))
>> ny = fac * (cos(y)*sin(x))
>> nz = fac * (sin(y) + sin(ai))
>> np = sqrt(nx**2 + ny**2)
>>
>> z = (np**2+nz**2)*exp(-0.001*nz)
>>
>> xi = linspace(np.min(),np.max(),x.shape[1])
>> yi = linspace(nz.min(),nz.max(),y.shape[0])
>> tic = time.time()
>> zi = griddata(np.flatten(),nz.flatten(),z.flatten(),xi,yi)
>> toc = time.time()
>> print toc-tic
>> 
> 
> 
From: Jeff W. <js...@fa...> - 2009年02月20日 20:04:17
Armin Moser wrote:
> Jeff Whitaker wrote:
> 
>> Armin Moser wrote:
>> 
>>> Hi,
>>>
>>> I would like to interpolate an array of shape (801,676) to regularily
>>> spaced datapoints using griddata. This interpolation is quick if the
>>> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
>>> condition is not fullfilled the delaunay triangulation is extremely
>>> slow, i.e. not useable. Is this a known property of the used
>>> triangulation? The triangulation can be performed with matlab without
>>> any problems.
>>>
>>> Armin
>>> 
>>> 
>> Armin: You could try installing the natgrid toolkit and see if that
>> speeds up griddata at all. If not, please post a test script with data
>> and maybe we can figure out what is going on.
>> 
> I have already tried natgrid and it didn't improve the situation. As
> suggested I append a script demonstrating the problem.
>
> Thanks
> Armin
> 
Armin: On my mac, your two benchmarks take 15 and 14 seconds. Do you 
consider that too slow?
Perhaps this is just a toy example to test griddata, but I assume you 
realize that you wouldn't normally use griddata to interpolate data on 
one regular grid to another regular grid. griddata is strictly for 
interpolating scatter data (not on a regular mesh) to a regular mesh.
-Jeff
> ------8<-------------
> from numpy import *
> from pylab import *
> import time
>
> deg2rad = pi/180.0
> ai = 0.12*deg2rad
> x = linspace(13,40,676)
> y = linspace(10,22,801)
>
> x = x*deg2rad
> y = y*deg2rad
> [x,y] = meshgrid(x,y)
> z = (x**2+y**2)
>
> xi = linspace(x.min(),x.max(),x.shape[1])
> yi = linspace(y.min(),y.max(),y.shape[0])
> tic= time.time()
> zi = griddata(x.flatten(),y.flatten(),z.flatten(),xi,yi)
> toc = time.time()
> print toc-tic
>
> fac = 2*pi/1.2681
> nx = fac * (cos(y)*cos(x) - cos(ai))
> ny = fac * (cos(y)*sin(x))
> nz = fac * (sin(y) + sin(ai))
> np = sqrt(nx**2 + ny**2)
>
> z = (np**2+nz**2)*exp(-0.001*nz)
>
> xi = linspace(np.min(),np.max(),x.shape[1])
> yi = linspace(nz.min(),nz.max(),y.shape[0])
> tic = time.time()
> zi = griddata(np.flatten(),nz.flatten(),z.flatten(),xi,yi)
> toc = time.time()
> print toc-tic
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Armin M. <arm...@st...> - 2009年02月20日 19:10:19
Jeff Whitaker wrote:
> Armin Moser wrote:
>> Hi,
>>
>> I would like to interpolate an array of shape (801,676) to regularily
>> spaced datapoints using griddata. This interpolation is quick if the
>> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
>> condition is not fullfilled the delaunay triangulation is extremely
>> slow, i.e. not useable. Is this a known property of the used
>> triangulation? The triangulation can be performed with matlab without
>> any problems.
>>
>> Armin
>> 
> 
> Armin: You could try installing the natgrid toolkit and see if that
> speeds up griddata at all. If not, please post a test script with data
> and maybe we can figure out what is going on.
I have already tried natgrid and it didn't improve the situation. As
suggested I append a script demonstrating the problem.
Thanks
Armin
------8<-------------
from numpy import *
from pylab import *
import time
deg2rad = pi/180.0
ai = 0.12*deg2rad
x = linspace(13,40,676)
y = linspace(10,22,801)
x = x*deg2rad
y = y*deg2rad
[x,y] = meshgrid(x,y)
z = (x**2+y**2)
xi = linspace(x.min(),x.max(),x.shape[1])
yi = linspace(y.min(),y.max(),y.shape[0])
tic= time.time()
zi = griddata(x.flatten(),y.flatten(),z.flatten(),xi,yi)
toc = time.time()
print toc-tic
fac = 2*pi/1.2681
nx = fac * (cos(y)*cos(x) - cos(ai))
ny = fac * (cos(y)*sin(x))
nz = fac * (sin(y) + sin(ai))
np = sqrt(nx**2 + ny**2)
z = (np**2+nz**2)*exp(-0.001*nz)
xi = linspace(np.min(),np.max(),x.shape[1])
yi = linspace(nz.min(),nz.max(),y.shape[0])
tic = time.time()
zi = griddata(np.flatten(),nz.flatten(),z.flatten(),xi,yi)
toc = time.time()
print toc-tic
From: Ryan M. <rm...@gm...> - 2009年02月20日 17:18:54
On Fri, Feb 20, 2009 at 8:11 AM, Armin Moser
<arm...@st...>wrote:
> Hi,
>
> I would like to interpolate an array of shape (801,676) to regularily
> spaced datapoints using griddata. This interpolation is quick if the
> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
> condition is not fullfilled the delaunay triangulation is extremely
> slow, i.e. not useable. Is this a known property of the used
> triangulation? The triangulation can be performed with matlab without
> any problems.
>
If you're not using meshgrid, how do you compute x,y? A small complete
example would be helpful.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from: Norman Oklahoma United States.
From: Jeff W. <js...@fa...> - 2009年02月20日 15:52:56
Armin Moser wrote:
> Hi,
>
> I would like to interpolate an array of shape (801,676) to regularily
> spaced datapoints using griddata. This interpolation is quick if the
> (x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
> condition is not fullfilled the delaunay triangulation is extremely
> slow, i.e. not useable. Is this a known property of the used
> triangulation? The triangulation can be performed with matlab without
> any problems.
>
> Armin
> 
Armin: You could try installing the natgrid toolkit and see if that 
speeds up griddata at all. If not, please post a test script with data 
and maybe we can figure out what is going on.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Armin M. <arm...@st...> - 2009年02月20日 14:53:10
Hi,
I would like to interpolate an array of shape (801,676) to regularily
spaced datapoints using griddata. This interpolation is quick if the
(x,y) supporting points are computed as X,Y = meshgrid(x,y). If this
condition is not fullfilled the delaunay triangulation is extremely
slow, i.e. not useable. Is this a known property of the used
triangulation? The triangulation can be performed with matlab without
any problems.
Armin
From: G. A. <gio...@gm...> - 2009年02月20日 11:02:20
Thanks Andrew, conceptually it's clear. Now I have to code it :)
I will have a look to SimPy, and also to SciPy/NumPy
I will let you know how it's going on.
2009年2月20日 Andrew Straw <str...@as...>:
> G. Allegri wrote:
>>
>> Hi Andrew.
>> With dist(point_i,polynomial_curve) do you mean point_i belonging to
>> the Line 2 set of points and pol_curve as Line 1?
>
> yes
>
>> In this case it
>> could be reasonably ok for me. How can I derive the closed form for
>> dist()? Excuse my ignorance with geometry....
>>
>
> Take the equation for line 1parameterized by s. Something like f(s) = (x,y)
> = (as**2 + bs +c, ds**2 + es + f ) for your polynomial model. Now, the
> distance for that point on line 1 from point i is dist(point_i, f(s)), where
> dist can be Euclidean distance, for example.
>
> So, the question is what value of s minimizes the distance. Since this
> function will be smallest at an inflection, just take the derivative of your
> distance function and solve for it to be equal to zero. Hopefully this
> function will be convex and you'll have only one zero, which will tell you
> the value of s where distance is a minimum. Otherwise, pick the inflection
> at the closest distance. Finally, repeat for all points i and sum the
> results.
>
> Hopefully that helps on the conceptual side. Sympy will be more useful than
> matplotlib on the coding side...
>
From: Andrew S. <str...@as...> - 2009年02月20日 10:32:43
G. Allegri wrote:
> Hi Andrew.
> With dist(point_i,polynomial_curve) do you mean point_i belonging to
> the Line 2 set of points and pol_curve as Line 1?
yes
> In this case it
> could be reasonably ok for me. How can I derive the closed form for
> dist()? Excuse my ignorance with geometry....
> 
Take the equation for line 1parameterized by s. Something like f(s) = 
(x,y) = (as**2 + bs +c, ds**2 + es + f ) for your polynomial model. Now, 
the distance for that point on line 1 from point i is dist(point_i, 
f(s)), where dist can be Euclidean distance, for example.
So, the question is what value of s minimizes the distance. Since this 
function will be smallest at an inflection, just take the derivative of 
your distance function and solve for it to be equal to zero. Hopefully 
this function will be convex and you'll have only one zero, which will 
tell you the value of s where distance is a minimum. Otherwise, pick the 
inflection at the closest distance. Finally, repeat for all points i and 
sum the results.
Hopefully that helps on the conceptual side. Sympy will be more useful 
than matplotlib on the coding side...
From: G. A. <gio...@gm...> - 2009年02月20日 08:51:26
Hi Andrew.
With dist(point_i,polynomial_curve) do you mean point_i belonging to
the Line 2 set of points and pol_curve as Line 1? In this case it
could be reasonably ok for me. How can I derive the closed form for
dist()? Excuse my ignorance with geometry....
From: Andrew S. <str...@as...> - 2009年02月20日 06:21:36
G. Allegri wrote:
> Hello list,
> I'm completely new to matplotlib and I'm not a computer scientist (not
> a good starting point!) but I need to solve a geometric/graphical
> problem.
> I've been asked to find a method, in Python, to find the distance
> between a 2D polynomial curve, derived from least squares
> interpolation on a set of points, and a curve locallly interpolating
> another set of points.
Do you really need the distance to be relative to the interpolated 
curve? Why not to the points which are being interpolated? Then the 
answer is just:
Sum_i dist(point_i,polynomial_curve)
Where dist() can be arrived at in closed form...
Otherwise, I guess it would depend on the interpolation, which you 
didn't really specify.
> 
> - the starting line is a smooth line, while the second should
> describe a path passing exactly thorugh the given points.
> - the distance should be the one along the normal to the first line
> 
> I attach a sketch to explain this.
> 
> Is there an heuristic, an algorithm, to solve this problem in an
> efficient way (I have to apply it to thousands couples of sets from
> sonar and seismic acquisitions)? Is the mapltolip API useful for this?
> 
> Thanks in advance,
> Giovanni
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2009年02月20日 01:16:52
per freem wrote:
> hi all,
> 
> when plotting a simple scatter plot in matlab, points that overlap will 
> cross in each other -- if i plot
> 
> scatter(randn(1,1000),randn(1,1000))
> 
> then no point will be fully "on top" of the other -- if they overlap, 
> then their edges will cross and they will look like tiny venn diagrams.
> 
> in matplotlib, this is not the case, and points that overlap are placed 
> on top of each other. for example if i use:
> x = randn(1,1000)
> plot(x, x, 'bo')
> 
> how can i fix it so that it looks like matlab and points cross?
So you want the interiors of the points to be transparent? Add the 
keyword argument mfc='none'. I may be misunderstanding the desired 
effect, however.
> 
> more importantly, the above command in matplotlib generates many many 
> line objects and takes forever to render. if i don't specify 'bo' and 
Again, you are using 2-D arrays when you should be using 1-D. In 
matlab, everything is a 2-D matrix (or it used to be, until higher 
dimensions were clumsily patched in). Numpy is designed to use as many 
or as few dimensions as you need. Mpl plot(x, y) with x and y being MxN 
is assuming each of the N columns is a line, so it is plotting N 
lines--as well as cycling through the colors, one per "line", if you 
don't explicitly give a color.
> simply call plot(x, x, 'o') it makes every point in a *different color*. 
> why is that? how can i change that? i feel like i must be doing 
> something wrong here.
It's just a Matlab hangover--a common malady, painful but rarely fatal.
Eric
From: Eric F. <ef...@ha...> - 2009年02月20日 01:03:20
per freem wrote:
> hi all,
> 
> i'm trying to do something extremely simple, namely print a scatter plot 
> of two random arrays:
> 
> import matplotlib.plt as plt
> from numpy.random import *
> 
> x = rand(1,10)
> scatter(x, x)
> 
> this fails with the error:
> 
> ValueError: Offsets array must be Nx2
> 
> what is happening here? are arrays somehow weird? do they not behave 
> like lists? any info on this will be greatly appreciated.
Your "x" is 2-D; what you want is rand(10); or you can do 
scatter(x.ravel(), x.ravel()).
Your example does point to a bug in scatter, however; it should not be 
failing with an obscure error message like that. (In mpl from svn trunk 
it still fails, but with a different obscure error message.) I don't 
know any good reason why it should not be able to handle the 2-D inputs. 
 I will take a look.
Eric
> 
> thank you.
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a 600ドル discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: per f. <per...@gm...> - 2009年02月20日 00:26:55
hi all,
when plotting a simple scatter plot in matlab, points that overlap will
cross in each other -- if i plot
scatter(randn(1,1000),randn(1,1000))
then no point will be fully "on top" of the other -- if they overlap, then
their edges will cross and they will look like tiny venn diagrams.
in matplotlib, this is not the case, and points that overlap are placed on
top of each other. for example if i use:
x = randn(1,1000)
plot(x, x, 'bo')
how can i fix it so that it looks like matlab and points cross?
more importantly, the above command in matplotlib generates many many line
objects and takes forever to render. if i don't specify 'bo' and simply call
plot(x, x, 'o') it makes every point in a *different color*. why is that?
how can i change that? i feel like i must be doing something wrong here.
 thanks.
1 message has been excluded from this view by a project administrator.

Showing 16 results of 16

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /