matlab-figure

Set the transparency of bars in a bar plot and set the y-axis to a log scale - but both don't seem to work in MATLAB

喜你入骨 提交于 2019-12-08 17:34:15
问题 In MATLAB, I want to set the transparency of bars in a bar plot to 0.3 and set the y-axis to a log scale - but both don't seem to work... subplot('Position',[0.15 0.7 0.45 0.15]); data = [1 2 5 4 7 4 1]; B = bar(data,'g'); ch = get(B,'child'); set(ch,'facea',.3) That works fine, but then add on this: set(gca,'YScale','log'); and the transparency setting doesn't work. Any ideas? Thanks! 回答1: Log Scale axis and Transparency do not work together in Matlab Why? OpenGl renderer, (which must be

How to rewrite this Matlab 2014 code with axis-subplots to 2016?

假装没事ソ 提交于 2019-12-08 15:38:21
问题 Code which I wrote for Matlab 2014 but which I want to rewrite it to Matlab 2016 such that it becomes more compact, since it is extranous now hFig3=figure('Units', 'inches'); hax3_b1=axes('Parent', hFig3); hax3_b2=axes('Parent', hFig3); hax3_b3=axes('Parent', hFig3); hax3_b4=axes('Parent', hFig3); b1=subplot(2,2,1, hax3_b1); b2=subplot(2,2,2, hax3_b2); b3=subplot(2,2,3, hax3_b3); b4=subplot(2,2,4, hax3_b4); % Example of common expression set([b1 b2], 'Units', 'inches'); % http://stackoverflow

Why axes handle deleted in Matlab loop?

心已入冬 提交于 2019-12-08 12:17:59
问题 Code which tries to mimic the real dynamic condition clear all; close all; hFig2=figure('Units','inches', 'Name', 'Time'); hax2=axes(hFig2); movegui(hFig2, 'southeast'); index=1; while (index < 7); hFig2=figure(hFig2); u=0:0.01:1+index; plot(hax2, u); % Give columns 1xXYZ to Matlab hold on; axis(hax2, 'xy'); axis(hax2, [0 (size(u,2)/1 - 0) min(u) max(u)]); % to maximise size axis(hax2, 'off'); % no ticks index=index+1; pause(1); hold off; drawnow end; Logs 1 hax2 in more dynamic condition,

Matlab x-axis scaling – evenly spaced custom axis

怎甘沉沦 提交于 2019-12-08 07:42:25
问题 Using the variables below, I need to plot data (x_values, y_values) on an x axis with ticks at ‘x_labels’ values. Each ‘x_labels’ tick must be evenly spaced on the x-axis (e.g. 1 cm). I have been playing with 'XTick' and 'XTickLabel' variables and although I searched online all other examples are related to when the ‘x_labels’ and ‘x_values’ are identical. The challenge here is that there is different spacing between ‘x_labels’ and ‘x_values’. Please help! x_labels = [4 8 16 32 64 128]; x

4D plot (3D+color) from 4 row vectors

故事扮演 提交于 2019-12-08 07:07:21
问题 I have 4 row vectors x, y, z and s , all of them have equal sizes 1*size . x, y, z should be the three Cartesian corodinate axes and s should be represented by colors (I want figure like below image). The statement Surf does not accept row vectors. I have read several stackoverflow post, but I could not find the answer. How can I plot such a figure? I really appreciate any help you can provide. 回答1: I can't test it because you didn't provide any data, but you could try: trisurf(x,y,z,s) If

Retrieving images from a folder and displaying it in the figure window of matlab

你。 提交于 2019-12-08 05:22:24
问题 I am working on content based image retrieval. I have found the images which are more similar to the query image and stored the result in a matrix as follows q = 100 -1293 50 -1237 8 -1075 102 -1024 141 -951 100th image is more similar, 50th image is the second image that is more similar. All these images are in a folder. How to retrieve these images inside matlab ? 回答1: How about folder = 'c:\images'; % folder were all images are img_names; % a cell array where each cell is the name of the

Why is there Gap in this Matlab Polar presentation with export_fig?

限于喜欢 提交于 2019-12-08 05:13:19
问题 Code which yields a gap at the line from origo (0,0) to (1,0), which seems to reach zero if C dimensions reaches infinity; however, I cannot get it small enough with any sizes of C so I think the artifact can be caused by Matlab figure internal features or image data itself (AnderBiguri) because it does not seem to occur for img=imread('peppers.png') . Code which makes the image, stores it by export_fig and maps it from Cartesian to Polar where the artifact occurs close all; clear all; clc; %

Placing picture on axis of MATLAB figure

こ雲淡風輕ζ 提交于 2019-12-08 03:38:17
问题 I want to make animation of ball (given by the picture here) which starts from origin and goes through a track given by x-vector, y-vector, z-vector (each of nX1).I know I need to use the getframe command but I don't know how to move the picture on the axis. I know that I can put a picture in one of the corner by defining new axis, e.g (exmaple taken from MATLAB offical forum): numberOfDataPoints = 200; sampleData = 100*rand(1,numberOfDataPoints); plot(sampleData); xlim([1, numberOfDataPoints

Impossible Viewpoint using Azimuth and Elevation

二次信任 提交于 2019-12-08 01:38:46
问题 I can't seem to achieve the following 3D plot view orientation using the view([AZ,EL]) command. No matter how hard I try rotating my 3D plot in the figure using the mouse or the command view itself, I just can't get that viewing angle. Is there another way of specifying the viewpoint? 回答1: You can achieve these sorts of views using camera control functions, in this case camorbit and camroll: [X, Y, Z] = peaks(); hAxes = gca; surf(hAxes, X, Y, Z); xlabel('x'); ylabel('y'); zlabel('z');

Matlab graph plotting - Legend and curves with labels

余生颓废 提交于 2019-12-08 00:39:04
问题 How to plot a figure like the one given below? Here the legend (green/blue) is plotted with some values (0.10 to 0.40) on each curve. Is there any possible solution or hints to do this? Figure Reference: 回答1: Plotting data labels within lines is possible with clabel (contour labels), although this requires that you to plot your data with the contour command. Although if you can't plot it as a contour plot then you should be able to convert your plot data to a contour matrix format, see the