I've created a box plot, the data on the left is the continous variable and the data on the right has about 10 unique options. When I create the boxplot I cannot see the labels. How do I make it show all the labels, possibly vertically?
boxplot(data$Rate ~ as.factor(data$Purpose))
I've looked around and cannot work out what im trying to follow.
The common way to put labels on the axes of a plot is by using the arguments xlab and ylab.
Changing axis labels To alter the labels on the axis, add the code +labs(y= "y axis name", x = "x axis name") to your line of basic ggplot code.
Boxplots can be created for individual variables or for variables by group. The format is boxplot(x, data=), where x is a formula and data= denotes the data frame providing the data. An example of a formula is y~group where a separate boxplot for numeric variable y is generated for each value of group.
from pylab import * import numpy as np fig = figure(figsize=(4,4)) # define the figure window ax = fig. add_subplot(111) # define the axis ax. boxplot(raw_data,1) # make your boxplot # add axis texts ax. set_xlabel('X-label', fontsize=8) ax.
You can add argument las=2
to function boxplot()
to make all labels perpendicular to axis.
df<-data.frame(Rate=rnorm(100),Purpose=rep(letters[1:10],each=10))
boxplot(df$Rate~df$Purpose,las=2)
If your label names are long then you should adjust also plot margins.
par(mar=c(7,5,1,1))
boxplot(df$Rate~df$Purpose,las=2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With