matlab-figure

Easy way to programmatically change all font types and sizes in all figures in MATLAB

百般思念 提交于 2019-12-11 04:49:57
问题 I am generating a number of plots in MATLAB. The axis labels and the tick labels are currently too small when included in my final document. I would like to change the font size for both axis labels and tick labels while also setting a new default typeface. I have tried the FontSize and FontName name value pair but strangely see no effect on the exported .eps files; also this method is somewhat impractical because I am generating a large number of plots. Any suggestions would be greatly

3D visualization of some data in MATLAB

这一生的挚爱 提交于 2019-12-11 04:33:46
问题 This is my data matrix in MATLAB: a = [43.676289 -79.477386 1 43.676370 -79.477107 5 43.676517 -79.477375 20 43.676417 -79.477509 8 43.676129 -79.477278 15]; The first column is Y axis, the second column is X axis and the third column is my data. How can I draw a bar graph, and adjust the color of the bars according to the value of data (like colorbar in a surface plot) for each data point in MATLAB? I added an example graph which I drew for another data matrix. In this example X, Y, and Z

MATLAB scrolling plot

荒凉一梦 提交于 2019-12-11 04:03:45
问题 I have an EEG data base that I would like to plot. The database is a 19*1000*134 matrix, with: 19 being the number of channel. On a first approach, I'm working with only one channel. 1000 the size of a sample (1000 points for a sampling rate of 500 Hz, i.e. 2 sec of data) 134 the number of epochs (number of different 2 second experience) The idea is to plot epoch n right after epoch n-1 on the same graph. The (X,Y) matrix used to plot this has a 134 000 * not_much size, and I would like to be

Connect two set of points with a line based in the index

泪湿孤枕 提交于 2019-12-11 03:35:38
问题 What I'm trying to do is connecting two sets of points (x,y based) with a line. The line should be drawn based on the index of the two sets. Meaning set1(x,y) should be connected to set2(x,y) where x and y are the same indices in both sets. What I have so far is the following: set1 = [1,2; 3,4; 5,6]; set2 = [10,20; 30,40; 50,60]; plot(set1(:,1),set1(:,2),'b+',set2(:,1),set2(:,2),'g+') Displaying me the items of set1 in blue points and the set2 in green points. Meaning I want to plot a line

MatLab: Weird display of logarithmic z-axis and bar3

折月煮酒 提交于 2019-12-11 03:14:55
问题 I want to display a 3d histogram using bar3 plot. Using linear scales with respect to x-, y-, and z-axis gives the following result: However, since the z-values have a very large interval I want to use a logarithmic z-axis such that the lower z-values are also visible. However, setting the z-axis to logarithmic with set(gca, 'ZScale', 'log'); yields the following plot, which does not look good: Is there some extra option I need to set or is it a known bug? Thanks in advance! 回答1: This is a

how to change the sequence of the legend

大兔子大兔子 提交于 2019-12-11 03:13:59
问题 I want to change the sequence of the legend. See the figure. I want the sequence to be: green and data2 , blue and data3 , black and data4 , red and data1 . Could anyone give a demo? 回答1: Change the order in which the plots are added to the figure, and then call legend normally. That should do it. You can also do it as follows. First get handles to the individual plots: h1 = plot(1:5); hold on h2 = plot(11:15, 'r'); Then call legend specifying the order: legend([h1 h2],'plot1','plot2') or

Use MATLAB's 'keyPressFcn' in a simple program

半世苍凉 提交于 2019-12-11 00:46:33
问题 I am trying to use the 'KeyPressFcn' in a normal MATLAB script, but I am having problems. I can use it nicely WITHIN a function, (like here), but I would like to use it in a normal script like so. My simple script is: %Entry Point clear all N = 100; x = randn(1,N); figHandle = figure(1); clf(figHandle); set(figHandle, 'KeyPressFcn', myFunction(~, eventDat,x,N)) Here is the function 'myFunction' that sits in the same directory: function myFunction(~, eventDat,x,N) mean = sum(x)/N; disp(mean);

Error in creating a volcano plot in MATLAB

末鹿安然 提交于 2019-12-10 23:54:09
问题 I am a complete newbie to MATLAB and the first task I have is to create a volcano plot. I have been using the documentation to understand about it and get started. I tried to run it on dummy values - a=[1 2 3] b=[4.6 2.7 4.5] c=[0.05 0.33 0.45] And then I ran - SigStructure = mavolcanoplot(a, b, c) My understanding is that a represents the gene expression values for condition 1, b for condition 2, and c is the list of p-values for the 3 data points in a and b . However running this code gives

Contour plot in MATLAB with constraints

一笑奈何 提交于 2019-12-10 22:48:06
问题 I'm completely new to MATLAB and have some problems. I need to make a contour plot of the following nonlinear optimization problem: In order to determine the feasible region for the function. I've tried searching on Mathworks, but haven't had any luck so far. I also have the following example: x = -5:0.005:5; y = -5:0.005:5; [X,Y] = meshgrid(x,y); F = (X.^2+Y-11).^2 + (X + Y.^2 - 7).^2; v = [0:2:10 10:10:100 100:20:200] [c,h]=contour(X,Y,F,v,'linewidth',2); colorbar yc1 = (x+2).^2; yc2 = (4*x

Legend for a single point in Matlab plot

荒凉一梦 提交于 2019-12-10 21:46:09
问题 I'm having some issues with the legend function. My code is as follows: xax = logspace(1, 4, 1000); R1 = sqrt(R11.*R21); %freq and mag are vectors of length 300 loglog(freq, mag, 'k-'); hold on; loglog(xax, R1, 'r-'); loglog(f1, R1, 'bo'); loglog(f2, R1, 'bo'); legend('|Zvc|', 'R1', 'f1', 'f2'); However, the legend doesn't work as I'd expect. It shows a black line and red line for the first two, which is fine. But the last two points are shown as red lines rather than blue circles. Here's a