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
(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)

Showing results of 27

1 2 > >> (Page 1 of 2)
From: Benjamin R. <ben...@ou...> - 2012年03月01日 23:00:55
On Thursday, March 1, 2012, Jerzy Karczmarczuk <
jer...@un...> wrote:
> Andrea Gavana :
>> Anyway, if I am not completely off-track, this is something I had been
>> looking for as well in matplotlib a while back (3, 4 years ago), but
>> at that time I was told it would have been complicated to implement it
>> for all the "live" backend (I can't recall the exact reason).
>>
>> I would say that, at least for the backends based on wxPython, this
>> kind of modify-the-live-plot-via-GUI-interaction should be relatively
>> straightforward, at least for the GUI part and for the basics (line
>> styles, colours, markers and so on).
> There is one non-trivial difference between Matplotlib and Matlab.
> Matplotlib is "just" a library, and not an integrated package with its
> own event processing loop, multithreading, etc. When you plot()
> something under Matlab or Scilab, you generate some objecs (gcf, gca)
> and other stuff, accessible from outside. Your program turns normally,
> your console works. So, you may launch a procedure which analyses all
> the plotted data and change the "patches", "lines", "collections", etc.,
> using the matplotlib jargon.
>
> In matplotlib, upon show(), you relinquish the control. The interaction
> becomes clumsy, the animation becomes clumsy, since matplotlib doesn't
> give you the full access to the event loop.
> OF COURSE you may do it, but it will require some work.
> One possibility is to use an interface which by design works (I
> presume...) in a separate, non-blocking thread. I mean: IPython. If you
> launch IPython --pylab, then you may, e.g. construct:
>
> x=linspace(0.0,25.0,300); y=sin(x)
> plot(x,y)
>
> and the figure is created without show().
> Then, write:
>
> a=gca(); p=a.lines[0]
>
> and nothing more difficult than:
>
> p.set_lw(3); p.set_color('red'); draw()
>
> You have edited your line. No need to change the code of matplotlib.
>
> Good luck.
>
> Jerzy Karczmarczuk
>
>
Just to be clear, you are speaking of the difference between interactive
and non-interactive modes, which is entirely switchable in matplotlib.
 However, widgets can be used in either mode. mpl can do what matlab can
do, and more -- in theory. We simply do not have all the widgets and tools
made.
Ipython uses mpl with interactive mode turned on. All artists are available
for editing at any time *until* the figure is destroyed (in either mode).
 It just happens that the execution moves past show() in non-interactive
mode only when the figures are destroyed.
As for any clumsiness for animations, it is because the feature is still
new and Ryan May and I would greatly welcome additional viewpoints in the
design discussions.
Ben Root
From: Paul H. <pmh...@gm...> - 2012年03月01日 22:38:48
Federico,
You were so close! Try this:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(100), range(100))
#If comment the following line everything is fine
ax.set_xscale('log')
xaxis = ax.get_xaxis()
xaxis.grid(False, which='minor')
xaxis.grid(False, which='major')
plt.show()
Hope that helps,
-paul
On Wed, Feb 29, 2012 at 4:09 PM, Federico Ariza
<ari...@gm...> wrote:
> Hi
>
> If I set the scale to log and set the grid to minor
> then, it is impossible to deactivate the grid
> It does not happen with major or without the logscale
>
> The code to reproduce the problem
>
>
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot(range(100), range(100))
>
> #If comment the following line everything is fine
> ax.set_xscale('log')
>
> xaxis = ax.get_xaxis()
> xaxis.grid(which = 'Minor')
> xaxis.grid(False)
> plt.show()
>
>
> Thanks
> Federico
> --
> Y yo que culpa tengo de que ellas se crean todo lo que yo les digo?
>
> -- Antonio Alducin --
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jerzy K. <jer...@un...> - 2012年03月01日 22:08:57
Andrea Gavana :
> Anyway, if I am not completely off-track, this is something I had been
> looking for as well in matplotlib a while back (3, 4 years ago), but
> at that time I was told it would have been complicated to implement it
> for all the "live" backend (I can't recall the exact reason).
>
> I would say that, at least for the backends based on wxPython, this
> kind of modify-the-live-plot-via-GUI-interaction should be relatively
> straightforward, at least for the GUI part and for the basics (line
> styles, colours, markers and so on).
There is one non-trivial difference between Matplotlib and Matlab.
Matplotlib is "just" a library, and not an integrated package with its 
own event processing loop, multithreading, etc. When you plot() 
something under Matlab or Scilab, you generate some objecs (gcf, gca) 
and other stuff, accessible from outside. Your program turns normally, 
your console works. So, you may launch a procedure which analyses all 
the plotted data and change the "patches", "lines", "collections", etc., 
using the matplotlib jargon.
In matplotlib, upon show(), you relinquish the control. The interaction 
becomes clumsy, the animation becomes clumsy, since matplotlib doesn't 
give you the full access to the event loop.
OF COURSE you may do it, but it will require some work.
One possibility is to use an interface which by design works (I 
presume...) in a separate, non-blocking thread. I mean: IPython. If you 
launch IPython --pylab, then you may, e.g. construct:
x=linspace(0.0,25.0,300); y=sin(x)
plot(x,y)
and the figure is created without show().
Then, write:
a=gca(); p=a.lines[0]
and nothing more difficult than:
p.set_lw(3); p.set_color('red'); draw()
You have edited your line. No need to change the code of matplotlib.
Good luck.
Jerzy Karczmarczuk
From: Benjamin R. <ben...@ou...> - 2012年03月01日 21:45:59
On Thu, Mar 1, 2012 at 3:31 PM, Andrea Gavana <and...@gm...>wrote:
> On 1 March 2012 21:37, Benjamin Root wrote:
> >
> >
> > On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza <
> ari...@gm...>
> > wrote:
> >>
> >> Dear all
> >>
> >> I am a long time matplotlib user (under linux) but new to the list
> >> (second post).
> >>
> >> On of the things that bothers me the most is the inability of the
> standard
> >> backend to change simple things (line color, labels, etc...).
> >>
> >
> > There was a feature a couple of us were hacking on a while back that
> would
> > allow for live switching between color and black&white modes. Is this
> sort
> > of stuff what you are speaking of? The changes were too invasive to be
> > included, but it was an interesting experiment.
>
> I thought the OP's original question was something like the Matlab
> "plot editor" (or whatever is its name), which allows you to edit line
> colours, styles, gridlines styles, this kind of stuff on a "live" plot
> (mind you, it's been 6 years since I used Matlab for the last time and
> I may have forgotten what the "plot editor" does).
>
> Anyway, if I am not completely off-track, this is something I had been
> looking for as well in matplotlib a while back (3, 4 years ago), but
> at that time I was told it would have been complicated to implement it
> for all the "live" backend (I can't recall the exact reason).
>
>
Actually, it isn't that complicated, if you restrict yourself to a subset
of mpl. I can't imagine being able to modify "any and all" aspects of a
figure, such as transforms or filters, but certainly could modify various
artists, for the most part. Also, this shouldn't be a "backend" in the
same sense that GTKAgg is a backend. Merely a very advanced collection of
widgets.
Also, in many sense, this actually already has been done. It is called
"Inkscape". Just save your figures as svg and edit them in Inkscape. (I
know, it is a cop-out.)
> I would say that, at least for the backends based on wxPython, this
> kind of modify-the-live-plot-via-GUI-interaction should be relatively
> straightforward, at least for the GUI part and for the basics (line
> styles, colours, markers and so on). However I am not sure what are
> the implications on the core matplotlib code.
>
Just about everything displayed is an "Artist" and therefore there is a
uniform, standard interface for all of them. Widgets could still
intelligently interact with subclassed Artists as well. There is nothing
preventing that from happening.
Ben Root
From: Russell E. O. <ro...@uw...> - 2012年03月01日 21:45:19
In article <row...@ne...>,
 "Russell E. Owen" <ro...@uw...> wrote:
> In article 
> <CACM7dVw_Lde1QDS4vRvi-zTit8gqFYgYuyRLakOqBy0AVii7oA-JsoAwUIsXosN+BqQ9rBEUg@pu
> blic.gmane.org>,
> William Jennings <wil...@gm...> 
> wrote:
> 
> > Hello mat plot lib users!
> > I feel quite embarrassed that I've gone through 2 days of trying to get to
> > get numpy, scipy and matplotlib all to work nice with each other. I've
> > scraped through forums, stackoverflow and all the links that can bide me
> > some type of logic. Yet, alas I still fail wildly with this set of errors:
> > 
> > *my current status is: just did a fresh install of my lion os and haven't
> > installed Xcode yet. I'm a little lost and have found only macports,
> > homebrew guides online only to be a slower failure. I really need to use
> > this software but I'm finding it difficult keeping straight what order and
> > what I need to install. 
> 
> I recommend:
> - Install python.org 64-bit Python 2.7 (the one labelled as being for 
> MacOS X 10.6 and later)
> - Install numpy, scipy and matplotlib Mac binary with "macosx10.6" in 
> their names. These are available from the web sites maintained by those 
> projects.
> 
> Or if you want better backward compatibility (e.g. if you plan to 
> distribute applications) then instead you should use the 32-bit 
> python.org python (marked as for MacOS X 10.3 and later) and the numpy, 
> scipy and matplotlib Mac binary installers with "macosx10.3" in their 
> names.
This sort of thing comes up often enough that I've posted a web page on 
the topic, including reasons you might want to choose 32-bit or 64-bit:
<http://www.astro.washington.edu/users/rowen/MacBinaryPythonPackageInstal
lers.html>
-- Russell
From: Andrea G. <and...@gm...> - 2012年03月01日 21:32:02
On 1 March 2012 21:37, Benjamin Root wrote:
>
>
> On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza <ari...@gm...>
> wrote:
>>
>> Dear all
>>
>> I am a long time matplotlib user (under linux) but new to the list
>> (second post).
>>
>> On of the things that bothers me the most is the inability of the standard
>> backend to change simple things (line color, labels, etc...).
>>
>
> There was a feature a couple of us were hacking on a while back that would
> allow for live switching between color and black&white modes. Is this sort
> of stuff what you are speaking of? The changes were too invasive to be
> included, but it was an interesting experiment.
I thought the OP's original question was something like the Matlab
"plot editor" (or whatever is its name), which allows you to edit line
colours, styles, gridlines styles, this kind of stuff on a "live" plot
(mind you, it's been 6 years since I used Matlab for the last time and
I may have forgotten what the "plot editor" does).
Anyway, if I am not completely off-track, this is something I had been
looking for as well in matplotlib a while back (3, 4 years ago), but
at that time I was told it would have been complicated to implement it
for all the "live" backend (I can't recall the exact reason).
I would say that, at least for the backends based on wxPython, this
kind of modify-the-live-plot-via-GUI-interaction should be relatively
straightforward, at least for the GUI part and for the basics (line
styles, colours, markers and so on). However I am not sure what are
the implications on the core matplotlib code.
But if I have misunderstood, I apologize for the noise :-) .
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
>>> import PyQt4.QtGui
Traceback (most recent call last):
 File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui
>>>
>>> import pygtk
Traceback (most recent call last):
 File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk
>>>
>>> import wx
>>>
>>>
From: Pawel <pa...@gm...> - 2012年03月01日 21:24:54
Got it. Thanks again.
Pawel
On 03/01/2012 04:11 PM, Benjamin Root wrote:
>
>
> On Thu, Mar 1, 2012 at 3:03 PM, Pawel <pa...@gm... 
> <mailto:pa...@gm...>> wrote:
>
> Thanks Ben. Your solution for setting different fontsizes worked
> like a charm!
>
>
> Glad it worked.
>
> For the other question, what I meant by padding was the distance
> of the tick label from the axis. This is what I set with the
> following command:
>
> matplotplib.pyplot.rc(('xtick.major','ytick.major'), pad=10)
>
> so that the pad of the label from the axis is set to 10. Now what
> if I want to set the pad of just one of the xtick lables to a
> different value?
>
>
> Ah. You could change the x/y position of the Text object. However, a 
> trick that would be significantly easier and maybe "good enough" would 
> be to simply include a '\n' character at the beginning of that label's 
> string.
>
> Ben Root
>
From: Benjamin R. <ben...@ou...> - 2012年03月01日 21:11:39
On Thu, Mar 1, 2012 at 3:03 PM, Pawel <pa...@gm...> wrote:
> **
> Thanks Ben. Your solution for setting different fontsizes worked like a
> charm!
>
>
Glad it worked.
> For the other question, what I meant by padding was the distance of the
> tick label from the axis. This is what I set with the following command:
>
> matplotplib.pyplot.rc(('xtick.major','ytick.major'), pad=10)
>
> so that the pad of the label from the axis is set to 10. Now what if I
> want to set the pad of just one of the xtick lables to a different value?
>
>
Ah. You could change the x/y position of the Text object. However, a
trick that would be significantly easier and maybe "good enough" would be
to simply include a '\n' character at the beginning of that label's string.
Ben Root
From: Pawel <pa...@gm...> - 2012年03月01日 21:03:47
Thanks Ben. Your solution for setting different fontsizes worked like a 
charm!
For the other question, what I meant by padding was the distance of the 
tick label from the axis. This is what I set with the following command:
matplotplib.pyplot.rc(('xtick.major','ytick.major'), pad=10)
so that the pad of the label from the axis is set to 10. Now what if I 
want to set the pad of just one of the xtick lables to a different value?
Thanks,
Pawel
On 03/01/2012 01:17 PM, Benjamin Root wrote:
>
>
> On Thu, Mar 1, 2012 at 11:33 AM, Pawel <pa...@gm... 
> <mailto:pa...@gm...>> wrote:
>
> Hi all,
>
> Is it possible to set the size of only some tick labels? I have text
> tick labels (residue names). I'd like to reduce the font size of just
> two of the labels to make them fit better, but keep the size of the
> remaining labels the same.
>
>
> It isn't _impossible_, but mpl certainly won't make it easy for you. 
> After creating your graph and tick labels, you would have to get back 
> the tick labels as a list of Text objects using "get_xticklabels()". 
> Then, you modify the font size of the appropriate element in that 
> list. Perhaps something like this:
>
> xticks = ax.get_xticklabels()
> xticks[3].set_fontsize(xticks[3].get_fontsize() * 0.9)
>
> Note: Completely untested.
>
> And in a similar vein, is it possible to change the padding of
> just some
> tick labels? Again, I'd like to increase the padding of just two
> of the
> labels but keep the remaining the same.
>
>
> By "padding" are you referring to the spacing between the tick 
> labels? That would have to be done by changing the tick locations 
> themselves. By default, the ticks are equally spaced over the 
> specified domain, and the labels for those ticks are placed so that 
> the center lines up with the tick mark. Try using "get_xticks()" and 
> "set_yticks()" and see what happens.
>
> I hope that helps!
> Ben Root
>
From: Benjamin R. <ben...@ou...> - 2012年03月01日 20:53:08
On Thu, Mar 1, 2012 at 1:11 PM, C M <cmp...@gm...> wrote:
>
> Yeah, there are better ways to do that, somewhat. The problem with the
>> proposed solution is that it relies on non-public APIs, which are can be
>> subject to change without deprecation. Instead, I would have created the
>> figimage object with a particular transform object that would have placed
>> it at the appropriate data points.
>
>
> Maybe your or someone from this list can help me understand more about
> this. So, if I take the code that I have adapted to my purposes, there are
> questions I have about it:
>
> # constants
> dpi = 72; imageSize = (32,32)
> # read in our png file
> im = image.imread('redX_10.png')
>
> So far, so good--just setting the dpi and getting the image.
>
> fig = self.figure
> ax = self.subplot
> ax.get_frame().set_alpha(0)
>
>
>
Does the current version of Matplotlib require the frame be set to fully
> transparent? I need a white canvas, so I think I'd rather not do that.
>
>
I think this is technically because of the use of figimage. Any axes that
are created would get plotted above the figimage. I suppose one could
manually set the zorder to a high enough number to make sure it stays on
top.
> # translate point positions to pixel positions
> # figimage needs pixels not points
> line = self.line_collections_list[0][0]
>
> "line" here is my line of datapoints from elsewhere in my app.
>
> line._transform_path()
> path, affine =
> line._transformed_path.get_transformed_points_and_affine()
> path = affine.transform_path(path)
>
> I have no understanding of the purpose of the previous three lines. Can
> someone give me a quick explanation?
>
>
The transforms framework translates coordinates from one system to
another. There are multiple coordinate systems within a mpl figure. data,
axes and figure are the three main "reference frames". I think the first
line is effectively useless (but due to caching has no impact on
performance). The second line would translate the coordinates stored in
"line" into figure-relative coordinates, and also provide a special object
for doing affine transformations. The point of that step, IIUC, is to do a
special handling of curves (either the line data itself has curves, or the
coordinate tranformation has curves). Consider the case of drawing a
straight line from a Lat/Lon coordinate on a map to another Lat/Lon
coordinate (so, there are only two points in "line"). Now, that line may
not be straight depending upon the map projection used, so the final line
may need many more points to represent it correctly in a transformed
projection. Again, I am not an expert here, so it is quite likely that I
mixed something up.
> for pixelPoint in path.vertices:
> # place image at point, centering it
>
> fig.figimage(im,pixelPoint[0]+80,pixelPoint[1]+180,origin="upper")
>
> This is just a way to put the image somewhere on my canvas to see it, so
> these offsets are just for this exercise.
>
> I should state that if I do it this way, the images appear on the canvas
> but are NOT repositioned in data coordinates (and they should be)--which is
> probably just Ben's point, right?
>
>
Right. It should be technically feasible to just simply tell figimage to
use a different transformation object, but this might have implications
elsewhere. I am very hazy in this part of mpl.
Cheers!
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年03月01日 20:38:07
On Wed, Feb 29, 2012 at 4:02 PM, Federico Ariza <ari...@gm...>wrote:
> Dear all
>
> I am a long time matplotlib user (under linux) but new to the list
> (second post).
>
> On of the things that bothers me the most is the inability of the standard
> backend to change simple things (line color, labels, etc...).
>
>
There was a feature a couple of us were hacking on a while back that would
allow for live switching between color and black&white modes. Is this sort
of stuff what you are speaking of? The changes were too invasive to be
included, but it was an interesting experiment.
> I resorted to create a simple FrankeinBackend (based on the GtkAgg)
> I guess I am not the only one missing this kind of features or
> experimenting with similar ideas.
>
> Some points comes to my mind:
> Is there any special place where we can share and discuss this?
>
GitHub
> Is it better if I just open a googlecode place for my code.?
>
No, GitHub (or any other git-compatible place that could interact with
mpl's github repo.)
> This is a recurring question and I have no idea what I am talking about
>
If it is what I think you mean, it is not an often asked-for-feature, but
it has been discussed. It is a very difficult problem to tackle and
significant refactoring work would be needed to even begin to address it.
Note, however, such refactor work by itself would be extremely valuable.
Along with that work should also be efforts towards improved documentation,
code comments, examples and tests. This way, when as work is done, we can
make sure that nothing is breaking (or make breaks well documented).
> This is already done I am reinventing the wheel
>
>
Nope, more like re-drawing the wheel. The wheel itself has yet to be made
to everyone's satisfaction.
Cheers!
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年03月01日 20:07:48
On Thu, Mar 1, 2012 at 10:59 AM, Jean-Baptiste Marquette <mar...@ia...>wrote:
> Dear Python gurus,
>
> I have written the attached script to plot data from SAMP interaction with
> TOPCAT (http://www.star.bris.ac.uk/~mbt/topcat/).
> I select a row on a given table (VOtable format) in TOPCAT, got the message
>
> Selected : file:/Volumes/pepperland/erosdata/cc_all/tm_all.vot 18
> Plotting star tm5000k7768
>
> All I obtain on screen is a blank rectangle window without borders and the
> rainbow wheel. I sampled the python process, file attached as well.
> I updated PyQt4 using the latest Mac snapshot and the Qt 4.8 libraries.
>
> Any hint welcome, thanks.
>
> Cheers,
> Jean-Baptiste Marquette
>
>
Jean,
You have several possible sources of problems here. I would first make
sure that basic matplotlib scripts work using the Qt4Agg backend on your
computer. Test out some regular scripts from the examples section of the
documentation. If they work as expected, then it is probably more likely
that there is a problem with one of the other libraries. Another possible
source of trouble may lie with the calls to "sleep". Because the display
libraries are not on a separate process, the sleep could also prevent the
figures from being completely rendered.
Personally, I wouldn't even bother with the interactive mode. Keep it off,
and just put the cleanup code after "plt.show()", which is a blocking
call. There is no need to implement your own event loop.
Ben Root
From: C M <cmp...@gm...> - 2012年03月01日 19:12:08
> Yeah, there are better ways to do that, somewhat. The problem with the
> proposed solution is that it relies on non-public APIs, which are can be
> subject to change without deprecation. Instead, I would have created the
> figimage object with a particular transform object that would have placed
> it at the appropriate data points.
Maybe your or someone from this list can help me understand more about
this. So, if I take the code that I have adapted to my purposes, there are
questions I have about it:
 # constants
 dpi = 72; imageSize = (32,32)
 # read in our png file
 im = image.imread('redX_10.png')
So far, so good--just setting the dpi and getting the image.
 fig = self.figure
 ax = self.subplot
 ax.get_frame().set_alpha(0)
Does the current version of Matplotlib require the frame be set to fully
transparent? I need a white canvas, so I think I'd rather not do that.
 # translate point positions to pixel positions
 # figimage needs pixels not points
 line = self.line_collections_list[0][0]
"line" here is my line of datapoints from elsewhere in my app.
 line._transform_path()
 path, affine =
line._transformed_path.get_transformed_points_and_affine()
 path = affine.transform_path(path)
I have no understanding of the purpose of the previous three lines. Can
someone give me a quick explanation?
 for pixelPoint in path.vertices:
 # place image at point, centering it
fig.figimage(im,pixelPoint[0]+80,pixelPoint[1]+180,origin="upper")
This is just a way to put the image somewhere on my canvas to see it, so
these offsets are just for this exercise.
I should state that if I do it this way, the images appear on the canvas
but are NOT repositioned in data coordinates (and they should be)--which is
probably just Ben's point, right?
Thanks,
Che
From: Benjamin R. <ben...@ou...> - 2012年03月01日 18:30:44
On Wed, Feb 29, 2012 at 5:47 PM, C M <cmp...@gm...> wrote:
> I'd like to use, in one case, small loaded images (pngs) as markers on an
> interactive matplotlib plot (using the OO approach). I'd potentially like
> to be able to point-pick these markers, too, as well as have them update
> appropriately if the plot is resized.
>
> The only example I've been to find of this is here:
>
> http://stackoverflow.com/questions/2318288/how-to-use-custom-marker-with-plot
>
> But that is from 2 years ago. Is this way of doing it--which the author
> describes as a "kludge"--still the state of things, or is there a better
> approach now? (And right now this way isn't working for me...the images
> are down the bottom of the figure).
>
> Thank you,
> Che
>
>
Yeah, there are better ways to do that, somewhat. The problem with the
proposed solution is that it relies on non-public APIs, which are can be
subject to change without deprecation. Instead, I would have created the
figimage object with a particular transform object that would have placed
it at the appropriate data points. Perhaps someone else on this list knows
of the correct way to do that?
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年03月01日 18:18:23
On Thu, Mar 1, 2012 at 11:33 AM, Pawel <pa...@gm...> wrote:
> Hi all,
>
> Is it possible to set the size of only some tick labels? I have text
> tick labels (residue names). I'd like to reduce the font size of just
> two of the labels to make them fit better, but keep the size of the
> remaining labels the same.
>
>
It isn't _impossible_, but mpl certainly won't make it easy for you. After
creating your graph and tick labels, you would have to get back the tick
labels as a list of Text objects using "get_xticklabels()". Then, you
modify the font size of the appropriate element in that list. Perhaps
something like this:
xticks = ax.get_xticklabels()
xticks[3].set_fontsize(xticks[3].get_fontsize() * 0.9)
Note: Completely untested.
> And in a similar vein, is it possible to change the padding of just some
> tick labels? Again, I'd like to increase the padding of just two of the
> labels but keep the remaining the same.
>
>
By "padding" are you referring to the spacing between the tick labels?
That would have to be done by changing the tick locations themselves. By
default, the ticks are equally spaced over the specified domain, and the
labels for those ticks are placed so that the center lines up with the tick
mark. Try using "get_xticks()" and "set_yticks()" and see what happens.
I hope that helps!
Ben Root
From: Jeffrey B. <jbl...@al...> - 2012年03月01日 17:49:35
Hi,
> I'm currently using the hist plot from matlibplot. Here I have the 
> following
> question: is there an easy way to set the bin content of a 
> specified bin?
> For example, I would like to call set_bin_content(bin_index=1, 
> value=10000)
> once instead of filling in 10000 times the same value.
You can do this by separating the histogram calculation from the 
plotting.
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
# generate data here; for example
data = np.random.randn(500)
myHist, myBinEdges = np.histogram(data)
# edit myHist to your heart's delight
wid = myBinEdges[1:] - myBinEdges[:-1]
plt.bar(myBinEdges[:-1], myHist, width=wid)
plt.show()
-Jeff
From: Pawel <pa...@gm...> - 2012年03月01日 17:33:29
Hi all,
Is it possible to set the size of only some tick labels? I have text 
tick labels (residue names). I'd like to reduce the font size of just 
two of the labels to make them fit better, but keep the size of the 
remaining labels the same.
And in a similar vein, is it possible to change the padding of just some 
tick labels? Again, I'd like to increase the padding of just two of the 
labels but keep the remaining the same.
Thanks for the help,
Pawel Janowski
From: Jean-Baptiste M. <mar...@ia...> - 2012年03月01日 16:59:49
Dear Python gurus,
I have written the attached script to plot data from SAMP interaction with TOPCAT (http://www.star.bris.ac.uk/~mbt/topcat/).
I select a row on a given table (VOtable format) in TOPCAT, got the message
Selected : file:/Volumes/pepperland/erosdata/cc_all/tm_all.vot 18
Plotting star tm5000k7768
All I obtain on screen is a blank rectangle window without borders and the rainbow wheel. I sampled the python process, file attached as well.
I updated PyQt4 using the latest Mac snapshot and the Qt 4.8 libraries.
Any hint welcome, thanks.
Cheers,
Jean-Baptiste Marquette
From: Ryan M. <rm...@gm...> - 2012年03月01日 14:18:23
On Feb 29, 2012, at 20:00, Bernhard Heijstek <ber...@ya...> wrote:
> Hello,
> 
> I'm trying to run a rudimentary animation code (http://pastebin.com/ZNRhDmPR). When I don't explicitly give a name to the FuncAnimation object, the code doesn't work. I mean, just dropping in:
> anim.FuncAnimation(fig, update_figure, np.arange(0, 2*np.pi, 0.1), interval=50)
> 
> instead of,
> 
> line_anim = anim.FuncAnimation(fig, update_figure, np.arange(0, 2*np.pi, 0.1), interval=50)
> 
> The way I see it, since both call the constructor and I don't reuse the object anywhere else, both should work, unless the code uses some weakrefs somewhere. If not, why isn't it working?
When you don't give the animation object a name, immediately following creation nothing is referencing the animation, so it is destroyed.
Ryan
From: John H. <jd...@gm...> - 2012年03月01日 14:07:13
I'll be attending the pydata hack night in Santa Clara tomorrow night.
 We'll be hacking on matplotlib, ipython, pandas, numpy and more. If you
are interested in stopping by, there is space for 200, many more than the
number of attendees at pydata. The event info is here:
http://python-data-hack-night.eventbrite.com/
Here is the description from the event:
The Python Data Workshop just got bigger! We are thrilled to announce that
Ground Floor Silicon Valley is generously opening up their coworking space
and hosting a Friday night Python Data Hack Night for all attendees of the
Workshop and any others who want to geek out on Python, data analysis, and
scientific computing! Spend a fun evening eating, drinking, coding, and
talking shop with the instructors and participants of the Workshop. This
includes the authors of Numpy, Scipy, IPython, Matplotlib, PyTables,
Pandas, and many other great Python packages.
Ground Floor has room for up to 200 folks, so if you are on the wait list
for the full Workshop, this is your chance to participate in the workshop!
 We are making tickets available to all those who registered for the Python
Data Workshop (attendees and wait list), before publicizing the event more
widely, so sign up now!
The event runs from 6pm until Midnight.
We are looking for sponsors to cover food and drinks, but we do expect to
have those there.
For sponsorship details, contact lyn...@ge...
Ground Floor SV
2030 Duane Avenue
Santa Clara, CA 95054
Friday, March 2, 2012 from 6:00 PM to 11:55 PM (PT)
JDH
From: Peter C. <p.j...@go...> - 2012年03月01日 11:11:42
On Thu, Mar 1, 2012 at 8:14 AM, Mic <mic...@gm...> wrote:
> Hello,
> Is it possible to use PyPy with:
> * BioPython
> * Pysam
> * Matplotlib
> * etc
>
> If not than it might be good idea to get a support for it with help of
> Google Summer of Code, because PyPy getting faster and faster.
Most of Biopython is working under PyPy (ignoring the C extensions,
much like our situation under Jython). This was mentioned in the
release notice for Bioython 1.59 - early adopters may be able to
find other problems that we're not aware of from the unit tests:
http://news.open-bio.org/news/2012/02/biopython-1-59-released/
I doubt there is enough work here alone to make a GSoC project.
I'm not sure about pysam under PyPy - but I would be interested
to know, because here interfacing with the samtools C code is the
essence of pysam. My impression from the PyPy mailing lists
calling external C libraries from PyPy is that this is another area
of active work.
For matplotlib, you would need NumPy under PyPy. That is an
area of active work for the PyPy team who are currently trying
to re-implement a pure-python version of NumPy which they are
calling NumPyPy (originally it was called micronumpy) sufficient
for other libraries using just the Python numpy API to run. A
problem with this is many Python libraries also use the NumPy
C API (e.g. bits of Biopython). See for example:
http://morepypy.blogspot.com/2012/01/numpypy-status-update.html
http://technicaldiscovery.blogspot.com/2011/10/thoughts-on-porting-numpy-to-pypy.html
I suggest reading the PyPy and NumPy mailing list archives for
more about this.
Peter
From: Jean-Baptiste M. <mar...@ia...> - 2012年03月01日 10:21:48
Le 29 févr. 2012 à 23:29, questions anon a écrit :
> I have a txt file (with an associated prj file) containing gridded weather data.
> Firstly how can I open this file and convert it to a numpy array?
You should have a look on ATpy package : http://atpy.github.com/
Cheers
JB
From: Mic <mic...@gm...> - 2012年03月01日 08:14:16
Hello,
Is it possible to use PyPy with:
* BioPython
* Pysam
* Matplotlib
* etc
If not than it might be good idea to get a support for it with help of
Google Summer of Code, because PyPy getting faster and faster.
Cheers,
From: Benjamin R. <ben...@ou...> - 2012年03月01日 05:42:56
On Wednesday, February 29, 2012, questions anon wrote:
> I have had some progress reading in the data but am unsure how to create
> lats and lons from the info I have (see above).
> the error I am receiving is:
>
> Traceback (most recent call last):
> File "d:\plotrainfall.py", line 40, in <module>
> CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet)
> File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py",
> line 3072, in contourf
> np.logical_or(outsidemask,np.logical_or(ma.getmaskarray(data),xymask))
> AttributeError: logical_or
>
>
> from the below code:
>
>
> onefile=r"E:/test_in/r19000117.txt"
>
> f=N.genfromtxt(onefile, skip_header=6, dtype=float, names=True)
> print f
>
>
> map = Basemap(projection='merc',llcrnrlat=-45,urcrnrlat=-9,
> llcrnrlon=111.975,urcrnrlon=156.525,lat_ts=0,resolution='i')
> map.drawcoastlines()
> map.drawstates()
> xi=N.linspace(111.975, 156.275, 886)
> yi=N.linspace(-44.525, -9.975, 691)
> x,y=map(*N.meshgrid(xi,yi))
> plt.title('rainfall')
> CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet)
> l,b,w,h =0.1,0.1,0.8,0.8
> cax = plt.axes([l+w+0.025, b, 0.025, h])
> plt.colorbar(CS,cax=cax, drawedges=True)
> plt.savefig((os.path.join(OutputFolder, 'rainfall.png')))
> plt.show()
> plt.close()
>
>
>
How did you install numpy? Which version are you using? What are your
imports at the top of this script?
Ben Root
From: questions a. <que...@gm...> - 2012年03月01日 05:16:07
I have had some progress reading in the data but am unsure how to create
lats and lons from the info I have (see above).
the error I am receiving is:
Traceback (most recent call last):
 File "d:\plotrainfall.py", line 40, in <module>
 CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet)
 File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py",
line 3072, in contourf
 np.logical_or(outsidemask,np.logical_or(ma.getmaskarray(data),xymask))
AttributeError: logical_or
from the below code:
onefile=r"E:/test_in/r19000117.txt"
f=N.genfromtxt(onefile, skip_header=6, dtype=float, names=True)
print f
map = Basemap(projection='merc',llcrnrlat=-45,urcrnrlat=-9,
 llcrnrlon=111.975,urcrnrlon=156.525,lat_ts=0,resolution='i')
map.drawcoastlines()
map.drawstates()
xi=N.linspace(111.975, 156.275, 886)
yi=N.linspace(-44.525, -9.975, 691)
x,y=map(*N.meshgrid(xi,yi))
plt.title('rainfall')
CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet)
l,b,w,h =0.1,0.1,0.8,0.8
cax = plt.axes([l+w+0.025, b, 0.025, h])
plt.colorbar(CS,cax=cax, drawedges=True)
plt.savefig((os.path.join(OutputFolder, 'rainfall.png')))
plt.show()
plt.close()
On Thu, Mar 1, 2012 at 9:29 AM, questions anon <que...@gm...>wrote:
> I have a txt file (with an associated prj file) containing gridded weather
> data.
> Firstly how can I open this file and convert it to a numpy array?
> and then how to plot in matplotlib, paticularly how to use the lat, lon
> and nrows,ncols.
> ncols=886
> nrows=691
> longitude west=111.975, east=156.275
> latitude north=-9.975, south=-44.525
> cell size=0.05
>
> My attempt below:
> --------------------------------------------------
>
> onefile=open("E:/test_in/r19000117.txt", 'r')
>
> map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
> llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
> map.drawcoastlines()
> map.drawstates()
> xi=N.linspace(111.975, 156.275, 886)
> yi=N.linspace(-44.525, -9.975, 691)
> x,y=map(*N.meshgrid(xi,yi))
> plt.title('rainfall')
> CS = map.contourf(x,y, onefile, cmap=plt.cm.jet)
> l,b,w,h =0.1,0.1,0.8,0.8
> cax = plt.axes([l+w+0.025, b, 0.025, h])
> plt.colorbar(CS,cax=cax, drawedges=True)
> plt.savefig((os.path.join(OutputFolder, 'rainfall.png')))
> plt.show()
> plt.close()
>
>

Showing results of 27

1 2 > >> (Page 1 of 2)
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 によって変換されたページ (->オリジナル) /