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
(9) |
2
(8) |
3
(6) |
4
(5) |
5
(10) |
6
(1) |
7
|
8
(5) |
9
(3) |
10
(12) |
11
(24) |
12
(28) |
13
(16) |
14
(3) |
15
(10) |
16
(17) |
17
(19) |
18
(10) |
19
(20) |
20
(7) |
21
(11) |
22
(7) |
23
(5) |
24
(4) |
25
(11) |
26
(19) |
27
(1) |
28
(1) |
29
(13) |
30
(7) |
31
(22) |
|
|
|
From: Fiedler, L. - 0. - M. <lar...@ll...> - 2011-08-11 22:51:58
|
I ended up creating a wrapper around the toolbar and resetting the labels and redrawing whenever something changes. Is there a cleaner way? class WrappedNavigationToolbar(NavigationToolbar): def __init__(self, viewer, canvas, parent): self.viewer = viewer super(WrappedNavigationToolbar, self).__init__(canvas, parent) def release_zoom(self, event): print "release zoom" super(WrappedNavigationToolbar, self).release_zoom(event) self.viewer.resetLabels() self.draw() def release_pan(self, event): print "release_pan" super(WrappedNavigationToolbar, self).release_pan(event) self.viewer.resetLabels() self.draw() def home(self, *args): print "home" super(WrappedNavigationToolbar, self).home(*args) self.viewer.resetLabels() self.draw() def forward(self, *args): print "forward" super(WrappedNavigationToolbar, self).forward(*args) self.viewer.resetLabels() self.draw() def back(self, *args): print "back" super(WrappedNavigationToolbar, self).back(*args) self.viewer.resetLabels() self.draw() . def resetLabels(self): xlabels = self.plotInfo.getXValues() xticks = self.axes.get_xticks() newticks = [] for label in xticks: idx = int(label) if idx >=0 and idx < len(xlabels): newticks.append(xlabels[idx]) else: newticks.append("") self.axes.set_xticklabels(newticks) From: Fiedler, Lars - 0447 - MITLL Sent: Thursday, August 11, 2011 6:10 PM To: mat...@li... Cc: Fiedler, Lars - 0447 - MITLL Subject: How to get correct xtick labels with zooming and panning Hi, If I create a bar graph inside a FigureCanvas, how do I get the correct x tick labels to display when someone does a zoom with the NavigationToolbar? For example, lets say I've got the below code: self.axes.set_xticks = range(len(vals)) self.axes.set_xticklabels(xLabels) self.axes.bar( left=range(len(vals)), height=map(float, vals), width=.2, align='center', alpha=0.44, picker=5) If the number of values is very large, then matplotlib seems to select only a few x labels to display (selecting far left and right, and some in the middle), but it's choosing the first ones in the specified label array, instead of indexing into it. I've tried setting the tick labels, based on the ticks it's selected, (setting labels based on the ticks after the bar has been created) and that seems to work on the initial load, but then if someone zooms into a particular part, it doesn't update the labels to the correct range . It's almost like I would need a callback to reset the labels . Ideas? Cheers, Lars |
From: Fiedler, L. - 0. - M. <lar...@ll...> - 2011-08-11 22:34:58
|
Hi, If I create a bar graph inside a FigureCanvas, how do I get the correct x tick labels to display when someone does a zoom with the NavigationToolbar? For example, lets say I've got the below code: self.axes.set_xticks = range(len(vals)) self.axes.set_xticklabels(xLabels) self.axes.bar( left=range(len(vals)), height=map(float, vals), width=.2, align='center', alpha=0.44, picker=5) If the number of values is very large, then matplotlib seems to select only a few x labels to display (selecting far left and right, and some in the middle), but it's choosing the first ones in the specified label array, instead of indexing into it. I've tried setting the tick labels, based on the ticks it's selected, (setting labels based on the ticks after the bar has been created) and that seems to work on the initial load, but then if someone zooms into a particular part, it doesn't update the labels to the correct range . It's almost like I would need a callback to reset the labels . Ideas? Cheers, Lars |
From: Paul I. <piv...@gm...> - 2011-08-11 20:36:17
|
Benjamin Root, on 2011-08-11 11:25, wrote: > On Thu, Aug 11, 2011 at 11:19 AM, David Just <Jus...@ma...> wrote: > > --onscroll-- > > self.ax.set_array(imdta[n]) # 0 < n < num_images > > self.canvas.draw() You last line here causes every artist on the canvas to draw. Have you tried blitting just the relevant axis? Look at the blitting animation examples (on the site) which have moved to examples/animation/old_animation in git. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
From: Paul I. <piv...@gm...> - 2011-08-11 20:13:52
|
WALTER Alain, on 2011-08-11 11:31, wrote: > Hello, > It's my first post on this forum and I'm very happy to discover a forum dedicated to matplotlib. I 've begun recently a development with matplotlib inside my python (2.7)application. > In a first step I've developped a stand alone graphical display and it runs properly. In a second step, I try to manage this graphical display through gtk (because my main application is in python/gtk) : now, most of functionalities run well, but labels on my 3 axes are no more displayed and I don't understand why. > Thank you for all suggestions. > > Here is the source code with gtk > ... > from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas > ... Hi there, glad you found us! I haven't looked closely, but I know there are limitations to what the gtk backend can render without using Agg (I recall a message on this list about rotated text not working, due to the interface to GTK we were using) so perhaps you ran into this. Can you try the gtkagg backend? best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
From: Ivan D V. <iv...@ad...> - 2011-08-11 18:23:42
|
On Thursday, August 11, 2011 14:20:22 you wrote: > but i instead use the following procedure to set up all of PyLab on Ubuntu 11.04: > > $ sudo add-apt-repository ppa:chris-lea/zeromq > $ sudo add-apt-repository ppa:pyside > $ sudo apt-get update > $ sudo apt-get build-dep python-numpy python-scipy matplotlib ipython pyzmq > $ sudo apt-get install python-pyside > $ ln -s /usr/lib/python2.7/dist-packages/PySide /opt/adverplex/lib/python2.7/site-packages/ sorry, this line should be: $ ln -s /usr/lib/python2.7/dist-packages/PySide {env}/lib/python2.7/site-packages/ where {env} is the location of your virtual environment. my company's standard environment happens to be at /opt/adverplex. > $ pip install --upgrade numpy scipy ipython pyzmq > $ pip install > http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz > > this has the benefit of being compatible with any virtual environment. prepend ``sudo `` to the pip > commands if your Python environment is owned by root. |
From: Ivan D V. <iv...@ad...> - 2011-08-11 18:20:38
|
On Thursday, August 11, 2011 11:29:57 Benjamin Root wrote: > > I'm running on ubuntu 10.04 32bit, with distro package 0.99 for > > matplotlib. I haven't been able to find anything that helps online > > either. > > > I don't remember who was hosting it, but I recall someone had a matplotlib > v1.0.1 PPA. I also believe that we got everything fixed for release to > Debian (and thus Ubuntu) for the upcoming Ubuntu. Anybody know where that > PPA is? you can use any one of the PPAs listed here: https://launchpad.net/ubuntu/+ppas?name_filter=matplotlib but i instead use the following procedure to set up all of PyLab on Ubuntu 11.04: $ sudo add-apt-repository ppa:chris-lea/zeromq $ sudo add-apt-repository ppa:pyside $ sudo apt-get update $ sudo apt-get build-dep python-numpy python-scipy matplotlib ipython pyzmq $ sudo apt-get install python-pyside $ ln -s /usr/lib/python2.7/dist-packages/PySide /opt/adverplex/lib/python2.7/site-packages/ $ pip install --upgrade numpy scipy ipython pyzmq $ pip install http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz this has the benefit of being compatible with any virtual environment. prepend ``sudo `` to the pip commands if your Python environment is owned by root. |
From: Benjamin R. <ben...@ou...> - 2011-08-11 17:55:21
|
On Thu, Aug 11, 2011 at 11:21 AM, WALTER Alain <ala...@th... > wrote: > Hi Ben, > I don't want to display rotate text ! I just need to display a simple text > to my figure : > > ax.text(onevolume['long'][i],onevolume['lat'][i],onevolume['upper'][i],onevolume['point'][i],color=linecolor) > In addition, I do not understand your remark about GDK, If I remember, I > need to use the following modules because FigureCanvas and NavigationToolbar > are required. > from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas > from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as > NavigationToolbar > > Anyway I cannot reproduce the warning, it is a little bit strange ! > Thank you > > Disregard what I said earlier. I didn't see that you were not trying to rotate your text in the first place. What is an example value for "onevolume['point'][i]"? The function signature for ax.text() is that the first 2 positional arguments are the coordinates, the third is the string to display (I would presume that "onevolume['upper'][i]" has something to do with the text you are displaying). However, the "onevolume['point'][i]" is in the position for the fontdict parameter of the function call. This dictionary overrides the default text properties, which I believe include properties like the rotation angle. Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-08-11 17:31:03
|
On Thu, Aug 11, 2011 at 11:43 AM, David Just <Jus...@ma...> wrote: > All the images in the pile will be the same dimensions. What I meant was > depending on what pile I load into the viewer, the dimensions of that pile > may differ eg: 150x256x10 to 512x512x150 > > Ok, now I understand. Have you tried setting the interpolation to 'nearest'? This is effectively a no-op (compared to the other interpolators). Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-08-11 16:40:04
|
On Thu, Aug 11, 2011 at 11:34 AM, David Just <Jus...@ma...> wrote: > The images are usually ~ 256x256 greyscale. They vary a bit in size, but > are not large by any shape or form. > > It seems interpolation is happening on each scroll. This is evident by > changing the interpolation scheme from linear to spline36. > > Linear takes ~0.25 seconds to re-draw the new image > spline36 takes ~.36 seconds to re-draw the new image > > Each “pile” of images ranges in size from 10-150 so scrolling from top to > bottom of 150 images can take upwards of 30 seconds!!!!!! > (This is on a macbook pro with a 2.53 ghz core 2 duo processor. ) > > I’m also trying to figure out how to change the size of the canvas that I > get since it’s overly large and seems to be stopping me from reducing the > size of my GTK window. > > Thanks, > Dave. > > > Are all of the images in a "pile" the same size? If they are different sizes as you scroll through them, then that is what is causing the problem. I would suggest sampling all of the images to a common resolution and scrolling through that array of images.. Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-08-11 16:30:25
|
On Thu, Aug 11, 2011 at 10:46 AM, Ned <a.g...@du...> wrote: > Hi, > I'm trying to sort out interactive use with standard python but am having > problems. > If I do: > import matplotlib > matplotlib.use("TkAgg") > matplotlib.interactive(True) > import pylab > pylab.ion() > pylab.plot([1,2,3,4]) > > Then I would expect a plot to appear. But it doesn't. I then have to > call: > > pylab.draw() > > twice before getting the plot (the first call brings up an empty plot > window, while the second displays the plot). > > Then, if I do: > pylab.plot([1,2,3,2,3,4,5]) > again, it does nothing, until I do > pylab.draw() > > Also the window isn't sensitive to expose events - if it is blocked by > another window/minimised etc, then the contents don't reappear, just go > blank. > > So, it is semi-interactive, in that I can use the python command line to > add new lines, but I have to call draw each time (which I shouldn't have > to), and also it doesn't redraw itself correctly. > > Can anyone give ideas? > > The problem is mostly with the version of matplotlib you have. Significant effort went into interactivity for v1.0.x, and I believe your problem would be greatly eliminated by using v1.0.1. You are right, you shouldn't have to call draw() all the time. > I'm running on ubuntu 10.04 32bit, with distro package 0.99 for > matplotlib. I haven't been able to find anything that helps online > either. > > I don't remember who was hosting it, but I recall someone had a matplotlib v1.0.1 PPA. I also believe that we got everything fixed for release to Debian (and thus Ubuntu) for the upcoming Ubuntu. Anybody know where that PPA is? Ben Root |
From: Benjamin R. <ben...@ou...> - 2011-08-11 16:25:55
|
On Thu, Aug 11, 2011 at 11:19 AM, David Just <Jus...@ma...> wrote: > Sorry if this get’s re-posted, my earlier e-mail didn’t seem to go > through. > > I have an array of images stored as an array of numpy arrays. I need to > be able to efficiently scroll through that set of images. My first attempt > at doing this goes something like this: > > --init-- > > self.ax = pyplot.imshow(imgdta[0], interpolation='spline36', > cmap=cm.gray, picker=True) # draw the plot @UndefinedVariable > pyplot.axes().set_axis_off() > self.fig = self.ax.get_figure() > self.canvas = FigureCanvasGTKAgg(self.fig) > > --onscroll-- > self.ax.set_array(imdta[n]) # 0 < n < num_images > self.canvas.draw() > > > This method ends up re-interpolating the image on each scroll event (which > takes SIGNIFICANT time). What I’d like to do is pre-build the images and > then just change what image is displayed on the canvas on each scroll event. > I cannot seem to figure out how to do this. Can anybody give me a pointer > in the right direction. > > Thanks, > Dave. > > You are doing it how I would do it for animations of imshow, which does not result in re-interpolations. I wonder if the on_scroll event is getting called more often than it needs? How big are these images? Ben Root |
From: WALTER A. <ala...@th...> - 2011-08-11 16:21:56
|
Hi Ben, I don't want to display rotate text ! I just need to display a simple text to my figure : ax.text(onevolume['long'][i],onevolume['lat'][i],onevolume['upper'][i],onevolume['point'][i],color=linecolor) In addition, I do not understand your remark about GDK, If I remember, I need to use the following modules because FigureCanvas and NavigationToolbar are required. from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar Anyway I cannot reproduce the warning, it is a little bit strange ! Thank you ________________________________________ De : ben...@gm... [ben...@gm...] de la part de Benjamin Root [ben...@ou...] Date d'envoi : jeudi 11 août 2011 16:05 À : WALTER Alain Cc : mat...@li... Objet : Re: [Matplotlib-users] unable to draw text at angles other than 0 or 90 On Thursday, August 11, 2011, WALTER Alain <ala...@th...<mailto:ala...@th...>> wrote: > Hello, > Concernig the source code of my previous post, the use of "ax.set_title('Volumic definition')" generate the following message: > /opt/IPASTEST/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py:150: UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90 > 'other than 0 or 90') > I thought that by default the drawing requested by my instruction set_title is 0 > Thank you for your suggestions Alain, Only the AGG-based backends can display rotated text. Is there a particular reason why you are using GDK backend? Since you are doing Gtk programming, I would recommend using GTKAgg. Ben Root |
From: David J. <Jus...@ma...> - 2011-08-11 16:20:00
|
Sorry if this get¹s re-posted, my earlier e-mail didn¹t seem to go through. I have an array of images stored as an array of numpy arrays. I need to be able to efficiently scroll through that set of images. My first attempt at doing this goes something like this: --init-- self.ax = pyplot.imshow(imgdta[0], interpolation='spline36', cmap=cm.gray, picker=True) # draw the plot @UndefinedVariable pyplot.axes().set_axis_off() self.fig = self.ax.get_figure() self.canvas = FigureCanvasGTKAgg(self.fig) --onscroll-- self.ax.set_array(imdta[n]) # 0 < n < num_images self.canvas.draw() This method ends up re-interpolating the image on each scroll event (which takes SIGNIFICANT time). What I¹d like to do is pre-build the images and then just change what image is displayed on the canvas on each scroll event. I cannot seem to figure out how to do this. Can anybody give me a pointer in the right direction. Thanks, Dave. |
From: Ned <a.g...@du...> - 2011-08-11 16:14:18
|
Hi, I'm trying to sort out interactive use with standard python but am having problems. If I do: import matplotlib matplotlib.use("TkAgg") matplotlib.interactive(True) import pylab pylab.ion() pylab.plot([1,2,3,4]) Then I would expect a plot to appear. But it doesn't. I then have to call: pylab.draw() twice before getting the plot (the first call brings up an empty plot window, while the second displays the plot). Then, if I do: pylab.plot([1,2,3,2,3,4,5]) again, it does nothing, until I do pylab.draw() Also the window isn't sensitive to expose events - if it is blocked by another window/minimised etc, then the contents don't reappear, just go blank. So, it is semi-interactive, in that I can use the python command line to add new lines, but I have to call draw each time (which I shouldn't have to), and also it doesn't redraw itself correctly. Can anyone give ideas? I'm running on ubuntu 10.04 32bit, with distro package 0.99 for matplotlib. I haven't been able to find anything that helps online either. Thanks... |
From: Damon M. <D.M...@wa...> - 2011-08-11 15:37:10
|
>>> This is what I have: >>> OS X Lion >>> Fresh install of python 2.6 from macports >>> Numpy version 1.6.1 (from macports) >>> freetype (from macports) >>> libpng (from macports) >>> matplotlib 1.0.1 (from macports) >>> >>> When I run my plotting script, I get the following error as soon as the script starts (i.e., right after matplotlib is imported): >>> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:403: UserWarning: matplotlibrc text.usetex can not be used with *Agg backend unless dvipng-1.5 or later is installed on your system >>> warnings.warn( 'matplotlibrc text.usetex can not be used with *Agg ' >>> >>> Note: I am using the PDF backend. >>> >>> When I try to save the plot to a pdf file, I get the following error: >>> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['serif'] not found. Falling back to Bitstream Vera Sans >>> (prop.get_family(), self.defaultFamily[fontext])) >>> >>> This is frustrating because it's a serif font that I need. >>> >>> After much thought, and Googling, I found out how to suppress the first warning message, and that is to add the directory where dvipng lives to my PATH variable. It is worth noting here that dvipng version 1.5 does not exist. The latest version is 1.14 as can be seen here: http://download.savannah.gnu.org/releases/dvipng/ > > > Actually 1.5 does exist, it's just older than 1.14 (think of it as 1.05). Are you sure that Matplotlib could "see" dvipng when it was built? During the install, it should spit out a bunch of details at the beginning with a few headings in all caps. Under the heading "OPTIONAL USETEX DEPENDENCIES", what's listed next to dvipng? > > -Tony Hey Tony, Thanks for your suggestion. I think it fixed the problem, at least for the build from source. I haven't tried the macports version, but for anyone with the same problem that's interested, you should run sudo port install py26-matplotlib +dvipng +latex if you want it to build with those optional dependencies. Damon McDougall d.m...@wa... http://damon.is-a-geek.com B2.39 Mathematics Institute Coventry West Midlands CV4 7AL |
From: Tony Yu <ts...@gm...> - 2011-08-11 14:46:16
|
On Thu, Aug 11, 2011 at 9:50 AM, Damon McDougall <D.M...@wa...>wrote: > More diagnostics. > <snip> > > This is what I have: > OS X Lion > Fresh install of python 2.6 from macports > Numpy version 1.6.1 (from macports) > freetype (from macports) > libpng (from macports) > matplotlib 1.0.1 (from macports) > > When I run my plotting script, I get the following error as soon as the > script starts (i.e., right after matplotlib is imported): > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:403: > UserWarning: matplotlibrc text.usetex can not be used with *Agg backend > unless dvipng-1.5 or later is installed on your system > warnings.warn( 'matplotlibrc text.usetex can not be used with *Agg ' > > Note: I am using the PDF backend. > > When I try to save the plot to a pdf file, I get the following error: > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: > UserWarning: findfont: Font family ['serif'] not found. Falling back to > Bitstream Vera Sans > (prop.get_family(), self.defaultFamily[fontext])) > > This is frustrating because it's a serif font that I need. > > After much thought, and Googling, I found out how to suppress the first > warning message, and that is to add the directory where dvipng lives to my > PATH variable. It is worth noting here that dvipng version 1.5 does not > exist. The latest version is 1.14 as can be seen here: > http://download.savannah.gnu.org/releases/dvipng/ > > Actually 1.5 does exist, it's just older than 1.14 (think of it as 1.05). Are you sure that Matplotlib could "see" dvipng when it was built? During the install, it should spit out a bunch of details at the beginning with a few headings in all caps. Under the heading "OPTIONAL USETEX DEPENDENCIES", what's listed next to dvipng? -Tony |
From: Benjamin R. <ben...@ou...> - 2011-08-11 14:05:57
|
On Thursday, August 11, 2011, WALTER Alain <ala...@th...> wrote: > Hello, > Concernig the source code of my previous post, the use of "ax.set_title('Volumic definition')" generate the following message: > /opt/IPASTEST/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py:150: UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90 > 'other than 0 or 90') > I thought that by default the drawing requested by my instruction set_title is 0 > Thank you for your suggestions Alain, Only the AGG-based backends can display rotated text. Is there a particular reason why you are using GDK backend? Since you are doing Gtk programming, I would recommend using GTKAgg. Ben Root |
From: Damon M. <D.M...@wa...> - 2011-08-11 13:50:53
|
More diagnostics. I ran the fonts_demo.py example and saved the plot as a .png (this time using the macosx backend). See attached for the result, and compare with http://matplotlib.sourceforge.net/plot_directive/mpl_examples/pylab_examples/fonts_demo.hires.png I also got the following font warnings (in addition to the Agg warning about dvipng again) while saving the figure. This time I took out the path where dvipng lives, so that I don't get that assertion error. /Users/damon/python/lib/matplotlib/__init__.py:401: UserWarning: matplotlibrc text.usetex can not be used with *Agg backend unless dvipng-1.5 or later is installed on your system warnings.warn( 'matplotlibrc text.usetex can not be used with *Agg ' /Users/damon/python/lib/matplotlib/font_manager.py:1210: UserWarning: findfont: Font family ['serif'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Users/damon/python/lib/matplotlib/font_manager.py:1210: UserWarning: findfont: Font family ['Script MT'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) >> Hi, >> >> I am having a ridiculous amount of trouble getting Computer Modern Roman to appear in my plots. So many problems, in fact, I nuked the whole of macports and installed the things I need again because I thought it might have been a problem with using an upgraded version of macports from Snow Leopard (I'm now using Lion). >> >> This is what I have: >> OS X Lion >> Fresh install of python 2.6 from macports >> Numpy version 1.6.1 (from macports) >> freetype (from macports) >> libpng (from macports) >> matplotlib 1.0.1 (from macports) >> >> When I run my plotting script, I get the following error as soon as the script starts (i.e., right after matplotlib is imported): >> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:403: UserWarning: matplotlibrc text.usetex can not be used with *Agg backend unless dvipng-1.5 or later is installed on your system >> warnings.warn( 'matplotlibrc text.usetex can not be used with *Agg ' >> >> Note: I am using the PDF backend. >> >> When I try to save the plot to a pdf file, I get the following error: >> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['serif'] not found. Falling back to Bitstream Vera Sans >> (prop.get_family(), self.defaultFamily[fontext])) >> >> This is frustrating because it's a serif font that I need. >> >> After much thought, and Googling, I found out how to suppress the first warning message, and that is to add the directory where dvipng lives to my PATH variable. It is worth noting here that dvipng version 1.5 does not exist. The latest version is 1.14 as can be seen here: http://download.savannah.gnu.org/releases/dvipng/ >> > > Once I do this the first warning DOES disappear, and the font error disappears, but I get a new error: >> Traceback (most recent call last): >> File "refinement.py", line 60, in <module> >> fig.savefig('conv.pdf') >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 1084, in savefig >> self.canvas.print_figure(*args, **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1923, in print_figure >> **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 2156, in print_pdf >> self.figure.draw(renderer) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 798, in draw >> func(*args) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 1946, in draw >> a.draw(renderer) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 1017, in draw >> tick.draw(renderer) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 234, in draw >> self.label1.draw(renderer) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper >> draw(artist, renderer, *args, **kwargs) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 571, in draw >> self._fontproperties, angle) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 1549, in draw_tex >> psfont = self.tex_font_mapping(dvifont.texname) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 1365, in tex_font_mapping >> dviread.PsfontsMap(dviread.find_tex_file('pdftex.map')) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 668, in __init__ >> self._parse(file) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 701, in _parse >> self._register(words) >> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 727, in _register >> assert encoding is None >> AssertionError >> >> I have no idea what this means or how to fix it! I assumed it was a problem with the version of dvipng that I'm using, but I'm using the latest one. >> >> I have also tried grabbing the matplotlib source from git and compiling it by hand (yes, both the macports install and the source install see that I have latex installed, I also have type1cm.sty installed from texlive-latex-extra so the fonts are there. typ1cm.sty lives in /opt/local/share/texmf-texlive-dist/tex/latex/type1cm/). Maybe it's a problem with matplotlib not looking in the right place for the fonts? >> >> Can anybody out there provide any suggestions? Damon McDougall d.m...@wa... http://damon.is-a-geek.com B2.39 Mathematics Institute Coventry West Midlands CV4 7AL |
From: Damon M. <D.M...@wa...> - 2011-08-11 11:23:40
|
Sorry, I made a typo. See below. > Hi, > > I am having a ridiculous amount of trouble getting Computer Modern Roman to appear in my plots. So many problems, in fact, I nuked the whole of macports and installed the things I need again because I thought it might have been a problem with using an upgraded version of macports from Snow Leopard (I'm now using Lion). > > This is what I have: > OS X Lion > Fresh install of python 2.6 from macports > Numpy version 1.6.1 (from macports) > freetype (from macports) > libpng (from macports) > matplotlib 1.0.1 (from macports) > > When I run my plotting script, I get the following error as soon as the script starts (i.e., right after matplotlib is imported): > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:403: UserWarning: matplotlibrc text.usetex can not be used with *Agg backend unless dvipng-1.5 or later is installed on your system > warnings.warn( 'matplotlibrc text.usetex can not be used with *Agg ' > > Note: I am using the PDF backend. > > When I try to save the plot to a pdf file, I get the following error: > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['serif'] not found. Falling back to Bitstream Vera Sans > (prop.get_family(), self.defaultFamily[fontext])) > > This is frustrating because it's a serif font that I need. > > After much thought, and Googling, I found out how to suppress the first warning message, and that is to add the directory where dvipng lives to my PATH variable. It is worth noting here that dvipng version 1.5 does not exist. The latest version is 1.14 as can be seen here: http://download.savannah.gnu.org/releases/dvipng/ > Once I do this the first warning DOES disappear, and the font error disappears, but I get a new error: > Traceback (most recent call last): > File "refinement.py", line 60, in <module> > fig.savefig('conv.pdf') > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 1084, in savefig > self.canvas.print_figure(*args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1923, in print_figure > **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 2156, in print_pdf > self.figure.draw(renderer) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper > draw(artist, renderer, *args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 798, in draw > func(*args) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper > draw(artist, renderer, *args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 1946, in draw > a.draw(renderer) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper > draw(artist, renderer, *args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 1017, in draw > tick.draw(renderer) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper > draw(artist, renderer, *args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 234, in draw > self.label1.draw(renderer) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper > draw(artist, renderer, *args, **kwargs) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 571, in draw > self._fontproperties, angle) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 1549, in draw_tex > psfont = self.tex_font_mapping(dvifont.texname) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 1365, in tex_font_mapping > dviread.PsfontsMap(dviread.find_tex_file('pdftex.map')) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 668, in __init__ > self._parse(file) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 701, in _parse > self._register(words) > File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 727, in _register > assert encoding is None > AssertionError > > I have no idea what this means or how to fix it! I assumed it was a problem with the version of dvipng that I'm using, but I'm using the latest one. > > I have also tried grabbing the matplotlib source from git and compiling it by hand (yes, both the macports install and the source install see that I have latex installed, I also have type1cm.sty installed from texlive-latex-extra so the fonts are there. typ1cm.sty lives in /opt/local/share/texmf-texlive-dist/tex/latex/type1cm/). Maybe it's a problem with matplotlib not looking in the right place for the fonts? > > Can anybody out there provide any suggestions? Damon McDougall d.m...@wa... http://damon.is-a-geek.com B2.39 Mathematics Institute Coventry West Midlands CV4 7AL |
From: Damon M. <D.M...@wa...> - 2011-08-11 11:03:11
|
Hi, I am having a ridiculous amount of trouble getting Computer Modern Roman to appear in my plots. So many problems, in fact, I nuked the whole of macports and installed the things I need again because I thought it might have been a problem with using an upgraded version of macports from Snow Leopard (I'm now using Lion). This is what I have: OS X Lion Fresh install of python 2.6 from macports Numpy version 1.6.1 (from macports) freetype (from macports) libpng (from macports) matplotlib 1.0.1 (from macports) When I run my plotting script, I get the following error as soon as the script starts (i.e., right after matplotlib is imported): /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/__init__.py:403: UserWarning: matplotlibrc text.usetex can not be used with *Agg backend unless dvipng-1.5 or later is installed on your system warnings.warn( 'matplotlibrc text.usetex can not be used with *Agg ' Note: I am using the PDF backend. When I try to save the plot to a pdf file, I get the following error: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['serif'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) This is frustrating because it's a serif font that I need. After much thought, and Googling, I found out how to suppress the first warning message, and that is to add the directory where dvipng lives to my PATH variable. It is worth noting here that dvipng version 1.5 does not exist. The latest version is 1.14 as can be seen here: http://download.savannah.gnu.org/releases/dvipng/ Once I do this the first warning message does not appear, and the font error disappears but I get a new error: Traceback (most recent call last): File "refinement.py", line 60, in <module> fig.savefig('conv.pdf') File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 1084, in savefig self.canvas.print_figure(*args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1923, in print_figure **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 2156, in print_pdf self.figure.draw(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py", line 798, in draw func(*args) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py", line 1946, in draw a.draw(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 1017, in draw tick.draw(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 234, in draw self.label1.draw(renderer) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/text.py", line 571, in draw self._fontproperties, angle) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 1549, in draw_tex psfont = self.tex_font_mapping(dvifont.texname) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_pdf.py", line 1365, in tex_font_mapping dviread.PsfontsMap(dviread.find_tex_file('pdftex.map')) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 668, in __init__ self._parse(file) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 701, in _parse self._register(words) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/dviread.py", line 727, in _register assert encoding is None AssertionError I have no idea what this means or how to fix it! I assumed it was a problem with the version of dvipng that I'm using, but I'm using the latest one. I have also tried grabbing the matplotlib source from git and compiling it by hand (yes, both the macports install and the source install see that I have latex installed, I also have type1cm.sty installed from texlive-latex-extra so the fonts are there. typ1cm.sty lives in /opt/local/share/texmf-texlive-dist/tex/latex/type1cm/). Maybe it's a problem with matplotlib not looking in the right place for the fonts? Can anybody out there provide any suggestions? Damon McDougall d.m...@wa... http://damon.is-a-geek.com B2.39 Mathematics Institute Coventry West Midlands CV4 7AL |
From: WALTER A. <ala...@th...> - 2011-08-11 09:50:55
|
Hello, Is is possible to add buttons (and relative callback) to the default toolbar that is display at the bottom of a matplotlib panel and that proposes : "reset original view","back to previous view", "forward to next view ..." Any examples are welcome. thank you |
From: WALTER A. <ala...@th...> - 2011-08-11 09:42:34
|
Hello, Concernig the source code of my previous post, the use of "ax.set_title('Volumic definition')" generate the following message: /opt/IPASTEST/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py:150: UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90 'other than 0 or 90') I thought that by default the drawing requested by my instruction set_title is 0 Thank you for your suggestions |
From: WALTER A. <ala...@th...> - 2011-08-11 09:32:12
|
Hello, It's my first post on this forum and I'm very happy to discover a forum dedicated to matplotlib. I 've begun recently a development with matplotlib inside my python (2.7)application. In a first step I've developped a stand alone graphical display and it runs properly. In a second step, I try to manage this graphical display through gtk (because my main application is in python/gtk) : now, most of functionalities run well, but labels on my 3 axes are no more displayed and I don't understand why. Thank you for all suggestions. Here is the source code with gtk ----------------------------------------------------------------------------------------------------------------- import sys import gtk import numpy as np import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar from StringIO import StringIO # StringIO behaves like a file object from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import colorConverter from matplotlib.widgets import Button class SectorDisplay2__: """ Display view of sectors and volumes """ def __init__(self): win = gtk.Window() win.connect("destroy",self.SectorDisplayClosePanel) win.set_default_size(800,800) vbox = gtk.VBox() win.add(vbox) fig = Figure() canvas = FigureCanvas(fig) # a gtk.DrawingArea ax = Axes3D(fig) #get lines as csv description line = "" line = line+"VOL1;P4120;0;999;-49.68722222222222;-1.52166666666667;\n" line = line+"VOL1;P4121;0;999;-49.68722222222222;-2.20722222222222;\n" line = line+"VOL1;P1421;0;999;-49.23750000000000;-2.20722222222222;\n" line = line+"VOL1;P1422;0;999;-49.23750000000000;-1.52166666666667;\n" line = line+"VOL1;P4120;0;999;-49.68722222222222;-1.52166666666667;\n" lines = StringIO(line) # get the list of point coordinates and level data = np.loadtxt(lines, delimiter=';', usecols = (0,1,2,3,4,5), # 0=volume 1=point 2=lower level 3=upper_level, 4=lat 5=long dtype = np.dtype({'names':['volume','point','lower','upper','lat','long'], 'formats': ['S20','S5','i4','i4','f4','f4']}) ) # Get one particular volume onevolume = data[data['volume']=="VOL1"] ax.plot(onevolume['long'],onevolume['lat'],onevolume['upper']) ax.plot(onevolume['long'],onevolume['lat'],onevolume['lower']) for i in range(len(onevolume)-1): ax.plot([onevolume['long'][i],onevolume['long'][i]], [onevolume['lat'][i],onevolume['lat'][i]], [onevolume['lower'][i],onevolume['upper'][i]]) ax.set_ylabel('Latitude (deg)') ax.set_xlabel('Longitude (deg)') ax.set_zlabel('Level (100xfeet)') ax.set_title('Volumic definition') vbox.pack_start(canvas) toolbar = NavigationToolbar(canvas,win) vbox.pack_start(toolbar,False,False) win.show_all() # Run the Gtk mainloop gtk.main() def SectorDisplayClosePanel(self,caller): gtk.main_quit() if __name__ == '__main__': SectorDisplay2__() ------------------------------------------------------------------------------------- Here is the initial source code without gtk: ------------------------------------------------------------------------------------- import sys import numpy as np import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar from StringIO import StringIO # StringIO behaves like a file object from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import colorConverter from matplotlib.widgets import Button class SectorDisplay2__: """ Display view of sectors and volumes """ def __init__(self): """ @param parentWin: Window which is parent of this window @type parentWin: Widget @param typevol: give the type of volume : volume, sector, non controlled area ... @type typevol: str @param entity_name: entity to display @type entity_name: str @type application: <Application__> @param application: instance of class Application__ @param class_creation: indicates a class creation and not only a call to Class__.__init__ @type class_creation: boolean """ fig = plt.figure() ax = Axes3D(fig) #get lines as csv description line = "" line = line+"VOL1;P4120;0;999;-49.68722222222222;-1.52166666666667;\n" line = line+"VOL1;P4121;0;999;-49.68722222222222;-2.20722222222222;\n" line = line+"VOL1;P1421;0;999;-49.23750000000000;-2.20722222222222;\n" line = line+"VOL1;P1422;0;999;-49.23750000000000;-1.52166666666667;\n" line = line+"VOL1;P4120;0;999;-49.68722222222222;-1.52166666666667;\n" lines = StringIO(line) # get the list of point coordinates and level data = np.loadtxt(lines, delimiter=';', usecols = (0,1,2,3,4,5), # 0=volume 1=point 2=lower level 3=upper_level, 4=lat 5=long dtype = np.dtype({'names':['volume','point','lower','upper','lat','long'], 'formats': ['S20','S5','i4','i4','f4','f4']}) ) # Get one particular volume onevolume = data[data['volume']=="VOL1"] ax.plot(onevolume['long'],onevolume['lat'],onevolume['upper']) ax.plot(onevolume['long'],onevolume['lat'],onevolume['lower']) for i in range(len(onevolume)-1): ax.plot([onevolume['long'][i],onevolume['long'][i]], [onevolume['lat'][i],onevolume['lat'][i]], [onevolume['lower'][i],onevolume['upper'][i]]) ax.set_ylabel('Latitude (deg)') ax.set_xlabel('Longitude (deg)') ax.set_zlabel('Level (100xfeet)') ax.set_title('Volumic definition') plt.show() def SectorDisplayClosePanel(self,caller): plt.close() if __name__ == '__main__': SectorDisplay2__() ------------------------------------------------------------------------------------- |
From: RICHARD Georges-E. <per...@gm...> - 2011-08-11 06:38:01
|
First of all congratulation for the release 1.1.0 of matplotlib it's a wonderfull. since the version 0.90 I started to use it, I keep enjoy it everyday. I work with PyQT4 and PySide. I try to modify the height of the NavigationToolbar2QT, but no matter I use "resize" the Qt4 method nothing happen. code available: http://pastebin.com/8KW2dWG2 #...# all Qt imports from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as NavigationToolbar class MPL_widget(QWidget): def __init__(self,parent): QWidget.__init__(self,parent) self.canvas = FigureCanvas() self.toolbar = NavigationToolbar(self.canvas,self.canvas) self.toolbar.resize(100,10) # self.vbox = QVBoxLayout() vbox = self.vbox vbox.addWidget(self.canvas) vbox.addWidget(self.toolbar) self.setLayout(vbox) I tryed to modify directly in matplotlib module 'matplotlib.backends.backed_qt4' in the constructor of NavigationToolbar2QT just after the call of QToolBar.__init__(), nothing happen either. finaly I added a QSplitter, which let me hide the bar during runtime, but my first goal was rather to reduce the size and all icon inside. from PyQt4.QtCore import * from PyQt4.QtGui import * import PyQt4.QtGui as QtGui import matplotlib if matplotlib.get_backend() != "Qt4Agg": matplotlib.use("Qt4Agg") from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as NavigationToolbar from matplotlib.figure import Figure class MPL_Widget(QWidget): def __init__(self, parent = None): QWidget.__init__(self, parent) self.fig = Figure(figsize = (10, 12), dpi=100, facecolor = '#FFFFFF') self.ax = self.fig.add_subplot(111, sharex = None, sharey = None) self.canvas = FigureCanvas(self.fig) self.toolbar = NavigationToolbar(self.canvas, self.canvas) self.toolbar.resize(10,10) # this line does nothing self.vbox = QVBoxLayout() tmp = self.vbox tmp = QSplitter() tmp.setOrientation(Qt.Vertical) tmp.setContentsMargins(0,0,0,0) tmp.addWidget(self.canvas) tmp.addWidget(self.toolbar) self.vbox.addWidget(tmp) self.setLayout(self.vbox) self.layout().setContentsMargins(0,0,0,0) import sys app = QApplication(sys.argv) w = MPL_Widget() import numpy as N x = N.linspace(-10, 10) y = N.sin(x) ax = w.ax ax.plot(x, y, 'o-', mew=0) w.show() sys.exit(app.exec_()) Any hint would be appreciate. Cheers. Joe -- RICHARD Georges-Emmanuel Electronic and Computer Engineer per...@gm... |