For instance, for a graph such as this made with basic plotly code
What is the font used here?
The default font family spec is "Open Sans", verdana, arial, sans-serif
, as listed in Python Figure Reference: layout
from the Plotly documentation. The precise font selected depends on which fonts you have installed on your system. If Open Sans is available, that font will be selected. If you don't have Open Sans, Plotly will try to use Verdana, and in absence of that, Arial. If no font from any of those families is available, Plotly will default to using any sans-serif available on your system.
Based solely on the shape of the lowercase a
in the title of the plot you posted, it appears that your plot was rendered using Open Sans.
The relevant passage from the Pyplot documentation is quoted below (emphasis mine).
font
Code:
fig.update_layout(font=dict(...))
Type: dict containing one or more of the keys listed below.Sets the global font. Note that fonts used in traces and other layout components inherit from the global font.
family
Code:
fig.update_layout(font_family=<VALUE>)
Type: string
Default:""Open Sans", verdana, arial, sans-serif"
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system.
Based on Plotly's documentation:
You can set the figure-wide font with the layout.font attribute, which will apply to all titles and tick labels, but this can be overridden for specific plot items like individual axes and legend titles etc. In the following figure, we set the figure-wide font to Courier New in blue, and then override this for certain parts of the figure.
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_length", y="sepal_width", color="species",
title="Playing with Fonts")
fig.update_layout(
font_family="Courier New",
font_color="blue",
title_font_family="Times New Roman",
title_font_color="red",
legend_title_font_color="green"
)
fig.update_xaxes(title_font_family="Arial")
fig.show()
But by default, it really depends on the browser rendering the output. HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates.