Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Creating a comparison plot (.PairGrid()) of all my cities' and global data's average percent change in temperature
- # Set up my figure by naming it 'pct_chg_yrly_fig', then call PairGrid on the DataFrame
- pct_chg_yrly_fig = sns.PairGrid(comp_pct_chg_df.dropna())
- # Using map_upper we can specify what the upper triangle will look like.
- pct_chg_yrly_fig.map_upper(plt.scatter,color='purple')
- # We can also define the lower triangle in the figure, including the plot type (KDE) or the color map (BluePurple)
- pct_chg_yrly_fig.map_lower(sns.kdeplot,cmap='cool_d')
- # Finally we'll define the diagonal as a series of histogram plots of the yearly average percent change in temperature
- pct_chg_yrly_fig.map_diag(plt.hist,histtype='step',linewidth=3,bins=30)
- # Adding a legend
- pct_chg_yrly_fig.add_legend()
- Here is the ValueError msg I'm receiving:
- ValueError Traceback (most recent call last)
- <ipython-input-38-3fcf1b69d4ef> in <module>()
- 11
- 12 # Finally we'll define the diagonal as a series of histogram plots of the yearly average percent change in temperature
- ---> 13 pct_chg_yrly_fig.map_diag(plt.hist,histtype='step',linewidth=3,bins=30)
- 14
- 15 # Adding a legend
- ~/anaconda3/lib/python3.6/site-packages/seaborn/axisgrid.py in map_diag(self, func, **kwargs)
- 1361
- 1362 if "histtype" in kwargs:
- -> 1363 func(vals, color=color, **kwargs)
- 1364 else:
- 1365 func(vals, color=color, histtype="barstacked", **kwargs)
- ~/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py in hist(x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, normed, hold, data, **kwargs)
- 3023 histtype=histtype, align=align, orientation=orientation,
- 3024 rwidth=rwidth, log=log, color=color, label=label,
- -> 3025 stacked=stacked, normed=normed, data=data, **kwargs)
- 3026 finally:
- 3027 ax._hold = washold
- ~/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
- 1715 warnings.warn(msg % (label_namer, func.__name__),
- 1716 RuntimeWarning, stacklevel=2)
- -> 1717 return func(ax, *args, **kwargs)
- 1718 pre_doc = inner.__doc__
- 1719 if pre_doc is None:
- ~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in hist(***failed resolving arguments***)
- 6137 color = mcolors.to_rgba_array(color)
- 6138 if len(color) != nx:
- -> 6139 raise ValueError("color kwarg must have one color per dataset")
- 6140
- 6141 # If bins are not specified either explicitly or via range,
- ValueError: color kwarg must have one color per dataset
Add Comment
Please, Sign In to add comment