Seaborn issue with catplot












0














I was following the code in the new seaborn 0.9.0 release as displayed on the site and I got an error when typing in the following code. The code came from the bottom of this page https://seaborn.pydata.org/tutorial/categorical.html



import seaborn as sns
tips = sns.load_dataset("tips")
sns.catplot(x="day", y="total_bill", hue="smoker",
col="time", aspect=.6,
kind="swarm", data=tips);


This is the output from running the above code. I have tried creating a new environment and everything has been updated. I still do not know why it is not working.



---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-21-c1ae50b18a54> in <module>
3 sns.catplot(x="day", y="total_bill", hue="smoker",
4 col="time", aspect=.6,
----> 5 kind="swarm", data=tips);
6 get_ipython().run_line_magic('version_information', '')

~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
3753
3754 # Draw the plot onto the facets
-> 3755 g.map_dataframe(plot_func, x, y, hue, **plot_kws)
3756
3757 # Special case axis labels for a count type plot

~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in map_dataframe(self, func, *args, **kwargs)
818
819 # Draw the plot
--> 820 self._facet_plot(func, ax, args, kwargs)
821
822 # Finalize the annotations and layout

~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in _facet_plot(self, func, ax, plot_args, plot_kwargs)
836
837 # Draw the plot
--> 838 func(*plot_args, **plot_kwargs)
839
840 # Sort out the supporting information

~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in swarmplot(x, y, hue, data, order, hue_order, dodge, orient, color, palette, size, edgecolor, linewidth, ax, **kwargs)
2989 linewidth=linewidth))
2990
-> 2991 plotter.plot(ax, kwargs)
2992 return ax
2993

~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in plot(self, ax, kws)
1444 def plot(self, ax, kws):
1445 """Make the full plot."""
-> 1446 self.draw_swarmplot(ax, kws)
1447 self.add_legend_data(ax)
1448 self.annotate_axes(ax)

~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in draw_swarmplot(self, ax, kws)
1404 kws.update(c=point_colors)
1405 if self.orient == "v":
-> 1406 points = ax.scatter(cat_pos, swarm_data, s=s, **kws)
1407 else:
1408 points = ax.scatter(swarm_data, cat_pos, s=s, **kws)

~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1803 "the Matplotlib list!)" % (label_namer, func.__name__),
1804 RuntimeWarning, stacklevel=2)
-> 1805 return func(ax, *args, **kwargs)
1806
1807 inner.__doc__ = _add_data_doc(inner.__doc__,

~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
4193 isinstance(c, str) or
4194 (isinstance(c, collections.Iterable) and
-> 4195 isinstance(c[0], str))):
4196 c_array = None
4197 else:

IndexError: index 0 is out of bounds for axis 0 with size 0









share|improve this question



























    0














    I was following the code in the new seaborn 0.9.0 release as displayed on the site and I got an error when typing in the following code. The code came from the bottom of this page https://seaborn.pydata.org/tutorial/categorical.html



    import seaborn as sns
    tips = sns.load_dataset("tips")
    sns.catplot(x="day", y="total_bill", hue="smoker",
    col="time", aspect=.6,
    kind="swarm", data=tips);


    This is the output from running the above code. I have tried creating a new environment and everything has been updated. I still do not know why it is not working.



    ---------------------------------------------------------------------------
    IndexError Traceback (most recent call last)
    <ipython-input-21-c1ae50b18a54> in <module>
    3 sns.catplot(x="day", y="total_bill", hue="smoker",
    4 col="time", aspect=.6,
    ----> 5 kind="swarm", data=tips);
    6 get_ipython().run_line_magic('version_information', '')

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
    3753
    3754 # Draw the plot onto the facets
    -> 3755 g.map_dataframe(plot_func, x, y, hue, **plot_kws)
    3756
    3757 # Special case axis labels for a count type plot

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in map_dataframe(self, func, *args, **kwargs)
    818
    819 # Draw the plot
    --> 820 self._facet_plot(func, ax, args, kwargs)
    821
    822 # Finalize the annotations and layout

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in _facet_plot(self, func, ax, plot_args, plot_kwargs)
    836
    837 # Draw the plot
    --> 838 func(*plot_args, **plot_kwargs)
    839
    840 # Sort out the supporting information

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in swarmplot(x, y, hue, data, order, hue_order, dodge, orient, color, palette, size, edgecolor, linewidth, ax, **kwargs)
    2989 linewidth=linewidth))
    2990
    -> 2991 plotter.plot(ax, kwargs)
    2992 return ax
    2993

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in plot(self, ax, kws)
    1444 def plot(self, ax, kws):
    1445 """Make the full plot."""
    -> 1446 self.draw_swarmplot(ax, kws)
    1447 self.add_legend_data(ax)
    1448 self.annotate_axes(ax)

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in draw_swarmplot(self, ax, kws)
    1404 kws.update(c=point_colors)
    1405 if self.orient == "v":
    -> 1406 points = ax.scatter(cat_pos, swarm_data, s=s, **kws)
    1407 else:
    1408 points = ax.scatter(swarm_data, cat_pos, s=s, **kws)

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
    1803 "the Matplotlib list!)" % (label_namer, func.__name__),
    1804 RuntimeWarning, stacklevel=2)
    -> 1805 return func(ax, *args, **kwargs)
    1806
    1807 inner.__doc__ = _add_data_doc(inner.__doc__,

    ~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
    4193 isinstance(c, str) or
    4194 (isinstance(c, collections.Iterable) and
    -> 4195 isinstance(c[0], str))):
    4196 c_array = None
    4197 else:

    IndexError: index 0 is out of bounds for axis 0 with size 0









    share|improve this question

























      0












      0








      0







      I was following the code in the new seaborn 0.9.0 release as displayed on the site and I got an error when typing in the following code. The code came from the bottom of this page https://seaborn.pydata.org/tutorial/categorical.html



      import seaborn as sns
      tips = sns.load_dataset("tips")
      sns.catplot(x="day", y="total_bill", hue="smoker",
      col="time", aspect=.6,
      kind="swarm", data=tips);


      This is the output from running the above code. I have tried creating a new environment and everything has been updated. I still do not know why it is not working.



      ---------------------------------------------------------------------------
      IndexError Traceback (most recent call last)
      <ipython-input-21-c1ae50b18a54> in <module>
      3 sns.catplot(x="day", y="total_bill", hue="smoker",
      4 col="time", aspect=.6,
      ----> 5 kind="swarm", data=tips);
      6 get_ipython().run_line_magic('version_information', '')

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
      3753
      3754 # Draw the plot onto the facets
      -> 3755 g.map_dataframe(plot_func, x, y, hue, **plot_kws)
      3756
      3757 # Special case axis labels for a count type plot

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in map_dataframe(self, func, *args, **kwargs)
      818
      819 # Draw the plot
      --> 820 self._facet_plot(func, ax, args, kwargs)
      821
      822 # Finalize the annotations and layout

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in _facet_plot(self, func, ax, plot_args, plot_kwargs)
      836
      837 # Draw the plot
      --> 838 func(*plot_args, **plot_kwargs)
      839
      840 # Sort out the supporting information

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in swarmplot(x, y, hue, data, order, hue_order, dodge, orient, color, palette, size, edgecolor, linewidth, ax, **kwargs)
      2989 linewidth=linewidth))
      2990
      -> 2991 plotter.plot(ax, kwargs)
      2992 return ax
      2993

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in plot(self, ax, kws)
      1444 def plot(self, ax, kws):
      1445 """Make the full plot."""
      -> 1446 self.draw_swarmplot(ax, kws)
      1447 self.add_legend_data(ax)
      1448 self.annotate_axes(ax)

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in draw_swarmplot(self, ax, kws)
      1404 kws.update(c=point_colors)
      1405 if self.orient == "v":
      -> 1406 points = ax.scatter(cat_pos, swarm_data, s=s, **kws)
      1407 else:
      1408 points = ax.scatter(swarm_data, cat_pos, s=s, **kws)

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
      1803 "the Matplotlib list!)" % (label_namer, func.__name__),
      1804 RuntimeWarning, stacklevel=2)
      -> 1805 return func(ax, *args, **kwargs)
      1806
      1807 inner.__doc__ = _add_data_doc(inner.__doc__,

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
      4193 isinstance(c, str) or
      4194 (isinstance(c, collections.Iterable) and
      -> 4195 isinstance(c[0], str))):
      4196 c_array = None
      4197 else:

      IndexError: index 0 is out of bounds for axis 0 with size 0









      share|improve this question













      I was following the code in the new seaborn 0.9.0 release as displayed on the site and I got an error when typing in the following code. The code came from the bottom of this page https://seaborn.pydata.org/tutorial/categorical.html



      import seaborn as sns
      tips = sns.load_dataset("tips")
      sns.catplot(x="day", y="total_bill", hue="smoker",
      col="time", aspect=.6,
      kind="swarm", data=tips);


      This is the output from running the above code. I have tried creating a new environment and everything has been updated. I still do not know why it is not working.



      ---------------------------------------------------------------------------
      IndexError Traceback (most recent call last)
      <ipython-input-21-c1ae50b18a54> in <module>
      3 sns.catplot(x="day", y="total_bill", hue="smoker",
      4 col="time", aspect=.6,
      ----> 5 kind="swarm", data=tips);
      6 get_ipython().run_line_magic('version_information', '')

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in catplot(x, y, hue, data, row, col, col_wrap, estimator, ci, n_boot, units, order, hue_order, row_order, col_order, kind, height, aspect, orient, color, palette, legend, legend_out, sharex, sharey, margin_titles, facet_kws, **kwargs)
      3753
      3754 # Draw the plot onto the facets
      -> 3755 g.map_dataframe(plot_func, x, y, hue, **plot_kws)
      3756
      3757 # Special case axis labels for a count type plot

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in map_dataframe(self, func, *args, **kwargs)
      818
      819 # Draw the plot
      --> 820 self._facet_plot(func, ax, args, kwargs)
      821
      822 # Finalize the annotations and layout

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/axisgrid.py in _facet_plot(self, func, ax, plot_args, plot_kwargs)
      836
      837 # Draw the plot
      --> 838 func(*plot_args, **plot_kwargs)
      839
      840 # Sort out the supporting information

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in swarmplot(x, y, hue, data, order, hue_order, dodge, orient, color, palette, size, edgecolor, linewidth, ax, **kwargs)
      2989 linewidth=linewidth))
      2990
      -> 2991 plotter.plot(ax, kwargs)
      2992 return ax
      2993

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in plot(self, ax, kws)
      1444 def plot(self, ax, kws):
      1445 """Make the full plot."""
      -> 1446 self.draw_swarmplot(ax, kws)
      1447 self.add_legend_data(ax)
      1448 self.annotate_axes(ax)

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/seaborn/categorical.py in draw_swarmplot(self, ax, kws)
      1404 kws.update(c=point_colors)
      1405 if self.orient == "v":
      -> 1406 points = ax.scatter(cat_pos, swarm_data, s=s, **kws)
      1407 else:
      1408 points = ax.scatter(swarm_data, cat_pos, s=s, **kws)

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
      1803 "the Matplotlib list!)" % (label_namer, func.__name__),
      1804 RuntimeWarning, stacklevel=2)
      -> 1805 return func(ax, *args, **kwargs)
      1806
      1807 inner.__doc__ = _add_data_doc(inner.__doc__,

      ~/anaconda3/envs/python3/lib/python3.7/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
      4193 isinstance(c, str) or
      4194 (isinstance(c, collections.Iterable) and
      -> 4195 isinstance(c[0], str))):
      4196 c_array = None
      4197 else:

      IndexError: index 0 is out of bounds for axis 0 with size 0






      python-3.x matplotlib seaborn






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 3:01









      M_L_

      31




      31
























          1 Answer
          1






          active

          oldest

          votes


















          0














          This is unfortunately a bug in matplotlib 3.0.1. It's been reported here and fixed by pull/12673.



          Options you have are to install either matplotlib 3.0.0 or 3.0.2.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385592%2fseaborn-issue-with-catplot%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This is unfortunately a bug in matplotlib 3.0.1. It's been reported here and fixed by pull/12673.



            Options you have are to install either matplotlib 3.0.0 or 3.0.2.






            share|improve this answer


























              0














              This is unfortunately a bug in matplotlib 3.0.1. It's been reported here and fixed by pull/12673.



              Options you have are to install either matplotlib 3.0.0 or 3.0.2.






              share|improve this answer
























                0












                0








                0






                This is unfortunately a bug in matplotlib 3.0.1. It's been reported here and fixed by pull/12673.



                Options you have are to install either matplotlib 3.0.0 or 3.0.2.






                share|improve this answer












                This is unfortunately a bug in matplotlib 3.0.1. It's been reported here and fixed by pull/12673.



                Options you have are to install either matplotlib 3.0.0 or 3.0.2.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 at 3:13









                ImportanceOfBeingErnest

                125k10127204




                125k10127204






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385592%2fseaborn-issue-with-catplot%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    Origin of the phrase “under your belt”?