0

I am currently generating a plot with the following code:

import matplotlib.pyplot as plt
import pandas as pd

data = pd.read_excel(r'C:\Users\marco\Desktop\Gm.xlsx', skiprows=0, sheet_name='MASCHDAT')
df = pd.DataFrame(data, columns= ['DATUM','W020'])

df['DATUM'] = df['DATUM'].apply(pd.to_datetime)
df.set_index('DATUM',inplace=True)

plt.rcParams['figure.figsize'] = (15, 8)

df['W020'].plot(grid = True)

df.head()
df.tail()
print(df.head())
print(df.tail())e

So my the data go from 2019-05 to 2019-12, increments by 2 minutes.

Graph

How can I avoid plotting these trending line between some dates in the entire data? I want to see these gaps. And as you also see in the picture. The plot makes a trending line, like there would be a gap, around September but there is some data there. Why is it making there, do i have to change to dotted lines?

Mr. T
  • 11,960
  • 10
  • 32
  • 54
Ghosts
  • 11
  • 1
  • A line plot will always connect the data points. Perhaps you should tray a scatter plot if you don't want the lines. – Trenton McKinney Nov 26 '20 at 23:05
  • @ghosts does ur data contain missing values? – ombk Nov 26 '20 at 23:06
  • no there arent missing values – Ghosts Nov 26 '20 at 23:07
  • you can either add the missing dates and keep their values NaN and change the plot marker to "-" or, you can plot fractions of the data on a single plot – ombk Nov 26 '20 at 23:09
  • `plt.plot(data.index – ombk Nov 26 '20 at 23:09
  • Group your data by whatever the criteria are that create your groups and plot the groups into one figure like it is done [here (but not into several subplots)](https://stackoverflow.com/a/64928953/8881141). – Mr. T Nov 27 '20 at 00:17

0 Answers0