File mplot/mfigs.py changed (mode: 100644) (index 2e4c4c5..e84d507) |
7 |
7 |
|
|
8 |
8 |
|
|
9 |
9 |
import numpy as np |
import numpy as np |
|
10 |
|
from . import mart |
10 |
11 |
from . import maxes |
from . import maxes |
11 |
12 |
from . import maxes3d |
from . import maxes3d |
12 |
13 |
from matplotlib import ticker |
from matplotlib import ticker |
|
... |
... |
from matplotlib import ticker |
15 |
16 |
__all__ = [ |
__all__ = [ |
16 |
17 |
'convergence_diagram', 'convergence_legend', 'double_proxy_diagram', |
'convergence_diagram', 'convergence_legend', 'double_proxy_diagram', |
17 |
18 |
'four_branch_convergence', 'beta_diagram', 'double_diagram', 'suspension_3d', |
'four_branch_convergence', 'beta_diagram', 'double_diagram', 'suspension_3d', |
18 |
|
'double_tri_R_plot', 'double_tri_R_twins_plot', 'double_plot', |
|
|
19 |
|
'double_tri_R_plot', 'double_tri_R_twins_plot', 'double_plot', 'G_U_distortion', |
19 |
20 |
'double_pprod_R_plot', 'double_mprod_R_plot', |
'double_pprod_R_plot', 'double_mprod_R_plot', |
20 |
21 |
'triple_plot', 'triple_wide', 'triple_wide_50_100', 'triple_plot_50_100', |
'triple_plot', 'triple_wide', 'triple_wide_50_100', 'triple_plot_50_100', |
21 |
22 |
'triple_nodes_plot', 'triple_wide_25_50', |
'triple_nodes_plot', 'triple_wide_25_50', |
|
... |
... |
def double_tri_R_plot(fig, sample_box, space): |
229 |
230 |
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme, nrid=2000, |
maxes.tri_nodes_plot(ax, tri_space='R', tn_scheme=tn_scheme, nrid=2000, |
230 |
231 |
ms=1.5, mew=0.4, lw=0.35, linewidths=linewidths) |
ms=1.5, mew=0.4, lw=0.35, linewidths=linewidths) |
231 |
232 |
ax.set_title(space_labels['G'], pad=10) |
ax.set_title(space_labels['G'], pad=10) |
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
|
237 |
|
def G_U_distortion(fig, sample_box, space): |
|
238 |
|
try: |
|
239 |
|
tn_scheme = sample_box.Tri.tn_scheme |
|
240 |
|
except: |
|
241 |
|
import quadpy |
|
242 |
|
tn_scheme = quadpy.tn.grundmann_moeller(sample_box.nvar, 5) |
|
243 |
|
ms=3 |
|
244 |
|
mew=0.6 |
|
245 |
|
lw=0.7 |
|
246 |
|
linewidths=[0.7, 0.5, 0.4, 0.3, 0.2, 0.1] |
|
247 |
|
nrid=100 |
|
248 |
|
|
|
249 |
|
from .. import simplex as six |
|
250 |
|
|
|
251 |
|
|
|
252 |
|
def _draw_nodes(*args, **kwargs): |
|
253 |
|
# callback's signature: sx, indices=, simplex=, nodes=, cell_stats= |
|
254 |
|
# positional "sx" is Tri object itself |
|
255 |
|
# "indices" are numbers of simplex vertices |
|
256 |
|
# "simplex" are vertices itself |
|
257 |
|
# "nodes" is what we really want to draw |
|
258 |
|
|
|
259 |
|
event = kwargs['cell_stats']['event'] |
|
260 |
|
|
|
261 |
|
if event == 'mix': |
|
262 |
|
color = (149/255, 173/255, 1, 0.7) |
|
263 |
|
mart.plot_sample(ax1, kwargs['nodes'], ls='', marker='.',\ |
|
264 |
|
mew=0, mfc=color, ms=2.8, alpha=0.5, rasterized=True) |
|
265 |
|
mart.plot_sample(ax, kwargs['nodes'], ls='', marker='.',\ |
|
266 |
|
mew=0, mfc=color, ms=2.8, alpha=0.5, rasterized=True) |
|
267 |
|
|
|
268 |
|
|
|
269 |
|
Tri = six.JustCubatureTriangulation(sample_box, tn_scheme=tn_scheme, \ |
|
270 |
|
tri_space='U', issi=None,\ |
|
271 |
|
weighting_space=None, \ |
|
272 |
|
incremental=False,\ |
|
273 |
|
on_add_simplex=_draw_nodes,\ |
|
274 |
|
on_delete_simplex=None) |
|
275 |
|
|
|
276 |
|
|
|
277 |
|
ax1 = ax = fig.add_subplot(121) |
|
278 |
|
ax.sample_box = sample_box |
|
279 |
|
ax.space = 'G' |
|
280 |
|
ax.set_aspect(1) |
|
281 |
|
ax.set_box_aspect(1) |
|
282 |
|
ax.margins(0) |
|
283 |
|
ax.set_title(space_labels[ax.space])#, pad=10) |
|
284 |
|
x_label="$x_1$"; y_label="$x_2$" |
|
285 |
|
ax.set_xlabel(x_label) |
|
286 |
|
ax.set_ylabel(y_label) |
|
287 |
|
mart.tri_plot(ax, Tri=Tri, color="#B2B2B2", lw=lw/1.4, zorder=100, rasterized=True) |
|
288 |
|
mart.plot_points(ax, ms=ms, mew=mew, zorder=100500) |
|
289 |
|
mart.number_points(ax, ha="left", va="bottom", zorder=1005000) |
|
290 |
|
try: |
|
291 |
|
mart.plot_boundaries(ax, lw=lw, zorder=1050, nrod=nrid) |
|
292 |
|
except: |
|
293 |
|
pass |
|
294 |
|
|
|
295 |
|
ax = fig.add_subplot(122) |
|
296 |
|
ax.sample_box = sample_box |
|
297 |
|
ax.space = 'U' |
|
298 |
|
ax.set_aspect(1) |
|
299 |
|
ax.set_box_aspect(1) |
|
300 |
|
ax.margins(0) |
|
301 |
|
ax.set_title(space_labels[ax.space])#, pad=10) |
|
302 |
|
ax.set_xlabel(x_label) |
|
303 |
|
#ax.set_ylabel(y_label) |
|
304 |
|
mart.triplot(ax, color="#B2B2B2", lw=lw/1.4, zorder=100) |
|
305 |
|
mart.plot_points(ax, ms=ms, mew=mew, zorder=100500) |
|
306 |
|
mart.number_points(ax, ha="left", va="bottom", zorder=1005000) |
|
307 |
|
try: |
|
308 |
|
mart.plot_boundaries(ax, lw=lw, zorder=1050, nrod=nrid) |
|
309 |
|
except: |
|
310 |
|
pass |
|
311 |
|
|
|
312 |
|
Tri.integrate() |
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
232 |
316 |
|
|
233 |
317 |
def double_plot(fig, sample_box, space, lim=100): |
def double_plot(fig, sample_box, space, lim=100): |
234 |
318 |
#fig.set_figwidth(19/2.54) |
#fig.set_figwidth(19/2.54) |