chartbeat-labs / textacy

NLP, before and after spaCy
https://textacy.readthedocs.io
Other
2.22k stars 250 forks source link

Termite Plot cropping words #213

Closed radiantone closed 5 years ago

radiantone commented 6 years ago

The termite plot in 0.6.1 is cutting off the words on the y-axis

Expected Behavior

For all the Y labels to be visible

Current Behavior

Y labels are being cropped

Possible Solution

Steps to Reproduce (for bugs)

Code below

Context

Python 2.7, textacy 0.6.1, Zeppelin 0.7

Your Environment

Red Hat

import numpy as np
from textacy.viz.termite import draw_termite_plot

mat = np.array([[5, 4, 3, 2, 1],
                [4, 3, 2, 1, 0],
                [3, 2, 1, 0, 5],
                [2, 1, 0, 5, 4],
                [1, 0, 5, 4, 3]])

draw_termite_plot(mat,['A','B','C','D','E'],['word 1','word 2','word 3','word 4','word 5'],highlight_cols=range(0,3))

termite

bdewilde commented 5 years ago

Hi @radiantone , thanks for your patience and apologies for the delay, I've not had bandwidth for textacy dev work for a few months.

I've always had trouble debugging this sort of issue — matplotlib can be finicky! Unfortunately, I'm unable to reproduce it in my setup using either matplotlib 2.2 or 3.0:

screen shot 2018-12-02 at 1 42 12 pm

Could you add constrained_layout=True to this line where the plot's figure and axes are being initialized, and let me know if that fixes it?

bdewilde commented 5 years ago

Hi @radiantone , you've probably moved on from this, but just in case: today I merged in a PR (#248) that included changes to help address this, and there's a brand new v0.8.0 release with them included. I'm going to close this issue out, but please reopen if you're still stuck and unable to make it work.