Apr 8, 2012

How to Change the Color in a Python Boxplot

,


The Python Boxplot class provides functions for creating an interactive box for plotting. The Boxplot class creates the plotting area in black, but you can use the "setp" function to draw the lines with a different color. The "setp" function sets up the plotting properties such as colors, width and height for the box plot.

Instructions

    • 1
      Open the Python programming editor on your desktop and open the source code file you want to edit.
    • 2
      Import the Python boxplot libraries. Add the following code to the top of the file:
      import matplotlib.pyplot as plt
      The "plt" statement creates an alias for the library, so you do not need to type the entire library name. Instead, you just reference the libraries with "plt."
    • 3
      Set up the boxplot line color. For instance, add the following code to make the line color red:
      plt.setp(color="red")
 

HowToYo Copyright © 2011 | Template design by O Pregador | Powered by Blogger Templates