scatter-plot

How do we plot images at given coordinates in R?

我们两清 提交于 2019-11-30 10:33:22
Given 'n' images in a png/jpeg format and 'n' corresponding coordinates in 2 dimensions (x,y): I would like to plot these images at the given coordinates on a single plot. If I find the images to be too big, I would ideally like to plot them as a smaller/scaled version at the given coordinates. How can i achieve such a plot in R? An example of how such a plot would look is given below: xy <- data.frame(x=runif(10, 0, 100), y=runif(10, 0, 100)) require(png) img <- readPNG(system.file("img", "Rlogo.png", package="png")) thumbnails <- function(x, y, images, width = 0.1*diff(range(x)), height = 0

Colormap for errorbars in x-y scatter plot using matplotlib

ぃ、小莉子 提交于 2019-11-30 08:00:36
问题 I have a time series of data for which I have the quantity, y, and its error, yerr. I would now like to create a plot that shows y against phase (i.e. time / period % 1) with vertical errorbars (yerr). For this, I typically use pyplot.errorbar(time, y, yerr=yerr, ...) However, I would like to use a colorbar/map to indicate the value of time in this same plot. What I thus do is the following: pylab.errorbar( phase, y, yerr=err, fmt=None, marker=None, mew=0 ) pylab.scatter( phase, y, c=time,

Python matplotlib superimpose scatter plots

天涯浪子 提交于 2019-11-30 07:50:24
问题 I am using Python matplotlib. i want to superimpose scatter plots. I know how to superimpose continuous line plots with commands: >>> plt.plot(seriesX) >>> plt.plot(Xresampl) >>> plt.show() But it does not seem to work the same way with scatter. Or maybe using plot() with a further argument specifying line style. How to proceed? thanks 回答1: You simply call the scatter function twice, matplotlib will superimpose the two plots for you. You might want to specify a color, as the default for all

How to label bubble chart/scatter plot with column from pandas dataframe?

此生再无相见时 提交于 2019-11-30 07:23:12
I am trying to label a scatter/bubble chart I create from matplotlib with entries from a column in a pandas data frame. I have seen plenty of examples and questions related (see e.g. here and here ). Hence I tried to annotate the plot accordingly. Here is what I do: import matplotlib.pyplot as plt import pandas as pd #example data frame x = [5, 10, 20, 30, 5, 10, 20, 30, 5, 10, 20, 30] y = [100, 100, 200, 200, 300, 300, 400, 400, 500, 500, 600, 600] s = [5, 10, 20, 30, 5, 10, 20, 30, 5, 10, 20, 30] users =['mark', 'mark', 'mark', 'rachel', 'rachel', 'rachel', 'jeff', 'jeff', 'jeff', 'lauren',

Change ylab position in R Scatterplot3D

我的未来我决定 提交于 2019-11-30 07:16:26
I´m working with R scatterplot3D and I need to use expression() in labels because I have to use some Greek letters; my question is: is there a way to pull the y.lab name down or write it along the axis (in a diagonal position)? I went to help and packages description but nothing seems to work; thanks in advance for any help Maria library(scatterplot3d) par(mfrow=c(1,1)) A <- c(3,2,3,3,2) B <- c(2,4,5,3,4) D <- c(4,3,4,2,3) scatterplot3d(A,D,B, xlab=expression(paste(x[a],"-",x[b])), ylab=expression(x[a]), zlab=expression(sigma^2)) You can't use any of the classic ways due to the way the

creating a matplotlib scatter legend size related

不想你离开。 提交于 2019-11-30 06:53:35
I am looking for a way to include a (matplotlib) legend that describe the size of points in a scatter plot, as this could be related to another variable, like in this basic example: import numpy as np import matplotlib.pyplot as plt N = 50 x = np.random.rand(N) y = np.random.rand(N) a2 = 400*np.random.rand(N) plt.scatter(x, y, s=a2, alpha=0.5) plt.show() (inspired from: http://matplotlib.org/examples/shapes_and_collections/scatter_demo.html ) so in the legend there would be ideally few spots corresponding to sizes 0-400 (the a2 variable), according to s descriptor in scatter . Ffisegydd The

Adding y=x to a matplotlib scatter plot if I haven't kept track of all the data points that went in

霸气de小男生 提交于 2019-11-30 04:53:08
Here's some code that does scatter plot of a number of different series using matplotlib and then adds the line y=x: import numpy as np, matplotlib.pyplot as plt, matplotlib.cm as cm, pylab nseries = 10 colors = cm.rainbow(np.linspace(0, 1, nseries)) all_x = [] all_y = [] for i in range(nseries): x = np.random.random(12)+i/10.0 y = np.random.random(12)+i/5.0 plt.scatter(x, y, color=colors[i]) all_x.extend(x) all_y.extend(y) # Could I somehow do the next part (add identity_line) if I haven't been keeping track of all the x and y values I've seen? identity_line = np.linspace(max(min(all_x), min

Scatter Plots in C++ [closed]

一个人想着一个人 提交于 2019-11-30 04:43:23
What is the best way to graph scatter plots in C++? Do you write data to a file and use another tool? Is there a library like matplotlib in Python? I always write out data and then using gnuplot to create my graphs. It is by far the best way I have found of producing graphs in a variety of formats: eps, png, jpeg, xpm, you name it. gnuplot will do scatter plot very easily. Provided the x and y values are in 2 space-separated columnss, then plot "data.txt" using 1:2 Will give you a quick scatter plot. Then you can adjust it and what not using other gnuplot commands. If you are involved in

Changing the background color of the axes planes of a matplotlib 3D plot

对着背影说爱祢 提交于 2019-11-30 00:30:42
问题 On the basis of the scatterplot example of matplotlib, how can I change the gray background color of the 3 axes grid planes? I would like to set it to white, keeping the grid lines with the default gray color. I found this question but I couldn't apply it to the example. Thanks. 回答1: Using the same example. You can set the pane color using the set_pane_color method as described here http://matplotlib.org/mpl_toolkits/mplot3d/api.html#axis3d. You can set the color using the RGBA tuple: #

Individual alpha values in scatter plot

妖精的绣舞 提交于 2019-11-29 21:22:18
I'm wondering if it is possible to have individual alpha values for each point to be plotted using the scatter function of Matplotlib. I need to plot a set of points, each one with its alpha value. For example, I have this code to plot some points def plot_singularities(points_x, p, alpha_point, file_path): plt.figure() plt.scatter(points_x, points_y, alpha=alpha_point) plt.savefig(file_path + '.png', dpi=100) plt.close() All my points_x , points_y and alpha_point have n values. However, I can't assign an array to the alpha parameter in scatter() . How can I have a different alpha value for