Changeset 3322 for development
- Timestamp:
- Jul 12, 2006, 8:39:02 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
development/pyvolution-1d/quantity.py
r3295 r3322 614 614 615 615 616 def newLinePlot(title='Simple Plot'): 617 import Gnuplot 618 g = Gnuplot.Gnuplot() 619 g.title(title) 620 g('set data style linespoints') 621 g.xlabel('x') 622 g.ylabel('y') 623 return g 624 625 def linePlot(g,x,y): 626 import Gnuplot 627 g.plot(Gnuplot.PlotItems.Data(x.flat,y.flat)) 628 629 630 631 616 632 617 633 if __name__ == "__main__": 618 634 from domain import Domain 619 635 from Numeric import arange 636 620 637 points1 = [0.0, 1.0, 2.0, 3.0] 621 638 vertex_values = [[1.0,2.0],[4.0,5.0],[-1.0,2.0]] … … 641 658 print Q1.centroid_values 642 659 643 def fun(x): 644 return x**2 645 660 class FunClass: 661 def __init__(self,value): 662 self.value = value 663 664 def __call__(self,x): 665 return self.value*(x**2) 666 667 668 fun = FunClass(1.0) 646 669 Q1.set_values(fun,'vertices') 647 670 … … 660 683 Q1.limit() 661 684 662 from pylab import * 663 plot(Xc,Qc) 664 665 show() 685 g1 = newLinePlot('plot 1') 686 linePlot(g1,Xc,Qc) 666 687 667 688 points2 = arange(10) 668 669 670 689 D2 = Domain(points2) 671 690 … … 674 693 Xc = Q2.domain.vertices 675 694 Qc = Q2.vertex_values 676 plot(Xc,Qc) 677 678 show() 695 696 g2 = newLinePlot('plot 2') 697 linePlot(g2,Xc,Qc) 698 699 700 679 701 Q2.extrapolate_second_order() 680 702 Q2.limit() … … 685 707 print Qc 686 708 687 plot(Xc,Qc) 688 689 show() 690 691 692 693 694 695 696 697 709 g3 = newLinePlot('plot 3') 710 linePlot(g3,Xc,Qc) 711 raw_input('press return') 712 713 714 for i in range(10): 715 fun = FunClass(i/10.0) 716 Q2.set_values(fun,'vertices') 717 Qc = Q2.vertex_values 718 linePlot(g3,Xc,Qc) 719 720 raw_input('press return') 721 722 723 724 725 726 727
Note: See TracChangeset
for help on using the changeset viewer.