python matplotlab.pyplot.scatter() 函数的用法
生活随笔
收集整理的這篇文章主要介紹了
python matplotlab.pyplot.scatter() 函数的用法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
引用文章1: PYthon——plt.scatter各參數詳解
https://blog.csdn.net/qiu931110/article/details/68130199
引用文章2: python matplotlib.pyplot.scatter() 中的cmap參數是什么意思?
https://blog.csdn.net/Dontla/article/details/99777573
官方doc:
Signature: plt.scatter(x,y,s=None,c=None,marker=None,cmap=None,norm=None,vmin=None,vmax=None,alpha=None,linewidths=None,verts=None,edgecolors=None,*,plotnonfinite=False,data=None,**kwargs, ) Docstring: A scatter plot of *y* vs *x* with varying marker size and/or color.Parameters ---------- x, y : array_like, shape (n, )The data positions.s : scalar or array_like, shape (n, ), optionalThe marker size in points**2.Default is ``rcParams['lines.markersize'] ** 2``.c : color, sequence, or sequence of color, optionalThe marker color. Possible values:- A single color format string.- A sequence of color specifications of length n.- A sequence of n numbers to be mapped to colors using *cmap* and*norm*.- A 2-D array in which the rows are RGB or RGBA.Note that *c* should not be a single numeric RGB or RGBA sequencebecause that is indistinguishable from an array of values to becolormapped. If you want to specify the same RGB or RGBA value forall points, use a 2-D array with a single row. Otherwise, value-matching will have precedence in case of a size matching with *x*and *y*.Defaults to ``None``. In that case the marker color is determinedby the value of ``color``, ``facecolor`` or ``facecolors``. In casethose are not specified or ``None``, the marker color is determinedby the next color of the ``Axes``' current "shape and fill" colorcycle. This cycle defaults to :rc:`axes.prop_cycle`.marker : `~matplotlib.markers.MarkerStyle`, optionalThe marker style. *marker* can be either an instance of the classor the text shorthand for a particular marker.Defaults to ``None``, in which case it takes the value of:rc:`scatter.marker` = 'o'.See `~matplotlib.markers` for more information about marker styles.cmap : `~matplotlib.colors.Colormap`, optional, default: NoneA `.Colormap` instance or registered colormap name. *cmap* is onlyused if *c* is an array of floats. If ``None``, defaults to rc``image.cmap``.norm : `~matplotlib.colors.Normalize`, optional, default: NoneA `.Normalize` instance is used to scale luminance data to 0, 1.*norm* is only used if *c* is an array of floats. If *None*, usethe default `.colors.Normalize`.vmin, vmax : scalar, optional, default: None*vmin* and *vmax* are used in conjunction with *norm* to normalizeluminance data. If None, the respective min and max of the colorarray is used. *vmin* and *vmax* are ignored if you pass a *norm*instance.alpha : scalar, optional, default: NoneThe alpha blending value, between 0 (transparent) and 1 (opaque).linewidths : scalar or array_like, optional, default: NoneThe linewidth of the marker edges. Note: The default *edgecolors*is 'face'. You may want to change this as well.If *None*, defaults to rcParams ``lines.linewidth``.edgecolors : {'face', 'none', *None*} or color or sequence of color, optional.The edge color of the marker. Possible values:- 'face': The edge color will always be the same as the face color.- 'none': No patch boundary will be drawn.- A Matplotlib color or sequence of color.Defaults to ``None``, in which case it takes the value of:rc:`scatter.edgecolors` = 'face'.For non-filled markers, the *edgecolors* kwarg is ignored andforced to 'face' internally.plotnonfinite : boolean, optional, default: FalseSet to plot points with nonfinite *c*, in conjunction with`~matplotlib.colors.Colormap.set_bad`.Returns ------- paths : `~matplotlib.collections.PathCollection`Other Parameters ---------------- **kwargs : `~matplotlib.collections.Collection` propertiesSee Also -------- plot : To plot scatter plots when markers are identical in size andcolor.Notes -----* The `.plot` function will be faster for scatterplots where markersdon't vary in size or color.* Any or all of *x*, *y*, *s*, and *c* may be masked arrays, in whichcase all masks will be combined and only unmasked points will beplotted.* Fundamentally, scatter works with 1-D arrays; *x*, *y*, *s*, and *c*may be input as 2-D arrays, but within scatter they will beflattened. The exception is *c*, which will be flattened only if itssize matches the size of *x* and *y*... note::In addition to the above described arguments, this function can take a**data** keyword argument. If such a **data** argument is given, thefollowing arguments are replaced by **data[<arg>]**:* All arguments with the following names: 'c', 'color', 'edgecolors', 'facecolor', 'facecolors', 'linewidths', 's', 'x', 'y'.Objects passed as **data** must support item access (``data[<arg>]``) andmembership test (``<arg> in data``). File: c:\users\huawei\appdata\local\programs\python\python36\lib\site-packages\matplotlib\pyplot.py Type: function總結
以上是生活随笔為你收集整理的python matplotlab.pyplot.scatter() 函数的用法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python numpy.array.m
- 下一篇: python numpy.arange(