plotting filled circles of defined radius [message #88674] |
Thu, 29 May 2014 23:48  |
Krishnakumar M.A
Messages: 19 Registered: March 2013
|
Junior Member |
|
|
Hi,
I was able to plot circles of radius as given from a file in idl. Is it possible to make the circle shaded inside? I tried with /fill which did not work. Is there a work around to do this?
Thanks,
Krishnakumar
|
|
|
Re: plotting filled circles of defined radius [message #88675 is a reply to message #88674] |
Fri, 30 May 2014 04:10   |
dg86
Messages: 118 Registered: September 2012
|
Senior Member |
|
|
On Friday, May 30, 2014 2:48:54 AM UTC-4, Krishnakumar M.A wrote:
> Hi,
>
>
>
> I was able to plot circles of radius as given from a file in idl. Is it possible to make the circle shaded inside? I tried with /fill which did not work. Is there a work around to do this?
>
>
>
> Thanks,
>
> Krishnakumar
Using function graphics, the following should do what you want:
p = plot(/test, color='black', symbol='o', /sym_filled, sym_fill_color='light yellow',sym_size=1.5)
All the best,
David
|
|
|
Re: plotting filled circles of defined radius [message #88676 is a reply to message #88675] |
Fri, 30 May 2014 06:42   |
Krishnakumar M.A
Messages: 19 Registered: March 2013
|
Junior Member |
|
|
On Friday, May 30, 2014 4:40:23 PM UTC+5:30, David Grier wrote:
> On Friday, May 30, 2014 2:48:54 AM UTC-4, Krishnakumar M.A wrote:
>
>> Hi,
>
>>
>
>>
>
>>
>
>> I was able to plot circles of radius as given from a file in idl. Is it possible to make the circle shaded inside? I tried with /fill which did not work. Is there a work around to do this?
>
>>
>
>>
>
>>
>
>> Thanks,
>
>>
>
>> Krishnakumar
>
>
>
> Using function graphics, the following should do what you want:
>
>
>
> p = plot(/test, color='black', symbol='o', /sym_filled, sym_fill_color='light yellow',sym_size=1.5)
>
>
>
> All the best,
>
>
>
> David
Hi,
Thanks for your reply.
Its not working for my data.
The below is a script I wrote, to plot the circles. Please let me know if anything can be done on that? Sorry I didnt post it before.
openr,1,'test_idl.dat'
data1=fltarr(3,218)
readf,1,data1
lo=reform(data1[0,*])
bo=reform(data1[1,*])
dm=reform(data1[2,*])
plot, [0,1], [0,1], /nodata,xrange=[0,360],yrange=[-35,30], xticklen=1,yticklen=1,xgridstyle=1,ygridstyle=1, background=0,xstyle=9
for i=0,217 do begin
n=49.0
theta=findgen(n)/(n-1.0)*2*!pi
xo=lo(i)+ro(i)*sin(theta)/110
yo=bo(i)+ro(i)*cos(theta)/120
oplot,xo,yo,linestyle=0,color=0
endfor
close,1
end
Thanks,
Krishnakumar
|
|
|
Re: plotting filled circles of defined radius [message #88678 is a reply to message #88676] |
Fri, 30 May 2014 06:57   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Krishnakumar M.A writes:
> Its not working for my data.
> The below is a script I wrote, to plot the circles. Please let me know if anything can be done on that?
If you just want filled circles of different radii, you can do something
like this:
data = Randomu(-3L, 50) * 10
x = 0.5 > (Randomu(seed, 50) * 10) < 9.5
y = 0.5 > (Randomu(seed, 50) * 10) < 9.5
radius = cgScaleVector(data, 1.0, 4.0)
colors = Bytscl(data)
cgPlot, x, y, /Nodata
cgLoadCT, 33
FOR j=0,N_Elements(data)-1 DO BEGIN
cgOplot, x[j], y[j], SYMSIZE=radius[j], PSYM=16, COLOR=colors[j]
ENDFOR
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: plotting filled circles of defined radius [message #88679 is a reply to message #88676] |
Fri, 30 May 2014 13:32   |
Bill Nel
Messages: 31 Registered: October 2010
|
Member |
|
|
> theta=findgen(n)/(n-1.0)*2*!pi
> xo=lo(i)+ro(i)*sin(theta)/110
> yo=bo(i)+ro(i)*cos(theta)/120
> oplot,xo,yo,linestyle=0,color=0
For "direct" (old) graphics, the IDL procedure USERSYM lets you define a plotting symbol, a circle in your case. Then you just use
plot, x, y, usersym=8
I use it all the time -- works great.
|
|
|
Re: plotting filled circles of defined radius [message #88680 is a reply to message #88678] |
Sat, 31 May 2014 08:45  |
Krishnakumar M.A
Messages: 19 Registered: March 2013
|
Junior Member |
|
|
On Friday, May 30, 2014 7:27:24 PM UTC+5:30, David Fanning wrote:
> Krishnakumar M.A writes:
>
>
>
>> Its not working for my data.
>
>> The below is a script I wrote, to plot the circles. Please let me know if anything can be done on that?
>
>
>
> If you just want filled circles of different radii, you can do something
>
> like this:
>
>
>
> data = Randomu(-3L, 50) * 10
>
> x = 0.5 > (Randomu(seed, 50) * 10) < 9.5
>
> y = 0.5 > (Randomu(seed, 50) * 10) < 9.5
>
> radius = cgScaleVector(data, 1.0, 4.0)
>
> colors = Bytscl(data)
>
> cgPlot, x, y, /Nodata
>
> cgLoadCT, 33
>
> FOR j=0,N_Elements(data)-1 DO BEGIN
>
> cgOplot, x[j], y[j], SYMSIZE=radius[j], PSYM=16, COLOR=colors[j]
>
> ENDFOR
>
> 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.")
Thanks a lot David. That worked like charm for me.
Krishnakumar
|
|
|