<p dir="auto">Say you have some some incomplete data on weirdly growing plants, and want to plot it as below. You might want to explicitly exclude the <em>tree</em> data for <em>outdoor</em>, as you just didn't test it and do not want to confuse anyone. How can this be done? I would have expected <code class="notranslate">sharex=False</code> to accomplish this, but apparently it does not. I this intended and can this be done in another way? (In my real example I also have set <code class="notranslate">hue='other_attribute'</code> but it probably does not play a role in this discussion.)</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import seaborn as sns
from matplotlib import pyplot as plt
from pandas import DataFrame

data = DataFrame(
    data=[
        ['grass', 'indoor', 30],
        ['bushes', 'indoor', 80],
        ['tree', 'indoor', 100],
        ['grass', 'outdoor', 50],
        ['bushes', 'outdoor', 120]
        # this does not exist: ['tree', 'outdoor', 300],
    ],
    columns=[
        'type', 'where', 'height'
    ])

graph = sns.catplot(x=&quot;type&quot;, y=&quot;height&quot;, col=&quot;where&quot;, data=data,
                    kind=&quot;bar&quot;, orient=&quot;v&quot;)
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">seaborn</span> <span class="pl-k">as</span> <span class="pl-s1">sns</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">from</span> <span class="pl-s1">pandas</span> <span class="pl-k">import</span> <span class="pl-v">DataFrame</span>

<span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-v">DataFrame</span>(
    <span class="pl-s1">data</span><span class="pl-c1">=</span>[
        [<span class="pl-s">'grass'</span>, <span class="pl-s">'indoor'</span>, <span class="pl-c1">30</span>],
        [<span class="pl-s">'bushes'</span>, <span class="pl-s">'indoor'</span>, <span class="pl-c1">80</span>],
        [<span class="pl-s">'tree'</span>, <span class="pl-s">'indoor'</span>, <span class="pl-c1">100</span>],
        [<span class="pl-s">'grass'</span>, <span class="pl-s">'outdoor'</span>, <span class="pl-c1">50</span>],
        [<span class="pl-s">'bushes'</span>, <span class="pl-s">'outdoor'</span>, <span class="pl-c1">120</span>]
        <span class="pl-c"># this does not exist: ['tree', 'outdoor', 300],</span>
    ],
    <span class="pl-s1">columns</span><span class="pl-c1">=</span>[
        <span class="pl-s">'type'</span>, <span class="pl-s">'where'</span>, <span class="pl-s">'height'</span>
    ])

<span class="pl-s1">graph</span> <span class="pl-c1">=</span> <span class="pl-s1">sns</span>.<span class="pl-en">catplot</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s">"type"</span>, <span class="pl-s1">y</span><span class="pl-c1">=</span><span class="pl-s">"height"</span>, <span class="pl-s1">col</span><span class="pl-c1">=</span><span class="pl-s">"where"</span>, <span class="pl-s1">data</span><span class="pl-c1">=</span><span class="pl-s1">data</span>,
                    <span class="pl-s1">kind</span><span class="pl-c1">=</span><span class="pl-s">"bar"</span>, <span class="pl-s1">orient</span><span class="pl-c1">=</span><span class="pl-s">"v"</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/4403130/66123784-1c800680-e5e3-11e9-9d89-c1403134c673.png"><img src="https://user-images.githubusercontent.com/4403130/66123784-1c800680-e5e3-11e9-9d89-c1403134c673.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">I would have expected that I can visualize different categorical variables in a count plot using <code class="notranslate">catplot</code> and <code class="notranslate">melt</code>.<br>
