SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S





1
(2)
2
(6)
3
4
(7)
5
(10)
6
(4)
7
(17)
8
(4)
9
(1)
10
(1)
11
(19)
12
(14)
13
(8)
14
(14)
15
(9)
16
(1)
17
18
19
(8)
20
(5)
21
(7)
22
(13)
23
(1)
24
25
(4)
26
(2)
27
(17)
28
(13)
29
(6)
30
(6)
31
(5)






Showing results of 204

<< < 1 2 3 4 .. 9 > >> (Page 2 of 9)
From: Andreas H. <li...@hi...> - 2013年03月28日 15:49:42
Hi,
I'm cross-posting a question I asked on SO:
 http://stackoverflow.com/q/15681890/152439
How can I vertically align text in matplotlib? My situation is as follows:
I'm using `ImageGrid`, to plot a row of five images:
 grid = ImageGrid(fig,
 rect=(0.06, 0., 0.885, 1.),
 nrows_ncols = (1, 5),
 direction="row",
 axes_pad = 0.,
 add_all=True,
 label_mode = "L",
 share_all = True,
 cbar_location="right",
 cbar_mode="single",
 cbar_size="10%",
 cbar_pad="0%",
 )
Within each axes, I want to add some text. For this, I defined the
following function (following one of the examples):
 def add_inner_title(ax, title, loc, props):
 from matplotlib.offsetbox import AnchoredText
 at = AnchoredText(title, loc=loc, prop=props,
 pad=0., borderpad=0.5,
 frameon=False)
 ax.add_artist(at)
 return at
which I use like this:
 ax = grid[i]
 tit = add_inner_title(ax, title, loc=3,
 props={'size':'x-small',
 'color':'#b0b0b0',
 'weight' : 'bold',
 'va' : 'baseline'})
Now, in one of the plots, the axes, the title is "Pollution Signal", in
another, it is "one", and in another, it is "GOME" (all just examples).
The problem is that now the texts are not vertically aligned: The
baseline of the text with a *g* is higher to accomodate for the needed
space below the baseline.
How can I achieve that in my case, all texts are vertically aligned,
given that the heights of the individual text boxes are different?
Any help is greatly appreciated!
Andreas
From: Michael D. <md...@st...> - 2013年03月28日 13:45:48
matplotlib does not support the `\begin{array}` construct. You can see 
what is supported here:
http://matplotlib.org/users/mathtext.html
If you need something like that in Sphinx, there are a number of other 
math plugins here:
http://sphinx-doc.org/ext/math.html
Mike
On 03/28/2013 02:45 AM, Ilias Miroslav wrote:
> Hi again,
>
> if you did not receive the attachement of my previous email, the files are here:
>
> https://docs.google.com/folder/d/0B8qBHKNhZAipZ2pnS0ViTUZBdXM/edit?usp=sharing
>
> The log of the simplest non-rendering formula:
>
> .. math::
> \begin{array}{c}
> {\Psi}^{L} \\
> {\Psi}^{S}
> \end{array}
>
> is as follows:
>
> ilias@miro_ilias_desktop:~/Dokumenty/Work/programming/sphinx-math-test/.sphinx-build . .
> Running Sphinx v1.1.3
>
> loading pickled environment... not yet created
> No builder selected, using default: html
> building [html]: targets for 1 source files that are out of date
> updating environment: 1 added, 0 changed, 0 removed
> reading sources... [100%] index
> looking for now-outdated files... none found
> pickling environment... done
> checking consistency... done
> preparing documents... done
> /usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could not render math expression $\begin{array}{c}{\Psi}^{L} \\{\Psi}^{S}\end{array}$
> Warning)
> #
> writing additional files... genindex search
> copying static files... done
> dumping search index... done
> dumping object inventory... done
> build succeeded.
>
>
> Best, Miro
>
> ________________________________________
> From: Ilias Miroslav
> Sent: Wednesday, March 27, 2013 8:28 PM
> To: mat...@li...
> Subject: difficult LaTeX formula for rendering
>
> Dear experts,
>
> in our sphinx-based project documentation (www.diracprogram.org) we have a complicated latex math formula, which is not rendered:
>
> /usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could not render math expression $i \hbar \frac{\partial}{\partial t} \left( \begin{array}{c}\Psi^L \\\Psi^S \end{array} \right) = c \left( \begin{array}{c}(\vec{\sigma} \cdot \vec{\pi}) \Psi^S \\(\vec{\sigma} \cdot \vec{\pi}) \Psi^L \end{array} \right)+ m_ec^2 \left( \begin{array}{c} \Psi^L \\-\Psi^S \end{array} \right) + V \left( \begin{array}{c}\Psi^L \\\Psi^S \end{array} \right)$
>
> The index.rst file with the sole math formula is attached.
>
> I have most recent Ubuntu 12.10 (x86_64) with default packages python-sphinx 1.1.2, python-matplotlib 1.1.1.
>
> Any help, please ? I was trying to cut this formula down; the smallest LaTeX part not rendered is "\begin{array}{c}\Psi^L \\ \Psi^S \end{array}".
>
> Yours,
>
> Miro
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: KURT P. <pet...@ms...> - 2013年03月28日 13:29:53
If I'm using this SGP4 library: https://pypi.python.org/pypi/sgp4/which provides x,y,z of a satellite with respect to the center of the Earth, what do you think would be the best way to calculate the distance from the satellite to a lat/long point on the Earth using MATPLOT library basemaps? I suppose using WGS 84, I could do something like:# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m = Basemap(llcrnrlon=-145.5,llcrnrlat=1.,urcrnrlon=-2.566,urcrnrlat=46.352,\
 rsphere=(6378137.00,6356752.3142),\
 resolution='l',area_thresh=1000.,projection='lcc',\
 lat_1=50.,lon_0=-107.,ax=ax)
x,y = m(lon, lat) But how could I get "Z" for a particular coordinate so I could be this norm calculation? And... would the x,y yielded above be in the same coordinate frame (ie, from the center of the Earth) as the SGP4 library in the first place? Regards,Kurt 		 	 		 
From: Ilias M. <Mir...@um...> - 2013年03月28日 06:45:09
Hi again,
if you did not receive the attachement of my previous email, the files are here:
https://docs.google.com/folder/d/0B8qBHKNhZAipZ2pnS0ViTUZBdXM/edit?usp=sharing
The log of the simplest non-rendering formula:
.. math::
 \begin{array}{c}
 {\Psi}^{L} \\
 {\Psi}^{S} 
 \end{array} 
is as follows:
ilias@miro_ilias_desktop:~/Dokumenty/Work/programming/sphinx-math-test/.sphinx-build . . 
Running Sphinx v1.1.3
loading pickled environment... not yet created
No builder selected, using default: html
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index 
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
/usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could not render math expression $\begin{array}{c}{\Psi}^{L} \\{\Psi}^{S}\end{array}$
 Warning)
#
writing additional files... genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded.
Best, Miro
________________________________________
From: Ilias Miroslav
Sent: Wednesday, March 27, 2013 8:28 PM
To: mat...@li...
Subject: difficult LaTeX formula for rendering
Dear experts,
in our sphinx-based project documentation (www.diracprogram.org) we have a complicated latex math formula, which is not rendered:
/usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could not render math expression $i \hbar \frac{\partial}{\partial t} \left( \begin{array}{c}\Psi^L \\\Psi^S \end{array} \right) = c \left( \begin{array}{c}(\vec{\sigma} \cdot \vec{\pi}) \Psi^S \\(\vec{\sigma} \cdot \vec{\pi}) \Psi^L \end{array} \right)+ m_ec^2 \left( \begin{array}{c} \Psi^L \\-\Psi^S \end{array} \right) + V \left( \begin{array}{c}\Psi^L \\\Psi^S \end{array} \right)$
The index.rst file with the sole math formula is attached.
I have most recent Ubuntu 12.10 (x86_64) with default packages python-sphinx 1.1.2, python-matplotlib 1.1.1.
Any help, please ? I was trying to cut this formula down; the smallest LaTeX part not rendered is "\begin{array}{c}\Psi^L \\ \Psi^S \end{array}".
Yours,
Miro
From: Jae-Joon L. <lee...@gm...> - 2013年03月28日 03:41:31
The first issue is a bug, and I opened a PR that fixes this.
https://github.com/matplotlib/matplotlib/pull/1864
In the comments of the PR, you can find a workaround.
Regards,
-JJ
On Wed, Mar 27, 2013 at 11:09 PM, Hackstein <new...@gm...> wrote:
> Sterling,
>
> I'm using matplotlib version 1.2.0 with agg backend.
>
> Here are two code examples, one for each problem. The first one doesn't
> save the figure due to the legend problem, seterr causes the script to stop
> with an error at that position.
> The second example shows the scientific labels on the y-axis, although it
> should be disabled in the code. I can't get the y-axis to display plain
> labels.
>
> First example:
> [code]
> import numpy as np
> np.seterr(all='raise')
> import matplotlib.pyplot as plt
>
> x_i = [11.7574075935, 11.665207135799999, 11.6762413105, 11.6580992311,
> 11.656368388500001]
> x_r = []
> dates = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02,
> 2.71359248e+02, 2.72320822e+02]
>
> diff = 0.16
> ra = [0., 110.5349726]
> dec = [0., -16.1061281]
> med_i = np.median(x_i)
> med_r = np.median(x_r)
>
> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
> if x_r == []:
> plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> else:
> plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
> plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> plt.rcParams['xtick.major.pad']=10
> plt.rcParams['ytick.major.pad']=10
> ax = plt.gca()
> ax.title.set_y(1.1)
> formy = plt.ScalarFormatter()
> formy.set_powerlimits((-5, 5))
> formy.set_scientific(False)
> ax.yaxis.set_major_formatter(formy)
> ax.set_ylim(ax.get_ylim()[::-1])
> for tick in ax.xaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> for tick in ax.yaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> plt.xlabel('Days', fontsize='20', labelpad=20)
> plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
>
> if x_r == []:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> else:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> leg = plt.gca().get_legend()
> ltext = leg.get_texts()
> plt.setp(ltext, fontsize='16')
> plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
> plt.close("i_only")
> [/code]
>
> Second example:
> [code]
> import numpy as np
> import matplotlib.pyplot as plt
>
> y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168,
> 11.125134152199999]
> y_r = [11.148667168999999, 11.10194503, 11.112352465300001,
> 11.111687871799999, 11.1214449011]
> dates_i = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02,
> 2.72320822e+02, 2.73250579e+02]
> dates_r = [311.28215, 324.25844, 325.25194, 330.20983, 338.21356]
>
> diff = 0.16
> ra = [112.5379659, 110.5349726]
> dec = [ -15.9841039, -16.1061281]
> med_i = np.median(y_i)
> med_r = np.median(y_r)
>
> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
> if y_r == []:
> plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> else:
> plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
> plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> plt.rcParams['xtick.major.pad']=10
> plt.rcParams['ytick.major.pad']=10
> ax = plt.gca()
> ax.title.set_y(1.1)
> formy = plt.ScalarFormatter()
> formy.set_powerlimits((-5, 5))
> formy.set_scientific(False)
> ax.yaxis.set_major_formatter(formy)
> ax.set_ylim(ax.get_ylim()[::-1])
> for tick in ax.xaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> for tick in ax.yaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> plt.xlabel('Days', fontsize='20', labelpad=20)
> plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
>
> if y_r == []:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> else:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> leg = plt.gca().get_legend()
> ltext = leg.get_texts()
> plt.setp(ltext, fontsize='16')
> plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
> plt.close("i_only")
> [/code]
>
> Best regards,
>
> frix
>
>
> Am 26.03.2013 um 20:36 schrieb Sterling Smith <sm...@fu...>:
>
> > Frix,
> >
> > It may be useful to post the version and backend you are using to the
> list.
> >
> > import matplotlib
> > print matplotlib.__version__
> > print matplotlib.get_backend()
> >
> > Also, if you can format the code as a simple self-contained example,
> that would help others confirm what you are seeing.
> >
> > -Sterling
> >
> > On Mar 26, 2013, at 12:01PM, Hackstein wrote:
> >
> >> Hello everyone,
> >>
> >> I have two issues with my current projects:
> >>
> >> 1) I automatically generate plots of several data sets in a for-loop,
> all of which have the same shape of x and y values, but some of which have
> two of those data (i.e. graphs) sets per figure, others have only one.
> >> I create the legend by
> >>
> >> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, borderaxespad=0.)
> >>
> >> which works perfectly if I plot two data sets (and therefore two
> labels) in a figure, but sometimes (not always) causes an error, if only
> one data set is plotted in a figure.
> >> The legend is this
> >>
> >> print ax.get_legend_handles_labels()
> >> ([<matplotlib.lines.Line2D object at 0x24b9550>], ['i_s'])
> >>
> >> and the error is
> >>
> >> File "/usr/lib64/python2.6/site-packages/matplotlib/offsetbox.py", line
> 76, in _get_packed_offsets
> >> sep = (total - sum(w_list)) / (len(w_list) - 1.)
> >> FloatingPointError: divide by zero encountered in double_scalars
> >>
> >> which I broke down to a problem with the" mode='expand'" parameter. It
> seems it cannot expand when the number of labels is 1. Strangely, however,
> that seems not always to be the case, since some of the plots with only one
> data set and one legend entry work without problems, but some raise an
> error.
> >>
> >> 2) Another problem occurs with the y-axis tick labels. Even if the
> y-values are quite ordinary (in the order of 10) the labels get scientific
> notation when the y-range is small (order 0.1). I don't know why that is
> and it only occurs then. When the y-range is larger (order of 1), the ticks
> get plain numbers. I tried to work around that with the following code,
> which did not
> >> work:
> >>
> >> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
> plt.plot(np.asarray(mod_mjd_list_i), np.asarray(x_i), 'r-', label = 'i_s')
> ax = plt.gca() formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5))
> >> formy.set_scientific(False)
> >> ax.yaxis.set_major_formatter(formy)
> >>
> >> Any ideas what I can do?
> >>
> >> Thanks,
> >> frix
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> >> Rise to greatness in Intel's independent game demo contest.
> >> Compete for recognition, cash, and the chance to get your game
> >> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> >> Submit your demo by 6/6/13.
> http://p.sf.net/sfu/intel_levelupd2d_______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Steven B. <bo...@ph...> - 2013年03月27日 21:41:35
Yeah,
when I used my officemate's computer (matplotlib 1.1.1) it works 
fine... I am running...
In [129]: import matplotlib
In [130]: matplotlib.__version__
Out[130]: '1.2.x'
Interesting...
Steven
On Wed Mar 27 16:29:53 2013, ChaoYue wrote:
> when saving as jpg, I cannot reproduce the problem.
> I am using version 1.2
>
> Chao
>
> On Wed, Mar 27, 2013 at 10:16 PM, Steven Boada [via matplotlib]
> <[hidden email] </user/SendEmail.jtp?type=node&node=40766&i=0>> wrote:
>
> Hey List,
>
> If you create a horizontal line, and then adjust the size of the
> figure, or axis limits the horizontal line does not move with
> everything else...
>
> To reproduce in ipython -pylab:
>
> axhline(5)
> yscale('log')
> ylim(0.5,30)
>
> The line stays where it started and is not moved when the plot is
> redrawn.
>
> This was discussed here (back in 2008!!!!!):
>
> http://matplotlib.1069221.n5.nabble.com/transforms-bug-axhline-with-log-y-scale-td35548.html
>
> Then... when you save the figure, the position of the horizontal
> line does *NOT* match the position you see when the figure is
> shown...
>
> savefig('test.eps')
>
> Am I missing something?
>
> Steven
>
> --
>
> Steven Boada
>
> Doctoral Student
> Dept of Physics and Astronomy
> Texas A&M University
> [hidden email] <http://user/SendEmail.jtp?type=node&node=40764&i=0>
>
>
> ------------------------------------------------------------------------------
>
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=40764&i=1>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://matplotlib.1069221.n5.nabble.com/problem-with-axhline-and-yscale-tp40764.html
>
> To start a new topic under matplotlib - users, email [hidden
> email] </user/SendEmail.jtp?type=node&node=40766&i=1>
> To unsubscribe from matplotlib, click here.
> NAML
> <http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
>
>
> --
> ***********************************************************************************
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> ************************************************************************************
>
> *figure_1.jpg* (149K) Download Attachment
> <http://matplotlib.1069221.n5.nabble.com/attachment/40766/0/figure_1.jpg>
>
> ------------------------------------------------------------------------
> View this message in context: Re: problem with axhline and yscale
> <http://matplotlib.1069221.n5.nabble.com/problem-with-axhline-and-yscale-tp40764p40766.html>
> Sent from the matplotlib - users mailing list archive
> <http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html> at
> Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Steven Boada
Doctoral Student
Dept of Physics and Astronomy
Texas A&M University
bo...@ph...
From: ChaoYue <cha...@gm...> - 2013年03月27日 21:30:00
when saving as jpg, I cannot reproduce the problem.
I am using version 1.2
Chao
On Wed, Mar 27, 2013 at 10:16 PM, Steven Boada [via matplotlib] <
ml-...@n5...> wrote:
> Hey List,
>
> If you create a horizontal line, and then adjust the size of the figure,
> or axis limits the horizontal line does not move with everything else...
>
> To reproduce in ipython -pylab:
>
> axhline(5)
> yscale('log')
> ylim(0.5,30)
>
> The line stays where it started and is not moved when the plot is redrawn.
>
> This was discussed here (back in 2008!!!!!):
>
>
> http://matplotlib.1069221.n5.nabble.com/transforms-bug-axhline-with-log-y-scale-td35548.html
>
> Then... when you save the figure, the position of the horizontal line does
> *NOT* match the position you see when the figure is shown...
>
> savefig('test.eps')
>
> Am I missing something?
>
> Steven
>
> --
>
> Steven Boada
>
> Doctoral Student
> Dept of Physics and Astronomy
> Texas A&M University[hidden email] <http://user/SendEmail.jtp?type=node&node=40764&i=0>
>
>
> ------------------------------------------------------------------------------
>
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=40764&i=1>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/problem-with-axhline-and-yscale-tp40764.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
figure_1.jpg (149K) <http://matplotlib.1069221.n5.nabble.com/attachment/40766/0/figure_1.jpg>
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/problem-with-axhline-and-yscale-tp40764p40766.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Steven B. <bo...@ph...> - 2013年03月27日 21:18:09
Hey Sayan,
Here is the manual page:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html
It works (basically) the same as loadtxt, but it is more flexible when 
there are holes in your data.
Good luck.
Steven
On Wed Mar 27 10:07:10 2013, Sayan Chatterjee wrote:
> Hi Steven,
>
> I am a newbie to Python and hence Matplotlib. I cannot get your point
> properly. Could you please redirect me to a page where the usage is
> demonstrated?
>
> As I can see, you're a doctoral student in Physics, it might be
> worthwhile to tell you that I'm trying to code a Zeldovich
> Approximation for a simple sinusoidal potential and want to make it
> evolve with varying scale factor and make an animation of it.
>
> Cheers,
> Sayan
>
>
> On 27 March 2013 19:58, Steven Boada <bo...@ph...
> <mailto:bo...@ph...>> wrote:
>
> Another, slightly more flexible, option is the genfromtxt
> function, also in numpy. Normally you should try genfromtxt after
> loadtxt doesn't work. Or, that is my normal method.
>
> Steven
>
>
> On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote:
>
> Thank you very much for your prompt reply.
>
> Florian, your reply seems to be the answer to my question.
> I'll try
> it out. If can't figure out,I'll get back to you.
>
>
> On 27 March 2013 15:37, Florian M. Wagner
> <wag...@st... <mailto:wag...@st...>
> <mailto:wag...@st...hz.__ch
> <mailto:wag...@st...>>> wrote:
>
> Hey Sayan,
>
> for reading in simple ASCII-Files containing your two
> arrays you
> should have a look at the numpy.loadtxt function.
>
> Scatter plots in matplotlib are then easily created as
> shown here
> http://matplotlib.org/__examples/pylab_examples/__scatter_demo.html
> <http://matplotlib.org/examples/pylab_examples/scatter_demo.html>
>
> For your purpose you can do something like:
>
> import os
> import numpy as np
> import matplotlib.pyplot as plt
>
> for file in os.path.listdir():
> x, y = np.loadtxt(file, unpack=True)
> plt.scatter(x,y)
> plt.savefig(file + '.png')
>
> Cheers,
>
> Florian
>
>
> Am 27.03.2013 09:32, schrieb Sayan Chatterjee:
>
> Dear All,
>
> I'm new to Matplotlib. It might be a silly question,
> how does one
> plot data(not functions) in Matplotlib.
>
> How:
> 1)Two arrays (X and Y) can be plotted in a scatter
> diagram?
>
> 2) or a number of data files can used to produce
> different plots
> having different(sequential) name?
>
> Thanks in anticipation.
> Regards,
> Sayan
>
> --
>
>
>
> ------------------------------__------------------------------__--------------
> *Sayan Chatterjee*
>
> Dept. of Physics and Meteorology
> IIT Kharagpur
> Lal Bahadur Shastry Hall of Residence
> Room AB 205
> Mob: +91 9874513565
> blog: www.blissprofound.blogspot.com
> <http://www.blissprofound.blogspot.com>
> <http://www.blissprofound.__blogspot.com
> <http://www.blissprofound.blogspot.com>>
>
> Volunteer , Padakshep
> www.padakshep.org <http://www.padakshep.org>
> <http://www.padakshep.org>
>
>
>
>
> ------------------------------__------------------------------__------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo
> contest.
> Compete for recognition, cash, and the chance to get
> your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by
> 6/6/13.http://p.sf.net/sfu/__intel_levelupd2d
> <http://p.sf.net/sfu/intel_levelupd2d>
>
>
> _________________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> <mailto:Mat...@li...>
> <mailto:Matplotlib-users@__lists.sourceforge.net
> <mailto:Mat...@li...>>
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>
>
>
>
> ------------------------------__------------------------------__------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13.
> http://p.sf.net/sfu/intel___levelupd2d
> <http://p.sf.net/sfu/intel_levelupd2d>
> _________________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> <mailto:Mat...@li...>
> <mailto:Matplotlib-users@__lists.sourceforge.net
> <mailto:Mat...@li...>>
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>
>
>
>
> --
>
>
> ------------------------------__------------------------------__--------------
> *Sayan Chatterjee*
>
> Dept. of Physics and Meteorology
> IIT Kharagpur
> Lal Bahadur Shastry Hall of Residence
> Room AB 205
> Mob: +91 9874513565
> blog: www.blissprofound.blogspot.com
> <http://www.blissprofound.blogspot.com>
> <http://www.blissprofound.__blogspot.com
> <http://www.blissprofound.blogspot.com>>
>
> Volunteer , Padakshep
> www.padakshep.org <http://www.padakshep.org>
> <http://www.padakshep.org>
>
>
>
> ------------------------------__------------------------------__------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13.
> http://p.sf.net/sfu/intel___levelupd2d
> <http://p.sf.net/sfu/intel_levelupd2d>
>
>
> _________________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>
>
> --
>
> Steven Boada
>
> Doctoral Student
> Dept of Physics and Astronomy
> Texas A&M University
> bo...@ph... <mailto:bo...@ph...>
>
>
>
>
> --
>
>
> --------------------------------------------------------------------------
> *Sayan Chatterjee*
> Dept. of Physics and Meteorology
> IIT Kharagpur
> Lal Bahadur Shastry Hall of Residence
> Room AB 205
> Mob: +91 9874513565
> blog: www.blissprofound.blogspot.com
> <http://www.blissprofound.blogspot.com>
>
> Volunteer , Padakshep
> www.padakshep.org <http://www.padakshep.org>
--
Steven Boada
Doctoral Student
Dept of Physics and Astronomy
Texas A&M University
bo...@ph...
From: Steven B. <bo...@ph...> - 2013年03月27日 21:16:08
Hey List,
If you create a horizontal line, and then adjust the size of the figure, 
or axis limits the horizontal line does not move with everything else...
To reproduce in ipython -pylab:
axhline(5)
yscale('log')
ylim(0.5,30)
The line stays where it started and is not moved when the plot is redrawn.
This was discussed here (back in 2008!!!!!):
http://matplotlib.1069221.n5.nabble.com/transforms-bug-axhline-with-log-y-scale-td35548.html
Then... when you save the figure, the position of the horizontal line 
does *NOT* match the position you see when the figure is shown...
savefig('test.eps')
Am I missing something?
Steven
-- 
Steven Boada
Doctoral Student
Dept of Physics and Astronomy
Texas A&M University
bo...@ph...
From: Ilias M. <Mir...@um...> - 2013年03月27日 20:06:25
Attachments: index.rst
Dear experts,
in our sphinx-based project documentation (www.diracprogram.org) we have a complicated latex math formula, which is not rendered:
/usr/lib/pymodules/python2.7/matplotlib/sphinxext/mathmpl.py:56: Warning: Could not render math expression $i \hbar \frac{\partial}{\partial t} \left( \begin{array}{c}\Psi^L \\\Psi^S \end{array} \right) = c \left( \begin{array}{c}(\vec{\sigma} \cdot \vec{\pi}) \Psi^S \\(\vec{\sigma} \cdot \vec{\pi}) \Psi^L \end{array} \right)+ m_ec^2 \left( \begin{array}{c} \Psi^L \\-\Psi^S \end{array} \right) + V \left( \begin{array}{c}\Psi^L \\\Psi^S \end{array} \right)$
The index.rst file with the sole math formula is attached.
I have most recent Ubuntu 12.10 (x86_64) with default packages python-sphinx 1.1.2, python-matplotlib 1.1.1.
Any help, please ? I was trying to cut this formula down; the smallest LaTeX part not rendered is "\begin{array}{c}\Psi^L \\ \Psi^S \end{array}".
Yours, 
Miro
From: Michael D. <md...@st...> - 2013年03月27日 19:16:31
I'm pleased to announce the release of matplotlib 1.2.1. This is a bug 
release and improves stability and quality over the 1.2.0 release from 
four months ago. All users on 1.2.0 are encouraged to upgrade.
Since github no longer provides download hosting, our tarballs and 
binaries are back on SourceForge, and we have a master index of 
downloads here:
http://matplotlib.org/downloads <http://matplotlib.org/downloads.html>
Highlights include:
- Usage of deprecated APIs in matplotlib are now displayed by default on 
all Python versions
- Agg backend: Cleaner rendering of rectilinear lines when snapping to 
pixel boundaries, and fixes rendering bugs when using clip paths
- Python 3: Fixes a number of missed Python 3 compatibility problems
- Histograms and stacked histograms have a number of important bugfixes
- Compatibility with more 3rd-party TrueType fonts
- SVG backend: Image support in SVG output is consistent with other backends
- Qt backend: Fixes leaking of window objects in Qt backend
- hexbin with a log scale now works correctly
- autoscaling works better on 3D plots
- ...and numerous others.
Enjoy! As always, there are number of good ways to get help with 
matplotlib listed on the homepage at http://matplotlib.org/ and I thank 
everyone for their continued support of this project.
Mike Droettboom
From: Sterling S. <sm...@fu...> - 2013年03月27日 16:21:03
Frix,
I get the same error for your first example with v1.1.1 [although I had to comment out the med_r = np.median(x_r) to get it to run]. You should probably file a bug at [1].
I get the same result for your yaxis. You need to change the formatter to 
ax.yaxis.set_major_formatter(plt.ScalarFormatter(useOffset=False))
-Sterling
[1] https://github.com/matplotlib/matplotlib/issues
On Mar 27, 2013, at 7:09AM, Hackstein wrote:
> Sterling,
> 
> I'm using matplotlib version 1.2.0 with agg backend.
> 
> Here are two code examples, one for each problem. The first one doesn't save the figure due to the legend problem, seterr causes the script to stop with an error at that position.
> The second example shows the scientific labels on the y-axis, although it should be disabled in the code. I can't get the y-axis to display plain labels. 
> 
> First example:
> [code]
> import numpy as np
> np.seterr(all='raise')
> import matplotlib.pyplot as plt
> 
> x_i = [11.7574075935, 11.665207135799999, 11.6762413105, 11.6580992311, 11.656368388500001]
> x_r = []
> dates = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.71359248e+02, 2.72320822e+02]
> 
> diff = 0.16
> ra = [0., 110.5349726]
> dec = [0., -16.1061281]
> med_i = np.median(x_i)
> med_r = np.median(x_r)
> 
> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
> if x_r == []:
> plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> else:
> plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
> plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> plt.rcParams['xtick.major.pad']=10
> plt.rcParams['ytick.major.pad']=10
> ax = plt.gca()
> ax.title.set_y(1.1)
> formy = plt.ScalarFormatter()
> formy.set_powerlimits((-5, 5))
> formy.set_scientific(False)
> ax.yaxis.set_major_formatter(formy)
> ax.set_ylim(ax.get_ylim()[::-1])
> for tick in ax.xaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> for tick in ax.yaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> plt.xlabel('Days', fontsize='20', labelpad=20)
> plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
> 
> if x_r == []:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> else:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> leg = plt.gca().get_legend()
> ltext = leg.get_texts()
> plt.setp(ltext, fontsize='16')
> plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
> plt.close("i_only")
> [/code]
> 
> Second example:
> [code]
> import numpy as np
> import matplotlib.pyplot as plt
> 
> y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 11.125134152199999]
> y_r = [11.148667168999999, 11.10194503, 11.112352465300001, 11.111687871799999, 11.1214449011]
> dates_i = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.72320822e+02, 2.73250579e+02]
> dates_r = [311.28215, 324.25844, 325.25194, 330.20983, 338.21356]
> 
> diff = 0.16
> ra = [112.5379659, 110.5349726]
> dec = [ -15.9841039, -16.1061281]
> med_i = np.median(y_i)
> med_r = np.median(y_r)
> 
> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
> if y_r == []:
> plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> else:
> plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
> plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
> plt.title('i_mag', fontsize='16')
> plt.rcParams['xtick.major.pad']=10
> plt.rcParams['ytick.major.pad']=10
> ax = plt.gca()
> ax.title.set_y(1.1)
> formy = plt.ScalarFormatter()
> formy.set_powerlimits((-5, 5))
> formy.set_scientific(False)
> ax.yaxis.set_major_formatter(formy)
> ax.set_ylim(ax.get_ylim()[::-1])
> for tick in ax.xaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> for tick in ax.yaxis.get_major_ticks():
> tick.label.set_fontsize(16)
> plt.xlabel('Days', fontsize='20', labelpad=20)
> plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
> 
> if y_r == []:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> else:
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
> numpoints=1, ncol=2, borderaxespad=0.)
> leg = plt.gca().get_legend()
> ltext = leg.get_texts()
> plt.setp(ltext, fontsize='16')
> plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
> plt.close("i_only") 
> [/code]
> 
> Best regards,
> 
> frix
> 
> 
> Am 26.03.2013 um 20:36 schrieb Sterling Smith <sm...@fu...>:
> 
>> Frix,
>> 
>> It may be useful to post the version and backend you are using to the list.
>> 
>> import matplotlib
>> print matplotlib.__version__
>> print matplotlib.get_backend()
>> 
>> Also, if you can format the code as a simple self-contained example, that would help others confirm what you are seeing.
>> 
>> -Sterling
>> 
>> On Mar 26, 2013, at 12:01PM, Hackstein wrote:
>> 
>>> Hello everyone,
>>> 
>>> I have two issues with my current projects:
>>> 
>>> 1) I automatically generate plots of several data sets in a for-loop, all of which have the same shape of x and y values, but some of which have two of those data (i.e. graphs) sets per figure, others have only one.
>>> I create the legend by
>>> 
>>> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, borderaxespad=0.)
>>> 
>>> which works perfectly if I plot two data sets (and therefore two labels) in a figure, but sometimes (not always) causes an error, if only one data set is plotted in a figure.
>>> The legend is this
>>> 
>>> print ax.get_legend_handles_labels()
>>> ([<matplotlib.lines.Line2D object at 0x24b9550>], ['i_s'])
>>> 
>>> and the error is
>>> 
>>> File "/usr/lib64/python2.6/site-packages/matplotlib/offsetbox.py", line 76, in _get_packed_offsets
>>> sep = (total - sum(w_list)) / (len(w_list) - 1.)
>>> FloatingPointError: divide by zero encountered in double_scalars
>>> 
>>> which I broke down to a problem with the" mode='expand'" parameter. It seems it cannot expand when the number of labels is 1. Strangely, however, that seems not always to be the case, since some of the plots with only one data set and one legend entry work without problems, but some raise an error.
>>> 
>>> 2) Another problem occurs with the y-axis tick labels. Even if the y-values are quite ordinary (in the order of 10) the labels get scientific notation when the y-range is small (order 0.1). I don't know why that is and it only occurs then. When the y-range is larger (order of 1), the ticks get plain numbers. I tried to work around that with the following code, which did not
>>> work:
>>> 
>>> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100) plt.plot(np.asarray(mod_mjd_list_i), np.asarray(x_i), 'r-', label = 'i_s') ax = plt.gca() formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5))
>>> formy.set_scientific(False)
>>> ax.yaxis.set_major_formatter(formy)
>>> 
>>> Any ideas what I can do?
>>> 
>>> Thanks,
>>> frix
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>>> Rise to greatness in Intel's independent game demo contest.
>>> Compete for recognition, cash, and the chance to get your game 
>>> on Steam. 5ドルK grand prize plus 10 genre and skill prizes. 
>>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d_______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
From: Sayan C. <say...@gm...> - 2013年03月27日 15:08:00
Hi Steven,
I am a newbie to Python and hence Matplotlib. I cannot get your point
properly. Could you please redirect me to a page where the usage is
demonstrated?
As I can see, you're a doctoral student in Physics, it might be worthwhile
to tell you that I'm trying to code a Zeldovich Approximation for a simple
sinusoidal potential and want to make it evolve with varying scale factor
and make an animation of it.
Cheers,
Sayan
On 27 March 2013 19:58, Steven Boada <bo...@ph...> wrote:
> Another, slightly more flexible, option is the genfromtxt function, also
> in numpy. Normally you should try genfromtxt after loadtxt doesn't work.
> Or, that is my normal method.
>
> Steven
>
>
> On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote:
>
>> Thank you very much for your prompt reply.
>>
>> Florian, your reply seems to be the answer to my question. I'll try
>> it out. If can't figure out,I'll get back to you.
>>
>>
>> On 27 March 2013 15:37, Florian M. Wagner <wag...@st...
>> <mailto:wag...@st...hz.**ch <wag...@st...>>> wrote:
>>
>> Hey Sayan,
>>
>> for reading in simple ASCII-Files containing your two arrays you
>> should have a look at the numpy.loadtxt function.
>>
>> Scatter plots in matplotlib are then easily created as shown here
>> http://matplotlib.org/**examples/pylab_examples/**scatter_demo.html<http://matplotlib.org/examples/pylab_examples/scatter_demo.html>
>>
>> For your purpose you can do something like:
>>
>> import os
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> for file in os.path.listdir():
>> x, y = np.loadtxt(file, unpack=True)
>> plt.scatter(x,y)
>> plt.savefig(file + '.png')
>>
>> Cheers,
>>
>> Florian
>>
>>
>> Am 27.03.2013 09:32, schrieb Sayan Chatterjee:
>>
>>> Dear All,
>>>
>>> I'm new to Matplotlib. It might be a silly question, how does one
>>> plot data(not functions) in Matplotlib.
>>>
>>> How:
>>> 1)Two arrays (X and Y) can be plotted in a scatter diagram?
>>>
>>> 2) or a number of data files can used to produce different plots
>>> having different(sequential) name?
>>>
>>> Thanks in anticipation.
>>> Regards,
>>> Sayan
>>>
>>> --
>>>
>>>
>>> ------------------------------**------------------------------**
>>> --------------
>>> *Sayan Chatterjee*
>>>
>>> Dept. of Physics and Meteorology
>>> IIT Kharagpur
>>> Lal Bahadur Shastry Hall of Residence
>>> Room AB 205
>>> Mob: +91 9874513565
>>> blog: www.blissprofound.blogspot.com
>>> <http://www.blissprofound.**blogspot.com<http://www.blissprofound.blogspot.com>
>>> >
>>>
>>> Volunteer , Padakshep
>>> www.padakshep.org <http://www.padakshep.org>
>>>
>>>
>>>
>>> ------------------------------**------------------------------**
>>> ------------------
>>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>>> Rise to greatness in Intel's independent game demo contest.
>>> Compete for recognition, cash, and the chance to get your game
>>> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
>>> Submit your demo by 6/6/13.http://p.sf.net/sfu/**intel_levelupd2d<http://p.sf.net/sfu/intel_levelupd2d>
>>>
>>>
>>> ______________________________**_________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.**sourceforge.net<Mat...@li...> <mailto:
>>> Matplotlib-users@**lists.sourceforge.net<Mat...@li...>
>>> >
>>> https://lists.sourceforge.net/**lists/listinfo/matplotlib-**users<https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>>>
>>
>>
>> ------------------------------**------------------------------**
>> ------------------
>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest.
>> Compete for recognition, cash, and the chance to get your game
>> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_**levelupd2d<http://p.sf.net/sfu/intel_levelupd2d>
>> ______________________________**_________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.**sourceforge.net<Mat...@li...>
>> <mailto:Matplotlib-users@**lists.sourceforge.net<Mat...@li...>
>> >
>> https://lists.sourceforge.net/**lists/listinfo/matplotlib-**users<https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>>
>>
>>
>>
>> --
>>
>>
>> ------------------------------**------------------------------**
>> --------------
>> *Sayan Chatterjee*
>>
>> Dept. of Physics and Meteorology
>> IIT Kharagpur
>> Lal Bahadur Shastry Hall of Residence
>> Room AB 205
>> Mob: +91 9874513565
>> blog: www.blissprofound.blogspot.com
>> <http://www.blissprofound.**blogspot.com<http://www.blissprofound.blogspot.com>
>> >
>>
>> Volunteer , Padakshep
>> www.padakshep.org <http://www.padakshep.org>
>>
>>
>>
>> ------------------------------**------------------------------**
>> ------------------
>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest.
>> Compete for recognition, cash, and the chance to get your game
>> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_**levelupd2d<http://p.sf.net/sfu/intel_levelupd2d>
>>
>>
>> ______________________________**_________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.**sourceforge.net<Mat...@li...>
>> https://lists.sourceforge.net/**lists/listinfo/matplotlib-**users<https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>>
>
> --
>
> Steven Boada
>
> Doctoral Student
> Dept of Physics and Astronomy
> Texas A&M University
> bo...@ph...
>
-- 
--------------------------------------------------------------------------
*Sayan Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com
Volunteer , Padakshep
www.padakshep.org
From: Steven B. <bo...@ph...> - 2013年03月27日 14:28:54
Another, slightly more flexible, option is the genfromtxt function, 
also in numpy. Normally you should try genfromtxt after loadtxt doesn't 
work. Or, that is my normal method.
Steven
On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote:
> Thank you very much for your prompt reply.
>
> Florian, your reply seems to be the answer to my question. I'll try
> it out. If can't figure out,I'll get back to you.
>
>
> On 27 March 2013 15:37, Florian M. Wagner <wag...@st...
> <mailto:wag...@st...>> wrote:
>
> Hey Sayan,
>
> for reading in simple ASCII-Files containing your two arrays you
> should have a look at the numpy.loadtxt function.
>
> Scatter plots in matplotlib are then easily created as shown here
> http://matplotlib.org/examples/pylab_examples/scatter_demo.html
>
> For your purpose you can do something like:
>
> import os
> import numpy as np
> import matplotlib.pyplot as plt
>
> for file in os.path.listdir():
> x, y = np.loadtxt(file, unpack=True)
> plt.scatter(x,y)
> plt.savefig(file + '.png')
>
> Cheers,
>
> Florian
>
>
> Am 27.03.2013 09:32, schrieb Sayan Chatterjee:
>> Dear All,
>>
>> I'm new to Matplotlib. It might be a silly question, how does one
>> plot data(not functions) in Matplotlib.
>>
>> How:
>> 1)Two arrays (X and Y) can be plotted in a scatter diagram?
>>
>> 2) or a number of data files can used to produce different plots
>> having different(sequential) name?
>>
>> Thanks in anticipation.
>> Regards,
>> Sayan
>>
>> --
>>
>>
>> --------------------------------------------------------------------------
>> *Sayan Chatterjee*
>> Dept. of Physics and Meteorology
>> IIT Kharagpur
>> Lal Bahadur Shastry Hall of Residence
>> Room AB 205
>> Mob: +91 9874513565
>> blog: www.blissprofound.blogspot.com
>> <http://www.blissprofound.blogspot.com>
>>
>> Volunteer , Padakshep
>> www.padakshep.org <http://www.padakshep.org>
>>
>>
>> ------------------------------------------------------------------------------
>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest.
>> Compete for recognition, cash, and the chance to get your game
>> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
>> Submit your demo by 6/6/13.http://p.sf.net/sfu/intel_levelupd2d
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li... <mailto:Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
>
>
> --------------------------------------------------------------------------
> *Sayan Chatterjee*
> Dept. of Physics and Meteorology
> IIT Kharagpur
> Lal Bahadur Shastry Hall of Residence
> Room AB 205
> Mob: +91 9874513565
> blog: www.blissprofound.blogspot.com
> <http://www.blissprofound.blogspot.com>
>
> Volunteer , Padakshep
> www.padakshep.org <http://www.padakshep.org>
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Steven Boada
Doctoral Student
Dept of Physics and Astronomy
Texas A&M University
bo...@ph...
From: Hackstein <new...@gm...> - 2013年03月27日 14:09:28
Sterling,
I'm using matplotlib version 1.2.0 with agg backend.
Here are two code examples, one for each problem. The first one doesn't save the figure due to the legend problem, seterr causes the script to stop with an error at that position.
The second example shows the scientific labels on the y-axis, although it should be disabled in the code. I can't get the y-axis to display plain labels. 
First example:
[code]
import numpy as np
np.seterr(all='raise')
import matplotlib.pyplot as plt
x_i = [11.7574075935, 11.665207135799999, 11.6762413105, 11.6580992311, 11.656368388500001]
x_r = []
dates = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.71359248e+02, 2.72320822e+02]
diff = 0.16
ra = [0., 110.5349726]
dec = [0., -16.1061281]
med_i = np.median(x_i)
med_r = np.median(x_r)
plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
if x_r == []:
 plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
 plt.title('i_mag', fontsize='16')
