How to list packages by size using Aptitude

Biggest packages installed on my Ubuntu according to Aptitude
Biggest packages installed on my Ubuntu according to Aptitude

This is a query that I frequently have: how to list packages sorted by their size? I am especially interested in this about installed packages. There are other tools that can do this job, but I like to use Aptitude for this since I use it regularly anyway.

To list all available packages:

$ aptitude search ".*"

Aptitude understands the concept of the install size i.e., how much disk space the files of a package occupy after they are uncompressed and extracted from the package. So, sorting by this installsize is easy:

$ aptitude search ".*" --sort installsize

Note that this listing is in ascending order of size. So, the largest packages are listed at the end.

The problem with this listing is that Aptitude does not display the size, so we have no idea how big the install sizes are. To show that, we can tinker with the display format and get it to display the package name and install size:

$ aptitude search ".*" --display-format "%p %I" --sort installsize

Using the shorter versions of the options, this command becomes:

$ aptitude search ".*" -F "%p %I" -O installsize

Now, to list all installed packages:

$ aptitude search "~i"

Finally, to show the install size of only installed packages and sort by it, we just apply the options shown above:

$ aptitude search "~i" --display-format "%p %I" --sort installsize

Reference: Aptitude user’s manual (its man page is woefully short on details of its commands)

Tried with: Aptitude 0.6.8.2 and Ubuntu 14.04

How to change size of Matplotlib plot

Sometimes you may want to change the width or height or both of the plot figure generated by Matplotlib. For example, you may want the X-axis to be stretched out a bit more and so on.

The size of the plot can be changed by setting the dynamic rc settings of Matplotlib. These are stored in a dictionary named rcParams. The size of the plot figure is stored with the key figure.figsize.

As an example, to get and set the size of a Matplotlib plot:

import matplotlib.pyplot as plt

# Get current size
fig_size = plt.rcParams["figure.figsize"]

# Prints: [8.0, 6.0]
print "Current size:", fig_size

# Set figure width to 12 and height to 9
fig_size[0] = 12
fig_size[1] = 9
plt.rcParams["figure.figsize"] = fig_size

Tried with: Python 2.7.6 and Ubuntu 14.04

How to change type size used for footnotes in LaTeX

Footnotes in a LaTeX document are rendered in the predefined footnotesize type size. This size lies between the scriptsize and small of the 9 type sizes in LaTeX. The size of footnotes in a LaTeX document can be changed by setting it one of the other 8 type sizes of LaTeX.

For example, to reduce the footnote type size by one increment:

\renewcommand{\footnotesize}{\scriptsize}