9,772 questions
0
votes
1
answer
187
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)...
3264
votes
16
answers
6.4m
views
How do I change the size of figures drawn with Matplotlib?
How do I change the size of figure drawn with Matplotlib?
1727
votes
18
answers
2.1m
views
How to put the legend outside the plot
I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets ...
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 (...
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 ...
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 ...
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 ...
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="...
527
votes
14
answers
1.4m
views
How to change the figure size of a seaborn axes or figure level plot
How do I change the size of my image so it's suitable for printing?
For example, I'd like to use an A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.
4
votes
1
answer
135
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, ...
602
votes
12
answers
1.0m
views
Improve subplot size/spacing with many subplots
I need to generate a whole bunch of vertically-stacked plots in matplotlib. The result will be saved using savefig and viewed on a webpage, so I don't care how tall the final image is, as long as 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))...
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 ...
306
votes
12
answers
550k
views
How to save a Seaborn plot into a file
I tried the following code (test_seaborn.py):
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
matplotlib.style.use('ggplot')
import seaborn as sns
sns.set()
df = sns....
377
votes
7
answers
858k
views
Plot a horizontal line on a given plot
How do I add a horizontal line to an existing plot?