I have the following dataframe df.
root
|-- id: long (nullable = false)
|-- subject: string (nullable = true)
|-- Marks: long (nullable = true)
|-- year: long (nullable = true)
And I want to draw a bar chart using the columns subject, marks and year. For each I want to see how marks for each subject is scored. I am unable to figure out how I can use three or more columns to draw a bar chart. I tried the below code to try mapping all three columns. Is this the correct way?
barchartPandas = df.toPandas()
barchartPandas.pivot('year', 'subject', 'marks').plot.bar(stacked=False, legend=False, figsize=(20,10))
Also if I have Large number of subjects my bar chart is really small. each bar is very tiny where its very difficult to visualize. How can I increase the size of each bar ?
df.limit(1000).toPandas()