Open TinoDerb opened 2 weeks ago
df.groupby("layer").plot(x='x', y='y', ax=plt.gca(), kind='line', color='blue'). DEFINE COLOR EXPICITLY BY PASSING COLOR PARAMETER IN THE FUNCTION PLOT BECAUSE WHEN WE USE groupby(layer) it divides the plot data in groups and uses default matplotlib color cycle to different groups sets
@abhisin-07 Hey, it seems you didn't really read the issue. The desired results is to have the automatic matplotlib color cycle for kind='scatter'
, just like when plotting with kind='line'
.
P.S.: no need for all caps :)
Hmm, with the line plot, even the color is correct, the legend is problematic.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[x] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
I was trying to write an asnwer on stackoverflow and I noticed the following behaviour:
Using
df.groupby("layer").plot(x='x', y='y', ax= plt.gca(), kind='line')
changes the color of every new group automatically.This is however not seen when using
kind="scatter"
.I think my version is a bit older than the latest one, but I could not find any similar issue on github.
Expected Behavior
I expect that the color should also change for the scatter kind. For this, here is the output of the following code:
Installed Versions