A simple Python script to plot and fit data (similar to Origin or SciDavis), but free, open source and LaTeX-friendly.
Project description
Plotestrem
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.
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 they = a * x + b
equation;"exp"
: exponential fit, will plot the exponential function and show the parameters for they = 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)
, withfit
being the coefficients. For example, a linear function would be passed as af(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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plotestrem-0.0.2.tar.gz
.
File metadata
- Download URL: plotestrem-0.0.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f560fe233ff1f3408f16051d45409b4162fb56be67236904fdb7c1fbaf330a20 |
|
MD5 | 01795b923b2573a702281f5f38b0d593 |
|
BLAKE2b-256 | dc0f22747733f70b5e1a54eb7abf72a210089da0be908075391dbcdae1fa8851 |
File details
Details for the file plotestrem-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: plotestrem-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ad8472e0f7a59ab5b7af4efeb48c7ba10f40c8898a73fc2a64cae3ee10a5b1e |
|
MD5 | e76202abf64f700c9d4cded1f71d97e6 |
|
BLAKE2b-256 | dfb1c8a42bc014f550fac17ef264373a5fab71c310f4048009c069ddc6674acf |