#!/usr/bin/env python # coding: utf-8 # ## Plotting example in modern Jupyter # # (In regards to https://stackoverflow.com/q/79533574/8508004 ) # # You can run this from [JupyterLab 4.3 on Binder](https://gist.github.com/jtpio/f3f7aed7c87bb15e07009bb29a601ed8). # Or [here](https://gist.github.com/fomightez/6773dedf6d5132795dd4245a18c066eb), if you'd like Python 3.12 at this time. # # From other one of those Launch that in your browser by hitting '`launch binder`'. # When the session comes up, open a new notebook. # If you choose the first as the launch resource, then furst run `%pip install numpy matplotlib` to install those two packages. Restart the kernel and run the plotting code below. # # You can skip the installation step if you used the second at this time. Runt the plotting code below. # # In[ ]: get_ipython().run_line_magic('pip', "install numpy matplotlib # need if you use jtpio's as source launch at this time") # In[5]: import numpy as np import matplotlib.pyplot as plt x = np.linspace(-10, 10, 100) y = np.sin(x) plt.plot(x, y, marker="x"); # In[ ]: