Questions tagged [seaborn]
Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics.
8,573
questions
-1
votes
3
answers
41
views
Plot number of persons in each car
I have a pandas dataframe which looks like this:
car,id
1,1
1,2
2,3
2,4
2,5
and so on
What I want to do is make a lineplot in seaborn that shows how many ids there are in each car ( I dont care for ...
1
vote
1
answer
39
views
Bar chart with line graph [duplicate]
Looking to combine two visuals into a single graphic in python much like you can combine in R. I'm running into issues with it actually combining.
Using pandas and seaborn packages I have a dataframe ...
0
votes
1
answer
29
views
Use color map from seaborn sns.pairplot tab10_r on mpl_toolkits 3D scatter plot
I am trying to get the first two colors found in the sns.pairplot shown here using
colors = dict(zip(['2', '1', '0'], sns.color_palette('tab10_r', 3)))
on the 3D scatter plot using mpl_toolkits. ...
0
votes
1
answer
27
views
Plot Dynamic graph of live dataframe of multiple columns using Python
I'm trying to plot dynamic graph with live data.
Below is sample dataframe in which after every 30 seconds I want to add data which I'm collecting from other function.
Dynamic DataFrame
TIME ...
-2
votes
0
answers
17
views
How to print Seaborn heat map's annotations? [closed]
I have this rather big dataset with more than 40 features in Python.
I have plotted a heat map of these using Seaborn.
The issue being: when using annot=True to display each correlations/annotations ...
-1
votes
0
answers
20
views
Seaborn heatmap takes time to execute [closed]
I created a code which plots a heatmap whenever a button is pressed. The plot is generated inside a method and the method is called whenever the button is pressed. However, every time the button is ...
0
votes
0
answers
37
views
Weighting the seaborn histplot probabilities when viewing multiple distributions
I am plotting four distributions using seaborn histplot. I can view the bin probability for each distribution but would like to reweight these probabilities so the total sum of probabilities across ...
0
votes
0
answers
42
views
Error with categorical dataset Seaborn scatterplot
I have converted numerical to categorical data to be used in the legend of a Seaborn scatterplot.
import pandas as pd
import seaborn as sns
data = [['Sample_1', 130, 325, 1989], ['Sample_2', 128, 348,...
1
vote
1
answer
35
views
Visualize a binary vector [duplicate]
I have a binary column in pandas dataframe. I want to visualize it, just to see how much there is 0 or 1. I used displot:
Plot = sns.displot(data = data, x = 'stroke', color = 'm')
Plot.fig.suptitle('...
0
votes
1
answer
39
views
How to quickly create a grid of histograms
fig, axes = plt.subplots(4,3, figsize=(17,17))
axes = axes.flatten()
labels = ['d','f']
l1 = sns.histplot(ax=axes[0],hue=dff_2k['source'],x='a', data=dff_2k)
l2 = sns.histplot(ax=axes[1],hue=dff_2k['...
0
votes
1
answer
39
views
How, for one plot only, to change the width with Seaborn/Matplotlib [duplicate]
This code creates following PNG file though, This wasn't what I want.
import seaborn as sns
import matplotlib.pyplot as plt
fig, ax = plt.subplots(2,figsize=(20, 6),gridspec_kw={'height_ratios': [2,1]...
0
votes
0
answers
18
views
Rotating boxplot x-axis labels in subplots [duplicate]
I found a a code that uses subplots so that i can plot two boxplots in one picture
Now when i want to rotate the x labels it only rotates the x labels of the last one, but not of both plot
names = ...
0
votes
0
answers
33
views
Can I put my ticks on the sides of tiles in a seaborn heatmap? [duplicate]
Like the tick marks for the x-axis go: -10, 10, 30, 50, ..., 190 but not on the center of a tile but on its side.
Code is from: https://www.youtube.com/watch?v=m7uXFyPN2Sk&list=WL&index=10&...
0
votes
0
answers
23
views
How can I plot all columns of data frame as linear regression in a single subplot? [duplicate]
I am able to do so by following code but it is not subplot it is by loop:
for col in data.columns:
sns.lmplot(x=col, y='Amount', hue='Class', data=data, line_kws={"color": "red"})...
0
votes
0
answers
45
views
Adjusting SNS heatmap size for large dataset [closed]
I am working with the Advanced Regression Housing dataset with 81 variables. I am using the SNS heatmap to visualize the correlation between each of these 81 variables. I need help adjusting the size ...
-1
votes
0
answers
25
views
Query Regarding Normalization of a feature with multiple peaks
If during plotting distribution plot (using sns.distplot) of a feature we get multiple peaks, do we need to normalize it. If yes how can we do it
-1
votes
0
answers
29
views
ValueError: No variables found for grid columns. Seaborn error [closed]
I want to visualize my data by using seaborn
I wrote this line of code
'''
sns.pairplot(data = df_covid, hue = 'study_type',height=2,diag_kind='hist')
'''
And I got the error
ValueError: ...
-1
votes
0
answers
23
views
Plotting a specific data set in Python [duplicate]
I have a list A. Here in A[0], (0, 0) represents the origin coordinate of the arrow and (1, 0) is the end coordinate of the arrow. Is there a way I can plot this data set in this form? The expected ...
0
votes
0
answers
47
views
Issue with Seaborn Box Plot Legend
I plotted a Box plot using seaborn.
import seaborn as sns
sns.set(rc={'figure.figsize':(4,10)})
sns.set_theme(style="whitegrid")
plt.rcParams["font.family"] = "Calibri"
...
0
votes
0
answers
17
views
How to display graphs on linux terminal using python seaborn and matplotlib [duplicate]
I wrote a script to display a histplot using seaborn and matplot. The python script is working fine when I run it on VS code. But when I run it using Linux terminal, the plot is not showing. I do not ...
0
votes
0
answers
24
views
How to control the marker shape in an sns jointplot? [duplicate]
I have the following code to create an sns jointplot:
p = sns.jointplot(
data=images,
x="Valence",
y="Arousal",
hue="image_cat_broad",
palette="...
1
vote
2
answers
83
views
How to prevent gridlines showing through when using alpha
Gridlines can be set behind the plot of a filled area by using either ax.set_axisbelow(True) or plt.rc('axes', axisbelow=True) (other stack question). But when using an alpha<1 then the gridlines ...
2
votes
2
answers
51
views
How to display a bar category on the axis when the value is 0
I have a dataframe column with the category of the corresponding row blood pressure systolic and diastolic values as obtained by the following function:
def classify_bp(row):
if row.SYS < 120 ...
2
votes
1
answer
40
views
How to sort a confusion matrix by the diagonal value
I have this confusion matrix:
import pandas as pd
import seaborn as sn
import matplotlib.pyplot as plt
data = {'y_Actual': [3, 3, 1, 1, 0, 1, 2, 3, 1, 1, 1, 0, 2, 4, 3],
'y_Predicted': [1, ...
0
votes
0
answers
33
views
relplot hue unable to parse strings it thinks are numeric
At least I think this is the issue.
I have a dataframe that looks like this:
import pandas as pd
import seaborn as sns
data = {0: [0.187041, -0.07495, 0.383563, -0.258548, -0.137496],
1: [0....
0
votes
1
answer
38
views
Issue with Seaborn, not showing the values for Y axis in countplot
I have the following dataframe (ordered_recurrent_df) which I wish to plot in Seaborn's countplot:
ordered_recurrent_df:
Month Card
January 4
February 7
March 11
April 32
May ...
0
votes
0
answers
50
views
Python. How to plot regression lines per groupby object in separate axes using seaborn
Here is my dataset with:
3 surveys (exp1, exp2 and exp3)
Each survey contains 2 trials (trial1,trial2)
The trials were evaluated using 3 features (feature1, feature2 and feature2)
I'm investigating ...
0
votes
0
answers
54
views
Seaborn regplot and bar superimposed: unable to see the bars [closed]
Dear friends I have blood pressure data which I am plotting with a seaborn regplot function and get a nice scatterplot of both high and low values and related regression lines with the x values being ...
-2
votes
0
answers
27
views
Trying to adjust tick marks on Seaborn Plot
I created a distribution plot using seaborn, but the data is small. I'm trying to adjust the tick marks using .set, but I'm getting an error. Is there a way to set the tick marks automatically based ...
-1
votes
0
answers
38
views
Can someone explain what get_legend_handles_labels() does [duplicate]
I'm trying to learn plotting in Python using Seaborn. I'm unable to add a proper legend to my plot. Can someone explain what this snippet does?
# Plots of average count across hour in a day for ...
0
votes
0
answers
40
views
Saving catplot subfigures into a single figure file [duplicate]
I need to combine catplot subfigures into a single figure and then save that figure to a file. I used plt.subplots to create independent axis for each subfigure and then assigned the catplots to the ...
-1
votes
0
answers
36
views
value error; could not interpret input 'category_name'
I tried to create a boxplot using seaborn but it keeps returning value error, saying it could not interpret input 'category name' I can't post a snapshot, so here is the code line and error message.
...
0
votes
0
answers
49
views
How to format float display to round thousands in python [duplicate]
I try to format data:
154,345.00 as 154K
or at least as 154.
I need to use it as annotations on a seaborn heatmap. It has formatting field fmt=''
I searched through string formatting rules but did not ...
0
votes
0
answers
44
views
How do I plot a bar chart grouped by one feature and "hued" by another? [duplicate]
My dataframe has columns for score_class, status and cbk_percent.
import pandas as pd
df = pd.DataFrame([[10,60,'active'], [20,35,'active'], [30,42,'active'], [40,80,'active'],
[...
-1
votes
0
answers
44
views
Error formatting date on x axis using seaborn boxplot and pandas df [closed]
Could someone please expand on what is needed to reopen the question? I also posted the answer in the comments. Also, after corresponding with some colleagues, it seems like this is a common issue ...
0
votes
1
answer
43
views
seaborn violin plot with frequency and values in separate columns
I have some DataFrame:
import pandas as pd
import numpy as np
import seaborn as sns
np.random.seed(1)
data = {'values': range(0,200,1), 'frequency': np.random.randint(low=0, high=2000, size=200)}
df =...
0
votes
0
answers
34
views
python seaborn - Superimpose a hatched boxplot on a filled one [duplicate]
I would like to superimpose a hatched boxplot on another one. On the right figure, I get almost what I want with the shown code except the caps and median are not the same colors as the "walls&...
-4
votes
0
answers
38
views
how to apply colour to my histogram in matplotlib by using seaborn? [closed]
I created a pyplot but I cant color my histogram when I apply color to pyplot it changed from histogram to line graph. what should I do?
-1
votes
0
answers
39
views
Creating heatmap of diagonal matrix using seaborn [closed]
I am using the following code to generate a heatmap of a diagonal matrix where the data values range from 94.3 to 100. But I am not getting a color gradient but a single color. Can anyone tell me what'...
0
votes
0
answers
21
views
How to create a horizonal line using start date and end date [duplicate]
I am trying to use the below dataframe to create horizontal reference lines,
data = pd.DataFrame({'Drug Name':['Katrex','Acyloir','Zelorix'],'Start Date': ['2001-11-13', '2002-6-26', '2004-2-22'],'End ...
1
vote
1
answer
48
views
How to add spacing between each block of a heatmap
I have a matrix like this. Is there a way I can add some white lines between it without changing the scaling. I have used matplotlib for this graph:
Something like this should work.:
Code ->
# ...
0
votes
2
answers
33
views
rotating xticks in seaborn scatterplot [duplicate]
i have an aggregate dataset that i am trying to visualise, it looks like that:
and i need to plot some statistics for 18 states. currently the plot looks in the following way:
and i manage to set ...
0
votes
0
answers
33
views
why seaborn plot matrix doesn't show the numbers in center of matrix? [duplicate]
I'm trying to plot a confusion matrix with seaborn. here is my code:
u=['Fire','No Fire']
v=['Fire','No Fire']
plt.figure(figsize=(5,5),dpi=500)
plt.rcParams["font.family"] = "serif&...
1
vote
2
answers
67
views
How to boxplot multiple dictionaries on the same plot
For a change point detection task, I am testing my own algorithm against a baseline, and I would like to plot the results from the two algorithms on the same boxplot.
My results (F Score values) are ...
1
vote
0
answers
21
views
Understanding the correlations in pairplots [migrated]
I was using pairplots and I'm stuck in understanding the pair wise relation between those features that have vertical or horizontal lines in the pair plots.
(Image source - source)
The correlation ...
-1
votes
0
answers
33
views
How to save figures in Jupyter notenook [duplicate]
I cannot save the figures from jupyter notebook. I used sns to draw and use savefig, but there is something strange with my picture. it's all blacked out
0
votes
0
answers
24
views
How to make seaborn scatterplot with a single regression line, but overlay other points
I have a dataset that I divided into a "training set" and a "test set." I'm trying to plot a regression plot of just the "training set", but also add the "test set&...
1
vote
1
answer
49
views
Change plot order of seaborn pairplot [duplicate]
For the seaborn pairplot shown below, how to change the order of the Labels, so that hidden points can be viewed in subsequent plots?
Note that I looked at this link, but could not configure my code ...
0
votes
1
answer
48
views
Pyplot plot horizontal line on specified value of Y axis on Heatmap
I currently have a dataframe, df:
In [1]: df
Out [1]:
one two
0.5 4.62
1.0 12.23
1.5 17.53
2.0 20.32
2.5 19.37
...
0
votes
0
answers
41
views
How to plot two charts on top of each other, sharing the same y axis, but having x axis mirror just for one of the charts in python [duplicate]
I have the chart below:
Almost everything is fine, except that I want to see the numbers close to the y axis on the right side of the chart.
They represent values that correspond to the labels on y ...