I'm on Win XP, and have no idea where the images went. I guess I'll have
to search my C-disk. I just began the search.

Looking at C:\Python25, I see no image files. Same with C:\Python25\Scripts

If I put some code up front as below, the image comes up on my screen,
but using a range of 0 to 8 and 0, 18 changes nothing. Further the
program hangs up.

So far matplotlib pretty much leaves the user on his own. Yes, there are
plenty of examples, but there seem to be no explanations about matters
like figure or show. No tutor on any of this I guess. Apparently, they
are leaving it up to one's MATLAB experience. It's been quite awhile
since I used that. It still resides on my computer.

Ah, the png files were found in the folder where the program is located.
I can clearly see the changes from your switches between range values.

=================inserted a few lines at the top and some print debug
stmts=====
import matplotlib.pyplot as plt
print "let's start the histogram"
plt.hist([1, 2, 3, 4, 5], range=(0, 18))
plt.show()
#raw_input("Hey")
fig = plt.figure()
plt.hist([1, 2, 3, 4, 5], range=(0, 20))
plt.show()
plt.savefig("hist_0_20.png")
plt.close(fig)

fig = plt.figure()
plt.hist([1, 2, 3, 4, 5], range=(0, 8))
plt.savefig("hist_0_8.png")
plt.close(fig)
print "finished"

Johan Grönqvist wrote:
> Wayne Watson skrev:
>   
>> Anyway, where, folder, does your program write the files? I'm not
>> familiar with figure, but apparently using it produces some "canvas"
>> that plt.hist places it's output on. One can than save fig to a file.
>> What happens if I don't use figure? I just put a copy of the line
>> plt.hist([1, 2, 3, 4, 5], range=(0, 20)) after import. When I execute
>> the program, I don't see a graphic appear. So doesn't matplotlib produce
>> graphic output aside from use of figure?
>>
>>     
>
> My intuition is exactly like that.
>
> After importing matplotlib.pyplt as plt, plt.figure creates an object 
> that acts as canvas, and then I plot various things (hist, is one 
> example), and when I am satisfied, I plt.savefig(path) or plt.show() the 
> figure. The figures are saved in the directory where the script is run 
> (its cwd, or current working directory, on linux).
>
> I have also used hist without having a figure, but that was because I 
> wanted the histogram data, i.e., the numbers of data points in the 
> different bins. That script used plt.hist to generate such data, and 
> later (after running fig = plt.figure) used plt.plot to plot parts of 
> the data in different ways.
>
> By the way, matplotlib.pyplot is one way of using matplotlib. There is 
> also the "object oriented interface", which I have never used.
>
>
>
>
>
> / johan
>
>
> ------------------------------------------------------------------------------
> 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
>
>   

-- 
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                   350 350 350 350 350 350 350 350 350 350
                     Make the number famous. See 350.org
            The major event has passed, but keep the number alive.

                    Web Page: <www.speckledwithstars.net/>



------------------------------------------------------------------------------
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