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

Home » Public Forums » archive » Plot with axis and labels with different colors
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
Plot with axis and labels with different colors [message #85321] Wed, 24 July 2013 10:19 Go to next message
mairan.teodoro is currently offline  mairan.teodoro
Messages: 20
Registered: June 2008
Junior Member
Hi all,

Is there any easy way of creating a plot with the axis in white and the axis labels in black?

I have an image with black background and would like to show the tick marks in white, and the labels in black.

Thanks for any help.

m.
Re: Plot with axis and labels with different colors [message #85323 is a reply to message #85321] Wed, 24 July 2013 10:41 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mairan Teodoro writes:

> Is there any easy way of creating a plot with the axis in white and the axis labels in black?
>
> I have an image with black background and would like to show the tick marks in white, and the labels in black.

image = BytArr(300, 300)
image[50,50] = Dist(200,200)
cgLoadct, 5
cgImage, image, /Axes, color='white', OPosition=p, /Fit_Inside
cgPlot, findgen(300), /NoData, /NoErase, Position=p, XStyle=4, YStyle=4
cgPlot, findgen(300), /NoData, /NoErase, Position=p, $
XTicklen=0.0001, YTicklen=0.0001, XMinor=0, YMinor=0
END

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Plot with axis and labels with different colors [message #85333 is a reply to message #85323] Thu, 25 July 2013 12:02 Go to previous messageGo to next message
mairan.teodoro is currently offline  mairan.teodoro
Messages: 20
Registered: June 2008
Junior Member
Hi David!

Thanks for the suggestion. However, that's exactly the way I use to create this kind of plot (one CGIMAGE call and two CGPLOT calls).

I was thinking about something like a keyword to define the color of the axis labels... something like

cgPlot, dataX, dataY, axiscolor='white', axislabel='black',...

Cheers,
m.
Re: Plot with axis and labels with different colors [message #85334 is a reply to message #85333] Thu, 25 July 2013 12:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mairan Teodoro writes:

> Thanks for the suggestion. However, that's exactly the way I use to create this kind of plot (one CGIMAGE call and two CGPLOT calls).
>
> I was thinking about something like a keyword to define the color of the axis labels... something like
>
> cgPlot, dataX, dataY, axiscolor='white', axislabel='black',...

Unfortunately, the axis color and the axis label are not separated in
the underlying Plot and Axis commands in IDL. That's why you have to do
this run-around.

In object graphics, these two colors are separate, so you can do what
you like. It's rather round-about in Function Graphics, too, but it is
possible. You do it like this:

;***********************************************************
im = image(cgdemodata(7))
p = im.POSITION
p = plot(indgen(360), position=p, /current, /nodata)
axes = p.axes
for j=0,3 do axes[j].color = 'white'
for j=0,3 do axes[j].text_color = 'black'
;***********************************************************

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: smoothing spline
Next Topic: UNsharing an IDLgrImage

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

Current Time: Wed Oct 08 15:49:41 PDT 2025

Total time taken to generate the page: 0.00431 seconds