13

I know the general usage of plotfile:

import matplotlib.pyplot as plt

plt.plotfile(csvfile,sometuple)

But this produces a line plot by default. I want a scatterplot. Is there some special argument that i need to pass to this method? I have already looked into the documentation and didnt find anything.

DevilFi5h
  • 163
  • 1
  • 1
  • 5

3 Answers3

21

I don't see the advantages of plotfile, myself: as soon as you want to do anything interesting it's probably easier to work with the usual directives. But

matplotlib.pyplot.plotfile('dat.csv',(0,1),linestyle="",marker="o")

should replace the line by points.

DSM
  • 342,061
  • 65
  • 592
  • 494
  • If you combine several time series data sets to one, you may end up with data where every data point has an NaN value before and after it. Without any further pre-processing or plotting options, you will end up with an invisible line if you don't show any points. – Dave Dec 13 '21 at 16:23
3

I don't know how to use the plotfile command, but in the 'just' plot I've used markers like

matplotlib.pyplot.plot(X1, Y1, 'go', X2, Y2, 'b-') 

where 'go' means green circles for the first plots, 'b-' means blue lines for the second plot, 'r--' means red dashed lines, and so on...

Check out the matplotlib.pyplot.plot documentation.

g.breeze
  • 1,940
  • 19
  • 24
Diego-MX
  • 2,279
  • 2
  • 20
  • 35
3

Plotfile is now deprecated, but for people reading this trying to make a scatter plot in regular matplotlib, it's easily done with .scatter. See the docs here.

In your code, try adding this, though you'll need to make sure csvfile and sometuple have the same dimensions.

plt.scatter(csvfile, sometuple)
bndxn
  • 31
  • 3