entrepreneur, diagram, curve

Methods to Exchange Font Measurement in ggplot2

Posted on
banner 336x280

You’ll importance refer to syntax to switch the font measurement of diverse components in ggplot2:

p + theme(textual content=element_text(measurement=20), #alternate font measurement of all textual content
        axis.textual content=element_text(measurement=20), #alternate font measurement of axis textual content
        axis.identify=element_text(measurement=20), #alternate font measurement of axis titles
        plot.identify=element_text(measurement=20), #alternate font measurement of plot identify
        legend.textual content=element_text(measurement=20), #alternate font measurement of legend textual content
        legend.identify=element_text(measurement=20)) #alternate font measurement of legend identify   

Please see examples display the way to importance this syntax with refer to scatterplot in ggplot2:

banner 468x60
library(ggplot2)

#build information body
df <- information.body(x=c(1, 2, 3, 4, 5, 6),
                 y=c(6, 8, 14, 19, 22, 18),
                 z=c('A', 'A', 'B', 'B', 'C', 'C'))

#build scatterplot
p <- ggplot(df, aes(x=x, y=y, colour=z)) +
       geom_point(measurement=3) +
         ggtitle("That is the Name")

p

Instance 1: Exchange Font Measurement of All Textual content

Please see code displays the way to alternate the font measurement of all textual content components within the plot:

p + theme(textual content=element_text(measurement=20))

ggplot change font size

Instance 2: Exchange Font Measurement of Axis Textual content

Please see code displays the way to alternate the font measurement of simply the axis textual content:

p + theme(axis.textual content=element_text(measurement=30))

ggplot2 change font size of axis text

Instance 3: Exchange Font Measurement of Axis Titles

Please see code displays the way to alternate the font measurement of simply the axis titles:

p + theme(axis.identify=element_text(measurement=30))

ggplot2 change font size of axis labels

Instance 4: Exchange Font Measurement of Plot Name

Please see code displays the way to alternate the font measurement of simply the plot identify:

p + theme(plot.identify=element_text(measurement=30))

ggplot change font size of plot title

Instance 5: Exchange Font Measurement of Legend Textual content

Please see code displays the way to alternate the font measurement of simply the legend textual content:

p + theme(legend.textual content=element_text(measurement=30))

ggplot2 change size of legend text

Instance 6: Exchange Font Measurement of Legend Name

Please see code displays the way to alternate the font measurement of simply the legend identify:

p + theme(legend.identify=element_text(measurement=30))

ggplot2 change font size of legend title

Supplementary Assets

The Entire Information to ggplot2 Titles
Methods to Exchange Legend Measurement in ggplot2
Methods to Rotate Axis Labels in ggplot2

banner 336x280

Leave a Reply

Your email address will not be published. Required fields are marked *