Parameters in Python Functions

Santhosh Kumar BVSRK
3 min readJun 20, 2021

--

  • kind = bar → used in plot() function to tell what kind of chart we want bar, line, area, box, etc.,
  • sorted=True
  • figsize(5,6) → used in plot() to adjust size of the graph
  • colormap=’magma’ → used in plot() to adjust color of the graph
  • fontsize=5 → used in plot() to set font size on the graph
  • yticks → used in plot() to set the number of points on y-axis
  • color → used in plot() to set color of the graph
  • linestyle=’.-‘ → used in plot() to set line graph style
  • chunksize= 1000 → used in readstata() to set the number of rows it should show
  • axis=0 → this is used in different functions for example, sort(axis=0) means it’ll sort data of x-axis
  • skiprows=3 → this parameter is used in read_csv() function to skip the number of rows from the file being read
  • encoding=’utf-8’ → used in read_csv() function to mention encoding of incoming file
  • autopct=’%.4f%%’ → used in plot() function to display a % values in a pie chart and value will be displayed up to 4 decimal places
  • explode=space → used in plot() function to display spaces between the pies in pie chart
  • legend=True → used in plot() function while drawing pie charts which will tell what will each color represent in the chart
  • wedgeprops={‘width’:0.15} → used in plot() function while drawing pie charts to remove the center filling of pies in pie chart
  • shadow=True → used in plot() function to produce shadow of the graph/pie chart
  • startangle=n → used in plot() function to adjust the position of legend so that it doesn’t overlap with your chart data
  • grid=True → used in plot() function for scatter plot chart and it’ll create a grid at the background for readability
  • stacked=True → used in plot(kind=’bar’)/plot(kind=’area’) to draw a stacked bar chart/stacked area chart
  • cmap=PuBuG → used while plotting heat map and this will tell the color which you want to use
  • annot=True → used in Heat Maps to show values inside the boxes
  • pad_width=2 → used in np.pad() function where it adds 2 rows and columns with a specific value mention in parameter constant_value
  • palette → used in sns.violinplot() and this is for coloring
  • loc → This parameter is used in plt.legend() function which accepts values as below

=============== =============
Location String Location Code
=============== =============
‘best’ 0
‘upper right’ 1
‘upper left’ 2
‘lower left’ 3
‘lower right’ 4
‘right’ 5
‘center left’ 6
‘center right’ 7
‘lower center’ 8
‘upper center’ 9
‘center’ 10
=============== =============

  • wedgeprops → This parameter is used to convert a pie chart to donut chart
  • sharex()→ This is used when you are using subplots where the x-axis is range is shared similarly across all the graphs
  • Kde → this parameter is used in distplot() where kde=True gives the line on the histogram and marking it false will disappear the line
  • na_values → this parameter is part of read_csv function which helps to replace a particular string with NaN. For instance, there are ? In the data which is not correct as shown below

Now, we’ll replace that with NaN as shown below

NOTE: This is a Work In Progress story and will keep updating with few more parameters.

--

--

Santhosh Kumar BVSRK
Santhosh Kumar BVSRK

Written by Santhosh Kumar BVSRK

17+ Years in IT/ITES| ML & AI Enthusiast| Oracle Cloud Architect, Integration Specialist — BPEL, OSB, OIC, IICS| Database Scripting-SQL, PL/SQL, MySQL

No responses yet