Ask Your Question
1

axis_thickness ?

asked 2014-08-13 13:34:15 -0500

mathochist gravatar image

updated 2014-08-13 23:08:29 -0500

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-13 23:08:48 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-08-13 16:12:32 -0500

dazedANDconfused gravatar image

updated 2014-08-14 11:02:39 -0500

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 15:44:23 -0500 )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 13:34:15 -0500

Seen: 93 times

Last updated: Aug 14 '14