title: Sorting Altair column order
body: <p>I am new to using Altair and have crudely combined some code from <a href="https://stackoverflow.com/questions/22787209/how-to-have-clusters-of-stacked-bars-with-python-pandas">here</a> and <a href="https://stackoverflow.com/questions/43797379/how-to-create-a-grouped-bar-chart-in-altair">here</a> which gives me the plot below but I cannot work out why my columns are shown in a non-sequential order.  My dataframe is as follows:</p>
  
  <pre><code>import pandas as pd
  
  TimeMth = pd.DataFrame([['Jul-2011', '&gt; 1.1 pu',  86],
                         ['Jul-2011', '&lt; 0.94 pu',  18],
                         ['Aug-2011', '&gt; 1.1 pu',  205],
                         ['Aug-2011', '&lt; 0.94 pu', 510],
                         ['Sep-2011', '&gt; 1.1 pu',   53],
                         ['Sep-2011', '&lt; 0.94 pu', 140],
                         ['Oct-2011', '&gt; 1.1 pu',   10],
                         ['Oct-2011', '&lt; 0.94 pu',   0],
                         ['Nov-2011', '&gt; 1.1 pu',   36],
                         ['Nov-2011', '&lt; 0.94 pu',  13],
                         ['Dec-2011', '&gt; 1.1 pu',    7],
                         ['Dec-2011', '&lt; 0.94 pu',   0],
                         ['Jan-2012', '&gt; 1.1 pu',   17],
                         ['Jan-2012', '&lt; 0.94 pu',   0],
                         ['Feb-2012', '&gt; 1.1 pu',    0],
                         ['Feb-2012', '&lt; 0.94 pu',   0],
                         ['Mar-2012', '&gt; 1.1 pu',   17],
                         ['Mar-2012', '&lt; 0.94 pu',   1],
                         ['Apr-2012', '&gt; 1.1 pu',   49],
                         ['Apr-2012', '&lt; 0.94 pu',  79],
                         ['May-2012', '&gt; 1.1 pu',    8],
                         ['May-2012', '&lt; 0.94 pu',   0],
                         ['Jun-2012', '&gt; 1.1 pu',   40],
                         ['Jun-2012', '&lt; 0.94 pu',  12]],
                      columns=['Month','Voltage','No of Violations'])
  </code></pre>
  
  <p>which I then attempt to plot with:</p>
  
  <pre><code>import altair as alt
  
  chartTimeMth = alt.Chart(TimeMth).mark_bar().encode(
  column=alt.Column('Month',
              axis=alt.Axis(axisWidth=1.0, 
                 offset=-8.0, orient='bottom', labelAngle=-45, 
  labelAlign='right'),
              scale=alt.Scale(padding=4.0)),
  x=alt.X('Voltage',
         axis=False),
  y=alt.Y('No of Violations', title='No. of voltage violations', 
  axis=alt.Axis(grid=False)),
  color=alt.Color('Voltage', scale=alt.Scale(range=['#96ceb4', '#ffcc5c']))
  ).configure_facet_cell(
  strokeWidth=0.0,)\
  .configure_scale(bandSize=12)\
  .configure_legend(titleFontSize=12, offset=-60, orient='right')
  
  chartTimeMth.display()
  </code></pre>
  
  <p>When I use <a href="https://altair-viz.github.io/API.html?highlight=sort#altair.SortField" rel="nofollow noreferrer">sortField</a> on the columns it gets close to what I need but still not right.  I guess this is something to do with the fact that my column (Month) data is text?  Any ideas on why the above code (with the <em>sortField</em> class omitted) does not plot the columns in index order?
  If my <em>Month</em> data was <em>datetimeindex</em>, is there a way to tell Altair to label the x-axis as I have below (ie mmm-yyyy)?</p>
  
  <p><a href="https://i.stack.imgur.com/a2hWP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a2hWP.png" alt="enter image description here"></a></p>