Wayne Watson wrote:
> Eric Firing wrote:
>>>
>>> I'm pretty new to this stuff, so what belongs where is sometimes 
>>> unclear. I'll check out the sourceforge tip. I didn't write the 
>>> program. I'm just trying to add some features. Changing the import 
>>> for matplotlib got the graphics window up.
>>>     import matplotlib.pyplot as plt
>>>
>>> When I ran it, it was followed by this traceback:
>>> ------------start
>>> Exception in Tkinter callback
>>> Traceback (most recent call last):
>>>   File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
>>>     return self.func(*args)
>>>   File 
>>> "C:\Sandia_Meteors\Sentinel_Development\Development_Sentuser+Utilities\sentuser\sentuser_20090103+hist.py",
>>>  
>>> line 508, in ShowHistogram
>>>     plt.histogram(v, bins=linspace(0,256,nplt_bins+1), normed=1)# 
>>> matplotlib version (plot)
>>> AttributeError: 'module' object has no attribute 'histogram'
>>> ---------------end
>>> 508 line is the histogram. Who's complaining? ShowHistogram?  I don't 
>>> believe I should be using hist here instead of histogram.
>>
>> histogram is a numpy function, not a pyplot function.  Pyplot has a 
>> hist which uses numpy.histogram to do the calculation, and then plots 
>> it.  It does look like plt.hist is what was intended in your code.
>>
>> For tracking down such things, there is no substitute for working 
>> interactively with ipython.  If you are not already familiar with it, 
>> taking a little time to get it running and learn the basics (like tab 
>> completion and appending ? or ?? to function names to get docstrings + 
>> origins, and source code, respectively) will pay big dividends.
>>
>> Eric
> These dependencies sure are tricky. I changed it to plt:hist, and that 
> got me a histogram plot. I think some of my parameters need work, but 
> it's close to what I expected. When I closed the graph and finally the 
> program, the shell (IDLE) did not provide a >> prompt, nor did it 
> produce my print of "End of Histogram" that followed plt.hist. Closing 
> the shell revealed something was still running.  I may have to go to the 
> console for execution to see what that's about.

That is what ipython is for (among other things): it handles interactive 
plotting, which tends to be a problem with other shells and 
environments.  It also gives nice access to the pdb debugger to help you 
figure out what actually went wrong when you get an exception.

> 
> I've heard of ipython. It looks like I should give it a try. Examples 
> for matplotlib abound, but not much about how MATLAB concepts like 
> figure shows up anywhere. Is that all in pylab docs?
> 
Yes.  If you are coming from Matlab, you may find this useful for the 
numeric aspects: http://www.scipy.org/NumPy_for_Matlab_Users.

Eric

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to