I have the a dataframe(df) which has the data of a Job being executed at different time intervals. It includes the following details about the execution of a job:

  1. Job Start Time (START)
  2. Job End Time (END)
  3. Time Interval (interval) i.e., END - START.

A small part of dataframe is shown below.


  END    |  START   |  interval
1423.0   |  1357.0  |    66.0
33277.0  |  33325.0 |   -48.0
42284.0  |  42250.0 |    34.0
53466.0  |  53218.0 |   248.0
62158.0  |  62073.0 |    85.0

I want to plot a graph with the x-axis as the timestamp and the y-axis with the interval. I tried to do it with the START time but it is not giving the correct result. How can we do this?


fig_dims = (12, 10)
fig, ax = plt.subplots(figsize=fig_dims)

sns.lineplot(x = 'START', y = 'interval', data = df, ax = ax)

enter image description here

Required Output
x-axis - Timestamp
y-axis - Interval

  • $\begingroup$ What timestamp would a start value of 1357 be? $\endgroup$
    – Oxbowerce
    Feb 24, 2021 at 12:58
  • $\begingroup$ It will be 1357 $\endgroup$
    – Subhawna
    Feb 24, 2021 at 12:59
  • $\begingroup$ Then I am not exactly sure why the current plot is not what you want? The x-axis shows the values from 0 up to 1*10^9, which is the range of the START column, and the y-axis shows the interval, which can have both positive and negative values. $\endgroup$
    – Oxbowerce
    Feb 24, 2021 at 13:13
  • $\begingroup$ Yes, I get it but this graph is not making any sense, is there a different way to plot this so that I can infer something? $\endgroup$
    – Subhawna
    Feb 24, 2021 at 13:19
  • $\begingroup$ That completely depends on what you are trying to infer. Because you have such a long range of values that shift up and down quite a bit the line chart get compressed quite heavily using the default size. You could try increasing the size of plot (mainly the width), however you might end up with an extremely large plot before you can actually can see the individual line. $\endgroup$
    – Oxbowerce
    Feb 24, 2021 at 13:22

1 Answer 1


Some suggested alternative plotting methods to visualise this data:

  1. Histogram of the y-axis. Check the distribution of time intervals

    df.plot.hist(by='interval', bins=10) #test varying the bin size

  2. Plot smaller subsets of the data if the order is important e.g. df[:100].plot() furthermore, if there is periodicity in the data, e.g. daily, hourly etc. you could plot each hour on top of each other (in a different colour) to compare the differences between periods.

  • $\begingroup$ Did this solve your problem? Let me know if you have any questions $\endgroup$
    – WBM
    Feb 26, 2021 at 15:33
  • $\begingroup$ Otherwise please accept the answer $\endgroup$
    – WBM
    Mar 4, 2021 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.