Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!k6g2000vbz.googlegroups.com!not-for-mail From: Harold Newsgroups: comp.graphics.apps.gnuplot Subject: Re: inlays positioned in graph coordinates? Date: Thu, 2 Feb 2012 09:36:30 -0800 (PST) Organization: http://groups.google.com Lines: 136 Message-ID: <6836f1d9-8d1b-4d12-be1e-e3efdac5c88d@k6g2000vbz.googlegroups.com> References: <4ba27ddf-023f-40d4-8880-11fb6df6b8c0@t30g2000vbx.googlegroups.com> NNTP-Posting-Host: 62.198.68.104 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1328204190 1816 127.0.0.1 (2 Feb 2012 17:36:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 2 Feb 2012 17:36:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k6g2000vbz.googlegroups.com; posting-host=62.198.68.104; posting-account=pCUH2AoAAAAOKG-ubNYl1cixhUj46ENC User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:896 Thanks Ethan, On Jan 17, 7:55=A0pm, 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 > =A0 =A0 show var GPVAL > > axis coords -> graph coords > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > 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 =3D (10. - GPVAL_X_MIN) / (GPVAL_X_MAX - GPVAL_X_MIN) > > graph coords -> screen coords > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > The screen coordinates of the plot borders are also given, so we can > further convert this to a raw screen coordinate > X_RAW_SCREEN =3D GPVAL_TERM_XMIN > =A0 =A0 =A0 =A0 =A0 =A0 =A0+ (X_GRAPH) * (GPVAL_TERM_XMAX - GPVAL_TERM_XM= IN) > > The final piece is to convert this raw screen coordinate into a > fractional screen coordinate. =A0Unfortunately there is not a GPVAL_* > variable holding the raw screen size (that's an oversight that we > should fix!). =A0You have to take this directly from the requested > terminal size. =A0E.g. if you do "set term png size 700,500" then the > raw screen size on x is 700. =A0 So the final step is > X_RAW_SCREEN_SIZE =3D =A0 > X_SCREEN =3D 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 =3D 54 GPVAL_TERM_XMAX =3D 694 [...] Hence, the line X_SCREEN =3D 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? This is an excerpt of the script that I have troubles with: X_RAW_SCREEN_SIZE =3D 4 Y_RAW_SCREEN_SIZE =3D 3 set terminal postscript eps enhanced color solid size X_RAW_SCREEN_SIZE, Y_RAW_SCREEN_SIZE L1_min =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f2` L1_max =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f3` L1_tot =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f4` P1_min =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f5` P1_max =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f6` P1_tot =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f7` res =3D `head -n1 results/distr_g1e-4_L580633_P7435763.dat | cut -d' ' -f8` P_min =3D P5_tot-2e5 P_max =3D P1_tot+5e4 L_min =3D L1_tot-2e5 L_max =3D 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} =3D 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 =3D (L1_min-L_min)/(L_max-L_min) Y_GRAPH =3D (P1_min-P_min)/(P_max-P_min) X_RAW_SCREEN =3D GPVAL_TERM_XMIN + (X_GRAPH)*(GPVAL_TERM_XMAX- GPVAL_TERM_XMIN) Y_RAW_SCREEN =3D GPVAL_TERM_YMIN + (Y_GRAPH)*(GPVAL_TERM_YMAX- GPVAL_TERM_YMIN) X_SCREEN =3D X_RAW_SCREEN / X_RAW_SCREEN_SIZE Y_SCREEN =3D 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.