This is a test version of Biostars. For the public version, visit https://www.biostars.org.
right way to working with dataframe and matplotlib

Hi !

I have a question about how I can work with pandas and matplotlib to make scatterplots.

I have a file space delimited like that:

    Flower1 Flower2 Flower3
Garden1 54  17  7   2
Garden2 28  49  13  4
Garden3 84  59  17  1
Garden4 17  3   29  0

In row 1 I have different flowers and in Column 1 I have different gardens, and I have values from Flower-Garden correspondence.

I try to make a scatterplot, using for example, the row 1 as x axis, and the column 1 as y axis, with the following script:

import matplotlib.pyplot as plt
import pandas as pd

df = pd.read_csv("flowers.txt",delim_whitespace=True)
ax = df.plot.scatter(x=df[1:0],y=df[0:1])

But an error occur: ValueError: Must pass DataFrame with boolean values only

Can anyone explain me how I can put those datas in the correct form?

thanks !

matplotlib dataframe graph python

x=df[1:0],y=df[0:1]

This dataframe slicing is not doing what you think it does.

Hello heuristic!

We believe that this post does not fit the main topic of this site.

Not a bioinformatics question, please search/ask StackOverflow

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.