matlab-figure

drawing 3d contour plot from 3d vector

给你一囗甜甜゛ 提交于 2019-11-29 16:33:59
I want to draw a contour plot for 3D data. I have a force in x,y,z directions I want to plot the contour3 for that the dimensions of the Fx = 21x21X21 same for Fy and Fz I am finding force = f*vector(x,y,z) Then Fx(x,y,z) = force(1) Fy(x,y,z) = force(2) Fz(x,y,z) = force(3) I did the following but it is not working with me ?? why and how can I plot that FS = sqrt(Fx.^2 + Fy.^2 + Fz.^2); x = -10:1:10; [X,Y] = meshgrid(x); for i=1:length(FS) for j = 1:length(FS) for k=1:length(FS) contour3(X,Y,FS(i,j,k),10) hold on end end end This is the error I am getting Error using contour3 (line 129) When Z

One combined legend entry for multiple plots

拟墨画扇 提交于 2019-11-29 16:27:40
For some reason, I would like to plot the line and marker of the same data separately. data1 = (1:1:10)'; data2 = (1:2:10); figure(1); plot(data1,data1,'or'); hold on; plot(data2,data2,'-r'); legend('data'); However it will only display the legend for the first plot. And Matlab seems not to have option to manipulate the legend marker, color and linestyle. How can I make legend like this? Thanks! You will need to plot an invisible third plot (with almost no data to keep it fast) to define your legend: data1 = (1:1:10)'; data2 = (1:2:10); figure(1); plot(data1,data1,'or'); hold on plot(data2

X-axis label on two rows

陌路散爱 提交于 2019-11-29 15:54:52
str = {'HS31'; 'HS31 (Ridotto)'; 'Dax85';'Dax85 (Ridotto)'; 'FTSE89';'FTSE89 (Ridotto)'; 'SP98';'SP98 (Ridotto)'; 'Nikkei22';'Nikkei225 (Ridotto)'; 'SP457';'SP457 (Ridotto)'; 'Russ1318';'Russ1318 (Ridotto)'; 'Russ2151';'Russ2151 (Ridotto)'; 'Eurostoxx';'Eurostoxx (Ridotto)'; 'Ftse';'HS31 (Ridotto)'; 'Mibtel';'Mibtel (Ridotto)'; 'SP';'SP (Ridotto)'; 'Nasdaq';'Nasdaq (Ridotto)'; }; h=figure; bar(t); set(gca, 'XTickLabel',str, 'XTick',1:numel(str)) saveas(h, 'Backtesting/computing_time.png'); I can't read the text below the plot. Do you know how to fix it? Screenshot: https://www.dropbox.com/s

Matlab - implay's default size window

感情迁移 提交于 2019-11-29 15:16:24
问题 I am using implay to play some frames i want, the thing is that window size that pops is a bit small,so the user must maximize it by himself, is there any way to control the size of the window that pops up? 回答1: Ah here we go: implay(Diff); set(findall(0,'tag','spcui_scope_framework'),'position',[150 150 700 550]); Works in 2012b. (Note: if you have more than one implay window open, this will set them all to the same size) So you can learn how to find this kind of stuff for yourself, what I

Is it possible to get around MATLAB's limitation on font embedding in vector format files?

隐身守侯 提交于 2019-11-29 15:11:55
问题 According to the MATLAB manual, when you save a figure using print or by choosing file|save , if you choose the painters renderer and save to PDF or EPS vector formats, all fonts get substituted. Is there a way to get around this limitation? Whenever I output a figure, whether I use print or export_fig , the fonts get substituted, and so they no longer match the fonts in the document that I plan on putting the figure into. I would prefer to keep them in a vector format, because I use LaTeX

Cylinder with filled top and bottom in matlab

自作多情 提交于 2019-11-29 15:09:35
I am trying to create a "solid" cylinder that has a filled top and bottom to it. I know that there is the function cylinder(r) that creates one, though it does not have a top and bottom circle to "close it". I did some research and can't seem to find a function that does this. I have found this: http://www.mathworks.com/help/symbolic/mupad_ref/plot-cylinder.html though it is mupad code, and I don't know how to call that function from matlab (from my .m file). Once again, I have done some research and this is what I have found, though is does not seem to work: http://www.mathworks.com/help

Make squared in legend instead of lines Matlab

我们两清 提交于 2019-11-29 14:51:04
I have the following code, which plots a 'map' using imagesc, and provides a legend, see output attached. I am trying to replace the lines in the legend with solid squares. My attamps to far leave the lines and ad hollow squares (including a random square in the top left corner of the figure) figure(6) imagesc(lut) title('Ditribution of Land use Types') ylabel('Longitude') xlabel('Latitude') caxis([0, 7]) myColorMap = jet(6); imagesc(lut, 'AlphaData', ~isnan(lut)) colormap(myColorMap); L = line(ones(6), ones(6)); set(L, {'Color'}, num2cell(myColorMap, 2)) legend(L, {'Forest','Shrubland',

How to avoid image display artifacts in Matlab?

假如想象 提交于 2019-11-29 14:13:48
When I display a bitmap image using image in a Matlab figure window, I'm experiencing strange artifacts: What I'm referring to are the cross-shaped structures which are particularly visible at the edges of the brain slice, but present throughout. These structures are not in the underlying image data, which are exactly identical to those in this image: I assume the artifacts have to do with the slight rescaling that is necessary to match the image to the given axes size. Does someone have an idea how to avoid these artifacts? I tried changing the figure 'Renderer' , which does indeed affect the

Make a pixel transparent in Matlab

北慕城南 提交于 2019-11-29 14:13:34
问题 I have imported an image in matlab and before I display it how would I make the background of the image transparent? For example I have a red ball on a white background, how would i make the white pixels of the image tranparent so that only the red ball is visible and the white pixels are transparent? 回答1: You need to make sure the image is saved in the 'png' format. Then you can use the 'Alpha' parameter of a png file, which is a matrix that specifies the transparency of each pixel

In MATLAB, how does one clear the last thing plotted to a figure?

和自甴很熟 提交于 2019-11-29 13:37:06
In MATLAB, I plot many different vectors to a figure. Now, what I would like to do is simply undo the last vector that I plotted to that figure, without clearing everything else. How can this be accomplished? Can it be accomplished? Thanks Edit: figure(1); clf(1); N = 100; x = randn(1,N); y = randn(1,N); z = sin(1:N); plot(x); hold on; plot(y,'r'); plot(z,'k'); Now here, I would like to remove the plot z, which was the last plot I made. If you know before plotting that you want to remove it again later, you can save the handle returned by plot and delete it afterwards. figure; h1 = plot([0 1 2