![]() ![]() Here is an example of a colourmap: Img of ColorbarĬolors = np.asarray([1, 2, 5, 4, 6, 8, 6, 3, 5, The Matplotlib module has a number of available colourmaps.Ī colourmap is like a list of colours, where each colour has a value that ranges from 0 to 100. Each float value in our colours array represents different colour intensities to plot our data. Scatter Plot with Marker Parameter The colourmap parameterĬmap – A Colormap instance or registered colourmap name. cmap is only used if c is an array of floats, (default: ‘viridis’). Plt.scatter(x = number_of_ratings, y = ratings_value, s = sizes, c = "green", marker = "^" ) Sizes = np.asarray() Number_of_ratings = np.asarray() # Using a different marker: (default: 'o') Let’s try to make some plots and try to visualize the trend. We want find the rating trend from the viewers. Most commonly, NumPy arrays are used for the code to run more efficiently, shape (n, ), required.įor example – We have a dataset with the features, number_of_ratings for a video post on some social media, and we have a ratings_value which varies from 1 – 9. The x_axis_array_data & y_axis_array_dataĪll the parameters mentioned above are optional except the x_axis_array_data and y_axis_array_data, which, as their name suggests takes in two sets of values as an array. You can install matplotlib using the command:Īlternatively, you can install it using Anaconda. Modifying Scatter Plot Parameters To Create Visualizations With PyPlot Scatter edgecolors: This parameter is used to set the color of the lines connecting the data points.linewidths: This parameter is used to set the width of the lines connecting the data points.alpha: This parameter is used to set the transparency of the data points.cmap: This parameter is used to set the colour map of the data points.marker: This parameter is used to set the marker style of the data points.c: This parameter is used to set the colour of the data points. ![]() s: This parameter is used to set the size of the data points.This is the array containing data for the y-axis. y_axis_array_data: This is the y-axis data.This is the array containing data for the x-axis. x_axis_array_data: This is the x-axis data.Let’s go through the syntax first and then we will see how to use the most commonly used parameters to get some nice visualizations. The syntax for using this tool is really simple and requires just a few lines of code with certain parameters. It is used to create scatter plots to observe relationships between features or variables which may help us gain insights. Scatter plots are what we will be going through in this article, specifically the method. It helps us to create interactive plots, figures, and layouts that can be greatly customized as per our needs.Īlso read: Resize the Plots and Subplots in Matplotlib Using figsize The scatter() method Matplotlib is a comprehensive library to create static, animated, and interactive visualizations in Python. We certainly need some kind of tool to work through it. ![]() Let’s say, for example, we have a use case where we need to see some kind of trend in our data. Visualizing those relationships through some kind of plot or figures is even more useful. An important methodology for any kind of Data Analysis is to observe relationships between key features and also to see if they somehow depend upon each other. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |