How can I get such a plot? Do not know the type of plot it is

Tobitor

I have data which looks like this:

file | timestamps
1 | 02/01/1970 
1 | 03/01/1970 
1 | 04/01/1970
1 | 05/01/1970 
2 | 06/01/1970
2 | 07/01/1970
3 | 08/01/1970
3 | 09/01/1970
3 | 10/01/1970

On the x-axis I would like to have the number of rows per file. On the y-axis I would like to have timestamps. It should look similar to this plot but I do not know how to get this plot. Is this a waterfall plot?

unknown

Pierre Debaisieux

Not a lot of data, but this is the result with your example

import matplotlib.pyplot as plt
import matplotlib.patches as patches
import pandas as pd

data = [[1, '02/01/1970'],
        [1, '03/01/1970'],
        [1, '04/01/1970'],
        [1, '05/01/1970'],
        [2, '06/01/1970'],
        [2, '07/01/1970'],
        [3, '08/01/1970'],
        [3, '09/01/1970'],
        [3, '10/01/1970']]

df = pd.DataFrame(data, columns = ['file', 'timestamps'])
df['timestamps'] = pd.to_datetime(df['timestamps'], format = '%d/%m/%Y')

tot_delta_d = 0
tot_file = 0

fig, ax = plt.subplots()

for f in df['file'].unique():
  delta_d = df[df['file'] == f]['timestamps'].max() - df[df['file'] == f]['timestamps'].min()

  rect = patches.Rectangle((tot_delta_d, tot_file),
                           delta_d.days,
                           df[df['file'] == f].shape[0],
                           color='indigo')

  ax.add_patch(rect)

  tot_delta_d += delta_d.days
  tot_file += df[df['file'] == f].shape[0]
  
plt.xlim([0, tot_delta_d])
plt.ylim([0, tot_file])
ax.set_xlabel('Parquets')
ax.set_ylabel('Timestamps')
ax.invert_yaxis()

plt.show()

output :

output

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I get the output of a matplotlib plot as an SVG?

How can I get my contour plot superimposed on a basemap

How do I get a simple scatter plot of a dataframe (preferrably with seaborn)

In sympy plotting, how can I get a plot with a fixed aspect ratio?

How do I plot a semilog plot in python?

How to know names of plot?

How can I get density plot with polygon function? I have multiple groups to plot

How do I get rid of the empty bar charts in a faceted plot?

How do I get the coefficients/interecept for each group/model so I can plot the fitted line for each group?

How do I plot the second coefficient (not including the intercept into a plot) can I choose which coefficient to draw with abline?

How do I get the value of the x-axis in qqnorm plot

How can I do a break or white space in line plot in R

How do I plot this as a scatterplot?

How do I update a plot type with RadioGroup buttons?

How can I do a multiple plot with a somSC type graph?

How can I generate this plot?

How can I get the plot label from the name of the plotted list?

How do I plot a function?

how can I plot the bar plot attached to box plot

How do I get this to show the legend on the plot?

How can I get my area plot to stack using ggplot?

How do I get plot type of a given Axes?

How can I plot a tensor?

How do I get the x-coordinate into my plot?

How can I get Isocontour's xy coordinates for contour plot?

How do I get rid of the percentages in this bar_plot?

How can I do a Contour plot of a coordinate dataframe in r?

How do I get the longer plot on top using subplots?

How can I get these to plot on separate figures?