# Tutorial: Using plot() function

**ALSTAT R Blog**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

To begin with, let’s define a vector first. Say wehave vector x, which is a sequence from 1 to 10 with length of 100 points. Thatis,

Then, here’s the simplest way on plotting a yfunction using points on vector x.

Now, you can modify your plot. Say you want to add atitle on your plot. Then you can just add **main=”Plot of sin(x) + cos(x)”**, on the code. That is,

Moreover, you can also change the style of yourplot, by changing the type of it. And here are the possible types of plot:

**“h”**. Then we have

Looking at the plot now, it seems that the lines arevery thin. To make it thicker we need to add an option **lwd**, which is for the linewidth. And thus, changing the line width and making it thicker, we can give avalue say 2.5.

**pch**option in R.

**leave a comment**for the author, please follow the link and comment on their blog:

**ALSTAT R Blog**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.