Dear All,
I am using one image of 235X130 and plotting the curve on it, now when i save it it goes in the resoltuion of 800X600,
I want to keep the resolution intact.What can be done for that to keep the resolution same?
I am using
savefig(’/home/jaguar/Softwares/Development/Python/bunty.png’)
Thanks in advance!
Regards
Yogesh
Hi Yogesh,
You can adjust the resolution by changing the figure size and the dpi in
savefig.
Keyword of figure:
*figsize* width x height in inches; defaults to rc figure.figsize
Keyword of savefig:
*dpi*: [ None | scalar > 0 ]
The resolution in dots per inch. If *None* it will default to
the value ``savefig.dpi`` in the matplotlibrc file.
e.g.
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
# aim: 235X130
fig = plt.figure(figsize=(23.5, 13.0))
ax = plt.axes([0.0, 0.0, 1.0, 1.0])
ax.plot([1, 2, 4], lw=5)
ax.set_xticks()
ax.set_yticks()
fig.savefig('test.png', dpi=10)
Kind regards,
Matthias
···
On Wednesday 31 March 2010 09:24:10 yogesh karpate wrote:
Dear All,
I am using one image of 235X130 and plotting the curve on
it, now when i save it it goes in the resoltuion of 800X600,
I want to keep the resolution intact.What can be done for that to keep the
resolution same?
I am using
savefig('/home/jaguar/Softwares/Development/Python/bunty.png')
Thanks in advance!
Regards
Yogesh
The list config got me, so to the list too ...
2010/3/31 Matthias Michler <MatthiasMichler@...361...>:
Dear All,
I am using one image of 235X130 and plotting the curve on
it, now when i save it it goes in the resoltuion of 800X600,
I want to keep the resolution intact.What can be done for that to keep the
resolution same?You can adjust the resolution by changing the figure size and the dpi in
savefig.
I think, but am not shure, that a problem could be that text is scaled
according to dpi, such that ugly things result with e.g. dpi = 2 or
so. You can also use, when you have an 2-element iterable *shape*
created, holding the pixel extent:
dpi = fig.dpi
fig.set_size_inches(shape[0] / dpi, shape[1] / dpi)
The standard dpi is sensible, otherwise it's for sure possible to
override beforehand.
Then your save command should give the desired result. I have no time
to check, sorry, may you do that Thanks.
Friedrich
···
On Wednesday 31 March 2010 09:24:10 yogesh karpate wrote: