18
18
*/
19
19
20
20
#include "matrix-plot.h"
21
- #include "MatrixPlotWindow.h"
22
21
23
22
MatrixPlot ::MatrixPlot (int subplotCols , int subplotRows )
24
23
{
@@ -176,15 +175,6 @@ void MatrixPlot::plot1d(Matrix & xMatrix, Matrix & yMatrix){
176
175
177
176
this -> SetOrigin (0 ,0 ,0 );
178
177
179
- //Subplotagem
180
-
181
- /*this->SubPlot(
182
- this->subplotCols,
183
- this->subplotRows,
184
- 0, "");
185
-
186
- this->Axis("xy");*/
187
-
188
178
string color = "" ;
189
179
switch (subplotIndex )
190
180
{
@@ -197,6 +187,9 @@ void MatrixPlot::plot1d(Matrix & xMatrix, Matrix & yMatrix){
197
187
case 2 :
198
188
color = "b" ;
199
189
break ;
190
+ case 3 :
191
+ color = "w" ;
192
+ break ;
200
193
}
201
194
202
195
if (this -> autoRange && subplotIndex == (subplotAmount - 1 ))
@@ -216,88 +209,27 @@ void MatrixPlot::plot1d(Matrix & xMatrix, Matrix & yMatrix){
216
209
217
210
void MatrixPlot ::plotbox (Matrix & referenceMatrix , int subplotIndex )
218
211
{
219
- int matrixRows = referenceMatrix .getRows ();
220
- int matrixCols = referenceMatrix .getCols ();
221
-
222
- mglData matrix_X_coordinates (matrixRows );
223
- mglData matrix_Y_coordinates (matrixRows );
224
-
225
- range matrixRange ;
226
-
227
- float matrixData [matrixRows ][matrixCols ];
228
-
229
- for (int i = 0 ; i < matrixRows ; i ++ )
230
- {
212
+ int matrixPlotRows = referenceMatrix .getRows ();
213
+ int subplotAmount = referenceMatrix .getCols ();
231
214
232
- for (int j = 0 ; j < matrixCols ; j ++ )
233
- {
234
- float dataPoint = referenceMatrix .getMat (i + 1 ,j + 1 );
235
-
236
- if (j == 0 )
237
- {
238
-
239
- //Min_x
240
- try {
241
- if (dataPoint < matrixRange .x_min )
242
- matrixRange .x_min = dataPoint ;
243
- } catch (...) {
244
- matrixRange .x_min = dataPoint ;
245
- }
246
-
247
- //Max_x
248
- try {
249
- if (dataPoint > matrixRange .x_max )
250
- matrixRange .x_max = dataPoint ;
251
- } catch (...) {
252
- matrixRange .x_max = dataPoint ;
253
- }
254
-
255
-
256
- matrix_X_coordinates .a [i ] = dataPoint ;
257
- }
258
- else
259
- {
260
- //Min_x
261
- try {
262
- if (dataPoint < matrixRange .y_min )
263
- matrixRange .y_min = dataPoint ;
264
- } catch (...) {
265
- matrixRange .y_min = dataPoint ;
266
- }
215
+ mglData dataBox (subplotAmount );
267
216
268
- //Max_x
269
- try {
270
- if (dataPoint > matrixRange .y_max )
271
- matrixRange .y_max = dataPoint ;
272
- } catch (...) {
273
- matrixRange .y_max = dataPoint ;
274
- }
275
-
276
- matrix_Y_coordinates .a [i ] = dataPoint ;
277
- }
278
-
279
- }
280
-
281
- }
282
-
283
- this -> SetOrigin (0 ,0 ,0 );
284
-
285
- //Subplotagem
286
-
287
- this -> SubPlot (
288
- this -> subplotCols ,
289
- this -> subplotRows ,
290
- subplotIndex , "" );
217
+ range matrixRange ;
291
218
292
- this -> Axis ("xy" );
219
+ for (int subplotIndex = 0 ; subplotIndex < subplotAmount ; subplotIndex ++ )
220
+ {
221
+ mglData dataItem (matrixPlotRows );
293
222
294
- if ( this -> autoRange )
223
+ for ( int matrixPlotRowIndex = 0 ; matrixPlotRowIndex < matrixPlotRows ; matrixPlotRowIndex ++ )
295
224
{
296
- this -> SetRange ('x' , matrixRange .x_min , matrixRange .x_max );
297
- this -> SetRange ('y' , matrixRange .y_min , matrixRange .y_max );
225
+ float x = referenceMatrix .getMat ((matrixPlotRowIndex + 1 ), (subplotIndex + 1 ));
226
+ dataItem .a [matrixPlotRowIndex ] = x ;
227
+ //dataBox.Set(&x, (long int)matrixPlotRowIndex, (long int)subplotIndex);
298
228
}
229
+ }
299
230
300
- this -> Plot (matrix_X_coordinates , matrix_Y_coordinates );
231
+ this -> Box ();
232
+ this -> BoxPlot (dataBox );
301
233
302
234
}
303
235
0 commit comments