Variable marker sizes in Seaborn `pairplot` scatter diagrams [duplicate] - seaborn

This question already has answers here:
How to have gradient colors and marker sizes for seaborn pairplot
(1 answer)
Changing the size of seaborn pairplot markers
(2 answers)
Closed 12 months ago.
I'd like to be able to assign the sizes of markers in Seaborn pairplot scatter diagrams. However, pairplot appears to require a long-form dataframe as input, and attempting to specify a scatterplot size thusly:
import seaborn as sns
penguins = sns.load_dataset("penguins")
spp = sns.pairplot(penguins)
spp.map_offdiag(sns.scatterplot(size='body_mass_g'))
… leads to the following error:
ValueError: The following variable cannot be assigned with wide-form data: 'size'
… which appears to indicate that the data which is passed to the scatterplot instances is in wide-form.
It would appear there's a mutual incompatibility here, but is there a way to do this?

Related

How can show the histogram in different line with three or four histogram per row to show visuals properly [duplicate]

This question already has answers here:
How to plot a stacked seaborn histogram colored from a different column
(1 answer)
Plotting multiple seaborn displot
(1 answer)
Closed 21 days ago.
Seaborn Facet Grid - Histogram Views
I want to how can I get the visuals in different rows so that I can view properly

What is y axis in seaborn distplot figure? [duplicate]

This question already has answers here:
What is y axis in seaborn distplot?
(3 answers)
Closed 3 years ago.
i'm using the following statement to plot a distribution fig:
a = sns.distplot(df, norm_hist=True)
and there is no difference when I change the norm_hist to false.
how can i interpret the y axis, it seems not count nor probability.
There is no difference when norm_hist=False because you are also plotting the KDE, which implies that norm_hist=True, if you want to see the non-normalized histogram you have to call
a = sns.distplot(df, norm_hist=False, kde=False)
When you are only showing the histogram (kde=False) and you don't normalize (norm_hist=False), then the y-axis represents the count in each bin.

Plot paired data in seaborn similar to ggpaired in R

I am trying to create a boxplot for paired data and want to draw lines between each paired data. Something similar is possible in R using ggpaired.
Is there as way to do so using seaborn or matplotlib in python?
Thanks in advance
IB

Color bar use in matlab surface image [duplicate]

This question already has answers here:
How to generate a non-linear colormap/colorbar?
(4 answers)
Closed 7 years ago.
Im displaying a 3D matrix, as an image using the surf tool in a 2D display as follows:
figure;
title('Plot')
surf(Matrix,'EdgeColor','None');
view(2);
colorbar;
There are areas of the image that i am interested in distinguishing from other areas, however since there are a few very high/ very low background values, the image doesn't make the colour of the interesting areas distinct, since the colour bar has to take into account the whole spread of the values.
Is there a way to change the colour bar so it takes the average values more into account as apposed the extreme values?
You can use caxis option to tune your color limits, and prctile to get the percentile level. Combining them will let you highlight portions of you data.
e.g.
caxis(prctile(Matrix(:),[5 90]))
will limit the colormap to the data above the %5 and below %90. Modify this values at will

Displaying small images with their original size in matlab [duplicate]

This question already has an answer here:
Display images in different sizes in MATLAB
(1 answer)
Closed 8 years ago.
I have two small images.
When I run the code below, my images are displayed in a larger size. I mean images are displayed with fit sub plots. I just want to display my small images original size not fitted size.
figure,subplot(121);imshow(IM1);
subplot(122);imshow(IM2);
I tryed axis image and truesize but failed.
Is there any way to do this?
The following sets the size of the axis the figure is shown in to the number of pixels in the original image...
Note: this will stop the axis from automatically resizing with the figure window
Hax = subplot(2,2,4);
imshow('image.bmp');
[x,y] = size(imread('image.bmp'));
set(Hax,'units','pixel');
pos = get(Hax,'position');
pos(3:4) = [y,x];
set(Hax,'position',pos)
The image will start in the bottom left of where the subplot axis was previously
to make it appear in the center add the following line just before pos(3:4) = [y,x];
pos(1:2) = ceil([pos(1)+pos(3)/2-y/2,pos(2)+pos(4)/2-x/2])

Resources