Issues with color and palette


Counplot using Seaborn gives an error when deploying on streamlit Cloud , Works fine in local env

Steps to reproduce

When tying to create a plot using seaborn the error pops up as shown below
This works fine on local env , but not working on web deployment on streamlit
Code snippet:

col1, col2 = st.columns([1,1])

    with col1:
        # Count plot to show the distribution of comments between the various countries whose people tweeted
        with sns.axes_style("darkgrid"):
            fig = plt.figure(figsize = (10,8), facecolor = None)
            sns.countplot(data = df ,y = 'Countries',orient="v",color='#5975a4',palette = sns.color_palette("pastel") ,order = df['Countries'].value_counts().iloc[:20].index)    
            plt.title('Top Contributing Countries')
            plt.ylabel('Countries', fontsize=12)
            plt.xlabel('Frequency of Comments', fontsize=12)

If applicable, please provide the steps we should take to reproduce the error or specified behaviour.

Expected behavior:

Seasborn Should pick up default color and palette or take the provided inputs and give out the plot

Actual behavior:

error message shows up as follows:

2023-05-08 09:08:22.603 Uncaught app exception
Traceback (most recent call last):
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/”, line 565, in _run_script
exec(code, module.dict)
File “/app/sentiment_eda/”, line 119, in
sns.countplot(data = df ,y = ‘Countries’,orient=“v”,color=‘#5975a4’,palette = sns.color_palette(“pastel”) ,order = df[‘Countries’].value_counts().iloc[:20].index)
File “/home/appuser/venv/lib/python3.9/site-packages/seaborn/”, line 2943, in countplot
plotter = _CountPlotter(
File “/home/appuser/venv/lib/python3.9/site-packages/seaborn/”, line 1532, in init
self.establish_colors(color, palette, saturation)
File “/home/appuser/venv/lib/python3.9/site-packages/seaborn/”, line 707, in establish_colors
lum = min(light_vals) * .6
ValueError: min() arg is an empty sequence

Debug info

  • Streamlit version: streamlit-1.22.0
  • Python version: 3.9
  • Issues While deploying StreamLit Cloud, works fine on local env
  • OS version: Windows 10
  • Browser version:

Requirements file

No issues with the requirement found


  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.