Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added inline images. #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.tox/
generated/
_build/
.spyproject/
32 changes: 23 additions & 9 deletions gallery/pyspedas_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# in the IDL programming language. For more information on SPEDAS,
# see: http://spedas.org/wiki/
from pyspedas import load_data, gmag_list, subtract_average, version
from pytplot import del_data, get_data, store_data, ylim, tplot, tplot_options, tplot_names
from pytplot import del_data, get_data, store_data, ylim, tplot, options, tplot_options, tplot_names

####################################################################################
# Load and plot THEMIS data
Expand Down Expand Up @@ -54,19 +54,31 @@

####################################################################################
# After working with the data, we can store a new pytplot variable.
# We can store any data in the pytplot object.
# We can also store our own data in the pytplot object.
store_data("tha_new_vel", data={'x': time, 'y': data})

####################################################################################
# Preparing for the plots, we define the y-axis limits.
# Preparing for the plots, we define the y-axis limits for the two panels.
ylim('tha_pos', -23000.0, 81000.0)
ylim('tha_new_vel', -8.0, 12.0)

####################################################################################
# We give a title to the plot and labels for the y-axis panels.
tplot_options('title', 'THEMIS tha position and velocity, 2015-12-31')
options('tha_pos','ytitle','Position')
options('tha_new_vel','ytitle','Velocity')

####################################################################################
# We plot the position and the velocity using the pyqtgraph library (the default).
# Another option is to plot using the bokeh library.
tplot(["tha_pos", "tha_new_vel"])

####################################################################################
# A new window will open, containing the following plot:
#
# .. image:: http://themis.ssl.berkeley.edu/images/pyspedas_demo1.png
# :alt: Themis tha position and velocity
#


####################################################################################
# Load and plot GMAG data
Expand All @@ -82,6 +94,7 @@
# and all GMAG stations, see: http://themis.ssl.berkeley.edu/gmag/gmag_list.php
#
# Get a list of the GMAG stations that belong to the EPO group.
# Internally, this function uses a web service to get a list of the names.
sites = gmag_list(group='epo')

####################################################################################
Expand Down Expand Up @@ -109,12 +122,13 @@
sites_loaded = tplot_names()

####################################################################################
# Plot GMAG and AE index data.
# Use the bokeh library - the plots will appear in the web browser.
# Plot GMAG and AE index data, using the bokeh library.
tplot_options('title', 'EPO GMAG 2015-12-31')
tplot(sites_loaded, bokeh=True)

####################################################################################
# Note: The HTML web page for this example may be missing the plots but this is a
# limitation of the platform for this particular gallery -
# if you run the python code locally, the plots will appear.
# The output will appear in the default web browser:
#
# .. image:: http://themis.ssl.berkeley.edu/images/pyspedas_demo2.png
# :alt: EPO GMAG plot
#