ValueError: view limit minimum 0.0 is less than 1 and is an invalid Matplotlib date value.











up vote
0
down vote

favorite












I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (30,26)



Index        DateTimestamp              0.0      5.0     34.0 ... 22.0 
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00


It should look this:



enter image description here



the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns.
Here is the code:
#Initialize the figure



plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,5, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df[' DateTimestamp'], df[v], marker='', color='grey', linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df[' DateTimestamp'], df[column], marker='', color=palette(num), linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,30)
plt.ylim(0,0) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(7) :
plt.tick_params(labelbottom='off')
if num not in [1,4,7] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black', style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Note', ha='center', va='center', rotation='vertical')


However,i get error:



Traceback (most recent call last):
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncoreformatters.py", line 307, in __call__return printer(obj)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 240, in <lambda> png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 124, in print_figure fig.canvas.print_figure(bytes_io, **kw)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackend_bases.py", line 2212, in print_figure**kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 513, in print_png FigureCanvasAgg.draw(self)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 433, in draw self.figure.draw(self.renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibfigure.py", line 1475, in draw renderer, self, artists, self.suppressComposite)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxes_base.py", line 2607, in draw mimage._draw_list_compositing_images(renderer, self, artists)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1190, in draw ticks_to_draw = self._update_ticks(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1028, in _update_ticks tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 971, in iter_ticks majorLocs = self.major.locator()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1249, in __call__self.refresh()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1269, in refresh dmin, dmax = self.viewlim_to_dt()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1026, in viewlim_to_dt.format(vmin))
ValueError: view limit minimum 0.0 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 <Figure size 432x288 with 25 Axes>









share|improve this question






















  • What purpose does plt.xlim(0,30) serve? I suppose 0 and 30 are way off the real data and 0 is not a valid date, hence the error.
    – ImportanceOfBeingErnest
    Nov 11 at 2:09










  • Thanks for your response.I was thinking to represent xlim(0,30) as the number of days. What do you propose as the likely solution.
    – Bode
    Nov 11 at 9:23










  • If you have a column in your dataframe which contains the numbers 0 to 30 you can use xlim(0,30). But currently you are plotting the dates on the x axis. If your dates are sorted and equally spaced, you might just plot the dataframe index instead of the dates, plt.plot(df.index, df[column]).
    – ImportanceOfBeingErnest
    Nov 11 at 11:59










  • Thanks a lot ...but there are some days that are missing so the dates are not equally spaced...so the plot won't be accurate
    – Bode
    Nov 11 at 14:26










  • My comment above contains two options. I suppose you are then looking for the first one?
    – ImportanceOfBeingErnest
    Nov 11 at 14:33















up vote
0
down vote

favorite












I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (30,26)



Index        DateTimestamp              0.0      5.0     34.0 ... 22.0 
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00


It should look this:



enter image description here



the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns.
Here is the code:
#Initialize the figure



plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,5, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df[' DateTimestamp'], df[v], marker='', color='grey', linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df[' DateTimestamp'], df[column], marker='', color=palette(num), linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,30)
plt.ylim(0,0) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(7) :
plt.tick_params(labelbottom='off')
if num not in [1,4,7] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black', style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Note', ha='center', va='center', rotation='vertical')


However,i get error:



