Python matplotlib.mlab.psd() Examples
The following are 30
code examples of matplotlib.mlab.psd().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.mlab
, or try the search function
.
Example #1
Source File: test_mlab.py From coffeegrindsize with MIT License | 6 votes |
def test_specgram_auto_psd_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specc, freqspecc, tc = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='psd') assert_array_equal(speca, specc) assert_array_equal(freqspeca, freqspecc) assert_array_equal(ta, tc)
Example #2
Source File: test_mlab.py From ImageFusion with MIT License | 6 votes |
def test_psd_csd_equal(self): freqs = self.freqs_density Pxx, freqsxx = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) Pxy, freqsxy = mlab.csd(x=self.y, y=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_equal(Pxx, Pxy) assert_array_equal(freqsxx, freqsxy)
Example #3
Source File: test_mlab.py From ImageFusion with MIT License | 6 votes |
def test_specgram_auto_default_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specb, freqspecb, tb = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='default') assert_array_equal(speca, specb) assert_array_equal(freqspeca, freqspecb) assert_array_equal(ta, tb)
Example #4
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_psd_windowarray_equal(self): freqs = self.freqs_density win = mlab.window_hanning(np.ones(self.NFFT_density_real)) speca, fspa = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, window=win) specb, fspb = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_equal(fspa, fspb) assert_allclose(speca, specb, atol=1e-08) # extra test for cohere...
Example #5
Source File: test_mlab.py From neural-network-animation with MIT License | 6 votes |
def test_psd_windowarray_equal(self): freqs = self.freqs_density win = mlab.window_hanning(np.ones(self.NFFT_density_real)) speca, fspa = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, window=win) specb, fspb = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_equal(fspa, fspb) assert_allclose(speca, specb, atol=1e-08)
Example #6
Source File: test_mlab.py From neural-network-animation with MIT License | 6 votes |
def test_specgram_auto_psd_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specc, freqspecc, tc = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='psd') assert_array_equal(speca, specc) assert_array_equal(freqspeca, freqspecc) assert_array_equal(ta, tc)
Example #7
Source File: test_mlab.py From neural-network-animation with MIT License | 6 votes |
def test_specgram_auto_default_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specb, freqspecb, tb = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='default') assert_array_equal(speca, specb) assert_array_equal(freqspeca, freqspecb) assert_array_equal(ta, tb)
Example #8
Source File: test_mlab.py From neural-network-animation with MIT License | 6 votes |
def test_psd_csd_equal(self): freqs = self.freqs_density Pxx, freqsxx = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) Pxy, freqsxy = mlab.csd(x=self.y, y=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_equal(Pxx, Pxy) assert_array_equal(freqsxx, freqsxy)
Example #9
Source File: test_mlab.py From coffeegrindsize with MIT License | 6 votes |
def test_psd_csd_equal(self): freqs = self.freqs_density Pxx, freqsxx = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) Pxy, freqsxy = mlab.csd(x=self.y, y=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_almost_equal_nulp(Pxx, Pxy) assert_array_equal(freqsxx, freqsxy)
Example #10
Source File: test_mlab.py From coffeegrindsize with MIT License | 6 votes |
def test_specgram_auto_default_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specb, freqspecb, tb = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='default') assert_array_equal(speca, specb) assert_array_equal(freqspeca, freqspecb) assert_array_equal(ta, tb)
Example #11
Source File: test_mlab.py From coffeegrindsize with MIT License | 6 votes |
def test_psd_windowarray_equal(self): freqs = self.freqs_density win = mlab.window_hanning(np.ones(self.NFFT_density_real)) speca, fspa = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, window=win) specb, fspb = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_equal(fspa, fspb) assert_allclose(speca, specb, atol=1e-08) # extra test for cohere...
Example #12
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_specgram_auto_psd_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specc, freqspecc, tc = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='psd') assert_array_equal(speca, specc) assert_array_equal(freqspeca, freqspecc) assert_array_equal(ta, tc)
Example #13
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_specgram_auto_default_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specb, freqspecb, tb = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='default') assert_array_equal(speca, specb) assert_array_equal(freqspeca, freqspecb) assert_array_equal(ta, tb)
Example #14
Source File: test_mlab.py From ImageFusion with MIT License | 6 votes |
def test_psd_windowarray_equal(self): freqs = self.freqs_density win = mlab.window_hanning(np.ones(self.NFFT_density_real)) speca, fspa = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, window=win) specb, fspb = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_equal(fspa, fspb) assert_allclose(speca, specb, atol=1e-08)
Example #15
Source File: test_mlab.py From ImageFusion with MIT License | 6 votes |
def test_specgram_auto_psd_equal(self): '''test that mlab.specgram without mode and with mode 'default' and 'psd' are all the same''' freqs = self.freqs_specgram speca, freqspeca, ta = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides) specc, freqspecc, tc = mlab.specgram(x=self.y, NFFT=self.NFFT_specgram, Fs=self.Fs, noverlap=self.nover_specgram, pad_to=self.pad_to_specgram, sides=self.sides, mode='psd') assert_array_equal(speca, specc) assert_array_equal(freqspeca, freqspecc) assert_array_equal(ta, tc)
Example #16
Source File: test_mlab.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_psd_csd_equal(self): freqs = self.freqs_density Pxx, freqsxx = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) Pxy, freqsxy = mlab.csd(x=self.y, y=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_array_almost_equal_nulp(Pxx, Pxy) assert_array_equal(freqsxx, freqsxy)
Example #17
Source File: SDR_AIS_waterfall.py From openplotter with GNU General Public License v2.0 | 6 votes |
def update(self, *args): # save center freq. since we're gonna be changing it start_fc = self.sdr.fc # prepare space in buffer # TODO: use indexing to avoid recreating buffer each time self.image_buffer = np.roll(self.image_buffer, 1, axis=0) for scan_num, start_ind in enumerate(range(0, NUM_SCANS_PER_SWEEP*NFFT, NFFT)): self.sdr.fc += self.sdr.rs*scan_num # estimate PSD for one scan samples = self.sdr.read_samples(NUM_SAMPLES_PER_SCAN) psd_scan, f = psd(samples, NFFT=NFFT) self.image_buffer[0, start_ind: start_ind+NFFT] = 10*np.log10(psd_scan) # plot entire sweep self.image.set_array(self.image_buffer) # restore original center freq. self.sdr.fc = start_fc return self.image,
Example #18
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_spectral_helper_psd(self): freqs = self.freqs_density spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, mode='psd') assert_allclose(fsp, freqs, atol=1e-06) assert_allclose(t, self.t_density, atol=1e-06) assert spec.shape[0] == freqs.shape[0] assert spec.shape[1] == self.t_specgram.shape[0]
Example #19
Source File: test_mlab.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_single_spectrum_helper_raises_mode_psd(self): # test that mode 'psd' cannot be used with _single_spectrum_helper with pytest.raises(ValueError): mlab._single_spectrum_helper(x=self.y, mode='psd')
Example #20
Source File: test_mlab.py From coffeegrindsize with MIT License | 5 votes |
def test_psd_detrend_mean_func_offset(self): if self.NFFT_density is None: return freqs = self.freqs_density ydata = np.zeros(self.NFFT_density) ydata1 = ydata+5 ydata2 = ydata+3.3 ydata = np.vstack([ydata1, ydata2]) ydata = np.tile(ydata, (20, 1)) ydatab = ydata.T.flatten() ydata = ydata.flatten() ycontrol = np.zeros_like(ydata) spec_g, fsp_g = mlab.psd(x=ydata, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend=mlab.detrend_mean) spec_b, fsp_b = mlab.psd(x=ydatab, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend=mlab.detrend_mean) spec_c, fsp_c = mlab.psd(x=ycontrol, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides) assert_array_equal(fsp_g, fsp_c) assert_array_equal(fsp_b, fsp_c) assert_allclose(spec_g, spec_c, atol=1e-08) # these should not be almost equal with pytest.raises(AssertionError): assert_allclose(spec_b, spec_c, atol=1e-08)
Example #21
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_psd_windowarray_scale_by_freq(self): freqs = self.freqs_density spec, fsp = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) spec_s, fsp_s = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, scale_by_freq=True) spec_n, fsp_n = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, scale_by_freq=False) assert_array_equal(fsp, fsp_s) assert_array_equal(fsp, fsp_n) assert_array_equal(spec, spec_s) assert_allclose(spec_s, spec_n/self.Fs, atol=1e-08)
Example #22
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_psd_windowarray(self): freqs = self.freqs_density spec, fsp = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, window=np.ones(self.NFFT_density_real)) assert_allclose(fsp, freqs, atol=1e-06) assert_equal(spec.shape, freqs.shape)
Example #23
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_psd_detrend_linear_str_trend(self): if self.NFFT_density is None: return freqs = self.freqs_density ydata = np.arange(self.NFFT_density) ydata1 = ydata+5 ydata2 = ydata+3.3 ydata = np.vstack([ydata1, ydata2]) ydata = np.tile(ydata, (20, 1)) ydatab = ydata.T.flatten() ydata = ydata.flatten() ycontrol = np.zeros_like(ydata) spec_g, fsp_g = mlab.psd(x=ydata, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend='linear') spec_b, fsp_b = mlab.psd(x=ydatab, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend='linear') spec_c, fsp_c = mlab.psd(x=ycontrol, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides) assert_array_equal(fsp_g, fsp_c) assert_array_equal(fsp_b, fsp_c) assert_allclose(spec_g, spec_c, atol=1e-08) # these should not be almost equal assert_raises(AssertionError, assert_allclose, spec_b, spec_c, atol=1e-08)
Example #24
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_psd_detrend_mean_str_offset(self): if self.NFFT_density is None: return freqs = self.freqs_density ydata = np.zeros(self.NFFT_density) ydata1 = ydata+5 ydata2 = ydata+3.3 ydata = np.vstack([ydata1, ydata2]) ydata = np.tile(ydata, (20, 1)) ydatab = ydata.T.flatten() ydata = ydata.flatten() ycontrol = np.zeros_like(ydata) spec_g, fsp_g = mlab.psd(x=ydata, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend='mean') spec_b, fsp_b = mlab.psd(x=ydatab, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend='mean') spec_c, fsp_c = mlab.psd(x=ycontrol, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides) assert_array_equal(fsp_g, fsp_c) assert_array_equal(fsp_b, fsp_c) assert_allclose(spec_g, spec_c, atol=1e-08) # these should not be almost equal assert_raises(AssertionError, assert_allclose, spec_b, spec_c, atol=1e-08)
Example #25
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_psd_detrend_mean_func_offset(self): if self.NFFT_density is None: return freqs = self.freqs_density ydata = np.zeros(self.NFFT_density) ydata1 = ydata+5 ydata2 = ydata+3.3 ydata = np.vstack([ydata1, ydata2]) ydata = np.tile(ydata, (20, 1)) ydatab = ydata.T.flatten() ydata = ydata.flatten() ycontrol = np.zeros_like(ydata) spec_g, fsp_g = mlab.psd(x=ydata, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend=mlab.detrend_mean) spec_b, fsp_b = mlab.psd(x=ydatab, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides, detrend=mlab.detrend_mean) spec_c, fsp_c = mlab.psd(x=ycontrol, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=0, sides=self.sides) assert_array_equal(fsp_g, fsp_c) assert_array_equal(fsp_b, fsp_c) assert_allclose(spec_g, spec_c, atol=1e-08) # these should not be almost equal assert_raises(AssertionError, assert_allclose, spec_b, spec_c, atol=1e-08)
Example #26
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_psd(self): freqs = self.freqs_density spec, fsp = mlab.psd(x=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides) assert_equal(spec.shape, freqs.shape) self.check_freqs(spec, freqs, fsp, self.fstims)
Example #27
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_spectral_helper_psd(self): freqs = self.freqs_density spec, fsp, t = mlab._spectral_helper(x=self.y, y=self.y, NFFT=self.NFFT_density, Fs=self.Fs, noverlap=self.nover_density, pad_to=self.pad_to_density, sides=self.sides, mode='psd') assert_allclose(fsp, freqs, atol=1e-06) assert_allclose(t, self.t_density, atol=1e-06) assert_equal(spec.shape[0], freqs.shape[0]) assert_equal(spec.shape[1], self.t_specgram.shape[0])
Example #28
Source File: test_mlab.py From ImageFusion with MIT License | 5 votes |
def test_single_spectrum_helper_raises_mode_psd(self): # test that mode 'psd' cannot be used with _single_spectrum_helper assert_raises(ValueError, mlab._single_spectrum_helper, x=self.y, mode='psd')
Example #29
Source File: digitalcom.py From scikit-dsp-comm with BSD 2-Clause "Simplified" License | 5 votes |
def my_psd(x,NFFT=2**10,Fs=1): """ A local version of NumPy's PSD function that returns the plot arrays. A mlab.psd wrapper function that returns two ndarrays; makes no attempt to auto plot anything. Parameters ---------- x : ndarray input signal NFFT : a power of two, e.g., 2**10 = 1024 Fs : the sampling rate in Hz Returns ------- Px : ndarray of the power spectrum estimate f : ndarray of frequency values Notes ----- This function makes it easier to overlay spectrum plots because you have better control over the axis scaling than when using psd() in the autoscale mode. Examples -------- >>> import matplotlib.pyplot as plt >>> from sk_dsp_comm import digitalcom as dc >>> from numpy import log10 >>> x,b, data = dc.NRZ_bits(10000,10) >>> Px,f = dc.my_psd(x,2**10,10) >>> plt.plot(f, 10*log10(Px)) >>> plt.show() """ Px,f = pylab.mlab.psd(x,NFFT,Fs) return Px.flatten(), f
Example #30
Source File: rtlsdr_helper.py From scikit-dsp-comm with BSD 2-Clause "Simplified" License | 5 votes |
def _plot_stage2_stream_bokeh(self,w,h): ''' Private method used the create a spectrum analyzer after the stage 2 decimator using a bokeh plot. ''' fig = bfigure(width=w,height=h,title='PSD after Stage 2 Decimation') fig.xaxis.axis_label = "Frequency (Hz)" fig.yaxis.axis_label = "Power Spectral Density (dB/Hz)" samples = await self.rf_queue.get() Px,f = psd(samples,self.plot_NFFT,self.fs) Px = 10*np.log10(Px*self.fs/self.plot_NFFT) f = (f+self.fc) r = fig.line(f,Px) if(self.invert): fig.background_fill_color = "Black" fig.background_fill_alpha = 0.8 r.glyph.line_color="Green" else: fig.background_fill_color = "White" fig.background_fill_alpha = 1.0 r.glyph.line_color="Blue" target = show(fig, notebook_handle=True) while(self.update_rf): samples = await self.rf_queue.get() Px,f = psd(samples,self.plot_NFFT,self.fs) Px = 10*np.log10(Px*self.fs/self.plot_NFFT) f = (f+self.fc) r.data_source.data['x'] = f r.data_source.data['y'] = Px if(self.invert): fig.background_fill_color = "Black" fig.background_fill_alpha = 0.8 r.glyph.line_color = "Green" else: fig.background_fill_color = "White" fig.background_fill_alpha = 1.0 r.glyph.line_color="Blue" push_notebook(handle=target)