Code covered by the BSD License  

Highlights from
Plot (Big)

4.71429

4.7 | 7 ratings Rate this file 127 Downloads (last 30 days) File Size: 12.7 KB File ID: #40790
image thumbnail

Plot (Big)

by Tucker McClure

 

15 Mar 2013

Makes MATLAB's line plots much faster.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

This simple tool intercepts data going into a plot and reduces it to the smallest possible set that looks identical given the number of pixels available on the screen. It then updates the data as a user zooms or pans. This is useful when a user must plot a very large amount of data and explore it visually.

This works with MATLAB's built-in line plot functions, allowing the functionality of those to be preserved.

Instead of:

plot(t, x);

One could use:

reduce_plot(t, x);

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File  
Everyone's Tags
big data(2), line plot, line plot reducer, pick of the week, potw
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
24 Jun 2013 Tucker McClure

Excellent point, dberm22.

Kelly, good suggestions. Plotting detailed coastlines would be a great use case for improvement! In the meantime, if you're displaying landmasses with patches, do you know about reducepatch? This could be used (pre-rendering) for multiple levels of fidelity.

Thanks to all for the ratings!

24 Jun 2013 dberm22

I did my own testing on this for speed, and at first I was tempted to give this 1 star because the tic-toc results show that reduce_plot() takes twice as long to create the plot than the regular plot() does. Don't be fooled by this! tic-toc does not take into account how long it takes to show the plot on the screen, for which reduce_plot() is extremely efficient. Also, with the such large amount of numbers I was using, zooming was rendered impossible with the normal plot() function. reduce_plot() was a life-saver in those scenarios.

plot() = 1.66s (create plot) + 7.54s (show on screen) = 9s total (& cannot zoom)
reduce_plot = 3.65s (create plot) + .8s (show on screen) = 4.45s total + .7s (zooming) = priceless

18 Jun 2013 Kelly Kearney

Very useful function. However, it currently only works if your data describes a function (in the mathematical sense of one y per x). It would be great if it could be extended to work when the y axis is the independent variable, or for lines defining polygons (for example, I originally stumbled on this looking for a more efficient way to plot high-resolution coastlines while allowing lots of efficient zooming and panning).

12 Jun 2013 Jorge  
07 Jun 2013 Brett Shoelson

Awesome!

10 Apr 2013 Adam Filion  
03 Apr 2013 Doug Hull  
25 Mar 2013 Michael  

Contact us