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

Home » Public Forums » archive » Bug report: plot title
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
Bug report: plot title [message #89576] Wed, 29 October 2014 09:24 Go to next message
markb77 is currently offline  markb77
Messages: 217
Registered: July 2006
Senior Member
hi,

I am making a foray into function graphics programming and I have uncovered what I think is a bug in the way that the properties of the plot title are set.

Essentially, when you create the plot, if you request a certain font, or font color, these properties are applied to the axis fonts but not the font title. This is contrary to what is specified in the IDL documentation for the PLOT function:

-------------------
TITLE
Set this property to a string specifying a title. The title properties may be modified using FONT_COLOR, FONT_NAME, FONT_SIZE, and FONT_STYLE. After creation the TITLE property may be used to retrieve a reference to the title text object, and the TEXT properties may be used to modify the title object.
-------------------


The bug is demonstrated in the following test case:

;----
pro test_plot_title_font

mydata_x = indgen(100)
mydata_y = sin(mydata_x * !pi/25.0)

plotfont = 'Courier'
mycolor = [255,0,0]

myplot = plot(mydata_x, $
mydata_y, $
font_name=plotfont, $
font_color=mycolor)

myplot.title = 'Plot Title'

ax = myplot.axes
ax[0].title = 'X axis'
ax[1].title = 'Y axis'

mytitle = myplot.title

print, 'Test results:'
print, ''
print, 'Requested font: ', plotfont
print, 'X axis font: ', ax[0].tickfont_name
print, 'Y axis font: ', ax[1].tickfont_name
print, 'Plot title font: ', mytitle.font_name
print, ''
print, 'Requested font color: ', mycolor
print, 'X axis font color: ', ax[0].text_color
print, 'Y axis font color: ', ax[1].text_color
print, 'Plot title font color: ', mytitle.font_color

print, !version

end
;---

program output:

Test results:

Requested font: Courier
X axis font: Courier
Y axis font: Courier
Plot title font: Helvetica

Requested font color: 255 0 0
X axis font color: 255 0 0
Y axis font color: 255 0 0
Plot title font color: 0 0 0
{ x86_64 Win32 Windows Microsoft Windows 8.3 Nov 15 2013 64 64}

As you can see, the plot title doesn't get assigned the correct font name or font color - possibly other properties would also not be properly assigned. I am using IDL 8.3 x64 on Windows. Perhaps the bug has been fixed in version 8.4?

Mark
Re: Bug report: plot title [message #89600 is a reply to message #89576] Thu, 30 October 2014 14:43 Go to previous messageGo to next message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Hi Mark,

If you specify the string when you create the Plot() it will take the font name and colour as specified there:

myplot = plot(mydata_x, $
mydata_y, $
font_name=plotfont, $
font_color=mycolor, $
title = 'Plot Title')

It seems that if you specify it as you did, the font_name and font_color are not saved as "defaults", they just apply to
things created in that command. However, if the title needs to wait until the Plot() is created, two options:

myplot.title = Text(0.5, 0.9, 'Plot Title', alignment=0.5, font_name = 'Courier', color = [255,0,0])
... and you'd have to fuss with the text size, get the position right, etc.

myplot.title = 'Plot Title' ; A just-right TEXT object is created from this
myplot.title.font_name = 'Courier'
myplot.title.color = [255,0,0]

If you see unwanted flickering through those changes, you can do this:

myplot.refresh, /disable
myplot.title = 'Plot Title'
myplot.title.font_name = 'Courier'
myplot.title.color = [255,0,0]
myplot.refresh

Hope this helps!

--

Cheers,
-Dick

Dick Jackson Software Consulting Inc.
Victoria, BC, Canada
www.d-jackson.com

superchromix wrote, On 2014-10-29, 9:24am:
>
> hi,
>
> I am making a foray into function graphics programming and I have uncovered what I think is a bug in the way that the properties of the plot title are set.
>
> Essentially, when you create the plot, if you request a certain font, or font color, these properties are applied to the axis fonts but not the font title. This is contrary to what is specified in the IDL documentation for the PLOT function:
>
> -------------------
> TITLE
> Set this property to a string specifying a title. The title properties may be modified using FONT_COLOR, FONT_NAME, FONT_SIZE, and FONT_STYLE. After creation the TITLE property may be used to retrieve a reference to the title text object, and the TEXT properties may be used to modify the title object.
> -------------------
>
>
> The bug is demonstrated in the following test case:
>
> ;----
> pro test_plot_title_font
>
> mydata_x = indgen(100)
> mydata_y = sin(mydata_x * !pi/25.0)
>
> plotfont = 'Courier'
> mycolor = [255,0,0]
>
> myplot = plot(mydata_x, $
> mydata_y, $
> font_name=plotfont, $
> font_color=mycolor)
>
> myplot.title = 'Plot Title'
>
> ax = myplot.axes
> ax[0].title = 'X axis'
> ax[1].title = 'Y axis'
>
> mytitle = myplot.title
>
> print, 'Test results:'
> print, ''
> print, 'Requested font: ', plotfont
> print, 'X axis font: ', ax[0].tickfont_name
> print, 'Y axis font: ', ax[1].tickfont_name
> print, 'Plot title font: ', mytitle.font_name
> print, ''
> print, 'Requested font color: ', mycolor
> print, 'X axis font color: ', ax[0].text_color
> print, 'Y axis font color: ', ax[1].text_color
> print, 'Plot title font color: ', mytitle.font_color
>
> print, !version
>
> end
> ;---
>
> program output:
>
> Test results:
>
> Requested font: Courier
> X axis font: Courier
> Y axis font: Courier
> Plot title font: Helvetica
>
> Requested font color: 255 0 0
> X axis font color: 255 0 0
> Y axis font color: 255 0 0
> Plot title font color: 0 0 0
> { x86_64 Win32 Windows Microsoft Windows 8.3 Nov 15 2013 64 64}
>
> As you can see, the plot title doesn't get assigned the correct font name or font color - possibly other properties would also not be properly assigned. I am using IDL 8.3 x64 on Windows. Perhaps the bug has been fixed in version 8.4?
>
> Mark
>
Re: Bug report: plot title [message #89618 is a reply to message #89600] Sat, 01 November 2014 10:11 Go to previous message
markb77 is currently offline  markb77
Messages: 217
Registered: July 2006
Senior Member
hi Dick, thanks for looking into this.

I maintain, however, that this is a BUG.

consider the following:

-------------

pro plot_title_bug

mydata_x = indgen(100)
mydata_y = sin(mydata_x * !pi/25.0)

plotfont = 'Courier'
mycolor = [255,0,0]

myplot = plot(mydata_x, $
mydata_y, $
font_name=plotfont, $
font_color=mycolor)

print, 'Plot properties before setting title:'
print, 'Font name: ', myplot.font_name
print, 'Font color: ', myplot.font_color

myplot.title = 'Plot Title'

print, 'Plot properties after setting title:'
print, 'Font name: ', myplot.font_name
print, 'Font color: ', myplot.font_color

print, !version

end


------------

output:

Plot properties before setting title:
Font name: Courier
Font color: 255 0 0
Plot properties after setting title:
Font name: Helvetica
Font color: 0 0 0
{ x86_64 Win32 Windows Microsoft Windows 8.3 Nov 15 2013 64 64}


Surely setting the Title property of the plot shouldn't change other properties of the plot in this way?

Looks like a bug to me.

Mark
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Best routines for mapping satellite images
Next Topic: Fwd: Announcing RSI User-Contributed Library

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

Current Time: Wed Oct 08 07:14:25 PDT 2025

Total time taken to generate the page: 0.04100 seconds