density-plot

R: getting data (instead of plot) back from sm.density.compare

女生的网名这么多〃 提交于 2019-12-11 18:11:36
问题 I'm doing a density compare in R using the sm package (sm.density.compare). Is there anyway I can get a mathematical description of the graph or at least a table with number of points rather than a plot back? I would like to plot the resulting graphs in a different application, but need the data to do so. Thanks a lot for the help, culicidae 来源: https://stackoverflow.com/questions/31252058/r-getting-data-instead-of-plot-back-from-sm-density-compare

number instead of date on the density plot in R

不羁的心 提交于 2019-12-11 14:46:27
问题 I have a problem. I am trying to draw a density plot in R with the plotly package. But when I hover the mouse over the plot I get number format of date 17623 instead 2018-04-02. Any ideas how to solve this problem? Date <- seq(as.Date(Sys.Date()-30), by=1, len=31) Value <- runif(31) dataTable <- data.frame(Date, Value) density_plot = ggplot(dataTable, aes(x=Date, y = Value)) + geom_density(stat="identity", fill = "#4156C5") + labs(fill = "Value", x = "Date", y = "Frequency") ggplotly(density

How should be a ggplot equivalent of plot + lines in R? [duplicate]

你。 提交于 2019-12-11 12:25:40
问题 This question already has an answer here : Plotting normal curve over histogram using ggplot2: Code produces straight line at 0 (1 answer) Closed 6 months ago . With plot and lines I can make multiple plots overlapped in the same range in R. For example, I can plot the density of a data and then simulate a density distribution in the same plot as follows: plot(density(mtcars$mpg), col = "red") polygon(density(mtcars$mpg), col = "red") x <- seq(0, 50, length=1000) hxn <- dnorm(x,mean=mean

A werid-looking density plot using stat_density_2d

蹲街弑〆低调 提交于 2019-12-11 06:45:29
问题 I have a data frame like below > dput(test_data) structure(list(X206.204 = c(18.28, 18.32, 18.453, 18.55, 18.24, 18.39, 18.36, 18.26, 18.23, 18.42, 18.35, 18.64, 18.59, 18.28, 18.56, 18.72, 18.6, 18.59, 18.63, 18.19, 18.73, 18.36, 18.71, 18.66, 18.66, 18.61, 18.68, 18.741, 17.1758, 17.18, 17.1709, 17.1748, 17.1774, 17.1756, 17.156, 17.074, 17.1837, 17.1806, 17.1904, 17.1849, 17.2025, 17.1802, 17.92, 17.9, 17.94, 17.93, 17.91, 17.92, 17.906, 17.92, 17.887, 17.935, 17.905, 17.867, 17.957, 17

ggplot2 2D Density plot - the gradient fill is too smooth

泄露秘密 提交于 2019-12-08 05:24:49
问题 I am having some difficulty with the ggplot2 package and the gradient fill. For my data with low number of data points, its gradient and density intensity doesn't really match. Here is an example: The code I am using is: pt <- read.xlsx("plots.xlsx", sheetName = "PT1_TB varseq", stringsAsFactors=FALSE) ggplot(pt, aes(x=pt$BAF, y=pt$LogR) ) + stat_density_2d(aes(fill = ..density..), geom = "raster", contour = FALSE) + scale_fill_distiller(palette= "Spectral", direction=-1) + scale_y_continuous

Color code points of 3D scatter plot according to density of points

倾然丶 夕夏残阳落幕 提交于 2019-12-08 02:18:24
问题 I have a 3D scatter plot of points in the xyz-sphere. I was wondering if there is a way to colormap/hue the scatter plot based on the density of the data. Basically, the parts of the scatter plot with the most densely clustered data points would be dark red, semi densely clustered data points would be medium red, and sparsely clustered data points would be light red. This is the way that I was thinking of, but (hopefully) there might be a simpler function or command to do this. Set a

Density plot with python making a Diffraction pattern with Bessel Integrals but it wont stop running

别说谁变了你拦得住时间么 提交于 2019-12-08 01:01:56
问题 I am trying to make a circular diffraction pattern, which has a central spot surrounded by a series of rings. It involves a Bessel integral to do it which is defined in the code. My problems is that it takes too long like I waited 10 min for the code to run but didn't get anything to display. I understand it is because my Bessel integral has 1000 iterations per point can any one help with this ? Am I on the right track? I am trying to self teach myself python and computational physics via

ggplot Poisson density curve: why zigzag lines?

巧了我就是萌 提交于 2019-12-07 11:19:48
问题 I would like to plot the density function of a Poisson distribution. I am not sure why I get a jaggy line (in blue). On the sample plot, the normal density curve (in red) looks smooth. It is because the reason the Poisson density function doesn't accept decimal values? How to eliminate the zigzag in the Poisson density plot? Thanks very much for any help. library(ggplot2) ggplot(data.frame(X = seq(5, 30)), aes(x = X)) + stat_function(fun=dpois, geom="line", size=2, color="blue3", args = list

Density plot with python making a Diffraction pattern with Bessel Integrals but it wont stop running

筅森魡賤 提交于 2019-12-06 11:21:31
I am trying to make a circular diffraction pattern, which has a central spot surrounded by a series of rings. It involves a Bessel integral to do it which is defined in the code. My problems is that it takes too long like I waited 10 min for the code to run but didn't get anything to display. I understand it is because my Bessel integral has 1000 iterations per point can any one help with this ? Am I on the right track? I am trying to self teach myself python and computational physics via Mark Newmans book Computational Physics the exercise is 5.4 of Computational Physics.Here is a link to the

Plot quantiles of distribution in ggplot2 with facets

梦想的初衷 提交于 2019-12-06 05:39:06
I'm currently plotting a number of different distributions of first differences from a number of regression models in ggplot. To facilitate interpretation of the differences, I want to mark the 2.5% and the 97.5% percentile of each distribution. Since I will be doing quite a few plots, and because the data is grouped in two dimension (model and type), I would like to define and plot the respective percentiles in the ggplot environment. Plotting the distributions using facets gets me to exactly where I want except for the percentiles. I could of course do this more manually, but I would ideally