Skip to content

theme_void() TypeError #424

Closed
Closed

Description

@x1o

Hi, I get a TypeError exception running this code (on this df):

ggplot(df) + \
    geom_tile(aes(x = 'x', y = 'y',  width = 1, height = 1, fill = 'value')) + \
    theme_void()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
    700                 type_pprinters=self.type_printers,
    701                 deferred_pprinters=self.deferred_printers)
--> 702             printer.pretty(obj)
    703             printer.flush()
    704             return stream.getvalue()

~/.local/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj)
    397                         if cls is not object \
    398                                 and callable(cls.__dict__.get('__repr__')):
--> 399                             return _repr_pprint(obj, self, cycle)
    400 
    401             return _default_pprint(obj, self, cycle)

~/.local/lib/python3.6/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
    687     """A pprint that just redirects to the normal repr function."""
    688     # Find newlines and replace them with p.break_()
--> 689     output = repr(obj)
    690     for idx,output_line in enumerate(output.splitlines()):
    691         if idx:

~/.local/lib/python3.6/site-packages/plotnine/ggplot.py in __repr__(self)
     86         # in the jupyter notebook.
     87         if not self.figure:
---> 88             self.draw()
     89         plt.show()
     90         return '<ggplot: (%d)>' % self.__hash__()

~/.local/lib/python3.6/site-packages/plotnine/ggplot.py in draw(self, return_ggplot)
    179         # new frames knowing that they are separate from the original.
    180         with pd.option_context('mode.chained_assignment', None):
--> 181             return self._draw(return_ggplot)
    182 
    183     def _draw(self, return_ggplot=False):

~/.local/lib/python3.6/site-packages/plotnine/ggplot.py in _draw(self, return_ggplot)
    210             if self.figure is not None:
    211                 plt.close(self.figure)
--> 212             raise err
    213 
    214         if return_ggplot:

~/.local/lib/python3.6/site-packages/plotnine/ggplot.py in _draw(self, return_ggplot)
    202                 self._draw_labels()
    203                 self._draw_breaks_and_labels()
--> 204                 self._draw_legend()
    205                 self._draw_title()
    206                 self._draw_watermarks()

~/.local/lib/python3.6/site-packages/plotnine/ggplot.py in _draw_legend(self)
    421         Draw legend onto the figure
    422         """
--> 423         legend_box = self.guides.build(self)
    424         if not legend_box:
    425             return

~/.local/lib/python3.6/site-packages/plotnine/guides/guides.py in build(self, plot)
    142             return
    143 
--> 144         gboxes = self.draw(gdefs, plot.theme)
    145         bigbox = self.assemble(gboxes, gdefs, plot.theme)
    146         return bigbox

~/.local/lib/python3.6/site-packages/plotnine/guides/guides.py in draw(self, gdefs, theme)
    284             g.theme = theme
    285             g._set_defaults()
--> 286         return [g.draw() for g in gdefs]
    287 
    288     def assemble(self, gboxes, gdefs, theme):

~/.local/lib/python3.6/site-packages/plotnine/guides/guides.py in <listcomp>(.0)
    284             g.theme = theme
    285             g._set_defaults()
--> 286         return [g.draw() for g in gdefs]
    287 
    288     def assemble(self, gboxes, gdefs, theme):

~/.local/lib/python3.6/site-packages/plotnine/guides/guide_colorbar.py in draw(self)
    152         # 1.45 makes the default colourbar wider than the
    153         # legend entry boxes.
--> 154         width = (self.barwidth or _d('legend_key_width')) * 1.45
    155         height = (self.barheight or _d('legend_key_height')) * 1.45
    156         height *= 5

TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

plotnine version: 0.7.0

Activity

  1. added 2 commits that reference this issue on Aug 6, 2020
    3a3bf2d
    1fbe9ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions