Reputation: 133
I have some code to create a chart using matplotlib (version 2.0.0) in Python (version 3.5.5) using a Jupyter notebook and am able to produce a chart but I need the chart axes to intersect at (0,0) or the origin. How do I do that? I have got the code below.
Please let me know how I can get it to intersect at 0,0.
Thanks a lot in advance.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
a = np.array([0])
#var1adj = np.append(a,var1)
f, ax = plt.subplots(1)
xdata = list(range(0,45))
ydata = list(range(0,45))
ax.plot(xdata,ydata)
ax.set_ylim(bottom=0)
plt.show(f)
Upvotes: 1
Views: 2050
Reputation: 104
If I understood correctly you wanted something like this:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
a = np.array([0])
#var1adj = np.append(a,var1)
f, ax = plt.subplots(1)
xdata = list(range(0,45))
ydata = list(range(0,45))
ax.plot(xdata,ydata)
ax.plot(0,0, 'bo')
ax.set_ylim(bottom=0)
ax.set_xlim(0)
plt.show(f)
Upvotes: 3