matlab-figure

What should I do to not show the legend for all the plots?

二次信任 提交于 2019-12-12 21:03:51
问题 Here is my code: N=100; n=50; tau=0.001; h=0.01; lambda=tau/h; mu=lambda/2; u=zeros(N,n); u1=zeros(N,n); u2=zeros(N,n); phi=zeros(n,1); for i=1:n for j=1:N u(j,i)=cos(2*pi*i*(j-1)*h); u1(j,i)=cos(2*pi*i*((j-1)*h-tau)); end for j=2:N u2(j,i)=u(j,i)-lambda*(u(j,i)-u(j-1,i)); end u2(1)=0; phi(i,1)=2*pi*i/N; end uf=zeros(n,1); uf1=zeros(n,1); uf2=zeros(n,1); for i=1:n for j=1:N uf(i,1)=uf(i,1)+(u(j,i)*exp(-1i*(j-1)*phi(i,1)))/100; uf1(i,1)=uf1(i,1)+u1(j,i)*exp(-1i*j*phi(i,1))/100; uf2(i,1)=uf2(i

Automatically align image and graph with shared x-axis

妖精的绣舞 提交于 2019-12-12 20:38:19
问题 I have an image that I want to plot under a graph showing the intensity of an arbitrary row of this image. Apparently, there is no way I can "automatically" make the two graphs both aligned (they share the same x-axis) and not distorted . Here is a MWE that uses the kobi.png image that should come with MATLAB. For this solution I used the answer to this question, but it's not exactly what I am looking for. The reason will be clear after the code. im = imread('kobi.png'); % read default image

Bar plot with two y axes

。_饼干妹妹 提交于 2019-12-12 19:13:07
问题 I have the following code for a plot with 2 y-axes in MATLAB. I am glad that the 2-axes feature works, however, I would like to avoid the overlapping of the bars. Also, the categories on the right-hand axis should have different colors, not only yellow, yet it should be somehow clear that they are plotted on the right-hand axis and not the left one. How can this be done? EONMW = [100 399 500]; RWEMW = [200 996 120]; GermanByEON = [0.2 0.4 0.5]; GermanByRWE = [0.1 0.5 0.9]; EONGermanPortfolio

How to make a matlab legend recognize multiple scatter plots?

痞子三分冷 提交于 2019-12-12 18:28:19
问题 I want to place three scatter plots in the same figure window and have a legend that describes them. The scatter plots all load in the same window just fine, but the legend only recognizes the last series. In other words, the legend shows a red marker (the color for the last series) for each of its entries. How do I make the legend recognize each scatter and not just the last one? I've tried a bunch of different things, and none of them seem to work. Thanks! The picture is the plot for one of

Making a gif from images

*爱你&永不变心* 提交于 2019-12-12 16:45:24
问题 I have a load of data in 100 .sdf files (labelled 0000.sdf to 0099.sdf), each of which contain a still image, and I'm trying to produce a .gif from these images. The code I use to plot the figure are (in the same directory as the sdf files): q = GetDataSDF('0000.sdf'); imagesc(q.data'); I've attempted to write a for loop that would plot the figure and then save it with the same filename as the sdf file but to no avail, using: for a = 1:100 q=GetDataSDF('0000.sdf'); fh = imagesc(q.dist_fn.x_px

Non Maximized matlab GUI figure

不羁岁月 提交于 2019-12-12 16:25:02
问题 Is there a way to create a GUI which starts as a maximized windows? I've tried to add set(gcf,'Units','normalized','Position',[0,0,1,1]); at the end of my gui's mygui_OpeningFcn() function but the GUI is not maximized properly (see printscreen). Setting the GUI properties at GUIDE to Units-'normalized' and Position-[0,0,1,1] didn't help either. I've also tried to use the Matlab File Exchange maximize function by adding maximize(handle.figure1); at the end of my gui's mygui_OpeningFcn() but it

Plot 3d bars on a map in Matlab

杀马特。学长 韩版系。学妹 提交于 2019-12-12 16:08:57
问题 I have a Lat/Long vector, and another with Z values that I need to show on a 3d map just like the one on the right of the following figure. I tried bar3 but it's combuersome as it requires creating multiple graphs. here's some code: S4 = shaperead(filename) plot([S4.X],[S4.Y],'k'); % plots the map from a shapefile I loaded previously XX = [-50 -51 ...]; YY = [-1 -2 ...]; ZZ = [ 2.2 3.2 ... ]; stem3(XX,YY,ZZ) % this is an option, but doesn't look good!! :( Any ideas on how can I do this? thx!

Setting different tick lengths

风流意气都作罢 提交于 2019-12-12 13:19:53
问题 I have a plot in which I'd like many ticks along the x-axis, yet only some of the ticks will have tick labels associated with them. However, I'd like the tick marks for those that have labels to be longer than those that don't. I know that you can turn the x-axis MinorTicks on, but that won't let you control where those ticks are actually located. For example, if the x-axis signifies days, I want tick marks every 7 days but labels every 28 days. Moreover, setting the XTickLength only lets you

Drawing circles around points in a plot

余生长醉 提交于 2019-12-12 12:27:13
问题 I have two matrices timeline = [0.0008 0.0012 0.0016 0.0020 0.0024 0.0028]; Origdata = 79.8400 69.9390 50.0410 55.5082 34.5200 37.4486 31.4237 27.3532 23.2860 19.3039 79.7600 69.8193 49.8822 55.3115 34.2800 37.1730 31.1044 26.9942 22.8876 18.9061 79.6800 69.6996 49.7233 55.1148 34.0400 36.8975 30.7850 26.6352 22.4891 18.5084 79.6000 69.5799 49.5645 54.9181 33.8000 36.6221 30.4657 26.2762 22.0907 18.1108 79.5200 69.4602 49.4057 54.7215 33.5600 36.3467 30.1464 25.9173 21.6924 17.7133 79.4400 69

Highlight mean value on y-axis in bar chart

混江龙づ霸主 提交于 2019-12-12 05:37:27
问题 So I have a bar chart with y-axis value y = [0:20:40:60:100] as set by bar chart by default. Now I need to mark the mean y value of my bars, so suppose it is 54.5. I need 54.5 on my axis. I don't want (0, 54.5) to be marked with some sign, I need (0, 54.5) to show the value 54.5, so that I can numerically identify the mean. Any advicein this regard will be helpful. 回答1: %random example data data=rand(10,1) %create bar plot bar(data) %insert mean m=mean(data) %draw mean line line(xlim,[m,m])