ggsmatr | R Documentation |
Create a scatter plot based on the coefficients from (Standardised) Major Axis Estimation fit.
ggsmatr(data, groups , xvar , yvar, sma.fit)
data |
a dataframe. |
groups |
group variable. |
xvar |
x variable for drawing. |
yvar |
y variable for drawing. |
sma.fit |
an sma or ma object fitted in SMATR package. |
ggplot based plot of sma.
datafile <- system.file("iris.csv", package = "ggsmatr")
df.iris <- read.csv(datafile, encoding = "UTF-8")
library(ggsmatr)
library(ggplot2)
library(smatr)
fit = sma(Sepal.Length ~ Sepal.Width + Species,
data = df.iris,shift=TRUE, elev.test=TRUE)
#
ggsmatr(data = df.iris, groups = "Species",
xvar = "Sepal.Width", yvar = "Sepal.Length",
sma.fit = fit) +
theme(legend.position = "top", legend.title=element_blank())+
ylab("Sepal.Length")+
xlab("Sepal.Width")+
theme(legend.position = "top")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.