matlab-figure

Set data tips programmatically?

不羁岁月 提交于 2019-12-01 10:51:50
I need to be able to set data tips programmatically from a list of array of x axis values. For example, I create a figure and plot my data. figure;plot(t1,[filter(b,a,Gyro(:,2)),filter(b,a,Gyro(:,4))]) I have a set of timestamp values from t1 variable (time) (e.g. [0.450, 0.854, 1.2343....] ) where I want to place data tips to mark certain events in my data. Without having to place them every time manual by clicking and saving data trip... How can I pass them as array and do this programmatically through matlab script? You can add matlab datatip programatically and customize them to an extent.

Find contour/edge in pcolor in Matlab

杀马特。学长 韩版系。学妹 提交于 2019-12-01 10:41:07
I'm trying to make a contour that follows the edges of the 'pixels' in a pcolor plot in Matlab. This is probably best explained in pictures. Here is a plot of my data. There is a distinct boundary between the yellow data (data==1) and the blue data (data==0): Note that this is a pcolor plot so each 'square' is essentially a pixel. I want to return a contour that follows the faces of the yellow data pixels , not just the edge of the yellow data. So the output contour (green line) passes through the mid-points of the face (red dots) of the pixels. Note that I don't want the contour to follow the

Why is subplot much faster than figure?

让人想犯罪 __ 提交于 2019-12-01 10:20:59
问题 I'm building a data analysis platform in MATLAB. One of the system's features need to create many plots. At any given time only one plot is available and the user can traverse to the next/previous upon request (the emphasis here is that there is no need for multiple windows to be open). Initially I used the figure command each time a new plot was shown, but I noticed that, as the user traverse to the next plot, this command took a bit longer than I wanted. Degrading usability. So I tried

How to set arbitrary colors for bars in a 3D bar plot?

≯℡__Kan透↙ 提交于 2019-12-01 09:28:22
Say that I have a matrix Z with some values, and I want to illustrate it by a plotting the values in Z by height. The first solution comes to mind is a surface, but using surf and similar functions with small matrices doesn't look good. So I thought about using something like a 3D bar plot with bar3 . But the problem is that this function always sets the color by the group and not by height, and I can't get it to do so. Here is an example: Z = peaks(5); subplot 121 surf(Z) title('Surface look bad') subplot 122 bar3(Z) title('The color is not by height') I tried to look for the color properties

Bounding box using MATLAB for the image

此生再无相见时 提交于 2019-12-01 09:04:50
I am trying to draw a bounding box around the white blob in the image below: I did like this: bw = imread('box.jpg'); bw=im2bw(bw); imshow(bw) L = bwlabel(bw); s = regionprops(L, 'Area', 'BoundingBox'); s(1); area_values = [s.Area]; idx = find((100 <= area_values) & (area_values <= 1000)); % list of all the objects %whose area is between 100 and 1000 bw2 = ismember(L, idx); %construct a binary image containing all the objects whose %area is between 100 and 1000 by passing L and idx to ismember. imshow(bw2) The output bw2, so far is: Can someone one tell me how to draw a bounding box around

Find contour/edge in pcolor in Matlab

核能气质少年 提交于 2019-12-01 08:33:30
问题 I'm trying to make a contour that follows the edges of the 'pixels' in a pcolor plot in Matlab. This is probably best explained in pictures. Here is a plot of my data. There is a distinct boundary between the yellow data (data==1) and the blue data (data==0): Note that this is a pcolor plot so each 'square' is essentially a pixel. I want to return a contour that follows the faces of the yellow data pixels , not just the edge of the yellow data. So the output contour (green line) passes

Matlab bars: changing the color of the bar and the space between bars and axes

喜欢而已 提交于 2019-12-01 08:28:57
问题 I have a tricky question, which I think cannot be simply answered. I have a large data table and want to save bar charts for each 2 corresponding mean values. I already did that with "for loop", but I cannot set different colors to my bars and cannot set proper spaces between bars and axes. That's the simplest example: k = [2 5] bar(k) Matlab thinks about those data [2 5] as about one "group" and it does not give a possibility of changing color for only one bar. Of course, when we have

Set data tips programmatically?

牧云@^-^@ 提交于 2019-12-01 08:21:08
问题 I need to be able to set data tips programmatically from a list of array of x axis values. For example, I create a figure and plot my data. figure;plot(t1,[filter(b,a,Gyro(:,2)),filter(b,a,Gyro(:,4))]) I have a set of timestamp values from t1 variable (time) (e.g. [0.450, 0.854, 1.2343....] ) where I want to place data tips to mark certain events in my data. Without having to place them every time manual by clicking and saving data trip... How can I pass them as array and do this

Removing the line between two specific data points in Matlab

人盡茶涼 提交于 2019-12-01 07:07:56
I am going to draw a graph in Matlab. The graph is quite simple and I am using the plot function. Suppose the data that I want to plot is (0:1:10) . I also put markers on my graph. Then, we have a line that has markers on coordinates (0,0),(1,1),(2,2),... etc. Now, I want to remove the line between (2,2) and (3,3) without deleting the whole line. That is to say, my purpose is to get rid of a particular segment of the line without loosing the entire line or any marker points. How can I do that? Try the following: y = [0.2751 0.2494 0.1480 0.2419 0.2385 0.1295 0.2346 0.1661 0.1111]; x = 1:numel

How to set arbitrary colors for bars in a 3D bar plot?

会有一股神秘感。 提交于 2019-12-01 06:38:59
问题 Say that I have a matrix Z with some values, and I want to illustrate it by a plotting the values in Z by height. The first solution comes to mind is a surface, but using surf and similar functions with small matrices doesn't look good. So I thought about using something like a 3D bar plot with bar3 . But the problem is that this function always sets the color by the group and not by height, and I can't get it to do so. Here is an example: Z = peaks(5); subplot 121 surf(Z) title('Surface look