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

Home » Public Forums » archive » Contour labels not aligned with contours
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
Contour labels not aligned with contours [message #88529] Thu, 08 May 2014 11:58 Go to next message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
Hi all,

Has anyone encountered a problem before where the contour labels are not aligned with the spaces left in the actual contours? It has been happening to me for the past few weeks, but I can't think that anything has changed with my system.

The problem only occurs when outputting to a postscript file which has different x and y lengths. I've put a couple of examples here: http://physics.open.ac.uk/~lsteele/contour_label.png

As can be seen in the top plot, the labels on the vertical line sections aren't centered on the contour as they are in the bottom plot. Does anyone know if this can be amended?

The test code I used for each plot is:

x = sin(findgen(50)/49*!pi)*5
y = cos(findgen(50)/49*!pi/2)*5
array = x#y

set_plot, 'ps'
!p.font=0
device, /encap, xsize=10, ysize=4, /inches, filename='test.eps'
pos = cglayout([1,1])

clevels = findgen(13)*2
contour, array, findgen(50), findgen(50), levels=clevels, $
c_label=intarr(26)+1, c_charsize=0.5, color=cgcolor('black')
device, /close

with the xsize being changed from 10 to 4 for the bottom plot.

Cheers,

Liam
Re: Contour labels not aligned with contours [message #88530 is a reply to message #88529] Thu, 08 May 2014 12:23 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ljs15@fsmail.net writes:

> Has anyone encountered a problem before where the contour labels are not aligned with the spaces left in the actual contours? It has been happening to me for the past few weeks, but I can't think that anything has changed with my system.
>
> The problem only occurs when outputting to a postscript file which has different x and y lengths. I've put a couple of examples here: http://physics.open.ac.uk/~lsteele/contour_label.png
>
> As can be seen in the top plot, the labels on the vertical line sections aren't centered on the contour as they are in the bottom plot. Does anyone know if this can be amended?

I think you had something else going on when you created the top figure.
Try exiting IDL (or doing a .reset), then running the code again.

Let us know. :-)

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: Contour labels not aligned with contours [message #88532 is a reply to message #88530] Thu, 08 May 2014 13:19 Go to previous messageGo to next message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
On Thursday, 8 May 2014 20:23:17 UTC+1, David Fanning wrote:
> ljs15@fsmail.net writes:
>
>
>
>> Has anyone encountered a problem before where the contour labels are not aligned with the spaces left in the actual contours? It has been happening to me for the past few weeks, but I can't think that anything has changed with my system.
>
>>
>
>> The problem only occurs when outputting to a postscript file which has different x and y lengths. I've put a couple of examples here: http://physics.open.ac.uk/~lsteele/contour_label.png
>
>>
>
>> As can be seen in the top plot, the labels on the vertical line sections aren't centered on the contour as they are in the bottom plot. Does anyone know if this can be amended?
>
>
>
> I think you had something else going on when you created the top figure.
>
> Try exiting IDL (or doing a .reset), then running the code again.
>
>
>
> Let us know. :-)
>
>
>
> 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.")


I thought it might be a problem with something I'd done previously, so I did exit IDL and then plotted the two pictures after logging in again, one after the other (I did each twice, i.e. the 10x4 inch image, then 4x4, then 10x4 then 4x4). Each time, only the labels in the 4x4 image were centred. :-S
Re: Contour labels not aligned with contours [message #88534 is a reply to message #88532] Thu, 08 May 2014 13:51 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ljs15@fsmail.net writes:

> I thought it might be a problem with something I'd done previously, so I did exit IDL and then plotted the two pictures after logging in again, one after the other (I did each twice, i.e. the 10x4 inch image, then 4x4, then 10x4 then 4x4). Each time, only the labels in the 4x4 image were centred.

Humm. Weird. Doesn't happen like that for me. What version of IDL are
you using? On what machine?

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: Contour labels not aligned with contours [message #88536 is a reply to message #88529] Fri, 09 May 2014 02:19 Go to previous messageGo to next message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
Right, I've done some more investigating...

The problem seems to be related to the character size used to label the contour labels. I've done two more test plots, using the code below. The results are here: http://physics.open.ac.uk/~lsteele/contour_test.png

In the first plot I set c_charsize=0.2, while in the second plot I set c_charsize=0.5. As you can see, the labels look ok in the second plot, but are not aligned with the contours in the first plot.

The problem is, I need to produce the eps plot for a journal article, and it needs to be output in the correct size (in this case 2.5 inches square). As such, I have to use small c_charsize values to make the labels legible, and not cover up any shading which is plotted underneath the contours.

Does anyone know of a way around this?

Cheers,

Liam

Test code:

x = sin(findgen(50)/49*!pi)*5
y = cos(findgen(50)/49*!pi/2)*5
array = x#y

set_plot, 'ps'
!p.font=0
device, /encap, xsize=2.5, ysize=2.5, /inches, filename='test.eps'
pos = cglayout([1,1], oxmargin=[3,1], oymargin=[2,1])

clevels = findgen(13)*2
contour, array, findgen(50), findgen(50), levels=clevels, $
c_label=intarr(13)+1, charsize=0.6, c_charsize=0.2, $
color=cgcolor('black'), position=pos[*,0]

device, /close
Re: Contour labels not aligned with contours [message #88537 is a reply to message #88536] Fri, 09 May 2014 02:21 Go to previous messageGo to next message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
On Friday, 9 May 2014 10:19:17 UTC+1, lj...@fsmail.net wrote:
> Right, I've done some more investigating...
>
>
>
> The problem seems to be related to the character size used to label the contour labels. I've done two more test plots, using the code below. The results are here: http://physics.open.ac.uk/~lsteele/contour_test.png
>
>
>
> In the first plot I set c_charsize=0.2, while in the second plot I set c_charsize=0.5. As you can see, the labels look ok in the second plot, but are not aligned with the contours in the first plot.
>
>
>
> The problem is, I need to produce the eps plot for a journal article, and it needs to be output in the correct size (in this case 2.5 inches square). As such, I have to use small c_charsize values to make the labels legible, and not cover up any shading which is plotted underneath the contours.
>
>
>
> Does anyone know of a way around this?
>
>
>
> Cheers,
>
>
>
> Liam
>
>
>
> Test code:
>
>
>
> x = sin(findgen(50)/49*!pi)*5
>
> y = cos(findgen(50)/49*!pi/2)*5
>
> array = x#y
>
>
>
> set_plot, 'ps'
>
> !p.font=0
>
> device, /encap, xsize=2.5, ysize=2.5, /inches, filename='test.eps'
>
> pos = cglayout([1,1], oxmargin=[3,1], oymargin=[2,1])
>
>
>
> clevels = findgen(13)*2
>
> contour, array, findgen(50), findgen(50), levels=clevels, $
>
> c_label=intarr(13)+1, charsize=0.6, c_charsize=0.2, $
>
> color=cgcolor('black'), position=pos[*,0]
>
>
>
> device, /close

Oh, and I've tested this using IDL 7.0 and 8.2, and it happens in both versions.
Re: Contour labels not aligned with contours [message #88538 is a reply to message #88536] Fri, 09 May 2014 06:06 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ljs15@fsmail.net writes:

> The problem seems to be related to the character size used to label the contour labels. I've done two more test plots, using the code below. The results are here: http://physics.open.ac.uk/~lsteele/contour_test.png
>
> In the first plot I set c_charsize=0.2, while in the second plot I set c_charsize=0.5. As you can see, the labels look ok in the second plot, but are not aligned with the contours in the first plot.
>
> The problem is, I need to produce the eps plot for a journal article, and it needs to be output in the correct size (in this case 2.5 inches square). As such, I have to use small c_charsize values to make the labels legible, and not cover up any shading which is plotted underneath the contours.
>
> Does anyone know of a way around this?

If it were me, I would produce the graphic in a normal size, using
normal values for character size, etc. Then I would tell the idiots at
the journal to get their act together and do some reading up on
PostScript files. They can make the damn thing any size they want. Why
are the making you do all the work, for God's sake! :-)

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: Contour labels not aligned with contours [message #88539 is a reply to message #88538] Fri, 09 May 2014 08:32 Go to previous message
Sir Loin Steak is currently offline  Sir Loin Steak
Messages: 42
Registered: January 2012
Member
On Friday, 9 May 2014 14:06:15 UTC+1, David Fanning wrote:
> ljs15@fsmail.net writes:
>
>
>
>> The problem seems to be related to the character size used to label the contour labels. I've done two more test plots, using the code below. The results are here: http://physics.open.ac.uk/~lsteele/contour_test.png
>
>>
>
>> In the first plot I set c_charsize=0.2, while in the second plot I set c_charsize=0.5. As you can see, the labels look ok in the second plot, but are not aligned with the contours in the first plot.
>
>>
>
>> The problem is, I need to produce the eps plot for a journal article, and it needs to be output in the correct size (in this case 2.5 inches square). As such, I have to use small c_charsize values to make the labels legible, and not cover up any shading which is plotted underneath the contours.
>
>>
>
>> Does anyone know of a way around this?
>
>
>
> If it were me, I would produce the graphic in a normal size, using
>
> normal values for character size, etc. Then I would tell the idiots at
>
> the journal to get their act together and do some reading up on
>
> PostScript files. They can make the damn thing any size they want. Why
>
> are the making you do all the work, for God's sake! :-)
>
>
>
> 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.")


That is indeed what I have resorted to doing! (I just doubled the page size, character size etc.) It still seems strange that IDL won't align the labels nicely when using a small c_label size. Ah well!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: GDL weirdness (bug?) with modulo command
Next Topic: Problem with IDLnetURL Callback Function

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

Current Time: Wed Oct 08 15:12:18 PDT 2025

Total time taken to generate the page: 0.00435 seconds