Beispiel #1
0
void Discriminant_drawConcentrationEllipses (Discriminant me, Graphics g, double scale, bool confidence, char32 *label,
        int discriminantDirections, long d1, long d2, double xmin, double xmax, double ymin, double ymax, int fontSize, int garnish)
{
    long numberOfFunctions = Discriminant_getNumberOfFunctions (me);

    if (! discriminantDirections) {
        SSCPList_drawConcentrationEllipses (my groups.get(), g, scale, confidence, label, d1, d2, xmin, xmax, ymin, ymax, fontSize, garnish);
        return;
    }

    if (numberOfFunctions <= 1) {
        Melder_warning (U"Discriminant_drawConcentrationEllipses: Nothing drawn "
                        U"because there is only one dimension in the discriminant space.");
        return;
    }

    // Project SSCPs on eigenvectors.

    if (d1 == 0 && d2 == 0) {
        d1 = 1;
        d2 = MIN (numberOfFunctions, d1 + 1);
    } else if (d1 < 0 || d2 > numberOfFunctions) {
        return;
    }

    double *v1 = my eigen -> eigenvectors [d1];
    double *v2 = my eigen -> eigenvectors [d2];


    autoSSCPList thee = SSCPList_toTwoDimensions (my groups.get(), v1, v2);

    SSCPList_drawConcentrationEllipses (thee.get(), g, scale, confidence, label, 1, 2, xmin, xmax, ymin, ymax, fontSize, 0);

    if (garnish) {
        char32 llabel[40];
        Graphics_drawInnerBox (g);
        Graphics_marksLeft (g, 2, true, true, false);
        Melder_sprint (llabel,40, U"function ", d2);
        Graphics_textLeft (g, true, llabel);
        Graphics_marksBottom (g, 2, true, true, false);
        Melder_sprint (llabel,40, U"function ", d1);
        Graphics_textBottom (g, true, llabel);
    }
}
Beispiel #2
0
void Configuration_drawConcentrationEllipses (Configuration me, Graphics g, double scale, bool confidence, const char32 *label, long d1, long d2, double xmin, double xmax, double ymin, double ymax, int fontSize, bool garnish) {
	autoSSCPList sscps = TableOfReal_to_SSCPList_byLabel (me);
	SSCPList_drawConcentrationEllipses (sscps.peek(), g, scale, confidence, label, d1, d2, xmin, xmax, ymin, ymax, fontSize, garnish);
}