matlab-figure

How to reduce the borders around subplots in matlab AND subaxis doesn't work

孤人 提交于 2019-12-24 09:17:06
问题 I've written a GUI that gives a matlab subplot of varying size and I'm looking for a generic way to squeeze the subplots together. Subaxis works for the vertical spacing, but it doesn't affect the horizontal spacing. What's the simplest way to squeeze them together? An example of one of the output figures it was produced with the following code in a for loop subaxis (1+ceil(max(zindex)/5),5,5+i, 'Padding', 0, 'Margin', 0,'SpacingHoriz',0.0001,'SpacingVert',0.009); 回答1: It looks like your

Matlab's patch function with interpolation produces different result based on order of vertices

喜欢而已 提交于 2019-12-24 07:39:41
问题 I have a patch with x,y,c coordinates as given below. Upon changing the order of points, MATLAB's patch color interpolation changes. x = [0.9000 1.0000 1.0000 0.9000]'; y = [0.5000 0.5000 0.6000 0.6000]'; c = [0.0278 0.0371 0.0325 0.0282]'; figure(); patch(x,y,c); order = [2:4,1]; figure(); patch(x(order),y(order),c(order)); The above produces two different color patches. However, the coordinates and the color have only changed the sequence in cyclic manner. Any suggestions to overcome this?

how to identify the points below a line in a graph using MATLAB?

故事扮演 提交于 2019-12-24 05:47:32
问题 After running the program, I got 14 values of loglik , then I plotted these value within two lines. The code is below: loglik=[-3168.7176,-4644.451,-3759.7372,-1758.1307,-4813.0647,-4147.0188,... -4330.944,-4612.9895,-3829.8987,-2687.4927,... -4007.5629,-2799.527,-2747.96,4.386]; aH = axes; plot(aH,loglik,'r.'); hold on; threshold1=mean(loglik)+1*std(loglik); threshold2=mean(loglik)+3*std(loglik); plot(aH, aH.XLim, [threshold2, threshold2], 'r-'); plot(aH, aH.XLim, [threshold1, threshold1],

How to combine different figures in a Matlab script?

孤者浪人 提交于 2019-12-24 05:15:47
问题 I am workin on a some sort of System test wherein i have a set of readings in the form of a .mat file. It has a structure in the .mat file with one field as Measurement. It has several Arrays(e.g air mass flow, velocity, carbon content) which further have fields like time and value. From these, I Need to plot the velocity and the air mass flow against time. For that i wrote the following command which gave me the corresponding plots: plot(Measurement.(Measurement.air_mass_flow.time)

Force Legend in Matlab Figure to be only one line per value

可紊 提交于 2019-12-24 05:05:57
问题 I'm wondering how I can force the text in the legend be only on one line? Like in my case there are three words and I have two values in the legend so the legend height becomes four lines. And I want to make it only two lines (one each). If anyone could please advise. 回答1: In Matlab 2010b and in 2015a, a legend as long as plot(1:8) hold all plot(2:9) legend('one two three four five six seven eight nine ten', ... 'one two three four five six seven eight nine ten') gives one line per legend

How to add tooltips or overlay text in a Matlab figure

假如想象 提交于 2019-12-24 03:47:12
问题 I have a figure with two or more lines. These lines have additional, important information associated with them, like how many data points were averaged to create the line etc. I would like to access this information in my figure. I thought a good solution for this would be to if you could hover over a line with your mouse and get that extended information. However searching for tooltips/overlays/hover-over on figures seemed to not be fruitful. Example: figure; hold on; plot(1:10,rand(10,1))

Simple way to get more sensible colors in gscatter

感情迁移 提交于 2019-12-24 03:29:59
问题 I'm looking for a simple way to get gscatter to choose more sensible colors. As you can see in the picture below, groups 3 and 4 have very similar colors, which are difficult to distinguish. I'm plotting my data using gscatter(X(:,1),X(:,4),assigns , [], [] ) . I know I can use scatter to manually get more sensible colors by creating a colormap that has the same number of colors as the number of groups I have, but then how do I get a nice legend like gscatter produces without looping over

How to customize a legend in matlab plot window

泪湿孤枕 提交于 2019-12-24 02:56:31
问题 As shown in the image below, the legend is too long for the plot window. what I want to do is: 1- To know how to split the legend over a second line? 2- To know how to shorten the red line in indicated in the legend. As you see, the legend contains a red line then (x1=......), I want to know whether there is any possibility to shorten that red line or to control its length. 回答1: There are two possibilities to control the content of the legend: Use of TeX commands : MATLAB parses the legend

Matlab imwrite() quality

[亡魂溺海] 提交于 2019-12-24 02:14:04
问题 I'm very new to Matlab, though I know a few other programming languages, so please forgive me if this is something simple. I have not been able to find any answers to this, either on StackOverflow or elsewhere. I produce a figure using the following code: figure(6),imageplot(P); drawnow; Which looks like this: I then save this image to my computer using the following commands: imwrite(P, 'images/plot.png'); And the resulting image is tiny, and missing some of the color information: If,

Matlab - short format of number variable in the plot title

萝らか妹 提交于 2019-12-24 01:56:10
问题 I am trying to place a variable into a plot title but I cannot produce formatting of 4 decimal places. How to avoid the float format in the title? This is the code I use subplot(3,2,1); hist(X,10); str=sprintf('X N=%d,Y=%d',N,Y) M=sum(X)/N Mean=sprintf('Mean=%0.4d',M) title({str,Mean}) 回答1: You need to use %f as the format specifier for float values. Changing your code Mean=sprintf('Mean=%0.4d',M) to Mean=sprintf('Mean=%0.4f',M) will print M with 4 decimal places of accuracy. If you want to