Advice in how to plot this database

I have a database with these columns: Country, Manufacturer and Volume. For this I want to concetrate on country (there are 5) and the manufacturers. What´s the best way to plot a graphic in R. if I want to compare the manufacturers presence by country. I´m still getting the hand of the language. Thanks

Any reason you wouldn't choose a bar chart?

Do you have a preference for "base" R or ggplot2?

Yes I was thinking of a bar chart in order to reflect the presence of each manufacturer in each country. What I believe I have to do is I to subset the database and use that to get the bar chart, and thats where I´m having issues. I´m using ggplot2.

No need to subset.

I'm assuming your data is in an object called myDataFrame


myDataFrame <- data.frame (
  Country = c(rep(letters[1:5],10)),
  Manufacturer = c(rep(LETTERS[11:20], 5)),
  Volume = c(rep(1:25,2)))

require(ggplot2)
require(tidyverse)

myDataFrame %>%
  ggplot ( aes (x = Manufacturer, y = Volume, fill = Manufacturer)) +
  geom_col() + 
facet_wrap(~Country)

This topic was automatically closed 21 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.