Yeah, you have to use matplotlib. I followed this message:
http://www.mail-archive.com/matplotl...@lists.sourceforge.net/msg18998.html
Here is the result:
http://aleph.sagemath.org/?q=1de1fd37-f4cb-4501-a13e-84769fd5befe
(click Evaluate, then look at the png file at the bottom)
Here is the code:
P = [1/6,1/6,1/6,1/6,1/6,1/6]
X = [1,2,3,4,5,6]
discrDistr = [(X[_],P[_]) for _ in range(len(P))] # Prepare values
for scatter_plot
p1 = scatter_plot(discrDistr, markersize=100,
facecolor='blue',xmin=0,xmax=(len(P)+0.5),ymax=0.3)
counter = 0
for expr in P:
p1 += line([(X[counter],0),(X[counter],expr)],
linestyle="--",color='black',thickness=2)
counter = counter + 1
p1.axes_width(2)
m=p1.matplotlib(fontsize=20)
from matplotlib import pyplot
xticks = pyplot.getp(m.axes[0], 'xticklines')
yticks = pyplot.getp(m.axes[0], 'yticklines')
# adjust markeredgewidth and markersize to adjust the width and length
of tickmarks
pyplot.setp(xticks, markeredgewidth=4, markersize=10)
pyplot.setp(yticks, markeredgewidth=2, markersize=12)
from matplotlib.backends.backend_agg import FigureCanvasAgg
m.set_canvas(FigureCanvasAgg(m))
m.savefig('test.png')
Thanks,
Jason
Yes, a long-term project is to overhaul the graphics code so that it
exposes more of the powerful matplotlib functionality, or at least makes
it easier to use matplotlib directly. Already, the .matplotlib()
function goes a long ways towards that (before the matplotlib method, it
was much more complicated to do things in matplotlib with Sage figures).
Thanks,
Jason