tern_limits | R Documentation |
tern_limits
(or its aliasses) appends new T
, L
and R
ternary continuous scales,
where the maximum scale value is specified, and, where the minimums for each are solved.
tern_limit(T = 1, L = 1, R = 1, ...)
limit_tern(...)
T , L , R |
numeric value (scalar) of the maximum |
... |
other arguments to pass to ALL of |
The contra value (ie minimum value) for the T
, L
and R
species is solved using
linear equations, therefore, if the solution is degenerate, or, the solution results in a zero range in either
of the proposed scales, then a warning message will be reported and an empty list returned. Note that
limits_tern(...), limit_tern(...)
and tern_limit(...)
are all aliasses for
the main function, tern_limits(...)
and can be used interchangeably.
Either an empty list (when no solution can be found), or a list containing one of each
of scale_X_continuous
(X = T, L, R
)
Nicholas Hamilton
scale_T_continuous
, scale_L_continuous
and scale_R_continuous
#Display a non-zoomed and zoomed plot side by side
data(Feldspar)
df.lims = data.frame(Ab = c(1,.25,.25),
An = c(0,.75,.00),
Or = c(0,.00,.75))
#Build the non-zoomed plot
A = ggtern(Feldspar,aes(Ab,An,Or)) +
stat_density_tern(geom='polygon',aes(fill=..level..,alpha=..level..)) +
geom_point() +
geom_mask() +
geom_polygon(data=df.lims,color='red',alpha=0,size=0.5) +
guides(color='none',fill='none',alpha='none') +
labs(title = "Non-Zoomed")
#Build the zoomed plot
B = A +
tern_limits(T=max(df.lims$An), L=max(df.lims$Ab), R=max(df.lims$Or)) +
labs(title = "Zoomed")
#Arrange the above plots side by side for illustration
grid.arrange(A,B,ncol=2,top="Demonstration of Limiting Region")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.