Python Forum
Python Matplotlib: How do I plot lines with different end point in the same graph? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python Matplotlib: How do I plot lines with different end point in the same graph? (/thread-32716.html)



Python Matplotlib: How do I plot lines with different end point in the same graph? - JaneTan - Feb-28-2021

Hi

Basically I have Revenue that ends at year 2000 and Profit that ends at year 1998. I want to plot both set of data on the same graph.

I read in the data from Excel file. But for Profit, the missing data from 1999 and 2000 cause Python to impute a value for the missing data at Year 1999 & 2000 in the Graph.

How do I make the line for Profit to stop at Year 1998 in the graph? Thank you


Year Revenue Profit
1990 1 2
1991 1 2
1992 1 2
1993 1 2
1994 1 2
1995 1 2
1996 1 2
1997 1 2
1998 1 2
1999 1
2000 1