scatter-plot

Python matplotlib superimpose scatter plots

隐身守侯 提交于 2019-11-29 09:08:16
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 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 scatter plots is blue. This is perhaps why you were only seeing one plot. import numpy as np import pylab as

Matplotlib scatter plot - Remove white padding

梦想与她 提交于 2019-11-29 08:20:53
I'm working with matplotlib to plot a variable in latitude longitude coordinates. The problem is that this image cannot include axes or borders. I have been able to remove axis, but the white padding around my image has to be completely removed (see example images from code below here: http://imgur.com/a/W0vy9 ) . I have tried several methods from Google searches, including these StackOverflow methodologies: Remove padding from matplotlib plotting How to remove padding/border in a matplotlib subplot (SOLVED) Matplotlib plots: removing axis, legends and white spaces but nothing has worked in

matplotlib 3D scatterplot with marker color corresponding to RGB values

跟風遠走 提交于 2019-11-29 06:54:33
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='0.5', marker='o') ax.set_xlabel('X Label') ax.set_ylabel('Y Label') ax.set_zlabel('Z Label') plt.show

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

元气小坏坏 提交于 2019-11-29 06:15:20
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 following error: "Error: Continuous value supplied to discrete scale" Does anyone know what could be wrong

Highcharts: how to change line color when hovering a scatterplot series

耗尽温柔 提交于 2019-11-29 05:22:18
I have a Highcharts scatterplot. Some details of the chart object are below: plotOptions: { scatter: { lineWidth:1, marker: { radius: 1, symbol:'circle', fillColor: '#800000', states: { hover: { enabled: true, radius:0, radiusPlus:2, lineColor: '#ff0000', fillColor: '#ff0000' } } }, states: { hover: { halo:false, lineWidthPlus:2, } } } } and the full working example is here . I need to change the line color when hovering the series, but I am unable to do it. Is this possible? This can be easily achieved with events. All you need is to update the series color property when user hovers on a

Reading objects from shiny output object not allowed?

懵懂的女人 提交于 2019-11-29 02:56:42
问题 I'm trying to write a little app that will allow the user to make a scatterplot, select a subset of points on the plot, then output a table in .csv format with just those selected points. I figured out how to get the page up and running and how to select points using brushedPoints. The table with selected points appears but when I press the Download button, the error "Reading objects from shinyoutput object not allowed." appears. Am I unable to download the table that I can visually see on

Scatter Plots in C++ [closed]

北战南征 提交于 2019-11-29 02:32:46
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . 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? 回答1: 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

JFreeChart Scatter Plot Lines

荒凉一梦 提交于 2019-11-29 01:53:02
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; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org

matplotlib: update position of patches (or: set_xy for circles)

笑着哭i 提交于 2019-11-29 01:30:42
Inspired by this example I'm trying to write a little matplotlib program that allows the user to drag and drop datapoints in a scatter plot dynamically. In contrast to the example which uses a bar plot (and thus allows dragging of rectangles) my goal was to achieve the same with other patches, like for instance a circle (any patch that is more scatter-plot-compatible than a rectangle would do). However I'm stuck at the point of updating the position of my patch. While a Rectangle provides a function set_xy I cannot find a direct analog for Cirlce or Ellipse . Obtaining the position of a circle

Matplotlib: Scatter Plot to Foreground on top of a Contour Plot

和自甴很熟 提交于 2019-11-29 01:06:49
Does anyone know a way to bring a scatter plot to the foreground in matplotlib? I have to display the scatter plotting on top of the contour, but by default it is plotted underneath... Thanks in advance! You can manually choose in which order the different plots are to be displayed with the zorder parameter of e.g. the scatter method. To demonstrate, see the code below, where the scatter plot in the left subplot has zorder=1 and in the right subplot it has zorder=-1 . The object with the highest zorder is placed on top. This means that the scatter will be placed on top of the contour in the