Q:

Matplotlib plot displays date which is not in the pandas dateframe

I have a simple data-frame which has a list of 10 days. Out of those 10 days 1 is a holiday. I have assigned a value (1) to each date in the data frame. I am trying to plot the data. The 5th of January is supposed to be a holiday, but it gets printed on the plot even though I have excluded it during the creation of the dictionary using which the data frame was created. My code is as follows.
from datetime import date, timedelta
import matplotlib.pyplot as plt
from pandas import DataFrame, to_datetime

START_DATE = date(2019,1,1)
DATE_LIST = []

for i in range(10):
    DATE = START_DATE + timedelta(i)
    if DATE != date(2019,1,5):
        DATE_LIST.append(DATE)

DATE_DICTIONARY = {}.fromkeys(DATE_LIST, 1)

DATAFRAME = DataFrame({"Value":DATE_DICTIONARY})
DATAFRAME.reindex(to_datetime(DATAFRAME.index)).plot(legend=False)
plt.show()

The output when the  
if DATE != date(2019,1,5):

is removed and the 5th of January is also added to the DATE_LIST looks 
something like this
Figure when the january 5th is added
I want the exact same format of x axis but, without 5th of januray but upon execution of my code this is what I get.
Figure when january 5th is excluded

A:

It's not surprising that the number 5 is still present between 4 and 6, independent on if you actually have that number in your data.  
If you want to treat dates as categories you can use matplotlib.
from datetime import date, timedelta
import matplotlib.pyplot as plt
from pandas import DataFrame, to_datetime

START_DATE = date(2019,1,1)
DATE_LIST = []

for i in range(10):
    DATE = START_DATE + timedelta(i)
    if DATE != date(2019,1,5):
        DATE_LIST.append(DATE)

DATE_DICTIONARY = {}.fromkeys(DATE_LIST, 1)

df = DataFrame({"Value":DATE_DICTIONARY})
df = df.reindex(to_datetime(df.index))

plt.plot(df.index.astype(str), df.values)
plt.setp(plt.gca().get_xticklabels(), rotation=45, ha="right")
plt.tight_layout()
plt.show()

