Re: [Matplotlib-users] swedish letters in yticks

2014-08-24 Thread Vlastimil Brom
2014-08-25 0:03 GMT+02:00 Johan Ekh ekh.jo...@gmail.com:
 Hi all

 I try to use yticks as

 plt.yticks(y_pos, projDescr)

 where projDescr is a list of strings that contains some swedish letters,
 i.e. åäö, but they are not printed correctly. I have googled but can not
 fins a solution. Can someone point me in the right direction?

 Best regards,
 Johan

Hi,
I am not sure, whether this is the same problem I encountered with
Czech diacritics in matplotlib some time ago, but it definitively
looks similar to me.
You can check the respective thread and the mentioned workaround there:
http://matplotlib.1069221.n5.nabble.com/font-setting-in-matplotlib-1-3-1-td42662.html

Basically, it seems to be a problem with font selection with regard to
Bitstream Vera;
a workaround consist in manipulating rcParams and removing this item
from the list of usable fonts.
hth,
  vbr

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] font setting in matplotlib 1.3.1

2014-01-27 Thread Vlastimil Brom
Many thanks for the fix as well as for the info!
I didn't know, there are built in fonts like this in matplotlib; this
would explain the issue - the character support of Bitstream Vera Sans
is indeed rather limited;
morover the special defaulting status of this font hopefully means,
that this shouldn't happen with other fonts, hence, I won't need to
account for other unknown fonts, as I was worried about initially.
Thanks again and regards
   vbr


2014-01-27 Michael Droettboom md...@stsci.edu:
 Thanks for the report.

 Indeed, you are correct in that the root of this problem is that Bitstream
 Vera Sans does not contain these characters, yet it is being selected
 erroneously.

 It does appear that there is a bug in the font selection algorithm, that
 Bitstream Vera Sans gets selected as a perfect match even when it is not
 the first font in the requested list.  Vera Sans ships with matplotlib and
 is the default fallback font, even though it is not installed as a system
 font on your computer.

 I have a fix here: https://github.com/matplotlib/matplotlib/pull/2771

 In the meantime, the solution you arrived at is the probably the best we can
 do for now.

 Mike


 On 01/27/2014 11:21 AM, Phil Elson wrote:

 Thanks for this Vlastimil, looks like there is either a subtlety beyond my
 font knowledge or a bug here - mdboom, did you have any ideas? Otherwise I
 think we need a github issue for this.

 Cheers,


 On 4 January 2014 19:37, Vlastimil Brom vlastimil.b...@gmail.com wrote:

 Hi all,
 after upgrading to matplotlib 1.3.1, I noticed some display errors on
 the plots with regard to accented characters (such as carons etc.).
 As I recall, I had similar problem in the past and could work around
 them by modifying rcParams, however, this fix doesn't work as expected
 in 1.3.1. (with python 2.7.6, 32bit on Win 7, Czech - with both WXAgg
 and TKAgg backends).
 From the usual Czech diacritics   áčďéěíňóřšťúůýž some are not
 displayed  (ďěňřťů) - replacement squares are shown instead.

 Simply prepending a suitable font at the beginning of the list
 rcParams['font.sans-serif'] doesn't help in 1.3.1.
 I eventually found out, that Bitstream Vera Sans (which is not
 installed on this computer) is somehow offending - as long as this
 item is in the list (even at the end), the mentioned characters aren't
 displayed.

 The problem can be observed in the following simple pylab script:
 ==
 #! Python
 # -*- coding: utf-8 -*-

 # with implicit fonts ďěňřťů are not displayed properly in the plot
 title
 from matplotlib import rcParams
 rcParams['font.family'] = 'sans-serif'
 if Bitstream Vera Sans in rcParams['font.sans-serif']:
 rcParams['font.sans-serif'].remove(Bitstream Vera Sans)

 # after appending the offending font even at the end of the list (by
 uncommenting the following line), ďěňřťů are not displayed again
 # rcParams['font.sans-serif'].append(Bitstream Vera Sans)

 import pylab
 pylab.title(uabcd áčďéěíňóřšťúůýž äöüß ê xyz)
 pylab.show()
 ==

 Is there something special in the resolution of the font items in
 rcParams?
 This individual issue seems to be fixed with removing the single font,
 but I'd like to understand this more generally, as the installed fonts
 on different computers differ.

 Thanks in advance
   Vlastimil Brom


 --
 Rapidly troubleshoot problems before they affect your business. Most IT
 organizations don't have a clear picture of how application performance
 affects their revenue. With AppDynamics, you get 100% visibility into your
 Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics
 Pro!

 http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 CenturyLink Cloud: The Leader in Enterprise Cloud Services.
 Learn Why More Businesses Are Choosing CenturyLink Cloud For
 Critical Workloads, Development Environments  Everything In Between.
 Get a Quote or Start a Free Trial Today.
 http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk



 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



 --
