axes

python/matplotlib - parasite twin axis scaling

烂漫一生 提交于 2019-11-30 16:07:25
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 aux_trans = matplotlib.transforms.Affine2D().scale(pm_to_kms, 1.) ax_pm = ax_kms.twin(aux_trans) ax_pm

Aplpy multiplot dynamic axis sharing

折月煮酒 提交于 2019-11-30 16:00:13
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 plotting code is below: from astropy.io import fits

matplotlib autoscale axes to include annotations

本秂侑毒 提交于 2019-11-30 15:37:45
问题 Does anyone know of an easy way to expand the plot area to include annotations? I have a figure where some labels are long and/or multiline strings, and rather than clipping these to the axes, I want to expand the axes to include the annotations. Autoscale_view doesn't do it, and ax.relim doesn't pick up the position of the annotations, so that doesn't seem to be an option. I've tried to do something like the code below, which loops over all the annotations (assuming they are in data

matplotlib autoscale axes to include annotations

女生的网名这么多〃 提交于 2019-11-30 15:34:34
Does anyone know of an easy way to expand the plot area to include annotations? I have a figure where some labels are long and/or multiline strings, and rather than clipping these to the axes, I want to expand the axes to include the annotations. Autoscale_view doesn't do it, and ax.relim doesn't pick up the position of the annotations, so that doesn't seem to be an option. I've tried to do something like the code below, which loops over all the annotations (assuming they are in data coordinates) to get their extents and then updates the axes accordingly, but ideally I don't want my

matplotlib animated plot wont update labels on axis using blit

风格不统一 提交于 2019-11-30 15:00:53
问题 I am plotting data in a plot using wxPython where the data limits on the y- axis are changing with the data. I would like to change the axis dynamically without redrawing the whole canvas like canvas.draw() rather I'd like to use blitting for this as I do for the plot itself. What I got to work is the changing y-axis, and I get the yticks animated with the plot, unfortunately the ylabels are gone and I cant find the solution. The reason is setting the get_yaxis().set_animated(True) setting

How do I scale the x and y axes in mayavi2?

一曲冷凌霜 提交于 2019-11-30 13:27:36
I want to do a 3-d plot with mayavi2 using mayavi.mlab.surf(). This function has an argument called warp_scale that can be used to scale the z axis, I'm looking for something similar but for the x and y axes. I can do this manually by multiplying the x and y arrays and then using the ranges argument in mayavi.mlab.axes() to correct the axes labels, however I'm looking for a more direct approach like that of warp_scale. Thanks! when "m" is your surface object: m.actor.actor.scale = (0.1, 1.0, 1.0) http://osdir.com/ml/python.enthought.devel/2006-11/msg00067.html I was looking for the same

matplotlib animated plot wont update labels on axis using blit

£可爱£侵袭症+ 提交于 2019-11-30 13:10:05
I am plotting data in a plot using wxPython where the data limits on the y- axis are changing with the data. I would like to change the axis dynamically without redrawing the whole canvas like canvas.draw() rather I'd like to use blitting for this as I do for the plot itself. What I got to work is the changing y-axis, and I get the yticks animated with the plot, unfortunately the ylabels are gone and I cant find the solution. The reason is setting the get_yaxis().set_animated(True) setting for the axis. I put together a little working example in the following. What am I missing here? import

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

狂风中的少年 提交于 2019-11-30 12:33:26
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? 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); %# ...and delete it Alternatively, if you didn't save the handle in a variable, you can search for it using

Labelling logarithmic scale display in R

谁说胖子不能爱 提交于 2019-11-30 11:42:22
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? Joris Meys 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:10) plot(x,y,log="y") You can use the parameter log="x" for the X axis, or log="xy" for both. If

How do I let my matplotlib plot go beyond the axes?

狂风中的少年 提交于 2019-11-30 10:59:43
I have to translate an image plotting script from matlab to matplotlib/pylab, and I'm trying to achieve the same effect as the matlab image below: As you can see, the z order of the plots seem to be higher than the z order of the grid, so the markers are not hidden by the axes. However, I can't figure out a way to do the same with my matplotlib image: I'm wondering if it is possible to get the same display without having to increase the limits of the y axis. To get the marker to show beyond the axes you can turn the clipping off. This can be done using the keyword argument in the plot command