Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100955 > unrolled thread
| Started by | damien.ishacian@gmail.com |
|---|---|
| First post | 2015-12-29 06:25 -0800 |
| Last post | 2015-12-29 18:44 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
yaxis damien.ishacian@gmail.com - 2015-12-29 06:25 -0800
Re: yaxis Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 15:18 +0000
Re: yaxis Peter Pearson <pkpearson@nowhere.invalid> - 2015-12-29 18:44 +0000
| From | damien.ishacian@gmail.com |
|---|---|
| Date | 2015-12-29 06:25 -0800 |
| Subject | yaxis |
| Message-ID | <7c62c35f-3c9d-420b-b453-1cc0f96ae5fe@googlegroups.com> |
hello I would only change the scale of the y-axis, how to deal with matplotlib.pyplot or another library ?
[toc] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-12-29 15:18 +0000 |
| Message-ID | <mailman.52.1451402339.11925.python-list@python.org> |
| In reply to | #100955 |
On 29/12/2015 14:25, damien.ishacian@gmail.com wrote: > hello I would only change the scale of the y-axis, how to deal with matplotlib.pyplot or another library ? > Please show us your code. The best way to deal with any library is to read the docs so start here http://matplotlib.org/contents.html -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Peter Pearson <pkpearson@nowhere.invalid> |
|---|---|
| Date | 2015-12-29 18:44 +0000 |
| Message-ID | <deg2kjF4h67U1@mid.individual.net> |
| In reply to | #100955 |
On Tue, 29 Dec 2015 06:25:49 -0800 (PST), damien.ishacian@gmail.com wrote:
> hello I would only change the scale of the y-axis, how to deal with
> matplotlib.pyplot or another library ?
Here's a function I use. ax is an "axes" object, which you can get
by calling the get-current-axes (gca()) method of some plot object,
for example
from matplotlib import pyplot as plt
<plot a bunch of stuff>
expand_limits(plt.gca(), 0.08)
plt.show()
Anyway, here's the function:
def expand_limits(ax, factor):
"""Expand the limits on a plotting area by the specified factor.
"""
def expand(xmin, xmax):
d = xmax - xmin
return xmin - 0.5*factor*d, xmax + 0.5*factor*d
ax.set_xlim(*expand(*ax.get_xlim()))
ax.set_ylim(*expand(*ax.get_ylim()))
--
To email me, substitute nowhere->runbox, invalid->com.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web