comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » actual size of plot in iplot window
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
actual size of plot in iplot window [message #53298] Thu, 05 April 2007 19:03 Go to next message
Paul Woodford is currently offline  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 Go to previous messageGo to next message
Michael Galloy is currently offline  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 [message #53389 is a reply to message #53298] Fri, 06 April 2007 10:07 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
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
Re: actual size of plot in iplot window [message #53401 is a reply to message #53381] Sat, 14 April 2007 20:29 Go to previous messageGo to next message
Paul Woodford is currently offline  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:

[snipped]

Thank you, your routine does the job for me.

Paul
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 Go to previous messageGo to next message
Benjamin Hornberger is currently offline  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 Go to previous message
Paul Woodford is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Ubuntu Feisty and IDL
Next Topic: Re: MPEG_OPEN and friends not working

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:21:00 PDT 2025

Total time taken to generate the page: 0.00574 seconds