[Matplotlib] Ploting an exponential distribution frequency curve

Denis McMahon denismfmcmahon at gmail.com
Sat Apr 25 19:12:19 EDT 2015


On Sat, 25 Apr 2015 23:33:10 +0100, Mario Figueiredo wrote:

>     plot(list(results.keys()), list(results.values()))

matplotlib supports at least (from searching the website) 5 plot methods.

Which one are you using?

My first guess would be that the data format that plot expects isn't the 
format it's getting, as you appear to be passing a list of x values and a 
list of y values, is it possible that it expects a list of value pairs?

Sorry, but given a choice of 5 plot methods in matplotlib and no hint as 
to which one you're calling, I'm not inclined to go and look at the 
arguments of all of them.

One suggestion I would make, though:

try plot([0,1,2,3,4,5,6,7,8,9,10],[0,1,2,3,4,5,6,7,8,9,10])

and see if you get a straight line running through the co-ord pairs:

0,0; 1,1; 2,2; 3,3; 4,4; 5,5; 6,6; 7,7; 8,8; 9,9 and 10,10

If not, then try:

plot(zip([0,1,2,3,4,5,6,7,8,9,10],[0,1,2,3,4,5,6,7,8,9,10]))

And see what that produces.

If the second plot produces the line I described, try:

plot(zip(list(results.keys()), list(results.values())))

in your code.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list