facet-grid

Left Align the Titles of Each Plotly Subplot

Left Align the Titles of Each Plotly Subplot Question: I have a facet wraped group of plotly express barplots , each with a title. How can I left align each subplot’s title with the left of its plot window? import lorem import plotly.express as px import numpy as np import random items = np.repeat([lorem.sentence() for …

Total answers: 2

How to annotate each lmplot facet by hue group or combined data

How to annotate each lmplot facet by hue group or combined data Question: I’m trying to add annotations to lmplots in a FacetGrid (r and p values for each regression) but the plots have two regression lines because I’m using "hue", and therefore I get two annotations that are stacked on top of each other. …

Total answers: 1

How can I plot a line with markers for separate categories in a relplot?

How can I plot a line with markers for separate categories in a relplot? Question: Using Seaborn I would like to plot both SBP and DBP columns as below. To achieve this, I use: plt.style.use(‘ggplot’) g = sns.relplot(data=r_29, x="DATE_TIME", y="SBP", col="VISIT", col_wrap=2, facet_kws={‘sharey’: False, ‘sharex’: False}, aspect=2, marker=’o’) g = sns.relplot(data=r_29, x="DATE_TIME", y="DBP", col="VISIT", col_wrap=2, …

Total answers: 1

FacetGrid returned seaborn's relplot does not respect hue

FacetGrid returned seaborn's relplot does not respect hue Question: I am encountering a problem in which seaborn’s relplot function creates a FacetGrid that is different from creating the FacetGrid manually. I find this unintuitive and would like the relplot function to give me a FacetGrid that behaves similarly to the manually created one. The issue …

Total answers: 1

How to specify the palette in a seaborn figure-level plot

How to specify the palette in a seaborn figure-level plot Question: I’ve learned to not use seaborn if I need to make specific changes or detail oriented visualizations but I feel like I’m not fully utilizing what it has to offer at times. I have a series of 2D slices plotting cluster memberships. Issue is …

Total answers: 1

displot 'FacetGrid' object is not callable

displot 'FacetGrid' object is not callable Question: I wrote the following code in order to plot a 2×2 displot with seaborn: df = pd.DataFrame( {‘Re’ : x, ‘n’ : y, ‘Type’ : tp, ‘tg’ : tg, ‘gt’ : gt }) g = sns.FacetGrid(df, row=’gt’, col=’tg’, margin_titles=False, height=2.5, aspect=1.65) g.map(sns.displot(df, x=’Re’, y=’n’, hue=’Type’, kind=’kde’,log_scale=True, palette=customPalette, fit_reg=False, …

Total answers: 1

Different functions return different object types, such as FacetGrid and AxesSubplot. Why and what is the difference?

Different functions return different object types, such as FacetGrid and AxesSubplot. Why and what is the difference? Question: I am producing graphs with Python Seaborn. I have noticed that some functions, such as sns.lmplot() return FacetGrid objects. On the other hand, the function sns.countplot() returns an AxesSubplot object of Matplotlib. This made me question: Why …

Total answers: 1

How to add additional plots to a seaborn FacetGrid and specify colors

How to add additional plots to a seaborn FacetGrid and specify colors Question: Is there a way to create a Seaborn line plot with all the lines gray and the mean as a red line? I’m trying to do this with relplot but I don’t know how to separate the mean from the data (and …

Total answers: 3

How to format the y- or x-axis labels in a seaborn FacetGrid

How to format the y- or x-axis labels in a seaborn FacetGrid Question: I want to format y-axis labels in a seaborn FacetGrid plot, with a number of decimals, and/or with some text added. import seaborn as sns import matplotlib.pyplot as plt sns.set(style="ticks") exercise = sns.load_dataset("exercise") g = sns.catplot(x="time", y="pulse", hue="kind", col="diet", data=exercise) #g.xaxis.set_major_formatter(ticker.FuncFormatter(lambda x, …

Total answers: 1

How can I add a title to a relplot in seaborn?

How can I add a title to a relplot in seaborn? Question: This should be easy, but I’ve tried many things (based on seaborn relplot: how to control the location of the legend and add title, How to add a title to Seaborn Facet Plot and also the documentation), but nothing worked. Things I’ve tried: …

Total answers: 1