expand plot for readability without expanding lines
<p>I am plotting 2 lines and a dot, X axis is a date range. The dot is most important, but it appears on the boundary of the plot. I want to "expand" the plot further right so that the dot position is more visible.
In other words I want to expand the X axis without adding new values to Y values of lines. However if I just add a few dates to X values of lines I get the "x and y dimensions must be equal" error. I tried to add a few np.NaN values to Y so that dimensions are equal, but then I get an error "integer required".
My plot:
<a href="http://i.stack.imgur.com/BwYp0.png" rel="nofollow"><img src="http://i.stack.imgur.com/BwYp0.png" alt="enter image description here"></a>
My code:</p>

<pre><code>fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
plot_x = train_original.index.values
train_y = train_original.values
ax1.plot(plot_x, train_y, 'grey')
x = np.concatenate([np.array([train_original.index.values[-1]]), test_original.index.values])
y = np.concatenate([np.array([train_original.dropna().values[-1]]), test_original.dropna().values])
ax1.plot(x, y, color='grey')
ax1.plot(list(predicted.index.values), list(predicted.values), 'ro')
ax1.axvline(x=train_end, alpha=0.7, linestyle='--',color='blue')
plt.show()
</code></pre>

<p>Just change the <a href="http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xlim" rel="nofollow">xlim()</a>. Something like:</p>

<pre><code>xmin, xmax = plt.xlim()   # return the current xlim
plt.xlim(xmax=xmax+1)
</code></pre>

python matplotlib plot