Skip to content

Commit

Permalink
ecg_plot and rsp_plot don't return fig
Browse files Browse the repository at this point in the history
  • Loading branch information
DominiqueMakowski committed May 14, 2022
1 parent eb81e70 commit 496ebf7
Show file tree
Hide file tree
Showing 11 changed files with 1,215 additions and 1,220 deletions.
6 changes: 3 additions & 3 deletions docs/examples/custom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"signals, info = nk.ecg_process(ecg, sampling_rate=1000)\n",
"\n",
"# Visualize\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down Expand Up @@ -158,7 +158,7 @@
"signals, info = my_processing(ecg)\n",
"\n",
"# Visualize\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down Expand Up @@ -299,7 +299,7 @@
],
"source": [
"signals, info = my_processing(ecg)\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down
1,176 changes: 588 additions & 588 deletions docs/examples/intervalrelated.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/readme/README_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
nk.ecg_plot(signals, sampling_rate=250)

# Save it
plot = nk.ecg_plot(signals, sampling_rate=250)
nk.ecg_plot(signals, sampling_rate=250)
plt.tight_layout()
plot.savefig("README_ecg.png", dpi=300)

Expand All @@ -112,7 +112,7 @@
nk.rsp_plot(signals, sampling_rate=250)

# Save it
plot = nk.rsp_plot(signals, sampling_rate=250)
nk.rsp_plot(signals, sampling_rate=250)
plt.tight_layout()
plt.savefig("README_rsp.png", dpi=300)

Expand Down
6 changes: 3 additions & 3 deletions docs_readthedocs/examples/custom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"signals, info = nk.ecg_process(ecg, sampling_rate=1000)\n",
"\n",
"# Visualize\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down Expand Up @@ -158,7 +158,7 @@
"signals, info = my_processing(ecg)\n",
"\n",
"# Visualize\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down Expand Up @@ -299,7 +299,7 @@
],
"source": [
"signals, info = my_processing(ecg)\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down
1,176 changes: 588 additions & 588 deletions docs_readthedocs/examples/intervalrelated.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs_readthedocs/readme/README_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
nk.ecg_plot(signals, sampling_rate=250)

# Save it
plot = nk.ecg_plot(signals, sampling_rate=250)
nk.ecg_plot(signals, sampling_rate=250)
plt.tight_layout()
plot.savefig("README_ecg.png", dpi=300)

Expand All @@ -112,7 +112,7 @@
nk.rsp_plot(signals, sampling_rate=250)

# Save it
plot = nk.rsp_plot(signals, sampling_rate=250)
nk.rsp_plot(signals, sampling_rate=250)
plt.tight_layout()
plt.savefig("README_rsp.png", dpi=300)

Expand Down
6 changes: 3 additions & 3 deletions docs_wip/examples/bio_custom/bio_custom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"signals, info = nk.ecg_process(ecg, sampling_rate=1000)\n",
"\n",
"# Visualize\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down Expand Up @@ -160,7 +160,7 @@
"signals, info = my_processing(ecg)\n",
"\n",
"# Visualize\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down Expand Up @@ -305,7 +305,7 @@
],
"source": [
"signals, info = my_processing(ecg)\n",
"plot = nk.ecg_plot(signals)"
"nk.ecg_plot(signals)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"# Process ecg\n",
"ecg_signals, info = nk.ecg_process(data[\"ECG\"], sampling_rate=100)\n",
"\n",
"plot = nk.ecg_plot(ecg_signals[:3000], sampling_rate=100)"
"nk.ecg_plot(ecg_signals[:3000], sampling_rate=100)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs_wip/readme/README_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
nk.ecg_plot(signals, sampling_rate=250)

# Save it
plot = nk.ecg_plot(signals, sampling_rate=250)
nk.ecg_plot(signals, sampling_rate=250)
plt.tight_layout()
plot.savefig("README_ecg.png", dpi=300)

Expand All @@ -112,7 +112,7 @@
nk.rsp_plot(signals, sampling_rate=250)

# Save it
plot = nk.rsp_plot(signals, sampling_rate=250)
nk.rsp_plot(signals, sampling_rate=250)
plt.tight_layout()
plt.savefig("README_rsp.png", dpi=300)

Expand Down
2 changes: 0 additions & 2 deletions neurokit2/ecg/ecg_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,3 @@ def ecg_plot(ecg_signals, rpeaks=None, sampling_rate=None, show_type="default"):
fig = signal_fixpeaks(
rpeaks, sampling_rate=sampling_rate, iterative=True, show=True, method="Kubios"
)

return fig
49 changes: 23 additions & 26 deletions neurokit2/rsp/rsp_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
def rsp_plot(rsp_signals, sampling_rate=None):
"""**Visualize respiration (RSP) data**
Parameters
----------
rsp_signals : DataFrame
DataFrame obtained from :func:`.rsp_process`.
sampling_rate : int
The desired sampling rate (in Hz, i.e., samples/second).
Parameters
----------
rsp_signals : DataFrame
DataFrame obtained from :func:`.rsp_process`.
sampling_rate : int
The desired sampling rate (in Hz, i.e., samples/second).
Examples
--------
.. ipython:: python
Examples
--------
.. ipython:: python
import neurokit2 as nk
import neurokit2 as nk
rsp = nk.rsp_simulate(duration=90, respiratory_rate=15)
rsp_signals, info = nk.rsp_process(rsp, sampling_rate=1000)
rsp = nk.rsp_simulate(duration=90, respiratory_rate=15)
rsp_signals, info = nk.rsp_process(rsp, sampling_rate=1000)
@savefig p_rsp_plot1.png scale=100%
fig = nk.rsp_plot(rsp_signals)
@suppress
plt.close()
@savefig p_rsp_plot1.png scale=100%
fig = nk.rsp_plot(rsp_signals)
@suppress
plt.close()
Returns
-------
fig
Figure representing a plot of the processed rsp signals.
Returns
-------
fig
Figure representing a plot of the processed rsp signals.
See Also
--------
rsp_process
See Also
--------
rsp_process
"""
# Mark peaks, troughs and phases.
Expand Down Expand Up @@ -125,9 +125,6 @@ def rsp_plot(rsp_signals, sampling_rate=None):
ax2.axhline(y=amplitude_mean, label="Mean", linestyle="--", color="#009688")
ax2.legend(loc="upper right")

# plt.show()
return fig


# =============================================================================
# Internals
Expand Down

0 comments on commit 496ebf7

Please sign in to comment.