ggtern

ternary plot of ggtern not working in shiny

不问归期 提交于 2020-06-02 03:35:47
问题 I want to use the output of ggtern() in a shiny app. However it seems to fail due to some constraints. This is what it should look like: This is the actual shiny output: See here for a reproducible example: library(shiny) library(ggtern) ui <- fluidPage( mainPanel( plotOutput("ggtern") ) ) server <- function(input, output) { output$ggtern <- renderPlot({ ggtern(data.frame(x=10, y=30, z=60), aes(x, y, z)) + geom_point() }) } shinyApp(ui = ui, server = server) Do I overlook something? 回答1:

ternary plot of ggtern not working in shiny

*爱你&永不变心* 提交于 2020-06-02 03:35:14
问题 I want to use the output of ggtern() in a shiny app. However it seems to fail due to some constraints. This is what it should look like: This is the actual shiny output: See here for a reproducible example: library(shiny) library(ggtern) ui <- fluidPage( mainPanel( plotOutput("ggtern") ) ) server <- function(input, output) { output$ggtern <- renderPlot({ ggtern(data.frame(x=10, y=30, z=60), aes(x, y, z)) + geom_point() }) } shinyApp(ui = ui, server = server) Do I overlook something? 回答1:

How can I show the real values (%) of my datas in ggtern?

会有一股神秘感。 提交于 2020-02-25 05:04:48
问题 I would like to get approximately the same result as it is shown in the example below. I hesitate between these two functions to get this result: geom_crosshair_tern and scale_X_continuous . Hamilton, N. E., & Ferry, M. (2018). ggtern: Ternary Diagrams Using ggplot2. Journal of Statistical Software, 87(1), 1‑17. https://doi.org/10.18637/jss.v087.c03 Here is the script i have written until now: points1 <- data.frame( rbind(c( 1,45,30,25), c( 2,33,33,34), c( 3,15,75,10) ) ) colnames(points1) =

Ternary plots with binned means/medians

喜你入骨 提交于 2020-01-04 07:10:55
问题 I am looking to generate a ternary plot with binned polygons ( either triangle or hex, preferably in a ggplot framework ) where the color of the polygon is a binned mean or median of selected values. This script gets very close, but triangle cell color is representative of a number of observations, rather than a mean value of observations contained within the triangle cell. So rather than soley providing X,Y, and Z; I would provide a fourth fill/value variable is provided from which binned

ggtern contour plot in R [closed]

∥☆過路亽.° 提交于 2020-01-03 17:17:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I have this data file that has enough data points for me to plot a "heatmap" in ternary plot. (It is not really heat map, just a scatter plot with enough data points) library(ggtern) library(reshape2) N=90 trans.prob = as.matrix(read.table("./N90_p_0.350_eta_90_W12.dat",fill=TRUE)) colnames(trans.prob) = NULL #

How to fill colors correctly using geom_polygon in ggtern?

青春壹個敷衍的年華 提交于 2019-12-19 08:58:56
问题 Here is the code which I am using to create boundaries in my ternary diagram: library(ggtern) DATA <- data.frame(x = c(0,0,0.04), y = c(1,0.6,0.575), z = c(0,0.4,0.385), xend = c(0.4,0.21,0.1), yend = c(0.0,0.475,0), zend = c(0.6,0.315,0.9), Series = c("yz","xz","xy")) ggtern(data=DATA,aes(x,y,z,xend=xend,yend=yend,zend=zend)) + geom_segment(aes(color=Series),size=1) + scale_color_manual(values=c("darkgreen","darkblue","darkred")) + theme_bw() + theme_nogrid() + theme(legend.position=c(0,1)

Ternary heatmap in R

回眸只為那壹抹淺笑 提交于 2019-12-18 03:45:12
问题 I'm trying to come up with a way of plotting a ternary heatmap using R. I think ggtern should be able todo the trick, but I don't know how to do a binning function like stat_bin in vanilla ggplot2. Here's What I have so far: require(ggplot2) require(ggtern) require(MASS) require(scales) palette <- c( "#FF9933", "#002C54", "#3375B2", "#CCDDEC", "#BFBFBF", "#000000") sig <- matrix(c(1,2,3,4),2,2) data <- data.frame(mvrnorm(n=10000, rep(2, 2), Sigma)) data$X1 <- data$X1/max(data$X1) data$X2 <-

Why does ggplotly break when ggtern is loaded?

回眸只為那壹抹淺笑 提交于 2019-12-11 19:44:59
问题 I was hoping to use plotly::ggplotly() to plot a graph produced with ggtern() with a tooltip feature. But loading the package ggtern caused ggplotly to throw the following error: Error in inherits(theme[[element]], ggplot_global$element_tree[[element]]$class) : 'what' must be a character vector What's more, this error appears for all graphs, not just those produced by ggtern. Here is an example. library(ggplot2) # This works gg.mtcars <- ggplot(mtcars, aes(hp, mpg)) + geom_point() plotly:

R - ggtern + geom_interpolate_tern, why is the plot not smooth at the symmetry line (triangle height)?

天涯浪子 提交于 2019-12-11 07:59:19
问题 ggtern output I am trying to plot the following data > foo Resp A B C 1 1.629 0.3333333 0.3333333 0.3333333 2 1.734 0.1666667 0.6666667 0.1666667 3 1.957 0.0000000 1.0000000 0.0000000 4 1.778 1.0000000 0.0000000 0.0000000 5 1.682 0.6666667 0.1666667 0.1666667 6 1.407 0.1666667 0.1666667 0.6666667 7 1.589 0.0000000 0.5000000 0.5000000 8 1.251 0.0000000 0.0000000 1.0000000 9 1.774 0.5000000 0.5000000 0.0000000 10 1.940 0.5000000 0.0000000 0.5000000 > Using ggtern() + geom_interpolate_tern( data

How to fill colors correctly using geom_polygon in ggtern?

萝らか妹 提交于 2019-12-01 06:34:03
Here is the code which I am using to create boundaries in my ternary diagram: library(ggtern) DATA <- data.frame(x = c(0,0,0.04), y = c(1,0.6,0.575), z = c(0,0.4,0.385), xend = c(0.4,0.21,0.1), yend = c(0.0,0.475,0), zend = c(0.6,0.315,0.9), Series = c("yz","xz","xy")) ggtern(data=DATA,aes(x,y,z,xend=xend,yend=yend,zend=zend)) + geom_segment(aes(color=Series),size=1) + scale_color_manual(values=c("darkgreen","darkblue","darkred")) + theme_bw() + theme_nogrid() + theme(legend.position=c(0,1),legend.justification=c(0,1)) + labs(title = "Sample Midpoint Segments") And this code produces the