You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function.plot_2d if Function is 2-Dimensional and forward arguments
1156
1163
and key-word arguments."""
1157
1164
ifisinstance(self, list):
1165
+
# Extract filename from kwargs
1166
+
filename=kwargs.get("filename", None)
1167
+
1158
1168
# Compare multiple plots
1159
-
Function.compare_plots(self)
1169
+
Function.compare_plots(self, filename)
1160
1170
else:
1161
1171
ifself.__dom_dim__==1:
1162
1172
self.plot_1d(*args, **kwargs)
@@ -1184,6 +1194,7 @@ def plot_1d(
1184
1194
force_points=False,
1185
1195
return_object=False,
1186
1196
equal_axis=False,
1197
+
filename=None,
1187
1198
):
1188
1199
"""Plot 1-Dimensional Function, from a lower limit to an upper limit,
1189
1200
by sampling the Function several times in the interval. The title of
@@ -1214,6 +1225,8 @@ def plot_1d(
1214
1225
Setting force_points to True will plot all points, as a scatter, in
1215
1226
which the Function was evaluated in the dataset. Default value is
1216
1227
False.
1228
+
filename : str | None, optional
1229
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
1217
1230
1218
1231
Returns
1219
1232
-------
@@ -1254,7 +1267,7 @@ def plot_1d(
1254
1267
plt.title(self.title)
1255
1268
plt.xlabel(self.__inputs__[0].title())
1256
1269
plt.ylabel(self.__outputs__[0].title())
1257
-
plt.show()
1270
+
show_or_save_plot(filename)
1258
1271
ifreturn_object:
1259
1272
returnfig, ax
1260
1273
@@ -1277,6 +1290,7 @@ def plot_2d(
1277
1290
disp_type="surface",
1278
1291
alpha=0.6,
1279
1292
cmap="viridis",
1293
+
filename=None,
1280
1294
):
1281
1295
"""Plot 2-Dimensional Function, from a lower limit to an upper limit,
1282
1296
by sampling the Function several times in the interval. The title of
@@ -1316,6 +1330,8 @@ def plot_2d(
1316
1330
cmap : string, optional
1317
1331
Colormap of plotted graph, which can be any of the color maps
1318
1332
available in matplotlib. Default value is viridis.
1333
+
filename : str | None, optional
1334
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
1319
1335
1320
1336
Returns
1321
1337
-------
@@ -1389,7 +1405,7 @@ def plot_2d(
1389
1405
axes.set_xlabel(self.__inputs__[0].title())
1390
1406
axes.set_ylabel(self.__inputs__[1].title())
1391
1407
axes.set_zlabel(self.__outputs__[0].title())
1392
-
plt.show()
1408
+
show_or_save_plot(filename)
1393
1409
1394
1410
@staticmethod
1395
1411
defcompare_plots(
@@ -1404,6 +1420,7 @@ def compare_plots(
1404
1420
force_points=False,
1405
1421
return_object=False,
1406
1422
show=True,
1423
+
filename=None,
1407
1424
):
1408
1425
"""Plots N 1-Dimensional Functions in the same plot, from a lower
1409
1426
limit to an upper limit, by sampling the Functions several times in
@@ -1448,6 +1465,8 @@ def compare_plots(
1448
1465
False.
1449
1466
show : bool, optional
1450
1467
If True, shows the plot. Default value is True.
1468
+
filename : str | None, optional
1469
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
"""Draw the nosecone shape along with some important information,
75
77
including the center line and the center of pressure position.
76
78
79
+
Parameters
80
+
----------
81
+
filename : str | None, optional
82
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
"""Draw the fin shape along with some important information, including
238
245
the center line, the quarter line and the center of pressure position.
239
246
247
+
Parameters
248
+
----------
249
+
filename : str | None, optional
250
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
"""Draw the fin shape along with some important information.
363
375
These being: the center line and the center of pressure position.
364
376
377
+
Parameters
378
+
----------
379
+
filename : str | None, optional
380
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
Tuple with the size of the figure. The default is (7, 7).
1474
+
filename : str | None, optional
1475
+
The path the plot should be saved to. By default None, in which case the plot will be shown instead of saved. Supported file endings are: png, pdf, ps, eps and svg.
0 commit comments