Complete the code to set the y-axis scale to logarithmic.
import matplotlib.pyplot as plt plt.plot([1, 10, 100, 1000]) plt.yscale([1]) plt.show()
The yscale function accepts 'log' to set the y-axis to logarithmic scale.
Complete the code to set the x-axis scale to linear.
import matplotlib.pyplot as plt plt.plot([1, 2, 3, 4]) plt.xscale([1]) plt.show()
The xscale function uses 'linear' to set the x-axis to a linear scale.
Fix the error in the code to set the y-axis scale to logarithmic.
import matplotlib.pyplot as plt plt.plot([1, 10, 100, 1000]) plt.yscale([1]) plt.show()
The scale type must be a string in quotes. So use 'log' to avoid errors.
Fill both blanks to set the x-axis to logarithmic and y-axis to linear scale.
import matplotlib.pyplot as plt plt.plot([1, 10, 100, 1000]) plt.xscale([1]) plt.yscale([2]) plt.show()
Use 'log' for logarithmic scale and 'linear' for linear scale, both as strings.
Fill all three blanks to create a plot with x-axis logarithmic, y-axis logarithmic, and set the base of the log scale to 2.
import matplotlib.pyplot as plt plt.plot([1, 2, 4, 8, 16]) plt.xscale([1], base=[2]) plt.yscale([3], base=2) plt.show()
Use 'log' for both axes and set the base to 2 for the x-axis and y-axis log scales.