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

Home » Public Forums » archive » changing the format of axis
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
changing the format of axis [message #78363] Mon, 21 November 2011 09:05 Go to next message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
I want to plot some value data (0.2,0.1,0.5) against text data ('55',
'-40', '0'). When I plot them, it seems the text data are conveted to
float data and are shown as values with the same intervales like 50,
0, -50. I wonder how I can change the format of text data that it
shows the exact values?
Re: changing the format of axis [message #78431 is a reply to message #78363] Fri, 25 November 2011 18:20 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Nov 25, 9:36 am, Hasan <h5_khav...@yahoo.com> wrote:
> That's right. 'xtickv' works with Plot (and not iPlot), it adds the
> exact tick values which, here, are equivalent with x values.. I
> couldn't find something similar to that in iPlot.

On further inspection, I noticed that xtickv (xtickvalues) did not
work on 7.1. It does work on 8.1, which is what I had used to test it
as I wrote above.
Re: changing the format of axis [message #78434 is a reply to message #78363] Fri, 25 November 2011 06:52 Go to previous message
Hasan is currently offline  Hasan
Messages: 6
Registered: November 2011
Junior Member
On Nov 25, 2:09 pm, David Fanning <n...@dfanning.com> wrote:
> Hasan writes:
>> I removed the Window keyword and added cgWindow but it seems I am
>> missing something else. if you copy and past the following code and
>> see the results, please, you can see what I mean.
>
> Well, a couple of things. AL_LEGEND requires a WINDOW
> keyword, instead of an ADDCMD keyword to add the command
> to the graphics window. But the biggest problem is that
> you didn't set the Y range of your data on your first plot.
>
> Since you are overploting your other data sets, the first
> plot you create must have a range that is large enough
> to accommodate all the rest of the data you want to put on
> it. In this case, I also made the range large enough so I
> could easily fit the legend onto the plot.
>
> y1=[576.000,687.000,416.000,325.000,271.000]
> y2=[665.000,702.000,527.000,493.000,433.000]
> y3=[2333.00,2409.00,2168.00,1791.00,1583.00]
> y4=[225.000,371.000,149.000,168.000,60.0000]
> y5=[863.000,912.000,590.000,652.000,695.000]
> y6=[546.000,539.000,336.000,322.000,275.000]
> y7=[1431.00,1523.00,1001.00,914.000,892.000]
>  x=[-12,-8,0,5,10]
>
> cgwindow
>
> cgplot,x,y1/10000,LineStyle=0,CHARSIZE =1,color='black', xtickv=x,$
>   xticks=n_elements(x)-1,XTITLE='Class 1',YTITLE='Values', $
>   Title='Differernt calsses values',yrange=[0.,3250.]/10000, /ADDCMD
> cgplot,x,y2/10000,LineStyle=0,color='green',/overplot,/ADDCM D
> cgplot,x,y3/10000,LineStyle=0, color='red',/overplot,/ADDCMD
> cgplot,x,y4/10000,LineStyle=0, color='orange',/overplot,/ADDCMD
> cgplot,x,y5/10000,LineStyle=0, color='magenta',/overplot,/ADDCMD
> cgplot,x,y6/10000,LineStyle=0, color='cyan',/overplot,/ADDCMD
> cgplot,x,y7/10000,LineStyle=0, color='blue',/overplot,/ADDCMD
>
> al_legend,LineStyle=0,$
>   ['class1','class2','class3','class4','class5','class6','clas s7']$
>   ,color=
> ['black','green','red','orange','magenta','cyan','blue'],Pos ition=[0.2,$
>   0.85], /Normal,CHarSIZE=0.8, /WINDOW
> END
>
> This works correctly. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thanks a lot David.
Re: changing the format of axis [message #78435 is a reply to message #78363] Fri, 25 November 2011 06:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hasan writes:

> I removed the Window keyword and added cgWindow but it seems I am
> missing something else. if you copy and past the following code and
> see the results, please, you can see what I mean.

Well, a couple of things. AL_LEGEND requires a WINDOW
keyword, instead of an ADDCMD keyword to add the command
to the graphics window. But the biggest problem is that
you didn't set the Y range of your data on your first plot.

Since you are overploting your other data sets, the first
plot you create must have a range that is large enough
to accommodate all the rest of the data you want to put on
it. In this case, I also made the range large enough so I
could easily fit the legend onto the plot.

y1=[576.000,687.000,416.000,325.000,271.000]
y2=[665.000,702.000,527.000,493.000,433.000]
y3=[2333.00,2409.00,2168.00,1791.00,1583.00]
y4=[225.000,371.000,149.000,168.000,60.0000]
y5=[863.000,912.000,590.000,652.000,695.000]
y6=[546.000,539.000,336.000,322.000,275.000]
y7=[1431.00,1523.00,1001.00,914.000,892.000]
x=[-12,-8,0,5,10]

cgwindow

cgplot,x,y1/10000,LineStyle=0,CHARSIZE =1,color='black', xtickv=x,$
xticks=n_elements(x)-1,XTITLE='Class 1',YTITLE='Values', $
Title='Differernt calsses values',yrange=[0.,3250.]/10000, /ADDCMD
cgplot,x,y2/10000,LineStyle=0,color='green',/overplot,/ADDCM D
cgplot,x,y3/10000,LineStyle=0, color='red',/overplot,/ADDCMD
cgplot,x,y4/10000,LineStyle=0, color='orange',/overplot,/ADDCMD
cgplot,x,y5/10000,LineStyle=0, color='magenta',/overplot,/ADDCMD
cgplot,x,y6/10000,LineStyle=0, color='cyan',/overplot,/ADDCMD
cgplot,x,y7/10000,LineStyle=0, color='blue',/overplot,/ADDCMD

al_legend,LineStyle=0,$
['class1','class2','class3','class4','class5','class6','clas s7']$
,color=
['black','green','red','orange','magenta','cyan','blue'],Pos ition=[0.2,$
0.85], /Normal,CHarSIZE=0.8, /WINDOW
END

This works correctly. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78436 is a reply to message #78363] Fri, 25 November 2011 03:36 Go to previous message
Hasan is currently offline  Hasan
Messages: 6
Registered: November 2011
Junior Member
That's right. 'xtickv' works with Plot (and not iPlot), it adds the
exact tick values which, here, are equivalent with x values.. I
couldn't find something similar to that in iPlot.
Re: changing the format of axis [message #78437 is a reply to message #78363] Fri, 25 November 2011 03:19 Go to previous message
Hasan is currently offline  Hasan
Messages: 6
Registered: November 2011
Junior Member
On Nov 24, 6:29 pm, David Fanning <n...@dfanning.com> wrote:
> Hasan writes:
>> I got this error message 'Trapped Error CGWINDOW: A valid cgWindow doe
>> not exist to add a acommand to.
>
> Now I am guessing you changed the keyword on the first command
> in that series from WINDOW, which you had before, to ADDCMD.
>
> The WINDOW keyword will either replace all the commands in
> a window, if a window exists, with a particular command,
> or create a window and add the command to it. Subsequent
> commands are added with the ADDCMD keyword. If you
> need a window, you can always create one by typing cgWindow.
>
> There is a whole book on the subject if you need further
> direction. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

I removed the Window keyword and added cgWindow but it seems I am
missing something else. if you copy and past the following code and
see the results, please, you can see what I mean.

y1=[576.000,687.000,416.000,325.000,271.000]
y2=[665.000,702.000,527.000,493.000,433.000]
y3=[2333.00,2409.00,2168.00,1791.00,1583.00]
y4=[225.000,371.000,149.000,168.000,60.0000]
y5=[863.000,912.000,590.000,652.000,695.000]
y6=[546.000,539.000,336.000,322.000,275.000]
y7=[1431.00,1523.00,1001.00,914.000,892.000]
x=[-12,-8,0,5,10]

cgwindow

cgplot,x,y1/10000,LineStyle=0,CHARSIZE =1,color='black', xtickv=x,$
xticks=n_elements(x)-1,XTITLE='Class$
1',YTITLE='Values',Title='Differernt calsses values',/ADDCMD
cgplot,x,y2/10000,LineStyle=0,color='green',/overplot,/ADDCM D
cgplot,x,y3/10000,LineStyle=0, color='red',/overplot,/ADDCMD
cgplot,x,y4/10000,LineStyle=0, color='orange',/overplot,/ADDCMD
cgplot,x,y5/10000,LineStyle=0, color='magenta',/overplot,/ADDCMD
cgplot,x,y6/10000,LineStyle=0, color='cyan',/overplot,/ADDCMD
cgplot,x,y7/10000,LineStyle=0, color='blue',/overplot,/ADDCMD

al_legend,LineStyle=0,$
['class1','class2','class3','class4','class5','class6','clas s7']$
,color=['black','green','red','orange','magenta','cyan','blu e'],Position=[0.2,$
0.34], /Normal,CHarSIZE=0.8
Re: changing the format of axis [message #78440 is a reply to message #78363] Thu, 24 November 2011 15:45 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Nov 24, 8:25 am, khorsan...@yahoo.com wrote:
> The graph created by iPlot looks nicer than the one produced by Plot
> function, i.e. the text format. I also can move the legend window to
> an empty place on the graph easily. If only I can add something like
> 'xtickv=x, xticks=n_elements(x)-1' to iPlot ...

Maybe I missed something because I had been absent. But it sounds like
what you want would be done with

y=[0.1,0.5,0.2,0.4,0.13]
x=[-12,-8,0,5,10]
iplot,x,y,xtickv=x

Where xtickv is actually abbreviation for xtickvalues.
Re: changing the format of axis [message #78444 is a reply to message #78363] Thu, 24 November 2011 10:29 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hasan writes:

> I got this error message 'Trapped Error CGWINDOW: A valid cgWindow doe
> not exist to add a acommand to.

Now I am guessing you changed the keyword on the first command
in that series from WINDOW, which you had before, to ADDCMD.

The WINDOW keyword will either replace all the commands in
a window, if a window exists, with a particular command,
or create a window and add the command to it. Subsequent
commands are added with the ADDCMD keyword. If you
need a window, you can always create one by typing cgWindow.

There is a whole book on the subject if you need further
direction. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78445 is a reply to message #78363] Thu, 24 November 2011 10:03 Go to previous message
Hasan is currently offline  Hasan
Messages: 6
Registered: November 2011
Junior Member
On Nov 24, 5:50 pm, David Fanning <n...@dfanning.com> wrote:
> Hasan writes:
>> Actually, it seems there is a problem with the results. I can't see
>> all the graphs on the window.
>
> Try adding /ADDCMD keywords to all your overplots.
>
> You are not adding those commands to the window, hence
> they don't show up when you resize the window. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

I got this error message 'Trapped Error CGWINDOW: A valid cgWindow doe
not exist to add a acommand to.
Re: changing the format of axis [message #78446 is a reply to message #78363] Thu, 24 November 2011 09:50 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hasan writes:

> Actually, it seems there is a problem with the results. I can't see
> all the graphs on the window.

Try adding /ADDCMD keywords to all your overplots.

You are not adding those commands to the window, hence
they don't show up when you resize the window. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78447 is a reply to message #78363] Thu, 24 November 2011 09:10 Go to previous message
Hasan is currently offline  Hasan
Messages: 6
Registered: November 2011
Junior Member
On Nov 24, 2:22 pm, David Fanning <n...@dfanning.com> wrote:
> khorsan...@yahoo.com writes:
>> The graph created by iPlot looks nicer than the one produced by Plot
>> function, i.e. the text format. I also can move the legend window to
>> an empty place on the graph easily. If only I can add something like
>> 'xtickv=x, xticks=n_elements(x)-1' to iPlot ...
>
> The one big advantage of Coyote Graphics legends, of course,
> is that they stay in the same place when the graphics window
> is resized. The reason you have to move the damn iPlot
> legend so much is that when you resize the window you
> don't know where in in the world it might show up! :-)
>
>   http://www.idlcoyote.com/ng_tips/loglegend.php
>
> I agree that object graphics plots look better on the
> display. But, who cares? I'm the only one looking at
> them. The key is having them look good when they are
> shown to someone else. The PostScript files produced
> by Coyote Graphics are sometimes orders of magnitude
> smaller than the PostScript files created with
> function graphics commands, and if you use ImageMagick
> to produce raster output from PostScript intermediates,
> then I would say the raster file output is comparable.
>
> Ugly display fonts aren't the first thing to spring to
> mind as something to complain about as I am twiddling
> my thumbs waiting for that function graphics plot to
> make it to the display!
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Actually, it seems there is a problem with the results. I can't see
all the graphs on the window.


y1=[576.000,687.000,416.000,325.000,271.000]
y2=[665.000,702.000,527.000,493.000,433.000]
y3=[2333.00,2409.00,2168.00,1791.00,1583.00]
y4=[225.000,371.000,149.000,168.000,60.0000]
y5=[863.000,912.000,590.000,652.000,695.000]
y6=[546.000,539.000,336.000,322.000,275.000]
y7=[1431.00,1523.00,1001.00,914.000,892.000]
x=[-12,-8,0,5,10]

cgplot,x,y/10000,LineStyle=0,CHARSIZE =1,color='black', xtickv=x,
xticks=n_elements(x)-1,XTITLE='Class
1',YTITLE='Values',Title='Differernt calsses values',/window
cgplot,x,y/10000,LineStyle=0,color='green',/overplot
cgplot,x,y/10000,LineStyle=0, color='red',/overplot
cgplot,x,y/10000,LineStyle=0, color='orange',/overplot
cgplot,x,y/10000,LineStyle=0, color='magenta',/overplot
cgplot,x,y/10000,LineStyle=0, color='cyan',/overplot
cgplot,x,y/10000,LineStyle=0, color='blue',/overplot
al_legend,LineStyle=0,
['class1','class2','class3','class4','class5','class6','clas s7']$
,color=['black','green','red','orange','magenta','cyan','blu e'],Position=[0.2,
0.34], /Normal,CHarSIZE=0.8
Re: changing the format of axis [message #78449 is a reply to message #78363] Thu, 24 November 2011 06:22 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
khorsand10@yahoo.com writes:

> The graph created by iPlot looks nicer than the one produced by Plot
> function, i.e. the text format. I also can move the legend window to
> an empty place on the graph easily. If only I can add something like
> 'xtickv=x, xticks=n_elements(x)-1' to iPlot ...

The one big advantage of Coyote Graphics legends, of course,
is that they stay in the same place when the graphics window
is resized. The reason you have to move the damn iPlot
legend so much is that when you resize the window you
don't know where in in the world it might show up! :-)

http://www.idlcoyote.com/ng_tips/loglegend.php

I agree that object graphics plots look better on the
display. But, who cares? I'm the only one looking at
them. The key is having them look good when they are
shown to someone else. The PostScript files produced
by Coyote Graphics are sometimes orders of magnitude
smaller than the PostScript files created with
function graphics commands, and if you use ImageMagick
to produce raster output from PostScript intermediates,
then I would say the raster file output is comparable.

Ugly display fonts aren't the first thing to spring to
mind as something to complain about as I am twiddling
my thumbs waiting for that function graphics plot to
make it to the display!

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78451 is a reply to message #78363] Thu, 24 November 2011 02:28 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
Thanks David. That code was useful. I figured out I forgot to use
'Linestyle' in Al_Legend.
Re: changing the format of axis [message #78452 is a reply to message #78363] Thu, 24 November 2011 02:25 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 2:48 pm, David Fanning <n...@dfanning.com> wrote:
> Jeremy Bailin writes:
>>>> So if I do
>>>> plot, x, y, xtickv=x, xticks=n_elements(x)-1
>
>>>> then I get what you want.
>
>>>> -Jeremy.
>
>>> Thanks Jeremy, it works.
>>> Do you know how I can do this iplot function?
>
>> Sorry, I very rarely use iplot so I don't know.
>
> Seriously, why would you *want* to use iPlot!?
> If you want to put this into a resizeable window
> where you can save it to all kinds of output formats,
> etc., then just do this:
>
>    cgPlot, x, y, xtickv=x, xticks=n_elements(x)-1, /Window
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

The graph created by iPlot looks nicer than the one produced by Plot
function, i.e. the text format. I also can move the legend window to
an empty place on the graph easily. If only I can add something like
'xtickv=x, xticks=n_elements(x)-1' to iPlot ...
Re: changing the format of axis [message #78453 is a reply to message #78363] Thu, 24 November 2011 02:19 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 9:18 pm, Manodeep Sinha <manod...@gmail.com> wrote:
> On Nov 23, 12:27 pm, khorsan...@yahoo.com wrote:
>
>
>
>
>
>
>
>
>
>> On Nov 23, 6:09 pm, David Fanning <n...@dfanning.com> wrote:
>
>>> khorsan...@yahoo.com writes:
>>>> I installed the Coyote Library on my IDL path but now got the
>>>> following system error:
>>>> CGPLOT-->Expression must be a scalar or 1 element array in this
>>>> context<Byte Array[3]>.
>
>>>> It's probably because I used '/overplot' or a value color like
>>>> 'color=[0,0,0].
>>>> Do you know how I can fix it?
>
>>> Yes, use color names: 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 thui. ("Perhaps thou speakest truth.")
>
>> Thanks David. I used Al_Legend to add the legend. it added the items
>> but didnt add the colors. it seems Al_Legend function just accepts
>> psym and not color.
>> al_legend,['Urban','Forest','Water'],color=['black','green', 'blue']
>
> If all you want are the names of the "items" written in various colors
> then you should use textcolor=['black',..]

Thanks Manodeep. It was a useful tip.
Re: changing the format of axis [message #78456 is a reply to message #78363] Wed, 23 November 2011 13:18 Go to previous message
manodeep@gmail.com is currently offline  manodeep@gmail.com
Messages: 33
Registered: June 2006
Member
On Nov 23, 12:27 pm, khorsan...@yahoo.com wrote:
> On Nov 23, 6:09 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>
>
>
>
>> khorsan...@yahoo.com writes:
>>> I installed the Coyote Library on my IDL path but now got the
>>> following system error:
>>> CGPLOT-->Expression must be a scalar or 1 element array in this
>>> context<Byte Array[3]>.
>
>>> It's probably because I used '/overplot' or a value color like
>>> 'color=[0,0,0].
>>> Do you know how I can fix it?
>
>> Yes, use color names: 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 thui. ("Perhaps thou speakest truth.")
>
> Thanks David. I used Al_Legend to add the legend. it added the items
> but didnt add the colors. it seems Al_Legend function just accepts
> psym and not color.
> al_legend,['Urban','Forest','Water'],color=['black','green', 'blue']

If all you want are the names of the "items" written in various colors
then you should use textcolor=['black',..]
Re: changing the format of axis [message #78457 is a reply to message #78363] Wed, 23 November 2011 10:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
khorsand10@yahoo.com writes:

> Thanks David. I used Al_Legend to add the legend. it added the items
> but didnt add the colors. it seems Al_Legend function just accepts
> psym and not color.
> al_legend,['Urban','Forest','Water'],color=['black','green', 'blue']

Well, I'm not sure which version of AL_LEGEND you are using,
but my version works correctly. Maybe you are running into
this problem:

http://www.idlcoyote.com/cg_tips/legcolor.php

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78458 is a reply to message #78363] Wed, 23 November 2011 10:31 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 6:20 pm, David Fanning <n...@dfanning.com> wrote:
> David Fanning writes:
>
>> khorsan...@yahoo.com writes:
>
>>> I installed the Coyote Library on my IDL path but now got the
>>> following system error:
>>> CGPLOT-->Expression must be a scalar or 1 element array in this
>>> context<Byte Array[3]>.
>
>>> It's probably because I used '/overplot' or a value color like
>>> 'color=[0,0,0].
>>> Do you know how I can fix it?
>
>> Yes, use color names: color="black".
>
> By the way, if you didn't want to use color names for
> some reason (e.g., you prefer writing obscure code that
> nobody can understand or you are so anal that you can't
> abide any of the 200 standard colors provided) you can
> always convert your color triple to a 24-bit value that
> can be used by Coyote Graphics routines:
>
>    cgPlot, data, COLOR=Color24([154,93,243])
>
> I've been thinking of adding this to the Coyote Graphics
> commands directly, but haven't gotten around to it yet. It
> won't happen today, because if I don't start cleaning the
> house ASAP I'll be living in the same dog house Coyote is
> living in!
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

That's a good idea David since it doesn't accept some names for
colors.
Lol, I think my room is more like my IDL codes folder.
Re: changing the format of axis [message #78459 is a reply to message #78363] Wed, 23 November 2011 10:27 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 6:09 pm, David Fanning <n...@dfanning.com> wrote:
> khorsan...@yahoo.com writes:
>> I installed the Coyote Library on my IDL path but now got the
>> following system error:
>> CGPLOT-->Expression must be a scalar or 1 element array in this
>> context<Byte Array[3]>.
>
>> It's probably because I used '/overplot' or a value color like
>> 'color=[0,0,0].
>> Do you know how I can fix it?
>
> Yes, use color names: 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 thui. ("Perhaps thou speakest truth.")

Thanks David. I used Al_Legend to add the legend. it added the items
but didnt add the colors. it seems Al_Legend function just accepts
psym and not color.
al_legend,['Urban','Forest','Water'],color=['black','green', 'blue']
Re: changing the format of axis [message #78461 is a reply to message #78363] Wed, 23 November 2011 10:20 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> khorsand10@yahoo.com writes:
>
>> I installed the Coyote Library on my IDL path but now got the
>> following system error:
>> CGPLOT-->Expression must be a scalar or 1 element array in this
>> context<Byte Array[3]>.
>>
>> It's probably because I used '/overplot' or a value color like
>> 'color=[0,0,0].
>> Do you know how I can fix it?
>
> Yes, use color names: color="black".

By the way, if you didn't want to use color names for
some reason (e.g., you prefer writing obscure code that
nobody can understand or you are so anal that you can't
abide any of the 200 standard colors provided) you can
always convert your color triple to a 24-bit value that
can be used by Coyote Graphics routines:

cgPlot, data, COLOR=Color24([154,93,243])

I've been thinking of adding this to the Coyote Graphics
commands directly, but haven't gotten around to it yet. It
won't happen today, because if I don't start cleaning the
house ASAP I'll be living in the same dog house Coyote is
living in!

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78463 is a reply to message #78363] Wed, 23 November 2011 10:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
khorsand10@yahoo.com writes:

> I installed the Coyote Library on my IDL path but now got the
> following system error:
> CGPLOT-->Expression must be a scalar or 1 element array in this
> context<Byte Array[3]>.
>
> It's probably because I used '/overplot' or a value color like
> 'color=[0,0,0].
> Do you know how I can fix it?

Yes, use color names: 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 thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78464 is a reply to message #78363] Wed, 23 November 2011 10:07 Go to previous message
Brian Wolven is currently offline  Brian Wolven
Messages: 94
Registered: May 2011
Member
I'm pretty darn sure he does. ;)
Re: changing the format of axis [message #78465 is a reply to message #78363] Wed, 23 November 2011 10:02 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 5:32 pm, David Fanning <n...@dfanning.com> wrote:
> khorsan...@yahoo.com writes:
>> well, I'm getting this error while using cgplot:
>
>> % Attempt to call undefined procedure/function: 'ERROR_MESSAGE'.
>> % Execution halted at: CGPLOT            196 C:\IDL_codes\allcodes
>> \cgplot.pro
>> %                      CGPLOT            196 C:\IDL_codes\allcodes
>> \cgplot.pro
>> %                      REF2_IN_5VA       116 C:\RS\codes
>> \ref2_in_5va.pro
>> %                      $MAIN$
>
>> any idea whats the problem?
>
> You don't have the Coyote Library on your IDL path:
>
>   http://www.idlcoyote.com/code_tips/installcoyote.php
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

I installed the Coyote Library on my IDL path but now got the
following system error:
CGPLOT-->Expression must be a scalar or 1 element array in this
context<Byte Array[3]>.

It's probably because I used '/overplot' or a value color like
'color=[0,0,0].
Do you know how I can fix it?
Re: changing the format of axis [message #78467 is a reply to message #78363] Wed, 23 November 2011 09:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
khorsand10@yahoo.com writes:

> well, I'm getting this error while using cgplot:
>
> % Attempt to call undefined procedure/function: 'ERROR_MESSAGE'.
> % Execution halted at: CGPLOT 196 C:\IDL_codes\allcodes
> \cgplot.pro
> % CGPLOT 196 C:\IDL_codes\allcodes
> \cgplot.pro
> % REF2_IN_5VA 116 C:\RS\codes
> \ref2_in_5va.pro
> % $MAIN$
>
> any idea whats the problem?

You don't have the Coyote Library on your IDL path:

http://www.idlcoyote.com/code_tips/installcoyote.php

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78468 is a reply to message #78363] Wed, 23 November 2011 09:18 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 4:11 pm, David Fanning <n...@dfanning.com> wrote:
> khorsan...@yahoo.com writes:
>> Thanks David. I want to insert legend as well. In iplot I can easily
>> add '/Insert_Legend' to do that but I don't know how to do it using
>> plot, plots or cgplot.
>
> In Coyote Graphics we do this by using the NASA routine
> AL_LEGEND:
>
>   http://www.idlcoyote.com/cg_tips/al_legend.php
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

well, I'm getting this error while using cgplot:

% Attempt to call undefined procedure/function: 'ERROR_MESSAGE'.
% Execution halted at: CGPLOT 196 C:\IDL_codes\allcodes
\cgplot.pro
% CGPLOT 196 C:\IDL_codes\allcodes
\cgplot.pro
% REF2_IN_5VA 116 C:\RS\codes
\ref2_in_5va.pro
% $MAIN$

any idea whats the problem?
Re: changing the format of axis [message #78469 is a reply to message #78363] Wed, 23 November 2011 08:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
khorsand10@yahoo.com writes:

> Thanks David. I want to insert legend as well. In iplot I can easily
> add '/Insert_Legend' to do that but I don't know how to do it using
> plot, plots or cgplot.

In Coyote Graphics we do this by using the NASA routine
AL_LEGEND:

http://www.idlcoyote.com/cg_tips/al_legend.php

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78470 is a reply to message #78363] Wed, 23 November 2011 08:04 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 2:48 pm, David Fanning <n...@dfanning.com> wrote:
> Jeremy Bailin writes:
>>>> So if I do
>>>> plot, x, y, xtickv=x, xticks=n_elements(x)-1
>
>>>> then I get what you want.
>
>>>> -Jeremy.
>
>>> Thanks Jeremy, it works.
>>> Do you know how I can do this iplot function?
>
>> Sorry, I very rarely use iplot so I don't know.
>
> Seriously, why would you *want* to use iPlot!?
> If you want to put this into a resizeable window
> where you can save it to all kinds of output formats,
> etc., then just do this:
>
>    cgPlot, x, y, xtickv=x, xticks=n_elements(x)-1, /Window
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thanks David. I want to insert legend as well. In iplot I can easily
add '/Insert_Legend' to do that but I don't know how to do it using
plot, plots or cgplot.
Re: changing the format of axis [message #78476 is a reply to message #78363] Wed, 23 November 2011 06:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jeremy Bailin writes:

>>> So if I do
>>> plot, x, y, xtickv=x, xticks=n_elements(x)-1
>>>
>>> then I get what you want.
>>>
>>> -Jeremy.
>>
>> Thanks Jeremy, it works.
>> Do you know how I can do this iplot function?
>
> Sorry, I very rarely use iplot so I don't know.

Seriously, why would you *want* to use iPlot!?
If you want to put this into a resizeable window
where you can save it to all kinds of output formats,
etc., then just do this:

cgPlot, x, y, xtickv=x, xticks=n_elements(x)-1, /Window

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: changing the format of axis [message #78481 is a reply to message #78363] Wed, 23 November 2011 06:22 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 11/22/11 3:58 PM, khorsand10@yahoo.com wrote:
> On Nov 22, 4:00 pm, Jeremy Bailin<astroco...@gmail.com> wrote:
>> On 11/22/11 7:52 AM, khorsan...@yahoo.com wrote:
>>
>>> On Nov 21, 9:57 pm, Brian Wolven<brian.wol...@gmail.com> wrote:
>>>> You'll need to use the [XYZ}TICKV keyword, as documented in the PLOT procedure.
>>
>>> well, it still doesnt show the x values on X Axis.
>>> y=[0.1,0.5,0.2,0.4,0.13]
>>> x=[-12,-8,0,5,10]
>>> plot,x,y,xtickv=x
>>
>> From the IDL help:
>>
>> Note
>> To specify the number of ticks and their values exactly, set
>> [XYZ]TICKS=N(where N> 1) and [XYZ]TICKV=Values, where Values has N+1
>> elements.
>>
>> So if I do
>> plot, x, y, xtickv=x, xticks=n_elements(x)-1
>>
>> then I get what you want.
>>
>> -Jeremy.
>
> Thanks Jeremy, it works.
> Do you know how I can do this iplot function?

Sorry, I very rarely use iplot so I don't know.

-Jeremy.
Re: changing the format of axis [message #78488 is a reply to message #78363] Tue, 22 November 2011 12:58 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 22, 4:00 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On 11/22/11 7:52 AM, khorsan...@yahoo.com wrote:
>
>> On Nov 21, 9:57 pm, Brian Wolven<brian.wol...@gmail.com>  wrote:
>>> You'll need to use the [XYZ}TICKV keyword, as documented in the PLOT procedure.
>
>> well, it still doesnt show the x values on X Axis.
>>   y=[0.1,0.5,0.2,0.4,0.13]
>>   x=[-12,-8,0,5,10]
>> plot,x,y,xtickv=x
>
>  From the IDL help:
>
> Note
> To specify the number of ticks and their values exactly, set
> [XYZ]TICKS=N(where N > 1) and [XYZ]TICKV=Values, where Values has N+1
> elements.
>
> So if I do
> plot, x, y, xtickv=x, xticks=n_elements(x)-1
>
> then I get what you want.
>
> -Jeremy.

Thanks Jeremy, it works.
Do you know how I can do this iplot function?
Re: changing the format of axis [message #78492 is a reply to message #78363] Tue, 22 November 2011 08:00 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 11/22/11 7:52 AM, khorsand10@yahoo.com wrote:
> On Nov 21, 9:57 pm, Brian Wolven<brian.wol...@gmail.com> wrote:
>> You'll need to use the [XYZ}TICKV keyword, as documented in the PLOT procedure.
>
> well, it still doesnt show the x values on X Axis.
> y=[0.1,0.5,0.2,0.4,0.13]
> x=[-12,-8,0,5,10]
> plot,x,y,xtickv=x


From the IDL help:

Note
To specify the number of ticks and their values exactly, set
[XYZ]TICKS=N(where N > 1) and [XYZ]TICKV=Values, where Values has N+1
elements.


So if I do
plot, x, y, xtickv=x, xticks=n_elements(x)-1

then I get what you want.

-Jeremy.
Re: changing the format of axis [message #78498 is a reply to message #78363] Tue, 22 November 2011 04:52 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 21, 9:57 pm, Brian Wolven <brian.wol...@gmail.com> wrote:
> You'll need to use the [XYZ}TICKV keyword, as documented in the PLOT procedure.

well, it still doesnt show the x values on X Axis.
y=[0.1,0.5,0.2,0.4,0.13]
x=[-12,-8,0,5,10]
plot,x,y,xtickv=x
Re: changing the format of axis [message #78505 is a reply to message #78363] Mon, 21 November 2011 13:57 Go to previous message
Brian Wolven is currently offline  Brian Wolven
Messages: 94
Registered: May 2011
Member
You'll need to use the [XYZ}TICKV keyword, as documented in the PLOT procedure.
Re: changing the format of axis [message #84638 is a reply to message #78457] Thu, 24 November 2011 02:18 Go to previous message
khorsand10 is currently offline  khorsand10
Messages: 12
Registered: November 2011
Junior Member
On Nov 23, 6:41 pm, David Fanning <n...@dfanning.com> wrote:
> khorsan...@yahoo.com writes:
>> Thanks David. I used Al_Legend to add the legend. it added the items
>> but didnt add the colors. it seems Al_Legend function just accepts
>> psym and not color.
>> al_legend,['Urban','Forest','Water'],color=['black','green', 'blue']
>
> Well, I'm not sure which version of AL_LEGEND you are using,
> but my version works correctly. Maybe you are running into
> this problem:
>
>   http://www.idlcoyote.com/cg_tips/legcolor.php
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thanks David. The problem was I didn't use 'Linestyle=0'.
Re: changing the format of axis [message #84639 is a reply to message #78446] Thu, 24 November 2011 10:41 Go to previous message
Hasan is currently offline  Hasan
Messages: 6
Registered: November 2011
Junior Member
On Nov 24, 5:50 pm, David Fanning <n...@dfanning.com> wrote:
> Hasan writes:
>> Actually, it seems there is a problem with the results. I can't see
>> all the graphs on the window.
>
> Try adding /ADDCMD keywords to all your overplots.
>
> You are not adding those commands to the window, hence
> they don't show up when you resize the window. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

I got an error message 'Trapped Error CGWINDOW: A valid cgWindow does
not exist to add a command to.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: gdl 0.9.2 delivered
Next Topic: IDL tools

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

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

Total time taken to generate the page: 0.00700 seconds