Plotting discrete points



On Sun, Jan 09, 2005 at 07:22:51PM -0600, James Amundson wrote:
> Here are some examples:
> 
> xx:makelist(x,x,0,10);
> yy:makelist(exp(-x*1.0),x,0,10);
> 
> /* plot with line segments */
> plot2d([list,xx,yy]);
> 
> /* plot with points */
> plot2d([list,xx,yy],[gnuplot_curve_styles,["with points"]]);
> 
> /* plot the curve cos(x) using lines and (xx,yy) using points */
> plot2d([cos(x),[list,xx,yy]],[x,0,10],[gnuplot_curve_styles,["with
> lines","with points pointsize 3"]]);

I'd prefer something like this:

xy:makelist([x,exp(-x*1.0)],x,0,10);

/* plot with line segments */
plot2d([discrete,xy]);

/* plot with points */
plot2d([discrete,xy],[lines,"no"],[points,"yes"]);

/* plot the curve cos(x) using lines and xy using points */
plot2d([cos(x),[discrete,xy]],[x,0,10],[lines,1],[points,1],[pointsize,3]);

Comments:
 1- openplot_curves accepts both [[0,0],[1,3],[4,6]] and [0,0,1,3,4,6]
    to plot the points (0,0), (1,3) and (4,6). It would be nice that
    plot2d did the same.

 2- I'm still not convinced that gnuplot is the final solution, and I still
    use openplot most of the time. Removing "gnuplot_curve_styles" from
    the options would make the syntax more general and the options that were
    not yet supported by other graphic systems could be silently ignored.
    Notice that for openplot_curves it would be very easy to change the
    current tcl-specific syntax "{plotpoints 1} {pointsize 3}" by
    the syntax I'm proposing above (I've already done it for plotdf).

 3- I have no preference among things such as [points,1] or [points,"yes"].
    If they both can be accepted, even better.

Regards,
Jaime