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.
Related
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
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?
This question already has an answer here:
How to create an array according to row and column number [duplicate]
(1 answer)
Closed 5 years ago.
The problem is the following: I have a .txt file containing 3 columns of numbers. The first 2 columns are the coordinate x,y of the points. The third columnn (z vector) is made of numbers that express the luminosity of each point. (The .txt files have been generated by a software that is used to study the pictures of a combustion process). Each vector (x,y,z) is made of 316920 elements (all integer numbers). Now: is there a way to create from these 3 vectors an image in matlab relating the luminosity value to the coordiantes of the point?
Thanks for your time!
consider a file image.txt contains y x and intensity values separated line. like this.
1 1 0
1 2 12
1 3 10
....
....
255 255 0
open the text file using fopen function
fid = fopen(image.txt,'r');
im=[];
and read a string-line of characters by fgetl function, convert string-line into vector using sscanf and put intensity value into y and x coordinates of a image matrix, im.
tline=fgetl(fid) ;
rd=sscanf(tline,'%d');
im(rd(1),rd(2))=rd(3);
The same process is iterated up-to end of file.
at last close file-handle fid
I am going to assume that the three columns in your text file are comma separated( The code will need to be a bit different if they are not comma separated) . Since you said all numbers are integers, I am going to assume that you have all the data needed to fill a 2D grid using your x and y coloumns is present. I am not assuming that it is in a ordered form. With these assumptions the code will look like
data = csvread(filename)
for i=1:length(data)
matrix(data(i,2)+1,data(i,1)+1)=data(i,3) // +1 is added since there maybe a index starting from 0 and matlab needs them to start from 1
end
image(matrix)
For other delimiters use
data = dlmread(filename,delimiter)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I understand the concept. But I think I am making a silly mistake. This is what I want (psuedo-ish code). This is for an exercise. I am unable to understand lower origin part and the syntax of the first two lines.
norm = LogNorm(image.mean() + 0.5 * image.std(), image.max(), clip='True',
cmap=cm.gray, origin="lower")
image is a numpy array here. How to pass these norm and cmap parameters in matplotlib to plt.show or imshow()?
This doesn't work:
imshow(image, cmap=cm.gray, LogNorm(......))
Does this work?
from matplotlib import colors, cm, pyplot as plt
norm = colors.LogNorm(image.mean() + 0.5 * image.std(), image.max(), clip='True')
plt.imshow(image, cmap=cm.gray, norm=norm, origin="lower")
This creates a special colormap that ranges from image.mean() + 0.5 * image.std() to image.max() using a logarithmic scale. More general information is here: colors and specifically: LogNorm
The origin='lower' means that the [0,0] element (the 'origin') of the array is shown in the lower left part of the figure. Normally the origin of an array is in the upper left.
I have a file that contains the map between the two entities. I have to plot the x and and Y axis in a graph using linux. The X axis is Time like (12:35:07) and the Y axis will have some integer numbers range (1-14). I need to plot the x and the Y axis using some method that should be called from linux shell script. X axis will have totally around 500 to 800 samples. say (from 12:14:00 to 12:30:00). Can anyone please help me out. I tried using GNUplot, but the graph is not proper. Sample input is given below
12:34:58 5
12:35:06 9
12:35:07 14
12:35:07 13
12:35:08 4
12:35:08 5
12:35:17 9
12:35:17 13
12:35:18 14
12:35:19 4
12:35:19 5
This is what I have written
1 set terminal png
2 set output 'test.png'
3 set xdata time
4 set timefmt "%H:%M:%S"
5 set yrange [1:15]
6 plot "Graph1" using 1:2 title 'data A'
The problem I have is since the image has large number of samples (around 700 intervals, I am not able to see each value properly. Also the Y axis is not proper. I need to restrict the Y axis to onlyh 10 values (1-10). Also I need to draw 4 similar graphs and place each graph in each corner (subplot). I have not done the subplot yet in GNUplot.
It seems that you have three main issues right now. For some of them the issue is not totally clear, so it would help if you could update your question (or make a comment) to clarify, and I can update my response.
1) Not able to see each of ~700 values properly.
Here I need a bit of clarification. I'm assuming you don't want to see each of 700 data points individually, rather you want to be able to get rid of clutter on the x axis which happens when plotting time values. For this you can use the command
set xtics X
where X is the interval between tics you want, in this case a number of seconds. Is this what you want?
You can also use
set format x '%M:%S'
(or something) if you want to control how the x values are displayed on the axis.
2) y axis needs to be restricted to 10 values.
Here also it's not totally clear what you are looking for. Do you want to scale everything down to be between 1 and 10? The range of your data presented is 4 to 14, so by subtracting four you can get things between 0 and 10 like this:
plot "Graph1" using 1:($2-4) title 'data A'
If you want to constrict an arbitrary y data set to be between 1 and 10, that's a little more tricky:
stats "Graph1"
plot "Graph1" using 1:(($2-STATS_min_y)*9/(STATS_max_y-STATS_min_y)+1) title 'data A'
The stats command gets statistics about a file before you plot it. The convoluted plot command should scale everything to be between 1 and 10 on the y axis.
3) You want to have 4 subplots.
This one is pretty easy. Before your first plot command, use the command
set multiplot layout 2,2
This will create a 2x2 grid for your plots. Every plot command will plot on a new subplot. Type help set multiplot at the gnuplot command line for details on changing the sequence of subplots used.