Dodo
February 22, 2023, 1:53pm
1
CMBSI <- lm(BSI_GSI_mzp2_T ~ ctq_sum, data = Datamed_cleanpair)
summary(CMBSI)
windows()
ggplot(Datamed_cleanpair, aes(x = ctq_sum, y = BSI_GSI_mzp2_T)) +
geom_point() +
geom_smooth(method = lm, se = TRUE, fullrange = TRUE) +
xlab('CM-Load') +
ylab('GSI Score') +
geom_text(label = paste("R² = ", round(summary(CMBSI)$r.squared, 2)), x = 10, y = 5)
I get a scatterplot but the R² is not in the image and I would like to add the p.value as well.
I expect it would only run without error, and not show the R2 if x=10,y=5 were not within the plotting region. are they ?
1 Like
Dodo
February 22, 2023, 2:32pm
3
yes ! Can I add the p.value like this
windows()
ggplot(Datamed_cleanpair, aes(x = ctq_sum, y = BSI_GSI_mzp2_T)) +
geom_point() +
geom_smooth(method = lm, se = TRUE, fullrange = TRUE) +
xlab('CM-Load') +
ylab('GSI Score') +
geom_text(label = paste("R² = ", round(summary(CMBSI)$r.squared, 2)), x = 80, y = 30)+
geom_text(label = paste("p = ", round(summary(CMBSI)$p.value, 2)), x = 80, y = 35)
Dodo
February 23, 2023, 4:03pm
4
Yes, and it works when I put the x and y higher. But its kind of thick and not very pretty.
I woud like to have it also in the same row.
Are there different ways to but values in a graphic or do i need to do this with Excel ?
system
Closed
March 16, 2023, 4:03pm
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.