better way to visualize profile data
이전 댓글 표시
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
답변 (4개)
the cyclist
2011년 12월 15일
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
Walter Roberson
2011년 12월 15일
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
2011년 12월 15일
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
2011년 12월 15일
Walter Roberson
2011년 12월 15일
That does sound odd, Sarah.
Sean de Wolski
2011년 12월 15일
0 개 추천
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
Sarah
2011년 12월 15일
Walter Roberson
2011년 12월 15일
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Sarah
2011년 12월 15일
Walter Roberson
2011년 12월 15일
0 개 추천
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.
per isakson
2012년 1월 3일
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
Sarah
2012년 1월 4일
Sarah
2012년 1월 4일
per isakson
2012년 1월 4일
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
2012년 1월 21일
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 )
카테고리
도움말 센터 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!