Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Groupby.plot enhancement #8018

Closed
wants to merge 1 commit into from
Closed

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Aug 13, 2014

Allow to support DataFrameGroupBy.plot and SeriesGroupBy.plot covering current DataFrame.hist(by=XXX) and DataFrame.boxplot(by=XXX) usecases. Implementation is incomplete but covering most of usecases / behaviours.

Following gist contains all patterns of outputs.

Rendered doc

untitled 3

@sinhrks sinhrks force-pushed the plot_groupby branch 3 times, most recently from 2e9ecd4 to ee2eb22 Compare January 20, 2015 13:54
@jreback jreback modified the milestone: Next Major Release Mar 2, 2015
@sinhrks sinhrks force-pushed the plot_groupby branch 6 times, most recently from b5849bb to f7b72e1 Compare April 17, 2015 22:27
@sinhrks sinhrks force-pushed the plot_groupby branch 2 times, most recently from 7091c84 to 54fed1c Compare May 13, 2015 14:58
@sinhrks sinhrks force-pushed the plot_groupby branch 3 times, most recently from cbae226 to 6cb50c2 Compare May 20, 2015 12:14
@sinhrks sinhrks force-pushed the plot_groupby branch 2 times, most recently from 3ee3af6 to fa27914 Compare July 16, 2015 12:04
@jreback
Copy link
Contributor

jreback commented Jul 28, 2015

@sinhrks is this stale?

@sinhrks
Copy link
Member Author

sinhrks commented Jul 29, 2015

@jreback Let me revisit after #9814 which does some internal changes.

@sinhrks sinhrks force-pushed the plot_groupby branch 3 times, most recently from eed95d4 to c163639 Compare July 30, 2015 16:19
@sinhrks sinhrks modified the milestones: 0.18.0, 0.17.0 Sep 13, 2015
@shoyer
Copy link
Member

shoyer commented Sep 13, 2015

@sinhrks We haven't quite finished the faceting API for xray, but basically the idea is to copy it from Seaborn. Plot methods accept arguments like row, col and col_span which control which how to create facets. We'll have a FacetGrid API for low level control, but the main user facing API will still be convenience methods like .plot.

We could copy this API for pandas. But again, Seaborn already does it -- and does it well. In theory, we might even wrap Seaborn's FacetGrid for this stuff, e.g., df.plot('x', 'y', row='foo', col='bar') -> sns.FacetGrid(df, row='foo', col='bar').map(plt.plot, 'x', 'y'). However there would pretty assuredly be some API breaks.

@sinhrks
Copy link
Member Author

sinhrks commented Sep 15, 2015

@shoyer I don't mean to implement full functionality like seaborn.

I think our goal is to migrate current DataFrame.hist, boxplot and scatter_plot 's grouping functionality to DataFrame.plot in a simple / easy way.

@jreback
Copy link
Contributor

jreback commented Nov 20, 2015

@sinhrks state of this?

Plotting with Grouped Data
--------------------------

.. versionadded:: 0.17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to 0.18

@jreback
Copy link
Contributor

jreback commented Dec 9, 2015

@sinhrks

so a couple of possibilities here:

  1. copy seaborn API as much as possible from FacetGrid. This would be familiar and provides a nice soln.
  2. simply defer to seaborn and make it an optional dep (to clarify I mean to have a reasonable pandas API that really just does the import of seaborn and pipes almost directly, with very little pandas code on the impl side).
  3. like 2), but provide this via an engine='seaborn' keyword.

I actually like 3) as the start of pandas removing all plotting code and defering to matplotlib/seaborn/bokeh as the default (note that we might need a set of configuration options to ultimately control this), but for now we can simply have an engine='seaborn' kw here.

So since this is 'new' functionaility I dont' see a need to have a engine='pandas' kw to control the exiting groupby plotting behavior (unless I am missing something here).

cc @tacaswell
cc @mdboom
cc @mwaskom
cc @pzwang
cc @bryevdv

@mwaskom
Copy link
Contributor

mwaskom commented Dec 9, 2015

I would be in favor of option 1.

@jreback
Copy link
Contributor

jreback commented Jan 24, 2016

@sinhrks status of this?

@tacaswell
Copy link
Contributor

I am also in favor of 1.

Is there anyway to tweak the API to return a dictionary mapping the groupby index -> the artist that is plotting it? That will make writing interactive functionality against these plots much easier.

@jreback jreback modified the milestones: Next Major Release, 0.18.0 Feb 2, 2016
@jreback jreback removed this from the Next Major Release milestone Mar 13, 2016
@jreback
Copy link
Contributor

jreback commented May 7, 2016

@sinhrks status?

@jreback
Copy link
Contributor

jreback commented May 20, 2016

@sinhrks @TomAugspurger @jorisvandenbossche

status on this?

@jreback
Copy link
Contributor

jreback commented Sep 9, 2016

status?

@jreback
Copy link
Contributor

jreback commented Nov 22, 2016

@sinhrks status on this?

@jreback
Copy link
Contributor

jreback commented Dec 21, 2016

what's status here?

@sinhrks is this viable

@jreback
Copy link
Contributor

jreback commented Jan 21, 2017

status of this?

@jreback
Copy link
Contributor

jreback commented Mar 20, 2017

closing as stale, but @sinhrks pls reopen if you want / can fix.

@jreback jreback closed this Mar 20, 2017
@sinhrks
Copy link
Member Author

sinhrks commented Mar 20, 2017

Sorry for the stale. I'll re-organize the preferable spec and re-submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants