axes

Plot subplot axes in separate figure in matplotlib [duplicate]

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Save a subplot in matplotlib 2 answers Suppose I have the following code (modified version of matplotlib gridspec tutorial ) import matplotlib.pyplot as plt def make_ticklabels_invisible(fig): for i, ax in enumerate(fig.axes): ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") for tl in ax.get_xticklabels() + ax.get_yticklabels(): tl.set_visible(False) plt.figure(0) ax1 = plt.subplot2grid((3,3), (0,0), colspan=3) ax2 = plt.subplot2grid((3,3), (1,0), colspan=2) ax3 = plt.subplot2grid((3,3),

OpenCL - Are work-group axes exchangeable?

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I was trying to find the best work-group size for a problem and I figured out something that I couldn't justify for myself. These are my results : GlobalWorkSize {6400 6400 1}, WorkGroupSize {64 4 1}, Time(Milliseconds) = 44.18 GlobalWorkSize {6400 6400 1}, WorkGroupSize {4 64 1}, Time(Milliseconds) = 24.39 Swapping axes caused a twice faster execution. Why !? By the way, I was using an AMD GPU. Thanks :-) EDIT : This is the kernel (a Simple Matrix Transposition): __kernel void transpose(__global float *input, __global float *output, const

How to rotate image and axes together on Matlab?

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Code 1 where flipping vertically and/or horizontally does not affect axes() ; Code 2 where proposed solution does not yield the expected output close all; clear all; clc; x = [5 8]; y = [3 6]; C = [0 2 4 6; 8 10 12 14; 16 18 20 22]; C2 = C(:,end:-1:1,:); %# horizontal flip C3 = C(end:-1:1,:,:); %# vertical flip C4 = C(end:-1:1,end:-1:1,:); %# horizontal+vertical flip % https://stackoverflow.com/a/4010203/54964 subplot(2,2,1), imagesc(x,y,C) subplot(2,2,2), imagesc(x,y,C2) subplot(2,2,3), imagesc(x,y,C3) subplot(2,2,4), imagesc(x,y,C4) %%

Correct placement of colorbar relative to geo axes (cartopy)

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Using Cartopy, I would like to have full control of where my colorbar goes. Usually I do this by getting the current axes position as basis and then create new axes for the colorbar. This works well for standard matplotlib axes but not when using Cartopy and geo_axes, because this will distort the axes. So, my question is: how do I get the exact position of my geo_axes? Here is a code example based on the Cartopy docs http://scitools.org.uk/cartopy/docs/latest/matplotlib/advanced_plotting.html : import cartopy.crs as ccrs import matplotlib

How to customize axes in 3D hist python/matplotlib

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to plot this data set using 3D bar B A freq 1 2003 2 1 2003 2 2 2008 1 2 2007 2 2 2007 2 3 2004 1 1 2004 3 1 2004 3 1 2004 3 I have written the code here. data = pandas.DataFrame({'A':[2003,2003,2008,2007,2007,2004,2004,2004,2004] , 'B': [1,1,2,2,2,3,1,1,1] ,'C': [2,2,1,2,2,1,3,3,3] }) fig = plt.figure() ax = plt.axes(projection='3d') # put 0s on the y-axis, and put the y axis on the z-axis #ax.plot(data.A.values, data.B.values,data.freq.values, marker='o', linestyle='--', color="blue", label='ys=0, zdir=z') xpos= range(len( data

Aplpy multiplot dynamic axis sharing

匿名 (未验证) 提交于 2019-12-03 02:22:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there any way to make multiplot aplpy plots dynamically share axes so that when one is moved or zoomed, it moves and zooms the others? I can achieve the affect using matplotlib pyplot's imshow and subplot routines, but using those limits some other important aspects of my plotting, while aplpy provides all the tools I need for my images. I have tried using the matplotlib cid commands and a function to recenter all the images based on click locations, but I can only zoom in, or out, not both, and I cant click and drag yet. My MWE of my

understanding matplotlib.subplots python

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have constructed a set of pie charts with some help Insert image into pie chart slice My charts look wonderful, now I need to place all 6 of them in a 2x3 figure with common tick marks on the shared x and y axis. For starting I am looking at subplots and thought I could get it to work. I downloaded some examples and started to try a few things. f, (a) = (plt.subplots(nrows=1, ncols=1, sharex=True, sharey=True))#, #squeeze=False, subplot_kw=None, gridspec_kw=None)) print(type(f),'\n',type(a),'\n')#,type(b)) yields: class 'matplotlib.figure

Matplotlib 2 Subplots, 1 Colorbar

匿名 (未验证) 提交于 2019-12-03 02:09:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've spent entirely too long researching how to get two subplots to share the same y-axis with a single colorbar shared between the two in Matplotlib. What was happening was that when I called the colorbar() function in either subplot1 or subplot2 , it would autoscale the plot such that the colorbar plus the plot would fit inside the 'subplot' bounding box, causing the two side-by-side plots to be two very different sizes. To get around this, I tried to create a third subplot which I then hacked to render no plot with just a colorbar present

matplotlib: can I create AxesSubplot objects, then add them to a Figure instance?

匿名 (未验证) 提交于 2019-12-03 02:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Looking at the matplotlib documentation, it seems the standard way to add an AxesSubplot to a Figure is to use Figure.add_subplot : from matplotlib import pyplot fig = pyplot.figure() ax = fig.add_subplot(1,1,1) ax.hist( some params .... ) I would like to be able to create AxesSubPlot -like objects independently of the figure, so I can use them in different figures. Something like fig = pyplot.figure() histoA = some_axes_subplot_maker.hist( some params ..... ) histoA = some_axes_subplot_maker.hist( some other params ..... ) # make one figure

remove colorbar from figure in matplotlib

匿名 (未验证) 提交于 2019-12-03 01:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This should be easy but I'm having a hard time with it. Basically, I have a subplot in matplotlib that I'm drawing a hexbin plot in every time a function is called, but every time I call the function I get a new colorbar, so what I'd really like to do is update the colorbar. Unfortunately, this doesn't seem to work since the object the colorbar is attached to is being recreated by subplot.hexbin. def foo(self): self.subplot.clear() hb = self.subplot.hexbin(...) if self.cb: self.cb.update_bruteforce() # Doesn't work (hb is new) else: self.cb