1818 */
1919
2020#include "matrix-plot.h"
21- #include "MatrixPlotWindow.h"
2221
2322MatrixPlot ::MatrixPlot (int subplotCols , int subplotRows )
2423{
@@ -176,15 +175,6 @@ void MatrixPlot::plot1d(Matrix & xMatrix, Matrix & yMatrix){
176175
177176 this -> SetOrigin (0 ,0 ,0 );
178177
179- //Subplotagem
180-
181- /*this->SubPlot(
182- this->subplotCols,
183- this->subplotRows,
184- 0, "");
185-
186- this->Axis("xy");*/
187-
188178 string color = "" ;
189179 switch (subplotIndex )
190180 {
@@ -197,6 +187,9 @@ void MatrixPlot::plot1d(Matrix & xMatrix, Matrix & yMatrix){
197187 case 2 :
198188 color = "b" ;
199189 break ;
190+ case 3 :
191+ color = "w" ;
192+ break ;
200193 }
201194
202195 if (this -> autoRange && subplotIndex == (subplotAmount - 1 ))
@@ -216,88 +209,27 @@ void MatrixPlot::plot1d(Matrix & xMatrix, Matrix & yMatrix){
216209
217210void MatrixPlot ::plotbox (Matrix & referenceMatrix , int subplotIndex )
218211{
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 ();
231214
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 );
267216
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 ;
291218
292- this -> Axis ("xy" );
219+ for (int subplotIndex = 0 ; subplotIndex < subplotAmount ; subplotIndex ++ )
220+ {
221+ mglData dataItem (matrixPlotRows );
293222
294- if ( this -> autoRange )
223+ for ( int matrixPlotRowIndex = 0 ; matrixPlotRowIndex < matrixPlotRows ; matrixPlotRowIndex ++ )
295224 {
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);
298228 }
229+ }
299230
300- this -> Plot (matrix_X_coordinates , matrix_Y_coordinates );
231+ this -> Box ();
232+ this -> BoxPlot (dataBox );
301233
302234}
303235
0 commit comments