scatter-plot

gnuplot: Plot in correct scale & position on top of image

安稳与你 提交于 2019-11-27 07:59:02
问题 My problem is drawing a plot atop an image. The image is not just meant to be a nice background but should line up with the plot. The plot is many colored points representing a car's speed and position in a coordinates system. That works. Now I want to line up the plot with an image of the road and there I have problems. The data file looks like this: -60.2501 106.115 0 0 -68.1729 98.0388 0 0 [...] x-pos, y-pos,speed, ignore last number Here is what I have so far: set multiplot set yrange [

How to define fixed aspect-ratio for scatter-plot

一世执手 提交于 2019-11-27 07:57:41
I am plotting correlation coefficients (values = 0.0:1.0) for two isotopes measured in each individual from two populations. I would like to have a fixed aspect-ratio for my scatter-plot so that the x- and y-axis are exactly the same size no matter the graphics device. Suggestions? This is my first plot in R, any comments on refinements to my code is appreciated? Finally, is it worth investing in learning the basic plotting techniques or should I jump right to ggplot2 or lattice? My plot script: ## Create dataset WW_corr <- structure(list(South_N15 = c(0.7976495, 0.1796725, 0.5338347, 0

Coloring each point of a chart based on data using sequential or divergent color scales

旧城冷巷雨未停 提交于 2019-11-27 07:26:25
问题 How can I colour the individual points on a scatter chart based on values in my spreadsheet? For example, how can I create the following chart: Where the x-data are in column U, the y-data are in column V and the colour data are in column T How can I create a divergent colourmap instead of a sequential one? 回答1: Full example on GitHub: https://github.com/DanGolding/Scatter-plot-with-color-grading-in-Excel If your colour data have only a few discrete values, the easiest way is to plot it as

Adding second legend to scatter plot

落花浮王杯 提交于 2019-11-27 07:16:57
问题 Is there a way to add a secondary legend to a scatterplot, where the size of the scatter is proportional to some data? I have written the following code that generates a scatterplot. The color of the scatter represents the year (and is taken from a user-defined df) while the size of the scatter represents variable 3 (also taken from a df but is raw data): import pandas as pd colors = pd.DataFrame({'1985':'red','1990':'b','1995':'k','2000':'g','2005':'m','2010':'y'}, index=[0,1,2,3,4,5]) fig =

scatterplot3d: regression plane with residuals

非 Y 不嫁゛ 提交于 2019-11-27 06:20:46
问题 Using scatterplot3d in R, I'm trying to draw red lines from the observations to the regression plane: wh <- iris$Species != "setosa" x <- iris$Sepal.Width[wh] y <- iris$Sepal.Length[wh] z <- iris$Petal.Width[wh] df <- data.frame(x, y, z) LM <- lm(y ~ x + z, df) library(scatterplot3d) G <- scatterplot3d(x, z, y, highlight.3d = FALSE, type = "p") G$plane3d(LM, draw_polygon = TRUE, draw_lines = FALSE) To obtain the 3D equivalent of the following picture: In 2D, I could just use segments : pred <

How to draw half-filled points in R (preferably using ggplot)

好久不见. 提交于 2019-11-27 06:01:47
问题 I was wondering if it is possible to fill points with multiple colors. For example, in a scatter plot, I'd like to see for each point the upper half is filled with certain color while the lower half filled with a different one. If possible, I'd also like to make the pairs of filling colors in each point mappings from some underlying data (for instance, certain types of pairing for if the data takes value of x). So far I've thought about plotting twice with two eclipses and fill them

connecting points with lines in ggplot2 in r

落花浮王杯 提交于 2019-11-27 05:40:19
问题 Here is my data: mydata <- data.frame (grp = c( 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,2, 2, 2,2, 2, 2, 2, 2), grp1 = c("A", "A", "A", "A", "A", "B", "B", "B", "B" , "A", "A", "A", "A", "B", "B", "B", "B", "B"), namef = c("M1", "M3", "M2", "M4", "M5","M1", "M3", "M4", "M0", "M6", "M7", "M8", "M10", "M6", "M7", "M8", "M9", "M10"), dgp = c(1, 1, 1, 1, 1, 1.15, 1.15,1.15, 1.15 , 2, 2, 2, 2,2.15, 2.15, 2.15, 2.15, 2.15), position = c(1.1, 2.1, 3.2, 4.1, 5.0, 1.1, 2.0, 5.0, 6.2, 1.0,3.0, 4.1, 5.0, 1.0, 2.1,

Control colorbar scale in MATLAB

点点圈 提交于 2019-11-27 04:54:19
问题 Question: How do I specify color transitions in a custom MATLAB colorbar? Specifically, I'd like to make the yellow (see below) cover more area of the colorbar (perhaps [19.5–21.5] or something close to that). Using this answer, I was able to create a custom colorbar in MATLAB. I'm trying to understand this answer as it might be relevant. I have attempted approaches from this answer and reviewed this answer & this one and was unable to accomplish my goal. Full representative example below %

How to completely remove the white space around a scatterplot?

风流意气都作罢 提交于 2019-11-27 03:45:54
问题 I am trying to plot a scatterplot over an image without having any white space around it. If I plot just the image as follows, then there is no white space: fig = plt.imshow(im,alpha=alpha,extent=(0,1,1,0)) plt.axis('off') fig.axes.axis('tight') fig.axes.get_xaxis().set_visible(False) fig.axes.get_yaxis().set_visible(False) but as I add a scatter plot over the image as follows: fig = plt.scatter(sx, sy,c="gray",s=4,linewidths=.2,alpha=.5) fig.axes.axis('tight') fig.axes.get_xaxis().set

Categorical scatter plot with mean segments using ggplot2 in R

点点圈 提交于 2019-11-27 03:40:13
问题 I am trying to plot a simple scatter plot for 3 groups, overlaying a segment indicating the mean for each group and labelling the groups. I have managed to get a scatter plot with error bars, but I would only like a segment indicating where the mean is. I also cannot seem to be getting the group labelling right. To get the summary statistics I am using the function "summarySE" from this page. [EDIT: note this function is also provided in the Rmisc package] Is there any simpler way to do this,