9,772 questions
0
votes
1
answer
186
views
How can I make this plot using Seaborn or matplotlib?
How can I make this plot using Seaborn or matplotlib? A key requirement is that the plot code be less than about 10 lines (this code is meant to go in a book and should not require a PhD in matplotlib)...
3
votes
1
answer
108
views
Seaborn split violin plot with multiple hue categories but on one single axis
I am in the process of migrating code and workflows from R-tidyverse/ggplot2 to Python and I'm trying to replicate something that worked for me in R. My challenge in this case is working with split ...
4
votes
1
answer
117
views
alignment of seaborn boxplot and stripplot in two different figures with set box width
I have a dataset for simulated and experimental values for different categories (temperatures, design). I want to create two figures to compare simulated and experimental values for 1.) temperature (...
2
votes
0
answers
53
views
What is wrong with my PIL looped image paste?
I have script that loops over a set of json color themes, uses seaborn and matplotlib to generate a labeled swatch and then saves it to a buffer. I want to paste the buffer into a new PIL.Image but ...
0
votes
2
answers
158
views
Data visualization with clear bars on a histogram?
I am making a histogram where all the bars are overlapped, but even with the transparency lowered for the bars, it still looks like a mess to me. I thought if I could make the bars themselves ...
3
votes
2
answers
98
views
Seaborn plot with lines inbetween pairs of data points showing value differences
I have the following plot made with Python seaborn:
The plot I have:
Obtained by this piece of code:
plot = sns.scatterplot(data=by_sent_type, s=50)
plot.set(xlabel="pair", ylabel="...
4
votes
1
answer
134
views
Seaborn legend italicize legend titles
I'm working on a scatterplot done with Seaborn; now, I'm pretty happy with the result achieved so far but there is one thing I wish to fix.
In my legend I have two type of entries: sample and genome, ...
Best practices
2
votes
4
replies
81
views
Visualizing categorical features with severe Class Imbalance for ML: Absolute Counts vs Normalized Percentages?
I am performing Exploratory Data Analysis (EDA) on a medical dataset (Primary Biliary Cirrhosis) to select features for a multiclass classification model. My target variable is Stage (1, 2, 3, 4).
The ...
Tooling
0
votes
3
replies
57
views
How to better emulate this broken line plot with matplotlib or seaborn?
What I want to achieve is something as below:
I have found the brokenaxes package here, and tried it:
from brokenaxes import brokenaxes
import numpy as np
bax = brokenaxes(xlims=((0, 10), (195, 200))...
Advice
0
votes
2
replies
60
views
Adjust bandwidth in seaborn.displot KDE plot
Here is the plot I obtain with default settings of seaborn.displot
sns.displot(df, x='duration', y='distance', kind='kde', fill=True)
this lead to negative values for duration which as no meaning. ...
1
vote
1
answer
140
views
Format y-axis as percentage in a seaborn.objects plot
I found a suggestion to use ticker.PercentFormatter. This changed the decimal numbers on the y-axis to percentages like I want, but the style formatting (grid, background, etc.) is lost, and the ...
1
vote
1
answer
77
views
Boxplot with scatter points: preventing overlap when categories are similar
I am trying to create a boxplot with different categories and overlay scatter points on top of it. The problem I am encountering is that when the results across categories are very similar, the ...
0
votes
2
answers
157
views
Can I use Python built-in data structures for Seaborn plots?
say I create a dataclass for recording some data:
@dataclass
class HourlyReading:
temperature: float
pressure: int
I create a list of my dataclass instances and regularly add data to ...
1
vote
1
answer
118
views
Specify hue when having multiple vertical plots in same graphic
I use a swarmplot to display vertically multiple distributions in the same graphic:
df = polars.read_csv("...")
ax = seaborn.swarmplot(data=[df["ColA"], df["ColB"], df[&...
3
votes
2
answers
130
views
How to generate scatter plot of all numeric columns against specific columns in the same dataframe
I have a dataframe with a mix of data types (object and numeric). I want to plot a scatter plot for all numeric columns in the dataset against specific columns: col_32, col_69,col_74 and col_80 ...