From 08696c0b42ad03c8c8eb93763f16c4cef723631c 2016-04-27 17:07:38 From: Miguel Valdez Date: 2016-04-27 17:07:38 Subject: [PATCH] saving figures with the same scale than plots --- diff --git a/schainpy/model/graphics/mpldriver.py b/schainpy/model/graphics/mpldriver.py index 6887dcd..2bd70fa 100644 --- a/schainpy/model/graphics/mpldriver.py +++ b/schainpy/model/graphics/mpldriver.py @@ -18,16 +18,18 @@ from matplotlib.ticker import FuncFormatter, LinearLocator #Actualizacion de las funciones del driver ########################################### -def createFigure(id, wintitle, width, height, facecolor="w", show=True): +def createFigure(id, wintitle, width, height, facecolor="w", show=True, dpi = 80): matplotlib.pyplot.ioff() - fig = matplotlib.pyplot.figure(num=id, facecolor=facecolor) + + fig = matplotlib.pyplot.figure(num=id, facecolor=facecolor, figsize=(1.0*width/dpi, 1.0*height/dpi)) fig.canvas.manager.set_window_title(wintitle) - fig.canvas.manager.resize(width, height) +# fig.canvas.manager.resize(width, height) matplotlib.pyplot.ion() + if show: matplotlib.pyplot.show() - + return fig def closeFigure(show=False, fig=None): @@ -54,7 +56,7 @@ def closeFigure(show=False, fig=None): def saveFigure(fig, filename): # matplotlib.pyplot.ioff() - fig.savefig(filename) + fig.savefig(filename, dpi=matplotlib.pyplot.gcf().dpi) # matplotlib.pyplot.ion() def clearFigure(fig):