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
(27) |
2
(15) |
3
(2) |
4
(4) |
5
(5) |
6
(9) |
7
(15) |
8
(24) |
9
(19) |
10
(7) |
11
(13) |
12
(26) |
13
(27) |
14
(17) |
15
(14) |
16
(12) |
17
(9) |
18
(12) |
19
(17) |
20
(19) |
21
(5) |
22
(5) |
23
(7) |
24
(4) |
25
(1) |
26
(9) |
27
(20) |
28
(5) |
29
(10) |
30
(12) |
31
(6) |
Sorry...That first line should be: fig, axes = plt.subplots(ncols=3) # note: subplotS not subplot On Mon, Mar 19, 2012 at 5:45 PM, Paul Hobson <pmh...@gm...> wrote: > Try it like this: > > fig, axes = plt.subplots(3,1,1) > ax1, ax2, ax3 = axes > p1, = ax1.plot(self.data0,self.data1) > p2, = ax2.plot(self.data0,self.data2) > p3, = ax3.plot(self.data0,self.data4) > for ax in axes: > ax.set_xticks([]) > > -paul
Try it like this: fig, axes = plt.subplots(3,1,1) ax1, ax2, ax3 = axes p1, = ax1.plot(self.data0,self.data1) p2, = ax2.plot(self.data0,self.data2) p3, = ax3.plot(self.data0,self.data4) for ax in axes: ax.set_xticks([]) -paul On Thu, Mar 15, 2012 at 1:06 AM, kususe <ku...@in...> wrote: > > > > On Wed, Mar 14, 2012 at 2:38 PM, kususe <ku...@in...> wrote: > >> >> I got an error using the first subplot function because I have to specify >> 3 >> parameters. >> If i do it, I get that "AxesSubplot' object is not iterable" >> I coded using 3 subplot functions, getting the same error. >> >> Thanks >> K. >> >> > Note that I wrote `subplots` with an "s", which is a different command than > `subplot`. (You're really having problems with "s"s today :) > > BTW, would you mind interleaving or bottom-posting > replies<http://en.wikipedia.org/wiki/Posting_style#Placement_of_replies>. > It's a bit easier to follow the conversation that way. > > -Tony > > > Yes, for sure I coded: > > fig, axes = plt.subplot(3,1,1) > ax1, ax2, ax3 = axes > p1, = ax1.plot(self.data0,self.data1) > .... > plt.subplot(3,1,2) > p2, = ax2.plot(self.data0,self.data2) > ....... > plt.subplot(3,1,3) > p3, = ax3.plot(self.data0,self.data4) > ........ > for ax in axes: > ax.set_xticks([]) > > but I got the error which said you. > -- > View this message in context: http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33507959.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
So when I add "np.logical_or" to the beginning of the script it makes no difference to the error message that I receive. I have tried reshaping the array but I receive an error message of: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> f.reshape(691,886) ValueError: total size of new array must be unchanged Is there a way to use np.genfromtxt and define the rows and columns on import? Thanks On Fri, Mar 16, 2012 at 7:10 AM, Goyo <goy...@gm...> wrote: > El día 15 de marzo de 2012 05:14, questions anon > <que...@gm...> escribió: > > I think my error is from the np.genfromtxt because I just checked the > size > > of my data and it appears in 1D rather than 2D. > > This is unsurprising since your file has just one row of data. I > overlooked that because the weird error message drove all my attention > to it. You can reshape the resulting array to (691, 886). Still that > error message should not be there in any case. > > >> I don't really understand what np.logical_or is or how to use it? > >> I have tried just calling it at the beginning of the script > > np.logical_or computes the logical out of two boolean arrays. It's > called internally by countourf and that's triggering the exception: > > AttributeError: logical_or > > Which makes no sense at all because: > 1. np is expected to be an alias for numpy and numpy *does* have an > attribute called logical_or. > 2. In case np didn't have an attribute called logical_or (for whatever > reason) it would cause an exception but the error message should be > something like "AttributeError: 'module' object has no attribute > 'logical_or'". > > You where asked to call np.logical_or at the beginning of the script > in order to know if it triggers the exception in that context. > > >> [...] but I still end up with the same error. > > So the call at the beginning didn't trigger the error? > > Regards > > Goyo >
Hello, I have been trying to figure out where my problem lies all day. Details: Mac Os X 10.6.8 Python/matplotlib : 1.1.0 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.pyc Matplotlib obtained from sourceforge. Running with ipython Error Message: Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize self.show() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array)) TclError Any ideas? cheers, Andrew
On Mon, Mar 19, 2012 at 1:36 PM, Moore, Eric (NIH/NIDDK) [F] < eri...@ni...> wrote: > From: Benjamin Root [mailto:ben...@ou...] > Sent: Monday, March 19, 2012 2:00 PM > To: Joshua Lande > Cc: mat...@li... > Subject: Re: [Matplotlib-users] Strange compression of matplotlib's eps > figures > > ... > > Using Firefox, I see no difference between the two images. What are you > using? > > Ben Root > > > All of the rows and columns are not the same width in the two images. Not > limited to saving as eps. Also true if you change the example to png and > then zoom in. Since imshow more than likely always saves as a raster, I'll > bet the real problem is the number of pixels doesn't divide evenly into the > size of z in Joshua's example. > > Eric > > Ah, I see. Yeah, that's not a bug, but a simple limitation of integer math. We have introduced a new option for interpolation in v1.1.0 that might help. Pass in the string "none" (not that python keyword) to the interpolation kwarg in imshow and maybe your results will look better. Ben Root
From: Benjamin Root [mailto:ben...@ou...] Sent: Monday, March 19, 2012 2:00 PM To: Joshua Lande Cc: mat...@li... Subject: Re: [Matplotlib-users] Strange compression of matplotlib's eps figures ... Using Firefox, I see no difference between the two images. What are you using? Ben Root All of the rows and columns are not the same width in the two images. Not limited to saving as eps. Also true if you change the example to png and then zoom in. Since imshow more than likely always saves as a raster, I'll bet the real problem is the number of pixels doesn't divide evenly into the size of z in Joshua's example. Eric
Hi. I have attached a screenshot of the way the image looks when viewed by Preview on my mac, evince on my RHEL5 machine, and the built in google docs image viewer. The image should look like 22x22 square pixels, but (at least for me) has stripes of strange looking rectangular pixels. The preview screenshot shows both the good and bad version of the image. I hope this makes sense. Joshua On Mon, Mar 19, 2012 at 10:59 AM, Benjamin Root <ben...@ou...> wrote: > On Sun, Mar 18, 2012 at 5:07 PM, Joshua Lande <jos...@gm...> wrote: >> >> Hello. >> >> I have run into a strange error where matplotlib compresses images >> that are saved with the eps backend. Strangely, this compression seems >> to happen only for images saved with certain figure sizes. I created a >> very simple example which produces this behavior. >> >> import pylab as P >> import numpy as np >> np.random.seed(0) >> z=np.random.uniform(size=(22,22)) >> >> for figsize in [.5,.55]: >> F = P.figure(None,(figsize,figsize)) >> ax = F.add_subplot(111) >> im = ax.imshow(z, origin="lower", interpolation="nearest") >> ax.xaxis.set_ticks([]) >> ax.yaxis.set_ticks([]) >> >> P.savefig('test_%.2f.eps' % figsize) >> >> This code produces test_0.50.eps (attached) which shows ugly >> compression whereas test_0.55.eps (also attached) is uncompressed. >> >> Is there an easy way to disable this compression? >> >> For reference, I am using python version 2.7.2, matplotlib version >> 1.1.0, and for clarity I do not have a matplotlibrc file. >> >> Thanks for your help, >> >> Joshua >> > > Using Firefox, I see no difference between the two images. What are you > using? > > Ben Root >
On Sun, Mar 18, 2012 at 5:07 PM, Joshua Lande <jos...@gm...> wrote: > Hello. > > I have run into a strange error where matplotlib compresses images > that are saved with the eps backend. Strangely, this compression seems > to happen only for images saved with certain figure sizes. I created a > very simple example which produces this behavior. > > import pylab as P > import numpy as np > np.random.seed(0) > z=np.random.uniform(size=(22,22)) > > for figsize in [.5,.55]: > F = P.figure(None,(figsize,figsize)) > ax = F.add_subplot(111) > im = ax.imshow(z, origin="lower", interpolation="nearest") > ax.xaxis.set_ticks([]) > ax.yaxis.set_ticks([]) > > P.savefig('test_%.2f.eps' % figsize) > > This code produces test_0.50.eps (attached) which shows ugly > compression whereas test_0.55.eps (also attached) is uncompressed. > > Is there an easy way to disable this compression? > > For reference, I am using python version 2.7.2, matplotlib version > 1.1.0, and for clarity I do not have a matplotlibrc file. > > Thanks for your help, > > Joshua > > Using Firefox, I see no difference between the two images. What are you using? Ben Root
Awesome John!! Thank you very much for your help on this... Guido From: John Hunter [mailto:jd...@gm...] Sent: Monday, March 19, 2012 12:52 PM To: Espinosa, Guido R Cc: mat...@li... Subject: Re: [Matplotlib-users] Too Many Requests error - matplotlib gallery On Mon, Mar 19, 2012 at 12:46 PM, John Hunter <jd...@gm...<mailto:jd...@gm...>> wrote: Thanks, this has been going on for several days now and I just filed a ticket with sourceforge. https://sourceforge.net/apps/trac/sourceforge/ticket/24897 In the meantime, a slightly out of date version of the website is available here: http://matplotlib.github.com/index.html JDH
What are you using to view the SVG? This works for me in Inkscape, Firefox and Google Chrome, but fails using rsvg 2.34 (which is used by ImageMagick and emacs, for example). It seems that rsvg doesn't like the clip path to appear after the object that uses it, even though this is allowed by the SVG spec. SVG compliance is pretty spotty between different renderers, but I generally think rsvg is one of the worst. Mike On 03/19/2012 12:46 PM, Sebastian Ohl wrote: > Hi, > > when i have a dataset that covers an area larger than the area i want > to show in my plot, then it should be clipped to the ranges i set to the > axes (at least that is what i am expecting). when i do so and save the > plot to a png-file everything is fine. but if i save it to an svg file, > the plot is not clipped to the plot area. did i do something wrong in > the code below or is it just a bug in the svg-backend? > > import matplotlib.pyplot as plt > > xData = range(0,100) > yData = range(0,100) > > ax = plt.axes() > ax.set_xlim(30,70) > ax.set_ylim(40,60) > > plt.plot(xData,yData) > plt.savefig("test.svg", format='svg', transparent=True) > plt.savefig("test.png", format='png', transparent=True) > > > > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Mario, When you call fig.add_subplot as you are doing, ax1 is None. I'm not sure why, but you don't need to set the xticks there anyway. Change your call to be ax1 = fig.add_subplot(111) that way ax1 != None. Then plot, create ax2, plot. You can then set the xticks by calling ax1.set_xticks([10,40,90]) or equivalently ax2.set_xticks([10,40,90]). Eric > -----Original Message----- > From: Mario Konschake [mailto:mar...@gm...] > Sent: Monday, March 19, 2012 1:11 PM > To: matplotlib-users > Subject: [Matplotlib-users] xticks when using twinx() > > Hello, > > I to set custom xticks is usually used > > fig = plt.figure() > ax1 = fig.add_subplot(xticks=[10,40,90]) > plt.plot(range(100)) > > I now need to have a second y-axis and tried > > fig = plt.figure() > > ax1 = fig.add_subplot(xticks=[10,40,90]) > plt.plot(range(100)) > > ax2 = plt.twinx() > plt.plot([x*x for x in range(100)]) > > which works fine, but i use the ability to manipulate the xticks. > > Any help is highly appriciated. > > Thank you, Mario. > > ----------------------------------------------------------------------- > ------- > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On Mon, Mar 19, 2012 at 12:46 PM, John Hunter <jd...@gm...> wrote: > > Thanks, this has been going on for several days now and I just filed a > ticket with sourceforge. > > > https://sourceforge.net/apps/trac/sourceforge/ticket/24897 > In the meantime, a slightly out of date version of the website is available here: http://matplotlib.github.com/index.html JDH
On Mon, Mar 19, 2012 at 11:46 AM, <gu...@th...> wrote: > Hi Guys,**** > > ** ** > > Accessing the Matplotlib gallery is killing access to the sourceforce > matplotlib site giving the "Too many requests" error. Anytime you access > the gallery, and attempt to view source of any thumbnail, the site gives > the error. Then, the entire website becomes unusable, for example, if you > then try to access the docs page, it will give the same error. I’ve noticed > this error only in the past few weeks. **** > > ** ** > > The gallery URL is this: http://matplotlib.sourceforge.net/gallery.html*** > * > > ** > Thanks, this has been going on for several days now and I just filed a ticket with sourceforge. https://sourceforge.net/apps/trac/sourceforge/ticket/24897 JDH
Hi Guys, Accessing the Matplotlib gallery is killing access to the sourceforce matplotlib site giving the "Too many requests" error. Anytime you access the gallery, and attempt to view source of any thumbnail, the site gives the error. Then, the entire website becomes unusable, for example, if you then try to access the docs page, it will give the same error. I've noticed this error only in the past few weeks. The gallery URL is this: http://matplotlib.sourceforge.net/gallery.html After visiting the above URL, the entire matplotlib website is down, even home: http://matplotlib.sourceforge.net/index.html Thanks for looking into this! Guido
Hello, I to set custom xticks is usually used fig = plt.figure() ax1 = fig.add_subplot(xticks=[10,40,90]) plt.plot(range(100)) I now need to have a second y-axis and tried fig = plt.figure() ax1 = fig.add_subplot(xticks=[10,40,90]) plt.plot(range(100)) ax2 = plt.twinx() plt.plot([x*x for x in range(100)]) which works fine, but i use the ability to manipulate the xticks. Any help is highly appriciated. Thank you, Mario.
Hi, when i have a dataset that covers an area larger than the area i want to show in my plot, then it should be clipped to the ranges i set to the axes (at least that is what i am expecting). when i do so and save the plot to a png-file everything is fine. but if i save it to an svg file, the plot is not clipped to the plot area. did i do something wrong in the code below or is it just a bug in the svg-backend? import matplotlib.pyplot as plt xData = range(0,100) yData = range(0,100) ax = plt.axes() ax.set_xlim(30,70) ax.set_ylim(40,60) plt.plot(xData,yData) plt.savefig("test.svg", format='svg', transparent=True) plt.savefig("test.png", format='png', transparent=True) -- Regards Sebastian Ohl -- Sebastian Ohl seb...@oh... Kurzekampstr. 14 Tel +49 531 7998221 D-38104 Braunschweig Mobil +49 172 1837678
Or, more likely, PEBCAK, but here goes: Following along with this example: http://matplotlib.sourceforge.net/examples/api/font_family_rc.html I tried the following (changing to comic sans so that "success" would be clear): from matplotlib import rcParams rcParams['font.family'] = 'sans-serif' rcParams['font.sans-serif'] = ['Comic Sans MS'] import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot([1,2,3], label='test') ax.legend() plt.show() However, the above does not result in "Comic Sans" on the plot... (Thank god, but still, that doesn't seem correct wrt the stated behavior from the example.) The below, however, does get comic sans: from matplotlib import rcParams rcParams['font.family'] = 'Comic Sans MS' import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot([1,2,3], label='test') ax.legend() plt.show() Is this a known issue / feature / mis-comprehension on my part? Otherwise I'll try digging through the code to find the problem. Thanks, Zach
Hello, I to set custom xticks is usually used fig = plt.figure() ax1 = fig.add_subplot(xticks=[10,40,90]) plt.plot(range(100)) I now need to have a second y-axis and tried fig = plt.figure() ax1 = fig.add_subplot(xticks=[10,40,90]) plt.plot(range(100)) ax2 = plt.twinx() plt.plot([x*x for x in range(100)]) which works fine, but i use the ability to manipulate the xticks. Any help is highly appriciated. Thank you, Mario.
Hello, below I've included my script for plotting some data, and a small amount of the data itself. I plot the data to several different file types via pyplot.savefig(). For each of eps, pdf, and png, it works fine. With svg it throws this error, any ideas why?: harb@joan:~/Documents/DATA/ApplicationData/python-script$ ./T-plots-modelvdata.py Traceback (most recent call last): File "./T-plots-modelvdata.py", line 58, in <module> plt.savefig(directory + 'data-and-models.svg') File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/pyplot.py", line 363, in savefig return fig.savefig(*args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/figure.py", line 1084, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backends/backend_wxagg.py", line 100, in print_figure FigureCanvasAgg.print_figure(self, filename, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backend_bases.py", line 1923, in print_figure **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backend_bases.py", line 1754, in print_svg return svg.print_svg(*args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backends/backend_svg.py", line 867, in print_svg return self._print_svg(filename, svgwriter, fh_to_close, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backends/backend_svg.py", line 902, in _print_svg self.figure.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/figure.py", line 798, in draw func(*args) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/axes.py", line 1946, in draw a.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/legend.py", line 430, in draw self._legend_box.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/offsetbox.py", line 240, in draw c.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/offsetbox.py", line 240, in draw c.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/offsetbox.py", line 240, in draw c.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/offsetbox.py", line 240, in draw c.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/offsetbox.py", line 678, in draw self._text.draw(renderer) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/text.py", line 571, in draw self._fontproperties, angle) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backends/backend_svg.py", line 587, in draw_tex self.draw_text_as_path(gc, x, y, s, prop, angle, ismath="TeX") File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/backends/backend_svg.py", line 541, in draw_text_as_path path = Path(*glyph_path) File "/usr/local/lib/python2.6/dist-packages/matplotlib-1.0.1-py2.6-linux-x86_64.egg/matplotlib/path.py", line 121, in __init__ assert vertices.ndim == 2 AssertionError SCRIPT (yes there are some ugly bits): import numpy as np import matplotlib.pyplot as plt from matplotlib import rc # Set matplotlib to use LaTeX text handling: rc('text', usetex=True) rc('font', family='serif') # Data file format: depth, temperature, depth, temperature, ... directory = '~/bores/' filename = directory + 'data-and-models.txt' tdata = np.genfromtxt(filename, skip_header=2, delimiter='\t', comments='#', missing_values='', filling_values=np.nan) # Get bore names and IDs: with open(filename,'rU') as f: bores = f.readline().rstrip().split('\t') headers = f.readline().rstrip().split('\t') for column in range(0, np.shape(tdata)[1], 2): # Plots temperature on x, depth on y: if bores[column+1] in ('T (q=70)', 'data'): plt.plot( tdata[:, column + 1], tdata[:, column], label=bores[column] + ' ' + bores[column + 1]) # titivate plot: plt.title("Borehole data and model comparison") plt.xlim(10,80) plt.ylim(-1500,0) plt.grid(True) plt.xlabel(r'Temperature (\textcelsius)') plt.ylabel(r'Depth ($mGL$)') plt.legend() plt.savefig(directory + 'data-and-models.pdf') plt.savefig(directory + 'data-and-models.eps') plt.savefig(directory + 'data-and-models.png') #plt.savefig(directory + 'data-and-models.svg') DATA SAMPLE (it's tab separated, hope they don't get converted to spaces): DST fluid recovery data Precision log data Stratigraphy model T (q=65) Stratigraphy model T (q=70) Stratigraphy model T (q=75) Lithology model T (q=65) Lithology model T (q=70) Lithology model T (q=75) Depth Temperature Depth Temperature Depth Temperature Depth Temperature Depth Temperature Depth Temperature Depth Temperature Depth Temperature -444.53 39.72 0 12.46 0 15 0 15 0 15 0.0 15 0.0 15 0.0 15 -876.53 55.81 -1.02 12.35 -19.75 15.6428849105 -19.75 15.6923375959 -19.75 15.7417902813 -16.3 15.541943734 -16.3 15.5836317136 -16.3 15.6253196931 -1395.35 77.08 -2.04 12.32 -126.75 22.4731381074 -126.75 23.0479948849 -126.75 23.6228516624 -19.8 15.6428849105 -19.8 15.6923375959 -19.8 15.7417902813 -3.06 12.31 -144.3 22.8533881074 -144.3 23.4574948849 -144.3 24.0616016624 -42.3 18.5743849105 -42.3 18.8493375959 -42.3 19.1242902813 -4.08 12.34 -1439.3 67.1560196864 -1439.3 71.1680212007 -1439.3 75.180022715 -46.3 18.727326087 -46.3 19.0140434783 -46.3 19.3007608696 -5.1 12.34 -61.3 19.1512391304 -61.3 19.4705652174 -61.3 19.7898913043 -6.12 12.6 -69.3 19.4571214834 -69.3 19.7999769821 -69.3 20.1428324808 -7.13 12.88 -72.3 19.8471214834 -72.3 20.2199769821 -72.3 20.5928324808 -8.15 13.05 -77.3 20.038297954 -77.3 20.425859335 -77.3 20.8134207161 -9.17 13.2 -87.3 21.338297954 -87.3 21.825859335 -87.3 22.3134207161 -10.19 13.35 -89.3 21.4147685422 -89.3 21.9082122762 -89.3 22.4016560102 -11.21 13.47 -126.8 22.4731381074 -126.8 23.0479948849 -126.8 23.6228516624 -12.23 13.61 -144.8 22.8533881074 -144.8 23.4574948849 -144.8 24.0616016624 -13.25 13.95 -216.3 25.3011512653 -216.3 26.0935475165 -216.3 26.8859437677 -14.27 14.2 -380.3 30.9116775811 -380.3 32.1356527796 -380.3 33.3596279782 -15.29 14.62 -392.3 31.3222038969 -392.3 32.5777580428 -392.3 33.8333121887 -16.31 14.81 -419.9 32.2664144232 -419.9 33.5946001481 -419.9 34.9227858729 -17.33 14.94 -436.3 32.8274670548 -436.3 34.1988106744 -436.3 35.570154294 -18.35 16.01 -452.9 33.3960460022 -452.9 34.8111264639 -452.9 36.2262069256 -19.36 16.61 -453.3 33.4090460022 -453.3 34.8251264639 -453.3 36.2412069256 -20.38 16.95 -509.3 35.3248354758 -509.3 36.8882843586 -509.3 38.4517332414 -21.4 17.24 -636.3 39.6695723179 -636.3 41.567231727 -636.3 43.4648911361 -22.42 17.49 -746.3 43.4327302127 -746.3 45.619863306 -746.3 47.8069963992 -23.44 17.66 -770.3 44.2537828443 -770.3 46.5040738323 -770.3 48.7543648203 -24.46 17.85 -886.3 48.2222038969 -886.3 50.7777580428 -886.3 53.3333121887 -25.48 18.01 -958.3 50.6853617916 -958.3 53.4303896218 -958.3 56.1754174519 -26.5 18.17 -1160.3 57.5958881074 -1160.3 60.8724948849 -1160.3 64.1491016624 -27.52 18.31 -1324.3 63.2064144232 -1324.3 66.9146001481 -1324.3 70.6227858729 -28.54 18.52 -1379.3 65.0879933706 -1379.3 68.9409159375 -1379.3 72.7938385045 -29.56 18.65 -1412.3 66.216940739 -1412.3 70.1567054112 -1412.3 74.0964700835 -30.58 18.81 -1427.3 66.7300986337 -1427.3 70.7093369902 -1427.3 74.6885753466
Hello. I have run into a strange error where matplotlib compresses images that are saved with the eps backend. Strangely, this compression seems to happen only for images saved with certain figure sizes. I created a very simple example which produces this behavior. import pylab as P import numpy as np np.random.seed(0) z=np.random.uniform(size=(22,22)) for figsize in [.5,.55]: F = P.figure(None,(figsize,figsize)) ax = F.add_subplot(111) im = ax.imshow(z, origin="lower", interpolation="nearest") ax.xaxis.set_ticks([]) ax.yaxis.set_ticks([]) P.savefig('test_%.2f.eps' % figsize) This code produces test_0.50.eps (attached) which shows ugly compression whereas test_0.55.eps (also attached) is uncompressed. Is there an easy way to disable this compression? For reference, I am using python version 2.7.2, matplotlib version 1.1.0, and for clarity I do not have a matplotlibrc file. Thanks for your help, Joshua
After parsing matplotlibrc, I browsed module where errorbars are defined (axes.py) and tried changing various variables without success. In bar() function (line 4628) there is "adjust_xlim = False" line which calls line 4768 if set True. So I set it True, to find it's buggy if x starts from 0 (most common start value). I didn't tried to copy this code block in errorbars because of that I browsed then axis.py and then - transforms.py - total mess. Retreat. Didn't even figured out why IPython inline mode pads left side x range in above example. Seems like IPython/core/pylabtools.py just calls "canvas.print_figure(pic-data)" and passes image in qt terminal, but I can't reproduce same range if not in inline mode. Idea was to learn how IPython inline mode sets one part of this range correctly, then use it to make what I wanted So, I guess wrapping some function that would calculate smart view range, like Tony replied, is the way to go Thanks Tony
On Sun, Mar 18, 2012 at 11:08 AM, Benjamin Root <ben...@ou...> wrote: > > > On Sunday, March 18, 2012, Tony Yu <ts...@gm...> wrote: > > > > > > On Sun, Mar 18, 2012 at 9:14 AM, klo uo <kl...@gm...> wrote: > >> > >> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...> > wrote: > >>> > >>> For inline ipython, you want to switch to the object-oriented use of > >>> pylab. Something like this should work with xlim. > >>> > >>> a = [0.1, 0.2, 0.1] > >>> fig = plt.figure() > >>> ax = fig.add_subplot(111) > >>> ax.errorbar(arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') > >>> ax.set_xlim(-.5,2.5) > >>> ax.show() > >>> > >>> I'm not aware of automatic settings for padding, but with this > >>> set_xlim, it's easy enough to roll your own using the data limits. > >>> > >> > >> OK, thanks > >> > >> It's not very elegant (assuming pylab freedom) but I take it as only > way to correct clipping example (or differently put - to use custom range > for axis) > >> > > > > You can roll out a utility function that can automatically adjust the > limits with some specified padding (i.e. the function doesn't calculate the > marker size, but you can just give it sufficient padding). > > Here's an example where you specify a padding passed on the axes size > (0.05 is 5% of axes height/width): > > #~~~~ > > import numpy as np > > import matplotlib.pyplot as plt > > def pad_limits(pad_frac=0.05, ax=None): > > ax = ax if ax is not None else plt.gca() > > ax.set_xlim(_calc_limits(ax.xaxis, pad_frac)) > > ax.set_ylim(_calc_limits(ax.yaxis, pad_frac)) > > def _calc_limits(axis, frac): > > limits = axis.get_data_interval() > > mag = np.diff(limits)[0] > > pad = np.array([-mag*frac, mag*frac]) > > return limits + pad > > a = np.array([0.1, 0.2, 0.1]) > > plt.errorbar(np.arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') > > pad_limits() > > plt.show() > > #~~~~ > > I've put this is my personal mpl toolkit with the added ability of > handling log scales: > > https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py#L80 > > Best, > > -Tony > > > > > Uhm, don't we already have padx and pady kwargs for various limits > functions? I know scatter and plot respects them. > > Ben Root Oh, I didn't know anything about them. ... and where exactly? I can't seem to find them (I looked in `ax.autoscale`, `ax.autoscale_view`, and `plt.xlim`). -Tony (Sorry for the duplicate, Ben. I forgot to reply all)
Hi, I'm using surface_plot to view the results of solving the 2d wave equation. It works fine (code is below) except I would like to add a color bar and fix the limits on the vertical axis. When I add the color bar a new one is added in every iteration instead of overwriting the previous one, anyone know how I can prevent this? Also is it possible to specify a view point when plotting? Thanks D import matplotlib.pyplot as plt import numpy as np import pylab as py from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm pi = np.pi #Set up grid. fig = py.figure() ax = Axes3D(fig) nx = 50 nz = 50 X = np.arange(0, nx, 1) Y = np.arange(0, nz, 1) X, Y = np.meshgrid(X, Y) nsteps = 100 # Constants for equation. c = 4000 dt = 1e-4 h = 1 # Set up source. xs = 0 zs = 0 #fig2 = py.figure() ts = np.arange(dt,nsteps*dt,dt) s = 0.5*np.sin(2*pi*100*ts) #py.plot(ts,s) #py.show() # Homogeneous pressure field. p = np.zeros([nx, nz, nsteps]) # Solve equation. for t in range(0,nsteps-1): for z in range(0,nz-1): for x in range(0,nx-1): p[xs,zs,t] = s[t] k = (c*dt/h)**2 p[x,z,t] = 2*p[x,z,t-1] - p[x,z,t-2] + k*(p[x+1,z,t-1]-4*p[x,z,t-1]+p[x-1,z,t-1]+p[x,z+1,t-1]+p[x,z-1,t-1]) snap = p[:,:,t] surf = ax.plot_surface(X,Y,snap, rstride=1, cstride=1, cmap=cm.jet, linewidth=0) #fig.colorbar(surf, shrink=0.5, aspect=5) #py.draw() py.savefig('/home/davcra/Desktop/plots/2Dwave/'+str(t))
On Sunday, March 18, 2012, Tony Yu <ts...@gm...> wrote: > > > On Sun, Mar 18, 2012 at 9:14 AM, klo uo <kl...@gm...> wrote: >> >> On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...> wrote: >>> >>> For inline ipython, you want to switch to the object-oriented use of >>> pylab. Something like this should work with xlim. >>> >>> a = [0.1, 0.2, 0.1] >>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.errorbar(arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') >>> ax.set_xlim(-.5,2.5) >>> ax.show() >>> >>> I'm not aware of automatic settings for padding, but with this >>> set_xlim, it's easy enough to roll your own using the data limits. >>> >> >> OK, thanks >> >> It's not very elegant (assuming pylab freedom) but I take it as only way to correct clipping example (or differently put - to use custom range for axis) >> > > You can roll out a utility function that can automatically adjust the limits with some specified padding (i.e. the function doesn't calculate the marker size, but you can just give it sufficient padding). > Here's an example where you specify a padding passed on the axes size (0.05 is 5% of axes height/width): > #~~~~ > import numpy as np > import matplotlib.pyplot as plt > def pad_limits(pad_frac=0.05, ax=None): > ax = ax if ax is not None else plt.gca() > ax.set_xlim(_calc_limits(ax.xaxis, pad_frac)) > ax.set_ylim(_calc_limits(ax.yaxis, pad_frac)) > def _calc_limits(axis, frac): > limits = axis.get_data_interval() > mag = np.diff(limits)[0] > pad = np.array([-mag*frac, mag*frac]) > return limits + pad > a = np.array([0.1, 0.2, 0.1]) > plt.errorbar(np.arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') > pad_limits() > plt.show() > #~~~~ > I've put this is my personal mpl toolkit with the added ability of handling log scales: > https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py#L80 > Best, > -Tony > Uhm, don't we already have padx and pady kwargs for various limits functions? I know scatter and plot respects them. Ben Root
On Sun, Mar 18, 2012 at 9:14 AM, klo uo <kl...@gm...> wrote: > On Sun, Mar 18, 2012 at 1:50 PM, Angus McMorland <am...@gm...>wrote: > >> >> For inline ipython, you want to switch to the object-oriented use of >> pylab. Something like this should work with xlim. >> >> a = [0.1, 0.2, 0.1] >> fig = plt.figure() >> ax = fig.add_subplot(111) >> ax.errorbar(arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') >> ax.set_xlim(-.5,2.5) >> ax.show() >> >> I'm not aware of automatic settings for padding, but with this >> set_xlim, it's easy enough to roll your own using the data limits. >> >> > OK, thanks > > It's not very elegant (assuming pylab freedom) but I take it as only way > to correct clipping example (or differently put - to use custom range for > axis) > > You can roll out a utility function that can automatically adjust the limits with some specified padding (i.e. the function doesn't calculate the marker size, but you can just give it sufficient padding). Here's an example where you specify a padding passed on the axes size (0.05 is 5% of axes height/width): #~~~~ import numpy as np import matplotlib.pyplot as plt def pad_limits(pad_frac=0.05, ax=None): ax = ax if ax is not None else plt.gca() ax.set_xlim(_calc_limits(ax.xaxis, pad_frac)) ax.set_ylim(_calc_limits(ax.yaxis, pad_frac)) def _calc_limits(axis, frac): limits = axis.get_data_interval() mag = np.diff(limits)[0] pad = np.array([-mag*frac, mag*frac]) return limits + pad a = np.array([0.1, 0.2, 0.1]) plt.errorbar(np.arange(3), a, yerr=a-sum(a)/len(a), fmt='ro') pad_limits() plt.show() #~~~~ I've put this is my personal mpl toolkit with the added ability of handling log scales: https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py#L80 Best, -Tony