0

I have a DataFrame that looks as follows:

        C    gamma  precision
0     1.0  0.00001   0.044040
1     1.0  0.00010   0.044063
2     1.0  0.00100   0.349788
3     1.0  0.01000   0.359441
4     1.0  0.10000   0.367857
5    10.0  0.00001   0.090369
6    10.0  0.00010   0.347510
7    10.0  0.00100   0.358762
8    10.0  0.01000   0.354194
9    10.0  0.10000   0.337157
10   50.0  0.00001   0.340957
11   50.0  0.00010   0.356938
12   50.0  0.00100   0.357969
13   50.0  0.01000   0.365525
14   50.0  0.10000   0.318042
15  100.0  0.00001   0.348168
16  100.0  0.00010   0.358309
17  100.0  0.00100   0.353821
18  100.0  0.01000   0.356823
19  100.0  0.10000   0.311630

I'm struggling with creating plot similar to this: enter image description here

Gamma is the X-axis, Precision is Y-axis and every line represents unique value of C.

1
  • It will be nice to provide code you have written and the output you are getting out of it. Then compare it to expected output. Commented May 30, 2016 at 10:48

1 Answer 1

3

For plotting each line with a unique C you could do something like this:

pl.figure()
ax=pl.gca()
for c in df['C'].unique():
    df.loc[df['C'] == c].plot(ax=ax, x='gamma', y='precision', label='C: {}'.format(c))

df['C'].unique() creates an array with all unique values of C, df.loc[df['C'] == c] selects all rows with the same value of C, and by setting the x and y parameters of plot() you can plot one column versus another.

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

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.