Posts

Showing posts with the label pythonanywhere

Ordering and Formatting Dates on X-Axis in Seaborn Bar Plot

Image
Ordering and Formatting Dates on X-Axis in Seaborn Bar Plot This seems so simple, but for the life of me I can't figure it out. I am new to Python and Seaborn, and I am doing all this online at PythonAnywhere. All I am trying to do is create a simple barplot in seaborn, with dates ordered properly (that is, ascending from left to right), on the x-axis. When I try this: import matplotlib.pyplot as plt import matplotlib.dates as mdates import datetime import pandas as pd import seaborn as sns emp = pd.DataFrame([[32, "5/31/2018"], [3, "2/28/2018"], [40, "11/30/2017"], [50, "8/31/2017"], [51, "5/31/2017"]], columns=["jobs", "12monthsEnding"]) fig = plt.figure(figsize = (10,7)) sns.barplot(x = "12monthsEnding", y = "uniqueClientExits", data = emp, estimator = sum, ci = None) fig.autofmt_xdate() plt.show() I get this: Nice looking bar graph but with the dates ordered descending from ...