Python-pptx Access Category Axis Elements "ticklblskip" & "tickmarkskip"
I used pptx to create a line chart with a lot of indices. I would like to tell ppt to label tick marks every 144 indices using the XML element shown here: http://python-pptx.readt
Solution 1:
Tick-mark spacing on a value axis (the "Y" axis, generally the vertical axis) is controlled by ValueAxis.major_unit
and ValueAxis.minor_unit
:
http://python-pptx.readthedocs.io/en/latest/api/chart.html#value-axes
A value axis has both minor and major tick marks. For example, you might have a long tick mark every five units and a short tick-mark every one unit. These can be controlled separately, including causing them not to appear.
In your case, I think you want something like:
from pptx.enum.chart importXL_TICK_MARKvalue_axis= chart.value_axis
value_axis.major_tick_mark = XL_TICK_MARK.OUTSIDE
value_axis.minor_tick_mark = XL_TICK_MARK.NONE
value_axis.major_unit = 144
Note that an XY (Scatter) chart has a value axis for both the X and Y dimensions; therefore tick marks can be controlled separately for each axis.
A category axis has discrete values (category labels), so tick mark units don't apply.
Post a Comment for "Python-pptx Access Category Axis Elements "ticklblskip" & "tickmarkskip""