_
 |\/|o _|_  _. _ | | \.__  __|__|_|_  _  _ ._ _
 |  ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |

 http://www.droettboom.com


 --
 CenturyLink Cloud: The Leader in Enterprise Cloud Services.
 Learn Why More Businesses Are Choosing CenturyLink Cloud For
 Critical Workloads, Development Environments  Everything In Between.
 Get a Quote

Re: [Matplotlib-users] Graphing in an existing PyGTK window

2013-08-19 Thread Vlastimil Brom
2013/8/19 Paul D. DeRocco pdero...@ix.netcom.com:
 I've just tried Matplotlib for the first time, for plotting on the screen,
 and the examples all seem to pop up a new window with interactive tools,
 like Matlab does. That's very nice, but what I need is to create a static
 plot that appears in some sort of widget in an existing window created
 with PyGTK, without any of the controls. Is there a page that shows how
 this can be done? Is it even possible?

 --

 Ciao,   Paul D. DeRocco
 Paulmailto:pdero...@ix.netcom.com

Hi,
to reuse the matplotlib controls or just the plotting area, check the
examples on embedding in the demo pages:
http://matplotlib.org/examples/user_interfaces/embedding_in_gtk.html
or the others in the respective section:
http://matplotlib.org/examples/user_interfaces/index.html
(I don't use gtk myself, but I believe, it might be directly usable in
your code.)

hth,
  vbr

--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] creating an object oriented matplotlib figure

2013-01-16 Thread Vlastimil Brom
2013/1/16 Kelson Zawack k...@cornell.edu:
 I want to create a matplotlib figure as part of a program I am writing
 and therefore would like to create the figure in a fully object oriented
 way, ie not in the pyplot state-full way.  I understand how to work with
 a figure object to create axes objects and then fill the axes objects
 with primitive artists but I can't figure out what type of object to put
 the figure object in to get it displayed.  From digging around in the
 source it looks like the show() method comes from the backend, but when
 I looked in 'matplotlib/backends/backend_agg' I saw no such object.
 What am I missing?  I guess I could put the figure in a Qt window, but I
 like the functionality provided by the default matplotlib window.

 Thanks for the help


Hi,
if you need an embedded figure in some gui app (supported with
matplotlib backends),
you may check some demos on this topic:
http://matplotlib.org/examples/user_interfaces/index.html
embedding_in_ ... (gtk, tk, qt, wx)
You can also reuse the gui elements such as toolbar etc.
I have no experience with qt, but apparently, there is an example for this:
http://matplotlib.org/examples/user_interfaces/embedding_in_qt4_wtoolbar.html
Or is it some more specific problem, you are encountering?

hth,
   vbr

--
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Figures piling up in Tkinter GUI (1.2.0rc2)

2012-11-02 Thread Vlastimil Brom
2012/11/1 Hans Bering hans.ber...@arcor.de:
 Hello everybody,

 I'm building a small Tkinter GUI using matplotlib, in which I have to
 change/update plots quite often depending on user input (with different
 contents  sizes, in different places in the GUI, etc.; but always only
 one figure at a time).

 As a first resort, I regenerated the figures with plt.figure(...) whenever
 necessary; unfortunately, the program happily accumulated memory with
 every new figure until the computer would no longer cooperate in a timely
 fashion. The following minimal script should demonstrate the tendency:

...
 Now I am wondering if I am missing some detail, e.g., some other clean-up
 procedure? Or should this work  could be a memory leak in matplotlib or
 Tkinter? And/or is this approach (of generating a new figure every time)
 not recommended in the first place? I tried reusing the figure, but some
 aspects like changing the layout in the GUI and applying new size and dpi
 then proved tricky in their own ways.

 Many thanks in advance,
 Hans

