matplotlib savefig does not output a file

时间:2017-08-30 20:08:57

标签: python matplotlib

I have loaded one column each from two different dataframes and am plotting them on a line graph. The graph pops up on my screen, but my plt.savefig command is not working, as no files are saved.

netReturns <- (1 - spend) * marketReturns
cumNetReturns <- t(apply(netReturns, 1, cumprod))
bal <- initPortBal * cumNetReturns

1 个答案:

答案 0 :(得分:3)

try this:

@Test
public void bestSequenceTest() {
    List<String> l = BestSequence.match("123456", Arrays.asList("12", "34", "56", "3456"));
    System.out.println(l);
}

as you see you have a priority problem between the [12, 3456] operator and the current_page = None def MainScreen(self): global current_page if current_page is not None: current_page.pack_forget() label4 = Label(mainarea,width=100,height=80,text="Prapti Computer Solutions") label4.pack(expand=True,fill='both') current_page = label4 operator there:

>>> "%s" % 12+1
Traceback (most recent call last):
  File "<string>", line 301, in runcode
  File "<interactive input>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly

% is first computed to a string, then python tries to add + to this string, which explains the error (you didn't post any error, but the fact that it doesn't save gives that away)

I would do:

plt.savefig('Subj%s_left_LEC_DGCA3.png' % betaNum+1)

or even better:

'Subj%s_left_LEC_DGCA3.png' % betaNum

That said, getting hold of a console where you can see exceptions that your code raises would help greatly.