Example of data export and import.
MGL code:
new a 100 100 'x^2*y':new b 100 100 export a 'test_data.png' 'BbcyrR' -1 1 import b 'test_data.png' 'BbcyrR' -1 1 subplot 2 1 0 '':title 'initial':box:dens a subplot 2 1 1 '':title 'imported':box:dens b
C++ code:
void smgl_export(mglGraph *gr) // basic data operations { mglData a(100,100), b; gr->Fill(a,"x^2*y"); a.Export("test_data.png","BbcyrR"); b.Import("test_data.png","BbcyrR",-1,1); gr->SubPlot(2,1,0,""); gr->Title("initial"); gr->Box(); gr->Dens(a); gr->SubPlot(2,1,1,""); gr->Title("imported"); gr->Box(); gr->Dens(b); }