Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-17 Thread Darren Dale
On Tue, Feb 16, 2010 at 9:53 PM, John Hunter jdh2...@gmail.com wrote:
 On Tue, Feb 16, 2010 at 3:57 PM, Ernest Adrogué eadro...@gmx.net wrote:
 16/02/10 @ 16:20 (-0500), thus spake Filipe Pires Alvarenga Fernandes:
 \\  works for titles and label, but not for DateFormatter, but \vspace did
 the trick!

 Thanks again for the help.

 ps: I'm new to python, but maybe there is a way to mix Latex and unicode?

 Yes, the inputenc package from latex lets you use unicode.
 Try adding this to your script:
 plt.rc('text.latex', preamble='\usepackage[utf]{inputenc}')

 Note that this setting is not officially supported, whatever
 that means :)

 I think it means that Darren, who did most of the heavy lifting for
 these features, was getting tired of the endless line of additional
 things TeX users wanted to do and the difficulties supporting these
 across all platforms (eg MikTex on Windows) and drew a line in the
 sand saying I'll add this stuff but if you report problems I may not
 stay up all night trying to fix them.

That is a fair explanation. Adding arbitrary lines to the latex
preamble adds an incredible amount of flexibility if you are a user,
and it provides plenty of rope with which to hang yourself if you are
a developer (answering questions/problems related to people writing
bad python code, misconfigured latex installations, and bad latex
code!). At the time, we had finally shaped the latex backend into
something that worked across platforms (and different versions of
latex installations), plus I was also finishing up grad school and
starting a new job, so I had reservations about even adding this
feature to the library. But people really wanted it so we compromised.

Darren

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Color in table help please! I have already searched previous posts

2010-02-17 Thread duckman


That actually did it.  I thought I had tried this several times and kept
getting errors.  It would not take the color names like red, blue etc.  But
when I changed it as suggested it worked!   

Thank you!  


Jae-Joon Lee wrote:
 
 On Tue, Feb 16, 2010 at 2:15 PM, duckman tduck...@crowellsystems.com
 wrote:
 I am trying to make the table at the bottom and the lines the same color.
  I
 took the code from one of the online examples and modified it to do most
 of
 what I want but cannot get the color in the table working properly! Can
 someone please help?  Thank you

 
 Do you want the background of the row labels to match your line colors?
 The answer seems to be so trivial and I'm not sure if this is what you
 want.
 
 the_table = table(cellText=cellText,
  rowLabels=rowLabels, rowColours=linecolor,
  colLabels=colLabels,
  loc='bottom')
 
 -JJ
 
 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 

-- 
View this message in context: 
http://old.nabble.com/Color-in-table-help-please%21--I-have-already-searched-previous-posts-tp27613553p27623776.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Easy come easy go

2010-02-17 Thread Michiel de Hoon
An inconsistency in the definition of save_figure between different backends is 
causing this problem.

The GTK backends use
def save_figure(self, button):

but the tkagg, qt, qt4, and macosx backends use
def save_figure(self):

so without the second argument. The line that is causing the error is

self.canvas.toolbar.save_figure(self.canvas.toolbar)

in backend_bases.py. This assumes that the save_figure method is defined as in 
the GTK backends.

As far as I can tell, the GTK backend has the second argument because that is 
what pygtk passes when save_figure is called as a callback. The second argument 
is not actually used inside the method.

So I would suggest the following:

In backend_bases.py, change the offending line to

self.canvas.toolbar.save_figure()

and the backend_gtk, change the definition of the save_figure method to

def save_figure(self, button-None):

Any objections, anybody?

--Michiel


--- On Sun, 2/14/10, David Arnold dwarnol...@suddenlink.net wrote:

 From: David Arnold dwarnol...@suddenlink.net
 Subject: [Matplotlib-users] Easy come easy go
 To: matplotlib-users@lists.sourceforge.net
 Date: Sunday, February 14, 2010, 11:36 PM
 All,
 
 This example:  
 http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html
 
 Raises this exception o my Macbook when the key 's' is
 pressed:
 
 The debugged program raised the exception unhandled
 TypeError
 save_figure() takes exactly 1 argument (2 given)
 File:
 /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py,
 Line: 1703
 
 David
 --
 SOLARIS 10 is the OS for Data Centers - provides features
 such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris
 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


  

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Assigning k key for xscaling

