![]() ![]() But most of the parameters we covered were to draw the plot more professionally. There might be some other way to draw the scatter plot, like some more attractive way, depending on how we use different parameters. We explained all the major concepts required to draw a scatter plot. In this article, we have seen how to use the scatter plot function. You can see that the outside of the data point is now bordered with the black colour with linewidth = 1. After adding both the parameters, now our scatter plot graph looks like something, as shown below. Line 11: In this line, we just add another parameter which we call edgecolor and linewidth. scatter (h, w, marker = "v", s = 75 ,c = "red" ,edgecolor = 'black', linewidth = 1 ) And the below print statement will show results like this. Line 18: We map the country category with their colour name. Line 17: We created a dictionary of the colour which represents each category. These are just assumptions and not the true value to show the demo. Line 12: We put the whole data points either in the category of country_1 or country_2. The lines where we did changes are explained below: The above code is similar to the previous examples. title ( "Scatter plot colour change for category wise" ) scatter (h, w, marker = "v", s = 75 ,c =colour_list ) 'country_2', 'country_2', 'country_1', 'country_2' ]Ĭolours = Ĭolour_list = for i in country_category ] # set the country name 1 or 2 which shows the height or weightĬountry_category = [ 'country_2', 'country_2', 'country_1' , Each tuple element’s value range will be between, and we can also represent the RGB or RGBA in the hexadecimal format like #FF5733. ![]() ![]() We can choose any RGB or RGBA tuple (red, green, blue, alpha). We can change the colour of the scatter plot using any colour which you want. Now, we will change the colour of the scatter plot data points, as shown below. We can also change the colour of the data points according to our choice. The below output shows data points with the same marker which we added in the scatter function.Įxample 4: Change the colour of the scatter plot Line 11: We pass the marker parameter and a new sign used by the scatter plot to draw points on the graph. The above code is the same as explained in the previous examples except for the below line. title ( "Scatter plot where marker change" ) So, we are going to see about this in this example. Even we can also set the size of the marker. So, if we want to change the style of the marker, we can change it through this parameter (marker). Example 3: Use marker parameter to change the style of data pointsīy default, the marker is a solid round, as shown in the above output. In the above output, we can see that the scatter plot has axis label names and the scatter plot title. We also set the title of the to scatter plot graph. Line 14 to 19: We set the x-axis and y-axis label names. And we pass both datasets to the scatter plot function. Line 4 to 11: We import the library matplotlib.pyplot and create two datasets for the x-axis and y-axis. title ( "Scatter plot for height and weight" ) The syntax to use the scatter () function is: To plot the graph as a scatter, we use the function scatter (). The matplotlib.pypolt offers different ways to plot the graph. This article will give you complete details which you need to work on the scatter plot. This article will see how to use the matplotlib.pyplot to draw a scatter plot. ![]() The scatter plot is widely used by data analytics to find out the relationship between two numerical datasets. In this article, we are going to explain how to use the matplotlib scatter plot in python. To generate the report on that, you must need some clear image of the data, and here the graphs come in place. In that big data, you are processing the data, analyzing the data, and then generating the report on that. If you are a data scientist, then sometimes you have to handle the big data. So, like that, the graph choice depends upon the dataset and requirements. For example, if you have a dataset of company performance from the last 10 years, then the bar chart graph will give more information about the company’s growth. These different graphs are used according to the dataset and requirements. There are different types of graphs available in the market like bar graphs, histograms, pie charts, etc. That’s why people always suggest drawing the big data graph to understand it in a very easy manner. The human can understand the visual more as compared to the text form. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |