Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to do scatter plot in pyplot

import numpy as npimport matplotlib.pyplot as plt
# Create data
N = 500x = np.random.rand(N)
y = np.random.rand(N)
colors = (0,0,0)
area = np.pi*3
# Plot
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.title('Scatter plot pythonspot.com')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
Comment

Customizing scatter plot with pyplot object

# Set figure size (width, height) in inches
plt.figure(figsize = ( 5 , 3 ))
  
# Plot scatterplot
sns.scatterplot( x = "total_bill" , y = "tip" , data = tips )
  
# Set label for x-axis
plt.xlabel( "Total Bill (USD)" , size = 12 )
  
# Set label for y-axis
plt.ylabel( "Tips (USD)" , size = 12 )
  
# Set title for figure
plt.title( "Bill vs Tips" , size = 24 )
  
# Display figure
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: xlrd python read excel 
Python :: async asyncio input 
Python :: boder color in tkinter 
Python :: importing python modules from a folder 
Python :: pandas create dataframe from multiple dictionaries 
Python :: add values to dictionary key python 
Python :: pickle dump example 
Python :: get element from string with deliminator python 
Python :: dynamic printing 
Python :: how to parse http request in python 
Python :: concatenate strings of numpy array python 
Python :: how to pre populate field flask wtforms 
Python :: reshape 
Python :: how to access a file from root folder in python project 
Python :: error python 
Python :: seaborn factorplot python 
Python :: python re split 
Python :: python use math 
Python :: python melt 
Python :: series object has no attribute split 
Python :: how to make a square in python 
Python :: run multiprocesses on flask 
Python :: insertion sort 
Python :: percent sign in python 
Python :: remove last digit from number python 
Python :: * pattern by python 
Python :: image hashing 
Python :: pandas read parquet from s3 
Python :: add columns not in place 
Python :: copy array along axis numpy 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =