I am using the rCharts nPlot()
function to display stacked or grouped bar charts given contingency table type data. The "multiBarChart" is displayed in a shiny application. A piece of the code that I use in my shiny application is given below.
graphData <- reactive({
as.data.frame(table(eval(inputVar1()),eval(inputVar2())))
})
output$myChart <- renderChart({
p1 <- nPlot(Freq ~ Var1, group="Var2", data=graphData(), type="multiBarChart")
p1$addParams(dom='myChart')
return(p1)
})
In my dataset, one categorical variable has 16 levels. When this variable is displayed along the x-axis of the "multiBarChart", not all labels are shown. Is there a way in nPlot
to adjust the font size of axis labels? I'm thinking something like cex.axis=0.5
or cex.lab=0.5
or something like that.
Alternatively, is there a parameter like las=
which would allow me to rotate the axis label 90 degrees and perhaps have a cleaner plot where all labels of categorical variables are displayed along the x-axis of the plot.
Any advice the group could provide is greatly appreciated!!
n1$setTemplate(afterScript='<style> svg text {font-size: 9px;}</style>')
– Almetaalmighty