1

This is the image which i have generated using iplot in python

How can i show the corresponding data element name , when i am using iplot function . I have used the following commmand to create the plot

data_f = pd.DataFrame({'Third':val , 'Fourth':val2 , 'Sixth':val3  }  )
data_f.iplot( )

Here val,val2,val3 are the Pandas.Series and the corresponding columns are 'Third' , 'Fourth' , 'Sixth' , and for these columns corresponding to the roll number of each student, i want to plot the graph using iplot , showing roll number instead of series of [1,2,3,.. ] in x -axis The corresponding roll numbers are present as series as roll_series.

Thank you in advance for help

1 Answers1

1

One way would be to put all the series in a dataframe and plot as below.

# Create series val, val1, val3 and roll_num
val = np.random.randn(10)
val2 = np.random.randn(10)
val3= np.random.randn(10)
roll_num = np.linspace(start=1001,stop=1010,num=10)

# Create dataframe from above series
df = pd.DataFrame({'val': val, 'val2': val2, 'val3': val3, 'roll_num':roll_num})
df.head(2)

# Plot using iplot() where x-axis now shows student roll number 
df.iplot(x='roll_num', y=['val', 'val2', 'val3'], xTitle='Student Roll Number',yTitle='Score',title='Class Scores')

Plot with student roll number on x-axis using iplot()

Nilesh Ingle
  • 1,777
  • 11
  • 17