Skip to main content

A simple Python script to plot and fit data (similar to Origin or SciDavis), but free, open source and LaTeX-friendly.

Project description

Plotestrem

Python 3 PyPI GPLv3.0

Small Python script for rapidly fitting data in the context of experimental sciences. With Plotestrem, you can easily fit (almost) any function and get a beautiful and scalable graphic. The axes are completely LaTeX-friendly, so you can use any packages you want. It also means you can use the same font as your main document.

For now, the equation is only generated for linear and exponential fitting, which should be sufficient for many applications. Maybe in the future I'll add more support.

This code is quite old, so it's not well-written, but it works.

Example

Usage

You'll need Python 3 installed and a LaTeX distribution. Then install the package:

pip3 install plotestrem

Once you have everything set up, open runner.py, add your data and run.

Yeah, it have no interface. Maybe one day. Who knows.

Fitting types

You can fit the data using three builtin fitters, or provide your own function. You just need to pass fit_type accordingly.

  • "linear": linear fit, will plot a line and show the parameters for the y = a * x + b equation;
  • "exp": exponential fit, will plot the exponential function and show the parameters for the y = a * exp(-b * x) + c equation;
  • "none": no fitting. It just skips the regression. Your data will be plotted as a scatter plot;
  • Lastly, you can provide a function (a lambda or just the name of an existing function, without the parenthesis) to be used in the fitting. For now, the program shows only the R² value (not the parameters) for user-defined functions, but this is an interesting feature to have in the future. Also, the function to be passed should be in the form f(x, *fit), with fit being the coefficients. For example, a linear function would be passed as a f(x, a, b).

Why Plotestrem?

It's how a mineiro (native of Minas Gerais -- Brasil) would say "Plot this thing". Here you can listen a canonical speech, but it's not correct (as it's not mineiro). This one is a little better.

Author

Developed by Heliton Martins.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotestrem-0.0.2.tar.gz (16.8 kB view hashes)

Uploaded Source

Built Distribution

plotestrem-0.0.2-py3-none-any.whl (17.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page