Black Lives Matter. Please consider donating to Black Girls Code today.

Problem changing annotations using updatemenus


I have an issue I can’t figure out with first/leftmost dropdown in the plot below (generated using MATLAB) - a few updatemenus arguments (but not all) mysteriously seem to stop working the second time one of the options is selected.

The intended use is that the first dropdown updates the visibility of the traces (to show the 1 month returns for the banks in the selected region), changes the annotations that are used as subtitles, and sets the logic for the second dropdown, so that the region selection flows through and the user can view the 1 month/3 month/1 year returns for those particular banks. Everything works perfectly the first time each option in the first dropdown is selected, but while the arguments that control the visibility of the traces and change the logic of the second dropdown continue to work as you click through the 1st menu options a few times, the annotations stop updating. So, if you select Europe, then Americas, then Europe again in the first menu, while the data in the top left subplot will be reflected properly as BNP/ BofA /BNP, the annotation reads BNP Paribas/Bank of America/Bank of America.

It’s entirely possible I’m doing something wrong here, so any suggestions would be appreciated!