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

Home » Public Forums » archive » Two NewGraphics weirdnesses
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
Two NewGraphics weirdnesses [message #88913] Thu, 03 July 2014 05:11 Go to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Folks,

do FONT_COLOR and SYM_COLOR accept arrays as input?

And, regardless to the answer, can someone explain this to me:


; This creates the correct filled points but the text colors are erratic
p1 = plot(INDGEN(10))
p1t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], ['BLUE', 'PURPLE',$
'RED', 'ORANGE'], FONT_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
p1s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
/SYM_FILLED, SYM_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])

; This is just chaos
cols = ['BLUE', 'PURPLE', 'RED', 'ORANGE']
p2 = plot(INDGEN(10))
p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols, FONT_COLOR=cols)
p2s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
/SYM_FILLED, SYM_COLOR=cols)


Thanks for shedding light on this for me!


Fabien


IDL> print, !VERSION
{ x86_64 linux unix linux 8.3 Nov 15 2013 64 64}
Re: Two NewGraphics weirdnesses [message #88918 is a reply to message #88913] Thu, 03 July 2014 09:40 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On Thursday, July 3, 2014 2:11:44 PM UTC+2, Fabien wrote:
> Folks,
>
>
>
> do FONT_COLOR and SYM_COLOR accept arrays as input?
>
>
>
> And, regardless to the answer, can someone explain this to me:
>
>
>
>
>
> ; This creates the correct filled points but the text colors are erratic
>
> p1 = plot(INDGEN(10))
>
> p1t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], ['BLUE', 'PURPLE',$
>
> 'RED', 'ORANGE'], FONT_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
>
> p1s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
>
> /SYM_FILLED, SYM_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
>
>
>
> ; This is just chaos
>
> cols = ['BLUE', 'PURPLE', 'RED', 'ORANGE']
>
> p2 = plot(INDGEN(10))
>
> p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols, FONT_COLOR=cols)
>
> p2s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
>
> /SYM_FILLED, SYM_COLOR=cols)
>
>
>
>
>
> Thanks for shedding light on this for me!
>
>
>
>
>
> Fabien
>
>
>
>
>
> IDL> print, !VERSION
>
> { x86_64 linux unix linux 8.3 Nov 15 2013 64 64}


The trick (and the inconsistency) is that multiple positions create multiple TEXT objects and only one single SYMBOL object.
The correct way seems to be (note the 'foreach' line):

cols = ['BLUE', 'PURPLE', 'RED', 'ORANGE']
p2 = plot(INDGEN(10))
p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols)
foreach t,p2t,i do t.FONT_COLOR=cols[i]
p2s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle', SYM_COLOR=cols, SYM_FILLED=1)

You get the same inconsistency if you jointly use LABEL_STRING and LABEL_COLOR keywords in SYMBOL (in order to avoid the TEXT calling).

alx.
Re: Two NewGraphics weirdnesses [message #88922 is a reply to message #88913] Thu, 03 July 2014 13:53 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi Alx,

Thanks for your answer.

It is still really not ok that an IDL built-in routine messes around
with your variables:

IDL> print, cols
BLUE PURPLE RED ORANGE
IDL> p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols,$
FONT_COLOR=cols)
IDL> print, cols
0 0 0
0 0 0
0 0 0
0 0 0

Cheers,

Fabien

