100+ | Another relatively easy solution is to use EasyBMP. (I know, I know--I'm biased. ;)) You can run your program, and then spit the output to a BMP file at the end. (Since those are easy enough to view.) Then, you don't have to bother with writing a GUI. At the end of the program, suppose you have a list of N (x[i], y[i]) values from your calculation. The very easiest way to do this: sample code: #include 'EasyBMP.h' .... // find the min and max data values of y: double max_y = -99999; double min_y = 99999; for( int i=0 ; i < N ; i++ ) { if( y[i] > max_y ){ max_y = y[i]; } if( y[i] < min_y ){ min_y = y[i]; } } // initialize the image BMP Output; Output.SetSize( N, N); RGBApixel PlotColor; PlotColor.Red = 0; PlotColor.Green = 0; PlotColor.Blue = 0; // plot each point for( int i=0 ; i < N ; i++ ) { // map the height to the appropriate pixel. // step 1: scale the y-value between 0 and 1 double scaled_y = ( y[i] - y_min ) / ( y_max - y_min ); // step 2: map that to the pixel range: 0 to height-1 int pixel_y = (int) ( (Output.TellHeight() - 1)*scaled_y ); // step 3: remember that on an image, the (0,0) pixel is the top // right corner! pixel_y = Output.TellHeight()-1 - pixel_y; // color pixel (i,pixel_y) black *Output(i,pixel_y) = PlotColor; } // write the file output Output.WriteToFile( 'output.bmp' ); // you're done. view the output.bmp in your // favorite image viewer. More commentary: Generally, though, I believe that scientific computation and post processing should be separate. You want your number cruncher to be as quick and efficient as possible. Also, you don't want to have to rerun your program when you desire a different type of plot. When you start tying windows and computation together, you run into the mess where you're dependent upon one compiler or operating system. (This can cause problems when you need to run your simulation many times and would like to use a linux cluster, but somebody decided to use MFC to make plots while running the simulation.) As such, it's ideal to have your program run once, save data, and exit, and then manipulate the data afterwards. (You don't even have to process that data on the same platform.) I do, however, find it useful to generate quick snapshots while running a simulation, to make it easier to check the status without the overhead of loading up matlab, mathematica, etc. Lastly, if you'd like an even smoother plot, EasyBMP has addons, including line drawing. So, you could connect data points with lines. That addon package also has a simple font, which you could use to label axes. I use it for my own cancer simulations and visualizations, such as here: my cancer multimedia page To make axis labeling easier, I'd recommend doing the steps above to make just the plot, and then pasting it into a larger image where you do the labeling. -- Paul |