![]() |
VOOZH | about |
Prerequisites:
From the below figure one can infer that a plot consists of X-axis, Y-axis, plot title and the axes. By default, the color of the plot is white. If we have to set the background color of the plot so that our plot looks beautiful, we have to make the axes object, by using axes() attribute after plotting the graph.
Approach:
Follow the given examples to understand better.
Example: Default color plot
Output:
Example 2 : Setting background color to yellow
Output:
Example 3: Setting background color to violet
Output:
We can also set the color of the outer portion of the plot. To set both the color for plot background and for outer portion of the plot the only change we have to do in our code is that we have to add plt.figure(faceccolor='color') before plotting the graph.
Example 1:
Output:
Example 2: Setting plot color using html color codes
Output: