Ask Your Question

Revision history [back]

Vector-graphic graphs of small size

I'm doing some computations related to BSD, and saving the resulting graphs as PDFs. Here is the script right now:


ds = [1,5,34,1254,29274]
pis = [[1.0] for d in ds]
primes = [1.0 for d in ds]
def ell_data(p,d):
    if 2*d % p == 0: # curve is singular
       return long(p)
    else:
       return long(EllipticCurve(GF(p),[0,0,0,-d^2,0]).cardinality())

for i in range(30000):
    p = Primes().unrank(i)
    for j in range(len(ds)):
        pis[j].append(pis[j][-1] * ell_data(p,ds[j]) / p)
    primes.append(log(long(p)))

ell_data = [zip(primes, pi) for pi in pis]
ell_log_data = [[(log(p),log(pi)) for (p,pi) in data] for data in ell_data]
p = sum([scatter_plot(e[1:], markersize=2, xmin=1) for e in ell_log_data])
p.save('bsd-plot.pdf')
 

The details aren't very important - what matters is that I'm creating a pretty big data set and plotting it. The problem is, if I save the plot as a PDF, the PDF is very large (around 30mb). Is there any way of creating a vector-graphics data plot that is reasonably sized?