title: Plotting dot plot with enough space of ticks in Python/matplotlib?
body: <p>In the following code snippet:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  import pandas.rpy.common as com
  import matplotlib.pyplot as plt
  mtcars = com.load_data("mtcars")
  df = mtcars.groupby(["cyl"]).apply(lambda x: pd.Series([x["cyl"].count(), np.mean(x["wt"])], index=["n", "wt"])).reset_index()
  plt.plot(df["n"], range(len(df["cyl"])), "o")
  plt.yticks(range(len(df["cyl"])), df["cyl"])
  plt.show()
  </code></pre>
  
  <p>This code outputs the dot plot graph, but the result looks quite awful, since both the xticks and yticks don't have enough space, that it's quite difficult to notice both <code>4</code> and <code>8</code> of the <code>cyl</code> variable output its values in the graph.</p>
  
  <p>So how can I plot it with enough space in advance, much like you can do it without any hassles in R/ggplot2?</p>
  
  <p>For your information, both of <a href="https://stackoverflow.com/questions/5080058/python-matplotlib-adjusting-the-spacing-between-the-edge-of-the-plot-and-the-x">this code</a> and <a href="https://stackoverflow.com/questions/8920436/matplotlib-how-to-start-ticks-leaving-space-from-the-axis-origin">this</a> doesn't work in my case. Anyone knows the reason? And do I have to bother to creating such subplots in the first place? Is it impossible to automatically adjust the ticks with response to the input values?</p>