Changeset 4845
- Timestamp:
- Nov 22, 2007, 1:54:53 PM (17 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/interpolate.py
r4839 r4845 565 565 # Plot boundary and interpolation points 566 566 # FIXME (Jane): Here's a beginning towards plotting 567 #if verbose is True: 568 # from anuga.utilities.polygon import plot_polygons 569 # from pylab import ion, hold, plot, axis, figure, legend, savefig, xlabel, ylabel, title, close 570 # plot_polygons([mesh_boundary_polygon], 571 # verbose=verbose) 572 573 # Add cloud of interpolation points to polygon plot 574 # x = interpolation_points[:,0] 575 # y = interpolation_points[:,1] 576 # plot(x, y, 'b.') 577 # title('Interpolation function: Polygon and interpolation points') 578 567 if verbose is True: 568 from anuga.utilities.polygon import plot_polygons_points 569 title = 'Interpolation function: Polygon and interpolation points' 570 plot_polygons_points([mesh_boundary_polygon,interpolation_points], 571 ['line','point'],label=title,verbose=verbose) 579 572 580 573 m = len(self.interpolation_points) -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r4833 r4845 4929 4929 # domain2) 4930 4930 Bf = Field_boundary(domain1.get_name() + '.' + domain1.format, 4931 domain2, mean_stage=mean_stage )4931 domain2, mean_stage=mean_stage, verbose=False) 4932 4932 4933 4933 domain2.set_boundary({'right':Br, 'bottom':Br, 'diagonal':Bf}) … … 5103 5103 # domain2) 5104 5104 Bf = Field_boundary(domain1.get_name() + '.' + domain1.format, 5105 domain2, mean_stage=1 )5105 domain2, mean_stage=1, verbose=True) 5106 5106 5107 5107 domain2.set_boundary({'right':Br, 'bottom':Br, 'diagonal':Bf}) -
anuga_core/source/anuga/utilities/polygon.py
r4769 r4845 341 341 return abs(poly_area/2) 342 342 343 def plot_polygons (polygons, figname=None, verbose=False):343 def plot_polygons_points(polygons_points, style=None, figname=None, label=None, verbose=False): 344 344 345 345 """ Take list of polygons and plot. … … 348 348 349 349 polygons - list of polygons 350 351 style - style list corresponding to each polygon 350 352 351 353 figname - name to save figure to 354 355 label - title for plot 352 356 353 357 Outputs: … … 357 361 """ 358 362 359 from pylab import ion, hold, plot, axis, figure, legend, savefig, xlabel, ylabel, title, close 360 361 assert type(polygons ) == list,\362 'input must be a list of polygons '363 from pylab import ion, hold, plot, axis, figure, legend, savefig, xlabel, ylabel, title, close, title 364 365 assert type(polygons_points) == list,\ 366 'input must be a list of polygons and/or points' 363 367 364 368 ion() … … 369 373 miny = 1e10 370 374 maxy = 0.0 371 372 for polygon in polygons: 373 x, y = poly_xy(polygon) 375 376 if label is None: label = '' 377 378 n = len(polygons_points) 379 if style is None: 380 style_type = 'line' 381 style = [] 382 for i in range(n): 383 style.append(style_type) 384 385 for i, item in enumerate(polygons_points): 386 x, y = poly_xy(item) 374 387 if min(x) < minx: minx = min(x) 375 388 if max(x) > maxx: maxx = max(x) 376 389 if min(y) < miny: miny = min(y) 377 390 if max(y) > maxy: maxy = max(y) 378 plot(x,y,'r-') 391 if style[i] is 'line': 392 plot(x,y,'b-') 393 else: 394 plot(x,y,'r.') 379 395 xlabel('x') 380 396 ylabel('y') 381 382 if figname is not None: 397 title(label) 398 399 if figname is not None: 383 400 savefig(figname) 384 401 else: 385 raw_input('Press a key to continue')402 savefig('test_image') 386 403 387 404 close('all')
Note: See TracChangeset
for help on using the changeset viewer.