shape

Python Matplotlib - Impose shape dimensions with Imsave

喜欢而已 提交于 2019-12-10 13:48:57
问题 I plot a great number of pictures with matplotlib in order to make video with it but when i try to make the video i saw the shape of the pictures is not the same in time...It induces some errors. Is there a command to impose the shape of the output when i use Imsave? You can see a part of my code : plt.close() fig, axes = plt.subplots(nrows=2, ncols=3) ###Figures composante X plt.tight_layout(pad=0.05, w_pad=0.001, h_pad=2.0) ax1 = plt.subplot(231) # creates first axis ax1.set_xticks([0,2000

How can I get the x and y dimensions of a ndarray - Numpy / Python

妖精的绣舞 提交于 2019-12-10 13:19:00
问题 I'm wondering if I can get the x and y dimensions of a ndarray separately. I know that I can use ndarray.shape to get a tuple representing the dimensions, but how can I separate this in x and y information? Thank you in advance. 回答1: You can use tuple unpacking. y, x = a.shape 回答2: height, width = a.shape Note, however, that ndarray has matrix coordinates ( i,j ), which are opposite to image coordinates ( x,y ). That is: i, j = y, x # and not x, y Also, Python tuples support indexing, so you

Cannot inherit Shapes

孤街浪徒 提交于 2019-12-10 06:15:14
问题 Why I can't use a class that inherits a Shapes class? I need to extend the Rectangle class with some methods, but i want to use this class in the same way I use a Shape , how can I do? 回答1: As Jon pointed out, Rectangle is sealed. Depending on what you're trying to do, a couple options are: You can extend Shape with your own class that contains Rectangle, and augment the functionality through composition. These objects wouldn't be considered Rectangles from an "is" check. You can write

Draw text on shape in ActionScript 3

橙三吉。 提交于 2019-12-10 03:28:54
问题 Is there any way to draw text in a DisplayObject or Shape using only ActionScript? The only way I can find on the web is by creating a TextField, but I can't add a TF to a DisplayObject or Shape. Edit: Solved thanks to viatropos. For anyone that's interested: DisplayObject implements IBitmapDrawable which can be passed as an argument to the draw function of a BitmapData object, which then can be drawn using graphics.beginBitmapFill . var textfield:TextField = new TextField; textfield.text =

Get data frame with polygons id and Centroid (lat long) information from shapefile

微笑、不失礼 提交于 2019-12-10 03:06:06
问题 I have a polygon shapefile (downloadable here) from which I want to create a data.frame with 3 columns containing: Polygon id Centroid latitude Centroid Longitude From this answer here, I know it its quite easy to get this information as a Formal Class SpatialPoints object. And when I convert this object to a data.frame I loose the id information. # Load Shapefile Legislative_areas <- readOGR(dsn = 'C:/Users/.../Downloads/Legislative2010UTM', layer ='Legislative2010UTM') # Get centroids cent

Diagonal Wedge Shaped CSS - Edge to Edge Centered in Browser

偶尔善良 提交于 2019-12-10 02:15:45
问题 I have been trying to make this shape in CSS. Ideally it will span the entire length of the browser window and probably extend outside the field of view to support larger screens and also be centered so that the angle does not change. Anyone have any solutions? Also I think I might run into a problem of the angle aliasing harshly. I might need to resort to using an image. Would like to use CSS though. ** Image Spelling Error. (Indefinitely not Inevitably) 回答1: A solution that doesn't require

Cutting irregular shape on image

∥☆過路亽.° 提交于 2019-12-09 21:03:24
问题 I am trying to cut an image into a particular shape using the canvas clip() method. I have followed the following steps to do so: Draw a rectangle. Draw semi circles on each side. The right and bottom semi circles protrude outwards and the left and top semi circles are inwards. The code snippet is provided below: var canvasNode = this.hasNode(); var ctx = canvasNode && canvasNode.getContext('2d'); var image = new Image(); image.onload = function() { ctx.drawImage(image, 0, 0, 512, 384); };

What is dimension order of numpy shape for image data?

前提是你 提交于 2019-12-09 09:20:34
问题 I am using nibabel lib to load data from nii file. I read the document of the lib at http://nipy.org/nibabel/gettingstarted.html, and found that This information is available without the need to load anything of the main image data into the memory. Of course there is also access to the image data as a NumPy array This is my code to load the data and it shapes import nibabel as nib img = nib.load('example.nii') data = img.get_data() data = np.squeeze(data) data = np.copy(data, order="C") print

distance between two Shapes/Areas in Java?

蹲街弑〆低调 提交于 2019-12-08 21:38:28
问题 If I have two java.awt.geom.Area 's made out of the union of various simple Shapes (Polygons and Ellipses), is there a method out there to find the distance (i.e. closest distance) between the two Areas? To clarify: suppose I have two arbitrary Areas, each of which is created from the union of shapes of any sort: //Define the first area Area a = new Area(new Ellipse2D.Double(50, 50, 100, 100)); a.add(new Area(new Rectangle2D.Double(100, 100, 100, 100))); //Define the second area Area b = new

CSS - How to make rectangle with pointed sides? [duplicate]

最后都变了- 提交于 2019-12-08 20:16:38
问题 This question already has answers here : How to make triangle shape in before a div in pure css? (1 answer) How do CSS triangles work? (18 answers) Closed 5 years ago . http://nl.tinypic.com/r/jgm90h/8 I would like to know how to make a HTML button tag have the shape in the link above using pure CSS3. Can you guys help me out? 回答1: The trick is to use the pseudo classes :before and :after . Try it like this: .yourButton { position: relative; width:200px; height:40px; margin-left:40px; color: