Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #1312
| From | mcirri@gmail.com |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: inlays positioned in graph coordinates? |
| Date | 2012-08-09 08:27 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <1517a6c7-b169-4e32-89a2-1fa6be93e17f@googlegroups.com> (permalink) |
| References | <4ba27ddf-023f-40d4-8880-11fb6df6b8c0@t30g2000vbx.googlegroups.com> <jf4g6q$iid$1@dont-email.me> <6836f1d9-8d1b-4d12-be1e-e3efdac5c88d@k6g2000vbz.googlegroups.com> <jgftg2$sj3$1@dont-email.me> |
On Friday, February 3, 2012 7:05:52 AM UTC+1, sfeam wrote:
> Harold wrote:
>
>
>
> > Thanks Ethan,
>
> >
>
> > On Jan 17, 7:55 pm, sfeam <sf...@users.sourceforge.net> 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 = <something-you-must-provide>
>
> >> 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
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Find similar
inlays positioned in graph coordinates? Harold <dadapapa@googlemail.com> - 2012-01-17 06:09 -0800
Re: inlays positioned in graph coordinates? sfeam <sfeam@users.sourceforge.net> - 2012-01-17 10:55 -0800
Re: inlays positioned in graph coordinates? Harold <dadapapa@googlemail.com> - 2012-01-19 04:28 -0800
Re: inlays positioned in graph coordinates? Harold <dadapapa@googlemail.com> - 2012-02-02 09:36 -0800
Re: inlays positioned in graph coordinates? sfeam <sfeam@users.sourceforge.net> - 2012-02-02 22:05 -0800
Re: inlays positioned in graph coordinates? mcirri@gmail.com - 2012-08-09 08:27 -0700
csiph-web