title: Adjusting the Scale on Bar Chart in Pandas
body: <p>So I am plotting to visualize the education difference between genders in a given dataset.
  I group the employees by gender, summing their years_in_education with this code</p>
  
  <pre><code>df1 = df[["gender","years_in_education"]] #creating a sub-dataframe with only the columns of gender and hourly wage
  staff4=df1.groupby(['gender']).sum() #grouping the data frame by gender and assigning it to a new variable 'staff4'
  staff4.head() #creating a visual of the grouped data for inspection
  </code></pre>
  
  <p>Then I use a bar chart to plot the difference with this code >></p>
  
  <pre><code>my_plot = staff4.T.plot(kind='bar',title="Education difference between Genders") #creating the parameters to plot the graph
  </code></pre>
  
  <p>The graph comes out as this >></p>
  
  <p><a href="https://i.stack.imgur.com/82iyE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/82iyE.jpg" alt="Graph Before Scale"></a></p>
  
  <p>But I observe the that scale of the y-axis is outrageous as the highest year in employment by the data is 30. I intend to adjust the scale to range from 0 - 30. I did that using <code>my_plot.set_ylim([0,30])</code> and the result of that was >></p>
  
  <p><a href="https://i.stack.imgur.com/HP4Nc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HP4Nc.jpg" alt="Graph after adjusting scale"></a></p>
  
  <p>This graph is not reflective of the data as shown in the first. What can I do to change that?</p>
  
  <p>Any ideas pls? How can I also change the orientation of the label on the y-axis.</p>