However, it looks like the data is converted to categorical before grouping for the columns, and so the categories are shared among all the count plots. That doesn't really make sense if the different columns correspond to different categories.<br>
Am I overlooking something or is there a different way of doing this?</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
import seaborn as sns
ames = pd.read_excel(&quot;http://www.amstat.org/publications/jse/v19n3/decock/AmesHousing.xls&quot;)

cat_cols = ['MS Zoning', 'Street', 'Alley', 'Lot Shape', 'Land Contour',
       'Utilities', 'Lot Config', 'Land Slope', 'Neighborhood', 'Condition 1',
       'Condition 2', 'Bldg Type', 'House Style', 'Roof Style', 'Roof Matl',
       'Exterior 1st', 'Exterior 2nd', 'Mas Vnr Type', 'Exter Qual',
       'Exter Cond', 'Foundation', 'Bsmt Qual', 'Bsmt Cond', 'Bsmt Exposure',
       'BsmtFin Type 1', 'BsmtFin Type 2', 'Heating', 'Heating QC',
       'Central Air', 'Electrical', 'Kitchen Qual', 'Functional',
       'Fireplace Qu', 'Garage Type', 'Garage Finish', 'Garage Qual',
       'Garage Cond', 'Paved Drive', 'Pool QC', 'Fence', 'Misc Feature',
       'Sale Type', 'Sale Condition']
ames_cat = ames[cat_cols]
sns.catplot(x='value', col='variable', data=ames_cat.melt(), sharex=False, sharey=False, col_wrap=5, kind='count')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">seaborn</span> <span class="pl-k">as</span> <span class="pl-s1">sns</span>
<span class="pl-s1">ames</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">read_excel</span>(<span class="pl-s">"http://www.amstat.org/publications/jse/v19n3/decock/AmesHousing.xls"</span>)

<span class="pl-s1">cat_cols</span> <span class="pl-c1">=</span> [<span class="pl-s">'MS Zoning'</span>, <span class="pl-s">'Street'</span>, <span class="pl-s">'Alley'</span>, <span class="pl-s">'Lot Shape'</span>, <span class="pl-s">'Land Contour'</span>,
       <span class="pl-s">'Utilities'</span>, <span class="pl-s">'Lot Config'</span>, <span class="pl-s">'Land Slope'</span>, <span class="pl-s">'Neighborhood'</span>, <span class="pl-s">'Condition 1'</span>,
       <span class="pl-s">'Condition 2'</span>, <span class="pl-s">'Bldg Type'</span>, <span class="pl-s">'House Style'</span>, <span class="pl-s">'Roof Style'</span>, <span class="pl-s">'Roof Matl'</span>,
       <span class="pl-s">'Exterior 1st'</span>, <span class="pl-s">'Exterior 2nd'</span>, <span class="pl-s">'Mas Vnr Type'</span>, <span class="pl-s">'Exter Qual'</span>,
       <span class="pl-s">'Exter Cond'</span>, <span class="pl-s">'Foundation'</span>, <span class="pl-s">'Bsmt Qual'</span>, <span class="pl-s">'Bsmt Cond'</span>, <span class="pl-s">'Bsmt Exposure'</span>,
       <span class="pl-s">'BsmtFin Type 1'</span>, <span class="pl-s">'BsmtFin Type 2'</span>, <span class="pl-s">'Heating'</span>, <span class="pl-s">'Heating QC'</span>,
       <span class="pl-s">'Central Air'</span>, <span class="pl-s">'Electrical'</span>, <span class="pl-s">'Kitchen Qual'</span>, <span class="pl-s">'Functional'</span>,
       <span class="pl-s">'Fireplace Qu'</span>, <span class="pl-s">'Garage Type'</span>, <span class="pl-s">'Garage Finish'</span>, <span class="pl-s">'Garage Qual'</span>,
       <span class="pl-s">'Garage Cond'</span>, <span class="pl-s">'Paved Drive'</span>, <span class="pl-s">'Pool QC'</span>, <span class="pl-s">'Fence'</span>, <span class="pl-s">'Misc Feature'</span>,
       <span class="pl-s">'Sale Type'</span>, <span class="pl-s">'Sale Condition'</span>]
<span class="pl-s1">ames_cat</span> <span class="pl-c1">=</span> <span class="pl-s1">ames</span>[<span class="pl-s1">cat_cols</span>]
<span class="pl-s1">sns</span>.<span class="pl-en">catplot</span>(<span class="pl-s1">x</span><span class="pl-c1">=</span><span class="pl-s">'value'</span>, <span class="pl-s1">col</span><span class="pl-c1">=</span><span class="pl-s">'variable'</span>, <span class="pl-s1">data</span><span class="pl-c1">=</span><span class="pl-s1">ames_cat</span>.<span class="pl-en">melt</span>(), <span class="pl-s1">sharex</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">sharey</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">col_wrap</span><span class="pl-c1">=</span><span class="pl-c1">5</span>, <span class="pl-s1">kind</span><span class="pl-c1">=</span><span class="pl-s">'count'</span>)</pre></div>