Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 355941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:03:53+00:00 2026-05-12T12:03:53+00:00

I’m using ggplot2 to make some bullseye charts in R. They look delightful, and

  • 0

I’m using ggplot2 to make some bullseye charts in R. They look delightful, and everyone is very pleased – except that they’d like to have the values of the bullseye layers plotted on the chart. I’d be happy just to put them in the lower-right corner of the plot, or even in the plot margins, but I’m having some difficulty doing this.

Here’s the example data again:

critters <- structure(list(Zoo = "Omaha", Animals = 50, Bears = 10, PolarBears = 3), .Names = c("Zoo", 
"Animals", "Bears", "PolarBears"), row.names = c(NA, -1L), class = "data.frame")

And how to plot it:

d <- data.frame(animal=factor(c(rep("Animals", critters$Animals),
       rep("Bears", critters$Bears), rep("PolarBears", critters$PolarBears)),
       levels = c("PolarBears", "Bears", "Animals"), ordered= TRUE))
grr <- ggplot(d, aes(x = factor(1), fill = factor(animal))) +  geom_bar() +
  coord_polar() + labs(x = NULL, fill = NULL) +
  scale_fill_manual(values = c("firebrick2", "yellow2", "green3")) +
  opts(title = paste("Animals, Bears and Polar Bears:\nOmaha Zoo", sep=""))

I’d like to add a list to, say, the lower right corner of this plot saying,

Animals: 50
Bears: 10
PolarBears: 3

But I can’t figure out how. My efforts so far with annotate() have been thwarted, in part by the polar coordinates. If I have to add the numbers to the title, so be it – but I always hold out hope for a more elegant solution.

EDIT:
An important note for those who come after: the bullseye is a bar plot mapped to polar coordinates. The ggplot2 default for bar plots is, sensibly, to stack them. However, that means that the rings of your bullseye will also be stacked (e.g. the radius in my example equals the sum of all three groups, 63, instead of the size of the largest group, 50). I don’t think that’s what most people expect from a bullseye plot, especially when the groups are nested. Using geom_bar(position = position_identity()) will turn the stacked rings into layered circles.

EDIT 2: Example from ggplot2 docs:
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:03:54+00:00Added an answer on May 12, 2026 at 12:03 pm

    You could add the numbers to the legend.

    library(ggplot2)
    critters <- structure(list(Zoo = "Omaha", Animals = 50, Bears = 10, PolarBears = 3), .Names = c("Zoo", "Animals", "Bears", "PolarBears"), row.names = c(NA, -1L), class = "data.frame")
    d <- data.frame(animal=factor(c(rep("Animals", critters$Animals),
           rep("Bears", critters$Bears), rep("PolarBears", critters$PolarBears)),
           levels = c("PolarBears", "Bears", "Animals"), ordered= TRUE))
    levels(d$animal) <- apply(data.frame(table(d$animal)), 1, paste, collapse = ": ")
    ggplot(d, aes(x = factor(1), fill = factor(animal))) +  geom_bar() +
      coord_polar() + labs(x = NULL, fill = NULL) +
      scale_fill_manual(values = c("firebrick2", "yellow2", "green3")) +
      opts(title = paste("Animals, Bears and Polar Bears:\nOmaha Zoo", sep=""))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.