Traceback (most recent call last):
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncoreformatters.py", line 307, in __call__return printer(obj)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 240, in <lambda> png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 124, in print_figure fig.canvas.print_figure(bytes_io, **kw)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackend_bases.py", line 2212, in print_figure**kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 513, in print_png FigureCanvasAgg.draw(self)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 433, in draw self.figure.draw(self.renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibfigure.py", line 1475, in draw renderer, self, artists, self.suppressComposite)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxes_base.py", line 2607, in draw mimage._draw_list_compositing_images(renderer, self, artists)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1190, in draw ticks_to_draw = self._update_ticks(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1028, in _update_ticks tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 971, in iter_ticks majorLocs = self.major.locator()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1249, in __call__self.refresh()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1269, in refresh dmin, dmax = self.viewlim_to_dt()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1026, in viewlim_to_dt.format(vmin))
ValueError: view limit minimum 0.0 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 <Figure size 432x288 with 25 Axes>









share|improve this question






















  • What purpose does plt.xlim(0,30) serve? I suppose 0 and 30 are way off the real data and 0 is not a valid date, hence the error.
    – ImportanceOfBeingErnest
    Nov 11 at 2:09










  • Thanks for your response.I was thinking to represent xlim(0,30) as the number of days. What do you propose as the likely solution.
    – Bode
    Nov 11 at 9:23










  • If you have a column in your dataframe which contains the numbers 0 to 30 you can use xlim(0,30). But currently you are plotting the dates on the x axis. If your dates are sorted and equally spaced, you might just plot the dataframe index instead of the dates, plt.plot(df.index, df[column]).
    – ImportanceOfBeingErnest
    Nov 11 at 11:59










  • Thanks a lot ...but there are some days that are missing so the dates are not equally spaced...so the plot won't be accurate
    – Bode
    Nov 11 at 14:26










  • My comment above contains two options. I suppose you are then looking for the first one?
    – ImportanceOfBeingErnest
    Nov 11 at 14:33













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (30,26)



Index        DateTimestamp              0.0      5.0     34.0 ... 22.0 
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00


It should look this:



enter image description here



the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns.
Here is the code:
#Initialize the figure



plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,5, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df[' DateTimestamp'], df[v], marker='', color='grey', linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df[' DateTimestamp'], df[column], marker='', color=palette(num), linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,30)
plt.ylim(0,0) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(7) :
plt.tick_params(labelbottom='off')
if num not in [1,4,7] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black', style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Note', ha='center', va='center', rotation='vertical')


However,i get error:



Traceback (most recent call last):
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncoreformatters.py", line 307, in __call__return printer(obj)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 240, in <lambda> png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 124, in print_figure fig.canvas.print_figure(bytes_io, **kw)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackend_bases.py", line 2212, in print_figure**kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 513, in print_png FigureCanvasAgg.draw(self)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 433, in draw self.figure.draw(self.renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibfigure.py", line 1475, in draw renderer, self, artists, self.suppressComposite)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxes_base.py", line 2607, in draw mimage._draw_list_compositing_images(renderer, self, artists)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1190, in draw ticks_to_draw = self._update_ticks(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1028, in _update_ticks tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 971, in iter_ticks majorLocs = self.major.locator()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1249, in __call__self.refresh()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1269, in refresh dmin, dmax = self.viewlim_to_dt()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1026, in viewlim_to_dt.format(vmin))
ValueError: view limit minimum 0.0 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 <Figure size 432x288 with 25 Axes>









share|improve this question













I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (30,26)



Index        DateTimestamp              0.0      5.0     34.0 ... 22.0 
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00


It should look this:



enter image description here



the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns.
Here is the code:
#Initialize the figure



plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,5, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df[' DateTimestamp'], df[v], marker='', color='grey', linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df[' DateTimestamp'], df[column], marker='', color=palette(num), linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,30)
plt.ylim(0,0) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(7) :
plt.tick_params(labelbottom='off')
if num not in [1,4,7] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black', style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Note', ha='center', va='center', rotation='vertical')


However,i get error:



Traceback (most recent call last):
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncoreformatters.py", line 307, in __call__return printer(obj)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 240, in <lambda> png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesIPythoncorepylabtools.py", line 124, in print_figure fig.canvas.print_figure(bytes_io, **kw)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackend_bases.py", line 2212, in print_figure**kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 513, in print_png FigureCanvasAgg.draw(self)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibbackendsbackend_agg.py", line 433, in draw self.figure.draw(self.renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibfigure.py", line 1475, in draw renderer, self, artists, self.suppressComposite)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxes_base.py", line 2607, in draw mimage._draw_list_compositing_images(renderer, self, artists)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibimage.py", line 141, in _draw_list_compositing_images a.draw(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibartist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1190, in draw ticks_to_draw = self._update_ticks(renderer)
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 1028, in _update_ticks tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibaxis.py", line 971, in iter_ticks majorLocs = self.major.locator()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1249, in __call__self.refresh()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1269, in refresh dmin, dmax = self.viewlim_to_dt()
File "C:UserstyAppDataLocalContinuumAnaconda3libsite-packagesmatplotlibdates.py", line 1026, in viewlim_to_dt.format(vmin))
ValueError: view limit minimum 0.0 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 <Figure size 432x288 with 25 Axes>






