Complete the code to import the correct module for custom tick formatting in matplotlib.
from matplotlib.ticker import [1]
The FuncFormatter class is used to create custom tick formatters in matplotlib.
Complete the code to define a function that formats ticks by adding a dollar sign before the value.
def currency_format(x, pos): return [1]
The function must convert the number x to a string and add a dollar sign before it.
Fix the error in the code to apply the custom formatter to the x-axis.
ax.xaxis.set_major_formatter([1](currency_format))The FuncFormatter class wraps the custom function to format ticks.
Fill both blanks to create a dictionary comprehension that formats numbers as percentages if greater than 0.5.
percent_dict = {num: f"[1]%" for num in numbers if num [2] 0.5}The dictionary comprehension converts numbers greater than 0.5 to percentages by multiplying by 100 and converting to int.
Fill all three blanks to create a custom formatter that shows values with 2 decimals and a percent sign only if value is less than 1.
def custom_percent(x, pos): if x [1] 1: return f"{x * 100:[2][3]" else: return str(x)
The function checks if x is less than 1, then formats it as a percentage with 2 decimals using .2f and adds a percent sign.