else:
 plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s')
 plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s')
 plt.title('i_mag', fontsize='16')
plt.rcParams['xtick.major.pad']=10
plt.rcParams['ytick.major.pad']=10
ax = plt.gca()
ax.title.set_y(1.1)
formy = plt.ScalarFormatter()
formy.set_powerlimits((-5, 5))
formy.set_scientific(False)
ax.yaxis.set_major_formatter(formy)
ax.set_ylim(ax.get_ylim()[::-1])
for tick in ax.xaxis.get_major_ticks():
 tick.label.set_fontsize(16)
for tick in ax.yaxis.get_major_ticks():
 tick.label.set_fontsize(16)
plt.xlabel('Days', fontsize='20', labelpad=20)
plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
if x_r == []:
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
 numpoints=1, ncol=2, borderaxespad=0.)
else:
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
 numpoints=1, ncol=2, borderaxespad=0.)
leg = plt.gca().get_legend()
ltext = leg.get_texts()
plt.setp(ltext, fontsize='16')
plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
plt.close("i_only")
[/code]
Second example:
[code]
import numpy as np
import matplotlib.pyplot as plt
y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 11.125134152199999]
y_r = [11.148667168999999, 11.10194503, 11.112352465300001, 11.111687871799999, 11.1214449011]
dates_i = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.72320822e+02, 2.73250579e+02]
dates_r = [311.28215, 324.25844, 325.25194, 330.20983, 338.21356]
 