python-3.x pandas matplotlib






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 1:58









Bode

14711




14711












  • What purpose does plt.xlim(0,30) serve? I suppose 0 and 30 are way off the real data and 0 is not a valid date, hence the error.
    – ImportanceOfBeingErnest
    Nov 11 at 2:09










  • Thanks for your response.I was thinking to represent xlim(0,30) as the number of days. What do you propose as the likely solution.
    – Bode
    Nov 11 at 9:23










  • If you have a column in your dataframe which contains the numbers 0 to 30 you can use xlim(0,30). But currently you are plotting the dates on the x axis. If your dates are sorted and equally spaced, you might just plot the dataframe index instead of the dates, plt.plot(df.index, df[column]).
    – ImportanceOfBeingErnest
    Nov 11 at 11:59










  • Thanks a lot ...but there are some days that are missing so the dates are not equally spaced...so the plot won't be accurate
    – Bode
    Nov 11 at 14:26










  • My comment above contains two options. I suppose you are then looking for the first one?
    – ImportanceOfBeingErnest
    Nov 11 at 14:33


















  • What purpose does plt.xlim(0,30) serve? I suppose 0 and 30 are way off the real data and 0 is not a valid date, hence the error.
    – ImportanceOfBeingErnest
    Nov 11 at 2:09










  • Thanks for your response.I was thinking to represent xlim(0,30) as the number of days. What do you propose as the likely solution.
    – Bode
    Nov 11 at 9:23










  • If you have a column in your dataframe which contains the numbers 0 to 30 you can use xlim(0,30). But currently you are plotting the dates on the x axis. If your dates are sorted and equally spaced, you might just plot the dataframe index instead of the dates, plt.plot(df.index, df[column]).
    – ImportanceOfBeingErnest
    Nov 11 at 11:59










  • Thanks a lot ...but there are some days that are missing so the dates are not equally spaced...so the plot won't be accurate
    – Bode
    Nov 11 at 14:26










  • My comment above contains two options. I suppose you are then looking for the first one?
    – ImportanceOfBeingErnest
    Nov 11 at 14:33
















What purpose does plt.xlim(0,30) serve? I suppose 0 and 30 are way off the real data and 0 is not a valid date, hence the error.
– ImportanceOfBeingErnest
Nov 11 at 2:09




What purpose does plt.xlim(0,30) serve? I suppose 0 and 30 are way off the real data and 0 is not a valid date, hence the error.
– ImportanceOfBeingErnest
Nov 11 at 2:09












Thanks for your response.I was thinking to represent xlim(0,30) as the number of days. What do you propose as the likely solution.
– Bode
Nov 11 at 9:23




Thanks for your response.I was thinking to represent xlim(0,30) as the number of days. What do you propose as the likely solution.
– Bode
Nov 11 at 9:23












If you have a column in your dataframe which contains the numbers 0 to 30 you can use xlim(0,30). But currently you are plotting the dates on the x axis. If your dates are sorted and equally spaced, you might just plot the dataframe index instead of the dates, plt.plot(df.index, df[column]).
– ImportanceOfBeingErnest
Nov 11 at 11:59




If you have a column in your dataframe which contains the numbers 0 to 30 you can use xlim(0,30). But currently you are plotting the dates on the x axis. If your dates are sorted and equally spaced, you might just plot the dataframe index instead of the dates, plt.plot(df.index, df[column]).
– ImportanceOfBeingErnest
Nov 11 at 11:59












Thanks a lot ...but there are some days that are missing so the dates are not equally spaced...so the plot won't be accurate
– Bode
Nov 11 at 14:26




Thanks a lot ...but there are some days that are missing so the dates are not equally spaced...so the plot won't be accurate
– Bode
Nov 11 at 14:26












My comment above contains two options. I suppose you are then looking for the first one?
– ImportanceOfBeingErnest
Nov 11 at 14:33




My comment above contains two options. I suppose you are then looking for the first one?
– ImportanceOfBeingErnest
Nov 11 at 14:33

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245199%2fvalueerror-view-limit-minimum-0-0-is-less-than-1-and-is-an-invalid-matplotlib-d%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245199%2fvalueerror-view-limit-minimum-0-0-is-less-than-1-and-is-an-invalid-matplotlib-d%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python