sillydist | R Documentation |
Sillydist provides a distance of any point vs. the axes of a plot. This just takes the abs(distances) of each point to the axes, normalizes them against the largest point on the axes, multiplies the result, and normalizes against the max of all point.
sillydist(firstterm, secondterm, firstaxis = 0, secondaxis = 0)
firstterm |
X-values of the points. |
secondterm |
Y-values of the points. |
firstaxis |
X-value of the vertical axis. |
secondaxis |
Y-value of the second axis. |
Dataframe of the distances.
[ggplot2]
## Not run:
mydist <- sillydist(df[,1], df[,2], first_median, second_median)
first_vs_second <- ggplot(df, aes(x = .data[["first"]], y = .data[["second"]]),
environment = hpgl_env) +
ggplot2::xlab(paste("Expression of", df_x_axis)) +
ggplot2::ylab(paste("Expression of", df_y_axis)) +
ggplot2::geom_vline(color = "grey", xintercept=(first_median - first_mad), size = line_size) +
ggplot2::geom_vline(color = "grey", xintercept=(first_median + first_mad), size = line_size) +
ggplot2::geom_vline(color = "darkgrey", xintercept = first_median, size = line_size) +
ggplot2::geom_hline(color = "grey", yintercept=(second_median - second_mad), size = line_size) +
ggplot2::geom_hline(color = "grey", yintercept=(second_median + second_mad), size = line_size) +
ggplot2::geom_hline(color = "darkgrey", yintercept = second_median, size = line_size) +
ggplot2::geom_point(colour = grDevices::hsv(mydist$dist, 1, mydist$dist),
alpha = 0.6, size = size) +
ggplot2::theme(legend.position = "none")
first_vs_second ## dots get colored according to how far they are from the medians
## replace first_median, second_median with 0,0 for the axes
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.