R shiny, displaying graphs based on input in drop down, this drop down is displayed when user selects a radio button

so i have this problem. i have a shiny app, that has radio buttons, when a user selects one of the radio buttons, based on that input, a drop down menu is displayed. based on selection in that drop down menu, i need to plot graphs. i am half way through. but my problem is that, when user selects an option from drop down, its graph is displayed. when another input from radio button comes in, the drop down comes but the previous graph is still there. the new graph comes below it. any suggestions on how i can solve this...

actually figured it out.