From: Bilheux, Jean-C. <bil...@or...> - 2015-06-01 19:21:52
|
Here is what I see with a couple of things modified ? did you expect something else ? from matplotlib.backends.backend_pdf import PdfPages import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(1,1,1) x = np.linspace(0,10,50) y = np.sin(x) with PdfPages('grid_test.pdf') as pdf: plt.clf() plt.clf() plt.plot(x,y) leg = plt.legend(['legend 1']) plt.title('Sample title') ax.set_ylabel('Sample ylabel') ax.set_xlabel('Sample xlabel') ax.set_xticks(np.arange(0, 10, 20)) ax.set_xticks(np.arange(0, 10, 5), minor=True) ax.set_yticks(np.arange(-1,1,20)) ax.set_yticks(np.arange(-1,1,20), minor=True) ax.minorticks_on plt.show() pdf.savefig() [cid:8C8...@or...] On Jun 1, 2015, at 2:49 PM, <st...@th...<mailto:st...@th...>> wrote: I am having an issue with the grid not appearing that I cannot figure out. Can anyone help? Thanks. --StephenB from matplotlib.backends.backend_pdf import PdfPages import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(1,1,1) x = np.linspace(0,10,50) y = np.sin(x) with PdfPages('grid_test.pdf') as pdf: plt.clf() plt.clf() plt.plot(x,y) leg = plt.legend(['legend 1']) plt.title('Sample title') ax.set_ylabel('Sample ylabel') ax.set_xlabel('Sample xlabel') ax.set_xticks(np.arange(0, 10, 20)) ax.set_xticks(np.arange(0, 10, 5), minor=True) ax.set_yticks(np.arange(-1,1,20)) ax.set_yticks(np.arange(-1,1,20), minor=True) ax.minorticks_on pdf.savefig() ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Mat...@li...<mailto:Mat...@li...> https://lists.sourceforge.net/lists/listinfo/matplotlib-users |