On 2/17/12 3:32 AM, Goebbe wrote:
Hi,
this is my first post. Please keep in mind that I have just started to
use Sage.

I use the sage notebook in order to prepare graphs for a introductory
statistics class.
Since I use the graphs in presentations (powerpoint) - I modified
linewidth, fontsize in
order to get a graph that is easily visible in the presentation (even
from the back of the room).

Unfortunately I did not find a way to change the size of ticks. I
already searched the documentation of sage and of matplotlib, but I
just did not manage to get this work.

Yeah, you have to use matplotlib.  I followed this message:

http://www.mail-archive.com/matplotlib-users@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

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to