Mar-06-2020, 04:55 PM
I'm doing some of the projects from Python Crash Course 2nd Ed., as I'm new to the language.
A simple point plotter throws an error when plt.style() is called. Here's the code:
A simple point plotter throws an error when plt.style() is called. Here's the code:
import matplotlib.pyplot as plt input_values = [1, 2, 3, 4, 5] squares = [1, 4, 9, 16, 25] '''''''The error is here''''''''''''''' plt.style.use('seaborn') ''''''''''''''''''''''''''''''''''''''' fig, ax = plt.subplots() ax.plot(input_values, squares, linewidth=3) # Set chart title and label axes. ax.set_title("Square Numbers", fontsize=24) ax.set_xlabel("Value", fontsize=14) ax.set_ylabel("Square of Value", fontsize=14) # Set size of tick labels. ax.tick_params(axis='both', labelsize=14) plt.show()When I run from my text editor, I get the following error:
Traceback (most recent call last): File "/Users/leecreighton/Desktop/ehmatthes-pcc_2e-d6b34cf/chapter_15/plotting_simple_line_graph/mpl_squares.py", line 6, in <module> plt.style.use('seaborn') AttributeError: 'module' object has no attribute 'style'I have tried doing a clean uninstall and reinstall of anaconda, and I have tried installing matplotlib using pip, and I still get this error. I'm quite disheartened.