Created
October 24, 2013 10:52
-
-
Save ashwin/7135027 to your computer and use it in GitHub Desktop.
Show all markers of Matplotlib in a plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import matplotlib.pyplot as pyplot | |
mark_dict = { | |
".":"point", | |
",":"pixel", | |
"o":"circle", | |
"v":"triangle_down", | |
"^":"triangle_up", | |
"<":"triangle_left", | |
">":"triangle_right", | |
"1":"tri_down", | |
"2":"tri_up", | |
"3":"tri_left", | |
"4":"tri_right", | |
"8":"octagon", | |
"s":"square", | |
"p":"pentagon", | |
"*":"star", | |
"h":"hexagon1", | |
"H":"hexagon2", | |
"+":"plus", | |
"D":"diamond", | |
"d":"thin_diamond", | |
"|":"vline", | |
"_":"hline" | |
} | |
def line_plot(): | |
x_list = [1, 10, 30, 70] | |
y_list = [10, 20, 30, 40] | |
pyplot.clf() | |
for mark in mark_dict: | |
y_list = [y_val + 10 for y_val in y_list] | |
pyplot.plot(x_list, y_list, label=mark_dict[mark], marker=mark) | |
pyplot.legend(loc="best", prop={'size':11}) | |
pyplot.savefig("markers.png") | |
def main(): | |
line_plot() | |
if "__main__" == __name__: | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment