Absolute spacing for embedded figure

Hi,

I'm currently using Qwt to display a plot in a GUI application, but I'd like
to replace it with matplotlib and a shell window, so that the user can not
only view the plot but also modify it in-place using pyplot commands.

One thing I'd like to do is to adjust the spacing surrounding the plot to be
constant, regardless of the window size. Since the plot window is resized
often, it is impossible to use very small subplot params and a waste of
viewing space to use larger ones when the window is maximized.

Is there a way to make the figure use absolute params like "20 pixels/points"?

Second, less important question: is there a way to give default font properties
(like weight="bold") for axis labels?

Third, I normally get my data one point at a time. Is there a more efficient
way to insert single data points in existing plots than doing
set_xdata/set_ydata?

Thanks,
Georg

···

--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

Hi,

I'm currently using Qwt to display a plot in a GUI application, but I'd like
to replace it with matplotlib and a shell window, so that the user can not
only view the plot but also modify it in-place using pyplot commands.

One thing I'd like to do is to adjust the spacing surrounding the plot to be
constant, regardless of the window size. Since the plot window is resized
often, it is impossible to use very small subplot params and a waste of
viewing space to use larger ones when the window is maximized.

Is there a way to make the figure use absolute params like "20 pixels/points"?

Axes in matplotlib uses normalized figure coordinates. Therefore, you
have to convert your dimension (say 20 points) into normalized figure
coordinates, and you need to do it whenever your the figure size
changes.

There are ways to do this, but no easy way like
subplots_adjust(left="20 points").

One way is to use axes_divider.py that I recently added In the example
directory (in the svn trunk).

import matplotlib.pyplot as plt
from axes_divider import LocatableAxes, Divider, Size

fig1 = plt.figure(1)

pad=0.8 # inch
v=[Size.Fixed(pad), Size.Scalable(1.),Size.Fixed(pad)]
h=[Size.Fixed(pad), Size.Scalable(1.),Size.Fixed(pad)]
divider = Divider(fig1, [0, 0, 1, 1],
                  horizontal=v, vertical=h)
locator = divider.new_locator(nx=1, ny=1)

# axes
ax = LocatableAxes(fig1, divider.get_position())
ax.set_axes_locator(locator)
fig1.add_axes(ax)
plt.draw()

Second, less important question: is there a way to give default font properties
(like weight="bold") for axis labels?

Unfortunately not, although font size and font color can be set using rcParams.

-JJ

···

On Sun, Dec 21, 2008 at 1:30 PM, Georg Brandl <g.brandl@...361...> wrote:

Third, I normally get my data one point at a time. Is there a more efficient
way to insert single data points in existing plots than doing
set_xdata/set_ydata?

Thanks,
Georg

--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options