Ask Your Question

Revision history [back]

how can matplotlib graph axis be moved?

Hello! I created test simple plot with matplotlib on www.sagenb.com using the following sintax:

import matplotlib.pyplot as plt
plt.plot([1, 3, 2, 4])
plt.savefig('1.png')

By default the axes are around the graph. But I want axes to be intersected at (0,0) point. I tried to find answer at matplotlib online documentation but not found. Please help me to move axes. Thanks.

how How can matplotlib graph axis be moved?

Hello! I created test simple plot with matplotlib on www.sagenb.com using the following sintax:

import matplotlib.pyplot as plt
plt.plot([1, 3, 2, 4])
plt.savefig('1.png')

By default the axes are around the graph. But I want axes to be intersected at (0,0) point. I tried to find answer at matplotlib online documentation but not found. Please help me to move axes. Thanks.

How can matplotlib graph axis be moved?

Hello! I created test simple plot with matplotlib on www.sagenb.com using the following sintax:

import matplotlib.pyplot as plt
plt.plot([1, 3, 2, 4])
plt.savefig('1.png')

By default the axes are around the graph. But I want axes to be intersected at (0,0) point. I tried to find answer at matplotlib online documentation but not found. found.

Upd_1:

I would like to explain my problem more detail. Original graph has frame around it. Axes of this graph are located on the graph bordes. I want frame to be switched off and axis lines to be intersected at (0,0) point. Such graphs are drawn with Sage by default (I'm glad to upload some pictures, but my karma isn't enough to do it). Thanks to the help of fidelbc I typed the following code:

import matplotlib.pyplot as plt
plt.clf()
plt.plot([0, 5, 10, 15,20,25], [0, 5, 0, -5, 0, 5], linewidth=2, color='blue')
plt.box('off')
plt.grid(True)
plt.axhline(y=0, color='black')
plt.axvline(x=0, color='black')
plt.savefig('1.png')

New graph responds my idea at more extent and I want to draw arrows on axes and ticks with its label to be located near new horisontal axes. Please help me to set these parameters or just move axes. graph axis. Thanks.