0

I have this bwplot made with the lattice package. Only thing is I want to enlarge the size of the "morning" and "midday" text on the y-axis (this is a 2-level factor called Period in the script). Any idea how to do this? My plot and script so far:

my_settings<- list(par.main.text = list(cex = 2, just = "left", x = grid::unit(5, "mm")), box.rectangle=list(lwd=2)) # change title position and size

#the plot
bwplot(dfmh2$Period~dfmh2$count^0.5|dfmh2$microhabitat, #count - morning/midday: midday more
      par.settings = my_settings,
      par.strip.text = list(cex =1.7),
      ylab= list(label = "Period of Day", fontsize = 20), xlab= list(label = "Count (n)", 
      fontsize = 20), 
      main="A) Count")



enter image description here

1 Answers1

1

You need to use the scales argument. This takes a list, which is itself a list of x and y components. The y component can have a cex argument to adjust the text size:

library(lattice)

bwplot(dfmh2$Period ~ dfmh2$count^0.5 | dfmh2$microhabitat,
       par.settings = my_settings,
       par.strip.text = list(cex = 1.7),
       ylab = list(label = "Period of Day", fontsize = 20), 
       xlab = list(label = "Count (n)", fontsize = 20),
       scales = list(y = list(cex = 1.5)),
       main="A) Count")

enter image description here


Data used

While it's always better to include a reproducible example of your data, I created a sample set with the same name as your own for the purposes of this plot:

set.seed(1)

dfmh2 <- data.frame(
  Period = factor(rep(rep(c('morning', 'midday'), each = 10), 6)),
  count  = rpois(60, 10),
  microhabitat = factor(rep(c('Avicennia open water', 'Mixed fringe', 
                              'Mixed open water', 'Rhizophora forest', 
                              'Rhizophora fringe', 
                              'Avicennia Pneumatophores'), each = 20),
                        c('Rhizophora forest', 'Rhizophora fringe',
                          'Avicennia Pneumatophores',
                          'Avicennia open water', 'Mixed fringe', 
                          'Mixed open water')))
Allan Cameron
  • 147,086
  • 7
  • 49
  • 87