daft-dev / daft

Render probabilistic graphical models using matplotlib
https://docs.daft-pgm.org
MIT License
675 stars 118 forks source link

Labels on the Plate object are no longer blue #107

Closed tmcclintock closed 5 years ago

tmcclintock commented 5 years ago

This PR fixes the closed issue #102 by making the bbox dictionary used to color the label in the Plate object have color set to none. Also, this argument did not have a docstring previously, and that has now been added. If you want, you can move the default setting into the function signature.

dsfulf commented 5 years ago

This doesn't actually fix the issue. The plate occurs blue only when kwargs are passed to bbox, because the matplotlib call to draw the color fill plate is only made when the kwargs are not None. After some routing through matplotlib we end up here:

def _set_facecolor(self, color):
    if color is None:
        color = mpl.rcParams['patch.facecolor']
    alpha = self._alpha if self._fill else 0
    self._facecolor = colors.to_rgba(color, alpha)
    self.stale = True

And checking the default rc.Params files we find:

#patch.facecolor        : C0

Which is described as:

a "CN" color spec, i.e. 'C' followed by a single digit, which is an index into the default property cycle

i.e. C0 is the default color blue.

I addressed this issue by setting the facecolor to 'none' in the case where kwargs have been passed to bbox but bbox['fc'] has not been set.

dsfulf commented 5 years ago

This is resolved by #109.