How to create a vertical scatter graph using range specific abscissas using Sigmaplot - range

I am currently working on a project in which I will be creating a vertical scatter plot using on average 6 points of y-axis data using Sigmaplot. The units of the graph are depth of snow in cm vs time. However the data I have collected is gathered over a range of days (i.e. 173-176) and I am having trouble applying my data sets to their respective ranged abscissa. I've noticed inputting the data in this manner finds the difference in the abscissa (i.e. 173-176 would correspond to 3) rather than interpreting the data as a range. Can anyone help me find a way in which to input abscissa not as singular values but rather ranges of those values using Sigmaplot?

Leaving the abscissa ranges in tact, plot all of the data. Sigmaplot does not want sort these data and rather places them in their respective chronological order. I did not find a way to make the width of the points as wide as the abscissa.

Related

Nearest neighbor analysis that provides me a distribution of adjacent values?

I am trying to perform a nearest neighbor type of analysis on an array based on a given set of (x,y) coordinate indexes (NN.HEME_indices). The array on which I am evaluating is a 142x128 double that has a number of positive values throughout (ATV_ng_g_raw). In this work, I’m trying to limit this nearest neighbor analysis to within 10 pixels of the indexes (including 0 and 10).
My goal is to retrieve two histograms from this analysis. One graph is where the x-axis is the number of pixels away from the indexes (from 0 to 10, inclusive) and the y-axis is the average of the non-zero numbers at each distance. The second histogram is the same but the y-axis is the average of all numbers (including the 0’s) at each distance.
I’ve placed a .mat file (“NN_04062021.mat) here. This includes:
“NN” data structure – contains the coordinate indeces that serve as the central points, (HEME_indices; 2046 x 2 double). This was derived from a separate 142x128 double
ATV_ng_g_raw – contains the array on which I would be performing the nearest neighbor analysis (142x128 double)
Anyone have any thoughts? Happy to clarify further or provide additional workspace variables if needed. Thank you!
yname='yname';
xname='xname';
indexname='raw_index';
[NN.yname,NN.xname]=find(ATV_ng_g_raw);
NN.(indexname)=[NN.(xname),NN.(yname)];
nnidxname='HEME_raw_idx';
nndistname='HEME_raw_dist';
[NN.(nnidxname),NN.(nndistname)]=knnsearch(NN.HEME_indices,NN.(indexname)); %knnsearch provides counts vs actual values in the ATV_ng_g_raw array
figure,histogram(NN.(nndistname),'BinMethod','integers');
ylabel('Counts of HEME+ voxels');
xlabel('Distance to ARVs (voxels)');

Working in jupyter, trying to plot time series

I just want to use any simple seaborn or matplot plot to visualize my data set as a lineplot. Please help. I cant seem to figure out how to plot these values i keep getting all types of errors.
My data set consists of 4 columns, the first is date which I want to plot on my x axis and the rest are numeric values of gold, oil and the dollar that I want to plot.
I have my dates set to datetime value and the rest set to float64, I am trying to plot the fluctuations of oil, gold and the dollar over time to look at any possible correlation. Sorry for any obvious mistakes I am not an expert.
Doing This gives me only one plotted value and the Date values on x axis is incorrect
plt.xlabel('Date')
plt.ylabel('Values')
plt.title('Historical Data')
df['Price_Gold'].plot()
So basically im running into trouble when trying to plot multiple values against time.
df.plot(x='Date', y=['Col1', 'Col2'])
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.html

Regridding data from 2D grid to another

i'm working on a project involving netcdf data analisys. To correctly process the data i need to regrid it to a coarser level. The matrix is in fact multidimensional, but i only need spatial regridding, so basically i have to work with a lat/lon matrix.
The process i had in mind would consist, giving a source 2d grid (the one retrived from the netcdf) and a destination grid ( the one that i need for my calculations) the second of wich is coarser(have less points),in calculating a sort of weight matrix that contains the coefficients needed to compute each point of destination grid.
This will be helpful because i have a bunch of variables laying on the same grid, so if i calculate a weight matrix, the problem is reduced in a sequence of matrices multiplications.
basically what i need is a function f(lat_source,lon_source,lat_dest, lot_dest) that given the coords of the source/destinaiton grids return a matrix of weights that maps the dest lat/lon onto the source one.
is there something already implemented ? Or some reads that could point me in the right direction ?
I know there are different interpolation methods that could be used, but, for the sake of the argument, let's suppose a linear interpolation.

Extracting data that meet a threshold in another matrix

I'm having some trouble in Matlab, and this might be more of a methodology/logic question.
So I have three netCDF files that I am loading into three separate matrices. Two of these matrices are values of a test run for two different experiments (all three files are gridded), and the other is the p-value of the data between the two experiments.
I want to create a new netCDF file that has the values of the difference between the two experiments if that particular grid has a pvalue <= 0.05.
I thought this would be fairly easy. Here is what I implemented:
%find the difference between experiments, averaged over the 3rd dimension
yr_diff = mean(mat_2012-mat_1980,3);
yr_diff(pvalue >= 0.05) = NaN;
final_grid = yr_diff;
And then I used a fairly straight forward netCDF exporting scheme. To my knowledge, the mat_2012 and mat_1980 matrices are organized in the same as the pvalue matrix.
This produces a sort of weird grid that doesn't really show anything. The first image below shows filled contours of the differences, with black contour lines where the areas are significant. The second plot shows filled contours of the netCDF file created with this logic, with the same significant contour lines.
So my question: Is the logic incorrect, and should I take a new direction? Is this something related to my exporting scheme? Or is this something else completely?

Controlled random number/dataset generation in MATLAB

Say, I have a cube of dimensions 1x1x1 spanning between coordinates (0,0,0) and (1,1,1). I want to generate a random set of points (assume 10 points) within this cube which are somewhat uniformly distributed (i.e. within certain minimum and maximum distance from each other and also not too close to the boundaries). How do I go about this without using loops? If this is not possible using vector/matrix operations then the solution with loops will also do.
Let me provide some more background details about my problem (This will help in terms of what I exactly need and why). I want to integrate a function, F(x,y,z), inside a polyhedron. I want to do it numerically as follows:
$F(x,y,z) = \sum_{i} F(x_i,y_i,z_i) \times V_i(x_i,y_i,z_i)$
Here, $F(x_i,y_i,z_i)$ is the value of function at point $(x_i,y_i,z_i)$ and $V_i$ is the weight. So to calculate the integral accurately, I need to identify set of random points which are not too close to each other or not too far from each other (Sorry but I myself don't know what this range is. I will be able to figure this out using parametric study only after I have a working code). Also, I need to do this for a 3D mesh which has multiple polyhedrons, hence I want to avoid loops to speed things out.
Check out this nice random vectors generator with fixed sum FEX file.
The code "generates m random n-element column vectors of values, [x1;x2;...;xn], each with a fixed sum, s, and subject to a restriction a<=xi<=b. The vectors are randomly and uniformly distributed in the n-1 dimensional space of solutions. This is accomplished by decomposing that space into a number of different types of simplexes (the many-dimensional generalizations of line segments, triangles, and tetrahedra.) The 'rand' function is used to distribute vectors within each simplex uniformly, and further calls on 'rand' serve to select different types of simplexes with probabilities proportional to their respective n-1 dimensional volumes. This algorithm does not perform any rejection of solutions - all are generated so as to already fit within the prescribed hypercube."
Use i=rand(3,10) where each column corresponds to one point, and each row corresponds to the coordinate in one axis (x,y,z)