### Bug description

I'm trying to incorporate the first example from this [site](https://plotly.com/python/sliders/) in a Quarto document that uses the knitr engine. The .qmd is here:

	---
	title: "test"
	---

	```{r}
	1+1
	```

	```{python}
	#| echo: false
	import plotly.graph_objects as go
	import numpy as np

	# Create figure
	fig = go.Figure()

	# Add traces, one for each slider step
	for step in np.arange(0, 5, 0.1):
		fig.add_trace(
			go.Scatter(
				visible=False,
				line=dict(color="#00CED1", width=6),
				name="𝜈 = " + str(step),
				x=np.arange(0, 10, 0.01),
				y=np.sin(step * np.arange(0, 10, 0.01))))

	# Make 10th trace visible
	fig.data[10].visible = True

	# Create and add slider
	steps = []
	for i in range(len(fig.data)):
		step = dict(
			method="update",
			args=[{"visible": [False] * len(fig.data)},
				  {"title": "Slider switched to step: " + str(i)}],  # layout attribute
		)
		step["args"][0]["visible"][i] = True  # Toggle i'th trace to "visible"
		steps.append(step)

	sliders = [dict(
		active=10,
		currentvalue={"prefix": "Frequency: "},
		pad={"t": 50},
		steps=steps
	)]

	fig.update_layout(
		sliders=sliders
	)

	fig.show()

	```

When I render this, I get an output with three plots like this which isn't intended:

![image](https://user-images.githubusercontent.com/45770265/220930785-0a62012f-5057-4231-af16-6e22f18122a6.png)

Note that if I specify `engine: jupyter` then it works as intended but doesn't render R blocks. 
![image](https://user-images.githubusercontent.com/45770265/220932215-a1a58277-8127-4546-9cfa-d0f0cdf878fa.png)

It also works when calling `py_run_file(test.py)` within R where `test.py` contains the content of the Python block above, so it appears that the `reticulate` package is working as it should on this code block.

Side question: Is it not possible to mix render engines? So have Python render Python code blocks and R render R code blocks?




### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid
2023-02-23T14:14:33Z
snhansen
bug upstream
v1.4
open
Plotly figure not rendered correctly with the knitr engine
https://github.com/quarto-dev/quarto-cli/issues/4507