0

I am using Tkinter to plot matplotlib figures from the terminal. I'm plotting using the Geopandas .plot() wrapper to matplotlib. I have been unable to suppress the <Figure size 432x288 with 0 Axes> output in the terminal. Here is the offending section of code:

tk_root = tk.Tk()

fig1 = plt.Figure(figsize=(10,10), dpi=100)
ax1 = fig1.add_subplot(111)
map1 = FigureCanvasTkAgg(fig1, tk_root)
map1.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH)
dcdb_shp.plot(ax=ax1)

tk_root.mainloop()

dcdb_shp is a GeoDataFrame.

Following answers to the many similar questions on StackOverflow I have tried semicolons ; after all lines and _ = before all lines not already containing =, including tk_root.mainloop(). I used pyplot.show(); with _ = ... as per this answer. No joy. No other figures are created in the rest of the code.

I'm guessing the problem comes from the use of the Geopandas wrapper .plot() and that the output is generated by matplotlib inside the wrapper but I don't know what to do about it.

GlenS
  • 209
  • 3
  • 6

0 Answers0