-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: categorical scatter plot #34293
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d8d8c3c
add legend with colors if coloring by categorical
MarcoGorelli a167313
add legend with colors if coloring by categorical
MarcoGorelli d10c5c1
add legend with colors if coloring by categorical
MarcoGorelli 7294aa2
add legend with colors if coloring by categorical
MarcoGorelli 50cd05f
add legend with colors if coloring by categorical
MarcoGorelli 4579142
add legend with colors if coloring by categorical
MarcoGorelli 6d3fe9e
add test
MarcoGorelli 3846804
revert empty line
MarcoGorelli ef4b03d
discrete colorbar in case of ordered categorical
MarcoGorelli cf218f7
cleanup
MarcoGorelli 7aae164
cleanup
MarcoGorelli 0ab903d
plot colorbar in both cases
MarcoGorelli b93ddf1
update test
MarcoGorelli 5fbc117
update test
MarcoGorelli 572ecfc
Merge remote-tracking branch 'upstream/master' into categorical-scatter
MarcoGorelli b2a8b28
:art:
MarcoGorelli efaaae6
Merge remote-tracking branch 'upstream/master' into categorical-scatter
MarcoGorelli b0a8cfa
simplify logic
MarcoGorelli 4c15a83
whatsnew entry
MarcoGorelli b65b103
Merge remote-tracking branch 'upstream/master' into categorical-scatter
MarcoGorelli 6560bb0
Merge remote-tracking branch 'upstream/master' into categorical-scatter
MarcoGorelli cce3461
add example to visualisation
MarcoGorelli 6e01091
add versionadded tag
MarcoGorelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1190,6 +1190,16 @@ def test_scatterplot_object_data(self): | |
_check_plot_works(df.plot.scatter, x="a", y="b") | ||
_check_plot_works(df.plot.scatter, x=0, y=1) | ||
|
||
def test_scatterplot_color_by_categorical(self): | ||
df = pd.DataFrame( | ||
[[5.1, 3.5], [4.9, 3.0], [7.0, 3.2], [6.4, 3.2], [5.9, 3.0]], | ||
columns=["length", "width"], | ||
) | ||
df["species"] = pd.Categorical( | ||
["setosa", "setosa", "virginica", "virginica", "versicolor"] | ||
) | ||
_check_plot_works(df.plot.scatter, x=0, y=1, c="species") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there way within the test to check the legend is drawn and the appropriate colors are applied? |
||
|
||
@pytest.mark.slow | ||
def test_if_scatterplot_colorbar_affects_xaxis_visibility(self): | ||
# addressing issue #10611, to ensure colobar does not | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit but instead of
not is_categorical_dtype
can you leave this asis_categorcial_dtype
and switch the branches?