2012-05-04 38 views

Respuesta

22

Pruebe usar ax.grid(True, which='both') para colocar sus líneas de cuadrícula en los tics mayores y menores, como se sugiere here.

EDIT: O simplemente establecer sus garrapatas manualmente, así:

import matplotlib.pyplot as plt 

fig = plt.figure() 
ax = fig.add_subplot(111) 
ax.plot([1,2,3,14],'ro-') 

# set your ticks manually 
ax.xaxis.set_ticks([1.,2.,3.,10.]) 
ax.grid(True) 

plt.show() 
+0

no tengo las marcas menores, cómo puedo crearlos? – ashim

+0

@capoluca: vea la edición –

6

Si desea seguir con el ejemplo ha citado:

>>> import numpy 
>>> import pylab 
>>> t = numpy.arange(0.0, 1.0+0.1, 0.01) 
>>> s = numpy.cos(2*2*numpy.pi*t) 
>>> pylab.plot(t,s) 
>>> pylab.grid(True) 
>>> pylab.xticks([i/10.0 for i in range(0,12)]) 
>>> pylab.show() 
+0

+1 para 'pylab.grid (True)' – slater

Cuestiones relacionadas