Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change matplotlib axis settings

How do I get control over the axis settings of a pyplot plot. I have simply done

    pylab.plot(*self.plot_generator(low, high))

    pylab.show()

and I get this which is what I want

alt text

but I want the x axis to be at 0 instead of at the bottom. How would I do that?

like image 378
Falmarri Avatar asked Nov 27 '10 02:11

Falmarri


People also ask

How do I change the y-axis values in Matplotlib?

To specify the value of axes, create a list of characters. Use xticks and yticks method to specify the ticks on the axes with x and y ticks data points respectively. Plot the line using x and y, color=red, using plot() method. Make x and y margin 0.


1 Answers

To set start of x-axis to 0:

pylab.xlim(xmin=0)

To set start of y-axis to 0:

pylab.ylim(ymin=0)

Put one of these lines (or both if you'd like) after the pylab.plot call.

like image 72
amillerrhodes Avatar answered Sep 19 '22 16:09

amillerrhodes