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

Home » Public Forums » archive » Behaviour of colorbar title in z-buffer?
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
Behaviour of colorbar title in z-buffer? [message #87808] Thu, 27 February 2014 09:00 Go to next message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
This one's got me a bit confused so I hoping someone could help.

I'm using David's colorbar.pro routine.
I'm making a high-resolution plot so I'm using the z-buffer, as per David's "working without windows" tutorial.

Everything is fine apart from the title on the colorbar is rotated 180 degrees.

What I mean by this is that if I generate the plot in a post-script file (lowering the resolution of the data so it's not crazy-big), the colorbar title title reads bottom to top with the underside of the title facing the colorbar.

If I do exactly the same thing in the z-buffer, the colorbar title runs top to bottom with the underside of the title facing the edge of the window.

Basically, the title is rotated 180 degrees.

Any idea what's going on?

Thanks

Rob
Re: Behaviour of colorbar title in z-buffer? [message #87810 is a reply to message #87808] Thu, 27 February 2014 09:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rjp23@le.ac.uk writes:

> This one's got me a bit confused so I hoping someone could help.
>
> I'm using David's colorbar.pro routine.
> I'm making a high-resolution plot so I'm using the z-buffer, as per David's "working without windows" tutorial.
>
> Everything is fine apart from the title on the colorbar is rotated 180 degrees.
>
> What I mean by this is that if I generate the plot in a post-script file (lowering the resolution of the data so it's not crazy-big), the colorbar title title reads bottom to top with the underside of the title facing the colorbar.
>
> If I do exactly the same thing in the z-buffer, the colorbar title runs top to bottom with the underside of the title facing the edge of the window.
>
> Basically, the title is rotated 180 degrees.
>
> Any idea what's going on?

No. Can I see some code, please. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Behaviour of colorbar title in z-buffer? [message #87850 is a reply to message #87810] Fri, 28 February 2014 02:40 Go to previous messageGo to next message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
On Thursday, February 27, 2014 5:02:43 PM UTC, David Fanning wrote:
> No. Can I see some code, please. :-)

I've trimmed it down to just what I think the relevant bits are. Doing the same thing but changing the z-buffer stuff to ps_start/ps_end gives what I'd expect.

Thanks

Rob



;open z-buffer
thisDevice = !D.Name
Set_Plot, 'Z', /COPY

Device, Set_Resolution=[resx,resy], Z_Buffer=0
Erase

;plot map
map_set,/grid,/continents,limit=plot_lat_min,plot_lon_min,pl ot_lat_max,plot_lon_max],glinethick=2,ymargin=0,xmargin=0,po sition=[posx1, posy1, posx2, posy2], mlinethick=2, color=0, /noerase


;do some plotting stuff here
<snip>

;set colorbar coordinates
cposx1=0.2
cposy1=0.08
cposx2=0.6
cposy2=0.09

title='Altitude [m]'
format='(I6)'
minval=0
maxval=5000

;plot colorbar
colorbar,range=[minval,maxval],/vertical,title=title, $
position=[cposx1, cposy1, cposx2, cposy2],ncolors=254, thick=4, charthick=2, format=format, color=255, charsize=1.5

;get plot from z-buffer
snapshot = TVRD()
TVLCT, r, g, b, /Get
Device, Z_Buffer=1
Set_Plot, thisDevice


image24 = BytArr(3, resx, resy)
image24[0,*,*] = r[snapshot]
image24[1,*,*] = g[snapshot]
image24[2,*,*] = b[snapshot]

Write_png, png_filename+'.png', image24
Re: Behaviour of colorbar title in z-buffer? [message #87851 is a reply to message #87850] Fri, 28 February 2014 05:20 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rjp23@le.ac.uk writes:

> I've trimmed it down to just what I think the relevant bits are. Doing the same thing but changing the z-buffer stuff to ps_start/ps_end gives what I'd expect.

OK, so here is what is happening.

Here are your colorbar coordinates:

;set colorbar coordinates
cposx1=0.2
cposy1=0.08
cposx2=0.6
cposy2=0.09

These are coordinates, obviously, of a HORIZONTAL color bar. That is,
the bar is much longer in X than in Y. But, you tell your color bar that
you want a VERTICAL colorbar.

This make absolutely no sense to the color bar program. So, it says to
itself, "This guy obviously doesn't know what he wants, so I'm thinking
he probably got the damn coordinates wrong." And the colorbar routine
switches things around so the you get the vertical color bar you are
suppose to get. But, the TITLE doesn't seem to be getting word of this,
so it goes on what it thinks is the original HORIZONTAL bar.

The COLORBAR routine you are using is so old I'm not exactly sure how it
works, to be honest with you. I haven't seen that code for about five
years. But, I think your problems will be solved if you simply match
your colorbar coordinates with the type of bar you are trying to draw.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Behaviour of colorbar title in z-buffer? [message #87852 is a reply to message #87851] Fri, 28 February 2014 05:35 Go to previous messageGo to next message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
On Friday, February 28, 2014 1:20:07 PM UTC, David Fanning wrote:
> This make absolutely no sense to the color bar program. So, it says to
>
> itself, "This guy obviously doesn't know what he wants, so I'm thinking
>
> he probably got the damn coordinates wrong." And the colorbar routine
>
> switches things around so the you get the vertical color bar you are
>
> suppose to get. But, the TITLE doesn't seem to be getting word of this,
>
> so it goes on what it thinks is the original HORIZONTAL bar.
>
>
>
> The COLORBAR routine you are using is so old I'm not exactly sure how it
>
> works, to be honest with you. I haven't seen that code for about five
>
> years. But, I think your problems will be solved if you simply match
>
> your colorbar coordinates with the type of bar you are trying to draw.

Hi David,

I'm not sure that solves it as giving it either


cposx1=0.2
cposy1=0.08
cposx2=0.6
cposy2=0.09

or

cposx1=0.08
cposy1=0.2
cposx2=0.09
cposy2=0.6

makes no difference to the colorbar at all. It still plots it in exactly the same place with the title the wrong way around.

Also, this seems to all work fine in the PS device and the problem seems specific to the z-buffer.

I think the solution might just be to update my colorbar routine :-)

Cheers

Rob
Re: Behaviour of colorbar title in z-buffer? [message #87853 is a reply to message #87852] Fri, 28 February 2014 05:44 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rjp23@le.ac.uk writes:

> I think the solution might just be to update my colorbar routine :-)

Well, yes, that's what I would recommend. Your code reminds me fondly of
the 1970s. :-)

To take a snapshot of a window and save it as a PNG file these days, for
example, you need only do this:

void = cgSnapshot(Filename='mywindow.png')

And, I'm almost certain you don't have to do *anything* in the Z-
graphics buffer anymore. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Behaviour of colorbar title in z-buffer? [message #87854 is a reply to message #87853] Fri, 28 February 2014 06:02 Go to previous messageGo to next message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
On Friday, February 28, 2014 1:44:30 PM UTC, David Fanning wrote:
> And, I'm almost certain you don't have to do *anything* in the Z-
>
> graphics buffer anymore. :-)

The only reason I'm using it is I'm making some ultra-high resolution images and I thought that was the best way of doing it? Is there a better solution now?
Re: Behaviour of colorbar title in z-buffer? [message #87855 is a reply to message #87854] Fri, 28 February 2014 06:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rjp23@le.ac.uk writes:

> The only reason I'm using it is I'm making some ultra-high resolution images and I thought that was the best way of doing it? Is there a better solution now?

Yep.

http://www.idlcoyote.com/graphics_tips/weboutput.php

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Behaviour of colorbar title in z-buffer? [message #87856 is a reply to message #87855] Fri, 28 February 2014 06:17 Go to previous messageGo to next message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
On Friday, February 28, 2014 2:11:46 PM UTC, David Fanning wrote:
> rjp23@le.ac.uk writes:
>
>
>
>> The only reason I'm using it is I'm making some ultra-high resolution images and I thought that was the best way of doing it? Is there a better solution now?
>
>
>
> Yep.
>
>
>
> http://www.idlcoyote.com/graphics_tips/weboutput.php
>

Is that the right link? What I meant is that the plots I want to make are for example 4000x2000 pixels or (if possible) 40,000 x 20,000 pixels.

I obviously (I think?) can't do that in the x-window or PS device so I thought the z-buffer was the solution?
Re: Behaviour of colorbar title in z-buffer? [message #87858 is a reply to message #87856] Fri, 28 February 2014 06:33 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rjp23@le.ac.uk writes:

> Is that the right link? What I meant is that the plots I want to make are for example 4000x2000 pixels or (if possible) 40,000 x 20,000 pixels.

4000x2000 is trivial.

cgPS_Start, 'mystuff.png'
cgDisplay, 800, 400
... graphics commands here
cgPS_Close, Width=4000

40000x20000 pixels is pretty damn big. What exactly are you going to do
with something that big? I suppose you can make a PostScript file that
big (poster presentation?) 40000/300dpi = something over 11 feet long.
That's pretty good size!

> I obviously (I think?) can't do that in the x-window or PS device so I thought the z-buffer was the solution?

Really!? You think you can do that in the Z-buffer? I guess I'd had to
see it to believe it. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Behaviour of colorbar title in z-buffer? [message #87859 is a reply to message #87858] Fri, 28 February 2014 06:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Really!? You think you can do that in the Z-buffer? I guess I'd had to
> see it to believe it. :-)

Well, I was wrong. You *can* make a 40000x20000 window in the Z-buffer.
I can't tell what is *in* the file because I don't have software,
apparently, that can open a file that big. But, it certainly appears to
have been created. :-)

I presume you can do the same thing in PostScript if you have a hard
drive big enough to hold the file.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to build connection between IDL and postGIS
Next Topic: interpolate weirdness

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

Current Time: Wed Oct 08 13:47:12 PDT 2025

Total time taken to generate the page: 0.00442 seconds