pythonpowerbiswarmplot

swarmplot palette in power bi doesn't change the color


I am trying to work with power bi and python by creating a single dimension clustering with swarmplot.

Everything is perfect except the color scale that I assign to it. This is my code. X="Centros" (crosses) and hue="Equipos" (teams).

import matplotlib.pyplot as plt

#fig. ax = plt.subplots()

sns.set(style="whitegrid", palette="muted")
sns.swarmplot(x="Centros", hue="Equipos", palette=["red","coral","linegreen","forestgreen"],s=13, data=dataset,hue_order=['00-20','20-40','40-60','60-80','80-100'] )

plt.show()```

[enter image description here][1]


  [1]: https://i.sstatic.net/CnAqH.png

Solution

  • You need to build a dictionary into palette argument with the hue's categories... such as: sns.swarmplot(x='centros', hue='equipos', data=dataset, palette={'real':'yellow', 'barca': 'red', 'atletico': 'blue'}).

    It worked for me.