diff = 0.16
ra = [112.5379659, 110.5349726]
dec = [ -15.9841039, -16.1061281]
med_i = np.median(y_i)
med_r = np.median(y_r)
plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
if y_r == []:
 plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
 plt.title('i_mag', fontsize='16')
else:
 plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s')
 plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s')
 plt.title('i_mag', fontsize='16')
plt.rcParams['xtick.major.pad']=10
plt.rcParams['ytick.major.pad']=10
ax = plt.gca()
ax.title.set_y(1.1)
formy = plt.ScalarFormatter()
formy.set_powerlimits((-5, 5))
formy.set_scientific(False)
ax.yaxis.set_major_formatter(formy)
ax.set_ylim(ax.get_ylim()[::-1])
for tick in ax.xaxis.get_major_ticks():
 tick.label.set_fontsize(16)
for tick in ax.yaxis.get_major_ticks():
 tick.label.set_fontsize(16)
plt.xlabel('Days', fontsize='20', labelpad=20)
plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20)
if y_r == []:
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
 numpoints=1, ncol=2, borderaxespad=0.)
else:
 plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
 numpoints=1, ncol=2, borderaxespad=0.)
leg = plt.gca().get_legend()
ltext = leg.get_texts()
plt.setp(ltext, fontsize='16')
plt.savefig('lc0.png', facecolor='white', bbox_inches='tight')
plt.close("i_only") 
[/code]
Best regards,
frix
Am 26.03.2013 um 20:36 schrieb Sterling Smith <sm...@fu...>:
> Frix,
> 
> It may be useful to post the version and backend you are using to the list.
> 
> import matplotlib
> print matplotlib.__version__
> print matplotlib.get_backend()
> 
> Also, if you can format the code as a simple self-contained example, that would help others confirm what you are seeing.
> 
> -Sterling
> 
> On Mar 26, 2013, at 12:01PM, Hackstein wrote:
> 
>> Hello everyone,
>> 
>> I have two issues with my current projects:
>> 
>> 1) I automatically generate plots of several data sets in a for-loop, all of which have the same shape of x and y values, but some of which have two of those data (i.e. graphs) sets per figure, others have only one.
>> I create the legend by
>> 
>> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, borderaxespad=0.)
>> 
>> which works perfectly if I plot two data sets (and therefore two labels) in a figure, but sometimes (not always) causes an error, if only one data set is plotted in a figure.
>> The legend is this
>> 
>> print ax.get_legend_handles_labels()
>> ([<matplotlib.lines.Line2D object at 0x24b9550>], ['i_s'])
>> 
>> and the error is
>> 
>> File "/usr/lib64/python2.6/site-packages/matplotlib/offsetbox.py", line 76, in _get_packed_offsets
>> sep = (total - sum(w_list)) / (len(w_list) - 1.)
>> FloatingPointError: divide by zero encountered in double_scalars
>> 
>> which I broke down to a problem with the" mode='expand'" parameter. It seems it cannot expand when the number of labels is 1. Strangely, however, that seems not always to be the case, since some of the plots with only one data set and one legend entry work without problems, but some raise an error.
>> 
>> 2) Another problem occurs with the y-axis tick labels. Even if the y-values are quite ordinary (in the order of 10) the labels get scientific notation when the y-range is small (order 0.1). I don't know why that is and it only occurs then. When the y-range is larger (order of 1), the ticks get plain numbers. I tried to work around that with the following code, which did not
>> work:
>> 
>> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100) plt.plot(np.asarray(mod_mjd_list_i), np.asarray(x_i), 'r-', label = 'i_s') ax = plt.gca() formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5))
>> formy.set_scientific(False)
>> ax.yaxis.set_major_formatter(formy)
>> 
>> Any ideas what I can do?
>> 
>> Thanks,
>> frix
>> 
>> 
>> ------------------------------------------------------------------------------
>> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest.
>> Compete for recognition, cash, and the chance to get your game 
>> on Steam. 5ドルK grand prize plus 10 genre and skill prizes. 
>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d_______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Benjamin R. <ben...@ou...> - 2013年03月27日 13:11:21
On Wed, Mar 27, 2013 at 1:03 AM, Gökhan Sever <gok...@gm...> wrote:
> Hello,
>
> Aren't these two log scaling calls supposed to be performing the same
> action?
>
> Here is a simple script tested in ipython --pylab
>
> fig = plt.figure(figsize=(5, 5))
> ax1 = fig.add_subplot(1,1,1)
> ax1.plot(np.random.randn(100))
>
> ax1.xaxis.set_scale('log')
> ax1.set_xscale('log')
>
>
Intuitively, I guess they should be identical, but they don't seem to be.
It seems like for "ax1.xaxis.set_scale('log')", everything is set
correctly, except the projection.
Ben Root
From: Michael D. <md...@st...> - 2013年03月27日 12:52:43
I'm pleased to announce the release of matplotlib 1.2.1. This is a bug 
release and improves stability and quality over the 1.2.0 release from 
four months ago. All users on 1.2.0 are encouraged to upgrade.
Since github no longer provides download hosting, our tarballs and 
binaries are back on SourceForge, and we have a master index of 
downloads here:
http://matplotlib.org/downloads <http://matplotlib.org/downloads.html>
Highlights include:
- Usage of deprecated APIs in matplotlib are now displayed by default on 
all Python versions
- Agg backend: Cleaner rendering of rectilinear lines when snapping to 
pixel boundaries, and fixes rendering bugs when using clip paths
- Python 3: Fixes a number of missed Python 3 compatibility problems
- Histograms and stacked histograms have a number of important bugfixes
- Compatibility with more 3rd-party TrueType fonts
- SVG backend: Image support in SVG output is consistent with other backends
- Qt backend: Fixes leaking of window objects in Qt backend
- hexbin with a log scale now works correctly
- autoscaling works better on 3D plots
- ...and numerous others.
Enjoy! As always, there are number of good ways to get help with 
matplotlib listed on the homepage at http://matplotlib.org/ and I thank 
everyone for their continued support of this project.
Mike Droettboom
From: Alexander E. <ale...@ov...> - 2013年03月27日 12:19:40
On 2013年3月27日 14:02:58 +0530
Sayan Chatterjee <say...@gm...> wrote:
> I'm new to Matplotlib. It might be a silly question, how does one plot
> data(not functions) in Matplotlib.
Besides the solution given in the first reply, you may also check
https://github.com/dmcdougall/mpl_binutils
Regards
Alex
From: Sayan C. <say...@gm...> - 2013年03月27日 12:17:32
Thank you very much for your prompt reply.
Florian, your reply seems to be the answer to my question. I'll try it
out. If can't figure out,I'll get back to you.
On 27 March 2013 15:37, Florian M. Wagner <wag...@st...> wrote:
> Hey Sayan,
>
> for reading in simple ASCII-Files containing your two arrays you should
> have a look at the numpy.loadtxt function.
>
> Scatter plots in matplotlib are then easily created as shown here
> http://matplotlib.org/examples/pylab_examples/scatter_demo.html
>
> For your purpose you can do something like:
>
> import os
> import numpy as np
> import matplotlib.pyplot as plt
>
> for file in os.path.listdir():
> x, y = np.loadtxt(file, unpack=True)
> plt.scatter(x,y)
> plt.savefig(file + '.png')
>
> Cheers,
>
> Florian
>
>
> Am 27.03.2013 09:32, schrieb Sayan Chatterjee:
>
> Dear All,
>
> I'm new to Matplotlib. It might be a silly question, how does one plot
> data(not functions) in Matplotlib.
>
> How:
> 1)Two arrays (X and Y) can be plotted in a scatter diagram?
>
> 2) or a number of data files can used to produce different plots having
> different(sequential) name?
>
> Thanks in anticipation.
> Regards,
> Sayan
>
> --
>
>
> --------------------------------------------------------------------------
> *Sayan Chatterjee*
> Dept. of Physics and Meteorology
> IIT Kharagpur
> Lal Bahadur Shastry Hall of Residence
> Room AB 205
> Mob: +91 9874513565
> blog: www.blissprofound.blogspot.com
>
> Volunteer , Padakshep
> www.padakshep.org
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>
>
>
> _______________________________________________
> Matplotlib-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
--------------------------------------------------------------------------
*Sayan Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com
Volunteer , Padakshep
www.padakshep.org
From: Florian M. W. <wag...@st...> - 2013年03月27日 10:20:54
Hey Sayan,
for reading in simple ASCII-Files containing your two arrays you should 
have a look at the numpy.loadtxt function.
Scatter plots in matplotlib are then easily created as shown here 
http://matplotlib.org/examples/pylab_examples/scatter_demo.html
For your purpose you can do something like:
 import os
 import numpy as np
 import matplotlib.pyplot as plt
 for file in os.path.listdir():
 x, y = np.loadtxt(file, unpack=True)
 plt.scatter(x,y)
 plt.savefig(file + '.png')
