title: Plotting pandas dataframe after doing pandas melt is slow and creates strange y-axis
body: <p>This could be caused by me not understanding how <a href="http://pandas.pydata.org/pandas-docs/version/0.22/generated/pandas.melt.html" rel="nofollow noreferrer"><code>pandas.melt</code></a> works but I get strange behaviour when plotting "melted" dataframes using <a href="https://github.com/has2k1/plotnine" rel="nofollow noreferrer">plotnine</a>. Both frames has been converted from wide to long format. One frame with a column containing string values (<code>df_slow</code>) and another with only numerical values (<code>df_fast</code>). </p>
  
  <p>The following code gives different behaviour. Plotting <code>df_slow</code> is slow and gives a strange looking y-axis. Plotting <code>df_fast</code> looks ok and is fast. My guess is that pandas melt is doing something strange with the data which causes this behaviour. See example plots. </p>
  
  <pre class="lang-python prettyprint-override"><code>import matplotlib.pyplot as plt
  import numpy as np
  import pandas as pd
  import plotnine as p9
  
  SIZE = 200
  value = np.random.rand(SIZE, 1)
  
  # Create test data, one with a column containing strings, one with only numeric values
  df_slow = pd.DataFrame({'value': value.flatten(), 'string_column': ['A']*SIZE})
  df_fast = pd.DataFrame({'value': value.flatten()})
  
  # Set index
  df_slow = df_slow.reset_index()
  df_fast = df_fast.reset_index()
  
  # Convert 'df_slow', 'df_fast' to long format
  df_slow = pd.melt(df_slow, id_vars='index')
  df_fast = pd.melt(df_fast, id_vars='index')
  
  print(df_slow.head())
  print(df_fast.head())
  df_slow = df_slow[df_slow.variable == 'value']
  
  # This is slow and has many breaks on y-axis
  p = (p9.ggplot(df_slow, p9.aes(x='index', y='value')) + p9.geom_point())
  p.draw()
  
  # This is much faster and y-axis looks good
  p = (p9.ggplot(df_fast, p9.aes(x='index', y='value')) + p9.geom_point())
  p.draw()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3kLFK.png" rel="nofollow noreferrer">slow and strange plot</a></p>
  
  <p><a href="https://i.stack.imgur.com/QrDPO.png" rel="nofollow noreferrer">fast and good looking plot</a></p>
  
  <h2>Possible fix</h2>
  
  <p>Changing the type of  the "value" column in <code>df_slow</code> makes it behave like <code>df_fast</code> when plotting.</p>
  
  <pre class="lang-python prettyprint-override"><code># This makes df_slow behave like df_fast when plotting
  df_slow['value'] = df_slow.value.astype(np.float64)
  </code></pre>
  
  <h2>Question</h2>
  
  <p>Is this a bug in <a href="https://github.com/has2k1/plotnine" rel="nofollow noreferrer">plotnine</a> (or <a href="http://pandas.pydata.org/pandas-docs/version/0.22/index.html" rel="nofollow noreferrer">pandas</a>) or am I doing something wrong?</p>
  
  <h2>Answer</h2>
  
  <p>When pivoting two columns with different data types, in this case string and float, I guess it makes sense that the resulting column containing both strings and floats will have the type object. As 
  ALollz pointed out this probably makes plotnine interpret the values as strings which causes this behavior. </p>