Issue with a frequency polygon plot

Hi everyone,

I'm working on a pet project in kaggle and I have encountered this issue. Whenever I run the following code

ggplot(air_visit_data, aes(visitors)) +
    geom_freqpoly(color = 'darkred') +
    scale_x_continuous(limits = c(0, 100), n.breaks = 20) +
    scale_y_continuous(limits = c(0, 40000), n.breaks = 10) +
    labs(
        title = 'The frequency of the number of visitors',
        subtitle = 'The number of visits for each number of visitors'
    )
    xlab("Visitors") + 
    theme(
        axis.text = element_text(size = 20, angle = 45, color = 'gray48'),
        axis.text.x = element_text(vjust = 0.7),
        axis.title = element_text(size = 30, color = 'chartreuse4'),
        plot.title = element_text(
            size = 25, face = 'bold', hjust = 0.5, color = 'steelblue'
        ),
        plot.subtitle = element_text(
            size = 20, face = 'italic', hjust = 0.5, color = 'orange'
        )
    )

I get the plot with NO changes in the default properties made. Also I get Null word just above the plot and this message

'stat_bin()' usingbins = 30. Pick better value with 'binwidth'.

Every other plot in the same project works fine except this one.
Any ideas what could be the issue?

Thanks

you are missing a + that would connect labs() to xlab()

1 Like

Indeed I was. Thanks a lot

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.