"""This example demonstrates the ' Ggplot ' style, which adjusts the style toemulate ggplot_ (a popular plotting package fo R r_). These settings were shamelessly stolen from [1]_ (with permission) ... [1] http://www.huyng.com/posts/sane-color-scheme-for-matplotlib/. _ggplot:http://had.co.nz/ggplot/. _r:http://www.r-project.org/"""ImportNumPy as NPImportMatplotlib.pyplot as Pltplt.style.use ('Ggplot') FIG, axes= Plt.subplots (ncols=2, nrows=2) Ax1, Ax2, ax3, ax4=Axes.ravel ()#Scatter plot (note: ' Plt.scatter ' doesn ' t use default colors)X, y = Np.random.normal (size= (2, 200)) Ax1.plot (x, Y,'o')#sinusoidal lines with colors from default color cycleL =Np.pix=np.linspace (0, L) ncolors= Len (plt.rcparams['axes.color_cycle']) Shift= Np.linspace (0, L, ncolors, endpoint=False) forSinchshift:ax2.plot (x, Np.sin (x+ s),'-') ax2.margins (0)#Bar Graphsx = Np.arange (5) y1, y2= Np.random.randint (1, size= (2, 5)) Width= 0.25Ax3.bar (x, y1, width) ax3.bar (x+ width, y2, width, color=plt.rcparams['axes.color_cycle'][2]) ax3.set_xticks (x+width) ax3.set_xticklabels (['a','b','C','D','e'])#circles with colors from default color cycle forI, colorinchEnumerate (plt.rcparams['axes.color_cycle']): XY= Np.random.normal (size=2) Ax4.add_patch (PLT. Circle (xy, Radius=0.3, color=color)) Ax4.axis ('Equal') ax4.margins (0) plt.show ()
I like this flat chart.
A style that looks good in matplotlib.pyplot