contour

Contour plot legend - Matplotlib

℡╲_俬逩灬. 提交于 2019-12-08 06:42:22
问题 As the question says, I have a contour plot and I would like show a legend for if. I'm using the contour plot style that uses: dashed lines for negative levels solid lines for positive values I would like to have a legend for them (dashed == negative and solid == positive). I tried the approaches found here and here. However, as can be seen below, this doesn't show the correct result. # Draw the scalar field level curves div_field = plt.contour(x, y, div_scalar_field, colors='white') rot

contour plot with date-time strings as x values

三世轮回 提交于 2019-12-08 02:53:30
问题 I am trying to produce a color contour plot showing time along the x axis, depth along the y and temperature as the z values. Time is given as: "2011-01-01 00:01" i.e. "%Y-%m-%d %H:%M" Is there a method for producing the color contour plot from these, and using filled.contour(Time,Depth,temp) example: time <- c("2011-01-01 01:00", "2011-01-01 02:00", "2011-01-01 03:00", "2011-01-01 04:00") depth <- seq(1,10,by = 1) seq1 <- seq(1:40) temp <- matrix(seq1, 10) Every column of temp represents a

How to draw a rectangle around the contours?

大兔子大兔子 提交于 2019-12-08 02:47:34
问题 I am just starting out with opencv and I am trying to make a program that puts squares around a picture of rocks on some sand. The documentation for the function here includes an example of how to use it. findContours( src, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE ); The prototype of findContours is void findContours(InputOutputArray image, OutputArrayOfArrays contours, OutputArray hierarchy, int mode, int method, Point offset=Point()) ; I have two questions. 1. The third

(opencv) merge contours together

假如想象 提交于 2019-12-07 13:00:10
问题 I am doing a real time motion detection program. I find that there are a lot of contour made in my different image after i used background subtraction method . i would like to ask is there any method that can merge these contour together or make a larger rect contain all the contours? the case now i have been done http://singhgaganpreet.files.wordpress.com/2012/07/motioncolour.jpg My code is here #include <iostream> #include <OpenCV/cv.h> #include <OPenCV/highgui.h> using namespace cv; using

Contour plot from scattered data in JavaScript [closed]

拥有回忆 提交于 2019-12-07 12:21:01
问题 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 5 years ago . I'm trying to plot a 2D and 3D contour from x, y, z data. Does anyone know any good JavaScript library that does that? Thank you 回答1: 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. 来源: https:

Set limits on a matplotlib colorbar without changing the actual plot

霸气de小男生 提交于 2019-12-07 07:28:57
问题 I would like create a pseudocolor plot (e.g. contour or contourf ) and a colorbar. For practical reason, I want the range of the colorbar different from the underlying mappable. In the example below, the data Z has a range from 0 to 10000, which is mapped to a colormap. The range of the colorbar is the same. import numpy from matplotlib import pyplot X = numpy.arange(100) Y = numpy.arange(100) Z = numpy.arange(100**2).reshape((100,100)) f = pyplot.figure() ax = f.gca() cf = ax.contourf(X,Y,Z

gnuplot contour plot hatched lines

*爱你&永不变心* 提交于 2019-12-07 03:13:31
问题 I'm using gnuplot for contour plot of a several function. This is for optimization problem. I have 3 functions: f(x,y) g1(x,y) g2(x,y) both g1(x,y) and g2(x,y) are constraints and would like to plot on top of the contour plot of f(x,y) . Here is the textbook example: Here is my attempt to replicate it in gnuplot, thanks to @theozh. ### contour lines with labels reset session f(x,y)=(x**2+y-11)**2+(x+y**2-7)**2 g1(x,y)=(x-5)**2+y**2 g2(x,y) = 4*x+y set xrange [0:6] set yrange [0:6] set

find iso-cost points on a 3d grid efficiently with minimum costing of points

强颜欢笑 提交于 2019-12-07 02:28:17
问题 I have a 3d grid where in each point (x,y,z) on the grid is associated with a cost value. The cost of any point (x,y,z) is not known in advance . To know the cost, we need to make a complex query which is really expensive. One thing we know about the object is that cost is monotonically non-decreasing in all 3 dimensions . Now given a cost C, I need to find the points (x,y,z) on the surface which have cost C . This has to be done by costing only bare minimum . How to solve my problem? When I

Matplotlib: Multiple legends for contour plot for multiple contour variables

有些话、适合烂在心里 提交于 2019-12-07 01:34:25
I need to make multiple contours plots of several variables on the same page. I can do this with MATLAB (see below for MATLAB code). I cannot get matplotlib to show multiple legends. Any help would be much appreciated. Python code: import numpy as np from matplotlib import cm as cm from matplotlib import pyplot as plt delta = 0.25 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) X, Y = np.meshgrid(x, y) Z1 = X*np.exp(-X**2-Y**2) Z2 = Y*np.exp(-X**2-Y**2) plt.figure() CS = plt.contour(X, Y, Z1, colors='k') plt.clabel(CS, inline=1, fontsize=10) CS = plt.contour(X, Y, Z2, colors='r

Draw heat map (or similar) of 2D population distribution

老子叫甜甜 提交于 2019-12-06 16:44:33
I am wondering how I can draw an image of the population proportion (pop.prop) at these locations (x and y) so that I can see the population distribution clearly? The data is shown below: pts.pr = pts.cent[pts.cent$PIDS==3, ] pop = rnorm(nrow(pts.pr), 0, 1) pop.prop = exp(pop)/sum(exp(pop)) pts.pr.data = as.data.frame(cbind(pts.pr@coords, cbind(pop.prop))) x y pop.prop 3633 106.3077 38.90931 0.070022855 3634 106.8077 38.90931 0.012173106 3756 106.3077 38.40931 0.039693085 3878 105.8077 37.90931 0.034190747 3879 106.3077 37.90931 0.057981214 3880 106.8077 37.90931 0.089484103 3881 107.3077 37