Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: mcirri@gmail.com Newsgroups: comp.graphics.apps.gnuplot Subject: Re: inlays positioned in graph coordinates? Date: Thu, 9 Aug 2012 08:27:02 -0700 (PDT) Organization: http://groups.google.com Lines: 328 Message-ID: <1517a6c7-b169-4e32-89a2-1fa6be93e17f@googlegroups.com> References: <4ba27ddf-023f-40d4-8880-11fb6df6b8c0@t30g2000vbx.googlegroups.com> <6836f1d9-8d1b-4d12-be1e-e3efdac5c88d@k6g2000vbz.googlegroups.com> NNTP-Posting-Host: 192.35.43.5 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1344526133 32519 127.0.0.1 (9 Aug 2012 15:28:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 9 Aug 2012 15:28:53 +0000 (UTC) Cc: sfeam@users.sourceforge.net In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.35.43.5; posting-account=toEm8AoAAABz9BvFNHXW5M73RVeaHoxO User-Agent: G2/1.0 X-Received-Bytes: 8072 Xref: csiph.com comp.graphics.apps.gnuplot:1312 On Friday, February 3, 2012 7:05:52 AM UTC+1, sfeam wrote: > Harold wrote: > > > > > Thanks Ethan, > > > > > > On Jan 17, 7:55 pm, sfeam wrote: > > >> Harold wrote: > > >> > What I would like to do -- if it were possible -- is to set the > > >> > origin of the inlays in graph coordinates (of the bigger graph), > > >> > such that I can read them out of the data at processing time. For > > >> > example, if my data happens to cover the range [-10;100][0;10], I > > >> > would like to command gnuplot to set the inlay, say at 10,5 (in > > >> > graph coordinates). > > >> > > >> After your first plot, the layout on the page can be reconstructed > > >> from the internal variables GPVAL_* > > >> You can inspect these by saying > > >> show var GPVAL > > >> > > >> axis coords -> graph coords > > >> =========================== > > >> The fractional x coordinate relative to the plot borders (graph > > >> coordinat) of a point with an x-axis coordinate 10 (your example), > > >> would be > > >> X_GRAPH = (10. - GPVAL_X_MIN) / (GPVAL_X_MAX - GPVAL_X_MIN) > > >> > > >> graph coords -> screen coords > > >> ============================= > > >> The screen coordinates of the plot borders are also given, so we can > > >> further convert this to a raw screen coordinate > > >> X_RAW_SCREEN = GPVAL_TERM_XMIN > > >> + (X_GRAPH) * (GPVAL_TERM_XMAX - GPVAL_TERM_XMIN) > > >> > > >> The final piece is to convert this raw screen coordinate into a > > >> fractional screen coordinate. Unfortunately there is not a GPVAL_* > > >> variable holding the raw screen size (that's an oversight that we > > >> should fix!). You have to take this directly from the requested > > >> terminal size. E.g. if you do "set term png size 700,500" then the > > >> raw screen size on x is 700. So the final step is > > >> X_RAW_SCREEN_SIZE = > > >> X_SCREEN = X_RAW_SCREEN / X_RAW_SCREEN_SIZE > > > > > > This is were I ran into a problem when following your recipe: I use > > > set terminal postscript eps size 4,3 > > > since this seemed close to the default size, such that the default > > > font sizes and line widths look neat. > > > > > > With this setting, however, my values for GPVAL_TERM_XMIN/MAX > > > are way out of range: > > >> show var GPVAL > > > [...] > > > GPVAL_TERM_XMIN = 54 > > > GPVAL_TERM_XMAX = 694 > > > [...] > > > > > > Hence, the line > > > X_SCREEN = X_RAW_SCREEN / X_RAW_SCREEN_SIZE > > > produces values way above 1 (~28 with my numbers). > > > > > > Is this an issue with the bounding box of the eps driver? > > > > Not exactly. It's a mis-match of units. > > The "set term post eps size 4,3" specifies x and y in inches (by default). > > But the internal terminal coordinates are different from that. > > The missing variable X_RAW_SCREEN_SIZE would in this case be 5760, > > not that there's any easy way for you to know that. As a result > > of this thread, the CVS version of gnuplot now exports this value as > > GPVAL_TERM_XSIZE. This will be true in the released version of 4.6 > > as well. > > > > For now what you need to know is that the requested eps terminal size > > in inches must be multiplied by 1440 to get the size in internal > > coordinates. > > > > Ethan > > > > > > > > > > > This is an excerpt of the script that I have troubles with: > > > > > > X_RAW_SCREEN_SIZE = 4 > > > Y_RAW_SCREEN_SIZE = 3 > > > > > > set terminal postscript eps enhanced color solid size > > > X_RAW_SCREEN_SIZE, Y_RAW_SCREEN_SIZE > > > > > > L1_min = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f2` > > > L1_max = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f3` > > > L1_tot = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f4` > > > P1_min = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f5` > > > P1_max = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f6` > > > P1_tot = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f7` > > > > > > res = `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' > > > ' -f8` > > > > > > P_min = P5_tot-2e5 > > > P_max = P1_tot+5e4 > > > L_min = L1_tot-2e5 > > > L_max = L5_tot+5e4 > > > > > > set multiplot > > > > > > set size square > > > set view map > > > set palette gray > > > set xlabel "L" > > > set ylabel "P" > > > set xtics 2e+5 > > > > > > set arrow 10 from L1_tot,P1_tot to L5_tot,P5_tot lt -1 lw 2 > > > set arrow 1 from L1_tot,P1_tot to L1_min,P1_min nohead lt 0 lw 3 > > > > > > plot [L_min:L_max][P_min:P_max] -1 t "{/Symbol g} = 10^{`echo > > > $ENERG_G| cut -de -f2`}" w d lt 0 > > > > > > unset arrow 10 > > > unset arrow 1 > > > > > > unset xlabel > > > unset ylabel > > > unset tics > > > unset colorbox > > > unset key > > > > > > # show var GPVAL > > > > > > X_GRAPH = (L1_min-L_min)/(L_max-L_min) > > > Y_GRAPH = (P1_min-P_min)/(P_max-P_min) > > > X_RAW_SCREEN = GPVAL_TERM_XMIN + (X_GRAPH)*(GPVAL_TERM_XMAX- > > > GPVAL_TERM_XMIN) > > > Y_RAW_SCREEN = GPVAL_TERM_YMIN + (Y_GRAPH)*(GPVAL_TERM_YMAX- > > > GPVAL_TERM_YMIN) > > > X_SCREEN = X_RAW_SCREEN / X_RAW_SCREEN_SIZE > > > Y_SCREEN = Y_RAW_SCREEN / Y_RAW_SCREEN_SIZE > > > > > > set origin X_SCREEN, Y_SCREEN > > > set size .2, .2 > > > clear > > > splot "results/distr_g1e-4_L580633_P7435763.dat" matrix u (($1*res > > > +L1_min)):(($2*res+P1_min)):3 w pm3d > > > > > > unset multiplot > > > > > > > > > Thanks for your help! > > > > > > harold. Dear all, Sorry to reply to a rather old post but still there is something not convincing here. Say I have a default eps term, my variables for a case I am running give me: GPVAL_TERM_XMIN=40 GPVAL_TERM_XMAX=349 GPVAL_TERM_XSIZE=7200 Now applying the formulas from the help: SCREEN_X = GPVAL_TERM_XMIN + GRAPH_X * (GPVAL_TERM_XMAX - GPVAL_TERM_XMIN) and FRAC_X = SCREEN_X / GPVAL_TERM_XSIZE say I want to compute the position of the left y-axis: GRAPH_X would then be 0 so SCREEN_X would be equal to GPVAL_TERM_XMIN and thus 40 The fractional position will then be 0.00555 This seems small to me but lets say it is ok, now I'll go for the right margin: GRAPH_X=1 ==> SCREEN_X=GPVAL_TERM_XMAX=349 the fractional position is 349/7200=.04847222222222222222 This is still less than 5% of the screen and doesn't match with the actual position on the far right of it. What am I doing wrong? Max