color plot in postscript [message #65677] |
Tue, 17 March 2009 06:48  |
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 #65746 is a reply to message #65677] |
Sat, 21 March 2009 07:00   |
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 #65755 is a reply to message #65677] |
Fri, 20 March 2009 07:14   |
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   |
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   |
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   |
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   |
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   |
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   |
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   |
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  |
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  |
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.")
|
|
|