actual size of plot in iplot window [message #53298] |
Thu, 05 April 2007 19:03  |
Paul Woodford
Messages: 43 Registered: June 2000
|
Member |
|
|
Is there any way to make the plot in an iplot window actually occupy the
majority of the window? Perhaps I'm thick, but this has been bugging me
for a while, and I can't figure out how to do it.
Paul
|
|
|
Re: actual size of plot in iplot window [message #53381 is a reply to message #53298] |
Fri, 06 April 2007 13:29   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On Apr 6, 11:07 am, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
> On Apr 5, 8:03 pm, Paul Woodford <cpwoodf...@spamcop.net> wrote:
>
>> Is there any way to make the plot in an iplot window actually occupy the
>> majority of the window? Perhaps I'm thick, but this has been bugging me
>> for a while, and I can't figure out how to do it.
>
> Yes, I would appreciate an easy way to do this too, like an XMARGIN
> and YMARGIN keywords that work like the PLOT commands'. Currently, I
> get the visualization layer and set the VIEWPLANE_RECT property to get
> the margins I want.
>
> There is a FIT_TO_VIEW keyword in IDL 6.4 which will make the
> visualization to take up the *entire* view.
>
> Mike
> --www.michaelgalloy.com
I had to refactor what I was doing to make it a bit more general, but
here is what I'm currently doing. This is not completely general, but
might give you hand on what you're doing:
;+
; Wrapper routine for iPlot which handles margins for the plot also.
;
; @param x {in}{required}{type=1D numeric array}
; x-coordinates of data if y param is passed or y-coordinates
of data
; if only x is passed
; @param y {in}{optional}{type=1D numeric array}
; y-coordinates of data
; @keyword xmargin {in}{optional}{type=fltarr(2)}{default=[0.1, 0.1]}
; size of left and right margins in window normal units
; @keyword ymargin {in}{optional}{type=fltarr(2)}{default=[0.1, 0.1]}
; size of bottom and top margins in window normal units
; @keyword _extra {in}{optional}{type=keywords}
; keywords to iPlot
;-
pro iplot_with_margins, x, y, xmargin=xmargin, ymargin=ymargin,
_extra=e
compile_opt strictarr
myXMargin = n_elements(xmargin) eq 0 ? [0.1, 0.1] : xmargin
myYMargin = n_elements(ymargin) eq 0 ? [0.1, 0.1] : ymargin
case n_params() of
0 : iplot, _strict_extra=e
1 : iplot, x, _strict_extra=e
2 : iplot, x, y, _strict_extra=e
endcase
toolID = itGetCurrent(tool=oTool)
visIds = oTool->findIdentifiers('*', /visualization)
visLayerId = strmid(visIds[0], 0, strpos(visIds[0], '/', /
reverse_search))
oVisLayer = oTool->getByIdentifier(visLayerId)
xsize = 1.4 / (1.0 - myXMargin[0] - myXMargin[1])
ysize = 0.98 / (1.0 - myYMargin[0] - myYMargin[1])
xstart = - myXMargin[0] * xsize - 1.4 / 2
ystart = - myYMargin[0] * ysize - 0.98 / 2
oVisLayer->setProperty, viewplane_rect=[xstart, ystart, xsize,
ysize]
end
Mike
--
www.michaelgalloy.com
|
|
|
|
|
Re: actual size of plot in iplot window -- getting rid of background rectangle in exported EPS [message #53479 is a reply to message #53298] |
Tue, 10 April 2007 08:39   |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Paul Woodford wrote:
> Is there any way to make the plot in an iplot window actually occupy the
> majority of the window? Perhaps I'm thick, but this has been bugging me
> for a while, and I can't figure out how to do it.
>
> Paul
As a related question -- the fact that the iPlot doesn't fully fill the
window is particularly annoying when exporting a postscript file,
because the iTools include a white rectangle of the size of the window
in the PS file. Therefore, when including the PS file in LaTeX or
elsewhere directly, there is a huge white background around the plot.
Does anybody know if / how it is possible to get rid of that rectangle
(in IDL)? I usually open the PS file in Illustrator and delete the
rectangle, with the typical consequence that the file size increases by
a factor of 10 (plus, it has to be done each time after the graph is
edited).
Alternatively, sometimes I just zoom the graph to fill the window
nicely, then the background rectangle doesn't really bother, but that's
not really satisfying either. In the end, it would be nice to be able to
use the iGraph directly without much fudging ...
Thanks,
Benjamin
|
|
|
Re: actual size of plot in iplot window [message #53657 is a reply to message #53381] |
Thu, 26 April 2007 20:56  |
Paul Woodford
Messages: 43 Registered: June 2000
|
Member |
|
|
In article <1175891393.084712.75280@o5g2000hsb.googlegroups.com>,
"mgalloy@gmail.com" <mgalloy@gmail.com> wrote:
> I had to refactor what I was doing to make it a bit more general, but
> here is what I'm currently doing. This is not completely general, but
> might give you hand on what you're doing:
I hate to look a gift horse in the mouth here, but I just discovered
that if I save a plot created with Michael's iplot_with_margins routine
as a .isv file, and then load that file, the plot has shrunk back to its
regular iplot dimensions. The same shrinking happens when I export to a
PNG. The size of the plot on the screen does not change when I do
either the save or the export, however. Does anyone have an idea what
may be happening?
If it matters, I'm running IDL 6.3 on Mac OS X 10.4.9.
Paul
|
|
|