You can do this by assigning events to the Joystick's Y axis only.
Right analog Y axis < 50 ---> Set gun angle -10 pixels
Right analog Y axis > 50 ---> Set gun angle +10 pixels
(I made the numbers up, you'd have to test and tweak it to get it behaving the way you like, and maybe swap the conditions / events round if you wanted inverted gun control or not). Not sure what method you are using to angle your gun so just modify that part of the code to make sense for your game engine.
I set the analog deadzone to 50 because I hate twitchy analog sticks, I think it's nice to have the stick only register input when the player has pushed it at least 50% off kilter, but of course change that if it's not right for you