Cheers,
Florian
Am 27.03.2013 09:32, schrieb Sayan Chatterjee:
> Dear All,
>
> I'm new to Matplotlib. It might be a silly question, how does one plot 
> data(not functions) in Matplotlib.
>
> How:
> 1)Two arrays (X and Y) can be plotted in a scatter diagram?
>
> 2) or a number of data files can used to produce different plots 
> having different(sequential) name?
>
> Thanks in anticipation.
> Regards,
> Sayan
>
> -- 
>
>
> --------------------------------------------------------------------------
> *Sayan Chatterjee*
> Dept. of Physics and Meteorology
> IIT Kharagpur
> Lal Bahadur Shastry Hall of Residence
> Room AB 205
> Mob: +91 9874513565
> blog: www.blissprofound.blogspot.com 
> <http://www.blissprofound.blogspot.com>
>
> Volunteer , Padakshep
> www.padakshep.org <http://www.padakshep.org>
>
>
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Sayan C. <say...@gm...> - 2013年03月27日 08:33:46
Dear All,
I'm new to Matplotlib. It might be a silly question, how does one plot
data(not functions) in Matplotlib.
How:
1)Two arrays (X and Y) can be plotted in a scatter diagram?
2) or a number of data files can used to produce different plots having
different(sequential) name?
Thanks in anticipation.
Regards,
Sayan
-- 
--------------------------------------------------------------------------
*Sayan Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com
Volunteer , Padakshep
www.padakshep.org
From: Gökhan S. <gok...@gm...> - 2013年03月27日 05:03:52
Hello,
Aren't these two log scaling calls supposed to be performing the same
action?
Here is a simple script tested in ipython --pylab
fig = plt.figure(figsize=(5, 5))
ax1 = fig.add_subplot(1,1,1)
ax1.plot(np.random.randn(100))
ax1.xaxis.set_scale('log')
ax1.set_xscale('log')
Thanks.
-- 
Gökhan
From: Sterling S. <sm...@fu...> - 2013年03月26日 19:36:27
Frix,
It may be useful to post the version and backend you are using to the list.
import matplotlib
print matplotlib.__version__
print matplotlib.get_backend()
Also, if you can format the code as a simple self-contained example, that would help others confirm what you are seeing.
-Sterling
On Mar 26, 2013, at 12:01PM, Hackstein wrote:
> Hello everyone,
> 
> I have two issues with my current projects:
> 
> 1) I automatically generate plots of several data sets in a for-loop, all of which have the same shape of x and y values, but some of which have two of those data (i.e. graphs) sets per figure, others have only one.
> I create the legend by
> 
> plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, borderaxespad=0.)
> 
> which works perfectly if I plot two data sets (and therefore two labels) in a figure, but sometimes (not always) causes an error, if only one data set is plotted in a figure.
> The legend is this
> 
> print ax.get_legend_handles_labels()
> ([<matplotlib.lines.Line2D object at 0x24b9550>], ['i_s'])
> 
> and the error is
> 
> File "/usr/lib64/python2.6/site-packages/matplotlib/offsetbox.py", line 76, in _get_packed_offsets
> sep = (total - sum(w_list)) / (len(w_list) - 1.)
> FloatingPointError: divide by zero encountered in double_scalars
> 
> which I broke down to a problem with the" mode='expand'" parameter. It seems it cannot expand when the number of labels is 1. Strangely, however, that seems not always to be the case, since some of the plots with only one data set and one legend entry work without problems, but some raise an error.
> 
> 2) Another problem occurs with the y-axis tick labels. Even if the y-values are quite ordinary (in the order of 10) the labels get scientific notation when the y-range is small (order 0.1). I don't know why that is and it only occurs then. When the y-range is larger (order of 1), the ticks get plain numbers. I tried to work around that with the following code, which did not
> work:
> 
> plt.figure("i_only", figsize=(14.40, 9.00), dpi=100) plt.plot(np.asarray(mod_mjd_list_i), np.asarray(x_i), 'r-', label = 'i_s') ax = plt.gca() formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5))
> formy.set_scientific(False)
> ax.yaxis.set_major_formatter(formy)
> 
> Any ideas what I can do?
> 
> Thanks,
> frix
> 
> 
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game 
> on Steam. 5ドルK grand prize plus 10 genre and skill prizes. 
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Hackstein <new...@gm...> - 2013年03月26日 19:01:49
Hello everyone,
 
