PPS 3-State Model
I recently found THIS site on the internet which I thought would be another good case-study.
As a standalone figure, it can be rendered as follows with ggtern:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#Load the data df <- read.table(file = "~/Desktop/PPS-data.txt", header = T) #Create the plot and store plot <- ggtern(data = df, aes(x = Xyp, y = XO, z = XY)) + geom_point(aes(fill = Root), size = 4, shape = 21, color = "black") + ggtitle("PPS 3-State Model") + labs(fill = "Root States") + theme_tern_rgbw() + theme(legend.position = c(0,1), legend.justification = c(0, 1)) #Render plot |
However, in order to distinguish the different categories, perhaps a facetted approach would be better:
1 2 |
#Render w/ Facetting plot + facet_wrap(~Root) |






Comments
Can you attach the txt file please, so a beginner like me can learn.
Very cool, but as HAMMAO notes, could you make sure the data are available for these examples so we can replicate them?
Sorry, I was travelling at the time and didn’t save the data down. The original source file that I was referring to is no longer on the web. The data is fairly trivial, surely you can come up with an equivalent set.
Hello, Nick,
Could you please explain what does “root” mean, and how can we use roots? Thanks!
Janet, I think this example is becoming too problematic, because I have lost the original data. Root, was one of the named columns in the source dataset. By using the term ‘Root”, mapped to fill and also the faceting, this means that for every unique value of ‘Root’ (in this case there were 4 unique values) a new facet gets generated, and also a new point fill colour. Hope this helps. Cheers, N
Thank you Nick!
I want to draw a triangle plot for some metabolite data. So each subject has three kinds of metabolites, which is three-way in the triangle plot, and subjects are from two city. I want to use different colors to represent subjects from two cities.
I originally used triangle.plot() to draw it, but it does not support color adjustment (does it?)
Now I wish to use this package. But somehow it doesnt work ( I am a beginner…)
So my data is like
id city a% b% c%
1 1 10 10 80
2 1 5 5 90
3 2 7 7 86
Could you please give me some instructions based on my situation?
Thanks a lot!
Janet,
I have emailed you, for anyone else, see below:
Probably get rid of the special characters (% signs) in the titles of your data-frame and save down somewhere (my case desktop) as ‘sample.txt’
Now you can load the data, and create a base plot:
Because the data is in the lower right corner, use
limit_tern()
to focusHi all,
This was my dataset originally. The original data (observed or “emp”) comes from the type of sex chromosomes that we observe in living beetles. This provides a single point on the plot. All of the other points are the results of simulating the evolution of sex chromosomes in beetles. Part of the process in doing the simulation is choosing a state for the root or beginning of the simulation. I have posted an update where you can simulate data to use for these type of plots under a phylogenetic (evolutionary) or non-phylogenetic model.
new post: http://coleoguy.blogspot.com/2015/09/ternary-diagram-working-example.html
Here is a link to the paper that I was working on where you can see the actual application of the approach:
http://www.genetics.org/content/197/2/561.short
Heath,
Thankyou so much for getting in touch. Are you happy for this case study to remain, would you like me to update/modify it in any way?
Cheers,
Nick
Nick,
No it looks great I just wanted to provide a bit of background and links to the updated post.
cheers
Heath
0.20
1.76
98.04
2.67
10.67
86.67
8.57
20.00
71.43
14.55
21.82
63.64
40.00
40.00
20.00
50.00
33.33
16.67
58.33
25.00
16.67
69.57
17.39
13.04
81.82
9.09
9.09
Hi.. My dataset for the ternary plot are as above.. I tried to load the dataset in R software but I could not do it using load workspace from file menu.. can u please help on this by giving the screenshots or videos for how to use R software-ggtern??
thanks,
kinjal parikh
kinjalparikh1@yahoo.com
research scholar
faculty of pharmacy
the m s university of baroda
gujarat, india
consider it as a b c. a b c. idk how it came into 1 column instead of 3..
Kinjal, try this:
Hi there,
how do I plot points that lie directly at one of the axes so that they are fully visible and not cut because they partially extend out of the plotting region? The point close to the C vertex in the plot above (from 13/08/2016 | 10:04) is an example of this undesirable visualization.
I would be grateful for any hints on how to fix this. Thanks!
Linda
Linda, thanks for you question. There are a couple of ways:
theme_nomask()
, orgeom_mask(...) + geom_point(...)
.If the mask layer is not put somewhere explicitly, it is added as the final layer, unless the mask is switched off entirely.
Many thanks for your reply! Works perfectly now!
Hello dear Hamilton
How we can add geometric mean in ggtern package to ternary plot
I have noticed you don’t monetize your site, don’t waste your traffic, you can earn extra
cash every month because you’ve got hi quality content.
If you want to know how to make extra money, search for:
best adsense alternative Wrastain’s tools
I need urgent help to make a triangular graphic with beta diversity components, I can upload my data matrix, if someone can explain how to do it.
my email asiel.cabrera@estudiantes.uo.edu.cu
I have the following script and produced ternary plots. However, after some months latter the script is not able to generate similar plots. I have the following error: