import pandas import plotly.express import plotly.graph_objects import urllib.request isotope = '40k' # Example # https://www-nds.iaea.org/relnsd/vcharthtml/api_v0_notebook.html # the service URL livechart = "https://nds.iaea.org/relnsd/v0/data?" CS137 = f"fields=decay_rads&nuclides={isotope}&rad_types=g" def lc_read_csv(url): req = urllib.request.Request(url) req.add_header('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0') return pandas.read_csv(urllib.request.urlopen(req)) # load data into a dataframe # this loading might not work, then use the line below # df = pandas.read_csv(livechart + "fields=decay_rads&nuclides=241am&rad_types=g") df = lc_read_csv(livechart + CS137) df = df[pandas.to_numeric(df['intensity'], errors='coerce').notna()] # remove blanks (unknown intensities) df.intensity = df['intensity'].astype(float) # convert to numeric. Note how one can specify the field by attribute or by string fig = plotly.express.scatter(df, x="energy", y="intensity", log_y=True) # plot in log scale fig.show()