python - Export matplotlib pdf with text not as path from tkinter -
i have simple gui plots figure this:
def display_graph(self,f1): self.canvas = figurecanvastkagg(f1, self) self.canvas.show() self.canvas.get_tk_widget().place(anchor = n ,x = 200 ,y= 150) self.get_all_figures() self.canvas._tkcanvas.place(anchor = n ,x = 675 ,y= 325) self.toolbar_frame = frame(self) toolbar = navigationtoolbar2tkagg(self.canvas, self.toolbar_frame) self.toolbar_frame.place(anchor = n ,x = 540 ,y= 933)
there text xlabel, ylabel , user should able export in pdf format. work figure great if displayed text text object in example illustrator, recognized path. (no font information). have changed pyl.rcparams['pdf.fonttype'] = 42
work when plot directly console. there trick make happen gui using canvas?
to save image use toolbar , function (depending on user clicks)
def save_all(figures,save_path_name,curr = 'all'): try: pp = pdfpages(save_path_name) if curr == 'last': pp.savefig(figures[-1]) else: in figures: pp.savefig(i) pp.close() except (oserror, ioerror) e: messagebox.showinfo('error ...',e) return
this trick. updating everytime before plotting graph. not able make work, when changed in rc file. strange maybe overseeing something.
def display_graph(self,f1): plt.rcparams['pdf.fonttype'] = 42 matplotlib.rcparams['pdf.fonttype'] = 42 self.canvas = figurecanvastkagg(f1, self) self.canvas.show() self.canvas.get_tk_widget().place(anchor = n ,x = 200 ,y= 150) self.get_all_figures() self.canvas._tkcanvas.place(anchor = n ,x = 675 ,y= 325) self.toolbar_frame = frame(self) toolbar = navigationtoolbar2tkagg(self.canvas, self.toolbar_frame) self.toolbar_frame.place(anchor = n ,x = 540 ,y= 933)
Comments
Post a Comment