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

Home » Public Forums » archive » Is there a simple way to describe and plot a simple geometry
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
Is there a simple way to describe and plot a simple geometry [message #63372] Fri, 07 November 2008 01:52 Go to next message
OliverS is currently offline  OliverS
Messages: 1
Registered: November 2008
Junior Member
Hi everyone.

I have a problem with finding a adequate way of plotting results of my
simulations.

The model has a fixed geometry consisting of several identical
cylinders. I want to plot a cut showing the x-y plane, where I color
the circles in dependence of the results.

My first idea to resolve the problem was plotting circles defined with
USERSYM at the specified positions. But I am not happy with this
solution because it is very difficult to get the right proportions
between symbolsize and distance between the positions in the plot.

a short code sample of my first idea:

X = (INDGEN(196)/14)*0.63 + 0.63
Y = (INDGEN(196) MOD 14)*0.63 + 0.63
; Make a vector of 16 points, A[i] = 2pi/16:
A = FINDGEN(17) * (!PI*2/16.)
R = 3
; Define the symbol to be a unit circle with 16 points,
; and set the filled flag:
USERSYM, COS(A)*R, SIN(A)*R, /FILL
plot, x,y, LINESTYLE=3, PSYM=8, XRANGE=[0,10], YRANGE=[0,10]

I would be very glad vor any advice how to solve the problem in a
better way.
Re: Is there a simple way to describe and plot a simple geometry [message #63514 is a reply to message #63372] Fri, 07 November 2008 06:50 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
Use polyfill to fill the circles instead.
It won't be extremely fast, but I am sure
it still is negligible compared with the
runtime of your simulation ;-)

Ciao,
Paolo

OliverS wrote:
> Hi everyone.
>
> I have a problem with finding a adequate way of plotting results of my
> simulations.
>
> The model has a fixed geometry consisting of several identical
> cylinders. I want to plot a cut showing the x-y plane, where I color
> the circles in dependence of the results.
>
> My first idea to resolve the problem was plotting circles defined with
> USERSYM at the specified positions. But I am not happy with this
> solution because it is very difficult to get the right proportions
> between symbolsize and distance between the positions in the plot.
>
> a short code sample of my first idea:
>
> X = (INDGEN(196)/14)*0.63 + 0.63
> Y = (INDGEN(196) MOD 14)*0.63 + 0.63
> ; Make a vector of 16 points, A[i] = 2pi/16:
> A = FINDGEN(17) * (!PI*2/16.)
> R = 3
> ; Define the symbol to be a unit circle with 16 points,
> ; and set the filled flag:
> USERSYM, COS(A)*R, SIN(A)*R, /FILL
> plot, x,y, LINESTYLE=3, PSYM=8, XRANGE=[0,10], YRANGE=[0,10]
>
> I would be very glad vor any advice how to solve the problem in a
> better way.
Re: Is there a simple way to describe and plot a simple geometry [message #63516 is a reply to message #63372] Fri, 07 November 2008 05:42 Go to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Fri, 7 Nov 2008 01:52:02 -0800 (PST), OliverS
<o.schitthelm@fz-juelich.de> wrote:

> My first idea to resolve the problem was plotting circles defined with
> USERSYM at the specified positions. But I am not happy with this
> solution because it is very difficult to get the right proportions
> between symbolsize and distance between the positions in the plot.


Well, object graphics will solve the symbol size problem (see below).
The combination of R for the Polygon data and the SIZE keyword for the
symbol will give you the correct radius (=R*size).

But if you want different colors for each symbol, I wouldn't know how
to avoid loops. Plotting filled circles with different offsets and
colors in direct graphics will be the easiest:
X=...
Y=...
n=n_elements(x)
plot, x,y,/nodata,/iso
A = FINDGEN(17) * (!PI*2/16.)
R= 0.2
X0= COS(A)*R
Y0= SIN(A)*R
col=...
for i=0,n-1 do POLYFILL, X0+X[i],Y0+Y[i], COLOR=col[i],/data



----Begin Code----

; Your data
X = (INDGEN(196)/14)*0.63 + 0.63
Y = (INDGEN(196) MOD 14)*0.63 + 0.63
xr=[0,10]
yr=[0,10]
A = FINDGEN(17) * (!PI*2/16.)
R= 0.2
X0= COS(A)*R
Y0= SIN(A)*R
color=[255,0,0]

; "Simple" object graphics pfff
oWindow = OBJ_NEW('IDLgrWindow')
oView = OBJ_NEW('IDLgrView')
oModel = OBJ_NEW('IDLgrModel')

oCircle = OBJ_NEW('IDLgrPolygon',x0,y0,color=color)
oSymbol = OBJ_NEW('IDLgrSymbol',oCircle,size=1)
oPlot =
OBJ_NEW('IDLgrPlot',x,y,xrange=xr,yrange=yr,symbol=oSymbol,l inestyle=6)
oPlot -> GetProperty, XRANGE=xr, YRANGE=yr
xrn=norm_coord(xr)
yrn=norm_coord(yr)
oPlot->SetProperty, XCOORD_CONV=xrn, YCOORD_CONV=yrn

oXAxis = OBJ_NEW('IDLgrAxis', 0, RANGE=[xr[0], xr[1]])
oXAxis -> SetProperty, XCOORD_CONV=norm_coord(xr)
oYAxis = OBJ_NEW('IDLgrAxis', 1, RANGE=[yr[0], yr[1]])
oYAxis -> SetProperty, YCOORD_CONV=norm_coord(yr)
oXAxis -> SetProperty, TICKLEN=0.005
oYAxis -> SetProperty, TICKLEN=0.005

oModel->Add,oXAxis
oModel->Add,oYAxis
oModel->Add,oPlot
oView->Add, oModel
SET_VIEW, oView, oWindow
oWindow->draw, oView

oHolder = OBJ_NEW('IDL_Container')
oHolder->Add,oWindow
oHolder->Add,oView
oHolder->Add,oCircle
oHolder->Add,oSymbol
;obj_destroy,oHolder

----End Code----
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to add several *.fit files (matrices) into one output *.fit file?
Next Topic: solving equation consisting of points - sort of...

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

Current Time: Wed Oct 08 13:54:24 PDT 2025

Total time taken to generate the page: 0.00534 seconds