Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #854
| From | sfeam <sfeam@users.sourceforge.net> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: inlays positioned in graph coordinates? |
| Followup-To | comp.graphics.apps.gnuplot |
| Date | 2012-01-17 10:55 -0800 |
| Organization | gnuplot development team |
| Message-ID | <jf4g6q$iid$1@dont-email.me> (permalink) |
| References | <4ba27ddf-023f-40d4-8880-11fb6df6b8c0@t30g2000vbx.googlegroups.com> |
Followups directed to: comp.graphics.apps.gnuplot
Harold wrote:
> Dear list,
>
> I want to use multiplot to insert several small inlays into a bigger
> graph. To be precise, the big graph shows some large-scale data, and
> the inlays should provide zooms into regions of interest. The actual
> data to plot is not known at the time of scripting, which is why I
> cannot statically set the position of the inlays (in screen
> coordinates).
>
> 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
At this point you can set up your inset by saying
set origin X_SCREEN, Y_SCREEN
set size <whatever>,<whatever>
clear
plot ...
hope that helps,
Ethan
> Unfortunately, as far as I can tell from reading the documentation and
> forums, set origin only allows to specify screen coordinates. Am I
> missing something? Is there a recommended way to transform one
> coordinate system to the other?
>
> Would be happy to hear your input...
> Thanks! harold.
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next 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