jeffalstott / powerlaw

607 stars 134 forks source link

original data option for the power law plot #41

Open BMo-design opened 7 years ago

BMo-design commented 7 years ago

Hi,

when I activate the original data option the plot of my sample changes but not the power law fit. I guess that is an issue, or?

Here a plots of my sample without the original data option: testsingle_1 With the original data option: testsingle_originaldata_1

Here is my code:

       ax = fits[1].plot_ccdf()
    fits[1].power_law.plot_ccdf(ax=ax, color='r', linestyle='--', linewidth=1, label='Power law fit')#add powerlaw line
    plt.savefig("testsingle_{}.png".format(1))
    plt.close()

ax=fits[1].plot_ccdf(original_data = True)
    fits[1].power_law.plot_ccdf(ax=ax, color='r', linestyle='--', linewidth=1, label='Power law fit')#add powerlaw line
    plt.savefig("testsingle_originaldata_{}.png".format(1))
    plt.close()
BMo-design commented 7 years ago

Comparing the results of this library with the results of the script by Joel Ornstein http://tuvalu.santafe.edu/~aaronc/powerlaws/, I found that the blue line in the second figure is correct, but the fit (red line) should be at the same position as in the first picture....

jeffalstott commented 7 years ago

I don't understand the issue. Can you be more detailed in what you're expecting to happen, and how this is different from what you're seeing?

BMo-design commented 7 years ago

Hi Jeff, thanks for your answer. I would expect a figure like this: plot0

jeffalstott commented 7 years ago

What you're talking about was discussed here: https://groups.google.com/d/msg/powerlaw-general/A3aI-5efAuE/wpp6EGZut7gJ

@psinger implemented a proportionality constant ("shifting") capability in his fork here, but it didn't materialize into a fully-vetted pull request to merge into powerlaw. If you implement the functionality you want and make a pull request, I'll merge it in!

"powerlaw is open for further development. If there's a feature you'd like to see in powerlaw, submit an issue. Pull requests and offers for expansion or inclusion in other projects are welcomed and encouraged. The original author of powerlaw, Jeff Alstott, is now only writing minor tweaks, so contributions are very helpful."

pyguy3 commented 3 years ago

Just to say I would also find this feature useful, i.e. it would be great to be able to see the power law fit superimposed on the full dataset, not just the dataset starting at xmin. That way, it is easy to do a visual check on whether the xmin used is sensible.

jeffalstott commented 3 years ago

Thanks @pyguy3. As I mentioned back in 2017, if a fully-vetted pull request is made, I'll merge it in! @psinger got one started in his fork here.