I am using plotnine
visualization library (python version of ggplot in R).
There is a difference in font when I create chart using plotnine
in local Vs in streamlit cloud
.
Below is the comparison of Local Vs streamlit cloud with same code:
On local (font looks on Steroid):
On streamlit (font looks malnourished):
Probably plotnine is not able to pickup the font (family="fantasy")
in streamlit cloud that I am using in the chart.
below is part of the code:
from plotnine import *
(ggplot() +
annotate('text', x = 1, y = 4, label = str(90) + '%', size=70, color="#988275",family="fantasy") +
annotate('text', x = 3, y = 4, label = str(92) + '%', size=70, color="#988275",family="fantasy") +
annotate('text', x = 1, y = 4.7, label = "Normal \nTest Results\nOn Overall\n Test Data",
size=24, color="#988275",family="fantasy") +
annotate('path', x=[.5, 1.5], y=[4.35, 4.35], color="#988275",size=3) +
annotate('path', x=[.5, 1.5], y=[3.7, 3.7], color="#988275",size=3) +
annotate('text', x = 3, y = 4.7, label = "Normal \nTest Results\nOn Latest\n Test Data",
size=24, color="#988275",family="fantasy") +
annotate('path', x=[2.5, 3.5], y=[4.35, 4.35], color="#988275",size=3) +
annotate('path', x=[2.5, 3.5], y=[3.7, 3.7], color="#988275",size=3) +
geom_vline(xintercept=2, color="#988275", linetype="dashed") +
coord_cartesian(xlim=(0.5, 4.5), ylim=(3.5, 5))
+ theme_void()
)
I am not sure what would I need to get the font (family="fantasy")
working.
Would appreciate any help !!
version:
python==3.12.4
streamlit==1.38.0
plotnine==0.14.3