| 3 | |
| 4 | |
| 5 | def 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 | |
| 36 | def plot3D(X, Y, Z, c='black', ls='', marker='o', fillstyle=None, label=None, ax=None, file=None, show=False, |