Creates the figure, and saves it to disck. It displays the figure if SLiCAPplots.figure.show == True.
(self)
| 287 | self.traceDict[trc.label] = trc |
| 288 | |
| 289 | def plot(self): |
| 290 | """ |
| 291 | Creates the figure, and saves it to disck. It displays the figure if |
| 292 | SLiCAPplots.figure.show == True. |
| 293 | """ |
| 294 | axes = np.array(self.axes) |
| 295 | try: |
| 296 | rows, cols = axes.shape |
| 297 | except: |
| 298 | print('Attribute of <figure>.axes must be a list of lists or a two-dimensional array.') |
| 299 | return False |
| 300 | axesList = [] |
| 301 | # Make a single list of plots to be plotted left -> right, then top -> bottom |
| 302 | for i in range(rows): |
| 303 | for j in range(cols): |
| 304 | axesList.append(axes[i][j]) |
| 305 | if len(axesList) == 0: |
| 306 | print('Error: no plot data available; plotting skipped.') |
| 307 | return False |
| 308 | # Define the matplotlib figure object |
| 309 | fig = plt.figure(figsize = (self.axisWidth*cols, rows*self.axisHeight)) |
| 310 | # Create the axes with their plots |
| 311 | for i in range(len(axesList)): |
| 312 | if axesList[i] != "": |
| 313 | ax = fig.add_subplot(rows, cols, i + 1, polar = axesList[i].polar) |
| 314 | if axesList[i].xLabel: |
| 315 | try: |
| 316 | ax.set_xlabel(axesList[i].xLabel) |
| 317 | except: |
| 318 | pass |
| 319 | if axesList[i].yLabel: |
| 320 | try: |
| 321 | ax.set_ylabel(axesList[i].yLabel) |
| 322 | except: |
| 323 | pass |
| 324 | if axesList[i].title: |
| 325 | try: |
| 326 | ax.set_title(axesList[i].title) |
| 327 | except: |
| 328 | pass |
| 329 | if axesList[i].xScale: |
| 330 | try: |
| 331 | ax.set_xscale(axesList[i].xScale) |
| 332 | except: |
| 333 | pass |
| 334 | if axesList[i].yScale: |
| 335 | try: |
| 336 | ax.set_yscale(axesList[i].yScale) |
| 337 | except: |
| 338 | pass |
| 339 | if len(axesList[i].xLim) == 2: |
| 340 | try: |
| 341 | ax.set_xlim(axesList[i].xLim[0], axesList[i].xLim[1]) |
| 342 | except: |
| 343 | pass |
| 344 | if len(axesList[i].yLim) == 2: |
| 345 | try: |
| 346 | ax.set_ylim(axesList[i].yLim[0], axesList[i].yLim[1]) |
no test coverage detected