On Tue, Sep 8, 2009 at 11:51 AM, Yann
Goudard<matplotlib-us...@alleeduweb.eu> wrote:
> Hi,
>
> I have the same behaviour with LocatableAxes. HostAxes, ParasiteAxes and
> LocatableAxes depend on 'mpl_toolkits.axes_grid.axislines.Axes'. It must
> be the matter origin.

Yes, and this was because I forgot to implement some necessary methods.
This is now fixed in the svn trunk. So if you can,please give it a try.

> This another example should draw a grid but does not:
>
> import wx
> from wx import Frame
> from matplotlib.backends.backend_wxagg import FigureFrameWxAgg,
> FigureCanvasWxAgg
> from matplotlib.figure import Figure
> from mpl_toolkits.axes_grid.axes_divider import LocatableAxes
>
> fig = Figure((1, 1), 50)
> axes = LocatableAxes(fig, [0, 0, 1, 1])
> # axes.toggle_axisline(False)
> axes.grid(True)
> fig.add_axes(axes)
>
> app = wx.PySimpleApp()
> my_viewer = FigureFrameWxAgg(-1, fig)
> my_viewer.Show()
> app.MainLoop()
>
> If you uncomment axes.toggle_axisline(False), it works cause it uses
> normal 'matplolib.axes.Axes' behaviour. It is not a matter for common
> use but if you need 'AxesZero', this trick does not work.

What the toggle_axisline does is simply to make the xaxis and yaxis
(which are responsible for drawing ticks, ticklabels, etc  in the
mainline mpl) visible again, and make axis["bottom"] and etc
invisible.
One workaround is to make xaxis and yaxis visible but pnly to draw the
gridlines. Something like below.

ax.toggle_axisline(True)
ax.grid(True)
ax.gridlines.set_visible(False) # this is just to make the code not to
draw gridlines twice in future release of mpl.
ax.xaxis.set_visible(True)
ax.yaxis.set_visible(True)
for t in ax.xaxis.majorTicks + ax.yaxis.majorTicks:
    t.gridOn = True
    t.tick1On = False
    t.tick2On = False
    t.label1On = False
    t.label2On = False

Let me know if this does not work, or there is a case that this cannot be used.
Regards,

-JJ


>
> Yann
>
>
> On 09/07/2009 10:37 PM, Andreas Fromm wrote:
>> thanks Sebastian,
>>
>> you are right, your code works here too. But i don't get it work in my
>> multi y-axes plot from the matplotlib examples
>> (http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes.html).
>> Even with linear plots, i get no gridlines.
>>
>> Any idea, whats wrong here?
>>
>> minimal code example:
>> #######################
>> import matplotlib.pyplot as plt
>> from mpl_toolkits.axes_grid.parasite_axes import HostAxes, ParasiteAxes
>>
>> fig = plt.figure(1)
>> fig.clf()
>> #plt.grid(True)
>> host = HostAxes(fig, [0.15, 0.1, 0.65, 0.8])
>> fig.add_axes(host)
>>
>> host.plot([0, 10, 100], [0, 10, 100], label='host')
>>
>> host.grid(True)  #?
>> host.yaxis.grid(True) #?
>>
>> host.yaxis.set_scale('log') #?
>>
>> plt.draw()
>> plt.show()
>> #######################
>>
>> Greets,
>> Andreas
>>
>>
>> Sebastian Busch schrieb:
>>
>>> from matplotlib.pyplot import *
>>>
>>> plot([1,10,100],[1,10,100])
>>> grid()
>>>
>>> yscale('log')
>>> xscale('log')
>>>
>>> works here.
>>>
>>> best,
>>> sebastian.
>>>
>>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to