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

Home » Public Forums » archive » Coord_transform in axes
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
Coord_transform in axes [message #89639] Mon, 03 November 2014 16:12 Go to next message
joellama is currently offline  joellama
Messages: 8
Registered: July 2013
Junior Member
I am trying to add an axis to an image but am having some difficulty.

My array is the shape: values[150, 50] representing 150 days and 50 latitude bins for each day.

I'm plotting the image using

im = image(values)

and the image appears as expected but I want to add a y axis to label the values of theta. Each of the 50 latitude bins is uniform in sin(theta) going from -1 to +1 but I want the axis to be in terms of theta going from -90 to +90 degrees.

Ive looked at the coord_transform function in axis and that can get me from (-1, 1) to (-90, 90) but the scaling is then wrong because the latitude values aren't uniform in theta but sin(theta).

I'm completely drawing a blank on how to do this. Any help would be greatly appreciated!
Re: Coord_transform in axes [message #89640 is a reply to message #89639] Mon, 03 November 2014 16:17 Go to previous messageGo to next message
joellama is currently offline  joellama
Messages: 8
Registered: July 2013
Junior Member
Just to be slightly clearer,

I'm basically after a y-axis that has tick marks -90, 30, 0, 30, 90 that are all roughly equally spaced - sin(theta) space rather than in theta space where it would be -90, -45, 0, 45, 90.
Re: Coord_transform in axes [message #89655 is a reply to message #89640] Thu, 06 November 2014 09:52 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
This is one way to do it: You can make your plot, then change the location of the axis ticks to arbitrary locations, and change the tick labels to arbitrary values.

imdata=dist(150,50) ;make some mock data
x=dindgen(150) ;make the x coordinates
y=-1d0+2d0*dindgen(50)/49d0 ;make the y coordinates from -1 to 1
myimage=image(imdata,x,y,axis_style=1,position=[0.2,0.2,0.8, 0.8],aspect_ratio=40.) ;make the image
nyticks=11 ;number of ticks for the y axis
ygrid=-1d0+2d0*dindgen(nyticks)/(nyticks-1d0) ;make an array of y tick values
ylabels=string(asin(ygrid)*180d0/!dpi,format='(I)') ;make the labels for the y axis
myimage['axis1'].tickvalues=ygrid ;replace the tick locations
myimage['axis1'].tickname=ylabels ;replace the tick labels
myimage.ytitle='$\theta$'
naxis=axis('y',location='right',title='sin($\theta$)',tickva lues=ygrid) ;add a second axis with the sines of the angle



On Monday, November 3, 2014 10:17:03 PM UTC-2, Joe Llama wrote:
> Just to be slightly clearer,
>
> I'm basically after a y-axis that has tick marks -90, 30, 0, 30, 90 that are all roughly equally spaced - sin(theta) space rather than in theta space where it would be -90, -45, 0, 45, 90.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: reading data with numbers and strings from data file
Next Topic: Reading binary (.ply) file of varying header size

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

Current Time: Wed Oct 08 09:16:17 PDT 2025

Total time taken to generate the page: 0.00506 seconds