You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
For Matplotlib temporal charts "from pandas import Timestamp\n" is not added to generated code.
Error: Timestamp is not defined. To Reproduce
generate matplotlib code for a temporal chart with:
vis.to_code("matplotlib")
Describe the bug
For Matplotlib temporal charts "from pandas import Timestamp\n" is not added to generated code.
Error: Timestamp is not defined.
To Reproduce
generate matplotlib code for a temporal chart with:
vis.to_code("matplotlib")
import matplotlib.pyplot as plt
plt.rcParams.update(
{
"axes.titlesize": 20,
"axes.titleweight": "bold",
"axes.labelweight": "bold",
"axes.labelsize": 16,
"legend.fontsize": 14,
"legend.title_fontsize": 15,
"xtick.labelsize": 13,
"ytick.labelsize": 13,
}
)
import numpy as np
from math import nan
df = pd.DataFrame({'year': {0: Timestamp('1950-01-01 00:00:00'), 1: Timestamp('1951-01-01 00:00:00'), 2: Timestamp('1952-01-01 00:00:00'), 3: Timestamp('1955-01-01 00:00:00'), 4: Timestamp('1956-01-01 00:00:00'), 5: Timestamp('1957-01-01 00:00:00'), 6: Timestamp('1958-01-01 00:00:00'), 7: Timestamp('1959-01-01 00:00:00'), 8: Timestamp('1960-01-01 00:00:00'), 9: Timestamp('1961-01-01 00:00:00'), 10: Timestamp('1963-01-01 00:00:00'), 11: Timestamp('1964-01-01 00:00:00'), 12: Timestamp('1965-01-01 00:00:00'), 13: Timestamp('1966-01-01 00:00:00'), 14: Timestamp('1967-01-01 00:00:00'), 15: Timestamp('1968-01-01 00:00:00'), 16: Timestamp('1969-01-01 00:00:00'), 17: Timestamp('1970-01-01 00:00:00'), 18: Timestamp('1971-01-01 00:00:00'), 19: Timestamp('1972-01-01 00:00:00'), 20: Timestamp('1973-01-01 00:00:00'), 21: Timestamp('1974-01-01 00:00:00'), 22: Timestamp('1975-01-01 00:00:00'), 23: Timestamp('1976-01-01 00:00:00'), 24: Timestamp('1978-01-01 00:00:00'), 25: Timestamp('1979-01-01 00:00:00'), 26: Timestamp('1980-01-01 00:00:00'), 27: Timestamp('1981-01-01 00:00:00'), 28: Timestamp('1982-01-01 00:00:00'), 29: Timestamp('1983-01-01 00:00:00'), 30: Timestamp('1984-01-01 00:00:00'), 31: Timestamp('1985-01-01 00:00:00'), 32: Timestamp('1986-01-01 00:00:00'), 33: Timestamp('1987-01-01 00:00:00'), 34: Timestamp('1988-01-01 00:00:00'), 35: Timestamp('1989-01-01 00:00:00'), 36: Timestamp('1990-01-01 00:00:00'), 37: Timestamp('1991-01-01 00:00:00'), 38: Timestamp('1993-01-01 00:00:00'), 39: Timestamp('1994-01-01 00:00:00'), 40: Timestamp('1995-01-01 00:00:00'), 41: Timestamp('1997-01-01 00:00:00'), 42: Timestamp('1998-01-01 00:00:00'), 43: Timestamp('1999-01-01 00:00:00'), 44: Timestamp('2000-01-01 00:00:00'), 45: Timestamp('2002-01-01 00:00:00'), 46: Timestamp('2004-01-01 00:00:00'), 47: Timestamp('2005-01-01 00:00:00'), 48: Timestamp('2006-01-01 00:00:00'), 49: Timestamp('2007-01-01 00:00:00'), 50: Timestamp('2009-01-01 00:00:00'), 51: Timestamp('2010-01-01 00:00:00'), 52: Timestamp('2011-01-01 00:00:00'), 53: Timestamp('2012-01-01 00:00:00'), 54: Timestamp('2013-01-01 00:00:00'), 55: Timestamp('2014-01-01 00:00:00'), 56: Timestamp('2015-01-01 00:00:00'), 57: Timestamp('2016-01-01 00:00:00'), 58: Timestamp('2017-01-01 00:00:00'), 59: Timestamp('2018-01-01 00:00:00'), 60: Timestamp('2019-01-01 00:00:00'), 61: Timestamp('2020-01-01 00:00:00')}, 'Record': {0: 3, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 2, 7: 1, 8: 1, 9: 2, 10: 3, 11: 1, 12: 2, 13: 1, 14: 1, 15: 2, 16: 3, 17: 4, 18: 1, 19: 1, 20: 2, 21: 4, 22: 2, 23: 1, 24: 3, 25: 7, 26: 2, 27: 2, 28: 2, 29: 2, 30: 1, 31: 3, 32: 3, 33: 3, 34: 3, 35: 4, 36: 1, 37: 1, 38: 4, 39: 2, 40: 4, 41: 5, 42: 4, 43: 2, 44: 3, 45: 2, 46: 2, 47: 4, 48: 1, 49: 3, 50: 2, 51: 3, 52: 2, 53: 2, 54: 3, 55: 3, 56: 2, 57: 2, 58: 6, 59: 6, 60: 11, 61: 9}})
fig, ax = plt.subplots()
x_pts = df['year']
y_pts = df['Record']
ax.plot(x_pts, y_pts)
ax.set_xlabel('year')
ax.set_ylabel('Number of Records')
fig
The text was updated successfully, but these errors were encountered: