positron icon indicating copy to clipboard operation
positron copied to clipboard

Plotly always renders in Viewer and ignores preference

Open timtmok opened this issue 1 year ago • 1 comments

When the preference to show HTML plots in the Viewer is disabled, rendering a Plotly plot shows up in the Viewer.

import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
fig

Positron only checks the function call to show() in order to display the plot in the Plots view. We should allow calling fig to also show in the Plots view. We can relax the check on the call stack to the Plotly module.

@timtmok , despite toggling Interactive Plots in Viewer it appears the plot is always rendering in the viewer and never in plots. I tried running against build 2024.10.0-13 and 2024.11.0-3 and both exhibited this behavior.

https://github.com/user-attachments/assets/317713f0-23d4-4bd4-a4b7-01fbf76011e1

Originally posted by @midleman in #4245

timtmok avatar Oct 04 '24 20:10 timtmok

For verification, we should also check that Vetiver apps preview in the viewer pane. Code:

from vetiver import VetiverModel, VetiverAPI
from vetiver.data import mtcars
from sklearn.linear_model import LinearRegression

model = LinearRegression().fit(mtcars.drop(columns="mpg"), mtcars["mpg"])
v = VetiverModel(model, model_name = "cars_linear", prototype_data = mtcars.drop(columns="mpg"))
VetiverAPI(v).run()

seeM avatar Oct 10 '24 10:10 seeM

Verified Fixed

Positron Version(s) : 2024.11.0-60
OS Version          : OSX

Test scenario(s)

Setting is honored now and vetiver works as expected

Link(s) to TestRail test cases run or created:

testlabauto avatar Oct 17 '24 15:10 testlabauto