|
From: Harald H. <h.h...@tu...> - 2005-01-17 21:49:24
|
In large splots with screen size above 1, arrows that are totally outside
the screen coordinates 1,1 are not plotted, see example:
set size 1.8,1.8
set terminal postscript color linewidth 4
set output 'gnuplotbug.ps'
set style arrow 1 nohead lt 1 front
set xrange [0:1]
set yrange [0:1]
set zrange [0:1]
set arrow from screen 1,0 rto screen 0,1 as 1
set arrow from screen 0,1 rto screen 1,0 as 1
set arrow from screen 0,0 rto screen 0,1 as 1
set arrow from screen 0,0 rto screen 1,0 as 1
set arrow from screen 1.1,0 rto screen 0,.5 as 1
set arrow from screen 0.9,0 rto screen 0,.5 as 1
set label '1' at screen 0.9,0.9
set label '2' at screen 1.0,1.0
set label '3' at screen 1.1,1.1
set label '4' at screen 0.1,0.1
set label '5' at screen 0.0,0.0
set label '6' at screen -0.1,-0.1
splot 1/0 notitle
plot 1/0 notitle
set multiplot
set size 0.8,0.8
set origin 0.1,0.1
splot 1/0 notitle
unset multiplot
set multiplot
set size 0.8,0.8
set origin 0.1,0.1
plot 1/0 notitle
unset multiplot
set output
I have written a patch that seems to work both with and without multiplot.
There is still one strange thing: Have a look at the arrows at the upper
corners. In 2d plots they are there, in 3d plots they are cut off. What is
the right behaviour?
Harald
Here is the patch:
diff -uNr orig/src/gadgets.c arrow/src/gadgets.c
--- orig/src/gadgets.c 2005-01-11 17:39:34.000000000 +0100
+++ arrow/src/gadgets.c 2005-01-17 22:41:05.000000000 +0100
@@ -62,6 +62,8 @@
float xsize = 1.0; /* scale factor for size */
float ysize = 1.0; /* scale factor for size */
float zsize = 1.0; /* scale factor for size */
+float global_xsize = 1.0; /* scale factor for size */
+float global_ysize = 1.0; /* scale factor for size */
float xoffset = 0.0; /* x origin */
float yoffset = 0.0; /* y origin */
float aspect_ratio = 0.0; /* don't attempt to force it */
diff -uNr orig/src/gadgets.h arrow/src/gadgets.h
--- orig/src/gadgets.h 2005-01-11 17:39:34.000000000 +0100
+++ arrow/src/gadgets.h 2005-01-17 22:37:56.000000000 +0100
@@ -249,6 +249,8 @@
extern float xsize; /* x scale factor for size */
extern float ysize; /* y scale factor for size */
extern float zsize; /* z scale factor for size */
+extern float global_xsize; /* x scale factor for size */
+extern float global_ysize; /* y scale factor for size */
extern float xoffset; /* x origin setting */
extern float yoffset; /* y origin setting */
extern float aspect_ratio; /* 1.0 for square */
diff -uNr orig/src/graph3d.c arrow/src/graph3d.c
--- orig/src/graph3d.c 2005-01-05 21:48:48.000000000 +0100
+++ arrow/src/graph3d.c 2005-01-17 22:47:42.000000000 +0100
@@ -453,8 +453,15 @@
/* EAM FIXME - Is this a sufficiently general test for out-of-bounds? */
/* Should we test the other end of the arrow also? */
- if (*sx < 0 || *sx > term->xmax || *sy < 0 || *sy > term->ymax)
+ if ((*sx < 0) ||
+ (multiplot && (*sx > term->xmax * global_xsize)) ||
+ (!multiplot && (*sx > term->xmax * xsize)) ||
+ (*sy < 0) ||
+ (multiplot && (*sy > term->ymax * global_ysize)) ||
+ (!multiplot && (*sy > term->ymax * ysize))) {
+ FPRINTF((stderr,"get_arrow3d: skipping out-of-bounds arrow\n"));
return FALSE;
+ }
if (arrow->relative) {
map3d_position_r(&(arrow->end), ex, ey, "arrow");
@@ -484,7 +491,12 @@
map3d_position(&this_label->place, &x, &y, "label");
/* EAM FIXME - Is this a sufficient test for out-of-bounds? */
- if (x < 0 || x > term->xmax || y < 0 || y > term->ymax) {
+ if ((x < 0) ||
+ (multiplot && (x > term->xmax * global_xsize)) ||
+ (!multiplot && (x > term->xmax * xsize)) ||
+ (y < 0) ||
+ (multiplot && (y > term->ymax * global_ysize)) ||
+ (!multiplot && (y > term->ymax * ysize))) {
FPRINTF((stderr,"place_labels3d: skipping out-of-bounds label\n"));
continue;
}
diff -uNr orig/src/set.c arrow/src/set.c
--- orig/src/set.c 2005-01-12 20:38:52.000000000 +0100
+++ arrow/src/set.c 2005-01-17 22:39:43.000000000 +0100
@@ -3070,6 +3070,10 @@
}
}
}
+ if (!multiplot) {
+ global_xsize = xsize;
+ global_ysize = ysize;
+ }
}
diff -uNr orig/src/term.c arrow/src/term.c
--- orig/src/term.c 2005-01-12 20:38:52.000000000 +0100
+++ arrow/src/term.c 2005-01-17 22:39:18.000000000 +0100
@@ -606,7 +606,10 @@
multiplot = TRUE;
mp_layout.auto_layout = FALSE;
-
+
+ global_xsize = xsize;
+ global_ysize = ysize;
+
/* check for optional multiplot layout */
if (!END_OF_COMMAND && almost_equals(c_token,"lay$out")) {
struct value a;
--
Harald Harders
h.h...@tu...
http://www.harald-harders.de
|