krigar_b
Mmarimo
•Created by krigar_b on 12/16/2023 in #archived-help-and-support
My notebook does not show the matplotlib
Thank you so much!
7 replies
Mmarimo
•Created by krigar_b on 12/16/2023 in #archived-help-and-support
My notebook does not show the matplotlib
The top cell shows up in app view - the rest don't
7 replies
Mmarimo
•Created by krigar_b on 12/16/2023 in #archived-help-and-support
My notebook does not show the matplotlib
@app.cell
def (mo):
userprhour = mo.ui.slider(start=0, stop=10000000, step=500000, label="users per hour")
sigma = mo.ui.slider(start=1, stop=6, step=0.5, label="sigma")
[userprhour, sigma]
return sigma, userprhour
@app.cell
def (np, plt, sigma):
# Parameters for the Gaussian distribution
mean = 300
std_deviation = np.sqrt(300)
# Generating points on the x axis between -4 and 4
x = np.linspace(0, 1000, 1000)
# Calculating the Gaussian distribution values for each x
y = (1 / (np.sqrt(2 * np.pi) * std_deviation)) * np.exp(
-0.5 * ((x - mean) / std_deviation) ** 2
)
# Creating the plot
plt.figure(figsize=(8, 6))
plt.plot(x, y, label="Gaussian Distribution\nMean = 0, Std Dev = 1")
plt.vlines(
300 + np.sqrt(300) * sigma.value, 0, 0.02, colors="k", linestyles="solid"
)
plt.title("Gaussian Distribution")
plt.xlabel("x")
plt.ylabel("Probability Density")
plt.legend()
plt.grid(True)
plt.show()
return mean, std_deviation, x, y
@app.cell
def (factorial, np, plt):
t = np.arange(0, 100, 0.1)
d = np.exp(-10)*np.power(10, t)/factorial(t)
plt.plot(t, d)
plt.show()
return d, t
@app.cell
def ():
import marimo as mo
from scipy.special import factorial
import numpy as np
import matplotlib.pyplot as plt
return factorial, mo, np, plt
if name == "main":
app.run()
7 replies