matlab-figure

quiver3 arrow color corresponding to magnitude

十年热恋 提交于 2019-11-26 11:17:42
问题 I want the color of each arrow in a quiver3 plot from MATLAB to correspond to the magnitude of each arrow. Is there any way to do that? I saw a few examples online that are able to do this for the 2D quiver , however none of them work for the 3D variant, quiver3 . I have the following plot and want to replace the blue arrows with a color corresponding to their magnitude. 回答1: In the old graphics system (R2014a and earlier) this is not possible using the built-in quiver object. You can easily

Automatically plot different colored lines

橙三吉。 提交于 2019-11-26 04:59:11
问题 I\'m trying to plot several kernel density estimations on the same graph, and I want them to all be different colors. I have a kludged solution using a string \'rgbcmyk\' and stepping through it for each separate plot, but I start having duplicates after 7 iterations. Is there an easier/more efficient way to do this, and with more color options? for n=1:10 source(n).data=normrnd(rand()*100,abs(rand()*50),100,1); %generate random data end cstring=\'rgbcmyk\'; % color string figure hold on for

How should I update the data of a plot in Matlab?

怎甘沉沦 提交于 2019-11-26 04:19:53
问题 Suppose that I want to update a plot with a new data. What method should I choose? Set the XDataSource property to some name, update the variable, and call refreshdata Erase the original plot , and call plot command again. Use Set(\'Xdata\',...\') 回答1: Short answer : always use Set('Xdata',...') . Example code: function PlotUpdate() x = 0:.1:8; y = sin(x); h = plot(x,y); y = sin(x.^3); set(h,'XData',x,'YData',y); end Long answer: There are three relevant measures by which one should choose