<p dir="auto">Presently the facetgrid accept:</p>
<p dir="auto">row, col, hue : strings<br>
Variables that define subsets of the data, which will be drawn on separate facets in the grid.</p>
<p dir="auto">Suppose I want to use a variable that it is not a column of my dataset, but that it can be computed starting from that. What I need to do now is to add a new column to my dataset and then use the name of this new column as argument.</p>
<p dir="auto">Suppose I want to set the hue depending on the column 'column1' which is of type string, but I want to ignore the case. What about something like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="hue = lambda x: x['column1'].capitalize()"><pre class="notranslate"><code class="notranslate">hue = lambda x: x['column1'].capitalize()
</code></pre></div>
<p dir="auto">In addition it would be nice to add the possibility to use ranges. Suppose I want to set hue depending on column 'column2' which is of type float. Here I want to define categories depending on some binning as in pandas.Cut. As before I would like to avoid to add a column to my dataframe just to do a plot.</p>
<p dir="auto">When the category you are mapping out to use as the hue in facetgrid contains three items then they do not colour as they should, instead taking on a grayscale when plotted using pyplot scatter. See attached code and image.</p>
<p dir="auto">This issue was fixed for lmplot from Seaborn 0.6 to 0.7, but is still present in the facetgrid.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/17030467/12780601/ba9a3d00-ca66-11e5-9ad1-8e85b9addf11.png"><img src="https://cloud.githubusercontent.com/assets/17030467/12780601/ba9a3d00-ca66-11e5-9ad1-8e85b9addf11.png" alt="seaborn" style="max-width: 100%;"></a><br>
Points from category 'three'  circled in red.</p>
<p dir="auto">python 2.7<br>
pandas version: 0.17.1<br>
numpy version:  1.10.1<br>
matplotlib version: 1.5.1<br>
seaborn version: 0.7.0</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.DataFrame(np.random.randint(0,100,size=(15, 4)), columns=list('ABCD'))

lst = ['one', 'two', 'two', 'three', 'three', 'three', 'four', 'four', 'four',
'four', 'five', 'five', 'five', 'five', 'five']

df[&quot;color&quot;] = lst

print df

graph = sns.FacetGrid(data=df, hue='color')
graph.map(plt.scatter, 'A', 'B', s=300,
          alpha=1, edgecolors='black', linewidths=1)
plt.legend(loc='center left', bbox_to_anchor=(1.01, 0.5))
plt.show()"><pre class="notranslate"><code class="notranslate">import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.DataFrame(np.random.randint(0,100,size=(15, 4)), columns=list('ABCD'))

lst = ['one', 'two', 'two', 'three', 'three', 'three', 'four', 'four', 'four',
'four', 'five', 'five', 'five', 'five', 'five']

df["color"] = lst

print df

graph = sns.FacetGrid(data=df, hue='color')
graph.map(plt.scatter, 'A', 'B', s=300,
          alpha=1, edgecolors='black', linewidths=1)
plt.legend(loc='center left', bbox_to_anchor=(1.01, 0.5))
plt.show()
</code></pre></div>