{"action":"created","issue":{"url":"https://api.github.com/repos/STAT545-UBC/Discussion/issues/189","labels_url":"https://api.github.com/repos/STAT545-UBC/Discussion/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/STAT545-UBC/Discussion/issues/189/comments","events_url":"https://api.github.com/repos/STAT545-UBC/Discussion/issues/189/events","html_url":"https://github.com/STAT545-UBC/Discussion/issues/189","id":113469498,"number":189,"title":"stacked (but not to 100%) barplots?","user":{"login":"Poush87","id":10982612,"avatar_url":"https://avatars.githubusercontent.com/u/10982612?v=3","gravatar_id":"","url":"https://api.github.com/users/Poush87","html_url":"https://github.com/Poush87","followers_url":"https://api.github.com/users/Poush87/followers","following_url":"https://api.github.com/users/Poush87/following{/other_user}","gists_url":"https://api.github.com/users/Poush87/gists{/gist_id}","starred_url":"https://api.github.com/users/Poush87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Poush87/subscriptions","organizations_url":"https://api.github.com/users/Poush87/orgs","repos_url":"https://api.github.com/users/Poush87/repos","events_url":"https://api.github.com/users/Poush87/events{/privacy}","received_events_url":"https://api.github.com/users/Poush87/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-26T23:04:36Z","updated_at":"2015-10-26T23:38:07Z","closed_at":null,"body":"I have a dataset that includes 2 categorical variables S1B3_v16 and S1B3_v17 and want to represent both in the same barplot, as proportions and not counts: \r\nSo far I've got :\r\nq <- ggplot(nss66, aes(x=S1B3_v16, fill= S1B3_v17)) \r\nq + geom_bar(position ='fill')\r\nBut this stacks each bar to 100%. Is there any way to keep them stacked but not to 100%?\r\n\r\nThanks!  "},"comment":{"url":"https://api.github.com/repos/STAT545-UBC/Discussion/issues/comments/151314769","html_url":"https://github.com/STAT545-UBC/Discussion/issues/189#issuecomment-151314769","issue_url":"https://api.github.com/repos/STAT545-UBC/Discussion/issues/189","id":151314769,"user":{"login":"npjc","id":6063192,"avatar_url":"https://avatars.githubusercontent.com/u/6063192?v=3","gravatar_id":"","url":"https://api.github.com/users/npjc","html_url":"https://github.com/npjc","followers_url":"https://api.github.com/users/npjc/followers","following_url":"https://api.github.com/users/npjc/following{/other_user}","gists_url":"https://api.github.com/users/npjc/gists{/gist_id}","starred_url":"https://api.github.com/users/npjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npjc/subscriptions","organizations_url":"https://api.github.com/users/npjc/orgs","repos_url":"https://api.github.com/users/npjc/repos","events_url":"https://api.github.com/users/npjc/events{/privacy}","received_events_url":"https://api.github.com/users/npjc/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T23:38:07Z","updated_at":"2015-10-26T23:38:07Z","body":"It's hard to help specifically without a reproducible example to go from BUT i suspect the examples from the `?geom_bar` may come to the rescue.\r\n\r\n1. Go through these examples, and make sure you understand what's happening:\r\n```r\r\n# Bar charts are automatically stacked when multiple bars are placed\r\n# at the same location\r\nlibrary(ggplot2)\r\ng <- ggplot(mpg, aes(class))\r\ng + geom_bar(aes(fill = drv)) # defaults to stacking\r\ng + geom_bar(aes(fill = drv), position = \"stack\") \r\ng + geom_bar(aes(fill = drv), position = \"dodge\")\r\ng + geom_bar(aes(fill = drv), position = \"fill\")\r\n```\r\n\r\n2. Compare the shape of your data to that of the data in the example\r\n\r\nremember what jenny says:\r\n\r\n> 'it is most likely a data shaping problem not a graphing problem'."}}