具有大量数据的散点图 [英] Scatter plot with a huge amount of data
问题描述
我想使用 Matplotlib 生成具有大量数据的散点图(约300万点).实际上,我有3个具有相同尺寸的矢量,并且我使用以下方式进行绘制.
I would like to use Matplotlib to generate a scatter plot with a huge amount of data (about 3 million points). Actually I've 3 vectors with the same dimension and I use to plot in the following way.
import matplotlib.pyplot as plt
import numpy as np
from numpy import *
from matplotlib import rc
import pylab
from pylab import *
fig = plt.figure()
fig.subplots_adjust(bottom=0.2)
ax = fig.add_subplot(111)
plt.scatter(delta,vf,c=dS,alpha=0.7,cmap=cm.Paired)
实际上没什么特别的.但是实际上生成它花费的时间太长(我正在使用python 2.7和matplotlib 1.0在MacBook Pro 4 GB RAM上工作).有什么办法可以提高速度?
Nothing special actually. But it takes too long to generate it actually (I'm working on my MacBook Pro 4 GB RAM with Python 2.7 and Matplotlib 1.0). Is there any way to improve the speed?
推荐答案
You could take the heatmap approach shown here. In this example the color represents the quantity of data in the bin, not the median value of the dS array, but that should be easy to change. More later if you are interested.
这篇关于具有大量数据的散点图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!