Closed aryaz42 closed 6 years ago
Strange? Do you have .matplotlibrc or other hidden commands?
The same issue here. I'm running daft from jupyter and my matplotlib version is 2.2.2 on windows. No customization, just installed a new env from conda-forge.
Interestingly, if I add the annotation manually, I don't see the blue background.
import daft
pgm = daft.PGM([4, 2])
pgm.add_node(daft.Node("Yi", r"$Y_I$", 1, 1))
pgm.add_node(daft.Node("a", r"$\mathbf{a}$", 2.8, 1))
pgm.add_edge("a", "Yi")
#pgm.add_plate(daft.Plate([0.1, 0.5, 1.9, 1],label=r'$N$'))
pgm.add_plate(daft.Plate([0.1, 0.5, 1.9, 1]))
pgm._ctx.ax().annotate("$i = 1,2,...,N$", [0.4,1.2])
pgm.render()
that is a clue. Inside the code, do we use an annotate command?
Yes, on line 595:
https://github.com/dfm/daft/blob/e0d20534f5ce8ef6bb6bb79877500b4353fa357c/daft.py#L595
It can be the rest of the parameters, I haven't tested yet.
can you try explicitly adding a facecolor=none and things like that in the annotate command? I think it takes the arguments listed here, but I am not sure!!
https://matplotlib.org/api/_as_gen/matplotlib.patches.PathPatch.html#matplotlib.patches.PathPatch
Actually, the bug is somewhere in the bbox parameter of annotate. If I pass dict({})
- daft default - I get the blue box, if I pass None
it's fine. I'm thinking of a workaround. I was trying to pass bbox=None
to the Plate
constructor but that doesn't work because there's a dict(bbox)
line in the initializer which fails with a None
value.
If you can find us a modification to that annotate()
call in the code that protects this, let me know; we will push the change.
I've created a pull request.
Plate labels end up having a blue background for me. For example when I run the classic.py file from the examples folder, I get this: