Hello, The script pasted below plots a square array. The (very small) output PDF is attached to this posting. For reasons I do not understand, there's a fine additional border immediately at the top and bottom of the array.
If the commented-out line of code is removed, the strange border disappears. Now you will ask, why do I create the figure in this way and don't simply use the commented-out line? The answer is that this script is a simplified version of the function "map" from http://git.kwant-project.org/kwant/tree/kwant/plotter.py?id=v1.0.0 There, we need to create a figure also when pyplot has not been imported. If we would import matplotlib.pyplot, the user of our package could not freely choose the matplotlib backend himself. Thanks, Christoph **************************************************************** import numpy as np from matplotlib import pyplot from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg data = np.random.random((11, 11)) fig = Figure() ax = fig.add_subplot(1, 1, 1, aspect='equal', adjustable='datalim') # Uncommenting the following line makes it work. # fig, ax = pyplot.subplots() image = ax.imshow(data, extent=(-49.5, 49.5, -49.5, 49.5), interpolation='none') fig.canvas = FigureCanvasAgg(fig) fig.set_size_inches(5, 5) fig.savefig('test.pdf')
test.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users