On Tue, Jan 31, 2012 at 12:56 PM, Petro Khoroshyy <khoroshyy@gmail.com> wrote:
Hi all
I try to use matplotlib ti anotate some pictures.
I wanted to combine two pictures into one using subplot. But apparently
subplot does not work with images. How can I do it?
Thanks

P.S. Here is the source:
import pylab
import numpy
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
golden_mean = (numpy.sqrt(5)-1.0)/2.0         # Aesthetic ratio
fig_width = 5.6  # width in inches
fig_height = fig_width*golden_mean      # height in inches
fig_size =  [fig_width,fig_height]
rcParams['figure.figsize']=fig_width, fig_width
rcParams['figure.dpi']=300
rcParams['mathtext.default']='regular'
rcParams['xtick.labelsize']=8
rcParams['ytick.labelsize']=8
pylab.rc('font', family='serif')
pylab.rc('font', serif='Times New Roman')
pylab.rc('text', usetex='false')
pyp=mpimg.imread('/home/petro/mydoc/thesis/ready_pictures/pyp.jpg')
fig=pylab.figure(facecolor="white")
fig.subplots_adjust(top=0.95)
fig.subplots_adjust(bottom=0.05)
fig.subplots_adjust(left=0.05)
fig.subplots_adjust(right=0.95)
ax_left=fig.add_subplot(121)
ax_left = pylab.axes(frameon=False)
ax_left.set_axis_off()
ax_left.imshow(pyp, origin='lower')
plt.text(821, 707, r'$\beta _1$', {'color' : 'k', 'fontsize' : 12})
pylab.savefig("pylab_pyp.png")

--
Petro.


Hi Petro,

I think the problem is that you create a subplot (...`add_subplot`...) and then override it (...`pylab.axes`...). Remove the call to axes and you should be set.

-Tony