mraptor - In addition to Craig's guidance, there may be additional advice to be had for your problem. For example, if you are producing one data point per second, then I suspect that Gnuplot, PGPLOT, and Prima would all work fine. PLplot may also work fine for this, though I cannot recall how smoothly it handles updates. Once upon a time I used a combination of PLplot and OpenGL to get animated plots, which was painful enough that I wrote PDL::Graphics::Prima. Long story short, if you have low data production rates, you should go with whichever library produces output that you prefer.
If you're generating 1000 data points per second and want to plot as it's generated, you should probably use Prima, as that sort of application motivated the library in the first place. Also, if you anticipate wanting to interact with the data visualization in some way, Prima will provide a much easier transition to a GUI application than the others. There are some tweaks you should use if you want really efficient plot updating at high data rates. First of all, don't use autoscaling. Autoscaling is really nice for having the plot Do What You Mean, but the calculations are pretty involved and can kill fast refresh rates. I've meant for some time to re-implement the autoscaling calculations in C, as well as provide a couple of different algorithms for varying speeds and accuracy, but it's not been a high enough priority. Instead of using autoscaling, you can set the min/max for your plots based on your data's min/max (which you have to evaluate every time you add a new piece of data), and while this may crop the symbols used to plot the data, it will at least be drawn much smoother. If the cropping bothers you, you can pad the values of the min and max a little. For an example of how this works, check out the animated plot example<https://github.com/run4flat/PDL-Graphics-Prima/blob/master/examples/animated.pl>, which smoothly swaps the sign of the data's x-values. If you only want to display, say, the last five seconds worth of data, you can use techniques illustrated in the ticker example<https://github.com/run4flat/PDL-Graphics-Prima/blob/master/examples/ticker.pl>. This utilizes the bad-value handling of PDL::Graphics::Prima for the initial transient, and also adds a couple of methods to the PDL namespace that let you use a piddle as though it were a buffer. This is what you might call an elegant hack to provide an efficient solution. :-) I have not yet written an Animation interface to PDL::Graphics::Prima because I simply haven't studied what would be helpful for such an interface. I am open to ideas, of course, so as you play around with this, feel free to share what you find. David On Wed, Oct 23, 2013 at 4:45 PM, mraptor <[email protected]> wrote: > Prima look nice, thanks will try that. > (I'm currently using PGPLOT) > > On Wed, Oct 23, 2013 at 4:04 PM, Craig DeForest > <[email protected]> wrote: > > Yes. > > > > There are four major plotting packages in PDL, and each one can do what > you want. > > > > David Mertens' PDL::Graphics::Prima is insanely zippy and is therefore > pretty awesome for rapid, interactive displays. It's designed for > interactive display, but can send output to a postscript device when you're > finished doing your calculation. > > > > PDL::Graphics::PGPLOT and PDL::Graphics::PLPlot are the legacy plotters. > Both have means of doing what you want. PGPLOT produces not-as-pretty > output but is fast. PLPlot produces prettier output and is comparably fast > for line plots, but for images it is insanely slow (it'll remind you of > being back in 1992). > > > > PDL::Graphics::Gnuplot is optimized for hardcopy output and is therefore > not as fast as PGPLOT - but it can do interactive stuff and has a clean way > to dump to a file. > > > > Since I like the look of the Gnuplot output, the way I do stuff like > you're describing is something like this: > > > > use PDL::Graphics::Gnuplot; > > $w=gpwin( wxt, size=>[8,8], enhanced=>1 ); > > > > for $i(1..1000) { > > iterate_my_data(); > > $w->plot( <some commands> ); > > } > > > > $w->output( pdf, out=>"my_nice_file.pdf",size=>[6,4,'in'] ); > > $w->replot; > > $w->close; > > > > On Oct 23, 2013, at 1:53 PM, mraptor <[email protected]> wrote: > > > >> hi guys, > >> > >> Can I open a graph/image and plot the data on the screen as I'm > >> calculating it... on the fly ? > >> And when I'm done to save it to file ? > >> > >> thanks > >> > >> _______________________________________________ > >> Perldl mailing list > >> [email protected] > >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > >> > > > > _______________________________________________ > Perldl mailing list > [email protected] > http://mailman.jach.hawaii.edu/mailman/listinfo/perldl > -- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
