wptmdoorn / methcomp

Python package providing functionality and plotting for chemistry method comparison
MIT License
13 stars 8 forks source link

Passing Bablok plot reference line #26

Open nf260 opened 2 years ago

nf260 commented 2 years ago

Hi

Just discovered this package while searching for Passing Bablok implementations in Python - looks like an amazing resource!

I have tried out the Passing Bablok fit with my data but I am getting some odd results for the reference/identity line.

Here is the data I am working with.

data.csv

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

df = pd.read_csv('data.csv')

from methcomp.regression import passingbablok

plt.figure(figsize=(8,6),dpi=200)
passingbablok(method1 = df['method1'],
              method2= df['method2'])

It looks like the reference line goes right through my data.

image

However, this was not what I was expecting! If I add a reference line manually then this affects the reference line plotted by passingbablok, which overlaps with the reference line I have plotted and now it is more obvious that method 2 has a slight positive bias.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

df = pd.read_csv('data.csv')

from methcomp.regression import passingbablok

plt.figure(figsize=(8,6),dpi=200)
passingbablok(method1 = df['method1'],
              method2= df['method2'])

X_plot = np.linspace(3, 14, 100)
Y_plot = X_plot
plt.plot(X_plot, Y_plot, color='black',linestyle='dotted')

image

wptmdoorn commented 2 years ago

Hi @nf260 thank you for the interest in the package. I will look into your issue and come back to you this week.