Categories: Big Data

Data Science – Commonly Used Plot Parameters in R Programming

This article represents some of the commonly used plot parameters across different plot commands, while you are working with different kind of plots in R. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos.
Following are the key points described later in this article:
  • What are some of the common plots (commands) in R?
  • Commonly Used Plot Parameters

 

What are some of the common plots (commands) in R?

Following represents some of the plots (commands) used in R language for different purposes. I shall be writing different blog on different use-cases where one should use one or more of the following plots:

  • plot
  • barplot
  • hist
  • stem
  • mosaicplot
  • pie
  • boxplot

 

Commonly Used Plot Parameters

Following are some of the commonly used parameters:

  • main: “main” parameter is used to give the title for the plot
  • ylim: “ylim” parameter is used to limit the numbers on the Y-axis. It is defined using following format: ylim=c(0,10) which sets the numbers on Y-axis starting from 0 going upto 10. The plots get adjusted accordingly.
  • xlim: “xlim” parameter is used to limit the numbers on the X-axis. It is defined using following format: xlim=c(0,15) which sets the numbers on X-axis starting from 0 going upto 15. The plots get adjusted accordingly.
  • las: Setting las=1 turns the numbers horizontally on the Y-axis.
  • xlab: xlab=”Label X” sets the label of X-axis to “Label X”
  • ylab: ylab=”Label Y” sets the label of Y-axis to “Label Y”
  • col: col is used to set the color of the plotting points or line wherever applicable with different kind of plots. For example, col=2 sets the color as red. col=4 sets the color as blue. One could use additional attributes with col to change the color of title (col.main), labels (col.lab), axis points (col.axis)
  • lwd: lwd is used to set the width of the line in the plots. The value could be 1,2,3,4,5 etc.
  • cex: “cex” argument is used to change the size of the plotting characters. cex with further attributes could be used to change the size of title (cex.main), x and y-axis labels (cex.lab), x and y-axis (cex.axis) points etc.
  • font: font command is used to change the font of title (font.main), labels (font.lab), axis (font.axis) etc.

For pie-charts, only “main” makes sense to be used.

 

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking.

Recent Posts

Agentic Reasoning Design Patterns in AI: Examples

In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…

1 month ago

LLMs for Adaptive Learning & Personalized Education

Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…

2 months ago

Sparse Mixture of Experts (MoE) Models: Examples

With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…

2 months ago

Anxiety Disorder Detection & Machine Learning Techniques

Anxiety is a common mental health condition that affects millions of people around the world.…

2 months ago

Confounder Features & Machine Learning Models: Examples

In machine learning, confounder features or variables can significantly affect the accuracy and validity of…

2 months ago

Credit Card Fraud Detection & Machine Learning

Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…

2 months ago