Behaviour of colorbar title in z-buffer? [message #87808] |
Thu, 27 February 2014 09:00  |
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 #87850 is a reply to message #87810] |
Fri, 28 February 2014 02:40   |
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   |
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   |
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 #87858 is a reply to message #87856] |
Fri, 28 February 2014 06:33   |
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  |
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.")
|
|
|