I have 2 figures in matplotlib, one is a standard graph the other is a Basemap that Im plotting lat/long onto. Im trying to set a logo for both windows, but I can only get the custom logo onto Figure1, Figure2 still shows Tkinter logo.
Im following one of the answers from here Change icon in a Matplotlib figure window
from Tkinter import PhotoImage
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
thismanager = plt.get_current_fig_manager()
img = PhotoImage(file='elcc_logo.ppm')
I have 2 plots:
plt.figure(num=1, figsize=(16, 12))
thismanager.window.tk.call('wm', 'iconphoto', thismanager.window._w, img)
plt.plot(date, energyplot, 'bo')
plt.figure(num=2, figsize=(10, 8))
thismanager.window.tk.call('wm', 'iconphoto', thismanager.window._w, img)
earth = Basemap(projection='mill')
earth.drawcoastlines(color='0.50', linewidth=0.25)
earth.fillcontinents(color='0.95', zorder=0)
x, y = earth(longitudes, latitudes)
earth.scatter(x, y, color='g', marker='o', linewidths=0.5)
for i, txt in enumerate(datalogger_id):
plt.annotate(txt, xy=(x[i], y[i]), xycoords='data', xytext=(8, -4), textcoords='offset points', clip_on=True)
plt.show()
I can swap the figure number and whichever one has num=1
gets the logo, I just cant get it on both at the same time.