This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Matplotlib: Change the position of the coordinate origin

Dear all, I am trying to make line plot using matplotlib. Here is my code:


import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
fig = plt.figure()
x = np.arange(10)
y = 2.5 * np.sin(x / 20 * np.pi)
yerr = np.linspace(0.05, 0.2, 10)
fig, ax = plt.subplots()
plt.errorbar(x, y, yerr=yerr, capsize=3, marker="o",
         markersize=7, mfc="black", mec="black", label='both limits (default)')

I got the result look like this one: unwanted


However, I want my coordinate system to look like this one: expected

How could I add arguments that can I get the coordinate origin and the x- and y-axis go through it in the resulted graph? Thank you all!

matplotlib python

0 answers

No answers yet.

Log in to answer this question.