4

Beautiful and useful plots, this seaborn.

I am trying to position violinplots on the abcissa, as the distributions I am investigating depend on a numerical parameter. Should really be quite easy with

import matplotlib as plt
import seaborn as sns
import numpy as np
y = list()
for n in (10, 100, 1000):
    rs = np.random.RandomState(0);
    y.append(rs.normal(0, 2, n))
sns.violinplot(data=y, positions=(0, 5, 7))

if I want the abcissa positions of the violins to be at 0, 5 and 7, respectively. In this answer mwaskom points out that violinplot takes a positions argument. Regardless of what I do, such as passing a numpy array or tuple, the positions of the violinplots remain the same and seem to be assigned to an increasing integer starting with 0.

Community
  • 1
  • 1
Philip Harding
  • 392
  • 1
  • 10
  • The positions argument was removed from `violinplot` a few versions ago, unfortunately. – mwaskom Apr 11 '16 at 14:49
  • 2
    But there is a relevant answer here: http://stackoverflow.com/questions/35090425/seaborn-boxplots-at-desired-distances-along-the-x-axis – mwaskom Apr 11 '16 at 14:50
  • Fanstastic! I hadn't seen that post. If you change your comment into an answer, I'll accept it. – Philip Harding Apr 12 '16 at 06:08

0 Answers0