Slightly different results in pdf data and fit.plot_pdf() function

24 views
Skip to first unread message

Jan Grießer

unread,
May 24, 2019, 9:45:23 AM5/24/19
to powerlaw-general
Hey there, 
I use powerlaw to fit my data. For display reasons, I first fit my data and then write the bin_edges and hist data using 
bin_edges = fit.pdf(original_data=True)[0]
hist = fit.pdf(original_data=True)[1]
into a file. Now, if I compare the results with the result of 
fit = powerlaw.Fit(observations, discrete=false)
ax = fit.plot_pdf(color="k", linestyle="-", original_data=True, label="observations")
I get additional data points in the lower part of my distribution (see also the comparison of the graphs below, I have already set the 0 entries to nan). Can you tell me why and where in the code these data points are deleted? 
Greetings,
Jan 

power_law_data.png
power_law_fit.png

Jan Grießer

unread,
May 24, 2019, 10:19:07 AM5/24/19
to powerlaw-general
Okay, I found the problem. In the standard use of Matplolib without markers, only points with neighboring points whose value is not equal to nan are connected. If you use marker=".", these points will be displayed, otherwise they just don't appear in the plot. 

Jeff Alstott

unread,
May 24, 2019, 9:09:51 PM5/24/19
to powerlaw...@googlegroups.com
Glad you got it sorted! Thanks for using powerlaw.

--
You received this message because you are subscribed to the Google Groups "powerlaw-general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to powerlaw-gener...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/powerlaw-general/a7d4917a-271d-436d-a174-b853182c0f78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages