Questions tagged [seaborn]

Seaborn stands out as a popular Python library for data visualization, building upon the foundation of matplotlib. Offering an elevated interface, it enables users to create visually appealing and insightful statistical graphics effortlessly. If you have any inquiries specifically related to seaborn objects, feel free to include the seaborn-0.12.x tag when seeking assistance.

Stacked components create visual interest in histogram

Imagine having a set of values measured daily for the past 90 days. Displaying these values in a histogram can be enhanced by visually segmenting each bar to highlight where measurements are concentrated within specific time frames throughout those 90 days ...

Seaborn provides a visual representation of lexical dispersion through its unique

Utilizing the seaborn library to generate a plot akin to the example provided below. import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns location = "/global/scratch/umalmonj/WRF/juris/golden_hourly_manual_obs.csv" ...

Steps for generating grouped and stacked bar charts

Dealing with a large dataset that includes multiple subsidiaries catering to three distinct customer groups across different countries can be quite challenging. Even though the provided example is simplified, the reality involves significantly more subsidi ...

Adjust the font size of x-axis labels on a Seaborn heatmap

One thing I'm curious about: I used sns.clustermap() to plot the coefficients of 7 variables. The x/y ticks label appear too small (In my case, they are labeled as s1, s2,... s9) Experimented Solutions label='big' tried but no noticeabl ...

Is there a way for me to edit the date range shown on my line graph?

import yfinance as yf import numpy as np import pandas as pd import seaborn as sns SP = yf.Ticker("^GSPC").history(period='1y') Gold = yf.Ticker("GC=F").history(period='1y') Oil = yf.Ticker("CL=F").history(period='1y') SP['P ...

Adding labels to both the percentages and actual values within the cells of a seaborn heatmap confusion matrix

When displaying data on a heatmap, I aim to show both percentages and absolute values like " 15 (20%) " in each cell. I have successfully implemented the code below to display percentages per class. However, I am uncertain how to display both per ...

Adjusting python color schemes to display only one value after reaching a certain threshold

Is it possible to adjust a colormap color scheme to maintain the same color past a specific point? For example, if my current colormap is: import palettable cmap = palettable.colorbrewer.sequential.YlGn_9.mpl_colormap How can I alter this colormap so th ...

making adjacent violin plots in seaborn

I've been experimenting with creating side-by-side violin plots using Matplotlib and Seaborn, but I'm facing challenges in getting them to display correctly. Instead of being superimposed, I want to compare the average Phast scores for different ...

The tight layout in Seaborn sometimes cuts off the plot title

Due to the use of tight_layout(), the title in the plot is being cut off on the right side. https://i.stack.imgur.com/3U0q0.png Is there a way to prevent this from happening? Below is a minimal working example (MWE) for that plot: #!/usr/bin/env python3 ...

What is the method for including commas on both the x and y axes of my seaborn graph?

import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns data = sns.load_dataset("tips") data['total_bill'] = data['total_bill']*1000000 data['tip'] = da ...

How do two whiskers on a Python Seaborn boxplot differ when they are defined as 1.5 times the interquartile range (IQR)?

As per the information provided in the seaborn documentation, it states that the whiskers generated by its boxplot method should be 1.5 times the Interquartile Range (IQR) long. However, when looking at the plot shared in the documentation, this assertion ...

Is there a way to create a combined bar and line plot on a single graph with separate Y axes?

I have two sets of data that share a common index, and I would like to display the first set as a barplot and the second set as a line plot on the same graph. Currently, I am using a method similar to the one shown below. ax = pt.a.plot(alpha = .75, kind ...

Bar chart in Seaborn showing missing values in the axes

I am working with a dataset that contains the following columns: Electronics Answers Smartphone Right Computer Right Smartphone Wrong Smartphone Wrong I am looking to create a barplot using seaborn, where the y-axis represents Electronics ...

Instead of creating a new figure each time in a loop for imshow() in matplotlib, consider updating the current plot instead

I am facing a challenge where I need to save displayed images based on user input, but the issue lies in the fact that unlike plt.other_plots(), plt.imshow() does not overwrite the existing figure, rather it creates a new figure below the existing one. How ...

Utilizing ANOVA analysis and expressing results in scientific notation within a seaborn boxplot

Hi everyone, I've encountered an issue with the scientific notation for the numbers in the y-axis and the ANOVA test not working. Any thoughts on why this might be happening? I suspect there could be some redundancy or conflict in the code, but I have ...

What are some ways to address the issue of legend colors in Python?

Creating a plot using seaborn was quite challenging. Specifically, when I attempted to add a legend using plt.legend, the colors of the legend items were the same and not easily distinguishable. Both 'so2' and 'no2' appeared as blue in ...

Tips for displaying only the decimal component in heatmap annotation floats

I have decimal floats and I'm only concerned with the numbers after the decimal point, as the integer part is irrelevant for my problem. When displaying these numbers on seaborn plots, I need to use string formatting. Currently, I am using '0.2f' to show ...

Creating a cumulative density plot in pandas: A step-by-step guide

I need to showcase the data in my dataframe, which looks like this: count_single count_multi column_names 0 11345 7209 e 1 11125 6607 w 2 10421 5105 j 3 9840 ...

Step-by-step guide on crafting a line and ribbon plot using seaborn objects

I am looking to create a line and ribbon plot, similar to the ones generated with ggplot2 using geom_line + geom_ribbon. You can see an example of what I'm aiming for here: If possible, I would like to utilize the new seaborn.objects interface. However, I ...