Skip to content

Instantly share code, notes, and snippets.

@dpshelio
Last active December 9, 2017 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpshelio/650af4784dcb72bbad0b9900511ec6fb to your computer and use it in GitHub Desktop.
Save dpshelio/650af4784dcb72bbad0b9900511ec6fb to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
from itertools import product
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
cc = [[0, 0], [0, 0]]
ap = [[0.218, 0.196], [0.249, 0.056]] # astropy - palpy
ae = [[0.459, 0.458], [0.860, 0.231]] # astropy - pyephem
pe = [[0.563, 0.570], [1.012, 0.253]] # palpy - pyephem
data = {'astropy-astropy': cc,
'astropy-kapteyn': cc, 'kapteyn-astropy': cc,
'astropy-pytpm': cc, 'pytpm-astropy': cc,
'astropy-palpy': ap, 'palpy-astropy': ap,
'astropy-pyast': ap, 'pyast-astropy': ap,
'astropy-pyslalib': ap, 'pyslalib-astropy': ap,
'astropy-pyephem': ae, 'pyephem-astropy': ae,
'kapteyn-kapteyn': cc,
'kapteyn-pytpm': cc, 'pytpm-kapteyn': cc,
'kapteyn-palpy': ap, 'palpy-kapteyn': ap,
'kapteyn-pyast': ap, 'pyast-kapteyn': ap,
'kapteyn-pyslalib': ap, 'pyslalib-kapteyn': ap,
'kapteyn-pyephem': ae, 'pyephem-kapteyn': ae,
'pytpm-pytpm': cc,
'pytpm-palpy': ap, 'palpy-pytpm': ap,
'pytpm-pyast': ap, 'pyast-pytpm': ap,
'pytpm-pyslalib': ap, 'pyslalib-pytpm': ap,
'pytpm-pyephem': ae, 'pyephem-pytpm': ae,
'palpy-palpy': cc,
'palpy-pyast': cc, 'pyast-palpy': cc,
'palpy-pyslalib': cc, 'pyslalib-palpy': cc,
'palpy-pyephem': pe, 'pyephem-palpy': pe,
'pyast-pyast': cc,
'pyast-pyslalib': cc, 'pyslalib-pyast': cc,
'pyast-pyephem': pe, 'pyephem-pyast': pe,
'pyslalib-pyslalib': cc,
'pyslalib-pyephem': pe, 'pyephem-pyslalib': pe,
'pyephem-pyephem': cc}
names = ['astropy', 'kapteyn', 'pytpm', 'palpy', 'pyast', 'pyslalib', 'pyephem']
n = len(names)
OX = 0.15
OY = 0.07
WX = WY = 0.8
fig, ax = plt.subplots(figsize=(7, 7))
ax = plt.axes([OX, OY, WX, WY])
ax.set_xlim(0, n)
ax.set_ylim(0, n)
ax.set_xticks(np.arange(0.5, n))
ax.set_xticklabels(names)
ax.set_yticks(np.arange(0.5, n))
ax.set_yticklabels(names)
ax.invert_yaxis()
ax.xaxis.tick_top()
size = WX / n
axes = []
for j in reversed(range(n)):
yy = OY + j * size
for i in range(n):
xx = OX + i * size
axes.append(fig.add_axes([xx, yy, size, size]))
for axis, nn in zip(axes, product(names, repeat=2)):
axis.pcolormesh(np.array(data["{}-{}".format(*nn)]),
cmap='YlOrBr', vmin=0, vmax=1.012)
# axis.set_axis_off() # removes the borders
axis.set_yticks(np.arange(0, 2, 1))
axis.set_yticklabels('')
axis.set_xticks(np.arange(0, 2, 1))
axis.set_xticklabels('')
axis.grid(True)
fig.subplots_adjust(left=-1, right=2,
top=2, bottom=-1,
hspace=0, wspace=0)
fig.savefig('coordinates-benchmark.pdf', transparent=True, pad_inches=0)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment