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

Home » Public Forums » archive » Re: Image scrolling, displaying axes from outside the visible 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
Re: Image scrolling, displaying axes from outside the visible window [message #31576] Fri, 02 August 2002 05:54
fahruz is currently offline  fahruz
Messages: 3
Registered: August 2002
Junior Member
>> IDL> window, /free
>> IDL> x=findgen(200)*0.1
>> IDL> plot, x, cos(x), /device, position=[-90,-90,200,200]
>>
>> When I type this I would like the lower and left axes not to be
>> displayed in the window and the tickmarks to be accordingly shifted
>> for the other 2 axes. However it seems that no matter what negative
>> value I type in, the axes still appear at the bottom and to the left
>> of the window.
>
> Oh, right. Yes, I thought we were dealing with scrolling windows.

That's what I'm attempting in the end but I agree I shouldn't have
mentioned it at this stage so as to not get you confused.

> Yes. In direct graphics IDL is "protecting" you by making sure
> that the POSITION keyword draws something in the graphics window.
> If you want to do something really dumb (like drawing something
> outside the graphics window) you have to use object
> graphics, which is more powerful than direct graphics. :-)

Call dumb what you can't admit you can't do (or can but in a very
convoluted way), I've heard of such bad loser marketing policies. :))
Seriously, I would've appreciated a tad more flexibility and choose
myself whether I want that "protection" or not.

> I've modified my XPLOT program to allow you to position the plot
> in the window with the POSITION keyword:
>
> http://www.dfanning.com/programs/xplot.pro
>
> The POSITION keyword uses "normalized" coordinates, which assumes
> that the visible portion of the plot window goes from 0 to 1 in
> both X and Y directions. For example, for a normal plot:
>
> IDL> XPlot, Findgen(100), Position=[0.15, 0.15, 0.9, 0.85]
>
> For a plot with the Y axis origin out of the window:
>
> IDL> XPlot, Findgen(100), Position=[0.15, -0.2, 0.9, 0.85]

Ok, I tried it and -surprise- it works. But I can hardly integrate it
in my code. I'd rather opt for that nifty solution suggested by Don
(thanks Don !!) with pixmaps.

> P.S. Tell me again why something like this is useful?

Any kind of application which needs to display specific areas of a
plot.

Anyway, thanks for your prompt answers and valuable help!

