Sometimes one wants to use a function that takes variables as strings and then pastes them into ggplot(). This can easily be done with aes_string(). However, aes_string() is missing from ggtern, so it falls back to using the ggplot2 version. This however means that the z variable is not found.
Sometimes one wants to use a function that takes variables as strings and then pastes them into
ggplot()
. This can easily be done withaes_string()
. However,aes_string()
is missing from ggtern, so it falls back to using the ggplot2 version. This however means that the z variable is not found.Example function I was trying to use:
Calling this gives something like:
Workaround:
One has to declare the name of the z variable explicitly, like this: