scatter-plot

R - create a scatter plot from a number of csv files automatically after filtering unwanted data

此生再无相见时 提交于 2019-12-24 14:34:36
问题 I have attached a sample CSV file which I have 100 of them, A number of its columns and its 19 top rows should be filtered and rest of data should be used to plot graphs and export graphs in a more usable format. These data are generated by Netlogo behavior space, and I could not find a good way to visualize the output directly, so what I have after each experiment is many csv files. data file: https://www.dropbox.com/s/nj243qcs6sx6fu8/Rates.csv sample output : https://www.dropbox.com/s

Adding marginal histograms (or boxplots) to xyplot using lattice

久未见 提交于 2019-12-24 11:27:40
问题 Similar to this question, I'd like to to add marginal histograms or boxplots to a xyplot or densityplot using lattice . Is there a way to replace the right and/or top axes with these plots instead? Something like: library(lattice) x <- rnorm(100) y <- rnorm(100) xyplot(x~y, x.top = histogram(~x), # desired y.right = bwplot(~y) # desired ) How could I do this? 回答1: Using ggplot2 with ggExtra works. library(ggplot2) library(ggExtra) p <- ggplot(cars, aes_string('speed', 'dist')) + geom_point()

Convert scatterChart into lineChart

末鹿安然 提交于 2019-12-24 09:47:32
问题 I have a scatterChart with too many points in nvd3 that looks like that: It is very computationally intense task for the browser to render a plenty of points, so I want to actually draw an nvd3 lineChart using the [x, y] data that I got. Basically I want areas of colors on my chart, and not the areas of color created by individual points. Is there a way to do that? What other things could you propose? I tried random sampling of the data that I have but I do not like it since the improvement

How to draw polar hist2d/hexbin in matplotlib?

烈酒焚心 提交于 2019-12-24 05:29:10
问题 I have a random vector (random length and random angle) and would like to plot its approximate PDF (probability density function) via hist2d or hexbin . Unfortunately they seems not to work with polar plots, the following code yields nothing: import numpy as np import matplotlib.pyplot as plt # Generate random data: N = 1024 r = .5 + np.random.normal(size=N, scale=.1) theta = np.pi / 2 + np.random.normal(size=N, scale=.1) # Plot: ax = plt.subplot(111, polar=True) ax.hist2d(theta, r) plt

Adding data to a highchart chart using an array with IDs

可紊 提交于 2019-12-24 01:01:46
问题 I want to add a series to a highchart scatterplot where I am naming each point in the series. I create a chart in the following way: var chart; // globally available makeCharts = function(){ chart = new Highcharts.Chart({ chart: { renderTo: 'container1', type: 'scatter' }, series: [{ name: 'a', data: [{ 'id': 'point1', 'x': 1, 'y': 2 }, { 'id': 'point2', 'x': 2, 'y': 5 }] }] }); } I would like to be able to update the points on the chart using something like: chart.series[0].setData([{id:[

Adding a point to the ggplot messes up the legend

£可爱£侵袭症+ 提交于 2019-12-23 22:14:02
问题 I have a data dataframe dat <- data.frame(cond = rep(c("A", "B"), each=10), xvar = 1:20 + rnorm(20,sd=3), yvar = 1:20 + rnorm(20,sd=3)) I want to scatter-plot it using ggplot2 Lets say the additional point would just be 15th row in the data g1 <- dat[15,] I can now generate the plot using scat1 <- ggplot(dat, aes(x=dat[,2], y=dat[,3], shape=factor(dat[,1]), size=2.5, colour = factor(dat[,1]))) + geom_point(alpha=1) #Add point to the plot scat1 <- scat1 + geom_point(x=g1[,2],y=g1[,3], colour=

combine histogram with scatter plot in R

感情迁移 提交于 2019-12-23 21:57:57
问题 I am trying to produce a plot with histogram and scatter plot in just one plot using a secondary axis. In detail, here is an example data: #generate example data set.seed(1) a <- rnorm(200,mean=500,sd=35) data <- data.frame(a = a, b = rnorm(200, mean=10, sd=2), c = c(rep(1,100), rep(0,100))) # produce a histogram of data$a hist(a, prob=TRUE, col="grey") #add a density line lines(density(a), col="blue", lwd=2) #scatter plot plot(data$a,data$b,col=ifelse(data$c==1,"red","black")) What I want to

Easiest way to plot values as symbols in scatter plot?

无人久伴 提交于 2019-12-23 20:34:25
问题 In an answer to an earlier question of mine regarding fixing the colorspace for scatter images of 4D data, Tom10 suggested plotting values as symbols in order to double-check my data. An excellent idea. I've run some similar demos in the past, but I can't for the life of me find the demo I remember being quite simple. So, what's the easiest way to plot numerical values as the symbol in a scatter plot instead of 'o' for example? Tom10 suggested plt.txt(x,y,value)- and that is the

Linking plotted data with color and size sources in MATLAB

二次信任 提交于 2019-12-23 18:12:39
问题 This question is related to the question posted here, in which I outline a problem I'm facing regarding rapid visualization of 3D scatter plotted data in MATLAB during a simulation. (Sample code and data are also provided there.) As an alternative to setting the XData , YData , ZData , SizeData , and CData properties of a 3D scatter plot in MATLAB, I'm wondering if it's possible to have all of their corresponding sources be dynamically linked to points that are 3D scatter plotted. The linked

Ignoring plotting data points of certain value

百般思念 提交于 2019-12-23 17:38:06
问题 I have a plot shown below and I am trying to figure out a way to ignore plotting points that have x value = 0.0. Basically, I want my plot to not include those 3 points you see in the top left corner. y = np.array([4.7, 6.6, 6.4, 6.8, 6.2, 7.2, 6.1, 5.9, 6.4, 6.6]) x = np.array([0.405,0.0,1.254,1.096,1.128,0.0,0.828,1.083,1.309,0.0]) plt.scatter(x, y) 回答1: There are two ways, depending on whether you want to actually stop plotting them, or just stop showing them. The first is to just set the