Hello All
Thanks a lot Eric. I think I have some module missing but I cannot figure out what it is. I get the following. Any idea. This started hapening after I reinstalled matplotlib.
File "/Users/Kennel/Pythoncodes/coolingmodel.py", line 6, in <module>
import matplotlib
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/__init__.py", line 129, in <module>
from rcsetup import defaultParams, validate_backend, validate_toolbar
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/rcsetup.py", line 19, in <module>
from matplotlib.colors import is_color_like
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/colors.py", line 54, in <module>
import matplotlib.cbook as cbook
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/cbook.py", line 10, in <module>
import numpy.ma as ma
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/__init__.py", line 47, in <module>
import extras
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/ma/extras.py", line 45, in <module>
from numpy.lib.index_tricks import AxisConcatenator
ImportError: cannot import name AxisConcatenator
The first few lines of my codes are:
from math import *
import exceptions
import pmag
import matplotlib
matplotlib.use("TkAgg")
import numpy as np
import matplotlib.pyplot as plt
Thanks a lot for all your help.
Mitra
···
On Nov 1, 2009, at 11:32 PM, Eric Firing wrote:
R. Mitra wrote:
Hi Eric
from math import *
import matplotlib
matplotlib.use("TkAgg")
from pylab import *
This is very basic I know. The above are the modules I am using. Is plt a separate module? Thanks.With your method above, you don't need the "plt." part. "from pylab import *" is discouraged, however, except for quick interactive use. For scripts, it is generally considered better practice to use
import matplotlib
matplotlib.use("tkagg")
import numpy as np
import matplotlib.pyplot as pltpyplot is the plot-related part of the pylab namespace; or to put it another way, pylab is pyplot plus numpy.
See http://matplotlib.sourceforge.net/faq/usage_faq.html
Eric
RM
On Nov 1, 2009, at 7:26 PM, Eric Firing wrote:R. Mitra wrote:
Hi
I am having problems with contourf(). Suppose I have two 10X30 arrays X,Y and a corresponding Z value array. How do I make the upper left to be the origin? I cannot use contour (Z,origin='upper') because the axis values gets messed up.It sounds like maybe you want to reverse the y-axis. Try something like plt.gca().invert_yaxis() after your call to contourf.
Eric