{"id":534,"date":"2026-04-05T11:27:11","date_gmt":"2026-04-05T03:27:11","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=534"},"modified":"2026-03-23T07:48:55","modified_gmt":"2026-03-23T07:48:55","slug":"how-to-set-crosses-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-set-crosses-using-xlwings\/","title":{"rendered":"How To Set Crosses Using xlwings?"},"content":{"rendered":"<p style=\"margin: 0in; font-size: 16.0pt;\"><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3010<\/span><span lang=\"en-US\" style=\"font-weight: bold; font-family: Calibri;\">Method<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3011<\/span><\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Use the **AxisBetweenCategories** property of the **Axis** object to set the intersection point between the value axis and the category axis. If the value is `True`, the intersection occurs in the middle of the categories; if it is `False`, the intersection occurs at the middle point of the categories.<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\u00a0<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">The **Crosses** property of the **Axis** object returns or sets the point at which the axis intersects with another axis. The possible values for this property are as follows:<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\u00a0<\/p>\n<div style=\"direction: ltr;\">\n<table style=\"direction: ltr; border-collapse: collapse; border: 1pt solid #A3A3A3;\" title=\"\" border=\"1\" summary=\"\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; width: 2.7409in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt; text-align: center;\">Name<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 1.4798in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt; text-align: center;\">Value<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 3.7965in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt; text-align: center;\">Description<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top; width: 2.7409in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">xlAxisCrossesAutomatic<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 1.4798in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">-4105<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 3.768in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Automatically set by Excel<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top; width: 2.7409in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">xlAxisCrossesCustom<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 1.4798in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">-4114<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 3.768in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Set by **CrossesAt** property<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top; width: 2.7409in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">xlAxisCrossesMaximum<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 1.4798in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">2<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 3.768in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Axis crosses at maximum value<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align: top; width: 2.7409in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">xlAxisCrossesMinimum<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 1.4798in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">4<\/p>\n<\/td>\n<td style=\"vertical-align: top; width: 3.768in; padding: 4pt 4pt 4pt 4pt; border: 1pt solid #A3A3A3;\">\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Axis crosses at minimum value<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p lang=\"x-none\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">\u00a0<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">sht.api.Range(&#8216;A1:B7&#8217;).Select()<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">cht=sht.api.Shapes.AddChart().Chart<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">axs2=cht.Axes(2)<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">axs2.Crosses=2<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#axs2.Crosses=-4114<\/p>\n<p lang=\"zh-CN\" style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#axs2.CrossesAt=50<\/p>\n<p lang=\"x-none\" style=\"margin: 0in; font-family: \u5b8b\u4f53; font-size: 8.0pt;\">\u00a0<\/p>\n<p style=\"margin: 0in; font-size: 16.0pt;\"><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3010<\/span><span lang=\"en-US\" style=\"font-weight: bold; font-family: Calibri;\">Example<\/span><span lang=\"zh-CN\" style=\"font-family: 'Microsoft YaHei';\">\u3011<\/span><\/p>\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"768\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-01-8.jpg\" alt=\"\" class=\"wp-image-1176\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-01-8.jpg 880w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-01-8-300x262.jpg 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-01-8-768x670.jpg 768w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u3010<strong>Code<\/strong>\u3011<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\nimport os\n\nroot=os.getcwd()\napp=xw.App(visible=True,add_book=False)\nwb=app.books.open(root+r'\/data2.xlsx',read_only=False)\nsht=wb.sheets('Sheet1')\n\nsht.api.Range('A1:B7').Select()    #\nshp=sht.api.Shapes.AddChart()    #\nshp.Left=20\ncht=shp.Chart\naxs=cht.Axes(1)    #\naxs.Border.ColorIndex=3    #\naxs.Border.Weight=3    #\naxs2=cht.Axes(2)    #\naxs.Crosses=xw.constants.AxisCrosses.xlAxisCrossesMaximum\naxs2.CrossesAt=10\n\n#wb.save()\n#app.kill()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"756\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-22.jpg\" alt=\"\" class=\"wp-image-1178\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-22.jpg 880w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-22-300x258.jpg 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/04\/2-22-768x660.jpg 768w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-534","post","type-post","status-publish","format-standard","hentry","category-xlwings-chart"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=534"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/534\/revisions"}],"predecessor-version":[{"id":1179,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/534\/revisions\/1179"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}