Hi,
I'd recommend to use an embedded plot and only clear and replace its
content (rather than tu use pyplot and recreate the figure multiple
times. I believe, changing of the figure should be possible too.

see e.g. the sample for tkinter
http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html

I only roughly adapted that source to use your function and the memory
usage appears to be more effective (although there is some increase
too - as displayed in Process Explorer). Would some variation of the
following work for you?

hth,
  vbr


#!/usr/bin/env python

import matplotlib
matplotlib.use('TkAgg')
import math

from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
from matplotlib.figure import Figure

import Tkinter

root = Tkinter.Tk()
root.wm_title(Embedding in TK)

fig = Figure(figsize=(5,4), dpi=100)
ax = fig.add_subplot(111)

canvas = FigureCanvasTkAgg(fig, master=root)
canvas.show()
canvas.get_tk_widget().pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)

toolbar = NavigationToolbar2TkAgg( canvas, root )
toolbar.update()
canvas._tkcanvas.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1)

plotShift = 0
def replot():
global plotShift, a, f
ax.clear()
xVals = xrange(100)
ax.plot(xVals, [math.sin(x + plotShift) for x in xVals])
fig.canvas.draw()
plotShift += 10

button = Tkinter.Button(master=root, text='replot', command=replot)
button.pack(side=Tkinter.BOTTOM)
Tkinter.mainloop()

--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] reusing the pylab gui in a custom application (wxpython)?

2012-07-31 Thread Vlastimil Brom
2012/7/31 Benjamin Root ben.r...@ou.edu:


 On Sun, Jul 29, 2012 at 7:39 PM, Vlastimil Brom vlastimil.b...@gmail.com
 wrote:

 2012/7/30 Benjamin Root ben.r...@ou.edu:
 
 
  On Sunday, July 29, 2012, Vlastimil Brom wrote:
 
  Hi all,
  I'd like to ask about the possibility to eventually reuse the gui of
  pylab for showing and manipulating the plots in the custom application
  (written in wxpython).
  [...]
  Thanks in advance for any hints
regards
   Vlastimil Brom
 
 
  Absolutely! It is one of the things mpl does best. Do a search in the
  online
  documentation for embedding codex.
 
  I hope that helps!
 
  Ben Root

 Thanks for the quick response and a useful hint!

 I apparently didn't search for the right terms before...
 I turns out, that

 http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
 shows exactly, what I need.

 By the way is there a place to propose a small correction of the example
 code?
 namely
 self.SetBackgroundColour(wx.NamedColor(WHITE))

 causes an error in wxpython 2.9, which removed the ...Color aliases
 and only knows ...Colour
 hence:

 self.SetBackgroundColour(wx.NamedColour(WHITE))

 works in wxpython 2.9 and should be backwards compatible too.

 Thanks again,
 vbr


 Thanks for catching that mistake.  Unfortunately, we don't do a good enough
 job of keeping up to date on changes in various backends.  The best way to
 make sure that gets fixed is to send us a pull request on github.  At the
 very least, post an issue report on it.

 Ben

Thanks, I created an issue:
https://github.com/matplotlib/matplotlib/issues/1048
about this and also tried to send the pull requests about the four
wx.NamedColor occurrences I could find.
Unfortunately, I haven't any experiences with code management tools
and github infrastructure, I didn't mess something up.

Regards,
  vbr

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] reusing the pylab gui in a custom application (wxpython)?

2012-07-29 Thread Vlastimil Brom
Hi all,
I'd like to ask about the possibility to eventually reuse the gui of
pylab for showing and manipulating the plots in the custom application
(written in wxpython).
Basically, I'd like to add some application specific controls to the
toolbar, or to place the existing gui to a custom frame, which would
add such additional controls (slider, buttons, etc.)
I looked at ...
Python27\Lib\site-packages\matplotlib\backends\backend_wx.py , but
couldn't find any way to access this windows in custom code.
Would it be possible at all, or are there other options? Is there
maybe some equivalent class/module etc. which could be reused or
adapted?
Or is the only way to reimplement the functionality writing my  own
plot gui (or to have the additionally needed controls in a separate
window, which doesn't look very elegant, but could probably work).

Thanks in advance for any hints
  regards
 Vlastimil Brom

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] reusing the pylab gui in a custom application (wxpython)?

2012-07-29 Thread Vlastimil Brom
2012/7/30 Benjamin Root ben.r...@ou.edu:


 On Sunday, July 29, 2012, Vlastimil Brom wrote:

 Hi all,
 I'd like to ask about the possibility to eventually reuse the gui of
 pylab for showing and manipulating the plots in the custom application
 (written in wxpython).
 [...]
 Thanks in advance for any hints
   regards
  Vlastimil Brom


 Absolutely! It is one of the things mpl does best. Do a search in the online
 documentation for embedding codex.

 I hope that helps!

 Ben Root

Thanks for the quick response and a useful hint!

I apparently didn't search for the right terms before...
I turns out, that
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
shows exactly, what I need.

By the way is there a place to propose a small correction of the example code?
namely
self.SetBackgroundColour(wx.NamedColor(WHITE))

causes an error in wxpython 2.9, which removed the ...Color aliases
and only knows ...Colour
hence:

self.SetBackgroundColour(wx.NamedColour(WHITE))

works in wxpython 2.9 and should be backwards compatible too.

Thanks again,
vbr

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot() not using alpha value from RGBA tuple

2011-08-16 Thread Vlastimil Brom
2011/8/16 Eric Firing efir...@hawaii.edu:
 On 07/25/2011 08:21 AM, Ben Breslauer wrote:
 I think that I have found the problem here.  Line2D.draw() (and I
 presume other Artist subclasses) calls

 gc.set_foreground(self._color)
 ...
 gc.set_alpha(self._alpha)

 self._color is defined by the color kwarg, whether it be a hex value,
 3-tuple, 4-tuple, or something else.  self._alpha is defined by the
 alpha kwarg, but if the alpha kwarg is None, it is not overwritten with
 color[3].  Therefore, using color=(R,G,B,A) does not set alpha
 correctly.  I'm not sure the best (i.e. most matplotlib-like) way to
 change this so that the A value gets used iff alpha is None, but I've
 attached a patch that does it one way (diff'ed against the github
 master, commit 67b1cd650f574f9c53ce).  I know the patch is less than
 ideal, as it adds kwarg-specific handling into a place where none had
 previously been done, and it's also in a for loop. Maybe it would be
 better to do the checking along with the scalex and scaley pops?


 Alpha handling is a real can of worms; it has gotten better, but as you
 note, there are still problems.  Unfortunately, I don't think your
 proposed solution will work in general, because self._color could be a
 4-letter string, like gray, in which case alpha would be set to y,
 and that would not be good at all.  I suspect the right place to solve
 the problem is down in the GraphicsContext--although I thought I had
 already straightened that out some time ago.
...

 Eric



 Separately, I noticed that
 backend_bases.GraphicsContextBase.set_foreground claims to only expect
 an RGB definition, and not an RGBA definition.  As such, I think that it
 should call

 self._rgb = colors.colorConverter.to_rgb(fg)

 instead of

 self._rgb = colors.colorConverter.to_rgba(fg)

 since that will make self._rgb a 3-tuple instead of a 4-tuple.

 Ben
 ...

Just a remark for this recent proposed patch, as I unfortunately don't
know the implications for the whole codebase.
I believe, that the condition added in the patch
if len(line._color) == 4 and line._alpha == None:
could be adjusted to e.g.:
if isinstance(line._color, tuple) and len(line._color) == 4 and
line._alpha == None

If the alpha value can be set in the color-tuple (for #RRGGBBAA some
parsing would be needed, if it is accepted).
Possibly the _alpha should be replace with tha alpha value of the
colour passed this way like
http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.ColorConverter.to_rgba
If arg is an RGBA sequence and alpha is not None, alpha will replace
the original A.

But as has been suggested already, it might be better adressed in some
more general way, than in this single function.

 regards,
  vbr

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib backends - WXAgg vs. WX

