Skip to content

imcompatible between pandas barh plot and ultraplot #731

@cmyangcn

Description

@cmyangcn

When I generated the axes using ultraplot and then tried to barh plot using pandas, an error occurred.

df=pd.Series({'a': 1, 'b': 2, 'c': 3})
fig,axs=uplt.subplots(nrows=1, ncols=1, figsize=(6,5))
df.plot(kind='barh', ax=axs[0])

AttributeError Traceback (most recent call last)
Cell In[116], line 3
1 df=pd.Series({'a': 1, 'b': 2, 'c': 3})
2 fig,axs=uplt.subplots(nrows=1, ncols=1, figsize=(6,5))
----> 3 df.plot(kind='barh', ax=axs[0])

File c:\Users\user\anaconda3\Lib\site-packages\pandas\plotting_core.py:1030, in PlotAccessor.call(self, *args, **kwargs)
1027 label_name = label_kw or data.columns
1028 data.columns = label_name
-> 1030 return plot_backend.plot(data, kind=kind, **kwargs)

File c:\Users\user\anaconda3\Lib\site-packages\pandas\plotting_matplotlib_init_.py:71, in plot(data, kind, **kwargs)
69 kwargs["ax"] = getattr(ax, "left_ax", ax)
70 plot_obj = PLOT_CLASSES[kind](data, **kwargs)
---> 71 plot_obj.generate()
72 plot_obj.draw()
73 return plot_obj.result

File c:\Users\user\anaconda3\Lib\site-packages\pandas\plotting_matplotlib\core.py:501, in MPLPlot.generate(self)
499 self._compute_plot_data()
500 fig = self.fig
--> 501 self._make_plot(fig)
502 self._add_table()
503 self._make_legend()
...
-> 3671 if not x.size or not y.size:
3672 return
3673 kwargs, vert = _get_vert(**kwargs)

AttributeError: 'int' object has no attribute 'size'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions