Hi,
I was wondering if its possible to create this sort of graph (result from structure software for population genetics) from the data below.
Image>
http://tinypic.com/r/1z3nhhd/7
I decided to describe the image as it is too small to see details. The values in data column ‘Sample’ are the x axis points on the graph.
The y axis extends from 0 to 1, which is adds up columns cluster01, cluster02 and cluster03. The colours correspond to the 3 clusters.
I am not sure if all that made sense.
data>
Sample Cluster 01 Cluster 02 Cluster 03
000001: 0.000000000000000 1.000000000000000 0.000000000000000 1
000002: 0.000750000000000 0.999250000000000 0.000000000000000 1
000003: 0.000000000000000 1.000000000000000 0.000000000000000 1
000004: 0.000000000000000 1.000000000000000 0.000000000000000 1
000005: 0.000450000000000 0.999550000000000 0.000000000000000 1
000006: 0.000500000000000 0.999500000000000 0.000000000000000 1
000007: 0.102725000000000 0.897250000000000 0.000025000000000 1
000008: 0.000425000000000 0.999575000000000 0.000000000000000 1
000009: 0.070425000000000 0.929575000000000 0.000000000000000 1
000010: 0.000000000000000 1.000000000000000 0.000000000000000 1
000011: 0.000000000000000 1.000000000000000 0.000000000000000 1
000012: 0.011425000000000 0.988575000000000 0.000000000000000 1
000013: 0.000000000000000 1.000000000000000 0.000000000000000 1
000014: 0.000000000000000 1.000000000000000 0.000000000000000 1
000015: 1.000000000000000 0.000000000000000 0.000000000000000 1
000016: 0.088225000000000 0.911775000000000 0.000000000000000 1
000017: 0.082550000000000 0.917400000000000 0.000050000000000 1
000018: 0.000175000000000 0.999825000000000 0.000000000000000 1
000019: 0.000025000000000 0.999975000000000 0.000000000000000 1
000020: 0.000000000000000 1.000000000000000 0.000000000000000 1
000021: 0.000000000000000 1.000000000000000 0.000000000000000 1
000022: 0.000000000000000 1.000000000000000 0.000000000000000 1
000023: 0.000400000000000 0.999600000000000 0.000000000000000 1
000024: 0.000000000000000 1.000000000000000 0.000000000000000 1
000025: 0.000050000000000 0.999950000000000 0.000000000000000 1
000026: 0.000075000000000 0.999925000000000 0.000000000000000 1
000027: 0.000000000000000 1.000000000000000 0.000000000000000 1
000028: 0.000000000000000 1.000000000000000 0.000000000000000 1
000029: 0.020975000000000 0.979025000000000 0.000000000000000 1
000030: 0.000000000000000 1.000000000000000 0.000000000000000 1
000031: 0.000000000000000 1.000000000000000 0.000000000000000 1
000032: 0.000000000000000 1.000000000000000 0.000000000000000 1
000033: 0.262200000000000 0.737725000000000 0.000075000000000 1
000034: 0.000000000000000 1.000000000000000 0.000000000000000 1
000035: 0.203375000000000 0.796625000000000 0.000000000000000 1
000036: 0.000700000000000 0.999300000000000 0.000000000000000 1
000037: 0.000000000000000 1.000000000000000 0.000000000000000 1
000038: 0.174400000000000 0.825600000000000 0.000000000000000 1
000039: 0.000600000000000 0.999400000000000 0.000000000000000 1
000040: 0.000000000000000 1.000000000000000 0.000000000000000 1
000041: 0.000025000000000 0.999975000000000 0.000000000000000 1
000042: 0.000125000000000 0.999875000000000 0.000000000000000 1
000043: 0.000450000000000 0.999550000000000 0.000000000000000 1
000044: 0.000200000000000 0.999700000000000 0.000100000000000 1
000045: 0.999975000000000 0.000025000000000 0.000000000000000 1
000046: 1.000000000000000 0.000000000000000 0.000000000000000 1
000047: 0.999775000000000 0.000000000000000 0.000225000000000 1
000048: 0.997900000000000 0.000600000000000 0.001500000000000 1
000049: 0.999450000000000 0.000000000000000 0.000550000000000 1
000050: 1.000000000000000 0.000000000000000 0.000000000000000 1
000051: 0.999950000000000 0.000000000000000 0.000050000000000 1
000052: 1.000000000000000 0.000000000000000 0.000000000000000 1
000053: 0.999450000000000 0.000225000000000 0.000325000000000 1
000054: 0.981550000000000 0.000400000000000 0.018050000000000 1
000055: 1.000000000000000 0.000000000000000 0.000000000000000 1
000056: 0.895600000000000 0.104250000000000 0.000150000000000 1
000057: 0.795175000000000 0.000000000000000 0.204825000000000 1
000058: 0.999900000000000 0.000100000000000 0.000000000000000 1
000059: 0.999025000000000 0.000000000000000 0.000975000000000 1
000060: 0.999600000000000 0.000000000000000 0.000400000000000 1
000061: 0.999275000000000 0.000225000000000 0.000500000000000 1
000062: 0.000075000000000 0.000000000000000 0.999925000000000 1
000063: 0.000000000000000 0.000000000000000 1.000000000000000 1
000064: 0.000000000000000 0.000000000000000 1.000000000000000 1
000065: 0.074400000000000 0.000050000000000 0.925550000000000 1
000066: 0.000325000000000 0.000000000000000 0.999675000000000 1
000067: 0.000000000000000 0.000000000000000 1.000000000000000 1
000068: 0.000525000000000 0.000000000000000 0.999475000000000 1
000069: 0.000000000000000 0.000000000000000 1.000000000000000 1
000070: 0.000000000000000 0.000000000000000 1.000000000000000 1
000071: 0.000075000000000 0.000000000000000 0.999925000000000 1
000072: 0.000000000000000 0.000000000000000 1.000000000000000 1
000073: 0.001500000000000 0.000000000000000 0.998500000000000 1
000074: 0.000800000000000 0.000000000000000 0.999200000000000 1
000075: 0.000000000000000 0.000000000000000 1.000000000000000 1
000076: 0.000000000000000 0.000000000000000 1.000000000000000 1
000077: 0.001525000000000 0.000000000000000 0.998475000000000 1
000078: 0.016925000000000 0.000000000000000 0.983075000000000 1
000079: 0.011750000000000 0.000000000000000 0.988250000000000 1
000080: 0.050625000000000 0.000000000000000 0.949375000000000 1
000081: 0.006800000000000 0.000000000000000 0.993200000000000 1
000082: 0.000000000000000 0.000000000000000 1.000000000000000 1
000083: 0.000000000000000 0.000000000000000 1.000000000000000 1
000084: 0.000000000000000 0.000000000000000 1.000000000000000 1
000085: 0.000075000000000 0.000000000000000 0.999925000000000 1
000086: 0.088150000000000 0.000000000000000 0.911850000000000 1
000087: 0.000100000000000 0.000000000000000 0.999900000000000 1
000088: 0.080600000000000 0.000000000000000 0.919400000000000 1
000089: 0.000000000000000 0.000000000000000 1.000000000000000 1
000090: 0.000000000000000 0.000000000000000 1.000000000000000 1
000091: 0.000000000000000 0.000000000000000 1.000000000000000 1
000092: 0.000000000000000 0.000000000000000 1.000000000000000 1
000093: 0.000000000000000 0.000000000000000 1.000000000000000 1
000094: 0.004325000000000 0.000000000000000 0.995675000000000 1
000095: 0.000000000000000 0.000000000000000 1.000000000000000 1
000096: 0.000000000000000 0.000000000000000 1.000000000000000 1
000097: 0.024100000000000 0.000175000000000 0.975725000000000 1
000098: 0.000000000000000 0.000000000000000 1.000000000000000 1
000099: 0.000000000000000 0.000000000000000 1.000000000000000 1
000100: 0.000275000000000 0.000000000000000 0.999725000000000 1
000101: 0.000125000000000 0.000000000000000 0.999875000000000 1
000102: 0.053750000000000 0.000000000000000 0.946250000000000 1
000103: 0.000000000000000 0.000000000000000 1.000000000000000 1
000104: 0.000000000000000 0.000000000000000 1.000000000000000 1
000105: 0.000000000000000 0.000000000000000 1.000000000000000 1
000106: 0.254750000000000 0.055675000000000 0.689575000000000 1
000107: 0.004900000000000 0.000000000000000 0.995100000000000 1
000108: 0.172050000000000 0.000000000000000 0.827950000000000 1
000109: 0.000000000000000 0.000000000000000 1.000000000000000 1
000110: 0.000000000000000 0.000000000000000 1.000000000000000 1
000111: 0.014800000000000 0.000000000000000 0.985200000000000 1
000112: 0.999925000000000 0.000000000000000 0.000075000000000 1
000113: 0.987450000000000 0.000000000000000 0.012550000000000 1
000114: 0.999800000000000 0.000000000000000 0.000200000000000 1
000115: 1.000000000000000 0.000000000000000 0.000000000000000 1
000116: 0.990400000000000 0.000075000000000 0.009525000000000 1
000117: 0.332775000000000 0.000000000000000 0.667225000000000 1
000118: 0.997450000000000 0.000100000000000 0.002450000000000 1
000119: 0.937575000000000 0.000000000000000 0.062425000000000 1
000120: 0.844525000000000 0.009325000000000 0.146150000000000 1
000121: 0.999725000000000 0.000000000000000 0.000275000000000 1
000122: 1.000000000000000 0.000000000000000 0.000000000000000 1
000123: 1.000000000000000 0.000000000000000 0.000000000000000 1
000124: 0.998375000000000 0.000575000000000 0.001050000000000 1
000125: 0.954650000000000 0.045225000000000 0.000125000000000 1
000126: 0.999875000000000 0.000125000000000 0.000000000000000 1
000127: 0.996900000000000 0.000000000000000 0.003100000000000 1
000128: 0.999625000000000 0.000000000000000 0.000375000000000 1
000129: 0.294300000000000 0.000000000000000 0.705700000000000 1
000130: 0.989625000000000 0.000000000000000 0.010375000000000 1
000131: 0.999225000000000 0.000000000000000 0.000775000000000 1
000132: 0.998625000000000 0.000000000000000 0.001375000000000 1
000133: 0.999200000000000 0.000025000000000 0.000775000000000 1
000134: 0.802125000000000 0.000050000000000 0.197825000000000 1
000135: 0.455800000000000 0.000000000000000 0.544200000000000 1
000136: 0.999900000000000 0.000100000000000 0.000000000000000 1
000137: 0.580175000000000 0.000000000000000 0.419825000000000 1
000138: 0.987175000000000 0.000000000000000 0.012825000000000 1
000139: 0.934850000000000 0.000000000000000 0.065150000000000 1
000140: 1.000000000000000 0.000000000000000 0.000000000000000 1
000141: 0.008875000000000 0.000000000000000 0.991125000000000 1
000142: 0.939300000000000 0.000000000000000 0.060700000000000 1
000143: 0.648175000000000 0.000100000000000 0.351725000000000 1
000144: 0.001600000000000 0.000000000000000 0.998400000000000 1
000145: 1.000000000000000 0.000000000000000 0.000000000000000 1
000146: 0.000050000000000 0.000000000000000 0.999950000000000 1
000147: 0.000000000000000 0.000000000000000 1.000000000000000 1
000148: 0.679750000000000 0.000725000000000 0.319525000000000 1
000149: 0.347675000000000 0.000000000000000 0.652325000000000 1
000150: 0.101775000000000 0.000000000000000 0.898225000000000 1
000151: 0.905900000000000 0.000000000000000 0.094100000000000 1
000152: 0.989725000000000 0.010000000000000 0.000275000000000 1
000153: 0.997300000000000 0.002700000000000 0.000000000000000 1
000154: 0.992275000000000 0.007725000000000 0.000000000000000 1
000155: 1.000000000000000 0.000000000000000 0.000000000000000 1
000156: 0.999800000000000 0.000000000000000 0.000200000000000 1
000157: 0.999975000000000 0.000025000000000 0.000000000000000 1
000158: 0.988675000000000 0.000200000000000 0.011125000000000 1
000159: 1.000000000000000 0.000000000000000 0.000000000000000 1
000160: 1.000000000000000 0.000000000000000 0.000000000000000 1
000161: 0.999900000000000 0.000000000000000 0.000100000000000 1
000162: 1.000000000000000 0.000000000000000 0.000000000000000 1
000163: 0.999800000000000 0.000000000000000 0.000200000000000 1
000164: 1.000000000000000 0.000000000000000 0.000000000000000 1
000165: 1.000000000000000 0.000000000000000 0.000000000000000 1
000166: 0.999700000000000 0.000300000000000 0.000000000000000 1
000167: 0.999900000000000 0.000100000000000 0.000000000000000 1
000168: 0.999825000000000 0.000175000000000 0.000000000000000 1
000169: 0.999175000000000 0.000825000000000 0.000000000000000 1
000170: 0.999750000000000 0.000200000000000 0.000050000000000 1
000171: 0.958375000000000 0.041625000000000 0.000000000000000 1
000172: 0.999875000000000 0.000100000000000 0.000025000000000 1
000173: 0.999500000000000 0.000200000000000 0.000300000000000 1
000174: 0.997075000000000 0.000625000000000 0.002300000000000 1
000175: 1.000000000000000 0.000000000000000 0.000000000000000 1
000176: 1.000000000000000 0.000000000000000 0.000000000000000 1
000177: 1.000000000000000 0.000000000000000 0.000000000000000 1
000178: 1.000000000000000 0.000000000000000 0.000000000000000 1
000179: 0.999800000000000 0.000000000000000 0.000200000000000 1
000180: 0.999875000000000 0.000125000000000 0.000000000000000 1
000181: 1.000000000000000 0.000000000000000 0.000000000000000 1
000182: 0.999975000000000 0.000000000000000 0.000025000000000 1
000183: 0.999675000000000 0.000325000000000 0.000000000000000 1
000184: 0.999975000000000 0.000025000000000 0.000000000000000 1
000185: 0.996950000000000 0.002750000000000 0.000300000000000 1
000186: 1.000000000000000 0.000000000000000 0.000000000000000 1
000187: 1.000000000000000 0.000000000000000 0.000000000000000 1
000188: 0.999950000000000 0.000000000000000 0.000050000000000 1
000189: 1.000000000000000 0.000000000000000 0.000000000000000 1
000190: 0.998275000000000 0.000000000000000 0.001725000000000 1
000191: 1.000000000000000 0.000000000000000 0.000000000000000 1
000192: 1.000000000000000 0.000000000000000 0.000000000000000 1
000193: 0.997900000000000 0.002100000000000 0.000000000000000 1
Thanks for any help in advance.
Kind regards
Roy Mathew Francis | Dept. of Integrated Pest Management |
Tel.: +45 |
|

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
::::On Friday 14 January 2011 Roy Francis Mathew said::::
> I was wondering if its possible to create this sort of graph (result from
> structure software for population genetics) from the data below.
I'd be quite interested in the answer, because ggplot2 graphs tend to look
nicer, but it is possible to do something similar in ordinary R:
http://kevindonnelly.org.uk/2010/12/conversation-profiles/
png(filename="popgen.png", height=600, width=1000, bg="white")
par(lty=0) # To zap the normal spacing between bars
popgendata<-read.csv (file="popgendata.csv", na.strings = "NA", nrows = -1,
skip = 0, check.names = TRUE, strip.white = FALSE, blank.lines.skip = TRUE)
barplot(t(popgendata), col=c("mediumvioletred", "khaki1", "lightskyblue1"),
space=0) # Or whatever colours you like.
title(main="Population genetics data")
dev.off()
You might have to fiddle about with settings a bit until you get something you
like. Now all we have to do is wait for others to say "ggplot2 does that much
nicer - here's how ..."!
--
Pob hwyl / Best wishes
Kevin Donnelly
kevindonnelly.org.uk
Thats fantastic Brandon. Thanks a lot. I think I will try to fiddle with the script and tweak it.
Thanks to Kevin and romunov for your links and replies. This group is really fast.
Med venlig hilsen / Regards
Roy Mathew Francis
--