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

Function plot2D

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

Source from the content-addressed store, hash-verified

3
4
5def plot2D(X, Y, c='black', ls='', marker='o', fillstyle=None, label=None, ax=None, file=None, show=False,
6 show_legend=False, bounds=None,title=None,disconnect=None):
7 if ax is None:
8 _, ax = plt.subplots(1, 1)
9 if disconnect is None:
10 ax.plot(X, Y, c=c, ls=ls, marker=marker, label=label,fillstyle=fillstyle)
11 else:
12 for l in disconnect:
13 ax.plot(X[l], Y[l], c=c, ls=ls, marker=marker, label=label, fillstyle=fillstyle)
14 ax.set_xlabel('$f_1(\mathbf{x})$', fontsize=13)
15 ax.set_ylabel('$f_2(\mathbf{x})$', fontsize=13)
16 ax.tick_params(axis='both', labelsize=13)
17
18 if show or file is not None:
19 plt.grid()
20 if show_legend:
21 plt.legend()
22 if bounds is not None:
23 plt.xlim((bounds[0, 0], bounds[0, 1]))
24 plt.ylim((bounds[1, 0], bounds[1, 1]))
25 if title:
26 plt.title(title)
27 if file is not None:
28 plt.savefig(file, format='pdf')
29 if show:
30 plt.show()
31 if file is None and show is False:
32 return ax
33 return None
34
35
36def plot3D(X, Y, Z, c='black', ls='', marker='o', fillstyle=None, label=None, ax=None, file=None, show=False,

Callers

nothing calls this directly

Calls 2

plotMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected