ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 10 Nov 2013 22:21:01 +0100Vector-graphic graphs of small sizehttps://ask.sagemath.org/question/10720/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:
<pre><code>
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')
</code>
</pre>
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?Sun, 10 Nov 2013 16:42:21 +0100https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/Comment by Daniel Miller for <p>I'm doing some computations related to BSD, and saving the resulting graphs as PDFs. Here is the script right now:</p>
<pre><code>
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')
</code>
</pre>
<p>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 <em>very large</em> (around 30mb). Is there any way of creating a vector-graphics data plot that is reasonably sized?</p>
https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/?comment=16743#post-id-16743No I haven't - thanks for the suggestion!Sun, 10 Nov 2013 17:52:39 +0100https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/?comment=16743#post-id-16743Comment by ndomes for <p>I'm doing some computations related to BSD, and saving the resulting graphs as PDFs. Here is the script right now:</p>
<pre><code>
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')
</code>
</pre>
<p>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 <em>very large</em> (around 30mb). Is there any way of creating a vector-graphics data plot that is reasonably sized?</p>
https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/?comment=16744#post-id-16744Have you tried p.save('bsd-plot.svg') ?Sun, 10 Nov 2013 17:05:17 +0100https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/?comment=16744#post-id-16744Comment by ppurka for <p>I'm doing some computations related to BSD, and saving the resulting graphs as PDFs. Here is the script right now:</p>
<pre><code>
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')
</code>
</pre>
<p>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 <em>very large</em> (around 30mb). Is there any way of creating a vector-graphics data plot that is reasonably sized?</p>
https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/?comment=16742#post-id-16742If it worked, @ndomes can add it as an answer, so that this question doesn't appear as unanswered. :)Sun, 10 Nov 2013 22:21:01 +0100https://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/?comment=16742#post-id-16742