# vtkAxisActor2D() ticks on both sides with n distance

**URL:** https://discourse.vtk.org/t/vtkaxisactor2d-ticks-on-both-sides-with-n-distance/14810
**Category:** Support
**Created:** [November 2, 2024, 8:43am UTC](https://discourse.vtk.org/t/vtkaxisactor2d-ticks-on-both-sides-with-n-distance/14810 "2024-11-02T08:43:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hs\_hs](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hs_hs/32/9436_2.png) [@hs\_hs](https://discourse.vtk.org/u/hs_hs)
#### Post date: [November 2, 2024, 8:43am UTC](https://discourse.vtk.org/t/vtkaxisactor2d-ticks-on-both-sides-with-n-distance/14810/1 "2024-11-02T08:43:28Z")

</div>

```auto
def create_ruler_in(x1, y1, x2, y2,title="",tick_dis=10):
            
            ruler = pv.plotting._vtk.vtkAxisActor2D()
            ruler.GetPositionCoordinate().SetCoordinateSystemToDisplay()
            ruler.GetPosition2Coordinate().SetCoordinateSystemToDisplay()
            ruler.GetPositionCoordinate().SetReferenceCoordinate(None)
            ruler.GetPositionCoordinate().SetValue(x1, y1)
            ruler.GetPosition2Coordinate().SetValue(x2, y2)
            
            distance = np.linalg.norm(np.asarray([x1, y1]) - np.asarray([x2, y2]))
            ruler.SetRange(0, distance)
            
            if title != "":
                ruler.SetTitle(title)
                label_color = pv.plotting.Color('red')
                ruler.SetFontFactor(0.6)
                ruler.GetTitleTextProperty().SetColor(label_color.float_rgb)
                ruler.GetTitleTextProperty().SetFontSize(12)
                ruler.SetTitlePosition(0.5)
                ruler.UseFontSizeFromPropertyOn()
               
                
            ruler.GetProperty().SetColor(*tick_color.int_rgb)    

            ruler.SetLabelVisibility(False)
            ruler.SetTickVisibility(True)
            
            plotter.add_actor(ruler, reset_camera=False, pickable=False)

```

The above is function to draw lines of a cross-hair on pyvista 3d using vtkAxisActor2D(). The ticks are only on one side of the ruler can we make it to both sides And can we dynamically give distance between ticks
