![]() Plt.figure() is the command that initializes your figure. Also, pylab probably isn't something you need for the code you've shown here. In general, I would avoid using import * because it can be confusing to read back your code later. On the other hand, from pylab import * imports all of the functions without the prefix. instead of having to type out () every time. For example, plt.show(), plt.figure, etc. Import matplotlib.pyplot as plt simply imports the functions and classes from the pyplot library from the matplotlib package, and the as plt part is sort of like making a nickname to access those functions easier. Plt.show() will produce an interactive plot on your screen, assuming you are using a backend (renderer) that supports plotting to your user interface. To elaborate a bit to answer some of your other questions about not understanding what individual lines mean: The resulting file will be in your working directory, you only need to open it after your script has finished. Instead, you should use only plt.savefig('filename.svg') if you desire to have a file in the svg format. See this information on Matplotlib's backends. Instead you need to use another backend such as WXAgg or QT4agg, the selection of which will depend on your system. You are attempting to use a backend that will not produce graphics with plt.show(). Myfile = open("datafiles/" name ".data", 'r') Name = raw_input("Enter the filename:\n") in front and when I don't put anything in front, etc? Sorry this will take so long to answer, but I really don't understand matplotlib or any of the examples on their website. svg of two lists and have it show at the end with details about why each line is included and when I put plt. I don't know when I need to use them or why I need to use them.Ĭould someone help me and explain how to draw an. I've messed around with it and tried different things but I think the main problem is that I don't understand what figure(), plt.show(), import matplotlib.pyplot as plt, from pylab import * and some other lines actually mean. My plotting code doesn't seem to be showing the graph (lines 12 to 59 are probably not breaking it, but I included them just in case - I had data that took a while to put into a sorted list).
0 Comments
Leave a Reply. |