![]() Let us create another scatter plot with different random numbers and the code snippet is given below: import numpy as np When you run the above code on your machine you will see the output as shown below: Let us go through the code snippet: import matplotlib.pyplot as plt Simple Scatter Plot Example:īelow we have a code snippet to create a simple scatter plot. Let us dive into some examples and create some scatter plots. ![]() This option indicates the blending value, between 0 (transparent) and 1 (opaque). This parameter is used to indicate the marker border-color and also it's default value is None. This parameter indicates the width of the marker border and having None as default value. This optional parameter indicates cmap name with default value equals to None. The default value of this parameter is None and it is also an optional parameter. This parameter is used to indicate the marker style. This parameter indicates the color of sequence and it is an optional parameter with default value equals to None. ![]() It is an optional parameter and the default value is None. This parameter indicates the marker size (it can be scalar or array of size equal to the size of x or y). This parameter indicates an array containing y-axis data. This parameter indicates an array containing x-axis data. ![]() Let us discuss the parameters of scatter() method: The syntax to use this method is given below: (x_axis_data, y_axis_data, s, c, marker, cmap, vmin, vmax,alpha,linewidths, edgecolors) The method scatter() in the pyplot module in matplotlib library of Python is mainly used to draw a scatter plot. In 2-Dimensions it is used to compare two variables while in 3-Dimensions it is used to make comparisons in three variables. These plots are mainly used to plot data points on the horizontal and vertical axis in order to show how much one variable is affected by another. Scatter plots make use of dots to represent the relationship between two variables. This plot is mainly used to observe the relationship between the two variables. The Scatter plot is a type of plot that is used to show the data as a collection of points. In this tutorial, we will cover what is a scatter plot? and how to create a scatter plot to present your data using Matplotlib library. update_layout ( geo = dict ( scope = 'north america', showland = True, landcolor = "rgb(212, 212, 212)", subunitcolor = "rgb(255, 255, 255)", countrycolor = "rgb(255, 255, 255)", showlakes = True, lakecolor = "rgb(255, 255, 255)", showsubunits = True, showcountries = True, resolution = 50, projection = dict ( type = 'conic conformal', rotation_lon = - 100 ), lonaxis = dict ( showgrid = True, gridwidth = 0.5, range =, dtick = 5 ), lataxis = dict ( showgrid = True, gridwidth = 0.5, range =, dtick = 5 ) ), title = 'US Precipitation 06-30-2015Source: NOAA', ) fig. astype ( str ) + ' inches', marker = dict ( color = df, colorscale = scl, reversescale = True, opacity = 0.7, size = 2, colorbar = dict ( titleside = "right", outlinecolor = "rgba(68, 68, 68, 0)", ticks = "outside", showticksuffix = "last", dtick = 0.1 ) ) )) fig. Scattergeo ( lat = df, lon = df, text = df. Import aph_objects as go import pandas as pd df = pd. update_layout ( title = 'Most trafficked US airports(Hover for airport names)', geo = dict ( scope = 'usa', projection_type = 'albers usa', showland = True, landcolor = "rgb(250, 250, 250)", subunitcolor = "rgb(217, 217, 217)", countrycolor = "rgb(217, 217, 217)", countrywidth = 0.5, subunitwidth = 0.5 ), ) fig. max (), colorbar_title = "Incoming flightsFebruary 2011" ))) fig. Scattergeo ( locationmode = 'USA-states', lon = df, lat = df, text = df, mode = 'markers', marker = dict ( size = 8, opacity = 0.8, reversescale = True, autocolorscale = False, symbol = 'square', line = dict ( width = 1, color = 'rgba(102, 102, 102)' ), colorscale = 'Blues', cmin = 0, color = df, cmax = df.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |