fabiopardo/tonic

Plotting bug

Closed this issue · 1 comments

Hi, renderer from plot.py kept returning None and as a result I kept getting this error:

AttributeError: 'NoneType' object has no attribute 'points_to_pixels'

To fix it, I just commented out these lines:

        renderer = legend_ax.get_renderer_cache()
        h_packer = legend.get_children()[0].get_children()[1]
        target_width = h_packer.get_extent(renderer)[0]
        current_width = sum(
            [ch.get_extent(renderer)[0] for ch in h_packer.get_children()])
        if target_width > 1.3 * current_width:
            break

Then plotting seemed to work fine, but may I ask, what do those lines do? The figure looks fine without them.

Hi do you use the latest version of Tonic and Matplotlib? If you still get the problem you can try to change the backend argument. Those lines are not essential if you do not have several agents in the legend simultaneously. Their goal is to automatically find the right number of columns.