Introduction
Line plots
Multiple histograms
Other plot types
Summary
15. Summary

Instruction

Perfect! It’s time to wrap things up.

  • To create a figure with two subplots in a single row, use:

    figure = plt.figure()
    subplot1 = figure.add_subplot(121)
    subplot2 = figure.add_subplot(122)
  • To draw a line plot, use:

    subplot.plot(data)
  • To draw a histogram, use
    subplot.hist(data)
  • To draw a scatter plot, use:

    plt.scatter(data)
  • To draw a bar plot, use:

    plt.bar(data)
  • To show a figure, use:

    plt.show()
  • To add a legend to a subplot, use:

    subplot.legend()
  • To change the x-axis tick labels, use:

    plt.xticks(range(len(dataFrame['column'])), dataFrame['column'])
  • To set axis labels, use:

    subplot.set_xlabel('...')
    subplot.set_ylabel('...')
  • To set titles for figures and plots, use:

    figure.suptitle('...')
    subplot.set_title('...')

Now, are you ready for a challenge?

Exercise

Click Next exercise to continue.