Python Scatter Plot example script from the python graph gallery. Plotly makes free online charts with Python, NumPy, SciPy, and IPython and a GUI. Plotly is an alternative to matplotlib.Graph of a Sine Wave Python Scatter Plot | Example Code | plotly

Fishschool Scatter Graph

Made with Python graphing API

Back to the API Gallery

Python Example Code


####################################
# Line and Scatter Plot Demo 
# Questions? Email feedback@plot.ly
# For more docs, see plot.ly/api
####################################

import plotly
py = plotly.plotly('username', 'api_key')

from numpy import *

x = arange(1500)
y1 = sin(2*pi*x/1500.) + random.rand(1500)-0.5
y2 = sin(2*pi*x/1500.)

fish = {'x':x,'y': y1,
	'type':'scatter','mode':'markers',
	'marker':{'color':'rgb(0, 0, 255)','opacity':0.5 } }

fit = {'x': x,'y': y2,
	'type':'scatter', 'mode':'markers', 'opacity':0.8, 
	'marker':{'color':'rgb(255, 0, 0)'} }

l={'autosize': False,'width': 650, 'height': 550,'title':'Fish School',
	'xaxis':{ "ticks": "", "gridcolor": "white", "zerolinecolor": "white", 
		"linecolor": "white", "autorange": False, "range":[0,1500] },
	'yaxis':{ "ticks": "", "gridcolor": "white", "zerolinecolor": "white", 
		"linecolor": "white", "autorange": False, "range":[-2.2,2.2] },
	'plot_bgcolor': 'rgb(245,245,247)', 'showlegend': False, 'hovermode': 'closest'}

py.plot([fish, fit],layout=l)