2010-02-17 Thread Matthias Michler
Hi list, Hi Gökhan, 

I once more would like to say that I like the 2 new features introduced by 
Gökhan (key 'k' for xscaling and the generalized handling of the key-mapping, 
which allows the user to choose its prefered key for a certain task) and I'd 
like to see this in matplotlib.

I attached a patch (against todays svn) of my final version, which is a 
slightly modified version of Gökhans patch.

If anybody could test it and comments on this I'd be happy. Otherwise I will 
place the patch on the patch tracker in (let's say) a week.

Thanks in advance for any help in order to bring this into matplotlib.

Kind regards,
Matthias

On Tuesday 02 February 2010 14:05:52 Matthias Michler wrote:
 Hi Gökhan,

 I'm sorry I didn't had the time to look into your patch in the last days.

 Today I did have a look at it and in my opinion you did a great job -
 Thanks! The point is that I'm not a developer and therefore cannot commit
 it right away ;-) .

 Although it is great stuff I tried to even improve it. Attached you find my
 svn-diff of the backend_bases.py, where I tried to get rid of the different
 handling of *3* keys for home and *1* for save etc. I converted all
 key-maps into lists and therefore the number of keys doesn't matter. With
 that I can do also
 xscale : L, k
 in my matplotlibrc and allow foGökhanr both of our favorite keys for the 
toggling
 of the xscale ;-)

 Concerning the names of the variables you find some changes in the attached
 patch, which are not yet complete in my opinion, but I didn't want to spoil
 your lines to much. If I have to decide between short and meaningful
 variable names, I prefer meaningful at least if they don't blow up to 80
 chars ;-) ...

 In my opinion your next patch should be a part of matplotlibs svn, but as I
 mentioned above I'm just a user. In case I can help you somehow in bringing
 up this patch, don't hesitate to write again and hopefully I have the time
 to help.

 Kind regards,
 Matthias

 On Friday 29 January 2010 20:22:20 Gökhan Sever wrote:
  My initial patch is ready for your review.
 
  I tested with latest svn and customized key-mapping (from matplotlibrc)
  is working correctly.
 
  Please review, and let me know if there would be any better solution,
  variable naming, placing etc.. I can also update the
  http://matplotlib.sourceforge.net/users/navigation_toolbar.html
  accordingly.
 
  On Mon, Jan 25, 2010 at 12:58 PM, Gökhan Sever 
gokhanse...@gmail.comwrote:
   Hello,
  
   I could these keys into rcsetup.py file as well as
   matplotlibrc.template and update backend_bases.py accordingly. And add
   some documentation reflecting
   the changes made.
  
   # Event keys to interact with figures/plots via keyboard
  
   fullscreen : 'f'
   home : 'h'
   reset : 'r'
   back : 'c'
   forward : 'v'
   pan : 'p'
   zoom : 'o'
   save : 's'
   grid : 'g'
   yscale : 'l'
   xscale : 'k'
  
  
   *Notes:*
  
   Matthias, leaving values as empty will remove the key short-cut.
  
   Don't understand exactly what 'a' does?
  
   f doesn't toggle full-screen --using qt4agg backend.
  
   There are a couple function duplicates. (eg. back with 'c' and left and
   backspace keys. How can represent them? Create a list inside the
   dictionary?
   back = ['c', 'left', 'backspace']
  
   'o' seems like unnecessary. Since you have to select an area using
   mouse.
  
   's' doesn't behave correctly here. Shouldn't it bring the save dialog?
   Instead I am getting:
   TypeError: save_figure() takes exactly 1 argument (2 given)
  
  
  
   On Mon, Jan 25, 2010 at 8:32 AM, Matthias Michler
   matthiasmich...@gmx.net
  
wrote:
  
   Hi Gökhan,
  
   I just wanted to discuss the key, because I think this patch should be
   part of
   matplotlib and not only of individual users. I think it is worth be be
   added
   to the mpl-tracker at http://sourceforge.net/tracker/?group_id=80706
   or maybe
   one of the developers has the time to commit this small change?
  
   I think your idea about key-mappings in the matplotlib-rc is a good
   option to
   customize keyboard short cuts and even remove short-cuts which aren't
   of intrest for the individual user. Furthermore the latter yields
   space for keyboard shortcuts, which are used in one's own program.
  
   Kind regards,
   Matthias
  
   On Friday 22 January 2010 16:57:22 Gökhan Sever wrote:
It is very simple to change key-assignment. Take a look at the
backend_bases.py code (search for event.key instances) :
   
elif event.key == 'L':
   
I was thinking to move y-scaling to y and x-scaling to x but x
and y are assigned to something else (
http://matplotlib.sourceforge.net/users/navigation_toolbar.html)
   
For me toggling k is simpler for me than doing Shift-L.
   
Maybe these options could be provided in the matplotlibrc file.
Users
  
   can
  
make their key mapping based on their choice. That requires some
more coding
   
:)
   
On Fri, Jan 22, 

[Matplotlib-users] Interactive use of matplotlib in ipython

2010-02-17 Thread Wolfgang Kerzendorf
Hello,

I would like to build a bit of an interactive fitter with matplotlib and 
ipython (in pylab environment). I would like to have a a function, which takes 
x and y as input, then plots these and fits a line to it (just numpy polyfit). 
if I click a point it will be removed from the fit pool and the line will be 
refitted (optionally after pressing 'f'). when I'm done I can press 'q' or 
close the window and the function will come to an end and spit out the fitting 
parameter. 
I tried this a year or two ago and I had terrible problems with getting 
stopping the event loop and waiting for the interactive part to finish and then 
finish the function. I'm running os 10.6 and use the wx backend (or mac os x, 
if that's easier). Can you point me to an example or give me a crude overview 
of how to do that in the right way. Is that understandable?

Cheers
Wolfgang
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Easy come easy go

2010-02-17 Thread John Hunter
On Wed, Feb 17, 2010 at 7:41 AM, Michiel de Hoon mjldeh...@yahoo.com wrote:
 An inconsistency in the definition of save_figure between different backends 
 is causing this problem.

 The GTK backends use
    def save_figure(self, button):

 but the tkagg, qt, qt4, and macosx backends use
    def save_figure(self):

 so without the second argument. The line that is causing the error is

            self.canvas.toolbar.save_figure(self.canvas.toolbar)

 in backend_bases.py. This assumes that the save_figure method is defined as 
 in the GTK backends.

 As far as I can tell, the GTK backend has the second argument because that is 
 what pygtk passes when save_figure is called as a callback. The second 
 argument is not actually used inside the method.

 So I would suggest the following:

 In backend_bases.py, change the offending line to

            self.canvas.toolbar.save_figure()

 and the backend_gtk, change the definition of the save_figure method to

    def save_figure(self, button-None):

 Any objections, anybody?


The base class signature is

def save_figure(self, *args):
'save the current figure'
raise NotImplementedError

But I think the problem is the line

  self.canvas.toolbar.save_figure(self.canvas.toolbar)

it shouldn't be passing the toolbar in, but should just read

  self.canvas.toolbar.save_figure()

We could make both changes -- make sure all the signatures of the
derived classes comply with

 def save_figure(self, *args):

and remove the self.canvas.toolbar argument from the save_figure call.

Michiel, do you want to take the lead on this?

JDH
No?

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Interactive use of matplotlib in ipython

2010-02-17 Thread John Hunter
On Wed, Feb 17, 2010 at 7:42 AM, Wolfgang Kerzendorf
wkerzend...@googlemail.com wrote:
 Hello,

 I would like to build a bit of an interactive fitter with matplotlib and 
 ipython (in pylab environment). I would like to have a a function, which 
 takes x and y as input, then plots these and fits a line to it (just numpy 
 polyfit). if I click a point it will be removed from the fit pool and the 
 line will be refitted (optionally after pressing 'f'). when I'm done I can 
 press 'q' or close the window and the function will come to an end and spit 
 out the fitting parameter.
 I tried this a year or two ago and I had terrible problems with getting 
 stopping the event loop and waiting for the interactive part to finish and 
 then finish the function. I'm running os 10.6 and use the wx backend (or mac 
 os x, if that's easier). Can you point me to an example or give me a crude 
 overview of how to do that in the right way. Is that understandable?

Take a look at

  http://matplotlib.sourceforge.net/examples/event_handling/poly_editor.html

You can use the 'i' and 'd' keys to insert and delete vertexes, can
click and drag them to move them.

See also the event handling tutorial at

  http://matplotlib.sourceforge.net/users/event_handling.html


JDH

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Assigning k key for xscaling

2010-02-17 Thread John Hunter
On Wed, Feb 17, 2010 at 8:08 AM, Matthias Michler
matthiasmich...@gmx.net wrote:
 Hi list, Hi Gökhan,

 I once more would like to say that I like the 2 new features introduced by
 Gökhan (key 'k' for xscaling and the generalized handling of the key-mapping,
 which allows the user to choose its prefered key for a certain task) and I'd
 like to see this in matplotlib.

 I attached a patch (against todays svn) of my final version, which is a
 slightly modified version of Gökhans patch.

 If anybody could test it and comments on this I'd be happy. Otherwise I will
 place the patch on the patch tracker in (let's say) a week.

 Thanks in advance for any help in order to bring this into matplotlib.

Hi -- these look like useful changes.  In most of matplotlib rc we
have a namespace for the rc keys, so I prefer something like

  keymap.fullscreen : f   # toggling
  keymap.home : h, r, home# home or reset mnemonic

Also, could you include in your patch a diff against

  mpl/doc/users/navigation_toolbar.rst

documenting the changes.

Also, I'm not sure you need

+# to get a common standard we move all keys for each action into a list
+for key in [fullscreen_keys, home_keys, back_keys, forward_keys,
+pan_keys, zoom_keys, save_keys, grid_keys,
+toggle_xscale_keys, toggle_yscale_keys, all]:
+if type(key) is not list:
+key = list(key)
+

If you setup your validate func properly in rcsetup, you can guarantee
that each of these keymap.* entries will be a list of strings, even
those changes interactively from the prompt.  So I suggest changing
each of these key entries to have a validate_stringlist validator and
then you won't need this check.

Thanks,
JDH

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Break in X-Axis

2010-02-17 Thread mogliii

Hi,

I am currently learning metplotlib to make beautiful figures for a LaTeX
thesis.

I will need to have graphs with a break in the x-axis, comparable to this
one
http://www.originlab.com/www/Products/images/Date_Axis_plot_with_XY_break_500px.png

As I found out, there is no native support for this. So I fiddled around a
lot and came up with the following solutions.

Please take this as a starting point if you happen to have the same
intensions with matplotlib.
Also I am happy for any input from more experienced users.

The code:

#@ begin
from matplotlib import rc
import numpy as np
import matplotlib.pyplot as plt

y = np.loadtxt('532_0.1_10.txt')

fig_width_pt = 400  # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27   # Convert pt to inches
golden_mean = (np.sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt  # width in inches
fig_height =fig_width*golden_mean   # height in inches
fig_size = [fig_width,fig_height]

rc('font',**{'family':'serif','serif':['Computer Modern Roman']})
params = {'backend': 'ps',
  'axes.labelsize': 10,
  'text.fontsize': 10,
  'legend.fontsize': 8,
  'xtick.labelsize': 8,
  'ytick.labelsize': 8,
  'text.usetex': True,
  'figure.figsize': fig_size,
  'axes.unicode_minus': True}
matplotlib.rcParams.update(params)

# setup figure with specified size
fig = plt.figure(figsize=fig_size)
width = 0.44 # width of the two subplots
spacing = 0.025/2 # spacing between subplots

if 1: # left subplot
ax1 = plt.axes([0.08,0.15,width,0.8])
for loc, spine in ax1.spines.iteritems():
if loc in ['right']:
spine.set_color('none')
else:
spine.set_position(('outward',0))
plt.plot(zip(*y)[0], zip(*y)[1])
ax1.set_xlim(740,820)
plt.xticks([750,800])

if 1: #right subplot with shared y-axis
ax2 = plt.axes([0.08+width+spacing,0.15,width,0.8], sharey=ax1)
for loc, spine in ax2.spines.iteritems():
if loc in ['left', 'right']:
spine.set_color('none')
else:
spine.set_position(('outward',0))
plt.plot(zip(*y)[0], zip(*y)[1])
ax2.set_xlim(930, 1010)
ax2.set_xticks([950,1000])
ax2.set_yticks([])
ax2.set_ylim(0, 11000)  # after second plot

if 1: # axes labels and break lines
ax3 = plt.axes([0.08,0.15,2*width+0.025/2,0.8]) # change position to
adjust labels
for loc, spine in ax3.spines.iteritems():
if loc in ['left', 'bottom', 'top']:
spine.set_color('none')
else:
spine.set_position(('outward',0))
ax3.set_yticks([])
ax3.set_xticks([])
ax3.set_xlabel(r'Raman shift (cm-1)', labelpad = 25) 
# ax3.xaxis.set_label_coords(0.5,-0.06) #alternative to labelpad
ax3.set_ylabel('Intensity (arb. unit)', labelpad = 10)
ax3.patch.set_facecolor('None') # set background transparent. Must for
.eps!
shift = spacing/2
# the four small lines
line =
matplotlib.lines.Line2D([0.5-0.005-shift,0.5+0.005-shift],[-0.013,0.013],
linewidth=1, color='black', clip_on=False)
ax3.add_line(line) 
line =
matplotlib.lines.Line2D([0.5-0.005+shift,0.5+0.005+shift],[-0.013,0.013],
linewidth=1, color='black', clip_on=False)
ax3.add_line(line) 
line =
matplotlib.lines.Line2D([0.5-0.005-shift,0.5+0.005-shift],[1+-0.013,1+0.013],
linewidth=1, color='black', clip_on=False)
ax3.add_line(line) 
line =
matplotlib.lines.Line2D([0.5-0.005+shift,0.5+0.005+shift],[1+-0.013,1+0.013],
linewidth=1, color='black', clip_on=False)
ax3.add_line(line) 

plt.show()
#plt.savefig('breaktest.png')
# end



And here some explanations:
I decided not to use subplots, but axes instead. I feel this gives more
control, even it involves arithmetics.

So there is one axes (ax1) for the left figure (no right axis)
then another axes (ax2) for the right figure (no left and right axis, sharey
with left figure)
And in the end a transparent axes (ax3) around both (only right axis), which
is used to plot the axis labels and the four small breaklines.

Looks better than Origin ;)
EPS output:  http://old.nabble.com/file/p27624781/image.eps image.eps 
PNG output:  http://old.nabble.com/file/p27624781/matplotlib_axis_break.png
matplotlib_axis_break.png 
Raw Data:  http://old.nabble.com/file/p27624781/532_0.1_10.txt
532_0.1_10.txt 
-- 
View this message in context: 
http://old.nabble.com/Break-in-X-Axis-tp27624781p27624781.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

Re: [Matplotlib-users] Assigning k key for xscaling

2010-02-17 Thread Matthias Michler
On Wednesday 17 February 2010 15:28:24 John Hunter wrote:
 On Wed, Feb 17, 2010 at 8:08 AM, Matthias Michler

 matthiasmich...@gmx.net wrote:
  Hi list, Hi Gökhan,
 
  I once more would like to say that I like the 2 new features introduced
  by Gökhan (key 'k' for xscaling and the generalized handling of the
  key-mapping, which allows the user to choose its prefered key for a
  certain task) and I'd like to see this in matplotlib.
 
  I attached a patch (against todays svn) of my final version, which is a
  slightly modified version of Gökhans patch.
 
  If anybody could test it and comments on this I'd be happy. Otherwise I
  will place the patch on the patch tracker in (let's say) a week.
 
  Thanks in advance for any help in order to bring this into matplotlib.

 Hi -- these look like useful changes.  In most of matplotlib rc we
 have a namespace for the rc keys, so I prefer something like

   keymap.fullscreen : f   # toggling
   keymap.home : h, r, home# home or reset mnemonic

 Also, could you include in your patch a diff against

   mpl/doc/users/navigation_toolbar.rst

 documenting the changes.

 Also, I'm not sure you need

 +# to get a common standard we move all keys for each action into a
 list +for key in [fullscreen_keys, home_keys, back_keys,
 forward_keys, +pan_keys, zoom_keys, save_keys,
 grid_keys,
 +toggle_xscale_keys, toggle_yscale_keys, all]:
 +if type(key) is not list:
 +key = list(key)
 +

 If you setup your validate func properly in rcsetup, you can guarantee
 that each of these keymap.* entries will be a list of strings, even
 those changes interactively from the prompt.  So I suggest changing
 each of these key entries to have a validate_stringlist validator and
 then you won't need this check.

Hi John,

thanks a lot for taking the time to go through this patch. I tried to 
incorporate you remarks and attached a new patch. 
The most difficult task is about the 
documentation 'mpl/doc/users/navigation_toolbar.rst', because I'm not sure 
what is needed and I not familiar with the used programming language.

Kind regards,
Matthias 
Index: matplotlibrc.template
===
--- matplotlibrc.template	(revision 8139)
+++ matplotlibrc.template	(working copy)
@@ -360,3 +360,20 @@
 #   from matplotlib import verbose.
 #verbose.level  : silent  # one of silent, helpful, debug, debug-annoying
 #verbose.fileo  : sys.stdout  # a log filename, sys.stdout or sys.stderr
+
+# Event keys to interact with figures/plots via keyboard.
+# Customize these settings according to your needs. 
+# Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '') 
+
+#keymap.fullscreen : f   # toggling
+#keymap.home : h, r, home# home or reset mnemonic
+#keymap.back : left, c, backspace# forward / backward keys to enable 
+#keymap.forward : right, v   #   left handed quick navigation
+#keymap.pan : p  # pan mnemonic
+#keymap.zoom : o # zoom mnemonic
+#keymap.save : s # saving current figure
+#keymap.grid : g # switching on/off a grid in current axes
+#keymap.yscale : l   # toggle scaling of y-axes ('log'/'linear')
+#keymap.xscale : L, k# toggle scaling of x-axes ('log'/'linear')
+#keymap.all_axes : a # enable all axes
+
Index: lib/matplotlib/backend_bases.py
===
--- lib/matplotlib/backend_bases.py	(revision 8139)
+++ lib/matplotlib/backend_bases.py	(working copy)
@@ -1888,50 +1888,85 @@
 #self.destroy() # how cruel to have to destroy oneself!
 #return
 
-if event.key == 'f':
+# Load key-mappings from your matplotlibrc file.
+fullscreen_keys = rcParams['keymap.fullscreen']
+home_keys = rcParams['keymap.home']
+back_keys = rcParams['keymap.back']
+forward_keys = rcParams['keymap.forward']
+pan_keys = rcParams['keymap.pan']
+zoom_keys = rcParams['keymap.zoom']
+save_keys = rcParams['keymap.save']
+grid_keys = rcParams['keymap.grid']
+toggle_yscale_keys = rcParams['keymap.yscale']
+toggle_xscale_keys = rcParams['keymap.xscale']
+all = rcParams['keymap.all_axes']
+
+# toggle fullscreen mode (default key 'f')
+if event.key in fullscreen_keys:
 self.full_screen_toggle()
 
-# *h*ome or *r*eset mnemonic
-elif event.key == 'h' or event.key == 'r' or event.key == home:
+# home or reset mnemonic  (default key 'h', 'home' and 'r')
+elif event.key in home_keys:
 self.canvas.toolbar.home()
-# c and v to enable left handed quick navigation
-elif event.key == 'left' or event.key == 'c' or event.key == 

Re: [Matplotlib-users] Assigning k key for xscaling

2010-02-17 Thread John Hunter
On Wed, Feb 17, 2010 at 9:06 AM, Matthias Michler
matthiasmich...@gmx.net wrote:

 thanks a lot for taking the time to go through this patch. I tried to
 incorporate you remarks and attached a new patch.
 The most difficult task is about the
 documentation 'mpl/doc/users/navigation_toolbar.rst', because I'm not sure
 what is needed and I not familiar with the used programming language.

Hey mattias,

I just committed this to svn HEAD.  I tested the L key on WXAgg, TkAgg
and Qt4Agg and it is working on all but WXAgg.  Some wx expert may
want to look and make sure that the shifted keys are getting properly
recognized on wx.

As for the docs in mpl/doc/users/navigation_toolbar.rst, the language
is sphinx and restructured text

  http://sphinx.pocoo.org/rest.html

It looks like you got it right by following the pattern.  This is the
document used to generate the mpl html and pdf documentation, eg

  http://matplotlib.sourceforge.net/users/navigation_toolbar.html

Thanks again!
JDH

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hexbin log bins and colorbar

2010-02-17 Thread Jan Strube
Dear matplotters,
encouraged from the excellent response times to my last problem, I am trying
to explore more features of matplotlib.

My current problem is with hexbin.
I have been using numpy.histogram2d and imshow so far for 2d histograms, but
I must admit that hexbin looks quite pretty.

In order to emphasize small differences over a large scale, I am using
hexbin with the bins='log' option.
The result is very nice, but when I add a pyplot.colorbar(), I would like to
have the original number of entries on the ticks, not their log10.

Ideally, I'd change the yaxis of the colorbar to a logscale, and use
numpy.power(10, yaxis_values) on it.
I think colorbar().ax.set_yscale('log') should do what I need for the first
part, but how do I get the original number of entries back, rather than
their log10.
I could cheat and simply replace each ticklabel with 10^ticklabel, but I
don't even know how to do that.

Thanks for any pointers,
Cheers,
Jan
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-17 Thread PHobson
 On Tue, Feb 16, 2010 at 9:53 PM, John Hunter jdh2...@gmail.com wrote:
  I think it means that Darren, who did most of the heavy lifting for
  these features, was getting tired of the endless line of additional
  things TeX users wanted to do and the difficulties supporting these
  across all platforms (eg MikTex on Windows) and drew a line in the
  sand saying I'll add this stuff but if you report problems I may not
  stay up all night trying to fix them.


 From: Darren Dale [mailto:dsdal...@gmail.com]
 Sent: Wednesday, February 17, 2010 4:55 AM
 That is a fair explanation. Adding arbitrary lines to the latex
 preamble adds an incredible amount of flexibility if you are a user,
 and it provides plenty of rope with which to hang yourself if you are
 a developer (answering questions/problems related to people writing
 bad python code, misconfigured latex installations, and bad latex
 code!). At the time, we had finally shaped the latex backend into
 something that worked across platforms (and different versions of
 latex installations), plus I was also finishing up grad school and
 starting a new job, so I had reservations about even adding this
 feature to the library. But people really wanted it so we compromised.

Compromised or not, it's a great feature and I'm *really* happy it made it was 
included! Thanks for all of the effort.

-Paul H.
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hexbin log bins and colorbar

2010-02-17 Thread Eric Firing
Jan Strube wrote:
 Dear matplotters,
 encouraged from the excellent response times to my last problem, I am 
 trying to explore more features of matplotlib.
 
 My current problem is with hexbin.
 I have been using numpy.histogram2d and imshow so far for 2d histograms, 
 but I must admit that hexbin looks quite pretty.
 
 In order to emphasize small differences over a large scale, I am using 
 hexbin with the bins='log' option.
 The result is very nice, but when I add a pyplot.colorbar(), I would 
 like to have the original number of entries on the ticks, not their log10.
 
 Ideally, I'd change the yaxis of the colorbar to a logscale, and use 
 numpy.power(10, yaxis_values) on it.
 I think colorbar().ax.set_yscale('log') should do what I need for the 
 first part, but how do I get the original number of entries back, rather 
 than their log10.
 I could cheat and simply replace each ticklabel with 10^ticklabel, but I 
 don't even know how to do that.

Offhand, I suspect this would be the best solution at present, if the 
only problem now is that you want the ticklabels written differently. 
Try using the format kwarg of the colorbar, supplying either a format 
string or a formatter.

Something like this (untested):

from matplotlib.ticker import LogFormatter

class LogFormatterHB(LogFormatter):
 def __call__(self, v, pos=None):
 vv = self._base ** v
 return LogFormatter.__call__(self, vv, pos)

...

cbar = colorbar( ... ,  format=LogFormatterHB())


Eric

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Assigning k key for xscaling

2010-02-17 Thread Gökhan Sever
On Wed, Feb 17, 2010 at 9:28 AM, John Hunter jdh2...@gmail.com wrote:

 On Wed, Feb 17, 2010 at 9:06 AM, Matthias Michler
 matthiasmich...@gmx.net wrote:

  thanks a lot for taking the time to go through this patch. I tried to
  incorporate you remarks and attached a new patch.
  The most difficult task is about the
  documentation 'mpl/doc/users/navigation_toolbar.rst', because I'm not
 sure
  what is needed and I not familiar with the used programming language.

 Hey mattias,


Thanks John adding this feature into the code-base. Also Matthias thanks for
your additions and keeping the subject hot :)


 I just committed this to svn HEAD.  I tested the L key on WXAgg, TkAgg
 and Qt4Agg and it is working on all but WXAgg.  Some wx expert may
 want to look and make sure that the shifted keys are getting properly
 recognized on wx.


L is working for me both for Qt4Agg and WXAgg.

For some reason I can't make f key toggling the fullscreen. It does
nothing -no error messages and no life sign. Any confirmation?

Lastly, I know s behaviour is also being discussed in another thread, and
I have seen with WXAgg it raises a not implemented error. I think s could
simply bring the save dialogue instead of showing those messages. What do
you think?



 As for the docs in mpl/doc/users/navigation_toolbar.rst, the language
 is sphinx and restructured text

  http://sphinx.pocoo.org/rest.html

 It looks like you got it right by following the pattern.  This is the
 document used to generate the mpl html and pdf documentation, eg

  http://matplotlib.sourceforge.net/users/navigation_toolbar.html

 Thanks again!
 JDH


I see that you also updated the documentation. I was waiting for someone to
take a look at the code before making changes there. Thanks again.





 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Gökhan
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] set_scientific(False) doesn't do anything.

2010-02-17 Thread cuddihyd

Hi -- According to what I've read in the docs, the following code should
render a graph with the Y-Axis NOT in scientific-mode. However this isn't
the case. What am I failing to understand?

import matplotlib.pylab as pylab
pylab.figure()
yfmt = pylab.gca().yaxis.get_major_formatter()
yfmt.set_scientific(False)
pylab.draw()
pylab.plot([110100,110102,110100,110103])
pylab.show()

...I'm running on Ubuntu Intrepid. matplotlib.__version__ reports 0.98.3  

Any thoughts?
Thanks!
-Dave
-- 
View this message in context: 
http://old.nabble.com/set_scientific%28False%29-doesn%27t-do-anything.-tp27631188p27631188.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Download Intelreg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Where do bugs and document corrections/suggestions get sent?

2010-02-17 Thread David Arnold
All,

Where do bugs and document corrections/suggestions get sent?

David

--
Download Intelreg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Clipping

2010-02-17 Thread David Arnold
All,

I'm looking at:

http://matplotlib.sourceforge.net/examples/api/clippath_demo.html

But I cannot figure out:

patch=patches.Circle((300, 300), radius=100)

Where precisely is (300,300)?

D.

--
Download Intelreg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Masks

2010-02-17 Thread David Arnold
All,

In the code on:

http://matplotlib.sourceforge.net/examples/api/bbox_intersect.html

I think I've figured out that:

vertices = (np.random.random((4, 2))-0.5)*6.0
vertices = np.ma.masked_array(vertices, [[False, False], [True, True], 
[False, False], [False, False]])

prevents the second of four random vertices from being used. But I'm not sure 
why

plot(vertices[:, 0], vertices[:, 1], color=color)

seems to connect only two points for a line segment.

Can someone explain?

D.
--
Download Intelreg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Where do bugs and document corrections/suggestions get sent?

2010-02-17 Thread Philipp Bender
The easiest way is to check out the SVN / git repo, make the changes and 
create a patch according to the instructuins here: 

http://matplotlib.sourceforge.net/faq/howto_faq.html#submit-a-patch

Best regards
Philipp

--
Download Intelreg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users