##// END OF EJS Templates
saving figures with the same scale than plots
Miguel Valdez -
r828:08696c0b42ad
parent child
Show More
@@ -18,16 +18,18 from matplotlib.ticker import FuncFormatter, LinearLocator
18 #Actualizacion de las funciones del driver
18 #Actualizacion de las funciones del driver
19 ###########################################
19 ###########################################
20
20
21 def createFigure(id, wintitle, width, height, facecolor="w", show=True):
21 def createFigure(id, wintitle, width, height, facecolor="w", show=True, dpi = 80):
22
22
23 matplotlib.pyplot.ioff()
23 matplotlib.pyplot.ioff()
24 fig = matplotlib.pyplot.figure(num=id, facecolor=facecolor)
24
25 fig = matplotlib.pyplot.figure(num=id, facecolor=facecolor, figsize=(1.0*width/dpi, 1.0*height/dpi))
25 fig.canvas.manager.set_window_title(wintitle)
26 fig.canvas.manager.set_window_title(wintitle)
26 fig.canvas.manager.resize(width, height)
27 # fig.canvas.manager.resize(width, height)
27 matplotlib.pyplot.ion()
28 matplotlib.pyplot.ion()
29
28 if show:
30 if show:
29 matplotlib.pyplot.show()
31 matplotlib.pyplot.show()
30
32
31 return fig
33 return fig
32
34
33 def closeFigure(show=False, fig=None):
35 def closeFigure(show=False, fig=None):
@@ -54,7 +56,7 def closeFigure(show=False, fig=None):
54 def saveFigure(fig, filename):
56 def saveFigure(fig, filename):
55
57
56 # matplotlib.pyplot.ioff()
58 # matplotlib.pyplot.ioff()
57 fig.savefig(filename)
59 fig.savefig(filename, dpi=matplotlib.pyplot.gcf().dpi)
58 # matplotlib.pyplot.ion()
60 # matplotlib.pyplot.ion()
59
61
60 def clearFigure(fig):
62 def clearFigure(fig):
General Comments 0
You need to be logged in to leave comments. Login now