Articles on Trending Technologies

Technical articles with clear explanations and examples

How to change the color of points in a scatterplot using ggplot2 in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 20K+ Views

To color the points in a scatterplot using ggplot2, we can use colour argument inside geom_point with aes. The color can be passed in multiple ways, one such way is to name the particular color and the other way is to giving a range or using a variable. If range or a variable will be used then the color of the points will be in different shades.Exampleggplot(df,aes(x,y))+geom_point(aes(colour=x))Output

Read More

How to increase the width of the median line in boxplot using ggplot2 in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

The default width of the median line is wider than the rest of the lines that represent minimum, first quartile, third quartile or maximum but we can make it a little wider to make it more appealing. This can be done with the help of fatten argument inside geom_boxplot function, the default value of fatten is 2.Exampleggplot(df,aes(x,y))+geom_boxplot(fatten=6)Output

Read More

Difference Between Daemon Threads and User Threads In Java

Nitin Sharma
Nitin Sharma
Updated on 11-Mar-2026 2K+ Views

As we know java is a language that supports multi threading and on the basis of nature threads in java are classified into two types Daemon thread and User thread.The following are the important differences between Daemon Threads and User Threads.Sr. No.KeyDaemon ThreadsUser Threads1NatureDaemon thread is low in priority i.e JVM does not care much about these types of threads.User threads are recognized as high priority thread i.e. JVM will wait for any active user thread to get completed.2CPU availabilityIt is not guaranteed that Daemon thread always gets CPU usage whenever it requires due to its low priority.User thread always ...

Read More

How to highlight text inside a plot created by ggplot2 using a box in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 302 Views

There might be many ways to highlight text inside a plot but the easiest one would be using geom_label function of ggplot2 package, with the help of this function we can put the required text and the aesthetics of that text by using a single line of code. It is highly recommended that we should use geom_label function with desired specifications.Examplelibrary(ggplot2) ggplot(df,aes(x))+geom_histogram(bins=30)+geom_label(aes(x=6,y=450,label="Normal Distribution"),fill="red")Output

Read More

How to subset a data frame by excluding a specific text value in an R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 908 Views

To create a subset based on text value we can use rowSums function by defining the sums for the text equal to zero, this will help us to drop all the rows that contains that specific text value. For example, if we have a data frame df that contains A in many columns then all the rows of df excluding A can be selected as−df[rowSums(df=="A")==0, , drop=FALSE]Exampledf[rowSums(df=="E")==0, , drop=FALSE] Output x1 x2 x3 x4 x5 1 A  D  B  C C 2 B  D  D  D D 3 B  A  D  D D 5 C  D  C  C C 10 C ...

Read More

How to convert MANOVA data frame for two-dependent variables into a count table in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 294 Views

MANOVA refers to multivariate analysis of variance, in this method we have more than one dependent variable and multiple independent variables. We want to compare each level of the independent variable combination for each of the dependent variables. To convert MANOVA data frame for two-dependent variables into a count table, we can use cast function of reshape package but we need to melt the data frame first so that the casting can be done appropriately.ExampleID

Read More

How to view the complete output of tibble in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

Tibbles are created when we analyze data using dplyr package and if the data size is large then only 10 values are printed in R. If we want to display the complete output of tibble then View function needs to be used. For example, if we want to perform calculation of counts then we should add View() at the end of the code with pipe operator.Exampledf%>%group_by(Group,Rating)%>%mutate(count=n())%>%View()Output

Read More

How to convert a data frame row into character vector in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

To create a character vector in R we can enclose the vector values in double quotation marks but if we want to use a data frame row values to create a character vector then as.character function can be used. For example, if we have a data frame df then the values in first row of the df can form a character vector using as.character(df[1,]).ExampleG1

Read More

How to italicize boxplot label in R using ggplot2?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 3K+ Views

Like every other tool for statistical analysis R does not display the labels of a boxplot in italics, thus if we want to do this, we need to do it manually. In ggplot2, we have a function scale_x_discrete that can be used to change the default font to italic using expression function.Exampleggplot(df,aes(x,y))+geom_boxplot()+scale_x_discrete(labels=expression(italic(Female),italic(Male)))Output

Read More

How to change the font size of legend in base R plot?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 3K+ Views

In base R, we can use legend function to add a legend to the plot. For example, if we want to create a histogram with legend on top-right position then we can use legend("topright",legend="Normal Distribution") and if we want to change the font size then we need to as cex argument as shown below:legend("topright",legend="Normal Distribution",cex=2)Examplelegend("topleft",legend="Histogram of",cex=1.5)Output

Read More
Showing 24721–24730 of 61,297 articles
Advertisements