Note that there are some explanatory texts on larger screens.

plurals
  1. POExclude zero values from a ggplot barplot?
    primarykey
    data
    text
    <p>does anyone know if it is possible to exclude zero values from a barplot in ggplot?</p> <p>I have a dataset that contains proportions as follows:</p> <pre><code> X5employf prop X5employff 1 increase 0.02272727 2 increase 0.59090909 1 3 increase 0.02272727 1 and 8 4 increase 0.02272727 2 5 increase 0.34090909 3 6 increase 0.00000000 4 7 increase 0.00000000 5 8 increase 0.00000000 6 9 increase 0.00000000 6 and 7 10 increase 0.00000000 6 and 7 11 increase 0.00000000 7 12 increase 0.00000000 8 13 decrease 0.00000000 14 decrease 0.00000000 1 15 decrease 0.00000000 1 and 8 16 decrease 0.00000000 2 17 decrease 0.00000000 3 18 decrease 0.10000000 4 19 decrease 0.50000000 5 20 decrease 0.20000000 6 21 decrease 0.00000000 6 and 7 22 decrease 0.00000000 6 and 7 23 decrease 0.10000000 7 24 decrease 0.10000000 8 25 same 0.00000000 26 same 0.00000000 1 27 same 0.00000000 1 and 8 28 same 0.00000000 2 29 same 0.00000000 3 30 same 0.21052632 4 31 same 0.31578947 5 32 same 0.26315789 6 33 same 0.15789474 6 and 7 34 same 0.00000000 6 and 7 35 same 0.05263158 7 36 same 0.00000000 8 </code></pre> <p>as you can see in the 'prop' column there are a lot of zero values. I am producing a facetted bar plot with 'X5employf' column as the facet. But because of the zero values I end up with a lot of empty space on my plot(see below). Is there a way of forcing ggplot to not plot the zero values? Its not the case of dropping unused factors as these are not NA values but 0s. Any ideas??!</p> <p><img src="https://i.stack.imgur.com/PlreC.png" alt="example plot"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload