Hướng dẫn dùng tick_params matplotlib python
Change the appearance of ticks, tick labels, and gridlines. Tick properties that are not explicitly set using the keyword arguments remain unchanged unless reset is True. Parametersaxis{'x', 'y', 'both'}, default: 'both'The axis to which the parameters are applied. which{'major', 'minor', 'both'}, default: 'major'The group of ticks to which the parameters are applied. resetbool, default: FalseWhether to reset the ticks to defaults before updating them. Other Parametersdirection{'in', 'out', 'inout'}Puts ticks inside the axes, outside the axes, or both. lengthfloatTick length in points. widthfloatTick width in points. colorcolorTick color. padfloatDistance in points between tick and label. labelsizefloat or strTick label font size in points or as a string (e.g., 'large'). labelcolorcolorTick label color. colorscolorTick color and label color. zorderfloatTick and label zorder. Whether to draw the respective ticks. labelbottom, labeltop, labelleft, labelrightboolWhether to draw the respective tick labels. labelrotationfloatTick label rotation grid_colorcolorGridline color. grid_alphafloatTransparency of gridlines: 0 (transparent) to 1 (opaque). grid_linewidthfloatWidth of gridlines in points. grid_linestylestrAny valid Examples ax.tick_params(direction='out', length=6, width=2, colors='r', grid_color='r', grid_alpha=0.5) This will make all major ticks be red, pointing out of the box, and with dimensions 6 points by 2 points. Tick labels will also be red. Gridlines will be red and translucent. Examples using |