Python Forum

Full Version: Plot a graph using matplotlib.pyplot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello I'm just starting to programme in Python :)

So I want to plot a graph using matplotlib.

my qustion is how to write a code which starts from the second line of data of a specific line

for example my plot is starts from 1962 but I want it starts from 1963.

how i do to make it works?
[Image: Y6rLeDW.jpg]

Thank you for any advice,
import matplotlib.pyplot as plt


plt.stackplot(time, DDI*100, SDI*100,CDI*100,WDI*100, colors=['green','red','yellow','blue'])  
plt.title('Drive mechanism')
plt.xlabel('Year')
plt.ylabel('Drive %')

plt.xticks(np.arange(min(time)+1, max(time), 5))
plt.show()
Hi, thanks to Julián Urrea from facebook

but in the second term time[50] of the code how I know the last number of my list, maybe i have 200 lines?

plt.xlim([time[2],time[50]])

Hi

I found the solution ;)

plt.xlim([time[2],max(time)])