I have two issues with my current projects:
 
1) I automatically generate plots of several data sets in a for-loop, all
of which have the same shape of x and y values, but some of which have two
of those data (i.e. graphs) sets per figure, others have only one.
I create the legend by 
 
plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand',
numpoints=1, borderaxespad=0.)
 
which works perfectly if I plot two data sets (and therefore two labels) in
a figure, but sometimes (not always) causes an error, if only one data set
is plotted in a figure.
The legend is this
 
print ax.get_legend_handles_labels()
([<matplotlib.lines.Line2D object at 0x24b9550>], ['i_s'])
 
and the error is 
 
File "/usr/lib64/python2.6/site-packages/matplotlib/offsetbox.py", line 76,
in _get_packed_offsets
 sep = (total - sum(w_list)) / (len(w_list) - 1.)
FloatingPointError: divide by zero encountered in double_scalars
 
which I broke down to a problem with the" mode='expand'" parameter. It seems
it cannot expand when the number of labels is 1. Strangely, however, that
seems not always to be the case, since some of the plots with only one data
set and one legend entry work without problems, but some raise an error. 
 
2) Another problem occurs with the y-axis tick labels. Even if the y-values
are quite ordinary (in the order of 10) the labels get scientific notation
when the y-range is small (order 0.1). I don't know why that is and it only
occurs then. When the y-range is larger (order of 1), the ticks get plain
numbers. I tried to work around that with the following code, which did not
work:
 