FM
Re: Image scrolling, displaying axes from outside the visible window [message #31593 is a reply to message #31576] Thu, 01 August 2002 08:01 Go to previous message
Don J Lindler is currently offline  Don J Lindler
Messages: 19
Registered: April 2001
Junior Member
"Lord Fahruz" <Fahruz@hotmail.com> wrote in message
news:5f84b161.0208010010.3c7d359e@posting.google.com...
>>> I am currently trying to implement some "artifical" scrolling solution
>>> in an image window enclosed by 4 axes and wondered why I could
>>> perfectly display an image (which is than the window) with its x and y
>>> coordinates having negative values (and thus having its origin outside
>>> the window) so that it shows only partially, whereas axes can only be
>>> displayed within the window frame invariably even if one tries to plot
>>> with a position vector containing negative values.
>>
>> What!? I don't think so. But I have a very poor
>> idea of what you are trying to do from your
>> description. Can you give an example?
>
> Okay, sorry for my poor phrasing.
> Simply put: I would like to display a coordinate system with its
> origin outside the visible window when using negative values in the
> position vector.
> For example:
>
> IDL> window, /free
> IDL> x=findgen(200)*0.1
> IDL> plot, x, cos(x), /device, position=[-90,-90,200,200]
>
> When I type this I would like the lower and left axes not to be
> displayed in the window and the tickmarks to be accordingly shifted
> for the other 2 axes. However it seems that no matter what negative
> value I type in, the axes still appear at the bottom and to the left
> of the window.
>
> Thanks for your help.
>
> FM

You might consider using a pixmap which contains a larger
area than your display window. Plot your data into the
pixmap and the copy the portion you want into the
display window. To scroll, just copy another area without
replotting the data.

IDL> x = findgen(200)*0.1
IDL> window, 20, xsize=1000, ysize=1000, /pixmap
IDL> plot, x, cos(x), position=[100,100,600,600], /device
IDL> window, 21, xsize=600, ysize=500
IDL> device, copy=[200,200,600,500,0,0,20]

Good Luck,
Don
Re: Image scrolling, displaying axes from outside the visible window [message #31599 is a reply to message #31593] Thu, 01 August 2002 07:03 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Lord Fahruz (Fahruz@hotmail.com) writes:

> Okay, sorry for my poor phrasing.
> Simply put: I would like to display a coordinate system with its
> origin outside the visible window when using negative values in the
> position vector.
> For example:
>
> IDL> window, /free
> IDL> x=findgen(200)*0.1
> IDL> plot, x, cos(x), /device, position=[-90,-90,200,200]
>
> When I type this I would like the lower and left axes not to be
> displayed in the window and the tickmarks to be accordingly shifted
> for the other 2 axes. However it seems that no matter what negative
> value I type in, the axes still appear at the bottom and to the left
> of the window.

Oh, right. Yes, I thought we were dealing with scrolling windows.

Yes. In direct graphics IDL is "protecting" you by making sure
that the POSITION keyword draws something in the graphics window.
If you want to do something really dumb (like drawing something
outside the graphics window) you have to use object
graphics, which is more powerful than direct graphics. :-)

I've modified my XPLOT program to allow you to position the plot
in the window with the POSITION keyword:

http://www.dfanning.com/programs/xplot.pro

The POSITION keyword uses "normalized" coordinates, which assumes
that the visible portion of the plot window goes from 0 to 1 in
both X and Y directions. For example, for a normal plot:

IDL> XPlot, Findgen(100), Position=[0.15, 0.15, 0.9, 0.85]

For a plot with the Y axis origin out of the window:

IDL> XPlot, Findgen(100), Position=[0.15, -0.2, 0.9, 0.85]

Cheers,

David

P.S. Tell me again why something like this is useful?

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Image scrolling, displaying axes from outside the visible window [message #31601 is a reply to message #31599] Thu, 01 August 2002 01:10 Go to previous message
fahruz is currently offline  fahruz
Messages: 3
Registered: August 2002
Junior Member
>> I am currently trying to implement some "artifical" scrolling solution
>> in an image window enclosed by 4 axes and wondered why I could
>> perfectly display an image (which is than the window) with its x and y
>> coordinates having negative values (and thus having its origin outside
>> the window) so that it shows only partially, whereas axes can only be
>> displayed within the window frame invariably even if one tries to plot
>> with a position vector containing negative values.
>
> What!? I don't think so. But I have a very poor
> idea of what you are trying to do from your
> description. Can you give an example?

Okay, sorry for my poor phrasing.
Simply put: I would like to display a coordinate system with its
origin outside the visible window when using negative values in the
position vector.
For example:

IDL> window, /free
IDL> x=findgen(200)*0.1
IDL> plot, x, cos(x), /device, position=[-90,-90,200,200]

When I type this I would like the lower and left axes not to be
displayed in the window and the tickmarks to be accordingly shifted
for the other 2 axes. However it seems that no matter what negative
value I type in, the axes still appear at the bottom and to the left
of the window.

Thanks for your help.

FM
Re: Image scrolling, displaying axes from outside the visible window [message #31616 is a reply to message #31601] Wed, 31 July 2002 06:53 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Lord Fahruz (fahruz@hotmail.com) writes:

> I am currently trying to implement some "artifical" scrolling solution
> in an image window enclosed by 4 axes and wondered why I could
> perfectly display an image (which is than the window) with its x and y
> coordinates having negative values (and thus having its origin outside
> the window) so that it shows only partially, whereas axes can only be
> displayed within the window frame invariably even if one tries to plot
> with a position vector containing negative values.

What!? I don't think so. But I have a very poor
idea of what you are trying to do from your
description. Can you give an example?

> Does that mean I would have to manually check whether they should be
> visible or not and use truncated axes whose range would correspond to
> the visible part of the image ? (what a pain)

You must have something else going wrong that you are
attributing to this problem. I just can't imagine
you can't do what you want to do.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: integer?
Next Topic: Re: saving variables between calls to a procedure?

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

Current Time: Wed Oct 08 19:55:07 PDT 2025

Total time taken to generate the page: 0.00840 seconds