+2 votes
in Programming Languages by (40.5k points)

I have the following code to generate a scatter plot without using the ggplot. dat1 is a data table. I want to increase the size of the title and axis label. How can I increase it?

scatter.smooth(dat1$predicted_prob, dat1$true_label, 

               xlab="",

               ylab="Fraction of positives",

               xlim=c(0,1),ylim=c(0,1), col="blue", main="True fraction: 0.01")

1 Answer

+2 votes
by (71.8k points)
selected by
 
Best answer

You can use the character expansion factor (cex) parameter to increase or decrease the size of the text in titles, labels, axis, or subtitles.

cex: A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. The default value is 1. A value > 1 (e.g. 1.1) will increase the size and a value < 1 (e.g. 0.9) will decrease the size.

cex.axis: set the size of axis annotation relative to the current setting of cex.

cex.lab: set the size of x and y labels relative to the current setting of cex.

cex.main: set the size of main titles relative to the current setting of cex.

cex.sub: set the size of sub-titles relative to the current setting of cex.

In your code, make the following changes to increase the size by 10%.

scatter.smooth(dat1$predicted_prob, dat1$true_label, 

               xlab="",

               ylab="Fraction of positives",

               xlim=c(0,1),ylim=c(0,1), col="blue", main="True fraction: 0.01", cex.main=1.1, cex.lab=1.1)


...