R software plot function
By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy. Popular Course in this category. Course Price View Course. Note: Code, in this case, is based on the situation where the data is in excel, by doing this I like to showcase how we upload the data into R and process it if we have to make a plot out of it. Free Data Science Course.
Login details for this Free course will be emailed to you. Email ID. Contact No. Manage consent. Close Privacy Overview This website uses cookies to improve your experience while you navigate through the website.
Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website.
We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience. Necessary Necessary. Necessary cookies are absolutely essential for the website to function properly.
We can also draw a regression line to our scatterplot by using the abline and lm R functions:. In combination with the density function, the plot function can be used to create a probability density plot in R:.
Figure 3 shows that our variable x is following a normal distribution. The small peaks in the density are due to randomness during the data creation process.
If we replace the plot function with the lines function, we can add a second density to our previously created kernel density plot. Have a look at the following R code:. Figure 4 contains multiple normally distributed densities, i. The plot function provides many arguments for the modification of its parameters.
For instance, we can change the main title and the axis labels of our plot as follows:. We just launched W3Schools videos. Get certified by completing a course today! If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:. Functions Global Variables. Example Draw one point in the diagram, at position 1 and position 3 : plot 1, 3. Example Draw two points in the diagram, one at position 1, 3 and one in position 8, 10 : plot c 1, 8 , c 3,
0コメント