axes

How can I make a blank subplot in matplotlib?

∥☆過路亽.° 提交于 2019-11-30 10:37:38
问题 I am making a group of subplot (say, 3 x 2) in matplotlib, but I have fewer than 6 datasets. How can I make the remaining subplot blank? The arrangement looks like this: +----+----+ | 0,0| 0,1| +----+----+ | 1,0| 1,1| +----+----+ | 2,0| 2,1| +----+----+ This may go on for several pages, but on the final page, there are, for example, 5 datasets to the 2,1 box will be empty. However, I have declared the figure as: cfig,ax = plt.subplots(3,2) So in the space for subplot 2,1 there is a default

Aplpy multiplot dynamic axis sharing

こ雲淡風輕ζ 提交于 2019-11-30 07:42:44
问题 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

python/matplotlib - parasite twin axis scaling

孤者浪人 提交于 2019-11-29 22:55:41
问题 Trying to plot a spectrum, ie, velocity versus intensity, with lower x axis = velocity, on the upper twin axis = frequency The relationship between them (doppler formula) is f = (1-v/c)*f_0 where f is the resulting frequency, v the velocity, c the speed of light, and f_0 the frequency at v=0, ie. the v_lsr. I have tried to solve it by looking at http://matplotlib.sourceforge.net/examples/axes_grid/parasite_simple2.html , where it is solved by pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5

How can I make a blank subplot in matplotlib?

坚强是说给别人听的谎言 提交于 2019-11-29 21:12:04
I am making a group of subplot (say, 3 x 2) in matplotlib, but I have fewer than 6 datasets. How can I make the remaining subplot blank? The arrangement looks like this: +----+----+ | 0,0| 0,1| +----+----+ | 1,0| 1,1| +----+----+ | 2,0| 2,1| +----+----+ This may go on for several pages, but on the final page, there are, for example, 5 datasets to the 2,1 box will be empty. However, I have declared the figure as: cfig,ax = plt.subplots(3,2) So in the space for subplot 2,1 there is a default set of axes with ticks and labels. How can I programatically render that space blank and devoid of axes?

Is there a way to remove a single plot from existing axes?

断了今生、忘了曾经 提交于 2019-11-29 17:49:08
问题 Is there an easy way to remove a plotted line from a set of axes without clearing everything else on the axes? I'm trying to implement a GUI with a listbox containing several data sets. I can make the callback function plot the selected data, but I'm not sure how to 'unplot' it when I deselect a data set. Any ideas? 回答1: If you save a handle to the created graphics object, you can call DELETE on it to remove it from the plot: hLine = plot(...); %# Create a line with PLOT delete(hLine); %# ..

Labelling logarithmic scale display in R

☆樱花仙子☆ 提交于 2019-11-29 17:25:13
问题 While plotting histogarm, scatterplots and other plots with axes scaled to logarithmic scale in R, how is it possible to use labels such as 10^-1 10^0 10^1 10^2 10^3 and so on instead of the axes showing just -1, 0, 1, 2, 3 etc. What parameters should be added to the commands such as hist(), plot() etc? 回答1: Apart from the solution of ggplot2 (see gsk3's comment), I would like to add that this happens automatically in plot() as well when using the correct arguments, eg : x <- 1:10 y <- exp(1

python check if figure is 2d or 3d

不问归期 提交于 2019-11-29 16:43:35
In matlab with a figure, to check if it is 3D figure or 2D figure I use: V=axis; and check the number of components of V (4 for 2d figure, 6 for 3d figure). How can i implement this with python and matplotlib? ImportanceOfBeingErnest You can use the name of the axes. plt.gca().name or ax.name if ax is the axes. A 3D axes' name will be "3d" . A 2D axes' name will be "rectilinear" , "polar" or some other name depending on the type of plot. You can therefore check if ax.name == "3d": # axes is 3D, do something else: # axes is not 3D, do something else You can also check for the limits, as

Seaborn学习05:分布图(多坐标显示)

拈花ヽ惹草 提交于 2019-11-29 14:14:27
import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white", palette="muted", color_codes=True) rs = np.random.RandomState(10) d = rs.normal(size=100) # 多个坐标显示 f, axes = plt.subplots(nrows=1, ncols=2, figsize=(12, 5)) sns.distplot(d, color="g", hist=False, kde_kws={"shade": True}, ax=axes[0]) # hist是否显示直方图 sns.distplot(d, color="m", ax=axes[1]) plt.show() 显示效果: 来源: https://www.cnblogs.com/jumpkin1122/p/11519295.html

Correct placement of colorbar relative to geo axes (cartopy)

北城余情 提交于 2019-11-29 05:43:55
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.pyplot as plt import os from netCDF4 import Dataset as

Crossing axis and labels in matlab

别说谁变了你拦得住时间么 提交于 2019-11-29 02:26:13
I just can't find it. How to set up axis and labels in matlab so they cross at zero point, with the labels just below the axis not on left/bottom of the plot ? If I didn't make myself clear - I just want the plot to look like like we all used to draw it when in school. Axes crossing, 4 quadrants, labels right below axis, curve ... as it goes. Anyone knows how to set it up ? You should check out two submissions on The MathWorks File Exchange : PlotAxisAtOrigin by Shanrong Zhang axescenter by Matt Fig Hopefully these will work with whatever MATLAB version you have (the submission from Matt Fig