[vtkusers] Gridline as the background in VTK (Python)

Slaughter, Andrew E andrew.slaughter at inl.gov
Tue Jun 26 12:44:40 EDT 2018


Here is a script that builds an empty plot, this should be a good starting
point.

#!/usr/bin/env python
import vtk

chart = vtk.vtkChartXY()
plot = vtk.vtkPlotPoints()
chart.AddPlot(plot)

view = vtk.vtkContextActor()
view.GetScene().AddItem(chart)

renderer = vtk.vtkRenderer()
renderer.AddActor(view)
renderer.SetBackground(0.5,0.5,0.5)

window = vtk.vtkRenderWindow()
window.SetSize(500, 500)
window.AddRenderer(renderer)

interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(window)
interactor.Initialize()

window.Render()
interactor.Start()

On Tue, Jun 26, 2018 at 10:04 AM, mafiaskafia <tsilveira1993 at gmail.com>
wrote:

> Hello, I would like to know if it's possible to have a gridline as the
> background of the vtkRenderer (instead of a blank color) like this:
>   <https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__vtk.1045678.n5.nabble.com_file_t342418_halpaa.png&d=DwICAg&c=
> 54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_
> HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=oXz2Jh2vN4kLzvKkknrbCJz0YhnBRG
> hw5Oytmjuqv4Q&s=TLZky1NKFTXcRhpwzuI0rtCdYor9i-XOTRQT_tXZTls&e=> .
> I'm doing a program that does a 2D cross-section analysis using FEM (gives
> its centroid, inertias, etc), so i would need a gridline to display, for
> example, the centroids more efficiently. Is this possible with vtk?
>
> Thanks in advance,
>
> Cheers
>
>
>
> --
> Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__vtk.
> 1045678.n5.nabble.com_VTK-2DUsers-2Df1224199.html&d=DwICAg&c=
> 54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_
> HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=oXz2Jh2vN4kLzvKkknrbCJz0YhnBRG
> hw5Oytmjuqv4Q&s=vqQZY9HpqApGkjO-xUu9-bSVQyT9CuBb_nbJGELav54&e=
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at https://urldefense.proofpoint.
> com/v2/url?u=http-3A__www.kitware.com_opensource_
> opensource.html&d=DwICAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB_
> _aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=
> oXz2Jh2vN4kLzvKkknrbCJz0YhnBRGhw5Oytmjuqv4Q&s=
> bm9lMiY6joExtUXYwzqpu7xPGz7LiO51nameV0Yj-iQ&e=
>
> Please keep messages on-topic and check the VTK FAQ at:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.
> org_Wiki_VTK-5FFAQ&d=DwICAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB_
> _aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=
> oXz2Jh2vN4kLzvKkknrbCJz0YhnBRGhw5Oytmjuqv4Q&s=
> udQgCHTjRSQUvCf1nmOocbHzgTS2Z5EB13hWSWkydnE&e=
>
> Search the list archives at: https://urldefense.proofpoint.
> com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwICAg&c=
> 54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_
> HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=oXz2Jh2vN4kLzvKkknrbCJz0YhnBRG
> hw5Oytmjuqv4Q&s=ojtBttbLzoXPQuYZStnqlpuBAJhO_tK3LH4yON5Fn10&e=
>
> Follow this link to subscribe/unsubscribe:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__public.
> kitware.com_mailman_listinfo_vtkusers&d=DwICAg&c=
> 54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_
> HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=oXz2Jh2vN4kLzvKkknrbCJz0YhnBRG
> hw5Oytmjuqv4Q&s=qH_Xrf6LTnD1ebDxNhFzLVSD_n-BF-4pJOHa1Z6uOTk&e=
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180626/05d17814/attachment.html>


More information about the vtkusers mailing list