better way to visualize profile data

6 visualizaciones (últimos 30 días)
Sarah
Sarah el 15 de Dic. de 2011
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
Sarah el 3 de En. de 2012
Thanks to those of you who have made suggestions. I still haven't resolved the issue, but have gotten closer to the source of the problem I think. I made a stripped down version of the GUI that I am using and discovered that the time delay with the profile plot has more to do with the fact that I am generating two plots (on two different axes) in my GUI. If I plot the colored scatter plot alone, it only takes about 2-3 seconds for a day's worth of data, but if I also try to plot a simple time series first on the other axes (using the plot function), it slows down to over a minute. Either plot alone generates rather quickly, but both together just bog down. I've posted the simple testGUI as well as the test dataset in dropbox at links at the end of this post. To test it, I simply select the pressure data and the color data in the e popupmenus and then press plot. If I comment out either of the plots, the remaining single plot generates quickly. Again, I am grateful for any help here. Walter Roberston’s suggestion of painting into an array and then imaging the array sounded promising, but I haven’t had luck figuring out how to do this. I don’t need to interact with the data in the scatter plot, only the simple time series plot.
Thanks again! Sarah
The dropbox links are:
Workspace data: http://dl.dropbox.com/u/53535639/testGUI/testGUI_data.mat
GUI figure: http://dl.dropbox.com/u/53535639/testGUI/testGUI.fig
GUI code: http://dl.dropbox.com/u/53535639/testGUI/testGUIcode.docx (I needed to copy it into word because the *.m file was not sharing correctly

Iniciar sesión para comentar.

Respuestas (4)

the cyclist
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
Sarah
Sarah el 15 de Dic. de 2011
Actually, I am plotting within a GUI that I've built to loop through datasets. I just realized that the data plot much more quickly outside the GUI than within (5 seconds for 2 days worth of data vs. 60 seconds for 12 hours worth). Any ideas why this would be the case?
Walter Roberson
Walter Roberson el 15 de Dic. de 2011
That does sound odd, Sarah.

Iniciar sesión para comentar.


Sean de Wolski
Sean de Wolski el 15 de Dic. de 2011
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
Walter Roberson
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
Sarah el 15 de Dic. de 2011
Thanks. Here is a link to 2 day's worth of data:
http://dl.dropbox.com/u/53535639/exampleData.mat
I should note that depth is originally in a slightly different time-step and has been interpolated to the variable time-step.
Also, I just replied to 'the cyclist' with respect to the time the plot is taking. I am plotting it within a GUI that I've created to loop through data. I've noticed that it is MUCH slower inside the GUI than when I graph it outside of the GUI.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 15 de Dic. de 2011
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
Sarah el 15 de Dic. de 2011
I tried to a little homework on what you meant by "painting" in, but came up short. Is there a reference you could direct me to?
Since all I need is to just view the picture, not being able to use the data cursor would be fine. Thanks, Sarah

Iniciar sesión para comentar.


per isakson
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
per isakson
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
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 )

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by