Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python- Connecting Lines with plot_date in Matplotlib

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

like image 681
JVarhol Avatar asked Jan 20 '14 18:01

JVarhol


People also ask

How do I connect points in matplotlib?

MatPlotLib with Python Add an axes to the current figure as a subplot arrangement. Create lists for x, y and z. To connect the points, use plot() method with x, y and z data points with black color line. To display the figure, use show() method.

How do I plot multiple lines in matplotlib?

Import matplotlib. To create subplot, use subplots() function. Next, define data coordinates using range() function to get multiple lines with different lengths. To plot a line chart, use the plot() function.


1 Answers

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

like image 67
JVarhol Avatar answered Oct 04 '22 14:10

JVarhol