|
From: Philipp K. J. <ja...@ie...> - 2014-06-19 17:41:24
|
Gnuplot makes a lot of information about the most recent plot available through GPVAL variables. It seems reasonable to include information about the current position of the key. I prepared a small patch that populates four new variables for each plot: GPVAL_KEY_XCENTER GPVAL_KEY_YCENTER GPVAL_KEY_WIDTH GPVAL_KEY_HEIGHT Using the information in these variables, one can recreate the most recent positioning of the key as follows: plot sin(x) set key center at screen \ GPVAL_KEY_XCENTER/GPVAL_TERM_XSIZE,GPVAL_KEY_YCENTER/GPVAL_TERM_YSIZE replot For 3dim graphs, there is an additional wrinkle, because splot does only honor the horizontal (right/center/left) positioning commands, but always uses "top" for vertical positioning. Hence, one needs to modify the vertical position: splot sin(x)*cos(y) set key center at screen \ GPVAL_KEY_XCENTER/GPVAL_TERM_XSIZE, \ (GPVAL_KEY_YCENTER+GPVAL_KEY_HEIGHT/2)/GPVAL_TERM_YSIZE replot The commands given above recreate the last position of the key. By adding/subtracting appropriate values, one can achieve any desired offset. The patch is available here, if you want to check it out: http://www.philipp-janert.com/keypos.patch Best, Ph. |