Skip to content Skip to sidebar Skip to footer

How Can I Plot Output From A Function Which Returns Multiple Values In Python?

Short intro I'm calculating and plotting spectral energy of planets orbiting pulsar from given data. I have previously ordered all data in a list variations with dimensions [172,

Solution 1:

Just use indexing on the return value from spectrum:

plot(spectrum(t)[2], (t, 1, 100))

Solution 2:

Just call the plot function with only the energy variable

omega=10
c, v, energy = spectrum(omega)   #enter arbitray angular frequency hereprint"Values for the given angular frequency : \n \n a = %f, b = %f, spectral_energy = %f " % (c, v, energy)

plot(energy, (omega, 1, 100))

Post a Comment for "How Can I Plot Output From A Function Which Returns Multiple Values In Python?"