Tags » MatPlotLib

Matplotlib

matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala MATLAB®* or Mathematica®†), web application servers, and six graphical user interface toolkits. 88 more words

Python

Stacking density plots in 3D in Matplotlib

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

X,Y = np.meshgrid(np.linspace(0,1,100),np.linspace(0,1,100))

A1 = np.sin(X)*np.sin(Y)
A2 = np.sin(X)*np.cos(Y)
A3 = np.sin(10*X)*np.cos(10*Y)

fig = plt.figure(figsize=plt.figaspect(2)*1)
ax = fig.add_subplot(111, projection='3d')
ax.contourf(X, Y, A1, 100, zdir='z', offset=0)
ax.contourf(X, Y, A2, 100, zdir='z', offset=0.5)
ax.contourf(X, Y, A3, 100, zdir='z', offset=1)

ax.set_zlim((0.,1.5))

plt.show()
Computing

FITS (Part 4) : Histograms

In this part, we will learn how to get histogram of the FITS image :

Python

matplotlib.rc customizations for fonts

I’ve long struggled with modifying the fonts for matplotlib plots from the default “Bitstream Vera Sans” until I found this post recently.

The steps outlined there worked quite well for changing the general font used for the plots, but escaped math characters still would change to the default Computer Modern font. 352 more words