+
+ //image window
+ outsvg << "<svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 " + toString(width) + " " + toString(height) + " \" >\n";
+ outsvg << "<g>\n";
+
+ //draw circles
+ outsvg << "<rect fill=\"white\" stroke=\"white\" x=\"0\" y=\"0\" width=\"" + toString(width) + "\" height=\"" + toString(height) + "\"/>";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.40 * width)) + "\" y=\"" + toString(int(0.44 * height)) + "\">Venn Diagram at distance " + lookup[0]->getLabel() + "</text>\n";
+ outsvg << "<circle fill=\"rgb(255,0,0)\" opacity=\".3\" stroke=\"black\" cx=\"" + toString(int(0.33 * width)) + "\" cy=\"" + toString(int(0.25 * height)) + "\" r=\"" + toString(int(0.22 * width)) + "\"/>";
+ outsvg << "<circle fill=\"rgb(0,255,0)\" opacity=\".3\" stroke=\"black\" cx=\"" + toString(int(0.65 * width)) + "\" cy=\"" + toString(int(0.25 * height)) + "\" r=\"" + toString(int(0.22 * width)) + "\"/>";
+ outsvg << "<circle fill=\"rgb(0,0,255)\" opacity=\".3\" stroke=\"black\" cx=\"" + toString(int(0.5 * width)) + "\" cy=\"" + toString(int(0.5 * height)) + "\" r=\"" + toString(int(0.22 * width)) + "\"/>";
+
+ //place labels within overlaps
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.33 * width) - ((int)toString(numA[0]-sharedAwithBC[0]).length() / 2)) + "\" y=\"" + toString(int(0.22 * height)) + "\">" + toString(numA[0]-sharedAwithBC[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.33 * width) - ((int)lookup[0]->getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[0]->getGroup() + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedAB[0] - sharedABC).length() / 2)) + "\" y=\"" + toString(int(0.22 * height)) + "\">" + toString(sharedAB[0] - sharedABC) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)toString(numB[0]-sharedBwithAC[0]).length() / 2)) + "\" y=\"" + toString(int(0.22 * height)) + "\">" + toString(numB[0]-sharedBwithAC[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.7 * width) - ((int)lookup[1]->getGroup().length() / 2)) + "\" y=\"" + toString(int(0.19 * height)) + "\">" + lookup[1]->getGroup() + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.38 * width) - ((int)toString(sharedAC[0] - sharedABC).length() / 2)) + "\" y=\"" + toString(int(0.38 * height)) + "\">" + toString(sharedAC[0] - sharedABC) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(numC[0]-sharedCwithAB[0]).length() / 2)) + "\" y=\"" + toString(int(0.54 * height)) + "\">" + toString(numC[0]-sharedCwithAB[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)lookup[2]->getGroup().length() / 2)) + "\" y=\"" + toString(int(0.52 * height)) + "\">" + lookup[2]->getGroup() + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.58 * width) - ((int)toString(sharedBC[0] - sharedABC).length() / 2)) + "\" y=\"" + toString(int(0.38 * height)) + "\">" + toString(sharedBC[0] - sharedABC) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.5 * width) - ((int)toString(sharedABC).length() / 2)) + "\" y=\"" + toString(int(0.34 * height)) + "\">" + toString(sharedABC) + "</text>\n";
+
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.825 * height)) + "\">The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(sharedAB[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.85 * height)) + "\">The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedAC[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.875 * height)) + "\">The number of species shared between groups " + lookup[1]->getGroup() + " and " + lookup[2]->getGroup() + " is " + toString(sharedBC[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.9 * height)) + "\">The number of species shared between groups " + lookup[0]->getGroup() + " and combined groups " + lookup[1]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedAwithBC[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.925 * height)) + "\">The number of species shared between groups " + lookup[1]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[2]->getGroup() + " is " + toString(sharedBwithAC[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.95 * height)) + "\">The number of species shared between groups " + lookup[2]->getGroup() + " and combined groups " + lookup[0]->getGroup() + lookup[1]->getGroup() + " is " + toString(sharedCwithAB[0]) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.725 * height)) + "\">The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]);
+ if (numA.size() == 3) {
+ outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "</text>\n";
+ }else { outsvg << "</text>\n"; }
+
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.75 * height)) + "\">The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]);
+ if (numB.size() == 3) {
+ outsvg << " the lci is " + toString(numB[1]) + " and the hci is " + toString(numB[2]) + "</text>\n";
+ }else { outsvg << "</text>\n"; }
+
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.775 * height)) + "\">The number of species in group " + lookup[2]->getGroup() + " is " + toString(numC[0]);
+ if (numC.size() == 3) {
+ outsvg << " the lci is " + toString(numC[1]) + " and the hci is " + toString(numC[2]) + "</text>\n";
+ }else { outsvg << "</text>\n"; }
+
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.80 * height)) + "\">The total richness of all the groups is " + toString(numA[0] + numB[0] + numC[0] - sharedAB[0] - sharedAC[0] - sharedBC[0] + sharedABC) + "</text>\n";
+ outsvg << "<text fill=\"black\" class=\"seri\" font-size=\"24\" x=\"" + toString(int(0.25 * width)) + "\" y=\"" + toString(int(0.975 * height)) + "\">The total shared richness is " + toString(sharedABC) + "</text>\n";
+
+ delete singleCalc;
+
+ }else { //sharedchao and sharedsobs are multigroup
+
+ vector<SharedRAbundVector*> subset;
+
+ //get estimates for numA
+ subset.push_back(lookup[0]);
+ vector<double> numA = vCalcs[i]->getValues(subset);
+
+ //get estimates for numB