|
From: K.Moriyama <km...@mb...> - 2004-08-03 07:32:50
|
Hi.
I wonder why this feature has not included in gnuplot so far.
when you plot several lines (e.g. calc. results) at once,
it may be hard to distinguish them, especially on a monochrome
terminal or hard copy.
many other tools (e.g. kaleida graph) has a feature with which
you can plot lines with points sparsely put along the lines,
so that you can easily distinguish the lines.
------*-------*-------*-----*-------
------o-------o-------o-----o-------
gnuplot's "linespoints" puts all the points, like
************************************
oooooooooooooooooooooooooooooooooooo
then, i added a new feature to specify the number of points which
is skipped when plotting by "linespoints".
(lines are drawn by all the data)
"pointskip" is the magic word.
usage: plot "data" with linespints pointskip 50
plot "data" wi linesp pointsk 50
plot "data" wi lp psk 50
this plots a line and sparse (every 50) points along it.
it works only for 2d plots. it takes effect with "linespoints" or
"points".
i bet this kind of feature definitely makes many people happier.
see the patch below. (dirty?)
k.moriyama
--------8<----------------8<----------------8<--------
--- term_api.h.org 2004-07-29 16:22:30.000000000 +0900
+++ term_api.h 2004-07-29 16:24:10.000000000 +0900
@@ -69,6 +69,7 @@
int pointflag; /* 0 if points not used, otherwise 1 */
int l_type;
int p_type;
+ int p_skip; /* skip interval for linespoints km040729 */
double l_width;
double p_size;
#ifdef PM3D
--- misc.c.org 2004-07-29 16:22:40.000000000 +0900
+++ misc.c 2004-07-29 16:32:44.000000000 +0900
@@ -731,6 +731,7 @@
lp->pointflag = allow_point;
lp->p_type = def_point;
lp->p_size = pointsize; /* as in "set pointsize" */
+ lp->p_skip = 1; /* no-skip by default km040729 */
while (!END_OF_COMMAND) {
if (almost_equals(c_token, "linet$ype") || equals(c_token, "lt")) {
if (set_lt++)
@@ -800,6 +801,20 @@
continue;
}
+ /* parse pointskip or psk km040729 */
+ if (almost_equals(c_token, "pointsk$ip") || equals(c_token, "psk")) {
+ if (allow_point) {
+ c_token++;
+ lp->p_skip = real(const_express(&t));
+ if (lp->p_size < 1)
+ lp->p_size = 1;
+ } else {
+ int_warn(c_token, "No pointskip specifier allowed, here");
+ c_token += 2;
+ }
+ continue;
+ }
+
/* unknown option catched -> quit the while(1) loop */
break;
}
@@ -1004,7 +1019,7 @@
arrow->head_lengthunit = hsize.scalex;
arrow->head_angle = hsize.y;
arrow->head_backangle = hsize.z;
- /* invalid backangle --> default of 90.0− */
+ /* invalid backangle --> default of 90.0− */
if (arrow->head_backangle <= arrow->head_angle)
arrow->head_backangle = 90.0;
continue;
--- graphics.c.org 2004-07-29 16:57:52.000000000 +0900
+++ graphics.c 2004-07-29 17:05:16.000000000 +0900
@@ -2670,16 +2670,38 @@
int i;
int x, y;
struct termentry *t = term;
+/* point skipping function km040729 */
+ int count;
+ count = 0;
+ for (i = 0; i < plot->p_count; i++) {
+ count++;
+ if (count < plot->lp_properties.p_skip ) {
+ continue;
+ } else {
+ count = 0;
+ if (plot->points[i].type == INRANGE) {
+ x = map_x(plot->points[i].x);
+ y = map_y(plot->points[i].y);
+ /* do clipping if necessary */
+ if (!clip_points || (x >= xleft + p_width &&
+ y >= ybot + p_height && x <= xright - p_width &&
+ y <= ytop - p_height))
+ (*t->point) (x, y, plot->lp_properties.p_type);
+ }
+ }
+ }
+/*
for (i = 0; i < plot->p_count; i++) {
if (plot->points[i].type == INRANGE) {
x = map_x(plot->points[i].x);
y = map_y(plot->points[i].y);
- /* do clipping if necessary */
+ /* do clipping if necessary * /
if (!clip_points || (x >= xleft + p_width && y >= ybot + p_height && x <= xright - p_width && y <= ytop - p_height))
(*t->point) (x, y, plot->lp_properties.p_type);
}
}
+*/
}
/* plot_dots:
|