1
Ich versuche, ein Tortendiagramm in Python zu machen, und ich bekomme diese Traceback. Hier ist mein CodePython Kreisdiagramm Traceback
#!/usr/bin/python
import sys
import re
import matplotlib.pyplot as plt
file1 = open(sys.argv[1])
file2 = open(sys.argv[2])
file3 = open(sys.argv[3])
all = []
count_1 = 0
count_2 = 0
count_3 = 0
for line in file1:
line = line.strip()
if line.startswith(">"):
count_1 += 1
all.append(count_1)
for line in file2:
line = line.strip()
if line.startswith(">"):
if re.search("CAGE_PLUS", line):
count_2 += 1
all.append(count_2)
for line in file3:
line = line.strip()
if line.startswith(">"):
if re.search("known", line):
count_3 += 1
all.append(count_3)
labels = ["All lincRNA", "CAGE lincRNA", "Known lincRNA"]
sizes = all
colors = ['yellowgreen', 'mediumpurple', 'lightskyblue']
plt.pie(sizes, # data
labels=labels, # slice labels
colors=colors, # array of colours
autopct='%1.1f%%' # print the values inside the wedges
)
plt.axis('equal')
plt.savefig('lincRNA_piechart')
Dies ist, wie ich es bin mit
python /evolinc_docker/lincRNA_fig.py All.lincRNAs.fa lincRNAs.with.CAGE.support.annotated.fa lincRNAs.overlapping.known.lincs.fa
Und die Zurückverfolgungs ich bin ist immer
Traceback (most recent call last):
File "/evolinc_docker/lincRNA_fig.py", line 50, in <module>
plt.pie(sizes, labels=labels, colors=colors)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2959, in pie
ax = gca()
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 803, in gca
ax = gcf().gca(**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 450, in gcf
return figure()
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 423, in figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Großartig. Wie setze ich dann die Variable $ DISPLAY? Wenn ich Echo $ DISPLAY in ubuntu eintippte, bekam ich nichts. – upendra
Ich benutze OSX, also ist meine Situation anders als deine. Aber im Grunde ist es die Umgebungsvariable, die verwendet wird, um Daten auf einem entfernten Bildschirm zu tunneln. Suchen Sie bei Google nach Ihrem spezifischen System. – Hun
Ich fand die Antwort hier - http://stackoverflow.com/questions/2801882/generating-a-png-with-matplotlib-when-display-is-undefined – upendra