plt.figure("i_only", figsize=(14.40, 9.00), dpi=100)
plt.plot(np.asarray(mod_mjd_list_i), np.asarray(x_i), 'r-', label = 'i_s')
ax = plt.gca() formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5))
formy.set_scientific(False)
ax.yaxis.set_major_formatter(formy)
 
Any ideas what I can do?
 
Thanks,
frix
 
 
From: Miriam D. <md...@am...> - 2013年03月25日 16:17:26
Hi Jon,
yes, this is what I am looking for. Now, the chart is like I've expected.
Thank you all! (...also for the quick response!)
Miriam D.
On 25/03/13 17:00, Jonathan Slavin wrote:
> Hi Miriam,
>
> This case is a simple one for setting the axis ratios. You want to set
> the aspect ratio to equal:
> gca().set_aspect('equal')
> after making your plot
>
> Jon
>
> On Mon, 2013年03月25日 at 16:06 +0100, Miriam Degginger wrote:
>> Hi all,
>>
>> I am working on a correlation chart with pyplot for a monitoring web
>> tool. The plot is looking good, but only the strange resolution of axes
>> disturbs the view.
>>
>> In a simple correlation plot, e.g. I want to compare two temperature
>> sensors, I expect a line who divides the picture in two halves with an
>> angle of 45° (optimal correlation R2=1). That feels natural and you can
>> see whether the both sensors correlate or not without a deeper look at
>> the exact values. But pyplot shows me a chart, where the x-axis's tick
>> interval is larger (108 pixel) than the y-axis's tick interval (77
>> pixel). In attachment you can see my example.
>>
>> How can I manipulate the axes that they show the same pixel resolution?
>>
>> I hope I make my case clear. If more information is needed, please tell me.
>>
>> Thank you very much in advance!
>>
>> Miriam D.

Showing results of 204

<< < 1 2 3 4 .. 9 > >> (Page 2 of 9)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /