Skip to content

Instantly share code, notes, and snippets.

@mdboom
Created April 15, 2013 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mdboom/5391801 to your computer and use it in GitHub Desktop.
Save mdboom/5391801 to your computer and use it in GitHub Desktop.
Test script for vertical text alignment
from matplotlib.pyplot import *
import matplotlib
matplotlib.use("agg")
text(0.1, 0.5, "Top Tj", verticalalignment="top")
text(0.2, 0.5, "Bottom Tj", verticalalignment="bottom")
text(0.3, 0.5, "Base Tj", verticalalignment="baseline")
text(0.4, 0.5, "Center Tj", verticalalignment="center")
text(0.5, 0.5, "Top Tj", rotation=30, verticalalignment="top")
text(0.6, 0.5, "Bottom Tj", rotation=30, verticalalignment="bottom")
text(0.7, 0.5, "Base Tj", rotation=30, verticalalignment="baseline")
text(0.8, 0.5, "Center Tj", rotation=30, verticalalignment="center")
text(0.1, 1.0, r"$\sum_{i=j}$", verticalalignment="top")
text(0.2, 1.0, r"$\sum_{i=j}$", verticalalignment="bottom")
text(0.3, 1.0, r"$\sum_{i=j}$", verticalalignment="baseline")
text(0.4, 1.0, r"$\sum_{i=j}$", verticalalignment="center")
text(0.5, 1.0, r"$\sum_{i=j}$", rotation=30, verticalalignment="top")
text(0.6, 1.0, r"$\sum_{i=j}$", rotation=30, verticalalignment="bottom")
text(0.7, 1.0, r"$\sum_{i=j}$", rotation=30, verticalalignment="baseline")
text(0.8, 1.0, r"$\sum_{i=j}$", rotation=30, verticalalignment="center")
plot([0, 1], [0.5, 0.5])
plot([0, 1], [1.0, 1.0])
ylim([0, 1.5])
savefig("alignment.png")
savefig("alignment.pdf")
savefig("alignment.svg")
savefig("alignment.ps")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment