Guest User

Untitled

a guest
Jun 22nd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. # Creating a comparison plot (.PairGrid()) of all my cities' and global data's average percent change in temperature
  2.  
  3. # Set up my figure by naming it 'pct_chg_yrly_fig', then call PairGrid on the DataFrame
  4. pct_chg_yrly_fig = sns.PairGrid(comp_pct_chg_df.dropna())
  5.  
  6. # Using map_upper we can specify what the upper triangle will look like.
  7. pct_chg_yrly_fig.map_upper(plt.scatter,color='purple')
  8.  
  9. # We can also define the lower triangle in the figure, including the plot type (KDE) or the color map (BluePurple)
  10. pct_chg_yrly_fig.map_lower(sns.kdeplot,cmap='cool_d')
  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
  16. pct_chg_yrly_fig.add_legend()
  17.  
  18. Here is the ValueError msg I'm receiving:
  19.  
  20. ValueError Traceback (most recent call last)
  21. <ipython-input-38-3fcf1b69d4ef> in <module>()
  22. 11
  23. 12 # Finally we'll define the diagonal as a series of histogram plots of the yearly average percent change in temperature
  24. ---> 13 pct_chg_yrly_fig.map_diag(plt.hist,histtype='step',linewidth=3,bins=30)
  25. 14
  26. 15 # Adding a legend
  27.  
  28. ~/anaconda3/lib/python3.6/site-packages/seaborn/axisgrid.py in map_diag(self, func, **kwargs)
  29. 1361
  30. 1362 if "histtype" in kwargs:
  31. -> 1363 func(vals, color=color, **kwargs)
  32. 1364 else:
  33. 1365 func(vals, color=color, histtype="barstacked", **kwargs)
  34.  
  35. ~/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)
  36. 3023 histtype=histtype, align=align, orientation=orientation,
  37. 3024 rwidth=rwidth, log=log, color=color, label=label,
  38. -> 3025 stacked=stacked, normed=normed, data=data, **kwargs)
  39. 3026 finally:
  40. 3027 ax._hold = washold
  41.  
  42. ~/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
  43. 1715 warnings.warn(msg % (label_namer, func.__name__),
  44. 1716 RuntimeWarning, stacklevel=2)
  45. -> 1717 return func(ax, *args, **kwargs)
  46. 1718 pre_doc = inner.__doc__
  47. 1719 if pre_doc is None:
  48.  
  49. ~/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in hist(***failed resolving arguments***)
  50. 6137 color = mcolors.to_rgba_array(color)
  51. 6138 if len(color) != nx:
  52. -> 6139 raise ValueError("color kwarg must have one color per dataset")
  53. 6140
  54. 6141 # If bins are not specified either explicitly or via range,
  55.  
  56. ValueError: color kwarg must have one color per dataset
Add Comment
Please, Sign In to add comment