File mplot/maxes.py changed (mode: 100644) (index 20de768..c42155e) |
... |
... |
def candidates_plot(ax): |
95 |
95 |
ax.set_xlabel("$x_1$") |
ax.set_xlabel("$x_1$") |
96 |
96 |
ax.set_ylabel("$x_2$") |
ax.set_ylabel("$x_2$") |
97 |
97 |
|
|
98 |
|
def convergence_diagram(ax): |
|
|
98 |
|
def convergence_diagram(ax, sources=['box', 'user'], apply_proxy=False): |
99 |
99 |
#č pokorně jedeme použiť guessbox |
#č pokorně jedeme použiť guessbox |
100 |
100 |
#č nic jiného nebylo pořádně implementováno |
#č nic jiného nebylo pořádně implementováno |
101 |
101 |
from .. import stm_df |
from .. import stm_df |
102 |
|
df = stm_df.get_tri_box_df(ax.sample_box) |
|
103 |
|
pf_exact = ax.sample_box.pf_exact |
|
104 |
|
pf_exact_method = ax.sample_box.pf_exact_method |
|
105 |
|
mgraph.tri_estimation_plot(ax, df, pf_exact=pf_exact, \ |
|
106 |
|
pf_exact_method=pf_exact_method, plot_outside=True) |
|
107 |
|
|
|
|
102 |
|
df = stm_df.get_tri_data_frame(ax.sample_box, sources, apply_proxy) |
|
103 |
|
try: |
|
104 |
|
pf_exact = ax.sample_box.pf_exact |
|
105 |
|
pf_exact_method = ax.sample_box.pf_exact_method |
|
106 |
|
mgraph.tri_estimation_plot(ax, df, pf_exact=pf_exact, \ |
|
107 |
|
pf_exact_method=pf_exact_method, plot_outside=True) |
|
108 |
|
except: |
|
109 |
|
mgraph.tri_estimation_plot(ax, df, plot_outside=True) |
108 |
110 |
ax.margins(0) |
ax.margins(0) |
109 |
111 |
ax.set_yscale('log') |
ax.set_yscale('log') |
110 |
112 |
ax.set_xlabel("Number of points") |
ax.set_xlabel("Number of points") |
|
... |
... |
def tri_nodes_plot(ax, tri_space=None, tn_scheme=None,\ |
126 |
128 |
|
|
127 |
129 |
#č já tuhle funkciju potřebuju ne abych kreslil bodíky ve vrcholech |
#č já tuhle funkciju potřebuju ne abych kreslil bodíky ve vrcholech |
128 |
130 |
if tn_scheme is None: |
if tn_scheme is None: |
129 |
|
tn_scheme = ax.sample_box.Tri.tn_scheme |
|
|
131 |
|
try: |
|
132 |
|
tn_scheme = ax.sample_box.Tri.tn_scheme |
|
133 |
|
except: |
|
134 |
|
import quadpy |
|
135 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
136 |
|
|
130 |
137 |
|
|
131 |
138 |
def _draw_nodes(*args, **kwargs): |
def _draw_nodes(*args, **kwargs): |
132 |
139 |
# callback's signature: sx, indices=, simplex=, nodes=, cell_stats= |
# callback's signature: sx, indices=, simplex=, nodes=, cell_stats= |
|
... |
... |
def tri_nodes_plot(ax, tri_space=None, tn_scheme=None,\ |
171 |
178 |
mart.tri_plot(ax, Tri=Tri, color="#B2B2B2", lw=0.5, zorder=100) |
mart.tri_plot(ax, Tri=Tri, color="#B2B2B2", lw=0.5, zorder=100) |
172 |
179 |
|
|
173 |
180 |
mart.plot_points(ax, ms=2.5, zorder=100500) |
mart.plot_points(ax, ms=2.5, zorder=100500) |
174 |
|
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
|
|
181 |
|
try: |
|
182 |
|
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
|
183 |
|
except: |
|
184 |
|
pass |
175 |
185 |
_setup_labels(ax) |
_setup_labels(ax) |
176 |
186 |
|
|
177 |
187 |
def tri_R_nodes_plot(ax, **kwargs): |
def tri_R_nodes_plot(ax, **kwargs): |
|
... |
... |
def tri_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1]): |
204 |
214 |
mart.tri_plot(ax, Tri=Tri, color="#B2B2B2", lw=0.5, zorder=100) |
mart.tri_plot(ax, Tri=Tri, color="#B2B2B2", lw=0.5, zorder=100) |
205 |
215 |
|
|
206 |
216 |
mart.plot_points(ax, ms=2.5, zorder=100500) |
mart.plot_points(ax, ms=2.5, zorder=100500) |
207 |
|
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
|
|
217 |
|
try: |
|
218 |
|
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
|
219 |
|
except: |
|
220 |
|
pass |
208 |
221 |
_setup_labels(ax) |
_setup_labels(ax) |
209 |
222 |
|
|
210 |
223 |
|
|
|
... |
... |
def convex_hull_plot(ax, tri_space=None, linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0. |
228 |
241 |
qhull = khull.QHull(ax.sample_box, space=tri_space, incremental=False) |
qhull = khull.QHull(ax.sample_box, space=tri_space, incremental=False) |
229 |
242 |
mart.qhull_plot(ax, qhull, color="#B2B2B2", lw=0.7, zorder=100) |
mart.qhull_plot(ax, qhull, color="#B2B2B2", lw=0.7, zorder=100) |
230 |
243 |
mart.plot_points(ax, ms=2.5, zorder=100500) |
mart.plot_points(ax, ms=2.5, zorder=100500) |
231 |
|
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
|
|
244 |
|
try: |
|
245 |
|
mart.plot_boundaries(ax, lw=0.7, zorder=1050) |
|
246 |
|
except: |
|
247 |
|
pass |
232 |
248 |
_setup_labels(ax) |
_setup_labels(ax) |
233 |
249 |
|
|
234 |
250 |
def just_points(ax): |
def just_points(ax): |
File mplot/mfigs.py changed (mode: 100644) (index fa50a45..4ca0107) |
... |
... |
from . import maxes |
10 |
10 |
from . import maxes3d |
from . import maxes3d |
11 |
11 |
|
|
12 |
12 |
__all__ = [ |
__all__ = [ |
13 |
|
'double_tri_R_plot', 'triple_plot', |
|
|
13 |
|
'convergence_diagram', 'double_proxy_diagram', |
|
14 |
|
'double_tri_R_plot', 'double_tri_R_twins_plot', 'double_plot', 'triple_plot', |
14 |
15 |
'qhull_under_density', 'plane_under_density', 'dhull_vs_complete' |
'qhull_under_density', 'plane_under_density', 'dhull_vs_complete' |
15 |
16 |
] |
] |
16 |
17 |
|
|
|
18 |
|
space_labels = { |
|
19 |
|
'R': r'$\mathcal{R}$', |
|
20 |
|
'Rn': r'$\mathcal{R}^{\mathrm{n}}$', |
|
21 |
|
'P': r'$\mathcal{P}$', |
|
22 |
|
'GK': r'$\mathcal{G}^{\mathrm{c}}$', |
|
23 |
|
'G': r'$\mathcal{G}$', |
|
24 |
|
'U': r'$\mathcal{U}$' |
|
25 |
|
} |
|
26 |
|
|
|
27 |
|
def convergence_diagram(fig, sample_box, space, lim=1000): |
|
28 |
|
fig.set_figheight(2) |
|
29 |
|
ax = fig.add_subplot(111) |
|
30 |
|
ax.sample_box = sample_box |
|
31 |
|
maxes.convergence_diagram(ax) |
|
32 |
|
ax.set_xlim(0, lim) |
|
33 |
|
|
17 |
34 |
|
|
18 |
|
def double_tri_R_plot(fig, sample_box, space): |
|
|
35 |
|
def double_proxy_diagram(fig, sample_box, space, lim=1000): |
|
36 |
|
ax1 = ax = fig.add_subplot(211) |
|
37 |
|
ax.sample_box = sample_box |
|
38 |
|
maxes.convergence_diagram(ax) |
|
39 |
|
ax.set_xlim(0, lim) |
|
40 |
|
ax.set_xlabel('') |
|
41 |
|
|
|
42 |
|
ax = fig.add_subplot(212) |
|
43 |
|
ax.sample_box = sample_box |
|
44 |
|
maxes.convergence_diagram(ax, sources=['box'], apply_proxy=True) |
|
45 |
|
ax.sharex(ax1) |
|
46 |
|
|
|
47 |
|
def double_tri_R_twins_plot(fig, sample_box, space): |
19 |
48 |
ax1 = ax = fig.add_subplot(121) |
ax1 = ax = fig.add_subplot(121) |
20 |
49 |
ax.sample_box = sample_box |
ax.sample_box = sample_box |
21 |
50 |
ax.space = 'R' |
ax.space = 'R' |
22 |
51 |
try: |
try: |
23 |
|
tn_scheme = sample_box.Tri.tn_scheme |
|
|
52 |
|
tn_scheme = sample_box.Tri.tn_scheme |
24 |
53 |
except: |
except: |
25 |
|
import quadpy |
|
26 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
27 |
|
|
|
|
54 |
|
import quadpy |
|
55 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
56 |
|
|
28 |
57 |
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme) |
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme) |
|
58 |
|
ax.set_title(r'$\mathcal{R}$', pad=10) |
29 |
59 |
ax = fig.add_subplot(122) |
ax = fig.add_subplot(122) |
30 |
60 |
ax.sample_box = sample_box |
ax.sample_box = sample_box |
31 |
61 |
ax.space = 'G' |
ax.space = 'G' |
32 |
62 |
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme) |
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme) |
|
63 |
|
ax.set_title(r'$\mathcal{G}$', pad=10) |
33 |
64 |
ax.sharey(ax1) |
ax.sharey(ax1) |
34 |
65 |
|
|
|
66 |
|
def double_tri_R_plot(fig, sample_box, space): |
|
67 |
|
ax1 = ax = fig.add_subplot(121) |
|
68 |
|
ax.sample_box = sample_box |
|
69 |
|
ax.space = 'R' |
|
70 |
|
try: |
|
71 |
|
tn_scheme = sample_box.Tri.tn_scheme |
|
72 |
|
except: |
|
73 |
|
import quadpy |
|
74 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
75 |
|
|
|
76 |
|
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme) |
|
77 |
|
ax.set_title(space_labels[space], pad=10) |
|
78 |
|
ax = fig.add_subplot(122) |
|
79 |
|
ax.sample_box = sample_box |
|
80 |
|
ax.space = 'G' |
|
81 |
|
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme) |
|
82 |
|
ax.set_title(space_labels['G'], pad=10) |
|
83 |
|
|
|
84 |
|
def double_plot(fig, sample_box, space): |
|
85 |
|
#fig.set_figwidth(19/2.54) |
|
86 |
|
ax = fig.add_subplot(121) |
|
87 |
|
ax.sample_box = sample_box[0:100] |
|
88 |
|
ax.space = space |
|
89 |
|
try: |
|
90 |
|
tn_scheme = sample_box.Tri.tn_scheme |
|
91 |
|
except: |
|
92 |
|
import quadpy |
|
93 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
94 |
|
maxes.tri_nodes_plot(ax, tri_space=None, tn_scheme=tn_scheme) |
|
95 |
|
ax.set_title(space_labels[space], pad=10) |
|
96 |
|
ax = fig.add_subplot(122) |
|
97 |
|
ax.sample_box = sample_box[0:200] |
|
98 |
|
ax.space = space |
|
99 |
|
maxes.tri_nodes_plot(ax, tri_space=None, tn_scheme=tn_scheme) |
|
100 |
|
ax.set_title(space_labels[space], pad=10) |
|
101 |
|
|
35 |
102 |
def triple_plot(fig, sample_box, space): |
def triple_plot(fig, sample_box, space): |
36 |
103 |
fig.set_figwidth(19/2.54) |
fig.set_figwidth(19/2.54) |
37 |
104 |
ax = fig.add_subplot(131) |
ax = fig.add_subplot(131) |
38 |
105 |
ax.sample_box = sample_box[0:100] |
ax.sample_box = sample_box[0:100] |
39 |
106 |
ax.space = space |
ax.space = space |
40 |
107 |
try: |
try: |
41 |
|
tn_scheme = sample_box.Tri.tn_scheme |
|
|
108 |
|
tn_scheme = sample_box.Tri.tn_scheme |
42 |
109 |
except: |
except: |
43 |
|
import quadpy |
|
44 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
|
110 |
|
import quadpy |
|
111 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
45 |
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 |
|
ax.set_title(space_labels[space], pad=10) |
46 |
114 |
ax = fig.add_subplot(132) |
ax = fig.add_subplot(132) |
47 |
115 |
ax.sample_box = sample_box[0:200] |
ax.sample_box = sample_box[0:200] |
48 |
116 |
ax.space = space |
ax.space = space |
49 |
117 |
maxes.tri_plot(ax) |
maxes.tri_plot(ax) |
|
118 |
|
ax.set_title(space_labels[space], pad=10) |
50 |
119 |
ax = fig.add_subplot(133) |
ax = fig.add_subplot(133) |
51 |
120 |
ax.sample_box = sample_box |
ax.sample_box = sample_box |
52 |
121 |
ax.space = space |
ax.space = space |
53 |
122 |
maxes.convex_hull_plot(ax) |
maxes.convex_hull_plot(ax) |
|
123 |
|
ax.set_title(space_labels[space], pad=10) |
54 |
124 |
|
|
55 |
125 |
def qhull_under_density(fig, sample_box, space): |
def qhull_under_density(fig, sample_box, space): |
56 |
126 |
from . import _axis3d_margins_patch, _axes3d |
from . import _axis3d_margins_patch, _axes3d |