** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezplot.cpp,v 1.8 2000/07/28 10:51:31 kevin Exp $
+** $Id: ezplot.cpp,v 1.12 2000/08/31 08:38:58 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
static const int MAXNUMFMT = 15; // maximum length of a numeric format
static const double DEF_CHARHEIGHT = (1./43.); //size of characters in NDC
static const double DEF_CHARWIDTH = (1./80.); // size of characters in NDC
-static const int DEF_CURVE_CLR = C_YELLOW;
+static const int DEF_CURVE_CLR = C_RED;
}
+void
+EZPlot::addCurve (const float *y, int n)
+{
+ double yDouble [n];
+
+ for (int i = 0; i < n; i++)
+ yDouble[i] = y[i];
+
+ addCurve (yDouble, n);
+}
+
+
void
EZPlot::addCurve (const float x[], const double y[], int num)
{
void
EZPlot::initPlotSettings ()
{
- curveinteract = -1;
-
charwidth = DEF_CHARWIDTH;
charheight = DEF_CHARHEIGHT;
- c_xlabel = "X axis";
- c_ylabel = "Y axis";
+ c_xlabel = "";
+ c_ylabel = "";
c_title = "";
c_legend = "";
s_ylegend = FALSE;
s_textsize = FALSE;
- clr_axis = C_WHITE; /* set fixed colors */
- clr_title = (C_CYAN+8);
- clr_label = (C_CYAN+8);
- clr_legend = (C_RED+8);
- clr_number = (C_GREEN+8);
- clr_grid = (C_BLACK+8);
+ clr_axis = C_BLACK; /* set fixed colors */
+ clr_title = C_CYAN;
+ clr_label = C_CYAN;
+ clr_legend = C_RED;
+ clr_number = C_GREEN;
+ clr_grid = C_LTGRAY;
}
}
/* find nice endpoints for axes */
- axis_scale (xmin, xmax, o_xmajortick - 1, &xgw_min, &xgw_max, &x_nint);
- axis_scale (ymin, ymax, o_ymajortick - 1, &ygw_min, &ygw_max, &y_nint);
+ if (! axis_scale (xmin, xmax, o_xmajortick - 1, &xgw_min, &xgw_max, &x_nint) || ! axis_scale (ymin, ymax, o_ymajortick - 1, &ygw_min, &ygw_max, &y_nint))
+ return;
/* check if user set x-axis extents */
if (s_xmin == TRUE) {
xtl_wid = x_fldwid * charwidth; /* calc size of tick labels */
ytl_wid = y_fldwid * charwidth;
tl_height = charheight;
-
+
+ // rSGP.getViewport (xp_min, yp_min, xp_max, yp_max);
/* calculate the extent of the plot frame */
xp_min = o_xporigin;
yp_min = o_yporigin;
EZPlot::axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp)
{
if (min >= max || nint < 1) {
- sys_error (ERR_WARNING, "Invalid params: min=%lf, min=%lf, num intervals=%d [axis_scale]", min, max, nint);
+ sys_error (ERR_WARNING, "Invalid params: min=%lf, max=%lf, num intervals=%d [axis_scale]", min, max, nint);
return (FALSE);
}