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

Home » Public Forums » archive » Re: Plotting a compass
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 a compass [message #81903] Fri, 09 November 2012 18:01 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Hi Davide,

Just to add a data point, there's nothing wrong with how you are computing the xy points, getting the perpendicular slope by taking -1/m1.

x0 = 0.8
y0 = 0.75
x1 = 0.85
y1 = 0.77

; slope of the first arrow:
m1 = (y1 - y0)/(x1 - x0)

x2 = 0.78
y2 = y0 - 1./m1 * (x2 - x0)

Plot,[x0,x1],[y0,y1],/Isotropic,xr=[0,1],yr=[0,1]
oPlot,[x0,x2],[y0,y2]

Using data coordinates with isotropic axes shows nice perpendicular line segments. Using normalized coordinates with a non-square drawing area will not! :-) You'll need to scale x or y lengths by the aspect ratio. To me that seems easier than using polar coords, but I may be missing something. Hope this helps!

Cheers,
-Dick

Dick Jackson Software Consulting
Victoria, BC, Canada

On Friday, November 9, 2012 2:47:48 PM UTC-8, David Fanning wrote:
> Davide writes:
>
>
>
>> So, how do I put a colorbar when I use cgImage to print on a eps?
>
>> cgColorbar comes after the instruction that directs the output to the eps.
>
>>
>
>> cgIMAGE, f, POSITION=p, /KEEP_ASPECT_RATIO, MINVALUE = 0, outfilename='wanderfulplot.eps', OUTPUT = 'EPS'
>
>> cgColorbar, FORMAT='(F2.0)', Position=[p[2], p[1], p[2]+0.015, p[3] ], ncolors=256, /vertical, /right, Divisions=4, Range=[minc, maxc]
>
>>
>
> I would do it pretty much the way you were doing it before:
>
>
>
> PS_Start, 'wanderfulplot.eps'
>
> cgIMAGE, f, POSITION=p, /KEEP_ASPECT_RATIO, MINVALUE = 0
>
> cgColorbar, FORMAT='(F2.0)', Position=[p[2],p[1],p[2]+0.015 p[3]], $
>
> ncolors=256, /vertical, /right, Divisions=4, Range=[minc, maxc]
>
> PS_End
>
>
>
>> For what concerns the arrows, I guess that the problem is that I am using normal coordinates, that's why they are not orthogonal. I should switch to the data coordinates. Anyway, they look the same than the arrows obtained with the old function.
>
>
>
> Well, you will certainly have to take into account the aspect
>
> ratio of the plotting window if you are going to use normalized
>
> coordinates. But, that is just another good reason to use polar
>
> coordinates. R and Theta are both going to be easy to calculate! :-)
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Coyote Library Updates
Next Topic: color table

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

Current Time: Wed Oct 08 19:56:57 PDT 2025

Total time taken to generate the page: 0.00191 seconds