title: I am trying to PLot Bar chart by integrating matplotlib with Pyspark. I am getting error
body: <p>I am trying to plot a bar chart using matplotlib in pyspark, i am getting error. </p>
  
  <pre><code>import matplotlib.pyplot as plt
  %matplotlib inline
  x_labels = violationcode_freq['Violation Code'].values
  fig = violationcode_freq[['count']].plot(kind='bar', facecolor='lightblue')
  fig.set_xticklabels(x_labels)
  fig.set_title('Counts of trips by passenger count')
  fig.set_xlabel('Passenger count in trips')
  fig.set_ylabel('Trip counts')
  plt.show()
  </code></pre>
  
  <pre><code>Error : 
  
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-22-19a8720dda44&gt; in &lt;module&gt;()
        1 import matplotlib.pyplot as plt
        2 get_ipython().run_line_magic('matplotlib', 'inline')
  ----&gt; 3 x_labels = violationcode_freq['Violation Code'].values
        4 fig = violationcode_freq[['count']].plot(kind='bar', facecolor='lightblue')
        5 fig.set_xticklabels(x_labels)
  
  TypeError: 'NoneType' object is not subscriptable
  </code></pre>