axes

how to fix axes position by using set_position method in python matplotlib?

…衆ロ難τιáo~ 提交于 2019-12-05 01:29:48
I think this is quite easy but I searched the internet and matplotlib users mailing list and not able to find an answer. ax2 is an inset axes within the "ax" axes in figure "fig", which I make by following here: http://matplotlib.sourceforge.net/examples/pylab_examples/axes_demo.html but now my problem is that I cannot fix the ax2 the exact position I want, it seems that draw() command change this: In [352]: ax2.set_position([0.125,0.63,0.25,0.25]) In [353]: ax2.get_position() Out[353]: Bbox(array([[ 0.125, 0.63 ], [ 0.375, 0.88 ]])) In [354]: draw() In [355]: ax2.get_position() Out[355]: Bbox

How to show x and y axes in a MATLAB graph?

时光怂恿深爱的人放手 提交于 2019-12-04 16:51:39
问题 I am drawing a graph using the plot() function, but by default it doesn't show the axes. How do we enable showing the axes at x=0 and y=0 on the graph? Actually my graph is something like: And I want a horizontal line corresponding to y=0 . How do I get that? 回答1: By default, plot does show axes, unless you've modified some settings. Try the following hold on; % make sure no new plot window is created on every plot command axes(); % produce plot window with axes plot(% whatever your plot

matplotlib: custom projection for hemisphere/wedge

梦想与她 提交于 2019-12-04 14:58:29
I'm looking at the custom projection example in the matplotlib gallery -- I'm trying to modify it to plot only the southern hemisphere. I have adjusted the necessary [-pi/2,pi/2] limits to [-pi/2,0]. Now I've been looking at: def _gen_axes_patch(self): """ Override this method to define the shape that is used for the background of the plot. It should be a subclass of Patch. In this case, it is a Circle (that may be warped by the axes transform into an ellipse). Any data and gridlines will be clipped to this shape. """ #return Circle((0.5, 0.5), 0.5) return Wedge((0.5,0.5), 0.5, 180, 360) def

TensorFlow 从入门到精通:tensorflow.nn 详解

不想你离开。 提交于 2019-12-04 11:48:36
看过前面的例子,会发现实现深度神经网络需要使用 tensorflow.nn 这个核心模块。我们通过源码来一探究竟。 1 # Copyright 2015 Google Inc. All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the

Python matplotlib -> 3D bar plot -> adjusting tick label position, transparent bars

吃可爱长大的小学妹 提交于 2019-12-04 09:39:11
问题 I am trying to create a 3D bar histogram in Python using bar3d() in Matplotlib. I have got to the point where I can display my histogram on the screen after passing it some data, but I am stuck on the following: Displaying axes labels correctly (currently misses out final (or initial?) tick labels) Either making the ticks on each axis (e.g. that for 'Mon') either point to it's corresponding blue bar, or position the tick label for between the major tick marks. Making the bars semi-transparent

Matplotlib pyplot axes formatter

断了今生、忘了曾经 提交于 2019-12-04 05:07:04
I have an image: Here in the y-axis I would like to get 5x10^-5 4x10^-5 and so on instead of 0.00005 0.00004 . What I have tried so far is: fig = plt.figure() ax = fig.add_subplot(111) y_formatter = matplotlib.ticker.ScalarFormatter(useOffset=True) ax.yaxis.set_major_formatter(y_formatter) ax.plot(m_plot,densities1,'-ro',label='0.0<z<0.5') ax.plot(m_plot,densities2, '-bo',label='0.5<z<1.0') ax.legend(loc='best',scatterpoints=1) plt.legend() plt.show() This does not seem to work. The document page for tickers does not seem to provide a direct answer. You can use matplotlib.ticker.FuncFormatter

make axes invisible or delete plot completely

非 Y 不嫁゛ 提交于 2019-12-04 03:38:39
问题 I have a matlab gui that shall contain 4 plots. The first plot shall be updated if a different file is selected in a list. the other 3 shall only be visible (and be calculated) on request. However I fail to make plots 2-4 invisible after they have been plotted once. I tried set(handles.axesImage, 'Visible', 'off'); but that only deletes the axis, not the whole plot. EDIT: Instead of making things unvisible, is it also possible to actually delele the content? Typically I would call close(hfig)

combining XPATH axes (preceding-sibling & following-sibling)

时光总嘲笑我的痴心妄想 提交于 2019-12-04 03:05:29
Say I have the following UL: <ul> <li>barry</li> <li>bob</li> <li>carl</li> <li>dave</li> <li>roger</li> <li>steve</li> </ul> I need to grab all the LIs between bob & roger. I can grab everything after bob with //ul/li[contains(.,"bob")]/following-sibling::li , and I can grab everything before roger with //ul/li[contains(.,"roger")]/preceding-sibling::li . The problem is when I try to combine the two, I end up getting extra results. For example, //ul/li[contains(.,"bob")]/following-sibling::li[contains(.,"roger")]/preceding-sibling::li will of course get everything before roger, instead of

Why won't the axes on my D3 SVG figure update?

怎甘沉沦 提交于 2019-12-04 02:35:39
问题 I have a simple D3 scatterplot that I switch among displaying several different attributes of my data, but while I can get the data points to change (and to transition as I want them to), and can change the labels to the figure's axes, I cannot get the axes themselves to update (let alone transition). I suspect I'm doing something in the wrong order, or am missing a step, but I can't figure out from the documentation or examples I'm working from what I'm missing. How do I get my axes to

Add legend outside of axes without rescaling in MATLAB

╄→гoц情女王★ 提交于 2019-12-04 01:30:53
I've got a GUI in MATLAB with a set of axes pre-placed. I'm using the location property of the legend to place it to the right hand side of the axes. However, by doing this the axes get re-scaled so that the axes+legend take up the original width of the axes. Is there any way to circumvent the re-size? Example: x=0:.1:10; y=sin(x); figure pos=get(gca,'position'); pos(3)=.5; %#re-size axes to leave room for legend set(gca,'position',pos) plot(x,y) So far I get: Place legend: legend('sin(x)','location','eastoutside') ...aaaaand... MATLAB squishes it all into the original axes space. Any way