matlab-figure

Patch circle by a color gradient

蹲街弑〆低调 提交于 2020-01-04 01:08:28
问题 I'm attempting to plot a color gradient which I would like to be uniform along an axis (in the case of the picture below defined by the angle pi/7 ) When I use the patch command, The plot matches the desired gradient direction, but is not uniform along it (all sorts of triangles are formed between the points along the circle) here is the code N=120; theta = linspace(-pi,pi,N+1); theta = theta(1:end-1); c = exp(-6*cos(theta-pi/7)); figure(1) patch(cos(theta),sin(theta),c) ylabel('y'); xlabel(

unknown white lines when saving pie chart as pdf

时间秒杀一切 提交于 2020-01-03 13:41:08
问题 When I save a pie chart as pdf, the pdf has unknown white lines. To simplify the question, I modify the code to its most generic form as the following. clc; h=pie(1); %set the pie chart color to black h(1).FaceColor = 'k'; The reason I choose to use black color is the white lines contrast most with a black background. Please see the attached pdf figure. I also find a similar thread having the same issue at this link: weird artifacts when saving pie chart as pdf. No solution is provided at

Creating movie by sequence of plots in matlab

六眼飞鱼酱① 提交于 2020-01-03 05:47:08
问题 I'm asking this question in the following of the question question and answer After running the answer code, you can see a movie by sequences of plots. Is there a way to save the sequence of plots as movie? Any answer is highly appreciated. 回答1: You can create a video of a plot by using the VideoWriter object in the following steps: 1) Create and open the video object (also specifying the name of the video) vidObj = VideoWriter('SIN_X_COS_X.avi'); 2) in the plotting loop, get the current

How to integrate Java swing black background toolbar into polaraxes?

别说谁变了你拦得住时间么 提交于 2020-01-03 04:59:19
问题 Code where I try to integrate shortened version of Altman's MATLAB 2013 polar radar system code into MATLAB 2016b polarxes implementation because I want to have black background in toolbar and zoom feature with horiozontal scrollbar. The former code basically uses javax.swing.JSlider having a continuous-movement callback . The current bug comes from the line 'StateChangedCallback',{@cbSlider,fp,imax}); where axes imax does not behave as expected close all; clear all; clc; % http:/

Plot vector field within given region (between two circles) in matlab

坚强是说给别人听的谎言 提交于 2020-01-02 13:31:32
问题 I want to plot below vector field in Matlab: u = cos(x-x_0).*y-y_0; v = sin(x+x_0).*y+y_0; I can do it easily in a grid, for example from -2 to 2 in x and y direction: x_0=2; y_0=1; [x,y] = meshgrid(-2:0.2:2, -2:0.2:2); figure quiver(x,y,u,v) But I want to plot the vector field in a certain region which isn't square like above. The region I want to plot the vector field is the region between two circles, both centered at (x_0,y_0) with radii equal to r_1=5 and r_2=10 How can I do that? 回答1:

Scaleable, draggable box on plots that can select data

↘锁芯ラ 提交于 2020-01-01 09:24:36
问题 Here's the setup: I've got a graphical plot of data, and I'm trying to find if it's feasible to try to put a box on the figure that can be moved and changed in width and return some values like percentage of and area under the curve. It looks something like this: Any suggestions on where to start? My feeling was that it might be doable using a more GUI'd interface versus a standard plot. 回答1: I would start with imrect . It is draggable, and you can add callbacks to it. (Taken directly from

Distance between axis label and axis in MATLAB figure

一世执手 提交于 2019-12-31 10:42:21
问题 I'm plotting some data with MATLAB and I'd like to adjust the distance between axis label and the axis itself. However, simply adding a bit to the "Position" property of the label makes the label move out of the figure window. Is there a "margin" property or something similar? In the above figure, I'd like to increase the distance between the numbers and the label "Time (s)" while automatically extending the figures size so that the label does not move out of bounds. This is how I set up the

Converting image using matlab / octave from rgb to hsv back to rgb

北城以北 提交于 2019-12-31 05:43:45
问题 I'm trying to convert a color image from rgb to hsv (make changes) then back to rgb. As a test I made this code just to test how to go from rgb to hsv back to rgb but when I view the image it just shows up as black. What am I missing? *PS I'm using octave 3.8.1 which works like matlab Here are the octave 3.8.1 packages I have loaded: >>> pkg list Package Name | Version | Installation directory --------------+---------+----------------------- control *| 2.6.2 | /usr/share/octave/packages

Matlab subplots in loop: only shows plots in last iteration

梦想与她 提交于 2019-12-31 05:39:26
问题 I am trying to create a big plot in Matlab by adding subplots in a loop. % Generation of examples and targets x = 0 : 0.05 : 3 * pi; y = sin(x.^2); % Deep Learning Toolbox™ software arranges concurrent vectors with a % matrix, and sequential vectors with a cell array (where the second index is the time step). % con2seq and seq2con allow concurrent vectors to be converted to sequential vectors, and back again. p = con2seq(x); t = con2seq(y); % convert the data to a useful format % Creation of

XTickLabel with variable intervals at barplot

守給你的承諾、 提交于 2019-12-31 05:24:08
问题 I have a barplot where the bars are located at the following x-coordinates: 1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,22,24,26,28,30,35,40,45,50,55,60,70,80,90 I want to show these values at the XTickLabel , however when I use figure(1); Vector = [1 2 3 4 5 6 7 8 9 10 12 14 16 18 20 22 24 26 28 30 35 40 45 50 60 70 80 90] bar(Vector,Vector); xticklabels(Vector); I get the following output, but I want that my XTickLabel to look like Vector at the corresponding values: As you can see the XTickLabel