0

I am using the following code for dot plot.I have to write name of Indian states in y axis. but I am unable to control the font size.

dotchart(data, xlim = c(0, 1), pch = 20, col=c("darkblue","darkgreen"))
axis(2, at=seq(1,36, by=1), labels = FALSE)

lablist.y <- as.vector(c("Andaman & Nicobar", "Andhra Pradesh", "Arunachal Pradesh", "Assam", "Bihar", "Chandigarh", 
                         "Chhattisgarh", "Daman & Diu", "Delhi", "Dadra & Nagar Haveli", "Goa", "Gujrat", "Haryana", 
                         "Himachal Pradesh", "Jammu & Kashmir", "Jharkhand", "Karnataka", "Kerela", "Lakshadweep", 
                         "Madhya Pradesh", "Maharashtra", "Manipur", "Meghalaya", "Mizoram", "Nagaland", "Odisha", 
                         "Punjab", "Puducherry", "Rajasthan", "Sikkim", "Tamil Nadu", "Telangana", "Tripura", 
                         "Uttar Pradesh", "Uttarakhand", "West Bengal"))
text(y = seq(1, 36, by=1), par("usr")[1], 
     labels = lablist.y, pos = 2, xpd = TRUE)

I want to decrese the font size of y axis label(state names)

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Have you tried the argument `, cex=yourFontSizeChoice` inside `text` function? You may also have to play with plot margins, please see https://bookdown.org/ndphillips/YaRrr/plot-margins.html – Yacine Hajji Jun 19 '23 at 10:06
  • Does this answer your question? [How to change the font size and color of x-axis and y-axis label in a scatterplot with plot function in R?](https://stackoverflow.com/questions/12504549/how-to-change-the-font-size-and-color-of-x-axis-and-y-axis-label-in-a-scatterplo) – Captain Hat Jun 19 '23 at 10:38
  • 'cex' command is not working properly, as the y lab fields are more in numbers, text size of 0.5 is also not covering – Sangeeta Nath Jun 19 '23 at 17:45
  • This link bookdown.org/ndphillips/YaRrr/plot-margins.html helped me a lot. After modifying the margin, cex command wokred – Sangeeta Nath Jun 20 '23 at 14:23

0 Answers0