2011-08-15 Thread Vlastimil Brom
2011/8/15 Michael Droettboom md...@stsci.edu:
 On 08/14/2011 11:28 AM, Vlastimil Brom wrote:
 ...
 Is there maybe some mechanism available in matplotlib, which would
 select the appropriate font for the given characters? (Like in wx or,
 even more powerful in tk?) Or is it the expected way to set the
 suitable font individually, as only the font list in rcParams are
 tried sequentially - regardless of the character support?
 That's correct: matplotlib doesn't currently do this.  It renders a
 particular string of text with a single font and does not do font
 substitution for characters that are not in that font.  The best
 practice is to use a font that contains the full set of characters, such
 as Arial or Deja Vu as you've discovered.

 There a lot of other i18n shortcomings to the way matplotlib supports
 text (such as a lack of bidi support).  That's a large wheel to
 reinvent, so the solution would involve using a third-party text layout
 library such as pango, but I know there is licensing friction against
 that.  It may be worth revisiting that at some point.

 Mike


Thanks for the confirmation, I'll stick with this apporoach, as I
didn't manage to fix the code for wx backend on the newest version
(cf. above). Given the status of the non-Agg backends it might be more
appropriate.

Regards,
   vbr

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib backends - WXAgg vs. WX

2011-08-14 Thread Vlastimil Brom
2011/8/14 Eric Firing efir...@hawaii.edu:
 On 08/13/2011 01:11 PM, Vlastimil Brom wrote:
 Hi all,
 I'd like to ask a probably basic qustion about backends in matplotlib
 - specifically with regard to WXAgg and WX.
 What are the differences of the two, and what are the supposed
 usecases, and maybe restrictions for them?

 http://matplotlib.sourceforge.net/faq/installing_faq.html#backends

 WXAgg is WX for window and widgets, but with all figure rendering done
 using the Agg library to generate an image which is then displayed as
 such by WX.  There is the same sort of pair for gtk: gtkagg and plain
 gtk.  Only the *agg interactive backends are fully supported; it is
 expected that not everything will work with the non-agg interactive
 backends, and every now and then there is discussion of whether they
 should be eliminated for that reason.  Their only advantage, as far as I
 know, is that under some circumstances, such as working remotely with X
 on a slow link, the non-agg backends may be faster.


 Using matplotlib/pylab pylab in a rather basic way I encountered
 problems with both backends and would like to clarify the differences
 before i try to find a fix.

 using wxAgg I am not able to display unicode text (some accents,
 non-latin scripts etc. e.g. in pylab.title(...) and otherwhere .

 This is surprising; in general, unicode works with the *agg backends.
 Maybe plain WX is finding some fonts that WXAgg is not finding?

 Eric



Thanks for the reference and for the important info, that only wxagg
is considered fully supported as opposed to wx backend.
It appears, that in the current state, using the latest wxpython
2.9.2.1, it is indeed unusable, as no graph canvas is displayed at all
(at least on my setup - win 7, py-2.7), cf.:



#! Python
# -*- coding: utf-8 -*-

import wxversion
# wxversion.select('2.9.1') # 2.9.1.1 # plot ok
wxversion.select('2.9.2') # 2.9.2.1 # invalid transparent canvas
without any graph content
import wx

import matplotlib
matplotlib.use('WX')
import pylab

pylab.plot(range(3), range(3))
pylab.show()



Regarding wxagg, it seems, that the suggestion about unsuitable fonts
being used was correct;
after setting the font to Arial, adapted from:
http://matplotlib.sourceforge.net/examples/api/font_family_rc.html
all the characters in the title are displayed ok.


#! Python
# -*- coding: utf-8 -*-

import wxversion
wxversion.select('2.9.2') # 2.9.2.1
import wx

# setting the font to Arial - the title is displayed completely;
# with the default font only the latin-1 characters are shown
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Arial'] + rcParams['font.sans-serif']
#

import matplotlib
matplotlib.use('WXAgg')
import pylab

pylab.plot(range(3), range(3))
pylab.title(uabcd áčďéěíňóřšťúůýž äöüß ê αβγδ абвгд אבגד xyz)
pylab.show()


 (using python 2.7.2, MPL 1.0.1; Win 7, Czech)

Is there maybe some machanism available in matplotlib, which would
select the appropriate font for the given characters? (Like in wx or,
even more powerful in tk?) Or is it the expected way to set the
suitable font individually, as only the font list in rcParams are
tried sequentially - regardless of the character support?

Regards,
   vbr

--
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy 
to use, easy to manage, easy to install, easy to extend. 
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib backends - WXAgg vs. WX

2011-08-13 Thread Vlastimil Brom
Hi all,
I'd like to ask a probably basic qustion about backends in matplotlib
- specifically with regard to WXAgg and WX.
What are the differences of the two, and what are the supposed
usecases, and maybe restrictions for them?

Using matplotlib/pylab pylab in a rather basic way I encountered
problems with both backends and would like to clarify the differences
before i try to find a fix.

using wxAgg I am not able to display unicode text (some accents,
non-latin scripts etc. e.g. in pylab.title(...) and otherwhere .
Just changing:
matplotlib.use('WXAgg')
to
matplotlib.use('WX')
seemed to fix this, and the graph gui also looks more consistent with
my wxPython app.

However, using the current wxPython 2.9.2.1. (python 2.7.2, Win 7,
Czech) I see a more serious bug in the wx-backend (basically failing
to display the graph at all
(cf. http://sourceforge.net/mailarchive/message.php?msg_id=27902016 ),
which doesn't apply for WXAgg.

Coud someone maybe provide some hints, where I should look into to
understand the backend differences better?

Thanks in advance,

Regards,
Vlastimil Brom

--
FREE DOWNLOAD - uberSVN with Social Coding for Subversion.
Subversion made easy with a complete admin console. Easy 
to use, easy to manage, easy to install, easy to extend. 
Get a Free download of the new open ALM Subversion platform now.
http://p.sf.net/sfu/wandisco-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib/pylab problems with wxpython 2.9.2.1 -

2011-08-04 Thread Vlastimil Brom
Hi all,
I'd like to ask about some issues I am having with using matplotlib
with the latest wxpython version 2.9.1.1;
I already mentioned that on the wxpython list:
https://groups.google.com/forum/#!topic/wxpython-users/vG-5NJ4vXnc
but it is unclear whether this is a bug in wx or a possible problem
with the backend_wx which happened to be tolerated in wxpython
sofar.

Simple code using the WX backend seems to
work ok in 2.8.12.1 and 2.9.1.1 but not in 2.9.2.1.
The graph canvas is inactive and transparent - showing the
screen below this active frame; with resizing and moving this frame,
there are artefacts and display glitches and redrawing errors around
it, but the graph is not shown and there are no exceptions thrown.

(I am using Python 2.7.2, matplotlib 1.0.1; win 7 and Win XP; wxPython
32bit (unicode))



# # # # # # # # # # # pylab - wxPython  # # # # # # # # # # # # # # # # #

#! Python
# -*- coding: utf-8 -*-

import wxversion
# wxversion.select('2.8') # 2.8.12.1 ok
# wxversion.select('2.9.1') # 2.9.1.1 ok
wxversion.select('2.9.2') # 2.9.2.1 !! display errors in pylab

import wx

import matplotlib # http://matplotlib.sourceforge.net/

# matplotlib.use('WXAgg') # ok in both, wx 2.8 and 2.9.x
matplotlib.use('WX')

import pylab

pylab.plot(range(3), range(3), label=a)
pylab.show()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
A very simple version without pylab shows the same problem:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

#! Python
# -*- coding: utf-8 -*-

import wxversion
# wxversion.select('2.8')
wxversion.select('2.9.2')
import wx
import matplotlib
matplotlib.use('WX')
from matplotlib.backends.backend_wx import FigureCanvasWx as
FigureCanvas  # err on wx 2.9.2
# from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas # ok
from matplotlib.figure import Figure

class CanvasFrame(wx.Frame):
def __init__(self, ):
wx.Frame.__init__(self, None, -1, 'CanvasFrame', size=(550,350))
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
self.axes.plot(range(4),range(4))
self.figure_canvas = FigureCanvas(self, -1, self.figure)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.figure_canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)

if __name__=='__main__':
app = wx.App(False)
frm = CanvasFrame()
frm.Show(True)
app.MainLoop()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

It is likely to depending on
matplotlib.backends.backend_wx :: FigureCanvasWx (or some inherited
classes), but I had sofar no success in finding the problematic code.

Could you maybe give any pointer where to look into, or maybe how to
activate some exception tracebacks etc? (Changing _DEBUG = 5 in
...\matplotlib\backends\backend_wx.py to other values doesn't seem to
have this effect).

Thanks in advance,
vbr

--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users