Ask Your Question

How to show on a plot minor gridlines with a different thickness?

asked 2015-03-18 19:42:43 +0200

Eugene gravatar image

updated 2015-03-18 23:43:39 +0200

Assuming I have some data points to plot, say x and y:

import numpy as np

x = np.linspace(0, 1)
y = np.sin(4 * np.pi * x) * np.exp(-5 * x)

I tried plotting them like this:

line(zip(x, y)).show(frame=True, gridlines='minor', axes=False)

In the documentation I read about options for gridlines, including style for vertical and horizontal ones separately, but what about minor and major separation?

What I want is something like this with major lines thicker than minor:

import matplotlib
from matplotlib.pyplot import figure

f = figure(figsize=(8,8))
axes = f.add_axes([.1, .1, .8, .8])

axes.plot(x, y)


axes.grid(b=True, which='minor',  linewidth=.2)
axes.grid(b=True, which='major',  linewidth=1)




edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-12 16:03:19 +0200

kcrisman gravatar image

I don't think this is possible without using matplotlib in some way inside of Sage. I've opened for this.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-03-18 19:42:43 +0200

Seen: 7,427 times

Last updated: Dec 12 '15