Reputation: 626
I am using matplotlib to graph out some data in which takes time over a time, therefore I have to use plot_date in order to plot my lines. But for some reason Plot_Date and Plot have completely different formatting as far as connecting lines.
Here is what It looks like when using plot(x,y)
Using plot(x,y,'bo')
or plot_date(x,y,'bo')
Plot_date(x,y)
looks like that ^^ too.
and using plot_date(x,y,'bo-')
How do I make it so that the result of plot_date
looks like the first picture? I have looked all over the Matplotlib website and couldn't find anything.
Thanks in advance
Upvotes: 11
Views: 15311
Reputation: 366
If you want to have the markers connected with the lines, you can also use
plt.plot_date(y,x,linestyle='solid')
So the complete code for the beginners would be:
from matplotlib import pyplot as plt
plt.plot_date(y,x,linestyle='solid')
plt.show()
Do not forget you need to have matplotlib installed first. For that you need to open command line and write:
pip install matplotlib
Upvotes: 1
Reputation: 626
Upon further investigation I found that in order to display a solid line without dots, I needed to use the line style 'b-', making the code plot_date(x,y,'b-')
.
Upvotes: 24