placing graph origin at exact location respect to other graph in multiplot

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

placing graph origin at exact location respect to other graph in multiplot

warpino
Hi all,

is there a way to place a graph, in multiplot mode, with its origin at some
location expressed not in screen coordinates but in graph coordinates of
another, say master, plot?

Thank you very much,

N
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: placing graph origin at exact location respect to other graph in multiplot

theozh
as far as I understand, and it looks like that gnuplot does not allow
other than screen coordinates for offset in the multiplot environment.
Probably it's not clear which coordinates it should take: the first
ones, the previous ones...?

Anyway, you could use the gnuplot internal variables GPVAL_...
"show var GPVAL"
With this you need to do some "little" coordinate transformations.
Maybe there is even a more elegant solution?

The following code should do what you're looking for...
You can actually skip all the lines starting with "print..."


### start gnuplot example code
reset

# enter the coordinates of the origin of the second plot
# i.e. coordinates with respect to the first plot
XPos = -10
YPos = 0

set multiplot

# your first plot
plot x

print "TermSize x,y: ", GPVAL_TERM_XSIZE, ", ", GPVAL_TERM_YSIZE
print "Term X: ", GPVAL_TERM_XMIN, " to ", GPVAL_TERM_XMAX
print "Term Y: ", GPVAL_TERM_YMIN, " to ", GPVAL_TERM_YMAX
print "Graph X: ", GPVAL_X_MIN, " to ", GPVAL_X_MAX
print "Graph Y: ", GPVAL_Y_MIN, " to ", GPVAL_Y_MAX

XScaling = (GPVAL_TERM_XMAX - GPVAL_TERM_XMIN)/(GPVAL_X_MAX - GPVAL_X_MIN)
YScaling = (GPVAL_TERM_YMAX - GPVAL_TERM_YMIN)/(GPVAL_Y_MAX - GPVAL_Y_MIN)
print "Scaling x,y: ", XScaling, YScaling

XMargin = GPVAL_TERM_XMIN/XScaling
YMargin = GPVAL_TERM_YMIN/YScaling
print "Margin x,y: ", XMargin, YMargin

XOffset = (XPos - GPVAL_X_MIN + XMargin)*XScaling/GPVAL_TERM_XSIZE
YOffset = (YPos - GPVAL_Y_MIN + YMargin)*YScaling/GPVAL_TERM_YSIZE
print "XOffset x,y: ", XOffset, YOffset

# your second plot, for example with reduced size
set size 0.4
set origin XOffset,YOffset
plot x*x

unset multiplot

### end gnuplot code



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Loading...