Academic societies require papers that are easy to read even in black and white. Although matplotlib and pylab are convenient, they are difficult to read if they are printed in black and white as they are because they output colorful graphs by default. So you need to do your best when plotting.
First, create a generator that creates the line format.
def monochrome_style_generator():
linestyle = ['-', '--', '-.', ':']
markerstyle = ['h' ,'2', 'v', '^', 's', '<', '>', '1', '3', '4', '8', 'p', '*', 'H', '+', ',', '.', 'x', 'o', 'D', 'd', '|', '_']
line_idx = 0
marker_idx = 0
while True:
yield 'k' + linestyle[line_idx] + markerstyle[marker_idx]
line_idx = (line_idx + 1) % len(linestyle)
marker_idx = (marker_idx + 1) % len(markerstyle)
What I defined like this
plot.py
import pylab
#Generator creation
gen = monochrome_style_generator()
xval = pylab.arange(100)*.01
for x in range(6):
# gen.next()Generate line format with
pylab.plot(xval, pylab.cos(x*pylab.pi*xval), gen.next())
pylab.savefig("result.png ", format = 'png')
By using it like this
You can output such a graph.
Recommended Posts