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
1158
and key-word arguments."""
1157
1159
ifisinstance(self, list):
1160
+
# Extract filename from kwargs
1161
+
filename=kwargs.get("filename", None)
1162
+
1158
1163
# Compare multiple plots
1159
-
Function.compare_plots(self)
1164
+
Function.compare_plots(self, filename)
1160
1165
else:
1161
1166
ifself.__dom_dim__==1:
1162
1167
self.plot_1d(*args, **kwargs)
@@ -1184,6 +1189,7 @@ def plot_1d(
1184
1189
force_points=False,
1185
1190
return_object=False,
1186
1191
equal_axis=False,
1192
+
filename=None,
1187
1193
):
1188
1194
"""Plot 1-Dimensional Function, from a lower limit to an upper limit,
1189
1195
by sampling the Function several times in the interval. The title of
@@ -1214,6 +1220,8 @@ def plot_1d(
1214
1220
Setting force_points to True will plot all points, as a scatter, in
1215
1221
which the Function was evaluated in the dataset. Default value is
1216
1222
False.
1223
+
filename : str | None, optional
1224
+
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
1225
1218
1226
Returns
1219
1227
-------
@@ -1254,7 +1262,7 @@ def plot_1d(
1254
1262
plt.title(self.title)
1255
1263
plt.xlabel(self.__inputs__[0].title())
1256
1264
plt.ylabel(self.__outputs__[0].title())
1257
-
plt.show()
1265
+
show_or_save_plot(filename)
1258
1266
ifreturn_object:
1259
1267
returnfig, ax
1260
1268
@@ -1277,6 +1285,7 @@ def plot_2d(
1277
1285
disp_type="surface",
1278
1286
alpha=0.6,
1279
1287
cmap="viridis",
1288
+
filename=None,
1280
1289
):
1281
1290
"""Plot 2-Dimensional Function, from a lower limit to an upper limit,
1282
1291
by sampling the Function several times in the interval. The title of
@@ -1316,6 +1325,8 @@ def plot_2d(
1316
1325
cmap : string, optional
1317
1326
Colormap of plotted graph, which can be any of the color maps
1318
1327
available in matplotlib. Default value is viridis.
1328
+
filename : str | None, optional
1329
+
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
1330
1320
1331
Returns
1321
1332
-------
@@ -1389,7 +1400,7 @@ def plot_2d(
1389
1400
axes.set_xlabel(self.__inputs__[0].title())
1390
1401
axes.set_ylabel(self.__inputs__[1].title())
1391
1402
axes.set_zlabel(self.__outputs__[0].title())
1392
-
plt.show()
1403
+
show_or_save_plot(filename)
1393
1404
1394
1405
@staticmethod
1395
1406
defcompare_plots(
@@ -1404,6 +1415,7 @@ def compare_plots(
1404
1415
force_points=False,
1405
1416
return_object=False,
1406
1417
show=True,
1418
+
filename=None,
1407
1419
):
1408
1420
"""Plots N 1-Dimensional Functions in the same plot, from a lower
1409
1421
limit to an upper limit, by sampling the Functions several times in
@@ -1448,6 +1460,8 @@ def compare_plots(
1448
1460
False.
1449
1461
show : bool, optional
1450
1462
If True, shows the plot. Default value is True.
1463
+
filename : str | None, optional
1464
+
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