onkaronkar4
onkaronkar4

Reputation: 43

in ggplot 2 the facet_wrap variable name is not appearing on the faceted graph

When I am rendering the following code I am getting the correct graph, however, the label of the faceted variable assembly_no does not appear on the graph. the graph below

hp %>% 
  filter(assembly_no > 10) %>%  
  filter(position == 1) %>% 
  count(assembly_no, party) %>% 
  mutate(party = fct_reorder(party,n)) |> 
  mutate(assembly_no = as.factor(assembly_no)) |> 
  ggplot(aes(n, party, fill = party)) + 
  geom_col(width = 0.3, show.legend = FALSE) +
  facet_wrap(~assembly_no,
             labeller = "label_value",

             scales = "free_y" )+

  labs(x = "Total number of seats", 
       y = "Political Party", 
       title = "Total number of seats by political parties")

Created on 2022-09-07 by the reprex package (v2.0.1)

Upvotes: 0

Views: 185

Answers (1)

yuk
yuk

Reputation: 19870

What theme do you use? What you show is not the default one. It's possible that the labels are hidden by the theme.

Check if you have a line with theme_set anywhere in your code.

Upvotes: 1

Related Questions