[AstroPy] how to make a sky plot
Thøger Emil Rivera-Thorsen
trive at astro.su.se
Wed Apr 2 11:02:51 EDT 2014
As far as I remember, the Kapteyn python package has some pretty good
functions for doing this exact kind of thing. It uses Matplotlib as a
backend.
By the way, EPD is outdated. I recommend updating to Canopy or, even
better *in my personal opinion) switch to Anaconda.
On Wed 02 Apr 2014 04:31:44 PM CEST, Eric Jensen wrote:
>
> On Apr 2, 2014, at 10:10 AM, Jonathan T. Niehof wrote:
>
>> (Don't know if it's possible to label RA in hours
>> instead of degrees longitude.)
>
> If it isn't possible to do this directly in the plotting routine, you
> could do something like this to manipulate the x-axis tick labels
> directly. (But if you do this, don't forget when looking at your plot
> and modifying your plot code that you are really still plotting a
> variable in degrees even if your label is in hours! e.g. your limits
> would still have to be degrees )
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> [ Code in here to plot your data and set axis limits. ]
>
> # Need to draw the canvas in order for ticklabels to be set:
> fig.canvas.draw()
> ticklist= ax.get_xticklabels()
> new_label_list = []
> for label in ticklist:
> # Get rid of dollar signs if using Latex labels:
> string= label.get_text().replace('$', '')
> # Some labels may be blank, leave as-is:
> if string == '':
> new_label = string
> else:
> # Get numeric equivalent, change to hours:
> tick_num = float(string)
> tick_num = tick_num/15.
> # Note that this rounds to integer, might not be what you want:
> tick_string = "%d" % tick_num
> # Add a raised "h" to denote hours:
> new_label = "$" + tick_string + "^h$"
> new_label_list.append(new_label)
> new = ax.set_xticklabels(new_label_list)
>
> (Based on code from
> http://stackoverflow.com/questions/11244514/matplotlib-modify-tick-label-text
> )
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
More information about the AstroPy
mailing list