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

Home » Public Forums » archive » plotting different sized circles
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: plotting different sized circles [message #86113 is a reply to message #86111] Mon, 07 October 2013 09:00 Go to previous messageGo to previous message
Krishnakumar M.A is currently offline  Krishnakumar M.A
Messages: 19
Registered: March 2013
Junior Member
On Monday, October 7, 2013 8:58:18 PM UTC+5:30, suicida...@gmail.com wrote:
> On Monday, October 7, 2013 9:12:13 AM UTC-6, Krishnakumar M.A wrote:
>
>> Hi all,
>
>>
>
>>
>
>>
>
>> I'm having a bit trouble here while using usersym. What I want to make is circles with the third column of the file (which means that the circles will have different radii). But, I have no idea if one can use the usersym like the way in which I have used. the code and the error message is given below. Please let me know the problem with the script.
>
>>
>
>>
>
>>
>
>> Thanks.
>
>>
>
>>
>
>>
>
>> data=fltarr(3,100)
>
>>
>
>> readf,1,data
>
>>
>
>> l=data(0,*)
>
>>
>
>> b=data(1,*)
>
>>
>
>> r=data(2,*)
>
>>
>
>>
>
>>
>
>> for i=0,99 do begin
>
>>
>
>> n=17.0
>
>>
>
>> theta=findgen(n)/(n-1.0)*360.0
>
>>
>
>> x(i)=l(i)+r(i)*sin(theta)/1.0
>
>>
>
>> y(i)=b(i)+r(i)*cos(theta)/1.0
>
>>
>
>> usersym,x(i),y(i)
>
>>
>
>>
>
>>
>
>> plot,l(i),b(i),psym=8
>
>>
>
>> endfor
>
>>
>
>>
>
>>
>
>> The returned error was
>
>>
>
>>
>
>>
>
>> % Compiled module: $MAIN$.
>
>>
>
>> % USERSYM: Expression must be an array in this context: <FLOAT (
>
>>
>
>> -1.99965)>.
>
>>
>
>> % Execution halted at: $MAIN$ 16
>
>
>
> I'm not sure why you want/need to use usersym in the first place. You've already calculated the x and y locations, so just plot them directly.
>
>
>
> Also - sin/cos work on radians, not degrees, and you have your sin and cos backwards in regards to x and y, and I'm not sure why you're dividing them by 1. Also, x and y are not preallocated, so you can't start subscripting them as if they're existing arrays, and even if they were preallocated, it would break because you're trying to store an entire 17 element array into a single element.
>
>
>
> You'll also want to reform your l, b, and r arrays so they're N elements rather than 1xN elements. The latter can cause some funky issues later on.
>
>
>
> Keep in mind that by using plot inside the for loop, you're going to end up with 100 separate plots, one point on each. I doubt this is what you truly want, so you probably want to make the plot outside of the loop, and then oplot inside.
>
>
>
> data=fltarr(3,100)
>
> readf,1,data
>
> l=reform(data[0,*])
>
> b=reform(data[1,*])
>
> r=reform(data[2,*])
>
>
>
> plot, [0,1], [0,1], /nodata, xrange=?, yrange=?
>
> for i=0,99 do begin
>
> n=17.0
>
> theta=findgen(n)/(n-1.0)*2*!pi
>
> x=l(i)+r(i)*cos(theta)
>
> y=b(i)+r(i)*sin(theta)
>
>
>
> oplot,x,y
>
> endfor

Thanks a lot. That was a great help for me.
As I said, I never used usersym in IDL, since I always use some other language to do plotting. But as I came to know that it will be easier in IDL, I tried my hand.
Thanks for the help.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Taylor Diagrams in IDL
Next Topic: Voigt function fit using MPFIT

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

Current Time: Wed Oct 08 16:00:12 PDT 2025

Total time taken to generate the page: 0.00451 seconds