![matlab plot colors matlab plot colors](https://www.mathworks.com/help/examples/graphics2/win64/Color3DBarsByHeightExample_01.png)
![matlab plot colors matlab plot colors](https://sunglass.io/wp-content/uploads/2020/01/img13.png)
% nested functions % = function draw_layer_and_blend (n, alpha, sat, r, r_rnd, ratio, sigma) % Inputs: % n - Number of dots. % save a high DPI version of our plot so you can use it as a wallpaper! Now we can put everything together and finalize our function: function light_dots %LIGHT_DOTS Draws fancy light dots. To export our final product as a high DPI image, we can simply use the printįunction : % save a high DPI version of our plot so you can use it as a wallpaper! % make sure the axes are hidden and the plot occupies the whole window Linspace( 0, canvas_height, im_size( 2)), blurred_im)
![matlab plot colors matlab plot colors](https://www.researchgate.net/publication/323595161/figure/fig1/AS:601359283924992@1520386634542/Comparison-of-default-Matlab-plotting-and-gramm-plotting-with-corresponding-code-A.png)
Image( linspace( 0, canvas_width, im_size( 1)). % replace the plot with the blurred image % retrives the current plot as an image and apply the filterīlurred_im = imgaussfilt(frame2im(frame), sigma) % draw the dotsĭraw_random_dots(n, alpha, sat, r, r_rnd, ratio) % ratio - Width of the dots = radius / ratio % sigma - Standard deviation of the 2-D Gaussian smoothing kernel. The detailed implementation ofĭraw_layer_and_blend is given below: function draw_layer_and_blend (n, alpha, sat, r, r_rnd, ratio, sigma) % Inputs: % n - Number of dots. Hence, by callingĭraw_layer_and_blend repeatedly, we alternate between drawing light dots andĪpplying the Gaussian filtering. We then retrieve the current plot as an image We first draw a group of light dots by callingĭraw_random_dots. Įnd end Implementing draw_layer_and_blend Rectangle( 'Position', xywh, 'Curvature',. % generate RGB colors according to the x coordinates % here we use the x coordinate to control the hue valueĬolors = hsv2rgb() Y_coords = curve + canvas_height / 2 + y_randomness * randn(n, 1) X_coords = linspace( 0, canvas_width, n)' + x_randomness * randn(n, 1) Ĭurve = amp * sin(init_phase + x_coords / sin_period * 2 * pi) % ratio - Width of the dots = radius / ratio % generates the centriod coordiates The detailed implementation of draw_random_dots is given below: function draw_random_dots (n, alpha, sat, r, r_rnd, ratio) % Inputs: % n - Number of dots. To achieve a smoothĬolor transition, we use the x coordinates of the dots to control the hue We then plot then using the rectangle function. The centroid coordinates around a sine curve, as well as the radiuses, and the colors ofĮach dot. The implementation of this function is quite straightforward. The whole procedure can be summarized in the following gif: This is done by alternatingīetween drawing light dots and applying the Gaussian filtering several times. Getting the feeling of the depth (the blurry effect). Generate their centroid coordinates around a sine curve. To make the light dots follow a curve, we just need to % we want to hide the axes so the actual plot will occupy the whole windowĪ unblurred light dot can be straightforwardly drawn with the rectangleįunction. Hf = figure( 'Menubar', 'none', 'Color', 'black'. % set up the figure % we want the backgroud to be black % define the parameters controlling the size and randomness of the light % dotsīase_radius = floor( 0.09 * canvas_width) % define the parameters controlling the curve that the light dots follows function light_dots %LIGHT_DOTS Draws fancy light dots. If it cannot fit into your screen, leading to incorrect plots. MATLAB will attempt to resize the figure window Note: canvas_width and canvas_height must be smaller than your screen In the image to which the Gaussian filtering will be applied, leading to Otherwise the axes and paddings will appear It is crucial to hide the axes and specify the plotĪrea to be the whole window. Note that when setting up the figure, we explicitly set the background The description of each parameter is given in theĬomments.
MATLAB PLOT COLORS CODE
We start by writing down the boilerplate code and defining the necessary