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

Home » Public Forums » archive » Re: Device independent plotting
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
Re: Device independent plotting [message #70790] Wed, 05 May 2010 08:02
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On May 5, 11:47 am, David Fanning <n...@dfanning.com> wrote:
> Karen writes:
>> To make my code truly platform independent I would like to check what
>> platform I am running on at the start so then I can load the right
>> paths to my files, rather than having to change them by hand every
>> time I swap machine. Is there a command that will tell me whether I am
>> on Mac or PC from within IDL? Sure there's an easy way but I can't
>> find it on the web.
>
> You are looking for !Version.OS_Family.

path_sep() may also be useful, to make sure the right kind of slash is
used. Nicely, file_dirname() and file_basename() work correctly on any
platform when given forward slashes, and return results with the right
kind of slash.
Re: Device independent plotting [message #70791 is a reply to message #70790] Wed, 05 May 2010 07:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karen writes:

> To make my code truly platform independent I would like to check what
> platform I am running on at the start so then I can load the right
> paths to my files, rather than having to change them by hand every
> time I swap machine. Is there a command that will tell me whether I am
> on Mac or PC from within IDL? Sure there's an easy way but I can't
> find it on the web.

You are looking for !Version.OS_Family.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Device independent plotting [message #70792 is a reply to message #70791] Wed, 05 May 2010 07:44 Go to previous message
Karen is currently offline  Karen
Messages: 3
Registered: May 2010
Junior Member
> If anybody is wondering: the "missing" plot lines in Postscript Karen
> described are actually plotted, but in the same color as the
> background, so they are not visible.

I figured that out eventually :-) and now my plots look pretty similar
on the Mac and PC and in postscript and on the screen.

To make my code truly platform independent I would like to check what
platform I am running on at the start so then I can load the right
paths to my files, rather than having to change them by hand every
time I swap machine. Is there a command that will tell me whether I am
on Mac or PC from within IDL? Sure there's an easy way but I can't
find it on the web.

PS I had my tongue firmly in my cheek when referring to the "classic"
red/black colour theme - though it has been close to becoming the
default on my machine lately :-)
Re: Device independent plotting [message #70793 is a reply to message #70792] Wed, 05 May 2010 07:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paolo writes:

> Does that mean that IDL's broken *default* settings for the colors
> have been assimilated internally by so many users that now "red on
> black"
> has achieved the status of being the "classic" color scheme (instead
> of
> the actually intended "white on black")?

As I have traveled around the world teaching IDL
classes, you can't BELIEVE how many people think
red on black in the default color scheme. I am
hoping Karen was using the term ironically. ;-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Device independent plotting [message #70794 is a reply to message #70793] Wed, 05 May 2010 07:20 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On May 5, 11:01 am, Paolo <pgri...@gmail.com> wrote:
> On May 5, 5:56 am, Karen <k.apl...@physics.ox.ac.uk> wrote:> I am using IDL workbench on a Mac at work and a PC at home and I'd
>> like my code to plot the same colours independent of device and
>> platform. I've downloaded the FSC_Color app and read the very helpful
>> documentation by David Fanning. I thought I had followed his
>> instructions carefully for how to get device independent colours, but
>> I can't make it work. At the moment, if I plot to the screen, I get
>> the classic red on black colour scheme,
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Does that mean that IDL's broken *default* settings for the colors
> have been assimilated internally by so many users that now "red on
> black"
> has achieved the status of being the "classic" color scheme (instead
> of
> the actually intended "white on black")?

That is interesting. His description was a good way to express it, as
I immediately recognized the old problem.

I have actually sort of promoted it into a color scheme: in some old
applications I wrote I did not know how to fix it, so I let the red on
black, when originally intended for white on black. But I got so used
to it, that even after I learned to fix it I left it unchanged. And in
some new applications I wrote, even in object graphics, I found myself
explicitly choosing (through triplets) red for lines to plot over
images.

If anybody is wondering: the "missing" plot lines in Postscript Karen
described are actually plotted, but in the same color as the
background, so they are not visible.
Re: Device independent plotting [message #70795 is a reply to message #70794] Wed, 05 May 2010 07:01 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On May 5, 5:56 am, Karen <k.apl...@physics.ox.ac.uk> wrote:
> I am using IDL workbench on a Mac at work and a PC at home and I'd
> like my code to plot the same colours independent of device and
> platform. I've downloaded the FSC_Color app and read the very helpful
> documentation by David Fanning. I thought I had followed his
> instructions carefully for how to get device independent colours, but
> I can't make it work. At the moment, if I plot to the screen, I get
> the classic red on black colour scheme,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Does that mean that IDL's broken *default* settings for the colors
have been assimilated internally by so many users that now "red on
black"
has achieved the status of being the "classic" color scheme (instead
of
the actually intended "white on black")?

Ciao,
Paolo






[skip]
Re: Device independent plotting [message #70797 is a reply to message #70795] Wed, 05 May 2010 06:56 Go to previous message
Karen is currently offline  Karen
Messages: 3
Registered: May 2010
Junior Member
Thanks, that all works nicely!
Re: Device independent plotting [message #70803 is a reply to message #70797] Wed, 05 May 2010 05:00 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pp writes:

> Move the calls to fsc_color to after the call to set_plot. Also, if
> there were any, after any calls to device that changed the way colors
> are handled. But keep it before the first use of the colors,
> obviously.

Yes, generally speaking, it is easier to write
device-independent color programs if colors are
loaded when they are needed. In practice this means
using FSC_Color with your graphics commands. For
example, you could do this:

; Set up colors for graphics output
axisColor = 'Navy'
dataColor = 'Red'
backgnd = 'White'

; Graphics output.
Plot, ..., COLOR=FSC_Color(axisColor), BACKGROUND=FSC_Color(backgnd)
OPLOT, ..., COLOR=FSC_Color(dataColor)

Of course, it seems somewhat redundant to "define" colors
first, so I usually just do this:

Plot, ..., COLOR=FSC_Color('Navy'), BACKGROUND=FSC_Color('White')
OPLOT, ..., COLOR=FSC_Color('Red')

This conveys the message and works well, to boot! :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Device independent plotting [message #70805 is a reply to message #70803] Wed, 05 May 2010 04:16 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
Move the calls to fsc_color to after the call to set_plot. Also, if
there were any, after any calls to device that changed the way colors
are handled. But keep it before the first use of the colors,
obviously.

fsc_color looks into the current device to find out which color value
to use, so it must be called at a point when the device is in the same
state as will be used for plotting.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Creating a new image from an image input in IDL
Next Topic: Fourier Fitting Data in PV-Wave

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

Current Time: Wed Oct 08 13:43:58 PDT 2025

Total time taken to generate the page: 0.00589 seconds