Vector-graphic graphs of small size

asked 2013-11-10 16:42:21 +0100

Daniel Miller gravatar image

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?

edit retag flag offensive close merge delete

Comments

1

Have you tried p.save('bsd-plot.svg') ?

ndomes gravatar imagendomes ( 2013-11-10 17:05:17 +0100 )edit

No I haven't - thanks for the suggestion!

Daniel Miller gravatar imageDaniel Miller ( 2013-11-10 17:52:39 +0100 )edit

If it worked, @ndomes can add it as an answer, so that this question doesn't appear as unanswered. :)

ppurka gravatar imageppurka ( 2013-11-10 22:21:01 +0100 )edit