Subject: gnuplot_x11
From: [email-masked] (Rick Sladkey)
To: [email-masked]
Cc: [email-masked]
Date: Wed, 10 Jun 92 01:38:59 -0400

>>>>> On Tue, 09 Jun 92 19:22:16 +0100, [email-masked] said:

Mitch> has anyone gotten gnuplot to work with X with SPLOTS ??

Yes, but it took some work...

Mitch> Well I tried compiling it with the linux defs in as well (so it
Mitch> works without X11 also i.e. with vgalib) and it compiles ok,
Mitch> even the gnuplot_x11 but when it runs and I try to do a surface
Mitch> plot I get big patches of color all over the plot (usually
Mitch> black). This also happens with hidden line removal!

I had exactly this problem.

Mitch> So what am I doing wrong, and is this a gcc or X11 problem ??

Well, if I knew much about X, I might be able to figure out what the
source of the problem is.  But since I don't, I'll just say what I
did to fix it.  gnuplot talks to gnuplot_x11 through a pipe so I wrote
all the output to a debug file and then experimented with sending
variations of the file directly to gnuplot_x11.  I discovered that
the line-type command was at fault.  gnuplot uses line-types -2 and -1
to represent borders or axes or something and types 0 through 7 (?)
for different colors.  Types -2 and -1 cause gnuplot_x11 to use
a X11 line-width of 2 instead of 0.  I suppose this is meant to select
2 pixel-wide lines but they come out more like 2 inches wide...

Anyway, here is the relevant patch.

Rick Sladkey
[email-masked]
-----
diff -rc ../gnuplot.orig/gnuplot_x11.c ./gnuplot_x11.c
*** ../gnuplot.orig/gnuplot_x11.c	Mon Sep  9 20:13:19 1991
--- ./gnuplot_x11.c	Tue May 26 21:51:59 1992
***************
*** 202,209 ****
--- 202,214 ----
        /*   X11_linetype(type) - set line type  */
        else if (*buf == 'L') { 
  	 sscanf(buf, "L%4d", &lt);
+ #if linux
+ 	 lt = (lt+2)%10;
+ 	 width = 0;
+ #else
  	 lt = (lt%8)+2;
  	 width = (lt == 0) ? 2 : 0;
+ #endif
  	 if (Color) {
  	    if (lt != 1) 
  	       type = LineSolid;