Hungry for Plots? Get some APLpy!

by Eli on July 20, 2009

Today APLpy 0.9.3 is out! It is a Python plotting package made to generate publication-quality plots in multiple formats such as EPS, PDF, PS, PNG, and SVG.

APLpy was created by Thomas Robitaille and Eli Bressert, who come from a Fortran and IDL background. With Python’s ease of use, portability, and programming they decided to make a plotting package for astronomers. APLpy’s objective is easy usage with great looking publication plots. In other words, more bang for the buck. Here’s an example of what an APLpy plot looks like:

A color generated APLpy plot from FITS files with grid lines.

To see more examples and how to make the plots in Python check out this link.

APLpy has quite a few features (some listed below – from the APLpy site) and is continuing to expand. Fortunately, there’s good documentation to accompany the features.

  • Make plots interactively or using scripts
  • Show grayscale, colorscale, and 3-color RGB images of FITS files
  • Generate co-aligned FITS cubes to make 3-color RGB images
  • Overlay any number of contour sets
  • Overlay markers with fully customizable symbol
  • Plot customizable shapes like circles, ellipses, and rectangles
  • Overlay coordinate grids
  • Customize the appearance of labels and ticks
  • Hide, show, and remove different contour and marker layers
  • Pan, zoom, and save any view as a full publication-quality plot
  • Save plots as EPS, PDF, PS, PNG, and SVG

The plotting package is under active development and there has been extensive interaction between the users and developers. We should be seeing some exciting features added to APLpy in the next few releases.

{ 8 comments… read them below or add one }

1 kelle July 20, 2009 at 10:54 pm

can it make a sun symbol in postscript fonts!?! 😉

Reply

2 kelle July 20, 2009 at 10:57 pm

I couldn’t access the APLpy gallery: https://sourceforge.net/apps/gallery/aplpy/index.php. It asked for a password…

Reply

3 Eli July 21, 2009 at 5:54 am

The link to the gallery has been fixed. It was not supposed to ask an email and password, so that was an error .

Make a sun symbol in postscript fonts, now that’s a challenge! I’ll see if that can be done 😉

Reply

4 Jessica July 21, 2009 at 3:56 pm

How does this compare to ds9 or matplotlib? Does it use matplotlib underneath? And is this an eventual ds9 replacement? Just curious how you see the new package fitting in.

Can’t wait to play with it!

You might request that it gets included with the scisoft astronomy application bundle.

Reply

5 Eli July 21, 2009 at 7:06 pm

Thank you for the suggestion about scisoft! I’ll look into that 🙂

APLpy uses matplotlib, where its capabilities are extended for plotting FITS data. APLpy is not a replacement to ds9. In fact the APLpy developers are working with the ds9 team some projects.

In my view, ds9 is a necessary and powerful utility to dynamically explore FITS data. APLpy is a high end Pythonic FITS plotting package. They could be used as complimentary tools for astronomers.

Reply

6 sjoert July 20, 2010 at 8:54 am

I’ve used APLpy to display optical images with radio contours and catalog overlays. I like it very much.

Reply

7 BF November 2, 2011 at 3:33 am

I am not sure if this is the right place to get help on APLpy. I don’t seem to find any help forum on the web. I am not a python expert. This program is very nice for making fits image plots. There are few features missing from APLpy. though. For example, I made a plot with fits image subplots. I was hoping to be able to set a universal title, x label and y label for the plot instead of x and y labels for individual subplots. Also, it would be nice if we could adjust the tickmark spacing for the colorbar and add a unit for it. At the moment, line width for the colorbar isn’t working.

Since the above features aren’t available for APLpy, I am wondering if it is possible to import some features from matplotlib.pyplot and use them under APLpy? For example, I could somehow use axes.set_title from matplotlib. How?

Reply

8 Tom November 2, 2011 at 9:04 am

@BF – for help with APLpy you can use the relatively new Google group here. To request features, you can open a ticket here. To answer your question you can create a matplotlib figure and pass the instance variable to FITSFigure with figure=, which means you can then call all the normal methods like set_title.

Reply

Leave a Comment

Previous post:

Next post: