title: Python: Changing visual parameters of ptitprince repo derived from seaborn and matplotlib
body: <p>I am using a github repository called ptitprince, which is derived from seaborn and matplotlib, to generate graphs.</p>
  
  <p>For example, this is the code using the ptitprince repo:</p>
  
  <pre><code># coding: utf8
  
  import pandas as pd
  import ptitprince as pt
  import seaborn as sns
  import os
  import matplotlib.pyplot as plt
  #sns.set(style="darkgrid")
  #sns.set(style="whitegrid")
  #sns.set_style("white")
  sns.set(style="whitegrid",font_scale=2)
  import matplotlib.collections as clt
  
  df = pd.read_csv ("u118phag.csv", sep= ",")
  df.head()
  
  savefigs = True
  figs_dir = 'figs'
  
  if savefigs:
      # Make the figures folder if it doesn't yet exist
      if not os.path.isdir('figs'):
          os.makedirs('figs')
  
  #automation
  f, ax = plt.subplots(figsize=(4, 5))
  #f.subplots_adjust(hspace=0,wspace=0)
  dx = "Treatment"; dy = "score"; ort = "v"; pal = "Set2"; sigma = .2
  ax=pt.RainCloud(x = dx, y = dy, data = df, palette = pal, bw = sigma,
                   width_viol = .6, ax = ax, move=.2, offset=.1, orient = ort, pointplot = True)
  f.show()
  
  if savefigs:
      f.savefig('figs/figure20.png', bbox_inches='tight', dpi=500)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eZTYK.png" rel="nofollow noreferrer">which generates the following graph</a></p>
  
  <p>The raw code not using ptitprince is as follows and produces the same graph as above:</p>
  
  <pre><code># coding: utf8
  
  import pandas as pd
  import ptitprince as pt
  import seaborn as sns
  import os
  import matplotlib.pyplot as plt
  #sns.set(style="darkgrid")
  #sns.set(style="whitegrid")
  #sns.set_style("white")
  sns.set(style="whitegrid",font_scale=2)
  import matplotlib.collections as clt
  
  df = pd.read_csv ("u118phag.csv", sep= ",")
  df.head()
  
  savefigs = True
  figs_dir = 'figs'
  
  if savefigs:
      # Make the figures folder if it doesn't yet exist
      if not os.path.isdir('figs'):
          os.makedirs('figs')
  
  f, ax = plt.subplots(figsize=(7, 5))
  dy="Treatment"; dx="score"; ort="h"; pal = sns.color_palette(n_colors=1)
  
  #adding color
  pal = "Set2"
  f, ax = plt.subplots(figsize=(7, 5))
  ax=pt.half_violinplot( x = dx, y = dy, data = df, palette = pal, bw = .2, cut = 0.,
                        scale = "area", width = .6, inner = None, orient = ort)
  ax=sns.stripplot( x = dx, y = dy, data = df, palette = pal, edgecolor = "white",
                   size = 3, jitter = 1, zorder = 0, orient = ort)
  ax=sns.boxplot( x = dx, y = dy, data = df, color = "black", width = .15, zorder = 10,\
              showcaps = True, boxprops = {'facecolor':'none', "zorder":10},\
              showfliers=True, whiskerprops = {'linewidth':2, "zorder":10},\
                 saturation = 1, orient = ort)
  
  
  if savefigs:
      f.savefig('figs/figure21.png', bbox_inches='tight', dpi=500)
  </code></pre>
  
  <p>Now, what I'm trying to do is to figure out how to modify the graph so that I can (1) move the plots closer together, so there is not so much white space between them, and (2) shift the x-axis to the right, so that I can make the distribution (violin) plot wider without it getting cut in half by the y-axis.</p>
  
  <p>I have tried to play around with <code>subplots_adjust()</code> as you can see in the first box of code, but I receive an error. I cannot figure out how to appropriately use this function, or even if that will actually bring the different graphs closer together.</p>
  
  <p>I also know that I can increase the distribution size by increasing this value <code>width = .6</code>, but if I increase it too high, the distribution plot begins to being cut off by the y-axis. I can't figure out if I need to adjust the overall plot using the <code>plt.subplots</code>,or if I need to move each individual plot.</p>
  
  <p>Any advice or recommendations on how to change the visuals of the graph? I've been staring at this for awhile, and I can't figure out how to make seaborn/matplotlib play nicely with ptitprince.</p>