Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pandas scatterplots: how to make unfilled symbols

I am trying to plot unfilled symbols but the matplotlib facecolors='none' argument just seems to change the fill colour. Note, i am using matplotlib style 'ggplot'.

Original code snippet with filled symbols:

ax=df.plot(kind='scatter', x='clay', y='vf1',xlim=[0,0.6],ylim=[0,6.0e-06],
            color='DarkBlue', s=40, label='u*=1, w=0') 

original, filled contours

Now attempting to use facecolors='none' (and setting edgecolors to the colour i want them)

ax=df.plot(kind='scatter', x='clay', y='vf1',xlim=[0,0.6],ylim=[0,6.0e-06],
            facecolors='none', edgecolors='DarkBlue', s=40, label='u*=1, w=0')     

attempting to unfill contours

It turns out that no matter what colour i enter for 'facecolors', the shading is always light blue. Does anybody know what's going on here, and how i can actually get an unshaded symbol?

***UPDATE**** After BrenBarn's answer below, i have the following, which is exactly what i wanted.

ax=df.plot(kind='scatter', x='clay', y='vf1',xlim=[0,0.6],ylim=[0,6.0e-06],
            c='none', edgecolor='DarkBlue', s=40, label='u*=1, w=0')

perfect!

like image 685
Ian Ashpole Avatar asked Feb 23 '16 17:02

Ian Ashpole


People also ask

Can pandas generate plots?

Pandas uses the plot() method to create diagrams. We can use Pyplot, a submodule of the Matplotlib library to visualize the diagram on the screen. Read more about Matplotlib in our Matplotlib Tutorial.

How do I plot one column in pandas?

To plot a specific column, use the selection method of the subset data tutorial in combination with the plot() method. Hence, the plot() method works on both Series and DataFrame .


1 Answers

It looks like you are not plotting directly with matplotlib, but with pandas (which is using matplotlib under the hood). But pandas' plot methods take a c argument for the point color. Try passing c='none' instead of facecolor='none'.

like image 141
BrenBarn Avatar answered Oct 30 '22 22:10

BrenBarn