multidimensional scatter plot with d3 - d3.js

I have a dataset which has 9 attributes out of which 2 are numerical and the rest are categorical.
I wish to plot as many attributes as possible within a scatter plot matrix. D3 examples have shown me scatter plot matrices with a majority of numerical values.
Are there any ways to plot multidimensional categorical data as scatter plots?
IF yes, are there any samples available on the wbe?

Related

What is the right scale for highly divergent values in d3 data visualization?

I have two maps that plot values against counties on the United States.
Values being plotted on both are highly divergent.
On the first, around 2.5k of 3.3k counties have values of 0. While the remaining counties have values ranging up to 257,519,000.
This map visualizes just fine using scaleLog likeso:
color = d3
.scaleLog()
.domain(d3.max(data), d3.min(data))
.range(["black", "purple"])
The next map has 0 values for about 3.2k of 3.3k counties. With the remaining c. 100 counties having values that range up to 881,587,418. The values are substantially more divergent.
Using a logarithmic scale to assign color does not work on this second map. All values are black.
What would be the best scale to use here? Or is there another technique for plotting mostly empty, highly divergent values in D3?

multiple ROC curve in R with a matrix of prediction values and labels

I want to plot multiple ROC curves with a matrix of predictions and labels. I have > 100 samples with a matrix of predictions and labels for each sample. The length of the samples is different. How could I get design a single matrix for all the samples and get multiple ROC curves in a single plot? I would appreciate any suggestions. Thanks

Seaborn boxplot and Violinplot median is different

I am comparing a boxplot and violin plot in seaborn and the violin plot has a different inner box than the boxplot itself. I would like to use a violin plot to visualize the distribution of the data at the same time, is it possible the violin plot has a different median due to the kernel density estimation? The boxplots have the correct median from the data.
EDIT:
when I set inner='quartiles' the violin plots show the appropriate scale. I would like to use inner='box' though for appearances if I can.
Here are the graphs themselves:
and now the boxplot:

Matlab: polar coordinates grey scale plot

edit: I decided to split this question into two parts, because it were really two questions: 1. how to make a polar surface plot in MATLAB (this question) and 2. how to put fit polar data points into a coarse (and non-polar) matrix
I have a matrix that contains certain grey values (values between zero and one). These points are stored in a rectangular matrix, but really the data points are acquired by rotating the detector. This means that I actually have polar coordinates (I know the polar coordinates for every single pixel in my starting matrix).
I want to make a polar plot of the data points. I have the example of this below.
Because MATLAB stores images as matrices, the polar coordinates I have do not exactly match the 'bins' of the matrix. Therefore, we currently use an interpolation algorithm to put the polar coordinates into a square matrix. However, this is extremely slow. I see two methods to solve this issue:
let MATLAB directly plot the data points as polar.
calculate once how to convert from the start matrix to the end matrix and let MATLAB do this through matrix multiplication.
Some basic information:
Input matrix size: 512×960
Current output matrix size: 1024×1024
I think there is built in function for polar plot in matlab.
Z = [2+3i 2 -1+4i 3-4i 5+2i -4-2i -2+3i -2 -3i 3i-2i];
polarplot(Z,'*')
this command plots:
plot polar
See this link:
http://www.mathworks.com/help/matlab/ref/polarplot.html
To plot in grayscale, use "pcolor" and specify colormap to "gray"
www.mathworks.com/help/matlab/ref/ pcolor.html
The question was solved (apart from a minor flaw), partially because K.M. Shihab Uddin pointed me in the right direction. Unfortunately, using surf means continuously really plotting the image in a figure, and this is slow as well.
So I have X and Y values both in separate matrices and greyscale values (in a matrix called C) for every X and Y combination.
I found out that pcolor is just surf with a viewpoint from the top. So I used the following code to plot my graph.
surf(X,Y,C*255)
view([0,0,500])
However, this gave me a completely black image. This is because surf (and pcolor) create 960 grid lines radially in my case. The solution is to use:
surf(X,Y,img2*255,'EdgeColor','none')
view([0,0,500])
Now I have an almost perfect image, like I had before. Only, of my 960 radial lines, one is left white, so I still have to solve that. However, I feel this is a technical detail of the function surf, and answering this part does not belong in this question.
The resulting image

k nearest neighbour search for cells in place of matrices?

I want to find the euclidean distance between some datasets. For each class I have about 50 learning or training samples and 5 test samples. The problem is that this data for each sample is stored in cells and is in the m * n format rather than the preferred 1 * n format.
I see that matlab has a built in function for k nearest neighbours using euclidean distance; knnsearch. But the problem is that it expects the samples to be in the form of rows and columns. It gives an error when data in cells are provided.
Is there anyway to do this classification in the format my data is in? Or is it preferred that I convert them to 1-D format (maybe by using some sort of dimensionality reduction?)
Suppose there are 5 classes/models that are each represented by cells of size 32 * N, below is a screenshot from Matlab. Each cell represents the features of a lot of training images, so cell 1 is a representation of person 1 and so on.
Now similarly I have test images that need to be identified. The features of each test image are also in cells. So I have 10 unknown images with their features extracted and stored in cells. Each cell is a representation of a single unknown image. Below again is a screenshot from Matlab showing their dimensions
As can be seen they are all of varying dimensions. I know this is not the ideal format of KNN as here each image is represented by a multidimension matrix rather than a single row of variables. How do I perform euclidean distance on such data?
Thank you

Resources