<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AstroBetter &#187; idl</title>
	<atom:link href="http://www.astrobetter.com/category/idl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.astrobetter.com</link>
	<description>Tips and Tricks for Professional Astronomers</description>
	<lastBuildDate>Mon, 06 Sep 2010 13:06:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Read IDL ‘save’ files into Python</title>
		<link>http://www.astrobetter.com/read-idl-save-files-into-python/</link>
		<comments>http://www.astrobetter.com/read-idl-save-files-into-python/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 14:00:37 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[idl]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.astrobetter.com/?p=1109</guid>
		<description><![CDATA[One of the most popular posts on this blog is Kelle&#8217;s reposting of Greenfield and Jedrzejewski&#8217;s IDL vs Python earlier this year. I am an avid Python user and have never installed IDL on my computer. Recently, I developed IDLSave, a package to read IDL ‘save’ files into Python, after being sent a few such [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img src="http://www.astrobetter.com/wp-content/uploads/2009/11/python-logo-new2.png" alt="python-logo-new2" title="python-logo-new2" width="150" height="44" class="alignright size-full wp-image-1154" />One of the most popular posts on this blog is Kelle&#8217;s reposting of Greenfield and Jedrzejewski&#8217;s <a href="http://www.astrobetter.com/idl-vs-python/">IDL vs Python</a> earlier this year. I am an avid Python user and have never installed IDL on my computer. Recently, I developed <a href="http://idlsave.sourceforge.net/">IDLSave</a>, a package to read <a href="http://idlastro.gsfc.nasa.gov/idl_html_help/SAVE.html">IDL ‘save’ files</a> into Python, after being sent a few such files by collaborators. In this package, scalars are converted to their respective Python types, while arrays and structures are mapped to <a href="http://numpy.scipy.org">Numpy</a> arrays and recarrays respectively. Most importantly, IDLSave does not require an installation of IDL.</p>
<p>With this package, there will be no need to bug your collaborators who send you IDL save files to resend them in a different format. This also means that if you are an IDL user holding back from switching over to Python because you have a large number of legacy IDL save files, you can now read these files directly into Python without first re-converting them to another format. </p>
<p><span id="more-1109"></span><br />
Using IDLSave is easy. Let&#8217;s say you (or a collaborator) writes a save file with</p>
<p><code>IDL&gt; save, wavelength, flux, file='spectrum.sav'</code></p>
<p>you will now be able to open this file in Python using</p>
<p><code>&gt;&gt;&gt; import idlsave<br />
&gt;&gt;&gt; s = idlsave.read('spectrum.sav')</code></p>
<p>after which you will be able to access the values using <code>s.wavelength</code> and <code>s.flux</code>.</p>
<p>The IDLSave <a href="http://idlsave.sourceforge.net/">homepage</a> includes download and installation instructions. If you encounter problems reading in save files, don&#8217;t give up &#8211; please submit a bug report through the <a href="https://sourceforge.net/tracker/?group_id=282358&amp;atid=1197649">bug tracker</a>, and I will look into it! One of the main limitations worth noting is that while it is possible to read save files into Python, it isn&#8217;t (currently) possible to write save files for reading back into IDL. It also is not possible to read special variables such as pointers or system variables from save files.</p>
<p>Enjoy!</p>



Share This:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F&amp;partner=sociable" title="Print"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F&amp;title=Read%20IDL%20%E2%80%98save%E2%80%99%20files%20into%20Python&amp;bodytext=One%20of%20the%20most%20popular%20posts%20on%20this%20blog%20is%20Kelle%27s%20reposting%20of%20Greenfield%20and%20Jedrzejewski%27s%20IDL%20vs%20Python%20earlier%20this%20year.%20I%20am%20an%20avid%20Python%20user%20and%20have%20never%20installed%20IDL%20on%20my%20computer.%20Recently%2C%20I%20developed%20IDLSave%2C%20a%20package%20to%20read%20I" title="Digg"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F&amp;title=Read%20IDL%20%E2%80%98save%E2%80%99%20files%20into%20Python&amp;notes=One%20of%20the%20most%20popular%20posts%20on%20this%20blog%20is%20Kelle%27s%20reposting%20of%20Greenfield%20and%20Jedrzejewski%27s%20IDL%20vs%20Python%20earlier%20this%20year.%20I%20am%20an%20avid%20Python%20user%20and%20have%20never%20installed%20IDL%20on%20my%20computer.%20Recently%2C%20I%20developed%20IDLSave%2C%20a%20package%20to%20read%20I" title="del.icio.us"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F&amp;t=Read%20IDL%20%E2%80%98save%E2%80%99%20files%20into%20Python" title="Facebook"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F&amp;title=Read%20IDL%20%E2%80%98save%E2%80%99%20files%20into%20Python&amp;annotation=One%20of%20the%20most%20popular%20posts%20on%20this%20blog%20is%20Kelle%27s%20reposting%20of%20Greenfield%20and%20Jedrzejewski%27s%20IDL%20vs%20Python%20earlier%20this%20year.%20I%20am%20an%20avid%20Python%20user%20and%20have%20never%20installed%20IDL%20on%20my%20computer.%20Recently%2C%20I%20developed%20IDLSave%2C%20a%20package%20to%20read%20I" title="Google Bookmarks"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Read%20IDL%20%E2%80%98save%E2%80%99%20files%20into%20Python&amp;body=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F" title="email"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Read%20IDL%20%E2%80%98save%E2%80%99%20files%20into%20Python%20-%20http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F" title="Twitter"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.astrobetter.com%2Fread-idl-save-files-into-python%2F&amp;partner=sociable" title="PDF"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>


<br/><br/><img src="http://www.astrobetter.com/?ak_action=api_record_view&id=1109&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.astrobetter.com/read-idl-save-files-into-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IDL vs. Python</title>
		<link>http://www.astrobetter.com/idl-vs-python/</link>
		<comments>http://www.astrobetter.com/idl-vs-python/#comments</comments>
		<pubDate>Tue, 05 May 2009 04:19:02 +0000</pubDate>
		<dc:creator>Kelle</dc:creator>
				<category><![CDATA[idl]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.astrobetter.com/?p=212</guid>
		<description><![CDATA[Here is a really nice listing of the pros and cons of IDL and Python for astronomers. It&#8217;s an Appendix of the Python tutorial Using Python for Interactive Data Analysis by Greenfield and Jedrzejewski at STScI. Data and scripts for the examples and exercises in the tutorial are available at scipy.org. Update 28 Jan 2010: [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><img class="size-medium wp-image-243 alignright" style="margin: 0px 1em;" title="python-logo-master-v3" src="http://www.astrobetter.com/wp-content/uploads/2009/05/python-logo-master-v3-300x101.png" alt="python-logo-master-v3" width="126" height="43" /></p>
<p id="head-a186f4a7f86f1dd693335cdee2908df0394a044b">Here is a really nice listing of the pros and cons of IDL and Python for astronomers. It&#8217;s an Appendix of the Python tutorial <a href="http://stsdas.stsci.edu/perry/pydatatut.pdf" target="_blank"><em>Using Python for Interactive Data </em><img class="size-full wp-image-240 alignright" style="margin-top: 0px; margin-bottom: 0px; margin-right: 0px; margin-left: 1em;" title="idl" src="http://www.astrobetter.com/wp-content/uploads/2009/05/idl.jpg" alt="idl" width="125" height="40" /><em>Analysis</em></a> by Greenfield and Jedrzejewski at STScI. Data and scripts for the examples and exercises in the tutorial are available at <a href="http://www.scipy.org/wikis/topical_software/Tutorial" target="_blank">scipy.org</a>.</p>
<p><i><b>Update 28 Jan 2010: We&#8217;ve transferred this article to the <a href="http://www.astrobetter.com/wiki/tiki-index.php?page=idl_vs_python">wiki</a> so that it can be updated as Python evolves.</i></b></p>
<h3>Why would I switch from IDL to Python (or not)?</h3>
<p><small><strong>by Greenfield and Jedrzejewski</strong></small></p>
<p>We do not claim that all, or even most, current IDL users should switch to using Python now. IDL suits many people’s needs very well and we recognize that there must be a strong motivation for starting to use Python over IDL. This appendix will present the pros and cons of each so that users can make a better informed decision about whether they should consider using Python. At the end we give a few cases where we feel users should give serious consideration to using Python over IDL.<br />
<span id="more-212"></span></p>
<p>Pros and Cons are addressed below in a comparative sense. Attributes that both share, e.g., that they are interpreted and relatively slow for very simple operations, are not listed.</p>
<h3>Pros of IDL</h3>
<ul>
<li>Mature many numerical and astronomical libraries available</li>
<li>Wide astronomical user base</li>
<li>Numerical aspect well integrated with language itself</li>
<li>Many local users with deep experience</li>
<li>Faster for small arrays</li>
<li>Easier installation</li>
<li>Good, unified documentation</li>
<li>Standard GUI run/debug tool (IDLDE)</li>
<li>Single widget system (no angst about which to choose or learn)</li>
<li>SAVE/RESTORE capability</li>
<li>Use of keyword arguments as flags more convenient</li>
</ul>
<h3>Cons of IDL</h3>
<ul>
<li>Narrow applicability, not well suited to general programming</li>
<li>Slower for large arrays</li>
<li>Array functionality less powerful</li>
<li>Table support poor</li>
<li>Limited ability to extend using C or Fortran, such extensions hard to distribute and support</li>
<li>Expensive, sometimes problem collaborating with others that don’t have or can’t afford licenses.</li>
<li>Closed source (only RSI can fix bugs)</li>
<li>Very awkward to integrate with IRAF tasks</li>
<li>Memory management more awkward</li>
<li>Single widget system (useless if working within another framework)</li>
<li>Plotting:
<ul>
<li>Awkward support for symbols and math text</li>
<li>Many font systems, portability issues (v5.1 alleviates somewhat)</li>
<li>not as flexible or as extensible</li>
<li>plot windows not intrinsically interactive (e.g., pan &amp; zoom)</li>
</ul>
</li>
</ul>
<h3>Pros of Python</h3>
<ul>
<li>Very  general  and  powerful  programming  language,  yet  easy  to  learn. Strong, but optional, Object Oriented programming support</li>
<li>Very large user and developer community, very extensive and broad library base</li>
<li>Very   extensible   with   C,   C++,   or   Fortran,   portable   distribution mechanisms available</li>
<li>Free; non-restrictive license; Open Source</li>
<li>Becoming the standard scripting language for astronomy</li>
<li>Easy to use with IRAF tasks</li>
<li>Basis of STScI application efforts</li>
<li>More general array capabilities</li>
<li>Faster for large arrays, better support for memory mapping</li>
<li>Many  books  and  on-line  documentation  resources  available  (for  the language and its libraries)</li>
<li>Better support for table structures</li>
<li>Plotting
<ul>
<li>framework (matplotlib) more extensible and general</li>
<li>Better font support and portability (only one way to do it too)</li>
<li>Usable within many windowing frameworks (GTK, Tk, WX, Qt&#8230;)</li>
<li>Standard plotting functionality independent of framework used</li>
<li>plots are embeddable within other GUIs</li>
<li>more   powerful   image   handling   (multiple   simultaneous   LUTS, optional resampling/rescaling, alpha blending, etc)</li>
</ul>
</li>
<li>Support for many widget systems</li>
<li>Strong local influence over capabilities being developed for Python</li>
</ul>
<h3>Cons of Python</h3>
<ul>
<li>More items to install separately</li>
<li>Not  as  well  accepted  in  astronomical  community  (but  support  clearly growing)</li>
<li>Scientific libraries not as mature:
<ul>
<li>Documentation not as complete, not as unified</li>
<li>Not as deep in astronomical libraries and utilities</li>
<li>Not   all   IDL   numerical   library   functions   have   corresponding functionality in Python</li>
</ul>
</li>
<li>Some numeric constructs not quite as consistent with language (or slightly less convenient than IDL)</li>
<li>Array indexing convention “backwards”</li>
<li>Small array performance slower</li>
<li>No standard GUI run/debug tool</li>
<li>Support for many widget systems (angst regarding which to choose)</li>
<li>Current lack of function equivalent to SAVE/RESTORE in IDL</li>
<li>matplotlib does not yet have equivalents for all IDL 2-D plotting capability (e.g., surface plots)</li>
<li>Use of keyword arguments used as flags less convenient</li>
<li>Plotting:
<ul>
<li>comparatively immature, still much development going on</li>
<li>missing some plot type (e.g., surface)</li>
<li>3-d capability requires VTK (though matplotlib has some basic 3-d capability)</li>
</ul>
</li>
</ul>
<h3>Specific cases where using Python provides strong advantages over IDL</h3>
<ul>
<li>Your processing needs depend on running a few hard-to-replicate IRAF tasks, but you don’t want to do most of your data manipulation in IRAF, but would rather write your own IDL-style programs to do so (and soon other systems will be accessible from Python, e.g., MIDAS, ALMA, slang, etc)</li>
<li>You have algorithms that cannot be efficiently coded in IDL. They likely won’t be efficiently coded in Python either, but you will find interfacing the needed C or Fortran code easier, more flexible, more portable, and distributable. (Question: how many distributed IDL libraries developed by 3rd parties include C or Fortran code?) Or you need to wrap existing C libraries (Python has many tools to make this easier to do).</li>
<li>You do work on algorithms that may migrate into STSDAS packages. Using Python means that your work will be more easily adapted as a distributed and supported tool.</li>
<li>You wish to integrate data processing with other significant non-numerical processing  such  as  databases,  web  page  generation,  web  services,  text processing, process control, etc.</li>
<li>You want to learn object-oriented programming and use it with your data analysis. (But you don’t need to learn object-oriented programming to do data analysis in Python.)</li>
<li>You want to be able to use the same language you use for data analysis for most of your other scripting and programming tasks.</li>
<li>Your boss makes you.</li>
<li>You want to be a cool, with-it person.</li>
<li>You are honked off at ITT Space Systems/RSI.</li>
</ul>
<p>Obviously using a new language and libraries entails time spent learning. Despite what people say, it’s never that easy, especially if one has a lot of experience and code invested in an existing language. If you don’t have any strong motivations to switch, you should probably wait.</p>
<p>Reproduced with permission. Copyright 2007, Association of Universities for Research in Astronomy, Inc (AURA).</p>
<p><i><b>Update 28 Jan 2010: We&#8217;ve transferred this article to the <a href="http://www.astrobetter.com/wiki/tiki-index.php?page=idl_vs_python">wiki</a> so that it can be updated as Python evolves.</i></b></p>



Share This:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F&amp;partner=sociable" title="Print"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F&amp;title=IDL%20vs.%20Python&amp;bodytext=%0D%0AHere%20is%20a%20really%20nice%20listing%20of%20the%20pros%20and%20cons%20of%20IDL%20and%20Python%20for%20astronomers.%20It%27s%20an%20Appendix%20of%20the%20Python%20tutorial%20Using%20Python%20for%20Interactive%20Data%20Analysis%20by%20Greenfield%20and%20Jedrzejewski%20at%20STScI.%20Data%20and%20scripts%20for%20the%20examples%20and%20" title="Digg"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F&amp;title=IDL%20vs.%20Python&amp;notes=%0D%0AHere%20is%20a%20really%20nice%20listing%20of%20the%20pros%20and%20cons%20of%20IDL%20and%20Python%20for%20astronomers.%20It%27s%20an%20Appendix%20of%20the%20Python%20tutorial%20Using%20Python%20for%20Interactive%20Data%20Analysis%20by%20Greenfield%20and%20Jedrzejewski%20at%20STScI.%20Data%20and%20scripts%20for%20the%20examples%20and%20" title="del.icio.us"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F&amp;t=IDL%20vs.%20Python" title="Facebook"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F&amp;title=IDL%20vs.%20Python&amp;annotation=%0D%0AHere%20is%20a%20really%20nice%20listing%20of%20the%20pros%20and%20cons%20of%20IDL%20and%20Python%20for%20astronomers.%20It%27s%20an%20Appendix%20of%20the%20Python%20tutorial%20Using%20Python%20for%20Interactive%20Data%20Analysis%20by%20Greenfield%20and%20Jedrzejewski%20at%20STScI.%20Data%20and%20scripts%20for%20the%20examples%20and%20" title="Google Bookmarks"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=IDL%20vs.%20Python&amp;body=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F" title="email"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=IDL%20vs.%20Python%20-%20http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F" title="Twitter"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.astrobetter.com%2Fidl-vs-python%2F&amp;partner=sociable" title="PDF"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>


<br/><br/><img src="http://www.astrobetter.com/?ak_action=api_record_view&id=212&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.astrobetter.com/idl-vs-python/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Making Fonts Better in IDL Postscript Output</title>
		<link>http://www.astrobetter.com/making-fonts-better-in-idl-postscript-output/</link>
		<comments>http://www.astrobetter.com/making-fonts-better-in-idl-postscript-output/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 20:13:22 +0000</pubDate>
		<dc:creator>Kelle</dc:creator>
				<category><![CDATA[idl]]></category>
		<category><![CDATA[figures]]></category>
		<category><![CDATA[fonts]]></category>

		<guid isPermaLink="false">http://www.astrobetter.com/?p=33</guid>
		<description><![CDATA[We&#8217;ve all seen it before, illegible labels on a figure in a paper or talk. I don&#8217;t know how to remedy this problem in SuperMongo or other popular plotting programs, but I do in IDL. I&#8217;ve addressed the topic of postscript output on my IDL figures page but in this post I&#8217;m just going to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>We&#8217;ve all seen it before, illegible labels on a figure in a paper or talk. I don&#8217;t know how to remedy this problem in SuperMongo or other popular plotting programs, but I do in IDL. I&#8217;ve addressed the topic of postscript output on <a href="http://www.astro.caltech.edu/~kelle/figs.html" target="_blank">my IDL figures page</a> but in this post I&#8217;m just going to focus on the issue of figure size and fonts. Symbols, line thickness, and colors will be discussed in future posts.</p>
<p><span id="more-33"></span></p>
<div id="attachment_74" class="wp-caption alignleft" style="width: 195px">
	<img class="size-medium wp-image-74" title="blog_fonts_bad" src="http://www.astrobetter.com/wp-content/uploads/2009/04/blog_fonts_bad-300x200.jpg" alt="Bad" width="195" />
	<p class="wp-caption-text"> BAD: 18 cm across and vector font</p>
</div>
<div id="attachment_75" class="wp-caption alignright" style="width: 195px">
	<img class="size-medium wp-image-75" title="blog_fonts_good" src="http://www.astrobetter.com/wp-content/uploads/2009/04/blog_fonts_good-300x200.jpg" alt="Better" width="195" />
	<p class="wp-caption-text">BETTER: 9 cm across and Postscript font</p>
</div>
<h3>Make the figure close to the actual printed size</h3>
<p>First thing, size matters. That old manuscript preparation document that said figures should fill a letter-sized page is misguided. No matter what type of font you use, if the text size looks right when the figure is 8 inches across, it will be too small when printed as a single column figure only 9 cm across. The BAD figure above is designed at 18 cm across while the BETTER one is 9 cm. Notice the difference in font size. (<code>Charsize</code> was not specified for either plot.) Design the figures to be tiny from the beginning and no further adjustments to the font size will be necessary for either publications or talks.</p>
<p>When these &#8220;small from the start&#8221; figures are blown up to fill a letter-sized page (i.e., in Latex preprint mode), the fonts might seem too large and look funny to your eye but, since it ensures that nobody will ever have trouble reading your axis labels, you should just get used to it.<br />
<code>aspect_ratio=1.5 ;rectangle<br />
device, xsize=9, ysize=xsize/aspect_ratio</code></p>
<h3>Use Postscript instead of Vector fonts <img class="alignright size-medium" title="fontvect" src="http://www.astrobetter.com/wp-content/uploads/2009/04/fontvect-300x40.gif" alt="fontvect" width="210" height="28" /></h3>
<h3><img class="alignright size-medium" title="fontdev" src="http://www.astrobetter.com/wp-content/uploads/2009/04/fontdev-300x44.gif" alt="fontdev" width="210" height="31" /></h3>
<p>Inevitably, when a figure is illegible during a talk, a vector (Hershey) font was used instead of a Postscript font. For the purposes of 2D figures, the relevant difference is that vector fonts are thin and have a tendency to disappear while Postscript fonts are thick. The above BAD figure uses the default vector font while the BETTER one uses a Postscript font.</p>
<p>It&#8217;s so simple to switch from vector to device fonts! All you need is <code>!p.font=0</code>. While you&#8217;re at it, you might as well specify Helvetica for good measure even though, as far as I can tell, it&#8217;s the default Postscript typeface.</p>
<p><code>set_plot, 'ps'<br />
!p.font=0<br />
device, /helvetica ; a classic sans-serif font</code></p>
<p>Everything you ever wanted to know about fonts in IDL is in the <a href="http://idlastro.gsfc.nasa.gov/idl_html_help/Fonts.html" target="_blank">Reference Guide</a>.</p>
<h3>Putting it together</h3>
<p><code>aspect_ratio=1.5<br />
xsize=9<br />
ysize=xsize/aspect_ratio<br />
set_plot, 'ps'<br />
!p.font=0<br />
device, filename='fig_better.eps', encapsulated=1, /helvetica<br />
device, xsize=xsize, ysize=ysize<br />
plot, a, b, xtitle='X Title', ytitle='Y Title'<br />
device, /close<br />
set_plot, 'x'<br />
!p.font=-1</code></p>
<p>Know how to get nice legible fonts in other plotting programs? Share it in the comments.</p>



Share This:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F&amp;partner=sociable" title="Print"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F&amp;title=Making%20Fonts%20Better%20in%20IDL%20Postscript%20Output&amp;bodytext=We%27ve%20all%20seen%20it%20before%2C%20illegible%20labels%20on%20a%20figure%20in%20a%20paper%20or%20talk.%20I%20don%27t%20know%20how%20to%20remedy%20this%20problem%20in%20SuperMongo%20or%20other%20popular%20plotting%20programs%2C%20but%20I%20do%20in%20IDL.%20I%27ve%20addressed%20the%20topic%20of%20postscript%20output%20on%20my%20IDL%20figures%20page" title="Digg"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F&amp;title=Making%20Fonts%20Better%20in%20IDL%20Postscript%20Output&amp;notes=We%27ve%20all%20seen%20it%20before%2C%20illegible%20labels%20on%20a%20figure%20in%20a%20paper%20or%20talk.%20I%20don%27t%20know%20how%20to%20remedy%20this%20problem%20in%20SuperMongo%20or%20other%20popular%20plotting%20programs%2C%20but%20I%20do%20in%20IDL.%20I%27ve%20addressed%20the%20topic%20of%20postscript%20output%20on%20my%20IDL%20figures%20page" title="del.icio.us"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F&amp;t=Making%20Fonts%20Better%20in%20IDL%20Postscript%20Output" title="Facebook"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F&amp;title=Making%20Fonts%20Better%20in%20IDL%20Postscript%20Output&amp;annotation=We%27ve%20all%20seen%20it%20before%2C%20illegible%20labels%20on%20a%20figure%20in%20a%20paper%20or%20talk.%20I%20don%27t%20know%20how%20to%20remedy%20this%20problem%20in%20SuperMongo%20or%20other%20popular%20plotting%20programs%2C%20but%20I%20do%20in%20IDL.%20I%27ve%20addressed%20the%20topic%20of%20postscript%20output%20on%20my%20IDL%20figures%20page" title="Google Bookmarks"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Making%20Fonts%20Better%20in%20IDL%20Postscript%20Output&amp;body=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F" title="email"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Making%20Fonts%20Better%20in%20IDL%20Postscript%20Output%20-%20http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F" title="Twitter"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.astrobetter.com%2Fmaking-fonts-better-in-idl-postscript-output%2F&amp;partner=sociable" title="PDF"><img src="http://www.astrobetter.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>


<br/><br/><img src="http://www.astrobetter.com/?ak_action=api_record_view&id=33&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.astrobetter.com/making-fonts-better-in-idl-postscript-output/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>
