SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Andrea R. <ari...@pi...> - 2005年02月24日 20:55:16
Hi all,
I'm an absolutely matplotlib newbie, so I'm sorry if my question is 
trivial. Anyway I've read the user guide and looked at the examples 
without finding out a solution.
Here it is my problem. Suppose I have a 2-dimensional array containg my 
data, and I want to produce a surface or a contour plot with it. Now 
the imshow() function seems the right way to go through. So far so 
good. Now suppose I want to draw the x,y axes for this plot, and 
suppose my axes are represented by **not-uniform** 1-dimensional array 
x[i], y[j]. How can I get the right ticks on the plot axes??
I hope to have been clear. Thanks in advance,
 Andrea.
From: John H. <jdh...@ac...> - 2005年02月25日 17:52:25
>>>>> "Andrea" == Andrea Riciputi <ari...@pi...> writes:
 Andrea> Hi all, I'm an absolutely matplotlib newbie, so I'm sorry
 Andrea> if my question is trivial. Anyway I've read the user guide
 Andrea> and looked at the examples without finding out a solution.
 Andrea> Here it is my problem. Suppose I have a 2-dimensional
 Andrea> array containg my data, and I want to produce a surface or
 Andrea> a contour plot with it. Now the imshow() function seems
 Andrea> the right way to go through. So far so good. Now suppose I
 Andrea> want to draw the x,y axes for this plot, and suppose my
 Andrea> axes are represented by **not-uniform** 1-dimensional
 Andrea> array x[i], y[j]. How can I get the right ticks on the
 Andrea> plot axes??
You need to interpolate your data onto a rectilinear grid and then use
pcolor. imshow requires that your data be an image -- eg the dx and
dy between rows and columns is the same between every row and column.
pcolor only assumes a rectilinear grid, so the dx and dy can vary from
row to row and column to column. But you have unstructured data.
In matlab, the interpolation is handled by the griddata function.
Peter Groszkowski promised to post some code he uses to for this
purpose back in December, but apparently he got lost in the stars.
matlab uses a delaunay triangulation according to the documentation
for griddata -- I think Peter uses a different approach. I looked at
the scipy interpolate module but didn't see anything that looked just
right -- perhaps I missed it. It surprises that scipy doesn't
have a delaunay triangulation routine, but apparently it does not.
A quick google for revealed
http://www.python.org/pypi?:action=display&name=Delny&version=0.1.0a2
which relies on the gnu qhull library...
A griddata function for mpl would be a nice complement to the meshgrid
function.
JDH
From: Perry G. <pe...@st...> - 2005年02月25日 19:57:45
On Feb 25, 2005, at 12:40 PM, John Hunter wrote:
>>>>>> "Andrea" == Andrea Riciputi <ari...@pi...> writes:
>
> Andrea> Hi all, I'm an absolutely matplotlib newbie, so I'm sorry
> Andrea> if my question is trivial. Anyway I've read the user guide
> Andrea> and looked at the examples without finding out a solution.
>
> Andrea> Here it is my problem. Suppose I have a 2-dimensional
> Andrea> array containg my data, and I want to produce a surface or
> Andrea> a contour plot with it. Now the imshow() function seems
> Andrea> the right way to go through. So far so good. Now suppose I
> Andrea> want to draw the x,y axes for this plot, and suppose my
> Andrea> axes are represented by **not-uniform** 1-dimensional
> Andrea> array x[i], y[j]. How can I get the right ticks on the
> Andrea> plot axes??
>
> You need to interpolate your data onto a rectilinear grid and then use
> pcolor. imshow requires that your data be an image -- eg the dx and
> dy between rows and columns is the same between every row and column.
> pcolor only assumes a rectilinear grid, so the dx and dy can vary from
> row to row and column to column. But you have unstructured data.
>
I'm not sure if that is what is being said. What may be referred to is 
a structured 2-d image for which it is intended that the data 
coordinates be taken from the x and y arrays (for corresponding 
locations). The contour task does allow one to give such x and y 
arrays, but not the image display tasks (if I remember correctly). Some 
clarification is needed.
Perry
From: Peter G. <pgr...@ge...> - 2005年02月28日 20:34:19
John Hunter wrote:
>>>>>>"Andrea" == Andrea Riciputi <ari...@pi...> writes:
>>>>>> 
>>>>>>
>
> Andrea> Hi all, I'm an absolutely matplotlib newbie, so I'm sorry
> Andrea> if my question is trivial. Anyway I've read the user guide
> Andrea> and looked at the examples without finding out a solution.
>
> Andrea> Here it is my problem. Suppose I have a 2-dimensional
> Andrea> array containg my data, and I want to produce a surface or
> Andrea> a contour plot with it. Now the imshow() function seems
> Andrea> the right way to go through. So far so good. Now suppose I
> Andrea> want to draw the x,y axes for this plot, and suppose my
> Andrea> axes are represented by **not-uniform** 1-dimensional
> Andrea> array x[i], y[j]. How can I get the right ticks on the
> Andrea> plot axes??
>
>You need to interpolate your data onto a rectilinear grid and then use
>pcolor. imshow requires that your data be an image -- eg the dx and
>dy between rows and columns is the same between every row and column.
>pcolor only assumes a rectilinear grid, so the dx and dy can vary from
>row to row and column to column. But you have unstructured data.
>
>In matlab, the interpolation is handled by the griddata function.
>Peter Groszkowski promised to post some code he uses to for this
>purpose back in December, but apparently he got lost in the stars.
>
yup.. i did get a little "lost in the stars" - I forgot about it in 
fact. I promise I will post it in the next few days - this time I mean 
it. ;)
-- 
Peter Groszkowski Gemini Observatory
Tel: +1 808 9742509 670 N. A'ohoku Place
Fax: +1 808 9359235 Hilo, Hawai'i 96720, USA 
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 によって変換されたページ (->オリジナル) /