Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalization scrambles points and curves #10

Open
bjreisman opened this issue Mar 8, 2020 · 1 comment
Open

Normalization scrambles points and curves #10

bjreisman opened this issue Mar 8, 2020 · 1 comment

Comments

@bjreisman
Copy link
Contributor

Hi there, I'm a big fan of the package. I came across the following issue when using the normal = T option in plot.drc. I've included the following reproducible example.

Plotting the unnormalized data works just fine:

library(drc)
mydata <- read.csv("repex.csv")
drc.model <-  drm(abs ~ conc, drug, data = mydata, fct = LL.4())
plot(drc.model, 
     type = "average",
     normal = F, 
     col = T, 
     broken = T, 
)

image

...but when I set the normal option to TRUE, the points for labels and curves for Ap Am appear to be mismatched. The curves are correct, but the points are misplotted

plot(drc.model, 
     type = "average",
     normal = T, 
     col = T, 
     broken = T, 
)

image

Setting type = "bars" also seems to normalize the curves, but not the error bars:

plot(drc.model, 
     type = "bars",
     normal = T, 
     col = T, 
     broken = T, 
)

image

The first issue can be corrected by sorting the data alphabetically first., but in a fix it would be desirable to control the order of the points in the legend.

Happy to contribute to a potential fix. 🤓

@bjreisman
Copy link
Contributor Author

repex.zip
Whoops, forgot to include the data used to generate these plots.

bjreisman added a commit to bjreisman/drc that referenced this issue Mar 9, 2020
bjreisman added a commit to bjreisman/drc that referenced this issue Mar 9, 2020
Added reordering to the normalization code blocks, each item is named before normalizaiton, noramlized by curve, then reordered to match the original order.
daniel-gerhard added a commit that referenced this issue May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant