-
Notifications
You must be signed in to change notification settings - Fork 32
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
plot histogram with class bins #216
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #216 +/- ##
=======================================
+ Coverage 89.4% 89.6% +0.1%
=======================================
Files 8 8
Lines 1088 1101 +13
=======================================
+ Hits 973 986 +13
Misses 115 115
|
Nice, I like this and the idea of moving legendgram as well. I would probably just try to add only maptlotlib as optional dependency. You can easily use |
cool will do. considered dropping the seaborn from the beginning, but despine really makes a difference in how the plot appears to me. Can drop it and add a test |
I don't think we need ax.spines.right.set_visible(False)
ax.spines.top.set_visible(False) from https://matplotlib.org/3.4.3/gallery/ticks_and_spines/spines_dropped.html |
oh right :P thanks |
plt.hist doesnt take or return an axes though (so the ax.vline doesn't work and isn't as composable otherwise). I think I'll keep it as pandas unless you have a different implementation? |
Like this rng = np.random.default_rng(seed=0)
normal = rng.normal(size=1000)
fig, ax = plt.subplots()
ax.hist(normal)
lim = ax.get_ylim()[1]
ax.vlines(-1, 0, lim, color="k")
ax.spines.right.set_visible(False)
ax.spines.top.set_visible(False) |
ah, i see. I was doing plt.hist not ax.hist. Thanks! |
for more information, see https://pre-commit.ci
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.
fancy!
wanted to gauge interest in adding a method to Classifier that plots the histogram of
y
with class bins a la desktop GISpandas and seaborn are optional dependencies but usually available in a pysal environment. If we take the coloring logic from #211 I think the legendgram could also be a method on Classifier (without depending on palettable), which would be pretty handy. Will add a test if folks are interested