| 1 |
.. _arbitrary: |
| 2 |
|
| 3 |
Arbitrary coordinate systems |
| 4 |
============================ |
| 5 |
|
| 6 |
Coordinate type |
| 7 |
--------------- |
| 8 |
|
| 9 |
In addition to standard longitude/latitude coordinates, APLpy supports any |
| 10 |
valid quantities for coordinates (e.g. velocity, frequency, ...) as long as |
| 11 |
the WCS header information is valid. To differentiate between longitudes, |
| 12 |
latitudes, and arbitrary scalar values, APLpy keeps track of the axis |
| 13 |
coordinate 'type' for each axis, and will try and guess these based on the |
| 14 |
header. However, it is possible to explicitly specify the coordinate type with |
| 15 |
the :meth:`~aplpy.FITSFigure.set_xaxis_coord_type` and :meth:`~aplpy.FITSFigure.set_yaxis_coord_type` methods in the |
| 16 |
:class:`~aplpy.FITSFigure` object:: |
| 17 |
|
| 18 |
f = FITSFigure('2MASS_k.fits') |
| 19 |
f.set_xaxis_coord_type('scalar') |
| 20 |
f.set_xaxis_coord_type('latitude') |
| 21 |
|
| 22 |
Valid coordinate types are ``longitude``, ``latitude``, and ``scalar``. |
| 23 |
Longitudes are forced to be in the 0 to 360 degree range, latitudes are forced |
| 24 |
to be in the -90 to 90 degree range, and scalars are not constrained. |
| 25 |
|
| 26 |
Label formatting |
| 27 |
---------------- |
| 28 |
|
| 29 |
How label formats are specified depends on the coordinate type. If the |
| 30 |
coordinate is a longitude or latitude, then the label format is specified |
| 31 |
using a special syntax which describes whether the label should be decimal or |
| 32 |
sexagesimal, in hours or degrees, and indicates the number of decimal places. |
| 33 |
For example: |
| 34 |
|
| 35 |
* ``ddd.ddddd`` means decimal degrees, where the number of decimal places can |
| 36 |
be varied |
| 37 |
* ``hh`` or ``dd`` means hours (or degrees) |
| 38 |
* ``hh:mm`` or ``dd:mm`` means hours and minutes (or degrees and arcminutes) |
| 39 |
* ``hh:mm:ss`` or ``dd:mm:ss`` means hours, minutes, and seconds (or degrees, |
| 40 |
arcminutes, and arcseconds) |
| 41 |
* ``hh:mm:ss.ss`` or ``dd:mm:ss.ss`` means hours, minutes, and seconds (or |
| 42 |
degrees, arcminutes, and arcseconds), where the number of decimal places can |
| 43 |
be varied. |
| 44 |
|
| 45 |
If the coordinate type is scalar, then the format should be specified as a |
| 46 |
valid Python format. For example, ``%g`` is the default Python format, |
| 47 |
``%10.3f`` means decimal notation with three decimal places, etc. For more |
| 48 |
information, see `String Formatting Operations |
| 49 |
<https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting>`_. |
| 50 |
|
| 51 |
In both cases, the default label format can be overridden:: |
| 52 |
|
| 53 |
f.tick_labels.set_xformat('dd.ddddd') |
| 54 |
f.tick_labels.set_yformat('%11.3f') |
| 55 |
|
| 56 |
Aspect ratio |
| 57 |
------------ |
| 58 |
|
| 59 |
When plotting images in sky coordinates, APLpy makes pixel square by default, |
| 60 |
but it is possible to change this, which can be useful for non-sky |
| 61 |
coordinates. When calling :meth:`~aplpy.FITSFigure.show_grayscale` or |
| 62 |
:meth:`~aplpy.FITSFigure.show_colorscale`, simply add ``aspect='auto'`` |
| 63 |
which will override the ``aspect='equal'`` default. |