Skip to content

Commit

Permalink
Fix mixed usage of subfig and self.subfig
Browse files Browse the repository at this point in the history
Was failing to plot anything because of these inconsistencies.
  • Loading branch information
mattachu committed Apr 14, 2020
1 parent 481d41e commit be3aa3d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions GUI/src/ImpactTPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ def __init__(self, parent,PlotFileName,xl,yl,labelY):
y = y*1.0e6 # unit convert from (m-rad) to (mm-mrad)

fig = Figure(figsize=(7,5), dpi=100)
subfig = fig.add_subplot(111)
subfig.plot(x,y)
subfig.set_xlabel('Z (m)')
subfig.set_ylabel(labelY)
self.subfig = fig.add_subplot(111)
self.subfig.plot(x,y)
self.subfig.set_xlabel('Z (m)')
self.subfig.set_ylabel(labelY)

xMax = np.max(x)
xMin = np.min(x)
Expand All @@ -393,8 +393,8 @@ def __init__(self, parent,PlotFileName,xl,yl,labelY):

#xmajorFormatter = FormatStrFormatter('%2.2E')
#subfig.yaxis.set_major_formatter(xmajorFormatter)
box = subfig.get_position()
subfig.set_position([box.x0*1.45, box.y0*1.1, box.width, box.height])
box = self.subfig.get_position()
self.subfig.set_position([box.x0*1.45, box.y0*1.1, box.width, box.height])

canvas = FigureCanvasTkAgg(fig, self)
canvas.draw()
Expand Down Expand Up @@ -723,6 +723,6 @@ def axis_format_T(xData,yData,subfig):
yMax = np.max(yData)
yMin = np.min(yData)
if (xMax-xMin)>IMPACT_T_sciMaxLimit or (xMax-xMin)<IMPACT_T_sciMinLimit:
subfig.xaxis.set_major_formatter(IMPACT_T_SciFormatter)
self.subfig.xaxis.set_major_formatter(IMPACT_T_SciFormatter)
if (yMax-yMin)>IMPACT_T_sciMaxLimit or (yMax-yMin)<IMPACT_T_sciMinLimit:
subfig.yaxis.set_major_formatter(IMPACT_T_SciFormatter)
self.subfig.yaxis.set_major_formatter(IMPACT_T_SciFormatter)
16 changes: 8 additions & 8 deletions GUI/src/ImpactZPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,10 @@ def __init__(self, parent,PlotFileName,xl,yl,labelY):
y = y*1.0e6 # unit convert from (m-rad) to (mm-mrad)

fig = Figure(figsize=(7,5), dpi=100)
subfig = fig.add_subplot(111)
subfig.plot(x,y)
subfig.set_xlabel('Z (m)')
subfig.set_ylabel(labelY)
self.subfig = fig.add_subplot(111)
self.subfig.plot(x,y)
self.subfig.set_xlabel('Z (m)')
self.subfig.set_ylabel(labelY)


xMax = np.max(x)
Expand All @@ -367,8 +367,8 @@ def __init__(self, parent,PlotFileName,xl,yl,labelY):
if (yMax-yMin)>IMPACT_Z_sciMaxLimit or (yMax-yMin)<IMPACT_Z_sciMinLimit:
self.subfig.yaxis.set_major_formatter(IMPACT_Z_SciFormatter)

box = subfig.get_position()
subfig.set_position([box.x0*1.3, box.y0*1.1, box.width, box.height])
box = self.subfig.get_position()
self.subfig.set_position([box.x0*1.3, box.y0*1.1, box.width, box.height])

canvas = FigureCanvasTkAgg(fig, self)
canvas.draw()
Expand Down Expand Up @@ -677,6 +677,6 @@ def axis_format_Z(xData,yData,subfig):
yMax = np.max(yData)
yMin = np.min(yData)
if (xMax-xMin)>IMPACT_Z_sciMaxLimit or (xMax-xMin)<IMPACT_Z_sciMinLimit:
subfig.xaxis.set_major_formatter(IMPACT_Z_SciFormatter)
self.subfig.xaxis.set_major_formatter(IMPACT_Z_SciFormatter)
if (yMax-yMin)>IMPACT_Z_sciMaxLimit or (yMax-yMin)<IMPACT_Z_sciMinLimit:
subfig.yaxis.set_major_formatter(IMPACT_Z_SciFormatter)
self.subfig.yaxis.set_major_formatter(IMPACT_Z_SciFormatter)
16 changes: 8 additions & 8 deletions GUI/src/ImpactZPlotold.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ def __init__(self, parent,PlotFileName,xl,yl,labelY):
y = y*1.0e6 # unit convert from (m-rad) to (mm-mrad)

fig = Figure(figsize=(7,5), dpi=100)
subfig = fig.add_subplot(111)
subfig.plot(x,y)
subfig.set_xlabel('Z (m)')
subfig.set_ylabel(labelY)
self.subfig = fig.add_subplot(111)
self.subfig.plot(x,y)
self.subfig.set_xlabel('Z (m)')
self.subfig.set_ylabel(labelY)


xMax = np.max(x)
Expand All @@ -368,8 +368,8 @@ def __init__(self, parent,PlotFileName,xl,yl,labelY):
if (yMax-yMin)>IMPACT_Z_sciMaxLimit or (yMax-yMin)<IMPACT_Z_sciMinLimit:
self.subfig.yaxis.set_major_formatter(IMPACT_Z_SciFormatter)

box = subfig.get_position()
subfig.set_position([box.x0*1.3, box.y0*1.1, box.width, box.height])
box = self.subfig.get_position()
self.subfig.set_position([box.x0*1.3, box.y0*1.1, box.width, box.height])

canvas = FigureCanvasTkAgg(fig, self)
canvas.draw()
Expand Down Expand Up @@ -678,6 +678,6 @@ def axis_format_Z(xData,yData,subfig):
yMax = np.max(yData)
yMin = np.min(yData)
if (xMax-xMin)>IMPACT_Z_sciMaxLimit or (xMax-xMin)<IMPACT_Z_sciMinLimit:
subfig.xaxis.set_major_formatter(IMPACT_Z_SciFormatter)
self.subfig.xaxis.set_major_formatter(IMPACT_Z_SciFormatter)
if (yMax-yMin)>IMPACT_Z_sciMaxLimit or (yMax-yMin)<IMPACT_Z_sciMinLimit:
subfig.yaxis.set_major_formatter(IMPACT_Z_SciFormatter)
self.subfig.yaxis.set_major_formatter(IMPACT_Z_SciFormatter)

0 comments on commit be3aa3d

Please sign in to comment.