How to Create a Log-Log Plot in R? Last Updated : 28 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss how to create a Log-Log plot in the R Programming Language. A log-log plot is a plot that uses logarithmic scales on both the axes i.e., the x-axis and the y-axis.We can create a Log-Log plot in the R language by following methods. Log-Log Plot in Base R: To create a Log-Log plot in base R we pass log(data) as data argument instead of data in the plot() function. The log() function converts the data value into its logarithmic value. The log() function by default calculates the natural logarithms. But if we need to use custom logarithmic values we can use the base parameter of the log function. Syntax: log( value, base ) where, value: a numeric variable whose logarithm is to be calculated.base: a numeric variable with respect to which logarithms are computed. Example: Here, is an example of a basic log-log scatter plot made using the log() function of the R Language. R # create sample data frame sample_data <- data.frame(x=1:12, y=c(10, 12, 3, 6, 2, 23, 12, 15, 17, 5, 12, 23)) # create scatterplot # Use log function to create log log plot plot( log(sample_data$x), log(sample_data$y) ) Output: Log-Log Plot using ggplot2 To create a Log-Log plot in the ggplot2. We convert the data frame values to their logarithmic values by using the log() function. The log() function converts the data value into its logarithmic value. Then we pass the converted data frame as an argument to the ggplot() function and use the geom_point() function to draw a scatter plot. Syntax: plot_dataframe <- data.frame( x= log(df$x), y= log(df$y) ) ggplot( plot_dataframe, aes( x, y) ) + geom_point() + labs ( title ) where, df: determines the data frame that is to be plotted..title: determines the title of plot. Example: Here, is an example of a basic log-log plot made using the ggplot2 package of the R Language. R # load library ggplot2 library(ggplot2) # create sample data frame sample_data <- data.frame(x=1:12, y=c(10, 12, 3, 6, 2, 23, 12, 15, 17, 5, 12, 23)) # convert dataframe data into Log data plot_data <- data.frame( x=log(sample_data$x), y=log(sample_data$y) ) # create scatterplot using geom_point function ggplot(plot_data, aes(x=x, y=y)) + geom_point()+ labs(title='Log-Log Plot', x='Log(x)', y='Log(y)') Output: Create Quiz Comment M mishrapriyank17 Follow 0 Improve M mishrapriyank17 Follow 0 Improve Article Tags : R Language R-plots R-Charts R-Graphs R-ggplot +1 More Explore IntroductionR Programming Language - Introduction 4 min read Interesting Facts about R Programming Language 4 min read R vs Python 5 min read Environments in R Programming 3 min read Introduction to R Studio 4 min read How to Install R and R Studio? 4 min read Creation and Execution of R File in R Studio 5 min read Clear the Console and the Environment in R Studio 2 min read Hello World in R Programming 2 min read Fundamentals of RBasic Syntax in R Programming 3 min read Comments in R 3 min read R-Operators 5 min read R-Keywords 2 min read R-Data Types 5 min read VariablesR Variables - Creating, Naming and Using Variables in R 5 min read Scope of Variable in R 5 min read Dynamic Scoping in R Programming 5 min read Lexical Scoping in R Programming 4 min read Input/OutputTaking Input from User in R Programming 7 min read Printing Output of an R Program 4 min read Print the Argument to the Screen in R Programming - print() Function 2 min read Control FlowControl Statements in R Programming 4 min read Decision Making in R Programming - if, if-else, if-else-if ladder, nested if-else, and switch 3 min read Switch case in R 2 min read For loop in R 5 min read R - while loop 5 min read R - Repeat loop 2 min read goto statement in R Programming 2 min read Break and Next statements in R 3 min read FunctionsFunctions in R Programming 5 min read Function Arguments in R Programming 4 min read Types of Functions in R Programming 6 min read Recursive Functions in R Programming 4 min read Conversion Functions in R Programming 4 min read Data StructuresData Structures in R Programming 4 min read R Strings 6 min read R-Vectors 4 min read R-Lists 6 min read R - Array 7 min read R-Matrices 10 min read R-Factors 4 min read R-Data Frames 6 min read Object Oriented ProgrammingR-Object Oriented Programming 7 min read Classes in R Programming 3 min read R-Objects 3 min read Encapsulation in R Programming 3 min read Polymorphism in R Programming 6 min read R - Inheritance 7 min read Abstraction in R Programming 3 min read Looping over Objects in R Programming 5 min read S3 class in R Programming 8 min read Explicit Coercion in R Programming 3 min read Error HandlingHandling Errors in R Programming 3 min read Condition Handling in R Programming 5 min read Debugging in R Programming 3 min read File HandlingFile Handling in R Programming 3 min read Reading Files in R Programming 9 min read Writing to Files in R Programming 2 min read Working with Binary Files in R Programming 5 min read Like