unable to draw text at angles other than 0 or 90

Hello,
Concernig the source code of my previous post, the use of "ax.set_title('Volumic definition')" generate the following message:
/opt/IPASTEST/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py:150: UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90
  'other than 0 or 90')
I thought that by default the drawing requested by my instruction set_title is 0
Thank you for your suggestions

Alain,

Only the AGG-based backends can display rotated text. Is there a particular reason why you are using GDK backend? Since you are doing Gtk programming, I would recommend using GTKAgg.

Ben Root

···

On Thursday, August 11, 2011, WALTER Alain <alain.walter@…3719…> wrote:

Hello,
Concernig the source code of my previous post, the use of “ax.set_title(‘Volumic definition’)” generate the following message:

/opt/IPASTEST/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py:150: UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90
‘other than 0 or 90’)
I thought that by default the drawing requested by my instruction set_title is 0

Thank you for your suggestions

Hi Ben,
I don't want to display rotate text ! I just need to display a simple text to my figure :
  ax.text(onevolume['long'][i],onevolume['lat'][i],onevolume['upper'][i],onevolume['point'][i],color=linecolor)
In addition, I do not understand your remark about GDK, If I remember, I need to use the following modules because FigureCanvas and NavigationToolbar are required.
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar

Anyway I cannot reproduce the warning, it is a little bit strange !
Thank you

···

________________________________________
De : ben.v.root@...287... [ben.v.root@...287...] de la part de Benjamin Root [ben.root@...1304...]
Date d'envoi : jeudi 11 août 2011 16:05
À : WALTER Alain
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] unable to draw text at angles other than 0 or 90

On Thursday, August 11, 2011, WALTER Alain <alain.walter@…3719…<mailto:alain.walter@…3719…>> wrote:

Hello,
Concernig the source code of my previous post, the use of "ax.set_title('Volumic definition')" generate the following message:
/opt/IPASTEST/lib/python2.7/site-packages/matplotlib/backends/backend_gdk.py:150: UserWarning: backend_gdk: unable to draw text at angles other than 0 or 90
'other than 0 or 90')
I thought that by default the drawing requested by my instruction set_title is 0
Thank you for your suggestions

Alain,

Only the AGG-based backends can display rotated text. Is there a particular reason why you are using GDK backend? Since you are doing Gtk programming, I would recommend using GTKAgg.

Ben Root

Disregard what I said earlier. I didn’t see that you were not trying to rotate your text in the first place.

What is an example value for “onevolume[‘point’][i]”? The function signature for ax.text() is that the first 2 positional arguments are the coordinates, the third is the string to display (I would presume that “onevolume[‘upper’][i]” has something to do with the text you are displaying). However, the “onevolume[‘point’][i]” is in the position for the fontdict parameter of the function call. This dictionary overrides the default text properties, which I believe include properties like the rotation angle.

Ben Root

···

On Thu, Aug 11, 2011 at 11:21 AM, WALTER Alain <alain.walter@…3719…> wrote:

Hi Ben,

I don’t want to display rotate text ! I just need to display a simple text to my figure :

    ax.text(onevolume['long'][i],onevolume['lat'][i],onevolume['upper'][i],onevolume['point'][i],color=linecolor)

In addition, I do not understand your remark about GDK, If I remember, I need to use the following modules because FigureCanvas and NavigationToolbar are required.

from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas

from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar

Anyway I cannot reproduce the warning, it is a little bit strange !

Thank you

You're right I'm not clear. You thought I' am using text() from matplotlib but If I'm looking to the text() invocation from the module Axes3D:
         Axes3D.text(x, y, z, s, zdir=None, **kwargs)¶
         Add text to the plot. kwargs will be passed on to Axes.text, except for the zdir keyword, which sets the direction to be used as the z direction.
In my case:
      ax. text(23.1, 14.0, 340.0, 'ABETI', color='red')
Anyway, now I've replaced GTK backend by GTKagg backend, and Everything seems better.
Alan

···

________________________________________
De : ben.v.root@...287... [ben.v.root@...287...] de la part de Benjamin Root [ben.root@...1304...]
Date d'envoi : jeudi 11 août 2011 19:54
À : WALTER Alain
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: RE : [Matplotlib-users] unable to draw text at angles other than 0 or 90

On Thu, Aug 11, 2011 at 11:21 AM, WALTER Alain <alain.walter@…3719…<mailto:alain.walter@…3719…>> wrote:
Hi Ben,
I don't want to display rotate text ! I just need to display a simple text to my figure :
       ax.text(onevolume['long'][i],onevolume['lat'][i],onevolume['upper'][i],onevolume['point'][i],color=linecolor)
In addition, I do not understand your remark about GDK, If I remember, I need to use the following modules because FigureCanvas and NavigationToolbar are required.
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar

Anyway I cannot reproduce the warning, it is a little bit strange !
Thank you

Disregard what I said earlier. I didn't see that you were not trying to rotate your text in the first place.

What is an example value for "onevolume['point'][i]"? The function signature for ax.text() is that the first 2 positional arguments are the coordinates, the third is the string to display (I would presume that "onevolume['upper'][i]" has something to do with the text you are displaying). However, the "onevolume['point'][i]" is in the position for the fontdict parameter of the function call. This dictionary overrides the default text properties, which I believe include properties like the rotation angle.

Ben Root

Ah, that explains everything! Because text on an axes3d object has to be projected to 2d, it uses simple AGG text rotation behind the scenes to achieve that effect (rather than actually performing the expensive tedious calculations to fully project it). So, even though you are not rotating the text, mplot3d is.

Good to know that switching to GTKAgg fixed everything.

Ben Root

···

On Friday, August 12, 2011, WALTER Alain <alain.walter@…3719…> wrote:

You’re right I’m not clear. You thought I’ am using text() from matplotlib but If I’m looking to the text() invocation from the module Axes3D:

    Axes3D.text(x, y, z, s, zdir=None, **kwargs)¶
    Add text to the plot. kwargs will be passed on to Axes.text, except for the zdir keyword, which sets the direction to be used as the z direction.

In my case:
ax. text(23.1, 14.0, 340.0, ‘ABETI’, color=‘red’)
Anyway, now I’ve replaced GTK backend by GTKagg backend, and Everything seems better.
Alan

I wonder if it’s worthwhile throwing a warning when mplot3d is used
in conjunction with the Gtk backend?

Mike
···

http://p.sf.net/sfu/wandisco-dev2dev


Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users