On 03.07.2014 14:11, Fabien wrote:
> Folks,
>
> do FONT_COLOR and SYM_COLOR accept arrays as input?
>
> And, regardless to the answer, can someone explain this to me:
>
>
> ; This creates the correct filled points but the text colors are erratic
> p1 = plot(INDGEN(10))
> p1t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], ['BLUE', 'PURPLE',$
> 'RED', 'ORANGE'], FONT_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
> p1s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
> /SYM_FILLED, SYM_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
>
> ; This is just chaos
> cols = ['BLUE', 'PURPLE', 'RED', 'ORANGE']
> p2 = plot(INDGEN(10))
> p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols, FONT_COLOR=cols)
> p2s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
> /SYM_FILLED, SYM_COLOR=cols)
>
>
> Thanks for shedding light on this for me!
>
>
> Fabien
>
>
> IDL> print, !VERSION
> { x86_64 linux unix linux 8.3 Nov 15 2013 64 64}
Re: Two NewGraphics weirdnesses [message #88925 is a reply to message #88922] Thu, 03 July 2014 15:01 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le jeudi 3 juillet 2014 22:53:41 UTC+2, Fabien a écrit :
> Hi Alx,
>
>
>
> Thanks for your answer.
>
>
>
> It is still really not ok that an IDL built-in routine messes around
>
> with your variables:
>
>
>
> IDL> print, cols
>
> BLUE PURPLE RED ORANGE
>
> IDL> p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols,$
>
> FONT_COLOR=cols)
>
> IDL> print, cols
>
> 0 0 0
>
> 0 0 0
>
> 0 0 0
>
> 0 0 0
>
>
>
> Cheers,
>
>
>
> Fabien
>
>
>
> On 03.07.2014 14:11, Fabien wrote:
>
>> Folks,
>
>>
>
>> do FONT_COLOR and SYM_COLOR accept arrays as input?
>
>>
>
>> And, regardless to the answer, can someone explain this to me:
>
>>
>
>>
>
>> ; This creates the correct filled points but the text colors are erratic
>
>> p1 = plot(INDGEN(10))
>
>> p1t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], ['BLUE', 'PURPLE',$
>
>> 'RED', 'ORANGE'], FONT_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
>
>> p1s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
>
>> /SYM_FILLED, SYM_COLOR=['BLUE', 'PURPLE', 'RED', 'ORANGE'])
>
>>
>
>> ; This is just chaos
>
>> cols = ['BLUE', 'PURPLE', 'RED', 'ORANGE']
>
>> p2 = plot(INDGEN(10))
>
>> p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols, FONT_COLOR=cols)
>
>> p2s = symbol([0.27,0.27,0.27, 0.27],[0.8,0.77,0.72,0.69], 'circle',
>
>> /SYM_FILLED, SYM_COLOR=cols)
>
>>
>
>>
>
>> Thanks for shedding light on this for me!
>
>>
>
>>
>
>> Fabien
>
>>
>
>>
>
>> IDL> print, !VERSION
>
>> { x86_64 linux unix linux 8.3 Nov 15 2013 64 64}

I agree. In spite of the fact that the documentation does not say that you can specify a multiple color, this looks like a (dangerous) bug.

IDL> pl=plot(/TEST)
IDL> toto = 'blue' & p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols, FONT_COLOR=toto)
IDL> foreach t,p2t do print,t.font_color
0 0 255
0 0 255
0 0 255
0 0 255
IDL> p2t = text([0.3,0.3,0.3, 0.3],[0.8,0.77,0.72,0.69], cols, FONT_COLOR=cols)
IDL> foreach t,p2t do print,t.font_color
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
IDL> cols
0 0 0
0 0 0
0 0 0
0 0 0
Re: Two NewGraphics weirdnesses [message #88927 is a reply to message #88925] Thu, 03 July 2014 23:01 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Just FYI, that bug where it changes your variable has been fixed for IDL 8.4, due out in a few months.

Cheers,
Chris
Re: Two NewGraphics weirdnesses [message #88928 is a reply to message #88927] Fri, 04 July 2014 01:16 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi Chris,

that's great, thanks!

The documentation for both SYM_COLOR and FONT_COLOR states:
"Set this property to a string or RGB vector that specifies the text
color. The default value is "black"."

So is it OK or not to give an array as input? Is the "inconsistency"
between text() and symbol() going to remain as it is now?

Thanks a lot!

Fabien
Re: Two NewGraphics weirdnesses [message #88929 is a reply to message #88928] Fri, 04 July 2014 02:07 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On Friday, July 4, 2014 10:16:05 AM UTC+2, Fabien wrote:
> Hi Chris,
>
>
>
> that's great, thanks!
>
>
>
> The documentation for both SYM_COLOR and FONT_COLOR states:
>
> "Set this property to a string or RGB vector that specifies the text
>
> color. The default value is "black"."
>
>
>
> So is it OK or not to give an array as input? Is the "inconsistency"
>
> between text() and symbol() going to remain as it is now?
>
>
>
> Thanks a lot!
>
>
>
> Fabien


"Set this property to a string or RGB vector that specifies the text color"
seems to me be meaning that you *cannot* give an array as input.
alx.
Re: Two NewGraphics weirdnesses [message #88933 is a reply to message #88929] Sat, 05 July 2014 03:23 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi Alx,

On 04.07.2014 11:07, alx wrote:
> seems to me be meaning that you*cannot* give an array as input.

Agreed. But since it works well for symbols it is tempting to use this
"bug" in your code, while it might not work forever if they decide to
throw an error in 8.4 when you try to pass a 4-element array as argument.

Anyway, it's not that important. Thanks Alx and Chris for your help!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How can IDL interact with a web service client?
Next Topic: Fredholm integral equation

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

Current Time: Wed Oct 08 15:08:09 PDT 2025

Total time taken to generate the page: 0.00455 seconds