MCPcopy Create free account
hub / github.com/COLA-Laboratory/TransOPT / plot3D

Function plot3D

transopt/utils/plot.py:36–62  ·  view source on GitHub ↗
(X, Y, Z, c='black', ls='', marker='o', fillstyle=None, label=None, ax=None, file=None, show=False,
           show_legend=False, bounds=None,title=None)

Source from the content-addressed store, hash-verified

34
35
36def plot3D(X, Y, Z, c='black', ls='', marker='o', fillstyle=None, label=None, ax=None, file=None, show=False,
37 show_legend=False, bounds=None,title=None):
38 if ax is None:
39 _, ax = plt.subplots(subplot_kw={"projection": "3d"})
40 ax.plot(X, Y, Z, c=c, ls=ls, marker=marker, label=label,fillstyle=fillstyle)
41 ax.set_xlabel('$f_1(\mathbf{x})$', fontsize=13)
42 ax.set_ylabel('$f_2(\mathbf{x})$', fontsize=13)
43 ax.set_zlabel('$f_3(\mathbf{x})$', fontsize=13)
44 ax.tick_params(axis='both', labelsize=13)
45
46 if show or file is not None:
47 plt.grid()
48 if show_legend:
49 plt.legend()
50 if bounds is not None:
51 ax.set_xlim((bounds[0, 0], bounds[0, 1]))
52 ax.set_ylim((bounds[1, 0], bounds[1, 1]))
53 ax.set_zlim((bounds[2, 0], bounds[2, 1]))
54 if title:
55 plt.title(title)
56 if file is not None:
57 plt.savefig(file, format='pdf')
58 if show:
59 plt.show()
60 if file is None and show is False:
61 return ax
62 return None
63
64
65def surface3D(X_grid, Y_grid, cmap=cm.Blues, ax=None, file=None, show=False,label=None):

Callers

nothing calls this directly

Calls 2

plotMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected