Ask Your Question
1

axis_thickness ?

asked 2014-08-13 20:34:15 +0200

mathochist gravatar image

updated 2014-08-14 06:08:29 +0200

kcrisman gravatar image

I would like to like to increase the thickness of my axes on my plots. How might I do this?

Background: I am a teacher who uses sage to make my own graph paper. The axes look good on paper (although I'd like to have arrows on them), but when I project the pdf onto my white board (to draw on) the axes don't look much thicker than the gridlines (I'm using greyed instead of dashed gridlines). Here's my code:

k = 8
p = plot(k, (x, -k, k), 
     thickness = 0, 
     aspect_ratio = 1, 
     gridlines = True, 
     axes_labels=['$x$','$y$'], 
     ticks=[[-k..k],[-k..k]],
     tick_formatter = [['$-8$', '', '$-6$', '', '$-4$', '', '$-2$', '', '', '', '$2$', '', '$4$', '', '$6$', '', '$8$'], ['$-8$', '', '$-6$', '', '$-4$', '', '$-2$', '', '', '', '$2$', '', '$4$', '', '$6$', '', '$8$']], 
     gridlinesstyle = dict(color = "gray", linestyle = "-")
)
p += plot(0, (x, -k, k), thickness = 0) #to establish graph width
p += plot(-k, (x, -k, k), thickness = 0) #to establish graph height

show(p)

p.save('graph8l.pdf')
edit retag flag offensive close merge delete

Comments

Nice idea!

kcrisman gravatar imagekcrisman ( 2014-08-14 06:08:48 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-08-13 23:12:32 +0200

dazedANDconfused gravatar image

updated 2014-08-14 18:02:39 +0200

The basic answer to your question is here: use the p.axes_width() command to change the axes width. Go to a Sage cell server and copy/paste your code with the extra line to thicken the axes:

k = 8
p = plot(k, (x, -k, k), 
     thickness = 0, 
     aspect_ratio = 1, 
     gridlines = True, 
     axes_labels=['$x$','$y$'], 
     ticks=[[-k..k],[-k..k]],
     tick_formatter = [['$-8$', '', '$-6$', '', '$-4$', '', '$-2$', '', '', '', '$2$', '', '$4$', '', '$6$', '', '$8$'], ['$-8$', '', '$-6$', '', '$-4$', '', '$-2$', '', '', '', '$2$', '', '$4$', '', '$6$', '', '$8$']], 
     gridlinesstyle = dict(color = "gray", linestyle = "-")
)

p += plot(0, (x, -k, k), thickness = 0) #to establish graph width
p += plot(-k, (x, -k, k), thickness = 0) #to establish graph height
p.axes_width(5)
show(p)

p.save('graph8l.pdf')

and the result will be thick axes for your screen output as well as the PDF output.

Given that latex is integrated with Sage, I think you could have much better looking graph paper working in LaTeX, such as is mentioned here. The tkz-fct package, for example can give good results.

edit flag offensive delete link more

Comments

Thank's a ton. I looked all through the 2D Plotting page and didn't think to look at Graphics objects. I should probably read through the documentation completely some time. I aim to continue my LaTeX/Sage integration as well. I haven't had a ton of success on my home or work setup. Maybe that tkz-fct package will help. Thanks again. (Edit: spelling)

mathochist gravatar imagemathochist ( 2014-08-14 22:44:23 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-08-13 20:34:15 +0200

Seen: 434 times

Last updated: Aug 14 '14