better way to visualize profile data
Mostrar comentarios más antiguos
I have data from a sensor that performs vertical profiles in the water (about 8 an hour) taking measurements on the order of a second. To visualize the profile data, I have been plotting time on the x and depth on the y and then coloring the data points with the actual variable being measured using the following code:
scatter(time,depth,3,variable,'filled').
Because of the high resolution of data points, the color is pretty much continuous once you plot about a day or more. However, using the colored scatter plot is VERY slow and it takes a full minute to plot about 12 hours worth of data. I would like to plot longer time intervals (typically a day or two, but sometimes up to a month) but this just isn't possible the way I am going about it now.
Does anyone have a suggestion for an alternate approach to visualizing this data?
I am fairly new to matlab and self-taught so please keep that in mind when responding.
Your help will be truly appreciated!! Thanks, Sarah
1 comentario
Sarah
el 3 de En. de 2012
Respuestas (4)
the cyclist
el 15 de Dic. de 2011
If the data are pretty smooth, you could plot only every 10th or 100th value:
>> scatter(time(1:10:end),depth(1:10:end), ...)
Seems strange that it is so slow, though. How many points total are you plotting? Are you sure it is the plotting that is slow, as opposed to processing?
4 comentarios
Walter Roberson
el 15 de Dic. de 2011
12 hours times 60 minutes per hour times 60 seconds per minute is 43200 time points. If the "about 8 an hour" means 8 samples per second, that would be more than 345000 points per graph.
Each circle is drawn as an individual patch object. That's a *lot* of graphics objects for MATLAB, which is never happy with lots and lots of handles.
the cyclist
el 15 de Dic. de 2011
I had been thinking, "a million points will plot in the blink of an eye for me". I was failing to appreciate that each was a separate object in this case. Lots, indeed.
Sarah
el 15 de Dic. de 2011
Walter Roberson
el 15 de Dic. de 2011
That does sound odd, Sarah.
Sean de Wolski
el 15 de Dic. de 2011
0 votos
Look into using mesh with x/y axes for time/depth and height instead of color. Provide a small set of sample data and we can help more.
3 comentarios
Sarah
el 15 de Dic. de 2011
Walter Roberson
el 15 de Dic. de 2011
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Sarah
el 15 de Dic. de 2011
Walter Roberson
el 15 de Dic. de 2011
0 votos
Have you considered "painting" in to an array and then image()'ing the array? That would be much less work on the graphics engine. You would lose the ability to use the data cursor on each individual point, but perhaps that would be an acceptable tradeoff for you.
1 comentario
Sarah
el 15 de Dic. de 2011
per isakson
el 3 de En. de 2012
Matlab cannot handle that many handle graphic objects efficiently. SCATTER creates one handle for each point. The following change to your code makes the response fast enough.
% make profile plot
axes(handles.axes1);
... scatter(colorTime,pressureData,3,colorData,'filled');
plot(colorTime,pressureData,'.');
However, that is not what you asked for. One way to make a plot similar to yours is as follows.
You can only distinguish say 64 colors. Create one line object for each color. Split your time series into 64 time series according to the value of the variable. Assign the appropriate color to each line. Use the functions LINE and SET.
It is doable and the code will be fast.
4 comentarios
Sarah
el 4 de En. de 2012
Sarah
el 4 de En. de 2012
per isakson
el 4 de En. de 2012
There is no default way to handle 64 colors. The line object doesn't use colormap. I would set the line colors with RGB vectors. However, you can make a suitable colormap with the GUI, colormapeditor. Store that in a variable, my_line_colors = colormap; and ...., set( line_handle(jj), 'Color', my_line_color( jj, : ) ).
------
To plot points: set( line_handle(jj), 'LineStyle', 'none' )and look up line properties in the documentation. There are a handfull properties to set 'Marker', 'MarkerSize', etc.
per isakson
el 21 de En. de 2012
There is a better way to set the colors. The property, ColorOrder, of axes takes a m-by-3 matrix of RGB values. That's a colormap. Thus, set( 0, 'DefaultAxesColorOrder', my_line_colors )
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!