"R Error: geom_text requires the following missing aesthetics: label" when labels are present

I got the following graph to work fine:

p = ggplot(weighted, aes(x=Brand, y=percent_sales, fill=Sales.Type)) +
geom_bar(stat="identity") + facet_grid(~ Region) +
geom_point(aes(y=Market.Share/12.5, label=Market.Share))

Then I used the following per other posts and the O’Reilly R Graphics Cookbook:

f_labels <- data.frame(Region = c("CENTRAL PLAINS", "EAST SEABOARD", "FLORIDA", "GREAT LAKES", "MIDWEST", "MISS DELTA",
                              "MOUNTAIN", "NEW ENGLAND", "NORTH PLAINS", "PACIFIC", "SOUTHEAST","TEXAS"),
                   labels = c(5.7, 10.7, 8.6, 8.9, 6.0, 5.5, 5.6, 11.9, 4.7, 7.4, 7.7, 5.5))

So I then tried to run:

p + geom_text(aes=(label=f_labels$label))

I get the warning message “geom_text requires the following missing aesthetics: label”. Normally, I would add that. However, I added the “label= ” argument to aes, which contains a list of 12 values per my earlier code. So why am I getting an error about required labels when I’ve supplied labels?


Download r.error.geom.text.requires.the.following.missing.aesthetics.label.when.labels.are.present.zip
Direct Link


Download


Download r.error.geom.text.requires.the.following.missing.aesthetics.label.when.labels.are.present.zip
Mediafire


Download


Download r.error.geom.text.requires.the.following.missing.aesthetics.label.when.labels.are.present.zip
Turbobit


Download


Download r.error.geom.text.requires.the.following.missing.aesthetics.label.when.labels.are.present.zip
Firedrive


Download


Download r.error.geom.text.requires.the.following.missing.aesthetics.label.when.labels.are.present.zip
Sanshare


Download

Both comments and pings are currently closed.

Comments are closed.