scatter-plot

3D scatter plot with 4D data

前提是你 提交于 2019-11-28 02:23:23
I need to plot a 3D figure with each data point colored with the value of a 4th variable using a colormap. Lets say I have 4 variables X,Y,Z and W where W = f(X,Y,Z). I want a 3D plot with X, Y, and Z as the three axis. The statement scatter3(X,Y,Z,'filled','b') gives me a scatter plot in 3D but I want to incorporate the value of Z in the graph by representing the points as an extra parameter (either with different areas :bigger circles for data points with high value of Z and small circles for data points with low value of Z or by plotting the data points with different colors using a

matplotlib 3D scatterplot with marker color corresponding to RGB values

主宰稳场 提交于 2019-11-28 00:28:12
问题 I have loaded a picture into a numpy array using mahotas. import mahotas img = mahotas.imread('test.jpg') Each pixel in img is represented by an array of RGB values: img[1,1] = [254, 200, 189] I have made a 3D scatterplot of R values on one axis, G values on the 2nd axis and B values on the third axis. This is no problem: fig = plt.figure() ax = fig.add_subplot(111, projection = '3d') for i in range(1,img.shape[1]+1): xs = img[i,1][0] ys = img[i,1][1] zs = img[i,1][2] ax.scatter(xs, ys, zs, c

“Error: Continuous value supplied to discrete scale” in default data set example mtcars and ggplot2

做~自己de王妃 提交于 2019-11-27 23:31:39
问题 I am trying to replicate the example here (sthda.com) using the following code: # Change point shapes and colors manually ggplot(mtcars, aes(x=wt, y=mpg, color=cyl, shape=cyl)) + geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE)+ scale_shape_manual(values=c(3, 16, 17))+ scale_color_manual(values=c('#999999','#E69F00', '#56B4E9'))+ theme(legend.position="top") The example on that web page says that code should produce the following result: But when I run it in R, I get the

ggplot: colour points by groups based on user defined colours

谁说胖子不能爱 提交于 2019-11-27 22:25:52
I am trying to define the colours of groups of points plotted in ggplot. I adapted code from this post: Color ggplot points based on defined color codes but as soon as I have more than one row defined by the same grouping variable (rather than a separate colour for each row), the code fails, and I can't figure out why. Below is a reproducible example: #create some data zone <- c("E","E","C","C","C","E","E") #grouping variable col <- c(50,100,150,200,250,300,350) #x variable D <- c(.4,.45,.20,.22,.30,.31,.35) #y variable df1 <- data.frame(zone, D, col); df1 #create a colour scheme based on

MATLAB - Plot multiple data sets on a scatter plot

*爱你&永不变心* 提交于 2019-11-27 21:57:25
I have two sets of data, (Ax, Ay; Bx, By). I'd like to plot both of these data sets on a scatter plot with different colors, but I can't seem to get it to work, because it seems scatter() does not work like plot() . Is it possible to do this? I've tried... scatter(Ax, Ay, 'g', Bx, By, 'b') And scatter(Ax, Ay, 'g') scatter(Bx, By, 'b') The first way returns an error. The latter only plots the Bx / By data. Qtax Try using hold on with the second example. plot (ax,ay,'g.') generates a scatter plot with green dots if you want bigger circles, you can use plot (ax,ay,'g.', 'MarkerSize', XX) %XX = 20

Control the size of points in an R scatterplot?

故事扮演 提交于 2019-11-27 17:33:37
In R, the plot() function takes a pch argument that controls the appearance of the points in the plot. I'm making scatterplots with tens of thousands of points and prefer a small, but not too small dot. Basically, I find pch='.' to be too small, but pch=19 to be too fat. Is there something in the middle or some way to scale the dots down somehow? Try the cex argument: ?par cex A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. Note that some graphics functions such as plot.default have an argument of this name which multiplies

How can I label points in this scatterplot?

匆匆过客 提交于 2019-11-27 17:23:25
Can you help me on putting labels on the following graph? The code i use is: valbanks<-scan("banks.txt", what=list(0,0,""), sep="", skip=1, comment.char="#") valbanks valj2007<-valbanks[[1]] valj2009<-valbanks[[2]] namebank<-valbanks[[3]] percent_losses<-(valj2009-valj2007)/valj2007 percent_losses abs_losses<-(valj2007-valj2009) abs_losses plot(abs_losses, percent_losses,main="Absolute Losses vs. Relative Losses(in%)",xlab="Losses (absolute, in miles of millions)",ylab="Losses relative (in % of January´2007 value",col="blue", pch = 19, cex = 1, lty = "solid", lwd = 2,text(percet_losses, abs

scatter plot in jfreechart from database

拜拜、爱过 提交于 2019-11-27 16:22:11
How can i draw scatter plot of datas in mysql database table using jfreechart in java. I have used swing library. Any link would be helpful. I searched google but couldnot find a understanding solution. If you have got code just provide me. Actually i did do barchart and plot it using jfreechart. The code i used for my barchart is here. Here display3 function displays the barchart. How can i modify it to display scatter plot? public void display3() throws SQLException, ClassNotFoundException{ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String JDBC_DRIVER="com.mysql.jdbc

iOS Scatter core plot with a gap

孤街醉人 提交于 2019-11-27 16:22:09
How does one draw a scatter plot with a gap using core plot? I was using the core plot library. Everything is working fine but now I want to do a scatter plot with a gap at the beginning or in the middle of the dataline? Someone help me please? Have the datasource return nil or [NSNull null] . For example, if the plot has five data points and you return nil for the x or y field at index 2, the plot will draw the points at indices 0 and 1 connected by a line and indices 3 and 4 connected by a line with a gap in between. 来源: https://stackoverflow.com/questions/17333532/ios-scatter-core-plot-with

JFreeChart Scatter Plot Lines

旧街凉风 提交于 2019-11-27 16:15:52
问题 I'm trying to create a graph with JFreeChart, however it doesn't get the lines right. Instead of connecting the points in the order I put them, it connects the points from in order of their x-values. I'm using ChartFactory.createScatterPlot to create the plot and a XYLineAndShapeRenderer to set the lines visible. /edit: sscce: package test; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation;