File mplot/maxes.py changed (mode: 100644) (index c42155e..c408b44) |
... |
... |
import numpy as np |
16 |
16 |
from . import mart |
from . import mart |
17 |
17 |
from . import mgraph |
from . import mgraph |
18 |
18 |
|
|
|
19 |
|
from matplotlib import colors as mcolors |
|
20 |
|
|
19 |
21 |
|
|
20 |
22 |
# it is mostly for qt_plot, it offers availiable options to user |
# it is mostly for qt_plot, it offers availiable options to user |
21 |
23 |
__all__ = [ |
__all__ = [ |
|
... |
... |
__all__ = [ |
34 |
36 |
] |
] |
35 |
37 |
|
|
36 |
38 |
|
|
37 |
|
def _setup_labels(ax): |
|
|
39 |
|
def _setup_labels(ax, data_offset=0.5): |
38 |
40 |
if ax.space in ('P', 'aP', 'U', 'aU'): |
if ax.space in ('P', 'aP', 'U', 'aU'): |
39 |
41 |
ax.set_xlabel("$x_1$") |
ax.set_xlabel("$x_1$") |
40 |
42 |
ax.set_ylabel("$x_2$") |
ax.set_ylabel("$x_2$") |
41 |
43 |
else: |
else: |
42 |
|
text = ax.text(1, -0.5, '$x_1$', ha='center',va='top', transform=ax.get_yaxis_transform()) |
|
|
44 |
|
text = ax.text(1, -data_offset, '$x_1$', ha='center',va='top', transform=ax.get_yaxis_transform()) |
43 |
45 |
text.set_in_layout(False) |
text.set_in_layout(False) |
44 |
|
text = ax.text(-0.5, 1, '$x_2~$', ha='right',va='center', transform=ax.get_xaxis_transform()) |
|
|
46 |
|
text = ax.text(-data_offset, 1, '$x_2~$', ha='right',va='center', transform=ax.get_xaxis_transform()) |
45 |
47 |
text.set_in_layout(False) |
text.set_in_layout(False) |
46 |
48 |
|
|
47 |
49 |
|
|
|
... |
... |
def candidates_sampling_plot(ax, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1]): |
63 |
65 |
|
|
64 |
66 |
if event in ('mix', 'outside'): |
if event in ('mix', 'outside'): |
65 |
67 |
mart.plot_sample(ax, kwargs['nodes'], ls='', marker='.',\ |
mart.plot_sample(ax, kwargs['nodes'], ls='', marker='.',\ |
66 |
|
mec="#00007E", mfc="#00007E", ms=1.5, alpha=0.5) |
|
|
68 |
|
mec="#00007E", mfc="#00007E", ms=1.5, alpha=0.5,\ |
|
69 |
|
rasterized=True) |
67 |
70 |
|
|
68 |
71 |
data = stm.fast_simplex_estimation(ax.sample_box, model_space=ax.space,\ |
data = stm.fast_simplex_estimation(ax.sample_box, model_space=ax.space,\ |
69 |
72 |
sampling_space=ax.space, \ |
sampling_space=ax.space, \ |
|
... |
... |
def candidates_sampling_plot(ax, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1]): |
82 |
85 |
pass |
pass |
83 |
86 |
|
|
84 |
87 |
def candidates_plot(ax): |
def candidates_plot(ax): |
85 |
|
tri_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3]) |
|
86 |
|
mart.scatter_candidates(ax, s=1.5, marker='.', cmap='plasma_r')#, alpha=0.5) |
|
87 |
|
mart.plot_the_best_candidate(ax, "^", color='#430051') |
|
|
88 |
|
tri_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3], data_offset=0.4) |
|
89 |
|
blue_colors = ["#BDBDFF", "#9999FF", "#00007E", "#000057"] |
|
90 |
|
blue_cmap = mcolors.LinearSegmentedColormap.from_list("bluecmap", blue_colors) |
|
91 |
|
mart.scatter_candidates(ax, s=1.5, marker='.', cmap=blue_cmap, rasterized=True) |
|
92 |
|
mart.plot_the_best_candidate(ax, "^", color='#000057') |
88 |
93 |
mart.plot_points(ax, ms=5, zorder=1005000) |
mart.plot_points(ax, ms=5, zorder=1005000) |
89 |
94 |
|
|
90 |
|
if ax.space in ('G', 'GK'): |
|
91 |
|
ax.xaxis.set_label_coords(1, 0.47) |
|
92 |
|
ax.set_xlabel("$x_1$") |
|
93 |
|
ax.text(0.47, 1, '$x_2$', ha='right',va='top', transform=ax.transAxes) |
|
94 |
|
else: |
|
95 |
|
ax.set_xlabel("$x_1$") |
|
96 |
|
ax.set_ylabel("$x_2$") |
|
|
95 |
|
# if ax.space in ('G', 'GK'): |
|
96 |
|
# ax.xaxis.set_label_coords(1, 0.47) |
|
97 |
|
# ax.set_xlabel("$x_1$") |
|
98 |
|
# ax.text(0.47, 1, '$x_2$', ha='right',va='top', transform=ax.transAxes) |
|
99 |
|
# else: |
|
100 |
|
# ax.set_xlabel("$x_1$") |
|
101 |
|
# ax.set_ylabel("$x_2$") |
97 |
102 |
|
|
98 |
103 |
def convergence_diagram(ax, sources=['box', 'user'], apply_proxy=False): |
def convergence_diagram(ax, sources=['box', 'user'], apply_proxy=False): |
99 |
104 |
#č pokorně jedeme použiť guessbox |
#č pokorně jedeme použiť guessbox |
|
... |
... |
def tri_nodes_plot(ax, tri_space=None, tn_scheme=None,\ |
154 |
159 |
assert 100500 < 0 #оӵ мар лэсьтӥське татын? |
assert 100500 < 0 #оӵ мар лэсьтӥське татын? |
155 |
160 |
|
|
156 |
161 |
mart.plot_sample(ax, kwargs['nodes'], ls='', marker='.',\ |
mart.plot_sample(ax, kwargs['nodes'], ls='', marker='.',\ |
157 |
|
mec=color, mfc=color, ms=1, alpha=0.5) |
|
|
162 |
|
mec=color, mfc=color, ms=1, alpha=0.5, rasterized=True) |
158 |
163 |
|
|
159 |
164 |
|
|
160 |
165 |
|
|
|
... |
... |
def tri_GK_nodes_plot(ax, **kwargs): |
194 |
199 |
#č ten [plot] zásadně vytvaří své struktury, nepouzívá oné ze skříňky, |
#č ten [plot] zásadně vytvaří své struktury, nepouzívá oné ze skříňky, |
195 |
200 |
#č protože já vím, že v těch obrázcích, ve kterých chcu ho použit, |
#č protože já vím, že v těch obrázcích, ve kterých chcu ho použit, |
196 |
201 |
#č můde být třeba použit řez a skříňka tedy potřebné struktury může nemít |
#č můde být třeba použit řez a skříňka tedy potřebné struktury může nemít |
197 |
|
def tri_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1]): |
|
|
202 |
|
def tri_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1], data_offset=0.5): |
198 |
203 |
from .. import simplex as six |
from .. import simplex as six |
199 |
204 |
if tri_space is None: |
if tri_space is None: |
200 |
205 |
tri_space = ax.space |
tri_space = ax.space |
|
... |
... |
def tri_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1]): |
218 |
223 |
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
219 |
224 |
except: |
except: |
220 |
225 |
pass |
pass |
221 |
|
_setup_labels(ax) |
|
|
226 |
|
_setup_labels(ax, data_offset) |
222 |
227 |
|
|
223 |
228 |
|
|
224 |
229 |
|
|
|
... |
... |
def candidates_drawing(ax): |
283 |
288 |
#č která inicializaci deleguje funkci cm.get_cmap() ve (svém) modulu cm. |
#č která inicializaci deleguje funkci cm.get_cmap() ve (svém) modulu cm. |
284 |
289 |
# cmap='viridis_r' #cmap='plasma', |
# cmap='viridis_r' #cmap='plasma', |
285 |
290 |
mart.scatter_candidates(ax, s=5, marker='.', cmap='plasma_r',\ |
mart.scatter_candidates(ax, s=5, marker='.', cmap='plasma_r',\ |
286 |
|
alpha=None, linewidths=None, edgecolors=None, plotnonfinite=False) |
|
|
291 |
|
alpha=None, linewidths=None, edgecolors=None, plotnonfinite=False, rasterized=True) |
287 |
292 |
mart.plot_the_best_candidate(ax, "^", color='#3D0D5B') |
mart.plot_the_best_candidate(ax, "^", color='#3D0D5B') |
288 |
293 |
|
|
289 |
294 |
|
|
File mplot/mfigs.py changed (mode: 100644) (index 4ca0107..9bfe346) |
... |
... |
def double_plot(fig, sample_box, space): |
101 |
101 |
|
|
102 |
102 |
def triple_plot(fig, sample_box, space): |
def triple_plot(fig, sample_box, space): |
103 |
103 |
fig.set_figwidth(19/2.54) |
fig.set_figwidth(19/2.54) |
104 |
|
ax = fig.add_subplot(131) |
|
|
104 |
|
ax1 = ax = fig.add_subplot(131) |
105 |
105 |
ax.sample_box = sample_box[0:100] |
ax.sample_box = sample_box[0:100] |
106 |
106 |
ax.space = space |
ax.space = space |
107 |
107 |
try: |
try: |
|
... |
... |
def triple_plot(fig, sample_box, space): |
111 |
111 |
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
112 |
112 |
maxes.tri_nodes_plot(ax, tri_space=None, tn_scheme=tn_scheme) |
maxes.tri_nodes_plot(ax, tri_space=None, tn_scheme=tn_scheme) |
113 |
113 |
ax.set_title(space_labels[space], pad=10) |
ax.set_title(space_labels[space], pad=10) |
|
114 |
|
|
114 |
115 |
ax = fig.add_subplot(132) |
ax = fig.add_subplot(132) |
115 |
116 |
ax.sample_box = sample_box[0:200] |
ax.sample_box = sample_box[0:200] |
116 |
117 |
ax.space = space |
ax.space = space |
117 |
118 |
maxes.tri_plot(ax) |
maxes.tri_plot(ax) |
|
119 |
|
ax.sharey(ax1) |
118 |
120 |
ax.set_title(space_labels[space], pad=10) |
ax.set_title(space_labels[space], pad=10) |
|
121 |
|
|
119 |
122 |
ax = fig.add_subplot(133) |
ax = fig.add_subplot(133) |
120 |
123 |
ax.sample_box = sample_box |
ax.sample_box = sample_box |
121 |
124 |
ax.space = space |
ax.space = space |
122 |
125 |
maxes.convex_hull_plot(ax) |
maxes.convex_hull_plot(ax) |
|
126 |
|
ax.sharey(ax1) |
123 |
127 |
ax.set_title(space_labels[space], pad=10) |
ax.set_title(space_labels[space], pad=10) |
124 |
128 |
|
|
125 |
129 |
def qhull_under_density(fig, sample_box, space): |
def qhull_under_density(fig, sample_box, space): |