Plot functions inside the cells return error, when executing in the console not

Hi all,
I am facing a very weird problem that I will try to describe as clear as possible.
I am running the following version of python

Python 3.6.8 |Anaconda, Inc.| (default, Dec 29 2018, 19:04:46)
Type ‘copyright’, ‘credits’ or ‘license’ for more information
IPython 7.5.0 – An enhanced Interactive Python. Type ‘?’ for help.

I have some code that does some plotting and when it runs inside a cell, some (and not always the same) of the plotting functions will return the following error

/anaconda3/envs/PythonFresh/lib/python3.6/site-packages/matplotlib/ in viewlim_to_dt(self)
1203 'often happens if you pass a non-datetime ’
1204 ‘value to an axis that has datetime units’
-> 1205 .format(vmin))
1206 return num2date(vmin,, num2date(vmax,

ValueError: view limit minimum -36805.66129843047 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units

Now, the weird part is that the data frames do not have the problems that the error message conveys -and- when I call the relevant function from the console

start='2019-02-08 13:32:07';end='2019-02-08 13:33:22'

it never but never returns this error message. What the function does is to plot based on the indexes

def define_drivetest(initial, end,plot=False):
    if (plot==True):
        plt.plot(data['All-Latitude'][initial:end].values, data['All-Longitude'][initial:end].values,'.')

It looks to be a jupyter issue when the plotting happening inside the cells.

Have you ever had any similar issue?

Thanks a lot

Let me know what more details are needed for this bug. I do not have much experience on how to make such reports.