Changing the xy-Axis Titles with Dropdown Menu

@Fxs7576 you’ll need to add your axis titles to the button args.

Here’s an example of how the updatemenus list could be modified to produce different axis labels for each plot:

updatemenus = list([
    dict(active=-1,
         buttons=list([   
            dict(label = 'High',
                 method = 'update',
                 args = [{'visible': [True, True, False, False]},
                         {'title': 'Yahoo High',
                          'xaxis': {'title': 'Date'},
                          'yaxis': {'title': 'High Price - Dollars'},
                          'annotations': high_annotations}]),
            dict(label = 'Low',
                 method = 'update',
                 args = [{'visible': [False, False, True, True]},
                         {'title': 'Yahoo Low',
                          'xaxis': {'title': 'Date'},
                          'yaxis': {'title': 'Low Price - Dollars'},
                          'annotations': low_annotations}]),
            dict(label = 'Both',
                 method = 'update',
                 args = [{'visible': [True, True, True, True]},
                         {'title': 'Yahoo',
                          'xaxis': {'title': 'Date'},
                          'yaxis': {'title': 'High & Low Price - Dollars'},
                          'annotations': high_annotations+low_annotations}]),
            dict(label = 'Reset',
                 method = 'update',
                 args = [{'visible': [True, False, True, False]},
                         {'title': 'Yahoo',
                          'xaxis': {'title': 'Date'},
                          'yaxis': {'title': 'Price - Dollars'},
                          'annotations': []}])
        ]),
    )
])
1 Like