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

Home » Public Forums » archive » color plot in postscript
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
color plot in postscript [message #65677] Tue, 17 March 2009 06:48 Go to next message
matteo86bo is currently offline  matteo86bo
Messages: 3
Registered: March 2009
Junior Member
hi everyone!
It is possible to have a color plot in ps format?

set_plot, 'PS'
device,file='fig5.ps',/color,bits_per_pixel=8

loadct=13
plot, ....., linestyle=0,color='50'

this code doesn't work ... any suggestions?
Re: color plot in postscript [message #65733 is a reply to message #65677] Sun, 22 March 2009 15:49 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeremy Bailin writes:

> In principle, that's definitely the way to go ({X|Y|Z}AXISCOLOR, with
> a default of AXISCOLOR a la CHARSIZE) ... but I'm having trouble
> picturing a plot where having separate axis colours doesn't look
> horrible! :-)

One of the problems with object graphics is that too
many choices are available. See the Paradox of Choice
by Barry Schwartz for the reasons why:

http://www.dfanning.com/reading/coyote_reading_2007.html

I'd be more than happy if the axes were one color and
the data was another. :-)

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: color plot in postscript [message #65738 is a reply to message #65677] Sun, 22 March 2009 06:03 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Mar 21, 12:49 pm, "Jean H." <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
>> Damn you... I looked at it and said "AXISCOLOR, of course". Then 5
>> minutes later I changed my mind, and I've been flipping back and forth
>> since then. ;-)
>
>> -Jeremy.
>
> Xcolor and Ycolor (and Zcolor)? if the later is not specified, use the
> same color for both...
>
> just adding another choice in the decision :-)
> Jean

In principle, that's definitely the way to go ({X|Y|Z}AXISCOLOR, with
a default of AXISCOLOR a la CHARSIZE) ... but I'm having trouble
picturing a plot where having separate axis colours doesn't look
horrible! :-)=

(yes, that's an invitation for everyone to post fantastic figures
they've made that do this!)

-Jeremy.
Re: color plot in postscript [message #65745 is a reply to message #65677] Sat, 21 March 2009 09:49 Go to previous messageGo to next message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
> Damn you... I looked at it and said "AXISCOLOR, of course". Then 5
> minutes later I changed my mind, and I've been flipping back and forth
> since then. ;-)
>
> -Jeremy.

Xcolor and Ycolor (and Zcolor)? if the later is not specified, use the
same color for both...

just adding another choice in the decision :-)
Jean
Re: color plot in postscript [message #65746 is a reply to message #65677] Sat, 21 March 2009 07:00 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Mar 20, 8:47 am, David Fanning <n...@dfanning.com> wrote:
> Jeremy Bailin writes:
>> That's actually my single biggest pet peeve about the plot command.
>> Surely there could be a keyword like "axiscolor" or something to
>> separately specify the colour of the axes+labels from the color of the
>> plotted data. Every time I do that two-command version I grumble.
>
>> "But Jeremy, why don't you just write your own wrapper that does
>> that?"
>
>> Good question... I sense a new addition to JBIU coming. ;-)
>
> It is truly amazing with what we put up with sometimes.
> But, writing the wrapper would irritate me even more.
> Why am I supporting this stupid color index way of
> specifying color when I don't use it anymore, ever,
> unless under duress and because IDL forces me to?
>
> When I write programs that use color, I want to use
> *names* of colors, not some color index that means
> nothing to me or to any of my users when they read
> the code. I used to think I was tying to impose my
> own person belief system on users when I made them
> use a color name rather than a color index. But then
> I thought, hell, just because I'm too old to care
> about offending someone doesn't mean I'm not right
> about it. ;-)
>
> Cheers,
>
> David
>
> P.S. When you write this wrapper think long and
> hard about whether this keyword is going to be
> AXISCOLOR or AXESCOLOR, because no matter which
> you choose, you are going to lose sleep over it. :-)
>
> --
> 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.")

Damn you... I looked at it and said "AXISCOLOR, of course". Then 5
minutes later I changed my mind, and I've been flipping back and forth
since then. ;-)

-Jeremy.
Re: color plot in postscript [message #65754 is a reply to message #65677] Fri, 20 March 2009 07:59 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Mar 20, 9:14 am, David Fanning <n...@dfanning.com> wrote:

> Although I am pretty sure Vince is not allowing for
> the fact that you have to know what device you are
> on, etc., if you are going to use indexed color
> successfully everywhere.

True -

> It is this last part that
> creates nightmares for code developers. If I were
> writing code only for my own use, life would be a
> LOT simpler. :-)

It is. ;^)
Re: color plot in postscript [message #65755 is a reply to message #65677] Fri, 20 March 2009 07:14 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Vince Hradil writes:

> I ran into this just last week. I wanted to use David's histoplot to
> have a "polyfilled" histogram, and I wanted the histogram to be shaded
> the same as the color image I was histogramming. http://yfrog.com/0erc3191=
> c5p
> I tried to set the polycolor keyword to, say, lindgen(256), but alas
> it wanted names. I ended up writing it myself - but I did alter
> histoplot.pro to check if polycolor is a string type or not. If it is
> a string (or string array), I let it call fsc_color(), otherwise I use
> the index.

Well, OK, here is an excellent counter-argument to my
general color philosophy. :-)

Over the weekend, though, I went to the trouble of
accommodating EVERYONE's way of specifying color
in my discrete color bar program. (Still haven't
seen that check, Vince!) That may be the last time
I try to do that. If you want to do it the old
way, as Vince proves, two lines of code and you
are back in business.

Although I am pretty sure Vince is not allowing for
the fact that you have to know what device you are
on, etc., if you are going to use indexed color
successfully everywhere. It is this last part that
creates nightmares for code developers. If I were
writing code only for my own use, life would be a
LOT simpler. :-)

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: color plot in postscript [message #65756 is a reply to message #65677] Fri, 20 March 2009 06:58 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Mar 20, 8:22 am, Dave Klassen <klas...@rowan.edu> wrote:
> On Mar 20, 8:47 am, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> It is truly amazing with what we put up with sometimes.
>> But, writing the wrapper would irritate me even more.
>> Why am I supporting this stupid color index way of
>> specifying color when I don't use it anymore, ever,
>> unless under duress and because IDL forces me to?
>
> Well, to play devil's advocate here, using a color index is good
> for doing multiple plots of differing colors.
>      plot, x, y[0,*], /nodata
>      for i=1,7 do oplot x, y[i,*], color=i
>
> Of course, I realize one could do
>      clrvec=['Red','Blue','Green',...]
> and then use
>      for i=1,7 do oplot x, y[i,*], color=clrvec[i]
> to get the same result.

I ran into this just last week. I wanted to use David's histoplot to
have a "polyfilled" histogram, and I wanted the histogram to be shaded
the same as the color image I was histogramming. http://yfrog.com/0erc3191c5p
I tried to set the polycolor keyword to, say, lindgen(256), but alas
it wanted names. I ended up writing it myself - but I did alter
histoplot.pro to check if polycolor is a string type or not. If it is
a string (or string array), I let it call fsc_color(), otherwise I use
the index.
Re: color plot in postscript [message #65757 is a reply to message #65677] Fri, 20 March 2009 06:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dave Klassen writes:

> Well, to play devil's advocate here, using a color index is good
> for doing multiple plots of differing colors.
> plot, x, y[0,*], /nodata
> for i=3D1,7 do oplot x, y[i,*], color=3Di
>
> Of course, I realize one could do
> clrvec=3D['Red','Blue','Green',...]
> and then use
> for i=3D1,7 do oplot x, y[i,*], color=3Dclrvec[i]
> to get the same result.

And I wouldn't be surprised to find some of the color
tools I've built would allow you to do just that. :-)

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: color plot in postscript [message #65758 is a reply to message #65677] Fri, 20 March 2009 06:22 Go to previous messageGo to next message
David Klassen is currently offline  David Klassen
Messages: 27
Registered: December 2004
Junior Member
On Mar 20, 8:47 am, David Fanning <n...@dfanning.com> wrote:
>
> It is truly amazing with what we put up with sometimes.
> But, writing the wrapper would irritate me even more.
> Why am I supporting this stupid color index way of
> specifying color when I don't use it anymore, ever,
> unless under duress and because IDL forces me to?

Well, to play devil's advocate here, using a color index is good
for doing multiple plots of differing colors.
plot, x, y[0,*], /nodata
for i=1,7 do oplot x, y[i,*], color=i

Of course, I realize one could do
clrvec=['Red','Blue','Green',...]
and then use
for i=1,7 do oplot x, y[i,*], color=clrvec[i]
to get the same result.
Re: color plot in postscript [message #65759 is a reply to message #65677] Fri, 20 March 2009 05:52 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> P.S. When you write this wrapper think long and
> hard about whether this keyword is going to be
> AXISCOLOR or AXESCOLOR, because no matter which
> you choose, you are going to lose sleep over it. :-)

And, by the way, since you are going to the trouble,
could you PLEASE make the background color white by
default, so we don't have to turn upside down to
make a PostScript file? Thank you. ;-)

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: color plot in postscript [message #65760 is a reply to message #65677] Fri, 20 March 2009 05:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeremy Bailin writes:

> That's actually my single biggest pet peeve about the plot command.
> Surely there could be a keyword like "axiscolor" or something to
> separately specify the colour of the axes+labels from the color of the
> plotted data. Every time I do that two-command version I grumble.
>
> "But Jeremy, why don't you just write your own wrapper that does
> that?"
>
> Good question... I sense a new addition to JBIU coming. ;-)

It is truly amazing with what we put up with sometimes.
But, writing the wrapper would irritate me even more.
Why am I supporting this stupid color index way of
specifying color when I don't use it anymore, ever,
unless under duress and because IDL forces me to?

When I write programs that use color, I want to use
*names* of colors, not some color index that means
nothing to me or to any of my users when they read
the code. I used to think I was tying to impose my
own person belief system on users when I made them
use a color name rather than a color index. But then
I thought, hell, just because I'm too old to care
about offending someone doesn't mean I'm not right
about it. ;-)

Cheers,

David

P.S. When you write this wrapper think long and
hard about whether this keyword is going to be
AXISCOLOR or AXESCOLOR, because no matter which
you choose, you are going to lose sleep over it. :-)

--
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: color plot in postscript [message #65761 is a reply to message #65677] Fri, 20 March 2009 04:37 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Mar 19, 9:55 am, David Fanning <n...@dfanning.com> wrote:
> matteo86bo writes:
>> ah, thank you very much! this works!
>> anyway all the plot is colored... how can I color only the line and
>> not the axis?
>
>    Plot, data, Color=FSC_Color('navy'), /NoData
>    Oplot, data, Color=FSC_Color('red')
>
> 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.")

That's actually my single biggest pet peeve about the plot command.
Surely there could be a keyword like "axiscolor" or something to
separately specify the colour of the axes+labels from the color of the
plotted data. Every time I do that two-command version I grumble.

"But Jeremy, why don't you just write your own wrapper that does
that?"

Good question... I sense a new addition to JBIU coming. ;-)

-Jeremy.
Re: color plot in postscript [message #65787 is a reply to message #65677] Thu, 19 March 2009 06:55 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
matteo86bo writes:

> ah, thank you very much! this works!
> anyway all the plot is colored... how can I color only the line and
> not the axis?

Plot, data, Color=FSC_Color('navy'), /NoData
Oplot, data, Color=FSC_Color('red')

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: color plot in postscript [message #65852 is a reply to message #65677] Tue, 24 March 2009 10:45 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Unfortunately, this only really works if I work with
> color decomposition on (my usual state). I haven't yet
> figured out how to do this in a completely device-independent
> way. (Although I just had another idea about it while writing
> this note.) Stay tuned, I guess. :-)

OK, FSC_Color has been modified so you can use the
color names '0', '1', '2', ..., '255' to refer to
colors in the current color table in effect when
FSC_Color is called. This makes it easy to used
FSC_Color with colors you load:

CTLoad, 25, /Brewer, NCOLORS=10, BOTTOM=1
colors = StrTrim(Indgen(10)+1, 2)
Histoplot, ..., PolyColor=colors

You can find the latest program here:

http://www.dfanning.com/programs/fsc_color.pro

Cheers,

David

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: color plot in postscript [message #65863 is a reply to message #65756] Tue, 24 March 2009 06:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Vince Hradil writes:

> I ran into this just last week. I wanted to use David's histoplot to
> have a "polyfilled" histogram, and I wanted the histogram to be shaded
> the same as the color image I was histogramming. http://yfrog.com/0erc3191=
> c5p
> I tried to set the polycolor keyword to, say, lindgen(256), but alas
> it wanted names. I ended up writing it myself - but I did alter
> histoplot.pro to check if polycolor is a string type or not. If it is
> a string (or string array), I let it call fsc_color(), otherwise I use
> the index.

Yikes! I ran into this situation just yesterday myself, although
I solved it in a slightly different way. I modified FSC_COLOR
to know the "names" of the colors in the current color table.
I gave them the names '0', '1', '2', ..., '255'. Thus, I could
specify a range of colors like this:

Histoplot, ..., POLYCOLOR=SIndgen(10)

Unfortunately, this only really works if I work with
color decomposition on (my usual state). I haven't yet
figured out how to do this in a completely device-independent
way. (Although I just had another idea about it while writing
this note.) Stay tuned, I guess. :-)

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Google Groups and ENVI 4.6.1
Next Topic: Passing more than one variable out of a function.

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

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

Total time taken to generate the page: 0.00547 seconds