python - Draw and write imagefile without Window -


I've found that using a code is not easy to draw a diagram in the file using matplotlib As much as reading this tutorial, it is explained in the tutorial, that you submit the data and then:

  import as plat # as the matplotlib.pyplot ... meaningful stuff Plt.plot (data.x, fill variable with data) .y, format_string) plt.savefig (filename)   

and done It works fine if you execute it as open but if you give this code in a process that does not have a window (like Jenkins), then you just get the following error:

  traceback (most recent call final): The file ".to_graph.py", line 89,   

The cause of this error, as I understand the source code around stack-trace lines I am hoping to use backend_tkagg.py in the previous window window (see the Tk.Tk () line in the stacktrace). So I wonder if there is a way of drawing pictures with matplotlib (or everything in the dragon) without having to depend on the window (-major) to work.

You have to set a backend that will write directly to a file.

For details, see:

You must call matplotlib for example:

  import matplotlib matplotlib.use ("AGG" ) Import Pipot # Continue as usual   

Actually, I found out that there is a solution given in this documentation:



Comments