I'm using plotrix in R to plot a state level map of the US. It has an excellent function floating.pie to put pie charts on each state.

I'm wondering if there are similar functions within the plotrix package to display bar charts in each state? (I took a look at the documentation and the functions that deal with bar charts don't seem to have this possibility, but I just wanted to be sure.) I prefer to work within the plotrix package if possible, but feel free to name other packages.

As an example, I would be interested in producing a map similar to this (but for the US):

enter image description here

For my US map, there would be 50 bar charts, one for each state.

I got this map from https://stackoverflow.com/questions/20465070/barplots-on-a-map, but it seems that ggsubplot doesn't work on my version of R (similar to what others have been saying on the post).

  • 1
    I also knew how to do it with ggsubplot package, but it is now deprecated and it won't work (as you mentioned). Perhaps this post can be a starting point: stackoverflow.com/questions/36063043/… – Andre Silva Dec 14 '16 at 14:03
  • Consult the documentation on plotrix, to see if such functions exist. Then consult the creator of plotrix. – Mox Mar 5 '18 at 19:53

ggplot2 and ggvis are two libraries which may help you to display the plots on the map. In ggplot2 you can plot bubbles on the map and then you just need to give aes() the coordinates which have nothing to do with the size and color of bubble. Regarding bar chart, you need to assign at least 2 pairs of x and y, one for bar chart location and the other for the height and width of the bar chart. In other words, you need to know the coordinates of 4 corners for a bar.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.