The modification of jet shapes in Pb-Pb collisions, relative to those in pp collisions, is studied for jets associated with an isolated photon. The data were collected with the CMS detector at the LHC at a nucleon-nucleon center-of-mass energy of 5.02 TeV. Jet shapes are constructed from charged particles with track transverse momenta (pT) above 1 GeV/c in annuli around the axes of jets with pTjet>30 GeV/c associated with an isolated photon with pTγ>60 GeV/c. The jet shape distributions are consistent between peripheral Pb-Pb and pp collisions, but are modified for more central Pb-Pb collisions. In these central Pb-Pb events, a larger fraction of the jet momentum is observed at larger distances from the jet axis compared to pp, reflecting the interaction between the partonic medium created in heavy ion collisions and the traversing partons.