@@ -243,6 +243,10 def setStrm(indexPlot): | |||||
243 |
|
243 | |||
244 | def plFlush(): |
|
244 | def plFlush(): | |
245 | plplot.plflush() |
|
245 | plplot.plflush() | |
|
246 | ||||
|
247 | def plShow(): | |||
|
248 | plplot.plspause(True) | |||
|
249 | plplot.plend() | |||
246 |
|
250 | |||
247 | def setPlTitle(pltitle,color, szchar=0.7): |
|
251 | def setPlTitle(pltitle,color, szchar=0.7): | |
248 | setSubpages(1, 0) |
|
252 | setSubpages(1, 0) | |
@@ -510,6 +514,9 class LinearPlot: | |||||
510 |
|
514 | |||
511 | return xpos,ypos |
|
515 | return xpos,ypos | |
512 |
|
516 | |||
|
517 | def show(self): | |||
|
518 | plShow() | |||
|
519 | ||||
513 | def refresh(self): |
|
520 | def refresh(self): | |
514 | plFlush() |
|
521 | plFlush() | |
515 |
|
522 | |||
@@ -536,11 +543,18 class LinearPlot: | |||||
536 | clearData(linearObj) |
|
543 | clearData(linearObj) | |
537 |
|
544 | |||
538 | else: |
|
545 | else: | |
|
546 | if type.lower() == 'simple': | |||
|
547 | linearObj.setXYData(x,y,"real") | |||
539 | if type.lower() == 'power': |
|
548 | if type.lower() == 'power': | |
540 | linearObj.setXYData(x,abs(y),"real") |
|
549 | linearObj.setXYData(x,abs(y),"real") | |
541 | if type.lower() == 'iq': |
|
550 | if type.lower() == 'iq': | |
542 | linearObj.setXYData(x,y,"complex") |
|
551 | linearObj.setXYData(x,y,"complex") | |
543 |
|
552 | |||
|
553 | if type.lower() == 'simple': | |||
|
554 | colline = 9 | |||
|
555 | linearObj.basicLineTimePlot(x, y, xmin, xmax, ymin, ymax, colline) | |||
|
556 | linearObj.setXYData(x,y,"real") | |||
|
557 | ||||
544 | if type.lower() == 'power': |
|
558 | if type.lower() == 'power': | |
545 | colline = 9 |
|
559 | colline = 9 | |
546 | linearObj.basicLineTimePlot(x, abs(y), xmin, xmax, ymin, ymax, colline) |
|
560 | linearObj.basicLineTimePlot(x, abs(y), xmin, xmax, ymin, ymax, colline) | |
@@ -1015,4 +1029,50 class RtiPlot: | |||||
1015 | savePlplot(filename,width,hei) |
|
1029 | savePlplot(filename,width,hei) | |
1016 |
|
1030 | |||
1017 | def refresh(self): |
|
1031 | def refresh(self): | |
1018 | plFlush() No newline at end of file |
|
1032 | plFlush() | |
|
1033 | ||||
|
1034 | if __name__ == '__main__': | |||
|
1035 | ||||
|
1036 | #Setting the signal | |||
|
1037 | fs = 8000 | |||
|
1038 | f0 = 200 | |||
|
1039 | f1 = 400 | |||
|
1040 | T = 1./fs | |||
|
1041 | x = numpy.arange(160) | |||
|
1042 | y1 = numpy.sin(2*numpy.pi*f0*x*T) | |||
|
1043 | y2 = numpy.sin(2*numpy.pi*f1*x*T) | |||
|
1044 | signalList = [y1,y2] | |||
|
1045 | ||||
|
1046 | xmin = numpy.min(x) | |||
|
1047 | xmax = numpy.max(x) | |||
|
1048 | ymin = numpy.min(y1) | |||
|
1049 | ymax = numpy.max(y1) | |||
|
1050 | ||||
|
1051 | # Creating Object | |||
|
1052 | indexPlot = 1 | |||
|
1053 | nsubplot = 2 | |||
|
1054 | winTitle = "mi grafico v1" | |||
|
1055 | ||||
|
1056 | subplotTitle = "subplot - No." | |||
|
1057 | xlabel = "" | |||
|
1058 | ylabel = "" | |||
|
1059 | ||||
|
1060 | linearObj = LinearPlot(indexPlot,nsubplot,winTitle) | |||
|
1061 | ||||
|
1062 | #Config SubPlots | |||
|
1063 | for subplot in range(nsubplot): | |||
|
1064 | indexplot = subplot + 1 | |||
|
1065 | title = subplotTitle + '%d'%indexplot | |||
|
1066 | linearObj.setup(indexplot, xmin, xmax, ymin, ymax, title, xlabel, ylabel) | |||
|
1067 | ||||
|
1068 | #Plotting | |||
|
1069 | type = "simple" | |||
|
1070 | for subplot in range(nsubplot): | |||
|
1071 | indexplot = subplot + 1 | |||
|
1072 | y = signalList[subplot] | |||
|
1073 | linearObj.plot(indexplot, x, y, type) | |||
|
1074 | ||||
|
1075 | linearObj.refresh() | |||
|
1076 | linearObj.show() | |||
|
1077 | ||||
|
1078 | print "end" No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now