<jupyter_start><jupyter_text>Plotting time series using pyacs.gts.lib.plot Author: <NAME> Date: 27/12/2019<jupyter_code>import numpy as np
# import pyacs time series modules
import pyacs.gts.Gts as Gts
import pyacs.gts.Sgts as Sgts
# loads some time series as Gts objects
albh_pbo = Gts.Gts.read(tsfile='../data/formats/ALBH.pbo.final_igs14.pos',fmt='pos',verbose=True)
# where plot will appear
# in the notebook as an interactive window
%matplotlib notebook
# in a separate interactive qt window
#%matplotlib qt
# in the notebook as a dead window
#%matplotlib inline<jupyter_output><empty_output><jupyter_text>The following cell Plotting using all default values<jupyter_code>albh_pbo.plot()<jupyter_output><empty_output><jupyter_text>This shows how most plot settings can be controled.<jupyter_code>albh_pbo.plot(
              # figure size
              plot_size=(8,4), 
              # components to plot 
              lcomponent = ['U','E'],
              # unit
              unit='m',
              # general title for the plot
              title='site ALBH from GAGE PBO Analysis', 
              # info for each subplot
              info = [("Up component - rms: %.1lf mm" % ( np.std(albh_pbo.detrend().data ,axis=0)[3]*1.E3)),
                     ("East component - rms: %.1lf mm" % ( np.std(albh_pbo.detrend().data ,axis=0)[2]*1.E3))],
              # period for plot in decimal years
              date=[2013.5,2013.9],
              # y-axis bounds for East and North components
              yaxis=[-0.007,0.007],
              # y-axis bounds for Up component
              yupaxis=[-0.02,0.02],
              # rescale error bars
              error_scale=5.,
              # xlabel format, here asking for 2 digits to be displayed
              xlabel_fmt="%.2lf",
              # minor xticks
              xticks_minor_locator = 0.1, 
              # from now on, the key-words are from matplotlib.plot.errorbar
              # marker as circle
              marker='o',
              # size of the marker, set to zero to hide them
              markersize=4,
              # marker color
              markerfacecolor='red',
              # line style
              linestyle='--',
              # width of the line joining data
              linewidth=2,
              # line color
              color='grey',
              # errorbar color
              ecolor='blue',
              # errorbar width
              elinewidth = 2 ,
             )<jupyter_output><empty_output><jupyter_text>plot can also superimpose several time series.In the following example, we will plot original data as dots and smooth data as a red line.For time series to be superimposed, the setting need to be defined through matplotlib.rcParams<jupyter_code># import
import matplotlib as mpl
# filter the original time series
albh_filtered_101 = albh_pbo.median_filter(101)
albh_filtered_vondrak = albh_pbo.vondrak(fc=4)
# setting for the superimposed time series
mpl.rc('lines', linewidth=2, linestyle='--',marker=None,markersize=1)
# plot
albh_pbo.plot(superimposed=[albh_filtered_101,albh_filtered_vondrak], \
              date=[2017.,2018.],
              xticks_minor_locator=1, 
              label=['101','vondrak'],
              lcolor=['black','red'],
              legend=True)<jupyter_output>-- Computing Vondrak filter for component North
-- Computing Vondrak filter for component East
-- Computing Vondrak filter for component Up<jupyter_text>Pyacs plot also handles several date formats<jupyter_code>%matplotlib inline
albh_pbo.plot(plot_size=(8,2.), lcomponent = ['E'], date=[2017.8,2018.3], 
              title='default decimal year')
albh_pbo.plot(plot_size=(8,2.), lcomponent = ['E'], date=[2017.8,2018.3], 
              title='decimal year since 2013.70',date_ref=2013.70)
albh_pbo.plot(plot_size=(8,2.), lcomponent = ['E'], date=[2017.8,2018.3], 
              title='Days since 2018.00',date_unit='days',date_ref=2018.00)
albh_pbo.plot(plot_size=(8,2.), lcomponent = ['E'], date=[2017.8,2018.3], 
              title='default calendar date',date_unit='cal')
albh_pbo.plot(plot_size=(8,2.), lcomponent = ['E'], date=[2018.1,2018.2], 
              title='calendar date - only month and days',date_unit='cal', 
              xticks_minor_locator="%d",xlabel_fmt="%m-%d")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11462907326091981, 'fraction_numerical': 0.03743933441183268, 'mean_word_length': 2.51869918699187, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '487325', 'license': 'MIT', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1316, 'n_words': 337, 'path': 'pyacs_docs/pyacs/downloads/905b7583964989788fea61aed0d6df13/plotting_time_series.ipynb', 'repo_name': 'JMNocquet/jmnocquet.github.io', 'size': '4334'}