# Show ECG curve plot

**URL:** https://discourse.slicer.org/t/show-ecg-curve-plot/23291
**Category:** Development
**Tags:** heart
**Created:** [May 5, 2022, 6:58pm UTC](https://discourse.slicer.org/t/show-ecg-curve-plot/23291 "2022-05-05T18:58:24Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [May 5, 2022, 9:58pm UTC](https://discourse.slicer.org/t/show-ecg-curve-plot/23291/2 "2022-05-05T21:58:10Z")

</div>

You can read the ECG signals to a table node. See for example how it is done in the UltrasoundImage3D reader:

> <https://github.com/SlicerHeart/SlicerHeart/blob/bdbffde05b8193d04bf945bf4d5037c73b8d4a27/UltrasoundImage3dReader/UltrasoundImage3dReader.py#L190-L196>

You can find some more plotting examples in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#plots) and more explanations in the documentation ([user guide](https://slicer.readthedocs.io/en/latest/user_guide/modules/plots.html), [developer guide](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#plots)).

If you want to display a view outside the view layout (I would not recommend that, because it is probably better to choose or create an appropriate view layout instead) then you can follow this example:

 ![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/8/580a2bb67a7dc750941c45d49e0c76f23a737a9b.png)

> [@Plotting the signals](https://discourse.slicer.org/t/plotting-the-signals/20242/12):
>
> I could not reproduce any crash with the scripts above, so maybe the issue is how you fill the tables with real data. I’ve made a couple of fixes and improvement (fix order of views, fit plot to the view, adjust labeling, etc.) and this is the result: The updated code: def SetLayout(nChannels): customLayout=( "\<layout type=\"horizontal\" split=\"true\"\>" "\<item\>" "\<layout type=\"vertical\" split=\"true\"\>" "\<item\>" "\<vi…

There is also a simpler example in the [script repository](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#show-a-slice-view-outside-the-view-layout).

To display a marker on the signal, I would recommend to add a series that has a single point or vertical line segment and add that to the chart.

---

_[View the full topic](https://discourse.slicer.org/t/show-ecg-curve-plot/23291)._
