ggtern is an R package to create ternary diagrams - it is an extension to ggplot2
Questions tagged [ggtern]
102 questions
7
votes
1 answer
How to use axis range and labels from original data in ggtern?
I am using ggtern in R to make a ternary plot, and would like to have the axis labels and breaks on my ggtern plot, the same as the original data. In the case of the generated data in the code below, each axis would go to a max of 12, 10 and…

Richard N. Belcher
- 154
- 1
- 2
- 8
7
votes
1 answer
Plotting a kde result in ggtern
I'm using ggtern to plot a large dataset in a form of tertiary plot (see below an example).
Till a certain data-size everything was perfect, as I was using geom_density_tern(). As I want to visualize a far more complicated dataset loading all of…

Ludwik
- 153
- 8
7
votes
1 answer
Ternary heatmap in R
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…

phildeutsch
- 683
- 1
- 8
- 18
5
votes
1 answer
How to animate a ternary plot in R
I am trying to animate a ternary plot in R with gganimate and I am facing into a wall.
library(tidyverse)
library(gganimate)
library(ggtern)
#> Registered S3 methods overwritten by 'ggtern':
#> method from
#> grid.draw.ggplot…

LDT
- 2,856
- 2
- 15
- 32
5
votes
2 answers
ggtern - distorted hex bin size and shape when faceted
I have an issue where geom_hex_tern works perfectly with single plots but the hex bin size and shape gets distorted when I make facets.
library(tidyverse)
library(ggtern)
# My data
dat <- structure(list(Fact2 = c(0.24, 0.24, 0.24, 0.24, 0.24, 0.24,…

flee
- 1,253
- 3
- 17
- 34
4
votes
1 answer
ggtern breaks ggplot2 and produces plots without axis labels etc
I noticed that, since ggplot2 released their new version (3.3.0), I can no longer use the package ggtern, as it completely breaks all my plots produced with ggplot2.
library(ggplot2)
df <- data.frame("x" = c(1,2), "y" = c(2,1))
ggplot(df, aes(x,y))…

Servus
- 373
- 3
- 14
4
votes
2 answers
How to fill colors correctly using geom_polygon in ggtern?
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),
…

R June
- 655
- 1
- 6
- 8
4
votes
2 answers
ggtern contour plot in R
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 =…

wdg
- 1,687
- 5
- 17
- 29
3
votes
1 answer
"Ignoring unknown aesthetics: z and zend" but freaks out without z and zend
When using the ggtern library to plot data on the simplex, R keeps giving me the warning
In ggplot2::geom_segment(data = lines, ggplot2::aes(x = x1, y = x2, :
Ignoring unknown aesthetics: z and zend
If I remove z and zend, it will give an…

Rebekah Scott
- 35
- 3
3
votes
0 answers
animate a ternary plot
I'm trying to animate a time-series of ternary plots made with ggtern. I'd like to animate the 'time' variable but am getting the error
Error: Mapping must have 3 unique named variable pairs
# Get ternary data:
df=data.frame(x=c(.7,.1,.3),
…

smm
- 75
- 4
3
votes
1 answer
Triangular plot for categorical variable
Here's a problem: What's the best way to plot values for threefold combinations of a categorical variable?
This is as far as I got in R:
library(tidyverse)
library(ggtern)
df_person <- tibble( name = c( 'Alice', 'Bob', 'Carla', 'Dave', 'Eve' ) )…

mrhd
- 1,036
- 7
- 16
3
votes
1 answer
Is there a way to have non-overlapping data point labels on a ternery plot in R?
I am trying to replicate a chart I found on FiveThirtyEight at https://fivethirtyeight.com/features/how-cable-news-reacted-to-the-cohen-hearing/. This shows a ternery plot where the location of the words in the 3 axis shows the proportion quoted…

Peter
- 107
- 1
- 9
3
votes
1 answer
How to avoid clipping of labels with ggtern/ggplot2 (like xpd=TRUE)
In the ternary plot below labels outside the axes are clipped. I can't find a setting for ggtern() or ggplot2 that avoids this. For base R graphics, I would just use xpd=TRUE.
My data:
modes <-
structure(list(Mode = c("Literature", "Poetry",…

user101089
- 3,756
- 1
- 26
- 53
3
votes
2 answers
How can I add specific, labeled points to a ggtern plot?
With ggplot2 I normally expect to be able to add a data point like so,
ggtern(df, aes(X, Y, Z, value = VALUE), aes(x, y, z)) +
geom_point(aes(fill = VALUE), size = 2, stroke = 0, shape = 21) +
scale_fill_gradient(low = "red",high =…

rjzii
- 14,236
- 12
- 79
- 119
3
votes
1 answer
ggtern: intersection between line (geom_segment) and smoothed data (geom_smooth_tern)
im currently working on visualization of an evaporation experiment. I've plotted a ternary phase diagram (NaCl-Na2SO4-H2O) with ggtern and data based on phreeqc simulation. Phase boundaries (red/blue) are smoothed data points (geom_smooth_tern).
>…

Christian S.
- 41
- 5