Re : Color Fonts?!?!? [message #31863 is a reply to message #30304] |
Tue, 20 August 2002 20:13  |
rmw092001
Messages: 17 Registered: January 2002
|
Junior Member |
|
|
Hello,
I wanted to plot a string with words in different colors, and found
this thread from a few months ago (unfortunately google doesn't allow
to restart old newsgroup threads). But isn't there a much easier way -
loadct,33
a=['the',' quick',' brown',' fox',' jumped',' over',' the',' lazy','
dog']
xyouts,.1,.5,a(0),color=20
for i=1,8 do xyouts,a(i),color=20+i*25
where XYOUTS remembers the last position if you don't give it x,y
values???? Anyway, just posting this so it's archived on google, in
case it's useful
RW
=====
Subject: Re: Color Fonts?!?!?
Date: 2002-04-17 12:20:13 PST
> Date: Wed, 17 Apr 2002 12:26:45 -0600
> From: Sean Davis <sdavis@nis.lanl.gov>
> Does anyone know how to make a string have different colored fonts. I
> would like the x-axis title on a plot to have a string that has different
> colors. thanks!
OK, after re-reading your post, it seems like you really do want each
letter to be a different color in the same string (weird!). In order
to do this via the method I showed in my last post, you need to use
fixed-width fonts OR somehow get plot to accept an "ALIGN=0.0" call.
If you can do either of these, it is simple to adapt the code below to
a loop of PLOT calls, with xtitle= being the key part.
If you want to do it in your normal font, you have to use XYOUTS, and
position the string in the correct location yourself. But here is how
to get a rainbow string:
data = indgen(10)
title = 'This is a Title'
plot, data
for i=15, 0, -1 do $
xyouts, 0.5, 0.5, align=0.0, /norm, $
strmid(title,0,i)+strmid(' ',i,15), $
color=255-(i*12), chars=2
This is getting closer to the "extraordinary hack" that David
mentioned (as in "extraordinary ugly").
|
|
|