9,790 questions
1
vote
1
answer
66
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
2
answers
122
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 ...
3
votes
2
answers
94
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 ...
2
votes
1
answer
80
views
Seaborn pairplot with one dataset having only NaN values leads to unexpected behavior
I have two datasets I'd like to plot in a single corner plot. In some instances, one of the datasets may be empty, but I'd still like the legend to show the keys for both datasets. I thought setting ...
2
votes
1
answer
73
views
How to set background seaborn style in a multi-plot figure with subplot()
I have a multi-plot bar plot figure produced with matplotlib/ seaborn and I'd like to control the tick lines and background style. When I try to use sns.set_style("whitegrid"), the ...
3
votes
2
answers
111
views
Seaborn heatmap with a logarithmic colorbar with each color resembling one order of magnitude?
I´m trying to plot some data in a heatmap. The expected data can be in the range between 1x100 and 1x109, so I´d like to use a discrete logarithmic color scale where one color represents one order of ...
2
votes
0
answers
54
views
broken x axis and broken dual y-axes - draw replot across subplots
My post relates to this one here:
Formatting a broken y axis in python matplotlib
I have borrowed code from this post and adapted it to what I am doing.
I am attempting to create a graph whereby I am ...
1
vote
1
answer
38
views
How to use both fixed colors and colorbar with range in matplotlib/seaborn heatmap
I saw JohanC's answer here:
How to set fixed color ranges with Seaborn heatmap?
When I made my plot, I had two types of cells that I needed to highlight: those with fixed values (e.g.,0 and 1), and ...
1
vote
3
answers
88
views
Can't return graph to website using Flask and HTML
This file is called 'html app.py'
from flask import Flask, render_template, request
import yfinance as yf
import seaborn as sns
import matplotlib.pyplot as plt
import io
import base64
app = Flask(...
2
votes
1
answer
58
views
Seaborn histogram to plot survey answer frequency by gender
I have some survey question answers (letters A, B, C) I'd like to plot in a Seaborn histogram, with the frequency of each response letter grouped by gender.
import pandas as pd
answers = ['A', 'B', 'A'...
1
vote
0
answers
110
views
PCA with direction arrows showing genes associated with samples
I’m trying to reproduce a PCA biplot where
dots = samples coloured by the column sample in pb.obs
arrows = genes, pointing toward the region(s) of the plot where each gene is most highly expressed.
So ...
0
votes
1
answer
120
views
How to set seaborn boxplot color and fill using two variables?
I'm using seaborn to plot a pandas dataframe. I'm currently able to set the color of the boxplot according to one variable ('G') but I also want to be able to set the fill of the boxplot according to ...
0
votes
0
answers
18
views
Python: Labels are only printing for half of my Confusion Matrix in Seaborn [duplicate]
I'm trying to visualize a confusion matrix for the output of a classification algorithm, but Seaborn is only printing the labels of the top half of my confusion matrix, as such:
CM with missing labels
...
1
vote
1
answer
89
views
Controlling Seaborn histplot() lines
Is it possible to change seaborn.histplot() bar lines? They are extremely thin...I tried adding lw = 1.5 or changing edgecolor (since Rectangle gets called) but nothing seems to work. Interestingly, ...
1
vote
1
answer
82
views
Plot heatmap from list
I have an list of lists like so:
my_list = [
['scoreA', 'scoreA', None],['scoreA', 'scoreB', 0.5], ['scoreA', 'scoreC', 0.4],
['scoreB', 'scoreB', None],['scoreB', 'scoreA', 0.5], ['scoreB', '...
2
votes
2
answers
95
views
How to adjust size of violin plot based on number of hues available for each category?
I need to create a violin plot based on two categories. But, some of the combination of categories are not available in the data. So it creates a white space, when i try to make the plot. I remember ...
0
votes
1
answer
66
views
Aligning error bars to bar in seanborn barplot
I'm relatively new to python and trying align error bars for cancer data.
I have a cancer dataset with the following code:
plt.figure(figsize=(16, 6))
# Using the barplot method with error bars
g = ...
0
votes
1
answer
53
views
I need to render a Plotter object on QWidget
I am trying to render a Plotter object created by Seaborn.object.Bar() on Qwidget from PyQt6.
plot = (
so.Plot(result, x = 'XXX', y = 'XXX')
.add(so.Bar(color='lightblue'))
....
0
votes
0
answers
49
views
Can't control what variable to dodge on using so.dodge
I'm trying to pass a list of variables to the so.Dodge function of seaborn objects, so that in my plot provided in the following example, the dodge is applied only on two of three possible variables. ...
1
vote
1
answer
80
views
produce nice barplots with python in PyCharm
I'm working on a very basic barplot in Python where I need to plot a series of length occurrences showcasing how many times a specific one appears.
I'm storing everything in an array, but when I ...
0
votes
0
answers
13
views
Change the color of kde line in sns.histplot [duplicate]
How to change the color of kde line in a histplot of seaborn?
I'm using this code to plot the histogram:
p = sns.histplot(data=diamantes, x='carat', bins=40, color='#90d8fc', kde=True)
In the ...
0
votes
3
answers
84
views
How to remove padding coming from tick labels from other subplots
I have created a set of heatmaps in a 6x3 subplot grid.
As you can see, I added a shared color bar in the last row that spans over all columns (I used a grid spec to realize this).
While iterating ...
0
votes
0
answers
61
views
Have a 3D Effect on Y-axis of a Matplotlib Graph
I have been trying to mimic this bar graph style that I found online. I was able to mimic several different parts, however, I am unable to mimic this 3D feel on the Y-axis. Using Python, any ideas of ...
-3
votes
1
answer
106
views
How to recreate this tile plot in python
I found this plot/diagram and I would like to recreate it in Python. It feels like a heatmap with fixed labels or something, but I think there should be a better solution than that. Any help or hints ...
1
vote
3
answers
82
views
Ways to prevent tkinter from opening a graph on each plot drawn/draw in a selected frame?
I am working on a python tkinter GUI, for plotting/modifying plots for device calibration and data analysis. Basically, I want to list various columns of data and then select regions of said data for ...