I'm doing some pattern mining in R using library(arules)
. Using ItemFrequencyPlot
I am trying to rotate the x-axis labels and scale the axis names.
library(arules)
data(Adult)
itemFrequencyPlot(Adult, topN=20, cex.names=0.7, las = 2, srt = 90, main = "Item frequency plot") #example
Scaling I can do with cex.names
. However, when it comes to rotating the axis labels, I'm having a hard time doing so. I have tried both variations of las
and srt
. In all, it seems a bit clunky, so perhaps there is another way for visualising it?
How to rotate the axis labels (and access other graphical elements of the item frequency plot to tweak it)?
itemFrequencyPlot
does not appear to allow you to control those labels, but it is after all just a barplot
, which does give you more control of the appearance. So just make your own. Here is how. Get the top 20 frequencies. Leave lots of room for the long axis labels. And plot!
iF20 = rev(tail(sort(itemFrequency(Adult)), 20))
par(mar=c(12,4,1,1))
barplot(iF20, las=2, cex.names=0.8)