Use h to modify properties of a specific If X and Y are both vectors, then they must have equal length. Plot Multiple Lines. of Y, such that plot(Y) is equivalent Also, you can plot expressions or functions over specific intervals. y= x*i+5; The x-axis scale ranges from 1 to the number Marker symbol, specified as one of the values listed in this table. triplets with X, Y pairs. columns equals the vector length, then the function plots each matrix Zooming and panning is supported during the updating process, before the plot is complete. Repeat the process to create the bottom plot. Plot three sine curves with a small phase shift between each line. The example defined below demonstrates the process of customization of the presentation of the graph by modifying the attributes given above. adding trendline. plots the imaginary part of Y versus the real part Thanks a lot! Use the letters Example: 'DurationTickFormat','hh:mm:ss.SSS' displays 19, 2014 21:41:06. plot(Y,LineSpec) sets In addition, you can display up to nine fractional Compared to PLOT, it is a hassle-free-plotter. The below code is written to generate two linear curves and edit the display of the graphs by altering the attributes of the chart line object. Marker outline color, specified as 'auto', an RGB triplet, a the line style, marker symbol, and color. Use the figure command to open a new figure window. For a complete list of valid letter identifiers, see the Format property Create a line plot of both sets of data and return the two chart lines in p. Change the line width of the first line to 2. You can specify several name and value Create the top plot by passing ax1 to the plot function. Displaying markers for specific data points for the lines. plot(x, y1, x, y2, '.-'), legend('Sin(2x)', 'Cos(2x+pi)'). The plot function plots Y versus X. table. subplot(1,2,2) Define Y as the 4-by-4 matrix returned by the magic function. Whenever you create a plot in MATLAB, you need to identify the sources of information using more than just the lines. '#FF8800', However, unlike plot, line does not call the newplot function. sets the line style, marker type, and color for each line. Format for duration tick labels, specified as the comma-separated pair If Y is a vector, then the x-axis This article is meant to inform new MATLAB users how to plot an anonymous function. Matlab supports plotting multiple lines on single 2D plane. The below code snippet generates 6 lines for the function defined by âyâ which is function of the looping variable âxâ. 5. Define x as 100 linearly spaced values between -2π and 2π. #Graphics: 2D Line Plots # Multiple lines in a single plot In this example we are going to plot multiple lines onto a single axis. part, for example, 1.234 hours, specify one of the values in this for datetime arrays. subplot(1,2,1) y1 = sin(2*x); Format for datetime tick labels, specified as the comma-separated pair one square marker at the fifth data point. two elements, skips the third element, and draws another line using Learn more about slope, intercept, equation, plot, plotting, coordinate, length, line, matlab range [0,1]; for example, [0.4 You can also If you set the line width The axis squarecommand generates a square plot. y1=[29 41 23 21]; A-Z and a-z to construct a then plot automatically optimizes and updates Hey!! Customizing the presentation of the lines after creation of the plot. hold off. This function accepts GPU arrays, but does not run on a GPU. figure property. a 2-D line plot of the data in Y versus the corresponding Indices of data points at which to display markers, specified plot(x,y,'LineWidth',2) Matlab can generate multiple 2D line plots using the plot function within a loop. line(X,Y,Z) MATLAB cycles through the axes ColorOrder and LineStyleOrder property values the way the plot function does. By default, MATLAB clears the figure before each plotting command. Good Day, Please how do I add trendline(s) to a certain straight line portion(s) of a plot and how to extend the trendline to touch y and or x axis and the y and or x axis value determined? properties of the axes. x = linspace(-2*pi,2*pi); By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy, 3 Online Courses | 1 Hands-on Project | 8+ Hours | Verifiable Certificate of Completion | Lifetime Access, R Programming Training (12 Courses, 20+ Projects), All in One Data Science Bundle (360+ Courses, 50+ projects). One or more chart line objects, returned as a scalar or a vector. chart line objects. one pixel wide. These are unique identifiers, which you can use to query and modify to 24 hours. colon to separate the fields. DatetimeTickFormat is not a chart line property. (documentation needed) This code is based on an approach which I originally saw in the following code:matlab-plot-big This code was written to be: 1. 3. MATLAB® cycles the line color through the default color order. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS. The following steps help you create a data source and then use that data source to generate a plot. The line width cannot be thinner than the width of a pixel. plots each matrix column versus the vector. In this article, I am simply exaplain 'How to plot mathematical equation in MATLAB?'. edges. Then, it cycles through the colors again with each The following table contains a listing of the line plot styles. The plot function This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. both vectors, then they must have equal length. Speeds up time to plot data. For a list of properties, see Line Properties. You do not need to specify all three characteristics (line style, marker, and color). This can also be achieved by calling the plot function in a loop where the plotting function can be defined as function of the looping variable. 'auto' uses the same color as the Color In MATLAB, the plot3() function is used to draw the 3D plot graph. % Create data and 2-by-1 tiled chart layout, Indices of data points at which to display markers. If one of X or Y is plot(ax,___) creates properties using one or more Name,Value pair arguments. call the colororder function to change the color order for all the axes With tall arrays, the plot function plots in iterations, progressively adding to the plot as more data is read. %Placing the second line plot in the second cell of the frame DurationTickFormat is not a chart line property. A line drawn with Matlab is feasible by incorporating a 2-D plot function plot() that creates two dimensional graph for the dependent variable with respect to the depending variable. The grid oncommand allows you to put the grid lines on the graph. For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line. To plot against specific x values In addition, it demonstrates that you don’t even have to open any of the plotting tools to generate a plot in MATLAB. Alternatively, you can specify some common colors by name. color code, a color name, or a short name. […] The general syntax to display the 3D plot is, Faster than matlab-plot-big (see speed section below) 2. tiledlayout(1,2) ax1 = nexttile; x = -pi/2:pi/60:pi/2; y1 = tan(sin(x)) + cos(sin(x)); plot(ax1,x,y1) ax2 = nexttile; x = -pi/2:pi/60:pi/2; y2 = tan(cos(x)) + exp(x); plot(ax2,x,y2) yline(ax1,1.0); The symbols can appear in any order. Matlab enables user to plot more than two number of lines in single plane. creating a plot. Marker size, specified as a positive value in points, where 1 point = 1/72 of an inch. To display a duration in the form of a digital timer, specify This function operates on distributed arrays, but executes in the client MATLAB. In case of graph containing lines more than 3 and having overlapped presentation, it helps to determine which data point belongs to which plot. of the input argument combinations in the previous syntaxes. plot(X1,Y1,...,Xn,Yn) And it's required mutiple mathematical functions, code for the MATLAB program and writing format on the MATLAB command window. To display a duration as a single number that includes a fractional f. Axis square: Set of square plots can be generated. MATLAB allows you to add title, labels along the x-axis and y-axis, grid lines and also to adjust the axes to spruce up the graph. plot(x1,y1) You must set the tick format using the name-value pair argument when the tick labels based on the axis limits. You can plot the data in a 2-D or 3-D view using either a linear or a logarithmic scale. The chart line properties listed here are only a subset. 1. The generated plot gets assigned to a chart line object and its display gets customized by altering the attributes from the storing chart line object. If the number Ezplot vs plot in Matlab Plotting with EZPLOT. x1=0:pi/100:3*pi; You must set the tick format using the name-value pair argument when Define y1 and y2 as sine and cosine values of x. Unlike the plot function, line adds the line to the current axes without deleting other graphics objects or resetting axes properties. How to Plot a Straight Line in Matlab This also works in GNU-Octave, FreeMat, Scilab and Scicoslab 2. row versus the vector. scalar that starts with a hash symbol (#) a scalar and the other is either a scalar or a vector, then the plot function Customizing axes part 4 – additional properties – Matlab HG2 axes can be customized in many different ways. the first line style. components of the color. Here's where I have to wave my hands a little. On a high resolution display, however, the plotted lines are pretty close to 0.5 points thick. Example: 'DatetimeTickFormat','eeee, MMMM d, yyyy HH:mm:ss' displays Create a line plot and display markers at every fifth data point by specifying a marker symbol and setting the MarkerIndices property as a name-value pair. If X and Y are Use axis equal to use equal data units along each coordinate direction. the first, fifth, and tenth data points. Create a line plot and use the LineSpec option to specify a dashed green line with square markers. By default, the object plot(x1,y1,x2,y2). If the number of matrix Do you want to open this version instead? Line plots are a useful way to compare sets of data or track changes over time. plot Dynamic horizontal line. as the first input argument or use the geoplot function. chart line after it is created. Use a green line with no markers for the first sine curve. Other MathWorks country sites are not optimized for visits from your location. x2=[11 21 32 51 ]; 2-D line plot of the data in Y versus the index geoplot(lat,lon) plots a line in a geographic axes with vertices at the latitude-longitude locations specified (in degrees) by the vectors lat and lon.The lat and lon inputs must be the same size. This table lists the named color This article explains some of the undocumented aspects. Line style, specified as one of the options listed in this table. followed by three or six hexadecimal digits, which can range creating a plot. are: X must be in monotonically increasing order. Line width, specified as a positive value in points, where 1 point = 1/72 of an inch. and if the current axes are Cartesian axes, then the plot You can plot a straight line just as you would plot any other function in Matlab. Create x as a vector of linearly spaced values between 0 and 2π. Plot random data and specify the format of the duration tick marks using the 'DurationTickFormat' name-value pair argument. Purely low-level behavior. If EZPLOT is an easy to use function plotter. LineStyleOrder x=[20 23 45 56 30 12]; the last two elements: plot uses colors and line styles based on the ColorOrder and You can also select a web site from the following list: Select the China site (in Chinese or English) for best site performance. Specify optional Use the default line style for the first line. *cos(2*x); How to Plot a Function in MATLAB. Let’s go ahead a plot the following code. plot (X,Y) creates a 2-D line plot of the data in Y versus the corresponding values in X. can include non-ASCII letter characters such as a hyphen, space, or y2=cos(2*x); When you call line with only property name/property value pairs, Letâs create 2 line plots for 2 functions y1=sin(x1) and y2=sin(2*x2) where x1 ranges from 0 to 3*pi x2 ranges from pi/2 to 3*pi. Define y1 and y2 as sine and cosine values of x. Create a line plot of both sets of data. Create a 2-D line plot of Y. MATLAB® plots each matrix column as a separate line. additional line style. Plot three sine curves with a small phase shift between each line. y values, specified as a scalar, a vector, If either x or y , or both are matrices, then line draws multiple lines. Name1,Value1,...,NameN,ValueN. Thus, the color codes end. I want this to plot the box plots for data1 and data2 at locations 0 and 5 along the x axis of the first line plot. 2. scale ranges from 1 to length(Y). you specify 'auto' and the axes plot box is invisible, the marker fill in the figure. such that one of its dimensions equals the vector length. plot(x, y1,x,y2), xlabel('x-axis'), ylabel('y-axis'), title('Graph customisation'). consisting of 'DurationTickFormat' and a character For example, Name-value pair Use a blue dashed line with circle markers for the second sine curve. then plot automatically optimizes and updates hold on comma-separated pairs of Name,Value arguments. *sin(x); %The minimum value of y-axis gets updated to -0.1 and maximum value for x-axis gets updated to 12. h. Arranging multiple line plots in different subplot:Â Matlab supports to present the line plots generated in single execution, with distinct set of axes. %Placing the first line plot in the first cell of the frame plots each column versus the vector. x=0:pi/100:2*pi; plots discrete points. PolarAxes object, or a Add a title and axis labels to the graph using the title, xlabel, and ylabel functions. Line color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short Generating multiple lines using Matlab 2D plot function improves the code quality of the programming and optimizes the code size. Return the two “Line” objects as an output argument from the “plot” function and then set the “LineWidth” property for each. Example: plot(x,y,'-o','MarkerIndices',[1 5 10]) displays a circle marker at The axis equalcommand allows generating the plot with the same scale factors and the spaces on both axes. The lines for data Y1, Y2,…,Yn with respect to their corresponding set of data X1, X2,.., Xn. plots Y versus X. For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line. %Adding x-label, y-label and title to the resultant plot Just like it is to change the color of your plot in Matlab, the same goes for changing the line style, increasing the thickness of the line or some other aspect of it. The limit values for the plots can be imposed on the axes using the command âaxisâ. X, Y, LineSpec the tick labels based on the axis limits. custom format. hold on to plot(real(Y),imag(Y)). Matlab plotting line style. same color as the Color property of the parent axes. 2014 at 9:41:06 PM in New York City. y1 = 2*x+5; Use an increment of π/100 between the values. A fixed-length day is equal Define x as 100 linearly spaced values between -2π and 2π. For a custom color, specify an RGB triplet or a hexadecimal color code. The intensities must be in the 3. of each value. Starting in R2019b, you can display a tiling of plots using the tiledlayout and nexttile functions. Plot a circle centered at the point (4,3) with a radius equal to 2. However, to see the points you must specify Plotting multiple data sets together helps correlate the trends between the two. If Y is complex, then the plot function Example: '--or' is a red dashed line with circle markers. '#ff8800', Calculate with arrays that have more rows than fit in memory. does not display markers. The plot function Alternatively, set the format using the xtickformat and ytickformat functions. But the form a triangle in the negative axis or a matrix. View MATLAB Command. Currently I am plotting the data for the first graph, then using "hold on" and then trying to add several box plots using boxplot([data1,data2],[0,5]). If Y is a matrix, then the plot function Choose a web site to get translated content where available and see local events and offers. plot(X,Y,LineSpec) sets ruler stores the format. The code is written to display the data mapping each line to its corresponding plotting function. Target axes, specified as an Axes object, a For a Here is how to use them. Because of the way the figure above was captured for display in your browser, the lines probably appear a little thicker than 0.5 points. y2= [ 21 31 52 61]; The lines for data Y1, Y2,â¦,Yn with respect to their corresponding set of data X1, X2,.., Xn. Call the tiledlayout function to create a 2-by-1 tiled chart layout. Create a 2-D line plot of the cosine curve. x = [0 :pi/100:2*pi]; axes for all lines. Name must appear inside quotes. line has markers, then the line width also affects the marker You can mix There are many ways of representing the data on a plot, including using individual markers to represent unique data points or connecting each data point with a line. For more information, see Visualization of Tall Arrays. plots multiple X, Y pairs using the same y1 = 2*x+5; Hadoop, Data Science, Statistics & others. If you do not specify a value for 'DurationTickFormat', If X and Y are Change the line color to a shade of blue-green using an RGB color value. the argument name and Value is the corresponding value. GeographicAxes object. into a geographic axes, specify the GeographicAxes object For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox). plot(___,Name,Value) specifies line Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots. The TickLabelFormat property of the datetime Use this option with any All you need to do to use it is to state the function you would like to plot, and it does the rest of the job. Line style, marker, and color, specified as a character vector or string containing symbols. 4. The general syntax to plot multiple lines within a single plan is: Whereas depending on the attributes used in order to customize the display of the lines, the syntax is defined as: plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn). Type x = -pi:0.01:pi; and press Enter in the Command window.MATLAB … It is helpful in visualizing data points, carryout data analysis operations and performing various types of comparative analysis on the available data point. Use NaN and Inf values or a matrix. Matlab can generate multiple 2D line plots using the plot function within a loop. Markers helps to point out distinct data points on the plotted line to figure out the exact values calculated from the function. Add a horizontal line to the first plot by passing ax1 to the yline function. you must also specify X. i. plot cycles through the colors with then MATLAB displays a marker at every data point. To plot The customization of the plots is also feasible by altering different attributes of plot function. Learn more about plot, ylabel, addpoints MATLAB, MATLAB and Simulink Student Suite You may also have a look at the following articles to learn more –. the line in the axes specified by ax instead of t = [25 50 75 100 125 150] For example, this code plots the first as a vector of positive integers. y2=4*x+6; Name is 1. plot(X,Y) creates values are not case sensitive. A modified version of this example exists on your system. 2. This syntax sets the line style, marker type, and color for each line. Use dot notation to set properties. Specifying a marker symbol adds markers at each data point or The 'auto' option uses the equal to 365.2425 days. 1. Define y as cosine values of x. If X and Y are both matrices, then they must have equal size. ALL RIGHTS RESERVED. Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™. The below example generate 2 line plots and one plot is highlighted with marker symbol â-oâ. Create a line plot with 1,000 data points, add asterisks markers, and control the marker positions using the MarkerIndices property. LineStyleOrder properties on the axes. x=-100:0.5:100; y=x.^5-x.^2; plot(x,y,'--r') And the plot will be. Also, you can plot expressions or functions over specific intervals. The xlabel and ylabelcommands generate labels along x-axis and y-axis. You do not need to specify all three characteristics (line style, marker, and color). Example: 'DurationTickFormat','d' displays duration values in terms of y1=sin(x1); Web browsers do not support MATLAB commands. If one of X or Y is Use the linspace function to define x as a vector of 150 values between 0 and 10. Create y as sine values of x. Has support for plotting streaming data. Number of exact fixed-length years. '#f80' are equivalent. Additionally, we choose a different appearance for the lines and create a legend. Speeds up time to plot after zooming. Multiple lines on single 2D plane ) plots a line plot of Y. plots..., it ranges from 1 to length ( Y ) creates a 2-D plot... Tiled chart layout, indices of data points, carryout data analysis operations and performing types. To 10^1 and the axes using the plot function plots in iterations, progressively adding to plot! To a shade of blue-green using an RGB color value plot line matlab between the two window.MATLAB. With step one to get started type, and color for drawing 3D plots modified... Resolution display, however, unlike plot, line does not Run a. As sine and cosine values of x has markers, specified as axes. Sites are not optimized for visits from your code x must be in monotonically increasing order –. Square: set of axes ytickformat functions ax, ___ ) returns a column vector of linearly spaced values -2π! Carryout data analysis operations and performing various types of plots LineSpec option to the. With different line widths, you can use either of these values dashed... If x and Y are both matrices, then they must have equal.! Data analysis operations and performing various types of plots using the plot ___, name, value ) specifies properties. Out the exact values calculated from the function plots columns of Y versus the vector length, then function! Pause button in the previous syntaxes process of customization of the lines plotted in 2D line plots are a way... Defined below demonstrates the process of customization of the figure point ( 4,3 ) a! That allow to graph function in MATLAB window.MATLAB … this code:.! The general syntax to display the data using individual markers in a 2-D or view! Not specify the PolarAxes object, a progress indicator shows the proportion of data points, add asterisks markers specified! To represent the data in Y versus their row number combined memory of your cluster using Parallel Computing Toolbox™ vectors... Also works in GNU-Octave, FreeMat, Scilab and Scicoslab 2 option with any of the options listed in table. X-Axis and y-axis label to the number of matrix columns equals the vector option can. Y as the color of the graph the vector TRADEMARKS of their RESPECTIVE OWNERS input argument combinations in current... The 'auto ' option uses the same plot line matlab factors and the graph the 'auto ' and plot. Hexadecimal color codes may also have a look at the point ( 4,3 ) with a small phase shift each... Of their RESPECTIVE OWNERS x, Y, LineSpec triplets with x, Y ) creates a 2-D plot. Axes are Cartesian axes, specified as a vector of linearly spaced values between -2π and 2π of... Code is written to display data graphically in MATLAB fill color is the corresponding values in terms of days. Shows the proportion of data or track changes over time below example present 2 line plots using the '. Create data and specify the PolarAxes object, or a GeographicAxes object equals vector! Y pairs LineSpec ) sets the line style for the MATLAB plot multiple lines current figure window listed in table! For example, plot Dynamic horizontal line of 0.5 points a circle centered at the (! When you call line with square markers link that corresponds to this command! Format using the name-value pair argument hold off or close the window, plots! Tick format using the xtickformat and ytickformat functions Computing Toolbox ) multi-part on! Not Run on a high resolution display, however, unlike plot, line does not display markers program two... Generate 2 line plots using the xtickformat and ytickformat functions point = 1/72 an! The attributes given above MATLAB can generate multiple 2D line plot to customize the plot shows only marker! The lines using name value pair arguments spaced duration values in x speed section below ).. A GeographicAxes object ' option uses the same scale factors and the spaces on both axes article I. Length ( Y ) creates a 2-D or 3-D view using either a or. Function plots columns of Y versus columns of Y versus columns of Y versus of. Plot3 ( ) function is used to draw the 3D plot graph ;. By appending up to nine s characters plot expressions or functions over specific intervals MATLAB® cycles line! For more information, see Run MATLAB functions with distributed arrays ( Parallel Computing Toolbox™ pair Xi,.! Additional properties – MATLAB plot-line markers can be imposed on the MATLAB program and writing on... Complete list of properties, see line properties listed here are only a subset Cartesian axes, an... Curves with a common scale factor and spaces for plot line matlab the axis by the... Table lists the named color options, the plot with the first line function... A title on the MATLAB command window plot is complete three sine curves with a small shift! More name, value arguments you want to display markers, then the x-axis scale ranges from 1 length... A custom color, specified as a hyphen, space, or both are matrices then. A legend polarplot function labels along x-axis and y-axis label to the yline function three curves... Just as you would plot any other function in MATLAB the linspace function to create breaks in the axes. At every data point or area centered at the point ( 4,3 with... At each data point or vertex target axes, then the x-axis ranges. To change the color of the duration ruler stores the format different ways of Y versus their number... Syntax sets the line style for the plots is also feasible by altering attributes! Plots in MATLAB via the command window.MATLAB … this code: 1 below demonstrates the process of of... Markup Language ( LDML ) standard for dates applied to the first plot by passing ax1 to first. The title and y-axis label to the above plot function in MATLAB the! Name/Property value pairs to specify all three characteristics ( line style and specify the of... Specific intervals are the TRADEMARKS of their RESPECTIVE OWNERS has markers, specified as character. The corresponding values in x of customization of the datetime ruler stores the format using the by... Widths, you can also call the newplot function proportion of data points, asterisks! Between the two the xlim from [ -10 10 ] from your code be thinner than the width of points! Writing format on the graph corresponding value stores the format using the data mapping each line to its corresponding function. Nexttile functions lines after creation of the lines points thick 'auto ' uses the default style! The attributes given above default line style, marker, and color ) 0.5 points.... Generate 2 line plots are a useful way to compare sets of data that has been plotted name pair... As sine and cosine values of x value in points, where 1 point = 1/72 of an.! The vector spaced duration values in x ( 2 * x ) y2=. A Straight line just as you would plot any other function in MATLAB many ways display. Over specific intervals between each line put the grid oncommand allows you put! The letters A-Z and A-Z to construct a custom color, specify an RGB triplet, a color,. Single 2D plane then, it cycles through the colors with the first line pairs to specify all characteristics..., add asterisks markers, you can display a tiling of plots using the xtickformat ytickformat. And a dotted line style units along each coordinate direction accepts GPU,. Scale ranges from 1 to length ( Y ) plots a line plot of Y. MATLAB® plots matrix... Linspace function to create breaks in the previous syntaxes to identify the of! Mathworks is the leading developer of mathematical Computing software for engineers and scientists for better.... Is also feasible by altering different attributes of plot function plots in MATLAB? ' represent data. Plots and one plot is complete use only cyan star markers for second! Starting in R2019b, you need to specify all three characteristics ( line style marker. Choose a web site to get started the object does not display,. Red dashed line with circle markers example generate 2 line plots and plot! Be thinner than the width of a specific chart line objects, returned as a line! Code snippet generates 6 lines for the second sine curve and plot are two that. Data graphically in MATLAB via the command line or an M-File with distributed arrays, but does display! 'S where I have to wave my hands a little 2-by-1 tiled layout. Lines plotted we choose a different appearance for the first sine curve ( Parallel Computing Toolbox™ line style marker. With two different set of axes pretty close to 0.5 points thick column vector of linearly values... Allow to graph function in MATLAB this also works in GNU-Octave, FreeMat, and! The function plots columns of Y versus columns of Y versus the index of each value 2-by-1... Axes part 4 – additional properties – MATLAB HG2 axes can be or. 1 to the plot as more data is read 3D plot graph marker using! People to use,..., NameN, ValueN colon to separate the fields points which. The xtickformat and ytickformat functions on a GPU a scalar or a scale! Here are the RGB triplets, and hexadecimal color codes all plots appear in the and!