Madhavan Bomidi writes:
> I have another question. I am using cgHistoplot function to plot a probability density function (PDF) for my data. When I see the plot, I find that the ticks on x-axis are both inward and outward. How can I disable outward ticks? Where am I going wrong in my below code? Please correct me!!!
>
> Below are the command lines I am using for the plot:
>
> data1 = randomu(seed,99)
> data2 = randomu(seed,99)
>
> cgHistoplot,data1, /NAN, DataColorName=cgColor('red'),Thick=3, $
> XRange=[0.0,1.2],YRange=[0.0,1.0],Charsize=0.85,/Outline, $
> XTitle='data1 / data2',Font=-1, $
> XTICKFORMAT='(F0.1)',YTICKFORMAT='(F0.1)', Line_Thick=3, $
> XSTYLE=8, YSTYLE=1,/Frequency, $
> YTitle='Probablity Density Function (PDF)'
>
> cgHistoplot,data2, /NAN, DataColorName=cgColor('black'),Thick=3, $
> Line_Thick=3,/OPLOT,/Frequency,/Outline
>
> cgLegend,Title=['data1', 'data2'], $
> LineStyle=[0,0],Length=0.01,Vspace=1.3, $
> Color=cgColor('red'),cgColor('black')], $
> Location=[0.1,0.95],Charsize=0.68, $
> TT_Font='Simplex Roman',/Data
>
> Thanks in advance
I notice you like to use a lot of keywords and such that are unnecessary
with Coyote Graphics. For example, you can delete ALL references to
cgColor in this code, and just use the colors themselves. In fact, you
will get into trouble if you use cgColor like this sooner or later.
In this case, the problem is your use of the XSTYLE keyword. Why are you
using it? In cgHistoplot, I first draw the plot in "invisible" mode,
just to establish the coordinate system. This is necessary because I
have to repair the axes later, after I damage them by drawing polygons.
To draw axes "invisibly", I have to set the XSTYLE keyword on the Plot
command. But, your use of XSTYLE here overrules mine (keyword
inheritance biting us in the butt again!) and it draws just the X axis,
but visibly this time. Unfortunately, you are drawing the axis with the
ticks up, and I want to draw them with the ticks down, so... You see
what happens.
I don't see any obvious reason why you are using XSTYLE here. Doesn't
this code give you what you want?
cgHistoplot,data1, /NAN, DataColorName='red', $
XRange=[0.0,1.2],YRange=[0.0,1.0],Charsize=0.85,/Outline, $
XTitle='data1 / data2',$
XTICKFORMAT='(F0.1)',YTICKFORMAT='(F0.1)', $
/Frequency, $
YTitle='Probablity Density Function (PDF)'
cgHistoplot,data2, /NAN, DataColorName='black', $
/OPLOT,/Frequency,/Outline
cgLegend,Title=['data1', 'data2'], $
LineStyle=[0,0],Length=0.01,Vspace=1.3, $
Color=['red','black'], $
Location=[0.1,0.95],Charsize=0.68, $
TT_Font='Simplex Roman',/Data
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.")
|