@@ -14,10 +14,10 import datetime | |||||
14 |
|
14 | |||
15 | #import plplot |
|
15 | #import plplot | |
16 | import matplotlib as mpl |
|
16 | import matplotlib as mpl | |
17 |
|
|
17 | mpl.use('TKAgg') | |
18 | import matplotlib.pyplot as plt |
|
18 | import matplotlib.pyplot as plt | |
19 |
|
19 | |||
20 |
|
|
20 | import scitools.numpyutils as sn | |
21 |
|
21 | |||
22 | def cmap1_init(colormap='gray'): |
|
22 | def cmap1_init(colormap='gray'): | |
23 |
|
23 | |||
@@ -1131,81 +1131,81 if __name__ == '__main__': | |||||
1131 | linearObj.plot(indexplot, x, y, type) |
|
1131 | linearObj.plot(indexplot, x, y, type) | |
1132 |
|
1132 | |||
1133 | linearObj.refresh() |
|
1133 | linearObj.refresh() | |
1134 | linearObj.show() |
|
1134 | # linearObj.show() | |
1135 |
|
1135 | |||
1136 |
|
1136 | |||
1137 |
|
|
1137 | """ | |
1138 |
|
|
1138 | Ejemplo2 | |
1139 |
|
|
1139 | """ | |
1140 | # |
|
1140 | ||
1141 |
|
|
1141 | # make these smaller to increase the resolution | |
1142 |
|
|
1142 | dx, dy = 0.05, 0.05 | |
1143 |
|
|
1143 | x = numpy.arange(-3.0, 3.0001, dx) | |
1144 |
|
|
1144 | y = numpy.arange(-2.0, 2.0001, dy) | |
1145 |
|
|
1145 | # X,Y = numpy.meshgrid(x, y) | |
1146 |
|
|
1146 | X,Y = sn.ndgrid(x, y) | |
1147 |
|
|
1147 | Z = (1- X/2 + X**5 + Y**3)*numpy.exp(-X**2-Y**2) | |
1148 |
|
|
1148 | ||
1149 |
|
|
1149 | # Creating Object | |
1150 |
|
|
1150 | indexPlot = 2 | |
1151 |
|
|
1151 | nsubplot = 1 | |
1152 |
|
|
1152 | winTitle = "mi grafico pcolor" | |
1153 |
|
|
1153 | colormap = "br_green" | |
1154 |
|
|
1154 | showColorbar = True | |
1155 |
|
|
1155 | showPowerProfile = False | |
1156 |
|
|
1156 | XAxisAsTime = False | |
1157 |
|
|
1157 | ||
1158 |
|
|
1158 | subplotTitle = "subplot no. " | |
1159 |
|
|
1159 | xlabel = "" | |
1160 |
|
|
1160 | ylabel = "" | |
1161 |
|
|
1161 | ||
1162 |
|
|
1162 | xmin = -3.0 | |
1163 |
|
|
1163 | xmax = 3.0 | |
1164 |
|
|
1164 | ymin = -2.0 | |
1165 |
|
|
1165 | ymax = 2.0 | |
1166 |
|
|
1166 | zmin = -0.3 | |
1167 |
|
|
1167 | zmax = 1.0 | |
1168 |
|
|
1168 | ||
1169 |
|
|
1169 | isPlotIni = False | |
1170 |
|
|
1170 | isPlotConfig = False | |
1171 |
|
|
1171 | ntimes = 10 | |
1172 |
|
|
1172 | ||
1173 |
|
|
1173 | ||
1174 |
|
|
1174 | for i in range(ntimes): | |
1175 |
|
|
1175 | ||
1176 |
|
|
1176 | # Instancia del objeto | |
1177 |
|
|
1177 | if not(isPlotConfig): | |
1178 |
|
|
1178 | pcolorObj = PcolorPlot(indexPlot, nsubplot, winTitle, colormap, showColorbar, showPowerProfile, XAxisAsTime) | |
1179 |
|
|
1179 | isPlotConfig = True | |
1180 |
|
|
1180 | ||
1181 |
|
|
1181 | # Crea los subplots | |
1182 |
|
|
1182 | if not(isPlotIni): | |
1183 |
|
|
1183 | for index in range(nsubplot): | |
1184 |
|
|
1184 | indexplot = index + 1 | |
1185 |
|
|
1185 | title = subplotTitle + '%d'%indexplot | |
1186 |
|
|
1186 | subplot = index | |
1187 |
|
|
1187 | pcolorObj.createObjects(indexplot,xmin,xmax,ymin,ymax,zmin,zmax,title,xlabel,ylabel) | |
1188 |
|
|
1188 | isPlotIni = True | |
1189 |
|
|
1189 | ||
1190 |
|
|
1190 | # Inicializa el grafico en cada iteracion | |
1191 |
|
|
1191 | pcolorObj.setFigure(indexPlot) | |
1192 |
|
|
1192 | pcolorObj.setNewPage("") | |
1193 |
|
|
1193 | ||
1194 |
|
|
1194 | for index in range(nsubplot): | |
1195 |
|
|
1195 | subplot = index | |
1196 |
|
|
1196 | pcolorObj.iniPlot(subplot+1) | |
1197 |
|
|
1197 | ||
1198 |
|
|
1198 | #plotea los datos | |
1199 |
|
|
1199 | for channel in range(nsubplot): | |
1200 |
|
|
1200 | data = Z+0.1*numpy.random.randn(len(x),len(y)) | |
1201 |
|
|
1201 | pcolorObj.plot(channel+1, x, y, data) | |
1202 |
|
|
1202 | ||
1203 |
|
|
1203 | pcolorObj.refresh() | |
1204 |
|
|
1204 | ||
1205 |
|
|
1205 | # pcolorObj.closePage() #descomentar esta linea para mas iteraciones | |
1206 |
|
|
1206 | ||
1207 |
|
|
1207 | time.sleep(1) | |
1208 |
|
|
1208 | ||
1209 |
|
|
1209 | pcolorObj.show() | |
1210 | # |
|
1210 | ||
1211 |
|
|
1211 | print "end" No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now