I'm interested in rendering matplotlib figures as SVG rather than PNG because the labels and titles in the following app seems unsharp/blurry to me.
from shiny import *
import matplotlib.pyplot as plt
app_ui = ui.page_fluid(
ui.output_plot("dens_plot"),
ui.input_slider(id = "n", label = "slider", min = 10, max = 50, value = 10)
)
def server(input, output, session):
@output
@render.plot()
def dens_plot():
xs = list(range(input.n()+1))
ys = [1]*len(xs)
fig, ax = plt.subplots()
ax.stem(xs, ys , markerfmt = " ")
ax.set_xlabel("X title")
ax.set_ylabel("Y title")
return fig
app = App(app_ui, server)
I tried @render.plot(format = "svg")
but it seems like a different option was already passed as I'm getting:
TypeError: matplotlib.figure.Figure.savefig() got multiple values for keyword argument 'format'
How can I achieve this?