コード例 #1
0
ファイル: plot1d.c プロジェクト: rashadkm/xgobi
void
plot1d_texture_var(xgobidata *xg)
{
/*
 * Set up the next dot plot.
*/
  int i;
  float *yy;
  float del = 1.;
  int option = 1, stages = 3;
  int jvar = (plot1d_vertically) ? xg->plot1d_vars.y : xg->plot1d_vars.x;
  extern int do_ash();

  /*
   * yy is a temporary variable.  It's used by textur, and then
   * junked immediately afterward.
  */
  yy = (float *) XtMalloc((Cardinal) xg->nrows_in_plot * sizeof(float));

  for (i=0; i<xg->nrows_in_plot; i++)
    yy[i] = xg->tform2[ xg->rows_in_plot[i] ][jvar];

  if (plot1d_type == ASH) {
    float min, max;
    extern void do_ash1d(float *, int, int, int, float *, float *, float *);
/*
    int nbins = MAX((int) (xg->scale.x * xg->plotsize.width),
                    (int) (xg->scale.y * xg->plotsize.height));
*/

    do_ash1d(yy, xg->nrows_in_plot, nbins, nASHes, plot1d_data, &min, &max);
    plot1d_lim.min = min;
    plot1d_lim.max = max;
  }
  else {
    plot1d_lim.min = FORGETITAXIS_MIN ;
    plot1d_lim.max = FORGETITAXIS_MAX ;
    textur(yy, plot1d_data, xg->nrows_in_plot, option, del, stages);
  }

  XtFree((XtPointer) yy);
}
コード例 #2
0
ファイル: tour1d.c プロジェクト: medmatix/ggobi
void
tour1d_projdata(splotd *sp, gdouble **world_data, GGobiStage *d, GGobiSession *gg)
{
  gint j, m;
  displayd *dsp = (displayd *) sp->displayptr;
  gdouble min, max, mean;
  cpaneld *cpanel = &dsp->cpanel;
  gdouble *yy;

  if (sp == NULL)
    return;
  if (sp->p1d.spread_data.nels != d->n_rows)
    vectord_realloc (&sp->p1d.spread_data, d->n_rows);

  yy = (gdouble *) g_malloc (d->n_rows * sizeof (gdouble));

  for (m=0; m < d->n_rows; m++) {
    yy[m] = sp->planar[m].x = 0;
    sp->planar[m].y = 0;
    for (j=0; j<d->n_cols; j++)
    {
      yy[m] += (gdouble)(dsp->t1d.F.vals[0][j]*world_data[m][j]);
    }
  }

  do_ash1d (yy, d->n_rows,
            cpanel->t1d.nbins, cpanel->t1d.nASHes,
            sp->p1d.spread_data.els, &min, &max, &mean);

  if (sp->tour1d.initmax) {
    sp->tour1d.mincnt = 0.0;    /* let this be zero for consistency */
    sp->tour1d.maxcnt = max;    
    sp->tour1d.initmax = false;  
    sp->tour1d.minscreenx = yy[0];
    sp->tour1d.maxscreenx = yy[0];
  }
  else
    if (max > sp->tour1d.maxcnt) sp->tour1d.maxcnt = max;

  /*max = 2*mean;  * try letting the max for scaling depend on the mean */
  max = sp->tour1d.maxcnt;
  if (cpanel->t1d.vert) {
    for (m=0; m<d->n_rows; m++) {
      if (yy[m] < sp->tour1d.minscreenx) {
         sp->tour1d.minscreenx = yy[m];
      }
      else if (yy[m] > sp->tour1d.maxscreenx) {
         sp->tour1d.maxscreenx = yy[m];
      }
    }
    for (m=0; m<d->n_rows; m++) {
      sp->planar[m].x = (-1.0+2.0* sp->p1d.spread_data.els[m]/max);
        /*(sp->p1d_data.els[i]-min)/(max-min)));*/
      /*      sp->planar[i].y = yy[i];*/
      sp->planar[m].y = -1.0+2.0*
        ((yy[m]-sp->tour1d.minscreenx)/
        (sp->tour1d.maxscreenx-sp->tour1d.minscreenx));
    }
  }
  else {
    for (m=0; m<d->n_rows; m++) {
      if (yy[m] < sp->tour1d.minscreenx) {
         sp->tour1d.minscreenx = yy[m];
      }
      else if (yy[m] > sp->tour1d.maxscreenx) {
         sp->tour1d.maxscreenx = yy[m];
      }
    }
    for (m=0; m<d->n_rows; m++) {
      sp->planar[m].x = -1.0+2.0* ((yy[m]-sp->tour1d.minscreenx)/
        (sp->tour1d.maxscreenx-sp->tour1d.minscreenx));
      /*      sp->planar[i].x = yy[i];*/
      sp->planar[m].y = -1.0+2.0* sp->p1d.spread_data.els[m]/max;
        /*(sp->p1d_data.els[i]-min)/(max-min)));*/
    }
  }

  g_free ((gpointer) yy);
}