r,matrix,rstudio,scatter-plot,tapply

You can subset using typical methods for row subsetting; using which() is simple. For example, I want a scatterplot matrix of a few columns of mtcars, but I'm only interested in the rows where cyl is 4. pairs(mtcars[which(mtcars$cyl==4),c('disp','hp','drat')]) ...

Please provide a reproducible example when asking R questions! We do not have 'veg' and 'temps'. I think you can use quantile regression for this. library(quantreg) # example data set.seed(0) x = rnorm(1000) y = rnorm(1000) - x minx <- quantile(x, 0.01, na.rm=TRUE) miny <- quantile(y, 0.01, na.rm=TRUE) plot(x,y, xlim=c(-6,6),...

Without your data it's hard to verify but I suspect the only problem is that you are regressing had ~ fatigue in your model but you're plotting x = hads, y = fatigue. The formula in lm should be of the form y ~ model so I think you just...

I did it with scatterplot3d. scatterplot3d(Hypo$Easting,Hypo$Northing,Hypo$Song_Dur,angle=118,color="red",pch=16,highlight.3d=TRUE,xlab="Easting",ylab="Northing",type="h",lwd=1) Where Hypo$Easting==x, Hypo$Northing==y and Hypo$Song_Dur==z(variable)....

python,matplotlib,plot,scatter-plot,aspect

You can do it like this: import matplotlib.pyplot as plt fig, ax = plt.subplots() x = [0, 0.2, 0.4, 0.6, 0.8] y = [0, 0.5, 1, 1.5, 2.0] colors = ['k']*len(x) ax.scatter(x, y, c=colors, alpha=0.5) ax.set_xlim((0,2)) ax.set_ylim((0,2)) x0,x1 = ax.get_xlim() y0,y1 = ax.get_ylim() ax.set_aspect(abs(x1-x0)/abs(y1-y0)) ax.grid(b=True, which='major', color='k', linestyle='--') fig.savefig('test.png', dpi=600)...

python,matplotlib,plot,scatter-plot,boxplot

There's a package built on top of matplotlib called beeswarm that positions the points as requested.

r,scatter-plot,kernel-density,density-plot

Seems like you want a filled contour rather than jus a contour. Perhaps library(RColorBrewer) library(MASS) greyscale <-brewer.pal(5, "Greys") x <- rnorm(20000, mean=5, sd=4.5); x <- x[x>0] y <- x + rnorm(length(x), mean=.2, sd=.4) z <- kde2d(x, y, n=100) filled.contour(z, nlevels=4, col=greyscale, plot.axes = { axis(1); axis(2) #points(x, y, pch=".", col="hotpink")...

I think something like this would be ok for start? ggplot(data = df, aes(x=var1, y=var2, shape = var3, color = var3)) + geom_point(size=4)+ geom_text(data=df[3:4,],aes(x=var1,y=var2,label=var4), color='black') To remove the circles for the 3rd and 4th row change the first row to this: ggplot(data = df[-c(3:4),], aes(x=var1, y=var2, shape = var3, color...

matlab,plot,colors,scatter-plot,color-space

As pointed out by horchler, the mistake was in my color conversion (RGB to XYZ to xyY) which I had done external to MATLAB. On correcting the error, the following code produced the desired result. cieplot(); hold on x=[0.42 0.38 0.388 0.352 0.344 0.281] y=[0.48 0.45 0.5 0.45 0.452 0.352];...

javascript,d3.js,path,line,scatter-plot

You aren't thinking with joins. The pattern is selectAll, enter, and append: var horizontalGrids = innerCanvas .selectAll(".horzGrid") .data(yAxisData) .enter() .append("path") .attr("class", "horzGrid") .attr("d", lineFunction(dataSet)) .attr("d", function(d, i) { var p1 = { x: 0, y: yAxisScale(d) }; var p2 = { x: marginRight - 100, y: yAxisScale(d) }; var pts...

Assuming you are using the hexbin package... library(hexbin) library(grid) # some data from the ?hexbin help set.seed(101) x <- rnorm(10000) y <- rnorm(10000) z <- w <- -3:3 # hexbin bin <- hexbin(x, y) # plot - look at str(p) p <- plot(bin) # push plot viewport pushHexport(p$plot.vp) # add...

javascript,highcharts,scatter-plot

SOLUTION So, I solved this issue and the solution is really trivial. When you do, chart.series[0].addPoint([x,y], true, true), it shifts the most recent coordinate by one point while appending the newest coordinate to the end. It's like an array - more specifically, this is stack: chart.series[0].data.y where new points are...

matrix,vector,dataset,octave,scatter-plot

The error message says it all. Your data is a 2-row matrix, and not a 2-column matrix as it should be. Just transpose it with .'. scatterplot(data.') I dropped the label argument since it is not compatible with the communications toolbox, either in matlab or in octave. Update: According to...

d3.js,symbol,nvd3.js,scatter-plot,bubble-chart

Just add the below code before you call d3.select('#chart svg') //We want to show shapes other than circles. chart.scatter.onlyCircles(false); Hope it helps....

javascript,d3.js,scatter-plot,fisheye

You have to prepare the data for the fisheye plugin: var circles = svg.selectAll("circle") .data(data) .enter() .append("circle") .datum( function(d) { return {x: d.pages, y: d.books} // change data, to feed to the fisheye plugin }) .attr("cx", function (d) {return d.x}) // changed data can be used here as well .attr("cy",...

r,classification,weka,scatter-plot

You can use Multidimensional Scaling (MDS) to first, reduce the dimension of your data and then plot it. This method tries to preserve the distances between points when projecting into a lower dimension. Here is an example in R for the iris dataset data <- iris colors <- as.integer(as.factor(data$Species)) d...

Figured out one work-around: 1) Create column with numerical values corresponding to the plot order, with the 'data in front' having being '1', and increasing for each layer going back; 2) Enable the 'size-by' filter, and select this new column; 3) Manually program the min/max limits to be '1' and...

matlab,colors,matlab-figure,scatter-plot,scatter

As told in the comment, scatter can take a 4th argument which will represent the color. The 3rd argument (the one you use with c for each of your scatter plot), only controls the size. For you, the way to call scatter should be: scatter(x,y, size, colour , 'filled') Read...

d3.js,pie-chart,scatter-plot,information-visualization

You can change the position of an svg object (like a group) element with translate. For example: <g transform="translate(20,20)"></g> Check a live example here: http://jsbin.com/zajij/1/ In d3 you can add an attr to add this transform .attr("transform", "translate(20,20)"); Hope this helps!...

vb.net,excel,visual-studio-2013,.net-3.5,scatter-plot

You need to manually create the Series object and supply it with XValues and Values properties accordingly. This replaces the call to SetSourceData. Here is some rough C# code that works. I apologize for not using VB.NET. The key step is to use the NewSeries method on the SeriesCollection object...

If you want both scatter points and circles of a given size (relative to the x-axis coordinates or actual size in inches/cm) I suggest you use the symbols() function x <- 10*runif(4) y <- 10*runif(4) symbols(x, y, circles=rep(3, length(x)), inches=FALSE, xlim=c(0,10), ylim=c(0,10)) points(x, y, pch=19) ...

Yes it can! You just need to provide the rotation property of text annotations with a value of 90 and it works fine. Example: clear clc x = [29.745, 61.77, 42.57, 70.049, 108.51, 93.1, 135.47, 52.79, 77.91, 116.7, 100.71, 146.37, 125.53] y = [6, 6, 12, 24, 24, 12, 24,...

The code you posted looks very easy to adapt to draw all three error bars. Try this (note that I adapted it also so that you can change the shape and colour etc of the plots as you normally would by using varargin, e.g. you can call plot3d_errorbars(...., '.r'): function...

d3.js,scatter-plot,semantic-zoom

You just need to rebind the new scales to the behavior. First put the zoom behaviour function in a variable so you can access it later: Your original code... var svg = d3.select("#scatter") .append("svg") .attr("width", outerWidth) .attr("height", outerHeight) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")") .call(d3.behavior.zoom().x(x).y(y).scaleExtent([0,...

python,pandas,colors,scatter-plot

You're getting a Series back from df.ix[0], which can't be drawn as a scatter plot. (I guess it could be a valid type in theory, but, as you say, it would only show 1 point.) If you change your code slightly to make sample a DataFrame instead, it works. (I've...

python,matplotlib,widget,scatter-plot

The graph updates itself when you set new limits. You just don't see this because you update wrong subplot. Just select right subplot to update: def update(val): plt.subplot(111) plt.ylim([smin.val,smax.val]) (this work for me) or maybe even: def update(val): plt.ylim([smin.val,smax.val]) plt.subplot(111) smin.on_changed(update) smax.on_changed(update) if you don`t do anything with it elsewhere...

javascript,d3.js,visualization,scatter-plot

Can you draw half a million points with D3? Sure, but not with SVG. You'll have to use canvas (here's a simple example with 10,000 points that includes brush-based selection: http://bl.ocks.org/emeeks/306e64e0d687a4374bcd) and that means that you no longer have individual elements to assign click handlers to. You will not be...

matlab,graph,matlab-figure,scatter-plot

The function scatter3 has a color input argument. But you need to define the size of the markers also. % Generate example data, X=rand(10,1)*10; Y=rand(10,1)*3; Z=rand(10,1)*5; fit=rand(10,1)*3+10; scatter3(X,Y,Z,ones(size(X))*40,fit,'fill') ...

Adjusting alpha is pretty easy with adjustcolor function: COL <- adjustcolor(c("red", "blue", "darkgreen")[iris$Species], alpha.f = 0.5) plot(iris$Sepal.Length, iris$Petal.Length, col = COL, pch = 19, cex = 1.5) #attempt in base graphics Mapping alpha to variable requires a bit more hacking: # Allocate Petal.Length to 7 length categories seq.pl <- seq(min(iris$Petal.Length)-0.1,max(iris$Petal.Length)+0.1,...

With ggplot2: # Make a data frame df <- data.frame(Speed = c(15, 30, 40, 32), Age = factor(c("<18", "18-25", "26-40", "40+"))) require(ggplot2) # Use the geom_point geom ggplot(df, aes(Speed, Age)) + geom_point() ...

python,matplotlib,transparency,scatter-plot

Yes, interesting question. You can get this scatterplot with Shapely. Here is the code : import matplotlib.pyplot as plt import matplotlib.patches as ptc import numpy as np from shapely.geometry import Point from shapely.ops import cascaded_union n = 100 size = 0.02 alpha = 0.5 def points(): x = np.random.uniform(size=n) y...

python,matplotlib,scatter-plot,bubble-chart

Your plot command was wrong; you need to specify x and y for each point you want to plot , so 4 values for both x and y. See the docs for more info (specifically about the shape of x and y) import matplotlib.pyplot as plt x = [1, 2,1,2]...

r,plot,ggplot2,scatter-plot,facet

There are multiuple ways you can achieve your goal. First, if you consider generating separate scatter plots and then mergining them you can use the multiplot function. You would simply have to generate the graphs you want, with all the settings, and then merge them. As a second approach, you...

r,ggplot2,packages,scatter-plot,boxplot

Perhaps this will get you started: d <- data.frame(y = rnorm(20, 9, 2), group = as.factor(rep(c('Post-FAP', 'Post-DEP'), each = 10)), id = rep(1:10, 2)) ggplot(d, aes(y = y)) + geom_boxplot(aes(x = rep(c(-3, 3), each = 10), group = group), fill = 'steelblue') + geom_point(aes(x = rep(c(-1, 1), each = 10)),...

You could do the following: library(scatterplot3d) a<-c(1:10) b<-c(1:10) c<-c(1:10) #remove x labels using x.ticklabs = '' scatterplot3d(a,b,c, main="3-D Scatterplot",color="blue", pch=19, type="h", lty.hplot=2, box=F, scale.y=.5, lty.grid=1, lab=c(9,5,1), xlab="", ylab="", zlab="", x.ticklabs='') #add the labels using the text function. srt specifies the angle. text(x=b, y=1, pos=1, labels=b, srt=45, adj=1, xpd=TRUE, offset=0.5) And...

python,scatter-plot,marker,colorbar

scatter can only do one kind of marker at a time, so you have to plot the different types separately. Fortunately pandas makes this easy: import matplotlib.pyplot as plt import pandas as pd x = {'speed': [10, 15, 20, 18, 19], 'meters' : [122, 150, 190, 230, 300], 'type': ['phone',...

r,plot,percentage,scatter-plot,uncertainty

Are you thinking of the confidence interval for binomial proportion? see http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval E.g. binom.test(208,14824) the 95% CI is [1.22, 1.61] for your sample estimate 1.40 (percentage)

javascript,d3.js,scatter-plot,nvd3.js,axis-labels

These tick values will not have any effect if the y values themselves are not within the 2-32 range. Right now that chart only has y values up to 2+. So, if in addition to adding chart.yAxis.tickValues(['2','4','8','16','32']); to the Chart Code/Javascript tab as you have in your question, you also...

You need to use the right shapes (21:25) and to specify your fill. This post has some good tips. Although at this point, your data are becoming more difficult to illustrate with a different outline and fill color. (Maybe instead code Time as your fill and use lighter hues for...

python,pandas,matplotlib,legend,scatter-plot

You can change the size of the symbol in the legend using the markerscale keyword. For example, ax.legend( scatterpoints=1, loc='best', ncol=1, markerscale=0.5, fontsize=12) will reduce the symbol size by a factor 2....

python,matplotlib,scatter-plot,colorbar,color-mapping

I ended up going with this. I'm not sure if it is the best way - if you have alternate suggestions perhaps I can learn from them for future use! cmap = matplotlib.colors.ListedColormap(['green', 'blue', 'red']) bounds=[0,125,200,400] cax = inset_axes(ax3, width="8%", height='70%', loc=4) cbar = matplotlib.colorbar.ColorbarBase(cax, cmap=cmap, boundaries=bounds) cax.yaxis.set_ticks_position('left') cbar.ax.set_yticklabels(['0', '125',...

matlab,colors,matlab-figure,scatter-plot,scatter

you are telling matlab to plot only n points ((1,1), (2,2), ..., (n,n)) where you want actually the cartesian product (1:nX1:n). Try [X,Y] = meshgrid(1:n,1:n); scatter(X(:), Y(:), 10, data(:));...

matlab,plot,data-visualization,scatter-plot,convex-hull

In the end, I came up with the following: Use scatterhist to create the scatter plot with marginal histograms. hold on Use convhull to get the convex hull for each group of points. Use fill to draw the convex hull. ...

Well, it doesn't look like there is a super straight forward way to do this in the scatter plot command itself, but you can find positions after you make the plot and draw on top. For example s <- scatterplot3d(x,y,z) with(s$xyz.convert(c(4,4),c(2,9),c(0,0)), lines(x, y, lwd=2)) with(s$xyz.convert(c(1,6),c(4,4),c(0,0)), lines(x, y, lwd=2)) Here we...

ok, in case anyone else runs into this and needs a suggestion...I've found that Android Plot (http://androidplot.com/) meets my needs. It has good native support for XY graphs and seems like a good package all around. I wish the javaDocs were a little more developed - a lot of functions...

matplotlib,label,legend,scatter-plot,markers

Here's my work-around MWE. I actually plot two extra "plots", point_g and point_r which have the legend handles we will use. I then cover them up by using a white squre marker. Plot the remaining plots as desired. import matplotlib.pyplot as plt plt.rc('text', usetex=True) plt.rc('text', **{'latex.preamble': '\\usepackage{wasysym}'}) plt.rc('lines', **{'markersize':20}) fig...

svg,d3.js,visualization,scatter-plot,circle-pack

Just threw this together. It takes d3 flare data and will scatter-plot out the first level children and their children. Data Structure: var flareData = { "name": "root", "children": [{ "name": "pointOne", "scatX": 10, "scatY": 20, "children": [{ "name": "pointOneA", "children": [{ "name": "A", "size": 40 }, { "name": "B",...

You might want to convert your x-values into factors. Right now, R assumes that your x-values are numbers and hence puts the appropriate space between them (the difference between 5,884 and 13,957 is larger than the difference between 21,013 and 28,708). However, you probably think of the numbers as names...

javascript,highcharts,3d,scatter-plot

Here are two methods, which both are not ideal in my opinion, but get the job done given that your chart is somewhat static in it's appearance (width and height). Set margins to make the plot area reflect the dimensions of the axis. In your case 1:1 for x and...

I would use rnegbin from MASS. Here is use: n as the number of simulated points. mu as the predicted values from the model and theta as the estimated theta from the model. library(ggplot2); library(MASS) year <- 1990:2009 set.seed(1) counts <- sample(1:1000, 20) df <- data.frame(year, counts) my_nb_reg <- glm.nb(counts...

python,matplotlib,scatter-plot,polar-coordinates

The problem is that you're only converting the edges of the array. By converting only the x and y coordinates of the edges, you're effectively converting the coordinates of a diagonal line across the 2D array. This line has a very small range of theta values, and you're applying that...

python,colors,opacity,scatter-plot,4d

I would do something like the following: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # choose your colormap cmap = plt.cm.jet # get a Nx4 array of RGBA corresponding to zs # cmap expects values between 0 and 1 z_list = np.array(z_list) # if z_list...

look at the sunflowerplot function (and the xyTable function that it uses to count overlapping points). You could also use the my.symbols function from the TeachingDemos package with the results of xyTable to use other shapes (polygrams or example)....

javascript,d3.js,data-visualization,contour,scatter-plot

This question is very similar to another question that was already asked and answered at Create contour map In that post, it was recommended to use d3.js and conrec.js....

The data in the mzRange is not numeric. If it is used as the data source for the X axis, it will result in the data points being numbered ascending on the X axis. The only way to plot over a data point is to use the exact X and...

ios,scale,core-plot,zooming,scatter-plot

If you always want the axes to cross at the same place, use the orthogonalCoordinateDecimal property. It defaults to zero for both axes, but you can change that if you want. If the crossing point is outside the visible range after calling -scaleToFitPlots:, you can adjust the location and length...

r,scatter-plot,ggally,r-corrplot

Short answer: There doesn't seem to be an elegant or easy way to do it, but here's a workaround. I dug into the ggpairs source code (in the GGally package source available from CRAN) to see how the variable labels are actually drawn. The relevant function in ggpairs.R is print.ggpairs....

android,scatter-plot,mpandroidchart

Currently that is not possible as you describe it, since the position on the x-axis can only be an integer (x-index). However, you can of course scale that up and then represent float....

ios,objective-c,core-plot,scatter-plot

Try different style on your scatter plot CPTScatterPlotInterpolationLinear: This is the default. CPTScatterPlotInterpolationStepped CPTScatterPlotInterpolationHistogram CPTScatterPlotInterpolationCurved example: CPTScatterPlot *yourPlot = [[CPTScatterPlot alloc] init]; yourPlot.dataSource = self; yourPlot.interpolation=CPTScatterPlotInterpolationCurved; ...

python,matplotlib,legend,scatter-plot

You can set the legend colors as such: import numpy as np import matplotlib.pyplot as plt t = np.linspace(0,10,100) x = np.random.rand(100,3) y = np.random.rand(100,3) colmaps = ['Blues', 'Greys', 'Reds'] for i in range(3): plt.scatter(x[:,i], y[:,i], c=t, cmap=colmaps[i], label=i) plt.legend() ax = plt.gca() legend = ax.get_legend() legend.legendHandles[0].set_color(plt.cm.Blues(.8)) legend.legendHandles[1].set_color(plt.cm.Greys(.8)) legend.legendHandles[2].set_color(plt.cm.Reds(.8)) plt.show()...

javascript,d3.js,scatter-plot,nvd3.js

You can set the y tooltip content to null to achieve this: var chart = nv.models.scatterChart() .showDistY(false) .tooltipYContent(null); ...