The analog read gives a value that is dependant on the analog reference which is usually your supply voltage. When powered by external voltage, it will be very close to 5 volts because of the onboard regulator. When its powered from USB it takes the voltage of the USB in the computer, which from experience can be a long way out. (4.7 volts isn't unusual) so the value read will change.