well you just need to be clear about the function of a bass player in different parts of a song .... when you are doing a supportive role, you want to support and not stand in the lime light. Hence it's more important to harmonise to the song.
Bass players are music theory Gurus because to be a good bass player, you must have a ear to harmonise. Like whats the effect of playing B over G chord, A over G Chord, D over G chord? And knowing when to play inversions and hybrids all calls for good hearing. Nathan East is one of my fave.
During improvisation, you will be the lime light ... hence you can do whatever you want. But i guess the bass is hitting on the lower register ... so it will be ideal either to play notes more far apart like Arpeggios or play on the upper registars to get a more defined melody lines.
Aiya, just experiment and you will know ... it's exciting to see Bass PLayers solo ... especially Jaco Pastorius