11

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) Pic1

Using plot(x,y,'bo') or plot_date(x,y,'bo') Pic2

Plot_date(x,y) looks like that ^^ too.

and using plot_date(x,y,'bo-') Pic3

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

2 Answers 2

24

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-').

Sign up to request clarification or add additional context in comments.

1 Comment

actually to make it more readable it would be better to use plot_date(x, y, linestyle='solid', marker='None')
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.